DGtal  0.9.3
Viewer3D.h
1 
17 #pragma once
18 
31 #if defined(Viewer3D_RECURSES)
32 #error Recursive header files inclusion detected in Viewer3D.h
33 #else // defined(Viewer3D_RECURSES)
34 
35 #define Viewer3D_RECURSES
36 
37 #if !defined Viewer3D_h
38 
39 #define Viewer3D_h
40 
42 // Inclusions
43 #include "DGtal/base/Common.h"
44 
45 #include <iostream>
46 #include <vector>
47 #include <algorithm>
48 #ifdef WIN32
49 #include <windows.h>
50 #endif
51 #ifdef APPLE
52 #include <OpenGL/gl.h>
53 #include <OpenGL/glu.h>
54 #else
55 #include <GL/gl.h>
56 #include <GL/glu.h>
57 #endif
58 
59 #ifdef WITH_QT5
60  #include <QApplication>
61 #else
62  #include <QtGui/qapplication.h>
63 #endif
64 
65 #include <QGLViewer/qglviewer.h>
66 #include <QGLWidget>
67 #include <QKeyEvent>
68 
69 #include "DGtal/kernel/SpaceND.h"
70 #include "DGtal/topology/KhalimskySpaceND.h"
71 #include "DGtal/base/CountedPtr.h"
72 #include "DGtal/io/Display3D.h"
73 #include "DGtal/math/BasicMathFunctions.h"
74 
75 #include "DGtal/kernel/CSpace.h"
76 
78 
79 namespace DGtal
80 {
81 
83  // class Viewer3D
130  template < typename Space = SpaceND<3>,
131  typename KSpace = KhalimskySpaceND<3> >
132  class Viewer3D : public QGLViewer, public Display3D<Space, KSpace>
133  {
134 
136 
137  //---------------overwritting some functions of Display3D -------------------
138 
139  // ----------------------- public types ------------------------------
140  public:
141 
145  typedef typename Display::RealPoint RealPoint;
146 
148 
149  // ----------------------- Standard services ------------------------------
150  public:
151 
155  Viewer3D() :QGLViewer(), Display3D<Space, KSpace>()
156  {
157  resize(800,600);
158  };
159 
164  Viewer3D(const KSpace &KSEmb):QGLViewer(), Display3D<Space,KSpace>(KSEmb)
165  {
166  resize(800,600);
167  }
168 
175  void setCameraPosition(double ax, double ay, double az)
176  {
177  camera_position[0] = ax; camera_position[1] = ay; camera_position[2] = az;
178  }
179 
186  void setCameraDirection(double ax, double ay, double az)
187  {
188  camera_direction[0] = ax; camera_direction[1] = ay; camera_direction[2] = az;
189  }
190 
197  void setCameraUpVector(double ax, double ay, double az)
198  {
199  camera_upVector[0] = ax; camera_upVector[1] = ay; camera_upVector[2] = az;
200  }
201 
207  void setNearFar(double _near, double _far)
208  {
209  ZNear = _near; ZFar = _far;
210  }
211 
221  void setGLScale(float sx, float sy, float sz)
222  {
223  myGLScaleFactorX=sx;
224  myGLScaleFactorY=sy;
225  myGLScaleFactorZ=sz;
226  // In order to have the light source rendering the same as wtih the default scale 1.
227  glEnable(GL_NORMALIZE);
228  }
229 
230 
242  void setGLDoubleRenderingMode(bool doubleSidedRendering);
243 
244 
252  void setGLMaterialShininessCoefficient(const GLfloat matShininessCoeff);
253 
254 
263  void setGLLightAmbientCoefficients(const GLfloat lightAmbientCoeffs [4]);
264 
273  void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs [4]);
274 
275 
283  void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs [4]);
284 
285 
286 
297  void setUseGLPointForBalls(bool useOpenGLPt);
298 
299 
307  void updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true);
308 
309 
314 
323  double myGLPointMinWidth = 1.5;
324  double myGLLineMinWidth = 1.5;
325  bool myAutoSaveState;
327  // define the default rendering mode of the viewer
329 
335  {
336 
338  RealPoint point1;
339  RealPoint point2;
340  RealPoint point3;
341  RealPoint point4;
345  unsigned int myDomainWidth;
347  unsigned int myDomainHeight;
351  std::string myMode;
353  unsigned int myLineSetIndex;
354 
364  template<typename TDomain>
365  Image2DDomainD3D( TDomain aDomain, ImageDirection normalDir=zDirection,
366  double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, std::string mode= "BoundingBox")
367  {
369  myMode = mode;
370  myDirection=normalDir;
371  myDomainWidth = (aDomain.upperBound())[0]-(aDomain.lowerBound())[0]+1;
372  myDomainHeight = (aDomain.upperBound())[1]-(aDomain.lowerBound())[1]+1;
373  updateDomainOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
374  }
375 
376 
386  void updateDomainOrientation( ImageDirection normalDir,
387  double xBottomLeft, double yBottomLeft, double zBottomLeft);
388 
389 
396  void translateDomain(double xTranslation=0.0,
397  double yTranslation=0.0, double zTranslation=0.0);
398 
399  };
400 
401 
407  {
408 
409  RealPoint point1;
410  RealPoint point2;
411  RealPoint point3;
412  RealPoint point4;
413 
415 
416  unsigned int myImageWidth;
417  unsigned int myImageHeight;
418  //TODO complete desc attribute
419  unsigned int * myTabImage;
420 
422  unsigned int myIndexDomain;
424 
429  {
430  delete [] myTabImage;
431  };
432 
437  TextureImage(const TextureImage & img): point1(img.point1), point2(img.point2),
438  point3(img.point3), point4(img.point4),
439  myDirection(img.myDirection), myImageWidth(img.myImageWidth),
440  myImageHeight(img.myImageHeight),
441  myTabImage(img.myTabImage),
442  myDrawDomain(img.myDrawDomain),
443  myIndexDomain(img.myIndexDomain),
444  myMode(img.myMode)
445  {
446 
447  if(img.myImageHeight>0 && img.myImageWidth>0)
448  {
449  myTabImage = new unsigned int [img.myImageWidth*img.myImageHeight];
450  for(unsigned int i=0; i<img.myImageWidth*img.myImageHeight; i++)
451  {
452  myTabImage[i] = img.myTabImage[i];
453  }
454  }else
455  {
456  myTabImage=img.myTabImage;
457  }
458  };
459 
460 
461 
481  template <typename TImageType, typename TFunctor>
482 
483  TextureImage( const TImageType & image, const TFunctor &aFunctor,
484  ImageDirection normalDir=zDirection,
485  double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0,
486  TextureMode aMode= GrayScaleMode)
487  {
490  myDrawDomain=false;
491  myDirection=normalDir;
492  myImageWidth = (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1;
493  myImageHeight = (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1;
494  myTabImage = new unsigned int [myImageWidth*myImageHeight];
495  updateImageOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
496  myMode=aMode;
497  updateImageDataAndParam(image, aFunctor);
498  }
499 
509  void updateImageOrientation( ImageDirection normalDir,
510  double xBottomLeft, double yBottomLeft, double zBottomLeft);
511 
512 
520  void
521  updateImage3DEmbedding( RealPoint aPoint1,
522  RealPoint aPoint2,
523  RealPoint aPoint3,
524  RealPoint aPoint4)
525  {
526  point1 = aPoint1; point2 = aPoint2; point3 = aPoint3; point4 = aPoint4;
527  myDirection=undefDirection;
528  }
529 
530 
546  template <typename TImageType, typename TFunctor>
547  void updateImageDataAndParam(const TImageType & image, const TFunctor &aFunctor, double xTranslation=0.0,
548  double yTranslation=0.0, double zTranslation=0.0)
549  {
552  assert ( (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1== static_cast<int>(myImageWidth) &&
553  (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1== static_cast<int>(myImageHeight));
554 
555  point1[0] += xTranslation; point1[1] += yTranslation; point1[2] += zTranslation;
556  point2[0] += xTranslation; point2[1] +=yTranslation; point2[2] += zTranslation;
557  point3[0] += xTranslation; point3[1] += yTranslation; point3[2] += zTranslation;
558  point4[0] += xTranslation; point4[1] += yTranslation; point4[2] += zTranslation;
559 
560  unsigned int pos=0;
561  for(typename TImageType::Domain::ConstIterator it = image.domain().begin(), itend=image.domain().end();
562  it!=itend; ++it)
563  {
564  myTabImage[pos]= aFunctor(image(*it));
565  pos++;
566  }
567  }
568 
572  std::string className() const;
573 
574  private:
580  {};
581  };
582 
589 
590 
596  Viewer3D<Space, KSpace> & operator<< ( const typename Viewer3D<Space, KSpace>::StreamKey & key );
597 
598 
602  void sortSurfelFromCamera();
603 
607  void sortTriangleFromCamera();
608 
612  void sortQuadFromCamera();
613 
617  void sortPolygonFromCamera();
618 
619 
620 
621  template <typename TDrawableWithViewer3D>
630  Viewer3D<Space, KSpace> & operator<< ( const TDrawableWithViewer3D & object );
631 
632 
633 
634  // ----------------------- Interface --------------------------------------
635  public:
636 
641  void selfDisplay ( std::ostream & out ) const;
642 
647  bool isValid() const;
648 
649 
650 
651  virtual unsigned int getCurrentDomainNumber();
652 
653  virtual unsigned int getCurrentGLImageNumber();
654 
655 
661  virtual void paintGL();
662 
663 
670  virtual void show();
671 
672 
678  void addTextureImage(const TextureImage &image);
679 
680 
693  template <typename TImageType, typename TFunctor>
694 
695  void updateTextureImage(unsigned int imageIndex, const TImageType & image, const TFunctor & aFunctor,
696  double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0,
697  double rotationAngle=0.0, ImageDirection rotationDir=zDirection);
698 
699 
700 
701 
711  void updateOrientationTextureImage(unsigned int imageIndex,
712  double xPosition, double yPosition,
713  double zPosition, ImageDirection newDirection);
714 
715 
716 
725  void updateEmbeddingTextureImage(unsigned int anImageIndex,
726  typename Space::Point aPoint1, typename Space::Point aPoint2,
727  typename Space::Point aPoint3, typename Space::Point aPoint4);
728 
729 
730 
737  template<typename TDomain>
738  void addImage2DDomainD3D(const TDomain &anImageDomain, std::string mode,
739  const DGtal::Color &aColor=DGtal::Color::Red );
740 
741 
750  void updateAn2DDomainOrientation(unsigned int imageIndex,
751  double xPosition, double yPosition,
752  double zPosition, ImageDirection newDirection);
753 
761  void translateAn2DDomain(unsigned int domainIndex, double xTranslation,
762  double yTranslation, double zTranslation);
763 
770  std::vector<typename DGtal::Viewer3D< Space , KSpace >::LineD3D>
771  compute2DDomainLineRepresentation( Image2DDomainD3D &anImageDomain, double delta );
772 
778  std::vector<typename DGtal::Viewer3D< Space , KSpace >::LineD3D>
780 
781 
790  template < typename TContainer >
792  double angleRotation, ImageDirection dirRotation);
793 
794 
795 
804  void rotateDomain(Image2DDomainD3D &anDom, double angle, ImageDirection rotationDir);
805 
806 
807 
808 
809 
810 
811  // ------------------------- Protected Datas ------------------------------
812  private:
813 
814 
815 
816  public:
817 
818 
819 
820 
821 
822  // ------------------------- Hidden services ------------------------------
823  //protected:
824 
825 
831  void updateList ( bool needToUpdateBoundingBox=true );
832 
833 
838  void glDrawGLBall (const typename Viewer3D<Space,KSpace>::BallD3D & aBall );
839 
840 
841 
859  virtual void keyPressEvent ( QKeyEvent *e );
860 
866  virtual void mouseMoveEvent ( QMouseEvent *e );
867 
873  virtual void mousePressEvent ( QMouseEvent *e );
874 
880  virtual void mouseReleaseEvent ( QMouseEvent *e );
881 
886  {
887  qglviewer::Vec posCam;
888  bool operator() (typename Viewer3D<Space,KSpace>::CubeD3D s1,
889  typename Viewer3D<Space,KSpace>::CubeD3D s2 )
890  {
891  double dist1= sqrt ( ( posCam.x-s1.center[0] ) * ( posCam.x-s1.center[0] ) + ( posCam.y-s1.center[1] ) * ( posCam.y-s1.center[1] ) + ( posCam.z-s1.center[2] ) * ( posCam.z-s1.center[2] ) );
892  double dist2= sqrt ( ( posCam.x-s2.center[0] ) * ( posCam.x-s2.center[0] ) + ( posCam.y-s2.center[1] ) * ( posCam.y-s2.center[1] ) + ( posCam.z-s2.center[2] ) * ( posCam.z-s2.center[2] ) );
893  return dist1>dist2;
894  }
895  };
896 
897 
902  {
903  qglviewer::Vec posCam;
904  bool operator() ( typename Viewer3D<Space,KSpace>::TriangleD3D t1,
906  {
907  qglviewer::Vec center1 ( ( t1.point1[0]+t1.point2[0]+t1.point3[0] ) /3.0, ( t1.point1[1]+t1.point2[1]+t1.point3[1] ) /3.0, ( t1.point1[2]+t1.point2[2]+t1.point3[2] ) /3.0 );
908  qglviewer::Vec center2 ( ( t2.point1[0]+t2.point2[0]+t2.point3[0] ) /3.0, ( t2.point1[1]+t2.point2[1]+t2.point3[1] ) /3.0, ( t2.point1[2]+t2.point2[2]+t2.point3[2] ) /3.0 );
909  double dist1= sqrt ( ( posCam.x-center1.x ) * ( posCam.x-center1.x ) + ( posCam.y-center1.y ) * ( posCam.y-center1.y ) + ( posCam.z-center1.z ) * ( posCam.z-center1.z ) );
910  double dist2= sqrt ( ( posCam.x-center2.x ) * ( posCam.x-center2.x ) + ( posCam.y-center2.y ) * ( posCam.y-center2.y ) + ( posCam.z-center2.z ) * ( posCam.z-center2.z ) );
911 
912  return dist1>dist2;
913  }
914  };
915 
920  {
921  qglviewer::Vec posCam;
922  bool operator() (typename Viewer3D<Space,KSpace>::QuadD3D q1,
923  typename Viewer3D<Space,KSpace>::QuadD3D q2 )
924  {
925 
926  qglviewer::Vec center1 ( ( q1.point1[0]+q1.point2[0]+q1.point3[0]+q1.point4[0] ) /4.0, ( q1.point1[1]+q1.point2[1]+q1.point3[1]+q1.point4[1] ) /4.0, ( q1.point1[2]+q1.point2[2]+q1.point3[2]+q1.point4[2] ) /4.0 );
927  qglviewer::Vec center2 ( ( q2.point1[0]+q2.point2[0]+q2.point3[0]+q2.point4[0] ) /4.0, ( q2.point1[1]+q2.point2[1]+q2.point3[1]+q2.point4[1] ) /4.0, ( q2.point1[2]+q2.point2[2]+q2.point3[2]+q2.point4[2] ) /4.0 );
928 
929  double dist1= sqrt ( ( posCam.x-center1.x ) * ( posCam.x-center1.x ) + ( posCam.y-center1.y ) * ( posCam.y-center1.y ) + ( posCam.z-center1.z ) * ( posCam.z-center1.z ) );
930  double dist2= sqrt ( ( posCam.x-center2.x ) * ( posCam.x-center2.x ) + ( posCam.y-center2.y ) * ( posCam.y-center2.y ) + ( posCam.z-center2.z ) * ( posCam.z-center2.z ) );
931  return dist1>dist2;
932  }
933  };
934 
939  {
940  qglviewer::Vec posCam;
941  bool operator() ( typename Viewer3D<Space,KSpace>::PolygonD3D q1,
943  {
944  double c1x=0.0, c1y=0.0, c1z=0.0;
945  double c2x=0.0, c2y=0.0, c2z=0.0;
946  for(unsigned int i=0; i< q1.vertices.size(); i++){
947  c1x+=q1.vertices.at(i)[0];
948  c1y+=q1.vertices.at(i)[1];
949  c1z+=q1.vertices.at(i)[2];
950  }
951  for(unsigned int i=0; i< q2.vertices.size(); i++){
952  c2x+=q2.vertices.at(i)[0];
953  c2y+=q2.vertices.at(i)[1];
954  c2z+=q2.vertices.at(i)[2];
955  }
956 
957  qglviewer::Vec center1 ( c1x/(double)q1.vertices.size(),c1y/(double)q1.vertices.size(), c1z/(double)q1.vertices.size() );
958  qglviewer::Vec center2 ( c2x/(double)q2.vertices.size(),c2y/(double)q2.vertices.size(), c2z/(double)q2.vertices.size() );
959 
960  double dist1= sqrt ( ( posCam.x-center1.x ) * ( posCam.x-center1.x ) + ( posCam.y-center1.y ) * ( posCam.y-center1.y ) + ( posCam.z-center1.z ) * ( posCam.z-center1.z ) );
961  double dist2= sqrt ( ( posCam.x-center2.x ) * ( posCam.x-center2.x ) + ( posCam.y-center2.y ) * ( posCam.y-center2.y ) + ( posCam.z-center2.z ) * ( posCam.z-center2.z ) );
962  return dist1>dist2;
963  }
964  };
965 
966 
967 
971  virtual void drawWithNames();
972 
976  virtual void draw();
977 
981  virtual void init();
982 
986  virtual QString helpString() const;
987 
992  virtual void postSelection ( const QPoint& point );
993 
994 
995 
1005  virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
1006 
1007 
1018  virtual void initFromDOMElement(const QDomElement& element);
1019 
1020 
1028  protected: virtual void closeEvent ( QCloseEvent * e );
1029 
1030 
1031 
1032  // ------------------------- Internals ------------------------------------
1033  private:
1034 
1035 
1041  {
1043  RealPoint point1;
1044  RealPoint point2;
1045  RealPoint point3;
1046  RealPoint point4;
1047 
1049  unsigned int myImageWidth;
1050  unsigned int myImageHeight;
1051 
1052  unsigned int myBufferWidth;
1053  unsigned int myBufferHeight;
1056  unsigned char * myTextureImageBufferGS;
1057  unsigned char * myTextureImageBufferRGB;
1058  double vectNormal[3];
1059 
1060 
1061  // By definition in OpenGL the image size of texture should power of 2
1064 
1065 
1066  // Destructor
1068  {
1069  if(myMode== 1)
1070  {
1071  if(myTextureImageBufferGS!=0)
1072  delete [] myTextureImageBufferGS;
1073  }
1075  {
1076  if(myTextureImageBufferRGB!=0)
1077  delete [] myTextureImageBufferRGB;
1078  }
1079 
1080  }
1081 
1082  //Copy constructor from a GLTextureImage
1083  GLTextureImage(const GLTextureImage &aGLImg): myBufferWidth(aGLImg.myBufferWidth),
1084  myBufferHeight(aGLImg.myBufferHeight),
1085  myTextureName(aGLImg.myTextureName),
1086  myMode(aGLImg.myMode),
1087  myTextureFitX(aGLImg.myTextureFitX),
1088  myTextureFitY(aGLImg.myTextureFitY)
1089 
1090  {
1091  point1[0]=aGLImg.point1[0]; point1[1]=aGLImg.point1[1]; point1[2]=aGLImg.point1[2];
1092  point2[0]=aGLImg.point2[0]; point2[1]=aGLImg.point2[1]; point2[2]=aGLImg.point2[2];
1093  point3[0]=aGLImg.point3[0]; point3[1]=aGLImg.point3[1]; point3[2]=aGLImg.point3[2];
1094  point4[0]=aGLImg.point4[0]; point4[1]=aGLImg.point4[1]; point4[2]=aGLImg.point4[2];
1095  myImageWidth=aGLImg.myImageWidth; myImageHeight=aGLImg.myImageHeight;
1096  myDirection = aGLImg.myDirection;
1097  vectNormal[0]=aGLImg.vectNormal[0];
1098  vectNormal[1]=aGLImg.vectNormal[1];
1099  vectNormal[2]=aGLImg.vectNormal[2];
1100 
1101  if(myMode== 1)
1102  {
1103  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1104  for(unsigned int i=0; i<myBufferHeight*myBufferWidth;i++)
1105  {
1106  myTextureImageBufferGS[i]=aGLImg.myTextureImageBufferGS[i];
1107  }
1108  }else if(myMode==Viewer3D<Space, KSpace>::RGBMode)
1109  {
1110  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1111  for(unsigned int i=0; i<3*myBufferHeight*myBufferWidth;i+=3)
1112  {
1113  myTextureImageBufferRGB[i]=aGLImg.myTextureImageBufferRGB[i];
1114  myTextureImageBufferRGB[i+1]=aGLImg.myTextureImageBufferRGB[i+1];
1115  myTextureImageBufferRGB[i+2]=aGLImg.myTextureImageBufferRGB[i+2];
1116  }
1117  }
1118  }
1119 
1120 
1121  //Copy constructor from a TextureImage
1123  {
1124  point1[0]=aGSImage.point1[0]; point1[1]=aGSImage.point1[1]; point1[2]=aGSImage.point1[2];
1125  point2[0]=aGSImage.point2[0]; point2[1]=aGSImage.point2[1]; point2[2]=aGSImage.point2[2];
1126  point3[0]=aGSImage.point3[0]; point3[1]=aGSImage.point3[1]; point3[2]=aGSImage.point3[2];
1127  point4[0]=aGSImage.point4[0]; point4[1]=aGSImage.point4[1]; point4[2]=aGSImage.point4[2];
1128  myImageWidth=aGSImage.myImageWidth; myImageHeight=aGSImage.myImageHeight;
1129  myDirection = aGSImage.myDirection;
1130  myMode= aGSImage.myMode;
1131  vectNormal[0]= (myDirection == Viewer3D<Space, KSpace>::xDirection)? 1.0: 0.0;
1132  vectNormal[1]= (myDirection == Viewer3D<Space, KSpace>::yDirection)? -1.0: 0.0;
1133  vectNormal[2]= (myDirection == Viewer3D<Space, KSpace>::zDirection)? 1.0: 0.0;
1134  if(myDirection==undefDirection){
1135  RealPoint v1 = point2-point1;
1136  RealPoint v2 = point4-point1;
1137  vectNormal[0] = v1[1]*v2[2] - v1[2]*v2[1];
1138  vectNormal[1] = v1[2]*v2[0] - v1[0]*v2[2];
1139  vectNormal[2] = v1[0]*v2[1] - v1[1]*v2[0];
1140  double norm = sqrt(vectNormal[0]*vectNormal[0]+vectNormal[1]*vectNormal[1]+vectNormal[2]*vectNormal[2]);
1141  vectNormal[0] /=norm; vectNormal[1] /=norm; vectNormal[2] /=norm;
1142  }
1143 
1144  myBufferWidth = functions::roundToUpperPowerOfTwo(myImageWidth);
1145  myBufferHeight = functions::roundToUpperPowerOfTwo(myImageHeight);
1146 
1147  if(myMode== 1)
1148  {
1149  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1150  unsigned int pos=0;
1151  for (unsigned int i=0; i<myBufferHeight; i++)
1152  {
1153  for (unsigned int j=0; j<myBufferWidth; j++)
1154  {
1155  if(i<myImageHeight && j< myImageWidth)
1156  {
1157  myTextureImageBufferGS[pos]= aGSImage.myTabImage[i*myImageWidth+j];
1158  }else{
1159  myTextureImageBufferGS[pos]=0;
1160  }
1161  pos++;
1162  }
1163  }
1164  }else if(myMode==Viewer3D<Space, KSpace>::RGBMode)
1165  {
1166  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1167  unsigned int pos=0;
1168  for (unsigned int i=0; i<myBufferHeight; i++)
1169  {
1170  for (unsigned int j=0; j<myBufferWidth; j++)
1171  {
1172  if(i<myImageHeight && j< myImageWidth)
1173  {
1174  DGtal::Color aCol(aGSImage.myTabImage[i*myImageWidth+j]);
1175  myTextureImageBufferRGB[pos]= aCol.red();
1176  myTextureImageBufferRGB[pos+1]= aCol.green();
1177  myTextureImageBufferRGB[pos+2]= aCol.blue();
1178  }else{
1179  myTextureImageBufferRGB[pos]=0;
1180  myTextureImageBufferRGB[pos+1]=0;
1181  myTextureImageBufferRGB[pos+2]=0;
1182  }
1183  pos+=3;
1184  }
1185  }
1186  }
1187 
1188  myTextureFitX = 1.0-((myBufferWidth-myImageWidth)/(double)myBufferWidth);
1189  myTextureFitY = 1.0-((myBufferHeight-myImageHeight)/(double)myBufferHeight);
1190  }
1191  };
1192 
1193 
1194 
1200  typedef typename std::vector<typename Viewer3D<Space, KSpace>::CubeD3D> VectorCubes;
1201  typedef typename std::vector<typename Viewer3D<Space, KSpace>::QuadD3D> VectorQuad;
1202  typedef typename std::vector<typename Viewer3D<Space, KSpace>::LineD3D> VectorLine;
1203  typedef typename std::vector<typename Viewer3D<Space, KSpace>::BallD3D> VectorBall;
1204  typedef typename std::vector<typename Viewer3D<Space, KSpace>::TriangleD3D> VectorTriangle;
1205  typedef typename std::vector<typename Viewer3D<Space, KSpace>::PolygonD3D> VectorPolygon;
1206  typedef typename std::vector<typename Viewer3D<Space, KSpace>::TextureImage> VectorTextureImage;
1207 
1208 
1209  typedef typename VectorCubes::iterator ItCube;
1210 
1211 
1221  void glCreateListCubesMaps(const typename Display3D<Space, KSpace>::CubesMap &aCubeMap, unsigned int idList);
1222 
1223 
1224 
1230  void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList);
1231 
1232 
1238  void glCreateListLines(const VectorLine &aVectLine, unsigned int idList);
1239 
1240 
1246  void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList);
1247 
1248 
1258  void glCreateListQuadMaps(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1259 
1260 
1270  void glCreateListQuadMapsWired(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1271 
1272 
1281  void glCreateListTriangles(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1282 
1283 
1292  void glCreateListTrianglesWired(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1293 
1294 
1303  void glCreateListPolygons(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1304 
1305 
1314  void glCreateListPolygonsWired(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1315 
1316 
1322  void glUpdateTextureImages(const VectorTextureImage &aVectImage);
1323 
1324 
1331  void glUpdateLightRenderingMode() const;
1332 
1333 
1341 
1349 
1350 
1351 
1352 
1353  public:
1365  template<typename TImageORDomain>
1366  static
1367  void
1368  rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir){
1369  double xB = (anImageOrDom.point1[0]+anImageOrDom.point2[0]+anImageOrDom.point3[0]+anImageOrDom.point4[0])/4.0;
1370  double yB = (anImageOrDom.point1[1]+anImageOrDom.point2[1]+anImageOrDom.point3[1]+anImageOrDom.point4[1])/4.0;
1371  double zB = (anImageOrDom.point1[2]+anImageOrDom.point2[2]+anImageOrDom.point3[2]+anImageOrDom.point4[2])/4.0;
1372  rotatePoint( anImageOrDom.point1[0], anImageOrDom.point1[1], anImageOrDom.point1[2], xB, yB, zB, angle, rotationDir);
1373  rotatePoint( anImageOrDom.point2[0], anImageOrDom.point2[1], anImageOrDom.point2[2], xB, yB, zB, angle, rotationDir);
1374  rotatePoint( anImageOrDom.point3[0], anImageOrDom.point3[1], anImageOrDom.point3[2], xB, yB, zB, angle, rotationDir);
1375  rotatePoint( anImageOrDom.point4[0], anImageOrDom.point4[1], anImageOrDom.point4[2], xB, yB, zB, angle, rotationDir);
1376 
1377  }
1378 
1392  template <typename TValues>
1393  static
1394  void rotatePoint(TValues &x, TValues &y, TValues &z,
1395  double cx, double cy, double cz,
1396  double rotationAngle, ImageDirection rotationDir);
1397 
1398 
1399 
1400 
1401 
1402  // ------------------------- Private Datas --------------------------------
1403  private:
1404 
1406  //GLuint myListToAff;
1407 
1410 
1413 
1417 
1420 
1423 
1425 
1426  unsigned int myNbListe;
1427  unsigned int myNbLineSetList;
1428  unsigned int myNbBallSetList;
1429  unsigned int myNbPrismSetList;
1430 
1433  unsigned char mySelectionColorShift = 150;
1434 
1440  std::vector<GLTextureImage> myVectTextureImage;
1441 
1443 
1444  double camera_position[3];
1445  double camera_direction[3];
1446  double camera_upVector[3];
1447 
1448  bool myLightPositionFixToCamera = true; // when false the light position is fix according to the scene.
1449  double myLightTheta;
1450  double myLightPhi;
1451  double myLightR;
1452  GLfloat myLightPosition [4] = {0.0f, 0.0f, 1.0f, 1.0f}; // the light position in cartesian coordinate
1453  GLfloat myLightPositionRefCameraDefault [3] = {-100.0f, 100.0f, 0.0f}; // the light default position according to the camera position
1454  GLfloat myLightPositionRefCamera [3] = {0.0f, 0.0f, 0.0f}; // the light position according to the camera position
1455  GLfloat myMaterialShininessCoeff[1] = {50.0f} ; // the material shininess coefficient used in opengl rendering
1456  GLfloat myMaterialSpecularCoeffs[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // the light specular coefficients used in opengl rendering
1457  GLfloat myLightSpecularCoeffs[4] = { 0.3f, 0.3f, 0.3f, 1.0f }; // the light specular coefficients used in opengl rendering
1458  GLfloat myLightAmbientCoeffs[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; // the material ambient coefficients used in opengl rendering
1459  GLfloat myLightDiffuseCoeffs[4] = { 0.7f, 0.7f, 0.7f, 1.0f }; // the material diffuse coefficients used in opengl rendering
1460 
1461  const GLfloat myDefaultRenderSpec = 0.3f; // default specular coefficients for default mode rendering
1462  const GLfloat myDefaultRenderDiff = 0.7f; // default diffuse coefficients for metallic mode rendering
1463  const GLfloat myLambertRenderSpec = 0.0f; // default specular coefficients for default mode rendering
1464  const GLfloat myLambertRenderDiff = 0.9f; // default diffuse coefficients for metallic mode rendering
1465  const GLfloat myMetallicRenderSpec = 0.5f; // default specular coefficients for metallic mode rendering
1466  const GLfloat myMetallicRenderDiff = 0.5f; // default diffuse coefficients for metallic mode rendering
1467  const GLfloat myPlasticRenderSpec = 0.8f; // default specular coefficients for platic mode rendering
1468  const GLfloat myPlasticRenderDiff = 0.2f; // default diffuse coefficients for platic mode rendering
1469 
1470  bool myUseGLPointsForBalls = false; // to display balls with GL points (instead real ball)
1471 
1472  double ZNear;
1473  double ZFar;
1474 
1475  //the default width of the mesh line
1477 
1478  // To apply openGL ajustment only on visualisation
1479  float myGLScaleFactorX=1.0;
1480  float myGLScaleFactorY=1.0;
1481  float myGLScaleFactorZ=1.0;
1482 
1483  // Used to apply interactive light rotation
1488 
1490  std::vector<TextureImage> myGSImageList;
1492  std::vector<Image2DDomainD3D> myImageDomainList;
1493 
1494  }; // end of class Viewer3D
1495 
1496 
1497 
1498  template < typename Space, typename KSpace>
1505  std::ostream&
1506  operator<< ( std::ostream & out, const Viewer3D<Space, KSpace> & object );
1507 } // namespace DGtal
1508 
1509 
1511 // Includes inline functions.
1512 #include "DGtal/io/viewers/Viewer3D.ih"
1513 
1514 // //
1516 
1517 #endif // !defined Viewer3D_h
1518 
1519 #undef Viewer3D_RECURSES
1520 #endif // else defined(Viewer3D_RECURSES)
unsigned int myNbBallSetList
Definition: Viewer3D.h:1428
virtual void postSelection(const QPoint &point)
postSelection
qglviewer::Vec myOrig
information linked to the navigation in the viewer
Definition: Viewer3D.h:1436
std::vector< typename Viewer3D< Space, KSpace >::TriangleD3D > VectorTriangle
Definition: Viewer3D.h:1204
bool myViewWire
objects have shadows which follow the camera if false
Definition: Viewer3D.h:322
double ZNear
znear distance
Definition: Viewer3D.h:1472
void updateImageDataAndParam(const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
Definition: Viewer3D.h:547
void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList)
const GLfloat myMetallicRenderSpec
Definition: Viewer3D.h:1465
void rotateLineD3D(typename DGtal::Display3D< Space, KSpace >::LineD3D &aLine, DGtal::PointVector< 3, int, TContainer > pt, double angleRotation, ImageDirection dirRotation)
GLfloat myMaterialShininessCoeff[1]
Definition: Viewer3D.h:1455
unsigned int myNbLineSetList
Definition: Viewer3D.h:1427
MyDigitalSurface::ConstIterator ConstIterator
GLfloat myLightPositionRefCamera[3]
Definition: Viewer3D.h:1454
const GLfloat myMetallicRenderDiff
Definition: Viewer3D.h:1466
void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList)
~TextureImage()
the mode of representation of the image
Definition: Viewer3D.h:428
std::vector< GLTextureImage > myVectTextureImage
list of the images textures in this viewer
Definition: Viewer3D.h:1440
static void rotatePoint(TValues &x, TValues &y, TValues &z, double cx, double cy, double cz, double rotationAngle, ImageDirection rotationDir)
void setCameraUpVector(double ax, double ay, double az)
Definition: Viewer3D.h:197
void setUseGLPointForBalls(bool useOpenGLPt)
double myLightPhi
the light position (inclination)
Definition: Viewer3D.h:1450
GLuint myBallSetListId
Definition: Viewer3D.h:1415
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Definition: SpaceND.h:95
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
double myGLPointMinWidth
Definition: Viewer3D.h:323
virtual QString helpString() const
unsigned int myDomainWidth
the width of the image domain
Definition: Viewer3D.h:345
ImageDirection myDirection
Definition: Viewer3D.h:414
virtual void mousePressEvent(QMouseEvent *e)
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1048
unsigned int myNbListe
number of lists in myListToAff
Definition: Viewer3D.h:1426
void updateEmbeddingTextureImage(unsigned int anImageIndex, typename Space::Point aPoint1, typename Space::Point aPoint2, typename Space::Point aPoint3, typename Space::Point aPoint4)
Image2DDomainD3D(TDomain aDomain, ImageDirection normalDir=zDirection, double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, std::string mode="BoundingBox")
Definition: Viewer3D.h:365
void updateLightCoordsFromCamera()
void updateAn2DDomainOrientation(unsigned int imageIndex, double xPosition, double yPosition, double zPosition, ImageDirection newDirection)
bool myIsMovingLight
the reference mouse y-position used to determince the light position change (inclination) ...
Definition: Viewer3D.h:1487
void glCreateListQuadMaps(const typename Display3D< Space, KSpace >::QuadsMap &aQuadMap, unsigned int idList)
int myRefMouseXPos
the angle rotation increment used for interactive light move
Definition: Viewer3D.h:1485
qglviewer::Vec myDirSelector
Definition: Viewer3D.h:1436
const GLfloat myPlasticRenderSpec
Definition: Viewer3D.h:1467
bool myAutoSaveState
flag to save automatically or not the Viewer3d state when closing the viewer
Definition: Viewer3D.h:326
void setCameraDirection(double ax, double ay, double az)
Definition: Viewer3D.h:186
std::vector< typename Viewer3D< Space, KSpace >::PolygonD3D > VectorPolygon
Definition: Viewer3D.h:1205
GLfloat myLightDiffuseCoeffs[4]
Definition: Viewer3D.h:1459
void glDrawGLBall(const typename Viewer3D< Space, KSpace >::BallD3D &aBall)
TextureImage(const TImageType &image, const TFunctor &aFunctor, ImageDirection normalDir=zDirection, double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, TextureMode aMode=GrayScaleMode)
Definition: Viewer3D.h:483
virtual void mouseMoveEvent(QMouseEvent *e)
void rotateDomain(Image2DDomainD3D &anDom, double angle, ImageDirection rotationDir)
GLfloat myLightSpecularCoeffs[4]
Definition: Viewer3D.h:1457
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:419
void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs [4])
GLTextureImage(const typename Viewer3D< Space, KSpace >::TextureImage &aGSImage)
Definition: Viewer3D.h:1122
DGtal::SpaceND ::RealPoint RealPoint
RealPoint type.
Definition: Display3D.h:101
QPoint myPosSelector
a point selected with postSelection
Definition: Viewer3D.h:1438
ImageDirection myDirection
the direction of the domain (x, y or z axe)
Definition: Viewer3D.h:349
Display::SelectCallbackFct SelectCallbackFct
Definition: Viewer3D.h:143
std::vector< typename Viewer3D< Space, KSpace >::BallD3D > VectorBall
Definition: Viewer3D.h:1203
bool myIsBackgroundDefault
true if the background is default
Definition: Viewer3D.h:320
const GLfloat myDefaultRenderDiff
Definition: Viewer3D.h:1462
BOOST_CONCEPT_ASSERT((concepts::CSpace< Space >))
std::map< DGtal::int32_t, std::vector< QuadD3D > > QuadsMap
The type that maps identifier name -> vector of QuadD3D.
Definition: Display3D.h:254
unsigned int myIndexDomain
true if the draw have a domain
Definition: Viewer3D.h:422
std::vector< RealPoint > vertices
Definition: Display3D.h:243
void updateImage3DEmbedding(RealPoint aPoint1, RealPoint aPoint2, RealPoint aPoint3, RealPoint aPoint4)
Definition: Viewer3D.h:521
const GLfloat myLambertRenderSpec
Definition: Viewer3D.h:1463
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:89
virtual void paintGL()
Overload of the QGLViewer method in order to change the order of display (to fix the QGLViewer axis d...
double camera_position[3]
camera position
Definition: Viewer3D.h:1444
unsigned int myLineSetIndex
the index of the line of the domain in the lineSetList of the viewer
Definition: Viewer3D.h:353
void updateTextureImage(unsigned int imageIndex, const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0, double rotationAngle=0.0, ImageDirection rotationDir=zDirection)
double myLightTheta
Definition: Viewer3D.h:1449
void glCreateListQuadMapsWired(const typename Display3D< Space, KSpace >::QuadsMap &aQuadMap, unsigned int idList)
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1055
void selfDisplay(std::ostream &out) const
qglviewer::Vec myDir
Definition: Viewer3D.h:1436
GLuint myQuadsMapId
Definition: Viewer3D.h:1418
void sortPolygonFromCamera()
void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs [4])
DGtal::Color myDefaultColor
the default color of the viewer
Definition: Viewer3D.h:318
bool myLightPositionFixToCamera
Definition: Viewer3D.h:1448
void glCreateListPolygonsWired(const std::vector< VectorPolygon > &aVectPolygon, unsigned int idList)
std::vector< typename DGtal::Viewer3D< Space, KSpace >::LineD3D > compute2DDomainLineRepresentation(Image2DDomainD3D &anImageDomain, double delta)
void addImage2DDomainD3D(const TDomain &anImageDomain, std::string mode, const DGtal::Color &aColor=DGtal::Color::Red)
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:129
double ZFar
zfar distance
Definition: Viewer3D.h:1473
virtual void draw()
draw
std::vector< typename Viewer3D< Space, KSpace >::TextureImage > VectorTextureImage
Definition: Viewer3D.h:1206
void setGLMaterialShininessCoefficient(const GLfloat matShininessCoeff)
RenderingMode myRenderingMode
Definition: Viewer3D.h:328
void updateDomainOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
bool myUseGLPointsForBalls
Definition: Viewer3D.h:1470
RealPoint center
The center coordinate of the cube.
Definition: Display3D.h:162
void addTextureImage(const TextureImage &image)
virtual unsigned int getCurrentGLImageNumber()
std::map< DGtal::int32_t, std::vector< CubeD3D > > CubesMap
The type that maps identifier name -> vector of CubeD3D.
Definition: Display3D.h:257
void setGLLightAmbientCoefficients(const GLfloat lightAmbientCoeffs [4])
void updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true)
int mySelectedElementId
used to displayed selected elements
Definition: Viewer3D.h:1432
void setNearFar(double _near, double _far)
Definition: Viewer3D.h:207
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines...
Definition: CSpace.h:105
void sortTriangleFromCamera()
double myLightR
the light position (azimuth)
Definition: Viewer3D.h:1451
GLuint myCubeSetListWiredId
Definition: Viewer3D.h:1422
static void rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir)
Definition: Viewer3D.h:1368
GLuint myPolygonSetListId
Definition: Viewer3D.h:1411
void updateRelativeCameraFromLightPosition()
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1056
std::vector< typename Viewer3D< Space, KSpace >::CubeD3D > VectorCubes
Definition: Viewer3D.h:1200
SelectCallbackFct getSelectCallback3D(DGtal::int32_t aName, void *&data) const
GLuint myTriangleSetListWiredId
Definition: Viewer3D.h:1409
qglviewer::Vec mySelectedPoint
Definition: Viewer3D.h:1436
const GLfloat myLambertRenderDiff
Definition: Viewer3D.h:1464
void updateList(bool needToUpdateBoundingBox=true)
int myRefMouseYPos
the reference mouse x-position used to determince the light position change (azimuth) ...
Definition: Viewer3D.h:1486
DGtal::Color color
The image domain color.
Definition: Viewer3D.h:343
std::vector< TextureImage > myGSImageList
flag to display the ligth source when it is moved by the user
Definition: Viewer3D.h:1490
void glCreateListCubesMaps(const typename Display3D< Space, KSpace >::CubesMap &aCubeMap, unsigned int idList)
DGtal::Color myDefaultBackgroundColor
the default background color of the viewer
Definition: Viewer3D.h:316
GLuint myPolygonSetListWiredId
Definition: Viewer3D.h:1412
DGtal is the top-level namespace which contains all DGtal functions and types.
int(* SelectCallbackFct)(void *viewer, DGtal::int32_t name, void *data)
Select callback function type.
Definition: Display3D.h:109
unsigned int myNbPrismSetList
Definition: Viewer3D.h:1429
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:416
float myGLScaleFactorX
Definition: Viewer3D.h:1479
void glCreateListPolygons(const std::vector< VectorPolygon > &aVectPolygon, unsigned int idList)
void setGLDoubleRenderingMode(bool doubleSidedRendering)
Display::RealPoint RealPoint
Definition: Viewer3D.h:145
void updateOrientationTextureImage(unsigned int imageIndex, double xPosition, double yPosition, double zPosition, ImageDirection newDirection)
std::vector< typename Viewer3D< Space, KSpace >::LineD3D > VectorLine
Definition: Viewer3D.h:1202
void glUpdateLightRenderingMode() const
float myGLScaleFactorZ
Definition: Viewer3D.h:1481
RealPoint point1
The image domain coordinates.
Definition: Viewer3D.h:338
virtual unsigned int getCurrentDomainNumber()
std::vector< Image2DDomainD3D > myImageDomainList
Used to store all the domains.
Definition: Viewer3D.h:1492
Display3D< Space, KSpace > Display
Definition: Viewer3D.h:142
GLfloat myLightAmbientCoeffs[4]
Definition: Viewer3D.h:1458
void translateDomain(double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1057
GLuint myCubesMapId
Definition: Viewer3D.h:1421
virtual void closeEvent(QCloseEvent *e)
Overload the QWidget method to customize the viewer state auto saving. Now it save the viewer state i...
GLfloat myLightPosition[4]
the light position (distance)
Definition: Viewer3D.h:1452
GLTextureImage(const GLTextureImage &aGLImg)
Definition: Viewer3D.h:1083
virtual void keyPressEvent(QKeyEvent *e)
double camera_upVector[3]
camera up-vector
Definition: Viewer3D.h:1446
void glCreateListTrianglesWired(const std::vector< VectorTriangle > &aVectTriangle, unsigned int idList)
std::string myMode
the mode of representation of the image domain
Definition: Viewer3D.h:351
T roundToUpperPowerOfTwo(const T &n)
double myGLLineMinWidth
to improve the display of gl points
Definition: Viewer3D.h:324
const GLfloat myPlasticRenderDiff
Definition: Viewer3D.h:1468
void glCreateListTriangles(const std::vector< VectorTriangle > &aVectTriangle, unsigned int idList)
void setCameraPosition(double ax, double ay, double az)
Definition: Viewer3D.h:175
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
void sortQuadFromCamera()
ImageDirection
the 3 possible axes for the image direction
Definition: Viewer3D.h:311
RealPoint point1
coordinates
Definition: Viewer3D.h:1043
virtual void initFromDOMElement(const QDomElement &element)
Overload of the QGLViewer method which restores the viewer state from a QDomDocument element...
GLfloat myMaterialSpecularCoeffs[4]
Definition: Viewer3D.h:1456
TextureImage(const TextureImage &img)
Copy constructor (needed due to myTabImage)
Definition: Viewer3D.h:437
void green(const unsigned char aGreenValue)
float myGLScaleFactorY
Definition: Viewer3D.h:1480
Viewer3D< Space, KSpace > & operator<<(const DGtal::Color &aColor)
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:417
VectorCubes::iterator ItCube
Definition: Viewer3D.h:1209
static const Color Red
Definition: Color.h:391
TextureMode
the modes of representation of an image
Definition: Viewer3D.h:313
Viewer3D(const KSpace &KSEmb)
Definition: Viewer3D.h:164
unsigned int myDomainHeight
the height of the image domain
Definition: Viewer3D.h:347
virtual void mouseReleaseEvent(QMouseEvent *e)
GLuint myPrismListId
Definition: Viewer3D.h:1416
void red(const unsigned char aRedValue)
Aim: Defines the concept describing a read-only image, which is a refinement of CPointFunctor.
Definition: CConstImage.h:94
void sortSurfelFromCamera()
virtual QDomElement domElement(const QString &name, QDomDocument &document) const
Overload of the QGLViewer method which returns an XML QDomElement representing the QGLViewer state...
TextureMode myMode
index of the image domain if exist
Definition: Viewer3D.h:423
void setGLScale(float sx, float sy, float sz)
Definition: Viewer3D.h:221
bool myDrawDomain
for each pixel of the image, color or height ?
Definition: Viewer3D.h:421
double myLigthRotationStep
Definition: Viewer3D.h:1484
bool myIsDoubleFaceRendering
true if is double face rendering
Definition: Viewer3D.h:1442
GLuint myQuadsMapWiredId
Definition: Viewer3D.h:1419
const GLfloat myDefaultRenderSpec
Definition: Viewer3D.h:1461
GLuint myLineSetListId
Definition: Viewer3D.h:1414
GLfloat myLightPositionRefCameraDefault[3]
Definition: Viewer3D.h:1453
bool isValid() const
Image image(domain)
unsigned char mySelectionColorShift
Definition: Viewer3D.h:1433
void glCreateListLines(const VectorLine &aVectLine, unsigned int idList)
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector...
Definition: Common.h:141
std::vector< typename Viewer3D< Space, KSpace >::QuadD3D > VectorQuad
Definition: Viewer3D.h:1201
void translateAn2DDomain(unsigned int domainIndex, double xTranslation, double yTranslation, double zTranslation)
virtual void init()
init
float myMeshDefaultLineWidth
Definition: Viewer3D.h:1476
double camera_direction[3]
camera direction
Definition: Viewer3D.h:1445
virtual void drawWithNames()
drawWithNames
void glUpdateTextureImages(const VectorTextureImage &aVectImage)
GLuint myTriangleSetListId
lists of the list to draw
Definition: Viewer3D.h:1408
void blue(const unsigned char aBlueValue)