Fix cycles issue with mapping node rotation and scale order. When using both
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 25 Sep 2013 20:28:49 +0000 (20:28 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 25 Sep 2013 20:28:49 +0000 (20:28 +0000)
scale and rotation in mapping node, there would be shearing, and the only way
to avoid that was to add 2 mapping nodes. This is because to transform the
texture, the inverse transform needs to be done on the texture coordinate

Now the mapping node has Texture/Point/Vector/Normal types to transform the
vector for a particular purpose. Point is the existing behavior, Texture is
the new default that behaves more like you might expect.

25 files changed:
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_shader.cpp
intern/cycles/render/nodes.cpp
intern/cycles/render/nodes.h
source/blender/blenkernel/BKE_texture.h
source/blender/blenkernel/intern/texture.c
source/blender/editors/space_node/drawnode.c
source/blender/makesdna/DNA_node_types.h
source/blender/makesdna/DNA_texture_types.h
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_texture.c
source/blender/nodes/composite/nodes/node_composite_mapValue.c
source/blender/nodes/shader/node_shader_util.c
source/blender/nodes/shader/nodes/node_shader_mapping.c
source/blender/nodes/shader/nodes/node_shader_tex_brick.c
source/blender/nodes/shader/nodes/node_shader_tex_checker.c
source/blender/nodes/shader/nodes/node_shader_tex_environment.c
source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
source/blender/nodes/shader/nodes/node_shader_tex_image.c
source/blender/nodes/shader/nodes/node_shader_tex_magic.c
source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
source/blender/nodes/shader/nodes/node_shader_tex_noise.c
source/blender/nodes/shader/nodes/node_shader_tex_sky.c
source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
source/blender/nodes/shader/nodes/node_shader_tex_wave.c

index 5fa497776fe542f8d839c26399cc6f2aabcb9889..34585260cdb82cf667f7b3ea8c66f006fdbe425a 100644 (file)
@@ -1085,6 +1085,8 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
 
         mapping = node.texture_mapping
 
+        layout.prop(mapping, "type", expand=True)
+
         row = layout.row()
 
         row.column().prop(mapping, "translation")
index 2007171642f0cffc5eda50b8c4606b9d83966553..d915d51dfd8e5d4d1bea967e645447ba96cc31ea 100644 (file)
@@ -147,6 +147,7 @@ static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
        mapping->translation = get_float3(b_mapping.translation());
        mapping->rotation = get_float3(b_mapping.rotation());
        mapping->scale = get_float3(b_mapping.scale());
+       mapping->type = (TextureMapping::Type)b_mapping.type();
 
        mapping->x_mapping = (TextureMapping::Mapping)b_mapping.mapping_x();
        mapping->y_mapping = (TextureMapping::Mapping)b_mapping.mapping_y();
@@ -161,6 +162,7 @@ static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_map
        mapping->translation = get_float3(b_mapping.translation());
        mapping->rotation = get_float3(b_mapping.rotation());
        mapping->scale = get_float3(b_mapping.scale());
+       mapping->type = (TextureMapping::Type)b_mapping.type();
 
        mapping->use_minmax = b_mapping.use_min() || b_mapping.use_max();
 
index 658deb87cfff3a2462e59d4d98afb61baaa70b2a..35b8a151587affe2377b6b3bae5555351ae9bfb4 100644 (file)
@@ -42,6 +42,8 @@ TextureMapping::TextureMapping()
        y_mapping = Y;
        z_mapping = Z;
 
+       type = TEXTURE;
+
        projection = FLAT;
 }
 
@@ -55,12 +57,52 @@ Transform TextureMapping::compute_transform()
                mmat[1][y_mapping-1] = 1.0f;
        if(z_mapping != NONE)
                mmat[2][z_mapping-1] = 1.0f;
+       
+       float3 scale_clamped = scale;
 
-       Transform smat = transform_scale(scale);
+       if(type == TEXTURE || type == NORMAL) {
+               /* keep matrix invertible */
+               if(fabsf(scale.x) < 1e-5f)
+                       scale_clamped.x = signf(scale.x)*1e-5f;
+               if(fabsf(scale.y) < 1e-5f)
+                       scale_clamped.y = signf(scale.y)*1e-5f;
+               if(fabsf(scale.z) < 1e-5f)
+                       scale_clamped.z = signf(scale.z)*1e-5f;
+       }
+       
+       Transform smat = transform_scale(scale_clamped);
        Transform rmat = transform_euler(rotation);
        Transform tmat = transform_translate(translation);
 
