diff options
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_tex_sky.c')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_tex_sky.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c index 70f3f80eb4b..d2c4413b862 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c @@ -44,9 +44,10 @@ static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node) tex->ground_albedo = 0.3f; tex->sun_disc = true; tex->sun_size = DEG2RADF(0.545); + tex->sun_intensity = 1.0f; tex->sun_elevation = M_PI_2; tex->sun_rotation = 0.0f; - tex->altitude = 0; + tex->altitude = 0.0f; tex->air_density = 1.0f; tex->dust_density = 1.0f; tex->ozone_density = 1.0f; @@ -64,7 +65,7 @@ typedef struct XYZ_to_RGB /* transposed imbuf_xyz_to_rgb, passed as 3x vec3 */ float r[3], g[3], b[3]; } XYZ_to_RGB; -static float sky_perez_function(float *lam, float theta, float gamma) +static float sky_perez_function(const float *lam, float theta, float gamma) { float ctheta = cosf(theta); float cgamma = cosf(gamma); @@ -73,7 +74,7 @@ static float sky_perez_function(float *lam, float theta, float gamma) (1.0 + lam[2] * expf(lam[3] * gamma) + lam[4] * cgamma * cgamma); } -static void sky_precompute_old(SkyModelPreetham *sunsky, float sun_angles[], float turbidity) +static void sky_precompute_old(SkyModelPreetham *sunsky, const float sun_angles[], float turbidity) { float theta = sun_angles[0]; float theta2 = theta * theta; @@ -214,6 +215,14 @@ static int node_shader_gpu_tex_sky(GPUMaterial *mat, } } +static void node_shader_update_sky(bNodeTree *UNUSED(ntree), bNode *node) +{ + bNodeSocket *sockVector = nodeFindSocket(node, SOCK_IN, "Vector"); + + NodeTexSky *tex = (NodeTexSky *)node->storage; + nodeSetSocketAvailability(sockVector, !(tex->sky_model == 2 && tex->sun_disc == 1)); +} + /* node type definition */ void register_node_type_sh_tex_sky(void) { @@ -225,6 +234,8 @@ void register_node_type_sh_tex_sky(void) node_type_init(&ntype, node_shader_init_tex_sky); node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage); node_type_gpu(&ntype, node_shader_gpu_tex_sky); + /* remove Vector input for Nishita */ + node_type_update(&ntype, node_shader_update_sky); nodeRegisterType(&ntype); } |