FBX: some refactorings.

pull/2091/head
Kim Kulling 2018-08-09 21:51:53 +02:00
parent 43be7abb70
commit c3d043e761
3 changed files with 86 additions and 85 deletions

View File

@ -73,7 +73,7 @@ using namespace Util;
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000L
Converter::Converter( aiScene* out, const Document& doc )
FBXConverter::FBXConverter( aiScene* out, const Document& doc )
: defaultMaterialIndex()
, out( out )
, doc( doc ) {
@ -114,7 +114,7 @@ Converter::Converter( aiScene* out, const Document& doc )
}
Converter::~Converter() {
FBXConverter::~FBXConverter() {
std::for_each( meshes.begin(), meshes.end(), Util::delete_fun<aiMesh>() );
std::for_each( materials.begin(), materials.end(), Util::delete_fun<aiMaterial>() );
std::for_each( animations.begin(), animations.end(), Util::delete_fun<aiAnimation>() );
@ -123,7 +123,7 @@ Converter::~Converter() {
std::for_each( textures.begin(), textures.end(), Util::delete_fun<aiTexture>() );
}
void Converter::ConvertRootNode() {
void FBXConverter::ConvertRootNode() {
out->mRootNode = new aiNode();
out->mRootNode->mName.Set( "RootNode" );
@ -131,7 +131,7 @@ void Converter::ConvertRootNode() {
ConvertNodes( 0L, *out->mRootNode );
}
void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& parent_transform ) {
void FBXConverter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& parent_transform ) {
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced( id, "Model" );
std::vector<aiNode*> nodes;
@ -282,7 +282,7 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
}
void Converter::ConvertLights( const Model& model, const std::string &orig_name ) {
void FBXConverter::ConvertLights( const Model& model, const std::string &orig_name ) {
const std::vector<const NodeAttribute*>& node_attrs = model.GetAttributes();
for( const NodeAttribute* attr : node_attrs ) {
const Light* const light = dynamic_cast<const Light*>( attr );
@ -292,7 +292,7 @@ void Converter::ConvertLights( const Model& model, const std::string &orig_name
}
}
void Converter::ConvertCameras( const Model& model, const std::string &orig_name ) {
void FBXConverter::ConvertCameras( const Model& model, const std::string &orig_name ) {
const std::vector<const NodeAttribute*>& node_attrs = model.GetAttributes();
for( const NodeAttribute* attr : node_attrs ) {
const Camera* const cam = dynamic_cast<const Camera*>( attr );
@ -302,7 +302,7 @@ void Converter::ConvertCameras( const Model& model, const std::string &orig_name
}
}
void Converter::ConvertLight( const Light& light, const std::string &orig_name ) {
void FBXConverter::ConvertLight( const Light& light, const std::string &orig_name ) {
lights.push_back( new aiLight() );
aiLight* const out_light = lights.back();
@ -379,7 +379,7 @@ void Converter::ConvertLight( const Light& light, const std::string &orig_name )
}
}
void Converter::ConvertCamera( const Camera& cam, const std::string &orig_name )
void FBXConverter::ConvertCamera( const Camera& cam, const std::string &orig_name )
{
cameras.push_back( new aiCamera() );
aiCamera* const out_camera = cameras.back();
@ -398,7 +398,7 @@ void Converter::ConvertCamera( const Camera& cam, const std::string &orig_name )
out_camera->mClipPlaneFar = cam.FarPlane();
}
void Converter::GetUniqueName( const std::string &name, std::string &uniqueName )
void FBXConverter::GetUniqueName( const std::string &name, std::string &uniqueName )
{
int i = 0;
uniqueName = name;
@ -413,7 +413,7 @@ void Converter::GetUniqueName( const std::string &name, std::string &uniqueName
}
const char* Converter::NameTransformationComp( TransformationComp comp )
const char* FBXConverter::NameTransformationComp( TransformationComp comp )
{
switch ( comp )
{
@ -460,7 +460,7 @@ const char* Converter::NameTransformationComp( TransformationComp comp )
return NULL;
}
const char* Converter::NameTransformationCompProperty( TransformationComp comp )
const char* FBXConverter::NameTransformationCompProperty( TransformationComp comp )
{
switch ( comp )
{
@ -506,14 +506,14 @@ const char* Converter::NameTransformationCompProperty( TransformationComp comp )
return NULL;
}
aiVector3D Converter::TransformationCompDefaultValue( TransformationComp comp )
aiVector3D FBXConverter::TransformationCompDefaultValue( TransformationComp comp )
{
// XXX a neat way to solve the never-ending special cases for scaling
// would be to do everything in log space!
return comp == TransformationComp_Scaling ? aiVector3D( 1.f, 1.f, 1.f ) : aiVector3D();
}
void Converter::GetRotationMatrix( Model::RotOrder mode, const aiVector3D& rotation, aiMatrix4x4& out )
void FBXConverter::GetRotationMatrix( Model::RotOrder mode, const aiVector3D& rotation, aiMatrix4x4& out )
{
if ( mode == Model::RotOrder_SphericXYZ ) {
FBXImporter::LogError( "Unsupported RotationMode: SphericXYZ" );
@ -603,7 +603,7 @@ void Converter::GetRotationMatrix( Model::RotOrder mode, const aiVector3D& rotat
}
}
bool Converter::NeedsComplexTransformationChain( const Model& model )
bool FBXConverter::NeedsComplexTransformationChain( const Model& model )
{
const PropertyTable& props = model.Props();
bool ok;
@ -634,12 +634,12 @@ bool Converter::NeedsComplexTransformationChain( const Model& model )
return false;
}
std::string Converter::NameTransformationChainNode( const std::string& name, TransformationComp comp )
std::string FBXConverter::NameTransformationChainNode( const std::string& name, TransformationComp comp )
{
return name + std::string( MAGIC_NODE_TAG ) + "_" + NameTransformationComp( comp );
}
void Converter::GenerateTransformationNodeChain( const Model& model, std::vector<aiNode*>& output_nodes, std::vector<aiNode*>& post_output_nodes )
void FBXConverter::GenerateTransformationNodeChain( const Model& model, std::vector<aiNode*>& output_nodes, std::vector<aiNode*>& post_output_nodes )
{
const PropertyTable& props = model.Props();
const Model::RotOrder rot = model.RotationOrder();
@ -811,7 +811,7 @@ void Converter::GenerateTransformationNodeChain( const Model& model, std::vector
}
}
void Converter::SetupNodeMetadata( const Model& model, aiNode& nd )
void FBXConverter::SetupNodeMetadata( const Model& model, aiNode& nd )
{
const PropertyTable& props = model.Props();
DirectPropertyMap unparsedProperties = props.GetUnparsedProperties();
@ -848,7 +848,7 @@ void Converter::SetupNodeMetadata( const Model& model, aiNode& nd )
}
}
void Converter::ConvertModel( const Model& model, aiNode& nd, const aiMatrix4x4& node_global_transform )
void FBXConverter::ConvertModel( const Model& model, aiNode& nd, const aiMatrix4x4& node_global_transform )
{
const std::vector<const Geometry*>& geos = model.GetGeometry();
@ -875,7 +875,7 @@ void Converter::ConvertModel( const Model& model, aiNode& nd, const aiMatrix4x4&
}
}
std::vector<unsigned int> Converter::ConvertMesh( const MeshGeometry& mesh, const Model& model,
std::vector<unsigned int> FBXConverter::ConvertMesh( const MeshGeometry& mesh, const Model& model,
const aiMatrix4x4& node_global_transform, aiNode& nd)
{
std::vector<unsigned int> temp;
@ -910,7 +910,7 @@ std::vector<unsigned int> Converter::ConvertMesh( const MeshGeometry& mesh, cons
return temp;
}
aiMesh* Converter::SetupEmptyMesh( const MeshGeometry& mesh, aiNode& nd)
aiMesh* FBXConverter::SetupEmptyMesh( const MeshGeometry& mesh, aiNode& nd)
{
aiMesh* const out_mesh = new aiMesh();
meshes.push_back( out_mesh );
@ -933,7 +933,7 @@ aiMesh* Converter::SetupEmptyMesh( const MeshGeometry& mesh, aiNode& nd)
return out_mesh;
}
unsigned int Converter::ConvertMeshSingleMaterial( const MeshGeometry& mesh, const Model& model,
unsigned int FBXConverter::ConvertMeshSingleMaterial( const MeshGeometry& mesh, const Model& model,
const aiMatrix4x4& node_global_transform, aiNode& nd)
{
const MatIndexArray& mindices = mesh.GetMaterialIndices();
@ -1060,7 +1060,7 @@ unsigned int Converter::ConvertMeshSingleMaterial( const MeshGeometry& mesh, con
return static_cast<unsigned int>( meshes.size() - 1 );
}
std::vector<unsigned int> Converter::ConvertMeshMultiMaterial( const MeshGeometry& mesh, const Model& model,
std::vector<unsigned int> FBXConverter::ConvertMeshMultiMaterial( const MeshGeometry& mesh, const Model& model,
const aiMatrix4x4& node_global_transform, aiNode& nd)
{
const MatIndexArray& mindices = mesh.GetMaterialIndices();
@ -1080,7 +1080,7 @@ std::vector<unsigned int> Converter::ConvertMeshMultiMaterial( const MeshGeometr
return indices;
}
unsigned int Converter::ConvertMeshMultiMaterial( const MeshGeometry& mesh, const Model& model,
unsigned int FBXConverter::ConvertMeshMultiMaterial( const MeshGeometry& mesh, const Model& model,
MatIndexArray::value_type index,
const aiMatrix4x4& node_global_transform,
aiNode& nd)
@ -1256,7 +1256,7 @@ unsigned int Converter::ConvertMeshMultiMaterial( const MeshGeometry& mesh, cons
return static_cast<unsigned int>( meshes.size() - 1 );
}
void Converter::ConvertWeights( aiMesh* out, const Model& model, const MeshGeometry& geo,
void FBXConverter::ConvertWeights( aiMesh* out, const Model& model, const MeshGeometry& geo,
const aiMatrix4x4& node_global_transform ,
unsigned int materialIndex,
std::vector<unsigned int>* outputVertStartIndices )
@ -1361,7 +1361,7 @@ void Converter::ConvertWeights( aiMesh* out, const Model& model, const MeshGeome
std::swap_ranges( bones.begin(), bones.end(), out->mBones );
}
void Converter::ConvertCluster( std::vector<aiBone*>& bones, const Model& /*model*/, const Cluster& cl,
void FBXConverter::ConvertCluster( std::vector<aiBone*>& bones, const Model& /*model*/, const Cluster& cl,
std::vector<size_t>& out_indices,
std::vector<size_t>& index_out_indices,
std::vector<size_t>& count_out_indices,
@ -1402,7 +1402,7 @@ void Converter::ConvertCluster( std::vector<aiBone*>& bones, const Model& /*mode
}
}
void Converter::ConvertMaterialForMesh( aiMesh* out, const Model& model, const MeshGeometry& geo,
void FBXConverter::ConvertMaterialForMesh( aiMesh* out, const Model& model, const MeshGeometry& geo,
MatIndexArray::value_type materialIndex )
{
// locate source materials for this mesh
@ -1424,7 +1424,7 @@ void Converter::ConvertMaterialForMesh( aiMesh* out, const Model& model, const M
materials_converted[ mat ] = out->mMaterialIndex;
}
unsigned int Converter::GetDefaultMaterial()
unsigned int FBXConverter::GetDefaultMaterial()
{
if ( defaultMaterialIndex ) {
return defaultMaterialIndex - 1;
@ -1446,7 +1446,7 @@ unsigned int Converter::GetDefaultMaterial()
}
unsigned int Converter::ConvertMaterial( const Material& material, const MeshGeometry* const mesh )
unsigned int FBXConverter::ConvertMaterial( const Material& material, const MeshGeometry* const mesh )
{
const PropertyTable& props = material.Props();
@ -1481,7 +1481,7 @@ unsigned int Converter::ConvertMaterial( const Material& material, const MeshGeo
return static_cast<unsigned int>( materials.size() - 1 );
}
unsigned int Converter::ConvertVideo( const Video& video )
unsigned int FBXConverter::ConvertVideo( const Video& video )
{
// generate empty output texture
aiTexture* out_tex = new aiTexture();
@ -1511,7 +1511,7 @@ unsigned int Converter::ConvertVideo( const Video& video )
return static_cast<unsigned int>( textures.size() - 1 );
}
aiString Converter::GetTexturePath(const Texture* tex)
aiString FBXConverter::GetTexturePath(const Texture* tex)
{
aiString path;
path.Set(tex->RelativeFilename());
@ -1551,7 +1551,7 @@ aiString Converter::GetTexturePath(const Texture* tex)
return path;
}
void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap& textures,
void FBXConverter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap& textures,
const std::string& propName,
aiTextureType target, const MeshGeometry* const mesh )
{
@ -1669,7 +1669,7 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const TextureMap&
}
}
void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures,
void FBXConverter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures,
const std::string& propName,
aiTextureType target, const MeshGeometry* const mesh ) {
LayeredTextureMap::const_iterator it = layeredTextures.find( propName );
@ -1792,7 +1792,7 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextu
}
}
void Converter::SetTextureProperties( aiMaterial* out_mat, const TextureMap& textures, const MeshGeometry* const mesh )
void FBXConverter::SetTextureProperties( aiMaterial* out_mat, const TextureMap& textures, const MeshGeometry* const mesh )
{
TrySetTextureProperties( out_mat, textures, "DiffuseColor", aiTextureType_DIFFUSE, mesh );
TrySetTextureProperties( out_mat, textures, "AmbientColor", aiTextureType_AMBIENT, mesh );
@ -1807,7 +1807,7 @@ void Converter::SetTextureProperties( aiMaterial* out_mat, const TextureMap& tex
TrySetTextureProperties( out_mat, textures, "ShininessExponent", aiTextureType_SHININESS, mesh );
}
void Converter::SetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures, const MeshGeometry* const mesh )
void FBXConverter::SetTextureProperties( aiMaterial* out_mat, const LayeredTextureMap& layeredTextures, const MeshGeometry* const mesh )
{
TrySetTextureProperties( out_mat, layeredTextures, "DiffuseColor", aiTextureType_DIFFUSE, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "AmbientColor", aiTextureType_AMBIENT, mesh );
@ -1822,7 +1822,7 @@ void Converter::SetTextureProperties( aiMaterial* out_mat, const LayeredTextureM
TrySetTextureProperties( out_mat, layeredTextures, "ShininessExponent", aiTextureType_SHININESS, mesh );
}
aiColor3D Converter::GetColorPropertyFactored( const PropertyTable& props, const std::string& colorName,
aiColor3D FBXConverter::GetColorPropertyFactored( const PropertyTable& props, const std::string& colorName,
const std::string& factorName, bool& result, bool useTemplate )
{
result = true;
@ -1847,13 +1847,13 @@ aiColor3D Converter::GetColorPropertyFactored( const PropertyTable& props, const
return aiColor3D( BaseColor.x, BaseColor.y, BaseColor.z );
}
aiColor3D Converter::GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName,
aiColor3D FBXConverter::GetColorPropertyFromMaterial( const PropertyTable& props, const std::string& baseName,
bool& result )
{
return GetColorPropertyFactored( props, baseName + "Color", baseName + "Factor", result, true );
}
aiColor3D Converter::GetColorProperty( const PropertyTable& props, const std::string& colorName,
aiColor3D FBXConverter::GetColorProperty( const PropertyTable& props, const std::string& colorName,
bool& result, bool useTemplate )
{
result = true;
@ -1866,7 +1866,7 @@ aiColor3D Converter::GetColorProperty( const PropertyTable& props, const std::st
return aiColor3D( ColorVec.x, ColorVec.y, ColorVec.z );
}
void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props )
void FBXConverter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyTable& props )
{
// Set shading properties.
// Modern FBX Files have two separate systems for defining these,
@ -1965,7 +1965,7 @@ void Converter::SetShadingPropertiesCommon( aiMaterial* out_mat, const PropertyT
}
double Converter::FrameRateToDouble( FileGlobalSettings::FrameRate fp, double customFPSVal )
double FBXConverter::FrameRateToDouble( FileGlobalSettings::FrameRate fp, double customFPSVal )
{
switch ( fp ) {
case FileGlobalSettings::FrameRate_DEFAULT:
@ -2018,7 +2018,7 @@ double Converter::FrameRateToDouble( FileGlobalSettings::FrameRate fp, double cu
}
void Converter::ConvertAnimations()
void FBXConverter::ConvertAnimations()
{
// first of all determine framerate
const FileGlobalSettings::FrameRate fps = doc.GlobalSettings().TimeMode();
@ -2031,7 +2031,7 @@ void Converter::ConvertAnimations()
}
}
std::string Converter::FixNodeName( const std::string& name ) {
std::string FBXConverter::FixNodeName( const std::string& name ) {
// strip Model:: prefix, avoiding ambiguities (i.e. don't strip if
// this causes ambiguities, well possible between empty identifiers,
// such as "Model::" and ""). Make sure the behaviour is consistent
@ -2044,7 +2044,7 @@ std::string Converter::FixNodeName( const std::string& name ) {
return name;
}
void Converter::ConvertAnimationStack( const AnimationStack& st )
void FBXConverter::ConvertAnimationStack( const AnimationStack& st )
{
const AnimationLayerList& layers = st.Layers();
if ( layers.empty() ) {
@ -2186,7 +2186,7 @@ static void validateAnimCurveNodes( const std::vector<const AnimationCurveNode*>
#endif // ASSIMP_BUILD_DEBUG
// ------------------------------------------------------------------------------------------------
void Converter::GenerateNodeAnimations( std::vector<aiNodeAnim*>& node_anims,
void FBXConverter::GenerateNodeAnimations( std::vector<aiNodeAnim*>& node_anims,
const std::string& fixed_name,
const std::vector<const AnimationCurveNode*>& curves,
const LayerMap& layer_map,
@ -2420,7 +2420,7 @@ void Converter::GenerateNodeAnimations( std::vector<aiNodeAnim*>& node_anims,
node_anim_chain_bits[ fixed_name ] = flags;
}
bool Converter::IsRedundantAnimationData( const Model& target,
bool FBXConverter::IsRedundantAnimationData( const Model& target,
TransformationComp comp,
const std::vector<const AnimationCurveNode*>& curves )
{
@ -2466,7 +2466,7 @@ bool Converter::IsRedundantAnimationData( const Model& target,
}
aiNodeAnim* Converter::GenerateRotationNodeAnim( const std::string& name,
aiNodeAnim* FBXConverter::GenerateRotationNodeAnim( const std::string& name,
const Model& target,
const std::vector<const AnimationCurveNode*>& curves,
const LayerMap& layer_map,
@ -2496,7 +2496,7 @@ aiNodeAnim* Converter::GenerateRotationNodeAnim( const std::string& name,
return na.release();
}
aiNodeAnim* Converter::GenerateScalingNodeAnim( const std::string& name,
aiNodeAnim* FBXConverter::GenerateScalingNodeAnim( const std::string& name,
const Model& /*target*/,
const std::vector<const AnimationCurveNode*>& curves,
const LayerMap& layer_map,
@ -2527,7 +2527,7 @@ aiNodeAnim* Converter::GenerateScalingNodeAnim( const std::string& name,
}
aiNodeAnim* Converter::GenerateTranslationNodeAnim( const std::string& name,
aiNodeAnim* FBXConverter::GenerateTranslationNodeAnim( const std::string& name,
const Model& /*target*/,
const std::vector<const AnimationCurveNode*>& curves,
const LayerMap& layer_map,
@ -2564,7 +2564,7 @@ aiNodeAnim* Converter::GenerateTranslationNodeAnim( const std::string& name,
return na.release();
}
aiNodeAnim* Converter::GenerateSimpleNodeAnim( const std::string& name,
aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim( const std::string& name,
const Model& target,
NodeMap::const_iterator chain[ TransformationComp_MAXIMUM ],
NodeMap::const_iterator iter_end,
@ -2700,7 +2700,7 @@ aiNodeAnim* Converter::GenerateSimpleNodeAnim( const std::string& name,
return na.release();
}
Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector<const AnimationCurveNode*>& nodes, int64_t start, int64_t stop )
FBXConverter::KeyFrameListList FBXConverter::GetKeyframeList( const std::vector<const AnimationCurveNode*>& nodes, int64_t start, int64_t stop )
{
KeyFrameListList inputs;
inputs.reserve( nodes.size() * 3 );
@ -2756,7 +2756,7 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector<const
}
KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
KeyTimeList FBXConverter::GetKeyTimeList( const KeyFrameListList& inputs )
{
ai_assert( inputs.size() );
@ -2805,7 +2805,7 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs )
return keys;
}
void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
void FBXConverter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
const aiVector3D& def_value,
double& max_time,
double& min_time ) {
@ -2861,14 +2861,14 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
}
}
void Converter::InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
void FBXConverter::InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
const aiVector3D& def_value,
double& maxTime,
double& minTime,
Model::RotOrder order )
{
ai_assert( keys.size() );
ai_assert( valOut );
ai_assert( !keys.empty() );
ai_assert( nullptr != valOut );
std::unique_ptr<aiVectorKey[]> temp( new aiVectorKey[ keys.size() ] );
InterpolateKeys( temp.get(), keys, inputs, def_value, maxTime, minTime );
@ -2899,7 +2899,7 @@ void Converter::InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, con
}
}
void Converter::ConvertTransformOrder_TRStoSRT( aiQuatKey* out_quat, aiVectorKey* out_scale,
void FBXConverter::ConvertTransformOrder_TRStoSRT( aiQuatKey* out_quat, aiVectorKey* out_scale,
aiVectorKey* out_translation,
const KeyFrameListList& scaling,
const KeyFrameListList& translation,
@ -2957,7 +2957,7 @@ void Converter::ConvertTransformOrder_TRStoSRT( aiQuatKey* out_quat, aiVectorKey
}
}
aiQuaternion Converter::EulerToQuaternion( const aiVector3D& rot, Model::RotOrder order )
aiQuaternion FBXConverter::EulerToQuaternion( const aiVector3D& rot, Model::RotOrder order )
{
aiMatrix4x4 m;
GetRotationMatrix( order, rot, m );
@ -2965,7 +2965,7 @@ aiQuaternion Converter::EulerToQuaternion( const aiVector3D& rot, Model::RotOrde
return aiQuaternion( aiMatrix3x3( m ) );
}
void Converter::ConvertScaleKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, const LayerMap& /*layers*/,
void FBXConverter::ConvertScaleKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, const LayerMap& /*layers*/,
int64_t start, int64_t stop,
double& maxTime,
double& minTime )
@ -2985,7 +2985,7 @@ void Converter::ConvertScaleKeys( aiNodeAnim* na, const std::vector<const Animat
InterpolateKeys( na->mScalingKeys, keys, inputs, aiVector3D( 1.0f, 1.0f, 1.0f ), maxTime, minTime );
}
void Converter::ConvertTranslationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
void FBXConverter::ConvertTranslationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
const LayerMap& /*layers*/,
int64_t start, int64_t stop,
double& maxTime,
@ -3003,7 +3003,7 @@ void Converter::ConvertTranslationKeys( aiNodeAnim* na, const std::vector<const
InterpolateKeys( na->mPositionKeys, keys, inputs, aiVector3D( 0.0f, 0.0f, 0.0f ), maxTime, minTime );
}
void Converter::ConvertRotationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
void FBXConverter::ConvertRotationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
const LayerMap& /*layers*/,
int64_t start, int64_t stop,
double& maxTime,
@ -3023,7 +3023,7 @@ void Converter::ConvertRotationKeys( aiNodeAnim* na, const std::vector<const Ani
}
}
void Converter::ConvertGlobalSettings() {
void FBXConverter::ConvertGlobalSettings() {
if (nullptr == out) {
return;
}
@ -3034,7 +3034,7 @@ void Converter::ConvertGlobalSettings() {
out->mMetaData->Set(index, "UnitScaleFactor", unitScalFactor);
}
void Converter::TransferDataToScene()
void FBXConverter::TransferDataToScene()
{
ai_assert( !out->mMeshes );
ai_assert( !out->mNumMeshes );
@ -3089,7 +3089,7 @@ void Converter::TransferDataToScene()
// ------------------------------------------------------------------------------------------------
void ConvertToAssimpScene(aiScene* out, const Document& doc)
{
Converter converter(out,doc);
FBXConverter converter(out,doc);
}
} // !FBX

View File

@ -78,7 +78,7 @@ using NodeNameCache = std::set<std::string>;
void ConvertToAssimpScene(aiScene* out, const Document& doc);
/** Dummy class to encapsulate the conversion process */
class Converter {
class FBXConverter {
public:
/**
* The different parts that make up the final local transformation of a fbx-node
@ -106,8 +106,8 @@ public:
};
public:
Converter(aiScene* out, const Document& doc);
~Converter();
FBXConverter(aiScene* out, const Document& doc);
~FBXConverter();
private:
// ------------------------------------------------------------------------------------------------

View File

@ -79,26 +79,27 @@ struct aiVectorKey
/// @brief Construction from a given time and key value.
aiVectorKey(double time, const aiVector3D& value)
: mTime (time)
, mValue (value)
{}
: mTime( time )
, mValue( value ) {
// empty
}
typedef aiVector3D elem_type;
// Comparison operators. For use with std::find();
bool operator == (const aiVectorKey& o) const {
return o.mValue == this->mValue;
bool operator == (const aiVectorKey& rhs) const {
return rhs.mValue == this->mValue;
}
bool operator != (const aiVectorKey& o) const {
return o.mValue != this->mValue;
bool operator != (const aiVectorKey& rhs ) const {
return rhs.mValue != this->mValue;
}
// Relational operators. For use with std::sort();
bool operator < (const aiVectorKey& o) const {
return mTime < o.mTime;
bool operator < (const aiVectorKey& rhs ) const {
return mTime < rhs.mTime;
}
bool operator > (const aiVectorKey& o) const {
return mTime > o.mTime;
bool operator > (const aiVectorKey& rhs ) const {
return mTime > rhs.mTime;
}
#endif // __cplusplus
};
@ -130,25 +131,25 @@ struct aiQuatKey
typedef aiQuaternion elem_type;
// Comparison operators. For use with std::find();
bool operator == (const aiQuatKey& o) const {
return o.mValue == this->mValue;
bool operator == (const aiQuatKey& rhs ) const {
return rhs.mValue == this->mValue;
}
bool operator != (const aiQuatKey& o) const {
return o.mValue != this->mValue;
bool operator != (const aiQuatKey& rhs ) const {
return rhs.mValue != this->mValue;
}
// Relational operators. For use with std::sort();
bool operator < (const aiQuatKey& o) const {
return mTime < o.mTime;
bool operator < (const aiQuatKey& rhs ) const {
return mTime < rhs.mTime;
}
bool operator > (const aiQuatKey& o) const {
return mTime > o.mTime;
bool operator > (const aiQuatKey& rhs ) const {
return mTime > rhs.mTime;
}
#endif
};
// ---------------------------------------------------------------------------
/** Binds a anim mesh to a specific point in time. */
/** Binds a anim-mesh to a specific point in time. */
struct aiMeshKey
{
/** The time of this key */