diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-03 16:31:05 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-03 16:31:05 +0400 |
commit | b3f21a22548db7e8e77001065b9139c44a8e0c62 (patch) | |
tree | f5b4dc68d19ab8ce313a14a667e98c53047c7ba0 /intern/cycles/blender/blender_util.h | |
parent | bf25f1ea96d01b513907cf3067e8e2dd3c7e41b4 (diff) |
Cycles Hair: add Generated texture coordinates for curves, so that procedural
textures now work without having to add a UV map.
Also made UV and intercept attributes only export when needed by the shader.
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r-- | intern/cycles/blender/blender_util.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index fbcbe15ec5a..88c98860794 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -242,6 +242,20 @@ static inline string blender_absolute_path(BL::BlendData b_data, BL::ID b_id, co return path; } +/* Texture Space */ + +static inline void mesh_texture_space(BL::Mesh b_mesh, float3& loc, float3& size) +{ + loc = get_float3(b_mesh.texspace_location()); + size = get_float3(b_mesh.texspace_size()); + + if(size.x != 0.0f) size.x = 0.5f/size.x; + if(size.y != 0.0f) size.y = 0.5f/size.y; + if(size.z != 0.0f) size.z = 0.5f/size.z; + + loc = loc*size - make_float3(0.5f, 0.5f, 0.5f); +} + /* ID Map * * Utility class to keep in sync with blender data. |