Cleanup: Remove more texture nodes preview handling
Similar to the previous commit, this allowed removing a function to set a single pixel of a node preview.
This commit is contained in:
parent
0966eab8e9
commit
cc367908cd
Notes:
blender-bot
2023-05-05 09:07:10 +02:00
Referenced by issue #107589, Regression: Failure to render stereoscopy correctly in background (rendering of curve objects with cycles and motion blur)
|
@ -971,14 +971,6 @@ void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree,
|
|||
struct bNodeTree *from_ntree,
|
||||
bool remove_old);
|
||||
|
||||
/**
|
||||
* Hack warning! this function is only used for shader previews,
|
||||
* and since it gets called multiple times per pixel for Z-transparency we only add the color once.
|
||||
* Preview gets cleared before it starts render though.
|
||||
*/
|
||||
void BKE_node_preview_set_pixel(
|
||||
struct bNodePreview *preview, const float col[4], int x, int y, bool do_manage);
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -3069,27 +3069,6 @@ void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, boo
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_node_preview_set_pixel(
|
||||
bNodePreview *preview, const float col[4], int x, int y, bool do_manage)
|
||||
{
|
||||
if (preview) {
|
||||
if (x >= 0 && y >= 0) {
|
||||
if (x < preview->xsize && y < preview->ysize) {
|
||||
unsigned char *tar = preview->rect + 4 * ((preview->xsize * y) + x);
|
||||
|
||||
if (do_manage) {
|
||||
linearrgb_to_srgb_uchar4(tar, col);
|
||||
}
|
||||
else {
|
||||
rgba_float_to_uchar(tar, col);
|
||||
}
|
||||
}
|
||||
// else printf("prv out bound x y %d %d\n", x, y);
|
||||
}
|
||||
// else printf("prv out bound x y %d %d\n", x, y);
|
||||
}
|
||||
}
|
||||
|
||||
/* ************** Free stuff ********** */
|
||||
|
||||
void nodeUnlinkNode(bNodeTree *ntree, bNode *node)
|
||||
|
|
|
@ -63,10 +63,6 @@ static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, sh
|
|||
{
|
||||
if (dg->node->need_exec) {
|
||||
dg->fn(out, params, dg->node, dg->in, thread);
|
||||
|
||||
if (dg->cdata->do_preview) {
|
||||
tex_do_preview(dg->preview, params->previewco, out, dg->cdata->do_manage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,19 +119,6 @@ void params_from_cdata(TexParams *out, TexCallData *in)
|
|||
out->mtex = in->mtex;
|
||||
}
|
||||
|
||||
void tex_do_preview(bNodePreview *preview,
|
||||
const float coord[2],
|
||||
const float col[4],
|
||||
bool do_manage)
|
||||
{
|
||||
if (preview) {
|
||||
int xs = ((coord[0] + 1.0f) * 0.5f) * preview->xsize;
|
||||
int ys = ((coord[1] + 1.0f) * 0.5f) * preview->ysize;
|
||||
|
||||
BKE_node_preview_set_pixel(preview, col, xs, ys, do_manage);
|
||||
}
|
||||
}
|
||||
|
||||
void tex_output(bNode *node,
|
||||
bNodeExecData *execdata,
|
||||
bNodeStack **in,
|
||||
|
|
|
@ -121,10 +121,6 @@ void tex_output(bNode *node,
|
|||
bNodeStack *out,
|
||||
TexFn texfn,
|
||||
TexCallData *data);
|
||||
void tex_do_preview(bNodePreview *preview,
|
||||
const float coord[2],
|
||||
const float col[4],
|
||||
bool do_manage);
|
||||
|
||||
void params_from_cdata(TexParams *out, TexCallData *in);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static bNodeSocketTemplate inputs[] = {
|
|||
static void exec(void *data,
|
||||
int UNUSED(thread),
|
||||
bNode *node,
|
||||
bNodeExecData *execdata,
|
||||
bNodeExecData *UNUSED(execdata),
|
||||
bNodeStack **in,
|
||||
bNodeStack **UNUSED(out))
|
||||
{
|
||||
|
@ -54,7 +54,6 @@ static void exec(void *data,
|
|||
else {
|
||||
tex_input_rgba(&target->tr, in[0], ¶ms, cdata->thread);
|
||||
}
|
||||
tex_do_preview(execdata->preview, params.co, &target->tr, cdata->do_manage);
|
||||
}
|
||||
else {
|
||||
/* 0 means don't care, so just use first */
|
||||
|
|
|
@ -36,7 +36,7 @@ static bNodeSocketTemplate outputs[] = {
|
|||
static void exec(void *data,
|
||||
int UNUSED(thread),
|
||||
bNode *UNUSED(node),
|
||||
bNodeExecData *execdata,
|
||||
bNodeExecData *UNUSED(execdata),
|
||||
bNodeStack **in,
|
||||
bNodeStack **UNUSED(out))
|
||||
{
|
||||
|
@ -48,7 +48,6 @@ static void exec(void *data,
|
|||
params_from_cdata(¶ms, cdata);
|
||||
|
||||
tex_input_rgba(col, in[0], ¶ms, cdata->thread);
|
||||
tex_do_preview(execdata->preview, params.previewco, col, cdata->do_manage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue