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>2007-12-05 15:40:54 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2007-12-05 15:40:54 +0300
commit29d87d64caac51fc900825063421a35ac9a7c7ae (patch)
treed0ee294c6a4960a986c6e722d2c34b98c562c642 /source/blender/blenkernel/intern/mesh.c
parent2422b1e401aac4ae6fbe33764ffc337e5eb8fd79 (diff)
Particles
========= - Texture orco coordinates for particles are now actual orcos instead of just the vertex positions, which means they are the same under deformations and the same as the ones on the mesh. - Particle distribution now uses these orcos to get consistent distributions independent of deformation. - This required changing the way orco's are computed for meshes. Now instead of generating an orco derivedmesh separately, the derivedmesh is generated alongside the regular one and stored in an orco custom data layer.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r--source/blender/blenkernel/intern/mesh.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 4e551e28885..746cc80d638 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -474,17 +474,13 @@ void mesh_get_texspace(Mesh *me, float *loc_r, float *rot_r, float *size_r)
if (size_r) VECCOPY(size_r, me->size);
}
-static float *make_orco_mesh_internal(Object *ob, int render)
+float *get_mesh_orco_verts(Object *ob)
{
Mesh *me = ob->data;
- float (*orcoData)[3];
int a, totvert;
- float loc[3], size[3];
- DerivedMesh *dm;
float (*vcos)[3] = NULL;
- /* Get appropriate vertex coordinates */
-
+ /* Get appropriate vertex coordinates */
if(me->key && me->texcomesh==0 && me->key->refkey) {
vcos= mesh_getRefKeyCos(me, &totvert);
}
@@ -512,40 +508,22 @@ static float *make_orco_mesh_internal(Object *ob, int render)
}
}
- /* Apply orco-changing modifiers */
-
- if (render) {
- dm = mesh_create_derived_no_deform_render(ob, vcos, CD_MASK_BAREMESH);
- } else {
- dm = mesh_create_derived_no_deform(ob, vcos, CD_MASK_BAREMESH);
- }
- totvert = dm->getNumVerts(dm);
+ return (float*)vcos;
+}
- orcoData = MEM_mallocN(sizeof(*orcoData)*totvert, "orcoData");
- dm->getVertCos(dm, orcoData);
- dm->release(dm);
- MEM_freeN(vcos);
+void transform_mesh_orco_verts(Mesh *me, float (*orco)[3], int totvert)
+{
+ float loc[3], size[3];
+ int a;
mesh_get_texspace(me->texcomesh?me->texcomesh:me, loc, NULL, size);
for(a=0; a<totvert; a++) {
- float *co = orcoData[a];
+ float *co = orco[a];
co[0] = (co[0]-loc[0])/size[0];
co[1] = (co[1]-loc[1])/size[1];
co[2] = (co[2]-loc[2])/size[2];
}
-
- return (float*) orcoData;
-}
-
-float *mesh_create_orco_render(Object *ob)
-{
- return make_orco_mesh_internal(ob, 1);
-}
-
-float *mesh_create_orco(Object *ob)
-{
- return make_orco_mesh_internal(ob, 0);
}
/* rotates the vertices of a face in case v[2] or v[3] (vertex index) is = 0.