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

Method SetMapperShaderParameters

Rendering/OpenGL2/vtkOpenGLPolyDataMapper.cxx:2753–2957  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2751
2752//------------------------------------------------------------------------------
2753void vtkOpenGLPolyDataMapper::SetMapperShaderParameters(
2754 vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* actor)
2755{
2756
2757 // Now to update the VAO too, if necessary.
2758 cellBO.Program->SetUniformi("PrimitiveIDOffset", this->PrimitiveIDOffset);
2759
2760 if (cellBO.IBO->IndexCount &&
2761 (this->VBOs->GetMTime() > cellBO.AttributeUpdateTime ||
2762 cellBO.ShaderSourceTime > cellBO.AttributeUpdateTime ||
2763 cellBO.VAO->GetMTime() > cellBO.AttributeUpdateTime))
2764 {
2765 cellBO.VAO->Bind();
2766
2767 this->VBOs->AddAllAttributesToVAO(cellBO.Program, cellBO.VAO);
2768
2769 cellBO.AttributeUpdateTime.Modified();
2770 }
2771
2772 vtkOpenGLCheckErrorMacro("failed after UpdateShader");
2773
2774 // Add IBL textures
2775 if (ren->GetUseImageBasedLighting())
2776 {
2777 vtkOpenGLRenderer* oglRen = vtkOpenGLRenderer::SafeDownCast(ren);
2778 if (oglRen)
2779 {
2780 cellBO.Program->SetUniformi("brdfTex", oglRen->GetEnvMapLookupTable()->GetTextureUnit());
2781 cellBO.Program->SetUniformi("prefilterTex", oglRen->GetEnvMapPrefiltered()->GetTextureUnit());
2782
2783 if (!oglRen->GetUseSphericalHarmonics())
2784 {
2785 cellBO.Program->SetUniformi(
2786 "irradianceTex", oglRen->GetEnvMapIrradiance()->GetTextureUnit());
2787 }
2788 }
2789 }
2790 vtkOpenGLCheckErrorMacro("failed after UpdateShader");
2791
2792 if (this->HaveTextures(actor))
2793 {
2794 cellBO.Program->SetUniformi(
2795 "showTexturesOnBackface", actor->GetProperty()->GetShowTexturesOnBackface() ? 1 : 0);
2796
2797 std::vector<texinfo> textures = this->GetTextures(actor);
2798 for (size_t i = 0; i < textures.size(); ++i)
2799 {
2800 vtkTexture* texture = textures[i].first;
2801 if (texture && cellBO.Program->IsUniformUsed(textures[i].second.c_str()))
2802 {
2803 int tunit = vtkOpenGLTexture::SafeDownCast(texture)->GetTextureUnit();
2804 cellBO.Program->SetUniformi(textures[i].second.c_str(), tunit);
2805 }
2806 }
2807
2808 // check for tcoord transform matrix
2809 vtkInformation* info = actor->GetPropertyKeys();
2810 vtkOpenGLCheckErrorMacro("failed after Render");

Callers 1

UpdateShadersMethod · 0.95

Calls 15

HaveTexturesMethod · 0.95
GetTexturesMethod · 0.95
DrawingEdgesMethod · 0.95
HaveWideLinesMethod · 0.95
AddAllAttributesToVAOMethod · 0.80
GetEnvMapLookupTableMethod · 0.80
GetEnvMapPrefilteredMethod · 0.80
GetEnvMapIrradianceMethod · 0.80
IsUniformUsedMethod · 0.80
GetModelToWorldMatrixMethod · 0.80

Tested by

no test coverage detected