DGtal  0.9.2
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  }
227 
228 
240  void setGLDoubleRenderingMode(bool doubleSidedRendering);
241 
242 
250  void setGLMaterialShininessCoefficient(const GLfloat matShininessCoeff);
251 
252 
261  void setGLLightAmbientCoefficients(const GLfloat lightAmbientCoeffs [4]);
262 
271  void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs [4]);
272 
273 
281  void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs [4]);
282 
283 
284 
295  void setUseGLPointForBalls(bool useOpenGLPt);
296 
297 
305  void updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true);
306 
307 
312 
321  double myGLPointMinWidth = 1.5;
322  double myGLLineMinWidth = 1.5;
323  bool myAutoSaveState;
325  // define the default rendering mode of the viewer
327 
333  {
334 
336  RealPoint point1;
337  RealPoint point2;
338  RealPoint point3;
339  RealPoint point4;
343  unsigned int myDomainWidth;
345  unsigned int myDomainHeight;
349  std::string myMode;
351  unsigned int myLineSetIndex;
352 
362  template<typename TDomain>
363  Image2DDomainD3D( TDomain aDomain, ImageDirection normalDir=zDirection,
364  double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0, std::string mode= "BoundingBox")
365  {
367  myMode = mode;
368  myDirection=normalDir;
369  myDomainWidth = (aDomain.upperBound())[0]-(aDomain.lowerBound())[0]+1;
370  myDomainHeight = (aDomain.upperBound())[1]-(aDomain.lowerBound())[1]+1;
371  updateDomainOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
372  }
373 
374 
384  void updateDomainOrientation( ImageDirection normalDir,
385  double xBottomLeft, double yBottomLeft, double zBottomLeft);
386 
387 
394  void translateDomain(double xTranslation=0.0,
395  double yTranslation=0.0, double zTranslation=0.0);
396 
397  };
398 
399 
405  {
406 
407  RealPoint point1;
408  RealPoint point2;
409  RealPoint point3;
410  RealPoint point4;
411 
413 
414  unsigned int myImageWidth;
415  unsigned int myImageHeight;
416  //TODO complete desc attribute
417  unsigned int * myTabImage;
418 
420  unsigned int myIndexDomain;
422 
427  {
428  delete [] myTabImage;
429  };
430 
435  TextureImage(const TextureImage & img): point1(img.point1), point2(img.point2),
436  point3(img.point3), point4(img.point4),
437  myDirection(img.myDirection), myImageWidth(img.myImageWidth),
438  myImageHeight(img.myImageHeight),
439  myTabImage(img.myTabImage),
440  myDrawDomain(img.myDrawDomain),
441  myIndexDomain(img.myIndexDomain),
442  myMode(img.myMode)
443  {
444 
445  if(img.myImageHeight>0 && img.myImageWidth>0)
446  {
447  myTabImage = new unsigned int [img.myImageWidth*img.myImageHeight];
448  for(unsigned int i=0; i<img.myImageWidth*img.myImageHeight; i++)
449  {
450  myTabImage[i] = img.myTabImage[i];
451  }
452  }else
453  {
454  myTabImage=img.myTabImage;
455  }
456  };
457 
458 
459 
479  template <typename TImageType, typename TFunctor>
480 
481  TextureImage( const TImageType & image, const TFunctor &aFunctor,
482  ImageDirection normalDir=zDirection,
483  double xBottomLeft=0.0, double yBottomLeft=0.0, double zBottomLeft=0.0,
484  TextureMode aMode= GrayScaleMode)
485  {
488  myDrawDomain=false;
489  myDirection=normalDir;
490  myImageWidth = (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1;
491  myImageHeight = (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1;
492  myTabImage = new unsigned int [myImageWidth*myImageHeight];
493  updateImageOrientation(normalDir, xBottomLeft, yBottomLeft, zBottomLeft);
494  myMode=aMode;
495  updateImageDataAndParam(image, aFunctor);
496  }
497 
507  void updateImageOrientation( ImageDirection normalDir,
508  double xBottomLeft, double yBottomLeft, double zBottomLeft);
509 
510 
518  void
519  updateImage3DEmbedding( RealPoint aPoint1,
520  RealPoint aPoint2,
521  RealPoint aPoint3,
522  RealPoint aPoint4)
523  {
524  point1 = aPoint1; point2 = aPoint2; point3 = aPoint3; point4 = aPoint4;
525  myDirection=undefDirection;
526  }
527 
528 
544  template <typename TImageType, typename TFunctor>
545  void updateImageDataAndParam(const TImageType & image, const TFunctor &aFunctor, double xTranslation=0.0,
546  double yTranslation=0.0, double zTranslation=0.0)
547  {
550  assert ( (image.domain().upperBound())[0]-(image.domain().lowerBound())[0]+1== static_cast<int>(myImageWidth) &&
551  (image.domain().upperBound())[1]-(image.domain().lowerBound())[1]+1== static_cast<int>(myImageHeight));
552 
553  point1[0] += xTranslation; point1[1] += yTranslation; point1[2] += zTranslation;
554  point2[0] += xTranslation; point2[1] +=yTranslation; point2[2] += zTranslation;
555  point3[0] += xTranslation; point3[1] += yTranslation; point3[2] += zTranslation;
556  point4[0] += xTranslation; point4[1] += yTranslation; point4[2] += zTranslation;
557 
558  unsigned int pos=0;
559  for(typename TImageType::Domain::ConstIterator it = image.domain().begin(), itend=image.domain().end();
560  it!=itend; ++it)
561  {
562  myTabImage[pos]= aFunctor(image(*it));
563  pos++;
564  }
565  }
566 
570  std::string className() const;
571 
572  private:
578  {};
579  };
580 
587 
588 
594  Viewer3D<Space, KSpace> & operator<< ( const typename Viewer3D<Space, KSpace>::StreamKey & key );
595 
596 
600  void sortSurfelFromCamera();
601 
605  void sortTriangleFromCamera();
606 
610  void sortQuadFromCamera();
611 
615  void sortPolygonFromCamera();
616 
617 
618 
619  template <typename TDrawableWithViewer3D>
628  Viewer3D<Space, KSpace> & operator<< ( const TDrawableWithViewer3D & object );
629 
630 
631 
632  // ----------------------- Interface --------------------------------------
633  public:
634 
639  void selfDisplay ( std::ostream & out ) const;
640 
645  bool isValid() const;
646 
647 
648 
649  virtual unsigned int getCurrentDomainNumber();
650 
651  virtual unsigned int getCurrentGLImageNumber();
652 
653 
659  virtual void paintGL();
660 
661 
668  virtual void show();
669 
670 
676  void addTextureImage(const TextureImage &image);
677 
678 
691  template <typename TImageType, typename TFunctor>
692 
693  void updateTextureImage(unsigned int imageIndex, const TImageType & image, const TFunctor & aFunctor,
694  double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0,
695  double rotationAngle=0.0, ImageDirection rotationDir=zDirection);
696 
697 
698 
699 
709  void updateOrientationTextureImage(unsigned int imageIndex,
710  double xPosition, double yPosition,
711  double zPosition, ImageDirection newDirection);
712 
713 
714 
723  void updateEmbeddingTextureImage(unsigned int anImageIndex,
724  typename Space::Point aPoint1, typename Space::Point aPoint2,
725  typename Space::Point aPoint3, typename Space::Point aPoint4);
726 
727 
728 
735  template<typename TDomain>
736  void addImage2DDomainD3D(const TDomain &anImageDomain, std::string mode,
737  const DGtal::Color &aColor=DGtal::Color::Red );
738 
739 
748  void updateAn2DDomainOrientation(unsigned int imageIndex,
749  double xPosition, double yPosition,
750  double zPosition, ImageDirection newDirection);
751 
759  void translateAn2DDomain(unsigned int domainIndex, double xTranslation,
760  double yTranslation, double zTranslation);
761 
768  std::vector<typename DGtal::Viewer3D< Space , KSpace >::LineD3D>
769  compute2DDomainLineRepresentation( Image2DDomainD3D &anImageDomain, double delta );
770 
776  std::vector<typename DGtal::Viewer3D< Space , KSpace >::LineD3D>
777  compute2DDomainLineRepresentation( Image2DDomainD3D &anImageDomain);
778 
779 
790  double angleRotation, ImageDirection dirRotation);
791 
792 
793 
802  void rotateDomain(Image2DDomainD3D &anDom, double angle, ImageDirection rotationDir);
803 
804 
805 
806 
807 
808 
809  // ------------------------- Protected Datas ------------------------------
810  private:
811 
812 
813 
814  public:
815 
816 
817 
818 
819 
820  // ------------------------- Hidden services ------------------------------
821  //protected:
822 
823 
829  void updateList ( bool needToUpdateBoundingBox=true );
830 
831 
836  void glDrawGLBall (const typename Viewer3D<Space,KSpace>::BallD3D & aBall );
837 
838 
839 
857  virtual void keyPressEvent ( QKeyEvent *e );
858 
864  virtual void mouseMoveEvent ( QMouseEvent *e );
865 
871  virtual void mousePressEvent ( QMouseEvent *e );
872 
878  virtual void mouseReleaseEvent ( QMouseEvent *e );
879 
884  {
885  qglviewer::Vec posCam;
887  typename Viewer3D<Space,KSpace>::CubeD3D s2 )
888  {
889  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] ) );
890  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] ) );
891  return dist1>dist2;
892  }
893  };
894 
895 
900  {
901  qglviewer::Vec posCam;
904  {
905  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 );
906  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 );
907  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 ) );
908  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 ) );
909 
910  return dist1>dist2;
911  }
912  };
913 
918  {
919  qglviewer::Vec posCam;
921  typename Viewer3D<Space,KSpace>::QuadD3D q2 )
922  {
923 
924  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 );
925  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 );
926 
927  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 ) );
928  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 ) );
929  return dist1>dist2;
930  }
931  };
932 
937  {
938  qglviewer::Vec posCam;
941  {
942  double c1x=0.0, c1y=0.0, c1z=0.0;
943  double c2x=0.0, c2y=0.0, c2z=0.0;
944  for(unsigned int i=0; i< q1.vertices.size(); i++){
945  c1x+=q1.vertices.at(i)[0];
946  c1y+=q1.vertices.at(i)[1];
947  c1z+=q1.vertices.at(i)[2];
948  }
949  for(unsigned int i=0; i< q2.vertices.size(); i++){
950  c2x+=q2.vertices.at(i)[0];
951  c2y+=q2.vertices.at(i)[1];
952  c2z+=q2.vertices.at(i)[2];
953  }
954 
955  qglviewer::Vec center1 ( c1x/(double)q1.vertices.size(),c1y/(double)q1.vertices.size(), c1z/(double)q1.vertices.size() );
956  qglviewer::Vec center2 ( c2x/(double)q2.vertices.size(),c2y/(double)q2.vertices.size(), c2z/(double)q2.vertices.size() );
957 
958  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 ) );
959  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 ) );
960  return dist1>dist2;
961  }
962  };
963 
964 
965 
969  virtual void drawWithNames();
970 
974  virtual void draw();
975 
979  virtual void init();
980 
984  virtual QString helpString() const;
985 
990  virtual void postSelection ( const QPoint& point );
991 
992 
993 
1003  virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
1004 
1005 
1016  virtual void initFromDOMElement(const QDomElement& element);
1017 
1018 
1026  protected: virtual void closeEvent ( QCloseEvent * e );
1027 
1028 
1029 
1030  // ------------------------- Internals ------------------------------------
1031  private:
1032 
1033 
1039  {
1041  RealPoint point1;
1042  RealPoint point2;
1043  RealPoint point3;
1044  RealPoint point4;
1045 
1047  unsigned int myImageWidth;
1048  unsigned int myImageHeight;
1049 
1050  unsigned int myBufferWidth;
1051  unsigned int myBufferHeight;
1054  unsigned char * myTextureImageBufferGS;
1055  unsigned char * myTextureImageBufferRGB;
1056  double vectNormal[3];
1057 
1058 
1059  // By definition in OpenGL the image size of texture should power of 2
1062 
1063 
1064  // Destructor
1066  {
1067  if(myMode== 1)
1068  {
1069  if(myTextureImageBufferGS!=0)
1070  delete [] myTextureImageBufferGS;
1071  }
1073  {
1074  if(myTextureImageBufferRGB!=0)
1075  delete [] myTextureImageBufferRGB;
1076  }
1077 
1078  }
1079 
1080  //Copy constructor from a GLTextureImage
1081  GLTextureImage(const GLTextureImage &aGLImg): myBufferWidth(aGLImg.myBufferWidth),
1082  myBufferHeight(aGLImg.myBufferHeight),
1083  myTextureName(aGLImg.myTextureName),
1084  myMode(aGLImg.myMode),
1085  myTextureFitX(aGLImg.myTextureFitX),
1086  myTextureFitY(aGLImg.myTextureFitY)
1087 
1088  {
1089  point1[0]=aGLImg.point1[0]; point1[1]=aGLImg.point1[1]; point1[2]=aGLImg.point1[2];
1090  point2[0]=aGLImg.point2[0]; point2[1]=aGLImg.point2[1]; point2[2]=aGLImg.point2[2];
1091  point3[0]=aGLImg.point3[0]; point3[1]=aGLImg.point3[1]; point3[2]=aGLImg.point3[2];
1092  point4[0]=aGLImg.point4[0]; point4[1]=aGLImg.point4[1]; point4[2]=aGLImg.point4[2];
1093  myImageWidth=aGLImg.myImageWidth; myImageHeight=aGLImg.myImageHeight;
1094  myDirection = aGLImg.myDirection;
1095  vectNormal[0]=aGLImg.vectNormal[0];
1096  vectNormal[1]=aGLImg.vectNormal[1];
1097  vectNormal[2]=aGLImg.vectNormal[2];
1098 
1099  if(myMode== 1)
1100  {
1101  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1102  for(unsigned int i=0; i<myBufferHeight*myBufferWidth;i++)
1103  {
1104  myTextureImageBufferGS[i]=aGLImg.myTextureImageBufferGS[i];
1105  }
1106  }else if(myMode==Viewer3D<Space, KSpace>::RGBMode)
1107  {
1108  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1109  for(unsigned int i=0; i<3*myBufferHeight*myBufferWidth;i+=3)
1110  {
1111  myTextureImageBufferRGB[i]=aGLImg.myTextureImageBufferRGB[i];
1112  myTextureImageBufferRGB[i+1]=aGLImg.myTextureImageBufferRGB[i+1];
1113  myTextureImageBufferRGB[i+2]=aGLImg.myTextureImageBufferRGB[i+2];
1114  }
1115  }
1116  }
1117 
1118 
1119  //Copy constructor from a TextureImage
1121  {
1122  point1[0]=aGSImage.point1[0]; point1[1]=aGSImage.point1[1]; point1[2]=aGSImage.point1[2];
1123  point2[0]=aGSImage.point2[0]; point2[1]=aGSImage.point2[1]; point2[2]=aGSImage.point2[2];
1124  point3[0]=aGSImage.point3[0]; point3[1]=aGSImage.point3[1]; point3[2]=aGSImage.point3[2];
1125  point4[0]=aGSImage.point4[0]; point4[1]=aGSImage.point4[1]; point4[2]=aGSImage.point4[2];
1126  myImageWidth=aGSImage.myImageWidth; myImageHeight=aGSImage.myImageHeight;
1127  myDirection = aGSImage.myDirection;
1128  myMode= aGSImage.myMode;
1129  vectNormal[0]= (myDirection == Viewer3D<Space, KSpace>::xDirection)? 1.0: 0.0;
1130  vectNormal[1]= (myDirection == Viewer3D<Space, KSpace>::yDirection)? -1.0: 0.0;
1131  vectNormal[2]= (myDirection == Viewer3D<Space, KSpace>::zDirection)? 1.0: 0.0;
1132  if(myDirection==undefDirection){
1133  RealPoint v1 = point2-point1;
1134  RealPoint v2 = point4-point1;
1135  vectNormal[0] = v1[1]*v2[2] - v1[2]*v2[1];
1136  vectNormal[1] = v1[2]*v2[0] - v1[0]*v2[2];
1137  vectNormal[2] = v1[0]*v2[1] - v1[1]*v2[0];
1138  double norm = sqrt(vectNormal[0]*vectNormal[0]+vectNormal[1]*vectNormal[1]+vectNormal[2]*vectNormal[2]);
1139  vectNormal[0] /=norm; vectNormal[1] /=norm; vectNormal[2] /=norm;
1140  }
1141 
1142  myBufferWidth = functions::roundToUpperPowerOfTwo(myImageWidth);
1143  myBufferHeight = functions::roundToUpperPowerOfTwo(myImageHeight);
1144 
1145  if(myMode== 1)
1146  {
1147  myTextureImageBufferGS = new unsigned char [myBufferHeight*myBufferWidth];
1148  unsigned int pos=0;
1149  for (unsigned int i=0; i<myBufferHeight; i++)
1150  {
1151  for (unsigned int j=0; j<myBufferWidth; j++)
1152  {
1153  if(i<myImageHeight && j< myImageWidth)
1154  {
1155  myTextureImageBufferGS[pos]= aGSImage.myTabImage[i*myImageWidth+j];
1156  }else{
1157  myTextureImageBufferGS[pos]=0;
1158  }
1159  pos++;
1160  }
1161  }
1162  }else if(myMode==Viewer3D<Space, KSpace>::RGBMode)
1163  {
1164  myTextureImageBufferRGB = new unsigned char [3*myBufferHeight*myBufferWidth];
1165  unsigned int pos=0;
1166  for (unsigned int i=0; i<myBufferHeight; i++)
1167  {
1168  for (unsigned int j=0; j<myBufferWidth; j++)
1169  {
1170  if(i<myImageHeight && j< myImageWidth)
1171  {
1172  DGtal::Color aCol(aGSImage.myTabImage[i*myImageWidth+j]);
1173  myTextureImageBufferRGB[pos]= aCol.red();
1174  myTextureImageBufferRGB[pos+1]= aCol.green();
1175  myTextureImageBufferRGB[pos+2]= aCol.blue();
1176  }else{
1177  myTextureImageBufferRGB[pos]=0;
1178  myTextureImageBufferRGB[pos+1]=0;
1179  myTextureImageBufferRGB[pos+2]=0;
1180  }
1181  pos+=3;
1182  }
1183  }
1184  }
1185 
1186  myTextureFitX = 1.0-((myBufferWidth-myImageWidth)/(double)myBufferWidth);
1187  myTextureFitY = 1.0-((myBufferHeight-myImageHeight)/(double)myBufferHeight);
1188  }
1189  };
1190 
1191 
1192 
1198  typedef typename std::vector<typename Viewer3D<Space, KSpace>::CubeD3D> VectorCubes;
1199  typedef typename std::vector<typename Viewer3D<Space, KSpace>::QuadD3D> VectorQuad;
1200  typedef typename std::vector<typename Viewer3D<Space, KSpace>::LineD3D> VectorLine;
1201  typedef typename std::vector<typename Viewer3D<Space, KSpace>::BallD3D> VectorBall;
1202  typedef typename std::vector<typename Viewer3D<Space, KSpace>::TriangleD3D> VectorTriangle;
1203  typedef typename std::vector<typename Viewer3D<Space, KSpace>::PolygonD3D> VectorPolygon;
1204  typedef typename std::vector<typename Viewer3D<Space, KSpace>::TextureImage> VectorTextureImage;
1205 
1206 
1207  typedef typename VectorCubes::iterator ItCube;
1208 
1209 
1219  void glCreateListCubesMaps(const typename Display3D<Space, KSpace>::CubesMap &aCubeMap, unsigned int idList);
1220 
1221 
1222 
1228  void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList);
1229 
1230 
1236  void glCreateListLines(const VectorLine &aVectLine, unsigned int idList);
1237 
1238 
1244  void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList);
1245 
1246 
1256  void glCreateListQuadMaps(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1257 
1258 
1268  void glCreateListQuadMapsWired(const typename Display3D<Space, KSpace>::QuadsMap &aQuadMap, unsigned int idList);
1269 
1270 
1279  void glCreateListTriangles(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1280 
1281 
1290  void glCreateListTrianglesWired(const std::vector<VectorTriangle> &aVectTriangle, unsigned int idList);
1291 
1292 
1301  void glCreateListPolygons(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1302 
1303 
1312  void glCreateListPolygonsWired(const std::vector<VectorPolygon> &aVectPolygon, unsigned int idList);
1313 
1314 
1320  void glUpdateTextureImages(const VectorTextureImage &aVectImage);
1321 
1322 
1329  void glUpdateLightRenderingMode() const;
1330 
1331 
1339 
1347 
1348 
1349 
1350 
1351  public:
1363  template<typename TImageORDomain>
1364  static
1365  void
1366  rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir){
1367  double xB = (anImageOrDom.point1[0]+anImageOrDom.point2[0]+anImageOrDom.point3[0]+anImageOrDom.point4[0])/4.0;
1368  double yB = (anImageOrDom.point1[1]+anImageOrDom.point2[1]+anImageOrDom.point3[1]+anImageOrDom.point4[1])/4.0;
1369  double zB = (anImageOrDom.point1[2]+anImageOrDom.point2[2]+anImageOrDom.point3[2]+anImageOrDom.point4[2])/4.0;
1370  rotatePoint( anImageOrDom.point1[0], anImageOrDom.point1[1], anImageOrDom.point1[2], xB, yB, zB, angle, rotationDir);
1371  rotatePoint( anImageOrDom.point2[0], anImageOrDom.point2[1], anImageOrDom.point2[2], xB, yB, zB, angle, rotationDir);
1372  rotatePoint( anImageOrDom.point3[0], anImageOrDom.point3[1], anImageOrDom.point3[2], xB, yB, zB, angle, rotationDir);
1373  rotatePoint( anImageOrDom.point4[0], anImageOrDom.point4[1], anImageOrDom.point4[2], xB, yB, zB, angle, rotationDir);
1374 
1375  }
1376 
1390  template <typename TValues>
1391  static
1392  void rotatePoint(TValues &x, TValues &y, TValues &z,
1393  double cx, double cy, double cz,
1394  double rotationAngle, ImageDirection rotationDir);
1395 
1396 
1397 
1398 
1399 
1400  // ------------------------- Private Datas --------------------------------
1401  private:
1402 
1404  //GLuint myListToAff;
1405 
1408 
1411 
1415 
1418 
1421 
1423 
1424  unsigned int myNbListe;
1425  unsigned int myNbLineSetList;
1426  unsigned int myNbBallSetList;
1427  unsigned int myNbPrismSetList;
1428 
1431  unsigned char mySelectionColorShift = 150;
1432 
1438  std::vector<GLTextureImage> myVectTextureImage;
1439 
1441 
1442  double camera_position[3];
1443  double camera_direction[3];
1444  double camera_upVector[3];
1445 
1446  bool myLightPositionFixToCamera = true; // when false the light position is fix according to the scene.
1447  double myLightTheta;
1448  double myLightPhi;
1449  double myLightR;
1450  GLfloat myLightPosition [4] = {0.0f, 0.0f, 1.0f, 1.0f}; // the light position in cartesian coordinate
1451  GLfloat myLightPositionRefCameraDefault [3] = {-100.0f, 100.0f, 0.0f}; // the light default position according to the camera position
1452  GLfloat myLightPositionRefCamera [3] = {0.0f, 0.0f, 0.0f}; // the light position according to the camera position
1453  GLfloat myMaterialShininessCoeff[1] = {50.0f} ; // the material shininess coefficient used in opengl rendering
1454  GLfloat myMaterialSpecularCoeffs[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // the light specular coefficients used in opengl rendering
1455  GLfloat myLightSpecularCoeffs[4] = { 0.3f, 0.3f, 0.3f, 1.0f }; // the light specular coefficients used in opengl rendering
1456  GLfloat myLightAmbientCoeffs[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; // the material ambient coefficients used in opengl rendering
1457  GLfloat myLightDiffuseCoeffs[4] = { 0.7f, 0.7f, 0.7f, 1.0f }; // the material diffuse coefficients used in opengl rendering
1458 
1459  const GLfloat myDefaultRenderSpec = 0.3f; // default specular coefficients for default mode rendering
1460  const GLfloat myDefaultRenderDiff = 0.7f; // default diffuse coefficients for metallic mode rendering
1461  const GLfloat myLambertRenderSpec = 0.0f; // default specular coefficients for default mode rendering
1462  const GLfloat myLambertRenderDiff = 0.9f; // default diffuse coefficients for metallic mode rendering
1463  const GLfloat myMetallicRenderSpec = 0.5f; // default specular coefficients for metallic mode rendering
1464  const GLfloat myMetallicRenderDiff = 0.5f; // default diffuse coefficients for metallic mode rendering
1465  const GLfloat myPlasticRenderSpec = 0.8f; // default specular coefficients for platic mode rendering
1466  const GLfloat myPlasticRenderDiff = 0.2f; // default diffuse coefficients for platic mode rendering
1467 
1468  bool myUseGLPointsForBalls = false; // to display balls with GL points (instead real ball)
1469 
1470  double ZNear;
1471  double ZFar;
1472 
1473  //the default width of the mesh line
1475 
1476  // To apply openGL ajustment only on visualisation
1477  float myGLScaleFactorX=1.0;
1478  float myGLScaleFactorY=1.0;
1479  float myGLScaleFactorZ=1.0;
1480 
1481  // Used to apply interactive light rotation
1486 
1488  std::vector<TextureImage> myGSImageList;
1490  std::vector<Image2DDomainD3D> myImageDomainList;
1491 
1492  }; // end of class Viewer3D
1493 
1494 
1495 
1496  template < typename Space, typename KSpace>
1503  std::ostream&
1504  operator<< ( std::ostream & out, const Viewer3D<Space, KSpace> & object );
1505 } // namespace DGtal
1506 
1507 
1509 // Includes inline functions.
1510 #include "DGtal/io/viewers/Viewer3D.ih"
1511 
1512 // //
1514 
1515 #endif // !defined Viewer3D_h
1516 
1517 #undef Viewer3D_RECURSES
1518 #endif // else defined(Viewer3D_RECURSES)
unsigned int myNbBallSetList
Definition: Viewer3D.h:1426
virtual void postSelection(const QPoint &point)
postSelection
qglviewer::Vec myOrig
information linked to the navigation in the viewer
Definition: Viewer3D.h:1434
std::vector< typename Viewer3D< Space, KSpace >::TriangleD3D > VectorTriangle
Definition: Viewer3D.h:1202
bool myViewWire
objects have shadows which follow the camera if false
Definition: Viewer3D.h:320
double ZNear
znear distance
Definition: Viewer3D.h:1470
void updateImageDataAndParam(const TImageType &image, const TFunctor &aFunctor, double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
Definition: Viewer3D.h:545
void glCreateListQuadD3D(const VectorQuad &aVectQuad, unsigned int idList)
const GLfloat myMetallicRenderSpec
Definition: Viewer3D.h:1463
void glUpdateLightRenderingMode() const
void setGLLightSpecularCoefficients(const GLfloat lightSpecularCoeffs[4])
void selfDisplay(std::ostream &out) const
GLfloat myMaterialShininessCoeff[1]
Definition: Viewer3D.h:1453
unsigned int myNbLineSetList
Definition: Viewer3D.h:1425
GLfloat myLightPositionRefCamera[3]
Definition: Viewer3D.h:1452
const GLfloat myMetallicRenderDiff
Definition: Viewer3D.h:1464
void glCreateListBalls(const VectorBall &aVectBall, unsigned int idList)
void rotateLineD3D(typename DGtal::Display3D< Space, KSpace >::LineD3D &aLine, DGtal::PointVector< 3, int > pt, double angleRotation, ImageDirection dirRotation)
~TextureImage()
the mode of representation of the image
Definition: Viewer3D.h:426
std::vector< GLTextureImage > myVectTextureImage
list of the images textures in this viewer
Definition: Viewer3D.h:1438
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:1448
GLuint myBallSetListId
Definition: Viewer3D.h:1413
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:321
unsigned int myDomainWidth
the width of the image domain
Definition: Viewer3D.h:343
ImageDirection myDirection
Definition: Viewer3D.h:412
virtual void mousePressEvent(QMouseEvent *e)
Viewer3D< Space, KSpace >::ImageDirection myDirection
Definition: Viewer3D.h:1046
unsigned int myNbListe
number of lists in myListToAff
Definition: Viewer3D.h:1424
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:363
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:1485
void updateImageOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
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:1483
qglviewer::Vec myDirSelector
Definition: Viewer3D.h:1434
const GLfloat myPlasticRenderSpec
Definition: Viewer3D.h:1465
bool myAutoSaveState
flag to save automatically or not the Viewer3d state when closing the viewer
Definition: Viewer3D.h:324
void setCameraDirection(double ax, double ay, double az)
Definition: Viewer3D.h:186
std::vector< typename Viewer3D< Space, KSpace >::PolygonD3D > VectorPolygon
Definition: Viewer3D.h:1203
GLfloat myLightDiffuseCoeffs[4]
Definition: Viewer3D.h:1457
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:481
virtual void mouseMoveEvent(QMouseEvent *e)
void rotateDomain(Image2DDomainD3D &anDom, double angle, ImageDirection rotationDir)
GLfloat myLightSpecularCoeffs[4]
Definition: Viewer3D.h:1455
unsigned int * myTabImage
the height of the image
Definition: Viewer3D.h:417
GLTextureImage(const typename Viewer3D< Space, KSpace >::TextureImage &aGSImage)
Definition: Viewer3D.h:1120
QPoint myPosSelector
a point selected with postSelection
Definition: Viewer3D.h:1436
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
ImageDirection myDirection
the direction of the domain (x, y or z axe)
Definition: Viewer3D.h:347
Display::SelectCallbackFct SelectCallbackFct
Definition: Viewer3D.h:143
std::vector< typename Viewer3D< Space, KSpace >::BallD3D > VectorBall
Definition: Viewer3D.h:1201
bool myIsBackgroundDefault
true if the background is default
Definition: Viewer3D.h:318
const GLfloat myDefaultRenderDiff
Definition: Viewer3D.h:1460
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:420
std::vector< RealPoint > vertices
Definition: Display3D.h:243
void updateImage3DEmbedding(RealPoint aPoint1, RealPoint aPoint2, RealPoint aPoint3, RealPoint aPoint4)
Definition: Viewer3D.h:519
const GLfloat myLambertRenderSpec
Definition: Viewer3D.h:1461
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:1442
unsigned int myLineSetIndex
the index of the line of the domain in the lineSetList of the viewer
Definition: Viewer3D.h:351
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:1447
void glCreateListQuadMapsWired(const typename Display3D< Space, KSpace >::QuadsMap &aQuadMap, unsigned int idList)
Viewer3D< Space, KSpace >::TextureMode myMode
Definition: Viewer3D.h:1053
qglviewer::Vec myDir
Definition: Viewer3D.h:1434
GLuint myQuadsMapId
Definition: Viewer3D.h:1416
void sortPolygonFromCamera()
DGtal::Color myDefaultColor
the default color of the viewer
Definition: Viewer3D.h:316
bool myLightPositionFixToCamera
Definition: Viewer3D.h:1446
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:1471
virtual void draw()
draw
std::vector< typename Viewer3D< Space, KSpace >::TextureImage > VectorTextureImage
Definition: Viewer3D.h:1204
void setGLMaterialShininessCoefficient(const GLfloat matShininessCoeff)
SelectCallbackFct getSelectCallback3D(DGtal::int32_t aName, void *&data) const
bool operator()(typename Viewer3D< Space, KSpace >::PolygonD3D q1, typename Viewer3D< Space, KSpace >::PolygonD3D q2)
Definition: Viewer3D.h:939
RenderingMode myRenderingMode
Definition: Viewer3D.h:326
void updateDomainOrientation(ImageDirection normalDir, double xBottomLeft, double yBottomLeft, double zBottomLeft)
bool myUseGLPointsForBalls
Definition: Viewer3D.h:1468
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 updateRenderingCoefficients(const RenderingMode aRenderMode, bool displayState=true)
int mySelectedElementId
used to displayed selected elements
Definition: Viewer3D.h:1430
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:1449
GLuint myCubeSetListWiredId
Definition: Viewer3D.h:1420
static void rotateImageVertex(TImageORDomain &anImageOrDom, double angle, ImageDirection rotationDir)
Definition: Viewer3D.h:1366
GLuint myPolygonSetListId
Definition: Viewer3D.h:1409
void setGLLightDiffuseCoefficients(const GLfloat lightDiffuseCoeffs[4])
void updateRelativeCameraFromLightPosition()
unsigned char * myTextureImageBufferGS
Definition: Viewer3D.h:1054
std::vector< typename Viewer3D< Space, KSpace >::CubeD3D > VectorCubes
Definition: Viewer3D.h:1198
GLuint myTriangleSetListWiredId
Definition: Viewer3D.h:1407
qglviewer::Vec mySelectedPoint
Definition: Viewer3D.h:1434
bool operator()(typename Viewer3D< Space, KSpace >::TriangleD3D t1, typename Viewer3D< Space, KSpace >::TriangleD3D t2)
Definition: Viewer3D.h:902
const GLfloat myLambertRenderDiff
Definition: Viewer3D.h:1462
void updateList(bool needToUpdateBoundingBox=true)
int myRefMouseYPos
the reference mouse x-position used to determince the light position change (azimuth) ...
Definition: Viewer3D.h:1484
DGtal::Color color
The image domain color.
Definition: Viewer3D.h:341
std::vector< TextureImage > myGSImageList
flag to display the ligth source when it is moved by the user
Definition: Viewer3D.h:1488
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:314
GLuint myPolygonSetListWiredId
Definition: Viewer3D.h:1410
virtual QDomElement domElement(const QString &name, QDomDocument &document) const
Overload of the QGLViewer method which returns an XML QDomElement representing the QGLViewer state...
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:1427
unsigned int myImageWidth
direction of the image (x, y or z axe)
Definition: Viewer3D.h:414
float myGLScaleFactorX
Definition: Viewer3D.h:1477
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:1200
float myGLScaleFactorZ
Definition: Viewer3D.h:1479
RealPoint point1
The image domain coordinates.
Definition: Viewer3D.h:336
virtual unsigned int getCurrentDomainNumber()
std::vector< Image2DDomainD3D > myImageDomainList
Used to store all the domains.
Definition: Viewer3D.h:1490
Display3D< Space, KSpace > Display
Definition: Viewer3D.h:142
GLfloat myLightAmbientCoeffs[4]
Definition: Viewer3D.h:1456
void translateDomain(double xTranslation=0.0, double yTranslation=0.0, double zTranslation=0.0)
std::string className() const
unsigned char * myTextureImageBufferRGB
Definition: Viewer3D.h:1055
GLuint myCubesMapId
Definition: Viewer3D.h:1419
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:1450
GLTextureImage(const GLTextureImage &aGLImg)
Definition: Viewer3D.h:1081
virtual void keyPressEvent(QKeyEvent *e)
double camera_upVector[3]
camera up-vector
Definition: Viewer3D.h:1444
void glCreateListTrianglesWired(const std::vector< VectorTriangle > &aVectTriangle, unsigned int idList)
std::string myMode
the mode of representation of the image domain
Definition: Viewer3D.h:349
T roundToUpperPowerOfTwo(const T &n)
double myGLLineMinWidth
to improve the display of gl points
Definition: Viewer3D.h:322
const GLfloat myPlasticRenderDiff
Definition: Viewer3D.h:1466
bool operator()(typename Viewer3D< Space, KSpace >::QuadD3D q1, typename Viewer3D< Space, KSpace >::QuadD3D q2)
Definition: Viewer3D.h:920
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
virtual QString helpString() const
void sortQuadFromCamera()
ImageDirection
the 3 possible axes for the image direction
Definition: Viewer3D.h:309
RealPoint point1
coordinates
Definition: Viewer3D.h:1041
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:1454
TextureImage(const TextureImage &img)
Copy constructor (needed due to myTabImage)
Definition: Viewer3D.h:435
void green(const unsigned char aGreenValue)
float myGLScaleFactorY
Definition: Viewer3D.h:1478
Viewer3D< Space, KSpace > & operator<<(const DGtal::Color &aColor)
unsigned int myImageHeight
the width of the image
Definition: Viewer3D.h:415
VectorCubes::iterator ItCube
Definition: Viewer3D.h:1207
static const Color Red
Definition: Color.h:391
TextureMode
the modes of representation of an image
Definition: Viewer3D.h:311
Viewer3D(const KSpace &KSEmb)
Definition: Viewer3D.h:164
unsigned int myDomainHeight
the height of the image domain
Definition: Viewer3D.h:345
virtual void mouseReleaseEvent(QMouseEvent *e)
void setGLLightAmbientCoefficients(const GLfloat lightAmbientCoeffs[4])
GLuint myPrismListId
Definition: Viewer3D.h:1414
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()
bool operator()(typename Viewer3D< Space, KSpace >::CubeD3D s1, typename Viewer3D< Space, KSpace >::CubeD3D s2)
Definition: Viewer3D.h:886
TextureMode myMode
index of the image domain if exist
Definition: Viewer3D.h:421
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:419
double myLigthRotationStep
Definition: Viewer3D.h:1482
bool myIsDoubleFaceRendering
true if is double face rendering
Definition: Viewer3D.h:1440
bool isValid() const
GLuint myQuadsMapWiredId
Definition: Viewer3D.h:1417
const GLfloat myDefaultRenderSpec
Definition: Viewer3D.h:1459
GLuint myLineSetListId
Definition: Viewer3D.h:1412
GLfloat myLightPositionRefCameraDefault[3]
Definition: Viewer3D.h:1451
unsigned char mySelectionColorShift
Definition: Viewer3D.h:1431
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:134
std::vector< typename Viewer3D< Space, KSpace >::QuadD3D > VectorQuad
Definition: Viewer3D.h:1199
void translateAn2DDomain(unsigned int domainIndex, double xTranslation, double yTranslation, double zTranslation)
virtual void init()
init
float myMeshDefaultLineWidth
Definition: Viewer3D.h:1474
double camera_direction[3]
camera direction
Definition: Viewer3D.h:1443
virtual void drawWithNames()
drawWithNames
void glUpdateTextureImages(const VectorTextureImage &aVectImage)
GLuint myTriangleSetListId
lists of the list to draw
Definition: Viewer3D.h:1406
void blue(const unsigned char aBlueValue)