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>2013-06-24 17:45:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-24 17:45:35 +0400
commit1a55b53375cf45481e3916d9d3a96c7ce4204e73 (patch)
treee087353ec83945db6a9ee807745b4390a0b0d8ca /source/blender/blenkernel/intern/lattice.c
parentc42c9cb234524fcde6248df686d359c2fa827fcd (diff)
lattice: use functions rather then defines, also added a function to get uvw from an index.
- BKE_lattice_index_from_uvw() - BKE_lattice_index_to_uvw()
Diffstat (limited to 'source/blender/blenkernel/intern/lattice.c')
-rw-r--r--source/blender/blenkernel/intern/lattice.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index feb82a34708..23368446675 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -62,6 +62,19 @@
#include "BKE_deform.h"
+int BKE_lattice_index_from_uvw(struct Lattice *lt,
+ const int u, const int v, const int w)
+{
+ return (w * (lt->pntsu * lt->pntsv) + (v * lt->pntsu) + u);
+}
+
+void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index,
+ int *r_u, int *r_v, int *r_w)
+{
+ *r_u = (index % lt->pntsu);
+ *r_v = (index / lt->pntsu) % lt->pntsv;
+ *r_w = (index / (lt->pntsu * lt->pntsv));
+}
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)
{
@@ -867,7 +880,7 @@ int object_deform_mball(Object *ob, ListBase *dispbase)
static BPoint *latt_bp(Lattice *lt, int u, int v, int w)
{
- return &lt->def[LT_INDEX(lt, u, v, w)];
+ return &lt->def[BKE_lattice_index_from_uvw(lt, u, v, w)];
}
void outside_lattice(Lattice *lt)