Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
G4OpenGLStoredWin32Viewer Class Reference

#include <G4OpenGLStoredWin32Viewer.hh>

Inheritance diagram for G4OpenGLStoredWin32Viewer:
G4OpenGLWin32Viewer G4OpenGLStoredViewer G4OpenGLViewer G4OpenGLViewer G4VViewer G4VViewer

Public Member Functions

void ClearView ()
 
void ClearViewWithoutFlush ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
void DrawView ()
 
virtual bool exportImage (std::string name="", int width=-1, int height=-1)
 
void FinishView ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
 G4OpenGLStoredWin32Viewer (G4OpenGLStoredSceneHandler &scene, const G4String &name="")
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
const G4ViewParametersGetDefaultViewParameters () const
 
const G4StringGetName () const
 
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4StringGetShortName () const
 
G4int GetViewId () const
 
const G4ViewParametersGetViewParameters () const
 
void Initialise ()
 
void NeedKernelVisit ()
 
void ProcessView ()
 
void RefreshView ()
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
bool setExportImageFormat (std::string format, bool quiet=false)
 
void SetName (const G4String &)
 
void SetNeedKernelVisit (G4bool need)
 
void SetView ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void SetViewParameters (const G4ViewParameters &vp)
 
void ShowView ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 

Protected Member Functions

void addExportImageFormat (std::string format)
 
void AddPrimitiveForASingleFrame (const G4Circle &circle)
 
void AddPrimitiveForASingleFrame (const G4Text &text)
 
void ChangeLineWidth (G4double width)
 
void ChangePointSize (G4double size)
 
virtual G4bool CompareForKernelVisit (G4ViewParameters &)
 
virtual void CreateFontLists ()
 
void CreateGLWin32Context ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
virtual void CreateMainWindow ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
virtual void DisplayTimePOColourModification (G4Colour &, size_t)
 
void DrawDisplayLists ()
 
virtual void DrawText (const G4Text &)
 
void g4GlFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
void g4GlOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
void g4GluLookAt (GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz)
 
