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

Method SetMapperShaderParameters

Rendering/OpenGL2/vtkOpenGLPolyDataMapper2D.cxx:357–404  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

355
356//------------------------------------------------------------------------------
357void vtkOpenGLPolyDataMapper2D::SetMapperShaderParameters(
358 vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* actor)
359{
360 // Now to update the VAO too, if necessary.
361 if (this->VBOUpdateTime > cellBO.AttributeUpdateTime ||
362 cellBO.ShaderSourceTime > cellBO.AttributeUpdateTime)
363 {
364 cellBO.VAO->Bind();
365
366 this->VBOs->AddAllAttributesToVAO(cellBO.Program, cellBO.VAO);
367
368 cellBO.AttributeUpdateTime.Modified();
369 }
370
371 if (this->HaveCellScalars)
372 {
373 int tunit = this->CellScalarTexture->GetTextureUnit();
374 cellBO.Program->SetUniformi("textureC", tunit);
375 }
376
377 if (this->VBOs->GetNumberOfComponents("tcoordMC"))
378 {
379 vtkInformation* info = actor->GetPropertyKeys();
380 if (info && info->Has(vtkProp::GENERAL_TEXTURE_UNIT()))
381 {
382 int tunit = info->Get(vtkProp::GENERAL_TEXTURE_UNIT());
383 cellBO.Program->SetUniformi("texture1", tunit);
384 }
385 }
386
387 // handle wide lines
388 if (this->HaveWideLines(viewport, actor))
389 {
390 int vp[4];
391 glGetIntegerv(GL_VIEWPORT, vp);
392 float lineWidth[2];
393 lineWidth[0] = 2.0 * actor->GetProperty()->GetLineWidth() / vp[2];
394 lineWidth[1] = 2.0 * actor->GetProperty()->GetLineWidth() / vp[3];
395 cellBO.Program->SetUniform2f("lineWidthNVC", lineWidth);
396 }
397
398 vtkRenderer* ren = vtkRenderer::SafeDownCast(viewport);
399 vtkHardwareSelector* selector = ren->GetSelector();
400 if (selector && cellBO.Program->IsUniformUsed("mapperIndex"))
401 {
402 cellBO.Program->SetUniform3f("mapperIndex", selector->GetPropColorValue());
403 }
404}
405
406//------------------------------------------------------------------------------
407void vtkOpenGLPolyDataMapper2D::SetPropertyShaderParameters(

Callers 1

UpdateShadersMethod · 0.95

Calls 14

HaveWideLinesMethod · 0.95
AddAllAttributesToVAOMethod · 0.80
IsUniformUsedMethod · 0.80
BindMethod · 0.45
ModifiedMethod · 0.45
GetTextureUnitMethod · 0.45
SetUniformiMethod · 0.45
GetNumberOfComponentsMethod · 0.45
HasMethod · 0.45
GetMethod · 0.45
GetPropertyMethod · 0.45
SetUniform2fMethod · 0.45

Tested by

no test coverage detected