dungeon_crawler

diff prototype/src/tile.cc @ 3:31e53fd79c2d

lalala
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 10 Aug 2012 04:45:38 +0300
parents 96de911d05d4
children 158de53b4e18
line diff
     1.1 --- a/prototype/src/tile.cc	Thu Aug 09 06:20:27 2012 +0300
     1.2 +++ b/prototype/src/tile.cc	Fri Aug 10 04:45:38 2012 +0300
     1.3 @@ -4,20 +4,24 @@
     1.4  
     1.5  bool Tile::load(const char *fname)
     1.6  {
     1.7 +	unsigned int proc_flags = aiProcess_JoinIdenticalVertices |
     1.8 +		aiProcess_PreTransformVertices | aiProcess_Triangulate |
     1.9 +		aiProcess_GenNormals | aiProcess_SortByPType | aiProcess_FlipUVs;
    1.10 +	const aiScene *scn = aiImportFile(fname, proc_flags);
    1.11 +	if(!scn) {
    1.12 +		fprintf(stderr, "failed to load tile: %s\n", fname);
    1.13 +		return -1;
    1.14 +	}
    1.15 +
    1.16 +	load_lights(scn);
    1.17 +
    1.18 +	load_meshes(scn);
    1.19 +
    1.20 +	printf("loaded tile %s: %d meshes, %d lights\n", fname, scn->mNumMeshes, scn->mNumLights);
    1.21  	return true;
    1.22  }
    1.23  
    1.24 -void Tile::draw() const
    1.25 +void Tile::draw(unsigned int drawmask) const
    1.26  {
    1.27 -	float color[] = {1, 0, 0, 1};
    1.28 -	float white[] = {1, 1, 1, 1};
    1.29  
    1.30 -	glPushAttrib(GL_LIGHTING_BIT);
    1.31 -
    1.32 -	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
    1.33 -	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
    1.34 -	glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 60.0);
    1.35 -	glutSolidSphere(0.5, 16, 8);
    1.36 -
    1.37 -	glPopAttrib();
    1.38  }