#include <TridFlatGLFrame.h>
Inheritance diagram for TridFlatGLFrame:

Public Member Functions | |
| TridFlatGLFrame (TridPage *tp, TGWindow &parent, TridControl *tc, const TridPOV &min=kTridPOV_DefaultRangeLow, const TridPOV &max=kTridPOV_DefaultRangeHigh, double scale=0.65) | |
| virtual | ~TridFlatGLFrame () |
| virtual void | SetupProjection () |
| virtual void | SetupOptions () |
| virtual void | SetupLighting (Bool_t lighting_on=true) |
| virtual void | TransformToPOV () |
| virtual Bool_t | HandleMotion (Event_t *ev) |
| virtual void | DrawObjects () |
| virtual Bool_t | HandleMotion (Event_t *) |
| virtual Bool_t | HandleMotion (int button, int startx, int starty, int stopx, int stopy) |
Private Attributes | |
| Double_t | fScale |
|
||||||||||||||||||||||||||||
|
Definition at line 25 of file TridFlatGLFrame.cxx. References fScale, max, min, MSG, and tc. 00029 : TridGLFrame( tp, parent, tc, min, max ) 00030 { 00031 // 00032 // 'scale' is the way to scale OpenGL units to window size. This is a course control, 00033 // overridden by the user. 00034 // 00035 // Min/max x/y are not limits for drawing, but rather limits to how far the POV center can be moved. 00036 // These should compare roughly with the drawable area. 00037 // 00038 // 00039 fScale = scale; 00040 00041 MSG("TriD",Msg::kDebug) << "TridFlatGLFrame constructor." << endl; 00042 }
|
|
|
Definition at line 44 of file TridFlatGLFrame.cxx. References MSG. 00045 {
00046 MSG("TriD",Msg::kDebug) << "TridFlatGLFrame constructor." << endl;
00047 }
|
|
|
Reimplemented from TridGLFrame. Reimplemented in TridHistoGLFrame. Definition at line 170 of file TridFlatGLFrame.cxx. References TridSketch::Draw(), TridSketchList::GetIterator(), TridSketchListItr::Next(), and TridSketchListItr::Reset(). 00171 {
00172 glMatrixMode(GL_MODELVIEW);
00173 TridSketchListItr itr = GetIterator();
00174 TridSketch* sketch;
00175 fNumSketches = 0;
00176 fNumSketchesDrawn = 0;
00177
00178 itr.Reset();
00179 while( (sketch = itr.Next()) ){
00180 fNumSketches++;
00181 Bool_t drawn = sketch->Draw(fAnimTimeMin, fAnimTimeMax);
00182 if(drawn) fNumSketchesDrawn++;
00183 }
00184 }
|
|
||||||||||||||||||||||||
|
|
|
|
|
|
|
Reimplemented from TridGLFrame. Reimplemented in TridHistoGLFrame. Definition at line 103 of file TridFlatGLFrame.cxx. References abs(), TridPOV::fDist, TridPOV::fx, TridPOV::fy, TridPOV::fz, TridPage::MouseOver(), TridGLFrame::Pick(), TridUndoable< STATECLASS >::Push(), TridPOVUndoable::PushIfChanged(), and TridGLFrame::Update(). 00104 {
00105 if(fButton == 0 ) {
00106 // The mouse is travelling.. pick and show.
00107 UInt_t name = Pick(ev->fX,ev->fY);
00108 if(name!=fPicked) {
00109 fPicked = name;
00110 fTridPage->MouseOver(fPicked);
00111 Update();
00112 }
00113 } else {
00114
00115 int delx, dely;
00116 delx = ev->fX - fMouseLast_x;
00117 dely = ev->fY - fMouseLast_y;
00118 fButtonTraveled+= abs(delx) + abs(dely);
00119
00120 if(abs(delx) + abs(dely)>0){
00121 if( (fButton ==kButton1) || (fButton ==kButton3) ) {
00122 // Slide.
00123
00124 GLfloat z;
00125 GLdouble x1, y1, z1;
00126 GLdouble x2, y2, z2;
00127 GLdouble model[16];
00128 GLdouble proj[16];
00129 GLint view[4];
00130 glGetDoublev(GL_MODELVIEW_MATRIX, model);
00131 glGetDoublev(GL_PROJECTION_MATRIX, proj);
00132 glGetIntegerv(GL_VIEWPORT, view);
00133
00134 glReadPixels(fMouseLast_x, fHeight-fMouseLast_y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
00135 gluUnProject(fMouseLast_x, fHeight-fMouseLast_y, z, model, proj, view, &x1, &y1, &z1);
00136 gluUnProject(ev->fX, fHeight-ev->fY, z, model, proj, view, &x2, &y2, &z2);
00137
00138 fPOV.fx -= x2-x1;
00139 fPOV.fy -= y2-y1;
00140 fPOV.fz -= z2-z1;
00141
00142 fPOV.Push();
00143 Update();
00144 }
00145
00146 if( fButton == kButton2 ) {
00147 // Scale. Towards center means shrink, away from center means grow.
00148 if(abs(delx) + abs(dely)>0){
00149 float sdx = (float)(fMouseLast_x - (fWidth/2.));
00150 float sdy = (float)(fMouseLast_y - (fHeight/2.));
00151 float dot = sdx*delx + sdy*dely;
00152 dot = dot/sqrt(sdy*sdy+sdx*sdx);
00153
00154 fPOV.fDist -= dot*100/(double)(fWidth);
00155 fPOV.PushIfChanged();
00156 Update();
00157 }
00158 }
00159
00160 }
00161
00162 fMouseLast_x = ev->fX;
00163 fMouseLast_y = ev->fY;
00164 }
00165
00166 return true;
00167 }
|
|
|
Reimplemented from TridGLFrame. Definition at line 69 of file TridFlatGLFrame.cxx. References TridGLFrame::SetupLighting(). 00070 {
00071 // Always do no lighting in these views.
00072 TridGLFrame::SetupLighting(false);
00073 }
|
|
|
Reimplemented from TridGLFrame. Definition at line 59 of file TridFlatGLFrame.cxx. 00060 {
00061 // Enables Smooth Color Shading; try GL_FLAT for (lack of) fun.
00062 glShadeModel(GL_SMOOTH);
00063 glEnable(GL_DEPTH_TEST); // Disable depth test if blending
00064 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00065 glEnable(GL_BLEND);
00066
00067 }
|
|
|
Reimplemented from TridGLFrame. Reimplemented in TridHistoGLFrame. Definition at line 49 of file TridFlatGLFrame.cxx. 00050 {
00051 // Set up the projection for the 3d window.
00052 float ratio = 1;
00053 if(fWidth>0) ratio = (float)fHeight/(float)fWidth;
00054 glOrtho(-1.0,1.0,
00055 -ratio,ratio,
00056 -1000.,1000.);
00057 }
|
|
|
Reimplemented from TridGLFrame. Reimplemented in TridHistoGLFrame. Definition at line 75 of file TridFlatGLFrame.cxx. References fScale, TridPOV::GetDist(), TridPOV::GetPhi(), TridPOV::GetTheta(), TridPOV::GetX(), TridPOV::GetY(), TridPOV::GetZ(), and TridGLFrame::NormalizeAndClipPOV(). 00076 {
00077 NormalizeAndClipPOV();
00078
00079 // Need to manipulate the ModelView matrix to move our model around.
00080 glMatrixMode(GL_MODELVIEW);
00081
00082 // Reset to 0,0,0; no rotation, no scaling.
00083 glLoadIdentity();
00084
00085 // 0.647 is a magic number found by trial and error: should match
00086 // the center of the plot nicely.
00087 double scale = (fScale/(fPOV.GetDist()+1.));
00088 if(fPOV.GetDist()<1) scale = (fScale*exp(-fPOV.GetDist()) );
00089 glScaled(scale,scale,scale);
00090
00091 // Rotate to our view.
00092 glRotatef(fPOV.GetTheta(),1.0f,0.0f,0.0f); // Rotate to elevation.
00093 glRotatef(fPOV.GetPhi() ,0.0f,1.0f,0.0f); // Rotate to side
00094
00095
00096 // Move to our viewpoint.
00097 glTranslatef(-fPOV.GetX(), -fPOV.GetY(), -fPOV.GetZ() ); // Move to our viewpoint.
00098
00099 }
|
|
|
Definition at line 42 of file TridFlatGLFrame.h. Referenced by TransformToPOV(), and TridFlatGLFrame(). |
1.3.9.1