Remove unused test files from SceneAPI/SceneBuilder
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -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 <AzCore/Casting/numeric_cast.h>
|
||||
#include <SceneAPI/FbxSceneBuilder/Tests/TestFbxMesh.h>
|
||||
#include <fbxsdk.h>
|
||||
#include <AzCore/Casting/lossy_cast.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace FbxSDKWrapper
|
||||
{
|
||||
TestFbxMesh::TestFbxMesh()
|
||||
: m_vertexControlPoints(nullptr)
|
||||
, m_vertexCount(0)
|
||||
, m_polygonVertexIndices(nullptr)
|
||||
, m_materialIndices(new FbxLayerElementArrayTemplate<int>(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<const FbxSkinWrapper> TestFbxMesh::GetSkin(int index) const
|
||||
{
|
||||
// For current test need, only have one skin for the mesh
|
||||
return m_skin;
|
||||
}
|
||||
|
||||
bool TestFbxMesh::GetMaterialIndices(FbxLayerElementArrayTemplate<int>** lockableArray) const
|
||||
{
|
||||
*lockableArray = m_materialIndices;
|
||||
return true;
|
||||
}
|
||||
|
||||
int TestFbxMesh::GetControlPointsCount() const
|
||||
{
|
||||
return static_cast<int>(m_vertexCount);
|
||||
}
|
||||
|
||||
AZStd::vector<Vector3> TestFbxMesh::GetControlPoints() const
|
||||
{
|
||||
return m_vertexControlPoints;
|
||||
}
|
||||
|
||||
int TestFbxMesh::GetPolygonCount() const
|
||||
{
|
||||
return static_cast<int>(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<AZ::Vector3>& points, std::vector<std::vector<int> >& 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<int>& 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<int>& onePolygonIndices : polygonVertexIndices)
|
||||
{
|
||||
m_polygonInfo.insert(std::make_pair<int, TestFbxPolygon>(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<FbxSkinWrapper>& skin)
|
||||
{
|
||||
m_skin = skin;
|
||||
}
|
||||
|
||||
void TestFbxMesh::CreateExpectMeshInfo(std::vector<std::vector<int> >& 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]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 <vector>
|
||||
#include <unordered_map>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h>
|
||||
#include <SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h>
|
||||
|
||||
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<const FbxSkinWrapper> GetSkin(int index) const override;
|
||||
bool GetMaterialIndices(FbxLayerElementArrayTemplate<int>** lockableArray) const override;
|
||||
|
||||
int GetControlPointsCount() const;
|
||||
AZStd::vector<Vector3> 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<AZ::Vector3>& points, std::vector<std::vector<int> >& polygonVertexIndices);
|
||||
void CreateExpectMeshInfo(std::vector<std::vector<int> >& expectedFaceVertexIndices);
|
||||
void SetSkin(const AZStd::shared_ptr<FbxSkinWrapper>& skin);
|
||||
|
||||
size_t GetExpectedVetexCount() const;
|
||||
size_t GetExpectedFaceCount() const;
|
||||
AZ::Vector3 GetExpectedFaceVertexPosition(unsigned int faceIndex, unsigned int vertexIndex) const;
|
||||
|
||||
protected:
|
||||
AZStd::vector<Vector3> 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<int>* m_materialIndices;
|
||||
std::unordered_map<int, TestFbxPolygon> m_polygonInfo;
|
||||
|
||||
FbxUVWrapper m_uvElements;
|
||||
FbxVertexColorWrapper m_vertexColorElements;
|
||||
AZStd::shared_ptr<FbxSkinWrapper> m_skin;
|
||||
|
||||
// Expected converted data
|
||||
unsigned int m_expectedVertexCount;
|
||||
std::vector<std::vector<int> > m_expectedFaceVertexIndices;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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 <SceneAPI/FbxSceneBuilder/Tests/TestFbxNode.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace FbxSDKWrapper
|
||||
{
|
||||
const std::shared_ptr<FbxMeshWrapper> TestFbxNode::GetMesh() const
|
||||
{
|
||||
return m_testFbxMesh;
|
||||
}
|
||||
|
||||
const char* TestFbxNode::GetName() const
|
||||
{
|
||||
return m_name.c_str();
|
||||
}
|
||||
|
||||
void TestFbxNode::SetMesh(std::shared_ptr<TestFbxMesh> testFbxMesh)
|
||||
{
|
||||
m_testFbxMesh = testFbxMesh;
|
||||
}
|
||||
|
||||
void TestFbxNode::SetName(const char* name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
|
||||
#include <SceneAPI/FbxSceneBuilder/Tests/TestFbxMesh.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace FbxSDKWrapper
|
||||
{
|
||||
// TestFbxNode
|
||||
// FbxNode Test Data creation
|
||||
class TestFbxNode
|
||||
: public FbxNodeWrapper
|
||||
{
|
||||
public:
|
||||
~TestFbxNode() override = default;
|
||||
|
||||
const std::shared_ptr<FbxMeshWrapper> GetMesh() const override;
|
||||
const char* GetName() const override;
|
||||
|
||||
void SetMesh(std::shared_ptr<TestFbxMesh> testFbxMesh);
|
||||
void SetName(const char* name);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<TestFbxMesh> m_testFbxMesh;
|
||||
AZStd::string m_name;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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 <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
#include <SceneAPI/FbxSceneBuilder/Tests/TestFbxSkin.h>
|
||||
#include <SceneAPI/FbxSceneBuilder/Tests/TestFbxNode.h>
|
||||
|
||||
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<const FbxNodeWrapper> TestFbxSkin::GetClusterLink(int index) const
|
||||
{
|
||||
return m_links[index];
|
||||
}
|
||||
|
||||
void TestFbxSkin::SetName(const char* name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
void TestFbxSkin::CreateSkinWeightData(AZStd::vector<AZStd::string>& boneNames, AZStd::vector<AZStd::vector<double>>& weights, AZStd::vector<AZStd::vector<int>>& controlPointIndices)
|
||||
{
|
||||
m_links.resize(boneNames.size());
|
||||
for (size_t linkIndex = 0; linkIndex < boneNames.size(); ++linkIndex)
|
||||
{
|
||||
m_links[linkIndex] = AZStd::make_shared<FbxSDKWrapper::TestFbxNode>();
|
||||
m_links[linkIndex]->SetName(boneNames[linkIndex].c_str());
|
||||
}
|
||||
m_weights = weights;
|
||||
m_controlPointIndices = controlPointIndices;
|
||||
}
|
||||
|
||||
void TestFbxSkin::CreateExpectSkinWeightData(AZStd::vector<AZStd::vector<int>>& boneIds, AZStd::vector<AZStd::vector<float>>& 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 <SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h>
|
||||
#include <SceneAPI/FbxSceneBuilder/Tests/TestFbxNode.h>
|
||||
|
||||
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<const FbxNodeWrapper> GetClusterLink(int index) const override;
|
||||
|
||||
void SetName(const char* name);
|
||||
void CreateSkinWeightData(AZStd::vector<AZStd::string>& boneNames, AZStd::vector<AZStd::vector<double>>& weights, AZStd::vector<AZStd::vector<int>>& controlPointIndices);
|
||||
void CreateExpectSkinWeightData(AZStd::vector<AZStd::vector<int>>& boneIds, AZStd::vector<AZStd::vector<float>>& 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<AZStd::shared_ptr<FbxSDKWrapper::TestFbxNode>> m_links;
|
||||
AZStd::vector<AZStd::vector<double>> m_weights;
|
||||
AZStd::vector<AZStd::vector<int>> m_controlPointIndices;
|
||||
|
||||
AZStd::vector<AZStd::vector<int>> m_expectedBoneIds;
|
||||
AZStd::vector<AZStd::vector<float>> m_expectedWeights;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user