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 "vtkGlyph3DMapper.h" 32 #include "vtkNew.h" // For vtkNew 33 #include "vtkRenderingOpenGL2Module.h" // For export macro 34 35 class vtkOpenGLGlyph3DHelper; 36 class vtkBitArray; 37 38 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLGlyph3DMapper : public vtkGlyph3DMapper 39 { 40 public: 41 static vtkOpenGLGlyph3DMapper* New(); 42 vtkTypeMacro(vtkOpenGLGlyph3DMapper, vtkGlyph3DMapper); 43 void PrintSelf(ostream& os, vtkIndent indent) override; 44 45 /** 46 * Method initiates the mapping process. Generally sent by the actor 47 * as each frame is rendered. 48 */ 49 void Render(vtkRenderer* ren, vtkActor* a) override; 50 51 /** 52 * Release any graphics resources that are being consumed by this mapper. 53 * The parameter window could be used to determine which graphic 54 * resources to release. 55 */ 56 void ReleaseGraphicsResources(vtkWindow* window) override; 57 58 ///@{ 59 /** 60 * Get the maximum number of LOD. OpenGL context must be bound. 61 * The maximum number of LOD depends on GPU capabilities. 62 */ 63 vtkIdType GetMaxNumberOfLOD() override; 64 65 /** 66 * Set the number of LOD. 67 */ 68 void SetNumberOfLOD(vtkIdType nb) override; 69 70 /** 71 * Configure LODs. Culling must be enabled. 72 * distance have to be a positive value, it is the distance to the camera scaled by 73 * the instanced geometry bounding box. 74 * targetReduction have to be between 0 and 1, 0 disable decimation, 1 draw a point. 75 * 76 * @sa vtkDecimatePro::SetTargetReduction 77 */ 78 void SetLODDistanceAndTargetReduction( 79 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* subarray, vtkIdType numPts, 110 vtkActor* actor, vtkDataSet* dataset, vtkBitArray* maskArray); 111 112 vtkMTimeType BlockMTime; // Last time BlockAttributes was modified. 113 114 private: 115 vtkOpenGLGlyph3DMapper(const vtkOpenGLGlyph3DMapper&) = delete; 116 void operator=(const vtkOpenGLGlyph3DMapper&) = delete; 117 }; 118 119 #endif 120