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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-11-13 18:05:17 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-01-20 11:30:07 +0300
commita754c0af4088aaa7d1799351db1d03b9250a0d2e (patch)
tree113d17f6d87c03c66c103999c75a2484053978d6 /source/blender/physics
parent9c660f18aca5d86a7e2f5818beabe9b3e0bc7ec7 (diff)
Another fix for off-by-one hair grid resolution errors.
Diffstat (limited to 'source/blender/physics')
-rw-r--r--source/blender/physics/intern/hair_volume.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/physics/intern/hair_volume.cpp b/source/blender/physics/intern/hair_volume.cpp
index daf362d1f55..5dadd45c154 100644
--- a/source/blender/physics/intern/hair_volume.cpp
+++ b/source/blender/physics/intern/hair_volume.cpp
@@ -794,18 +794,18 @@ HairGrid *BPH_hair_volume_create_vertex_grid(float cellsize, const float gmin[3]
sub_v3_v3v3(extent, gmax, gmin);
for (i = 0; i < 3; ++i) {
- resmin[i] = (int)(gmin[i] * scale);
- resmax[i] = (int)(gmax[i] * scale) + 1;
+ resmin[i] = floor_int(gmin[i] * scale);
+ resmax[i] = floor_int(gmax[i] * scale) + 1;
/* add margin of 1 cell */
resmin[i] -= 1;
resmax[i] += 1;
- res[i] = resmax[i] - resmin[i];
+ res[i] = resmax[i] - resmin[i] + 1;
/* sanity check: avoid null-sized grid */
- if (res[i] < 3) {
- res[i] = 3;
- resmax[i] = resmin[i] + 3;
+ if (res[i] < 4) {
+ res[i] = 4;
+ resmax[i] = resmin[i] + 4;
}
/* sanity check: avoid too large grid size */
if (res[i] > MAX_HAIR_GRID_RES) {