Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/util_projection.h
| Show All 39 Lines | |||||
| typedef struct PerspectiveMotionTransform { | typedef struct PerspectiveMotionTransform { | ||||
| ProjectionTransform pre; | ProjectionTransform pre; | ||||
| ProjectionTransform post; | ProjectionTransform post; | ||||
| } PerspectiveMotionTransform; | } PerspectiveMotionTransform; | ||||
| /* Functions */ | /* Functions */ | ||||
| ccl_device_inline float3 transform_perspective(const ProjectionTransform *t, const float3 a) | ccl_device_inline float3 transform_perspective(ccl_private const ProjectionTransform *t, | ||||
| const float3 a) | |||||
| { | { | ||||
| float4 b = make_float4(a.x, a.y, a.z, 1.0f); | float4 b = make_float4(a.x, a.y, a.z, 1.0f); | ||||
| float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b)); | float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b)); | ||||
| float w = dot(t->w, b); | float w = dot(t->w, b); | ||||
| return (w != 0.0f) ? c / w : zero_float3(); | return (w != 0.0f) ? c / w : zero_float3(); | ||||
| } | } | ||||
| ccl_device_inline float3 transform_perspective_direction(const ProjectionTransform *t, | ccl_device_inline float3 transform_perspective_direction(ccl_private const ProjectionTransform *t, | ||||
| const float3 a) | const float3 a) | ||||
| { | { | ||||
| float3 c = make_float3(a.x * t->x.x + a.y * t->x.y + a.z * t->x.z, | float3 c = make_float3(a.x * t->x.x + a.y * t->x.y + a.z * t->x.z, | ||||
| a.x * t->y.x + a.y * t->y.y + a.z * t->y.z, | a.x * t->y.x + a.y * t->y.y + a.z * t->y.z, | ||||
| a.x * t->z.x + a.y * t->z.y + a.z * t->z.z); | a.x * t->z.x + a.y * t->z.y + a.z * t->z.z); | ||||
| return c; | return c; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines | |||||