2.5: Material buttons
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 15 Aug 2009 19:35:03 +0000 (19:35 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 15 Aug 2009 19:35:03 +0000 (19:35 +0000)
* Transparency is now it's own panel, with a boolean toggle
  + enum for z/ray transparency (following mockup made by
  William). Also had to change DNA flags for this.
* Disabled radiosity a bit more in render engine, it still had
  some effects like auto autosmooth.
* Make some sliders in material buttons percentages in RNA.
* Some other small tweaks in layout and naming.

18 files changed:
release/ui/buttons_material.py
release/ui/buttons_texture.py
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/material.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/preview/previewrender.c
source/blender/gpu/intern/gpu_material.c
source/blender/makesdna/DNA_material_types.h
source/blender/makesrna/intern/rna_material.c
source/blender/render/extern/include/RE_shader_ext.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/zbuf.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp

index 16abc3c91f63ac0849b2f9cbb791abae6c9e6485..ff587d47668ace337ead3aacf74126136e66daa3 100644 (file)
@@ -60,15 +60,16 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel):
                        split.template_ID(ob, "active_material", new="material.new")
                        row = split.row()
                        if slot:
-                               row.itemR(slot, "link", expand=True)
+                               row.itemR(slot, "link", text="")
                        else:
                                row.itemL()
                elif mat:
                        split.template_ID(space, "pin_id")
                        split.itemS()
+
+               layout.itemR(mat, "type", expand=True)
        
-class MATERIAL_PT_material(MaterialButtonsPanel):
-       __idname__= "MATERIAL_PT_material"
+class MATERIAL_PT_shading(MaterialButtonsPanel):
        __label__ = "Shading"
        COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
 
@@ -81,30 +82,34 @@ class MATERIAL_PT_material(MaterialButtonsPanel):
                space = context.space_data
 
                if mat:
-                       layout.itemR(mat, "type", expand=True)
 
                        if mat.type in ('SURFACE', 'WIRE', 'VOLUME'):
                                split = layout.split()
        
                                col = split.column()
-                               col.itemR(mat, "alpha", slider=True)
-                               col.itemR(mat, "ambient", slider=True)
+                               col.active = not mat.shadeless
+                               col.itemR(mat, "ambient")
                                col.itemR(mat, "emit")
-                               col.itemR(mat, "translucency", slider=True)
+                               col.itemR(mat, "translucency")
                                
                                col = split.column()
-                               col.itemR(mat, "z_transparency")
                                col.itemR(mat, "shadeless")     
-                               col.itemR(mat, "tangent_shading")
-                               col.itemR(mat, "cubic", slider=True)
+                               sub = col.column()
+                               sub.active = not mat.shadeless
+                               sub.itemR(mat, "tangent_shading")
+                               sub.itemR(mat, "cubic")
                                
                        elif mat.type == 'HALO':
-                               layout.itemR(mat, "alpha", slider=True)
+                               layout.itemR(mat, "alpha")
                        
 class MATERIAL_PT_strand(MaterialButtonsPanel):
        __label__ = "Strand"
        __default_closed__ = True
        COMPAT_ENGINES = set(['BLENDER_RENDER'])
+
+       def poll(self, context):
+               mat = context.material
+               return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
        
        def draw(self, context):
                layout = self.layout
@@ -191,8 +196,9 @@ class MATERIAL_PT_options(MaterialButtonsPanel):
                col.itemR(mat, "vertex_color_light")
                col.itemR(mat, "object_color")
 
-class MATERIAL_PT_shadows(MaterialButtonsPanel):
-       __label__ = "Shadows"
+class MATERIAL_PT_shadow(MaterialButtonsPanel):
+       __label__ = "Shadow"
+       __default_closed__ = True
        COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
 
        def draw(self, context):
@@ -207,7 +213,7 @@ class MATERIAL_PT_shadows(MaterialButtonsPanel):
                col.itemR(mat, "transparent_shadows", text="Receive Transparent")
                col.itemR(mat, "only_shadow", text="Shadows Only")
                col.itemR(mat, "cast_shadows_only", text="Cast Only")
-               col.itemR(mat, "shadow_casting_alpha", text="Casting Alpha", slider=True)
+               col.itemR(mat, "shadow_casting_alpha", text="Casting Alpha")
                
                col = split.column()
                col.itemR(mat, "cast_buffer_shadows")
@@ -239,7 +245,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
                col.itemR(mat, "diffuse_color", text="")
                sub = col.column()
                sub.active = (not mat.shadeless)
-               sub.itemR(mat, "diffuse_reflection", text="Intensity", slider=True)
+               sub.itemR(mat, "diffuse_reflection", text="Intensity")
                
                col = split.column()
                col.active = (not mat.shadeless)
@@ -255,7 +261,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
                elif mat.diffuse_shader == 'TOON':
                        row = col.row()
                        row.itemR(mat, "diffuse_toon_size", text="Size")
-                       row.itemR(mat, "diffuse_toon_smooth", text="Smooth", slider=True)
+                       row.itemR(mat, "diffuse_toon_smooth", text="Smooth")
                elif mat.diffuse_shader == 'FRESNEL':
                        row = col.row()
                        row.itemR(mat, "diffuse_fresnel", text="Fresnel")
@@ -293,7 +299,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
                
                col = split.column()
                col.itemR(mat, "specular_color", text="")
