diff --git a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxMesh.cpp b/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxMesh.cpp deleted file mode 100644 index 4451f0ae93..0000000000 --- a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxMesh.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - TestFbxMesh::TestFbxMesh() - : m_vertexControlPoints(nullptr) - , m_vertexCount(0) - , m_polygonVertexIndices(nullptr) - , m_materialIndices(new FbxLayerElementArrayTemplate(eFbxInt)) - , m_uvElements(FbxGeometryElementUV::Create(nullptr, "TestElements_UV")) - , m_vertexColorElements(FbxGeometryElementVertexColor::Create(nullptr, "TestElements_VertexColors")) - , m_expectedVertexCount(0) - { - } - - int TestFbxMesh::GetDeformerCount() const - { - // For current test need, only have one skin for the mesh - return m_skin ? 1 : 0; - } - - AZStd::shared_ptr TestFbxMesh::GetSkin(int index) const - { - // For current test need, only have one skin for the mesh - return m_skin; - } - - bool TestFbxMesh::GetMaterialIndices(FbxLayerElementArrayTemplate** lockableArray) const - { - *lockableArray = m_materialIndices; - return true; - } - - int TestFbxMesh::GetControlPointsCount() const - { - return static_cast(m_vertexCount); - } - - AZStd::vector TestFbxMesh::GetControlPoints() const - { - return m_vertexControlPoints; - } - - int TestFbxMesh::GetPolygonCount() const - { - return static_cast(m_polygonInfo.size()); - } - - int TestFbxMesh::GetPolygonSize(int polygonIndex) const - { - if (m_polygonInfo.find(polygonIndex) != m_polygonInfo.end()) - { - return aznumeric_caster(m_polygonInfo.find(polygonIndex)->second.m_vertexCount); - } - return -1; - } - - int* TestFbxMesh::GetPolygonVertices() const - { - return m_polygonVertexIndices; - } - - int TestFbxMesh::GetPolygonVertexIndex(int polygonIndex) const - { - if (m_polygonInfo.find(polygonIndex) != m_polygonInfo.end()) - { - return aznumeric_caster(m_polygonInfo.find(polygonIndex)->second.m_startVertexIndex); - } - return -1; - } - - FbxUVWrapper TestFbxMesh::GetElementUV(int index) - { - (void)index; - return m_uvElements; - } - - int TestFbxMesh::GetElementUVCount() const - { - return 1; - } - - FbxVertexColorWrapper TestFbxMesh::GetElementVertexColor(int index) - { - (void)index; - return m_vertexColorElements; - } - - int TestFbxMesh::GetElementVertexColorCount() const - { - return 1; - } - - bool TestFbxMesh::GetPolygonVertexNormal(int polyIndex, int vertexIndex, Vector3& normal) const - { - normal = Vector3(1.0f, 0.0f, 0.0f); - return true; - } - - void TestFbxMesh::CreateMesh(std::vector& points, std::vector >& polygonVertexIndices) - { - m_vertexControlPoints.clear(); - m_materialIndices->Clear(); - m_polygonInfo.clear(); - - // Create fbx control point (position) data, and associated material index data - m_vertexCount = aznumeric_caster(points.size()); - m_vertexControlPoints.reserve(points.size()); - for (unsigned int i = 0; i < points.size(); ++i) - { - m_vertexControlPoints.push_back(Vector3(points[i].GetX(), points[i].GetY(), points[i].GetZ())); - m_materialIndices->Add(i); - } - - // Create fbx face data - m_expectedVertexCount = 0; - for (const std::vector& onePolygonIndices : polygonVertexIndices) - { - for (const int& index : onePolygonIndices) - { - m_expectedVertexCount++; - } - } - if (m_polygonVertexIndices) - { - delete m_polygonVertexIndices; - } - m_polygonVertexIndices = new int[m_expectedVertexCount]; - size_t i = 0; - for (const std::vector& onePolygonIndices : polygonVertexIndices) - { - m_polygonInfo.insert(std::make_pair(aznumeric_caster(m_polygonInfo.size()), - TestFbxPolygon(i, aznumeric_caster(onePolygonIndices.size())))); - for (const int& index : onePolygonIndices) - { - m_polygonVertexIndices[i] = index; - i++; - } - } - } - - void TestFbxMesh::SetSkin(const AZStd::shared_ptr& skin) - { - m_skin = skin; - } - - void TestFbxMesh::CreateExpectMeshInfo(std::vector >& expectedFaceVertexIndices) - { - m_expectedFaceVertexIndices = expectedFaceVertexIndices; - } - - size_t TestFbxMesh::GetExpectedVetexCount() const - { - return m_expectedVertexCount; - } - - size_t TestFbxMesh::GetExpectedFaceCount() const - { - return m_expectedFaceVertexIndices.size(); - } - - AZ::Vector3 TestFbxMesh::GetExpectedFaceVertexPosition(unsigned int faceIndex, unsigned int vertexIndex) const - { - return m_vertexControlPoints[m_expectedFaceVertexIndices[faceIndex][vertexIndex]]; - } - } -} diff --git a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxMesh.h b/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxMesh.h deleted file mode 100644 index 68f2e1f19b..0000000000 --- a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxMesh.h +++ /dev/null @@ -1,86 +0,0 @@ -#pragma once - -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - struct TestFbxPolygon - { - size_t m_startVertexIndex; - size_t m_vertexCount; - - TestFbxPolygon(size_t startVertexIndex, size_t vertexCount) - : m_startVertexIndex(startVertexIndex) - , m_vertexCount(vertexCount) - { - } - }; - - // TestFbxMesh - // FbxMesh Test Data creation - class TestFbxMesh - : public FbxMeshWrapper - { - public: - TestFbxMesh(); - ~TestFbxMesh() override = default; - - int GetDeformerCount() const override; - AZStd::shared_ptr GetSkin(int index) const override; - bool GetMaterialIndices(FbxLayerElementArrayTemplate** lockableArray) const override; - - int GetControlPointsCount() const; - AZStd::vector GetControlPoints() const override; - - int GetPolygonCount() const override; - int GetPolygonSize(int polygonIndex) const override; - int* GetPolygonVertices() const override; - int GetPolygonVertexIndex(int polygonIndex) const; - - FbxUVWrapper GetElementUV(int index = 0) override; - int GetElementUVCount() const override; - FbxVertexColorWrapper GetElementVertexColor(int index = 0) override; - int GetElementVertexColorCount() const override; - - bool GetPolygonVertexNormal(int polyIndex, int vertexIndex, Vector3& normal) const override; - - // Create test data APIs - void CreateMesh(std::vector& points, std::vector >& polygonVertexIndices); - void CreateExpectMeshInfo(std::vector >& expectedFaceVertexIndices); - void SetSkin(const AZStd::shared_ptr& skin); - - size_t GetExpectedVetexCount() const; - size_t GetExpectedFaceCount() const; - AZ::Vector3 GetExpectedFaceVertexPosition(unsigned int faceIndex, unsigned int vertexIndex) const; - - protected: - AZStd::vector m_vertexControlPoints; // vertex positions - size_t m_vertexCount; - int* m_polygonVertexIndices; // store all polygons' vertex indices in sequence. Each index maps to a control point. - FbxLayerElementArrayTemplate* m_materialIndices; - std::unordered_map m_polygonInfo; - - FbxUVWrapper m_uvElements; - FbxVertexColorWrapper m_vertexColorElements; - AZStd::shared_ptr m_skin; - - // Expected converted data - unsigned int m_expectedVertexCount; - std::vector > m_expectedFaceVertexIndices; - }; - } -} diff --git a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxNode.cpp b/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxNode.cpp deleted file mode 100644 index 0217044515..0000000000 --- a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxNode.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - const std::shared_ptr TestFbxNode::GetMesh() const - { - return m_testFbxMesh; - } - - const char* TestFbxNode::GetName() const - { - return m_name.c_str(); - } - - void TestFbxNode::SetMesh(std::shared_ptr testFbxMesh) - { - m_testFbxMesh = testFbxMesh; - } - - void TestFbxNode::SetName(const char* name) - { - m_name = name; - } - } -} diff --git a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxNode.h b/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxNode.h deleted file mode 100644 index ede0eb801c..0000000000 --- a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxNode.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - // TestFbxNode - // FbxNode Test Data creation - class TestFbxNode - : public FbxNodeWrapper - { - public: - ~TestFbxNode() override = default; - - const std::shared_ptr GetMesh() const override; - const char* GetName() const override; - - void SetMesh(std::shared_ptr testFbxMesh); - void SetName(const char* name); - - protected: - std::shared_ptr m_testFbxMesh; - AZStd::string m_name; - }; - } -} diff --git a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxSkin.cpp b/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxSkin.cpp deleted file mode 100644 index 9225f907b1..0000000000 --- a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxSkin.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - const char* TestFbxSkin::GetName() const - { - return m_name.c_str(); - } - - int TestFbxSkin::GetClusterCount() const - { - return aznumeric_caster(m_links.size()); - } - - int TestFbxSkin::GetClusterControlPointIndicesCount(int index) const - { - return aznumeric_caster(m_controlPointIndices[index].size()); - } - - int TestFbxSkin::GetClusterControlPointIndex(int clusterIndex, int pointIndex) const - { - return m_controlPointIndices[clusterIndex][pointIndex]; - } - - double TestFbxSkin::GetClusterControlPointWeight(int clusterIndex, int pointIndex) const - { - return m_weights[clusterIndex][pointIndex]; - } - - AZStd::shared_ptr TestFbxSkin::GetClusterLink(int index) const - { - return m_links[index]; - } - - void TestFbxSkin::SetName(const char* name) - { - m_name = name; - } - - void TestFbxSkin::CreateSkinWeightData(AZStd::vector& boneNames, AZStd::vector>& weights, AZStd::vector>& controlPointIndices) - { - m_links.resize(boneNames.size()); - for (size_t linkIndex = 0; linkIndex < boneNames.size(); ++linkIndex) - { - m_links[linkIndex] = AZStd::make_shared(); - m_links[linkIndex]->SetName(boneNames[linkIndex].c_str()); - } - m_weights = weights; - m_controlPointIndices = controlPointIndices; - } - - void TestFbxSkin::CreateExpectSkinWeightData(AZStd::vector>& boneIds, AZStd::vector>& weights) - { - m_expectedBoneIds = boneIds; - m_expectedWeights = weights; - } - - size_t TestFbxSkin::GetExpectedVertexCount() const - { - return m_expectedBoneIds.size(); - } - - size_t TestFbxSkin::GetExpectedLinkCount(size_t vertexIndex) const - { - return m_expectedBoneIds[vertexIndex].size(); - } - - int TestFbxSkin::GetExpectedSkinLinkBoneId(size_t vertexIndex, size_t linkIndex) const - { - return m_expectedBoneIds[vertexIndex][linkIndex]; - } - - float TestFbxSkin::GetExpectedSkinLinkWeight(size_t vertextIndex, size_t linkIndex) const - { - return m_expectedWeights[vertextIndex][linkIndex]; - } - } -} diff --git a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxSkin.h b/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxSkin.h deleted file mode 100644 index b90353e6a7..0000000000 --- a/Code/Tools/SceneAPI/SceneBuilder/Tests/TestFbxSkin.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -namespace AZ -{ - namespace FbxSDKWrapper - { - class TestFbxSkin - : public FbxSkinWrapper - { - public: - ~TestFbxSkin() override = default; - - const char* GetName() const override; - int GetClusterCount() const override; - int GetClusterControlPointIndicesCount(int index) const override; - int GetClusterControlPointIndex(int clusterIndex, int pointIndex) const override; - double GetClusterControlPointWeight(int clusterIndex, int pointIndex) const override; - AZStd::shared_ptr GetClusterLink(int index) const override; - - void SetName(const char* name); - void CreateSkinWeightData(AZStd::vector& boneNames, AZStd::vector>& weights, AZStd::vector>& controlPointIndices); - void CreateExpectSkinWeightData(AZStd::vector>& boneIds, AZStd::vector>& weights); - - size_t GetExpectedVertexCount() const; - size_t GetExpectedLinkCount(size_t vertexIndex) const; - int GetExpectedSkinLinkBoneId(size_t vertexIndex, size_t linkIndex) const; - float GetExpectedSkinLinkWeight(size_t vertexIndex, size_t linkIndex) const; - - protected: - AZStd::string m_name; - AZStd::vector> m_links; - AZStd::vector> m_weights; - AZStd::vector> m_controlPointIndices; - - AZStd::vector> m_expectedBoneIds; - AZStd::vector> m_expectedWeights; - }; - } -}