Paste Code
Paste Blends
Paste Images
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() {};

/**
  1. Index: release/scripts/ui/properties_material.py
  2. ===================================================================
  3. --- release/scripts/ui/properties_material.py   (revision 34744)
  4. +++ release/scripts/ui/properties_material.py   (working copy)
  5. @@ -553,7 +553,32 @@
  6.          col.prop(halo, "flare_subflare_count", text="Subflares")
  7.          col.prop(halo, "flare_subflare_size", text="Subsize")
  8.  
  9. +class MATERIAL_PT_gameop(MaterialButtonsPanel, bpy.types.Panel):
  10. +    bl_label = "Game Options"
  11. +    COMPAT_ENGINES = {'BLENDER_GAME'}
  12.  
  13. +    @classmethod
  14. +    def poll(cls, context):
  15. +         return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
  16. +
  17. +    def draw(self, context):
  18. +         layout = self.layout
  19. +         game = context.material.game_options  # dont use node material
  20. +
  21. +         split = layout.split()
  22. +         col = split.column()
  23. +         col.prop(game, "two_side")
  24. +         col.prop(game, "shared")
  25. +         col = split.column()
  26. +         col.prop(game, "text")
  27. +
  28. +         row = layout.row()
  29. +         row.label(text="Blend Alpha:")
  30. +         row.label(text="Face Orientation:")
  31. +         row = layout.row()
  32. +         row.prop(game,"game_blend",text="")
  33. +         row.prop(game,"face_orientation",text="")
  34. +
  35.  class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
  36.      bl_label = "Physics"
  37.      COMPAT_ENGINES = {'BLENDER_GAME'}
  38. @@ -562,8 +587,14 @@
  39.      def poll(cls, context):
  40.          return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
  41.  
  42. +    def draw_header(self, context):
  43. +         game = context.material.game_options
  44. +         self.layout.prop(game, "physics", text="")
  45. +
  46.      def draw(self, context):
  47.          layout = self.layout
  48. +        game = context.material.game_options
  49. +        layout.active = game.physics
  50.  
  51.          phys = context.material.physics  # dont use node material
  52.  
  53. Index: source/blender/makesdna/DNA_material_types.h
  54. ===================================================================
  55. --- source/blender/makesdna/DNA_material_types.h        (revision 34744)
  56. +++ source/blender/makesdna/DNA_material_types.h        (working copy)
  57. @@ -72,6 +72,15 @@
  58.         float ms_spread;
  59.  } VolumeSettings;
  60.  
  61. +typedef struct GameOptions {
  62. +/* Game Engine Material Options
  63. +       (Old Texface Options) */
  64. +       int game_flag;
  65. +       int game_blend;
  66. +       int game_face_ori;
  67. +       int pad1;
  68. +} GameOptions;
  69. +
  70.  typedef struct Material {
  71.         ID id;
  72.         struct AnimData *adt;   /* animation data (must be immediately after id for utilities to use it) */
  73. @@ -88,6 +97,7 @@
  74.         /* end synced with render_types.h */
  75.         
  76.         struct VolumeSettings vol;
  77. +       struct GameOptions gameopt;
  78.  
  79.         float fresnel_mir, fresnel_mir_i;
  80.         float fresnel_tra, fresnel_tra_i;
  81. @@ -163,6 +173,28 @@
  82.         ListBase gpumaterial;           /* runtime */
  83.  } Material;
  84.  
  85. +
  86. +/* Material Game Options */
  87. +// Game Options - game_flag
  88. +#define GEMAT_TwoSided 1
  89. +#define GEMAT_Shaded   2
  90. +#define GEMAT_Text             4
  91. +#define        GEMAT_Physics   8
  92. +
  93. +// Blend Transparency Options - game_blend
  94. +#define GEMAT_Opaque           0
  95. +#define GEMAT_Add                      1
  96. +#define        GEMAT_Clip                      2
  97. +#define GEMAT_Alpha                    3
  98. +#define        GEMAT_Alpha_Sort        4
  99. +
  100. +// Face Orientation Options - game_face_ori
  101. +#define GEMAT_None                     0
  102. +#define GEMAT_Halo                     1
  103. +#define GEMAT_Billboard                2
  104. +#define GEMAT_Shadow           4
  105. +
  106. +
  107.  /* **************** MATERIAL ********************* */
  108.  
  109.  /* maximum number of materials per material array.
  110. Index: source/blender/makesrna/intern/rna_material.c
  111. ===================================================================
  112. --- source/blender/makesrna/intern/rna_material.c       (revision 34744)
  113. +++ source/blender/makesrna/intern/rna_material.c       (working copy)
  114. @@ -703,6 +703,59 @@
  115.         RNA_def_property_update(prop, 0, "rna_Material_update");
  116.  }
  117.  
  118. +static void rna_def_material_gameop(BlenderRNA *brna)
  119. +{
  120. +       StructRNA *srna;
  121. +       PropertyRNA *prop;
  122. +
  123. +       static EnumPropertyItem prop_gameblend_items[] = {
  124. +               {GEMAT_Opaque, "OPAQUE", 0, "Opaque", ""},
  125. +               {GEMAT_Add, "ADD", 0, "Add", ""},
  126. +               {GEMAT_Clip, "CLIP", 0, "Alpha Clip", ""},             
  127. +               {GEMAT_Alpha, "ALPHA", 0, "Alpha Blend", ""},
  128. +               {GEMAT_Alpha_Sort, "ALPHASORT", 0, "Alpha Sort", ""},          
  129. +               {0, NULL, 0, NULL, NULL}};
  130. +
  131. +       static EnumPropertyItem prop_gameface_orientation_items[] = {
  132. +               {GEMAT_None,"NONE",0,"None",""},
  133. +               {GEMAT_Halo, "HALO", 0, "Halo", ""},
  134. +               {GEMAT_Billboard, "BILLBOARD", 0, "Billboard", ""},
  135. +               {GEMAT_Shadow, "SHADOW", 0, "Shadow", ""},             
  136. +               {0, NULL, 0, NULL, NULL}};
  137. +       
  138. +       srna= RNA_def_struct(brna, "MaterialGameOp", NULL);
  139. +       RNA_def_struct_sdna(srna, "GameOptions");
  140. +       RNA_def_struct_nested(brna, srna, "Material");
  141. +       RNA_def_struct_ui_text(srna, "Material Game Options", "Game Engine settings for a Material datablock");
  142. +       
  143. +       prop= RNA_def_property(srna, "two_side", PROP_BOOLEAN, PROP_NONE);
  144. +       RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_TwoSided); /* use bitflags */
  145. +       RNA_def_property_ui_text(prop, "Two Side", "Use two side faces in Game Engine ");
  146. +       
  147. +       prop= RNA_def_property(srna, "shared", PROP_BOOLEAN, PROP_NONE);
  148. +       RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Shaded); /* use bitflags */
  149. +       RNA_def_property_ui_text(prop, "Shared", "Use shared faces in Game Engine ");
  150. +       
  151. +       prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE);
  152. +       RNA_def_property_boolean_sdna(prop, NULL, "game_flag", GEMAT_Text); /* use bitflags */
  153. +       RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine ");
  154. +       
  155. +       prop= RNA_def_property(srna, "game_blend", PROP_ENUM, PROP_NONE);
  156. +       RNA_def_property_enum_sdna(prop, NULL, "game_blend");
  157. +       RNA_def_property_enum_items(prop, prop_gameblend_items);
  158. +       RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces");
  159. +
  160. +       prop= RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE);
  161. +       RNA_def_property_enum_sdna(prop, NULL, "game_face_ori");
  162. +       RNA_def_property_enum_items(prop, prop_gameface_orientation_items);
  163. +       RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options");
  164. +
  165. +       prop= RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE);
  166. +       RNA_def_property_boolean_negative_sdna(prop, NULL, "game_flag", GEMAT_Physics); /* use bitflags */
  167. +       RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials ");
  168. +       
  169. +}
  170. +
  171.  static void rna_def_material_colors(StructRNA *srna)
  172.  {
  173.         PropertyRNA *prop;
  174. @@ -1800,6 +1853,13 @@
  175.         RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL);
  176.         RNA_def_property_ui_text(prop, "Physics", "Game physics settings");
  177.  
  178. +       /* game ops */
  179. +       prop= RNA_def_property(srna, "game_options", PROP_POINTER, PROP_NONE);
  180. +       RNA_def_property_flag(prop, PROP_NEVER_NULL);
  181. +       RNA_def_property_pointer_sdna(prop, NULL, "gameopt");
  182. +       RNA_def_property_struct_type(prop, "MaterialGameOp");
  183. +       RNA_def_property_ui_text(prop, "Game Options", "Game material settings");
  184. +
  185.         /* nodetree */
  186.         prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
  187.         RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
  188. @@ -1843,6 +1903,7 @@
  189.         rna_def_material_mtex(brna);
  190.         rna_def_material_strand(brna);
  191.         rna_def_material_physics(brna);
  192. +       rna_def_material_gameop(brna);
  193.  
  194.         RNA_api_material(srna);
  195.  }
  196. Index: source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
  197. ===================================================================
  198. --- source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp (revision 34744)
  199. +++ source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp (working copy)
  200. @@ -49,6 +49,7 @@
  201.  
  202.  #include "KX_BlenderGL.h" // for text printing
  203.  #include "KX_BlenderRenderTools.h"
  204. +#include "DNA_Material_types.h"
  205.  
  206.  unsigned int KX_BlenderRenderTools::m_numgllights;
  207.  
  208. @@ -185,8 +186,9 @@
  209.         #8  0x0833e6ec in KX_BlenderRenderTools::applyTransform(RAS_IRasterizer*, double*, int) ()
  210.         */
  211.  
  212. -       if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED ||
  213. -               objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED)
  214. +       //if (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED ||
  215. +       //      objectdrawmode & RAS_IPolyMaterial::BILLBOARD_AXISALIGNED)
  216. +       if (objectdrawmode & GEMAT_Halo || objectdrawmode & GEMAT_Billboard)
  217.         {
  218.                 // rotate the billboard/halo
  219.                 //page 360/361 3D Game Engine Design, David Eberly for a discussion
  220. @@ -205,7 +207,7 @@
  221.                 // get scaling of halo object
  222.                 MT_Vector3  size = gameobj->GetSGNode()->GetLocalScale();
  223.                
  224. -               bool screenaligned = (objectdrawmode & RAS_IPolyMaterial::BILLBOARD_SCREENALIGNED)!=0;//false; //either screen or axisaligned
  225. +               bool screenaligned = (objectdrawmode & GEMAT_Billboard)!=0;//false; //either screen or axisaligned
  226.                 if (screenaligned)
  227.                 {
  228.                         up = (up - up.dot(dir) * dir).safe_normalized();
  229. @@ -233,7 +235,7 @@
  230.                        
  231.         } else
  232.         {
  233. -               if (objectdrawmode & RAS_IPolyMaterial::SHADOW)
  234. +               if (objectdrawmode & GEMAT_Shadow)
  235.                 {
  236.                         // shadow must be cast to the ground, physics system needed here!
  237.                         MT_Point3 frompoint(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
  238. Index: source/gameengine/Converter/BL_BlenderDataConversion.cpp
  239. ===================================================================
  240. --- source/gameengine/Converter/BL_BlenderDataConversion.cpp    (revision 34744)
  241. +++ source/gameengine/Converter/BL_BlenderDataConversion.cpp    (working copy)
  242. @@ -866,7 +866,7 @@
  243.                                 if (kx_blmat == NULL)
  244.                                         kx_blmat = new KX_BlenderMaterial();
  245.  
  246. -                               kx_blmat->Initialize(scene, bl_mat);
  247. +                               kx_blmat->Initialize(scene, bl_mat,&ma->gameopt);
  248.                                 polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat);
  249.                         }
  250.                         else {
  251. @@ -954,7 +954,7 @@
  252.                                         kx_polymat = new KX_PolygonMaterial();
  253.                                 kx_polymat->Initialize(imastr, ma, (int)mface->mat_nr,
  254.                                         tile, tilexrep, tileyrep,
  255. -                                       mode, transp, alpha, zsort, lightlayer, tface, (unsigned int*)mcol);
  256. +                                       mode, transp, alpha, zsort, lightlayer, tface, (unsigned int*)mcol,&ma->gameopt);
  257.                                 polymat = static_cast<RAS_IPolyMaterial*>(kx_polymat);
  258.         
  259.                                 if (ma) {
  260. Index: source/gameengine/Ketsji/KX_BlenderMaterial.cpp
  261. ===================================================================
  262. --- source/gameengine/Ketsji/KX_BlenderMaterial.cpp     (revision 34744)
  263. +++ source/gameengine/Ketsji/KX_BlenderMaterial.cpp     (working copy)
  264. @@ -54,7 +54,8 @@
  265.  
  266.  void KX_BlenderMaterial::Initialize(
  267.      KX_Scene *scene,
  268. -       BL_Material *data)
  269. +       BL_Material *data,
  270. +       GameOptions *gameopt)
  271.  {
  272.         RAS_IPolyMaterial::Initialize(
  273.                 data->texname[0],
  274. @@ -66,7 +67,9 @@
  275.                 data->mode,
  276.                 data->transp,
  277.                 ((data->ras_mode &ALPHA)!=0),
  278. -               ((data->ras_mode &ZSORT)!=0)
  279. +               ((data->ras_mode &ZSORT)!=0),
  280. +               gameopt
  281. +              
  282.         );
  283.         mMaterial = data;
  284.         mShader = 0;
  285. Index: source/gameengine/Ketsji/KX_BlenderMaterial.h
  286. ===================================================================
  287. --- source/gameengine/Ketsji/KX_BlenderMaterial.h       (revision 34744)
  288. +++ source/gameengine/Ketsji/KX_BlenderMaterial.h       (working copy)
  289. @@ -33,7 +33,8 @@
  290.         KX_BlenderMaterial();
  291.         void Initialize(
  292.                 class KX_Scene* scene,
  293. -               BL_Material*    mat
  294. +               BL_Material*    mat,
  295. +               GameOptions*    gameopt
  296.         );
  297.  
  298.         virtual ~KX_BlenderMaterial();
  299. Index: source/gameengine/Ketsji/KX_PolygonMaterial.cpp
  300. ===================================================================
  301. --- source/gameengine/Ketsji/KX_PolygonMaterial.cpp     (revision 34744)
  302. +++ source/gameengine/Ketsji/KX_PolygonMaterial.cpp     (working copy)
  303. @@ -79,7 +79,8 @@
  304.                 bool zsort,
  305.                 int lightlayer,
  306.                 struct MTFace* tface,
  307. -               unsigned int* mcol)
  308. +               unsigned int* mcol,
  309. +               struct GameOptions* game_opt)
  310.  {
  311.         RAS_IPolyMaterial::Initialize(
  312.                                                         texname,
  313. @@ -91,10 +92,13 @@
  314.                                                         mode,
  315.                                                         transp,
  316.                                                         alpha,
  317. -                                                       zsort);
  318. +                                                       zsort,
  319. +                                                       game_opt);
  320.         m_tface = tface;
  321.         m_mcol = mcol;
  322.         m_material = ma;
  323. +       m_game_options = game_opt;
  324. +
  325.  #ifdef WITH_PYTHON
  326.         m_pymaterial = 0;
  327.  #endif
  328. Index: source/gameengine/Ketsji/KX_PolygonMaterial.h
  329. ===================================================================
  330. --- source/gameengine/Ketsji/KX_PolygonMaterial.h       (revision 34744)
  331. +++ source/gameengine/Ketsji/KX_PolygonMaterial.h       (working copy)
  332. @@ -79,7 +79,8 @@
  333.                 bool zsort,
  334.                 int lightlayer,
  335.                 struct MTFace* tface,
  336. -               unsigned int* mcol);
  337. +               unsigned int* mcol,
  338. +               struct GameOptions* game_opt);
  339.  
  340.         virtual ~KX_PolygonMaterial();
  341.         
  342. Index: source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
  343. ===================================================================
  344. --- source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp       (revision 34744)
  345. +++ source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp       (working copy)
  346. @@ -31,6 +31,7 @@
  347.  
  348.  #include "DNA_image_types.h"
  349.  #include "DNA_meshdata_types.h"
  350. +#include "DNA_material_types.h"
  351.  
  352.  void  RAS_IPolyMaterial::Initialize(
  353.                                 const STR_String& texname,
  354. @@ -42,7 +43,8 @@
  355.                                 int mode,
  356.                                 int transp,
  357.                                 bool alpha,
  358. -                               bool zsort)
  359. +                               bool zsort,
  360. +                               struct GameOptions* game_opt)
  361.  {
  362.         m_texturename = texname;
  363.         m_materialname = matname;
  364. @@ -50,7 +52,7 @@
  365.         m_tile = tile;
  366.         m_tilexrep = tilexrep;
  367.         m_tileyrep = tileyrep;
  368. -       m_drawingmode = mode;
  369. +       m_drawingmode = mode; // PODE TIRAR DEPOIS
  370.         m_transp = transp;
  371.         m_alpha = alpha;
  372.         m_zsort = zsort;
  373. @@ -61,6 +63,7 @@
  374.         m_specular.setValue(0.5,0.5,0.5);
  375.         m_specularity = 1.0;
  376.         m_diffuse.setValue(0.5,0.5,0.5);
  377. +       m_game_options = game_opt;
  378.  }
  379.  
  380.  RAS_IPolyMaterial::RAS_IPolyMaterial()
  381. @@ -76,7 +79,8 @@
  382.                 m_materialindex(0),
  383.                 m_polymatid(0),
  384.                 m_flag(0),
  385. -               m_multimode(0)
  386. +               m_multimode(0),
  387. +               m_game_options(0)
  388.  {
  389.         m_shininess = 35.0;
  390.         m_specular = MT_Vector3(0.5,0.5,0.5);
  391. @@ -93,7 +97,8 @@
  392.                                                                          int mode,
  393.                                                                          int transp,
  394.                                                                          bool alpha,
  395. -                                                                        bool zsort)
  396. +                                                                        bool zsort,
  397. +                                                                        struct GameOptions* game_opt)
  398.                 : m_texturename(texname),
  399.                 m_materialname(matname),
  400.                 m_tile(tile),
  401. @@ -106,7 +111,8 @@
  402.                 m_materialindex(materialindex),
  403.                 m_polymatid(m_newpolymatid++),
  404.                 m_flag(0),
  405. -               m_multimode(0)
  406. +               m_multimode(0),
  407. +               m_game_options(game_opt)
  408.  {
  409.         m_shininess = 35.0;
  410.         m_specular = MT_Vector3(0.5,0.5,0.5);
  411. @@ -180,7 +186,8 @@
  412.  
  413.  int RAS_IPolyMaterial::GetDrawingMode() const
  414.  {
  415. -       return m_drawingmode;
  416. +       int g_face = m_game_options->game_face_ori;
  417. +       return g_face;
  418.  }
  419.  
  420.  const STR_String& RAS_IPolyMaterial::GetMaterialName() const
  421. Index: source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
  422. ===================================================================
  423. --- source/gameengine/Rasterizer/RAS_IPolygonMaterial.h (revision 34744)
  424. +++ source/gameengine/Rasterizer/RAS_IPolygonMaterial.h (working copy)
  425. @@ -48,6 +48,7 @@
  426.  struct Image;
  427.  struct Scene;
  428.  class SCA_IScene;
  429. +struct GameOptions;
  430.  
  431.  enum MaterialProps
  432.  {
  433. @@ -75,7 +76,7 @@
  434.         STR_HashedString                m_materialname; //also needed for touchsensor  
  435.         int                                             m_tile;
  436.         int                                             m_tilexrep,m_tileyrep;
  437. -       int                                             m_drawingmode;  // tface->mode
  438. +       int                                             m_drawingmode;  // tface->mode PODE TIRAR DEPOIS
  439.         int                                             m_transp;
  440.         bool                                    m_alpha;
  441.         bool                                    m_zsort;
  442. @@ -87,6 +88,7 @@
  443.         // will move...
  444.         unsigned int                    m_flag;//MaterialProps
  445.         int                                             m_multimode; // sum of values
  446. +       GameOptions*                    m_game_options;
  447.  public:
  448.         MT_Vector3                      m_diffuse;
  449.         float                           m_shininess;
  450. @@ -114,7 +116,9 @@
  451.                                           int mode,
  452.                                           int transp,
  453.                                           bool alpha,
  454. -                                         bool zsort);
  455. +                                         bool zsort,
  456. +                                         struct GameOptions* game_opt);
  457. +
  458.         void Initialize(const STR_String& texname,
  459.                                         const STR_String& matname,
  460.                                         int materialindex,
  461. @@ -124,7 +128,8 @@
  462.                                         int mode,
  463.                                         int transp,
  464.                                         bool alpha,
  465. -                                       bool zsort);
  466. +                                       bool zsort,
  467. +                                       struct GameOptions* game_opt);
  468.         virtual ~RAS_IPolyMaterial() {};
  469.  
  470.         /**
  471.  
go to heaven