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
diff options
context:
space:
mode:
authorMatt Ebb <matt@mke3.net>2007-11-15 03:11:00 +0300
committerMatt Ebb <matt@mke3.net>2007-11-15 03:11:00 +0300
commitd273ae05712901ef7619219db9864a3734bf4f22 (patch)
tree60ca5c1c584eb60bbc1d06bf1929d942574279a3 /source/blender/render/intern
parenteedfb86ea57f17445f8f7e5fe9affd620843b70c (diff)
* New material option: TexFace Alpha
This is an additional option for 'TexFace', which uses the alpha of the UV assigned faces as well as the colour. It appears in material buttons as a little 'A' button next to 'TexFace', when 'TexFace is switched on. It's a bit horrible, but no point tweaking that layout in isolation at this stage. This image is using texface alpha, with different assigned images, all sharing the one material: http://mke3.net/blender/devel/rendering/texface_alpha.jpg Usually I consider texface (and teaching people to use it for UV mapping) to be pretty evil, but in some cases, when you have lots of separate images that you want to control in the one material, it can be quite handy.
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r--source/blender/render/intern/source/shadeinput.c4
-rw-r--r--source/blender/render/intern/source/shadeoutput.c8
-rw-r--r--source/blender/render/intern/source/texture.c1
3 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index ca661469b36..71b59f7b8be 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -675,11 +675,13 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->vcol[0]= shi->col[0].col[0];
shi->vcol[1]= shi->col[0].col[1];
shi->vcol[2]= shi->col[0].col[2];
+ shi->vcol[3]= 1.0f;
}
else {
shi->vcol[0]= 0.0f;
shi->vcol[1]= 0.0f;
shi->vcol[2]= 0.0f;
+ shi->vcol[3]= 1.0f;
}
}
@@ -721,6 +723,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->vcol[0]= 1.0f;
shi->vcol[1]= 1.0f;
shi->vcol[2]= 1.0f;
+ shi->vcol[3]= 1.0f;
}
if(tface && tface->tpage)
render_realtime_texture(shi, tface->tpage);
@@ -739,6 +742,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
shi->vcol[0]= 1.0f;
shi->vcol[1]= 1.0f;
shi->vcol[2]= 1.0f;
+ shi->vcol[3]= 1.0f;
}
}
}
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 24eabffdf6f..56cb226560a 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -829,6 +829,8 @@ void shade_color(ShadeInput *shi, ShadeResult *shr)
shi->r= shi->vcol[0];
shi->g= shi->vcol[1];
shi->b= shi->vcol[2];
+ if(ma->mode & (MA_FACETEXTURE_ALPHA))
+ shi->alpha= shi->vcol[3];
}
if(ma->texco)
@@ -1149,6 +1151,10 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
if (lar->energy == 0.0) return;
+ /* optimisation, don't render fully black lamps */
+ if (!(lar->mode & LA_TEXTURE) && (lar->r + lar->g + lar->b == 0.0f))
+ return;
+
/* lampdist, spot angle, area side, ... */
visifac= lamp_get_visibility(lar, shi->co, lv, &lampdist);
if(visifac==0.0f)
@@ -1471,6 +1477,8 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shi->r= shi->vcol[0];
shi->g= shi->vcol[1];
shi->b= shi->vcol[2];
+ if(ma->mode & (MA_FACETEXTURE_ALPHA))
+ shi->alpha= shi->vcol[3];
}
if(ma->texco)
do_material_tex(shi);
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index 8c366593034..f541b161e0a 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -2450,6 +2450,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
shi->vcol[0]*= texr.tr;
shi->vcol[1]*= texr.tg;
shi->vcol[2]*= texr.tb;
+ shi->vcol[3]*= texr.ta;
}
/* eof */