src/ascension/datatypes.h

changeset 41
df81d493716e
parent 38
6e5629ea4c5c
child 45
18de2af03531
equal deleted inserted replaced
40:6c438be1a1fd 41:df81d493716e
136 static inline void asc_mat4f_ortho( 136 static inline void asc_mat4f_ortho(
137 asc_mat4f mat, 137 asc_mat4f mat,
138 float left, 138 float left,
139 float right, 139 float right,
140 float bottom, 140 float bottom,
141 float top 141 float top,
142 float near,
143 float far
142 ) { 144 ) {
143 memset(mat, 0, sizeof(float) * 16); 145 memset(mat, 0, sizeof(float) * 16);
144 mat[asc_mat4_index(0,0)] = 2.f / (right - left); 146 mat[asc_mat4_index(0,0)] = 2.f / (right - left);
145 mat[asc_mat4_index(1,1)] = 2.f / (top - bottom); 147 mat[asc_mat4_index(1,1)] = 2.f / (top - bottom);
146 mat[asc_mat4_index(2,2)] = -1; 148 mat[asc_mat4_index(2,2)] = -2.f / (far - near);
147 mat[asc_mat4_index(3,0)] = -(right + left) / (right - left); 149 mat[asc_mat4_index(3,0)] = -(right + left) / (right - left);
148 mat[asc_mat4_index(3,1)] = -(top + bottom) / (top - bottom); 150 mat[asc_mat4_index(3,1)] = -(top + bottom) / (top - bottom);
151 mat[asc_mat4_index(3,2)] = -(far + near) / (far - near);
149 mat[asc_mat4_index(3,3)] = 1; 152 mat[asc_mat4_index(3,3)] = 1;
150 } 153 }
151 154
152 static inline void asc_mat4f_mulst( 155 static inline void asc_mat4f_mulst(
153 asc_mat4f dest, 156 asc_mat4f dest,

mercurial