65 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
66 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
67 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
68 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
69 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
70 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
71 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
72 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
73 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
74 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
75 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
76 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
77 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
78 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
79 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
80 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
104 std::map<GLuint, G4AttHolder*>::iterator i;
131 fpModel->GetModelingParameters();
132 if (!modelingParameters) {
166 if (!
fpScene->GetRefreshAtEndOfEvent()) {
171 static G4int lastEventID = 0;
172 if (thisEventID != lastEventID) {
174 lastEventID = thisEventID;
181 if (!
fpScene->GetRefreshAtEndOfRun()) {
185 static G4int lastRunID = 0;
186 if (thisRunID != lastRunID) {
188 lastRunID = thisRunID;
198 static G4int primitivesWaitingToBeFlushed = 0;
199 primitivesWaitingToBeFlushed++;
202 primitivesWaitingToBeFlushed = 0;
208 if (!
fpScene->GetRefreshAtEndOfEvent()) {
210 static G4int lastEventID = 0;
211 if (thisEventID != lastEventID) {
212 static G4int eventsWaitingToBeFlushed = 0;
213 eventsWaitingToBeFlushed++;
216 eventsWaitingToBeFlushed = 0;
217 lastEventID = thisEventID;
252 static G4int primitivesWaitingToBeFlushed = 0;
253 primitivesWaitingToBeFlushed++;
256 primitivesWaitingToBeFlushed = 0;
305 glClearColor (0.0, 0.0, 0.0, 0.0);
307 glDisable (GL_LINE_SMOOTH);
308 glDisable (GL_POLYGON_SMOOTH);
309 glDisable (GL_POINT_SMOOTH);
322 glClearColor (0.0, 0.0, 0.0, 0.0);
324 glDisable (GL_LINE_SMOOTH);
325 glDisable (GL_POLYGON_SMOOTH);
326 glDisable (GL_POINT_SMOOTH);
356 std::size_t nPoints = line.size ();
357 if (nPoints <= 0)
return;
361 glDisable (GL_LIGHTING);
372 glBegin (GL_LINE_STRIP);
377 for (std::size_t iPoint = 0; iPoint < nPoints; ++iPoint) {
379 x = line[iPoint].x();
380 y = line[iPoint].y();
381 z = line[iPoint].z();
382 glVertex3d (x, y, z);
389 if (polymarker.size() == 0) {
395 glDisable (GL_LIGHTING);
405 if (!pGLViewer)
return;
407 if (sizeType ==
world) {
414 static G4bool hashedWarned =
false;
418 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
419 glEdgeFlag (GL_TRUE);
424 G4cout <<
"Hashed fill style in G4OpenGLSceneHandler."
425 <<
"\n Not implemented. Using G4VMarker::filled."
433 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
440 if (sizeType ==
world) {
459 fpViewer -> GetViewParameters().GetViewpointDirection();
461 const G4double dPhi = twopi / nSides;
466 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
468 glBegin (GL_POLYGON);
469 for (i = 0, phi = startPhi; i < nSides; i++, phi += dPhi) {
472 glVertex3d (p.
x(), p.
y(), p.
z());
486 if (
fpViewer->GetViewParameters().IsDotsSmooth()) {
487 glEnable (GL_POINT_SMOOTH);
494 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
496 glVertex3d(centre.
x(),centre.
y(),centre.
z());
505 if (pGLViewer) pGLViewer->
DrawText(text);
535 if (!pGLViewer)
return;
545 GLfloat* painting_colour;
546 GLfloat clear_colour[4];
547 GLfloat current_colour[4];
548 glGetFloatv (GL_CURRENT_COLOR, current_colour);
550 G4bool isTransparent =
false;
551 if (current_colour[3] < 1.) {
552 isTransparent =
true;
557 glGetFloatv (GL_COLOR_CLEAR_VALUE, clear_colour);
558 painting_colour = clear_colour;
560 painting_colour = current_colour;
571 glDisable (GL_LIGHTING);
573 switch (drawing_style) {
577 glEnable (GL_STENCIL_TEST);
580 glStencilFunc (GL_ALWAYS, 0, 1);
581 glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
582 glEnable (GL_DEPTH_TEST);
583 glDepthFunc (GL_LEQUAL);
586 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
587 glEnable(GL_COLOR_MATERIAL);
589 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
593 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
594 glEnable(GL_COLOR_MATERIAL);
596 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
598 glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
599 glEnable(GL_COLOR_MATERIAL);
602 glPolygonMode (GL_FRONT, GL_LINE);
607 glEnable (GL_DEPTH_TEST);
608 glDepthFunc (GL_LEQUAL);
611 glDepthMask (GL_FALSE);
612 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
613 glEnable(GL_COLOR_MATERIAL);
615 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
618 glDepthMask (GL_TRUE);
620 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
621 glEnable(GL_COLOR_MATERIAL);
623 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
625 glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
626 glEnable(GL_COLOR_MATERIAL);
629 glPolygonMode (GL_FRONT, GL_FILL);
636 glEnable (GL_DEPTH_TEST);
637 glDepthFunc (GL_LEQUAL);
639 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
646 glEdgeFlag (GL_TRUE);
655 notLastFace = polyhedron.
GetNextFacet(nEdges, vertex, edgeFlag, normals);
658 for(
G4int edgeCount = 0; edgeCount < nEdges; ++edgeCount) {
660 if (isAuxEdgeVisible) {
661 edgeFlag[edgeCount] = 1;
663 if (edgeFlag[edgeCount] > 0) {
665 glEdgeFlag (GL_TRUE);
670 glEdgeFlag (GL_FALSE);
674 glNormal3d (normals[edgeCount].x(),
675 normals[edgeCount].y(),
676 normals[edgeCount].z());
677 glVertex3d (vertex[edgeCount].x(),
678 vertex[edgeCount].y(),
679 vertex[edgeCount].z());
686 normals[edgeCount] = normals[0];
687 vertex[edgeCount] = vertex[0];
688 edgeFlag[edgeCount] = -1;
690 glEdgeFlag (GL_FALSE);
694 glNormal3d (normals[edgeCount].x(),
695 normals[edgeCount].y(),
696 normals[edgeCount].z());
697 glVertex3d (vertex[edgeCount].x(),
698 vertex[edgeCount].y(),
699 vertex[edgeCount].z());
704 "G4OpenGLSceneHandler::AddPrimitive(G4Polyhedron): WARNING"
705 "\n G4Polyhedron facet with " << nEdges <<
" edges" <<
G4endl;
713 glDisable(GL_COLOR_MATERIAL);
721 glDisable (GL_LIGHTING);
724 glStencilFunc (GL_EQUAL, 0, 1);
725 glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
729 glEnable (GL_DEPTH_TEST);
730 glDepthFunc (GL_LEQUAL);
733 glDepthMask (GL_FALSE);
735 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
738 glDepthMask (GL_TRUE);
741 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
745 glPolygonMode (GL_FRONT, GL_FILL);
751 goto end_of_drawing_through_stencil;
756 glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, painting_colour);
759 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, painting_colour);
761 glColor4fv (painting_colour);
763 glEdgeFlag (GL_TRUE);
766 for (
int edgeCount = 0; edgeCount < 4; ++edgeCount) {
767 if (edgeFlag[edgeCount] > 0) {
769 glEdgeFlag (GL_TRUE);
774 glEdgeFlag (GL_FALSE);
778 glNormal3d (normals[edgeCount].x(),
779 normals[edgeCount].y(),
780 normals[edgeCount].z());
781 glVertex3d (vertex[edgeCount].x(),
782 vertex[edgeCount].y(),
783 vertex[edgeCount].z());
786 end_of_drawing_through_stencil:
789 glStencilFunc (GL_ALWAYS, 0, 1);
790 glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT);
791 glDepthFunc (GL_LEQUAL);
795 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
800 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
804 glPolygonMode (GL_FRONT, GL_LINE);
807 glDisable (GL_LIGHTING);
808 glColor4fv (current_colour);
811 glEdgeFlag (GL_TRUE);
813 for (
int edgeCount = 0; edgeCount < 4; ++edgeCount) {
814 if (edgeFlag[edgeCount] > 0) {
816 glEdgeFlag (GL_TRUE);
821 glEdgeFlag (GL_FALSE);
825 glNormal3d (normals[edgeCount].x(),
826 normals[edgeCount].y(),
827 normals[edgeCount].z());
828 glVertex3d (vertex[edgeCount].x(),
829 vertex[edgeCount].y(),
830 vertex[edgeCount].z());
834 glDepthFunc (GL_LEQUAL);
837 glEdgeFlag (GL_TRUE);
843 }
while (notLastFace);
846 glDisable (GL_STENCIL_TEST);
847 glDepthMask (GL_TRUE);
848 glDisable (GL_LIGHTING);
HepGeom::Normal3D< G4double > G4Normal3D
HepGeom::Point3D< G4double > G4Point3D
HepGeom::Vector3D< G4double > G4Vector3D
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4DisplacedSolid is a solid that has been shifted from its original frame of reference to a new one....
const G4Event * GetEvent() const
G4DisplacedSolid * CreateCutawaySolid()
virtual void EndPrimitives()
G4bool fThirdPassForNonHiddenMarkersRequested
void ClearAndDestroyAtts()
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)
G4bool fThirdPassForNonHiddenMarkers
static FlushAction fFlushAction
static G4int fEntitiesFlushInterval
void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
void AddPrimitive(const G4Polyline &)
void AddCompound(const G4VTrajectory &)
virtual void EndPrimitives2D()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
static const GLubyte fStippleMaskHashed[128]
G4bool fSecondPassForTransparency
virtual ~G4OpenGLSceneHandler()
G4DisplacedSolid * CreateSectionSolid()
G4OpenGLSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
friend class G4OpenGLViewer
std::map< GLuint, G4AttHolder * > fPickMap
G4bool fSecondPassForTransparencyRequested
void ChangeLineWidth(G4double width)
virtual void DrawText(const G4Text &)
void ChangePointSize(G4double size)
void SetMarkerType(MarkerType)
MarkerType GetMarkerType() const
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
FillStyle GetFillStyle() const
G4Point3D GetPosition() const
G4int GetNoOfSides(const G4VisAttributes *)
virtual void EndPrimitives()
virtual G4DisplacedSolid * CreateSectionSolid()
virtual void ProcessScene()
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
virtual void EndPrimitives2D()
const G4VisAttributes * fpVisAttribs
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation=G4Transform3D())
G4bool fReadyForTransients
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())
G4double GetLineWidth(const G4VisAttributes *)
virtual void ClearStore()
virtual void AddCompound(const G4VTrajectory &)
G4bool GetAuxEdgeVisible(const G4VisAttributes *)
void StandardSpecialMeshRendering(const G4Mesh &)
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
BasicVector3D< T > & rotate(T a, const BasicVector3D< T > &v)
G4int GetNoFacets() const
G4bool GetNextFacet(G4int &n, G4Point3D *nodes, G4int *edgeFlags=nullptr, G4Normal3D *normals=nullptr) const