-               col.itemR(mat, "specular_reflection", text="Intensity", slider=True)
+               col.itemR(mat, "specular_reflection", text="Intensity")
 
                col = split.column()
                col.itemR(mat, "specular_shader", text="")
@@ -311,7 +317,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
                elif mat.specular_shader == 'TOON':
                        row = col.row()
                        row.itemR(mat, "specular_toon_size", text="Size")
-                       row.itemR(mat, "specular_toon_smooth", text="Smooth", slider=True)
+                       row.itemR(mat, "specular_toon_smooth", text="Smooth")
                
                if mat.use_specular_ramp:
                        layout.itemS()
@@ -354,8 +360,8 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
                col = split.column(align=True)
                col.itemR(sss, "color", text="")
                col.itemL(text="Blend:")
-               col.itemR(sss, "color_factor", text="Color", slider=True)
-               col.itemR(sss, "texture_factor", text="Texture", slider=True)
+               col.itemR(sss, "color_factor", text="Color")
+               col.itemR(sss, "texture_factor", text="Texture")
                col.itemL(text="Scattering Weight:")
                col.itemR(sss, "front")
                col.itemR(sss, "back")
@@ -367,14 +373,14 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
                col.itemR(sss, "radius", text="RGB Radius")
                col.itemR(sss, "error_tolerance")
 
-class MATERIAL_PT_raymir(MaterialButtonsPanel):
-       __label__ = "Ray Mirror"
+class MATERIAL_PT_mirror(MaterialButtonsPanel):
+       __label__ = "Mirror"
        __default_closed__ = True
        COMPAT_ENGINES = set(['BLENDER_RENDER'])
        
        def poll(self, context):
                mat = context.material
-               return mat and (mat.type in 'SURFACE', 'WIRE') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+               return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
        
        def draw_header(self, context):
                layout = self.layout
@@ -394,13 +400,13 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel):
                split = layout.split()
                
                col = split.column()
-               col.itemR(raym, "reflect", text="Reflectivity", slider=True)
+               col.itemR(raym, "reflect", text="Reflectivity")
                col.itemR(mat, "mirror_color", text="")
                col.itemL(text="Fresnel:")
                col.itemR(raym, "fresnel", text="Amount")
                sub = col.column()
                sub.active = raym.fresnel > 0
-               sub.itemR(raym, "fresnel_fac", text="Blend", slider=True)
+               sub.itemR(raym, "fresnel_factor", text="Blend")
                col.itemS()
                col.itemS()
                sub = col.split(percentage=0.4)
@@ -411,29 +417,28 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel):
                col.itemR(raym, "depth")
                col.itemR(raym, "distance", text="Max Dist")
                col.itemL(text="Gloss:")
-               col.itemR(raym, "gloss", text="Amount", slider=True)
+               col.itemR(raym, "gloss", text="Amount")
                sub = col.column()
                sub.active = raym.gloss < 1
-               sub.itemR(raym, "gloss_threshold", slider=True, text="Threshold")
+               sub.itemR(raym, "gloss_threshold", text="Threshold")
                sub.itemR(raym, "gloss_samples", text="Samples")
-               sub.itemR(raym, "gloss_anisotropic", slider=True, text="Anisotropic")
+               sub.itemR(raym, "gloss_anisotropic", text="Anisotropic")
                
                
-class MATERIAL_PT_raytransp(MaterialButtonsPanel):
-       __label__= "Ray Transparency"
+class MATERIAL_PT_transp(MaterialButtonsPanel):
+       __label__= "Transparency"
        __default_closed__ = True
        COMPAT_ENGINES = set(['BLENDER_RENDER'])
                
        def poll(self, context):
                mat = context.material
-               return mat and (mat.type in 'SURFACE', 'WIRE') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+               return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
 
        def draw_header(self, context):
                layout = self.layout
                
-               rayt = context.material.raytrace_transparency
-
-               layout.itemR(rayt, "enabled", text="")
+               mat = context.material
+               layout.itemR(mat, "transparency", text="")
 
        def draw(self, context):
                layout = self.layout
@@ -441,36 +446,47 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel):
                mat = context.material
                rayt = context.material.raytrace_transparency
                
-               layout.active = rayt.enabled and (not mat.shadeless)
+               row= layout.row()
+               row.itemR(mat, "transparency_method", expand=True)
+               row.active = mat.transparency and (not mat.shadeless)
                
                split = layout.split()
                
                col = split.column()
-               col.itemR(rayt, "ior")
-               col.itemR(rayt, "falloff")
-               col.itemR(rayt, "limit")
-               
-               col = split.column()
-               col.itemR(rayt, "depth")
-               col.itemR(rayt, "filter", slider=True)
-               col.itemR(rayt, "specular_opacity", slider=True, text="Spec Opacity")
-               
-               split = layout.split()
+               col.itemL(text="Transparency:")
+               row = col.row()
+               row.itemR(mat, "alpha")
+               row.active = mat.transparency
+               row = col.row()
+               row.itemR(mat, "specular_alpha", text="Specular")
+               row.active = mat.transparency and (not mat.shadeless)
                
                col = split.column()
+               col.active = mat.transparency and (not mat.shadeless)
                col.itemL(text="Fresnel:")
                col.itemR(rayt, "fresnel", text="Amount")
                sub = col.column()
                sub.active = rayt.fresnel > 0
