0.2 Clean up
This commit is contained in:
18
src/main.c
18
src/main.c
@@ -48,30 +48,24 @@ int main( void )
|
|||||||
if( !( m_axis = create_mesh( axis ) ) )
|
if( !( m_axis = create_mesh( axis ) ) )
|
||||||
goto error_mesh_axis;
|
goto error_mesh_axis;
|
||||||
|
|
||||||
|
|
||||||
texture=create_palette_texture( palette );
|
texture=create_palette_texture( palette );
|
||||||
use_texture( texture );
|
use_texture( texture );
|
||||||
|
|
||||||
while( is_open_window( window ) )
|
while( is_open_window( window ) )
|
||||||
{
|
{
|
||||||
load_rot_matrix( shader, rot );
|
|
||||||
|
|
||||||
++rot[1];
|
++rot[1];
|
||||||
|
|
||||||
|
load_rot_matrix( shader, rot );
|
||||||
|
|
||||||
draw_color();
|
draw_color();
|
||||||
|
|
||||||
load_mdl_matrix( shader, 2 );
|
load_mdl_matrix( shader, 0, 0 );
|
||||||
gload_float( shader, "idx", 2 );
|
|
||||||
draw_mesh( m_axis );
|
draw_mesh( m_axis );
|
||||||
|
load_mdl_matrix( shader, 1, 1 );
|
||||||
load_mdl_matrix( shader, 1 );
|
|
||||||
gload_float( shader, "idx", 1 );
|
|
||||||
draw_mesh( m_axis );
|
draw_mesh( m_axis );
|
||||||
|
load_mdl_matrix( shader, 2, 2 );
|
||||||
load_mdl_matrix( shader, 0 );
|
|
||||||
gload_float( shader, "idx", 0 );
|
|
||||||
draw_mesh( m_axis );
|
draw_mesh( m_axis );
|
||||||
gload_float( shader, "idx", 3 );
|
load_mdl_matrix( shader, 0, 3 );
|
||||||
draw_mesh( m_cube );
|
draw_mesh( m_cube );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void gload_mat4( unsigned int program, char * var, float * m );
|
|||||||
|
|
||||||
void load_fix_matrix( unsigned int shader, float ratio );
|
void load_fix_matrix( unsigned int shader, float ratio );
|
||||||
|
|
||||||
void load_mdl_matrix( unsigned int shader, unsigned char i );
|
void load_mdl_matrix( unsigned int shader, unsigned char i, unsigned char c );
|
||||||
|
|
||||||
void load_rot_matrix( unsigned int shader, unsigned char * angle );
|
void load_rot_matrix( unsigned int shader, unsigned char * angle );
|
||||||
|
|
||||||
|
|||||||
@@ -27,16 +27,18 @@ mat4 ortho[] =
|
|||||||
void load_fix_matrix( unsigned int shader, float ratio )
|
void load_fix_matrix( unsigned int shader, float ratio )
|
||||||
{
|
{
|
||||||
mat4 m, n;
|
mat4 m, n;
|
||||||
|
const int d = 7;
|
||||||
|
|
||||||
glm_lookat( (vec3){0,0,-5}, (vec3){0,0,0}, (vec3){0,1,0}, m );
|
glm_lookat( (vec3){0,0,-d}, (vec3){0,0,0}, (vec3){0,1,0}, m );
|
||||||
glm_perspective( 45.0, ratio, 2, 8, n );
|
glm_perspective( CGLM_PI/4, ratio, d-3, d+3, n );
|
||||||
glm_mat4_mul( n, m, m );
|
glm_mat4_mul( n, m, m );
|
||||||
|
|
||||||
gload_mat4( shader, "fix", (float*)m );
|
gload_mat4( shader, "fix", (float*)m );
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_mdl_matrix( unsigned int shader, unsigned char i )
|
void load_mdl_matrix( unsigned int shader, unsigned char i, unsigned char c )
|
||||||
{
|
{
|
||||||
|
gload_float( shader, "idx", c );
|
||||||
gload_mat4( shader, "mdl", (float*)ortho[i] );
|
gload_mat4( shader, "mdl", (float*)ortho[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user