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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-13 01:03:11 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-13 01:03:11 +0300
commitb3c238e8bc4c38a8f2ba483be2d19c76d03d674c (patch)
treea86991622fa5582498612cf348d0de58af048a08 /source/blender/render
parentbdfe7d89e2f1292644577972c716931b4ce3c6c3 (diff)
parent7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff)
2.5: merge with trunk, previous merge was only up to yesterday.
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17416:HEAD
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/extern/include/RE_shader_ext.h1
-rw-r--r--source/blender/render/intern/include/pixelshading.h4
-rw-r--r--source/blender/render/intern/include/texture.h3
-rw-r--r--source/blender/render/intern/source/convertblender.c2
-rw-r--r--source/blender/render/intern/source/pixelshading.c8
-rw-r--r--source/blender/render/intern/source/rayshade.c6
-rw-r--r--source/blender/render/intern/source/rendercore.c2
-rw-r--r--source/blender/render/intern/source/texture.c61
8 files changed, 66 insertions, 21 deletions
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h
index 888474ffa18..2cee2673a26 100644
--- a/source/blender/render/extern/include/RE_shader_ext.h
+++ b/source/blender/render/extern/include/RE_shader_ext.h
@@ -183,6 +183,7 @@ typedef struct ShadeInput
/* node shaders... */
struct Tex;
int multitex_ext(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
+int multitex_thread(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres, short thread, short which_output);
/* shaded view and bake */
struct Render;
diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h
index c6b11b4af9a..799f5521017 100644
--- a/source/blender/render/intern/include/pixelshading.h
+++ b/source/blender/render/intern/include/pixelshading.h
@@ -53,8 +53,8 @@ int shadeHaloFloat(HaloRen *har,
/**
* Render the sky at pixel (x, y).
*/
-void shadeSkyPixel(float *collector, float fx, float fy);
-void shadeSkyView(float *colf, float *rco, float *view, float *dxyview);
+void shadeSkyPixel(float *collector, float fx, float fy, short thread);
+void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short thread);
void shadeAtmPixel(struct SunSky *sunsky, float *collector, float fx, float fy, float distance);
void shadeSunView(float *colf, float *view);
/* ------------------------------------------------------------------------- */
diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h
index be5471e07c4..c254b768292 100644
--- a/source/blender/render/intern/include/texture.h
+++ b/source/blender/render/intern/include/texture.h
@@ -53,11 +53,12 @@ struct ImBuf;
/* texture.h */
void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf);
-void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag);
+void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread);
void do_material_tex(struct ShadeInput *shi);
void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect);
void init_render_textures(Render *re);
+void end_render_textures(void);
void render_realtime_texture(struct ShadeInput *shi, struct Image *ima);
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index a9bc2131d77..e2692113d16 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -2271,6 +2271,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
shi.vlr= vlr; /* current render face */
shi.mat= vlr->mat; /* current input material */
+ shi.thread= 0;
/* Displace the verts, flag is set when done */
if (!vlr->v1->flag)
@@ -4406,6 +4407,7 @@ void RE_Database_Free(Render *re)
end_radio_render();
end_render_materials();
+ end_render_textures();
if(re->wrld.aosphere) {
MEM_freeN(re->wrld.aosphere);
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 60723963af9..af6093ab36c 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -511,7 +511,7 @@ static void fillBackgroundImage(float *collector, float fx, float fy)
}
/* Only view vector is important here. Result goes to colf[3] */
-void shadeSkyView(float *colf, float *rco, float *view, float *dxyview)
+void shadeSkyView(float *colf, float *rco, float *view, float *dxyview, short thread)
{
float lo[3], zen[3], hor[3], blend, blendm;
int skyflag;
@@ -550,7 +550,7 @@ void shadeSkyView(float *colf, float *rco, float *view, float *dxyview)
SWAP(float, lo[1], lo[2]);
}
- do_sky_tex(rco, lo, dxyview, hor, zen, &blend, skyflag);
+ do_sky_tex(rco, lo, dxyview, hor, zen, &blend, skyflag, thread);
}
if(blend>1.0) blend= 1.0;
@@ -607,7 +607,7 @@ void shadeSunView(float *colf, float *view)
/*
Stuff the sky color into the collector.
*/
-void shadeSkyPixel(float *collector, float fx, float fy)
+void shadeSkyPixel(float *collector, float fx, float fy, short thread)
{
float view[3], dxyview[2];
@@ -653,7 +653,7 @@ void shadeSkyPixel(float *collector, float fx, float fy)
}
/* get sky color in the collector */
- shadeSkyView(collector, NULL, view, dxyview);
+ shadeSkyView(collector, NULL, view, dxyview, thread);
collector[3] = 0.0f;
}
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index f822d41bb85..46a7a1c556c 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -396,7 +396,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh
VECCOPY(shi->view, vec);
Normalize(shi->view);
- shadeSkyView(col, isec->start, shi->view, NULL);
+ shadeSkyView(col, isec->start, shi->view, NULL, shi->thread);
shadeSunView(col, shi->view);
}
}
@@ -1627,7 +1627,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *shadfac)
shadfac[2]+= (1.0f-skyfac)*R.wrld.horb + skyfac*R.wrld.zenb;
}
else { /* WO_AOSKYTEX */
- shadeSkyView(skycol, isec.start, view, dxyview);
+ shadeSkyView(skycol, isec.start, view, dxyview, shi->thread);
shadeSunView(skycol, shi->view);
shadfac[0]+= skycol[0];
shadfac[1]+= skycol[1];
@@ -1752,7 +1752,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *shadfac)
shadfac[2]+= (1.0f-fac)*R.wrld.horb + fac*R.wrld.zenb;
}
else { /* WO_AOSKYTEX */
- shadeSkyView(skycol, isec.start, view, dxyview);
+ shadeSkyView(skycol, isec.start, view, dxyview, shi->thread);
shadeSunView(skycol, shi->view);
shadfac[0]+= skycol[0];
shadfac[1]+= skycol[1];
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 1eb42bca569..c3b281f2a23 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -647,7 +647,7 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
if(pass[3]<1.0f) {
if(done==0) {
- shadeSkyPixel(col, x, y);
+ shadeSkyPixel(col, x, y, pa->thread);
done= 1;
}
diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c
index 7ce66ff6d12..61e9d9cf412 100644
--- a/source/blender/render/intern/source/texture.c
+++ b/source/blender/render/intern/source/texture.c
@@ -43,11 +43,13 @@
#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
#include "DNA_image_types.h"
+#include "DNA_node_types.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "BKE_image.h"
+#include "BKE_node.h"
#include "BKE_plugin_types.h"
#include "BKE_utildefines.h"
@@ -114,6 +116,10 @@ void init_render_texture(Render *re, Tex *tex)
}
}
}
+
+ if(tex->nodetree && tex->use_nodes) {
+ ntreeBeginExecTree(tex->nodetree); /* has internal flag to detect it only does it once */
+ }
}
/* ------------------------------------------------------------------------- */
@@ -129,6 +135,20 @@ void init_render_textures(Render *re)
}
}
+void end_render_texture(Tex *tex)
+{
+ if(tex && tex->use_nodes && tex->nodetree)
+ ntreeEndExecTree(tex->nodetree);
+}
+
+void end_render_textures(void)
+{
+ Tex *tex;
+ for(tex= G.main->tex.first; tex; tex= tex->id.next)
+ if(tex->id.us)
+ end_render_texture(tex);
+}
+
/* ------------------------------------------------------------------------- */
@@ -691,6 +711,19 @@ static float voronoiTex(Tex *tex, float *texvec, TexResult *texres)
}
+/* ------------------------------------------------------------------------- */
+
+static int evalnodes(Tex *tex, float *texvec, TexResult *texres, short thread, short which_output)
+{
+ short rv = TEX_INT;
+ bNodeTree *nodes = tex->nodetree;
+
+ ntreeTexExecTree(nodes, texres, texvec, 0, thread, tex, which_output);
+
+ if(texres->nor) rv |= TEX_NOR;
+ rv |= TEX_RGB;
+ return rv;
+}
/* ------------------------------------------------------------------------- */
@@ -1130,13 +1163,17 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
/* ************************************** */
-static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
+static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output)
{
float tmpvec[3];
int retval=0; /* return value, int:0, col:1, nor:2, everything:3 */
texres->talpha= 0; /* is set when image texture returns alpha (considered premul) */
+ if(tex->use_nodes && tex->nodetree) {
+ retval = evalnodes(tex, texvec, texres, thread, which_output);
+ }
+ else
switch(tex->type) {
case 0:
@@ -1236,7 +1273,11 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
* the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */
int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres)
{
-
+ return multitex_thread(tex, texvec, dxt, dyt, osatex, texres, 0, 0);
+}
+
+int multitex_thread(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexResult *texres, short thread, short which_output)
+{
if(tex==NULL) {
memset(texres, 0, sizeof(TexResult));
return 0;
@@ -1264,10 +1305,10 @@ int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, Te
do_2d_mapping(&mtex, texvec_l, NULL, NULL, dxt_l, dyt_l);
- return multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres);
+ return multitex(tex, texvec_l, dxt_l, dyt_l, osatex, texres, thread, which_output);
}
else
- return multitex(tex, texvec, dxt, dyt, osatex, texres);
+ return multitex(tex, texvec, dxt, dyt, osatex, texres, thread, which_output);
}
/* ------------------------------------------------------------------------- */
@@ -1671,7 +1712,7 @@ void do_material_tex(ShadeInput *shi)
}
}
- rgbnor= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres);
+ rgbnor= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres, shi->thread, mtex->which_output);
/* texture output */
@@ -2055,7 +2096,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
if(mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
- rgb= multitex(mtex->tex, texvec, dxt, dyt, osatex, &texres);
+ rgb= multitex(mtex->tex, texvec, dxt, dyt, osatex, &texres, 0, mtex->which_output);
/* texture output */
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
@@ -2126,7 +2167,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
/* ------------------------------------------------------------------------- */
/* hor and zen are RGB vectors, blend is 1 float, should all be initialized */
-void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag)
+void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag, short thread)
{
MTex *mtex;
TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
@@ -2226,7 +2267,7 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f
/* texture */
if(mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
- rgb= multitex(mtex->tex, texvec, dxt, dyt, R.osa, &texres);
+ rgb= multitex(mtex->tex, texvec, dxt, dyt, R.osa, &texres, thread, mtex->which_output);
/* texture output */
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
@@ -2407,7 +2448,7 @@ void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int ef
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
}
- rgb= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres);
+ rgb= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres, shi->thread, mtex->which_output);
/* texture output */
if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
@@ -2492,7 +2533,7 @@ int externtex(MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *t
do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
}
- rgb= multitex(tex, texvec, dxt, dyt, 0, &texr);
+ rgb= multitex(tex, texvec, dxt, dyt, 0, &texr, 0, mtex->which_output);
if(rgb) {
texr.tin= (0.35*texr.tr+0.45*texr.tg+0.2*texr.tb);