From c6148601806a8deac089cca6b140701df29eb27a Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 27 Apr 2023 16:47:58 +0100 Subject: [PATCH] Blendshape properties should be registered per renderer instead of per shader Change-Id: I38c6a191e37212720fa603f82cb2ef04c6b18a17 --- .../internal/model-components/model-primitive-impl.cpp | 8 ++++---- dali-scene3d/public-api/loader/blend-shape-details.cpp | 16 ++++++++-------- dali-scene3d/public-api/loader/blend-shape-details.h | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dali-scene3d/internal/model-components/model-primitive-impl.cpp b/dali-scene3d/internal/model-components/model-primitive-impl.cpp index 4dbb047..b4f2b17 100644 --- a/dali-scene3d/internal/model-components/model-primitive-impl.cpp +++ b/dali-scene3d/internal/model-components/model-primitive-impl.cpp @@ -19,9 +19,9 @@ #include // EXTERNAL INCLUDES +#include #include #include -#include // INTERNAL INCLUDES #include @@ -178,7 +178,7 @@ void ModelPrimitive::SetImageBasedLightScaleFactor(float iblScaleFactor) void ModelPrimitive::SetBlendShapeData(Scene3D::Loader::BlendShapes::BlendShapeData& data) { mBlendShapeData = std::move(data); - Scene3D::Loader::BlendShapes::ConfigureProperties(mBlendShapeData, mShader); + Scene3D::Loader::BlendShapes::ConfigureProperties(mBlendShapeData, mRenderer); } void ModelPrimitive::SetBlendShapeGeometry(Dali::Texture blendShapeGeometry) @@ -248,7 +248,7 @@ void ModelPrimitive::ApplyMaterialToRenderer(MaterialModifyObserver::ModifyFlag mShader = Shader::New(vertexShader, fragmentShader); if(mBlendShapeData.version != Scene3D::Loader::BlendShapes::Version::INVALID && mBlendShapeData.mActor.GetHandle()) { - Scene3D::Loader::BlendShapes::ConfigureProperties(mBlendShapeData, mShader); + Scene3D::Loader::BlendShapes::ConfigureProperties(mBlendShapeData, mRenderer); } if(!mRenderer) @@ -383,7 +383,7 @@ void ModelPrimitive::UpdateImageBasedLightTexture() mRenderer.SetTextures(newTextures); } - mRenderer.RegisterProperty(GetImplementation(mMaterial).GetImageBasedLightScaleFactorName() .data(), mIblScaleFactor); + mRenderer.RegisterProperty(GetImplementation(mMaterial).GetImageBasedLightScaleFactorName().data(), mIblScaleFactor); mRenderer.RegisterProperty(GetImplementation(mMaterial).GetImageBasedLightMaxLodUniformName().data(), static_cast(mSpecularMipmapLevels)); } } diff --git a/dali-scene3d/public-api/loader/blend-shape-details.cpp b/dali-scene3d/public-api/loader/blend-shape-details.cpp index 4cf288c..f854fa7 100644 --- a/dali-scene3d/public-api/loader/blend-shape-details.cpp +++ b/dali-scene3d/public-api/loader/blend-shape-details.cpp @@ -36,7 +36,7 @@ const char* BlendShapes::COMPONENTS("blendShapeComponents"); const char* BlendShapes::WEIGHTS_UNIFORM("uBlendShapeWeight"); -void BlendShapes::ConfigureProperties(const BlendShapeData& data, Shader shader) +void BlendShapes::ConfigureProperties(const BlendShapeData& data, Renderer renderer) { unsigned int index = 0u; @@ -54,28 +54,28 @@ void BlendShapes::ConfigureProperties(const BlendShapeData& data, Shader shader) actor.RegisterProperty(weightName, weight); } - if(shader && data.version == Version::VERSION_1_0) + if(renderer && data.version == Version::VERSION_1_0) { snprintf(pFactorName, sizeof(unnormalizeFactorNameBuffer) - (pFactorName - unnormalizeFactorNameBuffer), "[%d]", index); std::string factorName{unnormalizeFactorNameBuffer}; - shader.RegisterProperty(factorName, data.unnormalizeFactors[index]); + renderer.RegisterProperty(factorName, data.unnormalizeFactors[index]); } ++index; } - if(shader) + if(renderer) { if(Version::VERSION_2_0 == data.version) { - shader.RegisterProperty(UNNORMALIZE_FACTOR, data.unnormalizeFactors[0u]); + renderer.RegisterProperty(UNNORMALIZE_FACTOR, data.unnormalizeFactors[0u]); } - shader.RegisterProperty(NUMBER_OF_BLEND_SHAPES, Property::Value(static_cast(index))); - shader.RegisterProperty(COMPONENT_SIZE, Property::Value(static_cast(data.bufferOffset))); + renderer.RegisterProperty(NUMBER_OF_BLEND_SHAPES, Property::Value(static_cast(index))); + renderer.RegisterProperty(COMPONENT_SIZE, Property::Value(static_cast(data.bufferOffset))); // Create a read only property to preserve the components of the blend shape. - shader.RegisterProperty(COMPONENTS, data.components, Property::AccessMode::READ_ONLY); + renderer.RegisterProperty(COMPONENTS, data.components, Property::AccessMode::READ_ONLY); } } diff --git a/dali-scene3d/public-api/loader/blend-shape-details.h b/dali-scene3d/public-api/loader/blend-shape-details.h index 2b304d6..e7d2eb4 100644 --- a/dali-scene3d/public-api/loader/blend-shape-details.h +++ b/dali-scene3d/public-api/loader/blend-shape-details.h @@ -74,9 +74,9 @@ struct DALI_SCENE3D_API BlendShapes /** * @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants, - * on the given @a shader and @a actor. + * on the given @a renderer and @a actor. */ - static void ConfigureProperties(const BlendShapeData& data, Shader shader); + static void ConfigureProperties(const BlendShapeData& data, Renderer renderer); BlendShapes() = delete; }; -- 2.7.4