36 #include "../api_core.h"
42 template<
typename Type>
45 template<
typename Type>
48 template<
typename Type>
51 template<
typename Type>
54 template<
typename Type>
57 template<
typename Type>
60 template<
typename Type>
63 template<
typename Type>
66 template<
typename Type>
77 template<
typename Type>
83 union { Type
x; Type
s; Type
r; };
84 union { Type
y; Type
t; Type
g; };
85 union { Type
z; Type
u; Type
b; };
96 CL_Vec3(
const Type &p1,
const Type &p2 = 0,
const Type &p3 = 0) :
x(p1),
y(p2),
z(p3) { }
97 CL_Vec3(
const Type *array_xyz) :
x(array_xyz[0]),
y(array_xyz[1]),
z(array_xyz[2]) { }
196 const Type &
operator[](
unsigned int i)
const {
return ((Type *)
this)[i]; }
197 Type &
operator[](
unsigned int i) {
return ((Type *)
this)[i]; }
198 operator Type *() {
return (Type *)
this; }
199 operator Type *
const()
const {
return (Type *
const)
this; }
262 template<
typename Type>
266 matrix[0*3+0]*v.
x + matrix[0*3+1]*v.
y + matrix[0*3+2]*v.
z,
267 matrix[1*3+0]*v.
x + matrix[1*3+1]*v.
y + matrix[1*3+2]*v.
z,
268 matrix[2*3+0]*v.
x + matrix[2*3+1]*v.
y + matrix[2*3+2]*v.
z);
273 template<
typename Type>
277 matrix[0*3+0]*v.
x + matrix[1*3+0]*v.
y + matrix[2*3+0]*v.
z,
278 matrix[0*3+1]*v.
x + matrix[1*3+1]*v.
y + matrix[2*3+1]*v.
z,
279 matrix[0*3+2]*v.
x + matrix[1*3+2]*v.
y + matrix[2*3+2]*v.
z);