void g4GluPickMatrix (GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
 
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails (GLdouble x, GLdouble y)
 
std::string getRealPrintFilename ()
 
GLdouble getSceneDepth ()
 
GLdouble getSceneFarWidth ()
 
GLdouble getSceneNearWidth ()
 
void GetWin32Connection ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
unsigned int getWinHeight () const
 
unsigned int getWinWidth () const
 
void HaloingFirstPass ()
 
void HaloingSecondPass ()
 
void HLRFirstPass ()
 
void HLRSecondPass ()
 
void HLRThirdPass ()
 
void InitializeGLView ()
 
G4bool isFramebufferReady ()
 
G4bool isGl2psWriting ()
 
void KernelVisitDecision ()
 
virtual G4String Pick (GLdouble x, GLdouble y)
 
virtual G4bool POSelected (size_t)
 
void ResetView ()
 
void ResizeGLView ()
 
void ResizeWindow (unsigned int, unsigned int)
 
void rotateScene (G4double dx, G4double dy)
 
void rotateSceneToggle (G4double dx, G4double dy)
 
bool setExportFilename (G4String name, G4bool inc=true)
 
void setExportSize (G4int, G4int)
 
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
G4bool sizeHasChanged ()
 
virtual G4bool TOSelected (size_t)
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 

Protected Attributes

G4bool antialiasing_enabled
 
G4Colour background
 
std::string fDefaultExportImageFormat
 
G4ViewParameters fDefaultVP
 
G4bool fDepthTestEnable
 
int fExportFilenameIndex
 
std::string fExportImageFormat
 
std::vector< std::string > fExportImageFormatVector
 
G4OpenGLStoredSceneHandlerfG4OpenGLStoredSceneHandler
 
G4OpenGL2PSActionfGL2PSAction
 
HDC fHDC
 
G4ViewParameters fLastVP
 
G4bool fMouseHovered
 
G4bool fMousePressed
 
G4int fMousePressedX
 
G4int fMousePressedY
 
G4String fName
 
G4bool fNeedKernelVisit
 
G4Colour fOldDisplayListColor
 
G4OpenGLSceneHandlerfOpenGLSceneHandler
 
G4double fPan_sens
 
G4bool fPrintColour
 
G4int fPrintSizeX
 
G4int fPrintSizeY
 
G4double fRot_sens
 
G4VSceneHandlerfSceneHandler
 
G4String fShortName
 
G4bool fVectoredPs
 
G4int fViewId
 
G4ViewParameters fVP
 
unsigned int fWinSize_x
 
unsigned int fWinSize_y
 
G4bool haloing_enabled
 
G4bool transparency_enabled
 

Private Member Functions

G4int getRealExportHeight ()
 
G4int getRealExportWidth ()
 
GLubyte * grabPixels (int inColor, unsigned int width, unsigned int height)
 
bool printGl2PS ()
 
bool printNonVectoredEPS ()
 
bool printVectoredEPS ()
 
void ReleaseMouse ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void rotateSceneInViewDirection (G4double dx, G4double dy)
 
void rotateSceneThetaPhi (G4double dx, G4double dy)
 
void SetRotation (G4int, G4int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void SetShift (G4int, G4int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void SetZoom (G4int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
void TrackMouse (G4int, G4int)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 

Static Private Member Functions

static G4bool SetWindowPixelFormat (HDC)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 
static LRESULT CALLBACK WindowProc (HWND, UINT, WPARAM, LPARAM)
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// More...
 

Private Attributes

G4String fDefaultExportFilename
 
G4String fExportFilename
 
int fGl2psDefaultLineWith
 
int fGl2psDefaultPointSize
 
bool fGlViewInitialized
 
HGLRC fHGLRC
 
G4bool fInCreateWindow
 
bool fIsGettingPickInfos
 
G4float fPointSize
 
G4bool fSizeHasChanged
 
HWND fWindow
 

Detailed Description

Definition at line 41 of file G4OpenGLStoredWin32Viewer.hh.

Constructor & Destructor Documentation

◆ G4OpenGLStoredWin32Viewer()

G4OpenGLStoredWin32Viewer::G4OpenGLStoredWin32Viewer ( G4OpenGLStoredSceneHandler scene,
const G4String name = "" 
)

Definition at line 38 of file G4OpenGLStoredWin32Viewer.cc.

40 :
41G4OpenGLViewer (sceneHandler),
42G4OpenGLWin32Viewer (sceneHandler),
43G4OpenGLStoredViewer (sceneHandler),
44G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) {
45
46 if (fViewId < 0) return; // In case error in base class instantiation.
47}
G4OpenGLStoredViewer(G4OpenGLStoredSceneHandler &scene)
G4OpenGLViewer(G4OpenGLSceneHandler &scene)
G4OpenGLWin32Viewer(G4OpenGLSceneHandler &scene)
G4int fViewId
Definition: G4VViewer.hh:216
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition: G4VViewer.cc:46
const char * name(G4int ptype)

References G4VViewer::fViewId.

Member Function Documentation

◆ addExportImageFormat()

void G4OpenGLViewer::addExportImageFormat ( std::string  format)
protectedinherited

Definition at line 1288 of file G4OpenGLViewer.cc.

1288 {
1289 fExportImageFormatVector.push_back(format);
1290}
std::vector< std::string > fExportImageFormatVector

References G4OpenGLViewer::fExportImageFormatVector.

Referenced by G4OpenGLQtViewer::G4OpenGLQtViewer(), and G4OpenGLViewer::G4OpenGLViewer().

◆ AddPrimitiveForASingleFrame() [1/2]

void G4OpenGLStoredViewer::AddPrimitiveForASingleFrame ( const G4Circle circle)
protectedinherited

Definition at line 485 of file G4OpenGLStoredViewer.cc.

486{
487 // We don't want this to get into a display list or a TODL or a PODL so
488 // use the fMemoryForDisplayLists flag.
491 fG4OpenGLStoredSceneHandler.G4OpenGLStoredSceneHandler::AddPrimitive(circle);
492 fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists = memoryForDisplayListsKeep;
493}
bool G4bool
Definition: G4Types.hh:86
G4OpenGLStoredSceneHandler & fG4OpenGLStoredSceneHandler

References G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler, and G4OpenGLStoredSceneHandler::fMemoryForDisplayLists.

◆ AddPrimitiveForASingleFrame() [2/2]

void G4OpenGLStoredViewer::AddPrimitiveForASingleFrame ( const G4Text text)
protectedinherited

Definition at line 475 of file G4OpenGLStoredViewer.cc.

476{
477 // We don't want this to get into a display list or a TODL or a PODL so
478 // use the fMemoryForDisplayLists flag.
481 fG4OpenGLStoredSceneHandler.G4OpenGLStoredSceneHandler::AddPrimitive(text);
482 fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists = memoryForDisplayListsKeep;
483}

References G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler, and G4OpenGLStoredSceneHandler::fMemoryForDisplayLists.

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ ChangeLineWidth()

void G4OpenGLViewer::ChangeLineWidth ( G4double  width)
protectedinherited

Change LineSize on gl2ps if needed

Definition at line 810 of file G4OpenGLViewer.cc.

810 {
811
812 if (isGl2psWriting()) {
813 fGL2PSAction->setLineWidth(int(width));
814 } else {
815 glLineWidth (width);
816 }
817}
void setLineWidth(int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
G4OpenGL2PSAction * fGL2PSAction
G4bool isGl2psWriting()

References G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::isGl2psWriting(), and G4OpenGL2PSAction::setLineWidth().

Referenced by G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLViewer::HaloingFirstPass(), and G4OpenGLViewer::HaloingSecondPass().

◆ ChangePointSize()

void G4OpenGLViewer::ChangePointSize ( G4double  size)
protectedinherited

Change PointSize on gl2ps if needed

Definition at line 798 of file G4OpenGLViewer.cc.

798 {
799
800 if (isGl2psWriting()) {
801 fGL2PSAction->setPointSize(int(size));
802 } else {
803 glPointSize (size);
804 }
805}
void setPointSize(int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

References G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::isGl2psWriting(), and G4OpenGL2PSAction::setPointSize().

Referenced by G4OpenGLSceneHandler::AddPrimitive().

◆ ClearView()

void G4OpenGLViewer::ClearView ( void  )
virtualinherited

◆ ClearViewWithoutFlush()

void G4OpenGLViewer::ClearViewWithoutFlush ( )
inherited

Definition at line 214 of file G4OpenGLViewer.cc.

214 {
215 // Ready for clear ?
216 // See : http://lists.apple.com/archives/mac-opengl/2012/Jul/msg00038.html
217 if(!isFramebufferReady()) {
218 return;
219 }
220
221 glClearColor (background.GetRed(),
224 1.);
225 glClearDepth (1.0);
226 //Below line does not compile with Mesa includes.
227 //glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
228 glClear (GL_COLOR_BUFFER_BIT);
229 glClear (GL_DEPTH_BUFFER_BIT);
230 glClear (GL_STENCIL_BUFFER_BIT);
231}
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153

References G4OpenGLViewer::background, G4Colour::GetBlue(), G4Colour::GetGreen(), G4Colour::GetRed(), and G4OpenGLViewer::isFramebufferReady().

Referenced by G4OpenGLViewer::ClearView().

◆ CompareForKernelVisit()

G4bool G4OpenGLStoredViewer::CompareForKernelVisit ( G4ViewParameters lastVP)
protectedvirtualinherited

Reimplemented in G4OpenGLStoredQtViewer.

Definition at line 67 of file G4OpenGLStoredViewer.cc.

67 {
68
69 if (
70 (lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
72 (lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
73 (lastVP.IsCulling () != fVP.IsCulling ()) ||
74 (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
75 (lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
76 (lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
77 (lastVP.GetCBDAlgorithmNumber() !=
79 // Note: Section and Cutaway can reveal back-facing faces. If
80 // backface culling is implemented, the image can look strange because
81 // the back-facing faces are not there. For the moment, we have disabled
82 // (commented out) backface culling (it seems not to affect performance -
83 // in fact, performance seems to improve), so there is no problem.
84 (lastVP.IsSection () != fVP.IsSection ()) ||
85 // Section (DCUT) is NOT implemented locally so we need to visit the kernel.
86 // (lastVP.IsCutaway () != fVP.IsCutaway ()) ||
87 // Cutaways are implemented locally so we do not need to visit the kernel.
88 (lastVP.IsExplode () != fVP.IsExplode ()) ||
89 (lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
92 (lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
98 (lastVP.IsPicking () != fVP.IsPicking ()) ||
99 (lastVP.GetVisAttributesModifiers() !=
101 (lastVP.IsSpecialMeshRendering() !=
103 )
104 return true;
105
106 if (lastVP.IsDensityCulling () &&
107 (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
108 return true;
109
110// /**************************************************************
111// If section (DCUT) is implemented locally, comment this out.
112 if (lastVP.IsSection () &&
113 (lastVP.GetSectionPlane () != fVP.GetSectionPlane ()))
114 return true;
115// ***************************************************************/
116
117 /**************************************************************
118 If cutaways are implemented locally, comment this out.
119 if (lastVP.IsCutaway ()) {
120 if (lastVP.GetCutawayPlanes ().size () !=
121 fVP.GetCutawayPlanes ().size ()) return true;
122 for (size_t i = 0; i < lastVP.GetCutawayPlanes().size(); ++i)
123 if (lastVP.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
124 return true;
125 }
126 ***************************************************************/
127
128 if (lastVP.GetCBDAlgorithmNumber() > 0) {
129 if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
130 else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
131 }
132
133 if (lastVP.IsExplode () &&
134 (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
135 return true;
136
137 if (lastVP.IsSpecialMeshRendering() &&
139 return true;
140
141 // Time window parameters operate on the existing database so no need
142 // to rebuild even if they change.
143
144 return false;
145}
G4ViewParameters fVP
Definition: G4VViewer.hh:219
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() const
G4bool IsSpecialMeshRendering() const
G4double GetExplodeFactor() const
G4int GetNumberOfCloudPoints() const
G4bool IsMarkerNotHidden() const
G4double GetGlobalLineWidthScale() const
const G4Colour & GetBackgroundColour() const
G4bool IsSection() const
G4bool IsPicking() const
G4bool IsCulling() const
const G4VisAttributes * GetDefaultTextVisAttributes() const
G4bool IsExplode() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() const
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes() const
G4double GetGlobalMarkerScale() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
G4bool IsCullingCovered() const
const G4Plane3D & GetSectionPlane() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const
const G4Colour & GetColour() const

References G4VViewer::fVP, G4ViewParameters::GetBackgroundColour(), G4ViewParameters::GetCBDAlgorithmNumber(), G4ViewParameters::GetCBDParameters(), G4VisAttributes::GetColour(), G4ViewParameters::GetDefaultTextVisAttributes(), G4ViewParameters::GetDefaultVisAttributes(), G4ViewParameters::GetDrawingStyle(), G4ViewParameters::GetExplodeFactor(), G4ViewParameters::GetGlobalLineWidthScale(), G4ViewParameters::GetGlobalMarkerScale(), G4ViewParameters::GetNoOfSides(), G4ViewParameters::GetNumberOfCloudPoints(), G4ViewParameters::GetSectionPlane(), G4ViewParameters::GetSpecialMeshVolumes(), G4ViewParameters::GetVisAttributesModifiers(), G4ViewParameters::GetVisibleDensity(), G4ViewParameters::IsAuxEdgeVisible(), G4ViewParameters::IsCulling(), G4ViewParameters::IsCullingCovered(), G4ViewParameters::IsCullingInvisible(), G4ViewParameters::IsDensityCulling(), G4ViewParameters::IsExplode(), G4ViewParameters::IsMarkerNotHidden(), G4ViewParameters::IsPicking(), G4ViewParameters::IsSection(), and G4ViewParameters::IsSpecialMeshRendering().

Referenced by G4OpenGLStoredViewer::KernelVisitDecision().

◆ ComputeFlyThrough()

std::vector< G4ThreeVector > G4VViewer::ComputeFlyThrough ( G4Vector3D )
inherited

Definition at line 215 of file G4VViewer.cc.

216{
217 enum CurveType {
218 Bezier,
219 G4SplineTest};
220
221 // Choose a curve type (for testing)
222// int myCurveType = Bezier;
223
224 // number if step points
225 int stepPoints = 500;
226
227
228 G4Spline spline;
229
230
231 // At the moment we don't use the aVect parameters, but build it here :
232 // Good step points for exampleB5
233 spline.AddSplinePoint(G4Vector3D(0,1000,-14000));
234 spline.AddSplinePoint(G4Vector3D(0,1000,0));
235 spline.AddSplinePoint(G4Vector3D(-4000,1000,4000));
236
237
238 std::vector <G4ThreeVector> viewVect;
239
240// if(myCurveType == Bezier) {
241
242
243 // Draw the spline
244
245 for (int i = 0; i < stepPoints; i++) {
246 float t = (float)i / (float)stepPoints;
247 G4Vector3D cameraPosition = spline.GetInterpolatedSplinePoint(t);
248 // G4Vector3D targetPoint = spline.GetInterpolatedSplinePoint(t);
249
250 // viewParam->SetViewAndLights(G4ThreeVector (cameraPosition.x(), cameraPosition.y(), cameraPosition.z()));
251 // viewParam->SetCurrentTargetPoint(targetPoint);
252 G4cout << "FLY CR("<< i << "):" << cameraPosition << G4endl;
253 viewVect.push_back(G4ThreeVector (cameraPosition.x(), cameraPosition.y(), cameraPosition.z()));
254 }
255
256// } else if (myCurveType == G4SplineTest) {
257 /*
258 This method is a inspire from a Bezier curve. The problem of the Bezier curve is that the path does not go straight between two waypoints.
259 This method add "stay straight" parameter which could be between 0 and 1 where the pass will follow exactly the line between the waypoints
260 Ex : stay straight = 50%
261 m1 = 3*(P1+P0)/2
262
263 Ex : stay straight = 0%
264 m1 = (P1+P0)/2
265
266 P1
267 / \
268 / \
269 a--x--b
270 / ° ° \
271 / ° ° \
272 m1 m2
273 / \
274 / \
275 / \
276 / \
277 P0 P2
278
279 */
280// G4Vector3D a;
281// G4Vector3D b;
282// G4Vector3D m1;
283// G4Vector3D m2;
284// G4Vector3D P0;
285// G4Vector3D P1;
286// G4Vector3D P2;
287// G4double stayStraight = 0;
288// G4double bezierSpeed = 0.4; // Spend 40% time in bezier curve (time between m1-m2 is 40% of time between P0-P1)
289//
290// G4Vector3D firstPoint;
291// G4Vector3D lastPoint;
292//
293// float nbBezierSteps = (stepPoints * bezierSpeed*(1-stayStraight)) * (2./spline.GetNumPoints());
294// float nbFirstSteps = ((stepPoints/2-nbBezierSteps/2) /(1+stayStraight)) * (2./spline.GetNumPoints());
295//
296// // First points
297// firstPoint = spline.GetPoint(0);
298// lastPoint = (firstPoint + spline.GetPoint(1))/2;
299//
300// for( float j=0; j<1; j+= 1/nbFirstSteps) {
301// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint) * j;
302// viewVect.push_back(pt);
303// G4cout << "FLY Bezier A1("<< viewVect.size()<< "):" << pt << G4endl;
304// }
305//
306// for (int i = 0; i < spline.GetNumPoints()-2; i++) {
307// P0 = spline.GetPoint(i);
308// P1 = spline.GetPoint(i+1);
309// P2 = spline.GetPoint(i+2);
310//
311// m1 = P1 - (P1-P0)*(1-stayStraight)/2;
312// m2 = P1 + (P2-P1)*(1-stayStraight)/2;
313//
314// // We have to get straight path from (middile of P0-P1) to (middile of P0-P1 + (dist P0-P1) * stayStraight/2)
315// if (stayStraight >0) {
316//
317// firstPoint = (P0 + P1)/2;
318// lastPoint = (P0 + P1)/2 + (P1-P0)*stayStraight/2;
319//
320// for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
321// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
322// viewVect.push_back(pt);
323// G4cout << "FLY Bezier A2("<< viewVect.size()<< "):" << pt << G4endl;
324// }
325// }
326// // Compute Bezier curve
327// for( float delta = 0 ; delta < 1 ; delta += 1/nbBezierSteps)
328// {
329// // The Green Line
330// a = m1 + ( (P1 - m1) * delta );
331// b = P1 + ( (m2 - P1) * delta );
332//
333// // Final point
334// G4ThreeVector pt = a + ((b-a) * delta );
335// viewVect.push_back(pt);
336// G4cout << "FLY Bezier("<< viewVect.size()<< "):" << pt << G4endl;
337// }
338//
339// // We have to get straight path
340// if (stayStraight >0) {
341// firstPoint = (P1 + P2)/2 - (P2-P1)*stayStraight/2;
342// lastPoint = (P1 + P2)/2;
343//
344// for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
345// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
346// viewVect.push_back(pt);
347// G4cout << "FLY Bezier B1("<< viewVect.size()<< "):" << pt << G4endl;
348// }
349// }
350// }
351//
352// // last points
353// firstPoint = spline.GetPoint(spline.GetNumPoints()-2);
354// lastPoint = spline.GetPoint(spline.GetNumPoints()-1);
355// for( float j=1; j>0; j-= 1/nbFirstSteps) {
356// G4ThreeVector pt = lastPoint - ((lastPoint-firstPoint)*((1-stayStraight)/2) * j );
357// viewVect.push_back(pt);
358// G4cout << "FLY Bezier B2("<< viewVect.size()<< "):" << pt << G4endl;
359// }
360// }
361 return viewVect;
362}
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:34
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

References G4VViewer::G4Spline::AddSplinePoint(), G4cout, G4endl, G4VViewer::G4Spline::GetInterpolatedSplinePoint(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ CreateFontLists()

virtual void G4OpenGLViewer::CreateFontLists ( )
inlineprotectedvirtualinherited

◆ CreateGLWin32Context()

void G4OpenGLWin32Viewer::CreateGLWin32Context ( )
protectedinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 83 of file G4OpenGLWin32Viewer.cc.

87{
88}

Referenced by G4OpenGLImmediateWin32Viewer::Initialise(), and Initialise().

◆ CreateMainWindow()

void G4OpenGLWin32Viewer::CreateMainWindow ( )
protectedvirtualinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 91 of file G4OpenGLWin32Viewer.cc.

95{
96 if(fWindow) return; //Done.
97
98 // Bill Gates stuff...
99 static const char className[] = "G4OpenGLWin32";
100 static G4bool done = false;
101 if(done==false) {
102 WNDCLASS wc;
103 wc.style = CS_HREDRAW | CS_VREDRAW;
104 wc.lpfnWndProc = (WNDPROC)WindowProc;
105 wc.cbClsExtra = 0;
106 wc.cbWndExtra = 0;
107 wc.hInstance = ::GetModuleHandle(NULL);
108 wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
109 wc.hCursor = LoadCursor(NULL,IDC_CROSS);
110 wc.hbrBackground = NULL;
111 wc.lpszMenuName = className;
112 wc.lpszClassName = className;
113 ::RegisterClass(&wc);
114 done = true;
115 }
116
118
119 G4int x_res=GetSystemMetrics(SM_CXSCREEN);
120 G4int y_res=GetSystemMetrics(SM_CYSCREEN);
121
122 //FIXME : NOT tested !
123 fWindow = ::CreateWindowEx(0, className,fName.c_str(),
124 WS_OVERLAPPEDWINDOW,
125 //WS_CHILD | WS_VISIBLE,
126 // 0,0,
130 NULL, NULL,
131 ::GetModuleHandle(NULL),
132 NULL);
133 if(!fWindow) return;
134
135 ::SetWindowLongPtr(fWindow,GWLP_USERDATA,LONG_PTR(this));
136
137 // initialize OpenGL rendering :
138 fHDC = ::GetDC(fWindow);
139 if( fHDC && (SetWindowPixelFormat(fHDC)==TRUE) ) {
140 fHGLRC = ::wglCreateContext(fHDC);
141 }
142
143 if(fHDC && fHGLRC) {
144 ::wglMakeCurrent(fHDC,fHGLRC);
145 }
146
147 //G.Barrand : avoid to indirectly pass in
148 // WindowProc/[WM_SIZE,WM_PAINT]/This->DrawView()
149 // from this method. Else we have crash.
150 fInCreateWindow = true;
151
152 ::SetForegroundWindow(fWindow);
153 ::ShowWindow(fWindow,SW_SHOWDEFAULT);
154 ::UpdateWindow(fWindow);
155 ::DrawMenuBar(fWindow);
156
157 fInCreateWindow = false;
158}
int G4int
Definition: G4Types.hh:85
static char className[]
Definition: G4Win32.cc:36
#define TRUE
Definition: Globals.hh:27
unsigned int getWinHeight() const
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
static LRESULT CALLBACK WindowProc(HWND, UINT, WPARAM, LPARAM)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
static G4bool SetWindowPixelFormat(HDC)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
G4String fName
Definition: G4VViewer.hh:217
G4int GetWindowAbsoluteLocationHintY(G4int) const
unsigned int GetWindowSizeHintX() const
G4int GetWindowAbsoluteLocationHintX(G4int) const
unsigned int GetWindowSizeHintY() const

References className, G4OpenGLWin32Viewer::fHDC, G4OpenGLWin32Viewer::fHGLRC, G4OpenGLWin32Viewer::fInCreateWindow, G4VViewer::fName, G4VViewer::fVP, G4OpenGLWin32Viewer::fWindow, G4ViewParameters::GetWindowAbsoluteLocationHintX(), G4ViewParameters::GetWindowAbsoluteLocationHintY(), G4ViewParameters::GetWindowSizeHintX(), G4ViewParameters::GetWindowSizeHintY(), G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), G4OpenGLViewer::ResizeWindow(), G4OpenGLWin32Viewer::SetWindowPixelFormat(), TRUE, and G4OpenGLWin32Viewer::WindowProc().

Referenced by G4OpenGLImmediateWin32Viewer::Initialise(), and Initialise().

◆ DisplayTimePOColourModification()

virtual void G4OpenGLStoredViewer::DisplayTimePOColourModification ( G4Colour ,
size_t   
)
inlineprotectedvirtualinherited

Reimplemented in G4OpenGLStoredQtViewer.

Definition at line 56 of file G4OpenGLStoredViewer.hh.

57{}

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ DrawDisplayLists()

void G4OpenGLStoredViewer::DrawDisplayLists ( )
protectedinherited

Definition at line 147 of file G4OpenGLStoredViewer.cc.

147 {
148
149 // We moved these from G4OpenGLViewer to G4ViewParamaters. To avoid
150 // editing many lines below we introduce these convenient aliases.
151#define CONVENIENT_DOUBLE_ALIAS(q) const G4double& f##q = fVP.Get##q();
152#define CONVENIENT_BOOL_ALIAS(q) const G4bool& f##q = fVP.Is##q();
153 CONVENIENT_DOUBLE_ALIAS(StartTime)
155 CONVENIENT_DOUBLE_ALIAS(FadeFactor)
156 CONVENIENT_BOOL_ALIAS(DisplayHeadTime)
157 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeX)
158 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeY)
159 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeSize)
160 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeRed)
161 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeGreen)
162 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeBlue)
163 CONVENIENT_BOOL_ALIAS(DisplayLightFront)
164 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontX)
165 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontY)
166 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontZ)
167 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontT)
168 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontRed)
169 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontGreen)
170 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontBlue)
171
172 const G4Planes& cutaways = fVP.GetCutawayPlanes();
173 G4bool cutawayUnion = fVP.IsCutaway() &&
175 const size_t nCutaways = cutawayUnion? cutaways.size(): 1;
176 G4int iPass = 1;
177 G4bool secondPassForTransparencyRequested = false;
178 G4bool thirdPassForNonHiddenMarkersRequested = false;
179 fDepthTestEnable = true;
180 glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LEQUAL);
181 do {
182 for (size_t iCutaway = 0; iCutaway < nCutaways; ++iCutaway) {
183
184 if (cutawayUnion) {
185 double a[4];
186 a[0] = cutaways[iCutaway].a();
187 a[1] = cutaways[iCutaway].b();
188 a[2] = cutaways[iCutaway].c();
189 a[3] = cutaways[iCutaway].d();
190 glClipPlane (GL_CLIP_PLANE2, a);
191 glEnable (GL_CLIP_PLANE2);
192 }
193
194 G4bool isPicking = fVP.IsPicking();
195
196 for (size_t iPO = 0;
197 iPO < fG4OpenGLStoredSceneHandler.fPOList.size(); ++iPO) {
198 if (POSelected(iPO)) {
201 G4Colour c = po.fColour;
203 const G4bool isTransparent = c.GetAlpha() < 1.;
204 if ( iPass == 1) {
205 if (isTransparent && transparency_enabled) {
206 secondPassForTransparencyRequested = true;
207 continue;
208 }
210 thirdPassForNonHiddenMarkersRequested = true;
211 continue;
212 }
213 } else if (iPass == 2) { // Second pass for transparency.
214 if (!isTransparent) {
215 continue;
216 }
217 } else { // Third pass for non-hidden markers
218 if (!po.fMarkerOrPolyline) {
219 continue;
220 }
221 }
222 if (isPicking) glLoadName(po.fPickName);
224 glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha());
225 } else {
226 glColor3d(c.GetRed(),c.GetGreen(),c.GetBlue());
227 }
229 if (fDepthTestEnable !=false) {
230 glDisable (GL_DEPTH_TEST);
231 fDepthTestEnable = false;
232 }
233 } else {
234 if (fDepthTestEnable !=true) {
235 glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LEQUAL);
236 fDepthTestEnable = true;
237 }
238 }
239 if (po.fpG4TextPlus) {
240 if (po.fpG4TextPlus->fProcessing2D) {
241 glMatrixMode (GL_PROJECTION);
242 glPushMatrix();
243 glLoadIdentity();
244 g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
245 glMatrixMode (GL_MODELVIEW);
246 glPushMatrix();
247 glLoadIdentity();
249 glMultMatrixd (oglt.GetGLMatrix ());
250 // This text is from a PODL. We don't want to create a new PODL.
252 } else {
253 glPushMatrix();
255 glMultMatrixd (oglt.GetGLMatrix ());
256 // This text is from a PODL. We don't want to create a new PODL.
258 glPopMatrix();
259 }
260
261 if (po.fpG4TextPlus->fProcessing2D) {
262 glMatrixMode (GL_PROJECTION);
263 glPopMatrix();
264 glMatrixMode (GL_MODELVIEW);
265 glPopMatrix();
266 }
267 } else {
268 glPushMatrix();
270 glMultMatrixd (oglt.GetGLMatrix ());
271 glCallList (po.fDisplayListId);
272 glPopMatrix();
273 }
274 }
275 }
276
277 G4Transform3D lastMatrixTransform;
278 G4bool first = true;
279
280 for (size_t iTO = 0;
281 iTO < fG4OpenGLStoredSceneHandler.fTOList.size(); ++iTO) {
282 if (TOSelected(iTO)) {
285 const G4Colour& c = to.fColour;
286 const G4bool isTransparent = c.GetAlpha() < 1.;
287 if ( iPass == 1) {
288 if (isTransparent && transparency_enabled) {
289 secondPassForTransparencyRequested = true;
290 continue;
291 }
293 thirdPassForNonHiddenMarkersRequested = true;
294 continue;
295 }
296 } else if (iPass == 2) { // Second pass for transparency.
297 if (!isTransparent) {
298 continue;
299 }
300 } else { // Third pass for non-hidden markers
301 if (!to.fMarkerOrPolyline) {
302 continue;
303 }
304 }
306 if (fDepthTestEnable !=false) {
307 glDisable (GL_DEPTH_TEST);
308 fDepthTestEnable = false;
309 }
310 } else {
311 if (fDepthTestEnable !=true) {
312 glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LEQUAL);
313 fDepthTestEnable = true;
314 }
315 }
316 if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) {
317 if (fVP.IsPicking()) glLoadName(to.fPickName);
318 if (to.fpG4TextPlus) {
319 if (to.fpG4TextPlus->fProcessing2D) {
320 glMatrixMode (GL_PROJECTION);
321 glPushMatrix();
322 glLoadIdentity();
323 g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
324 glMatrixMode (GL_MODELVIEW);
325 glPushMatrix();
326 glLoadIdentity();
327 }
329 glMultMatrixd (oglt.GetGLMatrix ());
330 // This text is from a TODL. We don't want to create a new TODL.
332 if (to.fpG4TextPlus->fProcessing2D) {
333 glMatrixMode (GL_PROJECTION);
334 glPopMatrix();
335 glMatrixMode (GL_MODELVIEW);
336 glPopMatrix();
337 }
338 } else {
339 if (to.fTransform != lastMatrixTransform) {
340 if (! first) {
341 glPopMatrix();
342 }
343 first = false;
344 glPushMatrix();
346 glMultMatrixd (oglt.GetGLMatrix ());
347 }
348 const G4Colour& cc = to.fColour;
349 if (fFadeFactor > 0. && to.fEndTime < fEndTime) {
350 // Brightness scaling factor
351 G4double bsf = 1. - fFadeFactor *
352 ((fEndTime - to.fEndTime) / (fEndTime - fStartTime));
353 const G4Colour& bg = fVP.GetBackgroundColour();
355 glColor4d
356 (bsf * cc.GetRed() + (1. - bsf) * bg.GetRed(),
357 bsf * cc.GetGreen() + (1. - bsf) * bg.GetGreen(),
358 bsf * cc.GetBlue() + (1. - bsf) * bg.GetBlue(),
359 bsf * cc.GetAlpha() + (1. - bsf) * bg.GetAlpha());
360 } else {
361 glColor3d
362 (bsf * cc.GetRed() + (1. - bsf) * bg.GetRed(),
363 bsf * cc.GetGreen() + (1. - bsf) * bg.GetGreen(),
364 bsf * cc.GetBlue() + (1. - bsf) * bg.GetBlue());
365 }
366 } else {
368 glColor4d(cc.GetRed(),cc.GetGreen(),cc.GetBlue(),cc.GetAlpha());
369 } else {
370 glColor3d(cc.GetRed(),cc.GetGreen(),cc.GetBlue());
371 }
372 }
373 glCallList (to.fDisplayListId);
374 }
375 if (to.fTransform != lastMatrixTransform) {
376 lastMatrixTransform = to.fTransform;
377 }
378 }
379 }
380 }
381 if (! first) {
382 glPopMatrix();
383 }
384
385 if (cutawayUnion) glDisable (GL_CLIP_PLANE2);
386 } // iCutaway
387
388 if (iPass == 2) secondPassForTransparencyRequested = false; // Done.
389 if (iPass == 3) thirdPassForNonHiddenMarkersRequested = false; // Done.
390
391 if (secondPassForTransparencyRequested) iPass = 2;
392 else if (thirdPassForNonHiddenMarkersRequested) iPass = 3;
393 else break;
394
395 } while (true);
396
397 // Display time at "head" of time range, which is fEndTime...
398 if (fDisplayHeadTime && fEndTime < G4VisAttributes::fVeryLongTime) {
399 glMatrixMode (GL_PROJECTION);
400 glPushMatrix();
401 glLoadIdentity();
402 g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
403 glMatrixMode (GL_MODELVIEW);
404 glPushMatrix();
405 glLoadIdentity();
406 G4Text headTimeText(G4BestUnit(fEndTime,"Time"),
407 G4Point3D(fDisplayHeadTimeX, fDisplayHeadTimeY, 0.));
408 headTimeText.SetScreenSize(fDisplayHeadTimeSize);
410 (fDisplayHeadTimeRed,
411 fDisplayHeadTimeGreen,
412 fDisplayHeadTimeBlue));
413 headTimeText.SetVisAttributes(&visAtts);
414 AddPrimitiveForASingleFrame(headTimeText);
415 glMatrixMode (GL_PROJECTION);
416 glPopMatrix();
417 glMatrixMode (GL_MODELVIEW);
418 glPopMatrix();
419 }
420
421 // Display light front...
422 if (fDisplayLightFront && fEndTime < G4VisAttributes::fVeryLongTime) {
423 G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
424 if (lightFrontRadius > 0.) {
425 G4Point3D lightFrontCentre(fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ);
426 G4Point3D circleCentre = lightFrontCentre;
427 G4double circleRadius = lightFrontRadius;
428 if (fVP.GetFieldHalfAngle() > 0.) {
429 // Perspective view. Find horizon centre and radius...
433 if(sceneRadius <= 0.) sceneRadius = 1.;
434 G4double cameraDistance = fVP.GetCameraDistance(sceneRadius);
435 G4Point3D cameraPosition = targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
436 G4Vector3D lightFrontToCameraDirection = cameraPosition - lightFrontCentre;
437 G4double lightFrontCentreDistance = lightFrontToCameraDirection.mag();
438 /*
439 G4cout << "cameraPosition: " << cameraPosition
440 << ", lightFrontCentre: " << lightFrontCentre
441 << ", lightFrontRadius: " << lightFrontRadius
442 << ", lightFrontCentreDistance: " << lightFrontCentreDistance
443 << ", dot: " << lightFrontToCameraDirection * fVP.GetViewpointDirection()
444 << G4endl;
445 */
446 if (lightFrontToCameraDirection * fVP.GetViewpointDirection() > 0. && lightFrontRadius < lightFrontCentreDistance) {
447 // Light front in front of camera...
448 G4double sineHorizonAngle = lightFrontRadius / lightFrontCentreDistance;
449 circleCentre = lightFrontCentre + (lightFrontRadius * sineHorizonAngle) * lightFrontToCameraDirection.unit();
450 circleRadius = lightFrontRadius * std::sqrt(1. - std::pow(sineHorizonAngle, 2));
451 /*
452 G4cout << "sineHorizonAngle: " << sineHorizonAngle
453 << ", circleCentre: " << circleCentre
454 << ", circleRadius: " << circleRadius
455 << G4endl;
456 */
457 } else {
458 circleRadius = -1.;
459 }
460 }
461 if (circleRadius > 0.) {
462 G4Circle lightFront(circleCentre);
463 lightFront.SetWorldRadius(circleRadius);
465 (fDisplayLightFrontRed,
466 fDisplayLightFrontGreen,
467 fDisplayLightFrontBlue));
468 lightFront.SetVisAttributes(visAtts);
469 AddPrimitiveForASingleFrame(lightFront);
470 }
471 }
472 }
473}
#define CONVENIENT_BOOL_ALIAS(q)
#define CONVENIENT_DOUBLE_ALIAS(q)
#define G4OPENGL_FLT_BIG
Definition: G4OpenGL.hh:89
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
#define G4BestUnit(a, b)
double G4double
Definition: G4Types.hh:83
std::vector< G4Plane3D > G4Planes
G4double GetAlpha() const
Definition: G4Colour.hh:155
virtual G4bool TOSelected(size_t)
virtual G4bool POSelected(size_t)
virtual void DisplayTimePOColourModification(G4Colour &, size_t)
void AddPrimitiveForASingleFrame(const G4Text &text)
G4bool transparency_enabled
void g4GlOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
Definition: G4Text.hh:72
G4Scene * GetScene() const
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:215
CutawayMode GetCutawayMode() const
G4double GetCameraDistance(G4double radius) const
G4bool IsCutaway() const
const G4Vector3D & GetViewpointDirection() const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFieldHalfAngle() const
const G4Planes & GetCutawayPlanes() const
static constexpr G4double fVeryLongTime
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
BasicVector3D< T > unit() const
float c_light
Definition: hepunit.py:256

