Merge pull request #11417 from super626/terrain

Terrain
This commit is contained in:
minggo 2015-04-14 10:50:21 +08:00
commit 1ebcca8d9f
1 changed files with 6 additions and 3 deletions

View File

@ -202,6 +202,12 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t flags)
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);
} }
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
if(_isDrawWire)//reset state.
{
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
}
#endif
} }
bool Terrain::initHeightMap(const char * heightMap) bool Terrain::initHeightMap(const char * heightMap)
@ -872,9 +878,6 @@ void Terrain::Chunk::bindAndDraw()
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_NORMAL,3,GL_FLOAT,GL_FALSE,sizeof(TerrainVertexData),(GLvoid *)offset); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_NORMAL,3,GL_FLOAT,GL_FALSE,sizeof(TerrainVertexData),(GLvoid *)offset);
glDrawElements(GL_TRIANGLES, (GLsizei)_chunkIndices._size, GL_UNSIGNED_SHORT, 0); glDrawElements(GL_TRIANGLES, (GLsizei)_chunkIndices._size, GL_UNSIGNED_SHORT, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _chunkIndices._size); CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _chunkIndices._size);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
#endif
} }
void Terrain::Chunk::generate(int imgWidth, int imageHei, int m, int n, const unsigned char * data) void Terrain::Chunk::generate(int imgWidth, int imageHei, int m, int n, const unsigned char * data)