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>2010-02-16 18:45:19 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-02-16 18:45:19 +0300
commitbd638da9a0bbd057b72164eed6583888380490ed (patch)
tree90c535062d48f73329b4597920877964e3c3b97a /source/blender/nodes/intern/TEX_nodes
parent768f20d537967ada2c5e71c05b027533959bdc91 (diff)
Texture Nodes:
* Remove the manual OSA method but rather pass on derivatives to the textures. This means that at the moment e.g. the bricks node is not antialiased, but that image textures are now using mipmaps. Doing oversampling on the whole nodetree is convenient but it is really the individual textures that can do filtering best and quickest. * Image textures in a texture node tree were not color corrected and did not support 2d mapping, now it's passing along shadeinput to make this possible. Would like to avoid this but not sure how. * Fix preview not filling in all pixels when scaling or rotating in the texture nodes.
Diffstat (limited to 'source/blender/nodes/intern/TEX_nodes')
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_at.c6
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_bricks.c6
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_checker.c6
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_coord.c6
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_distance.c8
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_image.c6
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_output.c49
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_proc.c3
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_rotate.c56
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_scale.c15
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_texture.c7
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_translate.c10
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c20
-rw-r--r--source/blender/nodes/intern/TEX_nodes/TEX_viewer.c2
14 files changed, 77 insertions, 123 deletions
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_at.c b/source/blender/nodes/intern/TEX_nodes/TEX_at.c
index ed435e9c42b..08c1c65792d 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_at.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_at.c
@@ -41,10 +41,10 @@ static bNodeSocketType outputs[]= {
static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
TexParams np = *p;
- float new_coord[3];
- np.coord = new_coord;
+ float new_co[3];
+ np.co = new_co;
- tex_input_vec(new_coord, in[1], p, thread);
+ tex_input_vec(new_co, in[1], p, thread);
tex_input_rgba(out, in[0], &np, thread);
}
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c b/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
index 8351a53f819..9d26621e08c 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
@@ -59,10 +59,10 @@ static float noise(int n) /* fast integer noise */
static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- float *coord = p->coord;
+ float *co = p->co;
- float x = coord[0];
- float y = coord[1];
+ float x = co[0];
+ float y = co[1];
int bricknum, rownum;
float offset = 0;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
index 2b6e993d712..4155cec4d7f 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c
@@ -42,9 +42,9 @@ static bNodeSocketType outputs[]= {
static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- float x = p->coord[0];
- float y = p->coord[1];
- float z = p->coord[2];
+ float x = p->co[0];
+ float y = p->co[1];
+ float z = p->co[2];
float sz = tex_input_value(in[2], p, thread);
/* 0.00001 because of unit sized stuff */
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
index 43fa4dd7185..68e892ce77c 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c
@@ -35,9 +35,9 @@ static bNodeSocketType outputs[]= {
static void vectorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- out[0] = p->coord[0];
- out[1] = p->coord[1];
- out[2] = p->coord[2];
+ out[0] = p->co[0];
+ out[1] = p->co[1];
+ out[2] = p->co[2];
}
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
index f17cf861c88..e0fee3e3153 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c
@@ -43,12 +43,12 @@ static bNodeSocketType outputs[]= {
static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- float coord1[3], coord2[3];
+ float co1[3], co2[3];
- tex_input_vec(coord1, in[0], p, thread);
- tex_input_vec(coord2, in[1], p, thread);
+ tex_input_vec(co1, in[0], p, thread);
+ tex_input_vec(co2, in[1], p, thread);
- *out = len_v3v3(coord2, coord1);
+ *out = len_v3v3(co2, co1);
}
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_image.c b/source/blender/nodes/intern/TEX_nodes/TEX_image.c
index 211a4a1ab8d..628d9026db1 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_image.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_image.c
@@ -36,8 +36,8 @@ static bNodeSocketType outputs[]= {
static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- float x = p->coord[0];
- float y = p->coord[1];
+ float x = p->co[0];
+ float y = p->co[1];
Image *ima= (Image *)node->id;
ImageUser *iuser= (ImageUser *)node->storage;
@@ -69,7 +69,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
QUATCOPY( out, result );
}
}
-};
+}
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c
index 63f51073fed..09bc893cc1f 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c
@@ -35,48 +35,6 @@ static bNodeSocketType inputs[]= {
{ -1, 0, "" }
};
-static void osa(
- void (*input_fn)(float *, bNodeStack *, TexParams *, short),
- float *out,
- bNodeStack *in,
- TexParams *p,
- short thread
-){
- if(!p->dxt) {
- input_fn(out, in, p, thread);
- } else {
- float sample[4] = {0};
- float coord[3];
- TexParams sp = *p;
- int i;
-
- sp.coord = coord;
- sp.dxt = sp.dyt = 0;
-
- QUATCOPY(out, sample);
-
- for(i=0; i<5; i++) {
- VECCOPY(coord, p->coord);
-
- if(i < 4)
- {
- if(i % 2) VECADD(coord, coord, p->dxt);
- if(i > 1) VECADD(coord, coord, p->dyt);
- }
- else
- {
- VECADDFAC(coord, coord, p->dxt, 0.5);
- VECADDFAC(coord, coord, p->dyt, 0.5);
- }
-
- input_fn(sample, in, &sp, thread);
-
- QUATADDFAC(out, out, sample, 0.2);
- }
- }
-}
-
-
/* applies to render pipeline */
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
@@ -91,7 +49,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
tex_input_rgba(&target->tr, in[1], &params, cdata->thread);
else
tex_input_rgba(&target->tr, in[0], &params, cdata->thread);
- tex_do_preview(node, params.coord, &target->tr);
+ tex_do_preview(node, params.co, &target->tr);
}
else {
/* 0 means don't care, so just use first */
@@ -99,14 +57,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
TexParams params;
params_from_cdata(&params, cdata);
- osa(tex_input_rgba, &target->tr, in[0], &params, cdata->thread);
+ tex_input_rgba(&target->tr, in[0], &params, cdata->thread);
target->tin = (target->tr + target->tg + target->tb) / 3.0f;
target->talpha = 1.0f;
if(target->nor) {
if(in[1]->hasinput)
- osa(tex_input_vec, target->nor, in[1], &params, cdata->thread);
+ tex_input_vec(target->nor, in[1], &params, cdata->thread);
else
target->nor = 0;
}
@@ -210,3 +168,4 @@ bNodeType tex_node_output= {
/* copystoragefunc */ copy,
/* id */ NULL
};
+
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
index ef8325465b4..16b65a4b0be 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c
@@ -62,7 +62,8 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char
else
texres.nor = NULL;
- textype = multitex_thread(tex, p->coord, p->dxt, p->dyt, 0, &texres, thread, 0);
+ textype = multitex_nodes(tex, p->co, p->dxt, p->dyt, p->osatex,
+ &texres, thread, 0, p->shi, p->mtex);
if(is_normal)
return;
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
index 7812cefa267..31b669991ad 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c
@@ -42,54 +42,44 @@ static bNodeSocketType outputs[]= {
{ -1, 0, "" }
};
-static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+static void rotate(float new_co[3], float a, float ax[3], float co[3])
{
- float new_coord[3];
- float *coord = p->coord;
-
- float ax[4];
float para[3];
float perp[3];
float cp[3];
- float magsq, ndx;
-
- float a = tex_input_value(in[1], p, thread);
float cos_a = cos(a * 2 * M_PI);
float sin_a = sin(a * 2 * M_PI);
- // x' = xcosa + n(n.x)(1-cosa)+(x*n)sina
-
- tex_input_vec(ax, in[2], p, thread);
- magsq = ax[0]*ax[0] + ax[1]*ax[1] + ax[2]*ax[2];
-
- if(magsq == 0) magsq = 1;
-
- ndx = dot_v3v3(coord, ax);
-
- para[0] = ax[0] * ndx * (1 - cos_a);
- para[1] = ax[1] * ndx * (1 - cos_a);
- para[2] = ax[2] * ndx * (1 - cos_a);
+ // x' = xcosa + n(n.x)(1-cosa) + (x*n)sina
- sub_v3_v3v3(perp, coord, para);
+ mul_v3_v3fl(perp, co, cos_a);
+ mul_v3_v3fl(para, ax, dot_v3v3(co, ax)*(1 - cos_a));
- perp[0] = coord[0] * cos_a;
- perp[1] = coord[1] * cos_a;
- perp[2] = coord[2] * cos_a;
+ cross_v3_v3v3(cp, ax, co);
+ mul_v3_fl(cp, sin_a);
- cross_v3_v3v3(cp, ax, coord);
-
- cp[0] = cp[0] * sin_a;
- cp[1] = cp[1] * sin_a;
- cp[2] = cp[2] * sin_a;
+ new_co[0] = para[0] + perp[0] + cp[0];
+ new_co[1] = para[1] + perp[1] + cp[1];
+ new_co[2] = para[2] + perp[2] + cp[2];
+}
+
+static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
+{
+ float new_co[3], new_dxt[3], new_dyt[3], a, ax[3];
- new_coord[0] = para[0] + perp[0] + cp[0];
- new_coord[1] = para[1] + perp[1] + cp[1];
- new_coord[2] = para[2] + perp[2] + cp[2];
+ a= tex_input_value(in[1], p, thread);
+ tex_input_vec(ax, in[2], p, thread);
+
+ rotate(new_co, a, ax, p->co);
+ rotate(new_dxt, a, ax, p->dxt);
+ rotate(new_dyt, a, ax, p->dyt);
{
TexParams np = *p;
- np.coord = new_coord;
+ np.co = new_co;
+ np.dxt = new_dxt;
+ np.dyt = new_dyt;
tex_input_rgba(out, in[0], &np, thread);
}
}
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c
index ae0c3653109..609b117e5be 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c
@@ -42,15 +42,18 @@ static bNodeSocketType outputs[]= {
static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- float scale[3], new_coord[3];
+ float scale[3], new_co[3], new_dxt[3], new_dyt[3];
TexParams np = *p;
- np.coord = new_coord;
+
+ np.co = new_co;
+ np.dxt = new_dxt;
+ np.dyt = new_dyt;
tex_input_vec(scale, in[1], p, thread);
-
- new_coord[0] = p->coord[0] * scale[0];
- new_coord[1] = p->coord[1] * scale[1];
- new_coord[2] = p->coord[2] * scale[2];
+
+ mul_v3_v3v3(new_co, p->co, scale);
+ mul_v3_v3v3(new_dxt, p->dxt, scale);
+ mul_v3_v3v3(new_dyt, p->dyt, scale);
tex_input_rgba(out, in[0], &np, thread);
}
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
index aa687920e46..c01caa022e5 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c
@@ -44,7 +44,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
{
static float red[] = {1,0,0,1};
static float white[] = {1,1,1,1};
- float *coord = p->coord;
+ float *co = p->co;
Tex *nodetex = (Tex *)node->id;
@@ -52,7 +52,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
/* this node refers to its own texture tree! */
QUATCOPY(
out,
- (fabs(coord[0] - coord[1]) < .01) ? white : red
+ (fabs(co[0] - co[1]) < .01) ? white : red
);
}
else if(nodetex) {
@@ -65,7 +65,8 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
tex_input_rgba(col2, in[1], p, thread);
texres.nor = nor;
- textype = multitex_ext(nodetex, coord, 0, 0, 0, &texres);
+ textype = multitex_nodes(nodetex, co, p->dxt, p->dyt, p->osatex,
+ &texres, thread, 0, p->shi, p->mtex);
if(textype & TEX_RGB) {
QUATCOPY(out, &texres.tr);
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
index df555f794f4..a823338faf9 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c
@@ -42,15 +42,15 @@ static bNodeSocketType outputs[]= {
static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- float offset[3], new_coord[3];
+ float offset[3], new_co[3];
TexParams np = *p;
- np.coord = new_coord;
+ np.co = new_co;
tex_input_vec(offset, in[1], p, thread);
- new_coord[0] = p->coord[0] + offset[0];
- new_coord[1] = p->coord[1] + offset[1];
- new_coord[2] = p->coord[2] + offset[2];
+ new_co[0] = p->co[0] + offset[0];
+ new_co[1] = p->co[1] + offset[1];
+ new_co[2] = p->co[2] + offset[2];
tex_input_rgba(out, in[0], &np, thread);
}
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c
index a0d7b96a600..46aefe5ad47 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c
@@ -41,29 +41,29 @@ static bNodeSocketType outputs[]= {
static void normalfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
- float new_coord[3];
- float *coord = p->coord;
+ float new_co[3];
+ float *co = p->co;
float nabla = tex_input_value(in[1], p, thread);
float val;
float nor[3];
TexParams np = *p;
- np.coord = new_coord;
+ np.co = new_co;
val = tex_input_value(in[0], p, thread);
- new_coord[0] = coord[0] + nabla;
- new_coord[1] = coord[1];
- new_coord[2] = coord[2];
+ new_co[0] = co[0] + nabla;
+ new_co[1] = co[1];
+ new_co[2] = co[2];
nor[0] = tex_input_value(in[0], &np, thread);
- new_coord[0] = coord[0];
- new_coord[1] = coord[1] + nabla;
+ new_co[0] = co[0];
+ new_co[1] = co[1] + nabla;
nor[1] = tex_input_value(in[0], &np, thread);
- new_coord[1] = coord[1];
- new_coord[2] = coord[2] + nabla;
+ new_co[1] = co[1];
+ new_co[2] = co[2] + nabla;
nor[2] = tex_input_value(in[0], &np, thread);
out[0] = val-nor[0];
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
index f5f0ebe8397..698c894a8d8 100644
--- a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
+++ b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c
@@ -47,7 +47,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
params_from_cdata(&params, cdata);
tex_input_rgba(col, in[0], &params, cdata->thread);
- tex_do_preview(node, params.coord, col);
+ tex_do_preview(node, params.previewco, col);
}
}