Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorErvin Weber <ervin.weber@gmail.com>2011-03-11 10:59:43 +0300
committerErvin Weber <ervin.weber@gmail.com>2011-03-11 10:59:43 +0300
commit102c5e0ad4db69828efaf66845a00a62a2075fe2 (patch)
tree650d4cb325159913f066a392606231a9697b7e0e /source
parentbfe5a6ed8ffb4502aafe20bbb0815b0b4a58d504 (diff)
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenloader/intern/readfile.c23
-rw-r--r--source/blender/makesrna/intern/rna_material.c1
-rw-r--r--source/blender/render/intern/source/convertblender.c2
-rw-r--r--source/blender/render/intern/source/rayshade.c2
-rw-r--r--source/blender/render/intern/source/shadeoutput.c20
6 files changed, 40 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index f6bb4fbb635..6cbc49e19c8 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -44,7 +44,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather then defining with quotes */
#define BLENDER_VERSION 256
-#define BLENDER_SUBVERSION 2
+#define BLENDER_SUBVERSION 3
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 27690cb595f..3b69d73f7bf 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -11488,6 +11488,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)){
+
+ Material *mat;
+ int tex_nr, transp_tex;
+
+ for(mat = main->mat.first; mat; mat = mat->id.next){
+ if(!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)){
+
+ transp_tex= 0;
+
+ for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++){
+ if(!mat->mtex[tex_nr]) continue;
+ if(mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
+ }
+
+ if(mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex){
+ mat->mode |= MA_TRANSP;
+ mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
+ }
+ }
+ }
+ }
+
/* put compatibility code here until next subversion bump */
{
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 66939b58550..e593f305094 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -1569,6 +1569,7 @@ void RNA_def_material(BlenderRNA *brna)
{MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem transparency_items[] = {
+ {0, "MASK", 0, "Mask", "Mask the background"},
{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}};
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 81652f5a290..d7eb22b5fc7 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -3350,7 +3350,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
/* test for 100% transparant */
ok= 1;
- if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f) {
+ if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP)) {
ok= 0;
/* texture on transparency? */
for(a=0; a<MAX_MTEX; a++) {
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 6f639de70d5..c69507e6bf5 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -762,7 +762,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo
if(depth>0) {
float fr, fg, fb, f, f1;
- if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f) {
+ if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) {
float nf, f, refract[3], tracol[4];
tracol[0]= shi.r;
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 0081f809a09..768f1425c6f 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -878,7 +878,9 @@ void shade_color(ShadeInput *shi, ShadeResult *shr)
if(ma->fresnel_tra!=0.0f)
shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
-
+
+ if (!(shi->mode & MA_TRANSP)) shi->alpha= 1.0f;
+
shr->diff[0]= shi->r;
shr->diff[1]= shi->g;
shr->diff[2]= shi->b;
@@ -1578,7 +1580,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
accum = 1.0f - shaded;
}}
- shr->alpha= (shi->mat->alpha)*(accum);
+ shr->alpha= (shi->alpha)*(accum);
}
else {
/* If "fully shaded", use full alpha even on areas that have no lights */
@@ -1638,6 +1640,8 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
memset(shr, 0, sizeof(ShadeResult));
+ if(!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
+
/* separate loop */
if(ma->mode & MA_ONLYSHADOW) {
shade_lamp_loop_only_shadow(shi, shr);
@@ -1654,10 +1658,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shi->g= shi->vcol[1];
shi->b= shi->vcol[2];
if(ma->mode & (MA_FACETEXTURE_ALPHA))
- shi->alpha= shi->vcol[3];
+ shi->alpha= (shi->mode & MA_TRANSP) ? shi->vcol[3] : 1.0f;
}
- if(ma->texco)
+ if(ma->texco){
do_material_tex(shi);
+ if (!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
+ }
shr->col[0]= shi->r*shi->alpha;
shr->col[1]= shi->g*shi->alpha;
@@ -1812,11 +1818,11 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
/* alpha in end, spec can influence it */
if(passflag & (SCE_PASS_COMBINED)) {
- if(ma->fresnel_tra!=0.0f)
+ if((ma->fresnel_tra!=0.0f) && (shi->mode & MA_TRANSP))
shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
/* note: shi->mode! */
- if(shi->mode & MA_TRANSP) {
+ if(shi->mode & MA_TRANSP && (shi->mode & (MA_ZTRANSP|MA_RAYTRANSP))) {
if(shi->spectra!=0.0f) {
float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]);
t *= shi->spectra;
@@ -1886,7 +1892,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shr->combined[0] *= obcol[0];
shr->combined[1] *= obcol[1];
shr->combined[2] *= obcol[2];
- shr->alpha *= obcol[3];
+ if (shi->mode & MA_TRANSP) shr->alpha *= obcol[3];
}
}