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:
authorCampbell Barton <ideasman42@gmail.com>2012-10-30 23:20:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-30 23:20:17 +0400
commit00acdb629254b680992f1863a1d62cd2985198af (patch)
treee29b23a247a6111dc47f508cab01e2a5d955b983 /source/gameengine
parent6bd18e357563f6b28f7cfdf6da8a032bab947172 (diff)
remove CD_POLYINDEX customdata layer:
reported as [#29376] BMESH_TODO: remove tessface CD_ORIGINDEX layer for a single mesh there could be 3 origindex mappings stored, one on the polygons and 2 on the tessfaces. (CD_POLYINDEX and CD_ORIGINDEX). as Andrew suggests, now tessfaces (which are really a cache of polygons), using origindex to point to polygons on the same derived mesh, and polygons only store the original index values.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/BL_BlenderShader.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp1
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp40
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp5
4 files changed, 36 insertions, 12 deletions
diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp
index b2dfefd9e0b..23bfd7a111b 100644
--- a/source/gameengine/Ketsji/BL_BlenderShader.cpp
+++ b/source/gameengine/Ketsji/BL_BlenderShader.cpp
@@ -6,6 +6,8 @@
#include "DNA_material_types.h"
#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
+
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_DerivedMesh.h"
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index daa74ca14c0..ff3c46cb8ab 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -54,6 +54,7 @@
#include "KX_MotionState.h" // bridge between motionstate and scenegraph node
extern "C"{
+ #include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 568c11a0be4..ce0e0dd2c5c 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -46,9 +46,11 @@ subject to the following restrictions:
#include "DNA_meshdata_types.h"
extern "C"{
-#include "BKE_cdderivedmesh.h"
+ #include "BLI_utildefines.h"
+ #include "BKE_cdderivedmesh.h"
}
+
class BP_Proxy;
///todo: fill all the empty CcdPhysicsController methods, hook them up to the btRigidBody class
@@ -1500,9 +1502,15 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
MFace *mface = dm->getTessFaceArray(dm);
numpolys = dm->getNumTessFaces(dm);
numverts = dm->getNumVerts(dm);
- int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE);
+ /* double lookup */
+ const int *index_mf_to_mpoly = (const int *)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+ const int *index_mp_to_orig = (const int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
+ if ((index_mf_to_mpoly && index_mp_to_orig) == false) {
+ index_mf_to_mpoly = index_mp_to_orig = NULL;
+ }
+
m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH;
/* Convert blender geometry into bullet mesh, need these vars for mapping */
@@ -1515,7 +1523,8 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
for (int p2=0; p2<numpolys; p2++)
{
MFace* mf = &mface[p2];
- RAS_Polygon* poly = meshobj->GetPolygon((index)? index[p2]: p2);
+ const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
+ RAS_Polygon* poly = meshobj->GetPolygon(origi);
// only add polygons that have the collision flag set
if (poly->IsCollider())
@@ -1534,7 +1543,8 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
for (int p2=0; p2<numpolys; p2++)
{
MFace* mf = &mface[p2];
- RAS_Polygon* poly= meshobj->GetPolygon((index)? index[p2]: p2);
+ const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
+ RAS_Polygon* poly= meshobj->GetPolygon(origi);
// only add polygons that have the collisionflag set
if (poly->IsCollider())
@@ -1582,7 +1592,8 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
for (int p2=0; p2<numpolys; p2++)
{
MFace* mf = &mface[p2];
- RAS_Polygon* poly= meshobj->GetPolygon((index)? index[p2]: p2);
+ const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
+ RAS_Polygon* poly= meshobj->GetPolygon(origi);
// only add polygons that have the collision flag set
if (poly->IsCollider())
@@ -1619,7 +1630,8 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
{
MFace* mf = &mface[p2];
MTFace* tf = (tface) ? &tface[p2] : NULL;
- RAS_Polygon* poly= meshobj->GetPolygon((index)? index[p2]: p2);
+ const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
+ RAS_Polygon* poly= meshobj->GetPolygon(origi);
// only add polygons that have the collisionflag set
if (poly->IsCollider())
@@ -1645,7 +1657,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
}
// m_polygonIndexArray
- *poly_index_pt= (index)? index[p2]: p2;
+ *poly_index_pt = origi;
poly_index_pt++;
// the vertex location
@@ -1688,7 +1700,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
}
// m_polygonIndexArray
- *poly_index_pt= (index)? index[p2]: p2;
+ *poly_index_pt = origi;
poly_index_pt++;
// the vertex location
@@ -1800,7 +1812,13 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
MFace *mface = dm->getTessFaceArray(dm);
numpolys = dm->getNumTessFaces(dm);
numverts = dm->getNumVerts(dm);
- int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+
+ /* double lookup */
+ const int *index_mf_to_mpoly = (const int *)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+ const int *index_mp_to_orig = (const int *)dm->getPolyDataArray(dm, CD_ORIGINDEX);
+ if ((index_mf_to_mpoly && index_mp_to_orig) == false) {
+ index_mf_to_mpoly = index_mp_to_orig = NULL;
+ }
MFace *mf;
MVert *mv;
@@ -1856,7 +1874,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
{
if (tf->mode & TF_DYNAMIC)
{
- int origi = (index)? index[i]: i;
+ int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i) : i;
if (mf->v4) {
fv_pt= quad_verts;
@@ -1915,7 +1933,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
}
for (mf= mface, i=0; i < numpolys; mf++, i++) {
- int origi = (index)? index[i]: i;
+ int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i) : i;
if (mf->v4) {
fv_pt= quad_verts;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index dc96e972217..22a700c7d2b 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -52,7 +52,10 @@
#include "DNA_material_types.h"
#include "DNA_scene_types.h"
-#include "BKE_DerivedMesh.h"
+extern "C"{
+ #include "BLI_utildefines.h"
+ #include "BKE_DerivedMesh.h"
+}
#ifndef M_PI
#define M_PI 3.14159265358979323846