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

Method UpdatePBRStateCache

Rendering/OpenGL2/vtkOpenGLLowMemoryPolyDataMapper.cxx:3030–3073  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3028
3029//------------------------------------------------------------------------------
3030void vtkOpenGLLowMemoryPolyDataMapper::UpdatePBRStateCache(vtkRenderer*, vtkActor* actor)
3031{
3032 bool hasAnisotropy = actor->GetProperty()->GetInterpolation() == VTK_PBR &&
3033 actor->GetProperty()->GetAnisotropy() != 0.0;
3034 bool hasClearCoat = actor->GetProperty()->GetInterpolation() == VTK_PBR &&
3035 actor->GetProperty()->GetCoatStrength() > 0.0;
3036
3037 std::vector<TextureInfo> textures = this->GetTextures(actor);
3038 bool usesNormalMap =
3039 std::find_if(textures.begin(), textures.end(),
3040 [](const TextureInfo& tex) { return tex.second == "normalTex"; }) != textures.end();
3041 bool usesCoatNormalMap = this->HasClearCoat &&
3042 std::find_if(textures.begin(), textures.end(),
3043 [](const TextureInfo& tex) { return tex.second == "coatNormalTex"; }) != textures.end();
3044 bool usesRotationMap =
3045 std::find_if(textures.begin(), textures.end(),
3046 [](const TextureInfo& tex) { return tex.second == "anisotropyTex"; }) != textures.end();
3047
3048 if (hasAnisotropy != this->HasAnisotropy)
3049 {
3050 this->HasAnisotropy = hasAnisotropy;
3051 this->PBRStateTimeStamp.Modified();
3052 }
3053 if (hasClearCoat != this->HasClearCoat)
3054 {
3055 this->HasClearCoat = hasClearCoat;
3056 this->PBRStateTimeStamp.Modified();
3057 }
3058 if (usesNormalMap != this->UsesNormalMap)
3059 {
3060 this->UsesNormalMap = usesNormalMap;
3061 this->PBRStateTimeStamp.Modified();
3062 }
3063 if (usesCoatNormalMap != this->UsesCoatNormalMap)
3064 {
3065 this->UsesCoatNormalMap = usesCoatNormalMap;
3066 this->PBRStateTimeStamp.Modified();
3067 }
3068 if (usesRotationMap != this->UsesRotationMap)
3069 {
3070 this->UsesRotationMap = usesRotationMap;
3071 this->PBRStateTimeStamp.Modified();
3072 }
3073}
3074
3075//------------------------------------------------------------------------------
3076void vtkOpenGLLowMemoryPolyDataMapper::UpdateGLSLMods(vtkRenderer*, vtkActor*)

Callers 2

RenderPieceStartMethod · 0.95
ReplaceShaderValuesMethod · 0.95

Calls 6

GetTexturesMethod · 0.95
GetInterpolationMethod · 0.45
GetPropertyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected