2.5: Game Engine
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 18 Aug 2009 15:27:48 +0000 (15:27 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 18 Aug 2009 15:27:48 +0000 (15:27 +0000)
* Added Shading and Performance panels in the scene buttons,
  containing the options previously in the 2.4x game menu.
* Added show framerate/debug/physics/warnings back in game menu.
* Moved these settings from G.fileflags to scene GameData.
* Enabled Display Lists by default.
* Some other small game scene button tweaks.

15 files changed:
release/ui/buttons_game.py
release/ui/space_info.py
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/readfile.h
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/gpu/intern/gpu_material.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp

index 3158536..7334b45 100644 (file)
@@ -192,7 +192,7 @@ class SCENE_PT_game(SceneButtonsPanel):
                row.itemL()
 
 class SCENE_PT_game_player(SceneButtonsPanel):
-       __label__ = "Player"
+       __label__ = "Standalone Player"
 
        def draw(self, context):
                layout = self.layout
@@ -219,8 +219,8 @@ class SCENE_PT_game_player(SceneButtonsPanel):
                col = layout.column()
                col.itemL(text="Framing:")
                col.row().itemR(gs, "framing_type", expand=True)
-               sub = col.column()
-               sub.itemR(gs, "framing_color", text="")
+               if gs.framing_type == 'LETTERBOX':
+                       col.itemR(gs, "framing_color", text="")
 
 class SCENE_PT_game_stereo(SceneButtonsPanel):
        __label__ = "Stereo"
@@ -271,9 +271,55 @@ class SCENE_PT_game_stereo(SceneButtonsPanel):
                
                        layout.itemR(gs, "dome_text")
 
+class SCENE_PT_game_shading(SceneButtonsPanel):
+       __label__ = "Shading"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               gs = context.scene.game_data
+               layout.itemR(gs, "material_mode", expand=True)
+               if gs.material_mode == 'GLSL':
+                       split = layout.split()
+
+                       col = split.column()
+                       col.itemR(gs, "glsl_lights", text="Lights")
+                       col.itemR(gs, "glsl_shaders", text="Shaders")
+                       col.itemR(gs, "glsl_shadows", text="Shadows")
+
+                       col = split.column()
+                       col.itemR(gs, "glsl_ramps", text="Ramps")
+                       col.itemR(gs, "glsl_nodes", text="Nodes")
+                       col.itemR(gs, "glsl_extra_textures", text="Extra Textures")
+
+class SCENE_PT_game_performance(SceneButtonsPanel):
+       __label__ = "Performance"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               gs = context.scene.game_data
+
+               split = layout.split()
+
+               col = split.column()
+               col.itemL(text="Show:")
+               col.itemR(gs, "show_debug_properties", text="Debug Properties")
+               col.itemR(gs, "show_framerate_profile", text="Framerate and Profile")
+               col.itemR(gs, "show_physics_visualization", text="Physics Visualization")
+               col.itemR(gs, "deprecation_warnings")
+               col = split.column()
+               col.itemL(text="Render:")
+               col.itemR(gs, "all_frames")
+               col.itemR(gs, "display_lists")
+
 bpy.types.register(SCENE_PT_game)
 bpy.types.register(SCENE_PT_game_player)
 bpy.types.register(SCENE_PT_game_stereo)
+bpy.types.register(SCENE_PT_game_shading)
+bpy.types.register(SCENE_PT_game_performance)
 
 class WorldButtonsPanel(bpy.types.Panel):
        __space_type__ = "PROPERTIES"
index 12005ea..e0b5c77 100644 (file)
@@ -135,8 +135,17 @@ class INFO_MT_game(bpy.types.Menu):
        def draw(self, context):
                layout = self.layout
 
+               gs = context.scene.game_data
+
                layout.itemO("view3d.game_start")
 
+               layout.itemS()
+
+               layout.itemR(gs, "show_debug_properties")
+               layout.itemR(gs, "show_framerate_profile")
+               layout.itemR(gs, "show_physics_visualization")
+               layout.itemR(gs, "deprecation_warnings")
+
 class INFO_MT_render(bpy.types.Menu):
        __space_type__ = "INFO"
        __label__ = "Render"
index 4fe1eec..42ee115 100644 (file)
@@ -43,7 +43,7 @@ struct bContext;
 struct ReportList;
 
 #define BLENDER_VERSION                        250
-#define BLENDER_SUBVERSION             1
+#define BLENDER_SUBVERSION             2
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index 7ce616c..6323258 100644 (file)
@@ -126,26 +126,26 @@ typedef struct Global {
 #define G_AUTOPACK               (1 << 0)
 #define G_FILE_COMPRESS          (1 << 1)
 #define G_FILE_AUTOPLAY          (1 << 2)
-#define G_FILE_ENABLE_ALL_FRAMES (1 << 3)
-#define G_FILE_SHOW_DEBUG_PROPS  (1 << 4)
-#define G_FILE_SHOW_FRAMERATE    (1 << 5)
-#define G_FILE_SHOW_PROFILE      (1 << 6)
+#define G_FILE_ENABLE_ALL_FRAMES (1 << 3)                              /* deprecated */
+#define G_FILE_SHOW_DEBUG_PROPS  (1 << 4)                              /* deprecated */
+#define G_FILE_SHOW_FRAMERATE    (1 << 5)                              /* deprecated */
+#define G_FILE_SHOW_PROFILE      (1 << 6)                              /* deprecated */
 #define G_FILE_LOCK              (1 << 7)
 #define G_FILE_SIGN              (1 << 8)
 #define G_FIle_PUBLISH                  (1 << 9)
 #define G_FILE_NO_UI                    (1 << 10)
-#define G_FILE_GAME_TO_IPO              (1 << 11)
-#define G_FILE_GAME_MAT                         (1 << 12)
-#define G_FILE_DISPLAY_LISTS    (1 << 13)
-#define G_FILE_SHOW_PHYSICS             (1 << 14)
-#define G_FILE_GAME_MAT_GLSL    (1 << 15)
-#define G_FILE_GLSL_NO_LIGHTS   (1 << 16)
-#define G_FILE_GLSL_NO_SHADERS  (1 << 17)
-#define G_FILE_GLSL_NO_SHADOWS  (1 << 18)
-#define G_FILE_GLSL_NO_RAMPS    (1 << 19)
-#define G_FILE_GLSL_NO_NODES    (1 << 20)
-#define G_FILE_GLSL_NO_EXTRA_TEX (1 << 21)
-#define G_FILE_IGNORE_DEPRECATION_WARNINGS     (1 << 22)
+#define G_FILE_GAME_TO_IPO              (1 << 11)                              /* deprecated */
+#define G_FILE_GAME_MAT                         (1 << 12)                              /* deprecated */
+#define G_FILE_DISPLAY_LISTS    (1 << 13)                              /* deprecated */
+#define G_FILE_SHOW_PHYSICS             (1 << 14)                              /* deprecated */
+#define G_FILE_GAME_MAT_GLSL    (1 << 15)                              /* deprecated */
+#define G_FILE_GLSL_NO_LIGHTS   (1 << 16)                              /* deprecated */
+#define G_FILE_GLSL_NO_SHADERS  (1 << 17)                              /* deprecated */
+#define G_FILE_GLSL_NO_SHADOWS  (1 << 18)                              /* deprecated */
+#define G_FILE_GLSL_NO_RAMPS    (1 << 19)                              /* deprecated */
+#define G_FILE_GLSL_NO_NODES    (1 << 20)                              /* deprecated */
+#define G_FILE_GLSL_NO_EXTRA_TEX (1 << 21)                             /* deprecated */
+#define G_FILE_IGNORE_DEPRECATION_WARNINGS     (1 << 22)       /* deprecated */
 
 /* G.windowstate */
 #define G_WINDOWSTATE_USERDEF          0
index 8488d7a..2a8fd76 100644 (file)
@@ -442,6 +442,9 @@ Scene *add_scene(char *name)
        sce->gm.physubstep = 1;
        sce->gm.maxphystep = 5;
 
+       sce->gm.flag = GAME_DISPLAY_LISTS;
+       sce->gm.matmode = GAME_MAT_MULTITEX;
+
        return sce;
 }
 
index 61f6cb8..779a898 100644 (file)
@@ -5345,6 +5345,9 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
        bfd->curscene= fg->curscene;
        
        MEM_freeN(fg);
+
+       fd->globalf= bfd->globalf;
+       fd->fileflags= bfd->fileflags;
        
        return blo_nextbhead(fd, bhead);
 }
@@ -9560,6 +9563,42 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+       if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 2)) {
+               Scene *sce;
+
+               for(sce = main->scene.first; sce; sce = sce->id.next) {
+                       if(fd->fileflags & G_FILE_ENABLE_ALL_FRAMES)
+                               sce->gm.flag |= GAME_ENABLE_ALL_FRAMES;
+                       if(fd->fileflags & G_FILE_SHOW_DEBUG_PROPS)
+                               sce->gm.flag |= GAME_SHOW_DEBUG_PROPS;
+                       if(fd->fileflags & G_FILE_SHOW_FRAMERATE)
+                               sce->gm.flag |= GAME_SHOW_FRAMERATE;
+                       if(fd->fileflags & G_FILE_SHOW_PHYSICS)
+                               sce->gm.flag |= GAME_SHOW_PHYSICS;
+                       if(fd->fileflags & G_FILE_GLSL_NO_SHADOWS)
+                               sce->gm.flag |= GAME_GLSL_NO_SHADOWS;
+                       if(fd->fileflags & G_FILE_GLSL_NO_SHADERS)
+                               sce->gm.flag |= GAME_GLSL_NO_SHADERS;
+                       if(fd->fileflags & G_FILE_GLSL_NO_RAMPS)
+                               sce->gm.flag |= GAME_GLSL_NO_RAMPS;
+                       if(fd->fileflags & G_FILE_GLSL_NO_NODES)
+                               sce->gm.flag |= GAME_GLSL_NO_NODES;
+                       if(fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX)
+                               sce->gm.flag |= GAME_GLSL_NO_EXTRA_TEX;
+                       if(fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS)
+                               sce->gm.flag |= GAME_IGNORE_DEPRECATION_WARNINGS;
+
+                       if(fd->fileflags & G_FILE_GAME_MAT_GLSL)
+                               sce->gm.matmode= GAME_MAT_GLSL;
+                       else if(fd->fileflags & G_FILE_GAME_MAT)
+                               sce->gm.matmode= GAME_MAT_MULTITEX;
+                       else
+                               sce->gm.matmode= GAME_MAT_TEXFACE;
+
+                       sce->gm.flag |= GAME_DISPLAY_LISTS;
+               }
+       }
+
        /* put 2.50 compatibility code here until next subversion bump */
        {
        }
index f0e00b7..e39fefa 100644 (file)
@@ -69,6 +69,7 @@ typedef struct FileData {
        
        int fileversion;
        int id_name_offs;               /* used to retrieve ID names from (bhead+1) */
+       int globalf, fileflags; /* for do_versions patching */
        
        struct OldNewMap *datamap;
        struct OldNewMap *globmap;
index cb07796..466b55b 100644 (file)
@@ -216,8 +216,7 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
        if(ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
                return 0;
        
-       return ((G.fileflags & G_FILE_GAME_MAT) &&
-          (G.fileflags & G_FILE_GAME_MAT_GLSL) && (dt >= OB_SHADED));
+       return (scene->gm.matmode == GAME_MAT_GLSL) && (dt >= OB_SHADED);
 }
 
 static int check_material_alpha(Base *base, Mesh *me, int glsl)
index 01bc330..3140ae7 100644 (file)
@@ -1855,7 +1855,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
 /* *********************** customdata **************** */
 
 /* goes over all modes and view3d settings */
-static CustomDataMask get_viewedit_datamask(bScreen *screen, Object *ob)
+static CustomDataMask get_viewedit_datamask(bScreen *screen, Scene *scene, Object *ob)
 {
        CustomDataMask mask = CD_MASK_BAREMESH;
        ScrArea *sa;
@@ -1875,10 +1875,8 @@ static CustomDataMask get_viewedit_datamask(bScreen *screen, Object *ob)
                        if((view->drawtype == OB_TEXTURE) || ((view->drawtype == OB_SOLID) && (view->flag2 & V3D_SOLID_TEX))) {
                                mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
                                
-                               if((G.fileflags & G_FILE_GAME_MAT) &&
-                                  (G.fileflags & G_FILE_GAME_MAT_GLSL)) {
+                               if(scene->gm.matmode == GAME_MAT_GLSL)
                                        mask |= CD_MASK_ORCO;
-                               }
                        }
                }
        }
@@ -1909,7 +1907,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
        char *grid_unit= NULL;
        
        /* from now on all object derived meshes check this */
-       v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C), obact);
+       v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C), scene, obact);
        
        /* shadow buffers, before we setup matrices */
        if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
index c85e2b5..c0fb069 100644 (file)
@@ -500,7 +500,7 @@ static void ramp_diffuse_result(GPUShadeInput *shi, GPUNodeLink **diff)
        GPUMaterial *mat= shi->gpumat;
        GPUNodeLink *fac;
 
-       if(!(G.fileflags & G_FILE_GLSL_NO_RAMPS)) {
+       if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS)) {
                if(ma->ramp_col) {
                        if(ma->rampin_col==MA_RAMP_IN_RESULT) {
                                GPU_link(mat, "ramp_rgbtobw", *diff, &fac);
@@ -516,7 +516,7 @@ static void add_to_diffuse(GPUMaterial *mat, Material *ma, GPUShadeInput *shi, G
 {
        GPUNodeLink *fac, *tmp, *addcol;
        
-       if(!(G.fileflags & G_FILE_GLSL_NO_RAMPS) &&
+       if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
           ma->ramp_col && (ma->mode & MA_RAMP_COL)) {
                /* MA_RAMP_IN_RESULT is exceptional */
                if(ma->rampin_col==MA_RAMP_IN_RESULT) {
@@ -556,7 +556,7 @@ static void ramp_spec_result(GPUShadeInput *shi, GPUNodeLink **spec)
        GPUMaterial *mat= shi->gpumat;
        GPUNodeLink *fac;
 
-       if(!(G.fileflags & G_FILE_GLSL_NO_RAMPS) &&
+       if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
           ma->ramp_spec && ma->rampin_spec==MA_RAMP_IN_RESULT) {
                GPU_link(mat, "ramp_rgbtobw", *spec, &fac);
                
@@ -644,7 +644,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 
                is= inp; /* Lambert */
 
-               if(!(G.fileflags & G_FILE_GLSL_NO_SHADERS)) {
+               if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS)) {
                        if(ma->diff_shader==MA_DIFF_ORENNAYAR)
                                GPU_link(mat, "shade_diffuse_oren_nayer", inp, vn, lv, view, GPU_uniform(&ma->roughness), &is);
                        else if(ma->diff_shader==MA_DIFF_TOON)
@@ -656,7 +656,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
                }
        }
 
-       if(!(G.fileflags & G_FILE_GLSL_NO_SHADERS))
+       if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS))
                if(ma->shade_flag & MA_CUBIC)
                        GPU_link(mat, "shade_cubic", is, &is);
        
@@ -671,7 +671,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
        // done in shade_visifac now, GPU_link(mat, "mtex_value_clamp_positive", i, &i);
 
        if((ma->mode & MA_SHADOW) && GPU_lamp_has_shadow_buffer(lamp)) {
-               if(!(G.fileflags & G_FILE_GLSL_NO_SHADOWS)) {
+               if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS)) {
                        mat->dynproperty |= DYN_LAMP_PERSMAT;
 
                        GPU_link(mat, "test_shadowbuf",
@@ -700,7 +700,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
                        GPU_link(mat, "math_multiply", i, shadfac, &i);
                }
        }
-       else if((G.fileflags & G_FILE_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
+       else if((mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
                add_user_list(&mat->lamps, lamp);
                add_user_list(&lamp->materials, shi->gpumat->ma);
                return;
@@ -716,7 +716,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
                }
        }
 
-       if(G.fileflags & G_FILE_GLSL_NO_SHADERS);
+       if(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS);
        else if(!(lamp->mode & LA_NO_SPEC) && !(lamp->mode & LA_ONLYSHADOW) &&
           (GPU_link_changed(shi->spec) || ma->spec != 0.0f)) {
                if(lamp->type == LA_HEMI) {
@@ -1015,11 +1015,11 @@ static void do_material_tex(GPUShadeInput *shi)
                                if(mtex->mapto & MAP_COL)
                                        texture_rgb_blend(mat, tcol, shi->rgb, tin, colfac, mtex->blendtype, &shi->rgb);
                                
-                               if(!(G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_COLSPEC))
+                               if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_COLSPEC))
                                        texture_rgb_blend(mat, tcol, shi->specrgb, tin, colfac, mtex->blendtype, &shi->specrgb);
                        }
 
-                       if(!(G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) {
+                       if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) {
                                if(mtex->maptoneg & MAP_NORM) tex->norfac= -mtex->norfac;
                                else tex->norfac= mtex->norfac;
                                
@@ -1065,22 +1065,22 @@ static void do_material_tex(GPUShadeInput *shi)
                                                GPU_link(mat, "mtex_rgbtoint", trgb, &tin);
                                }
 
-                               if(!(G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_REF) {
+                               if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_REF) {
                                        int flip= mtex->maptoneg & MAP_REF;
                                        texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->refl, tin, varfac, mtex->blendtype, flip, &shi->refl);
                                        GPU_link(mat, "mtex_value_clamp_positive", shi->refl, &shi->refl);
                                }
-                               if(!(G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_SPEC) {
+                               if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_SPEC) {
                                        int flip= mtex->maptoneg & MAP_SPEC;
                                        texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->spec, tin, varfac, mtex->blendtype, flip, &shi->spec);
                                        GPU_link(mat, "mtex_value_clamp_positive", shi->spec, &shi->spec);
                                }
-                               if(!(G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_EMIT) {
+                               if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_EMIT) {
                                        int flip= mtex->maptoneg & MAP_EMIT;
                                        texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->emit, tin, varfac, mtex->blendtype, flip, &shi->emit);
                                        GPU_link(mat, "mtex_value_clamp_positive", shi->emit, &shi->emit);
                                }
-                               if(!(G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_HAR) {
+                               if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_HAR) {
                                        int flip= mtex->maptoneg & MAP_HAR;
                                        GPU_link(mat, "mtex_har_divide", shi->har, &shi->har);
                                        texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->har, tin, varfac, mtex->blendtype, flip, &shi->har);
@@ -1091,7 +1091,7 @@ static void do_material_tex(GPUShadeInput *shi)
                                        texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->alpha, tin, varfac, mtex->blendtype, flip, &shi->alpha);
                                        GPU_link(mat, "mtex_value_clamp", shi->alpha, &shi->alpha);
                                }
-                               if(!(G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_AMB) {
+                               if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_AMB) {
                                        int flip= mtex->maptoneg & MAP_AMB;
                                        texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->amb, tin, varfac, mtex->blendtype, flip, &shi->amb);
                                        GPU_link(mat, "mtex_value_clamp", shi->amb, &shi->amb);
@@ -1142,7 +1142,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
        if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
                GPU_material_enable_alpha(mat);
 
-       if((G.fileflags & G_FILE_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
+       if((mat->scene->gm.flag & GAME_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
                shr->combined = shi->rgb;
                shr->alpha = shi->alpha;
                GPU_link(mat, "set_rgb", shi->rgb, &shr->diff);
@@ -1251,7 +1251,7 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
        mat = GPU_material_construct_begin(ma);
        mat->scene = scene;
 
-       if(!(G.fileflags & G_FILE_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) {
+       if(!(scene->gm.flag & GAME_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) {
                ntreeGPUMaterialNodes(ma->nodetree, mat);
        }
        else {
@@ -1458,8 +1458,8 @@ void GPU_lamp_free(Object *ob)
 
 int GPU_lamp_has_shadow_buffer(GPULamp *lamp)
 {
-       return (!(G.fileflags & G_FILE_GLSL_NO_SHADOWS) &&
-               !(G.fileflags & G_FILE_GLSL_NO_LIGHTS) &&
+       return (!(lamp->scene->gm.flag & GAME_GLSL_NO_SHADOWS) &&
+               !(lamp->scene->gm.flag & GAME_GLSL_NO_LIGHTS) &&
                        lamp->tex && lamp->fb);
 }
 
index f00813b..4a3d555 100644 (file)
@@ -387,7 +387,7 @@ typedef struct GameData {
         * bit 3: (gameengine): Activity culling is enabled.
         * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling
        */
-       short mode, pad11;
+       short mode, flag, matmode, pad[3];
        short occlusionRes;             /* resolution of occlusion Z buffer in pixel */
        short physicsEngine;
        short ticrate, maxlogicstep, physubstep, maxphystep;
@@ -401,6 +401,7 @@ typedef struct GameData {
        struct GameDome dome;
        short stereoflag, stereomode, xsch, ysch; //xsch and ysch can be deleted !!!
 } GameData;
+
 #define STEREO_NOSTEREO                1
 #define STEREO_ENABLED                 2
 #define STEREO_DOME                    3
@@ -422,6 +423,25 @@ typedef struct GameData {
 #define WOPHY_ODE              4
 #define WOPHY_BULLET   5
 
+/* GameData.flag */
+#define GAME_ENABLE_ALL_FRAMES                         (1 << 1)
+#define GAME_SHOW_DEBUG_PROPS                          (1 << 2)
+#define GAME_SHOW_FRAMERATE                                    (1 << 3)
+#define GAME_SHOW_PHYSICS                                      (1 << 4)
+#define GAME_DISPLAY_LISTS                                     (1 << 5)
+#define GAME_GLSL_NO_LIGHTS                                    (1 << 6)
+#define GAME_GLSL_NO_SHADERS                           (1 << 7)
+#define GAME_GLSL_NO_SHADOWS                           (1 << 8)
+#define GAME_GLSL_NO_RAMPS                                     (1 << 9)
+#define GAME_GLSL_NO_NODES                                     (1 << 10)
+#define GAME_GLSL_NO_EXTRA_TEX                         (1 << 11)
+#define GAME_IGNORE_DEPRECATION_WARNINGS       (1 << 12)
+
+/* GameData.matmode */
+#define GAME_MAT_TEXFACE       0
+#define GAME_MAT_MULTITEX      1
+#define GAME_MAT_GLSL          2
+
 typedef struct TimeMarker {
        struct TimeMarker *next, *prev;
        int frame;
index bb66112..c8be3c7 100644 (file)
@@ -776,9 +776,9 @@ void rna_def_scene_game_data(BlenderRNA *brna)
        PropertyRNA *prop;
 
        static EnumPropertyItem framing_types_items[] ={
-               {SCE_GAMEFRAMING_BARS, "BARS", 0, "Stretch", ""},
-               {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", ""},
-               {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", ""},
+               {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", "Show the entire viewport in the display window, using bar horizontally or vertically"},
+               {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", "Show the entire viewport in the display window, viewing more horizontally or vertically"},
+               {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"},
                {0, NULL, 0, NULL, NULL}};
 
        static EnumPropertyItem dome_modes_items[] ={
@@ -801,7 +801,7 @@ void rna_def_scene_game_data(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}};
                
        static EnumPropertyItem stereo_items[] ={
-               {STEREO_NOSTEREO, "NO_STEREO", 0, "No Stereo", ""},
+               {STEREO_NOSTEREO, "NONE", 0, "None", ""},
                {STEREO_ENABLED, "STEREO", 0, "Stereo", ""},
                {STEREO_DOME, "DOME", 0, "Dome", ""},
                {0, NULL, 0, NULL, NULL}};
@@ -815,6 +815,12 @@ void rna_def_scene_game_data(BlenderRNA *brna)
                {WOPHY_BULLET, "BULLET", 0, "Bullet", ""},
                {0, NULL, 0, NULL, NULL}};
 
+       static EnumPropertyItem material_items[] ={
+               {GAME_MAT_TEXFACE, "TEXTURE_FACE", 0, "Texture Face", "Single texture face materials."},
+               {GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials."},
+               {GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders."},
+               {0, NULL, 0, NULL, NULL}};
+
        srna= RNA_def_struct(brna, "SceneGameData", NULL);
        RNA_def_struct_sdna(srna, "GameData");
        RNA_def_struct_nested(brna, srna, "Scene");
@@ -979,6 +985,74 @@ void rna_def_scene_game_data(BlenderRNA *brna)
        RNA_def_property_range(prop, 0.0, 1000.0);
        RNA_def_property_ui_text(prop, "box radius", "Radius of the activity bubble, in Manhattan length. Objects outside the box are activity-culled");
        RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       /* booleans */
+       prop= RNA_def_property(srna, "all_frames", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
+       RNA_def_property_ui_text(prop, "All Frames", "Render as many frames as possible, rather than respecting framerate.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS);
+       RNA_def_property_ui_text(prop, "Show Debug Properties", "Show properties marked for debugging while the game runs.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE);
+       RNA_def_property_ui_text(prop, "Show Framerate and Profile", "Show framerate and profiling information while the game runs.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS);
+       RNA_def_property_ui_text(prop, "Show Physics Visualization", "Show a visualization of physics bounds and interactions.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "display_lists", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS);
+       RNA_def_property_ui_text(prop, "Display Lists", "Use display lists to speed up rendering by keeping geometry on the GPU.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS);
+       RNA_def_property_ui_text(prop, "Deprecation Warnings", "Print warnings when using deprecated features in the python API.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       /* materials */
+       prop= RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "matmode");
+       RNA_def_property_enum_items(prop, material_items);
+       RNA_def_property_ui_text(prop, "Material Mode", "Material mode to use for rendering.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "glsl_lights", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS);
+       RNA_def_property_ui_text(prop, "GLSL Lights", "Use lights for GLSL rendering.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "glsl_shaders", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADERS);
+       RNA_def_property_ui_text(prop, "GLSL Shaders", "Use shaders for GLSL rendering.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "glsl_shadows", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADOWS);
+       RNA_def_property_ui_text(prop, "GLSL Shadows", "Use shadows for GLSL rendering.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "glsl_ramps", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_RAMPS);
+       RNA_def_property_ui_text(prop, "GLSL Ramps", "Use ramps for GLSL rendering.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "glsl_nodes", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_NODES);
+       RNA_def_property_ui_text(prop, "GLSL Nodes", "Use nodes for GLSL rendering.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "glsl_extra_textures", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX);
+       RNA_def_property_ui_text(prop, "GLSL Extra Textures", "Use extra textures like normal or specular maps for GLSL rendering.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
 }
 
 static void rna_def_scene_render_layer(BlenderRNA *brna)
index 4efdf04..ae46f88 100644 (file)
@@ -350,12 +350,12 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
 
                        if(GPU_extensions_minimum_support())
                                useglslmat = true;
-                       else if(G.fileflags & G_FILE_GAME_MAT_GLSL)
+                       else if(blscene->gm.matmode == GAME_MAT_GLSL)
                                usemat = false;
 
-            if(usemat && (G.fileflags & G_FILE_GAME_MAT))
+            if(usemat && (blscene->gm.matmode != GAME_MAT_TEXFACE))
                                sceneconverter->SetMaterials(true);
-                       if(useglslmat && (G.fileflags & G_FILE_GAME_MAT_GLSL))
+                       if(useglslmat && (blscene->gm.matmode == GAME_MAT_GLSL))
                                sceneconverter->SetGLSLMaterials(true);
                                        
                        KX_Scene* startscene = new KX_Scene(keyboarddevice,
index 4c824a8..c9a2e81 100644 (file)
@@ -524,16 +524,17 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
                
                // SYS_WriteCommandLineInt(syshandle, "fixedtime", 0);
                // SYS_WriteCommandLineInt(syshandle, "vertexarrays",1);                
+               GameData *gm= &m_startScene->gm;
                bool properties = (SYS_GetCommandLineInt(syshandle, "show_properties", 0) != 0);
                bool profile = (SYS_GetCommandLineInt(syshandle, "show_profile", 0) != 0);
-               bool fixedFr = (G.fileflags & G_FILE_ENABLE_ALL_FRAMES);
+               bool fixedFr = (gm->flag & GAME_ENABLE_ALL_FRAMES);
 
-               bool showPhysics = (G.fileflags & G_FILE_SHOW_PHYSICS);
+               bool showPhysics = (gm->flag & GAME_SHOW_PHYSICS);
                SYS_WriteCommandLineInt(syshandle, "show_physics", showPhysics);
 
                bool fixed_framerate= (SYS_GetCommandLineInt(syshandle, "fixed_framerate", fixedFr) != 0);
                bool frameRate = (SYS_GetCommandLineInt(syshandle, "show_framerate", 0) != 0);
-               bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", G.fileflags & G_FILE_DISPLAY_LISTS) != 0);
+               bool useLists = (SYS_GetCommandLineInt(syshandle, "displaylists", gm->flag & GAME_DISPLAY_LISTS) != 0);
                bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0);
 
                if(GLEW_ARB_multitexture && GLEW_VERSION_1_1)
@@ -541,7 +542,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
 
                if(GPU_extensions_minimum_support())
                        m_blenderglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0);
-               else if(G.fileflags & G_FILE_GAME_MAT_GLSL)
+               else if(gm->matmode == GAME_MAT_GLSL)
                        m_blendermat = false;
 
                // create the canvas, rasterizer and rendertools
@@ -671,9 +672,9 @@ bool GPG_Application::startEngine(void)
 
                //      if (always_use_expand_framing)
                //              sceneconverter->SetAlwaysUseExpandFraming(true);
-               if(m_blendermat && (G.fileflags & G_FILE_GAME_MAT))
+               if(m_blendermat && (m_startScene->gm.matmode != GAME_MAT_TEXFACE))
                        m_sceneconverter->SetMaterials(true);
-               if(m_blenderglslmat && (G.fileflags & G_FILE_GAME_MAT_GLSL))
+               if(m_blenderglslmat && (m_startScene->gm.matmode == GAME_MAT_GLSL))
                        m_sceneconverter->SetGLSLMaterials(true);
 
                KX_Scene* startscene = new KX_Scene(m_keyboard,
index 0eef33f..de3dcd0 100644 (file)
@@ -92,6 +92,7 @@ extern "C" {
 
 /* we only need this to get a list of libraries from the main struct */
 #include "DNA_ID.h"
+#include "DNA_scene_types.h"
 
 
 #include "marshal.h" /* python header for loading/saving dicts */
@@ -206,8 +207,6 @@ static PyObject* gPySendMessage(PyObject*, PyObject* args)
        Py_RETURN_NONE;
 }
 
-static bool usedsp = false;
-
 // this gets a pointer to an array filled with floats
 static PyObject* gPyGetSpectrum(PyObject*)
 {
@@ -769,17 +768,17 @@ static PyObject* gPyDisableMotionBlur(PyObject*)
 int getGLSLSettingFlag(char *setting)
 {
        if(strcmp(setting, "lights") == 0)
-               return G_FILE_GLSL_NO_LIGHTS;
+               return GAME_GLSL_NO_LIGHTS;
        else if(strcmp(setting, "shaders") == 0)
-               return G_FILE_GLSL_NO_SHADERS;
+               return GAME_GLSL_NO_SHADERS;
        else if(strcmp(setting, "shadows") == 0)
-               return G_FILE_GLSL_NO_SHADOWS;
+               return GAME_GLSL_NO_SHADOWS;
        else if(strcmp(setting, "ramps") == 0)
-               return G_FILE_GLSL_NO_RAMPS;
+               return GAME_GLSL_NO_RAMPS;
        else if(strcmp(setting, "nodes") == 0)
-               return G_FILE_GLSL_NO_NODES;
+               return GAME_GLSL_NO_NODES;
        else if(strcmp(setting, "extra_textures") == 0)
-               return G_FILE_GLSL_NO_EXTRA_TEX;
+               return GAME_GLSL_NO_EXTRA_TEX;
        else
                return -1;
 }
@@ -788,8 +787,9 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*,
                                                                                        PyObject* args,
                                                                                        PyObject*)
 {
+       GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
        char *setting;
-       int enable, flag, fileflags;
+       int enable, flag, sceneflag;
 
        if (!PyArg_ParseTuple(args,"si:setGLSLMaterialSetting",&setting,&enable))
                return NULL;
@@ -801,15 +801,15 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*,
                return NULL;
        }
 
-       fileflags = G.fileflags;
+       sceneflag= gm->flag;
        
        if (enable)
-               G.fileflags &= ~flag;
+               gm->flag &= ~flag;
        else
-               G.fileflags |= flag;
+               gm->flag |= flag;
 
        /* display lists and GLSL materials need to be remade */
-       if(G.fileflags != fileflags) {
+       if(sceneflag != gm->flag) {
                GPU_materials_free();
                if(gp_KetsjiEngine) {
                        KX_SceneList *scenes = gp_KetsjiEngine->CurrentScenes();
@@ -830,6 +830,7 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*,
                                                                         PyObject* args, 
                                                                         PyObject*)
 {
+       GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
        char *setting;
        int enabled = 0, flag;
 
@@ -843,7 +844,7 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*,
                return NULL;
        }
 
-       enabled = ((G.fileflags & flag) != 0);
+       enabled = ((gm->flag & flag) != 0);
        return PyLong_FromSsize_t(enabled);
 }
 
@@ -855,35 +856,34 @@ static PyObject* gPySetMaterialType(PyObject*,
                                                                        PyObject* args,
                                                                        PyObject*)
 {
-       int flag, type;
+       GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
+       int type;
 
        if (!PyArg_ParseTuple(args,"i:setMaterialType",&type))
                return NULL;
 
        if(type == KX_BLENDER_GLSL_MATERIAL)
-               flag = G_FILE_GAME_MAT|G_FILE_GAME_MAT_GLSL;
+               gm->matmode= GAME_MAT_GLSL;
        else if(type == KX_BLENDER_MULTITEX_MATERIAL)
-               flag = G_FILE_GAME_MAT;
+               gm->matmode= GAME_MAT_MULTITEX;
        else if(type == KX_TEXFACE_MATERIAL)
-               flag = 0;
+               gm->matmode= GAME_MAT_TEXFACE;
        else {
                PyErr_SetString(PyExc_ValueError, "Rasterizer.setMaterialType(int): material type is not known");
                return NULL;
        }
 
-       G.fileflags &= ~(G_FILE_GAME_MAT|G_FILE_GAME_MAT_GLSL);
-       G.fileflags |= flag;
-
        Py_RETURN_NONE;
 }
 
 static PyObject* gPyGetMaterialType(PyObject*)
 {
+       GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
        int flag;
 
-       if(G.fileflags & G_FILE_GAME_MAT_GLSL)
+       if(gm->matmode == GAME_MAT_GLSL)
                flag = KX_BLENDER_GLSL_MATERIAL;
-       else if(G.fileflags & G_FILE_GAME_MAT)
+       else if(gm->matmode == GAME_MAT_MULTITEX)
                flag = KX_BLENDER_MULTITEX_MATERIAL;
        else
                flag = KX_TEXFACE_MATERIAL;