Eevee : Fix bug with SSS and SSR active node selection

The bug was affecting the ability to correctly edit the expected SSS profile.
This commit is contained in:
Clément Foucault 2017-11-18 22:14:53 +01:00
parent a96134d794
commit 4de142e0b7
4 changed files with 11 additions and 11 deletions

@ -763,7 +763,7 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_create(
bool is_hair, bool is_flat_normal, bool use_blend, bool use_ssr, int shadow_method)
{
static int ssr_id;
ssr_id = (use_ssr) ? 0 : -1;
ssr_id = (use_ssr) ? 1 : -1;
int options = VAR_MAT_MESH;
if (is_hair) options |= VAR_MAT_HAIR;
@ -791,7 +791,7 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_get(
bool is_hair, bool is_flat_normal, bool use_ssr, int shadow_method)
{
static int ssr_id;
ssr_id = (use_ssr) ? 0 : -1;
ssr_id = (use_ssr) ? 1 : -1;
int options = VAR_MAT_MESH;
if (is_hair) options |= VAR_MAT_HAIR;

@ -439,7 +439,7 @@ static void ntree_shader_link_builtin_normal(bNodeTree *ntree,
static void ntree_shader_relink_displacement(bNodeTree *ntree,
short compatibility)
{
if (compatibility != NODE_NEW_SHADING) {
if ((compatibility & NODE_NEW_SHADING) == 0) {
/* We can only deal with new shading system here. */
return;
}
@ -511,7 +511,7 @@ static bool ntree_tag_ssr_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *
*/
static void ntree_shader_tag_ssr_node(bNodeTree *ntree, short compatibility)
{
if (compatibility & NODE_NEWER_SHADING) {
if ((compatibility & NODE_NEWER_SHADING) == 0) {
/* We can only deal with new shading system here. */
return;
}
@ -523,8 +523,8 @@ static void ntree_shader_tag_ssr_node(bNodeTree *ntree, short compatibility)
/* Make sure sockets links pointers are correct. */
ntreeUpdateTree(G.main, ntree);
int lobe_count = 0;
nodeChainIter(ntree, output_node, ntree_tag_ssr_bsdf_cb, &lobe_count, true);
float lobe_id = 1;
nodeChainIter(ntree, output_node, ntree_tag_ssr_bsdf_cb, &lobe_id, true);
}
static bool ntree_tag_sss_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *userdata, const bool UNUSED(reversed))
@ -546,7 +546,7 @@ static bool ntree_tag_sss_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *
*/
static void ntree_shader_tag_sss_node(bNodeTree *ntree, short compatibility)
{
if (compatibility & NODE_NEWER_SHADING) {
if ((compatibility & NODE_NEWER_SHADING) == 0) {
/* We can only deal with new shading system here. */
return;
}
@ -558,8 +558,8 @@ static void ntree_shader_tag_sss_node(bNodeTree *ntree, short compatibility)
/* Make sure sockets links pointers are correct. */
ntreeUpdateTree(G.main, ntree);
int sss_count = 0;
nodeChainIter(ntree, output_node, ntree_tag_sss_bsdf_cb, &sss_count, true);
float sss_id = 1;
nodeChainIter(ntree, output_node, ntree_tag_sss_bsdf_cb, &sss_id, true);
}
/* EEVEE: Find which material domain are used (volume, surface ...).

@ -99,7 +99,7 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeE
}
/* SSS Profile */
if (node->sss_id == 0) {
if (node->sss_id == 1) {
static short profile = SHD_SUBSURFACE_BURLEY;
bNodeSocket *socket = BLI_findlink(&node->original->inputs, 2);
bNodeSocketValueRGBA *socket_data = socket->default_value;

@ -54,7 +54,7 @@ static int node_shader_gpu_subsurface_scattering(GPUMaterial *mat, bNode *node,
if (!in[5].link)
GPU_link(mat, "world_normals_get", &in[5].link);
if (node->sss_id == 0) {
if (node->sss_id == 1) {
bNodeSocket *socket = BLI_findlink(&node->original->inputs, 2);
bNodeSocketValueRGBA *socket_data = socket->default_value;
bNodeSocket *socket_sharp = BLI_findlink(&node->original->inputs, 3);