28 float4(0.0f, v, 0.0f, 0.0f),
29 float4(0.0f, 0.0f, v, 0.0f),
30 float4(0.0f, 0.0f, 0.0f, v));
84 ret[3].xyz = location;
104 ret[0][0] =
scale[0];
105 ret[1][1] =
scale[1];
106 ret[2][2] =
scale[2];
115 ret[0][0] =
scale[0];
116 ret[1][1] =
scale[1];
117 ret[2][2] =
scale[2];
118 ret[3][3] =
scale[3];
127 float c =
cos(rotation.angle);
128 float s =
sin(rotation.angle);
136 float ci =
cos(rotation.x);
137 float cj =
cos(rotation.y);
138 float ch =
cos(rotation.z);
139 float si =
sin(rotation.x);
140 float sj =
sin(rotation.y);
141 float sh =
sin(rotation.z);
149 mat[1][0] = sj * sc - cs;
150 mat[2][0] = sj * cc + ss;
153 mat[1][1] = sj * ss + cc;
154 mat[2][1] = sj * cs - sc;
183 mat[0][0] =
float(1.0f - qbb - qcc);
184 mat[0][1] =
float(qdc + qab);
185 mat[0][2] =
float(-qdb + qac);
187 mat[1][0] =
float(-qdc + qab);
188 mat[1][1] =
float(1.0f - qaa - qcc);
189 mat[1][2] =
float(qda + qbc);
191 mat[2][0] =
float(qdb + qac);
192 mat[2][1] =
float(-qda + qbc);
193 mat[2][2] =
float(1.0f - qaa - qbb);
201 float angle_sin =
sin(rotation.angle);
202 float angle_cos =
cos(rotation.angle);
203 float3 axis = rotation.axis;
205 float ico = (
float(1) - angle_cos);
206 float3 nsi = axis * angle_sin;
208 float3 n012 = (axis * axis) * ico;
209 float n_01 = (axis[0] * axis[1]) * ico;
210 float n_02 = (axis[0] * axis[2]) * ico;
211 float n_12 = (axis[1] * axis[2]) * ico;
214 mat[0][1] = n_01 + nsi[2];
215 mat[0][2] = n_02 - nsi[1];
216 mat[1][0] = n_01 - nsi[2];
217 mat[1][2] = n_12 + nsi[0];
218 mat[2][0] = n_02 + nsi[1];
219 mat[2][1] = n_12 - nsi[0];
251 ret[3].xyz = location;
260 ret[3].xyz = location;
269 ret[3].xyz = location;
279 ret[3].xyz = location;
288 ret[3].xyz = location;
297 ret[3].xyz = location;
307 float cos_angle = direction.
x;
308 float sin_angle = direction.
y;
309 return float2x2(cos_angle, sin_angle, -sin_angle, cos_angle);
336 float z_sign = up.
z >= 0.0f ? 1.0f : -1.0f;
337 float a = -1.0f / (z_sign + up.
z);
338 float b = up.
x * up.
y * a;
341 basis[0] =
float3(1.0f + z_sign *
square(up.
x) * a, z_sign *
b, -z_sign * up.
x);
364 basis[1] =
cross(up, basis[0]);
ccl_device_inline float cos_theta(const float3 w)
VecBase< float, D > normalize(VecOp< float, D >) RET
float dot(VecOp< float, D >, VecOp< float, D >) RET
VecBase< float, 3 > cross(VecOp< float, 3 >, VecOp< float, 3 >) RET
float3x3 scale(float3x3 mat, float2 scale)
float4x4 mat4x4_diagonal(float v)
float4x4 from_location(float3 location)
float3x3 from_up_axis(float3 up)
float4x4 mat4x4_all(float v)
float2x2 mat2x2_all(float v)
float3x3 from_rot_scale(EulerXYZ rotation, float3 scale)
float2x2 from_direction(float2 direction)
float2x2 from_scale(float2 scale)
float2x2 mat2x2_identity()
float4x4 from_loc_rot(float3 location, EulerXYZ rotation)
float3x3 mat3x3_identity()
float2x2 mat2x2_diagonal(float v)
float2x2 from_rotation(AngleRadian rotation)
float4x4 mat4x4_identity()
float3x3 from_incident_vector(float3 up, float3 forward)
float3x3 mat3x3_all(float v)
float4x4 from_loc_rot_scale(float3 location, EulerXYZ rotation, float3 scale)
float3x3 mat3x3_diagonal(float v)
MatBase< float, 2, 2 > float2x2
MatBase< float, 4, 4 > float4x4
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float