Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_tex_sky.c
| Show All 38 Lines | static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| BKE_texture_colormapping_default(&tex->base.color_mapping); | BKE_texture_colormapping_default(&tex->base.color_mapping); | ||||
| tex->sun_direction[0] = 0.0f; | tex->sun_direction[0] = 0.0f; | ||||
| tex->sun_direction[1] = 0.0f; | tex->sun_direction[1] = 0.0f; | ||||
| tex->sun_direction[2] = 1.0f; | tex->sun_direction[2] = 1.0f; | ||||
| tex->turbidity = 2.2f; | tex->turbidity = 2.2f; | ||||
| tex->ground_albedo = 0.3f; | tex->ground_albedo = 0.3f; | ||||
| tex->sun_disc = true; | tex->sun_disc = true; | ||||
| tex->sun_size = DEG2RADF(0.545); | tex->sun_size = DEG2RADF(0.545); | ||||
| tex->sun_intensity = 1.0f; | |||||
| tex->sun_elevation = M_PI_2; | tex->sun_elevation = M_PI_2; | ||||
| tex->sun_rotation = 0.0f; | tex->sun_rotation = 0.0f; | ||||
| tex->altitude = 0; | tex->altitude = 0.0f; | ||||
| tex->air_density = 1.0f; | tex->air_density = 1.0f; | ||||
| tex->dust_density = 1.0f; | tex->dust_density = 1.0f; | ||||
| tex->ozone_density = 1.0f; | tex->ozone_density = 1.0f; | ||||
| tex->sky_model = SHD_SKY_NISHITA; | tex->sky_model = SHD_SKY_NISHITA; | ||||
| node->storage = tex; | node->storage = tex; | ||||
| } | } | ||||
| typedef struct SkyModelPreetham { | typedef struct SkyModelPreetham { | ||||
| ▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | return GPU_stack_link(mat, | ||||
| GPU_uniform(xyz_to_rgb.g), | GPU_uniform(xyz_to_rgb.g), | ||||
| GPU_uniform(xyz_to_rgb.b)); | GPU_uniform(xyz_to_rgb.b)); | ||||
| } | } | ||||
| else { | else { | ||||
| return GPU_stack_link(mat, node, "node_tex_sky_nishita", in, out); | return GPU_stack_link(mat, node, "node_tex_sky_nishita", in, out); | ||||
| } | } | ||||
| } | } | ||||
| 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 */ | /* node type definition */ | ||||
| void register_node_type_sh_tex_sky(void) | void register_node_type_sh_tex_sky(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, 0); | sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, 0); | ||||
| node_type_socket_templates(&ntype, sh_node_tex_sky_in, sh_node_tex_sky_out); | node_type_socket_templates(&ntype, sh_node_tex_sky_in, sh_node_tex_sky_out); | ||||
| node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | ||||
| node_type_init(&ntype, node_shader_init_tex_sky); | node_type_init(&ntype, node_shader_init_tex_sky); | ||||
| node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage); | node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage); | ||||
| node_type_gpu(&ntype, node_shader_gpu_tex_sky); | node_type_gpu(&ntype, node_shader_gpu_tex_sky); | ||||
| /* remove Vector input for Nishita */ | |||||
| node_type_update(&ntype, node_shader_update_sky); | |||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||