References G4OpenGLStoredViewer::AddPrimitiveForASingleFrame(), source.hepunit::c_light, CONVENIENT_BOOL_ALIAS, CONVENIENT_DOUBLE_ALIAS, G4ViewParameters::cutawayUnion, G4OpenGLStoredViewer::DisplayTimePOColourModification(), G4OpenGLStoredSceneHandler::PO::fColour, G4OpenGLStoredSceneHandler::TO::fColour, G4OpenGLStoredViewer::fDepthTestEnable, G4OpenGLStoredSceneHandler::PO::fDisplayListId, G4OpenGLStoredSceneHandler::TO::fDisplayListId, G4OpenGLStoredSceneHandler::TO::fEndTime, G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler, G4OpenGLStoredSceneHandler::G4TextPlus::fG4Text, G4OpenGLStoredSceneHandler::PO::fMarkerOrPolyline, G4OpenGLStoredSceneHandler::TO::fMarkerOrPolyline, G4OpenGLStoredSceneHandler::PO::fpG4TextPlus, G4OpenGLStoredSceneHandler::TO::fpG4TextPlus, G4OpenGLStoredSceneHandler::PO::fPickName, G4OpenGLStoredSceneHandler::TO::fPickName, G4OpenGLStoredSceneHandler::fPOList, G4OpenGLStoredSceneHandler::G4TextPlus::fProcessing2D, G4VViewer::fSceneHandler, G4OpenGLStoredSceneHandler::TO::fStartTime, G4OpenGLStoredSceneHandler::fTOList, G4OpenGLStoredSceneHandler::PO::fTransform, G4OpenGLStoredSceneHandler::TO::fTransform, G4VisAttributes::fVeryLongTime, G4VViewer::fVP, G4BestUnit, G4OpenGLViewer::g4GlOrtho(), G4OPENGL_FLT_BIG, G4Colour::GetAlpha(), G4ViewParameters::GetBackgroundColour(), G4Colour::GetBlue(), G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4ViewParameters::GetCutawayMode(), G4ViewParameters::GetCutawayPlanes(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFieldHalfAngle(), G4OpenGLTransform3D::GetGLMatrix(), G4Colour::GetGreen(), G4Colour::GetRed(), G4VSceneHandler::GetScene(), G4Scene::GetStandardTargetPoint(), G4ViewParameters::GetViewpointDirection(), G4ViewParameters::IsCutaway(), G4ViewParameters::IsMarkerNotHidden(), G4ViewParameters::IsPicking(), HepGeom::BasicVector3D< T >::mag(), G4OpenGLStoredViewer::POSelected(), G4VMarker::SetScreenSize(), G4Visible::SetVisAttributes(), G4VMarker::SetWorldRadius(), G4OpenGLStoredViewer::TOSelected(), G4OpenGLViewer::transparency_enabled, and HepGeom::BasicVector3D< T >::unit().

Referenced by G4OpenGLStoredQtViewer::ComputeView(), DrawView(), G4OpenGLStoredXmViewer::DrawView(), and G4OpenGLStoredXViewer::DrawView().

◆ DrawText()

void G4OpenGLViewer::DrawText ( const G4Text g4text)
protectedvirtualinherited

Reimplemented in G4OpenGLQtViewer, and G4OpenGLXViewer.

Definition at line 758 of file G4OpenGLViewer.cc.

759{
760 // gl2ps or GL window ?
761 if (isGl2psWriting()) {
762
764 G4double size = fSceneHandler.GetMarkerSize(g4text,sizeType);
765 G4Point3D position = g4text.GetPosition();
766
767 G4String textString = g4text.GetText();
768
769 glRasterPos3d(position.x(),position.y(),position.z());
770 GLint align = GL2PS_TEXT_B;
771
772 switch (g4text.GetLayout()) {
773 case G4Text::left: align = GL2PS_TEXT_BL; break;
774 case G4Text::centre: align = GL2PS_TEXT_B; break;
775 case G4Text::right: align = GL2PS_TEXT_BR;
776 }
777
778 gl2psTextOpt(textString.c_str(),"Times-Roman",GLshort(size),align,0);
779
780 } else {
781
782 static G4int callCount = 0;
783 ++callCount;
784 //if (callCount <= 10 || callCount%100 == 0) {
785 if (callCount <= 1) {
786 G4cout <<
787 "G4OpenGLViewer::DrawText: Not implemented for \""
788 << fName <<
789 "\"\n Called with "
790 << g4text
791 << G4endl;
792 }
793 }
794}
#define gl2psTextOpt
Definition: Geant4_gl2ps.h:44
Layout GetLayout() const
G4String GetText() const
@ centre
Definition: G4Text.hh:76
@ right
Definition: G4Text.hh:76
@ left
Definition: G4Text.hh:76
G4Point3D GetPosition() const
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
#define GL2PS_TEXT_BL
Definition: gl2ps.h:198
#define GL2PS_TEXT_BR
Definition: gl2ps.h:199
#define GL2PS_TEXT_B
Definition: gl2ps.h:197

References G4Text::centre, G4VViewer::fName, G4VViewer::fSceneHandler, G4cout, G4endl, G4Text::GetLayout(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4Text::GetText(), GL2PS_TEXT_B, GL2PS_TEXT_BL, GL2PS_TEXT_BR, gl2psTextOpt, G4OpenGLViewer::isGl2psWriting(), G4Text::left, and G4Text::right.

Referenced by G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLQtViewer::DrawText(), and G4OpenGLXViewer::DrawText().

◆ DrawView()

void G4OpenGLStoredWin32Viewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 65 of file G4OpenGLStoredWin32Viewer.cc.

65 {
66
67 glViewport (0, 0, getWinWidth(), getWinHeight());
68
70
71 //See if things have changed from last time and remake if necessary...
72 // The fNeedKernelVisit flag might have been set by the user in
73 // /vis/viewer/rebuild, but if not, make decision and set flag only
74 // if necessary...
76 fLastVP = fVP;
77 G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
78 ProcessView ();
79
80 if(style!=G4ViewParameters::hlr &&
82
85 glFlush ();
86
88
90 FinishView ();
91
92 } else {
93
94 // If kernel visit was needed, drawing and FinishView will already
95 // have been done, so...
96 if (!kernelVisitWasNeeded) {
98 FinishView ();
99 } else {
100 // However, union cutaways are implemented in DrawDisplayLists, so make
101 // an extra pass...
102 if (fVP.IsCutaway() &&
104 ClearView();
106 FinishView ();
107 } else { // ADD TO AVOID KernelVisit=1 and nothing to display
109 FinishView ();
110 }
111 }
112 }
113}
void FinishView()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void HaloingSecondPass()
G4bool fNeedKernelVisit
Definition: G4VViewer.hh:224
const G4ViewParameters & GetViewParameters() const
void ProcessView()
Definition: G4VViewer.cc:105

References G4OpenGLViewer::ClearView(), G4ViewParameters::cutawayUnion, G4OpenGLStoredViewer::DrawDisplayLists(), FinishView(), G4OpenGLStoredViewer::fLastVP, G4VViewer::fNeedKernelVisit, G4VViewer::fVP, G4ViewParameters::GetCutawayMode(), G4ViewParameters::GetDrawingStyle(), G4VViewer::GetViewParameters(), G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), G4OpenGLViewer::haloing_enabled, G4OpenGLViewer::HaloingFirstPass(), G4OpenGLViewer::HaloingSecondPass(), G4ViewParameters::hlr, G4ViewParameters::IsCutaway(), G4OpenGLStoredViewer::KernelVisitDecision(), and G4VViewer::ProcessView().

◆ exportImage()

bool G4OpenGLViewer::exportImage ( std::string  name = "",
int  width = -1,
int  height = -1 
)
virtualinherited

Export image with the given name with width and height Several cases : If name is "", filename will have the default value If name is "toto.png", set the name to "toto" and the format to "png". No incremented suffix is added. If name is "toto", set the name to "toto" and the format to default (or current format if specify). Will also add an incremented suffix at the end of the file

Reimplemented in G4OpenGLQtViewer.

Definition at line 827 of file G4OpenGLViewer.cc.

827 {
828
829 if (! setExportFilename(name)) {
830 return false;
831 }
832
833 if ((width != -1) && (height != -1)) {
834 setExportSize(width, height);
835 }
836
837 if (fExportImageFormat == "eps") {
839 } else if (fExportImageFormat == "ps") {
841 } else if (fExportImageFormat == "svg") {
843 } else if (fExportImageFormat == "pdf") {
845 } else {
846 setExportImageFormat(fExportImageFormat,true); // will display a message if this format is not correct for the current viewer
847 return false;
848 }
849
850 bool res;
851
852 // Change the LC_NUMERIC value in order to have "." separtor and not ","
853 // This case is only useful for French, Canadien...
854 size_t len = strlen(setlocale(LC_NUMERIC,NULL));
855 char* oldLocale = (char*)(malloc(len+1));
856 if(oldLocale!=NULL) strncpy(oldLocale,setlocale(LC_NUMERIC,NULL),len);
857 setlocale(LC_NUMERIC,"C");
858
859 if (((fExportImageFormat == "eps") || (fExportImageFormat == "ps")) && (!fVectoredPs)) {
860 res = printNonVectoredEPS();
861 } else {
862 res = printVectoredEPS();
863 }
864
865 // restore the local
866 if (oldLocale) {
867 setlocale(LC_NUMERIC,oldLocale);
868 free(oldLocale);
869 }
870
871 if (res == false) {
872 G4cerr << "Error saving file... " << getRealPrintFilename().c_str() << G4endl;
873 } else {
874 G4cout << "File " << getRealPrintFilename().c_str() << " size: " << getRealExportWidth() << "x" << getRealExportHeight() << " has been saved " << G4endl;
875
876 // increment index if necessary
877 if ( fExportFilenameIndex != -1) {
879 }
880 }
881
882 return res;
883}
G4GLOB_DLL std::ostream G4cerr
void setExportImageFormat(unsigned int)
G4int getRealExportHeight()
bool setExportImageFormat(std::string format, bool quiet=false)
std::string fExportImageFormat
bool setExportFilename(G4String name, G4bool inc=true)
bool printNonVectoredEPS()
void setExportSize(G4int, G4int)
G4int getRealExportWidth()
std::string getRealPrintFilename()
#define GL2PS_SVG
Definition: gl2ps.h:133
#define GL2PS_EPS
Definition: gl2ps.h:130
#define GL2PS_PDF
Definition: gl2ps.h:132
#define GL2PS_PS
Definition: gl2ps.h:129

References G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::fExportImageFormat, G4OpenGLViewer::fGL2PSAction, free, G4OpenGLViewer::fVectoredPs, G4cerr, G4cout, G4endl, G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), GL2PS_EPS, GL2PS_PDF, GL2PS_PS, GL2PS_SVG, G4InuclParticleNames::name(), G4OpenGLViewer::printNonVectoredEPS(), G4OpenGLViewer::printVectoredEPS(), G4OpenGLViewer::setExportFilename(), G4OpenGLViewer::setExportImageFormat(), G4OpenGL2PSAction::setExportImageFormat(), and G4OpenGLViewer::setExportSize().

