cleanup, less bright buildings

This commit is contained in:
Hannes Janetzek 2013-01-05 08:31:25 +01:00
parent 28278ba102
commit 885eec73d5
2 changed files with 19 additions and 28 deletions

View File

@ -273,7 +273,7 @@ public class ExtrusionLayer extends Layer {
vertices[v + 3] = vertices[v + 7] = c;
color1 = color2;
// check if polygon is convex
/* check if polygon is convex */
if (convex) {
// TODO simple polys with only one concave arc
// could be handled without special triangulation
@ -286,37 +286,36 @@ public class ExtrusionLayer extends Layer {
convex = false;
}
// check if face is within tile
/* check if face is within tile */
if (!mClipper.clip((int) cx, (int) cy, (int) nx, (int) ny)) {
even = (even + 1) % 2;
continue;
}
// add ZigZagQuadIndices(tm) for sides
short[] indices = mCurIndices[even].vertices;
// index id relative to mCurIndices item
int ind = mCurIndices[even].used;
// indices for current face
/* add ZigZagQuadIndices(tm) for sides */
short vert = (short) (vOffset + (i - 2));
short s0 = vert++;
short s1 = vert++;
short s2 = vert++;
short s3 = vert++;
if (ind == VertexPoolItem.SIZE) {
//mCurIndices[even].used = VertexPoolItem.SIZE;
mCurIndices[even].next = VertexPool.get();
mCurIndices[even] = mCurIndices[even].next;
indices = mCurIndices[even].vertices;
ind = 0;
}
// connect last to first (when number of faces is even)
if (!addFace && i == len) {
s2 -= len;
s3 -= len;
}
short[] indices = mCurIndices[even].vertices;
// index id relative to mCurIndices item
int ind = mCurIndices[even].used;
if (ind == VertexPoolItem.SIZE) {
mCurIndices[even].next = VertexPool.get();
mCurIndices[even] = mCurIndices[even].next;
indices = mCurIndices[even].vertices;
ind = 0;
}
indices[ind + 0] = s0;
indices[ind + 1] = s2;
indices[ind + 2] = s1;
@ -326,9 +325,9 @@ public class ExtrusionLayer extends Layer {
indices[ind + 5] = s3;
mCurIndices[even].used += 6;
even = (even + 1) % 2;
even = (even == 0 ? 1 : 0);
// add roof outline indices
/* add roof outline indices */
VertexPoolItem it = mCurIndices[IND_OUTLINE];
if (it.used == VertexPoolItem.SIZE) {
it.next = VertexPool.get();
@ -407,10 +406,6 @@ public class ExtrusionLayer extends Layer {
}
}
public void render() {
}
private static boolean initialized = false;
private static ShortBuffer sBuf;
private static FloatBuffer fBuf;

View File

@ -256,21 +256,17 @@ public class ExtrusionOverlay extends RenderOverlay {
// draw roof
GLES20.glUniform1i(hExtrusionMode, 0);
//GLES20.glUniform4f(hExtrusionColor, 0.81f, 0.8f, 0.8f, 0.9f);
GLES20.glUniform4fv(hExtrusionColor, 1, mRoofColor, 0);
GLES20.glDrawElements(GLES20.GL_TRIANGLES, el.mIndiceCnt[2],
GLES20.GL_UNSIGNED_SHORT, (el.mIndiceCnt[0] + el.mIndiceCnt[1]) * 2);
// draw sides 1
//GLES20.glUniform4f(hExtrusionColor, 0.8f, 0.8f, 0.8f, 1.0f);
//GLES20.glUniform4f(hExtrusionColor, 0.9f, 0.905f, 0.9f, 1.0f);
GLES20.glUniform4fv(hExtrusionColor, 1, mColor, 0);
GLES20.glUniform1i(hExtrusionMode, 1);
GLES20.glDrawElements(GLES20.GL_TRIANGLES, el.mIndiceCnt[0],
GLES20.GL_UNSIGNED_SHORT, 0);
// draw sides 2
//GLES20.glUniform4f(hExtrusionColor, 0.9f, 0.9f, 0.905f, 1.0f);
GLES20.glUniform4fv(hExtrusionColor, 1, mColor2, 0);
GLES20.glUniform1i(hExtrusionMode, 2);
@ -279,7 +275,7 @@ public class ExtrusionOverlay extends RenderOverlay {
GLES20.glDepthFunc(GLES20.GL_LEQUAL);
GLES20.glUniform1i(hExtrusionMode, 0);
GLES20.glUniform4f(hExtrusionColor, 0.65f, 0.65f, 0.65f, 0.98f);
GLES20.glUniform4f(hExtrusionColor, 0.7f, 0.7f, 0.7f, 1.0f);
GLES20.glDrawElements(GLES20.GL_LINES, el.mIndiceCnt[3],
GLES20.GL_UNSIGNED_SHORT,
(el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]) * 2);
@ -334,10 +330,10 @@ public class ExtrusionOverlay extends RenderOverlay {
+ " color = u_color;"
+ " else if (u_mode == 1)"
// sides 1 - use 0xff00
+ " color = vec4(u_color.rgb * (a_light.y / ff), 0.8);"
+ " color = vec4(u_color.rgb * (a_light.y / ff), 0.85);"
+ " else"
// sides 2 - use 0x00ff
+ " color = vec4(u_color.rgb * (a_light.x / ff), 0.8);"
+ " color = vec4(u_color.rgb * (a_light.x / ff), 0.85);"
+ "}";
// final static String extrusionVertexAnimShader = ""