1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkOpenGLGlyph3DMapper.h 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 /** 16 * @class vtkOpenGLGlyph3DMapper 17 * @brief vtkOpenGLGlyph3D on the GPU. 18 * 19 * Do the same job than vtkGlyph3D but on the GPU. For this reason, it is 20 * a mapper not a vtkPolyDataAlgorithm. Also, some methods of vtkOpenGLGlyph3D 21 * don't make sense in vtkOpenGLGlyph3DMapper: GeneratePointIds, old-style 22 * SetSource, PointIdsName, IsPointVisible. 23 * 24 * @sa 25 * vtkOpenGLGlyph3D 26 */ 27 28 #ifndef vtkOpenGLGlyph3DMapper_h 29 #define vtkOpenGLGlyph3DMapper_h 30 31 #include "vtkRenderingOpenGL2Module.h" // For export macro 32 #include "vtkGlyph3DMapper.h" 33 #include "vtkNew.h" // For vtkNew 34 35 class vtkOpenGLGlyph3DHelper; 36 class vtkBitArray; 37 38 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLGlyph3DMapper 39 : public vtkGlyph3DMapper 40 { 41 public: 42 static vtkOpenGLGlyph3DMapper* New(); 43 vtkTypeMacro(vtkOpenGLGlyph3DMapper, vtkGlyph3DMapper); 44 void PrintSelf(ostream& os, vtkIndent indent) override; 45 46 /** 47 * Method initiates the mapping process. Generally sent by the actor 48 * as each frame is rendered. 49 */ 50 void Render(vtkRenderer *ren, vtkActor *a) override; 51 52 /** 53 * Release any graphics resources that are being consumed by this mapper. 54 * The parameter window could be used to determine which graphic 55 * resources to release. 56 */ 57 void ReleaseGraphicsResources(vtkWindow *window) override; 58 59 //@{ 60 /** 61 * Get the maximum number of LOD. OpenGL context must be bound. 62 * The maximum number of LOD depends on GPU capabilities. 63 */ 64 virtual vtkIdType GetMaxNumberOfLOD() override; 65 66 /** 67 * Set the number of LOD. 68 */ 69 virtual void SetNumberOfLOD(vtkIdType nb) override; 70 71 /** 72 * Configure LODs. Culling must be enabled. 73 * distance have to be a positive value, it is the distance to the camera scaled by 74 * the instanced geometry bounding box. 75 * targetReduction have to be between 0 and 1, 0 disable decimation, 1 draw a point. 76 * 77 * @sa vtkDecimatePro::SetTargetReduction 78 */ 79 virtual void SetLODDistanceAndTargetReduction(vtkIdType index, float distance, float targetReduction) override; 80 //@} 81 82 protected: 83 vtkOpenGLGlyph3DMapper(); 84 ~vtkOpenGLGlyph3DMapper() override; 85 86 /** 87 * Render setup 88 */ 89 virtual void Render(vtkRenderer*, vtkActor*, vtkDataSet*); 90 91 /** 92 * Send mapper ivars to sub-mapper. 93 * \pre mapper_exists: mapper != 0 94 */ 95 void CopyInformationToSubMapper(vtkOpenGLGlyph3DHelper*); 96 97 void SetupColorMapper(); 98 99 vtkMapper *ColorMapper; 100 101 class vtkOpenGLGlyph3DMapperEntry; 102 class vtkOpenGLGlyph3DMapperSubArray; 103 class vtkOpenGLGlyph3DMapperArray; 104 vtkOpenGLGlyph3DMapperArray *GlyphValues; // array of value for datasets 105 106 /** 107 * Build data structures associated with 108 */ 109 virtual void RebuildStructures(vtkOpenGLGlyph3DMapperSubArray *entry, 110 vtkIdType numPts, vtkActor* actor, vtkDataSet* dataset, 111 vtkBitArray *maskArray); 112 113 vtkMTimeType BlockMTime; // Last time BlockAttributes was modified. 114 115 private: 116 vtkOpenGLGlyph3DMapper(const vtkOpenGLGlyph3DMapper&) = delete; 117 void operator=(const vtkOpenGLGlyph3DMapper&) = delete; 118 }; 119 120 #endif 121