-               sub.itemR(rayt, "fresnel_fac", text="Blend", slider=True)
-               
-               col = split.column()
-               col.itemL(text="Gloss:")
-               col.itemR(rayt, "gloss", text="Amount", slider=True)
-               sub = col.column()
-               sub.active = rayt.gloss < 1
-               sub.itemR(rayt, "gloss_threshold", slider=True, text="Threshold")
-               sub.itemR(rayt, "gloss_samples", text="Samples")
+               sub.itemR(rayt, "fresnel_factor", text="Blend")
+
+               if mat.transparency_method == 'RAYTRACE':
+                       split = layout.split()
+                       split.active = mat.transparency and (not mat.shadeless)
+
+                       col = split.column()
+                       col.itemR(rayt, "ior")
+                       col.itemR(rayt, "filter")
+                       col.itemR(rayt, "falloff")
+                       col.itemR(rayt, "limit")
+                       col.itemR(rayt, "depth")
+                       
+                       col = split.column()
+                       col.itemL(text="Gloss:")
+                       col.itemR(rayt, "gloss", text="Amount")
+                       sub = col.column()
+                       sub.active = rayt.gloss < 1
+                       sub.itemR(rayt, "gloss_threshold", text="Threshold")
+                       sub.itemR(rayt, "gloss_samples", text="Samples")
                
 class MATERIAL_PT_halo(MaterialButtonsPanel):
        __label__= "Halo"
@@ -492,7 +508,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
                col.itemR(mat, "diffuse_color", text="")
                col.itemR(halo, "size")
                col.itemR(halo, "hardness")
-               col.itemR(halo, "add", slider=True)
+               col.itemR(halo, "add")
                col.itemL(text="Options:")
                col.itemR(halo, "use_texture", text="Texture")
                col.itemR(halo, "use_vertex_normal", text="Vertex Normal")
@@ -526,14 +542,15 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
 
 bpy.types.register(MATERIAL_PT_context_material)
 bpy.types.register(MATERIAL_PT_preview)
-bpy.types.register(MATERIAL_PT_material)
 bpy.types.register(MATERIAL_PT_diffuse)
 bpy.types.register(MATERIAL_PT_specular)
-bpy.types.register(MATERIAL_PT_raymir)
-bpy.types.register(MATERIAL_PT_raytransp)
+bpy.types.register(MATERIAL_PT_shading)
+bpy.types.register(MATERIAL_PT_transp)
+bpy.types.register(MATERIAL_PT_mirror)
 bpy.types.register(MATERIAL_PT_sss)
 bpy.types.register(MATERIAL_PT_halo)
 bpy.types.register(MATERIAL_PT_physics)
 bpy.types.register(MATERIAL_PT_strand)
 bpy.types.register(MATERIAL_PT_options)
-bpy.types.register(MATERIAL_PT_shadows)
+bpy.types.register(MATERIAL_PT_shadow)
+
index a1c2e348f2eb4bdbef7b1895ec871deca8a90dc1..51a90b2c9ee25bf24f9537a4420cfb496055d9f6 100644 (file)
@@ -67,8 +67,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
                                                                        context.texture_paint_object \
                                                                        ):
                        split.itemR(space, "brush_texture", text="Brush", toggle=True)
-               
-               layout.itemS()
 
                if tex:
                        split = layout.split(percentage=0.2)
index a72f26f6157a534f7614deded385d9f79c324695..2f0e09315883c7e51ae1842601b77652d3808286 100644 (file)
@@ -160,7 +160,7 @@ static AdrBit2Path ma_mode_bits[]= {
 //     {MA_SHADOW, "shadow", 0},
 //     {MA_SHLESS, "shadeless", 0},
 //     ...
-       {MA_RAYTRANSP, "raytrace_transparency.enabled", 0},
+       {MA_RAYTRANSP, "transparency", 0},
        {MA_RAYMIRROR, "raytrace_mirror.enabled", 0},
 //     {MA_HALO, "type", MA_TYPE_HALO}
 };
index 08a19cada7d49070c91d1c380aa701c11095d1b6..50db2bfe706bc13a16aba35d8f6deea45b1794f0 100644 (file)
@@ -170,7 +170,7 @@ void init_material(Material *ma)
        ma->sss_front= 1.0f;
        ma->sss_back= 1.0f;
 
-       ma->mode= MA_TRACEBLE|MA_SHADBUF|MA_SHADOW|MA_RADIO|MA_RAYBIAS|MA_TANGENT_STR;
+       ma->mode= MA_TRACEBLE|MA_SHADBUF|MA_SHADOW|MA_RAYBIAS|MA_TANGENT_STR;
 
        ma->preview = NULL;
 }
@@ -678,9 +678,6 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
        if(needtang) ma->mode |= MA_NORMAP_TANG;
        else ma->mode &= ~MA_NORMAP_TANG;
        
