static void valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
	float co1[3], co2[3];

	tex_input_vec(co1, in[0], p, thread);
	tex_input_vec(co2, in[1], p, thread);

	*out = len_v3v3(co2, co1);
}
Beispiel #2
0
/* applies to render pipeline */
static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **UNUSED(out))
{
    TexCallData *cdata = (TexCallData *)data;
    TexResult *target = cdata->target;

    if (cdata->do_preview) {
        TexParams params;
        params_from_cdata(&params, cdata);

        if (in[1] && in[1]->hasinput && !in[0]->hasinput)
            tex_input_rgba(&target->tr, in[1], &params, cdata->thread);
        else
            tex_input_rgba(&target->tr, in[0], &params, cdata->thread);
        tex_do_preview(execdata->preview, params.co, &target->tr);
    }
    else {
        /* 0 means don't care, so just use first */
        if (cdata->which_output == node->custom1 || (cdata->which_output == 0 && node->custom1 == 1)) {
            TexParams params;
            params_from_cdata(&params, cdata);

            tex_input_rgba(&target->tr, in[0], &params, cdata->thread);

            target->tin = (target->tr + target->tg + target->tb) / 3.0f;
            target->talpha = TRUE;

            if (target->nor) {
                if (in[1] && in[1]->hasinput)
                    tex_input_vec(target->nor, in[1], &params, cdata->thread);
                else
                    target->nor = NULL;
            }
        }
    }
}
Beispiel #3
0
static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
	TexParams np = *p;
	float new_co[3];
	np.co = new_co;
	
	tex_input_vec(new_co, in[1], p, thread);
	tex_input_rgba(out, in[0], &np, thread);
}
static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
	float offset[3], new_co[3];
	TexParams np = *p;
	np.co = new_co;
	
	tex_input_vec(offset, in[1], p, thread);
	
	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);
}
Beispiel #5
0
static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
	float scale[3], new_co[3], new_dxt[3], new_dyt[3];
	TexParams np = *p;

	np.co = new_co;
	np.dxt = new_dxt;
	np.dyt = new_dyt;
	
	tex_input_vec(scale, in[1], p, thread);

	mul_v3_v3v3(new_co, p->co, scale);
	if (p->osatex) {
		mul_v3_v3v3(new_dxt, p->dxt, scale);
		mul_v3_v3v3(new_dyt, p->dyt, scale);
	}
	
	tex_input_rgba(out, in[0], &np, thread);
}
Beispiel #6
0
static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
	float new_co[3], new_dxt[3], new_dyt[3], a, ax[3];
	
	a= tex_input_value(in[1], p, thread);
	tex_input_vec(ax, in[2], p, thread);

	rotate(new_co, a, ax, p->co);
	if (p->osatex) {
		rotate(new_dxt, a, ax, p->dxt);
		rotate(new_dyt, a, ax, p->dyt);
	}
	
	{
		TexParams np = *p;
		np.co = new_co;
		np.dxt = new_dxt;
		np.dyt = new_dyt;
		tex_input_rgba(out, in[0], &np, thread);
	}
}
float tex_input_value(bNodeStack *in, TexParams *params, short thread)
{
	float out[4];
	tex_input_vec(out, in, params, thread);
	return out[0];
}