Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,40 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME})
set(sdkwrapper_dir ${CMAKE_CURRENT_LIST_DIR}/../SDKWrapper)
set(sdkwrapper_pal_dir ${sdkwrapper_dir}/Platform/${PAL_PLATFORM_NAME})
if (NOT PAL_TRAIT_BUILD_HOST_TOOLS)
return()
endif()
ly_add_target(
NAME FbxSDKWrapper STATIC
NAMESPACE AZ
FILES_CMAKE
fbxsdkwrapper_files.cmake
${sdkwrapper_dir}/sdkwrapper_files.cmake
${sdkwrapper_pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
PLATFORM_INCLUDE_FILES
${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
INCLUDE_DIRECTORIES
PUBLIC
.
../..
${sdkwrapper_dir}
BUILD_DEPENDENCIES
PRIVATE
AZ::AzCore
AZ::AzToolsFramework
PUBLIC
3rdParty::FbxSdk
)
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include "FbxAnimCurveNodeWrapper.h"
#include "FbxAnimCurveWrapper.h"
#include "fbxsdk.h"
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAnimCurveNodeWrapper::FbxAnimCurveNodeWrapper(FbxAnimCurveNode* fbxAnimCurveNode)
: m_fbxAnimCurveNode(fbxAnimCurveNode)
{
}
const char* FbxAnimCurveNodeWrapper::GetName() const
{
return m_fbxAnimCurveNode->GetName();
}
int FbxAnimCurveNodeWrapper::GetChannelCount() const
{
return m_fbxAnimCurveNode->GetChannelsCount();
}
int FbxAnimCurveNodeWrapper::GetCurveCount(int channelID) const
{
return m_fbxAnimCurveNode->GetCurveCount(channelID);
}
AZStd::shared_ptr<const FbxAnimCurveWrapper> FbxAnimCurveNodeWrapper::GetCurveWrapper(int channelID, int index) const
{
return AZStd::make_shared<const FbxAnimCurveWrapper>(static_cast<FbxAnimCurve*>(m_fbxAnimCurveNode->GetCurve(channelID, index)));
}
}
}
@@ -0,0 +1,40 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "fbxsdk.h"
#include "FbxTimeWrapper.h"
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxAnimCurveWrapper;
class FbxAnimCurveNodeWrapper
{
public:
FbxAnimCurveNodeWrapper(FbxAnimCurveNode* fbxAnimCurveNode);
~FbxAnimCurveNodeWrapper() = default;
const char* GetName() const;
int GetChannelCount() const;
int GetCurveCount(int channelID) const;
AZStd::shared_ptr<const FbxAnimCurveWrapper> GetCurveWrapper(int channelID, int index) const;
protected:
FbxAnimCurveNode* m_fbxAnimCurveNode;
};
}
}
@@ -0,0 +1,34 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAnimCurveWrapper::FbxAnimCurveWrapper(FbxAnimCurve* fbxAnimCurve)
: m_fbxAnimCurve(fbxAnimCurve)
{
}
const char* FbxAnimCurveWrapper::GetName() const
{
return m_fbxAnimCurve->GetName();
}
float FbxAnimCurveWrapper::Evaluate(FbxTimeWrapper& time) const
{
return m_fbxAnimCurve->Evaluate(time.m_fbxTime);
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,34 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxAnimCurveWrapper
{
public:
FbxAnimCurveWrapper(FbxAnimCurve* fbxAnimCurve);
~FbxAnimCurveWrapper() = default;
const char* GetName() const;
float Evaluate(FbxTimeWrapper& time) const;
protected:
FbxAnimCurve* m_fbxAnimCurve;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,49 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Casting/numeric_cast.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimCurveNodeWrapper.h>
#include "fbxsdk.h"
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAnimLayerWrapper::FbxAnimLayerWrapper(FbxAnimLayer* fbxAnimLayer)
: m_fbxAnimLayer(fbxAnimLayer)
{
}
const char* FbxAnimLayerWrapper::GetName() const
{
return m_fbxAnimLayer->GetName();
}
u32 FbxAnimLayerWrapper::GetCurveNodeCount() const
{
return static_cast<u32>(m_fbxAnimLayer->GetMemberCount());
}
FbxAnimLayer* FbxAnimLayerWrapper::GetFbxLayer() const
{
return m_fbxAnimLayer;
}
AZStd::shared_ptr<const FbxAnimCurveNodeWrapper> FbxAnimLayerWrapper::GetCurveNodeWrapper(u32 index) const
{
return AZStd::make_shared<const FbxAnimCurveNodeWrapper>(static_cast<FbxAnimCurveNode*>(m_fbxAnimLayer->GetMember(aznumeric_cast<int>(index))));
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,39 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxAnimCurveNodeWrapper;
class FbxAnimLayerWrapper
{
friend class FbxNodeWrapper;
public:
FbxAnimLayerWrapper(FbxAnimLayer* fbxAnimLayer);
~FbxAnimLayerWrapper() = default;
const char* GetName() const;
u32 GetCurveNodeCount() const ;
FbxAnimLayer* GetFbxLayer() const;
AZStd::shared_ptr<const FbxAnimCurveNodeWrapper> GetCurveNodeWrapper(u32 index) const;
protected:
FbxAnimLayer* m_fbxAnimLayer;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,55 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAnimStackWrapper::FbxAnimStackWrapper(FbxAnimStack* fbxAnimStack)
: m_fbxAnimStack(fbxAnimStack)
{
AZ_Assert(fbxAnimStack, "Invalid FbxAnimStack input to initialize FbxAnimStackWrapper");
}
FbxAnimStackWrapper::~FbxAnimStackWrapper()
{
m_fbxAnimStack = nullptr;
}
const char* FbxAnimStackWrapper::GetName() const
{
return m_fbxAnimStack->GetName();
}
int FbxAnimStackWrapper::GetAnimationLayerCount() const
{
return m_fbxAnimStack->GetMemberCount<FbxAnimLayer>();
}
const AZStd::shared_ptr<FbxAnimLayerWrapper> FbxAnimStackWrapper::GetAnimationLayerAt(int index) const
{
AZ_Assert(index < GetAnimationLayerCount(), "Invalid animation layer index %d for layer count %d", index, GetAnimationLayerCount());
return AZStd::make_shared<FbxAnimLayerWrapper>(m_fbxAnimStack->GetMember<FbxAnimLayer>(index));
}
FbxTimeSpanWrapper FbxAnimStackWrapper::GetLocalTimeSpan() const
{
return FbxTimeSpanWrapper(m_fbxAnimStack->GetLocalTimeSpan());
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,42 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
using FbxSDKLongLong = FbxLongLong;
class FbxAnimLayerWrapper;
class FbxTimeSpanWrapper;
class FbxAnimStackWrapper
{
public:
FbxAnimStackWrapper(FbxAnimStack* fbxAnimStack);
virtual ~FbxAnimStackWrapper();
virtual const char* GetName() const;
virtual int GetAnimationLayerCount() const;
virtual const AZStd::shared_ptr<FbxAnimLayerWrapper> GetAnimationLayerAt(int index) const;
virtual FbxTimeSpanWrapper GetLocalTimeSpan() const;
protected:
FbxAnimStackWrapper() = default;
FbxAnimStack* m_fbxAnimStack;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,75 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <AzToolsFramework/Debug/TraceContext.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxAxisSystemWrapper::FbxAxisSystemWrapper(const FbxAxisSystem& fbxAxisSystem)
: m_fbxAxisSystem(fbxAxisSystem)
{
}
FbxAxisSystemWrapper::UpVector FbxAxisSystemWrapper::GetUpVector(int& sign) const
{
switch (m_fbxAxisSystem.GetUpVector(sign))
{
case FbxAxisSystem::eXAxis:
return X;
case FbxAxisSystem::eYAxis:
return Y;
case FbxAxisSystem::eZAxis:
return Z;
default:
AZ_TraceContext("Unknown value", m_fbxAxisSystem.GetUpVector(sign));
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized axis up vector type");
return Unknown;
}
}
SceneAPI::DataTypes::MatrixType FbxAxisSystemWrapper::CalculateConversionTransform(UpVector targetUpAxis)
{
FbxAxisSystem targetSystem;
switch (targetUpAxis)
{
case Y:
// Maya YUp coordinate system (UpVector = +Y, FrontVector = +Z, CoordSystem = +X (RightHanded))
targetSystem = FbxAxisSystem::MayaYUp;
break;
case Z:
// CryTek ZUp coordinate system (UpVector = +Z, FrontVector = +Y, CoordSystem = -X (RightHanded))
targetSystem = FbxAxisSystem(FbxAxisSystem::eZAxis, FbxAxisSystem::eParityOdd, FbxAxisSystem::eRightHanded);
break;
case X:
// Default XUp coordinate system (UpVector = +X, FrontVector = +Z, CoordSystem = -Y (RightHanded))
targetSystem = FbxAxisSystem(FbxAxisSystem::eXAxis, FbxAxisSystem::eParityOdd, FbxAxisSystem::eRightHanded);
break;
default:
AZ_TraceContext("Unknown value", targetUpAxis);
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized axis conversion target axis type");
return SceneAPI::DataTypes::MatrixType::CreateIdentity();
}
FbxAMatrix targetMatrix;
targetSystem.GetMatrix(targetMatrix);
FbxAMatrix currentMatrix;
m_fbxAxisSystem.GetMatrix(currentMatrix);
FbxAMatrix adjustMatrix = targetMatrix * currentMatrix.Inverse();
return FbxTypeConverter::ToTransform(adjustMatrix);
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,44 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <SceneAPI/SceneCore/DataTypes/MatrixType.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxAxisSystemWrapper
{
public:
enum UpVector
{
X,
Y,
Z,
Unknown
};
FbxAxisSystemWrapper() = default;
FbxAxisSystemWrapper(const FbxAxisSystem& fbxAxisSystem);
virtual ~FbxAxisSystemWrapper() = default;
virtual UpVector GetUpVector(int& sign) const;
virtual SceneAPI::DataTypes::MatrixType CalculateConversionTransform(UpVector targetUpAxis);
protected:
FbxAxisSystem m_fbxAxisSystem;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,100 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxBlendShapeChannelWrapper::FbxBlendShapeChannelWrapper(FbxBlendShapeChannel* fbxBlendShapeChannel)
: m_fbxBlendShapeChannel(fbxBlendShapeChannel)
{
AZ_Assert(fbxBlendShapeChannel, "Invalid FbxSkin input to initialize FbxBlendShapeChannelWrapper");
}
FbxBlendShapeChannelWrapper::~FbxBlendShapeChannelWrapper()
{
m_fbxBlendShapeChannel = nullptr;
}
const char* FbxBlendShapeChannelWrapper::GetName() const
{
return m_fbxBlendShapeChannel->GetName();
}
//The engine currently only supports one target shape. If there are more than one,
//code will ultimately end up just using the max index returned by this function.
int FbxBlendShapeChannelWrapper::GetTargetShapeCount() const
{
return m_fbxBlendShapeChannel->GetTargetShapeCount();
}
//While not strictly true that the target shapes are meshes, for the purposes of the engine's
//current runtime they must be meshes.
AZStd::shared_ptr<const FbxMeshWrapper> FbxBlendShapeChannelWrapper::GetTargetShape(int index) const
{
//we need to create a duplicate FbxMesh from the base mesh and the target data
//FbxMeshWrapper needs an FbxMesh to point to so we are generating one
//by cloning the mesh data and then replacing with the morph data.
FbxShape* fbxShape = m_fbxBlendShapeChannel->GetTargetShape(index);
if (!fbxShape)
{
return nullptr;
}
FbxGeometry* fbxGeom = fbxShape->GetBaseGeometry();
if (fbxGeom && fbxGeom->GetAttributeType() == FbxNodeAttribute::EType::eMesh)
{
FbxMesh* fbxMesh = static_cast<FbxMesh*>(fbxGeom);
FbxMesh* fbxBlendMesh = FbxMesh::Create(m_fbxBlendShapeChannel->GetScene(),"");
fbxBlendMesh->Copy(*fbxMesh);
//TODO: test that mesh is managed by the sdk
const int count = fbxBlendMesh->GetControlPointsCount();
//set control points from blend shape
for (int i = 0; i < count; i++)
{
fbxBlendMesh->SetControlPointAt(fbxShape->GetControlPointAt(i), i);
}
//source data
FbxLayerElementArrayTemplate<FbxVector4>* normalsTemplate;
if (fbxShape->GetNormals(&normalsTemplate))
{
int normalCount = normalsTemplate->GetCount();
//destination data
FbxLayer* normalLayer = fbxBlendMesh->GetLayer(0, FbxLayerElement::eNormal);
if (normalLayer)
{
FbxLayerElementNormal* normals = normalLayer->GetNormals();
if (normals)
{
//set normal data from blend shape
for (int j = 0; j < normalCount; j++)
{
FbxVector4 normal = normalsTemplate->GetAt(j);
normals->GetDirectArray().SetAt(j, normal);
}
}
}
}
return AZStd::make_shared<FbxMeshWrapper>(fbxBlendMesh);
}
return nullptr;
}
}
}
@@ -0,0 +1,43 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxNodeWrapper;
class FbxMeshWrapper;
class FbxBlendShapeChannelWrapper
{
public:
FbxBlendShapeChannelWrapper(FbxBlendShapeChannel* fbxBlendShapeChannel);
virtual ~FbxBlendShapeChannelWrapper();
virtual const char* GetName() const;
virtual int GetTargetShapeCount() const;
//While not strictly true that the target shapes are meshes, for the purposes of the engine's
//current runtime they must be meshes.
virtual AZStd::shared_ptr<const FbxMeshWrapper> GetTargetShape(int index) const;
protected:
FbxBlendShapeChannelWrapper() = default;
FbxBlendShapeChannel* m_fbxBlendShapeChannel;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,74 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxBlendShapeChannelWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxBlendShapeWrapper::FbxBlendShapeWrapper(FbxBlendShape* fbxBlendShape)
: m_fbxBlendShape(fbxBlendShape)
{
AZ_Assert(fbxBlendShape, "Invalid FbxBlendShape input to initialize FbxBlendShapeWrapper");
}
FbxBlendShapeWrapper::~FbxBlendShapeWrapper()
{
m_fbxBlendShape = nullptr;
}
const char* FbxBlendShapeWrapper::GetName() const
{
return m_fbxBlendShape->GetName();
}
//Technically Fbx returns a FbxGeometry off this interface, but we only support meshes in the engine runtime.
AZStd::shared_ptr<const FbxMeshWrapper> FbxBlendShapeWrapper::GetGeometry() const
{
FbxGeometry* fbxGeom = m_fbxBlendShape->GetGeometry();
if (fbxGeom && fbxGeom->GetAttributeType() == FbxNodeAttribute::EType::eMesh )
{
return AZStd::make_shared<FbxMeshWrapper>(static_cast<FbxMesh*>(fbxGeom));
}
else
{
return nullptr;
}
}
int FbxBlendShapeWrapper::GetBlendShapeChannelCount() const
{
return m_fbxBlendShape->GetBlendShapeChannelCount();
}
AZStd::shared_ptr<const FbxBlendShapeChannelWrapper> FbxBlendShapeWrapper::GetBlendShapeChannel(int index) const
{
FbxBlendShapeChannel* fbxBlendShapeChannel = m_fbxBlendShape->GetBlendShapeChannel(index);
if (fbxBlendShapeChannel)
{
return AZStd::make_shared<FbxBlendShapeChannelWrapper>(fbxBlendShapeChannel);
}
else
{
return nullptr;
}
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,43 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxBlendShapeChannelWrapper;
class FbxNodeWrapper;
class FbxMeshWrapper;
class FbxBlendShapeWrapper
{
public:
FbxBlendShapeWrapper(FbxBlendShape* fbxBlendShape);
virtual ~FbxBlendShapeWrapper();
virtual const char* GetName() const;
//Technically Fbx returns a FbxGeometry off this interface, but we only support meshes in the engine runtime.
virtual AZStd::shared_ptr<const FbxMeshWrapper> GetGeometry() const;
virtual int GetBlendShapeChannelCount() const;
virtual AZStd::shared_ptr<const FbxBlendShapeChannelWrapper> GetBlendShapeChannel(int index) const;
protected:
FbxBlendShapeWrapper() = default;
FbxBlendShape* m_fbxBlendShape;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,31 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxLayerElementUtilities
{
public:
template <typename ValueType, typename ElementArrayType>
static void GetGeometryElement(ValueType& value, const ElementArrayType* elementArray,
int polygonIndex, int polygonVertexIndex, int controlPointIndex);
};
} // namespace FbxSDKWrapper
} // namespace AZ
#include "FbxLayerElementUtilities.inl"
@@ -0,0 +1,74 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <AzToolsFramework/Debug/TraceContext.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
namespace AZ
{
namespace FbxSDKWrapper
{
template <typename ValueType, typename ElementArrayType>
void FbxLayerElementUtilities::GetGeometryElement( ValueType& value, const ElementArrayType* elementArray,
int polygonIndex, int polygonVertexIndex, int controlPointIndex)
{
if (!elementArray)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Invalid ElementArrayType input");
return;
}
int fbxElementIndex;
switch (elementArray->GetMappingMode())
{
case FbxGeometryElement::eByControlPoint:
// One mapping coordinate for each surface control point/vertex.
fbxElementIndex = controlPointIndex;
break;
case FbxGeometryElement::eByPolygonVertex:
// One mapping coordinate for each vertex, for every polygon of which it is a part.
// This means that a vertex will have as many mapping coordinates as polygons of which it is a part.
fbxElementIndex = polygonVertexIndex;
break;
case FbxGeometryElement::eByPolygon:
// One mapping coordinate for the whole polygon.
fbxElementIndex = polygonIndex;
break;
default:
AZ_TraceContext("Unknown value", elementArray->GetMappingMode());
AZ_TracePrintf(AZ::SceneAPI::Utilities::ErrorWindow, "Invalid ElementArrayType mapping mode");
return;
}
if (elementArray->GetReferenceMode() == FbxGeometryElement::eIndexToDirect)
{
// Convert index from "index of value's index" to "index of value".
const FbxLayerElementArrayTemplate<int>& indices = elementArray->GetIndexArray();
AZ_Assert(fbxElementIndex < indices.GetCount(), "Invalid element index %d", fbxElementIndex);
if (fbxElementIndex >= indices.GetCount())
{
return;
}
fbxElementIndex = indices.GetAt(fbxElementIndex);
}
const FbxLayerElementArrayTemplate<ValueType>& elements = elementArray->GetDirectArray();
AZ_Assert(fbxElementIndex < elements.GetCount(), "Invalid element index %d", fbxElementIndex);
if (fbxElementIndex >= elements.GetCount())
{
return;
}
value = elements.GetAt(fbxElementIndex);
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,185 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Debug/Trace.h>
#include <AzCore/Math/MathUtils.h>
#include <AzToolsFramework/Debug/TraceContext.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h>
namespace
{
const char* s_physicalisedAttributeName = "physicalize";
const char* s_proxyNoDraw = "ProxyNoDraw";
}
namespace AZ
{
namespace FbxSDKWrapper
{
FbxMaterialWrapper::FbxMaterialWrapper(FbxSurfaceMaterial* fbxMaterial)
: SDKMaterial::MaterialWrapper(fbxMaterial)
{
AZ_Assert(fbxMaterial, "Invalid FbxSurfaceMaterial input to initialize FbxMaterialWrapper");
}
AZStd::string FbxMaterialWrapper::GetName() const
{
return m_fbxMaterial->GetInitialName();
}
AZ::Vector3 FbxMaterialWrapper::GetDiffuseColor() const
{
if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId))
{
FbxSurfaceLambert* lambertMat = static_cast<FbxSurfaceLambert*>(m_fbxMaterial);
const FbxDouble3 fbxValue = lambertMat->Diffuse.Get();
const float power = static_cast<float>(lambertMat->DiffuseFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
const FbxDouble3 fbxValue = phongMat->Diffuse.Get();
const float power = static_cast<float>(phongMat->DiffuseFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
return AZ::Vector3::CreateOne();
}
AZ::Vector3 FbxMaterialWrapper::GetSpecularColor() const
{
if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
const FbxDouble3 fbxValue = phongMat->Specular.Get();
const float power = static_cast<float>(phongMat->SpecularFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
return AZ::Vector3::CreateZero();
}
AZ::Vector3 FbxMaterialWrapper::GetEmissiveColor() const
{
if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId))
{
FbxSurfaceLambert* lambertMat = static_cast<FbxSurfaceLambert*>(m_fbxMaterial);
const FbxDouble3 fbxValue = lambertMat->Emissive.Get();
const float power = static_cast<float>(lambertMat->EmissiveFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
const FbxDouble3 fbxValue = phongMat->Emissive.Get();
const float power = static_cast<float>(phongMat->EmissiveFactor.Get());
return power * AZ::Vector3(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1]), static_cast<float>(fbxValue[2]));
}
return AZ::Vector3::CreateZero();
}
float FbxMaterialWrapper::GetShininess() const
{
if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
return static_cast<float>(phongMat->Shininess.Get());
}
return 10.f;
}
uint64_t FbxMaterialWrapper::GetUniqueId() const
{
return m_fbxMaterial->GetUniqueID();
}
float FbxMaterialWrapper::GetOpacity() const
{
// FBX materials are erroneously reporting a TransparencyFactor of 1.0 (fully transparent)
// even for values that are 0.0 in Maya. It is instead storing it in the components
// for TransparentColor, so extract from there instead.
if (m_fbxMaterial->GetClassId().Is(FbxSurfaceLambert::ClassId))
{
FbxSurfaceLambert* lambertMat = static_cast<FbxSurfaceLambert*>(m_fbxMaterial);
const FbxDouble3 fbxValue = lambertMat->TransparentColor.Get();
return 1.f - AZ::GetMin<float>(AZ::GetMin<float>(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1])), static_cast<float>(fbxValue[2]));
}
else if (m_fbxMaterial->GetClassId().Is(FbxSurfacePhong::ClassId))
{
FbxSurfacePhong* phongMat = static_cast<FbxSurfacePhong*>(m_fbxMaterial);
const FbxDouble3 fbxValue = phongMat->TransparentColor.Get();
return 1.f - AZ::GetMin<float>(AZ::GetMin<float>(static_cast<float>(fbxValue[0]), static_cast<float>(fbxValue[1])), static_cast<float>(fbxValue[2]));
}
return 1.f;
}
AZStd::string FbxMaterialWrapper::GetTextureFileName(const char* textureType) const
{
FbxFileTexture* fileTexture = nullptr;
FbxProperty property = m_fbxMaterial->FindProperty(textureType);
FbxDataType propertyType = property.GetPropertyDataType();
/// Engine currently doesn't support multiple textures. Right now we only use first texture of first layer.
int layeredTextureCount = property.GetSrcObjectCount<FbxLayeredTexture>();
if (layeredTextureCount > 0)
{
FbxLayeredTexture* layeredTexture = FbxCast<FbxLayeredTexture>(property.GetSrcObject<FbxLayeredTexture>(0));
int textureCount = layeredTexture->GetSrcObjectCount<FbxTexture>();
if (textureCount > 0)
{
fileTexture = FbxCast<FbxFileTexture>(layeredTexture->GetSrcObject<FbxTexture>(0));
}
}
else
{
int textureCount = property.GetSrcObjectCount<FbxTexture>();
if (textureCount > 0)
{
fileTexture = FbxCast<FbxFileTexture>(property.GetSrcObject<FbxTexture>(0));
}
}
return fileTexture ? fileTexture->GetFileName() : AZStd::string();
}
AZStd::string FbxMaterialWrapper::GetTextureFileName(const AZStd::string& textureType) const
{
return GetTextureFileName(textureType.c_str());
}
AZStd::string FbxMaterialWrapper::GetTextureFileName(MaterialMapType textureType) const
{
switch (textureType)
{
case MaterialMapType::Diffuse:
return GetTextureFileName(FbxSurfaceMaterial::sDiffuse);
case MaterialMapType::Specular:
return GetTextureFileName(FbxSurfaceMaterial::sSpecular);
case MaterialMapType::Bump:
return GetTextureFileName(FbxSurfaceMaterial::sBump);
case MaterialMapType::Normal:
return GetTextureFileName(FbxSurfaceMaterial::sNormalMap);
default:
AZ_TraceContext("Unknown value", aznumeric_cast<int>(textureType));
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized MaterialMapType retrieved");
return AZStd::string();
}
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,44 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/string/string.h>
#include <SceneAPI/SDKWrapper/MaterialWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxMaterialWrapper : public SDKMaterial::MaterialWrapper
{
public:
AZ_RTTI(FbxMaterialWrapper, "{227582F6-93BC-4E44-823E-FB1D631443A7}", SDKMaterial::MaterialWrapper);
FbxMaterialWrapper(FbxSurfaceMaterial* fbxMaterial);
~FbxMaterialWrapper() override = default;
AZStd::string GetName() const override;
virtual AZStd::string GetTextureFileName(const char* textureType) const;
virtual AZStd::string GetTextureFileName(const AZStd::string& textureType) const;
AZStd::string GetTextureFileName(MaterialMapType textureType) const override;
AZ::Vector3 GetDiffuseColor() const override;
AZ::Vector3 GetSpecularColor() const override;
AZ::Vector3 GetEmissiveColor() const override;
float GetOpacity() const override;
float GetShininess() const override;
uint64_t GetUniqueId() const override;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,156 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxBlendShapeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxMeshWrapper::FbxMeshWrapper(FbxMesh* fbxMesh)
: m_fbxMesh(fbxMesh)
{
AZ_Assert(fbxMesh, "Invalid FbxMesh input to initialize FbxMeshWrapper");
}
FbxMeshWrapper::~FbxMeshWrapper()
{
m_fbxMesh = nullptr;
}
const char* FbxMeshWrapper::GetName() const
{
return m_fbxMesh->GetName();
}
int FbxMeshWrapper::GetDeformerCount() const
{
return m_fbxMesh->GetDeformerCount();
}
int FbxMeshWrapper::GetDeformerCount(int type) const
{
return m_fbxMesh->GetDeformerCount(static_cast<FbxDeformer::EDeformerType>(type));
}
int FbxMeshWrapper::GetControlPointsCount() const
{
return m_fbxMesh->GetControlPointsCount();
}
AZStd::vector<Vector3> FbxMeshWrapper::GetControlPoints() const
{
FbxVector4* controlPoints = m_fbxMesh->GetControlPoints();
AZStd::vector<Vector3> azControlPoints;
azControlPoints.reserve(aznumeric_caster(GetControlPointsCount()));
for (int i = 0; i < GetControlPointsCount(); ++i)
{
azControlPoints.push_back(FbxTypeConverter::ToVector3(controlPoints[i]));
}
return azControlPoints;
}
AZStd::shared_ptr<const FbxSkinWrapper> FbxMeshWrapper::GetSkin(int index) const
{
FbxSkin* skin = static_cast<FbxSkin*>(m_fbxMesh->GetDeformer(index, FbxDeformer::eSkin));
return skin ? AZStd::make_shared<const FbxSkinWrapper>(skin) : nullptr;
}
AZStd::shared_ptr<const FbxBlendShapeWrapper> FbxMeshWrapper::GetBlendShape(int index) const
{
int deformerCount = m_fbxMesh->GetDeformerCount();
int blendshapeCount = m_fbxMesh->GetDeformerCount(FbxDeformer::eBlendShape);
FbxBlendShape* blendShape = static_cast<FbxBlendShape*>(m_fbxMesh->GetDeformer(index, FbxDeformer::eBlendShape));
return blendShape ? AZStd::make_shared<const FbxBlendShapeWrapper>(blendShape) : nullptr;
}
int FbxMeshWrapper::GetPolygonCount() const
{
return m_fbxMesh->GetPolygonCount();
}
int FbxMeshWrapper::GetPolygonSize(int polygonIndex) const
{
return m_fbxMesh->GetPolygonSize(polygonIndex);
}
int* FbxMeshWrapper::GetPolygonVertices() const
{
return m_fbxMesh->GetPolygonVertices();
}
int FbxMeshWrapper::GetPolygonVertexIndex(int polygonIndex) const
{
return m_fbxMesh->GetPolygonVertexIndex(polygonIndex);
}
bool FbxMeshWrapper::GetMaterialIndices(FbxLayerElementArrayTemplate<int>** lockableArray) const
{
return m_fbxMesh->GetMaterialIndices(lockableArray);
}
FbxUVWrapper FbxMeshWrapper::GetElementUV(int index)
{
return FbxUVWrapper(m_fbxMesh->GetElementUV(index));
}
FbxVertexTangentWrapper FbxMeshWrapper::GetElementTangent(int index)
{
return FbxVertexTangentWrapper(m_fbxMesh->GetElementTangent(index));
}
FbxVertexBitangentWrapper FbxMeshWrapper::GetElementBitangent(int index)
{
return FbxVertexBitangentWrapper(m_fbxMesh->GetElementBinormal(index));
}
int FbxMeshWrapper::GetElementUVCount() const
{
return m_fbxMesh->GetElementUVCount();
}
int FbxMeshWrapper::GetElementTangentCount() const
{
return m_fbxMesh->GetElementTangentCount();
}
int FbxMeshWrapper::GetElementBitangentCount() const
{
return m_fbxMesh->GetElementBinormalCount();
}
FbxVertexColorWrapper FbxMeshWrapper::GetElementVertexColor(int index)
{
return FbxVertexColorWrapper(m_fbxMesh->GetElementVertexColor(index));
}
int FbxMeshWrapper::GetElementVertexColorCount() const
{
return m_fbxMesh->GetElementVertexColorCount();
}
bool FbxMeshWrapper::GetPolygonVertexNormal(int polyIndex, int vertexIndex, Vector3& normal) const
{
FbxVector4 fbxNormal;
bool hasVertexNormal = m_fbxMesh->GetPolygonVertexNormal(polyIndex, vertexIndex, fbxNormal);
normal = FbxTypeConverter::ToVector3(fbxNormal);
return hasVertexNormal;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,89 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxUVWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxSkinWrapper;
class FbxBlendShapeWrapper;
class FbxVertexTangentWrapper;
class FbxVertexBitangentWrapper;
class FbxMeshWrapper
{
public:
FbxMeshWrapper(FbxMesh* fbxMesh);
virtual ~FbxMeshWrapper();
virtual const char* GetName() const;
virtual int GetDeformerCount() const;
virtual int GetDeformerCount(int type) const;
virtual AZStd::shared_ptr<const FbxSkinWrapper> GetSkin(int index) const;
virtual AZStd::shared_ptr<const FbxBlendShapeWrapper> GetBlendShape(int index) const;
virtual bool GetMaterialIndices(FbxLayerElementArrayTemplate<int>** lockableArray) const;
// Vertex positions access
// Get the control points number
virtual int GetControlPointsCount() const;
// Get the array of control points
virtual AZStd::vector<Vector3> GetControlPoints() const;
// Polygon data accesses
// Get the polygon count of this mesh
virtual int GetPolygonCount() const;
// Get the number of polygon vertices in a polygon
virtual int GetPolygonSize(int polygonIndex) const;
// Get the array of polygon vertices (i.e: indices to the control points)
virtual int* GetPolygonVertices() const;
// Gets the start index into the array returned by GetPolygonVertices() for the given polygon
virtual int GetPolygonVertexIndex(int polygonIndex) const;
// Vertex colors and UV textures accesses
// Returns this geometry's UV element
virtual FbxUVWrapper GetElementUV(int index = 0);
virtual int GetElementUVCount() const;
virtual int GetElementTangentCount() const;
virtual int GetElementBitangentCount() const;
virtual FbxVertexTangentWrapper GetElementTangent(int index = 0);
virtual FbxVertexBitangentWrapper GetElementBitangent(int index = 0);
// Returns this geometry's vertex color element
virtual FbxVertexColorWrapper GetElementVertexColor(int index = 0);
virtual int GetElementVertexColorCount() const;
// Get the normal associated with the specified polygon vertex
virtual bool GetPolygonVertexNormal(int polyIndex, int vertexIndex, Vector3& normal) const;
protected:
FbxMeshWrapper() = default;
FbxMesh* m_fbxMesh;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,220 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimLayerWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimCurveWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxNodeWrapper::FbxNodeWrapper(FbxNode* fbxNode)
: NodeWrapper(fbxNode)
{
AZ_Assert(fbxNode, "Invalid FbxNode to initialize FbxNodeWrapper");
}
FbxNodeWrapper::~FbxNodeWrapper()
{
}
int FbxNodeWrapper::GetMaterialCount() const
{
return m_fbxNode->GetMaterialCount();
}
const char* FbxNodeWrapper::GetMaterialName(int index) const
{
if (index < GetMaterialCount())
{
return m_fbxNode->GetMaterial(index)->GetName();
}
AZ_Assert(index < GetMaterialCount(), "Invalid material index %d", index);
return nullptr;
}
const std::shared_ptr<FbxMeshWrapper> FbxNodeWrapper::GetMesh() const
{
FbxMesh* mesh = m_fbxNode->GetMesh();
return mesh ? std::shared_ptr<FbxMeshWrapper>(new FbxMeshWrapper(mesh)) : nullptr;
}
const std::shared_ptr<FbxPropertyWrapper> FbxNodeWrapper::FindProperty(const char* name) const
{
FbxProperty propertyName = m_fbxNode->FindProperty(name);
return std::shared_ptr<FbxPropertyWrapper>(new FbxPropertyWrapper(&propertyName));
}
bool FbxNodeWrapper::IsBone() const
{
return (m_fbxNode->GetSkeleton() != nullptr);
}
bool FbxNodeWrapper::IsMesh() const
{
return (m_fbxNode->GetMesh() != nullptr);
}
const char* FbxNodeWrapper::GetName() const
{
return m_fbxNode->GetName();
}
AZ::u64 FbxNodeWrapper::GetUniqueId() const
{
return m_fbxNode->GetUniqueID();
}
SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateGlobalTransform()
{
return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateGlobalTransform());
}
Vector3 FbxNodeWrapper::EvaluateLocalTranslation()
{
return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTranslation());
}
Vector3 FbxNodeWrapper::EvaluateLocalTranslation(FbxTimeWrapper& time)
{
return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTranslation(time.m_fbxTime));
}
SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateLocalTransform()
{
return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateLocalTransform());
}
SceneAPI::DataTypes::MatrixType FbxNodeWrapper::EvaluateLocalTransform(FbxTimeWrapper& time)
{
return FbxTypeConverter::ToTransform(m_fbxNode->EvaluateLocalTransform(time.m_fbxTime));
}
Vector3 FbxNodeWrapper::EvaluateLocalRotation()
{
return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTransform().GetR());
}
Vector3 FbxNodeWrapper::EvaluateLocalRotation(FbxTimeWrapper& time)
{
return FbxTypeConverter::ToVector3(m_fbxNode->EvaluateLocalTransform(time.m_fbxTime).GetR());
}
Vector3 FbxNodeWrapper::GetGeometricTranslation() const
{
return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricTranslation(FbxNode::eSourcePivot));
}
Vector3 FbxNodeWrapper::GetGeometricScaling() const
{
return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricScaling(FbxNode::eSourcePivot));
}
Vector3 FbxNodeWrapper::GetGeometricRotation() const
{
return FbxTypeConverter::ToVector3(m_fbxNode->GetGeometricRotation(FbxNode::eSourcePivot));
}
SceneAPI::DataTypes::MatrixType FbxNodeWrapper::GetGeometricTransform() const
{
FbxAMatrix geoTransform(m_fbxNode->GetGeometricTranslation(FbxNode::eSourcePivot),
m_fbxNode->GetGeometricRotation(FbxNode::eSourcePivot), m_fbxNode->GetGeometricScaling(FbxNode::eSourcePivot));
return FbxTypeConverter::ToTransform(geoTransform);
}
const AZStd::shared_ptr<FbxAnimCurveWrapper> FbxNodeWrapper::GetLocalTranslationCurve(const AZStd::shared_ptr<FbxAnimLayerWrapper>& layer,
CurveNodeComponent component) const
{
if (!layer)
{
return nullptr;
}
const char* componentString = nullptr;
switch (component)
{
case Component_X:
componentString = FBXSDK_CURVENODE_COMPONENT_X;
break;
case Component_Y:
componentString = FBXSDK_CURVENODE_COMPONENT_Y;
break;
case Component_Z:
componentString = FBXSDK_CURVENODE_COMPONENT_Z;
break;
default:
break;
}
// If there is available animation curve data of specified component/channel for translation, create and return a wrapped version of it.
return m_fbxNode->LclTranslation.GetCurve(layer->m_fbxAnimLayer, componentString) ?
AZStd::make_shared<FbxAnimCurveWrapper>(m_fbxNode->LclTranslation.GetCurve(layer->m_fbxAnimLayer, componentString)) : nullptr;
}
const AZStd::shared_ptr<FbxAnimCurveWrapper> FbxNodeWrapper::GetLocalRotationCurve(const AZStd::shared_ptr<FbxAnimLayerWrapper>& layer,
CurveNodeComponent component) const
{
if (!layer)
{
return nullptr;
}
const char* componentString = nullptr;
switch (component)
{
case Component_X:
componentString = FBXSDK_CURVENODE_COMPONENT_X;
break;
case Component_Y:
componentString = FBXSDK_CURVENODE_COMPONENT_Y;
break;
case Component_Z:
componentString = FBXSDK_CURVENODE_COMPONENT_Z;
break;
default:
break;
}
// If there is available animation curve data of specified component/channel for rotation, create and return a wrapped version of it.
return m_fbxNode->LclRotation.GetCurve(layer->m_fbxAnimLayer, componentString) ?
AZStd::make_shared<FbxAnimCurveWrapper>(m_fbxNode->LclRotation.GetCurve(layer->m_fbxAnimLayer, componentString)) : nullptr;
}
bool FbxNodeWrapper::IsAnimated() const
{
return FbxAnimUtilities::IsAnimated(m_fbxNode);
}
int FbxNodeWrapper::GetChildCount() const
{
return m_fbxNode->GetChildCount();
}
const std::shared_ptr<SDKNode::NodeWrapper> FbxNodeWrapper::GetChild(int childIndex) const
{
FbxNode* child = m_fbxNode->GetChild(childIndex);
AZ_Assert(child, "Cannot get child FbxNode at index %d", childIndex);
return child ? std::shared_ptr<SDKNode::NodeWrapper>(new FbxNodeWrapper(child)) : nullptr;
}
const std::shared_ptr<FbxMaterialWrapper> FbxNodeWrapper::GetMaterial(int index) const
{
if (index < GetMaterialCount())
{
return std::shared_ptr<FbxMaterialWrapper>(new FbxMaterialWrapper(m_fbxNode->GetMaterial(index)));
}
AZ_Assert(index < GetMaterialCount(), "Invalid material index %d", index);
return nullptr;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,69 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h>
#include <SceneAPI/SceneCore/DataTypes/MatrixType.h>
#include <SceneAPI/SDKWrapper/NodeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxMaterialWrapper;
class FbxAnimLayerWrapper;
class FbxAnimCurveWrapper;
class FbxNodeWrapper : public SDKNode::NodeWrapper
{
public:
AZ_RTTI(FbxNodeWrapper, "{5F1C09D1-791C-41CA-94DB-D7DD2810C859}", SDKNode::NodeWrapper);
FbxNodeWrapper(FbxNode* fbxNode);
~FbxNodeWrapper() override;
int GetMaterialCount() const override;
virtual const char* GetMaterialName(int index) const;
virtual const std::shared_ptr<FbxMaterialWrapper> GetMaterial(int index) const;
virtual const std::shared_ptr<FbxMeshWrapper> GetMesh() const;
virtual const std::shared_ptr<FbxPropertyWrapper> FindProperty(const char* name) const;
virtual bool IsBone() const;
virtual bool IsMesh() const;
const char* GetName() const override;
AZ::u64 GetUniqueId() const override;
virtual SceneAPI::DataTypes::MatrixType EvaluateGlobalTransform();
virtual Vector3 EvaluateLocalTranslation();
virtual Vector3 EvaluateLocalTranslation(FbxTimeWrapper& time);
virtual SceneAPI::DataTypes::MatrixType EvaluateLocalTransform();
virtual SceneAPI::DataTypes::MatrixType EvaluateLocalTransform(FbxTimeWrapper& time);
virtual Vector3 EvaluateLocalRotation();
virtual Vector3 EvaluateLocalRotation(FbxTimeWrapper& time);
virtual Vector3 GetGeometricTranslation() const;
virtual Vector3 GetGeometricScaling() const;
virtual Vector3 GetGeometricRotation() const;
virtual SceneAPI::DataTypes::MatrixType GetGeometricTransform() const;
virtual const AZStd::shared_ptr<FbxAnimCurveWrapper> GetLocalTranslationCurve(const AZStd::shared_ptr<FbxAnimLayerWrapper>& layer, CurveNodeComponent component) const;
virtual const AZStd::shared_ptr<FbxAnimCurveWrapper> GetLocalRotationCurve(const AZStd::shared_ptr<FbxAnimLayerWrapper>& layer, CurveNodeComponent component) const;
int GetChildCount() const override;
const std::shared_ptr<NodeWrapper> GetChild(int childIndex) const override;
virtual bool IsAnimated() const;
protected:
FbxNodeWrapper() = default;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,57 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxPropertyWrapper::FbxPropertyWrapper(FbxProperty* fbxProperty)
: m_fbxProperty(fbxProperty)
{
AZ_Assert(fbxProperty, "Invalid FbxProperty to initialize FbxPropertyWrapper");
}
FbxPropertyWrapper::~FbxPropertyWrapper()
{
m_fbxProperty = nullptr;
}
bool FbxPropertyWrapper::IsValid() const
{
return m_fbxProperty->IsValid();
}
Vector3 FbxPropertyWrapper::GetFbxVector3() const
{
return FbxTypeConverter::ToVector3(m_fbxProperty->Get<FbxVector4>());
}
int FbxPropertyWrapper::GetFbxInt() const
{
return aznumeric_caster(m_fbxProperty->Get<FbxInt>());
}
AZStd::string FbxPropertyWrapper::GetFbxString() const
{
return AZStd::string(m_fbxProperty->Get<FbxString>().Buffer());
}
const char* FbxPropertyWrapper::GetEnumValue(int index) const
{
return m_fbxProperty->GetEnumValue(index);
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,39 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/std/string/string.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxPropertyWrapper
{
public:
FbxPropertyWrapper(FbxProperty* fbxProperty);
virtual ~FbxPropertyWrapper();
virtual bool IsValid() const;
virtual Vector3 GetFbxVector3() const;
virtual int GetFbxInt() const;
virtual AZStd::string GetFbxString() const;
virtual const char* GetEnumValue(int index) const;
protected:
FbxProperty* m_fbxProperty;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,200 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzToolsFramework/Debug/TraceContext.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxSceneWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxSceneWrapper::FbxSceneWrapper()
: SceneWrapperBase()
, m_fbxManager(nullptr)
, m_fbxImporter(nullptr)
, m_fbxIOSettings(nullptr)
{
}
FbxSceneWrapper::FbxSceneWrapper(FbxScene* fbxScene)
: SceneWrapperBase(fbxScene)
, m_fbxManager(nullptr)
, m_fbxImporter(nullptr)
, m_fbxIOSettings(nullptr)
{
AZ_Assert(fbxScene, "FbxSceneWrapper should have a valid scene to initialize.");
}
FbxSceneWrapper::~FbxSceneWrapper()
{
if (m_fbxScene)
{
m_fbxScene->Destroy();
m_fbxScene = nullptr;
}
if (m_fbxImporter)
{
m_fbxImporter->Destroy();
m_fbxImporter = nullptr;
}
if (m_fbxIOSettings)
{
m_fbxIOSettings->Destroy();
m_fbxIOSettings = nullptr;
}
if (m_fbxManager)
{
m_fbxManager->Destroy();
m_fbxManager = nullptr;
}
}
AZStd::shared_ptr<FbxAxisSystemWrapper> FbxSceneWrapper::GetAxisSystem() const
{
return AZStd::make_shared<FbxAxisSystemWrapper>(m_fbxScene->GetGlobalSettings().GetAxisSystem());
}
AZStd::shared_ptr<FbxSystemUnitWrapper> FbxSceneWrapper::GetSystemUnit() const
{
return AZStd::make_shared<FbxSystemUnitWrapper>(m_fbxScene->GetGlobalSettings().GetSystemUnit());
}
FbxTimeWrapper FbxSceneWrapper::GetTimeLineDefaultDuration() const
{
FbxTimeSpan timeSpan;
m_fbxScene->GetGlobalSettings().GetTimelineDefaultTimeSpan(timeSpan);
return FbxTimeWrapper(timeSpan.GetDuration());
}
const char* FbxSceneWrapper::GetLastSavedApplicationName() const
{
if (m_fbxScene->GetDocumentInfo())
{
return m_fbxScene->GetDocumentInfo()->LastSaved_ApplicationName.Get().Buffer();
}
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Cannot get valid document info from FbxScene");
return nullptr;
}
const char* FbxSceneWrapper::GetLastSavedApplicationVersion() const
{
if (m_fbxScene->GetDocumentInfo())
{
return m_fbxScene->GetDocumentInfo()->LastSaved_ApplicationVersion.Get().Buffer();
}
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Cannot get valid document info from FbxScene");
return nullptr;
}
const std::shared_ptr<SDKNode::NodeWrapper> FbxSceneWrapper::GetRootNode() const
{
return std::shared_ptr<FbxNodeWrapper>(new FbxNodeWrapper(m_fbxScene->GetRootNode()));
}
std::shared_ptr<SDKNode::NodeWrapper> FbxSceneWrapper::GetRootNode()
{
return std::shared_ptr<FbxNodeWrapper>(new FbxNodeWrapper(m_fbxScene->GetRootNode()));
}
int FbxSceneWrapper::GetAnimationStackCount() const
{
return m_fbxScene->GetSrcObjectCount<FbxAnimStack>();
}
const std::shared_ptr<FbxAnimStackWrapper> FbxSceneWrapper::GetAnimationStackAt(int index) const
{
return std::shared_ptr<FbxAnimStackWrapper>(new FbxAnimStackWrapper(FbxCast<FbxAnimStack>(m_fbxScene->GetSrcObject<FbxAnimStack>(index))));
}
bool FbxSceneWrapper::LoadSceneFromFile(const char* fileName)
{
AZ_TracePrintf(SceneAPI::Utilities::LogWindow, "FbxSceneWrapper::LoadSceneFromFile %s", fileName);
AZ_TraceContext("Filename", fileName);
if (!m_fbxManager)
{
m_fbxManager = FbxManager::Create();
if (!m_fbxManager)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxManager");
return false;
}
}
if (!m_fbxIOSettings)
{
m_fbxIOSettings = FbxIOSettings::Create(m_fbxManager, IOSROOT);
if (!m_fbxIOSettings)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxIOSettings");
return false;
}
}
m_fbxManager->SetIOSettings(m_fbxIOSettings);
if (!m_fbxImporter)
{
m_fbxImporter = FbxImporter::Create(m_fbxManager, "");
if (!m_fbxImporter)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxImporter with FbxManager");
return false;
}
}
if (!m_fbxImporter->Initialize(fileName, -1, m_fbxManager->GetIOSettings()))
{
FbxString error = m_fbxImporter->GetStatus().GetErrorString();
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to initialize FbxImporter with fbx file. Error returned: %s", error.Buffer());
return false;
}
// Create a new FBX scene so it can be populated by the imported file.
m_fbxScene = FbxScene::Create(m_fbxManager, s_defaultSceneName);
if (!m_fbxScene)
{
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to create FbxScene");
return false;
}
if (!m_fbxImporter->Import(m_fbxScene))
{
FbxString error = m_fbxImporter->GetStatus().GetErrorString();
AZ_TracePrintf(SceneAPI::Utilities::ErrorWindow, "Failed to import FbxScene. Error returned: %s", error.Buffer());
return false;
}
return true;
}
bool FbxSceneWrapper::LoadSceneFromFile(const AZStd::string& fileName)
{
return LoadSceneFromFile(fileName.c_str());
}
void FbxSceneWrapper::Clear()
{
if (m_fbxScene)
{
m_fbxScene->Clear();
}
}
}//namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,62 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// FBX SDK Wrapper
// provides isolation between AUTODESK FBX SDK and FBX Serializer
// provides necessary APIs for FBX Serializer
//
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.h>
#include <SceneAPI/SDKWrapper/SceneWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxSceneWrapper : public SDKScene::SceneWrapperBase
{
public:
AZ_RTTI(FbxSceneWrapper, "{63637E50-BB26-4BE9-AECD-D1168AE2355B}", SDKScene::SceneWrapperBase);
FbxSceneWrapper();
FbxSceneWrapper(fbxsdk::FbxScene* fbxScene);
~FbxSceneWrapper();
bool LoadSceneFromFile(const char* fileName) override;
bool LoadSceneFromFile(const AZStd::string& fileName) override;
virtual AZStd::shared_ptr<FbxSystemUnitWrapper> GetSystemUnit() const;
virtual AZStd::shared_ptr<FbxAxisSystemWrapper> GetAxisSystem() const;
virtual FbxTimeWrapper GetTimeLineDefaultDuration() const;
virtual const char* GetLastSavedApplicationName() const;
virtual const char* GetLastSavedApplicationVersion() const;
const std::shared_ptr<SDKNode::NodeWrapper> GetRootNode() const override;
std::shared_ptr<SDKNode::NodeWrapper> GetRootNode() override;
virtual int GetAnimationStackCount() const;
virtual const std::shared_ptr<FbxAnimStackWrapper> GetAnimationStackAt(int index) const;
void Clear() override;
protected:
FbxManager* m_fbxManager;
FbxImporter* m_fbxImporter;
FbxIOSettings* m_fbxIOSettings;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,86 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxSkinWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxSkinWrapper::FbxSkinWrapper(FbxSkin* fbxSkin)
: m_fbxSkin(fbxSkin)
{
AZ_Assert(fbxSkin, "Invalid FbxSkin input to initialize FbxSkinWrapper");
}
FbxSkinWrapper::~FbxSkinWrapper()
{
m_fbxSkin = nullptr;
}
const char* FbxSkinWrapper::GetName() const
{
return m_fbxSkin->GetName();
}
int FbxSkinWrapper::GetClusterCount() const
{
return m_fbxSkin->GetClusterCount();
}
int FbxSkinWrapper::GetClusterControlPointIndicesCount(int index) const
{
if (index < m_fbxSkin->GetClusterCount())
{
return m_fbxSkin->GetCluster(index)->GetControlPointIndicesCount();
}
AZ_Assert(index < m_fbxSkin->GetClusterCount(), "Invalid skin cluster index %d", index);
return 0;
}
int FbxSkinWrapper::GetClusterControlPointIndex(int clusterIndex, int pointIndex) const
{
bool validIndex = clusterIndex < m_fbxSkin->GetClusterCount() && pointIndex < m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndicesCount();
if (validIndex)
{
return m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndices()[pointIndex];
}
AZ_Assert(validIndex, "Invalid skin cluster control point index at cluster index %d control point index %d", clusterIndex, pointIndex);
return -1;
}
double FbxSkinWrapper::GetClusterControlPointWeight(int clusterIndex, int pointIndex) const
{
bool validIndex = clusterIndex < m_fbxSkin->GetClusterCount() && pointIndex < m_fbxSkin->GetCluster(clusterIndex)->GetControlPointIndicesCount();
if (validIndex)
{
return m_fbxSkin->GetCluster(clusterIndex)->GetControlPointWeights()[pointIndex];
}
AZ_Assert(validIndex, "Invalid skin cluster control point weight at cluster index %d control point index %d", clusterIndex, pointIndex);
return 0.0f;
}
AZStd::shared_ptr<const FbxNodeWrapper> FbxSkinWrapper::GetClusterLink(int index) const
{
if (index < m_fbxSkin->GetClusterCount())
{
return AZStd::make_shared<const FbxNodeWrapper>(m_fbxSkin->GetCluster(index)->GetLink());
}
AZ_Assert(index < m_fbxSkin->GetClusterCount(), "Invalid skin cluster index %d", index);
return nullptr;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,42 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxNodeWrapper;
class FbxSkinWrapper
{
public:
FbxSkinWrapper(FbxSkin* fbxSkin);
virtual ~FbxSkinWrapper();
virtual const char* GetName() const;
virtual int GetClusterCount() const;
virtual int GetClusterControlPointIndicesCount(int index) const;
virtual int GetClusterControlPointIndex(int clusterIndex, int pointIndex) const;
virtual double GetClusterControlPointWeight(int clusterIndex, int pointIndex) const;
virtual AZStd::shared_ptr<const FbxNodeWrapper> GetClusterLink(int index) const;
protected:
FbxSkinWrapper() = default;
FbxSkin* m_fbxSkin;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,108 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxSystemUnitWrapper::FbxSystemUnitWrapper(const FbxSystemUnit& fbxSystemUnit)
: m_fbxSystemUnit(fbxSystemUnit)
{
}
FbxSystemUnitWrapper::Unit FbxSystemUnitWrapper::GetUnit() const
{
if (m_fbxSystemUnit == FbxSystemUnit::mm)
{
return mm;
}
if (m_fbxSystemUnit == FbxSystemUnit::dm)
{
return dm;
}
if (m_fbxSystemUnit == FbxSystemUnit::cm)
{
return cm;
}
if (m_fbxSystemUnit == FbxSystemUnit::m)
{
return m;
}
if (m_fbxSystemUnit == FbxSystemUnit::km)
{
return km;
}
if (m_fbxSystemUnit == FbxSystemUnit::Inch)
{
return inch;
}
if (m_fbxSystemUnit == FbxSystemUnit::Foot)
{
return foot;
}
if (m_fbxSystemUnit == FbxSystemUnit::Mile)
{
return mile;
}
if (m_fbxSystemUnit == FbxSystemUnit::Yard)
{
return yard;
}
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized current unit type");
return unknown;
}
float FbxSystemUnitWrapper::GetConversionFactorTo(Unit to)
{
FbxSystemUnit targetUnit;
switch (to)
{
case mm:
targetUnit = FbxSystemUnit::mm;
break;
case dm:
targetUnit = FbxSystemUnit::dm;
break;
case cm:
targetUnit = FbxSystemUnit::cm;
break;
case m:
targetUnit = FbxSystemUnit::m;
break;
case km:
targetUnit = FbxSystemUnit::km;
break;
case inch:
targetUnit = FbxSystemUnit::Inch;
break;
case foot:
targetUnit = FbxSystemUnit::Foot;
break;
case mile:
targetUnit = FbxSystemUnit::Mile;
break;
case yard:
targetUnit = FbxSystemUnit::Yard;
break;
default:
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unrecognized unit conversion target type");
targetUnit = FbxSystemUnit::m;
}
return aznumeric_caster(m_fbxSystemUnit.GetConversionFactorTo(targetUnit));
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,49 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxSystemUnitWrapper
{
public:
enum Unit
{
mm,
dm,
cm,
m,
km,
inch,
foot,
mile,
yard,
unknown
};
FbxSystemUnitWrapper() = default;
FbxSystemUnitWrapper(const FbxSystemUnit& fbxSystemUnit);
virtual ~FbxSystemUnitWrapper() = default;
virtual Unit GetUnit() const;
virtual float GetConversionFactorTo(Unit to);
protected:
FbxSystemUnit m_fbxSystemUnit;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,45 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeSpanWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxTimeSpanWrapper::FbxTimeSpanWrapper(const FbxTimeSpan& fbxTimeSpan)
: m_fbxTimeSpan(fbxTimeSpan)
{
}
FbxTimeWrapper FbxTimeSpanWrapper::GetStartTime() const
{
return FbxTimeWrapper(m_fbxTimeSpan.GetStart());
}
FbxTimeWrapper FbxTimeSpanWrapper::GetStopTime() const
{
return FbxTimeWrapper(m_fbxTimeSpan.GetStop());
}
double FbxTimeSpanWrapper::GetFrameRate() const
{
return FbxTimeWrapper(m_fbxTimeSpan.GetStart()).GetFrameRate();
}
int64_t FbxTimeSpanWrapper::GetNumFrames() const
{
return GetStopTime().GetFrameCount() - GetStartTime().GetFrameCount() + 1;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,37 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxTimeSpanWrapper
{
public:
FbxTimeSpanWrapper(const FbxTimeSpan& fbxTimeSpan);
virtual ~FbxTimeSpanWrapper() = default;
virtual FbxTimeWrapper GetStartTime() const;
virtual FbxTimeWrapper GetStopTime() const;
virtual double GetFrameRate() const;
int64_t GetNumFrames() const;
protected:
FbxTimeSpan m_fbxTimeSpan;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,76 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Debug/Trace.h>
#include <SceneAPI/SceneCore/Utilities/Reporting.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxTimeWrapper::FbxTimeWrapper() : m_fbxTime(FBXSDK_TIME_INFINITE)
{
}
FbxTimeWrapper::FbxTimeWrapper(const FbxTime& fbxTime) : m_fbxTime(fbxTime)
{
}
FbxTimeWrapper::~FbxTimeWrapper()
{
}
void FbxTimeWrapper::SetFrame(int64_t frames, TimeMode timeMode)
{
m_fbxTime.SetFrame(static_cast<FbxLongLong>(frames), GetFbxTimeMode(timeMode));
}
void FbxTimeWrapper::SetTime(double time)
{
m_fbxTime.SetSecondDouble(time);
}
double FbxTimeWrapper::GetFrameRate() const
{
return m_fbxTime.GetFrameRate(m_fbxTime.GetGlobalTimeMode());
}
int64_t FbxTimeWrapper::GetFrameCount() const
{
return static_cast<int64_t>(m_fbxTime.GetFrameCount());
}
double FbxTimeWrapper::GetTime() const
{
return m_fbxTime.GetSecondDouble();
}
FbxTime::EMode FbxTimeWrapper::GetFbxTimeMode(TimeMode timeMode) const
{
switch (timeMode)
{
case frames60:
return FbxTime::eFrames60;
case frames30:
return FbxTime::eFrames30;
case frames24:
return FbxTime::eFrames24;
case defaultMode:
return FbxTime::eDefaultMode;
default:
AZ_TracePrintf(SceneAPI::Utilities::WarningWindow, "Unsupported frame rate");
return FbxTime::eDefaultMode;
}
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,52 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <stdint.h>
#include <fbxsdk.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxTimeWrapper
{
friend class FbxNodeWrapper;
friend class FbxAnimCurveWrapper;
public:
enum TimeMode
{
defaultMode,
frames60,
frames30,
frames24,
eModesCount
};
FbxTimeWrapper();
FbxTimeWrapper(const FbxTime& fbxTime);
virtual ~FbxTimeWrapper();
virtual void SetFrame(int64_t frames, TimeMode timeMode = defaultMode);
virtual void SetTime(double time);
virtual double GetFrameRate() const;
virtual int64_t GetFrameCount() const;
virtual double GetTime() const;
protected:
FbxTime::EMode GetFbxTimeMode(TimeMode timeMode) const;
FbxTime m_fbxTime;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,64 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
Vector2 FbxTypeConverter::ToVector2(const FbxVector2& vector)
{
return Vector2(static_cast<float>(vector[0]),
static_cast<float>(vector[1]));
}
Vector3 FbxTypeConverter::ToVector3(const FbxVector4& vector)
{
// Note: FbxVector4[x] is of type FbxDouble and aznumeric_caster does not accept it as cast from type.
return Vector3(static_cast<float>(vector[0]),
static_cast<float>(vector[1]),
static_cast<float>(vector[2]));
}
SceneAPI::DataTypes::MatrixType FbxTypeConverter::ToTransform(const FbxAMatrix& matrix)
{
SceneAPI::DataTypes::MatrixType transform;
for (int row = 0; row < 3; ++row)
{
FbxVector4 line = matrix.GetColumn(row);
for (int column = 0; column < 4; ++column)
{
// Note: FbxVector4[x] is of type FbxDouble and aznumeric_caster does not accept it as cast from type.
transform.SetElement(row, column, static_cast<float>(line[column]));
}
}
return transform;
}
SceneAPI::DataTypes::MatrixType FbxTypeConverter::ToTransform(const FbxMatrix& matrix)
{
// This implementation ignores the last row, effectively assuming it to be (0,0,0,1)
SceneAPI::DataTypes::MatrixType transform;
for (int row = 0; row < 3; ++row)
{
FbxVector4 line = matrix.GetColumn(row);
for (int column = 0; column < 4; ++column)
{
// Note: FbxVector4[x] is of type FbxDouble and aznumeric_caster does not accept it as cast from type.
transform.SetElement(row, column, static_cast<float>(line[column]));
}
}
return transform;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,32 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/Math/Vector2.h>
#include <AzCore/Math/Vector3.h>
#include <SceneAPI/SceneCore/DataTypes/MatrixType.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxTypeConverter
{
public:
static Vector2 ToVector2(const FbxVector2& vector);
static Vector3 ToVector3(const FbxVector4& vector);
static SceneAPI::DataTypes::MatrixType ToTransform(const FbxAMatrix& matrix);
static SceneAPI::DataTypes::MatrixType ToTransform(const FbxMatrix& matrix);
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,53 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxUVWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxUVWrapper::FbxUVWrapper(FbxGeometryElementUV* fbxUV)
: m_fbxUV(fbxUV)
{
AZ_Assert(fbxUV, "Invalid FbxGeometryElementUV to initialize FbxUVWrapper")
}
FbxUVWrapper::~FbxUVWrapper()
{
m_fbxUV = nullptr;
}
const char* FbxUVWrapper::GetName() const
{
if (m_fbxUV)
{
return m_fbxUV->GetName();
}
return nullptr;
}
Vector2 FbxUVWrapper::GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const
{
FbxVector2 uv;
FbxLayerElementUtilities::GetGeometryElement(uv, m_fbxUV, polygonIndex, polygonVertexIndex, controlPointIndex);
return FbxTypeConverter::ToVector2(uv);
}
bool FbxUVWrapper::IsValid() const
{
return m_fbxUV != nullptr;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,37 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/Math/Vector2.h>
#include <SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxUVWrapper
{
public:
FbxUVWrapper(FbxGeometryElementUV* fbxUV);
~FbxUVWrapper();
Vector2 GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const;
const char* GetName() const;
bool IsValid() const;
protected:
FbxGeometryElementUV* m_fbxUV;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,58 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxVertexBitangentWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxVertexBitangentWrapper::FbxVertexBitangentWrapper(FbxGeometryElementBinormal* fbxBitangent)
: m_fbxBitangent(fbxBitangent)
{
AZ_Assert(fbxBitangent, "Invalid FbxGeometryElementBinormal to initialize FbxVertexBitangentWrapper")
}
FbxVertexBitangentWrapper::~FbxVertexBitangentWrapper()
{
m_fbxBitangent = nullptr;
}
const char* FbxVertexBitangentWrapper::GetName() const
{
if (m_fbxBitangent)
{
return m_fbxBitangent->GetName();
}
return "";
}
Vector3 FbxVertexBitangentWrapper::GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const
{
FbxVector4 bitangent;
FbxLayerElementUtilities::GetGeometryElement(bitangent, m_fbxBitangent, polygonIndex, polygonVertexIndex, controlPointIndex);
return FbxTypeConverter::ToVector3(bitangent);
}
bool FbxVertexBitangentWrapper::IsValid() const
{
return m_fbxBitangent != nullptr;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,39 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/Math/Vector3.h>
#include <SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxVertexBitangentWrapper
{
public:
FbxVertexBitangentWrapper(FbxGeometryElementBinormal* fbxBitangent);
~FbxVertexBitangentWrapper();
Vector3 GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const;
const char* GetName() const;
bool IsValid() const;
protected:
FbxGeometryElementBinormal* m_fbxBitangent;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,79 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Casting/numeric_cast.h>
#include <SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxColorWrapper::FbxColorWrapper(FbxColor& fbxColor)
: m_fbxColor(fbxColor)
{
}
float FbxColorWrapper::GetR() const
{
return aznumeric_caster(m_fbxColor.mRed);
}
float FbxColorWrapper::GetG() const
{
return aznumeric_caster(m_fbxColor.mGreen);
}
float FbxColorWrapper::GetB() const
{
return aznumeric_caster(m_fbxColor.mBlue);
}
float FbxColorWrapper::GetAlpha() const
{
return aznumeric_caster(m_fbxColor.mAlpha);
}
FbxVertexColorWrapper::FbxVertexColorWrapper(FbxGeometryElementVertexColor* fbxVertexColor)
: m_fbxVertexColor(fbxVertexColor)
{
AZ_Assert(m_fbxVertexColor, "Invalid FbxGeometryElementVertexColor to initialie FbxVertexColorWrapper");
}
FbxVertexColorWrapper::~FbxVertexColorWrapper()
{
m_fbxVertexColor = nullptr;
}
const char* FbxVertexColorWrapper::GetName() const
{
if (m_fbxVertexColor)
{
return m_fbxVertexColor->GetName();
}
return nullptr;
}
FbxColorWrapper FbxVertexColorWrapper::GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const
{
FbxColor color;
FbxLayerElementUtilities::GetGeometryElement(color, m_fbxVertexColor, polygonIndex, polygonVertexIndex, controlPointIndex);
return FbxColorWrapper(color);
}
bool FbxVertexColorWrapper::IsValid() const
{
return m_fbxVertexColor != nullptr;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,49 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxColorWrapper
{
public:
FbxColorWrapper(FbxColor& fbxColor);
float GetR() const;
float GetG() const;
float GetB() const;
float GetAlpha() const;
protected:
FbxColor m_fbxColor;
};
class FbxVertexColorWrapper
{
public:
FbxVertexColorWrapper(FbxGeometryElementVertexColor* fbxVertexColor);
~FbxVertexColorWrapper();
FbxColorWrapper GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const;
const char* GetName() const;
bool IsValid() const;
protected:
FbxGeometryElementVertexColor* m_fbxVertexColor;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,59 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxVertexTangentWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h>
#include <SceneAPI/FbxSDKWrapper/FbxTypeConverter.h>
namespace AZ
{
namespace FbxSDKWrapper
{
FbxVertexTangentWrapper::FbxVertexTangentWrapper(FbxGeometryElementTangent* fbxTangent)
: m_fbxTangent(fbxTangent)
{
AZ_Assert(fbxTangent, "Invalid FbxGeometryElementTangent to initialize FbxVertexTangentWrapper")
}
FbxVertexTangentWrapper::~FbxVertexTangentWrapper()
{
m_fbxTangent = nullptr;
}
const char* FbxVertexTangentWrapper::GetName() const
{
if (m_fbxTangent)
{
return m_fbxTangent->GetName();
}
return "";
}
Vector3 FbxVertexTangentWrapper::GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const
{
FbxVector4 tangent;
FbxLayerElementUtilities::GetGeometryElement(tangent, m_fbxTangent, polygonIndex, polygonVertexIndex, controlPointIndex);
return FbxTypeConverter::ToVector3(tangent);
}
bool FbxVertexTangentWrapper::IsValid() const
{
return m_fbxTangent != nullptr;
}
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,39 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <fbxsdk.h>
#include <AzCore/Math/Vector3.h>
#include <SceneAPI/FbxSDKWrapper/FbxLayerElementUtilities.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class FbxVertexTangentWrapper
{
public:
FbxVertexTangentWrapper(FbxGeometryElementTangent* fbxTangent);
~FbxVertexTangentWrapper();
Vector3 GetElementAt(int polygonIndex, int polygonVertexIndex, int controlPointIndex) const;
const char* GetName() const;
bool IsValid() const;
protected:
FbxGeometryElementTangent* m_fbxTangent;
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,32 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxAnimStackWrapper.h>
#include <AzTest/AzTest.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxAnimStackWrapper
: public FbxAnimStackWrapper
{
public:
MOCK_CONST_METHOD0(GetMemberCount,
int());
MOCK_CONST_METHOD1(GetAnimationLayerAt,
FbxAnimLayer * (int index));
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,32 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/FbxSDKWrapper/FbxAxisSystemWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxAxisSystemWrapper
: public FbxAxisSystemWrapper
{
public:
MOCK_CONST_METHOD1(GetUpVector,
UpVector(int));
MOCK_METHOD1(CalculateConversionTransform,
Transform(UpVector));
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,38 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/FbxSDKWrapper/FbxMaterialWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxMaterialWrapper
: public FbxMaterialWrapper
{
public:
MOCK_CONST_METHOD0(GetName,
std::string());
MOCK_CONST_METHOD1(GetTextureFileName,
std::string(const char* textureType));
MOCK_CONST_METHOD1(GetTextureFileName,
std::string(const std::string& textureType));
MOCK_CONST_METHOD1(GetTextureFileName,
std::string(MaterialMapType textureType));
MOCK_CONST_METHOD0(IsNoDraw,
bool());
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,56 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/FbxSDKWrapper/FbxMeshWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxMeshWrapper
: public FbxMeshWrapper
{
public:
MOCK_CONST_METHOD0(GetDeformerCount,
int());
MOCK_CONST_METHOD1(GetSkin,
AZStd::shared_ptr<const FbxSkinWrapper>(int index));
MOCK_CONST_METHOD1(GetMaterialIndices,
bool(FbxLayerElementArrayTemplate<int>**));
MOCK_CONST_METHOD0(GetControlPointsCount,
int());
MOCK_CONST_METHOD0(GetControlPoints,
AZStd::vector<Vector3>());
MOCK_CONST_METHOD0(GetPolygonCount,
int());
MOCK_CONST_METHOD1(GetPolygonSize,
int(int));
MOCK_CONST_METHOD1(GetPolygonVertics,
int(int index));
MOCK_CONST_METHOD1(GetPolygonVertexIndex,
int(int));
MOCK_CONST_METHOD1(GetElementUV,
FbxUVWrapper(int));
MOCK_CONST_METHOD0(GetElementUVCount,
int());
MOCK_CONST_METHOD1(GetElementVertexColor,
FbxVertexColorWrapper(int));
MOCK_CONST_METHOD0(GetElementVertexColorCount,
int());
MOCK_CONST_METHOD3(GetPolygonVertexNormal,
bool(int, int, Vector3&));
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,67 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxNodeWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
#include <AzTest/AzTest.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxNodeWrapper
: public FbxNodeWrapper
{
public:
MOCK_CONST_METHOD0(GetMaterialCount,
int());
MOCK_CONST_METHOD1(GetMaterialName,
const char*(int index));
MOCK_CONST_METHOD1(GetMaterial,
const std::shared_ptr<FbxMaterialWrapper>(int index));
MOCK_CONST_METHOD0(GetMesh,
const std::shared_ptr<FbxMeshWrapper>());
MOCK_CONST_METHOD1(FindProperty,
const std::shared_ptr<FbxPropertyWrapper>(const char* name));
MOCK_CONST_METHOD0(IsBone,
bool());
MOCK_CONST_METHOD0(GetName,
const char*());
MOCK_METHOD0(EvaluateGlobalTransform,
Transform());
MOCK_METHOD0(EvaluateLocalTranslation,
Vector3());
MOCK_METHOD1(EvaluateLocalTranslation,
Vector3(FbxTimeWrapper& time));
MOCK_METHOD0(EvaluateLocalTransform,
Transform());
MOCK_METHOD1(EvaluateLocalTransform,
Transform(FbxTimeWrapper& time));
MOCK_CONST_METHOD0(GetGeometricTranslation,
Vector3());
MOCK_CONST_METHOD0(GetGeometricScaling,
Vector3());
MOCK_CONST_METHOD0(GetGeometricRotation,
Vector3());
MOCK_CONST_METHOD0(GetGeometricTransform,
Transform());
MOCK_CONST_METHOD0(GetChildCount,
int());
MOCK_CONST_METHOD1(GetChild,
const std::shared_ptr<FbxNodeWrapper>(int childIndex));
MOCK_CONST_METHOD0(IsAnimated,
bool());
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,42 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxPropertyWrapper.h>
#include <AzTest/AzTest.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxPropertyWrapper
: public FbxPropertyWrapper
{
public:
MockFbxPropertyWrapper()
: FbxPropertyWrapper(new FbxProperty())
{
}
MOCK_CONST_METHOD0(IsValid,
bool());
MOCK_CONST_METHOD0(GetFbxVector4,
Vector4());
MOCK_CONST_METHOD0(GetFbxInt,
FbxInt());
MOCK_CONST_METHOD0(GetFbxString,
AZStd::string());
MOCK_CONST_METHOD1(GetEnumValue,
const char*(int index));
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,55 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxSceneWrapper.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
#include <AzTest/AzTest.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxSceneWrapper
: public FbxSceneWrapper
{
public:
virtual ~MockFbxSceneWrapper() = default;
MOCK_METHOD1(LoadSceneFromFile,
bool(const char* fileName));
MOCK_METHOD1(LoadSceneFromFile,
bool(const std::string& fileName));
MOCK_CONST_METHOD0(GetSystemUnit,
AZStd::shared_ptr<FbxSystemUnitWrapper>());
MOCK_CONST_METHOD0(GetAxisSystem,
AZStd::shared_ptr<FbxAxisSystemWrapper>());
MOCK_CONST_METHOD0(GetTimeLineDefaultDuration,
FbxTimeWrapper());
MOCK_CONST_METHOD0(GetLastSavedApplicationName,
const char*());
MOCK_CONST_METHOD0(GetLastSavedApplicationVersion,
const char*());
MOCK_CONST_METHOD0(GetRootNode,
const std::shared_ptr<FbxNodeWrapper>());
MOCK_METHOD0(GetRootNode,
std::shared_ptr<FbxNodeWrapper>());
MOCK_CONST_METHOD0(GetAnimationStackCount,
int());
MOCK_CONST_METHOD1(GetAnimationStackAt,
const std::shared_ptr<FbxAnimStackWrapper>(int index));
MOCK_METHOD0(Clear,
void());
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,40 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSdkWrapper/FbxSkinWrapper.h>
#include <AzTest/AzTest.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxSkinWrapper
: public FbxSkinWrapper
{
public:
MOCK_CONST_METHOD0(GetName,
const char*());
MOCK_CONST_METHOD0(GetClusterCount,
int());
MOCK_CONST_METHOD1(GetClusterControlPointIndicesCount,
int(int index));
MOCK_CONST_METHOD2(GetClusterControlPointIndices,
int(int clusterIndex, int pointIndex));
MOCK_CONST_METHOD2(GetClusterControlPointWeights,
double(int clusterIndex, int pointIndex));
MOCK_CONST_METHOD1(GetClusterLink,
AZStd::shared_ptr<const FbxNodeWrapper>(int index));
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,32 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/FbxSDKWrapper/FbxSystemUnitWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxSystemUnitWrapper
: public FbxSystemUnitWrapper
{
public:
MOCK_CONST_METHOD0(GetUnit,
Unit());
MOCK_METHOD1(GetConversionFactorTo,
float(Unit));
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,34 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/FbxSDKWrapper/FbxTimeWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxTimeWrapper
: public FbxTimeWrapper
{
public:
MOCK_METHOD2(SetFrame,
void(int64_t, TimeMode));
MOCK_CONST_METHOD0(GetFrameRate,
double());
MOCK_CONST_METHOD0(GetFrameCount,
int64_t());
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,34 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <SceneAPI/FbxSDKWrapper/FbxUVWrapper.h>
#include <AzTest/AzTest.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxUVWrapper
: public FbxUVWrapper
{
public:
MOCK_CONST_METHOD3(GetElementAt,
Vector2(int, int, int));
MOCK_CONST_METHOD0(GetName,
const char*());
MOCK_CONST_METHOD0(IsValid,
bool());
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,35 @@
#pragma once
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <SceneAPI/FbxSDKWrapper/FbxVertexColorWrapper.h>
namespace AZ
{
namespace FbxSDKWrapper
{
class MockFbxVertexColorWrapper
: public FbxVertexColorWrapper
{
public:
MOCK_CONST_METHOD3(GetElementAt,
FbxColorWrapper(int, int, int));
MOCK_CONST_METHOD0(GetName,
const char*());
MOCK_CONST_METHOD0(IsValid,
bool());
};
} // namespace FbxSDKWrapper
} // namespace AZ
@@ -0,0 +1,12 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
@@ -0,0 +1,12 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
@@ -0,0 +1,16 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(LY_BUILD_DEPENDENCIES
PUBLIC
3rdParty::AssImp
)
set(LY_COMPILE_DEFINITIONS PUBLIC ASSET_IMPORTER_SDK_SUPPORTED_TRAIT)
@@ -0,0 +1,69 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
FbxSceneWrapper.cpp
FbxAnimStackWrapper.cpp
FbxAnimLayerWrapper.cpp
FbxAnimCurveNodeWrapper.cpp
FbxAnimCurveWrapper.cpp
FbxNodeWrapper.cpp
FbxMeshWrapper.cpp
FbxSkinWrapper.cpp
FbxPropertyWrapper.cpp
FbxMaterialWrapper.cpp
FbxTimeWrapper.cpp
FbxTimeSpanWrapper.cpp
FbxTypeConverter.cpp
FbxAxisSystemWrapper.cpp
FbxSystemUnitWrapper.cpp
FbxVertexColorWrapper.cpp
FbxVertexTangentWrapper.cpp
FbxVertexBitangentWrapper.cpp
FbxUVWrapper.cpp
FbxBlendShapeWrapper.cpp
FbxBlendShapeChannelWrapper.cpp
FbxLayerElementUtilities.inl
FbxSceneWrapper.h
FbxAnimStackWrapper.h
FbxAnimLayerWrapper.h
FbxAnimCurveNodeWrapper.h
FbxAnimCurveWrapper.h
FbxNodeWrapper.h
FbxMeshWrapper.h
FbxSkinWrapper.h
FbxPropertyWrapper.h
FbxMaterialWrapper.h
FbxTimeWrapper.h
FbxTimeSpanWrapper.h
FbxTypeConverter.h
FbxAxisSystemWrapper.h
FbxSystemUnitWrapper.h
FbxVertexColorWrapper.h
FbxVertexTangentWrapper.h
FbxVertexBitangentWrapper.h
FbxUVWrapper.h
FbxBlendShapeWrapper.h
FbxBlendShapeChannelWrapper.h
FbxLayerElementUtilities.h
Mocks/MockFbxAnimStackWrapper.h
Mocks/MockFbxAxisSystemWrapper.h
Mocks/MockFbxMaterialWrapper.h
Mocks/MockFbxMeshWrapper.h
Mocks/MockFbxNodeWrapper.h
Mocks/MockFbxPropertyWrapper.h
Mocks/MockFbxSceneWrapper.h
Mocks/MockFbxSkinWrapper.h
Mocks/MockFbxSystemUnitWrapper.h
Mocks/MockFbxTimeWrapper.h
Mocks/MockFbxUVWrapper.h
Mocks/MockFbxVertexColorWrapper.h
)