18#ifndef INCLUDED_COMMONCONVERT
19#define INCLUDED_COMMONCONVERT
26class FCDEntityInstance;
28class FCDSkinController;
38 virtual const char*
what()
const throw() {
return msg.c_str(); }
46 virtual void operator() (
const char* data,
unsigned int length)=0;
60 void OnError(FUError::Level errorLevel, uint32 errorCode, uint32 lineNumber);
89 std::unique_ptr<FCDExtra>
extra;
118#define REQUIRE(value, message) require_(__LINE__, value, "Assertion not satisfied", "failed requirement \"" message "\"")
121#define REQUIRE_SUCCESS(status) require_(__LINE__, status, "FCollada error", "Line " STRINGIFY(__LINE__))
122#define STRINGIFY(x) #x
124void require_(
int line,
bool value,
const char* type,
const char* message);
129 output((
char*)&data,
sizeof(
T));
143bool FindSingleInstance(FCDSceneNode* node, FCDEntityInstance*& instance, FMMatrix44& transform);
150void SkinReduceInfluences(FCDSkinController* skin,
size_t maxInfluenceCount,
float minimumWeight);
176void TransformBones(std::vector<BoneTransform>& bones,
const FMMatrix44& scaleTransform,
bool yUp);
void require_(int line, bool value, const char *type, const char *message)
Definition: CommonConvert.cpp:35
const Skeleton & FindSkeleton(const FCDControllerInstance &controllerInstance)
Finds the skeleton definition which best matches the given controller.
Definition: CommonConvert.cpp:382
void TransformBones(std::vector< BoneTransform > &bones, const FMMatrix44 &scaleTransform, bool yUp)
Performs the standard transformations on bones, applying a scale matrix and moving them into the game...
Definition: CommonConvert.cpp:398
void write(OutputCB &output, const T &data)
Outputs a structure, using sizeof to get the size.
Definition: CommonConvert.h:127
FMMatrix44 FMMatrix44_Identity
void SkinReduceInfluences(FCDSkinController *skin, size_t maxInfluenceCount, float minimumWeight)
Like FCDSkinController::ReduceInfluences but works correctly.
Definition: CommonConvert.cpp:304
bool FindSingleInstance(FCDSceneNode *node, FCDEntityInstance *&instance, FMMatrix44 &transform)
Tries to find a single suitable entity instance in the scene.
Definition: CommonConvert.cpp:266
void FixSkeletonRoots(FCDControllerInstance &controllerInstance)
Fixes some occasional problems with the skeleton root definitions in a controller.
Definition: CommonConvert.cpp:364
Definition: CommonConvert.h:34
ColladaException(const std::string &msg)
Definition: CommonConvert.h:36
~ColladaException()
Definition: CommonConvert.h:37
std::string msg
Definition: CommonConvert.h:40
virtual const char * what() const
Definition: CommonConvert.h:38
Wrapper for code shared between the PMD and PSA converters.
Definition: CommonConvert.h:97
~CommonConvert()
Definition: CommonConvert.cpp:166
const FMMatrix44 & GetEntityTransform() const
Definition: CommonConvert.h:104
FCDEntityInstance * m_Instance
Definition: CommonConvert.h:111
bool m_YUp
Definition: CommonConvert.h:113
bool m_IsXSI
Definition: CommonConvert.h:114
FMMatrix44 m_EntityTransform
Definition: CommonConvert.h:112
FCDEntityInstance & GetInstance()
Definition: CommonConvert.h:103
FColladaDocument m_Doc
Definition: CommonConvert.h:110
bool IsXSI() const
Definition: CommonConvert.h:106
FCDSceneNode & GetRoot()
Definition: CommonConvert.h:102
const FColladaDocument & GetDocument() const
Definition: CommonConvert.h:101
bool IsYUp() const
Definition: CommonConvert.h:105
FColladaErrorHandler m_Err
Definition: CommonConvert.h:109
CommonConvert(const char *text, std::string &xmlErrors)
Definition: CommonConvert.cpp:139
Standard document loader.
Definition: CommonConvert.h:71
FCDocument * GetDocument() const
Returns the FCDocument that was loaded.
Definition: CommonConvert.h:81
std::unique_ptr< FCDExtra > extra
Definition: CommonConvert.h:89
std::unique_ptr< FCDocument > document
Definition: CommonConvert.h:88
void ReadExtras(xmlNode *colladaNode)
Definition: CommonConvert.cpp:114
FCDExtra * GetExtra() const
Returns the <extra> data from the <COLLADA> element.
Definition: CommonConvert.h:84
void LoadFromText(const char *text)
Loads the document from the given XML string.
Definition: CommonConvert.cpp:97
Standard error handler - logs FCollada messages using Log(), and also maintains a list of XML parser ...
Definition: CommonConvert.h:54
void OnError(FUError::Level errorLevel, uint32 errorCode, uint32 lineNumber)
Definition: CommonConvert.cpp:76
std::string & xmlErrors
Definition: CommonConvert.h:61
FColladaErrorHandler(std::string &xmlErrors)
Definition: CommonConvert.cpp:56
void operator=(FColladaErrorHandler)
~FColladaErrorHandler()
Definition: CommonConvert.cpp:67
Definition: StdSkeletons.h:51
#define T(string_literal)
Definition: secure_crt.cpp:77
Definition: CommonConvert.h:44
virtual void operator()(const char *data, unsigned int length)=0
virtual ~OutputCB()
Definition: CommonConvert.h:45