FBX Import now detects collider meshes based on prefix ("collider_")

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40195
This commit is contained in:
kearwood
2012-12-20 01:53:09 +00:00
parent 23004557fd
commit fd3a5a870c
3 changed files with 59 additions and 19 deletions

View File

@@ -31,8 +31,8 @@
#import "KREngine-common.h"
#ifndef __KREngine__KRCollider__
#define __KREngine__KRCollider__
#ifndef KRCOLLIDER_H
#define KRCOLLIDER_H
#import "KRModel.h"
#import "KRMat4.h"
@@ -65,4 +65,4 @@ private:
void loadModel();
};
#endif /* defined(__KREngine__KRCollider__) */
#endif /* defined(KRCOLLIDER_H) */

View File

@@ -34,6 +34,8 @@
#include "KRQuaternion.h"
#include "KRBone.h"
#include "KRBundle.h"
#include "KRInstance.h"
#include "KRCollider.h"
#ifdef IOS_REF
#undef IOS_REF
@@ -1152,8 +1154,14 @@ KRNode *LoadMesh(KRNode *parent_node, std::vector<KRResource *> &resources, FbxG
std::string light_map = pNode->GetName();
light_map.append("_lightmap");
KRInstance *new_instance = new KRInstance(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), light_map, 0.0f, true, false);
return new_instance;
const char *collider_prefix = "collider_";
const char *node_name = pNode->GetName();
if(strncmp(node_name, collider_prefix, strlen(collider_prefix)) == 0) {
// FINDME, HACK - Until we have a GUI, we're using prefixes to select correct object type
return new KRCollider(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName());
} else {
return new KRInstance(parent_node->getScene(), GetFbxObjectName(pNode), pSourceMesh->GetNode()->GetName(), light_map, 0.0f, true, false);
}
} else {
return NULL;
}