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:
authorJanne Karhu <jhkarh@gmail.com>2011-08-25 11:30:12 +0400
committerJanne Karhu <jhkarh@gmail.com>2011-08-25 11:30:12 +0400
commit44f7a8aee2dcd664717b58f8e1265f832d67062d (patch)
tree38f4e3f4fd53a183945057e07918ece822053c8a /source/blender/render/intern
parent38398d200fd611d609a56933ec4406574f916855 (diff)
Fix for [#28239] Particles Billboard 3x3 Split Error.
* Patch by Alex Fraser.
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r--source/blender/render/intern/source/convertblender.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 7033ec27fc0..2f79560efd6 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1345,8 +1345,11 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
VlakRen *vlr;
MTFace *mtf;
float xvec[3], yvec[3], zvec[3], bb_center[3];
+ /* Number of tiles */
int totsplit = bb->uv_split * bb->uv_split;
- float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f;
+ int tile, x, y;
+ /* Tile offsets */
+ float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f;
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
@@ -1420,11 +1423,14 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
else if(bb->split_offset==PART_BB_OFF_RANDOM)
time = (float)fmod(time + bb->random, 1.0f);
- uvx = uvdx * floor((float)(bb->uv_split * bb->uv_split) * (float)fmod((double)time, (double)uvdx));
- uvy = uvdy * floor((1.0f - time) * (float)bb->uv_split);
-
- if(fmod(time, 1.0f / bb->uv_split) == 0.0f)
- uvy -= uvdy;
+ /* Find the coordinates in tile space (integer), then convert to UV
+ * space (float). Note that Y is flipped. */
+ tile = (int)((time + FLT_EPSILON10) * totsplit);
+ x = tile % bb->uv_split;
+ y = tile / bb->uv_split;
+ y = (bb->uv_split - 1) - y;
+ uvx = uvdx * x;
+ uvy = uvdy * y;
}
/* normal UVs */