Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
#include "precompiled.h"
#include "CommonConvert.h"
#include "StdSkeletons.h"
#include "XMLFix.h"
#include "FCollada.h"
#include "FCDocument/FCDSceneNode.h"
#include "FCDocument/FCDSkinController.h"
#include "FUtils/FUDaeSyntax.h"
#include "FUtils/FUFileManager.h"
#include <algorithm>
#include <cassert>
#include <libxml/xmlerror.h>
Classes | |
struct | FoundInstance |
Functions | |
void | require_ (int line, bool value, const char *type, const char *message) |
void | errorHandler (void *ctx, const char *msg,...) |
Error handler for libxml2. More... | |
const FMVector3 | FMVector3_XAxis (1.0f, 0.0f, 0.0f) |
FMMatrix44 | FMMatrix44_Identity (identity) |
static bool | IsVisible_XSI (FCDSceneNode *node, bool &visible) |
static bool | IsVisible (FCDSceneNode *node) |
static void | FindInstances (FCDSceneNode *node, std::vector< FoundInstance > &instances, const FMMatrix44 &transform, bool onlyMarked) |
Recursively finds all entities under the current node. More... | |
bool | FindSingleInstance (FCDSceneNode *node, FCDEntityInstance *&instance, FMMatrix44 &transform) |
Tries to find a single suitable entity instance in the scene. More... | |
static bool | ReverseSortWeight (const FCDJointWeightPair &a, const FCDJointWeightPair &b) |
void | SkinReduceInfluences (FCDSkinController *skin, size_t maxInfluenceCount, float minimumWeight) |
Like FCDSkinController::ReduceInfluences but works correctly. More... | |
void | FixSkeletonRoots (FCDControllerInstance &controllerInstance) |
Fixes some occasional problems with the skeleton root definitions in a controller. More... | |
const Skeleton & | FindSkeleton (const FCDControllerInstance &controllerInstance) |
Finds the skeleton definition which best matches the given controller. More... | |
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's coordinate space. More... | |
Variables | |
static float | identity [] = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 } |
void errorHandler | ( | void * | ctx, |
const char * | msg, | ||
... | |||
) |
Error handler for libxml2.
|
static |
Recursively finds all entities under the current node.
If onlyMarked is set, only matches entities where the user-defined property was set to "export" in the modelling program.
node | root of subtree to search |
instances | output - appends matching entities |
transform | transform matrix of current subtree |
onlyMarked | only match entities with "export" property |
bool FindSingleInstance | ( | FCDSceneNode * | node, |
FCDEntityInstance *& | instance, | ||
FMMatrix44 & | transform | ||
) |
Tries to find a single suitable entity instance in the scene.
Fails if there are none, or if there are too many and it's not clear which one should be converted.
node | root scene node to search under |
instance | output - the found entity instance (if any) |
transform | - the world-space transform of the found entity |
const Skeleton & FindSkeleton | ( | const FCDControllerInstance & | controllerInstance | ) |
Finds the skeleton definition which best matches the given controller.
ColladaException | if none is found. |
void FixSkeletonRoots | ( | FCDControllerInstance & | controllerInstance | ) |
Fixes some occasional problems with the skeleton root definitions in a controller.
(In particular, it's needed for models exported from XSI.) Should be called before extracting any joint information from the controller.
FMMatrix44 FMMatrix44_Identity | ( | identity | ) |
const FMVector3 FMVector3_XAxis | ( | 1. | 0f, |
0. | 0f, | ||
0. | 0f | ||
) |
|
static |
|
static |
void require_ | ( | int | line, |
bool | value, | ||
const char * | type, | ||
const char * | message | ||
) |
|
static |
void SkinReduceInfluences | ( | FCDSkinController * | skin, |
size_t | maxInfluenceCount, | ||
float | minimumWeight | ||
) |
Like FCDSkinController::ReduceInfluences but works correctly.
Additionally, multiple influences for the same joint-vertex pair are collapsed into a single influence.
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's coordinate space.
|
static |