Referenced by G4OpenGLQtViewer::exportImage(), G4OpenGLXmViewer::print_callback(), and G4OpenGLViewerMessenger::SetNewValue().

◆ FinishView()

void G4OpenGLStoredWin32Viewer::FinishView ( void  )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Reimplemented from G4VViewer.

Definition at line 116 of file G4OpenGLStoredWin32Viewer.cc.

120{
121 if(!fHDC) return;
122
123 glFlush ();
124 GLint renderMode;
125 glGetIntegerv(GL_RENDER_MODE, &renderMode);
126 if (renderMode == GL_RENDER) ::SwapBuffers(fHDC);
127
128 // Empty the Windows message queue :
129 MSG event;
130 while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
131 ::TranslateMessage(&event);
132 ::DispatchMessage (&event);
133 }
134}

References G4OpenGLWin32Viewer::fHDC.

Referenced by DrawView(), and Initialise().

◆ g4GlFrustum()

void G4OpenGLViewer::g4GlFrustum ( GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  near,
GLdouble  far 
)
protectedinherited

Definition at line 1467 of file G4OpenGLViewer.cc.

1467 {
1468 // glFrustum (left, right, bottom, top, near, far);
1469
1470 GLdouble deltaX = right - left;
1471 GLdouble deltaY = top - bottom;
1472 GLdouble deltaZ = zFar - zNear;
1473
1474 GLdouble a = 2.0f * zNear / deltaX;
1475 GLdouble b = 2.0f * zNear / deltaY;
1476 GLdouble c = (right + left) / deltaX;
1477 GLdouble d = (top + bottom) / deltaY;
1478 GLdouble e = -(zFar + zNear) / (zFar - zNear);
1479 GLdouble f = -2.0f * zFar * zNear / deltaZ;
1480
1481 GLdouble proj[16] = {
1482 a, 0, 0, 0,
1483 0, b, 0, 0,
1484 c, d, e, -1.0f,
1485 0, 0, f, 0
1486 };
1487
1488 glMultMatrixd(proj);
1489
1490}

Referenced by G4OpenGLViewer::SetView().

◆ g4GlOrtho()

void G4OpenGLViewer::g4GlOrtho ( GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  near,
GLdouble  far 
)
protectedinherited

Definition at line 1445 of file G4OpenGLViewer.cc.

1445 {
1446 // glOrtho (left, right, bottom, top, near, far);
1447
1448 GLdouble a = 2.0 / (right - left);
1449 GLdouble b = 2.0 / (top - bottom);
1450 GLdouble c = -2.0 / (zFar - zNear);
1451
1452 GLdouble tx = - (right + left)/(right - left);
1453 GLdouble ty = - (top + bottom)/(top - bottom);
1454 GLdouble tz = - (zFar + zNear)/(zFar - zNear);
1455
1456 GLdouble ortho[16] = {
1457 a, 0, 0, 0,
1458 0, b, 0, 0,
1459 0, 0, c, 0,
1460 tx, ty, tz, 1
1461 };
1462 glMultMatrixd(ortho);
1463
1464}

Referenced by G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLImmediateSceneHandler::BeginPrimitives2D(), G4OpenGLStoredViewer::DrawDisplayLists(), and G4OpenGLViewer::SetView().

◆ g4GluLookAt()

void G4OpenGLViewer::g4GluLookAt ( GLdouble  eyex,
GLdouble  eyey,
GLdouble  eyez,
GLdouble  centerx,
GLdouble  centery,
GLdouble  centerz,
GLdouble  upx,
GLdouble  upy,
GLdouble  upz 
)
protectedinherited

Definition at line 1365 of file G4OpenGLViewer.cc.

1369{
1370 GLdouble mat[16];
1371 GLdouble x[3], y[3], z[3];
1372 GLdouble mag;
1373
1374 /* Make rotation matrix */
1375
1376 /* Z vector */
1377 z[0] = eyex - centerx;
1378 z[1] = eyey - centery;
1379 z[2] = eyez - centerz;
1380 mag = std::sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
1381 if (mag) { /* mpichler, 19950515 */
1382 z[0] /= mag;
1383 z[1] /= mag;
1384 z[2] /= mag;
1385 }
1386
1387 /* Y vector */
1388 y[0] = upx;
1389 y[1] = upy;
1390 y[2] = upz;
1391
1392 /* X vector = Y cross Z */
1393 x[0] = y[1] * z[2] - y[2] * z[1];
1394 x[1] = -y[0] * z[2] + y[2] * z[0];
1395 x[2] = y[0] * z[1] - y[1] * z[0];
1396
1397 /* Recompute Y = Z cross X */
1398 y[0] = z[1] * x[2] - z[2] * x[1];
1399 y[1] = -z[0] * x[2] + z[2] * x[0];
1400 y[2] = z[0] * x[1] - z[1] * x[0];
1401
1402 /* mpichler, 19950515 */
1403 /* cross product gives area of parallelogram, which is < 1.0 for
1404 * non-perpendicular unit-length vectors; so normalize x, y here
1405 */
1406
1407 mag = std::sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
1408 if (mag) {
1409 x[0] /= mag;
1410 x[1] /= mag;
1411 x[2] /= mag;
1412 }
1413
1414 mag = std::sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
1415 if (mag) {
1416 y[0] /= mag;
1417 y[1] /= mag;
1418 y[2] /= mag;
1419 }
1420
1421#define M(row,col) mat[col*4+row]
1422 M(0, 0) = x[0];
1423 M(0, 1) = x[1];
1424 M(0, 2) = x[2];
1425 M(0, 3) = 0.0;
1426 M(1, 0) = y[0];
1427 M(1, 1) = y[1];
1428 M(1, 2) = y[2];
1429 M(1, 3) = 0.0;
1430 M(2, 0) = z[0];
1431 M(2, 1) = z[1];
1432 M(2, 2) = z[2];
1433 M(2, 3) = 0.0;
1434 M(3, 0) = 0.0;
1435 M(3, 1) = 0.0;
1436 M(3, 2) = 0.0;
1437 M(3, 3) = 1.0;
1438#undef M
1439 glMultMatrixd(mat);
1440
1441 /* Translate Eye to Origin */
1442 glTranslated(-eyex, -eyey, -eyez);
1443}
#define M(row, col)

References M.

Referenced by G4OpenGLViewer::SetView().

◆ g4GluPickMatrix()

void G4OpenGLViewer::g4GluPickMatrix ( GLdouble  x,
GLdouble  y,
GLdouble  width,
GLdouble  height,
GLint  viewport[4] 
)
protectedinherited

Definition at line 1323 of file G4OpenGLViewer.cc.

1325 {
1326 GLdouble mat[16];
1327 GLdouble sx, sy;
1328 GLdouble tx, ty;
1329
1330 sx = viewport[2] / width;
1331 sy = viewport[3] / height;
1332 tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
1333 ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;
1334
1335#define M(row, col) mat[col*4+row]
1336 M(0, 0) = sx;
1337 M(0, 1) = 0.0;
1338 M(0, 2) = 0.0;
1339 M(0, 3) = tx;
1340 M(1, 0) = 0.0;
1341 M(1, 1) = sy;
1342 M(1, 2) = 0.0;
1343 M(1, 3) = ty;
1344 M(2, 0) = 0.0;
1345 M(2, 1) = 0.0;
1346 M(2, 2) = 1.0;
1347 M(2, 3) = 0.0;
1348 M(3, 0) = 0.0;
1349 M(3, 1) = 0.0;
1350 M(3, 2) = 0.0;
1351 M(3, 3) = 1.0;
1352#undef M
1353
1354 glMultMatrixd(mat);
1355}

References M.

Referenced by G4OpenGLViewer::GetPickDetails().

◆ GetApplicableVisAttributes()

const G4VisAttributes * G4VViewer::GetApplicableVisAttributes ( const G4VisAttributes ) const
inherited

◆ GetDefaultViewParameters()

const G4ViewParameters & G4VViewer::GetDefaultViewParameters ( ) const
inherited

◆ GetName()

const G4String & G4VViewer::GetName ( ) const
inherited

◆ GetPickDetails()

const std::vector< G4OpenGLViewerPickMap * > & G4OpenGLViewer::GetPickDetails ( GLdouble  x,
GLdouble  y 
)
protectedinherited

Definition at line 488 of file G4OpenGLViewer.cc.

489{
490 static std::vector < G4OpenGLViewerPickMap* > pickMapVector;
491 for (auto pickMap: pickMapVector) {
492 delete pickMap;
493 }
494 pickMapVector.clear();
495
496 const G4int BUFSIZE = 512;
497 GLuint selectBuffer[BUFSIZE];
498 glSelectBuffer(BUFSIZE, selectBuffer);
499 glRenderMode(GL_SELECT);
500 glInitNames();
501 glPushName(0);
502 glMatrixMode(GL_PROJECTION);
503 G4double currentProjectionMatrix[16];
504 glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix);
505 glPushMatrix();
506 glLoadIdentity();
507 GLint viewport[4];
508 glGetIntegerv(GL_VIEWPORT, viewport);
509/* G4cout
510 << "viewport, x,y: "
511 << viewport[0] << ',' << viewport[1] << ',' << viewport[2] << ',' << viewport[3]
512 << ", " << x << ',' << y
513 << G4endl;
514*/
515 fIsGettingPickInfos = true;
516 // Define 5x5 pixel pick area
517 g4GluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
518 glMultMatrixd(currentProjectionMatrix);
519 glMatrixMode(GL_MODELVIEW);
520 DrawView();
521 GLint hits = glRenderMode(GL_RENDER);
522 fIsGettingPickInfos = false;
523 if (hits < 0) {
524 G4cout << "Too many hits. Zoom in to reduce overlaps." << G4endl;
525 goto restoreMatrices;
526 }
527 if (hits > 0) {
528 GLuint* p = selectBuffer;
529 for (GLint i = 0; i < hits; ++i) {
530 GLuint nnames = *p++;
531 // This bit of debug code or...
532 //GLuint zmin = *p++;
533 //GLuint zmax = *p++;
534 //G4cout << "Hit " << i << ": " << nnames << " names"
535 // << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl;
536 // ...just increment the pointer
537 p++;
538 p++;
539 for (GLuint j = 0; j < nnames; ++j) {
540 GLuint name = *p++;
541 std::map<GLuint, G4AttHolder*>::iterator iter =
543 if (iter != fOpenGLSceneHandler.fPickMap.end()) {
544 G4AttHolder* attHolder = iter->second;
545 if(attHolder && attHolder->GetAttDefs().size()) {
546 for (size_t iAtt = 0;
547 iAtt < attHolder->GetAttDefs().size(); ++iAtt) {
548 std::ostringstream oss;
549 oss << G4AttCheck(attHolder->GetAttValues()[iAtt],
550 attHolder->GetAttDefs()[iAtt]);
552// G4cout
553// << "i,j, attHolder->GetAttDefs().size(): "
554// << i << ',' << j
555// << ", " << attHolder->GetAttDefs().size()
556// << G4endl;
557// G4cout << "G4OpenGLViewer::GetPickDetails: " << oss.str() << G4endl;
558 pickMap->addAttributes(oss.str());
559 pickMap->setHitNumber(i);
560 pickMap->setSubHitNumber(j);
561 pickMap->setPickName(name);
562 pickMapVector.push_back(pickMap);
563 }
564 }
565 }
566 }
567 }
568 }
569
570restoreMatrices:
571 glMatrixMode(GL_PROJECTION);
572 glPopMatrix();
573 glMatrixMode(GL_MODELVIEW);
574
575 return pickMapVector;
576}
const std::vector< const std::vector< G4AttValue > * > & GetAttValues() const
Definition: G4AttHolder.hh:59
const std::vector< const std::map< G4String, G4AttDef > * > & GetAttDefs() const
Definition: G4AttHolder.hh:61
std::map< GLuint, G4AttHolder * > fPickMap
void setSubHitNumber(G4int n)
void setHitNumber(G4int n)
void addAttributes(G4String att)
void setPickName(G4int n)
void g4GluPickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
G4OpenGLSceneHandler & fOpenGLSceneHandler
virtual void DrawView()=0
#define BUFSIZE
Definition: liblist.c:40

References G4OpenGLViewerPickMap::addAttributes(), BUFSIZE, G4VViewer::DrawView(), G4OpenGLViewer::fIsGettingPickInfos, G4OpenGLViewer::fOpenGLSceneHandler, G4OpenGLSceneHandler::fPickMap, G4cout, G4endl, G4OpenGLViewer::g4GluPickMatrix(), G4AttHolder::GetAttDefs(), G4AttHolder::GetAttValues(), G4InuclParticleNames::name(), G4OpenGLViewerPickMap::setHitNumber(), G4OpenGLViewerPickMap::setPickName(), and G4OpenGLViewerPickMap::setSubHitNumber().

Referenced by G4OpenGLViewer::Pick(), and G4OpenGLQtViewer::updatePickInfosWidget().

◆ GetPrivateVisAttributesModifiers()

virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * G4VViewer::GetPrivateVisAttributesModifiers ( ) const
virtualinherited

◆ getRealExportHeight()

G4int G4OpenGLViewer::getRealExportHeight ( )
privateinherited

Definition at line 1004 of file G4OpenGLViewer.cc.

1004 {
1005 if (fPrintSizeY == -1) {
1006 return fWinSize_y;
1007 }
1008 GLint dims[2];
1009 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
1010
1011 // L.Garnier 01-2010: Some problems with mac 10.6
1012 if ((dims[0] !=0 ) && (dims[1] !=0)) {
1013 if (fPrintSizeY > dims[1]){
1014 return dims[1];
1015 }
1016 }
1017 if (fPrintSizeY < -1){
1018 return 0;
1019 }
1020 return fPrintSizeY;
1021}
unsigned int fWinSize_y

References G4OpenGLViewer::fPrintSizeY, and G4OpenGLViewer::fWinSize_y.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::printNonVectoredEPS().

◆ getRealExportWidth()

G4int G4OpenGLViewer::getRealExportWidth ( )
privateinherited

Definition at line 985 of file G4OpenGLViewer.cc.

985 {
986 if (fPrintSizeX == -1) {
987 return fWinSize_x;
988 }
989 GLint dims[2];
990 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
991
992 // L.Garnier 01-2010: Some problems with mac 10.6
993 if ((dims[0] !=0 ) && (dims[1] !=0)) {
994 if (fPrintSizeX > dims[0]){
995 return dims[0];
996 }
997 }
998 if (fPrintSizeX < -1){
999 return 0;
1000 }
1001 return fPrintSizeX;
1002}
unsigned int fWinSize_x

References G4OpenGLViewer::fPrintSizeX, and G4OpenGLViewer::fWinSize_x.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::printNonVectoredEPS().

◆ getRealPrintFilename()

std::string G4OpenGLViewer::getRealPrintFilename ( )
protectedinherited

Definition at line 1066 of file G4OpenGLViewer.cc.

1066 {
1067 std::string temp = fExportFilename;
1068 if (fExportFilenameIndex != -1) {
1069 temp += std::string("_");
1070 std::ostringstream os;
1071 os << std::setw(4) << std::setfill('0') << fExportFilenameIndex;
1072 std::string nb_str = os.str();
1073 temp += nb_str;
1074 }
1075 temp += "."+fExportImageFormat;
1076 return temp;
1077}
G4String fExportFilename

References G4OpenGLViewer::fExportFilename, G4OpenGLViewer::fExportFilenameIndex, and G4OpenGLViewer::fExportImageFormat.

Referenced by G4OpenGLQtViewer::exportImage(), G4OpenGLViewer::exportImage(), G4OpenGLXmViewer::misc_callback(), G4OpenGLViewer::printGl2PS(), G4OpenGLViewer::printNonVectoredEPS(), and G4OpenGLViewer::setExportFilename().

◆ getSceneDepth()

GLdouble G4OpenGLViewer::getSceneDepth ( )
protectedinherited

Definition at line 1111 of file G4OpenGLViewer.cc.

1112{
1113 if (!fSceneHandler.GetScene()) {
1114 return 0;
1115 }
1116 const G4Point3D targetPoint
1120 if(radius<=0.) radius = 1.;
1121 const G4double cameraDistance = fVP.GetCameraDistance (radius);
1122 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
1123 return fVP.GetFarDistance (cameraDistance, pnear, radius)- pnear;
1124}
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const

