Refactor LLDAELoader
- Many instances of null-checking if statements include both variable declaration and initialization (for scoping) - Modern(ish) C++ conventions (e.g. range-based for loops, auto keyword) - Local variable caching for array/iterator elements - const keyword for variables that should not be mutated (optimization possible) - const keyword for instance methods that should not mutate (affects LLModelLoader in one case) - Consistent usage of un/signed types for array indexing - Better readability/simplicity of branching - Consolidated extractTranslation/ViaElement logic (reusability) - Formatting - Changes based on code review
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -60,7 +60,7 @@ public:
|
||||
U32 maxJointsPerMesh,
|
||||
U32 modelLimit,
|
||||
bool preprocess);
|
||||
virtual ~LLDAELoader() ;
|
||||
virtual ~LLDAELoader();
|
||||
|
||||
virtual bool OpenFile(const std::string& filename);
|
||||
|
||||
@@ -69,28 +69,27 @@ protected:
|
||||
void processElement(daeElement* element, bool& badElement, DAE* dae, daeElement* domRoot);
|
||||
void processDomModel(LLModel* model, DAE* dae, daeElement* pRoot, domMesh* mesh, domSkin* skin);
|
||||
|
||||
material_map getMaterials(LLModel* model, domInstance_geometry* instance_geo, DAE* dae);
|
||||
LLImportMaterial profileToMaterial(domProfile_COMMON* material, DAE* dae);
|
||||
LLColor4 getDaeColor(daeElement* element);
|
||||
material_map getMaterials(LLModel* model, domInstance_geometry* instance_geo, DAE* dae) const;
|
||||
LLImportMaterial profileToMaterial(domProfile_COMMON* material, DAE* dae) const;
|
||||
LLColor4 getDaeColor(daeElement* element) const;
|
||||
|
||||
daeElement* getChildFromElement( daeElement* pElement, std::string const & name );
|
||||
daeElement* getChildFromElement(daeElement* pElement, std::string const& name);
|
||||
|
||||
bool isNodeAJoint( domNode* pNode );
|
||||
void processJointNode( domNode* pNode, std::map<std::string,LLMatrix4>& jointTransforms );
|
||||
void extractTranslation( domTranslate* pTranslate, LLMatrix4& transform );
|
||||
void extractTranslationViaElement( daeElement* pTranslateElement, LLMatrix4& transform );
|
||||
void extractTranslationViaSID( daeElement* pElement, LLMatrix4& transform );
|
||||
void buildJointToNodeMappingFromScene( daeElement* pRoot );
|
||||
void processJointToNodeMapping( domNode* pNode );
|
||||
void processChildJoints( domNode* pParentNode );
|
||||
bool isNodeAJoint(const domNode* pNode) const;
|
||||
void processJointNode(domNode* pNode, JointTransformMap& jointTransforms);
|
||||
void extractTranslation(const domTranslate* pTranslate, LLMatrix4& transform) const;
|
||||
void extractTranslationViaSID(daeElement* pElement, LLMatrix4& transform) const;
|
||||
void buildJointToNodeMappingFromScene(daeElement* pRoot);
|
||||
void processJointToNodeMapping(domNode* pNode);
|
||||
void processChildJoints(domNode* pParentNode);
|
||||
|
||||
bool verifyCount( int expected, int result );
|
||||
bool verifyCount(const size_t expected, const size_t result) const;
|
||||
|
||||
//Verify that a controller matches vertex counts
|
||||
bool verifyController( domController* pController );
|
||||
bool verifyController(const domController* pController) const;
|
||||
|
||||
static bool addVolumeFacesFromDomMesh(LLModel* model, domMesh* mesh);
|
||||
static bool createVolumeFacesFromDomMesh(LLModel* model, domMesh *mesh);
|
||||
static bool createVolumeFacesFromDomMesh(LLModel* model, domMesh* mesh);
|
||||
|
||||
static LLModel* loadModelFromDomMesh(domMesh* mesh);
|
||||
|
||||
@@ -99,11 +98,11 @@ protected:
|
||||
//
|
||||
bool loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out, U32 submodel_limit);
|
||||
|
||||
static std::string getElementLabel(daeElement *element);
|
||||
static size_t getSuffixPosition(std::string label);
|
||||
static std::string getLodlessLabel(daeElement *element);
|
||||
static std::string getElementLabel(daeElement* element);
|
||||
static size_t getSuffixPosition(const std::string label);
|
||||
static std::string getLodlessLabel(daeElement* element);
|
||||
|
||||
static std::string preprocessDAE(std::string filename);
|
||||
static std::string preprocessDAE(const std::string filename);
|
||||
|
||||
private:
|
||||
U32 mGeneratedModelLimit; // Attempt to limit amount of generated submodels
|
||||
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
//-----------------------------------------------------------------------------
|
||||
// isNodeAJoint()
|
||||
//-----------------------------------------------------------------------------
|
||||
bool isNodeAJoint(const char* name)
|
||||
bool isNodeAJoint(const char* name) const
|
||||
{
|
||||
return name != NULL && mJointMap.find(name) != mJointMap.end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user