// gl.glTranslatef(hcore.vertexorigin.x, hcore.vertexorigin.y, hcore.vertexorigin.z);
// gl.glScalef(hcore.vertexscale, hcore.vertexscale, hcore.vertexscale);
// }
Point3D vertexarray[] = hcore.vertexarray;
Point2D texcoordarray[] = hcore.texcoordarray;
float heightblendvalue = node.getInterpolationCounter();
Point3D vertex[] = hcore.getInterpolationVertexArray(heightblendvalue); // vertexarray;
int vertex_i = 0;
Point2D texcoord[] = texcoordarray;
int texcoord_i = 0;
/* Initialize texture units */
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glClientActiveTexture(GL.GL_TEXTURE0);
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL.GL_NORMAL_ARRAY);
gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);
gl.glEnable(GL.GL_COLOR_MATERIAL);
gl.glColor4f(1.f, 1.f, 1.f, 1.f);
/* Set second texture only if the user wants multitexturing */
if (Global.cacheUseMultiTexturing) {
gl.glActiveTexture(GL.GL_TEXTURE1);
gl.glClientActiveTexture(GL.GL_TEXTURE1);
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
Texture interpolationtextureID = null;
try {
interpolationtextureID = core.getInterpolationTextureID(gl);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (interpolationtextureID == null) {
blendvalue = 0;
}
else {
gl.glColor4f(blendvalue, blendvalue, blendvalue, 1.f);
gl.glEnable(GL.GL_TEXTURE_2D);
interpolationtextureID.bind();
}
}
else {
blendvalue = 0;
}
for(int row=0; row<hcore.vertexcount/hcore.stripsize; row++) {
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glClientActiveTexture(GL.GL_TEXTURE0);
DoubleBuffer db = hcore.getVertexDb();
db.position(vertex_i*3);
gl.glVertexPointer(3, GL.GL_DOUBLE, 0, db);
gl.glNormalPointer(GL.GL_DOUBLE, 0, db);
DoubleBuffer texDb = hcore.getTexDb();
texDb.position(texcoord_i*2);
gl.glTexCoordPointer(2, GL.GL_DOUBLE, 0, texDb);
// TODO can be removed when texture blending is not used
gl.glActiveTexture(GL.GL_TEXTURE1);
gl.glClientActiveTexture(GL.GL_TEXTURE1);
gl.glTexCoordPointer(2, GL.GL_DOUBLE, 0, texDb);
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glClientActiveTexture(GL.GL_TEXTURE0);
// #ifdef LINE_MODE
//gl.glDrawArrays(GL.GL_LINE_STRIP, 0, hcore.stripsize);
// #else
if (Global.maptiledrawtype==0) {
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, hcore.stripsize);
}
else {
if (Global.maptiledrawtype==1) {
gl.glDrawArrays(GL.GL_LINE_STRIP, 0, hcore.stripsize);
}
else {
gl.glBegin(GL.GL_LINE_STRIP);
gl.glVertex3d(hcore.vertex[0].x, hcore.vertex[0].y, hcore.vertex[0].z);
gl.glVertex3d(hcore.vertex[1].x, hcore.vertex[1].y, hcore.vertex[1].z);
gl.glVertex3d(hcore.vertex[2].x, hcore.vertex[2].y, hcore.vertex[2].z);
gl.glVertex3d(hcore.vertex[3].x, hcore.vertex[3].y, hcore.vertex[3].z);
gl.glVertex3d(hcore.vertex[0].x, hcore.vertex[0].y, hcore.vertex[0].z);
gl.glEnd();
}
}
// #endif
vertex_i+=hcore.stripsize;
texcoord_i+=hcore.stripsize;
}
/* draw fans */
for(int direction=0; direction<4; direction++) {
Point3D fanvertexarray[] = hcore.fanvertexarray[direction];
Point2D fantexcoordarray[] = hcore.fantexcoordarray[direction];
// glColor3f(0.f, 1.f, 0.f);
// glBindTexture(GL.GL_TEXTURE_2D, null);
vertex = fanvertexarray;
vertex_i = 0;