void templateAppInit(int width, int height)
{
    GFX_start();
    glViewport(0.0f, 0.0f, width, height);
    glGetIntegerv(GL_VIEWPORT, viewport_matrix);
    vec4 color = { 1.0f, 1.0f, 1.0f, 1.0f };
    light = LIGHT_create_directional((char *)"point", &color, 45.0f, 0.0f, 0.0f);
}
Esempio n. 2
0
void templateAppInit( int width, int height ) {

	atexit( templateAppExit );

	GFX_start();

	glViewport( 0.0f, 0.0f, width, height );
	
	glGetIntegerv( GL_VIEWPORT, viewport_matrix );
	
	vec4 color = { 1.0f, 1.0f, 1.0f, 1.0f };
	
	light = LIGHT_create_directional( ( char * )"point", &color, 45.0f, 0.0f, 0.0f );
	
	
	obj = ( OBJ * ) calloc( 1, sizeof( OBJ ) );
	
	OBJ_load_mtl( obj, MTL_FILE, 1 );
	
	unsigned int i = 0;
	
	while( i != obj->n_texture ) { 

		OBJ_build_texture( obj,
						   i,
						   obj->texture_path,
						   TEXTURE_MIPMAP | TEXTURE_CLAMP | TEXTURE_16_BITS,
						   TEXTURE_FILTER_3X,
						   0.0f );
		++i;
	}


	i = 0;
	while( i != obj->n_program ) { 
		
		OBJ_build_program( obj,
						   i,
						   program_bind_attrib_location,
						   NULL,
						   1,
						   obj->program_path );
		++i;
	}


	i = 0;
	while( i != obj->n_objmaterial ) { 

		OBJ_build_material( obj, i, NULL );
		
		OBJ_set_draw_callback_material( obj, i, material_draw );
		
		++i;
	}
	

	md5 = MD5_load_mesh( MD5_MESH, 1 );

	MD5_optimize( md5, 128 );

	MD5_build( md5 );

	i = 0;
	while( i != md5->n_mesh ) {

		MD5MESH *md5mesh = &md5->md5mesh[ i ];

		MD5_set_mesh_material( md5mesh,
							   OBJ_get_material( obj,
												 md5mesh->shader,
												 0 ) );
		++i;
	}
	
	
	MD5_load_action( md5,
					 ( char * )"idle",
					 ( char * )"bob_idle.md5anim",
					 1 );
					 
	idle = MD5_get_action( md5, ( char * )"idle", 0 );

	MD5_set_action_fps( idle, 24.0f );

	//MD5_action_play( idle,
	//				 MD5_METHOD_FRAME,
	//				 1 );

	//MD5_action_play( idle,
	//				 MD5_METHOD_LERP,
	//				 1 );

	MD5_action_play( idle,
					 MD5_METHOD_SLERP,
					 1 );
	
	MD5_free_mesh_data( md5 );

	glDisable( GL_CULL_FACE );	
}