diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-01-11 20:21:17 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-01-11 20:21:17 +0400 |
commit | e26cd10b7aad11f04aaca53f6d578357a748a026 (patch) | |
tree | 3121216535716c24ed84499885792b2641d3f024 /source | |
parent | 33d7c9e8ce00662199d2e8bb723f3593308f0455 (diff) |
Fix #29836: stress not working as input for displacement texture. Previously it
would be computed after displacement, but I don't think this made much sense.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 434e596e739..1ec400138a7 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -2283,7 +2283,18 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve if(texco & TEXCO_REFL) { /* not (yet?) */ } - + if(texco & TEXCO_STRESS) { + float *s= RE_vertren_get_stress(obr, vr, 0); + + if(s) { + shi->stress= *s; + if(shi->stress<1.0f) shi->stress-= 1.0f; + else shi->stress= (shi->stress-1.0f)/shi->stress; + } + else + shi->stress= 0.0f; + } + shi->displace[0]= shi->displace[1]= shi->displace[2]= 0.0; do_material_tex(shi, re); @@ -3536,6 +3547,9 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) } if(!timeoffset) { + if(need_stress) + calc_edge_stress(re, obr, me); + if (test_for_displace(re, ob ) ) { recalc_normals= 1; calc_vertexnormals(re, obr, 0, 0); @@ -3552,9 +3566,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) if(recalc_normals!=0 || need_tangent!=0) calc_vertexnormals(re, obr, need_tangent, need_nmap_tangent); - - if(need_stress) - calc_edge_stress(re, obr, me); } dm->release(dm); |