2.5: Materials
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 25 Jul 2009 21:31:17 +0000 (21:31 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 25 Jul 2009 21:31:17 +0000 (21:31 +0000)
* Diffuse/specular ramps works again.
* Wire is now a material type next to Surface and Halo.
* Removed Volume material type option until it is actually there.
* Some button layout tweaks.

release/ui/buttons_material.py
source/blender/blenloader/intern/readfile.c
source/blender/makesdna/DNA_material_types.h
source/blender/makesrna/intern/rna_material.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/shadbuf.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/zbuf.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp

index c6678d64c6e37df7f159dec1edbb9f2ee539f12e..9a28a74d0f785ecbef1fb995b373da0353a7b9f4 100644 (file)
@@ -75,40 +75,23 @@ class MATERIAL_PT_material(MaterialButtonsPanel):
                if mat:
                        layout.itemR(mat, "type", expand=True)
 
-                       if mat.type == 'SURFACE':
+                       if mat.type in ('SURFACE', 'WIRE', 'VOLUME'):
                                split = layout.split()
        
                                sub = split.column()
-                               sub.itemR(mat, "z_buffer")
                                sub.itemR(mat, "alpha", slider=True)
                                sub.itemR(mat, "ambient", slider=True)
                                sub.itemR(mat, "emit")
+                               sub.itemR(mat, "translucency", slider=True)
                                
                                sub = split.column()
+                               sub.itemR(mat, "z_transparency")
                                sub.itemR(mat, "shadeless")     
-                               sub.itemR(mat, "wireframe")
-                               
                                sub.itemR(mat, "tangent_shading")
                                sub.itemR(mat, "cubic", slider=True)
                                
-                       elif mat.type == 'VOLUME':
-                               split = layout.split()
-       
-                               sub = split.column()
-                               sub.itemR(mat, "z_buffer")
-                               sub.itemR(mat, "alpha", slider=True)
-                               sub.itemR(mat, "ambient", slider=True)
-                               sub.itemR(mat, "emit")
-                               
-                               sub = split.column()
-                               sub.itemR(mat, "shadeless")     
-                               sub.itemR(mat, "wireframe")
-                               
-                               sub.itemR(mat, "tangent_shading")
-                               sub.itemR(mat, "cubic", slider=True)
                        elif mat.type == 'HALO':
                                layout.itemR(mat, "alpha", slider=True)
-
                        
 class MATERIAL_PT_strand(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_strand"
@@ -158,17 +141,23 @@ class MATERIAL_PT_options(MaterialButtonsPanel):
                sub.itemR(mat, "full_oversampling")
                sub.itemR(mat, "sky")
                sub.itemR(mat, "exclude_mist")
+               sub.itemR(mat, "invert_z")
+
+               col = sub.column(align=True)
+               col.itemL(text="Light Group:")
+               col.itemR(mat, "light_group", text="")
+               row = col.row()
+               row.active = mat.light_group
+               row.itemR(mat, "light_group_exclusive", text="Exclusive")
+
                sub = split.column()
                sub.itemR(mat, "face_texture")
                colsub = sub.column()
                colsub.active = mat.face_texture
                colsub.itemR(mat, "face_texture_alpha")
-               sub.itemR(mat, "invert_z")
-               sub.itemR(mat, "light_group")
-               sub.itemR(mat, "light_group_exclusive")
-               
-               
-
+               sub.itemR(mat, "vertex_color_paint")
+               sub.itemR(mat, "vertex_color_light")
+               sub.itemR(mat, "object_color")
 
 class MATERIAL_PT_shadows(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_shadows"
@@ -201,7 +190,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
 
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type != "HALO")
+               return (mat and mat.type != 'HALO')
 
        def draw(self, context):
                layout = self.layout
@@ -211,18 +200,14 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
                
                sub = split.column()
                sub.itemR(mat, "diffuse_color", text="")
-               sub.itemR(mat, "vertex_color_paint")
-               sub.itemR(mat, "vertex_color_light")
+               row = sub.row()
+               row.active = mat.shadeless== False
+               row.itemR(mat, "diffuse_reflection", text="Intensity", slider=True)
                
                sub = split.column()
                sub.active = mat.shadeless== False
-               sub.itemR(mat, "diffuse_reflection", text="Intensity", slider=True)
-               sub.itemR(mat, "translucency", slider=True)
-               sub.itemR(mat, "object_color")
-               
-               row = layout.row()
-               row.active = mat.shadeless== False
-               row.itemR(mat, "diffuse_shader", text="Shader")
+               sub.itemR(mat, "diffuse_shader", text="")
+               sub.itemR(mat, "use_diffuse_ramp", text="Ramp")
                
                split = layout.split()
                split.active = mat.shadeless== False
@@ -240,8 +225,8 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
                        sub = split.column()
                        sub.itemR(mat, "diffuse_fresnel_factor", text="Factor")
                
-               layout.template_color_ramp(mat.diffuse_ramp, expand=True)
-               
+               if mat.use_diffuse_ramp:
+                       layout.template_color_ramp(mat.diffuse_ramp, expand=True)
                
 class MATERIAL_PT_specular(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_specular"
@@ -249,7 +234,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
 
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type != "HALO")
+               return (mat and mat.type != 'HALO')
 
        def draw(self, context):
                layout = self.layout
@@ -261,29 +246,30 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
                
                sub = split.column()
                sub.itemR(mat, "specular_color", text="")
-               sub = split.column()
                sub.itemR(mat, "specular_reflection", text="Intensity", slider=True)
-               
-               layout.itemR(mat, "spec_shader", text="Shader")
+
+               sub = split.column()
+               sub.itemR(mat, "specular_shader", text="")
+               sub.itemR(mat, "use_specular_ramp", text="Ramp")
                
                split = layout.split()
                
                sub = split.column()
-               if mat.spec_shader in ('COOKTORR', 'PHONG'):
+               if mat.specular_shader in ('COOKTORR', 'PHONG'):
                        sub.itemR(mat, "specular_hardness", text="Hardness")
-               if mat.spec_shader == 'BLINN':
+               if mat.specular_shader == 'BLINN':
                        sub.itemR(mat, "specular_hardness", text="Hardness")
                        sub = split.column()
                        sub.itemR(mat, "specular_ior", text="IOR")
-               if mat.spec_shader == 'WARDISO':
+               if mat.specular_shader == 'WARDISO':
                        sub.itemR(mat, "specular_slope", text="Slope")
-               if mat.spec_shader == 'TOON':
+               if mat.specular_shader == 'TOON':
                        sub.itemR(mat, "specular_toon_size", text="Size")
                        sub = split.column()
                        sub.itemR(mat, "specular_toon_smooth", text="Smooth")
                
-               layout.template_color_ramp(mat.specular_ramp, expand=True)
-               
+               if mat.use_specular_ramp:
+                       layout.template_color_ramp(mat.specular_ramp, expand=True)
                
 class MATERIAL_PT_sss(MaterialButtonsPanel):
        __idname__= "MATERIAL_PT_sss"
@@ -292,7 +278,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
        
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type == "SURFACE")
+               return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
 
        def draw_header(self, context):
                layout = self.layout
@@ -331,7 +317,7 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel):
        
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type == "SURFACE")
+               return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
        
        def draw_header(self, context):
                layout = self.layout
