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>2009-08-31 07:36:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-08-31 07:36:02 +0400
commit6b3351c327771c6572ddfb3677db087b15bf06d1 (patch)
treeef4f3fc19088d0bb7a58f614e7d617944cb9ea51 /source/gameengine/Rasterizer/RAS_Polygon.cpp
parentca96a75af49910340540960e7dbc797be9b01caf (diff)
bugfix [#19254] KX_PolyProxy returns improper VertexIndex with triangles, using .getVertexIndex() and .v1, .v2, etc.
Surprising this wasn't noticed before. Any mix of quads/tris caused the face verts of either quads/tries (whichever comes last). Tested by exporting the KX_MeshProxy and re-importing as an OBJ. This fix assumes there are only 2 m_darray's per face array which is currently true, but wont be if edge support is added back.
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_Polygon.cpp')
-rw-r--r--source/gameengine/Rasterizer/RAS_Polygon.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp
index eacc1285166..87c5118c5fb 100644
--- a/source/gameengine/Rasterizer/RAS_Polygon.cpp
+++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp
@@ -31,6 +31,7 @@
#endif
#include "RAS_Polygon.h"
+#include "RAS_MeshObject.h" /* only for GetVertexOffsetAbs */
RAS_Polygon::RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray *darray, int numvert)
{
@@ -63,6 +64,20 @@ 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 incices 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()
{