Make objects lit by default if there is a light in the scene, and no other face infor...
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>
Wed, 1 Dec 2004 08:43:02 +0000 (08:43 +0000)
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>
Wed, 1 Dec 2004 08:43:02 +0000 (08:43 +0000)
source/gameengine/Converter/BL_BlenderDataConversion.cpp

index a716098514ae287fcbf99f23a02ec3b73008d95d..f2d9d46bf9488a2926fc2a09032365136ade28e6 100644 (file)
 #include "BL_ArmatureObject.h"
 #include "BL_DeformableGameObject.h"
 
+static int default_face_mode = TF_DYNAMIC;
+
 static unsigned int KX_rgbaint2uint_new(unsigned int icol)
 {
        union
@@ -197,6 +199,21 @@ static unsigned int KX_Mcol2uint_new(MCol col)
        return out_colour.integer;
 }
 
+static void SetDefaultFaceType(Scene* scene)
+{
+       default_face_mode = TF_DYNAMIC;
+       Base *base = static_cast<Base*>(scene->base.first);
+       while(base)
+       {
+               if (base->object->type == OB_LAMP)
+               {
+                       default_face_mode = TF_DYNAMIC|TF_LIGHT;
+                       return;
+               }
+               base = base->next;
+       }
+}
+
 RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* rendertools, KX_Scene* scene, KX_BlenderSceneConverter *converter)
 {
        RAS_MeshObject *meshobj;
@@ -332,7 +349,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
                                                // If there are no vertex colors OR texfaces,
                                                // Initialize face to white and set COLLSION true and everything else FALSE
                                                unsigned int colour = 0xFFFFFFFFL;
-                                               mode = TF_DYNAMIC;      
+                                               mode = default_face_mode;       
                                                transp = TF_SOLID;
                                                tile = 0;
                                                if (ma)
@@ -1077,6 +1094,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
                logicmgr->RegisterActionName(curAct->id.name, curAct);
        }
        
+       SetDefaultFaceType(blenderscene);
+       
        Base *base = static_cast<Base*>(blenderscene->base.first);
        while(base)
        {