-       if(r_mode & R_RADIO)
-               if(ma->mode & MA_RADIO) needuv= 1;
-       
        if(ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
                needuv= 1;
                if(r_mode & R_OSA) ma->texco |= TEXCO_OSA;              /* for texfaces */
@@ -689,7 +686,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
        
        /* since the raytracer doesnt recalc O structs for each ray, we have to preset them all */
        if(r_mode & R_RAYTRACE) {
-               if(ma->mode & (MA_RAYMIRROR|MA_RAYTRANSP|MA_SHADOW_TRA)) { 
+               if((ma->mode & (MA_RAYMIRROR|MA_SHADOW_TRA)) || ((ma->mode && MA_TRANSP) && (ma->mode & MA_RAYTRANSP))) { 
                        ma->texco |= NEED_UV|TEXCO_ORCO|TEXCO_REFL|TEXCO_NORM;
                        if(r_mode & R_OSA) ma->texco |= TEXCO_OSA;
                }
index a4dd61f82f7142b4f9c31141b9cfa6f157c8fb0c..72d7c61778fd1a30bdb29e142db780f9add695d1 100644 (file)
@@ -5726,7 +5726,7 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
                                tf = ((MTFace*)me->fdata.layers[b].data) + a;
 
                                tf->mode &= ~TF_ALPHASORT;
-                               if(ma && (ma->mode & MA_ZTRA))
+                               if(ma && (ma->mode & MA_ZTRANSP))
                                        if(ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP)))
                                                tf->mode |= TF_ALPHASORT;
                        }
@@ -9463,6 +9463,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                ma->mode &= ~MA_HALO;
                        }
 