References G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFarDistance(), G4ViewParameters::GetNearDistance(), G4VSceneHandler::GetScene(), and G4Scene::GetStandardTargetPoint().

Referenced by G4OpenGLQtViewer::moveScene().

◆ getSceneFarWidth()

GLdouble G4OpenGLViewer::getSceneFarWidth ( )
protectedinherited

Definition at line 1094 of file G4OpenGLViewer.cc.

1095{
1096 if (!fSceneHandler.GetScene()) {
1097 return 0;
1098 }
1099 const G4Point3D targetPoint
1103 if(radius<=0.) radius = 1.;
1104 const G4double cameraDistance = fVP.GetCameraDistance (radius);
1105 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
1106 const GLdouble pfar = fVP.GetFarDistance (cameraDistance, pnear, radius);
1107 return 2 * fVP.GetFrontHalfHeight (pfar, radius);
1108}
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const

References G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFarDistance(), G4ViewParameters::GetFrontHalfHeight(), G4ViewParameters::GetNearDistance(), G4VSceneHandler::GetScene(), and G4Scene::GetStandardTargetPoint().

◆ GetSceneHandler()

G4VSceneHandler * G4VViewer::GetSceneHandler ( ) const
inherited

◆ getSceneNearWidth()

GLdouble G4OpenGLViewer::getSceneNearWidth ( )
protectedinherited

◆ GetShortName()

const G4String & G4VViewer::GetShortName ( ) const
inherited

◆ GetViewId()

G4int G4VViewer::GetViewId ( ) const
inherited

◆ GetViewParameters()

const G4ViewParameters & G4VViewer::GetViewParameters ( ) const
inherited

Referenced by G4OpenGLXmViewer::actions_callback(), G4OpenInventorSceneHandler::AddCircleSquare(), G4Qt3DSceneHandler::AddPrimitive(), G4ToolsSGSceneHandler::AddPrimitive(), G4OpenInventorSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenInventorSceneHandler::AddTransform(), G4OpenGLXmViewer::background_color_callback(), G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4VSceneHandler::CreateSectionSolid(), G4VisManager::CreateViewer(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4OpenGLStoredSceneHandler::EndModeling(), G4VisManager::EndOfRun(), G4VSceneHandler::GetAuxEdgeVisible(), G4VSceneHandler::GetColour(), G4VSceneHandler::GetDrawingStyle(), G4VSceneHandler::GetNoOfSides(), G4VSceneHandler::GetNumberOfCloudPoints(), G4VSceneHandler::GetTextColour(), G4VVisCommand::RefreshIfRequired(), G4VSceneHandler::RequestPrimitives(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandGeometrySetDaughtersInvisible::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValue(), G4VisCommandSceneNotifyHandlers::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerAddCutawayPlane::SetNewValue(), G4VisCommandViewerCentreOn::SetNewValue(), G4VisCommandViewerChangeCutawayPlane::SetNewValue(), G4VisCommandViewerClearCutawayPlanes::SetNewValue(), G4VisCommandViewerClearVisAttributesModifiers::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerColourByDensity::SetNewValue(), G4VisCommandViewerCopyViewFrom::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerDolly::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4VisCommandViewerPan::SetNewValue(), G4VisCommandViewerSave::SetNewValue(), G4VisCommandViewerScale::SetNewValue(), G4VisCommandViewerZoom::SetNewValue(), G4VisCommandsViewerSet::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4OpenInventorViewer::SetReducedWireFrame(), G4OpenInventorViewer::SetSolid(), and G4OpenInventorViewer::SetWireFrame().

◆ GetWin32Connection()

void G4OpenGLWin32Viewer::GetWin32Connection ( )
protectedinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 75 of file G4OpenGLWin32Viewer.cc.

79{
80}

◆ getWinHeight()

unsigned int G4OpenGLViewer::getWinHeight ( ) const
protectedinherited

◆ getWinWidth()

unsigned int G4OpenGLViewer::getWinWidth ( ) const
protectedinherited

◆ grabPixels()

GLubyte * G4OpenGLViewer::grabPixels ( int  inColor,
unsigned int  width,
unsigned int  height 
)
privateinherited

Definition at line 578 of file G4OpenGLViewer.cc.

579 {
580
581 GLubyte* buffer;
582 GLint swapbytes, lsbfirst, rowlength;
583 GLint skiprows, skippixels, alignment;
584 GLenum format;
585 int size;
586
587 if (inColor) {
588 format = GL_RGB;
589 size = width*height*3;
590 } else {
591 format = GL_LUMINANCE;
592 size = width*height*1;
593 }
594
595 buffer = new GLubyte[size];
596 if (buffer == NULL)
597 return NULL;
598
599 glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
600 glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
601 glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
602
603 glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
604 glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
605 glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
606
607 glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
608 glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
609 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
610
611 glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
612 glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
613 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
614
615 glReadBuffer(GL_FRONT);
616 glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
617
618 glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
619 glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
620 glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
621
622 glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
623 glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
624 glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
625
626 return buffer;
627}
#define buffer
Definition: xmlparse.cc:628

References buffer.

Referenced by G4OpenGLViewer::printNonVectoredEPS().

◆ HaloingFirstPass()

void G4OpenGLViewer::HaloingFirstPass ( )
protectedinherited

Definition at line 441 of file G4OpenGLViewer.cc.

441 {
442
443 //To perform haloing, first Draw all information to the depth buffer
444 //alone, using a chunky line width, and then Draw all info again, to
445 //the colour buffer, setting a thinner line width an the depth testing
446 //function to less than or equal, so if two lines cross, the one
447 //passing behind the other will not pass the depth test, and so not
448 //get rendered either side of the infront line for a short distance.
449
450 //First, disable writing to the colo(u)r buffer...
451 glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
452
453 //Now enable writing to the depth buffer...
454 glDepthMask (GL_TRUE);
455 glDepthFunc (GL_LESS);
456 glClearDepth (1.0);
457
458 //Finally, set the line width to something wide...
459 ChangeLineWidth(3.0);
460
461}
void ChangeLineWidth(G4double width)

References G4OpenGLViewer::ChangeLineWidth().

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), DrawView(), G4OpenGLStoredXmViewer::DrawView(), and G4OpenGLStoredXViewer::DrawView().

◆ HaloingSecondPass()

void G4OpenGLViewer::HaloingSecondPass ( )
protectedinherited

Definition at line 463 of file G4OpenGLViewer.cc.

463 {
464
465 //And finally, turn the colour buffer back on with a sesible line width...
466 glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
467 glDepthFunc (GL_LEQUAL);
468 ChangeLineWidth(1.0);
469
470}

References G4OpenGLViewer::ChangeLineWidth().

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), DrawView(), G4OpenGLStoredXmViewer::DrawView(), and G4OpenGLStoredXViewer::DrawView().

◆ HLRFirstPass()

void G4OpenGLViewer::HLRFirstPass ( )
protectedinherited

◆ HLRSecondPass()

void G4OpenGLViewer::HLRSecondPass ( )
protectedinherited

◆ HLRThirdPass()

void G4OpenGLViewer::HLRThirdPass ( )
protectedinherited

◆ Initialise()

void G4OpenGLStoredWin32Viewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 49 of file G4OpenGLStoredWin32Viewer.cc.

49 {
50
51 //Check that G4OpenGLWin32Viewer got a double buffered colour visual
52
56
57// clear the buffers and window.
58 ClearView ();
59 FinishView ();
60
61 glDepthFunc (GL_LEQUAL);
62 glDepthMask (GL_TRUE);
63}
virtual void CreateFontLists()
virtual void CreateMainWindow()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void CreateGLWin32Context()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

References G4OpenGLViewer::ClearView(), G4OpenGLViewer::CreateFontLists(), G4OpenGLWin32Viewer::CreateGLWin32Context(), G4OpenGLWin32Viewer::CreateMainWindow(), and FinishView().

◆ InitializeGLView()

void G4OpenGLViewer::InitializeGLView ( )
protectedinherited

Definition at line 127 of file G4OpenGLViewer.cc.

128{
129#ifdef G4OPENGL_VERSION_2
130 if (fVboDrawer) {
131
132 // First, load a simple shader
133 fShaderProgram = glCreateProgram();
134 Shader vertexShader = glCreateShader(GL_VERTEX_SHADER);
135 const char * vSrc = fVboDrawer->getVertexShaderSrc();
136 glShaderSource(vertexShader, 1, &vSrc, NULL);
137 glCompileShader(vertexShader);
138 glAttachShader(fShaderProgram, vertexShader);
139
140 Shader fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
141 const char * fSrc = fVboDrawer->getFragmentShaderSrc();
142 glShaderSource(fragmentShader, 1, &fSrc, NULL);
143 glCompileShader(fragmentShader);
144
145 glAttachShader(fShaderProgram, fragmentShader);
146 glLinkProgram(fShaderProgram);
147 glUseProgram(fShaderProgram);
148
149 // UniformLocation uColor = getUniformLocation(fShaderProgram, "uColor");
150 // uniform4fv(uColor, [0.0, 0.3, 0.0, 1.0]);
151
152 // Extract the references to the attributes from the shader.
153
154 fVertexPositionAttribute =
155 glGetAttribLocation(fShaderProgram, "aVertexPosition");
156
157
158 glEnableVertexAttribArray(fVertexPositionAttribute);
159
160 // Extract the references the uniforms from the shader
161 fpMatrixUniform = glGetUniformLocation(fShaderProgram, "uPMatrix");
162 fcMatrixUniform = glGetUniformLocation(fShaderProgram, "uCMatrix");
163 fmvMatrixUniform = glGetUniformLocation(fShaderProgram, "uMVMatrix");
164 fnMatrixUniform = glGetUniformLocation(fShaderProgram, "uNMatrix");
165 ftMatrixUniform = glGetUniformLocation(fShaderProgram, "uTMatrix");
166
167 /* glUniformMatrix4fv(fcMatrixUniform, 1, 0, identity);
168 glUniformMatrix4fv(fpMatrixUniform, 1, 0, identity);
169 glUniformMatrix4fv(ftMatrixUniform, 1, 0, identity);
170 glUniformMatrix4fv(fmvMatrixUniform, 1, 0, identity);
171 */
172 // We have to set that in order to avoid calls on opengl commands before all is ready
173 fGlViewInitialized = true;
174 }
175#endif
176
177 if (fWinSize_x == 0) {
179 }
180 if (fWinSize_y == 0) {
182 }
183
184 glClearColor (0.0, 0.0, 0.0, 0.0);
185 glClearDepth (1.0);
186#ifndef G4OPENGL_VERSION_2
187 glDisable (GL_LINE_SMOOTH);
188 glDisable (GL_POLYGON_SMOOTH);
189#endif
190
191// clear the buffers and window?
192 ClearView ();
193 FinishView ();
194
195 glDepthFunc (GL_LEQUAL);
196 glDepthMask (GL_TRUE);
197
198 glEnable (GL_BLEND);
199 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
200
201}
virtual void FinishView()
Definition: G4VViewer.cc:101

References G4OpenGLViewer::ClearView(), G4OpenGLViewer::fGlViewInitialized, G4VViewer::FinishView(), G4VViewer::fVP, G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4ViewParameters::GetWindowSizeHintX(), and G4ViewParameters::GetWindowSizeHintY().

Referenced by G4OpenGLImmediateXmViewer::Initialise(), G4OpenGLImmediateXViewer::Initialise(), G4OpenGLStoredXmViewer::Initialise(), G4OpenGLStoredXViewer::Initialise(), G4OpenGLImmediateQtViewer::initializeGL(), and G4OpenGLStoredQtViewer::initializeGL().

◆ isFramebufferReady()

G4bool G4OpenGLViewer::isFramebufferReady ( )
protectedinherited

Definition at line 730 of file G4OpenGLViewer.cc.

730 {
731 bool check = false;
732#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
733 check = true;
734#endif
735#ifdef G4VIS_BUILD_OPENGLX_DRIVER
736 check = false;
737#endif
738#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
739 check = false;
740#endif
741#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
742 check = false;
743#endif
744
745#if GL_ARB_framebuffer_object
746 if (check) {
747// if ( glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_UNDEFINED) {
748// return false;
749// }
750 }
751#endif
752 return true;
753}

Referenced by G4OpenGLViewer::ClearView(), G4OpenGLViewer::ClearViewWithoutFlush(), G4OpenGLImmediateQtViewer::paintEvent(), and G4OpenGLStoredQtViewer::paintEvent().

◆ isGl2psWriting()

bool G4OpenGLViewer::isGl2psWriting ( )
protectedinherited

Return if gl2ps is currently writing

Definition at line 720 of file G4OpenGLViewer.cc.

720 {
721
722 if (!fGL2PSAction) return false;
724 return true;
725 }
726 return false;
727}
bool fileWritingEnabled() const
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

References G4OpenGLViewer::fGL2PSAction, and G4OpenGL2PSAction::fileWritingEnabled().

Referenced by G4OpenGLViewer::ChangeLineWidth(), G4OpenGLViewer::ChangePointSize(), G4OpenGLQtViewer::DrawText(), G4OpenGLViewer::DrawText(), and G4OpenGLXViewer::DrawText().

◆ KernelVisitDecision()

void G4OpenGLStoredViewer::KernelVisitDecision ( )
protectedinherited

Definition at line 56 of file G4OpenGLStoredViewer.cc.

56 {
57
58 // If there's a significant difference with the last view parameters
59 // of either the scene handler or this viewer, trigger a rebuild.
60
64 }
65}
virtual G4bool CompareForKernelVisit(G4ViewParameters &)
void NeedKernelVisit()
Definition: G4VViewer.cc:78

References G4OpenGLStoredViewer::CompareForKernelVisit(), G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler, G4OpenGLStoredViewer::fLastVP, G4OpenGLStoredSceneHandler::fTopPODL, and G4VViewer::NeedKernelVisit().

Referenced by G4OpenGLStoredQtViewer::ComputeView(), DrawView(), G4OpenGLStoredXmViewer::DrawView(), and G4OpenGLStoredXViewer::DrawView().

◆ NeedKernelVisit()

void G4VViewer::NeedKernelVisit ( )
inherited

Definition at line 78 of file G4VViewer.cc.

78 {
79
80 fNeedKernelVisit = true;
81
82 // At one time I thought we'd better notify all viewers. But I guess
83 // each viewer can take care of itself, so the following code is
84 // redundant (but keep it commented out for now). (John Allison)
85 // Notify all viewers that a kernel visit is required.
86 // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
87 // G4ViewerListConstIterator i;
88 // for (i = viewerList.begin(); i != viewerList.end(); i++) {
89 // (*i) -> SetNeedKernelVisit ();
90 // }
91 // ??...but, there's a problem in OpenGL Stored which seems to
92 // require *all* viewers to revisit the kernel, so...
93 // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
94 // G4ViewerListConstIterator i;
95 // for (i = viewerList.begin(); i != viewerList.end(); i++) {
96 // (*i) -> SetNeedKernelVisit (true);
97 // }
98 // Feb 2005 - commented out. Let's fix OpenGL if necessary.
99}

