Index: release/scripts/ui/properties_material.py =================================================================== --- release/scripts/ui/properties_material.py (revision 34744) +++ release/scripts/ui/properties_material.py (working copy) @@ -553,7 +553,32 @@ col.prop(halo, "flare_subflare_count", text="Subflares") col.prop(halo, "flare_subflare_size", text="Subsize") +class MATERIAL_PT_gameop(MaterialButtonsPanel, bpy.types.Panel): + bl_label = "Game Options" + COMPAT_ENGINES = {'BLENDER_GAME'} + @classmethod + def poll(cls, context): + return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + game = context.material.game_options # dont use node material + + split = layout.split() + col = split.column() + col.prop(game, "two_side") + col.prop(game, "shared") + col = split.column() + col.prop(game, "text") + + row = layout.row() + row.label(text="Blend Alpha:") + row.label(text="Face Orientation:") + row = layout.row() + row.prop(game,"game_blend",text="") + row.prop(game,"face_orientation",text="") + class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): bl_label = "Physics" COMPAT_ENGINES = {'BLENDER_GAME'} @@ -562,8 +587,14 @@ def poll(cls, context): return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) + def draw_header(self, context): + game = context.material.game_options + self.layout.prop(game, "physics", text="") + def draw(self, context): layout = self.layout + game = context.material.game_options + layout.active = game.physics phys = context.material.physics # dont use node material Index: source/blender/makesdna/DNA_material_types.h =================================================================== --- source/blender/makesdna/DNA_material_types.h (revision 34744) +++ source/blender/makesdna/DNA_material_types.h (working copy) @@ -72,6 +72,15 @@ float ms_spread; } VolumeSettings; +typedef struct GameOptions { +/* Game Engine Material Options + (Old Texface Options) */ + int game_flag; + int game_blend; + int game_face_ori; + int pad1; +} GameOptions; + typedef struct Material { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ @@ -88,6 +97,7 @@ /* end synced with render_types.h */ struct VolumeSettings vol; + struct GameOptions gameopt; float fresnel_mir, fresnel_mir_i; float fresnel_tra, fresnel_tra_i; @@ -163,6 +173,28 @@ ListBase gpumaterial; /* runtime */ } Material; + +/* Material Game Options */ +// Game Options - game_flag +#define GEMAT_TwoSided 1 +#define GEMAT_Shaded 2 +#define GEMAT_Text 4 +#define GEMAT_Physics 8 + +// Blend Transparency Options - game_blend +#define GEMAT_Opaque 0 +#define GEMAT_Add 1 +#define GEMAT_Clip 2 +#define GEMAT_Alpha 3 +#define GEMAT_Alpha_Sort 4 + +// Face Orientation Options - game_face_ori +#define GEMAT_None 0 +#define GEMAT_Halo 1 +#define GEMAT_Billboard 2 +#define GEMAT_Shadow 4 + + /* **************** MATERIAL ********************* */ /* maximum number of materials per material array. Index: source/blender/makesrna/intern/rna_material.c =================================================================== --- source/blender/makesrna/intern/rna_material.c (revision 34744) +++ source/blender/makesrna/intern/rna_material.c (working copy) @@ -703,6 +703,59 @@ RNA_def_property_update(prop, 0, "rna_Material_update"); } +static void rna_def_material_gameop(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_gameblend_items[] = { + {GEMAT_Opaque, "OPAQUE", 0, "Opaque", ""}, + {GEMAT_Add, "ADD", 0, "Add", ""}, + {GEMAT_Clip, "CLIP", 0, "Alpha Clip", ""}, + {GEMAT_Alpha, "ALPHA", 0, "Alpha Blend", ""}, + {GEMAT_Alpha_Sort, "ALPHASORT", 0, "Alpha Sort", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_gameface_orientation_items[] = { + {GEMAT_None,"NONE",0,"None",""}, + {GEMAT_Halo, "HALO", 0, "Halo", ""}, + {GEMAT_Billboard, "BILLBOARD", 0, "Billboard", ""}, + {GEMAT_Shadow, "SHADOW", 0, "Shadow", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "MaterialGameOp", NULL); + RNA_def_struct_sdna(srna, "GameOptions"); + RNA_def_struct_nested(brna, srna, "Material"); + RNA_def_struct_ui_text(srna, "Material Game Options", "Game Engine settings for a Material datablock"); + + prop= RNA_def_property(srna, "two_side", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_TwoSided); /* use bitflags */ + RNA_def_property_ui_text(prop, "Two Side", "Use two side faces in Game Engine "); + + prop= RNA_def_property(srna, "shared", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Shaded); /* use bitflags */ + RNA_def_property_ui_text(prop, "Shared", "Use shared faces in Game Engine "); + + prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Text); /* use bitflags */ + RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine "); + + prop= RNA_def_property(srna, "game_blend", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "game_blend"); + RNA_def_property_enum_items(prop, prop_gameblend_items); + RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces"); + + prop= RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "game_face_ori"); + RNA_def_property_enum_items(prop, prop_gameface_orientation_items); + RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options"); + + prop= RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "game_flag", GEMAT_Physics); /* use bitflags */ + RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials "); + +} + static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; @@ -1800,6 +1853,13 @@ RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Physics", "Game physics settings"); + /* game ops */ + prop= RNA_def_property(srna, "game_options", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "gameopt"); + RNA_def_property_struct_type(prop, "MaterialGameOp"); + RNA_def_property_ui_text(prop, "Game Options", "Game material settings"); + /* nodetree */ prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); @@ -1843,6 +1903,7 @@ rna_def_material_mtex(brna); rna_def_material_strand(brna); rna_def_material_physics(brna); + rna_def_material_gameop(brna); RNA_api_material(srna); } Index: source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp =================================================================== --- source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp (revision 34744) +++ source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp (working copy) @@ -49,6 +49,7 @@ #include "KX_BlenderGL.h" // for text printing #include "KX_BlenderRenderTools.h" +#include "DNA_Material_types.h" unsigned int KX_BlenderRenderTools::m_numgllights; @@ -185,8 +186,9 @@ #8 0x0833e6ec in KX_BlenderRenderTools::applyTransform(RAS_IRasterizer*, double*, int) () */ - if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED || - objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED) + //if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED || + // objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED) + if (objectdrawmode & GEMAT_Halo || objectdrawmode & GEMAT_Billboard) { // rotate the billboard/halo //page 360/361 3D Game Engine Design, David Eberly for a discussion @@ -205,7 +207,7 @@ // get scaling of halo object MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale(); - bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned + bool screenaligned = (objectdrawmode & GEMAT_Billboard)!=0;//false; //either screen or axisaligned if (screenaligned) { up = (up - up.dot(dir) * dir).safe_normalized(); @@ -233,7 +235,7 @@ } else { - if (objectdrawmode & RAS_IPolyMaterial::SHADOW) + if (objectdrawmode & GEMAT_Shadow) { // shadow must be cast to the ground, physics system needed here! MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]); Index: source/gameengine/Converter/BL_BlenderDataConversion.cpp =================================================================== --- source/gameengine/Converter/BL_BlenderDataConversion.cpp (revision 34744) +++ source/gameengine/Converter/BL_BlenderDataConversion.cpp (working copy) @@ -866,7 +866,7 @@ if (kx_blmat == NULL) kx_blmat = new KX_BlenderMaterial(); - kx_blmat->Initialize(scene, bl_mat); + kx_blmat->Initialize(scene, bl_mat,&ma->gameopt); polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat); } else { @@ -954,7 +954,7 @@ kx_polymat = new KX_PolygonMaterial(); kx_polymat->Initialize(imastr, ma, (int)mface->mat_nr, tile, tilexrep, tileyrep, - mode, transp, alpha, zsort, lightlayer, tface, (unsigned int*)mcol); + mode, transp, alpha, zsort, lightlayer, tface, (unsigned int*)mcol,&ma->gameopt); polymat = static_cast<RAS_IPolyMaterial*>(kx_polymat); if (ma) { Index: source/gameengine/Ketsji/KX_BlenderMaterial.cpp =================================================================== --- source/gameengine/Ketsji/KX_BlenderMaterial.cpp (revision 34744) +++ source/gameengine/Ketsji/KX_BlenderMaterial.cpp (working copy) @@ -54,7 +54,8 @@ void KX_BlenderMaterial::Initialize( KX_Scene *scene, - BL_Material *data) + BL_Material *data, + GameOptions *gameopt) { RAS_IPolyMaterial::Initialize( data->texname[0], @@ -66,7 +67,9 @@ data->mode, data->transp, ((data->ras_mode &ALPHA)!=0), - ((data->ras_mode &ZSORT)!=0) + ((data->ras_mode &ZSORT)!=0), + gameopt + ); mMaterial = data; mShader = 0; Index: source/gameengine/Ketsji/KX_BlenderMaterial.h =================================================================== --- source/gameengine/Ketsji/KX_BlenderMaterial.h (revision 34744) +++ source/gameengine/Ketsji/KX_BlenderMaterial.h (working copy) @@ -33,7 +33,8 @@ KX_BlenderMaterial(); void Initialize( class KX_Scene* scene, - BL_Material* mat + BL_Material* mat, + GameOptions* gameopt ); virtual ~KX_BlenderMaterial(); Index: source/gameengine/Ketsji/KX_PolygonMaterial.cpp =================================================================== --- source/gameengine/Ketsji/KX_PolygonMaterial.cpp (revision 34744) +++ source/gameengine/Ketsji/KX_PolygonMaterial.cpp (working copy) @@ -79,7 +79,8 @@ bool zsort, int lightlayer, struct MTFace* tface, - unsigned int* mcol) + unsigned int* mcol, + struct GameOptions* game_opt) { RAS_IPolyMaterial::Initialize( texname, @@ -91,10 +92,13 @@ mode, transp, alpha, - zsort); + zsort, + game_opt); m_tface = tface; m_mcol = mcol; m_material = ma; + m_game_options = game_opt; + #ifdef WITH_PYTHON m_pymaterial = 0; #endif Index: source/gameengine/Ketsji/KX_PolygonMaterial.h =================================================================== --- source/gameengine/Ketsji/KX_PolygonMaterial.h (revision 34744) +++ source/gameengine/Ketsji/KX_PolygonMaterial.h (working copy) @@ -79,7 +79,8 @@ bool zsort, int lightlayer, struct MTFace* tface, - unsigned int* mcol); + unsigned int* mcol, + struct GameOptions* game_opt); virtual ~KX_PolygonMaterial(); Index: source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp =================================================================== --- source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp (revision 34744) +++ source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp (working copy) @@ -31,6 +31,7 @@ #include "DNA_image_types.h" #include "DNA_meshdata_types.h" +#include "DNA_material_types.h" void RAS_IPolyMaterial::Initialize( const STR_String& texname, @@ -42,7 +43,8 @@ int mode, int transp, bool alpha, - bool zsort) + bool zsort, + struct GameOptions* game_opt) { m_texturename = texname; m_materialname = matname; @@ -50,7 +52,7 @@ m_tile = tile; m_tilexrep = tilexrep; m_tileyrep = tileyrep; - m_drawingmode = mode; + m_drawingmode = mode; // PODE TIRAR DEPOIS m_transp = transp; m_alpha = alpha; m_zsort = zsort; @@ -61,6 +63,7 @@ m_specular.setValue(0.5,0.5,0.5); m_specularity = 1.0; m_diffuse.setValue(0.5,0.5,0.5); + m_game_options = game_opt; } RAS_IPolyMaterial::RAS_IPolyMaterial() @@ -76,7 +79,8 @@ m_materialindex(0), m_polymatid(0), m_flag(0), - m_multimode(0) + m_multimode(0), + m_game_options(0) { m_shininess = 35.0; m_specular = MT_Vector3(0.5,0.5,0.5); @@ -93,7 +97,8 @@ int mode, int transp, bool alpha, - bool zsort) + bool zsort, + struct GameOptions* game_opt) : m_texturename(texname), m_materialname(matname), m_tile(tile), @@ -106,7 +111,8 @@ m_materialindex(materialindex), m_polymatid(m_newpolymatid++), m_flag(0), - m_multimode(0) + m_multimode(0), + m_game_options(game_opt) { m_shininess = 35.0; m_specular = MT_Vector3(0.5,0.5,0.5); @@ -180,7 +186,8 @@ int RAS_IPolyMaterial::GetDrawingMode() const { - return m_drawingmode; + int g_face = m_game_options->game_face_ori; + return g_face; } const STR_String& RAS_IPolyMaterial::GetMaterialName() const Index: source/gameengine/Rasterizer/RAS_IPolygonMaterial.h =================================================================== --- source/gameengine/Rasterizer/RAS_IPolygonMaterial.h (revision 34744) +++ source/gameengine/Rasterizer/RAS_IPolygonMaterial.h (working copy) @@ -48,6 +48,7 @@ struct Image; struct Scene; class SCA_IScene; +struct GameOptions; enum MaterialProps { @@ -75,7 +76,7 @@ STR_HashedString m_materialname; //also needed for touchsensor int m_tile; int m_tilexrep,m_tileyrep; - int m_drawingmode; // tface->mode + int m_drawingmode; // tface->mode PODE TIRAR DEPOIS int m_transp; bool m_alpha; bool m_zsort; @@ -87,6 +88,7 @@ // will move... unsigned int m_flag;//MaterialProps int m_multimode; // sum of values + GameOptions* m_game_options; public: MT_Vector3 m_diffuse; float m_shininess; @@ -114,7 +116,9 @@ int mode, int transp, bool alpha, - bool zsort); + bool zsort, + struct GameOptions* game_opt); + void Initialize(const STR_String& texname, const STR_String& matname, int materialindex, @@ -124,7 +128,8 @@ int mode, int transp, bool alpha, - bool zsort); + bool zsort, + struct GameOptions* game_opt); virtual ~RAS_IPolyMaterial() {}; /**
Index: release/scripts/ui/properties_material.py =================================================================== --- release/scripts/ui/properties_material.py (revision 34744) +++ release/scripts/ui/properties_material.py (working copy) @@ -553,7 +553,32 @@ col.prop(halo, "flare_subflare_count", text="Subflares") col.prop(halo, "flare_subflare_size", text="Subsize") +class MATERIAL_PT_gameop(MaterialButtonsPanel, bpy.types.Panel): + bl_label = "Game Options" + COMPAT_ENGINES = {'BLENDER_GAME'} + @classmethod + def poll(cls, context): + return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + game = context.material.game_options # dont use node material + + split = layout.split() + col = split.column() + col.prop(game, "two_side") + col.prop(game, "shared") + col = split.column() + col.prop(game, "text") + + row = layout.row() + row.label(text="Blend Alpha:") + row.label(text="Face Orientation:") + row = layout.row() + row.prop(game,"game_blend",text="") + row.prop(game,"face_orientation",text="") + class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel): bl_label = "Physics" COMPAT_ENGINES = {'BLENDER_GAME'} @@ -562,8 +587,14 @@ def poll(cls, context): return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES) + def draw_header(self, context): + game = context.material.game_options + self.layout.prop(game, "physics", text="") + def draw(self, context): layout = self.layout + game = context.material.game_options + layout.active = game.physics phys = context.material.physics # dont use node material Index: source/blender/makesdna/DNA_material_types.h =================================================================== --- source/blender/makesdna/DNA_material_types.h (revision 34744) +++ source/blender/makesdna/DNA_material_types.h (working copy) @@ -72,6 +72,15 @@ float ms_spread; } VolumeSettings; +typedef struct GameOptions { +/* Game Engine Material Options + (Old Texface Options) */ + int game_flag; + int game_blend; + int game_face_ori; + int pad1; +} GameOptions; + typedef struct Material { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ @@ -88,6 +97,7 @@ /* end synced with render_types.h */ struct VolumeSettings vol; + struct GameOptions gameopt; float fresnel_mir, fresnel_mir_i; float fresnel_tra, fresnel_tra_i; @@ -163,6 +173,28 @@ ListBase gpumaterial; /* runtime */ } Material; + +/* Material Game Options */ +// Game Options - game_flag +#define GEMAT_TwoSided 1 +#define GEMAT_Shaded 2 +#define GEMAT_Text 4 +#define GEMAT_Physics 8 + +// Blend Transparency Options - game_blend +#define GEMAT_Opaque 0 +#define GEMAT_Add 1 +#define GEMAT_Clip 2 +#define GEMAT_Alpha 3 +#define GEMAT_Alpha_Sort 4 + +// Face Orientation Options - game_face_ori +#define GEMAT_None 0 +#define GEMAT_Halo 1 +#define GEMAT_Billboard 2 +#define GEMAT_Shadow 4 + + /* **************** MATERIAL ********************* */ /* maximum number of materials per material array. Index: source/blender/makesrna/intern/rna_material.c =================================================================== --- source/blender/makesrna/intern/rna_material.c (revision 34744) +++ source/blender/makesrna/intern/rna_material.c (working copy) @@ -703,6 +703,59 @@ RNA_def_property_update(prop, 0, "rna_Material_update"); } +static void rna_def_material_gameop(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_gameblend_items[] = { + {GEMAT_Opaque, "OPAQUE", 0, "Opaque", ""}, + {GEMAT_Add, "ADD", 0, "Add", ""}, + {GEMAT_Clip, "CLIP", 0, "Alpha Clip", ""}, + {GEMAT_Alpha, "ALPHA", 0, "Alpha Blend", ""}, + {GEMAT_Alpha_Sort, "ALPHASORT", 0, "Alpha Sort", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_gameface_orientation_items[] = { + {GEMAT_None,"NONE",0,"None",""}, + {GEMAT_Halo, "HALO", 0, "Halo", ""}, + {GEMAT_Billboard, "BILLBOARD", 0, "Billboard", ""}, + {GEMAT_Shadow, "SHADOW", 0, "Shadow", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "MaterialGameOp", NULL); + RNA_def_struct_sdna(srna, "GameOptions"); + RNA_def_struct_nested(brna, srna, "Material"); + RNA_def_struct_ui_text(srna, "Material Game Options", "Game Engine settings for a Material datablock"); + + prop= RNA_def_property(srna, "two_side", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_TwoSided); /* use bitflags */ + RNA_def_property_ui_text(prop, "Two Side", "Use two side faces in Game Engine "); + + prop= RNA_def_property(srna, "shared", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Shaded); /* use bitflags */ + RNA_def_property_ui_text(prop, "Shared", "Use shared faces in Game Engine "); + + prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Text); /* use bitflags */ + RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine "); + + prop= RNA_def_property(srna, "game_blend", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "game_blend"); + RNA_def_property_enum_items(prop, prop_gameblend_items); + RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces"); + + prop= RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "game_face_ori"); + RNA_def_property_enum_items(prop, prop_gameface_orientation_items); + RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options"); + + prop= RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "game_flag", GEMAT_Physics); /* use bitflags */ + RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials "); + +} + static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; @@ -1800,6 +1853,13 @@ RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Physics", "Game physics settings"); + /* game ops */ + prop= RNA_def_property(srna, "game_options", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_pointer_sdna(prop, NULL, "gameopt"); + RNA_def_property_struct_type(prop, "MaterialGameOp"); + RNA_def_property_ui_text(prop, "Game Options", "Game material settings"); + /* nodetree */ prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); @@ -1843,6 +1903,7 @@ rna_def_material_mtex(brna); rna_def_material_strand(brna); rna_def_material_physics(brna); + rna_def_material_gameop(brna); RNA_api_material(srna); } Index: source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp =================================================================== --- source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp (revision 34744) +++ source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp (working copy) @@ -49,6 +49,7 @@ #include "KX_BlenderGL.h" // for text printing #include "KX_BlenderRenderTools.h" +#include "DNA_Material_types.h" unsigned int KX_BlenderRenderTools::m_numgllights; @@ -185,8 +186,9 @@ #8 0x0833e6ec in KX_BlenderRenderTools::applyTransform(RAS_IRasterizer*, double*, int) () */ - if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED || - objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED) + //if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED || + // objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED) + if (objectdrawmode & GEMAT_Halo || objectdrawmode & GEMAT_Billboard) { // rotate the billboard/halo //page 360/361 3D Game Engine Design, David Eberly for a discussion @@ -205,7 +207,7 @@ // get scaling of halo object MT_Vector3 size = gameobj->GetSGNode()->GetLocalScale(); - bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned + bool screenaligned = (objectdrawmode & GEMAT_Billboard)!=0;//false; //either screen or axisaligned if (screenaligned) { up = (up - up.dot(dir) * dir).safe_normalized(); @@ -233,7 +235,7 @@ } else { - if (objectdrawmode & RAS_IPolyMaterial::SHADOW) + if (objectdrawmode & GEMAT_Shadow) { // shadow must be cast to the ground, physics system needed here! MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]); Index: source/gameengine/Converter/BL_BlenderDataConversion.cpp =================================================================== --- source/gameengine/Converter/BL_BlenderDataConversion.cpp (revision 34744) +++ source/gameengine/Converter/BL_BlenderDataConversion.cpp (working copy) @@ -866,7 +866,7 @@ if (kx_blmat == NULL) kx_blmat = new KX_BlenderMaterial(); - kx_blmat->Initialize(scene, bl_mat); + kx_blmat->Initialize(scene, bl_mat,&ma->gameopt); polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat); } else { @@ -954,7 +954,7 @@ kx_polymat = new KX_PolygonMaterial(); kx_polymat->Initialize(imastr, ma, (int)mface->mat_nr, tile, tilexrep, tileyrep, - mode, transp, alpha, zsort, lightlayer, tface, (unsigned int*)mcol); + mode, transp, alpha, zsort, lightlayer, tface, (unsigned int*)mcol,&ma->gameopt); polymat = static_cast<RAS_IPolyMaterial*>(kx_polymat); if (ma) { Index: source/gameengine/Ketsji/KX_BlenderMaterial.cpp =================================================================== --- source/gameengine/Ketsji/KX_BlenderMaterial.cpp (revision 34744) +++ source/gameengine/Ketsji/KX_BlenderMaterial.cpp (working copy) @@ -54,7 +54,8 @@ void KX_BlenderMaterial::Initialize( KX_Scene *scene, - BL_Material *data) + BL_Material *data, + GameOptions *gameopt) { RAS_IPolyMaterial::Initialize( data->texname[0], @@ -66,7 +67,9 @@ data->mode, data->transp, ((data->ras_mode &ALPHA)!=0), - ((data->ras_mode &ZSORT)!=0) + ((data->ras_mode &ZSORT)!=0), + gameopt + ); mMaterial = data; mShader = 0; Index: source/gameengine/Ketsji/KX_BlenderMaterial.h =================================================================== --- source/gameengine/Ketsji/KX_BlenderMaterial.h (revision 34744) +++ source/gameengine/Ketsji/KX_BlenderMaterial.h (working copy) @@ -33,7 +33,8 @@ KX_BlenderMaterial(); void Initialize( class KX_Scene* scene, - BL_Material* mat + BL_Material* mat, + GameOptions* gameopt ); virtual ~KX_BlenderMaterial(); Index: source/gameengine/Ketsji/KX_PolygonMaterial.cpp =================================================================== --- source/gameengine/Ketsji/KX_PolygonMaterial.cpp (revision 34744) +++ source/gameengine/Ketsji/KX_PolygonMaterial.cpp (working copy) @@ -79,7 +79,8 @@ bool zsort, int lightlayer, struct MTFace* tface, - unsigned int* mcol) + unsigned int* mcol, + struct GameOptions* game_opt) { RAS_IPolyMaterial::Initialize( texname, @@ -91,10 +92,13 @@ mode, transp, alpha, - zsort); + zsort, + game_opt); m_tface = tface; m_mcol = mcol; m_material = ma; + m_game_options = game_opt; + #ifdef WITH_PYTHON m_pymaterial = 0; #endif Index: source/gameengine/Ketsji/KX_PolygonMaterial.h =================================================================== --- source/gameengine/Ketsji/KX_PolygonMaterial.h (revision 34744) +++ source/gameengine/Ketsji/KX_PolygonMaterial.h (working copy) @@ -79,7 +79,8 @@ bool zsort, int lightlayer, struct MTFace* tface, - unsigned int* mcol); + unsigned int* mcol, + struct GameOptions* game_opt); virtual ~KX_PolygonMaterial(); Index: source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp =================================================================== --- source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp (revision 34744) +++ source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp (working copy) @@ -31,6 +31,7 @@ #include "DNA_image_types.h" #include "DNA_meshdata_types.h" +#include "DNA_material_types.h" void RAS_IPolyMaterial::Initialize( const STR_String& texname, @@ -42,7 +43,8 @@ int mode, int transp, bool alpha, - bool zsort) + bool zsort, + struct GameOptions* game_opt) { m_texturename = texname; m_materialname = matname; @@ -50,7 +52,7 @@ m_tile = tile; m_tilexrep = tilexrep; m_tileyrep = tileyrep; - m_drawingmode = mode; + m_drawingmode = mode; // PODE TIRAR DEPOIS m_transp = transp; m_alpha = alpha; m_zsort = zsort; @@ -61,6 +63,7 @@ m_specular.setValue(0.5,0.5,0.5); m_specularity = 1.0; m_diffuse.setValue(0.5,0.5,0.5); + m_game_options = game_opt; } RAS_IPolyMaterial::RAS_IPolyMaterial() @@ -76,7 +79,8 @@ m_materialindex(0), m_polymatid(0), m_flag(0), - m_multimode(0) + m_multimode(0), + m_game_options(0) { m_shininess = 35.0; m_specular = MT_Vector3(0.5,0.5,0.5); @@ -93,7 +97,8 @@ int mode, int transp, bool alpha, - bool zsort) + bool zsort, + struct GameOptions* game_opt) : m_texturename(texname), m_materialname(matname), m_tile(tile), @@ -106,7 +111,8 @@ m_materialindex(materialindex), m_polymatid(m_newpolymatid++), m_flag(0), - m_multimode(0) + m_multimode(0), + m_game_options(game_opt) { m_shininess = 35.0; m_specular = MT_Vector3(0.5,0.5,0.5); @@ -180,7 +186,8 @@ int RAS_IPolyMaterial::GetDrawingMode() const { - return m_drawingmode; + int g_face = m_game_options->game_face_ori; + return g_face; } const STR_String& RAS_IPolyMaterial::GetMaterialName() const Index: source/gameengine/Rasterizer/RAS_IPolygonMaterial.h =================================================================== --- source/gameengine/Rasterizer/RAS_IPolygonMaterial.h (revision 34744) +++ source/gameengine/Rasterizer/RAS_IPolygonMaterial.h (working copy) @@ -48,6 +48,7 @@ struct Image; struct Scene; class SCA_IScene; +struct GameOptions; enum MaterialProps { @@ -75,7 +76,7 @@ STR_HashedString m_materialname; //also needed for touchsensor int m_tile; int m_tilexrep,m_tileyrep; - int m_drawingmode; // tface->mode + int m_drawingmode; // tface->mode PODE TIRAR DEPOIS int m_transp; bool m_alpha; bool m_zsort; @@ -87,6 +88,7 @@ // will move... unsigned int m_flag;//MaterialProps int m_multimode; // sum of values + GameOptions* m_game_options; public: MT_Vector3 m_diffuse; float m_shininess; @@ -114,7 +116,9 @@ int mode, int transp, bool alpha, - bool zsort); + bool zsort, + struct GameOptions* game_opt); + void Initialize(const STR_String& texname, const STR_String& matname, int materialindex, @@ -124,7 +128,8 @@ int mode, int transp, bool alpha, - bool zsort); + bool zsort, + struct GameOptions* game_opt); virtual ~RAS_IPolyMaterial() {}; /**
|