Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/light.cpp
| Show First 20 Lines • Show All 619 Lines • ▼ Show 20 Lines | if (node->type == SkyTextureNode::node_type) { | ||||
| if ((vec_src->type != TextureCoordinateNode::node_type) || | if ((vec_src->type != TextureCoordinateNode::node_type) || | ||||
| (vec_in->link != vec_src->output("Generated"))) { | (vec_in->link != vec_src->output("Generated"))) { | ||||
| environment_res.x = max(environment_res.x, 4096); | environment_res.x = max(environment_res.x, 4096); | ||||
| environment_res.y = max(environment_res.y, 2048); | environment_res.y = max(environment_res.y, 2048); | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| /* Determine sun direction from lat/long and texture mapping. */ | |||||
| float latitude = sky->sun_elevation; | float latitude = sky->sun_elevation; | ||||
| float longitude = M_2PI_F - sky->sun_rotation + M_PI_2_F; | float longitude = M_2PI_F - sky->sun_rotation + M_PI_2_F; | ||||
| float3 sun_direction = make_float3( | |||||
| cosf(latitude) * cosf(longitude), cosf(latitude) * sinf(longitude), sinf(latitude)); | |||||
| Transform sky_transform = transform_inverse(sky->tex_mapping.compute_transform()); | |||||
| sun_direction = transform_direction(&sky_transform, sun_direction); | |||||
| /* Pack sun direction and size. */ | |||||
| float half_angle = sky->sun_size * 0.5f; | float half_angle = sky->sun_size * 0.5f; | ||||
| kbackground->sun = make_float4(cosf(latitude) * cosf(longitude), | kbackground->sun = make_float4( | ||||
| cosf(latitude) * sinf(longitude), | sun_direction.x, sun_direction.y, sun_direction.z, half_angle); | ||||
| sinf(latitude), | |||||
| half_angle); | |||||
| kbackground->sun_weight = 4.0f; | kbackground->sun_weight = 4.0f; | ||||
| environment_res.x = max(environment_res.x, 512); | environment_res.x = max(environment_res.x, 512); | ||||
| environment_res.y = max(environment_res.y, 256); | environment_res.y = max(environment_res.y, 256); | ||||
| num_suns++; | num_suns++; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 486 Lines • Show Last 20 Lines | |||||