References G4VViewer::fNeedKernelVisit.

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4HepRepFileViewer::DrawView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4VTreeViewer::DrawView(), G4VRML2FileViewer::DrawView(), G4VtkViewer::DrawView(), G4VisManager::GeometryHasChanged(), G4OpenGLStoredViewer::KernelVisitDecision(), G4OpenInventorViewer::KernelVisitDecision(), G4Qt3DViewer::KernelVisitDecision(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::KernelVisitDecision(), G4VisManager::NotifyHandlers(), G4OpenGLImmediateViewer::ProcessView(), G4VisCommandViewerRebuild::SetNewValue(), G4OpenInventorViewer::SetPreview(), G4OpenInventorViewer::SetPreviewAndFull(), G4OpenInventorViewer::SetReducedWireFrame(), and G4OpenInventorViewer::UpdateScene().

◆ Pick()

G4String G4OpenGLViewer::Pick ( GLdouble  x,
GLdouble  y 
)
protectedvirtualinherited

Definition at line 472 of file G4OpenGLViewer.cc.

473{
474 const std::vector < G4OpenGLViewerPickMap* > & pickMap = GetPickDetails(x,y);
475 G4String txt = "";
476 if (pickMap.size() == 0) {
477// txt += "No hits recorded.";;
478 } else {
479 for (unsigned int a=0; a < pickMap.size(); a++) {
480 if (pickMap[a]->getAttributes().size() > 0) {
481 txt += pickMap[a]->print();
482 }
483 }
484 }
485 return txt;
486}
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails(GLdouble x, GLdouble y)

References G4OpenGLViewer::GetPickDetails().

Referenced by G4OpenGLXViewer::ShowView().

◆ POSelected()

virtual G4bool G4OpenGLStoredViewer::POSelected ( size_t  )
inlineprotectedvirtualinherited

Reimplemented in G4OpenGLStoredQtViewer.

Definition at line 67 of file G4OpenGLStoredViewer.hh.

67{return true;}

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ printGl2PS()

bool G4OpenGLViewer::printGl2PS ( )
privateinherited

Definition at line 886 of file G4OpenGLViewer.cc.

886 {
887
888 int width = getRealExportWidth();
889 int height = getRealExportHeight();
890 bool res = true;
891
892 // no need to redraw at each new primitive for printgl2PS
893 G4OpenGLSceneHandler& oglSceneHandler = dynamic_cast<G4OpenGLSceneHandler&>(fSceneHandler);
894 G4OpenGLSceneHandler::FlushAction originalFlushAction = oglSceneHandler.GetFlushAction();
896
897 if (!fGL2PSAction) return false;
898
900 // try to resize
901 int X = fWinSize_x;
902 int Y = fWinSize_y;
903
904 fWinSize_x = width;
905 fWinSize_y = height;
906 // Laurent G. 16/03/10 : Not the good way to do.
907 // We should draw in a new offscreen context instead of
908 // resizing and drawing in current window...
909 // This should be solve when we will do an offscreen method
910 // to render OpenGL
911 // See :
912 // http://developer.apple.com/Mac/library/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_offscreen/opengl_offscreen.html
913 // http://www.songho.ca/opengl/gl_fbo.html
914
915 ResizeGLView();
916 bool extendBuffer = true;
917 bool endWriteAction = false;
918 bool beginWriteAction = true;
919 bool filePointerOk = true;
920 while ((extendBuffer) && (! endWriteAction) && (filePointerOk)) {
921
922 beginWriteAction = fGL2PSAction->enableFileWriting();
923 // 3 cases :
924 // - true
925 // - false && ! fGL2PSAction->fileWritingEnabled() => bad file name
926 // - false && fGL2PSAction->fileWritingEnabled() => buffer size problem ?
927
928 filePointerOk = fGL2PSAction->fileWritingEnabled();
929
930 if (beginWriteAction) {
931
932 // Set the viewport
933 // By default, we choose the line width (trajectories...)
935 // By default, we choose the point size (markers...)
937
938 DrawView ();
939 endWriteAction = fGL2PSAction->disableFileWriting();
940 }
941 if (filePointerOk) {
942 if ((! endWriteAction) || (! beginWriteAction)) {
943 extendBuffer = fGL2PSAction->extendBufferSize();
944 }
945 }
946 }
948
949 if (!extendBuffer ) {
950 G4cerr << "ERROR: gl2ps buffer size is not big enough to print this geometry. Try to extend it. No output produced"<< G4endl;
951 res = false;
952 }
953 if (!beginWriteAction ) {
954 G4cerr << "ERROR: saving file "<<getRealPrintFilename().c_str()<<". Check read/write access. No output produced" << G4endl;
955 res = false;
956 }
957 if (!endWriteAction ) {
958 G4cerr << "gl2ps error. No output produced" << G4endl;
959 res = false;
960 }
961 fWinSize_x = X;
962 fWinSize_y = Y;
963
964 oglSceneHandler.SetFlushAction(originalFlushAction);
965
966 // Reset for next time (useful is size change)
967 // fPrintSizeX = 0;
968 // fPrintSizeY = 0;
969
970 return res;
971}
G4double Y(G4double density)
bool enableFileWriting()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool disableFileWriting()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setFileName(const char *)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool extendBufferSize()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void resetBufferSizeParameters()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
static void SetFlushAction(FlushAction action)
static FlushAction GetFlushAction()

References G4OpenGL2PSAction::disableFileWriting(), G4VViewer::DrawView(), G4OpenGL2PSAction::enableFileWriting(), G4OpenGL2PSAction::extendBufferSize(), G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::fGl2psDefaultLineWith, G4OpenGLViewer::fGl2psDefaultPointSize, G4OpenGL2PSAction::fileWritingEnabled(), G4VViewer::fSceneHandler, G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4cerr, G4endl, G4OpenGLSceneHandler::GetFlushAction(), G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), G4OpenGLSceneHandler::never, G4OpenGL2PSAction::resetBufferSizeParameters(), G4OpenGLViewer::ResizeGLView(), G4OpenGL2PSAction::setFileName(), G4OpenGLSceneHandler::SetFlushAction(), G4OpenGL2PSAction::setLineWidth(), G4OpenGL2PSAction::setPointSize(), and Y().

Referenced by G4OpenGLViewer::printVectoredEPS().

◆ printNonVectoredEPS()

bool G4OpenGLViewer::printNonVectoredEPS ( )
privateinherited

Definition at line 633 of file G4OpenGLViewer.cc.

633 {
634
635 int width = getRealExportWidth();
636 int height = getRealExportHeight();
637
638 FILE* fp;
639 GLubyte* pixels;
640 GLubyte* curpix;
641 int components, pos, i;
642
643 pixels = grabPixels (fPrintColour, width, height);
644
645 if (pixels == NULL) {
646 G4cerr << "Failed to get pixels from OpenGl viewport" << G4endl;
647 return false;
648 }
649 if (fPrintColour) {
650 components = 3;
651 } else {
652 components = 1;
653 }
654 std::string name = getRealPrintFilename();
655 fp = fopen (name.c_str(), "w");
656 if (fp == NULL) {
657 G4cerr << "Can't open filename " << name.c_str() << G4endl;
658 return false;
659 }
660
661 fprintf (fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
662 fprintf (fp, "%%%%Title: %s\n", name.c_str());
663 fprintf (fp, "%%%%Creator: OpenGL pixmap render output\n");
664 fprintf (fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
665 fprintf (fp, "%%%%EndComments\n");
666 fprintf (fp, "gsave\n");
667 fprintf (fp, "/bwproc {\n");
668 fprintf (fp, " rgbproc\n");
669 fprintf (fp, " dup length 3 idiv string 0 3 0 \n");
670 fprintf (fp, " 5 -1 roll {\n");
671 fprintf (fp, " add 2 1 roll 1 sub dup 0 eq\n");
672 fprintf (fp, " { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n");
673 fprintf (fp, " 3 1 roll 5 -1 roll } put 1 add 3 0 \n");
674 fprintf (fp, " { 2 1 roll } ifelse\n");
675 fprintf (fp, " }forall\n");
676 fprintf (fp, " pop pop pop\n");
677 fprintf (fp, "} def\n");
678 fprintf (fp, "systemdict /colorimage known not {\n");
679 fprintf (fp, " /colorimage {\n");
680 fprintf (fp, " pop\n");
681 fprintf (fp, " pop\n");
682 fprintf (fp, " /rgbproc exch def\n");
683 fprintf (fp, " { bwproc } image\n");
684 fprintf (fp, " } def\n");
685 fprintf (fp, "} if\n");
686 fprintf (fp, "/picstr %d string def\n", width * components);
687 fprintf (fp, "%d %d scale\n", width, height);
688 fprintf (fp, "%d %d %d\n", width, height, 8);
689 fprintf (fp, "[%d 0 0 %d 0 0]\n", width, height);
690 fprintf (fp, "{currentfile picstr readhexstring pop}\n");
691 fprintf (fp, "false %d\n", components);
692 fprintf (fp, "colorimage\n");
693
694 curpix = (GLubyte*) pixels;
695 pos = 0;
696 for (i = width*height*components; i>0; i--) {
697 fprintf (fp, "%02hx ", (unsigned short)(*(curpix++)));
698 if (++pos >= 32) {
699 fprintf (fp, "\n");
700 pos = 0;
701 }
702 }
703 if (pos)
704 fprintf (fp, "\n");
705
706 fprintf (fp, "grestore\n");
707 fprintf (fp, "showpage\n");
708 delete [] pixels;
709 fclose (fp);
710
711 // Reset for next time (useful is size change)
712 // fPrintSizeX = -1;
713 // fPrintSizeY = -1;
714
715 return true;
716}
static const G4double pos
GLubyte * grabPixels(int inColor, unsigned int width, unsigned int height)

References G4OpenGLViewer::fPrintColour, G4cerr, G4endl, G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), G4OpenGLViewer::grabPixels(), G4InuclParticleNames::name(), and pos.

Referenced by G4OpenGLViewer::exportImage().

◆ printVectoredEPS()

bool G4OpenGLViewer::printVectoredEPS ( )
privateinherited

Definition at line 629 of file G4OpenGLViewer.cc.

629 {
630 return printGl2PS();
631}

References G4OpenGLViewer::printGl2PS().

Referenced by G4OpenGLViewer::exportImage().

◆ ProcessView()

void G4VViewer::ProcessView ( )
inherited

Definition at line 105 of file G4VViewer.cc.

106{
107 // If the scene has changed, or if the concrete viewer has decided
108 // that it necessary to visit the kernel, perhaps because the view
109 // parameters have changed significantly (this should be done in the
110 // concrete viewer's DrawView)...
111 if (fNeedKernelVisit) {
112 // Reset flag. This must be done before ProcessScene to prevent
113 // recursive calls when recomputing transients...
114 fNeedKernelVisit = false;
117 }
118}
virtual void ProcessScene()
virtual void ClearStore()

References G4VSceneHandler::ClearStore(), G4VViewer::fNeedKernelVisit, G4VViewer::fSceneHandler, and G4VSceneHandler::ProcessScene().

Referenced by G4OpenGLStoredQtViewer::ComputeView(), G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4HepRepFileViewer::DrawView(), DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4OpenInventorViewer::DrawView(), G4Qt3DViewer::DrawView(), G4RayTracerViewer::DrawView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::DrawView(), G4VTreeViewer::DrawView(), G4VRML2FileViewer::DrawView(), G4VtkViewer::DrawView(), and G4OpenGLImmediateViewer::ProcessView().

◆ RefreshView()

void G4VViewer::RefreshView ( )
inherited

◆ ReleaseMouse()

void G4OpenGLWin32Viewer::ReleaseMouse ( )
privateinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 417 of file G4OpenGLWin32Viewer.cc.

References G4OpenGLWin32Viewer::fMousePressed, G4OpenGLWin32Viewer::fMousePressedX, and G4OpenGLWin32Viewer::fMousePressedY.

◆ ResetView()

void G4OpenGLViewer::ResetView ( )
protectedvirtualinherited

Reimplemented from G4VViewer.

Reimplemented in G4OpenGLXmViewer.

Definition at line 434 of file G4OpenGLViewer.cc.

434 {
436 fRot_sens = 1;
437 fPan_sens = 0.01;
438}
virtual void ResetView()

References G4OpenGLViewer::fPan_sens, G4OpenGLViewer::fRot_sens, and G4VViewer::ResetView().

Referenced by G4OpenGLQtViewer::ResetView(), and G4OpenGLXmViewer::ResetView().

◆ ResizeGLView()

void G4OpenGLViewer::ResizeGLView ( )
protectedinherited

Set the viewport of the scene MAXIMUM SIZE is : GLint dims[2]; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);

Definition at line 250 of file G4OpenGLViewer.cc.

251{
252 // Check size
253 GLint dims[2];
254 dims[0] = 0;
255 dims[1] = 0;
256
257 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
258
259 if ((dims[0] !=0 ) && (dims[1] !=0)) {
260
261 if (fWinSize_x > (unsigned)dims[0]) {
262 G4cerr << "Try to resize view greater than max X viewport dimension. Desired size "<<fWinSize_x <<" is resize to "<< dims[0] << G4endl;
263 fWinSize_x = dims[0];
264 }
265 if (fWinSize_y > (unsigned)dims[1]) {
266 G4cerr << "Try to resize view greater than max Y viewport dimension. Desired size "<<fWinSize_y <<" is resize to "<< dims[1] << G4endl;
267 fWinSize_y = dims[1];
268 }
269 }
270
271 glViewport(0, 0, fWinSize_x,fWinSize_y);
272
273
274}

References G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4cerr, and G4endl.

Referenced by G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::SetView().

◆ ResizeWindow()

void G4OpenGLViewer::ResizeWindow ( unsigned int  aWidth,
unsigned int  aHeight 
)
protectedinherited

◆ rotateScene()

void G4OpenGLViewer::rotateScene ( G4double  dx,
G4double  dy 
)
protectedinherited

Definition at line 1128 of file G4OpenGLViewer.cc.

1129{
1132 } else {
1133 if( dx != 0) {
1134 rotateSceneThetaPhi(dx,0);
1135 }
1136 if( dy != 0) {
1137 rotateSceneThetaPhi(0,dy);
1138 }
1139 }
1140}
void rotateSceneInViewDirection(G4double dx, G4double dy)
void rotateSceneThetaPhi(G4double dx, G4double dy)
RotationStyle GetRotationStyle() const

References G4ViewParameters::freeRotation, G4VViewer::fVP, G4ViewParameters::GetRotationStyle(), G4OpenGLViewer::rotateSceneInViewDirection(), and G4OpenGLViewer::rotateSceneThetaPhi().

Referenced by G4OpenGLXmViewer::rotate_in_phi(), G4OpenGLXmViewer::rotate_in_theta(), and G4OpenGLQtViewer::rotateQtScene().

◆ rotateSceneInViewDirection()

void G4OpenGLViewer::rotateSceneInViewDirection ( G4double  dx,
G4double  dy 
)
privateinherited

Definition at line 1241 of file G4OpenGLViewer.cc.

1242{
1243 if (!fSceneHandler.GetScene()) {
1244 return;
1245 }
1246
1247 G4Vector3D vp;
1248 G4Vector3D up;
1249
1250 G4Vector3D xprime;
1251 G4Vector3D yprime;
1252 G4Vector3D zprime;
1253
1254 G4Vector3D new_vp;
1255 G4Vector3D new_up;
1256
1257 G4Vector3D a1;
1258 G4Vector3D a2;
1259 G4Vector3D delta;
1260 G4Vector3D viewPoint;
1261
1262 dx = dx/100;
1263 dy = dy/100;
1264
1265 //phi spin stuff here
1266
1267 vp = fVP.GetViewpointDirection ().unit();
1268 up = fVP.GetUpVector ().unit();
1269
1270 G4Vector3D zPrimeVector = G4Vector3D(up.y()*vp.z()-up.z()*vp.y(),
1271 up.z()*vp.x()-up.x()*vp.z(),
1272 up.x()*vp.y()-up.y()*vp.x());
1273
1274 viewPoint = vp/fRot_sens + (zPrimeVector*dx - up*dy) ;
1275 new_up = G4Vector3D(viewPoint.y()*zPrimeVector.z()-viewPoint.z()*zPrimeVector.y(),
1276 viewPoint.z()*zPrimeVector.x()-viewPoint.x()*zPrimeVector.z(),
1277 viewPoint.x()*zPrimeVector.y()-viewPoint.y()*zPrimeVector.x());
1278
1279 G4Vector3D new_upUnit = new_up.unit();
1280
1281
1282
1283 fVP.SetUpVector(new_upUnit);
1284 fVP.SetViewAndLights (viewPoint);
1285}
void SetViewAndLights(const G4Vector3D &viewpointDirection)
const G4Vector3D & GetUpVector() const
void SetUpVector(const G4Vector3D &upVector)

