diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-02 02:41:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-02 02:41:55 +0400 |
commit | dee33e80970ff0b83a06b2dd5d23b8e25f7317df (patch) | |
tree | 437f98d8bc3e1d4a37cf33b2bef6090a06526fc0 /source | |
parent | 3bbf11761a78e45be465f7ebb3a7e4dfc1f9b13b (diff) |
fix [#34609] mesh.getVertex doesn't work as spected with poly.getMaterialIndex() and poly vertex indexes
revert r22906 (own old commit, was incorrectly trying to make vertex indices absolute)
Diffstat (limited to 'source')
-rw-r--r-- | source/gameengine/Ketsji/KX_PolyProxy.cpp | 10 | ||||
-rw-r--r-- | source/gameengine/Rasterizer/RAS_Polygon.cpp | 15 | ||||
-rw-r--r-- | source/gameengine/Rasterizer/RAS_Polygon.h | 1 |
3 files changed, 5 insertions, 21 deletions
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp index eaedc752201..83092c7d89c 100644 --- a/source/gameengine/Ketsji/KX_PolyProxy.cpp +++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp @@ -140,21 +140,21 @@ PyObject *KX_PolyProxy::pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *at { KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v); - return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0)); + return PyLong_FromLong(self->m_polygon->GetVertexOffset(0)); } PyObject *KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v); - return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1)); + return PyLong_FromLong(self->m_polygon->GetVertexOffset(1)); } PyObject *KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v); - return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2)); + return PyLong_FromLong(self->m_polygon->GetVertexOffset(2)); } PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) @@ -163,7 +163,7 @@ PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *at if (3 < self->m_polygon->VertexCount()) { - return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3)); + return PyLong_FromLong(self->m_polygon->GetVertexOffset(3)); } return PyLong_FromLong(0); } @@ -243,7 +243,7 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex, } if (index < m_polygon->VertexCount()) { - return PyLong_FromLong(m_polygon->GetVertexOffsetAbs(m_mesh, index)); + return PyLong_FromLong(m_polygon->GetVertexOffset(index)); } return PyLong_FromLong(0); } diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp index 74544a80efa..72e09c9667d 100644 --- a/source/gameengine/Rasterizer/RAS_Polygon.cpp +++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp @@ -34,7 +34,6 @@ #endif #include "RAS_Polygon.h" -#include "RAS_MeshObject.h" /* only for GetVertexOffsetAbs */ RAS_Polygon::RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray *darray, int numvert) { @@ -67,20 +66,6 @@ int RAS_Polygon::GetVertexOffset(int i) return m_offset[i]; } -int RAS_Polygon::GetVertexOffsetAbs(RAS_MeshObject *mesh, int i) -{ - /* hack that only works because there can only ever be 2 different - * GetDisplayArray's per mesh. if this uses a different display array to the first - * then its indices are offset. - * if support for edges is added back this would need to be changed. */ - RAS_DisplayArray* darray= mesh->GetPolygon(0)->GetDisplayArray(); - - if (m_darray != darray) - return m_offset[i] + darray->m_vertex.size(); - - return m_offset[i]; -} - /* int RAS_Polygon::GetEdgeCode() { diff --git a/source/gameengine/Rasterizer/RAS_Polygon.h b/source/gameengine/Rasterizer/RAS_Polygon.h index bc70b43286c..088bdbd6844 100644 --- a/source/gameengine/Rasterizer/RAS_Polygon.h +++ b/source/gameengine/Rasterizer/RAS_Polygon.h @@ -75,7 +75,6 @@ public: void SetVertexOffset(int i, unsigned short offset); int GetVertexOffset(int i); - int GetVertexOffsetAbs(RAS_MeshObject *mesh, int i); /* accounts for quad and tri arrays, slower, for python */ // each bit is for a visible edge, starting with bit 1 for the first edge, bit 2 for second etc. // - Not used yet! |