Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/geom/geom_volume.h
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | else { | ||||
| return float4_to_float3(value); | return float4_to_float3(value); | ||||
| } | } | ||||
| } | } | ||||
| ccl_device float4 volume_attribute_float4(KernelGlobals *kg, | ccl_device float4 volume_attribute_float4(KernelGlobals *kg, | ||||
| const ShaderData *sd, | const ShaderData *sd, | ||||
| const AttributeDescriptor desc) | const AttributeDescriptor desc) | ||||
| { | { | ||||
| if (desc.element & (ATTR_ELEMENT_OBJECT | ATTR_ELEMENT_MESH)) { | |||||
| return kernel_tex_fetch(__attributes_float3, desc.offset); | |||||
| } | |||||
| else if (desc.element == ATTR_ELEMENT_VOXEL) { | |||||
| /* todo: optimize this so we don't have to transform both here and in | /* todo: optimize this so we don't have to transform both here and in | ||||
| * kernel_tex_image_interp_3d when possible. Also could optimize for the | * kernel_tex_image_interp_3d when possible. Also could optimize for the | ||||
| * common case where transform is translation/scale only. */ | * common case where transform is translation/scale only. */ | ||||
| float3 P = sd->P; | float3 P = sd->P; | ||||
| object_inverse_position_transform(kg, sd, &P); | object_inverse_position_transform(kg, sd, &P); | ||||
| InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC) ? INTERPOLATION_CUBIC : | InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC) ? INTERPOLATION_CUBIC : | ||||
| INTERPOLATION_NONE; | INTERPOLATION_NONE; | ||||
| return kernel_tex_image_interp_3d(kg, desc.offset, P, interp); | return kernel_tex_image_interp_3d(kg, desc.offset, P, interp); | ||||
| } | } | ||||
| else { | |||||
| return make_float4(0.0f, 0.0f, 0.0f, 0.0f); | |||||
| } | |||||
brecht: This should also check for `ATTR_ELEMENT_MESH`. | |||||
| } | |||||
| #endif | #endif | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
This should also check for ATTR_ELEMENT_MESH.