style cleanup: nodes
This commit is contained in:
@@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_alphaover_out[] = {
|
||||
|
||||
static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
|
||||
node->storage = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
|
||||
}
|
||||
|
||||
void register_node_type_cmp_alphaover(void)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,32 +1,30 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2006 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2006 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
/** \file blender/nodes/composite/nodes/node_composite_bokehimage.c
|
||||
* \ingroup cmpnodes
|
||||
@@ -44,7 +42,7 @@ static bNodeSocketTemplate cmp_node_bokehimage_out[] = {
|
||||
|
||||
static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeBokehImage * data = MEM_callocN(sizeof(NodeBokehImage), "NodeBokehImage");
|
||||
NodeBokehImage *data = MEM_callocN(sizeof(NodeBokehImage), "NodeBokehImage");
|
||||
data->angle = 0.0f;
|
||||
data->flaps = 5;
|
||||
data->rounding = 0.0f;
|
||||
@@ -57,7 +55,7 @@ void register_node_type_cmp_bokehimage(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, NULL, cmp_node_bokehimage_out);
|
||||
node_type_init(&ntype, node_composit_init_bokehimage);
|
||||
node_type_storage(&ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
/** \file blender/nodes/composite/nodes/node_composite_brightness.c
|
||||
* \ingroup cmpnodes
|
||||
|
||||
@@ -47,24 +47,24 @@ static bNodeSocketTemplate cmp_node_channel_matte_out[] = {
|
||||
|
||||
static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage=c;
|
||||
c->t1= 1.0f;
|
||||
c->t2= 0.0f;
|
||||
c->t3= 0.0f;
|
||||
c->fsize= 0.0f;
|
||||
c->fstrength= 0.0f;
|
||||
c->algorithm=1; /*max channel limiting */
|
||||
c->channel=1; /* limit by red */
|
||||
node->custom1= 1; /* RGB channel */
|
||||
node->custom2= 2; /* Green Channel */
|
||||
NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage = c;
|
||||
c->t1 = 1.0f;
|
||||
c->t2 = 0.0f;
|
||||
c->t3 = 0.0f;
|
||||
c->fsize = 0.0f;
|
||||
c->fstrength = 0.0f;
|
||||
c->algorithm = 1; /*max channel limiting */
|
||||
c->channel = 1; /* limit by red */
|
||||
node->custom1 = 1; /* RGB channel */
|
||||
node->custom2 = 2; /* Green Channel */
|
||||
}
|
||||
|
||||
void register_node_type_cmp_channel_matte(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_channel_matte_in, cmp_node_channel_matte_out);
|
||||
node_type_init(&ntype, node_composit_init_channel_matte);
|
||||
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -47,20 +47,20 @@ static bNodeSocketTemplate cmp_node_chroma_out[] = {
|
||||
|
||||
static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage= c;
|
||||
c->t1= DEG2RADF(30.0f);
|
||||
c->t2= DEG2RADF(10.0f);
|
||||
c->t3= 0.0f;
|
||||
c->fsize= 0.0f;
|
||||
c->fstrength= 1.0f;
|
||||
NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage = c;
|
||||
c->t1 = DEG2RADF(30.0f);
|
||||
c->t2 = DEG2RADF(10.0f);
|
||||
c->t3 = 0.0f;
|
||||
c->fsize = 0.0f;
|
||||
c->fstrength = 1.0f;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_chroma_matte(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_chroma_in, cmp_node_chroma_out);
|
||||
node_type_init(&ntype, node_composit_init_chroma_matte);
|
||||
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -47,20 +47,20 @@ static bNodeSocketTemplate cmp_node_color_out[] = {
|
||||
|
||||
static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node color");
|
||||
node->storage= c;
|
||||
c->t1= 0.01f;
|
||||
c->t2= 0.1f;
|
||||
c->t3= 0.1f;
|
||||
c->fsize= 0.0f;
|
||||
c->fstrength= 1.0f;
|
||||
NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node color");
|
||||
node->storage = c;
|
||||
c->t1 = 0.01f;
|
||||
c->t2 = 0.1f;
|
||||
c->t3 = 0.1f;
|
||||
c->fsize = 0.0f;
|
||||
c->fstrength = 1.0f;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_color_matte(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_color_in, cmp_node_color_out);
|
||||
node_type_init(&ntype, node_composit_init_color_matte);
|
||||
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -45,13 +45,13 @@ static bNodeSocketTemplate cmp_node_color_spill_out[] = {
|
||||
|
||||
static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill");
|
||||
node->storage=ncs;
|
||||
node->custom1= 2; /* green channel */
|
||||
node->custom2= 0; /* simple limit algo*/
|
||||
ncs->limchan= 0; /* limit by red */
|
||||
ncs->limscale= 1.0f; /* limit scaling factor */
|
||||
ncs->unspill=0; /* do not use unspill */
|
||||
NodeColorspill *ncs = MEM_callocN(sizeof(NodeColorspill), "node colorspill");
|
||||
node->storage = ncs;
|
||||
node->custom1 = 2; /* green channel */
|
||||
node->custom2 = 0; /* simple limit algo*/
|
||||
ncs->limchan = 0; /* limit by red */
|
||||
ncs->limscale = 1.0f; /* limit scaling factor */
|
||||
ncs->unspill = 0; /* do not use unspill */
|
||||
}
|
||||
|
||||
void register_node_type_cmp_color_spill(void)
|
||||
|
||||
@@ -48,7 +48,7 @@ static bNodeSocketTemplate cmp_node_colorbalance_out[] = {
|
||||
|
||||
static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeColorBalance *n= node->storage= MEM_callocN(sizeof(NodeColorBalance), "node colorbalance");
|
||||
NodeColorBalance *n = node->storage = MEM_callocN(sizeof(NodeColorBalance), "node colorbalance");
|
||||
|
||||
n->lift[0] = n->lift[1] = n->lift[2] = 1.0f;
|
||||
n->gamma[0] = n->gamma[1] = n->gamma[2] = 1.0f;
|
||||
|
||||
@@ -49,29 +49,29 @@ static bNodeSocketTemplate cmp_node_colorcorrection_out[] = {
|
||||
|
||||
static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeColorCorrection *n= node->storage= MEM_callocN(sizeof(NodeColorCorrection), "node colorcorrection");
|
||||
NodeColorCorrection *n = node->storage = MEM_callocN(sizeof(NodeColorCorrection), "node colorcorrection");
|
||||
n->startmidtones = 0.2f;
|
||||
n->endmidtones = 0.7f;
|
||||
n->master.contrast = 1.0f;
|
||||
n->master.gain = 1.0f;
|
||||
n->master.gamma = 1.0f;
|
||||
n->master.lift= 0.0f;
|
||||
n->master.saturation= 1.0f;
|
||||
n->master.lift = 0.0f;
|
||||
n->master.saturation = 1.0f;
|
||||
n->midtones.contrast = 1.0f;
|
||||
n->midtones.gain = 1.0f;
|
||||
n->midtones.gamma = 1.0f;
|
||||
n->midtones.lift= 0.0f;
|
||||
n->midtones.saturation= 1.0f;
|
||||
n->midtones.lift = 0.0f;
|
||||
n->midtones.saturation = 1.0f;
|
||||
n->shadows.contrast = 1.0f;
|
||||
n->shadows.gain = 1.0f;
|
||||
n->shadows.gamma = 1.0f;
|
||||
n->shadows.lift= 0.0f;
|
||||
n->shadows.saturation= 1.0f;
|
||||
n->shadows.lift = 0.0f;
|
||||
n->shadows.saturation = 1.0f;
|
||||
n->highlights.contrast = 1.0f;
|
||||
n->highlights.gain = 1.0f;
|
||||
n->highlights.gamma = 1.0f;
|
||||
n->highlights.lift= 0.0f;
|
||||
n->highlights.saturation= 1.0f;
|
||||
n->highlights.lift = 0.0f;
|
||||
n->highlights.saturation = 1.0f;
|
||||
node->custom1 = 7; // red + green + blue enabled
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ static bNodeSocketTemplate cmp_node_crop_out[] = {
|
||||
|
||||
static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTwoXYs *nxy= MEM_callocN(sizeof(NodeTwoXYs), "node xy data");
|
||||
node->storage= nxy;
|
||||
nxy->x1= 0;
|
||||
nxy->x2= 0;
|
||||
nxy->y1= 0;
|
||||
nxy->y2= 0;
|
||||
NodeTwoXYs *nxy = MEM_callocN(sizeof(NodeTwoXYs), "node xy data");
|
||||
node->storage = nxy;
|
||||
nxy->x1 = 0;
|
||||
nxy->x2 = 0;
|
||||
nxy->y1 = 0;
|
||||
nxy->y2 = 0;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_crop(void)
|
||||
|
||||
@@ -43,9 +43,9 @@ static bNodeSocketTemplate cmp_node_time_out[] = {
|
||||
|
||||
static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1= 1;
|
||||
node->custom2= 250;
|
||||
node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
node->custom1 = 1;
|
||||
node->custom2 = 250;
|
||||
node->storage = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void register_node_type_cmp_curve_time(void)
|
||||
@@ -76,7 +76,7 @@ static bNodeSocketTemplate cmp_node_curve_vec_out[] = {
|
||||
|
||||
static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
|
||||
node->storage = curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void register_node_type_cmp_curve_vec(void)
|
||||
@@ -109,7 +109,7 @@ static bNodeSocketTemplate cmp_node_curve_rgb_out[] = {
|
||||
|
||||
static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
node->storage = curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void register_node_type_cmp_curve_rgb(void)
|
||||
|
||||
@@ -52,7 +52,7 @@ void register_node_type_cmp_despeckle(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_despeckle_in, cmp_node_despeckle_out);
|
||||
node_type_init(&ntype, node_composit_init_despeckle);
|
||||
|
||||
|
||||
@@ -47,17 +47,17 @@ static bNodeSocketTemplate cmp_node_diff_matte_out[] = {
|
||||
|
||||
static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage= c;
|
||||
c->t1= 0.1f;
|
||||
c->t2= 0.1f;
|
||||
NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage = c;
|
||||
c->t1 = 0.1f;
|
||||
c->t2 = 0.1f;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_diff_matte(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_diff_matte_in, cmp_node_diff_matte_out);
|
||||
node_type_init(&ntype, node_composit_init_diff_matte);
|
||||
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -47,18 +47,18 @@ static bNodeSocketTemplate cmp_node_distance_matte_out[] = {
|
||||
|
||||
static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage= c;
|
||||
c->channel=1;
|
||||
c->t1= 0.1f;
|
||||
c->t2= 0.1f;
|
||||
NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage = c;
|
||||
c->channel = 1;
|
||||
c->t1 = 0.1f;
|
||||
c->t2 = 0.1f;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_distance_matte(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_distance_matte_in, cmp_node_distance_matte_out);
|
||||
node_type_init(&ntype, node_composit_init_distance_matte);
|
||||
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -67,7 +67,3 @@ void register_node_type_cmp_ellipsemask(void)
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ void register_node_type_cmp_filter(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out);
|
||||
node_type_label(&ntype, node_filter_label);
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
/** \file blender/nodes/composite/nodes/node_composite_gamma.c
|
||||
* \ingroup cmpnodes
|
||||
|
||||
@@ -46,11 +46,11 @@ static bNodeSocketTemplate cmp_node_hue_sat_out[] = {
|
||||
|
||||
static void node_composit_init_hue_sat(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeHueSat *nhs= MEM_callocN(sizeof(NodeHueSat), "node hue sat");
|
||||
node->storage= nhs;
|
||||
nhs->hue= 0.5f;
|
||||
nhs->sat= 1.0f;
|
||||
nhs->val= 1.0f;
|
||||
NodeHueSat *nhs = MEM_callocN(sizeof(NodeHueSat), "node hue sat");
|
||||
node->storage = nhs;
|
||||
nhs->hue = 0.5f;
|
||||
nhs->sat = 1.0f;
|
||||
nhs->val = 1.0f;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_hue_sat(void)
|
||||
|
||||
@@ -45,12 +45,12 @@ static bNodeSocketTemplate cmp_node_huecorrect_out[] = {
|
||||
|
||||
static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
CurveMapping *cumapping = node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
CurveMapping *cumapping = node->storage = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
int c;
|
||||
|
||||
cumapping->preset = CURVE_PRESET_MID9;
|
||||
|
||||
for (c=0; c<3; c++) {
|
||||
for (c = 0; c < 3; c++) {
|
||||
CurveMap *cuma = &cumapping->cm[c];
|
||||
curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, CURVEMAP_SLOPE_POSITIVE);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ static void cmp_node_image_add_multilayer_outputs(bNodeTree *ntree, bNode *node,
|
||||
NodeImageLayer *sockdata;
|
||||
RenderPass *rpass;
|
||||
int index;
|
||||
for (rpass=rl->passes.first, index=0; rpass; rpass=rpass->next, ++index) {
|
||||
for (rpass = rl->passes.first, index = 0; rpass; rpass = rpass->next, ++index) {
|
||||
int type;
|
||||
if (rpass->channels == 1)
|
||||
type = SOCK_FLOAT;
|
||||
@@ -172,7 +172,7 @@ static void cmp_node_image_add_multilayer_outputs(bNodeTree *ntree, bNode *node,
|
||||
|
||||
static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
Image *ima= (Image *)node->id;
|
||||
Image *ima = (Image *)node->id;
|
||||
if (ima) {
|
||||
ImageUser *iuser = node->storage;
|
||||
ImageUser load_iuser = {NULL};
|
||||
@@ -194,31 +194,31 @@ static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node)
|
||||
ibuf = BKE_image_acquire_ibuf(ima, &load_iuser, NULL);
|
||||
|
||||
if (ima->rr) {
|
||||
RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
|
||||
RenderLayer *rl = BLI_findlink(&ima->rr->layers, iuser->layer);
|
||||
|
||||
if (rl) {
|
||||
if (ima->type!=IMA_TYPE_MULTILAYER)
|
||||
if (ima->type != IMA_TYPE_MULTILAYER)
|
||||
cmp_node_image_add_render_pass_outputs(ntree, node, rl->passflag);
|
||||
else
|
||||
cmp_node_image_add_multilayer_outputs(ntree, node, rl);
|
||||
}
|
||||
else
|
||||
cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
|
||||
cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE | RRES_OUT_ALPHA);
|
||||
}
|
||||
else
|
||||
cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA|RRES_OUT_Z);
|
||||
cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE | RRES_OUT_ALPHA | RRES_OUT_Z);
|
||||
|
||||
BKE_image_release_ibuf(ima, ibuf, NULL);
|
||||
}
|
||||
else
|
||||
cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
|
||||
cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE | RRES_OUT_ALPHA);
|
||||
}
|
||||
|
||||
static bNodeSocket *cmp_node_image_output_find_match(bNode *UNUSED(node), bNodeSocket *newsock, ListBase *oldsocklist)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
|
||||
for (sock=oldsocklist->first; sock; sock = sock->next)
|
||||
for (sock = oldsocklist->first; sock; sock = sock->next)
|
||||
if (STREQ(sock->name, newsock->name))
|
||||
return sock;
|
||||
return NULL;
|
||||
@@ -257,7 +257,7 @@ static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node)
|
||||
/* XXX make callback */
|
||||
cmp_node_image_create_outputs(ntree, node);
|
||||
|
||||
for (newsock = node->outputs.first; newsock; newsock=newsock->next) {
|
||||
for (newsock = node->outputs.first; newsock; newsock = newsock->next) {
|
||||
/* XXX make callback */
|
||||
oldsock = cmp_node_image_output_find_match(node, newsock, &oldsocklist);
|
||||
if (oldsock) {
|
||||
@@ -267,11 +267,11 @@ static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node)
|
||||
}
|
||||
|
||||
/* move links to new socket */
|
||||
for (oldsock=oldsocklist.first, oldindex=0; oldsock; oldsock=oldsock->next, ++oldindex) {
|
||||
for (oldsock = oldsocklist.first, oldindex = 0; oldsock; oldsock = oldsock->next, ++oldindex) {
|
||||
newsock = cmp_node_image_output_relink(node, oldsock, oldindex);
|
||||
|
||||
if (newsock) {
|
||||
for (link=ntree->links.first; link; link=link->next) {
|
||||
for (link = ntree->links.first; link; link = link->next) {
|
||||
if (link->fromsock == oldsock)
|
||||
link->fromsock = newsock;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node)
|
||||
* but the nodeRemoveSocket function works anyway. In future this
|
||||
* should become part of the core code, so can take care of this behavior.
|
||||
*/
|
||||
for (oldsock=oldsocklist.first; oldsock; oldsock=oldsock_next) {
|
||||
for (oldsock = oldsocklist.first; oldsock; oldsock = oldsock_next) {
|
||||
oldsock_next = oldsock->next;
|
||||
MEM_freeN(oldsock->storage);
|
||||
nodeRemoveSocket(ntree, node, oldsock);
|
||||
@@ -299,12 +299,12 @@ static void cmp_node_image_update(bNodeTree *ntree, bNode *node)
|
||||
|
||||
static void node_composit_init_image(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage= iuser;
|
||||
iuser->frames= 1;
|
||||
iuser->sfra= 1;
|
||||
iuser->fie_ima= 2;
|
||||
iuser->ok= 1;
|
||||
ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage = iuser;
|
||||
iuser->frames = 1;
|
||||
iuser->sfra = 1;
|
||||
iuser->fie_ima = 2;
|
||||
iuser->ok = 1;
|
||||
|
||||
/* setup initial outputs */
|
||||
cmp_node_image_verify_outputs(ntree, node);
|
||||
@@ -325,10 +325,10 @@ static void node_composit_copy_image(bNodeTree *UNUSED(dest_ntree), bNode *dest_
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
|
||||
dest_node->storage= MEM_dupallocN(src_node->storage);
|
||||
dest_node->storage = MEM_dupallocN(src_node->storage);
|
||||
|
||||
/* copy extra socket info */
|
||||
for (sock=src_node->outputs.first; sock; sock = sock->next)
|
||||
for (sock = src_node->outputs.first; sock; sock = sock->next)
|
||||
sock->new_sock->storage = MEM_dupallocN(sock->storage);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ void register_node_type_cmp_image(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_init(&ntype, node_composit_init_image);
|
||||
node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image);
|
||||
node_type_update(&ntype, cmp_node_image_update, NULL);
|
||||
@@ -349,7 +349,7 @@ void register_node_type_cmp_image(void)
|
||||
|
||||
static int node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntree)
|
||||
{
|
||||
if (strcmp(ntree->idname, "CompositorNodeTree")==0) {
|
||||
if (strcmp(ntree->idname, "CompositorNodeTree") == 0) {
|
||||
Scene *scene;
|
||||
|
||||
/* XXX ugly: check if ntree is a local scene node tree.
|
||||
@@ -369,7 +369,7 @@ void register_node_type_cmp_rlayers(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out);
|
||||
ntype.poll = node_composit_poll_rlayers;
|
||||
|
||||
|
||||
@@ -47,14 +47,14 @@ static bNodeSocketTemplate cmp_node_view_levels_out[] = {
|
||||
|
||||
static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1=1; /*All channels*/
|
||||
node->custom1 = 1; /*All channels*/
|
||||
}
|
||||
|
||||
void register_node_type_cmp_view_levels(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW);
|
||||
node_type_socket_templates(&ntype, cmp_node_view_levels_in, cmp_node_view_levels_out);
|
||||
node_type_init(&ntype, node_composit_init_view_levels);
|
||||
node_type_storage(&ntype, "ImageUser", NULL, NULL);
|
||||
|
||||
@@ -47,17 +47,17 @@ static bNodeSocketTemplate cmp_node_luma_matte_out[] = {
|
||||
|
||||
static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage=c;
|
||||
c->t1= 1.0f;
|
||||
c->t2= 0.0f;
|
||||
NodeChroma *c = MEM_callocN(sizeof(NodeChroma), "node chroma");
|
||||
node->storage = c;
|
||||
c->t1 = 1.0f;
|
||||
c->t2 = 0.0f;
|
||||
}
|
||||
|
||||
void register_node_type_cmp_luma_matte(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_luma_matte_in, cmp_node_luma_matte_out);
|
||||
node_type_init(&ntype, node_composit_init_luma_matte);
|
||||
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -44,7 +44,7 @@ static bNodeSocketTemplate cmp_node_map_value_out[] = {
|
||||
|
||||
static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= add_tex_mapping();
|
||||
node->storage = add_tex_mapping();
|
||||
}
|
||||
|
||||
void register_node_type_cmp_map_value(void)
|
||||
|
||||
@@ -48,7 +48,7 @@ void register_node_type_cmp_mix_rgb(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
|
||||
node_type_label(&ntype, node_blend_label);
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void register_node_type_cmp_movieclip(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, NULL, cmp_node_movieclip_out);
|
||||
node_type_init(&ntype, init);
|
||||
node_type_storage(&ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -51,9 +51,9 @@
|
||||
/* find unique path */
|
||||
static bool unique_path_unique_check(void *arg, const char *name)
|
||||
{
|
||||
struct {ListBase *lb; bNodeSocket *sock;} *data= arg;
|
||||
struct {ListBase *lb; bNodeSocket *sock; } *data = arg;
|
||||
bNodeSocket *sock;
|
||||
for (sock=data->lb->first; sock; sock = sock->next) {
|
||||
for (sock = data->lb->first; sock; sock = sock->next) {
|
||||
if (sock != data->sock) {
|
||||
NodeImageMultiFileSocket *sockdata = sock->storage;
|
||||
if (STREQ(sockdata->path, name))
|
||||
@@ -65,7 +65,7 @@ static bool unique_path_unique_check(void *arg, const char *name)
|
||||
void ntreeCompositOutputFileUniquePath(ListBase *list, bNodeSocket *sock, const char defname[], char delim)
|
||||
{
|
||||
NodeImageMultiFileSocket *sockdata;
|
||||
struct {ListBase *lb; bNodeSocket *sock;} data;
|
||||
struct {ListBase *lb; bNodeSocket *sock; } data;
|
||||
data.lb = list;
|
||||
data.sock = sock;
|
||||
|
||||
@@ -80,9 +80,9 @@ void ntreeCompositOutputFileUniquePath(ListBase *list, bNodeSocket *sock, const
|
||||
/* find unique EXR layer */
|
||||
static bool unique_layer_unique_check(void *arg, const char *name)
|
||||
{
|
||||
struct {ListBase *lb; bNodeSocket *sock;} *data= arg;
|
||||
struct {ListBase *lb; bNodeSocket *sock; } *data = arg;
|
||||
bNodeSocket *sock;
|
||||
for (sock=data->lb->first; sock; sock = sock->next) {
|
||||
for (sock = data->lb->first; sock; sock = sock->next) {
|
||||
if (sock != data->sock) {
|
||||
NodeImageMultiFileSocket *sockdata = sock->storage;
|
||||
if (STREQ(sockdata->layer, name))
|
||||
@@ -94,7 +94,7 @@ static bool unique_layer_unique_check(void *arg, const char *name)
|
||||
void ntreeCompositOutputFileUniqueLayer(ListBase *list, bNodeSocket *sock, const char defname[], char delim)
|
||||
{
|
||||
NodeImageMultiFileSocket *sockdata;
|
||||
struct {ListBase *lb; bNodeSocket *sock;} data;
|
||||
struct {ListBase *lb; bNodeSocket *sock; } data;
|
||||
data.lb = list;
|
||||
data.sock = sock;
|
||||
|
||||
@@ -121,9 +121,9 @@ bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, con
|
||||
ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, name, '_');
|
||||
|
||||
if (im_format) {
|
||||
sockdata->format= *im_format;
|
||||
sockdata->format = *im_format;
|
||||
if (BKE_imtype_is_movie(sockdata->format.imtype)) {
|
||||
sockdata->format.imtype= R_IMF_IMTYPE_OPENEXR;
|
||||
sockdata->format.imtype = R_IMF_IMTYPE_OPENEXR;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -145,7 +145,7 @@ int ntreeCompositOutputFileRemoveActiveSocket(bNodeTree *ntree, bNode *node)
|
||||
if (!sock)
|
||||
return 0;
|
||||
|
||||
if (nimf->active_input == totinputs-1)
|
||||
if (nimf->active_input == totinputs - 1)
|
||||
--nimf->active_input;
|
||||
|
||||
/* free format data */
|
||||
@@ -175,9 +175,9 @@ static void init_output_file(const bContext *C, PointerRNA *ptr)
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
bNodeTree *ntree = ptr->id.data;
|
||||
bNode *node = ptr->data;
|
||||
NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
|
||||
NodeImageMultiFile *nimf = MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
|
||||
ImageFormatData *format = NULL;
|
||||
node->storage= nimf;
|
||||
node->storage = nimf;
|
||||
|
||||
if (scene) {
|
||||
RenderData *rd = &scene->r;
|
||||
@@ -185,7 +185,7 @@ static void init_output_file(const bContext *C, PointerRNA *ptr)
|
||||
BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path));
|
||||
nimf->format = rd->im_format;
|
||||
if (BKE_imtype_is_movie(nimf->format.imtype)) {
|
||||
nimf->format.imtype= R_IMF_IMTYPE_OPENEXR;
|
||||
nimf->format.imtype = R_IMF_IMTYPE_OPENEXR;
|
||||
}
|
||||
|
||||
format = &nimf->format;
|
||||
@@ -216,7 +216,7 @@ static void copy_output_file(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, bN
|
||||
dest_node->storage = MEM_dupallocN(src_node->storage);
|
||||
|
||||
/* duplicate storage data in sockets */
|
||||
for (src_sock=src_node->inputs.first, dest_sock=dest_node->inputs.first; src_sock && dest_sock; src_sock=src_sock->next, dest_sock=dest_sock->next) {
|
||||
for (src_sock = src_node->inputs.first, dest_sock = dest_node->inputs.first; src_sock && dest_sock; src_sock = src_sock->next, dest_sock = dest_sock->next) {
|
||||
dest_sock->storage = MEM_dupallocN(src_sock->storage);
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,7 @@ void register_node_type_cmp_output_file(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW);
|
||||
node_type_socket_templates(&ntype, NULL, NULL);
|
||||
ntype.initfunc_api = init_output_file;
|
||||
node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file);
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
/** \file blender/nodes/composite/nodes/node_composite_premulkey.c
|
||||
* \ingroup cmpnodes
|
||||
|
||||
@@ -46,7 +46,7 @@ static bNodeSocketTemplate cmp_node_rotate_out[] = {
|
||||
|
||||
static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1= 1; /* Bilinear Filter*/
|
||||
node->custom1 = 1; /* Bilinear Filter*/
|
||||
}
|
||||
|
||||
void register_node_type_cmp_rotate(void)
|
||||
|
||||
@@ -41,19 +41,19 @@ static bNodeSocketTemplate cmp_node_splitviewer_in[] = {
|
||||
|
||||
static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage= iuser;
|
||||
iuser->sfra= 1;
|
||||
iuser->fie_ima= 2;
|
||||
iuser->ok= 1;
|
||||
node->custom1= 50; /* default 50% split */
|
||||
ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage = iuser;
|
||||
iuser->sfra = 1;
|
||||
iuser->fie_ima = 2;
|
||||
iuser->ok = 1;
|
||||
node->custom1 = 50; /* default 50% split */
|
||||
}
|
||||
|
||||
void register_node_type_cmp_splitviewer(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, cmp_node_splitviewer_in, NULL);
|
||||
node_type_init(&ntype, node_composit_init_splitviewer);
|
||||
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -48,7 +48,7 @@ void register_node_type_cmp_texture(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
|
||||
cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS | NODE_PREVIEW);
|
||||
node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
@@ -46,7 +46,7 @@ static bNodeSocketTemplate cmp_node_valtorgb_out[] = {
|
||||
|
||||
static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= add_colorband(true);
|
||||
node->storage = add_colorband(true);
|
||||
}
|
||||
|
||||
void register_node_type_cmp_valtorgb(void)
|
||||
|
||||
@@ -67,10 +67,10 @@ static int shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype))
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
/* allow empty engine string too, this is from older versions that didn't have registerable engines yet */
|
||||
return (scene->r.engine[0] == '\0'
|
||||
|| strcmp(scene->r.engine, "BLENDER_RENDER")==0
|
||||
|| strcmp(scene->r.engine, "BLENDER_GAME")==0
|
||||
|| strcmp(scene->r.engine, "CYCLES")==0);
|
||||
return (scene->r.engine[0] == '\0' ||
|
||||
STREQ(scene->r.engine, "BLENDER_RENDER") ||
|
||||
STREQ(scene->r.engine, "BLENDER_GAME") ||
|
||||
STREQ(scene->r.engine, "CYCLES"));
|
||||
}
|
||||
|
||||
static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
int sh_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
|
||||
{
|
||||
return (strcmp(ntree->idname, "ShaderNodeTree")==0);
|
||||
return STREQ(ntree->idname, "ShaderNodeTree");
|
||||
}
|
||||
|
||||
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag)
|
||||
@@ -54,16 +54,16 @@ void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, shor
|
||||
|
||||
void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
|
||||
{
|
||||
float *from= ns->vec;
|
||||
float *from = ns->vec;
|
||||
|
||||
if (type_in==SOCK_FLOAT) {
|
||||
if (ns->sockettype==SOCK_FLOAT)
|
||||
*in= *from;
|
||||
if (type_in == SOCK_FLOAT) {
|
||||
if (ns->sockettype == SOCK_FLOAT)
|
||||
*in = *from;
|
||||
else
|
||||
*in= (from[0]+from[1]+from[2]) / 3.0f;
|
||||
*in = (from[0] + from[1] + from[2]) / 3.0f;
|
||||
}
|
||||
else if (type_in==SOCK_VECTOR) {
|
||||
if (ns->sockettype==SOCK_FLOAT) {
|
||||
else if (type_in == SOCK_VECTOR) {
|
||||
if (ns->sockettype == SOCK_FLOAT) {
|
||||
in[0] = from[0];
|
||||
in[1] = from[0];
|
||||
in[2] = from[0];
|
||||
@@ -73,10 +73,10 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
|
||||
}
|
||||
}
|
||||
else { /* type_in==SOCK_RGBA */
|
||||
if (ns->sockettype==SOCK_RGBA) {
|
||||
if (ns->sockettype == SOCK_RGBA) {
|
||||
copy_v4_v4(in, from);
|
||||
}
|
||||
else if (ns->sockettype==SOCK_FLOAT) {
|
||||
else if (ns->sockettype == SOCK_FLOAT) {
|
||||
in[0] = from[0];
|
||||
in[1] = from[0];
|
||||
in[2] = from[0];
|
||||
@@ -99,33 +99,33 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
|
||||
int a;
|
||||
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
if (node->type==SH_NODE_TEXTURE) {
|
||||
if (node->type == SH_NODE_TEXTURE) {
|
||||
if ((r_mode & R_OSA) && node->id) {
|
||||
Tex *tex= (Tex *)node->id;
|
||||
Tex *tex = (Tex *)node->id;
|
||||
if (ELEM(tex->type, TEX_IMAGE, TEX_ENVMAP)) {
|
||||
*texco |= TEXCO_OSA|NEED_UV;
|
||||
*texco |= TEXCO_OSA | NEED_UV;
|
||||
}
|
||||
}
|
||||
/* usability exception... without input we still give the node orcos */
|
||||
sock= node->inputs.first;
|
||||
if (sock==NULL || sock->link==NULL)
|
||||
*texco |= TEXCO_ORCO|NEED_UV;
|
||||
sock = node->inputs.first;
|
||||
if (sock == NULL || sock->link == NULL)
|
||||
*texco |= TEXCO_ORCO | NEED_UV;
|
||||
}
|
||||
else if (node->type==SH_NODE_GEOMETRY) {
|
||||
else if (node->type == SH_NODE_GEOMETRY) {
|
||||
/* note; sockets always exist for the given type! */
|
||||
for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
|
||||
for (a = 0, sock = node->outputs.first; sock; sock = sock->next, a++) {
|
||||
if (sock->flag & SOCK_IN_USE) {
|
||||
switch (a) {
|
||||
case GEOM_OUT_GLOB:
|
||||
*texco |= TEXCO_GLOB|NEED_UV; break;
|
||||
*texco |= TEXCO_GLOB | NEED_UV; break;
|
||||
case GEOM_OUT_VIEW:
|
||||
*texco |= TEXCO_VIEW|NEED_UV; break;
|
||||
*texco |= TEXCO_VIEW | NEED_UV; break;
|
||||
case GEOM_OUT_ORCO:
|
||||
*texco |= TEXCO_ORCO|NEED_UV; break;
|
||||
*texco |= TEXCO_ORCO | NEED_UV; break;
|
||||
case GEOM_OUT_UV:
|
||||
*texco |= TEXCO_UV|NEED_UV; break;
|
||||
*texco |= TEXCO_UV | NEED_UV; break;
|
||||
case GEOM_OUT_NORMAL:
|
||||
*texco |= TEXCO_NORM|NEED_UV; break;
|
||||
*texco |= TEXCO_NORM | NEED_UV; break;
|
||||
case GEOM_OUT_VCOL:
|
||||
*texco |= NEED_UV; *mode |= MA_VERTEXCOL; break;
|
||||
case GEOM_OUT_VCOL_ALPHA:
|
||||
@@ -142,34 +142,34 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns)
|
||||
memset(gs, 0, sizeof(*gs));
|
||||
|
||||
copy_v4_v4(gs->vec, ns->vec);
|
||||
gs->link= ns->data;
|
||||
gs->link = ns->data;
|
||||
|
||||
if (type == SOCK_FLOAT)
|
||||
gs->type= GPU_FLOAT;
|
||||
gs->type = GPU_FLOAT;
|
||||
else if (type == SOCK_VECTOR)
|
||||
gs->type= GPU_VEC3;
|
||||
gs->type = GPU_VEC3;
|
||||
else if (type == SOCK_RGBA)
|
||||
gs->type= GPU_VEC4;
|
||||
gs->type = GPU_VEC4;
|
||||
else if (type == SOCK_SHADER)
|
||||
gs->type= GPU_VEC4;
|
||||
gs->type = GPU_VEC4;
|
||||
else
|
||||
gs->type= GPU_NONE;
|
||||
gs->type = GPU_NONE;
|
||||
|
||||
gs->name = "";
|
||||
gs->hasinput= ns->hasinput && ns->data;
|
||||
gs->hasinput = ns->hasinput && ns->data;
|
||||
/* XXX Commented out the ns->data check here, as it seems it's not always set,
|
||||
* even though there *is* a valid connection/output... But that might need
|
||||
* further investigation.
|
||||
*/
|
||||
gs->hasoutput= ns->hasoutput /*&& ns->data*/;
|
||||
gs->sockettype= ns->sockettype;
|
||||
gs->hasoutput = ns->hasoutput /*&& ns->data*/;
|
||||
gs->sockettype = ns->sockettype;
|
||||
}
|
||||
|
||||
void node_data_from_gpu_stack(bNodeStack *ns, GPUNodeStack *gs)
|
||||
{
|
||||
copy_v4_v4(ns->vec, gs->vec);
|
||||
ns->data= gs->link;
|
||||
ns->sockettype= gs->sockettype;
|
||||
ns->data = gs->link;
|
||||
ns->sockettype = gs->sockettype;
|
||||
}
|
||||
|
||||
static void gpu_stack_from_data_list(GPUNodeStack *gs, ListBase *sockets, bNodeStack **ns)
|
||||
@@ -177,10 +177,10 @@ static void gpu_stack_from_data_list(GPUNodeStack *gs, ListBase *sockets, bNodeS
|
||||
bNodeSocket *sock;
|
||||
int i;
|
||||
|
||||
for (sock=sockets->first, i=0; sock; sock = sock->next, i++)
|
||||
for (sock = sockets->first, i = 0; sock; sock = sock->next, i++)
|
||||
node_gpu_stack_from_data(&gs[i], sock->type, ns[i]);
|
||||
|
||||
gs[i].type= GPU_NONE;
|
||||
gs[i].type = GPU_NONE;
|
||||
}
|
||||
|
||||
static void data_from_gpu_stack_list(ListBase *sockets, bNodeStack **ns, GPUNodeStack *gs)
|
||||
@@ -188,7 +188,7 @@ static void data_from_gpu_stack_list(ListBase *sockets, bNodeStack **ns, GPUNode
|
||||
bNodeSocket *sock;
|
||||
int i;
|
||||
|
||||
for (sock=sockets->first, i=0; sock; sock = sock->next, i++)
|
||||
for (sock = sockets->first, i = 0; sock; sock = sock->next, i++)
|
||||
node_data_from_gpu_stack(ns[i], &gs[i]);
|
||||
}
|
||||
|
||||
@@ -206,8 +206,8 @@ bNode *nodeGetActiveTexture(bNodeTree *ntree)
|
||||
|
||||
/* node active texture node in this tree, look inside groups */
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
if (node->type==NODE_GROUP) {
|
||||
tnode = nodeGetActiveTexture((bNodeTree*)node->id);
|
||||
if (node->type == NODE_GROUP) {
|
||||
tnode = nodeGetActiveTexture((bNodeTree *)node->id);
|
||||
if (tnode)
|
||||
return tnode;
|
||||
}
|
||||
@@ -222,19 +222,19 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
|
||||
bNode *node;
|
||||
int n;
|
||||
bNodeStack *stack;
|
||||
bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
|
||||
bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
|
||||
bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
|
||||
bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
|
||||
GPUNodeStack gpuin[MAX_SOCKET + 1], gpuout[MAX_SOCKET + 1];
|
||||
int do_it;
|
||||
|
||||
stack= exec->stack;
|
||||
stack = exec->stack;
|
||||
|
||||
for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
|
||||
for (n = 0, nodeexec = exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
|
||||
node = nodeexec->node;
|
||||
|
||||
do_it = FALSE;
|
||||
/* for groups, only execute outputs for edited group */
|
||||
if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
|
||||
if (node->typeinfo->nclass == NODE_CLASS_OUTPUT) {
|
||||
if (do_outputs && (node->flag & NODE_DO_OUTPUT))
|
||||
do_it = TRUE;
|
||||
}
|
||||
@@ -255,10 +255,10 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
|
||||
|
||||
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *UNUSED(out))
|
||||
{
|
||||
NodeTexBase *base= node->storage;
|
||||
TexMapping *texmap= &base->tex_mapping;
|
||||
float domin= (texmap->flag & TEXMAP_CLIP_MIN) != 0;
|
||||
float domax= (texmap->flag & TEXMAP_CLIP_MAX) != 0;
|
||||
NodeTexBase *base = node->storage;
|
||||
TexMapping *texmap = &base->tex_mapping;
|
||||
float domin = (texmap->flag & TEXMAP_CLIP_MIN) != 0;
|
||||
float domax = (texmap->flag & TEXMAP_CLIP_MAX) != 0;
|
||||
|
||||
if (domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) {
|
||||
GPUNodeLink *tmat = GPU_uniform((float *)texmap->mat);
|
||||
|
||||
@@ -44,11 +44,11 @@ static bNodeSocketTemplate sh_node_camera_out[] = {
|
||||
static void node_shader_exec_camera(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **out)
|
||||
{
|
||||
if (data) {
|
||||
ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */
|
||||
ShadeInput *shi = ((ShaderCallData *)data)->shi; /* Data we need for shading. */
|
||||
|
||||
copy_v3_v3(out[0]->vec, shi->co); /* get view vector */
|
||||
out[1]->vec[0] = fabs(shi->co[2]); /* get view z-depth */
|
||||
out[2]->vec[0] = normalize_v3(out[0]->vec); /* get view distance */
|
||||
copy_v3_v3(out[0]->vec, shi->co); /* get view vector */
|
||||
out[1]->vec[0] = fabs(shi->co[2]); /* get view z-depth */
|
||||
out[2]->vec[0] = normalize_v3(out[0]->vec); /* get view distance */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void register_node_type_sh_camera(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_camera_out);
|
||||
node_type_storage(&ntype, "node_camera", NULL, NULL);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_camera);
|
||||
|
||||
@@ -87,7 +87,7 @@ static void *group_initexec(bNodeExecContext *context, bNode *node, bNodeInstanc
|
||||
|
||||
static void group_freeexec(bNode *UNUSED(node), void *nodedata)
|
||||
{
|
||||
bNodeTreeExec*gexec = (bNodeTreeExec *)nodedata;
|
||||
bNodeTreeExec *gexec = (bNodeTreeExec *)nodedata;
|
||||
|
||||
ntreeShaderEndExecTree_internal(gexec);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ static void group_freeexec(bNode *UNUSED(node), void *nodedata)
|
||||
*/
|
||||
static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree*)gnode->id;
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
@@ -117,7 +117,7 @@ static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack)
|
||||
*/
|
||||
static void group_move_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree*)gnode->id;
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
@@ -130,7 +130,7 @@ static void group_move_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstac
|
||||
if (ns)
|
||||
move_stack(out[a], ns);
|
||||
}
|
||||
break; /* only one active output node */
|
||||
break; /* only one active output node */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ static void group_execute(void *data, int thread, struct bNode *node, bNodeExecD
|
||||
*/
|
||||
{
|
||||
bNode *inode;
|
||||
for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
|
||||
for (inode = exec->nodetree->nodes.first; inode; inode = inode->next)
|
||||
inode->need_exec = 1;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ static void group_execute(void *data, int thread, struct bNode *node, bNodeExecD
|
||||
|
||||
static void group_gpu_copy_inputs(bNode *gnode, GPUNodeStack *in, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree*)gnode->id;
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
@@ -186,7 +186,7 @@ static void group_gpu_copy_inputs(bNode *gnode, GPUNodeStack *in, bNodeStack *gs
|
||||
*/
|
||||
static void group_gpu_move_outputs(bNode *gnode, GPUNodeStack *out, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree*)gnode->id;
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
@@ -201,7 +201,7 @@ static void group_gpu_move_outputs(bNode *gnode, GPUNodeStack *out, bNodeStack *
|
||||
node_gpu_stack_from_data(&out[a], sock->type, ns);
|
||||
}
|
||||
}
|
||||
break; /* only one active output node */
|
||||
break; /* only one active output node */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,11 +211,11 @@ static int gpu_group_execute(GPUMaterial *mat, bNode *node, bNodeExecData *execd
|
||||
bNodeTreeExec *exec = execdata->data;
|
||||
|
||||
group_gpu_copy_inputs(node, in, exec->stack);
|
||||
#if 0 /* XXX NODE_GROUP_EDIT is deprecated, depends on node space */
|
||||
#if 0 /* XXX NODE_GROUP_EDIT is deprecated, depends on node space */
|
||||
ntreeExecGPUNodes(exec, mat, (node->flag & NODE_GROUP_EDIT));
|
||||
#else
|
||||
#else
|
||||
ntreeExecGPUNodes(exec, mat, 0);
|
||||
#endif
|
||||
#endif
|
||||
group_gpu_move_outputs(node, out, exec->stack);
|
||||
|
||||
return 1;
|
||||
@@ -237,7 +237,7 @@ void register_node_type_sh_group(void)
|
||||
BLI_assert(ntype.ext.srna != NULL);
|
||||
RNA_struct_blender_type_set(ntype.ext.srna, &ntype);
|
||||
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, NULL, NULL);
|
||||
node_type_size(&ntype, 120, 60, 200);
|
||||
node_type_label(&ntype, node_group_label);
|
||||
|
||||
@@ -57,7 +57,7 @@ static void node_shader_exec_curve_vec(void *UNUSED(data), int UNUSED(thread), b
|
||||
|
||||
static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
|
||||
node->storage = curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
@@ -74,7 +74,7 @@ void register_node_type_sh_curve_vec(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_curve_vec_in, sh_node_curve_vec_out);
|
||||
node_type_init(&ntype, node_shader_init_curve_vec);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
|
||||
@@ -113,7 +113,7 @@ static void node_shader_exec_curve_rgb(void *UNUSED(data), int UNUSED(thread), b
|
||||
|
||||
static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
node->storage = curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
@@ -131,7 +131,7 @@ void register_node_type_sh_curve_rgb(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_curve_rgb_in, sh_node_curve_rgb_out);
|
||||
node_type_init(&ntype, node_shader_init_curve_rgb);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
|
||||
|
||||
@@ -54,17 +54,17 @@ static bNodeSocketTemplate sh_node_geom_out[] = {
|
||||
static void node_shader_exec_geom(void *data, int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **UNUSED(in), bNodeStack **out)
|
||||
{
|
||||
if (data) {
|
||||
ShadeInput *shi= ((ShaderCallData *)data)->shi;
|
||||
NodeGeometry *ngeo= (NodeGeometry*)node->storage;
|
||||
ShadeInputUV *suv= &shi->uv[shi->actuv];
|
||||
ShadeInput *shi = ((ShaderCallData *)data)->shi;
|
||||
NodeGeometry *ngeo = (NodeGeometry *)node->storage;
|
||||
ShadeInputUV *suv = &shi->uv[shi->actuv];
|
||||
static float defaultvcol[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
int i;
|
||||
|
||||
if (ngeo->uvname[0]) {
|
||||
/* find uv map by name */
|
||||
for (i = 0; i < shi->totuv; i++) {
|
||||
if (strcmp(shi->uv[i].name, ngeo->uvname)==0) {
|
||||
suv= &shi->uv[i];
|
||||
if (strcmp(shi->uv[i].name, ngeo->uvname) == 0) {
|
||||
suv = &shi->uv[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -80,12 +80,12 @@ static void node_shader_exec_geom(void *data, int UNUSED(thread), bNode *node, b
|
||||
|
||||
if (shi->totcol) {
|
||||
/* find vertex color layer by name */
|
||||
ShadeInputCol *scol= &shi->col[0];
|
||||
ShadeInputCol *scol = &shi->col[0];
|
||||
|
||||
if (ngeo->colname[0]) {
|
||||
for (i = 0; i < shi->totcol; i++) {
|
||||
if (strcmp(shi->col[i].name, ngeo->colname)==0) {
|
||||
scol= &shi->col[i];
|
||||
if (strcmp(shi->col[i].name, ngeo->colname) == 0) {
|
||||
scol = &shi->col[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -101,18 +101,18 @@ static void node_shader_exec_geom(void *data, int UNUSED(thread), bNode *node, b
|
||||
}
|
||||
|
||||
if (shi->osatex) {
|
||||
out[GEOM_OUT_GLOB]->data= shi->dxgl;
|
||||
out[GEOM_OUT_GLOB]->datatype= NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_LOCAL]->data= shi->dxco;
|
||||
out[GEOM_OUT_LOCAL]->datatype= NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_VIEW]->data= &shi->dxview;
|
||||
out[GEOM_OUT_VIEW]->datatype= NS_OSA_VALUES;
|
||||
out[GEOM_OUT_ORCO]->data= shi->dxlo;
|
||||
out[GEOM_OUT_ORCO]->datatype= NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_UV]->data= suv->dxuv;
|
||||
out[GEOM_OUT_UV]->datatype= NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_NORMAL]->data= shi->dxno;
|
||||
out[GEOM_OUT_NORMAL]->datatype= NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_GLOB]->data = shi->dxgl;
|
||||
out[GEOM_OUT_GLOB]->datatype = NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_LOCAL]->data = shi->dxco;
|
||||
out[GEOM_OUT_LOCAL]->datatype = NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_VIEW]->data = &shi->dxview;
|
||||
out[GEOM_OUT_VIEW]->datatype = NS_OSA_VALUES;
|
||||
out[GEOM_OUT_ORCO]->data = shi->dxlo;
|
||||
out[GEOM_OUT_ORCO]->datatype = NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_UV]->data = suv->dxuv;
|
||||
out[GEOM_OUT_UV]->datatype = NS_OSA_VECTORS;
|
||||
out[GEOM_OUT_NORMAL]->data = shi->dxno;
|
||||
out[GEOM_OUT_NORMAL]->datatype = NS_OSA_VECTORS;
|
||||
}
|
||||
|
||||
/* front/back, normal flipping was stored */
|
||||
@@ -122,19 +122,19 @@ static void node_shader_exec_geom(void *data, int UNUSED(thread), bNode *node, b
|
||||
|
||||
static void node_shader_init_geometry(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
|
||||
node->storage = MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
|
||||
}
|
||||
|
||||
static int gpu_shader_geom(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
NodeGeometry *ngeo= (NodeGeometry*)node->storage;
|
||||
NodeGeometry *ngeo = (NodeGeometry *)node->storage;
|
||||
GPUNodeLink *orco = GPU_attribute(CD_ORCO, "");
|
||||
GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, ngeo->uvname);
|
||||
GPUNodeLink *mcol = GPU_attribute(CD_MCOL, ngeo->colname);
|
||||
|
||||
return GPU_stack_link(mat, "geom", in, out,
|
||||
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
|
||||
GPU_builtin(GPU_INVERSE_VIEW_MATRIX), orco, mtface, mcol);
|
||||
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
|
||||
GPU_builtin(GPU_INVERSE_VIEW_MATRIX), orco, mtface, mcol);
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
|
||||
@@ -43,8 +43,8 @@ static bNodeSocketTemplate sh_node_geometry_out[] = {
|
||||
static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
return GPU_stack_link(mat, "node_geometry", in, out,
|
||||
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
|
||||
GPU_builtin(GPU_INVERSE_VIEW_MATRIX));
|
||||
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
|
||||
GPU_builtin(GPU_INVERSE_VIEW_MATRIX));
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
|
||||
@@ -50,19 +50,19 @@ static bNodeSocketTemplate sh_node_hue_sat_out[] = {
|
||||
/* note: it would be possible to use CMP version for both nodes */
|
||||
static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac)
|
||||
{
|
||||
if (*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) {
|
||||
float col[3], hsv[3], mfac= 1.0f - *fac;
|
||||
if (*fac != 0.0f && (*hue != 0.5f || *sat != 1.0f || *val != 1.0f)) {
|
||||
float col[3], hsv[3], mfac = 1.0f - *fac;
|
||||
|
||||
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
|
||||
hsv[0]+= (*hue - 0.5f);
|
||||
if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
|
||||
hsv[1]*= *sat;
|
||||
hsv[2]*= *val;
|
||||
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
|
||||
|
||||
out[0] = mfac*in[0] + *fac*col[0];
|
||||
out[1] = mfac*in[1] + *fac*col[1];
|
||||
out[2] = mfac*in[2] + *fac*col[2];
|
||||
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv + 1, hsv + 2);
|
||||
hsv[0] += (*hue - 0.5f);
|
||||
if (hsv[0] > 1.0f) hsv[0] -= 1.0f; else if (hsv[0] < 0.0f) hsv[0] += 1.0f;
|
||||
hsv[1] *= *sat;
|
||||
hsv[2] *= *val;
|
||||
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col + 1, col + 2);
|
||||
|
||||
out[0] = mfac * in[0] + *fac * col[0];
|
||||
out[1] = mfac * in[1] + *fac * col[1];
|
||||
out[2] = mfac * in[2] + *fac * col[2];
|
||||
}
|
||||
else {
|
||||
copy_v4_v4(out, in);
|
||||
@@ -85,7 +85,7 @@ void register_node_type_sh_hue_sat(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_hue_sat_in, sh_node_hue_sat_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_hue_sat);
|
||||
|
||||
@@ -47,7 +47,7 @@ static bNodeSocketTemplate sh_node_invert_out[] = {
|
||||
};
|
||||
|
||||
static void node_shader_exec_invert(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in,
|
||||
bNodeStack **out)
|
||||
bNodeStack **out)
|
||||
{
|
||||
float col[3], facm;
|
||||
|
||||
@@ -59,9 +59,9 @@ bNodeStack **out)
|
||||
if (in[0]->vec[0] < 1.0f) {
|
||||
facm = 1.0f - in[0]->vec[0];
|
||||
|
||||
col[0] = in[0]->vec[0]*col[0] + (facm*in[1]->vec[0]);
|
||||
col[1] = in[0]->vec[0]*col[1] + (facm*in[1]->vec[1]);
|
||||
col[2] = in[0]->vec[0]*col[2] + (facm*in[1]->vec[2]);
|
||||
col[0] = in[0]->vec[0] * col[0] + (facm * in[1]->vec[0]);
|
||||
col[1] = in[0]->vec[0] * col[1] + (facm * in[1]->vec[1]);
|
||||
col[2] = in[0]->vec[0] * col[2] + (facm * in[1]->vec[2]);
|
||||
}
|
||||
|
||||
copy_v3_v3(out[0]->vec, col);
|
||||
@@ -77,7 +77,7 @@ void register_node_type_sh_invert(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_invert_in, sh_node_invert_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_invert);
|
||||
node_type_gpu(&ntype, gpu_shader_invert);
|
||||
|
||||
@@ -46,8 +46,8 @@ static bNodeSocketTemplate sh_node_mapping_out[] = {
|
||||
/* do the regular mapping options for blender textures */
|
||||
static void node_shader_exec_mapping(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
|
||||
{
|
||||
TexMapping *texmap= node->storage;
|
||||
float *vec= out[0]->vec;
|
||||
TexMapping *texmap = node->storage;
|
||||
float *vec = out[0]->vec;
|
||||
|
||||
/* stack order input: vector */
|
||||
/* stack order output: vector */
|
||||
@@ -55,28 +55,28 @@ static void node_shader_exec_mapping(void *UNUSED(data), int UNUSED(thread), bNo
|
||||
mul_m4_v3(texmap->mat, vec);
|
||||
|
||||
if (texmap->flag & TEXMAP_CLIP_MIN) {
|
||||
if (vec[0]<texmap->min[0]) vec[0] = texmap->min[0];
|
||||
if (vec[1]<texmap->min[1]) vec[1] = texmap->min[1];
|
||||
if (vec[2]<texmap->min[2]) vec[2] = texmap->min[2];
|
||||
if (vec[0] < texmap->min[0]) vec[0] = texmap->min[0];
|
||||
if (vec[1] < texmap->min[1]) vec[1] = texmap->min[1];
|
||||
if (vec[2] < texmap->min[2]) vec[2] = texmap->min[2];
|
||||
}
|
||||
if (texmap->flag & TEXMAP_CLIP_MAX) {
|
||||
if (vec[0]>texmap->max[0]) vec[0] = texmap->max[0];
|
||||
if (vec[1]>texmap->max[1]) vec[1] = texmap->max[1];
|
||||
if (vec[2]>texmap->max[2]) vec[2] = texmap->max[2];
|
||||
if (vec[0] > texmap->max[0]) vec[0] = texmap->max[0];
|
||||
if (vec[1] > texmap->max[1]) vec[1] = texmap->max[1];
|
||||
if (vec[2] > texmap->max[2]) vec[2] = texmap->max[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void node_shader_init_mapping(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= add_tex_mapping();
|
||||
node->storage = add_tex_mapping();
|
||||
}
|
||||
|
||||
static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
TexMapping *texmap= node->storage;
|
||||
float domin= (texmap->flag & TEXMAP_CLIP_MIN) != 0;
|
||||
float domax= (texmap->flag & TEXMAP_CLIP_MAX) != 0;
|
||||
TexMapping *texmap = node->storage;
|
||||
float domin = (texmap->flag & TEXMAP_CLIP_MIN) != 0;
|
||||
float domax = (texmap->flag & TEXMAP_CLIP_MAX) != 0;
|
||||
GPUNodeLink *tmat = GPU_uniform((float *)texmap->mat);
|
||||
GPUNodeLink *tmin = GPU_uniform(texmap->min);
|
||||
GPUNodeLink *tmax = GPU_uniform(texmap->max);
|
||||
@@ -91,7 +91,7 @@ void register_node_type_sh_mapping(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_mapping_in, sh_node_mapping_out);
|
||||
node_type_size(&ntype, 320, 160, 360);
|
||||
node_type_init(&ntype, node_shader_init_mapping);
|
||||
|
||||
@@ -80,7 +80,7 @@ static void node_shader_exec_material(void *data, int UNUSED(thread), bNode *nod
|
||||
if (data && node->id) {
|
||||
ShadeResult shrnode;
|
||||
ShadeInput *shi;
|
||||
ShaderCallData *shcd= data;
|
||||
ShaderCallData *shcd = data;
|
||||
float col[4];
|
||||
bNodeSocket *sock;
|
||||
char hasinput[NUM_MAT_IN] = {'\0'};
|
||||
@@ -91,15 +91,15 @@ static void node_shader_exec_material(void *data, int UNUSED(thread), bNode *nod
|
||||
* we just want to know if a node input uses external data or the material setting.
|
||||
* this is an ugly hack, but so is this node as a whole.
|
||||
*/
|
||||
for (sock = node->inputs.first, i=0; sock; sock = sock->next, ++i)
|
||||
for (sock = node->inputs.first, i = 0; sock; sock = sock->next, ++i)
|
||||
hasinput[i] = (sock->link != NULL);
|
||||
|
||||
shi= shcd->shi;
|
||||
shi->mat= (Material *)node->id;
|
||||
shi = shcd->shi;
|
||||
shi->mat = (Material *)node->id;
|
||||
|
||||
/* copy all relevant material vars, note, keep this synced with render_types.h */
|
||||
memcpy(&shi->r, &shi->mat->r, 23*sizeof(float));
|
||||
shi->har= shi->mat->har;
|
||||
memcpy(&shi->r, &shi->mat->r, 23 * sizeof(float));
|
||||
shi->har = shi->mat->har;
|
||||
|
||||
/* write values */
|
||||
if (hasinput[MAT_IN_COLOR])
|
||||
@@ -147,9 +147,9 @@ static void node_shader_exec_material(void *data, int UNUSED(thread), bNode *nod
|
||||
if (shi->mat->mode & MA_TRANSP)
|
||||
shi->mode |= MA_TRANSP;
|
||||
|
||||
shi->nodes= 1; /* temp hack to prevent trashadow recursion */
|
||||
node_shader_lamp_loop(shi, &shrnode); /* clears shrnode */
|
||||
shi->nodes= 0;
|
||||
shi->nodes = 1; /* temp hack to prevent trashadow recursion */
|
||||
node_shader_lamp_loop(shi, &shrnode); /* clears shrnode */
|
||||
shi->nodes = 0;
|
||||
|
||||
shi->mode = mode;
|
||||
|
||||
@@ -196,12 +196,12 @@ static void node_shader_exec_material(void *data, int UNUSED(thread), bNode *nod
|
||||
float combined[4], alpha;
|
||||
|
||||
copy_v4_v4(combined, shcd->shr->combined);
|
||||
alpha= shcd->shr->alpha;
|
||||
alpha = shcd->shr->alpha;
|
||||
|
||||
*(shcd->shr)= shrnode;
|
||||
*(shcd->shr) = shrnode;
|
||||
|
||||
copy_v4_v4(shcd->shr->combined, combined);
|
||||
shcd->shr->alpha= alpha;
|
||||
shcd->shr->alpha = alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ static void node_shader_exec_material(void *data, int UNUSED(thread), bNode *nod
|
||||
|
||||
static void node_shader_init_material(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1= SH_NODE_MAT_DIFF|SH_NODE_MAT_SPEC;
|
||||
node->custom1 = SH_NODE_MAT_DIFF | SH_NODE_MAT_SPEC;
|
||||
}
|
||||
|
||||
/* XXX this is also done as a local static function in gpu_codegen.c,
|
||||
@@ -236,10 +236,10 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, bNodeExecData *UNU
|
||||
* the constant input stack values (e.g. in case material node is inside a group).
|
||||
* we just want to know if a node input uses external data or the material setting.
|
||||
*/
|
||||
for (sock = node->inputs.first, i=0; sock; sock = sock->next, ++i)
|
||||
for (sock = node->inputs.first, i = 0; sock; sock = sock->next, ++i)
|
||||
hasinput[i] = (sock->link != NULL);
|
||||
|
||||
GPU_shadeinput_set(mat, (Material*)node->id, &shi);
|
||||
GPU_shadeinput_set(mat, (Material *)node->id, &shi);
|
||||
|
||||
/* write values */
|
||||
if (hasinput[MAT_IN_COLOR])
|
||||
@@ -264,18 +264,18 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, bNodeExecData *UNU
|
||||
|
||||
if (node->type == SH_NODE_MATERIAL_EXT) {
|
||||
if (hasinput[MAT_IN_AMB])
|
||||
shi.amb= gpu_get_input_link(&in[MAT_IN_AMB]);
|
||||
shi.amb = gpu_get_input_link(&in[MAT_IN_AMB]);
|
||||
if (hasinput[MAT_IN_EMIT])
|
||||
shi.emit= gpu_get_input_link(&in[MAT_IN_EMIT]);
|
||||
shi.emit = gpu_get_input_link(&in[MAT_IN_EMIT]);
|
||||
if (hasinput[MAT_IN_ALPHA])
|
||||
shi.alpha= gpu_get_input_link(&in[MAT_IN_ALPHA]);
|
||||
shi.alpha = gpu_get_input_link(&in[MAT_IN_ALPHA]);
|
||||
}
|
||||
|
||||
GPU_shaderesult_set(&shi, &shr); /* clears shr */
|
||||
|
||||
/* write to outputs */
|
||||
if (node->custom1 & SH_NODE_MAT_DIFF) {
|
||||
out[MAT_OUT_COLOR].link= shr.combined;
|
||||
out[MAT_OUT_COLOR].link = shr.combined;
|
||||
|
||||
if (!(node->custom1 & SH_NODE_MAT_SPEC)) {
|
||||
GPUNodeLink *link;
|
||||
@@ -283,7 +283,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, bNodeExecData *UNU
|
||||
}
|
||||
}
|
||||
else if (node->custom1 & SH_NODE_MAT_SPEC) {
|
||||
out[MAT_OUT_COLOR].link= shr.spec;
|
||||
out[MAT_OUT_COLOR].link = shr.spec;
|
||||
}
|
||||
else
|
||||
GPU_link(mat, "set_rgb_zero", &out[MAT_OUT_COLOR].link);
|
||||
@@ -311,7 +311,7 @@ void register_node_type_sh_material(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
|
||||
sh_node_type_base(&ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_OPTIONS | NODE_PREVIEW);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_material_in, sh_node_material_out);
|
||||
node_type_init(&ntype, node_shader_init_material);
|
||||
@@ -326,7 +326,7 @@ void register_node_type_sh_material_ext(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
|
||||
sh_node_type_base(&ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_OPTIONS | NODE_PREVIEW);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_material_ext_in, sh_node_material_ext_out);
|
||||
node_type_init(&ntype, node_shader_init_material);
|
||||
|
||||
@@ -49,24 +49,24 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
{
|
||||
switch (node->custom1) {
|
||||
|
||||
case 0: /* Add */
|
||||
out[0]->vec[0] = in[0]->vec[0] + in[1]->vec[0];
|
||||
break;
|
||||
case 1: /* Subtract */
|
||||
out[0]->vec[0] = in[0]->vec[0] - in[1]->vec[0];
|
||||
break;
|
||||
case 2: /* Multiply */
|
||||
out[0]->vec[0] = in[0]->vec[0] * in[1]->vec[0];
|
||||
break;
|
||||
case 3: /* Divide */
|
||||
case 0: /* Add */
|
||||
out[0]->vec[0] = in[0]->vec[0] + in[1]->vec[0];
|
||||
break;
|
||||
case 1: /* Subtract */
|
||||
out[0]->vec[0] = in[0]->vec[0] - in[1]->vec[0];
|
||||
break;
|
||||
case 2: /* Multiply */
|
||||
out[0]->vec[0] = in[0]->vec[0] * in[1]->vec[0];
|
||||
break;
|
||||
case 3: /* Divide */
|
||||
{
|
||||
if (in[1]->vec[0]==0) /* We don't want to divide by zero. */
|
||||
if (in[1]->vec[0] == 0) /* We don't want to divide by zero. */
|
||||
out[0]->vec[0] = 0.0;
|
||||
else
|
||||
out[0]->vec[0] = in[0]->vec[0] / in[1]->vec[0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4: /* Sine */
|
||||
case 4: /* Sine */
|
||||
{
|
||||
if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
|
||||
out[0]->vec[0] = sin(in[0]->vec[0]);
|
||||
@@ -74,7 +74,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = sin(in[1]->vec[0]);
|
||||
}
|
||||
break;
|
||||
case 5: /* Cosine */
|
||||
case 5: /* Cosine */
|
||||
{
|
||||
if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
|
||||
out[0]->vec[0] = cos(in[0]->vec[0]);
|
||||
@@ -82,7 +82,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = cos(in[1]->vec[0]);
|
||||
}
|
||||
break;
|
||||
case 6: /* Tangent */
|
||||
case 6: /* Tangent */
|
||||
{
|
||||
if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
|
||||
out[0]->vec[0] = tan(in[0]->vec[0]);
|
||||
@@ -90,7 +90,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = tan(in[1]->vec[0]);
|
||||
}
|
||||
break;
|
||||
case 7: /* Arc-Sine */
|
||||
case 7: /* Arc-Sine */
|
||||
{
|
||||
if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
|
||||
/* Can't do the impossible... */
|
||||
@@ -108,7 +108,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8: /* Arc-Cosine */
|
||||
case 8: /* Arc-Cosine */
|
||||
{
|
||||
if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
|
||||
/* Can't do the impossible... */
|
||||
@@ -126,7 +126,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 9: /* Arc-Tangent */
|
||||
case 9: /* Arc-Tangent */
|
||||
{
|
||||
if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
|
||||
out[0]->vec[0] = atan(in[0]->vec[0]);
|
||||
@@ -134,7 +134,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = atan(in[1]->vec[0]);
|
||||
}
|
||||
break;
|
||||
case 10: /* Power */
|
||||
case 10: /* Power */
|
||||
{
|
||||
/* Only raise negative numbers by full integers */
|
||||
if (in[0]->vec[0] >= 0) {
|
||||
@@ -154,7 +154,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
|
||||
}
|
||||
break;
|
||||
case 11: /* Logarithm */
|
||||
case 11: /* Logarithm */
|
||||
{
|
||||
/* Don't want any imaginary numbers... */
|
||||
if (in[0]->vec[0] > 0 && in[1]->vec[0] > 0)
|
||||
@@ -163,7 +163,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = 0.0;
|
||||
}
|
||||
break;
|
||||
case 12: /* Minimum */
|
||||
case 12: /* Minimum */
|
||||
{
|
||||
if (in[0]->vec[0] < in[1]->vec[0])
|
||||
out[0]->vec[0] = in[0]->vec[0];
|
||||
@@ -171,7 +171,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = in[1]->vec[0];
|
||||
}
|
||||
break;
|
||||
case 13: /* Maximum */
|
||||
case 13: /* Maximum */
|
||||
{
|
||||
if (in[0]->vec[0] > in[1]->vec[0])
|
||||
out[0]->vec[0] = in[0]->vec[0];
|
||||
@@ -179,7 +179,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = in[1]->vec[0];
|
||||
}
|
||||
break;
|
||||
case 14: /* Round */
|
||||
case 14: /* Round */
|
||||
{
|
||||
if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
|
||||
out[0]->vec[0] = (in[0]->vec[0] < 0) ? (int)(in[0]->vec[0] - 0.5f) : (int)(in[0]->vec[0] + 0.5f);
|
||||
@@ -187,7 +187,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = (in[1]->vec[0] < 0) ? (int)(in[1]->vec[0] - 0.5f) : (int)(in[1]->vec[0] + 0.5f);
|
||||
}
|
||||
break;
|
||||
case 15: /* Less Than */
|
||||
case 15: /* Less Than */
|
||||
{
|
||||
if (in[0]->vec[0] < in[1]->vec[0])
|
||||
out[0]->vec[0] = 1.0f;
|
||||
@@ -195,7 +195,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = 0.0f;
|
||||
}
|
||||
break;
|
||||
case 16: /* Greater Than */
|
||||
case 16: /* Greater Than */
|
||||
{
|
||||
if (in[0]->vec[0] > in[1]->vec[0])
|
||||
out[0]->vec[0] = 1.0f;
|
||||
@@ -203,7 +203,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
out[0]->vec[0] = 0.0f;
|
||||
}
|
||||
break;
|
||||
case 17: /* Modulo */
|
||||
case 17: /* Modulo */
|
||||
{
|
||||
if (in[1]->vec[0] == 0.0f)
|
||||
out[0]->vec[0] = 0.0f;
|
||||
@@ -217,9 +217,9 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode
|
||||
static int gpu_shader_math(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
static const char *names[] = {"math_add", "math_subtract", "math_multiply",
|
||||
"math_divide", "math_sine", "math_cosine", "math_tangent", "math_asin",
|
||||
"math_acos", "math_atan", "math_pow", "math_log", "math_min", "math_max",
|
||||
"math_round", "math_less_than", "math_greater_than", "math_modulo"};
|
||||
"math_divide", "math_sine", "math_cosine", "math_tangent", "math_asin",
|
||||
"math_acos", "math_atan", "math_pow", "math_log", "math_min", "math_max",
|
||||
"math_round", "math_less_than", "math_greater_than", "math_modulo"};
|
||||
|
||||
switch (node->custom1) {
|
||||
case 0:
|
||||
@@ -268,7 +268,7 @@ void register_node_type_sh_math(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_math_in, sh_node_math_out);
|
||||
node_type_label(&ntype, node_math_label);
|
||||
node_type_storage(&ntype, "node_math", NULL, NULL);
|
||||
|
||||
@@ -65,9 +65,9 @@ static void node_shader_exec_mix_rgb(void *UNUSED(data), int UNUSED(thread), bNo
|
||||
static int gpu_shader_mix_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
static const char *names[] = {"mix_blend", "mix_add", "mix_mult", "mix_sub",
|
||||
"mix_screen", "mix_div", "mix_diff", "mix_dark", "mix_light",
|
||||
"mix_overlay", "mix_dodge", "mix_burn", "mix_hue", "mix_sat",
|
||||
"mix_val", "mix_color", "mix_soft", "mix_linear"};
|
||||
"mix_screen", "mix_div", "mix_diff", "mix_dark", "mix_light",
|
||||
"mix_overlay", "mix_dodge", "mix_burn", "mix_hue", "mix_sat",
|
||||
"mix_val", "mix_color", "mix_soft", "mix_linear"};
|
||||
|
||||
return GPU_stack_link(mat, names[node->custom1], in, out);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ void register_node_type_sh_mix_rgb(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out);
|
||||
node_type_label(&ntype, node_blend_label);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_mix_rgb);
|
||||
|
||||
@@ -69,7 +69,7 @@ void register_node_type_sh_normal(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_normal_in, sh_node_normal_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_normal);
|
||||
node_type_gpu(&ntype, gpu_shader_normal);
|
||||
|
||||
@@ -42,23 +42,23 @@ static bNodeSocketTemplate sh_node_output_in[] = {
|
||||
static void node_shader_exec_output(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **UNUSED(out))
|
||||
{
|
||||
if (data) {
|
||||
ShadeInput *shi= ((ShaderCallData *)data)->shi;
|
||||
ShadeInput *shi = ((ShaderCallData *)data)->shi;
|
||||
float col[4];
|
||||
|
||||
/* stack order input sockets: col, alpha, normal */
|
||||
nodestack_get_vec(col, SOCK_VECTOR, in[0]);
|
||||
nodestack_get_vec(col+3, SOCK_FLOAT, in[1]);
|
||||
nodestack_get_vec(col + 3, SOCK_FLOAT, in[1]);
|
||||
|
||||
if (shi->do_preview) {
|
||||
BKE_node_preview_set_pixel(execdata->preview, col, shi->xs, shi->ys, shi->do_manage);
|
||||
node->lasty= shi->ys;
|
||||
node->lasty = shi->ys;
|
||||
}
|
||||
|
||||
if (node->flag & NODE_DO_OUTPUT) {
|
||||
ShadeResult *shr= ((ShaderCallData *)data)->shr;
|
||||
ShadeResult *shr = ((ShaderCallData *)data)->shr;
|
||||
|
||||
copy_v4_v4(shr->combined, col);
|
||||
shr->alpha= col[3];
|
||||
shr->alpha = col[3];
|
||||
|
||||
// copy_v3_v3(shr->nor, in[3]->vec);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void register_node_type_sh_rgb(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_rgb_out);
|
||||
node_type_gpu(&ntype, gpu_shader_rgb);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ void register_node_type_sh_seprgb(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_seprgb_in, sh_node_seprgb_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_seprgb);
|
||||
node_type_gpu(&ntype, gpu_shader_seprgb);
|
||||
@@ -100,7 +100,7 @@ void register_node_type_sh_combrgb(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_combrgb_in, sh_node_combrgb_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_combrgb);
|
||||
node_type_gpu(&ntype, gpu_shader_combrgb);
|
||||
|
||||
@@ -50,8 +50,8 @@ static void node_shader_exec_squeeze(void *UNUSED(data), int UNUSED(thread), bNo
|
||||
float vec[3];
|
||||
|
||||
nodestack_get_vec(vec, SOCK_FLOAT, in[0]);
|
||||
nodestack_get_vec(vec+1, SOCK_FLOAT, in[1]);
|
||||
nodestack_get_vec(vec+2, SOCK_FLOAT, in[2]);
|
||||
nodestack_get_vec(vec + 1, SOCK_FLOAT, in[1]);
|
||||
nodestack_get_vec(vec + 2, SOCK_FLOAT, in[2]);
|
||||
|
||||
out[0]->vec[0] = 1.0f / (1.0f + powf(M_E, -((vec[0] - vec[2]) * vec[1])));
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *UNUSED(node), bNod
|
||||
GPUNodeLink *mtface = GPU_attribute(CD_MTFACE, "");
|
||||
|
||||
return GPU_stack_link(mat, "node_tex_coord", in, out,
|
||||
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
|
||||
GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), orco, mtface);
|
||||
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
|
||||
GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), orco, mtface);
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
|
||||
@@ -48,18 +48,18 @@ static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *no
|
||||
default_color_mapping(&tex->base.color_mapping);
|
||||
tex->color_space = SHD_COLORSPACE_COLOR;
|
||||
tex->projection = SHD_PROJ_EQUIRECTANGULAR;
|
||||
tex->iuser.frames= 1;
|
||||
tex->iuser.sfra= 1;
|
||||
tex->iuser.fie_ima= 2;
|
||||
tex->iuser.ok= 1;
|
||||
tex->iuser.frames = 1;
|
||||
tex->iuser.sfra = 1;
|
||||
tex->iuser.fie_ima = 2;
|
||||
tex->iuser.ok = 1;
|
||||
|
||||
node->storage = tex;
|
||||
}
|
||||
|
||||
static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
Image *ima= (Image*)node->id;
|
||||
ImageUser *iuser= NULL;
|
||||
Image *ima = (Image *)node->id;
|
||||
ImageUser *iuser = NULL;
|
||||
NodeTexImage *tex = node->storage;
|
||||
int isdata = tex->color_space == SHD_COLORSPACE_NONE;
|
||||
int ret;
|
||||
|
||||
@@ -48,18 +48,18 @@ static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
default_tex_mapping(&tex->base.tex_mapping);
|
||||
default_color_mapping(&tex->base.color_mapping);
|
||||
tex->color_space = SHD_COLORSPACE_COLOR;
|
||||
tex->iuser.frames= 1;
|
||||
tex->iuser.sfra= 1;
|
||||
tex->iuser.fie_ima= 2;
|
||||
tex->iuser.ok= 1;
|
||||
tex->iuser.frames = 1;
|
||||
tex->iuser.sfra = 1;
|
||||
tex->iuser.fie_ima = 2;
|
||||
tex->iuser.ok = 1;
|
||||
|
||||
node->storage = tex;
|
||||
}
|
||||
|
||||
static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
Image *ima= (Image*)node->id;
|
||||
ImageUser *iuser= NULL;
|
||||
Image *ima = (Image *)node->id;
|
||||
ImageUser *iuser = NULL;
|
||||
NodeTexImage *tex = node->storage;
|
||||
int isdata = tex->color_space == SHD_COLORSPACE_NONE;
|
||||
int ret;
|
||||
|
||||
@@ -54,7 +54,7 @@ static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
|
||||
static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
NodeTexMagic *tex = (NodeTexMagic*)node->storage;
|
||||
NodeTexMagic *tex = (NodeTexMagic *)node->storage;
|
||||
float depth = tex->depth;
|
||||
|
||||
if (!in[0].link)
|
||||
|
||||
@@ -51,9 +51,9 @@ static bNodeSocketTemplate sh_node_texture_out[] = {
|
||||
static void node_shader_exec_texture(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
|
||||
{
|
||||
if (data && node->id) {
|
||||
ShadeInput *shi= ((ShaderCallData *)data)->shi;
|
||||
ShadeInput *shi = ((ShaderCallData *)data)->shi;
|
||||
TexResult texres;
|
||||
bNodeSocket *sock_vector= node->inputs.first;
|
||||
bNodeSocket *sock_vector = node->inputs.first;
|
||||
float vec[3], nor[3] = {0.0f, 0.0f, 0.0f};
|
||||
int retval;
|
||||
short which_output = node->custom1;
|
||||
@@ -63,19 +63,19 @@ static void node_shader_exec_texture(void *data, int UNUSED(thread), bNode *node
|
||||
/* out: value, color, normal */
|
||||
|
||||
/* we should find out if a normal as output is needed, for now we do all */
|
||||
texres.nor= nor;
|
||||
texres.tr= texres.tg= texres.tb= 0.0f;
|
||||
texres.nor = nor;
|
||||
texres.tr = texres.tg = texres.tb = 0.0f;
|
||||
|
||||
/* don't use in[0]->hasinput, see material node for explanation */
|
||||
if (sock_vector->link) {
|
||||
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
|
||||
|
||||
if (in[0]->datatype==NS_OSA_VECTORS) {
|
||||
float *fp= in[0]->data;
|
||||
retval = multitex_nodes((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres, thread, which_output, NULL, NULL, NULL);
|
||||
if (in[0]->datatype == NS_OSA_VECTORS) {
|
||||
float *fp = in[0]->data;
|
||||
retval = multitex_nodes((Tex *)node->id, vec, fp, fp + 3, shi->osatex, &texres, thread, which_output, NULL, NULL, NULL);
|
||||
}
|
||||
else if (in[0]->datatype==NS_OSA_VALUES) {
|
||||
float *fp= in[0]->data;
|
||||
else if (in[0]->datatype == NS_OSA_VALUES) {
|
||||
float *fp = in[0]->data;
|
||||
float dxt[3], dyt[3];
|
||||
|
||||
dxt[0] = fp[0]; dxt[1] = dxt[2] = 0.0f;
|
||||
@@ -91,8 +91,8 @@ static void node_shader_exec_texture(void *data, int UNUSED(thread), bNode *node
|
||||
}
|
||||
|
||||
/* stupid exception */
|
||||
if ( ((Tex *)node->id)->type==TEX_STUCCI) {
|
||||
texres.tin= 0.5f + 0.7f*texres.nor[0];
|
||||
if ( ((Tex *)node->id)->type == TEX_STUCCI) {
|
||||
texres.tin = 0.5f + 0.7f * texres.nor[0];
|
||||
CLAMP(texres.tin, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ static void node_shader_exec_texture(void *data, int UNUSED(thread), bNode *node
|
||||
|
||||
static int gpu_shader_texture(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
Tex *tex = (Tex*)node->id;
|
||||
Tex *tex = (Tex *)node->id;
|
||||
|
||||
if (tex && tex->type == TEX_IMAGE && tex->ima) {
|
||||
GPUNodeLink *texlink = GPU_image(tex->ima, &tex->iuser, FALSE);
|
||||
@@ -130,7 +130,7 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, bNodeExecData *UNUS
|
||||
|
||||
if (ret) {
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(tex->ima, &tex->iuser, NULL);
|
||||
if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) ==0 &&
|
||||
if (ibuf && (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) == 0 &&
|
||||
GPU_material_do_color_management(mat))
|
||||
{
|
||||
GPU_link(mat, "srgb_to_linearrgb", out[1].link, &out[1].link);
|
||||
@@ -148,7 +148,7 @@ void register_node_type_sh_texture(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
|
||||
sh_node_type_base(&ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS | NODE_PREVIEW);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_texture_in, sh_node_texture_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_texture);
|
||||
|
||||
@@ -59,7 +59,7 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), int UNUSED(thread), bN
|
||||
|
||||
static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= add_colorband(true);
|
||||
node->storage = add_colorband(true);
|
||||
}
|
||||
|
||||
static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
@@ -76,7 +76,7 @@ void register_node_type_sh_valtorgb(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_valtorgb_in, sh_node_valtorgb_out);
|
||||
node_type_init(&ntype, node_shader_init_valtorgb);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
|
||||
@@ -90,12 +90,12 @@ void register_node_type_sh_valtorgb(void)
|
||||
|
||||
/* **************** RGBTOBW ******************** */
|
||||
static bNodeSocketTemplate sh_node_rgbtobw_in[] = {
|
||||
{ SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
{ SOCK_RGBA, 1, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
static bNodeSocketTemplate sh_node_rgbtobw_out[] = {
|
||||
{ SOCK_FLOAT, 0, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
{ SOCK_FLOAT, 0, N_("Val"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ void register_node_type_sh_rgbtobw(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_rgbtobw);
|
||||
node_type_gpu(&ntype, gpu_shader_rgbtobw);
|
||||
|
||||
@@ -49,7 +49,7 @@ void register_node_type_sh_value(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_value_out);
|
||||
node_type_gpu(&ntype, gpu_shader_value);
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ static void node_shader_exec_vect_math(void *UNUSED(data), int UNUSED(thread), b
|
||||
out[0]->vec[1] = vec1[1] + vec2[1];
|
||||
out[0]->vec[2] = vec1[2] + vec2[2];
|
||||
|
||||
out[1]->vec[0] = normalize_v3(out[0]->vec );
|
||||
out[1]->vec[0] = normalize_v3(out[0]->vec);
|
||||
}
|
||||
else if (node->custom1 == 3) { /* Dot product */
|
||||
out[1]->vec[0] = (vec1[0] * vec2[0]) + (vec1[1] * vec2[1]) + (vec1[2] * vec2[2]);
|
||||
@@ -83,7 +83,7 @@ static void node_shader_exec_vect_math(void *UNUSED(data), int UNUSED(thread), b
|
||||
out[0]->vec[1] = (vec1[2] * vec2[0]) - (vec1[0] * vec2[2]);
|
||||
out[0]->vec[2] = (vec1[0] * vec2[1]) - (vec1[1] * vec2[0]);
|
||||
|
||||
out[1]->vec[0] = normalize_v3(out[0]->vec );
|
||||
out[1]->vec[0] = normalize_v3(out[0]->vec);
|
||||
}
|
||||
else if (node->custom1 == 5) { /* Normalize */
|
||||
if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
|
||||
@@ -97,7 +97,7 @@ static void node_shader_exec_vect_math(void *UNUSED(data), int UNUSED(thread), b
|
||||
out[0]->vec[2] = vec2[2];
|
||||
}
|
||||
|
||||
out[1]->vec[0] = normalize_v3(out[0]->vec );
|
||||
out[1]->vec[0] = normalize_v3(out[0]->vec);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -144,7 +144,7 @@ void register_node_type_sh_vect_math(void)
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
|
||||
node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_vect_math_in, sh_node_vect_math_out);
|
||||
node_type_label(&ntype, node_vect_math_label);
|
||||
node_type_storage(&ntype, "node_vect_math", NULL, NULL);
|
||||
|
||||
@@ -47,7 +47,7 @@ static bNodeSocketTemplate inputs[] = {
|
||||
};
|
||||
static bNodeSocketTemplate outputs[] = {
|
||||
{ SOCK_RGBA, 0, N_("Color")},
|
||||
{ -1, 0, "" }
|
||||
{ -1, 0, ""}
|
||||
};
|
||||
|
||||
static void init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
@@ -91,15 +91,15 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
|
||||
|
||||
rownum = (int)floor(y / row_height);
|
||||
|
||||
if ( node->custom1 && node->custom2 ) {
|
||||
brick_width *= ((int)(rownum) % node->custom2 ) ? 1.0f : node->custom4; /* squash */
|
||||
offset = ((int)(rownum) % node->custom1 ) ? 0 : (brick_width*node->custom3); /* offset */
|
||||
if (node->custom1 && node->custom2) {
|
||||
brick_width *= ((int)(rownum) % node->custom2) ? 1.0f : node->custom4; /* squash */
|
||||
offset = ((int)(rownum) % node->custom1) ? 0 : (brick_width * node->custom3); /* offset */
|
||||
}
|
||||
|
||||
bricknum = (int)floor((x+offset) / brick_width);
|
||||
bricknum = (int)floor((x + offset) / brick_width);
|
||||
|
||||
ins_x = (x+offset) - brick_width*bricknum;
|
||||
ins_y = y - row_height*rownum;
|
||||
ins_x = (x + offset) - brick_width * bricknum;
|
||||
ins_y = y - row_height * rownum;
|
||||
|
||||
tint = noise((rownum << 16) + (bricknum & 0xFFFF)) + bias;
|
||||
CLAMP(tint, 0.0f, 1.0f);
|
||||
@@ -125,7 +125,7 @@ void register_node_type_tex_bricks(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
tex_node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS);
|
||||
tex_node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, inputs, outputs);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, init);
|
||||
|
||||
@@ -74,7 +74,7 @@ void register_node_type_tex_checker(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
tex_node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS);
|
||||
tex_node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, inputs, outputs);
|
||||
node_type_exec(&ntype, NULL, NULL, exec);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ static void copy_stack(bNodeStack *to, bNodeStack *from)
|
||||
|
||||
static void *group_initexec(bNodeExecContext *context, bNode *node, bNodeInstanceKey key)
|
||||
{
|
||||
bNodeTree *ngroup= (bNodeTree*)node->id;
|
||||
bNodeTree *ngroup = (bNodeTree *)node->id;
|
||||
void *exec;
|
||||
|
||||
if (!ngroup)
|
||||
@@ -74,7 +74,7 @@ static void *group_initexec(bNodeExecContext *context, bNode *node, bNodeInstanc
|
||||
|
||||
static void group_freeexec(bNode *UNUSED(node), void *nodedata)
|
||||
{
|
||||
bNodeTreeExec*gexec= (bNodeTreeExec*)nodedata;
|
||||
bNodeTreeExec *gexec = (bNodeTreeExec *)nodedata;
|
||||
|
||||
ntreeTexEndExecTree_internal(gexec);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ static void group_freeexec(bNode *UNUSED(node), void *nodedata)
|
||||
*/
|
||||
static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree*)gnode->id;
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
@@ -105,7 +105,7 @@ static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack)
|
||||
*/
|
||||
static void group_copy_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree*)gnode->id;
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
@@ -118,14 +118,14 @@ static void group_copy_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstac
|
||||
if (ns)
|
||||
copy_stack(out[a], ns);
|
||||
}
|
||||
break; /* only one active output node */
|
||||
break; /* only one active output node */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void group_execute(void *data, int thread, struct bNode *node, bNodeExecData *execdata, struct bNodeStack **in, struct bNodeStack **out)
|
||||
{
|
||||
bNodeTreeExec *exec= execdata->data;
|
||||
bNodeTreeExec *exec = execdata->data;
|
||||
bNodeThreadStack *nts;
|
||||
|
||||
if (!exec)
|
||||
@@ -136,7 +136,7 @@ static void group_execute(void *data, int thread, struct bNode *node, bNodeExecD
|
||||
*/
|
||||
{
|
||||
bNode *inode;
|
||||
for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
|
||||
for (inode = exec->nodetree->nodes.first; inode; inode = inode->next)
|
||||
inode->need_exec = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ static bNodeSocketTemplate time_outputs[] = {
|
||||
static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread))
|
||||
{
|
||||
/* stack order output: fac */
|
||||
float fac= 0.0f;
|
||||
float fac = 0.0f;
|
||||
|
||||
if (node->custom1 < node->custom2)
|
||||
fac = (p->cfra - node->custom1)/(float)(node->custom2-node->custom1);
|
||||
fac = (p->cfra - node->custom1) / (float)(node->custom2 - node->custom1);
|
||||
|
||||
curvemapping_initialize(node->storage);
|
||||
fac = curvemapping_evaluateF(node->storage, 0, fac);
|
||||
@@ -62,9 +62,9 @@ static void time_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData
|
||||
|
||||
static void time_init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1= 1;
|
||||
node->custom2= 250;
|
||||
node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
node->custom1 = 1;
|
||||
node->custom2 = 250;
|
||||
node->storage = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void register_node_type_tex_curve_time(void)
|
||||
@@ -89,7 +89,7 @@ static bNodeSocketTemplate rgb_inputs[] = {
|
||||
|
||||
static bNodeSocketTemplate rgb_outputs[] = {
|
||||
{ SOCK_RGBA, 0, N_("Color")},
|
||||
{ -1, 0, "" }
|
||||
{ -1, 0, ""}
|
||||
};
|
||||
|
||||
static void rgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
|
||||
@@ -108,7 +108,7 @@ static void rgb_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData
|
||||
|
||||
static void rgb_init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
node->storage = curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void register_node_type_tex_curve_rgb(void)
|
||||
|
||||
@@ -50,20 +50,20 @@ static bNodeSocketTemplate outputs[] = {
|
||||
static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac)
|
||||
{
|
||||
if (fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) {
|
||||
float col[3], hsv[3], mfac= 1.0f - fac;
|
||||
float col[3], hsv[3], mfac = 1.0f - fac;
|
||||
|
||||
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
|
||||
hsv[0]+= (hue - 0.5f);
|
||||
if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
|
||||
hsv[1]*= sat;
|
||||
if (hsv[1]>1.0f) hsv[1] = 1.0f; else if (hsv[1]<0.0f) hsv[1] = 0.0f;
|
||||
hsv[2]*= val;
|
||||
if (hsv[2]>1.0f) hsv[2] = 1.0f; else if (hsv[2]<0.0f) hsv[2] = 0.0f;
|
||||
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
|
||||
|
||||
out[0] = mfac*in[0] + fac*col[0];
|
||||
out[1] = mfac*in[1] + fac*col[1];
|
||||
out[2] = mfac*in[2] + fac*col[2];
|
||||
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv + 1, hsv + 2);
|
||||
hsv[0] += (hue - 0.5f);
|
||||
if (hsv[0] > 1.0f) hsv[0] -= 1.0f; else if (hsv[0] < 0.0f) hsv[0] += 1.0f;
|
||||
hsv[1] *= sat;
|
||||
if (hsv[1] > 1.0f) hsv[1] = 1.0f; else if (hsv[1] < 0.0f) hsv[1] = 0.0f;
|
||||
hsv[2] *= val;
|
||||
if (hsv[2] > 1.0f) hsv[2] = 1.0f; else if (hsv[2] < 0.0f) hsv[2] = 0.0f;
|
||||
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col + 1, col + 2);
|
||||
|
||||
out[0] = mfac * in[0] + fac * col[0];
|
||||
out[1] = mfac * in[1] + fac * col[1];
|
||||
out[2] = mfac * in[2] + fac * col[2];
|
||||
}
|
||||
else {
|
||||
copy_v4_v4(out, in);
|
||||
|
||||
@@ -42,12 +42,12 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
|
||||
{
|
||||
float x = p->co[0];
|
||||
float y = p->co[1];
|
||||
Image *ima= (Image *)node->id;
|
||||
ImageUser *iuser= (ImageUser *)node->storage;
|
||||
Image *ima = (Image *)node->id;
|
||||
ImageUser *iuser = (ImageUser *)node->storage;
|
||||
|
||||
if ( ima ) {
|
||||
if (ima) {
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
|
||||
if ( ibuf ) {
|
||||
if (ibuf) {
|
||||
float xsize, ysize;
|
||||
float xoff, yoff;
|
||||
int px, py;
|
||||
@@ -58,24 +58,24 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
|
||||
ysize = ibuf->y / 2;
|
||||
xoff = yoff = -1;
|
||||
|
||||
px = (int)( (x-xoff) * xsize );
|
||||
py = (int)( (y-yoff) * ysize );
|
||||
px = (int)( (x - xoff) * xsize);
|
||||
py = (int)( (y - yoff) * ysize);
|
||||
|
||||
if ( (!xsize) || (!ysize) ) return;
|
||||
|
||||
if ( !ibuf->rect_float ) {
|
||||
if (!ibuf->rect_float) {
|
||||
BLI_lock_thread(LOCK_IMAGE);
|
||||
if ( !ibuf->rect_float )
|
||||
if (!ibuf->rect_float)
|
||||
IMB_float_from_rect(ibuf);
|
||||
BLI_unlock_thread(LOCK_IMAGE);
|
||||
}
|
||||
|
||||
while ( px < 0 ) px += ibuf->x;
|
||||
while ( py < 0 ) py += ibuf->y;
|
||||
while ( px >= ibuf->x ) px -= ibuf->x;
|
||||
while ( py >= ibuf->y ) py -= ibuf->y;
|
||||
while (px < 0) px += ibuf->x;
|
||||
while (py < 0) py += ibuf->y;
|
||||
while (px >= ibuf->x) px -= ibuf->x;
|
||||
while (py >= ibuf->y) py -= ibuf->y;
|
||||
|
||||
result = ibuf->rect_float + py*ibuf->x*4 + px*4;
|
||||
result = ibuf->rect_float + py * ibuf->x * 4 + px * 4;
|
||||
copy_v4_v4(out, result);
|
||||
|
||||
BKE_image_release_ibuf(ima, ibuf, NULL);
|
||||
@@ -90,18 +90,18 @@ static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *exe
|
||||
|
||||
static void init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage= iuser;
|
||||
iuser->sfra= 1;
|
||||
iuser->fie_ima= 2;
|
||||
iuser->ok= 1;
|
||||
ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage = iuser;
|
||||
iuser->sfra = 1;
|
||||
iuser->fie_ima = 2;
|
||||
iuser->ok = 1;
|
||||
}
|
||||
|
||||
void register_node_type_tex_image(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
tex_node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
|
||||
tex_node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, NULL, outputs);
|
||||
node_type_init(&ntype, init);
|
||||
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
static bNodeSocketTemplate inputs[] = {
|
||||
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION},
|
||||
{ -1, 0, "" }
|
||||
{ -1, 0, ""}
|
||||
};
|
||||
|
||||
/* applies to render pipeline */
|
||||
@@ -88,10 +88,10 @@ static void unique_name(bNode *node)
|
||||
|
||||
i = node;
|
||||
while (i->prev) i = i->prev;
|
||||
for ( ; i; i = i->next) {
|
||||
for (; i; i = i->next) {
|
||||
if (i == node ||
|
||||
i->type != TEX_NODE_OUTPUT ||
|
||||
strcmp(name, ((TexNodeOutput*)(i->storage))->name))
|
||||
!STREQ(name, ((TexNodeOutput *)(i->storage))->name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -130,11 +130,11 @@ static void assign_index(struct bNode *node)
|
||||
while (tnode->prev)
|
||||
tnode = tnode->prev;
|
||||
|
||||
check_index:
|
||||
for (; tnode; tnode= tnode->next)
|
||||
check_index:
|
||||
for (; tnode; tnode = tnode->next)
|
||||
if (tnode->type == TEX_NODE_OUTPUT && tnode != node)
|
||||
if (tnode->custom1 == index) {
|
||||
index ++;
|
||||
index++;
|
||||
goto check_index;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ static void assign_index(struct bNode *node)
|
||||
static void init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
TexNodeOutput *tno = MEM_callocN(sizeof(TexNodeOutput), "TEX_output");
|
||||
node->storage= tno;
|
||||
node->storage = tno;
|
||||
|
||||
strcpy(tno->name, "Default");
|
||||
unique_name(node);
|
||||
@@ -162,7 +162,7 @@ void register_node_type_tex_output(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
tex_node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS);
|
||||
tex_node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, inputs, NULL);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, init);
|
||||
|
||||
@@ -94,7 +94,7 @@ static void texfn(
|
||||
MapFn map_inputs,
|
||||
short thread)
|
||||
{
|
||||
Tex tex = *((Tex*)(node->storage));
|
||||
Tex tex = *((Tex *)(node->storage));
|
||||
float col1[4], col2[4];
|
||||
tex_input_rgba(col1, in[0], p, thread);
|
||||
tex_input_rgba(col2, in[1], p, thread);
|
||||
@@ -108,7 +108,7 @@ static int count_outputs(bNode *node)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
int num = 0;
|
||||
for (sock= node->outputs.first; sock; sock= sock->next) {
|
||||
for (sock = node->outputs.first; sock; sock = sock->next) {
|
||||
num++;
|
||||
}
|
||||
return num;
|
||||
@@ -121,20 +121,20 @@ static int count_outputs(bNode *node)
|
||||
{}
|
||||
|
||||
#define ProcDef(name) \
|
||||
static void name##_colorfn(float *result, TexParams *p, bNode *node, bNodeStack **in, short thread) \
|
||||
{ \
|
||||
texfn(result, p, node, in, 0, &name##_map_inputs, thread); \
|
||||
} \
|
||||
static void name##_normalfn(float *result, TexParams *p, bNode *node, bNodeStack **in, short thread) \
|
||||
{ \
|
||||
texfn(result, p, node, in, 1, &name##_map_inputs, thread); \
|
||||
} \
|
||||
static void name##_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) \
|
||||
{ \
|
||||
int outs = count_outputs(node); \
|
||||
if (outs >= 1) tex_output(node, execdata, in, out[0], &name##_colorfn, data); \
|
||||
if (outs >= 2) tex_output(node, execdata, in, out[1], &name##_normalfn, data); \
|
||||
}
|
||||
static void name##_colorfn(float *result, TexParams *p, bNode *node, bNodeStack **in, short thread) \
|
||||
{ \
|
||||
texfn(result, p, node, in, 0, &name##_map_inputs, thread); \
|
||||
} \
|
||||
static void name##_normalfn(float *result, TexParams *p, bNode *node, bNodeStack **in, short thread) \
|
||||
{ \
|
||||
texfn(result, p, node, in, 1, &name##_map_inputs, thread); \
|
||||
} \
|
||||
static void name##_exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out) \
|
||||
{ \
|
||||
int outs = count_outputs(node); \
|
||||
if (outs >= 1) tex_output(node, execdata, in, out[0], &name##_colorfn, data); \
|
||||
if (outs >= 2) tex_output(node, execdata, in, out[1], &name##_normalfn, data); \
|
||||
}
|
||||
|
||||
|
||||
/* --- VORONOI -- */
|
||||
@@ -152,13 +152,13 @@ static bNodeSocketTemplate voronoi_inputs[] = {
|
||||
};
|
||||
static void voronoi_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
|
||||
{
|
||||
tex->vn_w1 = tex_input_value(in[I+0], p, thread);
|
||||
tex->vn_w2 = tex_input_value(in[I+1], p, thread);
|
||||
tex->vn_w3 = tex_input_value(in[I+2], p, thread);
|
||||
tex->vn_w4 = tex_input_value(in[I+3], p, thread);
|
||||
tex->vn_w1 = tex_input_value(in[I + 0], p, thread);
|
||||
tex->vn_w2 = tex_input_value(in[I + 1], p, thread);
|
||||
tex->vn_w3 = tex_input_value(in[I + 2], p, thread);
|
||||
tex->vn_w4 = tex_input_value(in[I + 3], p, thread);
|
||||
|
||||
tex->ns_outscale = tex_input_value(in[I+4], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I+5], p, thread);
|
||||
tex->ns_outscale = tex_input_value(in[I + 4], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I + 5], p, thread);
|
||||
}
|
||||
ProcDef(voronoi)
|
||||
|
||||
@@ -178,7 +178,7 @@ static bNodeSocketTemplate magic_inputs[] = {
|
||||
};
|
||||
static void magic_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
|
||||
{
|
||||
tex->turbul = tex_input_value(in[I+0], p, thread);
|
||||
tex->turbul = tex_input_value(in[I + 0], p, thread);
|
||||
}
|
||||
ProcDef(magic)
|
||||
|
||||
@@ -191,8 +191,8 @@ static bNodeSocketTemplate marble_inputs[] = {
|
||||
};
|
||||
static void marble_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
|
||||
{
|
||||
tex->noisesize = tex_input_value(in[I+0], p, thread);
|
||||
tex->turbul = tex_input_value(in[I+1], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I + 0], p, thread);
|
||||
tex->turbul = tex_input_value(in[I + 1], p, thread);
|
||||
}
|
||||
ProcDef(marble)
|
||||
|
||||
@@ -204,7 +204,7 @@ static bNodeSocketTemplate clouds_inputs[] = {
|
||||
};
|
||||
static void clouds_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
|
||||
{
|
||||
tex->noisesize = tex_input_value(in[I+0], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I + 0], p, thread);
|
||||
}
|
||||
ProcDef(clouds)
|
||||
|
||||
@@ -217,8 +217,8 @@ static bNodeSocketTemplate distnoise_inputs[] = {
|
||||
};
|
||||
static void distnoise_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
|
||||
{
|
||||
tex->noisesize = tex_input_value(in[I+0], p, thread);
|
||||
tex->dist_amount = tex_input_value(in[I+1], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I + 0], p, thread);
|
||||
tex->dist_amount = tex_input_value(in[I + 1], p, thread);
|
||||
}
|
||||
ProcDef(distnoise)
|
||||
|
||||
@@ -231,8 +231,8 @@ static bNodeSocketTemplate wood_inputs[] = {
|
||||
};
|
||||
static void wood_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
|
||||
{
|
||||
tex->noisesize = tex_input_value(in[I+0], p, thread);
|
||||
tex->turbul = tex_input_value(in[I+1], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I + 0], p, thread);
|
||||
tex->turbul = tex_input_value(in[I + 1], p, thread);
|
||||
}
|
||||
ProcDef(wood)
|
||||
|
||||
@@ -249,11 +249,11 @@ static bNodeSocketTemplate musgrave_inputs[] = {
|
||||
};
|
||||
static void musgrave_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
|
||||
{
|
||||
tex->mg_H = tex_input_value(in[I+0], p, thread);
|
||||
tex->mg_lacunarity = tex_input_value(in[I+1], p, thread);
|
||||
tex->mg_octaves = tex_input_value(in[I+2], p, thread);
|
||||
tex->ns_outscale = tex_input_value(in[I+3], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I+4], p, thread);
|
||||
tex->mg_H = tex_input_value(in[I + 0], p, thread);
|
||||
tex->mg_lacunarity = tex_input_value(in[I + 1], p, thread);
|
||||
tex->mg_octaves = tex_input_value(in[I + 2], p, thread);
|
||||
tex->ns_outscale = tex_input_value(in[I + 3], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I + 4], p, thread);
|
||||
}
|
||||
ProcDef(musgrave)
|
||||
|
||||
@@ -274,8 +274,8 @@ static bNodeSocketTemplate stucci_inputs[] = {
|
||||
};
|
||||
static void stucci_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread)
|
||||
{
|
||||
tex->noisesize = tex_input_value(in[I+0], p, thread);
|
||||
tex->turbul = tex_input_value(in[I+1], p, thread);
|
||||
tex->noisesize = tex_input_value(in[I + 0], p, thread);
|
||||
tex->turbul = tex_input_value(in[I + 1], p, thread);
|
||||
}
|
||||
ProcDef(stucci)
|
||||
|
||||
@@ -284,7 +284,7 @@ ProcDef(stucci)
|
||||
static void init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
Tex *tex = MEM_callocN(sizeof(Tex), "Tex");
|
||||
node->storage= tex;
|
||||
node->storage = tex;
|
||||
|
||||
default_tex(tex);
|
||||
tex->type = node->type - TEX_NODE_PROC;
|
||||
|
||||
@@ -53,13 +53,13 @@ static void rotate(float new_co[3], float a, float ax[3], const float co[3])
|
||||
float perp[3];
|
||||
float cp[3];
|
||||
|
||||
float cos_a = cos(a * (float)(2*M_PI));
|
||||
float sin_a = sin(a * (float)(2*M_PI));
|
||||
float cos_a = cosf(a * (float)(2 * M_PI));
|
||||
float sin_a = sinf(a * (float)(2 * M_PI));
|
||||
|
||||
// x' = xcosa + n(n.x)(1-cosa) + (x*n)sina
|
||||
|
||||
mul_v3_v3fl(perp, co, cos_a);
|
||||
mul_v3_v3fl(para, ax, dot_v3v3(co, ax)*(1 - cos_a));
|
||||
mul_v3_v3fl(para, ax, dot_v3v3(co, ax) * (1 - cos_a));
|
||||
|
||||
cross_v3_v3v3(cp, ax, co);
|
||||
mul_v3_fl(cp, sin_a);
|
||||
@@ -73,7 +73,7 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **
|
||||
{
|
||||
float new_co[3], new_dxt[3], new_dyt[3], a, ax[3];
|
||||
|
||||
a= tex_input_value(in[1], p, thread);
|
||||
a = tex_input_value(in[1], p, thread);
|
||||
tex_input_vec(ax, in[2], p, thread);
|
||||
|
||||
rotate(new_co, a, ax, p->co);
|
||||
|
||||
@@ -63,7 +63,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
|
||||
zero_v3(dyt);
|
||||
}
|
||||
|
||||
if (node->custom2 || node->need_exec==0) {
|
||||
if (node->custom2 || node->need_exec == 0) {
|
||||
/* this node refers to its own texture tree! */
|
||||
copy_v4_v4(out, (fabsf(co[0] - co[1]) < 0.01f) ? white : red);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
|
||||
|
||||
texres.nor = nor;
|
||||
textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex,
|
||||
&texres, thread, 0, p->shi, p->mtex, NULL);
|
||||
&texres, thread, 0, p->shi, p->mtex, NULL);
|
||||
|
||||
if (textype & TEX_RGB) {
|
||||
copy_v4_v4(out, &texres.tr);
|
||||
@@ -99,7 +99,7 @@ void register_node_type_tex_texture(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
tex_node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
|
||||
tex_node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW | NODE_OPTIONS);
|
||||
node_type_socket_templates(&ntype, inputs, outputs);
|
||||
node_type_exec(&ntype, NULL, NULL, exec);
|
||||
|
||||
|
||||
@@ -71,9 +71,9 @@ static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack *
|
||||
new_co[2] = co[2] + nabla;
|
||||
nor[2] = tex_input_value(in[0], &np, thread);
|
||||
|
||||
out[0] = val-nor[0];
|
||||
out[1] = val-nor[1];
|
||||
out[2] = val-nor[2];
|
||||
out[0] = val - nor[0];
|
||||
out[1] = val - nor[1];
|
||||
out[2] = val - nor[2];
|
||||
}
|
||||
static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user