Exemplo n.º 1
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;
            }
        }
    }
}
Exemplo n.º 2
0
static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread)
{
	if (dg->node->need_exec) {
		dg->fn(out, params, dg->node, dg->in, thread);

		if (dg->cdata->do_preview)
			tex_do_preview(dg->node, params->previewco, out);
	}
}
Exemplo n.º 3
0
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
	TexCallData *cdata = (TexCallData *)data;

	if (cdata->do_preview) {
		TexParams params;
		float col[4];
		params_from_cdata(&params, cdata);

		tex_input_rgba(col, in[0], &params, cdata->thread);
		tex_do_preview(node, params.previewco, col);
	}
}