MCPcopy Create free account
hub / github.com/Kitware/VTK / Draw

Method Draw

Rendering/OpenGL2/vtkOpenGLLowMemoryCellTypeAgent.cxx:117–160  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

115
116//------------------------------------------------------------------------------
117void vtkOpenGLLowMemoryCellTypeAgent::Draw(vtkRenderer* renderer, vtkActor* actor,
118 vtkOpenGLLowMemoryPolyDataMapper* mapper,
119 const std::vector<vtkOpenGLLowMemoryPolyDataMapper::CellGroupInformation>& cellGroups,
120 std::size_t cellGroupIdx /*=0*/) const
121{
122 if (!mapper)
123 {
124 return;
125 }
126 if (cellGroupIdx >= cellGroups.size())
127 {
128 std::cerr << cellGroupIdx << " > " << cellGroups.size() << std::endl;
129 return;
130 }
131 const auto& cellGroup = cellGroups[cellGroupIdx];
132 if (!cellGroup.CanRender)
133 {
134 return;
135 }
136#ifdef vtkOpenGLLowMemoryCellTypeAgent_DEBUG
137 std::cout << this << " Draw CellGroups[" << cellGroupIdx << '/' << cellGroups.size()
138 << "]: " << cellGroup << '\n';
139#endif
140 const auto& offsets = cellGroup.Offsets;
141 mapper->FirstVertexId = offsets.VertexIdOffset;
142 mapper->NumberOfElements = cellGroup.NumberOfElements;
143 // when rendering vertices, increase number of elements and draw 1 instance.
144 if (actor->GetProperty()->GetRepresentation() == VTK_POINTS || this->InVertexVisibilityPass)
145 {
146 mapper->NumberOfElements *= this->NumberOfPointsPerPrimitive;
147 }
148 else
149 {
150 mapper->NumberOfElements *= this->NumberOfPseudoPrimitivesPerElement;
151 }
152 mapper->ShaderProgram->SetUniformi("cellIdOffset", offsets.CellIdOffset);
153 mapper->ShaderProgram->SetUniformi("vertexIdOffset", offsets.VertexIdOffset);
154 mapper->ShaderProgram->SetUniformi("edgeValueBufferOffset", offsets.EdgeValueBufferOffset);
155 mapper->ShaderProgram->SetUniformi("pointIdOffset", offsets.PointIdOffset);
156 mapper->ShaderProgram->SetUniformi("primitiveIdOffset", offsets.PrimitiveIdOffset);
157 mapper->ShaderProgram->SetUniformi("usesCellMap", cellGroup.UsesCellMapBuffer);
158 mapper->ShaderProgram->SetUniformi("usesEdgeValues", cellGroup.UsesEdgeValueBuffer);
159 mapper->vtkDrawTexturedElements::DrawInstancedElementsImpl(renderer, actor, mapper);
160}
161
162//------------------------------------------------------------------------------
163void vtkOpenGLLowMemoryCellTypeAgent::PostDraw(

Callers 7

DrawPrimitivesMethod · 0.45
RenderPieceDrawMethod · 0.45
ClearMethod · 0.45
RecordDrawCommandsMethod · 0.45
RecordDrawCommandsMethod · 0.45

Calls 4

GetRepresentationMethod · 0.80
sizeMethod · 0.45
GetPropertyMethod · 0.45
SetUniformiMethod · 0.45

Tested by

no test coverage detected