/*
-* Copyright (c) 2021 Samsung Electronics Co., Ltd.
+* Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// FILE HEADER
-#include "dali-scene-loader/public-api/blend-shape-details.h"
+#include <dali-scene-loader/public-api/blend-shape-details.h>
// EXTERNAL INCLUDES
-#include "dali/public-api/animation/constraints.h"
-#include "dali/public-api/object/property.h"
+#include <dali/public-api/animation/constraints.h>
+#include <dali/public-api/object/property.h>
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/resource-bundle.h"
+#include <dali-scene-loader/public-api/resource-bundle.h>
namespace Dali
{
std::string weightName{weightNameBuffer};
actor.RegisterProperty(weightName, blendShape.weight);
- if(mesh.first.mBlendShapeVersion == Version::VERSION_1_0)
+ if(shader && mesh.first.mBlendShapeVersion == Version::VERSION_1_0)
{
snprintf(pFactorName, sizeof(unnormalizeFactorNameBuffer) - (pFactorName - unnormalizeFactorNameBuffer), "[%d]", index);
std::string factorName{unnormalizeFactorNameBuffer};
++index;
}
- if(Version::VERSION_2_0 == mesh.first.mBlendShapeVersion)
+ if(shader)
{
- shader.RegisterProperty(UNNORMALIZE_FACTOR, mesh.second.blendShapeUnnormalizeFactor[0u]);
- }
+ if(Version::VERSION_2_0 == mesh.first.mBlendShapeVersion)
+ {
+ shader.RegisterProperty(UNNORMALIZE_FACTOR, mesh.second.blendShapeUnnormalizeFactor[0u]);
+ }
- shader.RegisterProperty(NUMBER_OF_BLEND_SHAPES, Property::Value(static_cast<int>(index)));
- shader.RegisterProperty(COMPONENT_SIZE, Property::Value(static_cast<int>(mesh.second.blendShapeBufferOffset)));
+ shader.RegisterProperty(NUMBER_OF_BLEND_SHAPES, Property::Value(static_cast<float>(index)));
+ shader.RegisterProperty(COMPONENT_SIZE, Property::Value(static_cast<float>(mesh.second.blendShapeBufferOffset)));
- // Create a read only property to preserve the components of the blend shape.
- int32_t components = 0x0;
- for(auto& bs : mesh.first.mBlendShapes)
- {
- components |= (bs.deltas.IsDefined() * Component::POSITIONS) |
- (bs.normals.IsDefined() * Component::NORMALS) | (bs.tangents.IsDefined() * Component::TANGENTS);
+ // Create a read only property to preserve the components of the blend shape.
+ int32_t components = 0x0;
+ for(auto& bs : mesh.first.mBlendShapes)
+ {
+ components |= (bs.deltas.IsDefined() * Component::POSITIONS) |
+ (bs.normals.IsDefined() * Component::NORMALS) | (bs.tangents.IsDefined() * Component::TANGENTS);
+ }
+ shader.RegisterProperty(COMPONENTS, components, Property::AccessMode::READ_ONLY);
}
- shader.RegisterProperty(COMPONENTS, components, Property::AccessMode::READ_ONLY);
}
} // namespace SceneLoader