Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2006-11-20 07:28:02 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2006-11-20 07:28:02 +0300
commite435fbc3c5a00e5b63c1cd2609ab6828187660d3 (patch)
tree3f1da9c51451dee55a203cd001d37f8774d2582f /source/gameengine
parent0a7c43c6e5fc7d5d75a4645eca1164cede2d03a6 (diff)
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are still used of course, but allocating, copying or freeing these arrays should be done through the CustomData API. Work in progress documentation on this is here: http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData Replaced TFace by MTFace: This is the same struct, except that it does not contain color, that now always stays separated in MCol. This was not a good design decision to begin with, and it is needed for adding multiple color layers later. Note that this does mean older Blender versions will not be able to read UV coordinates from the next release, due to an SDNA limitation. Removed DispListMesh: This now fully replaced by DerivedMesh. To provide access to arrays of vertices, edges and faces, like DispListMesh does. The semantics of the DerivedMesh.getVertArray() and similar functions were changed to return a pointer to an array if one exists, or otherwise allocate a temporary one. On releasing the DerivedMesh, this temporary array will be removed automatically. Removed ssDM and meshDM DerivedMesh backends: The ssDM backend was for DispListMesh, so that became obsolete automatically. The meshDM backend was replaced by the custom data backend, that now figures out which layers need to be modified, and only duplicates those. This changes code in many places, and overall removes 2514 lines of code. So, there's a good chance this might break some stuff, although I've been testing it for a few days now. The good news is, adding multiple color and uv layers should now become easy.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.cpp16
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderGL.h4
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.cpp4
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.h14
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp13
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp136
-rw-r--r--source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp10
-rw-r--r--source/gameengine/GamePlayer/common/GPC_PolygonMaterial.h8
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.cpp24
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.h3
-rw-r--r--source/gameengine/Ketsji/BL_Material.h10
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp10
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h5
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp14
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.h15
15 files changed, 138 insertions, 148 deletions
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index af367f1797e..da3bda0a220 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -110,8 +110,8 @@ void BL_SwapBuffers()
myswapbuffers();
}
-void BL_RenderText(int mode,const char* textstr,int textlen,struct TFace* tface,
- float v1[3],float v2[3],float v3[3],float v4[3])
+void BL_RenderText(int mode,const char* textstr,int textlen,struct MTFace* tface,
+ unsigned int *col,float v1[3],float v2[3],float v3[3],float v4[3])
{
Image* ima;
@@ -131,6 +131,8 @@ void BL_RenderText(int mode,const char* textstr,int textlen,struct TFace* tface,
characters = 0;
}
+ if(!col) glColor3f(1.0f, 1.0f, 1.0f);
+
glPushMatrix();
for (index = 0; index < characters; index++) {
// lets calculate offset stuff
@@ -140,30 +142,30 @@ void BL_RenderText(int mode,const char* textstr,int textlen,struct TFace* tface,
// character = character - ' ' + 1;
matrixGlyph(ima->ibuf, character, & centerx, &centery, &sizex, &sizey, &transx, &transy, &movex, &movey, &advance);
-
+
glBegin(GL_POLYGON);
// printf(" %c %f %f %f %f\n", character, tface->uv[0][0], tface->uv[0][1], );
// glTexCoord2f((tface->uv[0][0] - centerx) * sizex + transx, (tface->uv[0][1] - centery) * sizey + transy);
glTexCoord2f((tface->uv[0][0] - centerx) * sizex + transx, (tface->uv[0][1] - centery) * sizey + transy);
- spack(tface->col[0]);
+ if(col) spack(col[0]);
// glVertex3fv(v1);
glVertex3f(sizex * v1[0] + movex, sizey * v1[1] + movey, v1[2]);
glTexCoord2f((tface->uv[1][0] - centerx) * sizex + transx, (tface->uv[1][1] - centery) * sizey + transy);
- spack(tface->col[1]);
+ if(col) spack(col[1]);
// glVertex3fv(v2);
glVertex3f(sizex * v2[0] + movex, sizey * v2[1] + movey, v2[2]);
glTexCoord2f((tface->uv[2][0] - centerx) * sizex + transx, (tface->uv[2][1] - centery) * sizey + transy);
- spack(tface->col[2]);
+ if(col) spack(col[2]);
// glVertex3fv(v3);
glVertex3f(sizex * v3[0] + movex, sizey * v3[1] + movey, v3[2]);
if(v4) {
// glTexCoord2f((tface->uv[3][0] - centerx) * sizex + transx, 1.0 - (1.0 - tface->uv[3][1]) * sizey - transy);
glTexCoord2f((tface->uv[3][0] - centerx) * sizex + transx, (tface->uv[3][1] - centery) * sizey + transy);
- spack(tface->col[3]);
+ if(col) spack(col[3]);
// glVertex3fv(v4);
glVertex3f(sizex * v4[0] + movex, sizey * v4[1] + movey, v4[2]);
}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
index e7cc220f88c..b0f97f1a76c 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
@@ -49,8 +49,8 @@ void BL_HideMouse();
void BL_NormalMouse();
void BL_WaitMouse();
-void BL_RenderText(int mode,const char* textstr,int textlen,struct TFace* tface,
- float v1[3],float v2[3],float v3[3],float v4[3]);
+void BL_RenderText(int mode,const char* textstr,int textlen,struct MTFace* tface,
+ unsigned int *col,float v1[3],float v2[3],float v3[3],float v4[3]);
void BL_print_gamedebug_line(char* text, int xco, int yco, int width, int height);
void BL_print_gamedebug_line_padded(char* text, int xco, int yco, int width, int height);
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.cpp b/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.cpp
index df96ae55691..cdb6ce5b829 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.cpp
@@ -48,7 +48,7 @@ KX_BlenderPolyMaterial::KX_BlenderPolyMaterial(const STR_String &texname,
int lightlayer,
bool bIsTriangle,
void* clientobject,
- struct TFace* tface)
+ struct MTFace* tface)
: RAS_IPolyMaterial(texname,
false,
matname,
@@ -79,7 +79,7 @@ void KX_BlenderPolyMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cach
if ((m_drawingmode & 4)&& (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED))
{
- update_realtime_texture((struct TFace*) m_tface, rasty->GetTime());
+ update_realtime_texture((struct MTFace*) m_tface, rasty->GetTime());
set_tpage(m_tface);
rasty->EnableTextures(true);
}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.h b/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.h
index fd6d39cc8e3..1dab77cb901 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderPolyMaterial.h
@@ -35,14 +35,14 @@
#include "RAS_MaterialBucket.h"
#include "RAS_IRasterizer.h"
-struct TFace;
-extern "C" int set_tpage(TFace* tface); /* Worst hack ever */
+struct MTFace;
+extern "C" int set_tpage(MTFace* tface); /* Worst hack ever */
#if 0
class KX_BlenderPolyMaterial : public RAS_IPolyMaterial
{
/** Blender texture face structure. */
- TFace* m_tface;
+ MTFace* m_tface;
public:
@@ -58,7 +58,7 @@ public:
int lightlayer,
bool bIsTriangle,
void* clientobject,
- struct TFace* tface);
+ struct MTFace* tface);
/**
* Returns the caching information for this material,
@@ -80,20 +80,20 @@ public:
* Returns the Blender texture face structure that is used for this material.
* @return The material's texture face.
*/
- TFace* GetTFace(void) const;
+ MTFace* GetMTFace(void) const;
protected:
private:
};
-inline TFace* KX_BlenderPolyMaterial::GetTFace(void) const
+inline MTFace* KX_BlenderPolyMaterial::GetMTFace(void) const
{
return m_tface;
}
inline RAS_IPolyMaterial::TCachingInfo KX_BlenderPolyMaterial::GetCachingInfo(void) const
{
- return GetTFace();
+ return GetMTFace();
}
#endif
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
index 9ceae753908..caf3d120fab 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
@@ -256,17 +256,20 @@ void KX_BlenderRenderTools::RenderText(int mode,RAS_IPolyMaterial* polymat,float
STR_String mytext = ((CValue*)m_clientobject)->GetPropertyText("Text");
const unsigned int flag = polymat->GetFlag();
- struct TFace* tface = 0;
+ struct MTFace* tface = 0;
+ unsigned int *col = 0;
if(flag & RAS_BLENDERMAT) {
KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat);
- tface = bl_mat->GetTFace();
+ tface = bl_mat->GetMTFace();
+ col = bl_mat->GetMCol();
} else {
KX_PolygonMaterial* blenderpoly = static_cast<KX_PolygonMaterial*>(polymat);
- tface = blenderpoly->GetTFace();
+ tface = blenderpoly->GetMTFace();
+ col = blenderpoly->GetMCol();
}
- BL_RenderText( mode,mytext,mytext.Length(),tface,v1,v2,v3,v4);
+ BL_RenderText( mode,mytext,mytext.Length(),tface,col,v1,v2,v3,v4);
}
@@ -445,7 +448,7 @@ RAS_IPolyMaterial* KX_BlenderRenderTools::CreateBlenderPolyMaterial(
texname,
ba,matname,tile,tilexrep,tileyrep,mode,transparant,zsort, lightlayer
- ,bIsTriangle,clientobject,(struct TFace*)tface);*/
+ ,bIsTriangle,clientobject,(struct MTFace*)tface);*/
return NULL;
}
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 0399d4e61c1..b0986aeca50 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -227,7 +227,6 @@ static void GetRGB(short type,
MFace* mface,
MCol* mmcol,
Material *mat,
- TFace *tface,
unsigned int &c0,
unsigned int &c1,
unsigned int &c2,
@@ -236,7 +235,7 @@ static void GetRGB(short type,
unsigned int colour = 0xFFFFFFFFL;
switch(type)
{
- case 0: // vertex colors?
+ case 0: // vertex colors
{
if(mmcol) {
c0 = KX_Mcol2uint_new(mmcol[0]);
@@ -244,7 +243,6 @@ static void GetRGB(short type,
c2 = KX_Mcol2uint_new(mmcol[2]);
if (mface->v4)
c3 = KX_Mcol2uint_new(mmcol[3]);
- mmcol += 4;
}else // backup white
{
c0 = KX_rgbaint2uint_new(colour);
@@ -276,26 +274,7 @@ static void GetRGB(short type,
c3 = KX_rgbaint2uint_new(colour);
} break;
- case 2: // vertex colors
- {
- if(tface ) {
- c0 = KX_rgbaint2uint_new(tface->col[0]);
- c1 = KX_rgbaint2uint_new(tface->col[1]);
- c2 = KX_rgbaint2uint_new(tface->col[2]);
-
- if (mface->v4) {
- c3 = KX_rgbaint2uint_new(tface->col[3]);
- }
- }else {
- c0 = KX_rgbaint2uint_new(colour);
- c1 = KX_rgbaint2uint_new(colour);
- c2 = KX_rgbaint2uint_new(colour);
- if (mface->v4)
- c3 = KX_rgbaint2uint_new( colour );
- }
- } break;
-
- case 3: // white
+ default: // white
{
c0 = KX_rgbaint2uint_new(colour);
c1 = KX_rgbaint2uint_new(colour);
@@ -307,20 +286,18 @@ static void GetRGB(short type,
}
// ------------------------------------
-BL_Material* ConvertMaterial( Mesh* mesh, Material *mat, TFace* tface, MFace* mface, MCol* mmcol, int lightlayer, Object* blenderobj )
+BL_Material* ConvertMaterial( Mesh* mesh, Material *mat, MTFace* tface, MFace* mface, MCol* mmcol, int lightlayer, Object* blenderobj )
{
//this needs some type of manager
BL_Material *material = new BL_Material();
int numchan = -1;
bool validmat = (mat!=0);
- bool validface = (mesh->tface && tface);
+ bool validface = (mesh->mtface && tface);
short type = 0;
if( validmat )
type = 1; // material color
- else if(mesh->tface && tface)
- type = 2; // vertex colors
material->IdMode = DEFAULT_BLENDER;
@@ -328,8 +305,8 @@ BL_Material* ConvertMaterial( Mesh* mesh, Material *mat, TFace* tface, MFace*
if(validmat) {
// use vertex colors by explicitly setting
- if(mat->mode &MA_VERTEXCOLP)
- type = 2;
+ if(mat->mode &MA_VERTEXCOLP)
+ type = 0;
// use lighting?
material->ras_mode |= ( mat->mode & MA_SHLESS )?0:USE_LIGHT;
@@ -593,7 +570,7 @@ BL_Material* ConvertMaterial( Mesh* mesh, Material *mat, TFace* tface, MFace*
material->tile = 0;
}
unsigned int rgb[4];
- GetRGB(type,mface,mmcol,mat,tface,rgb[0],rgb[1],rgb[2], rgb[3]);
+ GetRGB(type,mface,mmcol,mat,rgb[0],rgb[1],rgb[2], rgb[3]);
material->SetConversionRGB(rgb);
material->SetConversionUV(uv);
@@ -632,7 +609,7 @@ static void BL_ComputeTriTangentSpace(const MT_Vector3 &v1, const MT_Vector3 &v2
static MT_Vector4* BL_ComputeMeshTangentSpace(Mesh* mesh)
{
MFace* mface = static_cast<MFace*>(mesh->mface);
- TFace* tface = static_cast<TFace*>(mesh->tface);
+ MTFace* tface = static_cast<MTFace*>(mesh->mtface);
MT_Vector3 *tan1 = new MT_Vector3[mesh->totvert];
MT_Vector3 *tan2 = new MT_Vector3[mesh->totvert];
@@ -696,7 +673,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
int lightlayer = blenderobj->lay;
MFace* mface = static_cast<MFace*>(mesh->mface);
- TFace* tface = static_cast<TFace*>(mesh->tface);
+ MTFace* tface = static_cast<MTFace*>(mesh->mtface);
MCol* mmcol = mesh->mcol;
MT_assert(mface || mesh->totface == 0);
@@ -808,10 +785,10 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
{
ma = give_current_material(blenderobj, 1);
- Image* bima = ((mesh->tface && tface) ? (Image*) tface->tpage : NULL);
+ Image* bima = ((mesh->mtface && tface) ? (Image*) tface->tpage : NULL);
STR_String imastr =
- ((mesh->tface && tface) ?
+ ((mesh->mtface && tface) ?
(bima? (bima)->id.name : "" ) : "" );
char transp=0;
@@ -825,7 +802,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
}
- if (mesh->tface && tface)
+ if (mesh->mtface && tface)
{
// Use texface colors if available
//TF_DYNAMIC means the polygon is a collision face
@@ -839,76 +816,59 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
uv0 = MT_Point2(tface->uv[0]);
uv1 = MT_Point2(tface->uv[1]);
uv2 = MT_Point2(tface->uv[2]);
- rgb0 = KX_rgbaint2uint_new(tface->col[0]);
- rgb1 = KX_rgbaint2uint_new(tface->col[1]);
- rgb2 = KX_rgbaint2uint_new(tface->col[2]);
if (mface->v4)
- {
uv3 = MT_Point2(tface->uv[3]);
- rgb3 = KX_rgbaint2uint_new(tface->col[3]);
- }
}
- else
+ if (mmcol)
{
- //
- if (mmcol)
- {
- // Use vertex colours
- rgb0 = KX_Mcol2uint_new(mmcol[0]);
- rgb1 = KX_Mcol2uint_new(mmcol[1]);
- rgb2 = KX_Mcol2uint_new(mmcol[2]);
-
-
- if (mface->v4)
- {
- rgb3 = KX_Mcol2uint_new(mmcol[3]);
-
- }
+ // Use vertex colours
+ rgb0 = KX_Mcol2uint_new(mmcol[0]);
+ rgb1 = KX_Mcol2uint_new(mmcol[1]);
+ rgb2 = KX_Mcol2uint_new(mmcol[2]);
- mmcol += 4;
- }
- else
+ if (mface->v4)
+ rgb3 = KX_Mcol2uint_new(mmcol[3]);
+ }
+ else
+ {
+ // If there are no vertex colors OR texfaces,
+ // Initialize face to white and set COLLSION true and everything else FALSE
+ unsigned int colour = 0xFFFFFFFFL;
+ mode = default_face_mode;
+ transp = TF_SOLID;
+ tile = 0;
+ if (ma)
{
- // If there are no vertex colors OR texfaces,
- // Initialize face to white and set COLLSION true and everything else FALSE
- unsigned int colour = 0xFFFFFFFFL;
- mode = default_face_mode;
- transp = TF_SOLID;
- tile = 0;
- if (ma)
+ // If we have a material, take the default colour from the material.
+ union
{
- // If we have a material, take the default colour from the material.
- union
- {
- unsigned char cp[4];
- unsigned int integer;
- } col_converter;
-
- col_converter.cp[3] = (unsigned char) (ma->r*255.0);
- col_converter.cp[2] = (unsigned char) (ma->g*255.0);
- col_converter.cp[1] = (unsigned char) (ma->b*255.0);
- col_converter.cp[0] = (unsigned char) (ma->alpha*255.0);
-
- colour = col_converter.integer;
- }
+ unsigned char cp[4];
+ unsigned int integer;
+ } col_converter;
- rgb0 = KX_rgbaint2uint_new(colour);
- rgb1 = KX_rgbaint2uint_new(colour);
- rgb2 = KX_rgbaint2uint_new(colour);
+ col_converter.cp[3] = (unsigned char) (ma->r*255.0);
+ col_converter.cp[2] = (unsigned char) (ma->g*255.0);
+ col_converter.cp[1] = (unsigned char) (ma->b*255.0);
+ col_converter.cp[0] = (unsigned char) (ma->alpha*255.0);
- if (mface->v4)
- rgb3 = KX_rgbaint2uint_new(colour);
+ colour = col_converter.integer;
}
- }
+ rgb0 = KX_rgbaint2uint_new(colour);
+ rgb1 = KX_rgbaint2uint_new(colour);
+ rgb2 = KX_rgbaint2uint_new(colour);
+
+ if (mface->v4)
+ rgb3 = KX_rgbaint2uint_new(colour);
+ }
bool istriangle = (mface->v4==0);
bool zsort = ma?(ma->mode & MA_ZTRA) != 0:false;
polymat = new KX_PolygonMaterial(imastr, ma,
tile, tilexrep, tileyrep,
- mode, transp, zsort, lightlayer, istriangle, blenderobj, tface);
+ mode, transp, zsort, lightlayer, istriangle, blenderobj, tface, (unsigned int*)mmcol);
if (ma)
{
@@ -985,6 +945,8 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
}
if (tface)
tface++;
+ if (mmcol)
+ mmcol+=4;
}
meshobj->UpdateMaterialList();
diff --git a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp
index 9cad9fcf932..97cf89e963f 100644
--- a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.cpp
@@ -115,11 +115,11 @@ static void my_make_repbind(Image *ima)
}
}
-extern "C" int set_tpage(TFace *tface);
+extern "C" int set_tpage(MTFace *tface);
-int set_tpage(TFace *tface)
+int set_tpage(MTFace *tface)
{
- static TFace *lasttface= 0;
+ static MTFace *lasttface= 0;
Image *ima;
unsigned int *rect, *bind;
int tpx, tpy, tilemode, tileXRep,tileYRep;
@@ -368,7 +368,7 @@ GPC_PolygonMaterial::GPC_PolygonMaterial(const STR_String& texname, bool ba, con
int tile, int tileXrep, int tileYrep, int mode, bool transparant, bool zsort,
int lightlayer, bool bIsTriangle, void* clientobject, void* tpage) :
RAS_IPolyMaterial(texname, ba, matname, tile, tileXrep, tileYrep, mode,
- transparant, zsort, lightlayer, bIsTriangle, clientobject), m_tface((struct TFace*)tpage)
+ transparant, zsort, lightlayer, bIsTriangle, clientobject), m_tface((struct MTFace*)tpage)
{
// clear local caching info
my_set_tpage(0);
@@ -392,7 +392,7 @@ void GPC_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& caching
if ((m_drawingmode & 4)&& (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) )
{
- update_realtime_texture((struct TFace*) m_tface, rasty->GetTime());
+ update_realtime_texture((struct MTFace*) m_tface, rasty->GetTime());
my_set_tpage(m_tface);
rasty->EnableTextures(true);
} else
diff --git a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.h b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.h
index a091ec6eea4..d9aa3ca4b7e 100644
--- a/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.h
+++ b/source/gameengine/GamePlayer/common/GPC_PolygonMaterial.h
@@ -43,7 +43,7 @@ namespace GPC_PolygonMaterial
#if 0
class GPC_PolygonMaterial : public RAS_IPolyMaterial
{
- struct TFace* m_tface;
+ struct MTFace* m_tface;
public:
GPC_PolygonMaterial(const STR_String& texname, bool ba, const STR_String& matname,
@@ -72,20 +72,20 @@ public:
* Returns the Blender texture face structure that is used for this material.
* @return The material's texture face.
*/
- TFace* GetTFace(void) const;
+ MTFace* GetMTFace(void) const;
static void SetMipMappingEnabled(bool enabled = false);
};
-inline TFace* GPC_PolygonMaterial::GetTFace(void) const
+inline MTFace* GPC_PolygonMaterial::GetMTFace(void) const
{
return m_tface;
}
inline GPC_PolygonMaterial::TCachingInfo GPC_PolygonMaterial::GetCachingInfo(void) const
{
- return GetTFace();
+ return GetMTFace();
}
#endif
#endif // __GPC_POLYGONMATERIAL_H
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
index 43e823d59ac..59a49c05b3c 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
@@ -254,17 +254,20 @@ void GPC_RenderTools::RenderText(
STR_String mytext = ((CValue*)m_clientobject)->GetPropertyText("Text");
const unsigned int flag = polymat->GetFlag();
- struct TFace* tface = 0;
+ struct MTFace* tface = 0;
+ unsigned int* col = 0;
if(flag & RAS_BLENDERMAT) {
KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat);
- tface = bl_mat->GetTFace();
+ tface = bl_mat->GetMTFace();
+ col = bl_mat->GetMCol();
} else {
KX_PolygonMaterial* blenderpoly = static_cast<KX_PolygonMaterial*>(polymat);
- tface = blenderpoly->GetTFace();
+ tface = blenderpoly->GetMTFace();
+ col = blenderpoly->GetMCol();
}
- BL_RenderText(mode, mytext, mytext.Length(), tface, v1, v2, v3, v4);
+ BL_RenderText(mode, mytext, mytext.Length(), tface, col, v1, v2, v3, v4);
}
@@ -276,7 +279,8 @@ void GPC_RenderTools::BL_RenderText(
int mode,
const char* textstr,
int textlen,
- struct TFace* tface,
+ struct MTFace* tface,
+ unsigned int* col,
float v1[3],float v2[3],float v3[3],float v4[3])
{
struct Image* ima;
@@ -298,6 +302,8 @@ void GPC_RenderTools::BL_RenderText(
characters = 0;
}
+ if(!col) glColor3f(1.0f, 1.0f, 1.0f);
+
glPushMatrix();
for (index = 0; index < characters; index++) {
// lets calculate offset stuff
@@ -313,24 +319,24 @@ void GPC_RenderTools::BL_RenderText(
// glTexCoord2f((tface->uv[0][0] - centerx) * sizex + transx, (tface->uv[0][1] - centery) * sizey + transy);
glTexCoord2f((tface->uv[0][0] - centerx) * sizex + transx, (tface->uv[0][1] - centery) * sizey + transy);
- BL_spack(tface->col[0]);
+ if(col) BL_spack(col[0]);
// glVertex3fv(v1);
glVertex3f(sizex * v1[0] + movex, sizey * v1[1] + movey, v1[2]);
glTexCoord2f((tface->uv[1][0] - centerx) * sizex + transx, (tface->uv[1][1] - centery) * sizey + transy);
- BL_spack(tface->col[1]);
+ if(col) BL_spack(col[1]);
// glVertex3fv(v2);
glVertex3f(sizex * v2[0] + movex, sizey * v2[1] + movey, v2[2]);
glTexCoord2f((tface->uv[2][0] - centerx) * sizex + transx, (tface->uv[2][1] - centery) * sizey + transy);
- BL_spack(tface->col[2]);
+ if(col) BL_spack(col[2]);
// glVertex3fv(v3);
glVertex3f(sizex * v3[0] + movex, sizey * v3[1] + movey, v3[2]);
if(v4) {
// glTexCoord2f((tface->uv[3][0] - centerx) * sizex + transx, 1.0 - (1.0 - tface->uv[3][1]) * sizey - transy);
glTexCoord2f((tface->uv[3][0] - centerx) * sizex + transx, (tface->uv[3][1] - centery) * sizey + transy);
- BL_spack(tface->col[3]);
+ if(col) BL_spack(col[3]);
// glVertex3fv(v4);
glVertex3f(sizex * v4[0] + movex, sizey * v4[1] + movey, v4[2]);
}
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.h b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
index 3ff9479f9da..b7f73df3c34 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.h
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
@@ -157,7 +157,8 @@ protected:
int mode,
const char* textstr,
int textlen,
- struct TFace* tface,
+ struct MTFace* tface,
+ unsigned int* col,
float v1[3],float v2[3],float v3[3],float v4[3]);
void BL_spack(unsigned int ucol)
{
diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h
index dbf482e2db3..2656f0d688a 100644
--- a/source/gameengine/Ketsji/BL_Material.h
+++ b/source/gameengine/Ketsji/BL_Material.h
@@ -8,7 +8,7 @@
struct MTex;
struct Material;
struct Image;
-struct TFace;
+struct MTFace;
struct MTex;
struct Material;
struct EnvMap;
@@ -37,9 +37,6 @@ public:
class BL_Material
{
private:
- unsigned int rgb[4];
- MT_Point2 uv[4];
-
int num_users;
bool share;
@@ -76,9 +73,12 @@ public:
Material* material;
- TFace* tface;
+ MTFace* tface;
Image* img[MAXTEX];
EnvMap* cubemap[MAXTEX];
+
+ unsigned int rgb[4];
+ MT_Point2 uv[4];
void SetConversionRGB(unsigned int *rgb);
void GetConversionRGB(unsigned int *rgb);
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 195fd5bd35f..b505c9ec8dc 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -44,7 +44,7 @@ extern "C" {
#include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "DNA_image_types.h"
-#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "BKE_mesh.h"
// ------------------------------------
using namespace bgl;
@@ -118,13 +118,19 @@ KX_BlenderMaterial::~KX_BlenderMaterial()
}
-TFace* KX_BlenderMaterial::GetTFace(void) const
+MTFace* KX_BlenderMaterial::GetMTFace(void) const
{
// fonts on polys
MT_assert(mMaterial->tface);
return mMaterial->tface;
}
+unsigned int* KX_BlenderMaterial::GetMCol(void) const
+{
+ // fonts on polys
+ return mMaterial->rgb;
+}
+
void KX_BlenderMaterial::OnConstruction()
{
// for each unique material...
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 4dac7f294ec..2b1264154d0 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -14,7 +14,7 @@
#include "MT_Vector3.h"
#include "MT_Vector4.h"
-struct TFace;
+struct MTFace;
class KX_Scene;
class KX_BlenderMaterial : public PyObjectPlus, public RAS_IPolyMaterial
@@ -61,7 +61,8 @@ public:
)const;
- TFace* GetTFace(void) const;
+ MTFace* GetMTFace(void) const;
+ unsigned int* GetMCol(void) const;
// for ipos
void UpdateIPO(
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index 89c84d63913..5a15a0375dc 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -45,7 +45,7 @@ extern "C" {
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
#include "DNA_image_types.h"
-#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "IMB_imbuf_types.h"
@@ -67,7 +67,8 @@ KX_PolygonMaterial::KX_PolygonMaterial(const STR_String &texname,
int lightlayer,
bool bIsTriangle,
void* clientobject,
- struct TFace* tface,
+ struct MTFace* tface,
+ unsigned int* mcol,
PyTypeObject *T)
: PyObjectPlus(T),
RAS_IPolyMaterial(texname,
@@ -82,6 +83,7 @@ KX_PolygonMaterial::KX_PolygonMaterial(const STR_String &texname,
bIsTriangle,
clientobject),
m_tface(tface),
+ m_mcol(mcol),
m_material(material),
m_pymaterial(0),
m_pass(0)
@@ -146,7 +148,7 @@ void KX_PolygonMaterial::DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& c
if ((m_drawingmode & 4)&& (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED))
{
- update_realtime_texture((struct TFace*) m_tface, rasty->GetTime());
+ update_realtime_texture((struct MTFace*) m_tface, rasty->GetTime());
set_tpage(m_tface);
rasty->EnableTextures(true);
}
@@ -228,7 +230,7 @@ PyObject* KX_PolygonMaterial::_getattr(const STR_String& attr)
if (attr == "gl_texture")
{
- Image *ima = (Image*) m_tface->tpage;
+ Image *ima = m_tface->tpage;
int bind = 0;
if (ima)
bind = ima->bindcode;
@@ -383,7 +385,7 @@ KX_PYMETHODDEF_DOC(KX_PolygonMaterial, updateTexture, "updateTexture(tface, rast
PyObject *pyrasty, *pytface;
if (PyArg_ParseTuple(args, "O!O!", &PyCObject_Type, &pytface, &PyCObject_Type, &pyrasty))
{
- TFace *tface = (TFace*) PyCObject_AsVoidPtr(pytface);
+ MTFace *tface = (MTFace*) PyCObject_AsVoidPtr(pytface);
RAS_IRasterizer *rasty = (RAS_IRasterizer*) PyCObject_AsVoidPtr(pyrasty);
update_realtime_texture(tface, rasty->GetTime());
Py_Return;
@@ -397,7 +399,7 @@ KX_PYMETHODDEF_DOC(KX_PolygonMaterial, setTexture, "setTexture(tface)")
PyObject *pytface;
if (PyArg_ParseTuple(args, "O!", &PyCObject_Type, &pytface))
{
- TFace *tface = (TFace*) PyCObject_AsVoidPtr(pytface);
+ MTFace *tface = (MTFace*) PyCObject_AsVoidPtr(pytface);
set_tpage(tface);
Py_Return;
}
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h
index 46c60cab1f7..a9bcba98a78 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.h
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h
@@ -37,7 +37,7 @@
#include "RAS_MaterialBucket.h"
#include "RAS_IRasterizer.h"
-struct TFace;
+struct MTFace;
struct Material;
struct MTex;
@@ -52,7 +52,8 @@ class KX_PolygonMaterial : public PyObjectPlus, public RAS_IPolyMaterial
Py_Header;
private:
/** Blender texture face structure. */
- TFace* m_tface;
+ MTFace* m_tface;
+ unsigned int* m_mcol;
Material* m_material;
PyObject* m_pymaterial;
@@ -71,7 +72,8 @@ public:
int lightlayer,
bool bIsTriangle,
void* clientobject,
- struct TFace* tface,
+ struct MTFace* tface,
+ unsigned int* mcol,
PyTypeObject *T = &Type);
virtual ~KX_PolygonMaterial();
@@ -99,10 +101,15 @@ public:
* Returns the Blender texture face structure that is used for this material.
* @return The material's texture face.
*/
- TFace* GetTFace(void) const
+ MTFace* GetMTFace(void) const
{
return m_tface;
}
+
+ unsigned int* GetMCol(void) const
+ {
+ return m_mcol;
+ }
KX_PYMETHOD_DOC(KX_PolygonMaterial, updateTexture);