-       return tmat*rmat*smat*mmat;
+       Transform mat;
+
+       switch(type) {
+               case TEXTURE:
+                       /* inverse transform on texture coordinate gives
+                        * forward transform on texture */
+                       mat = tmat*rmat*smat;
+                       mat = transform_inverse(mat);
+                       break;
+               case POINT:
+                       /* full transform */
+                       mat = tmat*rmat*smat;
+                       break;
+               case VECTOR:
+                       /* no translation for vectors */
+                       mat = rmat*smat;
+                       break;
+               case NORMAL:
+                       /* no translation for normals, and inverse transpose */
+                       mat = rmat*smat;
+                       mat = transform_inverse(mat);
+                       mat = transform_transpose(mat);
+                       break;
+       }
+
+       /* projection last */
+       mat = mat*mmat;
+
+       return mat;
 }
 
 bool TextureMapping::skip()
@@ -98,6 +140,11 @@ void TextureMapping::compile(SVMCompiler& compiler, int offset_in, int offset_ou
                compiler.add_node(float3_to_float4(min));
                compiler.add_node(float3_to_float4(max));
        }
+
+       if(type == NORMAL) {
+               compiler.add_node(NODE_VECTOR_MATH, NODE_VECTOR_MATH_NORMALIZE, offset_out, offset_out);
+               compiler.add_node(NODE_VECTOR_MATH, SVM_STACK_INVALID, offset_out);
+       }
 }
 
 void TextureMapping::compile(OSLCompiler &compiler)
index d58c6633a41be89845771cd75a69f719aeab9012..430c37158f47e99b233dc1e973acaf0215001bbd 100644 (file)
@@ -43,6 +43,9 @@ public:
        float3 min, max;
        bool use_minmax;
 
+       enum Type { POINT = 0, TEXTURE = 1, VECTOR = 2, NORMAL = 3 };
+       Type type;
+
        enum Mapping { NONE = 0, X = 1, Y = 2, Z = 3 };
        Mapping x_mapping, y_mapping, z_mapping;
 
index ac0d507003efd98f9dc2f5ab3b2f4c39bd3b9aa0..2a00dee2a3f6dad207d2fea6320d2487ab0e9af3 100644 (file)
@@ -101,8 +101,8 @@ void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex
 
 int has_current_material_texture(struct Material *ma);
 
-struct TexMapping *add_tex_mapping(void);
-void default_tex_mapping(struct TexMapping *texmap);
+struct TexMapping *add_tex_mapping(int type);
+void default_tex_mapping(struct TexMapping *texmap, int type);
 void init_tex_mapping(struct TexMapping *texmap);
 
 struct ColorMapping *add_color_mapping(void);
index e2b7358525ac449350c17adf070cdeec898e672e..d98a6cbe0cc9f6c412de1d81c6d3ef5caf9ffc48 100644 (file)
 
 /* ****************** Mapping ******************* */
 
-TexMapping *add_tex_mapping(void)
+TexMapping *add_tex_mapping(int type)
 {
        TexMapping *texmap = MEM_callocN(sizeof(TexMapping), "TexMapping");
        
-       default_tex_mapping(texmap);
+       default_tex_mapping(texmap, type);
        
        return texmap;
 }
 
-void default_tex_mapping(TexMapping *texmap)
+void default_tex_mapping(TexMapping *texmap, int type)
 {
        memset(texmap, 0, sizeof(TexMapping));
 
@@ -92,11 +92,12 @@ void default_tex_mapping(TexMapping *texmap)
        texmap->projy = PROJ_Y;
        texmap->projz = PROJ_Z;
        texmap->mapping = MTEX_FLAT;
+       texmap->type = type;
 }
 
 void init_tex_mapping(TexMapping *texmap)
 {
-       float smat[3][3], rmat[3][3], mat[3][3], proj[3][3];
+       float smat[4][4], rmat[4][4], tmat[4][4], proj[4][4], size[3];
 
        if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
            is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size))
