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-11-10 13:45:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-10 13:45:43 +0400
commitfecc3b9d68102630fc53f451a3f405f180b31384 (patch)
tree36d2ca28db9d0eb244ee9fad921d81f5d66adcbb /source/gameengine/Rasterizer
parentf5c9f2c2530d21474f8e2ee5ea7dfdb483b7ba7d (diff)
add 2 new utility functions to the BGE mesh py api.
mesh.transform(matid, matrix) mesh.transform_uv(matid, matrix, uv_index=-1)) much more efficient then looping over verts in python to transform them.
Diffstat (limited to 'source/gameengine/Rasterizer')
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_TexVert.cpp9
-rw-r--r--source/gameengine/Rasterizer/RAS_TexVert.h2
3 files changed, 13 insertions, 0 deletions
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
index 16ecffb9a32..4c72f128817 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
@@ -189,6 +189,8 @@ class RAS_MeshMaterial
public:
RAS_MeshSlot *m_baseslot;
class RAS_MaterialBucket *m_bucket;
+
+ /* the KX_GameObject is used as a key here */
CTR_Map<CTR_HashedPtr,RAS_MeshSlot*> m_slots;
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp
index 3b4f4cae30e..6d8cbfece15 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.cpp
+++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp
@@ -151,3 +151,12 @@ void RAS_TexVert::Transform(const MT_Matrix4x4& mat, const MT_Matrix4x4& nmat)
SetTangent((nmat*MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0)).getValue());
}
+void RAS_TexVert::TransformUV(const MT_Matrix4x4& mat)
+{
+ SetUV((mat * MT_Vector4(m_uv1[0], m_uv1[1], 0.0, 1.0)).getValue());
+}
+
+void RAS_TexVert::TransformUV2(const MT_Matrix4x4& mat)
+{
+ SetUV2((mat * MT_Vector4(m_uv2[0], m_uv2[1], 0.0, 1.0)).getValue());
+}
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.h b/source/gameengine/Rasterizer/RAS_TexVert.h
index 889769da5ed..bb151a64814 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.h
+++ b/source/gameengine/Rasterizer/RAS_TexVert.h
@@ -137,6 +137,8 @@ public:
void Transform(const class MT_Matrix4x4& mat,
const class MT_Matrix4x4& nmat);
+ void TransformUV(const MT_Matrix4x4& mat);
+ void TransformUV2(const MT_Matrix4x4& mat);
// compare two vertices, to test if they can be shared, used for
// splitting up based on uv's, colors, etc