示例#1
0
文件: testmesh.c 项目: bzar/sparrow3d
int main(int argc, char **argv)
{
	//sparrow3D Init
	spSetDefaultWindowSize(640,480); //Creates a 640x480 window at PC instead of 320x240
	spInitCore();
	
	//Setup
	screen = spCreateDefaultWindow();
	//Selecting the renderTarget. It could be every surface
	spSelectRenderTarget(screen);
	resize(screen->w,screen->h);
	
	//Textures loading
	texture = spLoadSurface("./data/garfield.png");
	//Setting alpha test to 0, because the texture has pink parts
	spSetAlphaTest(0);
	//Mesh loading
	mesh = spMeshLoadObj("./data/testmeshuv_tri.obj",texture,65535);
		
	//Light on! There is one "default" light at 0,0,0 with color white. We just use it.
	spSetLight(1);
	
	//All glory the main loop
	//every frame the draw_function is called
	//every frame the calc_function is called with the past time as argument
	//at least 10 ms have to be between to frames (max 100 fps)
	//if the window is resized, the resize feedback-function is called (again)
	spLoop(draw_function,calc_function,10,resize,NULL);
	
	//Winter Wrap up, Winter Wrap up
	spMeshDelete(mesh);
	spDeleteSurface(texture);
	spQuitCore();
	return 0;
}
示例#2
0
文件: debugstage.cpp 项目: pmprog/P01
void DebugStage::Finish()
{
	spMeshDelete( carMesh );
	SDL_FreeSurface( carTexture );
	SDL_FreeSurface( roadTexture );
	SDL_FreeSurface( offroadTexture );
	SDL_FreeSurface( roadsideTexture );
	spFontDelete( fontHnd );
}
示例#3
0
void run_splashscreen(void (*resize)(Uint16 w,Uint16 h))
{
	//spSetPerspectiveTextureMapping(1);
  splash_rotation = 0;
  sparrow = spLoadSurface("./images/sparrow.png");
  logo = spLoadSurface("./images/dragonbox.png");
  sparrow_mesh = spMeshLoadObj( "./images/splash.obj", sparrow, 65535 );
  logo_mesh = spMeshLoadObj( "./images/splash.obj", logo, 65535 );
  int i;
  for (i = 0; i < MESH_SIZE*2; i ++)
  {
		saved_points[i][0] = sparrow_mesh->texPoint[i].x;
		saved_points[i][1] = sparrow_mesh->texPoint[i].y;
		saved_points[i][2] = sparrow_mesh->texPoint[i].z;
	}
  splash_counter = SPLASH_WAIT;
  spLoop(draw_splash,calc_splash,10,resize,NULL);
  spMeshDelete( sparrow_mesh );
  spMeshDelete( logo_mesh );
  SDL_FreeSurface(sparrow);
  SDL_FreeSurface(logo);
  //spSetPerspectiveTextureMapping(0);
}