Merge branch 'main' into sceneapi_script_autotest
This commit is contained in:
@@ -66,6 +66,15 @@ namespace AZ
|
||||
{
|
||||
}
|
||||
|
||||
void BlendShapeAnimationData::CloneAttributesFrom(const IGraphObject* sourceObject)
|
||||
{
|
||||
IBlendShapeAnimationData::CloneAttributesFrom(sourceObject);
|
||||
if (const auto* typedSource = azrtti_cast<const BlendShapeAnimationData*>(sourceObject))
|
||||
{
|
||||
SetBlendShapeName(typedSource->GetBlendShapeName());
|
||||
}
|
||||
}
|
||||
|
||||
void BlendShapeAnimationData::SetBlendShapeName(const char* blendShapeName)
|
||||
{
|
||||
m_blendShapeName = blendShapeName;
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace AZ
|
||||
|
||||
SCENE_DATA_API BlendShapeAnimationData();
|
||||
SCENE_DATA_API ~BlendShapeAnimationData() override = default;
|
||||
SCENE_DATA_API void CloneAttributesFrom(const IGraphObject* sourceObject) override;
|
||||
SCENE_DATA_API virtual void SetBlendShapeName(const char* name);
|
||||
SCENE_DATA_API virtual void AddKeyFrame(double keyFrameValue);
|
||||
SCENE_DATA_API virtual void ReserveKeyFrames(size_t count);
|
||||
|
||||
@@ -23,11 +23,14 @@ namespace AZ
|
||||
|
||||
BlendShapeData::~BlendShapeData() = default;
|
||||
|
||||
unsigned int BlendShapeData::AddVertex(const Vector3& position, const Vector3& normal)
|
||||
void BlendShapeData::AddPosition(const Vector3& position)
|
||||
{
|
||||
m_positions.push_back(position);
|
||||
}
|
||||
|
||||
void BlendShapeData::AddNormal(const Vector3& normal)
|
||||
{
|
||||
m_normals.push_back(normal);
|
||||
return static_cast<unsigned int>(m_positions.size()-1);
|
||||
}
|
||||
|
||||
void BlendShapeData::AddTangentAndBitangent(const Vector4& tangent, const Vector3& bitangent)
|
||||
@@ -135,6 +138,12 @@ namespace AZ
|
||||
return static_cast<unsigned int>(m_faces.size());
|
||||
}
|
||||
|
||||
const BlendShapeData::Face& BlendShapeData::GetFaceInfo(unsigned int index) const
|
||||
{
|
||||
AZ_Assert(index < m_faces.size(), "GetFaceInfo index not in range");
|
||||
return m_faces[index];
|
||||
}
|
||||
|
||||
const Vector3& BlendShapeData::GetPosition(unsigned int index) const
|
||||
{
|
||||
AZ_Assert(index < m_positions.size(), "GetPosition index not in range");
|
||||
|
||||
@@ -37,7 +37,8 @@ namespace AZ
|
||||
static constexpr AZ::u8 MaxNumUVSets = 8;
|
||||
|
||||
SCENE_DATA_API ~BlendShapeData() override;
|
||||
SCENE_DATA_API virtual unsigned int AddVertex(const Vector3& position, const Vector3& normal);
|
||||
SCENE_DATA_API void AddPosition(const AZ::Vector3& position);
|
||||
SCENE_DATA_API void AddNormal(const AZ::Vector3& normal);
|
||||
SCENE_DATA_API void AddTangentAndBitangent(const Vector4& tangent, const Vector3& bitangent);
|
||||
SCENE_DATA_API void AddUV(const Vector2& uv, AZ::u8 uvSetIndex);
|
||||
SCENE_DATA_API void AddColor(const SceneAPI::DataTypes::Color& color, AZ::u8 colorSetIndex);
|
||||
@@ -57,6 +58,7 @@ namespace AZ
|
||||
//assume consistent winding - no stripping or fanning expected (3 index per face)
|
||||
SCENE_DATA_API unsigned int GetVertexCount() const override;
|
||||
SCENE_DATA_API unsigned int GetFaceCount() const override;
|
||||
SCENE_DATA_API const Face& GetFaceInfo(unsigned int index) const override;
|
||||
|
||||
SCENE_DATA_API const Vector3& GetPosition(unsigned int index) const override;
|
||||
SCENE_DATA_API const Vector3& GetNormal(unsigned int index) const override;
|
||||
|
||||
@@ -74,6 +74,15 @@ namespace AZ
|
||||
|
||||
MeshData::~MeshData() = default;
|
||||
|
||||
void MeshData::CloneAttributesFrom(const IGraphObject* sourceObject)
|
||||
{
|
||||
IMeshData::CloneAttributesFrom(sourceObject);
|
||||
if (const auto* typedSource = azrtti_cast<const MeshData*>(sourceObject))
|
||||
{
|
||||
SetSdkMeshIndex(typedSource->GetSdkMeshIndex());
|
||||
}
|
||||
}
|
||||
|
||||
void MeshData::AddPosition(const AZ::Vector3& position)
|
||||
{
|
||||
m_positions.push_back(position);
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace AZ
|
||||
static void Reflect(ReflectContext* context);
|
||||
|
||||
SCENE_DATA_API ~MeshData() override;
|
||||
|
||||
SCENE_DATA_API void CloneAttributesFrom(const IGraphObject* sourceObject) override;
|
||||
|
||||
//assumes 1 to 1 mapping for these position, normal, color, uv
|
||||
//positions with more than one normal or uv (seam) will duplicate shared values in multiple verts
|
||||
SCENE_DATA_API virtual void AddPosition(const AZ::Vector3& position);
|
||||
|
||||
@@ -44,6 +44,16 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void MeshVertexBitangentData::CloneAttributesFrom(const IGraphObject* sourceObject)
|
||||
{
|
||||
IMeshVertexBitangentData::CloneAttributesFrom(sourceObject);
|
||||
if (const auto* typedSource = azrtti_cast<const MeshVertexBitangentData*>(sourceObject))
|
||||
{
|
||||
SetTangentSpace(typedSource->GetTangentSpace());
|
||||
SetBitangentSetIndex(typedSource->GetBitangentSetIndex());
|
||||
}
|
||||
}
|
||||
|
||||
size_t MeshVertexBitangentData::GetCount() const
|
||||
{
|
||||
return m_bitangents.size();
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace AZ
|
||||
|
||||
SCENE_DATA_API ~MeshVertexBitangentData() override = default;
|
||||
|
||||
SCENE_DATA_API void CloneAttributesFrom(const IGraphObject* sourceObject) override;
|
||||
|
||||
SCENE_DATA_API size_t GetCount() const override;
|
||||
SCENE_DATA_API const AZ::Vector3& GetBitangent(size_t index) const override;
|
||||
SCENE_DATA_API void SetBitangent(size_t vertexIndex, const AZ::Vector3& bitangent) override;
|
||||
|
||||
@@ -50,6 +50,15 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void MeshVertexColorData::CloneAttributesFrom(const IGraphObject* sourceObject)
|
||||
{
|
||||
IMeshVertexColorData::CloneAttributesFrom(sourceObject);
|
||||
if (const auto* typedSource = azrtti_cast<const MeshVertexColorData*>(sourceObject))
|
||||
{
|
||||
SetCustomName(typedSource->GetCustomName());
|
||||
}
|
||||
}
|
||||
|
||||
const AZ::Name& MeshVertexColorData::GetCustomName() const
|
||||
{
|
||||
return m_customName;
|
||||
@@ -59,7 +68,10 @@ namespace AZ
|
||||
{
|
||||
m_customName = name;
|
||||
}
|
||||
|
||||
void MeshVertexColorData::SetCustomName(const AZ::Name& name)
|
||||
{
|
||||
m_customName = name;
|
||||
}
|
||||
|
||||
size_t MeshVertexColorData::GetCount() const
|
||||
{
|
||||
|
||||
@@ -32,8 +32,11 @@ namespace AZ
|
||||
|
||||
SCENE_DATA_API ~MeshVertexColorData() override = default;
|
||||
|
||||
SCENE_DATA_API void CloneAttributesFrom(const IGraphObject* sourceObject) override;
|
||||
|
||||
SCENE_DATA_API const AZ::Name& GetCustomName() const override;
|
||||
SCENE_DATA_API void SetCustomName(const char* name);
|
||||
SCENE_DATA_API void SetCustomName(const AZ::Name& name);
|
||||
|
||||
SCENE_DATA_API size_t GetCount() const override;
|
||||
SCENE_DATA_API const AZ::SceneAPI::DataTypes::Color& GetColor(size_t index) const override;
|
||||
|
||||
@@ -44,6 +44,16 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void MeshVertexTangentData::CloneAttributesFrom(const IGraphObject* sourceObject)
|
||||
{
|
||||
IMeshVertexTangentData::CloneAttributesFrom(sourceObject);
|
||||
if (const auto* typedSource = azrtti_cast<const MeshVertexTangentData*>(sourceObject))
|
||||
{
|
||||
SetTangentSpace(typedSource->GetTangentSpace());
|
||||
SetTangentSetIndex(typedSource->GetTangentSetIndex());
|
||||
}
|
||||
}
|
||||
|
||||
size_t MeshVertexTangentData::GetCount() const
|
||||
{
|
||||
return m_tangents.size();
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace AZ
|
||||
|
||||
SCENE_DATA_API ~MeshVertexTangentData() override = default;
|
||||
|
||||
SCENE_DATA_API void CloneAttributesFrom(const IGraphObject* sourceObject) override;
|
||||
|
||||
SCENE_DATA_API size_t GetCount() const override;
|
||||
SCENE_DATA_API const AZ::Vector4& GetTangent(size_t index) const override;
|
||||
SCENE_DATA_API void SetTangent(size_t vertexIndex, const AZ::Vector4& tangent) override;
|
||||
|
||||
@@ -40,6 +40,15 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void MeshVertexUVData::CloneAttributesFrom(const IGraphObject* sourceObject)
|
||||
{
|
||||
IMeshVertexUVData::CloneAttributesFrom(sourceObject);
|
||||
if (const auto* typedSource = azrtti_cast<const MeshVertexUVData*>(sourceObject))
|
||||
{
|
||||
SetCustomName(typedSource->GetCustomName());
|
||||
}
|
||||
}
|
||||
|
||||
const AZ::Name& MeshVertexUVData::GetCustomName() const
|
||||
{
|
||||
return m_customName;
|
||||
@@ -49,6 +58,10 @@ namespace AZ
|
||||
{
|
||||
m_customName = name;
|
||||
}
|
||||
void MeshVertexUVData::SetCustomName(const AZ::Name& name)
|
||||
{
|
||||
m_customName = name;
|
||||
}
|
||||
|
||||
size_t MeshVertexUVData::GetCount() const
|
||||
{
|
||||
|
||||
@@ -34,8 +34,11 @@ namespace AZ
|
||||
|
||||
SCENE_DATA_API ~MeshVertexUVData() override = default;
|
||||
|
||||
SCENE_DATA_API void CloneAttributesFrom(const IGraphObject* sourceObject) override;
|
||||
|
||||
SCENE_DATA_API const AZ::Name& GetCustomName() const override;
|
||||
SCENE_DATA_API void SetCustomName(const char* name);
|
||||
SCENE_DATA_API void SetCustomName(const AZ::Name& name);
|
||||
|
||||
SCENE_DATA_API size_t GetCount() const override;
|
||||
SCENE_DATA_API const AZ::Vector2& GetUV(size_t index) const override;
|
||||
|
||||
@@ -30,7 +30,7 @@ protected:
|
||||
|
||||
sceneCoreModule = AZ::DynamicModuleHandle::Create("SceneCore");
|
||||
AZ_Assert(sceneCoreModule, "SceneData unit tests failed to create SceneCore module.");
|
||||
bool loaded = sceneCoreModule->Load(false);
|
||||
[[maybe_unused]] bool loaded = sceneCoreModule->Load(false);
|
||||
AZ_Assert(loaded, "SceneData unit tests failed to load SceneCore module.");
|
||||
auto init = sceneCoreModule->GetFunction<AZ::InitializeDynamicModuleFunction>(AZ::InitializeDynamicModuleFunctionName);
|
||||
AZ_Assert(init, "SceneData unit tests failed to find the initialization function the SceneCore module.");
|
||||
@@ -51,4 +51,4 @@ private:
|
||||
AZStd::unique_ptr<AZ::DynamicModuleHandle> sceneCoreModule;
|
||||
};
|
||||
|
||||
AZ_UNIT_TEST_HOOK(new SceneDataTestEnvironment);
|
||||
AZ_UNIT_TEST_HOOK(new SceneDataTestEnvironment);
|
||||
|
||||
Reference in New Issue
Block a user