+                       if(ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) {
+                               ma->mode |= MA_TRANSP;
+                       }
+                       else {
+                               ma->mode |= MA_ZTRANSP;
+                               ma->mode &= ~MA_TRANSP;
+                       }
+
                        /* set new bump for unused slots */
                        for(a=0; a<MAX_MTEX; a++) {
                                if(ma->mtex[a]) {
index c5a741b11ed49a1adb0c35002cb4092f26399f44..159e644bb390aa060242688cfce098648e7289f7 100644 (file)
@@ -304,7 +304,9 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
                                end_render_material(mat);
                                
                                /* turn on raytracing if needed */
-                               if(mat->mode_l & (MA_RAYTRANSP|MA_RAYMIRROR))
+                               if(mat->mode_l & MA_RAYMIRROR)
+                                       sce->r.mode |= R_RAYTRACE;
+                               if((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
                                        sce->r.mode |= R_RAYTRACE;
                                if(mat->sss_flag & MA_DIFF_SSS)
                                        sce->r.mode |= R_SSS;
index 7e8b5c18d71a295eca805ff53837ad3a7e8b299a..067f4d8021de2148ea2a0318022f51cc83877c26 100644 (file)
@@ -1139,7 +1139,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
 
        do_material_tex(shi);
 
-       if(ma->mode & MA_ZTRA)
+       if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
                GPU_material_enable_alpha(mat);
 
        if((G.fileflags & G_FILE_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
@@ -1213,7 +1213,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
                        GPU_uniform(&world->horr), &shr->combined);
        }
 
-       if(!(ma->mode & MA_ZTRA)) {
+       if(!((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))) {
                if(world && (GPU_link_changed(shr->alpha) || ma->alpha != 1.0f))
                        GPU_link(mat, "shade_world_mix", GPU_uniform(&world->horr),
                                shr->combined, &shr->combined);
index 8428e750025bd7554a8577777b8652503476c7c3..f7b3273c2e1b018d1e230ea60e9eadc555afe82e 100644 (file)
@@ -164,7 +164,7 @@ typedef struct Material {
 #define MA_VERTEXCOL   16
 #define MA_HALO_SOFT   16
 #define MA_HALO                        32                      /* deprecated */
-#define MA_ZTRA                        64
+#define MA_ZTRANSP             64
 #define MA_VERTEXCOLP  128
 #define MA_ZINV                        256
 #define MA_HALO_RINGS  256
@@ -180,7 +180,7 @@ typedef struct Material {
 #define MA_NOMIST              0x4000
 #define MA_HALO_SHADE  0x4000
 #define MA_HALO_FLARE  0x8000
-#define MA_RADIO               0x10000
+#define MA_TRANSP              0x10000
 #define MA_RAYTRANSP   0x20000
 #define MA_RAYMIRROR   0x40000
 #define MA_SHADOW_TRA  0x80000
index 4ac3996d0a57b78abdf04d2e57e74114f7427e5d..66c08c4da4cde376b251489d8960d186cb6833ce 100644 (file)
@@ -527,10 +527,16 @@ static void rna_def_material_colors(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Mirror Color", "Mirror color of the material.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Alpha", "Alpha transparency of the material.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+
+       prop= RNA_def_property(srna, "specular_alpha", PROP_FLOAT, PROP_PERCENTAGE);
+       RNA_def_property_float_sdna(prop, NULL, "spectra");
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_text(prop, "Specular Alpha", "Alpha transparency for specular areas.");
+       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
        /* Color bands */
        prop= RNA_def_property(srna, "use_diffuse_ramp", PROP_BOOLEAN, PROP_NONE);
@@ -599,7 +605,7 @@ static void rna_def_material_diffuse(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Diffuse Shader Model", "");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "diffuse_reflection", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "diffuse_reflection", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "ref");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Diffuse Reflection", "Amount of diffuse reflection.");
@@ -616,7 +622,7 @@ static void rna_def_material_diffuse(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Diffuse Toon Size", "Size of diffuse toon area.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 
-       prop= RNA_def_property(srna, "diffuse_toon_smooth", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "diffuse_toon_smooth", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "param[1]");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Diffuse Toon Smooth", "Smoothness of diffuse toon area.");
@@ -660,7 +666,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Enabled", "Enable raytraced reflections.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
                
-       prop= RNA_def_property(srna, "reflect", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "reflect", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "ray_mirror");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Reflect", "Sets the amount mirror reflection for raytrace.");
@@ -672,19 +678,19 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Fresnel", "Power of Fresnel for mirror reflection.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "fresnel_fac", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "fresnel_mir_i");
        RNA_def_property_range(prop, 0.0f, 5.0f);
        RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "gloss_mir");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Gloss", "The shininess of the reflection. Values < 1.0 give diffuse, blurry reflections.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "gloss_anisotropic", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "gloss_anisotropic", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "aniso_gloss_mir");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Gloss Anisotropy", "The shape of the reflection, from 0.0 (circular) to 1.0 (fully stretched along the tangent.");
@@ -696,7 +702,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Gloss Samples", "Number of cone samples averaged for blurry reflections.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "adapt_thresh_mir");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped.");
@@ -731,11 +737,6 @@ static void rna_def_material_raytra(BlenderRNA *brna)
        RNA_def_struct_nested(brna, srna, "Material");
        RNA_def_struct_ui_text(srna, "Material Raytrace Transparency", "Raytraced refraction settings for a Material datablock.");
 
-       prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYTRANSP); /* use bitflags */
-       RNA_def_property_ui_text(prop, "Enabled", "Enables raytracing for transparent refraction rendering.");
-       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
-       
        prop= RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "ang");
        RNA_def_property_range(prop, 1.0f, 3.0f);
@@ -748,13 +749,13 @@ static void rna_def_material_raytra(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Fresnel", "Power of Fresnel for transparency (Ray or ZTransp).");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "fresnel_fac", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "fresnel_tra_i");
        RNA_def_property_range(prop, 1.0f, 5.0f);
        RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "gloss", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "gloss_tra");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Gloss", "The clarity of the refraction. Values < 1.0 give diffuse, blurry refractions.");
@@ -766,7 +767,7 @@ static void rna_def_material_raytra(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Gloss Samples", "Number of cone samples averaged for blurry refractions.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "adapt_thresh_tra");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped.");
@@ -778,7 +779,7 @@ static void rna_def_material_raytra(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-refractions.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "filter", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "filter", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "filter");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Filter", "Amount to blend in the material's diffuse color in raytraced transparency (simulating absorption).");
@@ -795,12 +796,6 @@ static void rna_def_material_raytra(BlenderRNA *brna)
        RNA_def_property_range(prop, 0.1f, 10.0f);
        RNA_def_property_ui_text(prop, "Falloff", "Falloff power for transmissivity filter effect (1.0 is linear).");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
-       
-       prop= RNA_def_property(srna, "specular_opacity", PROP_FLOAT, PROP_NONE);
-       RNA_def_property_float_sdna(prop, NULL, "spectra");
-       RNA_def_property_range(prop, 0.0f, 1.0f);
-       RNA_def_property_ui_text(prop, "Specular Opacity", "Makes specular areas opaque on transparent materials.");
-       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 }
 
 static void rna_def_material_halo(BlenderRNA *brna)
@@ -825,7 +820,7 @@ static void rna_def_material_halo(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Hardness", "Sets the hardness of the halo.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "add", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "add", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "add");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Add", "Sets the strength of the add effect.");
@@ -971,13 +966,13 @@ static void rna_def_material_sss(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "IOR", "Index of refraction (higher values are denser).");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 
-       prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "sss_colfac");
        RNA_def_property_ui_range(prop, 0, 1, 10, 3);
        RNA_def_property_ui_text(prop, "Color Factor", "Blend factor for SSS colors.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 
-       prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "sss_texfac");
        RNA_def_property_ui_range(prop, 0, 1, 10, 3);
        RNA_def_property_ui_text(prop, "Texture Factor", "Texture scatting blend factor.");
@@ -1019,7 +1014,7 @@ void rna_def_material_specularity(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Specular Shader Model", "");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "specular_reflection", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "specular_reflection", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "spec");
        RNA_def_property_range(prop, 0, 1);
        RNA_def_property_ui_text(prop, "Specularity Intensity", "");
@@ -1048,7 +1043,7 @@ void rna_def_material_specularity(StructRNA *srna)
        RNA_def_property_ui_text(prop, "Specular Toon Size", "Size of specular toon area.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 
-       prop= RNA_def_property(srna, "specular_toon_smooth", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "specular_toon_smooth", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "param[3]");
        RNA_def_property_range(prop, 0.0f, 1.0f);
        RNA_def_property_ui_text(prop, "Specular Toon Smooth", "Ssmoothness of specular toon area.");
@@ -1179,6 +1174,10 @@ void RNA_def_material(BlenderRNA *brna)
                // {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}};
+       static EnumPropertyItem transparency_items[] = {
+               {MA_ZTRANSP, "Z_TRANSPARENCY", 0, "Z Transparency", "Use alpha buffer for transparent faces."},
+               {MA_RAYTRANSP, "RAYTRACE", 0, "Raytrace", "Use raytracing for transparent refraction rendering."},
+               {0, NULL, 0, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "Material", "ID");
        RNA_def_struct_ui_text(srna, "Material", "Material datablock to defined the appearance of geometric objects for rendering.");
@@ -1190,8 +1189,19 @@ void RNA_def_material(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Type", "Material type defining how the object is rendered.");
        RNA_def_property_enum_funcs(prop, NULL, "rna_Material_type_set", NULL);
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL);
+
+       prop= RNA_def_property(srna, "transparency", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TRANSP);
+       RNA_def_property_ui_text(prop, "Transparency", "Render material as transparent.");
+       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
+
+       prop= RNA_def_property(srna, "transparency_method", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
+       RNA_def_property_enum_items(prop, transparency_items);
+       RNA_def_property_ui_text(prop, "Transparency Method", "Method to use for rendering transparency.");
+       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "amb");
        RNA_def_property_range(prop, 0, 1);
        RNA_def_property_ui_text(prop, "Ambient", "Amount of global ambient color the material receives.");
@@ -1202,7 +1212,7 @@ void RNA_def_material(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Emit", "Amount of light to emit.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 
-       prop= RNA_def_property(srna, "translucency", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "translucency", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_range(prop, 0, 1);
        RNA_def_property_ui_text(prop, "Translucency", "Amount of diffuse shading on the back side.");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
@@ -1227,7 +1237,7 @@ void RNA_def_material(BlenderRNA *brna)
        RNA_def_property_range(prop, 0, 10);
        RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Factor to multiply shadow buffer bias with (0 is ignore.)");
 
-       prop= RNA_def_property(srna, "shadow_casting_alpha", PROP_FLOAT, PROP_NONE);
+       prop= RNA_def_property(srna, "shadow_casting_alpha", PROP_FLOAT, PROP_PERCENTAGE);
        RNA_def_property_float_sdna(prop, NULL, "shad_alpha");
        RNA_def_property_range(prop, 0.001, 1);
        RNA_def_property_ui_text(prop, "Shadow Casting Alpha", "Shadow casting alpha, only in use for Irregular Shadowbuffer.");
@@ -1262,11 +1272,6 @@ 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, "z_transparency", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZTRA);
-       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);
        RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_VERTEXCOL);
        RNA_def_property_ui_text(prop, "Vertex Color Light", "Add vertex colors as additional lighting.");
@@ -1312,11 +1317,6 @@ void RNA_def_material(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Exclude Mist", "Excludes this material from mist effects (in world settings)");
        RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
        
-       prop= RNA_def_property(srna, "radiosity", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RADIO);
-       RNA_def_property_ui_text(prop, "Radiosity", "Include this material in radiosity calculations");
-       RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
-       
        prop= RNA_def_property(srna, "transparent_shadows", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW_TRA);
        RNA_def_property_ui_text(prop, "Transparent Shadows", "Allow this object to receive transparent shadows casted through other objects");
index 0ad48fe97a970328733c1e0e60f492bb75f90f78..5f5b493a9ecef60c83c7a1857c8863514c94c48e 100644 (file)
@@ -55,7 +55,6 @@ typedef struct ShadeResult
        float refl[3];
        float refr[3];
        float nor[3];
-       float rad[3];
        float winspeed[4];
 } ShadeResult;
 
@@ -132,7 +131,7 @@ typedef struct ShadeInput
        float layerfac;
        
        /* texture coordinates */
-       float lo[3], gl[3], ref[3], orn[3], winco[3], sticky[3], vcol[4], rad[3];
+       float lo[3], gl[3], ref[3], orn[3], winco[3], sticky[3], vcol[4];
        float refcol[4], displace[3];
        float strandco, tang[3], nmaptang[3], stress, winspeed[4];
        float duplilo[3], dupliuv[3];
index 2b06f164c1221a24580c3cda8c6df9c9a4400db4..2c264ce2337f5912ba5f4e07946de24229af03bd 100644 (file)
@@ -895,7 +895,7 @@ static void flag_render_node_material(Render *re, bNodeTree *ntree)
                        if(GS(node->id->name)==ID_MA) {
                                Material *ma= (Material *)node->id;
 
-                               if(ma->mode & MA_ZTRA)
+                               if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
                                        re->flag |= R_ZTRA;
 
                                ma->flag |= MA_IS_USED;
@@ -917,7 +917,7 @@ static Material *give_render_material(Render *re, Object *ob, int nr)
        
        if(re->r.mode & R_SPEED) ma->texco |= NEED_UV;
        
-       if(ma->mode & MA_ZTRA)
+       if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
                re->flag |= R_ZTRA;
        
        /* for light groups */
@@ -3025,11 +3025,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
                                }
                                need_nmap_tangent= 1;
                        }
-
-                       /* radio faces need autosmooth, to separate shared vertices in corners */
-                       if(re->r.mode & R_RADIO)
-                               if(ma->mode & MA_RADIO) 
-                                       do_autosmooth= 1;
                }
        }
 
@@ -3799,7 +3794,7 @@ static void set_phong_threshold(ObjectRen *obr)
 static void set_fullsample_flag(Render *re, ObjectRen *obr)
 {
        VlakRen *vlr;
-       int a, trace;
+       int a, trace, mode;
 
        if(re->osa==0)
                return;
@@ -3808,12 +3803,13 @@ static void set_fullsample_flag(Render *re, ObjectRen *obr)
        
        for(a=obr->totvlak-1; a>=0; a--) {
                vlr= RE_findOrAddVlak(obr, a);
+               mode= vlr->mat->mode;
                
-               if(vlr->mat->mode & MA_FULL_OSA) 
+               if(mode & MA_FULL_OSA) 
                        vlr->flag |= R_FULL_OSA;
                else if(trace) {
-                       if(vlr->mat->mode & MA_SHLESS);
-                       else if(vlr->mat->mode & (MA_RAYTRANSP|MA_RAYMIRROR))
+                       if(mode & MA_SHLESS);
+                       else if((mode & MA_RAYMIRROR) || ((mode & MA_TRANSP) && (mode & MA_RAYTRANSP)))
                                /* for blurry reflect/refract, better to take more samples 
                                 * inside the raytrace than as OSA samples */
                                if ((vlr->mat->gloss_mir == 1.0) && (vlr->mat->gloss_tra == 1.0)) 
index 010930fcb85d858e0e9ae928cf55c883c9c3ddb2..0c8749ce3292c1d6697a6a6997f65dc1035683a1 100644 (file)
@@ -361,7 +361,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr)
 {
        float dx, dy, dz, d, p;
 
-       if (0 == (shi->mat->mode & (MA_RAYTRANSP|MA_ZTRA)))
+       if (0 == (shi->mat->mode & MA_TRANSP))
                return -1;
           
        if (shi->mat->tx_limit <= 0.0f) {
@@ -468,7 +468,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
                
                if(depth>0) {
 
-                       if(shi.mat->mode_l & (MA_RAYTRANSP|MA_ZTRA) && shr.alpha < 1.0f) {
+                       if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f) {
                                float nf, f, f1, refract[3], tracol[4];
                                
                                tracol[0]= shi.r;
@@ -476,7 +476,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
                                tracol[2]= shi.b;
                                tracol[3]= col[3];      // we pass on and accumulate alpha
                                
-                               if(shi.mat->mode & MA_RAYTRANSP) {
+                               if((shi.mat->mode & MA_TRANSP) && (shi.mat->mode & MA_RAYTRANSP)) {
                                        /* odd depths: use normal facing viewer, otherwise flip */
                                        if(traflag & RAY_TRAFLIP) {
                                                float norm[3];
@@ -1183,7 +1183,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
        float diff[3];
        int do_tra, do_mir;
        
-       do_tra= ((shi->mat->mode & (MA_RAYTRANSP)) && shr->alpha!=1.0f);
+       do_tra= ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f);
        do_mir= ((shi->mat->mode & MA_RAYMIRROR) && shi->ray_mirror!=0.0f);
 
        
index 3a3d6f57830910652b81f8d3d57550887332f466..b774bf6374da06bea9888a798ed1f9b777b76a7e 100644 (file)
@@ -477,7 +477,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
                                col= shr->refr;
                                break;
                        case SCE_PASS_RADIO:
-                               col= shr->rad;
+                               col= NULL; // removed shr->rad;
                                break;
                        case SCE_PASS_NORMAL:
                                col= shr->nor;
@@ -569,7 +569,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
                                col= shr->refr;
                                break;
                        case SCE_PASS_RADIO:
-                               col= shr->rad;
+                               col= NULL; // removed shr->rad;
                                break;
                        case SCE_PASS_NORMAL:
                                col= shr->nor;
index c860e9ac5d10fc919aef2e35c410cb8d53b07b24..857b401e29885a8ec0659a757d4a2f7988c151da 100644 (file)
@@ -156,13 +156,13 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
        /* depth >= 1 when ray-shading */
        if(shi->depth==0) {
                if(R.r.mode & R_RAYTRACE) {
-                       if(shi->ray_mirror!=0.0f || ((shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
+                       if(shi->ray_mirror!=0.0f || ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
                                /* ray trace works on combined, but gives pass info */
                                ray_trace(shi, shr);
                        }
                }
                /* disable adding of sky for raytransp */
-               if(shi->mat->mode & MA_RAYTRANSP) 
+               if((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP))
                        if((shi->layflag & SCE_LAY_SKY) && (R.r.alphamode==R_ADDSKY))
                                shr->alpha= 1.0f;
        }       
@@ -190,7 +190,6 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
        if(shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL|SCE_PASS_RADIO)) {
                QUATCOPY(shr->winspeed, shi->winspeed);
                VECCOPY(shr->nor, shi->vn);
-               VECCOPY(shr->rad, shi->rad);
        }
        
        /* MIST */
@@ -558,10 +557,6 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
                        shi->orn[2]= -shi->vn[2];
                }
 
-               if(mode & MA_RADIO) {
-                       /* not supported */
-               }
-
                if(texco & TEXCO_REFL) {
                        /* mirror reflection color textures (and envmap) */
                        calc_R_ref(shi);    /* wrong location for normal maps! XXXXXXXXXXXXXX */
@@ -580,8 +575,6 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
                }
        }
 
-       shi->rad[0]= shi->rad[1]= shi->rad[2]= 0.0f;
-
        /* this only avalailable for scanline renders */
        if(shi->depth==0) {
                if(texco & TEXCO_WINDOW) {
@@ -1154,24 +1147,6 @@ void shade_input_set_shade_texco(ShadeInput *shi)
                        shi->orn[2]= -shi->vn[2];
                }
                
-               if(mode & MA_RADIO) {
-                       float *r1, *r2, *r3;
-                       
-                       r1= RE_vertren_get_rad(obr, v1, 0);
-                       r2= RE_vertren_get_rad(obr, v2, 0);
-                       r3= RE_vertren_get_rad(obr, v3, 0);
-                       
-                       if(r1 && r2 && r3) {
-                               shi->rad[0]= (l*r3[0] - u*r1[0] - v*r2[0]);
-                               shi->rad[1]= (l*r3[1] - u*r1[1] - v*r2[1]);
-                               shi->rad[2]= (l*r3[2] - u*r1[2] - v*r2[2]);
-                       }
-                       else
-                               shi->rad[0]= shi->rad[1]= shi->rad[2]= 0.0f;
-               }
-               else
-                       shi->rad[0]= shi->rad[1]= shi->rad[2]= 0.0f;
-               
                if(texco & TEXCO_REFL) {
                        /* mirror reflection color textures (and envmap) */
                        calc_R_ref(shi);        /* wrong location for normal maps! XXXXXXXXXXXXXX */
@@ -1199,8 +1174,6 @@ void shade_input_set_shade_texco(ShadeInput *shi)
                        }
                }
        }
-       else
-               shi->rad[0]= shi->rad[1]= shi->rad[2]= 0.0f;
        
        /* this only avalailable for scanline renders */
        if(shi->depth==0) {
index 2fbd93df0ce02c10b9bbd5ecd9606a744f2ca86d..d5c8cf30b3000ec13466bd393144198012f1c701 100644 (file)
@@ -1713,7 +1713,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
                        shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
                        
                /* note: shi->mode! */
-               if(shi->mode & (MA_ZTRA|MA_RAYTRANSP)) {
+               if(shi->mode & MA_TRANSP) {
                        if(shi->spectra!=0.0f) {
                                float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]);
                                t *= shi->spectra;
@@ -1730,11 +1730,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
                shr->combined[1]+= shi->ambg;
                shr->combined[2]+= shi->ambb;
 
+               /* removed
                if(shi->combinedflag & SCE_PASS_RADIO) {
                        shr->combined[0]+= shi->r*shi->amb*shi->rad[0];
                        shr->combined[1]+= shi->g*shi->amb*shi->rad[1];
                        shr->combined[2]+= shi->b*shi->amb*shi->rad[2];
-               }
+               }*/
                
                /* add AO in combined? */
                if(R.wrld.mode & WO_AMB_OCC) {
index a47fef840ca289c568e57189469f0a31fbd75e1f..6e2a0e966dcb9458d7ec5b8a4a1c22b179de4643 100644 (file)
@@ -234,8 +234,8 @@ void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, Sha
                        interpolate_vec3(shr1->refl, shr2->refl, t, negt, shr->refl);
                if(addpassflag & SCE_PASS_REFRACT)
                        interpolate_vec3(shr1->refr, shr2->refr, t, negt, shr->refr);
-               if(addpassflag & SCE_PASS_RADIO)
-                       interpolate_vec3(shr1->rad, shr2->rad, t, negt, shr->rad);
+               /* removed if(addpassflag & SCE_PASS_RADIO)
+                       interpolate_vec3(shr1->rad, shr2->rad, t, negt, shr->rad);*/
                if(addpassflag & SCE_PASS_MIST)
                        interpolate_vec1(&shr1->mist, &shr2->mist, t, negt, &shr->mist);
        }
index 4436f3aa047e366f8bcafcdbf27a952ad46810d5..53a05dd0d671642bda6c96145e0e97d8c07024e9 100644 (file)
@@ -2152,7 +2152,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
                                if(obi->lay & lay) {
                                        if(vlr->mat!=ma) {
                                                ma= vlr->mat;
-                                               nofill= ma->mode & (MA_ZTRA|MA_ONLYCAST);
+                                               nofill= (ma->mode & MA_ONLYCAST) || ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP));
                                                env= (ma->mode & MA_ENV);
                                                wire= (ma->material_type == MA_TYPE_WIRE);
                                                
@@ -3306,7 +3306,7 @@ static int zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, Re
                        
                        if(vlr->mat!=ma) {
                                ma= vlr->mat;
-                               dofill= (ma->mode & MA_ZTRA) && !(ma->mode & MA_ONLYCAST);
+                               dofill= ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) && !(ma->mode & MA_ONLYCAST);
                        }
                        
                        if(dofill) {
@@ -3480,7 +3480,7 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
                                col= shr->refl;
                                break;
                        case SCE_PASS_RADIO:
-                               col= shr->rad;
+                               col= NULL; // removed shr->rad;
                                break;
                        case SCE_PASS_REFRACT:
                                col= shr->refr;
@@ -3582,7 +3582,7 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
                                col= shr->refr;
                                break;
                        case SCE_PASS_RADIO:
-                               col= shr->rad;
+                               col= NULL; // removed shr->rad;
                                break;
                        case SCE_PASS_NORMAL:
                                col= shr->nor;
@@ -3817,8 +3817,8 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
                                        if(addpassflag & SCE_PASS_REFRACT)
                                                addvecmul(samp_shr->refr, shr->refr, fac);
                                        
-                                       if(addpassflag & SCE_PASS_RADIO)
-                                               addvecmul(samp_shr->rad, shr->rad, fac);
+                                       /* removed if(addpassflag & SCE_PASS_RADIO)
+                                               addvecmul(samp_shr->rad, shr->rad, fac);*/
                                        
                                        if(addpassflag & SCE_PASS_MIST)
                                                samp_shr->mist= samp_shr->mist+fac*shr->mist;
index 2c7df80a3fcc9335a0829d5531ac103944457750..7572453fdab5f886b95b3e020c994a5ba117debc 100644 (file)
@@ -623,7 +623,7 @@ bool ConvertMaterial(
        }
 
        // with ztransp enabled, enforce alpha blending mode
-       if(validmat && (mat->mode & MA_ZTRA) && (material->transp == TF_SOLID))
+       if(validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->transp == TF_SOLID))
                material->transp = TF_ALPHA;
 
        // always zsort alpha + add