@@ -375,7 +361,7 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel):
                
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type == "SURFACE")
+               return (mat and (mat.type == 'SURFACE' or mat.type == 'WIRE'))
 
        def draw_header(self, context):
                layout = self.layout
@@ -419,7 +405,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
        
        def poll(self, context):
                mat = context.material
-               return (mat and mat.type == "HALO")
+               return (mat and mat.type == 'HALO')
        
        def draw(self, context):
                layout = self.layout
index 7551d902ad81dc45ce77060f8fa48fec299bfee9..9d42777881033db23a42e2b3dff4e528055d1420 100644 (file)
@@ -9281,6 +9281,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
 
                for(ma = main->mat.first; ma; ma = ma->id.next) {
+                       if(ma->mode & MA_WIRE) {
+                               ma->material_type= MA_TYPE_WIRE;
+                               ma->mode &= ~MA_WIRE;
+                       }
                        if(ma->mode & MA_HALO) {
                                ma->material_type= MA_TYPE_HALO;
                                ma->mode &= ~MA_HALO;
index 1f93bcf13173d1d3c9e9a25a896849e735a22537..5b566a244b40566ad649e88797f1fa8aa153f2ed 100644 (file)
@@ -148,6 +148,7 @@ typedef struct Material {
 #define MA_TYPE_SURFACE        0
 #define MA_TYPE_HALO   1
 #define MA_TYPE_VOLUME 2
+#define MA_TYPE_WIRE   3
 
 /* flag */
                /* for render */
@@ -159,7 +160,7 @@ typedef struct Material {
 #define MA_TRACEBLE            1
 #define MA_SHADOW              2
 #define MA_SHLESS              4
-#define MA_WIRE                        8
+#define MA_WIRE                        8                       /* deprecated */
 #define MA_VERTEXCOL   16
 #define MA_HALO_SOFT   16
 #define MA_HALO                        32                      /* deprecated */
index 2eab89e43b21f2c622278f16314a3d51f57c5320..f8cead563ff3a38aef22f16c1860f0a773cdddbb 100644 (file)
@@ -166,6 +166,28 @@ static void rna_MaterialTextureSlot_enabled_set(PointerRNA *ptr, int value)
        }
 }
 
+static void rna_Material_use_diffuse_ramp_set(PointerRNA *ptr, int value)
+{
+       Material *ma= (Material*)ptr->data;
+
+       if(value) ma->mode |= MA_RAMP_COL;
+       else ma->mode &= ~MA_RAMP_COL;
+
+       if((ma->mode & MA_RAMP_COL) && ma->ramp_col == NULL)
+               ma->ramp_col= add_colorband(0);
+}
+
+static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value)
+{
+       Material *ma= (Material*)ptr->data;
+
+       if(value) ma->mode |= MA_RAMP_SPEC;
+       else ma->mode &= ~MA_RAMP_SPEC;
+
+       if((ma->mode & MA_RAMP_SPEC) && ma->ramp_spec == NULL)
+               ma->ramp_spec= add_colorband(0);
+}
+
 #else
 
 static void rna_def_material_mtex(BlenderRNA *brna)
@@ -477,11 +499,23 @@ static void rna_def_material_colors(StructRNA *srna)
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
        
        /* Color bands */
+       prop= RNA_def_property(srna, "use_diffuse_ramp", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_COL);
+       RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_diffuse_ramp_set");
+       RNA_def_property_ui_text(prop, "Use Diffuse Ramp", "Toggle diffuse ramp operations.");
+       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+
        prop= RNA_def_property(srna, "diffuse_ramp", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "ramp_col");
        RNA_def_property_struct_type(prop, "ColorRamp");
        RNA_def_property_ui_text(prop, "Diffuse Ramp", "Color ramp used to affect diffuse shading.");
 
+       prop= RNA_def_property(srna, "use_specular_ramp", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_SPEC);
+       RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_specular_ramp_set");
+       RNA_def_property_ui_text(prop, "Use Specular Ramp", "Toggle specular ramp operations.");
+       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+
        prop= RNA_def_property(srna, "specular_ramp", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "ramp_spec");
        RNA_def_property_struct_type(prop, "ColorRamp");
@@ -912,7 +946,7 @@ void rna_def_material_specularity(StructRNA *srna)
 {
        PropertyRNA *prop;
        
-       static EnumPropertyItem prop_spec_shader_items[] = {
+       static EnumPropertyItem prop_specular_shader_items[] = {
                {MA_SPEC_COOKTORR, "COOKTORR", 0, "CookTorr", ""},
                {MA_SPEC_PHONG, "PHONG", 0, "Phong", ""},
                {MA_SPEC_BLINN, "BLINN", 0, "Blinn", ""},
@@ -920,9 +954,9 @@ void rna_def_material_specularity(StructRNA *srna)
                {MA_SPEC_WARDISO, "WARDISO", 0, "WardIso", ""},
                {0, NULL, 0, NULL, NULL}};
        
-       prop= RNA_def_property(srna, "spec_shader", PROP_ENUM, PROP_NONE);
+       prop= RNA_def_property(srna, "specular_shader", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "spec_shader");
-       RNA_def_property_enum_items(prop, prop_spec_shader_items);
+       RNA_def_property_enum_items(prop, prop_specular_shader_items);
        RNA_def_property_ui_text(prop, "Specular Shader Model", "");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
@@ -1042,7 +1076,8 @@ void RNA_def_material(BlenderRNA *brna)
 
        static EnumPropertyItem prop_type_items[] = {
                {MA_TYPE_SURFACE, "SURFACE", 0, "Surface", "Render object as a surface."},
-               {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."},
+               {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in ray tracing)."},
+               // {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."},
                {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles."},
                {0, NULL, 0, NULL, NULL}};
 
@@ -1128,14 +1163,9 @@ void RNA_def_material(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Shadeless", "Makes this material insensitive to light or shadow.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "wireframe", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_WIRE);
-       RNA_def_property_ui_text(prop, "Wireframe", "Render the edges of faces as wires (not supported in ray tracing).");
-       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
-       
-       prop= RNA_def_property(srna, "z_buffer", PROP_BOOLEAN, PROP_NONE);
+       prop= RNA_def_property(srna, "z_transparency", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZTRA);
-       RNA_def_property_ui_text(prop, "Z Buffer", "Enable Z-buffering of transparent faces");
+       RNA_def_property_ui_text(prop, "Z Transparency", "Enable alpha buffer for transparent faces.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
        prop= RNA_def_property(srna, "vertex_color_light", PROP_BOOLEAN, PROP_NONE);
index 5853b51a6b1616d39a51c3b4c7acc87c766f4558..2b06f164c1221a24580c3cda8c6df9c9a4400db4 100644 (file)
@@ -1250,7 +1250,7 @@ static void particle_curve(Render *re, ObjectRen *obr, DerivedMesh *dm, Material
 {
        HaloRen *har=0;
 
-       if(ma->mode&MA_WIRE)
+       if(ma->material_type == MA_TYPE_WIRE)
                static_particle_wire(obr, ma, loc, loc1, sd->first, sd->line);
        else if(ma->material_type == MA_TYPE_HALO) {
                har= RE_inithalo_particle(re, obr, dm, ma, loc, loc1, sd->orco, sd->uvco, sd->size, 1.0, seed);
@@ -1627,7 +1627,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
                path_nbr=(int)pow(2.0,(double) part->ren_step);
 
                if(path_nbr) {
-                       if((ma->material_type != MA_TYPE_HALO) && (ma->mode & MA_WIRE)==0) {
+                       if(!ELEM(ma->material_type, MA_TYPE_HALO, MA_TYPE_WIRE)) {
                                sd.orco = MEM_mallocN(3*sizeof(float)*(totpart+totchild), "particle orcos");
                                set_object_orco(re, psys, sd.orco);
                        }
@@ -3124,7 +3124,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
                                }
                                
                                /* if wire material, and we got edges, don't do the faces */
-                               if(ma->mode & MA_WIRE) {
+                               if(ma->material_type == MA_TYPE_WIRE) {
                                        end= dm->getNumEdges(dm);
                                        if(end) ok= 0;
                                }
@@ -3209,7 +3209,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
                        end= dm->getNumEdges(dm);
                        mvert= dm->getVertArray(dm);
                        ma= give_render_material(re, ob, 1);
-                       if(end && (ma->mode & MA_WIRE)) {
+                       if(end && (ma->material_type == MA_TYPE_WIRE)) {
                                MEdge *medge;
                                struct edgesort *edgetable;
                                int totedge= 0;
@@ -3834,7 +3834,7 @@ static void split_quads(ObjectRen *obr, int dir)
                vlr= RE_findOrAddVlak(obr, a);
                
                /* test if rendering as a quad or triangle, skip wire */
-               if(vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->mode & MA_WIRE)==0) {
+               if(vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
                        
                        if(vlr->v4) {
 
@@ -3884,7 +3884,7 @@ static void check_non_flat_quads(ObjectRen *obr)
                vlr= RE_findOrAddVlak(obr, a);
                
                /* test if rendering as a quad or triangle, skip wire */
-               if(vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->mode & MA_WIRE)==0) {
+               if(vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
                        
                        /* check if quad is actually triangle */
                        v1= vlr->v1;
index df74e88e87ef209481c276fc383c887c5c177802..010930fcb85d858e0e9ae928cf55c883c9c3ddb2 100644 (file)
@@ -133,7 +133,7 @@ void makeraytree(Render *re)
                        else vlr++;
                        /* baking selected to active needs non-traceable too */
                        if((re->flag & R_BAKE_TRACE) || (vlr->mat->mode & MA_TRACEBLE)) {       
-                               if((vlr->mat->mode & MA_WIRE)==0) {     
+                               if(vlr->mat->material_type != MA_TYPE_WIRE) {
                                        VECCOPY(co1, vlr->v1->co);
                                        VECCOPY(co2, vlr->v2->co);
                                        VECCOPY(co3, vlr->v3->co);
@@ -194,7 +194,7 @@ void makeraytree(Render *re)
                        else vlr++;
                        
                        if((re->flag & R_BAKE_TRACE) || (vlr->mat->mode & MA_TRACEBLE))
-                               if((vlr->mat->mode & MA_WIRE)==0)
+                               if(vlr->mat->material_type != MA_TYPE_WIRE)
                                        RE_ray_tree_add_face(re->raytree, RAY_OBJECT_SET(re, obi), vlr);
                }
        }
index 71cd678233d8c812e1c2c367a617bf75502cd10d..33085b98095a0bb51d176687c6b97ab88f0da125 100644 (file)
@@ -1557,7 +1557,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
                                ma= vlr->mat;
                                ok= 1;
                                if((ma->mode & MA_SHADBUF)==0) ok= 0;
-                               if(ma->mode & MA_WIRE) ok= 0;
+                               if(ma->material_type == MA_TYPE_WIRE) ok= 0;
                                zspanstrand.shad_alpha= zspan.shad_alpha= ma->shad_alpha;
                        }
                        
@@ -1589,7 +1589,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
                                                c4= testclip(hoco[3]); 
                                        
                                        /* ***** NO WIRE YET */                 
-                                       if(ma->mode & MA_WIRE)  {
+                                       if(ma->material_type == MA_TYPE_WIRE) {
                                                if(vlr->v4)
                                                        zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
                                                else
index 6b1d11be6f34fb2874c3fc0c43d593ade6a97365..c860e9ac5d10fc919aef2e35c410cb8d53b07b24 100644 (file)
@@ -617,7 +617,7 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float *
        /* returns not normalized, so is in viewplane coords */
        calc_view_vector(view, x, y);
        
-       if(shi->mat->mode & MA_WIRE) {
+       if(shi->mat->material_type == MA_TYPE_WIRE) {
                /* wire cannot use normal for calculating shi->co, so
                 * we reconstruct the coordinate less accurate */
                if(R.r.mode & R_ORTHO)
index 0d8f1be8c85ba507b18fea1b32f5077e3a8b5238..4436f3aa047e366f8bcafcdbf27a952ad46810d5 100644 (file)
@@ -2154,7 +2154,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
                                                ma= vlr->mat;
                                                nofill= ma->mode & (MA_ZTRA|MA_ONLYCAST);
                                                env= (ma->mode & MA_ENV);
-                                               wire= (ma->mode & MA_WIRE);
+                                               wire= (ma->material_type == MA_TYPE_WIRE);
                                                
                                                for(zsample=0; zsample<samples; zsample++) {
                                                        if(ma->mode & MA_ZINV || (zmaskpass && neg_zmask))
@@ -2341,7 +2341,7 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
                                c2= zbuf_shadow_project(cache, vlr->v2->index, obwinmat, vlr->v2->co, ho2);
                                c3= zbuf_shadow_project(cache, vlr->v3->index, obwinmat, vlr->v3->co, ho3);
 
-                               if((ma->mode & MA_WIRE) || (vlr->flag & R_STRAND)) {
+                               if((ma->material_type == MA_TYPE_WIRE) || (vlr->flag & R_STRAND)) {
                                        if(vlr->v4) {
                                                c4= zbuf_shadow_project(cache, vlr->v4->index, obwinmat, vlr->v4->co, ho4);
                                                zbufclipwire(&zspan, 0, a+1, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
@@ -2571,7 +2571,7 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo
                                                ma= vlr->mat;
                                                nofill= ma->mode & MA_ONLYCAST;
                                                env= (ma->mode & MA_ENV);
-                                               wire= (ma->mode & MA_WIRE);
+                                               wire= (ma->material_type == MA_TYPE_WIRE);
                                        }
                                }
                                else {
@@ -3357,7 +3357,7 @@ static int zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, Re
                                                        zspan= &zspans[zsample];
                                                        zspan->polygon_offset= polygon_offset;
                                
-                                                       if(ma->mode & (MA_WIRE)) {
+                                                       if(ma->material_type == MA_TYPE_WIRE) {
                                                                if(v4)
                                                                        zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
                                                                else
index 072889a530fbd19feb62aed20beb909f851e67d3..7f6a9966189841ae7212afd8c2b97a4f6e2b9b62 100644 (file)
@@ -559,7 +559,7 @@ bool ConvertMaterial(
                material->ref                   = mat->ref;
                material->amb                   = mat->amb;
 
-               material->ras_mode |= (mat->mode & MA_WIRE)? WIRE: 0;
+               material->ras_mode |= (mat->material_type == MA_TYPE_WIRE)? WIRE: 0;
        }
        else {
                int valid = 0;