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-29 01:24:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-29 01:24:38 +0400
commit62ab3baea43a7ab37f761330978f2b3d0a84e11f (patch)
tree0eb97f3d1561f39f724f847de48690ce9654089e /source/blender/blenkernel/intern/lattice.c
parentf55ef8b3fc405f630ecb59e3c21b2676451f448f (diff)
replace LATTICE_PT macro with BKE_lattice_index_from_uvw().
Diffstat (limited to 'source/blender/blenkernel/intern/lattice.c')
-rw-r--r--source/blender/blenkernel/intern/lattice.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 23368446675..c9b904e76ac 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -65,15 +65,21 @@
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);
+ const int totu = lt->pntsu;
+ const int totv = lt->pntsv;
+
+ return (w * (totu * totv) + (v * totu) + 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));
+ const int totu = lt->pntsu;
+ const int totv = lt->pntsv;
+
+ *r_u = (index % totu);
+ *r_v = (index / totu) % totv;
+ *r_w = (index / (totu * totv));
}
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)