@@ -107,7 +108,8 @@ void init_tex_mapping(TexMapping *texmap)
        }
        else {
                /* axis projection */
-               zero_m3(proj);
+               zero_m4(proj);
+               proj[3][3] = 1.0f;
 
                if (texmap->projx != PROJ_N)
                        proj[texmap->projx - 1][0] = 1.0f;
@@ -117,19 +119,50 @@ void init_tex_mapping(TexMapping *texmap)
                        proj[texmap->projz - 1][2] = 1.0f;
 
                /* scale */
-               size_to_mat3(smat, texmap->size);
+               copy_v3_v3(size, texmap->size);
+
+               if (ELEM(texmap->type, TEXMAP_TYPE_TEXTURE, TEXMAP_TYPE_NORMAL)) {
+                       /* keep matrix invertible */
+                       if(fabsf(size[0]) < 1e-5f)
+                               size[0] = signf(size[0])*1e-5f;
+                       if(fabsf(size[1]) < 1e-5f)
+                               size[1] = signf(size[1])*1e-5f;
+                       if(fabsf(size[2]) < 1e-5f)
+                               size[2] = signf(size[2])*1e-5f;
+               }
                
+               size_to_mat4(smat, texmap->size);
+
                /* rotation */
-               /* TexMapping rotation are now in radians. */
-               eul_to_mat3(rmat, texmap->rot);
-               
-               /* compose it all */
-               mul_m3_m3m3(mat, rmat, smat);
-               mul_m3_m3m3(mat, proj, mat);
-               
+               eul_to_mat4(rmat, texmap->rot);
+
                /* translation */
-               copy_m4_m3(texmap->mat, mat);
-               copy_v3_v3(texmap->mat[3], texmap->loc);
+               unit_m4(tmat);
+               copy_v3_v3(tmat[3], texmap->loc);
+
+               if (texmap->type == TEXMAP_TYPE_TEXTURE) {
+                       /* to transform a texture, the inverse transform needs
+                        * to be applied to the texture coordinate */
+                       mul_serie_m4(texmap->mat, tmat, rmat, smat, 0, 0, 0, 0, 0);
+                       invert_m4(texmap->mat);
+               }
+               else if (texmap->type == TEXMAP_TYPE_POINT) {
+                       /* forward transform */
+                       mul_serie_m4(texmap->mat, tmat, rmat, smat, 0, 0, 0, 0, 0);
+               }
+               else if (texmap->type == TEXMAP_TYPE_VECTOR) {
+                       /* no translation for vectors */
+                       mul_m4_m4m4(texmap->mat, rmat, smat);
+               }
+               else if (texmap->type == TEXMAP_TYPE_NORMAL) {
+                       /* no translation for normals, and inverse transpose */
+                       mul_m4_m4m4(texmap->mat, rmat, smat);
+                       invert_m4(texmap->mat);
+                       transpose_m4(texmap->mat);
+               }
+
+               /* projection last */
+               mul_m4_m4m4(texmap->mat, texmap->mat, proj);
 
                texmap->flag &= ~TEXMAP_UNIT_MATRIX;
        }