References G4OpenGLViewer::fRot_sens, G4VViewer::fSceneHandler, G4VViewer::fVP, G4VSceneHandler::GetScene(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), G4ViewParameters::SetUpVector(), G4ViewParameters::SetViewAndLights(), HepGeom::BasicVector3D< T >::unit(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by G4OpenGLViewer::rotateScene(), and G4OpenGLViewer::rotateSceneToggle().

◆ rotateSceneThetaPhi()

void G4OpenGLViewer::rotateSceneThetaPhi ( G4double  dx,
G4double  dy 
)
privateinherited

Definition at line 1157 of file G4OpenGLViewer.cc.

1158{
1159 if (!fSceneHandler.GetScene()) {
1160 return;
1161 }
1162
1163 G4Vector3D vp;
1164 G4Vector3D up;
1165
1166 G4Vector3D xprime;
1167 G4Vector3D yprime;
1168 G4Vector3D zprime;
1169
1170 G4double delta_alpha;
1171 G4double delta_theta;
1172
1173 G4Vector3D new_vp;
1174 G4Vector3D new_up;
1175
1176 G4double cosalpha;
1177 G4double sinalpha;
1178
1179 G4Vector3D a1;
1180 G4Vector3D a2;
1181 G4Vector3D delta;
1182 G4Vector3D viewPoint;
1183
1184
1185 //phi spin stuff here
1186
1187 vp = fVP.GetViewpointDirection ().unit ();
1188 up = fVP.GetUpVector ().unit ();
1189
1190 yprime = (up.cross(vp)).unit();
1191 zprime = (vp.cross(yprime)).unit();
1192
1194 delta_alpha = dy * fRot_sens;
1195 delta_theta = -dx * fRot_sens;
1196 } else {
1197 delta_alpha = -dy * fRot_sens;
1198 delta_theta = dx * fRot_sens;
1199 }
1200
1201 delta_alpha *= CLHEP::deg;
1202 delta_theta *= CLHEP::deg;
1203
1204 new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
1205
1206 // to avoid z rotation flipping
1207 // to allow more than 360∞ rotation
1208
1210 new_up = (new_vp.cross(yprime)).unit();
1211 if (new_vp.z()*vp.z() <0) {
1212 new_up.set(new_up.x(),-new_up.y(),new_up.z());
1213 }
1214 } else {
1215 new_up = up;
1216 if (new_vp.z()*vp.z() <0) {
1217 new_up.set(new_up.x(),-new_up.y(),new_up.z());
1218 }
1219 }
1220 fVP.SetUpVector(new_up);
1222 // Rotates by fixed azimuthal angle delta_theta.
1223
1224 cosalpha = new_up.dot (new_vp.unit());
1225 sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
1226 yprime = (new_up.cross (new_vp.unit())).unit ();
1227 xprime = yprime.cross (new_up);
1228 // Projection of vp on plane perpendicular to up...
1229 a1 = sinalpha * xprime;
1230 // Required new projection...
1231 a2 = sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
1232 // Required Increment vector...
1233 delta = a2 - a1;
1234 // So new viewpoint is...
1235 viewPoint = new_vp.unit() + delta;
1236
1237 fVP.SetViewAndLights (viewPoint);
1238}
G4bool GetLightsMoveWithCamera() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
void set(T x1, T y1, T z1)
T dot(const BasicVector3D< T > &v) const
static constexpr double deg

References HepGeom::BasicVector3D< T >::cross(), CLHEP::deg, HepGeom::BasicVector3D< T >::dot(), G4OpenGLViewer::fRot_sens, G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetLightsMoveWithCamera(), G4VSceneHandler::GetScene(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), HepGeom::BasicVector3D< T >::set(), G4ViewParameters::SetUpVector(), G4ViewParameters::SetViewAndLights(), HepGeom::BasicVector3D< T >::unit(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by G4OpenGLViewer::rotateScene(), and G4OpenGLViewer::rotateSceneToggle().

◆ rotateSceneToggle()

void G4OpenGLViewer::rotateSceneToggle ( G4double  dx,
G4double  dy 
)
protectedinherited

◆ SetDefaultViewParameters()

void G4VViewer::SetDefaultViewParameters ( const G4ViewParameters vp)
inherited

◆ setExportFilename()

bool G4OpenGLViewer::setExportFilename ( G4String  name,
G4bool  inc = true 
)
protectedinherited

If name is "" or "!", filename and extension will have the default value. If name is "toto.png", set the name to "toto" and the format to "png". No incremented suffix is added. If name is "toto", set the name to "toto" and the format to default (or current format if specify). If name is the same as previous, do not reset incremented suffix.

Definition at line 1034 of file G4OpenGLViewer.cc.

1034 {
1035 if (name == "!") {
1036 name = "";
1037 }
1038
1039 if (inc) {
1040 if ((name != "") && (fExportFilename != name)) {
1042 }
1043 } else {
1045 }
1046
1047 if (name.size() == 0) {
1048 name = getRealPrintFilename().c_str();
1049 } else {
1050 // guess format by extention
1051 std::string extension = name.substr(name.find_last_of(".") + 1);
1052 // If there is a dot in the name the above might find rubbish, so...
1053 if (extension.size() >= 3 && extension.size() <= 4) { // Possible extension
1054 if (setExportImageFormat(extension, false)) { // Extension found
1055 fExportFilename = name.substr(0,name.find_last_of("."));
1056 } else { // No viable extension found
1057 return false;
1058 }
1059 } else { // Assume name is already the required without-extension part
1061 }
1062 }
1063 return true;
1064}

References G4OpenGLViewer::fExportFilename, G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::getRealPrintFilename(), G4InuclParticleNames::name(), and G4OpenGLViewer::setExportImageFormat().

Referenced by G4OpenGLQtViewer::actionSaveImage(), G4OpenGLQtViewer::exportImage(), G4OpenGLViewer::exportImage(), and G4OpenGLViewerMessenger::SetNewValue().

◆ setExportImageFormat()

bool G4OpenGLViewer::setExportImageFormat ( std::string  format,
bool  quiet = false 
)
inherited

Definition at line 1292 of file G4OpenGLViewer.cc.

1292 {
1293 bool found = false;
1294 std::string list;
1295 for (unsigned int a=0; a<fExportImageFormatVector.size(); a++) {
1296 list +=fExportImageFormatVector.at(a) + " ";
1297
1298 if (fExportImageFormatVector.at(a) == format) {
1299 if (! quiet) {
1300 G4cout << " Changing export format to \"" << format << "\"" << G4endl;
1301 }
1302 if (format != fExportImageFormat) {
1304 fExportImageFormat = format;
1305 }
1306 return true;
1307 }
1308 }
1309 if (! found) {
1310 if (format.size() == 0) {
1311 G4cout << " Current formats availables are : " << list << G4endl;
1312 } else {
1313 G4cerr << " Format \"" << format << "\" is not available for the selected viewer. Current formats availables are : " << list << G4endl;
1314 }
1315 }
1316 return false;
1317}

References G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::fExportImageFormat, G4OpenGLViewer::fExportImageFormatVector, G4cerr, G4cout, and G4endl.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLImmediateQtViewer::initializeGL(), G4OpenGLStoredQtViewer::initializeGL(), G4OpenGLViewer::setExportFilename(), and G4OpenGLViewerMessenger::SetNewValue().

◆ setExportSize()

void G4OpenGLViewer::setExportSize ( G4int  X,
G4int  Y 
)
protectedinherited

◆ SetName()

void G4VViewer::SetName ( const G4String name)
inherited

Definition at line 72 of file G4VViewer.cc.

72 {
73 fName = name;
74 fShortName = fName.substr(0, fName.find (' '));
76}
G4String fShortName
Definition: G4VViewer.hh:218
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.

References G4VViewer::fName, G4VViewer::fShortName, G4InuclParticleNames::name(), and G4StrUtil::strip().

◆ SetNeedKernelVisit()

void G4VViewer::SetNeedKernelVisit ( G4bool  need)
inherited

◆ SetRotation()

void G4OpenGLWin32Viewer::SetRotation ( G4int  dx,
G4int  dy 
)
privateinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 444 of file G4OpenGLWin32Viewer.cc.

450{
451 // Simple ad-hoc algorithms (borrowed from G4Qt3DViewer)
452 const G4Vector3D& x_prime = fVP.GetViewpointDirection()
454 const G4Vector3D& y_prime = x_prime.cross(fVP.GetViewpointDirection());
455 const G4double scale = 200; // Roughly pixels per window, empirically chosen
456 G4Vector3D newViewpointDirection = fVP.GetViewpointDirection();
457 newViewpointDirection += dx*x_prime/scale;
458 newViewpointDirection += dy*y_prime/scale;
459 fVP.SetViewpointDirection(newViewpointDirection.unit());
460
462 G4Vector3D newUpVector = fVP.GetUpVector();
463 newUpVector += dx*x_prime/scale;
464 newUpVector += dy*y_prime/scale;
465 fVP.SetUpVector(newUpVector.unit());
466 }
467}
void SetViewpointDirection(const G4Vector3D &viewpointDirection)

References HepGeom::BasicVector3D< T >::cross(), G4ViewParameters::freeRotation, G4VViewer::fVP, G4ViewParameters::GetRotationStyle(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), G4ViewParameters::SetUpVector(), G4ViewParameters::SetViewpointDirection(), and HepGeom::BasicVector3D< T >::unit().

◆ SetShift()

void G4OpenGLWin32Viewer::SetShift ( G4int  dx,
G4int  dy 
)
privateinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 428 of file G4OpenGLWin32Viewer.cc.

434{
435 const G4double sceneRadius = GetSceneHandler()->GetScene()
437 const G4double scale = 300; // Roughly pixels per window, empirically chosen
438 const G4double dxScene = dx*sceneRadius/scale;
439 const G4double dyScene = dy*sceneRadius/scale;
440 fVP.IncrementPan(-dxScene,dyScene);
441}
G4VSceneHandler * GetSceneHandler() const
void IncrementPan(G4double right, G4double up)

References G4VViewer::fVP, G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4VSceneHandler::GetScene(), G4VViewer::GetSceneHandler(), and G4ViewParameters::IncrementPan().

◆ SetTouchable()

void G4VViewer::SetTouchable ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath)
protectedinherited

Definition at line 124 of file G4VViewer.cc.

126{
127 // Set the touchable for /vis/touchable/set/... commands.
128 std::ostringstream oss;
129 const auto& pvStore = G4PhysicalVolumeStore::GetInstance();
130 for (const auto& pvNodeId: fullPath) {
131 const auto& pv = pvNodeId.GetPhysicalVolume();
132 auto iterator = find(pvStore->begin(),pvStore->end(),pv);
133 if (iterator == pvStore->end()) {
135 ed << "Volume no longer in physical volume store.";
136 G4Exception("G4VViewer::SetTouchable", "visman0501", JustWarning, ed);
137 } else {
138 oss
139 << ' ' << pvNodeId.GetPhysicalVolume()->GetName()
140 << ' ' << pvNodeId.GetCopyNo();
141 }
142 }
143 G4UImanager::GetUIpointer()->ApplyCommand("/vis/set/touchable" + oss.str());
144}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4PhysicalVolumeStore * GetInstance()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77

References G4UImanager::ApplyCommand(), G4Exception(), G4PhysicalVolumeStore::GetInstance(), G4UImanager::GetUIpointer(), and JustWarning.

Referenced by G4OpenGLQtViewer::changeColorAndTransparency(), and G4OpenGLQtViewer::setCheckComponent().

◆ SetView()

void G4OpenGLWin32Viewer::SetView ( )
virtualinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Reimplemented from G4OpenGLViewer.

Definition at line 47 of file G4OpenGLWin32Viewer.cc.

51{
52 if(!fHDC) return;
53 if(!fHGLRC) return;
54 ::wglMakeCurrent(fHDC,fHGLRC);
56}

References G4OpenGLWin32Viewer::fHDC, G4OpenGLWin32Viewer::fHGLRC, and G4OpenGLViewer::SetView().

◆ SetViewParameters()

void G4VViewer::SetViewParameters ( const G4ViewParameters vp)
inherited

◆ SetWindowPixelFormat()

G4bool G4OpenGLWin32Viewer::SetWindowPixelFormat ( HDC  aHdc)
staticprivateinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 349 of file G4OpenGLWin32Viewer.cc.

354{
355 // The ungessable...
356
357 PIXELFORMATDESCRIPTOR pfd;
358 pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
359 pfd.nVersion = 1;
360 pfd.dwFlags =
361 PFD_DRAW_TO_WINDOW |
362 PFD_SUPPORT_OPENGL |
363 PFD_DOUBLEBUFFER |
364 PFD_STEREO_DONTCARE;
365 pfd.iPixelType = PFD_TYPE_RGBA;
366 pfd.cColorBits = 32;
367 pfd.cRedBits = 8;
368 pfd.cRedShift = 16;
369 pfd.cGreenBits = 8;
370 pfd.cGreenShift = 8;
371 pfd.cBlueBits = 8;
372 pfd.cBlueShift = 0;
373 pfd.cAlphaBits = 0;
374 pfd.cAlphaShift = 0;
375 pfd.cAccumBits = 64;
376 pfd.cAccumRedBits = 16;
377 pfd.cAccumGreenBits = 16;
378 pfd.cAccumBlueBits = 16;
379 pfd.cAccumAlphaBits = 0;
380 pfd.cDepthBits = 32;
381 pfd.cStencilBits = 8;
382 pfd.cAuxBuffers = 0;
383 pfd.iLayerType = PFD_MAIN_PLANE;
384 pfd.bReserved = 0;
385 pfd.dwLayerMask = 0;
386 pfd.dwVisibleMask = 0;
387 pfd.dwDamageMask = 0;
388
389 G4int pixelIndex = ::ChoosePixelFormat(aHdc,&pfd);
390 if (pixelIndex==0) {
391 pixelIndex = 1;
392 if (::DescribePixelFormat(aHdc,
393 pixelIndex,
394 sizeof(PIXELFORMATDESCRIPTOR),
395 &pfd)==0) {
396 return false;
397 }
398 }
399 if (::SetPixelFormat(aHdc,pixelIndex,&pfd)==FALSE) return false;
400 return true;
401}
#define FALSE
Definition: Globals.hh:23

References FALSE.

Referenced by G4OpenGLWin32Viewer::CreateMainWindow().

◆ SetZoom()

void G4OpenGLWin32Viewer::SetZoom ( G4int  delta)
privateinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 470 of file G4OpenGLWin32Viewer.cc.

475{
476 if (fVP.GetFieldHalfAngle() == 0.) { // Orthographic projection
477 const G4double scale = 500; // Empirically chosen
478 fVP.MultiplyZoomFactor(1. + delta/scale);
479 } else { // Perspective projection
480 const G4double scale = fVP.GetFieldHalfAngle()/(10.*deg); // Empirical
481 fVP.SetDolly(fVP.GetDolly() + delta/scale);
482 }
483}
static constexpr double deg
Definition: G4SIunits.hh:132
void SetDolly(G4double dolly)
void MultiplyZoomFactor(G4double zoomFactorMultiplier)
G4double GetDolly() const

References deg, G4VViewer::fVP, G4ViewParameters::GetDolly(), G4ViewParameters::GetFieldHalfAngle(), G4ViewParameters::MultiplyZoomFactor(), and G4ViewParameters::SetDolly().

◆ ShowView()

void G4OpenGLWin32Viewer::ShowView ( void  )
virtualinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Reimplemented from G4VViewer.

Definition at line 59 of file G4OpenGLWin32Viewer.cc.

63{
64 if(!fHDC) return;
65 glFlush ();
66 // Empty the Windows message queue :
67 MSG event;
68 while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
69 ::TranslateMessage(&event);
70 ::DispatchMessage (&event);
71 }
72}

References G4OpenGLWin32Viewer::fHDC.

◆ sizeHasChanged()

G4bool G4OpenGLViewer::sizeHasChanged ( )
protectedinherited

◆ TOSelected()

virtual G4bool G4OpenGLStoredViewer::TOSelected ( size_t  )
inlineprotectedvirtualinherited

Reimplemented in G4OpenGLStoredQtViewer.

Definition at line 68 of file G4OpenGLStoredViewer.hh.

68{return true;}

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ TouchableSetColour()

void G4VViewer::TouchableSetColour ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath,
const G4Colour colour 
)
protectedinherited

Definition at line 180 of file G4VViewer.cc.

183{
184 // Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
185
186 std::ostringstream oss;
187 oss << "/vis/touchable/set/colour "
188 << colour.GetRed() << ' ' << colour.GetGreen()
189 << ' ' << colour.GetBlue() << ' ' << colour.GetAlpha();
190
191 // The following is equivalent to
192 // G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
193 // (assuming the touchable has already been set), but avoids view rebuild.
194
195 // Instantiate a working copy of a G4VisAttributes object...
196 G4VisAttributes workingVisAtts;
197 // and set the colour.
198 workingVisAtts.SetColour(colour);
199
202 (workingVisAtts,
205 // G4ModelingParameters::VASColour (VAS = Vis Attribute Signifier)
206 // signifies that it is the colour that should be picked out
207 // and merged with the touchable's normal vis attributes.
208
209 // Record on G4cout (with #) for information.
210 if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
211 G4cout << "# " << oss.str() << G4endl;
212 }
213}
static G4ModelingParameters::PVNameCopyNoPath GetPVNameCopyNoPath(const std::vector< G4PhysicalVolumeNodeID > &)
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
void SetColour(const G4Colour &)

References G4ViewParameters::AddVisAttributesModifier(), G4VViewer::fVP, G4cout, G4endl, G4Colour::GetAlpha(), G4Colour::GetBlue(), G4Colour::GetGreen(), G4PhysicalVolumeModel::GetPVNameCopyNoPath(), G4Colour::GetRed(), G4UImanager::GetUIpointer(), G4VisAttributes::SetColour(), and G4ModelingParameters::VASColour.

Referenced by G4OpenGLQtViewer::changeColorAndTransparency().

◆ TouchableSetVisibility()

void G4VViewer::TouchableSetVisibility ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath,
G4bool  visibility 
)
protectedinherited

