Implemented KRModel::setLightMap

Implemented KRModel::getLightMap
Corrected logging bugs and crashes during fbx import pipeline

--HG--
extra : source : d3c9f1247de05d4ecb57210faa5c1809208f7a06
This commit is contained in:
2013-12-14 18:02:01 -08:00
parent 4f61b1f96b
commit e466e38501
3 changed files with 18 additions and 4 deletions

View File

@@ -105,6 +105,17 @@ float KRModel::getRimPower()
return m_rim_power; return m_rim_power;
} }
void KRModel::setLightMap(const std::string &name)
{
m_lightMap = name;
m_pLightMap = NULL;
}
std::string KRModel::getLightMap()
{
return m_lightMap;
}
void KRModel::loadModel() { void KRModel::loadModel() {
if(m_models.size() == 0) { if(m_models.size() == 0) {
std::vector<KRMesh *> models = m_pContext->getModelManager()->getModel(m_model_name.c_str()); // The model manager returns the LOD levels in sorted order, with the highest detail first std::vector<KRMesh *> models = m_pContext->getModelManager()->getModel(m_model_name.c_str()); // The model manager returns the LOD levels in sorted order, with the highest detail first

View File

@@ -66,6 +66,9 @@ public:
KRVector3 getRimColor(); KRVector3 getRimColor();
float getRimPower(); float getRimPower();
void setLightMap(const std::string &name);
std::string getLightMap();
private: private:
std::vector<KRMesh *> m_models; std::vector<KRMesh *> m_models;
unordered_map<KRMesh *, std::vector<KRBone *> > m_bones; // Outer std::map connects model to set of bones unordered_map<KRMesh *, std::vector<KRBone *> > m_bones; // Outer std::map connects model to set of bones

View File

@@ -130,7 +130,7 @@ void KRResource::LoadFbx(KRContext &context, const std::string& path)
int animation_count = pFbxScene->GetSrcObjectCount<FbxAnimStack>(); int animation_count = pFbxScene->GetSrcObjectCount<FbxAnimStack>();
for(int i = 0; i < animation_count; i++) { for(int i = 0; i < animation_count; i++) {
FbxAnimStack *animation = pFbxScene->GetSrcObject<FbxAnimStack>(i); FbxAnimStack *animation = pFbxScene->GetSrcObject<FbxAnimStack>(i);
KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, " Animation %i of %i: %s", i+1, animation_count, animation->GetName()); KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, " Animation %i of %i: %s", i+1, animation_count, animation->GetName().c_str());
KRAnimation *new_animation = LoadAnimation(context, animation); KRAnimation *new_animation = LoadAnimation(context, animation);
if(new_animation) { if(new_animation) {
context.getAnimationManager()->addAnimation(new_animation); context.getAnimationManager()->addAnimation(new_animation);
@@ -142,7 +142,7 @@ void KRResource::LoadFbx(KRContext &context, const std::string& path)
int curve_count = pFbxScene->GetSrcObjectCount<FbxAnimCurve>(); int curve_count = pFbxScene->GetSrcObjectCount<FbxAnimCurve>();
for(int i=0; i < curve_count; i++) { for(int i=0; i < curve_count; i++) {
FbxAnimCurve *curve = pFbxScene->GetSrcObject<FbxAnimCurve>(i); FbxAnimCurve *curve = pFbxScene->GetSrcObject<FbxAnimCurve>(i);
KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, " Animation Curve %i of %i: %s", i+1, curve_count, curve->GetName()); KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, " Animation Curve %i of %i: %s", i+1, curve_count, curve->GetName().c_str());
KRAnimationCurve *new_curve = LoadAnimationCurve(context, curve); KRAnimationCurve *new_curve = LoadAnimationCurve(context, curve);
if(new_curve) { if(new_curve) {
@@ -156,7 +156,7 @@ void KRResource::LoadFbx(KRContext &context, const std::string& path)
KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, "\nLoading materials..."); KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, "\nLoading materials...");
for(int i=0; i < material_count; i++) { for(int i=0; i < material_count; i++) {
FbxSurfaceMaterial *material = pFbxScene->GetSrcObject<FbxSurfaceMaterial>(i); FbxSurfaceMaterial *material = pFbxScene->GetSrcObject<FbxSurfaceMaterial>(i);
KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, " Material %i of %i: %s", i+1, material_count, material->GetName()); KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, " Material %i of %i: %s", i+1, material_count, material->GetName().c_str());
LoadMaterial(context, material); LoadMaterial(context, material);
} }
@@ -166,7 +166,7 @@ void KRResource::LoadFbx(KRContext &context, const std::string& path)
for(int i=0; i < mesh_count; i++) { for(int i=0; i < mesh_count; i++) {
FbxMesh *mesh = pFbxScene->GetSrcObject<FbxMesh>(i); FbxMesh *mesh = pFbxScene->GetSrcObject<FbxMesh>(i);
KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, " Mesh %i of %i: %s", i+1, mesh_count, mesh->GetNode()->GetName()); KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, " Mesh %i of %i: %s", i+1, mesh_count, mesh->GetNode()->GetName().c_str());
LoadMesh(context, pFbxScene, pGeometryConverter, mesh); LoadMesh(context, pFbxScene, pGeometryConverter, mesh);
} }