diff options
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 11 | ||||
-rw-r--r-- | source/gameengine/Converter/BlenderWorldInfo.cpp | 75 | ||||
-rw-r--r-- | source/gameengine/Converter/BlenderWorldInfo.h | 78 |
3 files changed, 51 insertions, 113 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 9998f10e417..9dfad5bc0ed 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -941,15 +941,16 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, // Without checking names, we get some reuse we don't want that can cause // problems with material LoDs. - if ((meshobj = converter->FindGameMesh(mesh/*, ob->lay*/)) != NULL) { - STR_String bge_name = meshobj->GetName(); - STR_String blender_name = ((Mesh*)blenderobj->data)->id.name+2; - if (bge_name == blender_name) + if (blenderobj && ((meshobj = converter->FindGameMesh(mesh/*, ob->lay*/)) != NULL)) { + const char *bge_name = meshobj->GetName().ReadPtr(); + const char *blender_name = ((ID *)blenderobj->data)->name + 2; + if (STREQ(bge_name, blender_name)) { return meshobj; + } } // Get DerivedMesh data - DerivedMesh *dm = CDDM_from_mesh(mesh, blenderobj); + DerivedMesh *dm = CDDM_from_mesh(mesh); DM_ensure_tessface(dm); MVert *mvert = dm->getVertArray(dm); diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp index f1f264b3367..be85d89775f 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.cpp +++ b/source/gameengine/Converter/BlenderWorldInfo.cpp @@ -64,22 +64,19 @@ /* end of blender include block */ -BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World* blenderworld) +BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World *blenderworld) { - if (blenderworld) - { + if (blenderworld) { m_hasworld = true; // do we have mist? - if ((blenderworld->mode) & WO_MIST) - { + if ((blenderworld->mode) & WO_MIST) { m_hasmist = true; m_miststart = blenderworld->miststa; m_mistdistance = blenderworld->mistdist; copy_v3_v3(m_mistcolor, &blenderworld->horr); } - else - { + else { m_hasmist = false; m_miststart = 0.0; m_mistdistance = 0.0; @@ -95,53 +92,39 @@ BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World* ble linearrgb_to_srgb_v3_v3(m_ambientcolor, m_ambientcolor); } } - else - { + else { m_hasworld = false; } } - - BlenderWorldInfo::~BlenderWorldInfo() { - } - bool BlenderWorldInfo::hasWorld() { return m_hasworld; } - - bool BlenderWorldInfo::hasMist() { return m_hasmist; } - - float BlenderWorldInfo::getBackColorRed() { return m_backgroundcolor[0]; } - - float BlenderWorldInfo::getBackColorGreen() { return m_backgroundcolor[1]; -} - - +} float BlenderWorldInfo::getBackColorBlue() { return m_backgroundcolor[2]; -} - +} float BlenderWorldInfo::getAmbientColorRed() { @@ -163,28 +146,20 @@ float BlenderWorldInfo::getMistStart() return m_miststart; } - - float BlenderWorldInfo::getMistDistance() { return m_mistdistance; } - - float BlenderWorldInfo::getMistColorRed() { return m_mistcolor[0]; } - - float BlenderWorldInfo::getMistColorGreen() { return m_mistcolor[1]; -} - - +} float BlenderWorldInfo::getMistColorBlue() { @@ -198,41 +173,27 @@ void BlenderWorldInfo::setBackColor(float r, float g, float b) m_backgroundcolor[2] = b; } - void -BlenderWorldInfo::setMistStart( - float d -) { +void BlenderWorldInfo::setMistStart(float d) +{ m_miststart = d; } - - void -BlenderWorldInfo::setMistDistance( - float d -) { +void BlenderWorldInfo::setMistDistance(float d) +{ m_mistdistance = d; } - - void -BlenderWorldInfo::setMistColorRed( - float d -) { +void BlenderWorldInfo::setMistColorRed(float d) +{ m_mistcolor[0] = d; } - - void -BlenderWorldInfo::setMistColorGreen( - float d -) { +void BlenderWorldInfo::setMistColorGreen(float d) +{ m_mistcolor[1] = d; } - - void -BlenderWorldInfo::setMistColorBlue( - float d -) { +void BlenderWorldInfo::setMistColorBlue(float d) +{ m_mistcolor[2] = d; } diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h index af535d65d62..2ac2d70b5d1 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.h +++ b/source/gameengine/Converter/BlenderWorldInfo.h @@ -36,68 +36,44 @@ class BlenderWorldInfo : public KX_WorldInfo { - bool m_hasworld; - float m_backgroundcolor[3]; + bool m_hasworld; + float m_backgroundcolor[3]; - bool m_hasmist; - float m_miststart; - float m_mistdistance; - float m_mistcolor[3]; + bool m_hasmist; + float m_miststart; + float m_mistdistance; + float m_mistcolor[3]; - float m_ambientcolor[3]; + float m_ambientcolor[3]; public: - BlenderWorldInfo(struct Scene *blenderscene, struct World* blenderworld); + BlenderWorldInfo(struct Scene *blenderscene, struct World *blenderworld); ~BlenderWorldInfo(); - bool hasWorld(); - bool hasMist(); - float getBackColorRed(); - float getBackColorGreen(); - float getBackColorBlue(); - - float getAmbientColorRed(); - float getAmbientColorGreen(); - float getAmbientColorBlue(); + bool hasWorld(); + bool hasMist(); + float getBackColorRed(); + float getBackColorGreen(); + float getBackColorBlue(); - float getMistStart(); - float getMistDistance(); - float getMistColorRed(); - float getMistColorGreen(); - float getMistColorBlue(); + float getAmbientColorRed(); + float getAmbientColorGreen(); + float getAmbientColorBlue(); - void - setBackColor( - float r, - float g, - float b - ); - void - setMistStart( - float d - ); + float getMistStart(); + float getMistDistance(); + float getMistColorRed(); + float getMistColorGreen(); + float getMistColorBlue(); - void - setMistDistance( - float d - ); + void setBackColor(float r, float g, float b); + void setMistStart(float d); + void setMistDistance(float d); + void setMistColorRed(float d); + void setMistColorGreen(float d); + void setMistColorBlue(float d); - void - setMistColorRed( - float d - ); - void - setMistColorGreen( - float d - ); - - void - setMistColorBlue( - float d - ); - - #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:BlenderWorldInfo") #endif |