index 45428425138bbd8f487a557ada8720541616d630..308e9afa42fc6933025a2ea50f98164ae1c21e2a 100644 (file)
@@ -709,6 +709,8 @@ static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), Poin
 {
        uiLayout *row;
        
+       uiItemR(layout, ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
        uiItemL(layout, IFACE_("Location:"), ICON_NONE);
        row = uiLayoutRow(layout, TRUE);
        uiItemR(row, ptr, "translation", 0, "", ICON_NONE);
index a82d1a71a1e8a37eb9e7a5bf411f83a31b1624c5..5cfe3fd20822d50027babe172b00298e9c819fb4 100644 (file)
@@ -975,7 +975,7 @@ typedef struct NodeShaderNormalMap {
 #define SHD_NORMAL_MAP_BLENDER_OBJECT  3
 #define SHD_NORMAL_MAP_BLENDER_WORLD   4
 
-/* tangent */
+/* subsurface */
 #define SHD_SUBSURFACE_COMPATIBLE              0
 #define SHD_SUBSURFACE_CUBIC                   1
 #define SHD_SUBSURFACE_GAUSSIAN                        2
index 0b6e5f9c7bbe4e2b2d4deaa90f273e2cbf39a7fc..fcd0575f1c5d3b3ff9f59621357f7a326616aa70 100644 (file)
@@ -263,7 +263,7 @@ typedef struct TexMapping {
        float loc[3], rot[3], size[3];
        int flag;
        char projx, projy, projz, mapping;
-       int pad;
+       int type;
        
        float mat[4][4];
        float min[3], max[3];
@@ -287,6 +287,12 @@ typedef struct ColorMapping {
 #define TEXMAP_CLIP_MAX                2
 #define TEXMAP_UNIT_MATRIX     4
 
+/* texmap->type */
+#define TEXMAP_TYPE_POINT              0
+#define TEXMAP_TYPE_TEXTURE            1
+#define TEXMAP_TYPE_VECTOR             2
+#define TEXMAP_TYPE_NORMAL             3
+
 /* colormap->flag */
 #define COLORMAP_USE_RAMP 1
 
index eb5f5933bf1f4b6cfbe765e172961181ff66b08a..cc99296614dd41491d9877f25b2d8d5d91ba6f7f 100644 (file)
@@ -3135,10 +3135,24 @@ static void def_sh_material(StructRNA *srna)
 
 static void def_sh_mapping(StructRNA *srna)
 {
+       static EnumPropertyItem prop_vect_type_items[] = {
+               {TEXMAP_TYPE_TEXTURE, "TEXTURE",  0, "Texture", "Transforms a texture by inverse mapping the texture coordinate"},
+               {TEXMAP_TYPE_POINT,   "POINT",    0, "Point",   "Transforms a point"},
+               {TEXMAP_TYPE_VECTOR,  "VECTOR",   0, "Vector",  "Transforms a direction vector"},
+               {TEXMAP_TYPE_NORMAL,  "NORMAL",   0, "Normal",  "Transforms a normal vector with unit length"},
+               {0, NULL, 0, NULL, NULL}
+       };
+
        PropertyRNA *prop;
        
        RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
 
+       prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "type");
+       RNA_def_property_enum_items(prop, prop_vect_type_items);
+       RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
+       RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
        prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
        RNA_def_property_float_sdna(prop, NULL, "loc");
        RNA_def_property_ui_text(prop, "Location", "");
@@ -3522,9 +3536,9 @@ static void def_sh_tex_coord(StructRNA *srna)
 static void def_sh_vect_transform(StructRNA *srna)
 {
        static EnumPropertyItem prop_vect_type_items[] = {
-               {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR",  0, "Vector",   ""},
-               {SHD_VECT_TRANSFORM_TYPE_POINT,  "POINT",   0, "Point",    ""},
-               {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL",  0, "Normal",   ""},
+               {SHD_VECT_TRANSFORM_TYPE_POINT,  "POINT",   0, "Point",    "Transforms a point"},
+               {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR",  0, "Vector",   "Transforms a direction vector"},
+               {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL",  0, "Normal",   "Transforms a normal vector with unit length"},
                {0, NULL, 0, NULL, NULL}
        };
 
index a27e41a96c8bbfed92cfec6f924f4b2fcdcf0270..6aee4486cf5a0ed9c930c60556f0ba5bfd86e134 100644 (file)
@@ -495,6 +495,14 @@ static void rna_def_texmapping(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
                
+       static EnumPropertyItem prop_vect_type_items[] = {
+               {TEXMAP_TYPE_TEXTURE, "TEXTURE",  0, "Texture", "Transforms a texture by inverse mapping the texture coordinate"},
+               {TEXMAP_TYPE_POINT,   "POINT",    0, "Point",   "Transforms a point"},
+               {TEXMAP_TYPE_VECTOR,  "VECTOR",   0, "Vector",  "Transforms a direction vector"},
+               {TEXMAP_TYPE_NORMAL,  "NORMAL",   0, "Normal",  "Transforms a normal vector with unit length"},
+               {0, NULL, 0, NULL, NULL}
+       };
+
        static EnumPropertyItem prop_xyz_mapping_items[] = {
                {0, "NONE", 0, "None", ""},
                {1, "X", 0, "X", ""},
@@ -509,6 +517,12 @@ static void rna_def_texmapping(BlenderRNA *brna)
        srna = RNA_def_struct(brna, "TexMapping", NULL);
        RNA_def_struct_ui_text(srna, "Texture Mapping", "Texture coordinate mapping settings");
 
+       prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "type");
+       RNA_def_property_enum_items(prop, prop_vect_type_items);
+       RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
+       RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
        prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
        RNA_def_property_float_sdna(prop, NULL, "loc");
        RNA_def_property_ui_text(prop, "Location", "");
index 316e5b344ce10e1523757f6e50951c7c22538f04..22d16e938791d32be83cec61560fe0b4f6b775f5 100644 (file)
@@ -44,7 +44,7 @@ static bNodeSocketTemplate cmp_node_map_value_out[] = {
 
 static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node)
 {
-       node->storage = add_tex_mapping();
+       node->storage = add_tex_mapping(TEXMAP_TYPE_POINT);
 }
 
 void register_node_type_cmp_map_value(void)
index aed8a0224f181ff0a796be4747e3978e5f24e377..86e59cd779a5e73cbaa91df095f5191b8278f3b1 100644 (file)
@@ -271,6 +271,9 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in
                GPUNodeLink *tdomax = GPU_uniform(&domax);
 
                GPU_link(mat, "mapping", in[0].link, tmat, tmin, tmax, tdomin, tdomax, &in[0].link);
+
+               if (texmap->type == TEXMAP_TYPE_NORMAL)
+                       GPU_link(mat, "texco_norm", in[0].link, &in[0].link);
        }
 }
 
index 05936e22775a08ea4e5c97239de3e13b5a603086..82444caadb8d69e0af23a53a734616a653a79858 100644 (file)
@@ -29,7 +29,6 @@
  *  \ingroup shdnodes
  */
 
-
 #include "node_shader_util.h"
 
 /* **************** MAPPING  ******************** */
@@ -53,7 +52,7 @@ static void node_shader_exec_mapping(void *UNUSED(data), int UNUSED(thread), bNo
        /* stack order output: vector */
        nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
        mul_m4_v3(texmap->mat, vec);
-       
+
        if (texmap->flag & TEXMAP_CLIP_MIN) {
                if (vec[0] < texmap->min[0]) vec[0] = texmap->min[0];
                if (vec[1] < texmap->min[1]) vec[1] = texmap->min[1];
@@ -64,12 +63,15 @@ static void node_shader_exec_mapping(void *UNUSED(data), int UNUSED(thread), bNo
                if (vec[1] > texmap->max[1]) vec[1] = texmap->max[1];
                if (vec[2] > texmap->max[2]) vec[2] = texmap->max[2];
        }
+
+       if (texmap->type == TEXMAP_TYPE_NORMAL)
+               normalize_v3(vec);
 }
 
 
 static void node_shader_init_mapping(bNodeTree *UNUSED(ntree), bNode *node)
 {
-       node->storage = add_tex_mapping();
+       node->storage = add_tex_mapping(TEXMAP_TYPE_TEXTURE);
 }
 
 static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
@@ -83,7 +85,12 @@ static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, bNodeExecData *UNUS
        GPUNodeLink *tdomin = GPU_uniform(&domin);
        GPUNodeLink *tdomax = GPU_uniform(&domax);
 
-       return GPU_stack_link(mat, "mapping", in, out, tmat, tmin, tmax, tdomin, tdomax);
+       int result = GPU_stack_link(mat, "mapping", in, out, tmat, tmin, tmax, tdomin, tdomax);
+
+       if (result && texmap->type == TEXMAP_TYPE_NORMAL)
+               GPU_link(mat, "texco_norm", out[0].link, &out[0].link);
+
+       return result;
 }
 
 void register_node_type_sh_mapping(void)
index 826b7d9337d2dd208c40428afb79793d1c3a9351..480d285af6cab421a8e8fd3a50384d2005d4932c 100644 (file)
@@ -51,7 +51,7 @@ static bNodeSocketTemplate sh_node_tex_brick_out[] = {
 static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexBrick *tex = MEM_callocN(sizeof(NodeTexBrick), "NodeTexBrick");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        
        tex->offset = 0.5f;
index ceb3911f4293317d22b814f008ab4ba8470a154a..82125f3ea029160acb35ad52deedfe7ba0700d96 100644 (file)
@@ -46,7 +46,7 @@ static bNodeSocketTemplate sh_node_tex_checker_out[] = {
 static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexChecker *tex = MEM_callocN(sizeof(NodeTexChecker), "NodeTexChecker");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
 
        node->storage = tex;
index 2fbf5b6faf9c388f6908e3b5c437a5c8f1264292..923684304bf92e645677c17cb9b1bc944e0c3221 100644 (file)
@@ -44,7 +44,7 @@ static bNodeSocketTemplate sh_node_tex_environment_out[] = {
 static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexEnvironment *tex = MEM_callocN(sizeof(NodeTexEnvironment), "NodeTexEnvironment");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        tex->color_space = SHD_COLORSPACE_COLOR;
        tex->projection = SHD_PROJ_EQUIRECTANGULAR;
index 5ee3b1f617604703eb0f49e515046af3fce19a21..00dd45df7b095a49341ee121ccf474a838569a49 100644 (file)
@@ -43,7 +43,7 @@ static bNodeSocketTemplate sh_node_tex_gradient_out[] = {
 static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexGradient *tex = MEM_callocN(sizeof(NodeTexGradient), "NodeTexGradient");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        tex->gradient_type = SHD_BLEND_LINEAR;
 
index 53c44ebd7154195c5bdbe785284f4d17ae44b29a..935c0c618c7b87516eb7e43a12843c8756c62455 100644 (file)
@@ -45,7 +45,7 @@ static bNodeSocketTemplate sh_node_tex_image_out[] = {
 static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexImage *tex = MEM_callocN(sizeof(NodeTexImage), "NodeTexImage");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        tex->color_space = SHD_COLORSPACE_COLOR;
        tex->iuser.frames = 1;
index 38292939a3c8ea5c5bef29114ec7b3d64d8c6dd3..c043484d5503eba01c8f8fbdaef3462ecfa5d29b 100644 (file)
@@ -45,7 +45,7 @@ static bNodeSocketTemplate sh_node_tex_magic_out[] = {
 static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexMagic *tex = MEM_callocN(sizeof(NodeTexMagic), "NodeTexMagic");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        tex->depth = 2;
 
index b41cc7d8812b0f4e5721dfb3a7d3f0aab087a4c6..33ae2dbc8c21fca18da05f415d97303dcbf6f51d 100644 (file)
@@ -49,7 +49,7 @@ static bNodeSocketTemplate sh_node_tex_musgrave_out[] = {
 static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexMusgrave *tex = MEM_callocN(sizeof(NodeTexMusgrave), "NodeTexMusgrave");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        tex->musgrave_type = SHD_MUSGRAVE_FBM;
 
index a7009b81e9af9307c6a36c7c35d7dbf564cc9c94..9e63e0278e69325ea5e30ebd3633fe77e4173f6c 100644 (file)
@@ -46,7 +46,7 @@ static bNodeSocketTemplate sh_node_tex_noise_out[] = {
 static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexNoise *tex = MEM_callocN(sizeof(NodeTexNoise), "NodeTexNoise");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
 
        node->storage = tex;
index c80b5282de3e46c47314b3cbc91fe3ccabe09062..0c842207c05771f70c7002a913c7bcae80585fcd 100644 (file)
@@ -42,7 +42,7 @@ static bNodeSocketTemplate sh_node_tex_sky_out[] = {
 static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexSky *tex = MEM_callocN(sizeof(NodeTexSky), "NodeTexSky");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        tex->sun_direction[0] = 0.0f;
        tex->sun_direction[1] = 0.0f;
index 3f1b0638b99624378f9136598d5b7d0798311ec6..5ace85506a675d88bc6cc74afcf2d07ab6abdda1 100644 (file)
@@ -44,7 +44,7 @@ static bNodeSocketTemplate sh_node_tex_voronoi_out[] = {
 static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexVoronoi *tex = MEM_callocN(sizeof(NodeTexVoronoi), "NodeTexVoronoi");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        tex->coloring = SHD_VORONOI_INTENSITY;
 
index a424265c94a7b98eefaceb3cc2c0558500757428..a189d927673c44c0d16567e28e295c93db1eb5cc 100644 (file)
@@ -47,7 +47,7 @@ static bNodeSocketTemplate sh_node_tex_wave_out[] = {
 static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node)
 {
        NodeTexWave *tex = MEM_callocN(sizeof(NodeTexWave), "NodeTexWave");
-       default_tex_mapping(&tex->base.tex_mapping);
+       default_tex_mapping(&tex->base.tex_mapping, TEXMAP_TYPE_TEXTURE);
        default_color_mapping(&tex->base.color_mapping);
        tex->wave_type = SHD_WAVE_BANDS;