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/Ketsji
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/Ketsji')
-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
5 files changed, 35 insertions, 19 deletions
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);