Add function middle, delete unused var.
This commit is contained in:
parent
d63f6a8793
commit
6fe2192d13
30
sweet_math.c
30
sweet_math.c
@ -516,6 +516,36 @@ sweet_vector_add4 (vec4 v1, vec4 v2)
|
|||||||
return v1;
|
return v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec2
|
||||||
|
sweet_vector_middle2 (vec2 vector1, vec2 vector2)
|
||||||
|
{
|
||||||
|
vec2 v;
|
||||||
|
v.x = (vector1.x + vector2.x) * 0.5;
|
||||||
|
v.y = (vector1.y + vector2.y) * 0.5;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3
|
||||||
|
sweet_vector_middle3 (vec3 vector1, vec3 vector2)
|
||||||
|
{
|
||||||
|
vec3 v;
|
||||||
|
v.x = (vector1.x + vector2.x) * 0.5;
|
||||||
|
v.y = (vector1.y + vector2.y) * 0.5;
|
||||||
|
v.z = (vector1.z + vector2.z) * 0.5;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4
|
||||||
|
sweet_vector_middle4 (vec4 vector1, vec4 vector2)
|
||||||
|
{
|
||||||
|
vec4 v;
|
||||||
|
v.x = (vector1.x + vector2.x) * 0.5;
|
||||||
|
v.y = (vector1.y + vector2.y) * 0.5;
|
||||||
|
v.z = (vector1.z + vector2.z) * 0.5;
|
||||||
|
v.w = (vector1.w + vector2.w) * 0.5;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
vec2
|
vec2
|
||||||
sweet_vector_sub2 (vec2 v1, vec2 v2)
|
sweet_vector_sub2 (vec2 v1, vec2 v2)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -191,6 +191,14 @@ vec2 sweet_vector_add2 (vec2 vector1, vec2 vector2);
|
|||||||
vec3 sweet_vector_add3 (vec3 vector1, vec3 vector2);
|
vec3 sweet_vector_add3 (vec3 vector1, vec3 vector2);
|
||||||
vec4 sweet_vector_add4 (vec4 vector1, vec4 vector2);
|
vec4 sweet_vector_add4 (vec4 vector1, vec4 vector2);
|
||||||
|
|
||||||
|
/** Middle */
|
||||||
|
/** @param Vector1 as vector */
|
||||||
|
/** @param Vector2 as vector */
|
||||||
|
/** @return middle point between vector1 and vector2 */
|
||||||
|
vec2 sweet_vector_middle2 (vec2 vector1, vec2 vector2);
|
||||||
|
vec3 sweet_vector_middle3 (vec3 vector1, vec3 vector2);
|
||||||
|
vec4 sweet_vector_middle4 (vec4 vector1, vec4 vector2);
|
||||||
|
|
||||||
/** Sub */
|
/** Sub */
|
||||||
/** @param Vector1 as vector */
|
/** @param Vector1 as vector */
|
||||||
/** @param Vector2 as vector */
|
/** @param Vector2 as vector */
|
||||||
|
|||||||
@ -242,7 +242,6 @@ mat4
|
|||||||
sweet_matrix_look_at (vec3 pos, vec3 dir, vec3 up)
|
sweet_matrix_look_at (vec3 pos, vec3 dir, vec3 up)
|
||||||
{
|
{
|
||||||
mat4 m;
|
mat4 m;
|
||||||
mat4 t;
|
|
||||||
vec3 side;
|
vec3 side;
|
||||||
side = sweet_vector_cross (dir, up);
|
side = sweet_vector_cross (dir, up);
|
||||||
side = sweet_vector_normalize3 (side);
|
side = sweet_vector_normalize3 (side);
|
||||||
@ -885,15 +884,12 @@ sweet_matrix_product4 (mat4 * p, mat4 * a, mat4 * b)
|
|||||||
float bv0 = b->v[0];
|
float bv0 = b->v[0];
|
||||||
float bv1 = b->v[1];
|
float bv1 = b->v[1];
|
||||||
float bv2 = b->v[2];
|
float bv2 = b->v[2];
|
||||||
float bv3 = b->v[3];
|
|
||||||
float bv4 = b->v[4];
|
float bv4 = b->v[4];
|
||||||
float bv5 = b->v[5];
|
float bv5 = b->v[5];
|
||||||
float bv6 = b->v[6];
|
float bv6 = b->v[6];
|
||||||
float bv7 = b->v[7];
|
|
||||||
float bv8 = b->v[8];
|
float bv8 = b->v[8];
|
||||||
float bv9 = b->v[9];
|
float bv9 = b->v[9];
|
||||||
float bv10 = b->v[10];
|
float bv10 = b->v[10];
|
||||||
float bv11 = b->v[11];
|
|
||||||
float bv12 = b->v[12];
|
float bv12 = b->v[12];
|
||||||
float bv13 = b->v[13];
|
float bv13 = b->v[13];
|
||||||
float bv14 = b->v[14];
|
float bv14 = b->v[14];
|
||||||
|
|||||||
@ -72,7 +72,7 @@ sweet_matrix_stack4_push (matrix_stack4 * ms)
|
|||||||
if (ms->position >= SWEET_MATRIX_STACK_SIZE) { return 1; }
|
if (ms->position >= SWEET_MATRIX_STACK_SIZE) { return 1; }
|
||||||
|
|
||||||
ms->matrix[ms->position + 1] = ms->matrix[ms->position];
|
ms->matrix[ms->position + 1] = ms->matrix[ms->position];
|
||||||
ms->position = ms->position++;
|
ms->position++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user