Definition at line 146 of file G4VViewer.cc.

149{
150 // Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
151
152 std::ostringstream oss;
153 oss << "/vis/touchable/set/visibility ";
154 if (visibiity) oss << "true"; else oss << "false";
155
156 // The following is equivalent to
157 // G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
158 // (assuming the touchable has already been set), but avoids view rebuild.
159
160 // Instantiate a working copy of a G4VisAttributes object...
161 G4VisAttributes workingVisAtts;
162 // and set the visibility.
163 workingVisAtts.SetVisibility(visibiity);
164
167 (workingVisAtts,
170 // G4ModelingParameters::VASVisibility (VAS = Vis Attribute Signifier)
171 // signifies that it is the visibility that should be picked out
172 // and merged with the touchable's normal vis attributes.
173
174 // Record on G4cout (with #) for information.
175 if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
176 G4cout << "# " << oss.str() << G4endl;
177 }
178}
void SetVisibility(G4bool=true)

References G4ViewParameters::AddVisAttributesModifier(), G4VViewer::fVP, G4cout, G4endl, G4PhysicalVolumeModel::GetPVNameCopyNoPath(), G4UImanager::GetUIpointer(), G4VisAttributes::SetVisibility(), and G4ModelingParameters::VASVisibility.

Referenced by G4OpenGLQtViewer::setCheckComponent().

◆ TrackMouse()

void G4OpenGLWin32Viewer::TrackMouse ( G4int  x,
G4int  y 
)
privateinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 404 of file G4OpenGLWin32Viewer.cc.

410{
411 fMousePressed = true;
412 fMousePressedX = x;
413 fMousePressedY = y;
414}

References G4OpenGLWin32Viewer::fMousePressed, G4OpenGLWin32Viewer::fMousePressedX, and G4OpenGLWin32Viewer::fMousePressedY.

◆ WindowProc()

LRESULT CALLBACK G4OpenGLWin32Viewer::WindowProc ( HWND  aWindow,
UINT  aMessage,
WPARAM  aWParam,
LPARAM  aLParam 
)
staticprivateinherited

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 202 of file G4OpenGLWin32Viewer.cc.

210{
211 switch (aMessage) {
212 case WM_SIZE: {
213 //FIXME : have to handle WM_RESIZE
214 // Seems to be done (ovidio.pena AT upm.es, 2021/02/23)
215 auto* This = (G4OpenGLWin32Viewer*)
216 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
217 if (This) {
218 This->fWinSize_x = (G4int) LOWORD(aLParam);
219 This->fWinSize_y = (G4int) HIWORD(aLParam);
220 if (!This->fInCreateWindow) {
221 This->SetView();
222 glViewport(0, 0, This->fWinSize_x, This->fWinSize_y);
223 This->DrawView();
224 }
225 }
226 return 0;
227 }
228
229 case WM_PAINT: {
230 PAINTSTRUCT ps;
231 BeginPaint(aWindow, &ps);
232 auto* This = (G4OpenGLWin32Viewer*)
233 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
234 if (This) {
235 //FIXME : To have an automatic refresh someone have to redraw here.
236 // Seems to be done (ovidio.pena AT upm.es, 2021/02/23)
237 if(!This->fInCreateWindow) {
238 This->SetView();
239 This->ClearView();
240 This->DrawView();
241 }
242 }
243 EndPaint(aWindow, &ps);
244 return 0;
245 }
246
247 case WM_LBUTTONDOWN: {
248 auto* This = (G4OpenGLWin32Viewer*)
249 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
250 This->TrackMouse(LOWORD(aLParam), HIWORD(aLParam));
251 return 0;
252 }
253
254 case WM_RBUTTONDOWN: {
255 auto* This = (G4OpenGLWin32Viewer*)
256 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
257 This->TrackMouse(LOWORD(aLParam), HIWORD(aLParam));
258 return 0;
259 }
260
261 case WM_LBUTTONUP: {
262 auto* This = (G4OpenGLWin32Viewer*)
263 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
264 This->ReleaseMouse();
265 return 0;
266 }
267
268 case WM_RBUTTONUP: {
269 auto* This = (G4OpenGLWin32Viewer*)
270 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
271 This->ReleaseMouse();
272 return 0;
273 }
274
275 case WM_MOUSEHOVER: {
276 auto* This = (G4OpenGLWin32Viewer*)
277 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
278 This->fMouseHovered = true;
279 return 0;
280 }
281
282 case WM_MOUSELEAVE: {
283 auto* This = (G4OpenGLWin32Viewer*)
284 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
285 This->fMouseHovered = false;
286 return 0;
287 }
288
289 case WM_MOUSEMOVE: {
290 auto* This = (G4OpenGLWin32Viewer*)
291 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
292
293 if (!This->fMouseHovered) {
294 // mouse hover/leave tracking
295 TRACKMOUSEEVENT tme;
296 tme.cbSize = sizeof(tme);
297 tme.dwFlags = TME_HOVER | TME_LEAVE;
298 tme.hwndTrack = aWindow;
299 tme.dwHoverTime = HOVER_DEFAULT;
300 ::TrackMouseEvent(&tme);
301 This->fMouseHovered = true;
302 }
303
304 if (This->fMousePressed) {
305 G4int x = (G4int) LOWORD(aLParam);
306 G4int y = (G4int) HIWORD(aLParam);
307 G4int dx = x - This->fMousePressedX;
308 G4int dy = y - This->fMousePressedY;
309 This->fMousePressedX = x;
310 This->fMousePressedY = y;
311
312 if (aWParam == MK_LBUTTON) { // Rotation
313 This->SetRotation(dx, dy);
314 }
315
316 if (aWParam == MK_RBUTTON) { // Shift
317 This->SetShift(dx, dy);
318 }
319
320 This->SetView();
321 This->ClearView();
322 This->DrawView();
323 }
324
325 return 0;
326 }
327
328 case WM_MOUSEWHEEL: {
329 auto* This = (G4OpenGLWin32Viewer*)
330 ::GetWindowLongPtr(aWindow, GWLP_USERDATA);
331
332 G4int delta = (short) HIWORD(aWParam);
333
334 This->SetZoom(delta);
335
336 This->SetView();
337 This->ClearView();
338 This->DrawView();
339 return 0;
340 }
341
342 default:
343 return DefWindowProc(aWindow, aMessage, aWParam, aLParam);
344 }
345// return DefWindowProc(aWindow,aMessage,aWParam,aLParam);
346}
static constexpr double ps
Definition: G4SIunits.hh:157

References ps.

Referenced by G4OpenGLWin32Viewer::CreateMainWindow().

Field Documentation

◆ antialiasing_enabled

G4bool G4OpenGLViewer::antialiasing_enabled
protectedinherited

◆ background

G4Colour G4OpenGLViewer::background
protectedinherited

◆ fDefaultExportFilename

G4String G4OpenGLViewer::fDefaultExportFilename
privateinherited

Definition at line 220 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::G4OpenGLViewer().

◆ fDefaultExportImageFormat

std::string G4OpenGLViewer::fDefaultExportImageFormat
protectedinherited

Definition at line 210 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLQtViewer::actionSaveImage().

◆ fDefaultVP

G4ViewParameters G4VViewer::fDefaultVP
protectedinherited

◆ fDepthTestEnable

G4bool G4OpenGLStoredViewer::fDepthTestEnable
protectedinherited

Definition at line 70 of file G4OpenGLStoredViewer.hh.

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ fExportFilename

G4String G4OpenGLViewer::fExportFilename
privateinherited

◆ fExportFilenameIndex

int G4OpenGLViewer::fExportFilenameIndex
protectedinherited

◆ fExportImageFormat

std::string G4OpenGLViewer::fExportImageFormat
protectedinherited

◆ fExportImageFormatVector

std::vector< std::string > G4OpenGLViewer::fExportImageFormatVector
protectedinherited

◆ fG4OpenGLStoredSceneHandler

G4OpenGLStoredSceneHandler& G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler
protectedinherited

◆ fGL2PSAction

G4OpenGL2PSAction* G4OpenGLViewer::fGL2PSAction
protectedinherited

◆ fGl2psDefaultLineWith

int G4OpenGLViewer::fGl2psDefaultLineWith
privateinherited

Definition at line 222 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::printGl2PS().

◆ fGl2psDefaultPointSize

int G4OpenGLViewer::fGl2psDefaultPointSize
privateinherited

Definition at line 223 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::printGl2PS().

◆ fGlViewInitialized

bool G4OpenGLViewer::fGlViewInitialized
privateinherited

Definition at line 224 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::InitializeGLView().

◆ fHDC

HDC G4OpenGLWin32Viewer::fHDC
protectedinherited

◆ fHGLRC

HGLRC G4OpenGLWin32Viewer::fHGLRC
privateinherited

◆ fInCreateWindow

G4bool G4OpenGLWin32Viewer::fInCreateWindow
privateinherited

Definition at line 71 of file G4OpenGLWin32Viewer.hh.

Referenced by G4OpenGLWin32Viewer::CreateMainWindow().

◆ fIsGettingPickInfos

bool G4OpenGLViewer::fIsGettingPickInfos
privateinherited

Definition at line 241 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::GetPickDetails(), and G4OpenGLViewer::SetView().

◆ fLastVP

G4ViewParameters G4OpenGLStoredViewer::fLastVP
protectedinherited

◆ fMouseHovered

G4bool G4OpenGLWin32Viewer::fMouseHovered
protectedinherited

Definition at line 55 of file G4OpenGLWin32Viewer.hh.

◆ fMousePressed

G4bool G4OpenGLWin32Viewer::fMousePressed
protectedinherited

◆ fMousePressedX

G4int G4OpenGLWin32Viewer::fMousePressedX
protectedinherited

◆ fMousePressedY

G4int G4OpenGLWin32Viewer::fMousePressedY
protectedinherited

◆ fName

G4String G4VViewer::fName
protectedinherited

◆ fNeedKernelVisit

G4bool G4VViewer::fNeedKernelVisit
protectedinherited

◆ fOldDisplayListColor

G4Colour G4OpenGLStoredViewer::fOldDisplayListColor
protectedinherited

Definition at line 71 of file G4OpenGLStoredViewer.hh.

◆ fOpenGLSceneHandler

G4OpenGLSceneHandler& G4OpenGLViewer::fOpenGLSceneHandler
protectedinherited

Definition at line 197 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::GetPickDetails().

◆ fPan_sens

G4double G4OpenGLViewer::fPan_sens
protectedinherited

◆ fPointSize

G4float G4OpenGLViewer::fPointSize
privateinherited

Definition at line 218 of file G4OpenGLViewer.hh.

◆ fPrintColour

G4bool G4OpenGLViewer::fPrintColour
protectedinherited

◆ fPrintSizeX

G4int G4OpenGLViewer::fPrintSizeX
protectedinherited

◆ fPrintSizeY

G4int G4OpenGLViewer::fPrintSizeY
protectedinherited

◆ fRot_sens

G4double G4OpenGLViewer::fRot_sens
protectedinherited

◆ fSceneHandler

G4VSceneHandler& G4VViewer::fSceneHandler
protectedinherited

◆ fShortName

G4String G4VViewer::fShortName
protectedinherited

◆ fSizeHasChanged

G4bool G4OpenGLViewer::fSizeHasChanged
privateinherited

◆ fVectoredPs

G4bool G4OpenGLViewer::fVectoredPs
protectedinherited

◆ fViewId

G4int G4VViewer::fViewId
protectedinherited

◆ fVP

G4ViewParameters G4VViewer::fVP
protectedinherited

Definition at line 219 of file G4VViewer.hh.

Referenced by G4OpenGLQtViewer::actionChangeBackgroundColor(), G4OpenGLQtViewer::actionChangeDefaultColor(), G4OpenGLQtViewer::actionChangeTextColor(), G4OpenGLXmViewer::actions_callback(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLXmViewer::aux_edge_callback(), G4OpenGLQtViewer::changeDepthInSceneTree(), G4OpenGLStoredQtViewer::CompareForKernelVisit(), G4OpenGLStoredViewer::CompareForKernelVisit(), G4OpenInventorViewer::CompareForKernelVisit(), G4Qt3DViewer::CompareForKernelVisit(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::CompareForKernelVisit(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLWin32Viewer::CreateMainWindow(), G4OpenGLXmViewer::CreateMainWindow(), G4OpenGLXViewer::CreateMainWindow(), G4OpenGLQtViewer::CreateMainWindow(), G4OpenGLQtViewer::createPopupMenu(), G4OpenGLXmViewer::dolly_callback(), G4OpenGLStoredViewer::DrawDisplayLists(), G4OpenGLXmViewer::drawing_style_callback(), DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4OpenInventorViewer::DrawView(), G4Qt3DViewer::DrawView(), G4RayTracerViewer::DrawView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::DrawView(), G4VtkViewer::DrawViewHUD(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Export(), G4ASCIITreeViewer::G4ASCIITreeViewer(), G4HepRepFileViewer::G4HepRepFileViewer(), G4OpenGLQtViewer::G4keyPressEvent(), G4OpenGLQtViewer::G4MouseMoveEvent(), G4OpenGLQtViewer::G4MousePressEvent(), G4OpenGLQtViewer::G4MouseReleaseEvent(), G4OpenGLViewer::G4OpenGLViewer(), G4OpenInventorViewer::G4OpenInventorViewer(), G4VtkViewer::G4VtkViewer(), G4VViewer::G4VViewer(), G4OpenGLQtViewer::G4wheelEvent(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLXmViewer::GetXmConnection(), G4OpenInventorViewer::GroupCameraSensorCB(), G4OpenInventorQtViewer::Initialise(), G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), G4OpenInventorXtViewer::Initialise(), G4Qt3DViewer::Initialise(), G4RayTracerViewer::Initialise(), G4RayTracerXViewer::Initialise(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Initialise(), G4VtkQtViewer::Initialise(), G4VtkViewer::Initialise(), G4OpenGLViewer::InitializeGLView(), G4OpenGLXmViewer::left_right_pan_callback(), G4OpenGLXmViewer::misc_callback(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::mouse_move(), G4Qt3DViewer::mouseMoveEvent(), G4OpenGLQtViewer::moveScene(), G4OpenGLImmediateViewer::ProcessView(), G4OpenGLXmViewer::projection_callback(), G4OpenGLXmViewer::reset_callback(), G4OpenGLXmViewer::ResetView(), G4OpenGLViewer::rotateScene(), G4OpenGLViewer::rotateSceneInViewDirection(), G4OpenGLViewer::rotateSceneThetaPhi(), G4OpenGLViewer::rotateSceneToggle(), G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI(), G4DAWNFILEViewer::SendViewParameters(), G4VRML2FileViewer::SendViewParameters(), G4OpenGLXmViewer::set_rot_subject_callback(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4OpenGLWin32Viewer::SetRotation(), G4OpenGLWin32Viewer::SetShift(), G4OpenGLViewer::SetView(), G4OpenInventorQtViewer::SetView(), G4OpenInventorViewer::SetView(), G4OpenInventorWinViewer::SetView(), G4OpenInventorXtExtendedViewer::SetView(), G4OpenInventorXtViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), G4ToolsSGQtViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView(), G4VtkViewer::SetView(), G4VViewer::SetViewParameters(), G4OpenGLWin32Viewer::SetZoom(), G4OpenGLXViewer::ShowView(), G4VtkViewer::ShowView(), G4OpenGLQtViewer::toggleAux(), G4OpenGLQtViewer::toggleHiddenMarkers(), G4OpenGLQtViewer::togglePicking(), G4OpenGLQtViewer::toggleProjection(), G4OpenGLQtViewer::toggleSurfaceAction(), G4VViewer::TouchableSetColour(), G4VViewer::TouchableSetVisibility(), G4OpenGLXmViewer::up_down_pan_callback(), G4OpenGLXmViewer::update_panels_callback(), G4OpenGLXmViewer::UpdateControlPanel(), G4OpenGLQtViewer::updateToolbarAndMouseContextMenu(), G4OpenGLQtViewer::updateViewerPropertiesTableWidget(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::wheel_rotate(), G4Qt3DViewer::wheelEvent(), G4OpenGLXmViewer::wobble_callback(), G4OpenGLXmViewer::wobble_timer_callback(), and G4OpenGLXmViewer::zoom_callback().

◆ fWindow

HWND G4OpenGLWin32Viewer::fWindow
privateinherited

◆ fWinSize_x

unsigned int G4OpenGLViewer::fWinSize_x
protectedinherited

◆ fWinSize_y

unsigned int G4OpenGLViewer::fWinSize_y
protectedinherited

◆ haloing_enabled

G4bool G4OpenGLViewer::haloing_enabled
protectedinherited

◆ transparency_enabled

G4bool G4OpenGLViewer::transparency_enabled
protectedinherited

The documentation for this class was generated from the following files: