コード例 #1
0
void readGeometry(xmlNode *n, void *context) {
          printf("readGeometry\n%s\n",n->name);
	geomteryContext *c = (geomteryContext *)context;
	printf("GeometryContext (N): %d\n",c->n);
	fillGeometry(n, &c->g[c->n]);
	c->n++;
}
コード例 #2
0
ファイル: terrain.cpp プロジェクト: prolikeapro/singledrop
void Terrain::makeTerrain()
{
	DsChunkPtr ch = world->generateChunk(0, 0);
	double* map = ch->getMap();
	side = static_cast<int>(pow(2, DsWorld::CHUNK_SIZE)) + 1;

	geom = new Geometry();
	//Pass 1: Fill vertex and texcoord data. Normals will be accumulated on step 2 and normalized on step 3.
    fillGeometry(map);
    //Pass 2: Make faces and accumulate per-vertex normals
	/*
	v1-------v2
	| even /  |
	|	 /    |
	|  /  odd |
	v3-------v4
	*/
    makeFacesAndNormals();
    //Pass 3: Normalize normals
    normalizeNormals();
    vbo = new TerrainVbo(*geom);
	delete[] map;
}