more work on overlay renderer:

- moved text rendering to overlay
- added grid overlay
This commit is contained in:
Hannes Janetzek
2012-10-13 04:57:27 +02:00
parent 33d8865d7b
commit 4a06553ddc
33 changed files with 2050 additions and 1089 deletions

View File

@@ -47,4 +47,11 @@ public class FastMath {
}
return r;
}
public static float pow(int pow) {
if (pow == 0)
return 1;
return (pow > 0 ? (1 << pow) : (1.0f / (1 << -pow)));
}
}

View File

@@ -157,6 +157,24 @@ public class GlUtils {
GLES20.glUniform4fv(handle, 1, c, 0);
else
glUniform4f(handle, c[0] * alpha, c[1] * alpha, c[2] * alpha, c[3] * alpha);
}
public static float[] colorToFloat(int color) {
float[] c = new float[4];
c[3] = (color >> 24 & 0xff) / 255.0f;
c[0] = (color >> 16 & 0xff) / 255.0f;
c[1] = (color >> 8 & 0xff) / 255.0f;
c[2] = (color >> 0 & 0xff) / 255.0f;
return c;
}
// premultiply alpha
public static float[] colorToFloatP(int color) {
float[] c = new float[4];
c[3] = (color >> 24 & 0xff) / 255.0f;
c[0] = (color >> 16 & 0xff) / 255.0f * c[3];
c[1] = (color >> 8 & 0xff) / 255.0f * c[3];
c[2] = (color >> 0 & 0xff) / 255.0f * c[3];
return c;
}
}