Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void colorFunc2(GL gl, float x, float y, float z) {
- float[] rgba;
- float q = 0.20f;
- float blueBegin = 0.00f;
- float blueEnd = 0.35f;
- //\\//\\//\\//\\//\\//\\//
- float greenBegin = 0.35f;
- float greenEnd = 0.60f;
- //\\//\\//\\//\\//\\//\\//
- float brownBegin = 0.60f;
- float brownEnd = 0.85f;
- //\\//\\//\\//\\//\\//\\//
- float whiteBegin = 0.85f;
- float whiteEnd = 1.00f;
- if (inRange(y, blueBegin, blueEnd-q)) {
- rgba = blue;
- }
- else if (inRange(y, blueEnd-q, blueEnd)) {
- rgba = scale4f(
- sum4f(
- scale4f(blue, (blueEnd - y)),
- scale4f(green, (blueEnd-q + y))
- ),
- 1.00f
- );
- }
- else if (inRange(y, greenBegin, greenEnd-q)) {
- rgba = green;
- }
- else if (inRange(y, greenEnd-q, greenEnd)) {
- rgba = scale4f(
- sum4f(
- scale4f(green, (greenEnd - y)),
- scale4f(brown, (greenEnd-q + y))
- ),
- 1.00f
- );
- }
- else if (inRange(y, brownBegin, brownEnd-q)) {
- rgba = brown;
- }
- else if (inRange(y, brownEnd-q, brownEnd)) {
- rgba = scale4f(
- sum4f(
- scale4f(brown, (brownEnd - y)),
- scale4f(white, (brownEnd-q + y))
- ),
- 1.00f
- );
- }
- else if (inRange(y, whiteBegin, whiteEnd)) {
- rgba = white;
- }
- else {
- //throw new RuntimeException("Unexpected value: " + y);
- //System.err.println("Unexpected value: " + y);
- rgba = purple;
- }
- //color(gl, new float[] {1f, 1f, 1f, 1f});
- color(gl, rgba);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement