com.watabou.gltextures.Gradient Java Examples
The following examples show how to use
com.watabou.gltextures.Gradient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SurfaceScene.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 5 votes |
public Sky( boolean dayTime ) { super( 0, 0, 1, 1 ); texture = new Gradient( dayTime ? day : night ); float[] vertices = new float[16]; verticesBuffer = Quad.create(); vertices[2] = 0.25f; vertices[6] = 0.25f; vertices[10] = 0.75f; vertices[14] = 0.75f; vertices[3] = 0; vertices[7] = 1; vertices[11] = 1; vertices[15] = 0; vertices[0] = 0; vertices[1] = 0; vertices[4] = 1; vertices[5] = 0; vertices[8] = 1; vertices[9] = 1; vertices[12] = 0; vertices[13] = 1; verticesBuffer.position( 0 ); verticesBuffer.put( vertices ); }
Example #2
Source File: SurfaceScene.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public Sky( boolean dayTime ) { super( 0, 0, 1, 1 ); texture = new Gradient( dayTime ? day : night ); float[] vertices = new float[16]; verticesBuffer = Quad.create(); vertices[2] = 0.25f; vertices[6] = 0.25f; vertices[10] = 0.75f; vertices[14] = 0.75f; vertices[3] = 0; vertices[7] = 1; vertices[11] = 1; vertices[15] = 0; vertices[0] = 0; vertices[1] = 0; vertices[4] = 1; vertices[5] = 0; vertices[8] = 1; vertices[9] = 1; vertices[12] = 0; vertices[13] = 1; verticesBuffer.position( 0 ); verticesBuffer.put( vertices ); }
Example #3
Source File: SurfaceScene.java From pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public Sky( boolean dayTime ) { super( 0, 0, 1, 1 ); texture = new Gradient( dayTime ? day : night ); float[] vertices = new float[16]; verticesBuffer = Quad.create(); vertices[2] = 0.25f; vertices[6] = 0.25f; vertices[10] = 0.75f; vertices[14] = 0.75f; vertices[3] = 0; vertices[7] = 1; vertices[11] = 1; vertices[15] = 0; vertices[0] = 0; vertices[1] = 0; vertices[4] = 1; vertices[5] = 0; vertices[8] = 1; vertices[9] = 1; vertices[12] = 0; vertices[13] = 1; verticesBuffer.position( 0 ); verticesBuffer.put( vertices ); }
Example #4
Source File: SurfaceScene.java From remixed-dungeon with GNU General Public License v3.0 | 5 votes |
public Sky( boolean dayTime ) { super( 0, 0, 1, 1 ); texture = new Gradient( dayTime ? day : night ); float[] vertices = new float[16]; verticesBuffer = Quad.create(); vertices[2] = 0.25f; vertices[6] = 0.25f; vertices[10] = 0.75f; vertices[14] = 0.75f; vertices[3] = 0; vertices[7] = 1; vertices[11] = 1; vertices[15] = 0; vertices[0] = 0; vertices[1] = 0; vertices[4] = 1; vertices[5] = 0; vertices[8] = 1; vertices[9] = 1; vertices[12] = 0; vertices[13] = 1; verticesBuffer.position( 0 ); verticesBuffer.put( vertices ); }
Example #5
Source File: Flare.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
@SuppressLint("FloatMath") public Flare( int nRays, float radius ) { super( 0, 0, 0, 0 ); int gradient[] = {0xFFFFFFFF, 0x00FFFFFF}; texture = new Gradient( gradient ); this.nRays = nRays; angle = 45; angularSpeed = 180; vertices = ByteBuffer. allocateDirect( (nRays * 2 + 1) * 4 * (Float.SIZE / 8) ). order( ByteOrder.nativeOrder() ). asFloatBuffer(); indices = ByteBuffer. allocateDirect( nRays * 3 * Short.SIZE / 8 ). order( ByteOrder.nativeOrder() ). asShortBuffer(); float v[] = new float[4]; v[0] = 0; v[1] = 0; v[2] = 0.25f; v[3] = 0; vertices.put( v ); v[2] = 0.75f; v[3] = 0; for (int i=0; i < nRays; i++) { float a = i * 3.1415926f * 2 / nRays; v[0] = (float)Math.cos( a ) * radius; v[1] = (float)Math.sin( a ) * radius; vertices.put( v ); a += 3.1415926f * 2 / nRays / 2; v[0] = (float)Math.cos( a ) * radius; v[1] = (float)Math.sin( a ) * radius; vertices.put( v ); indices.put( (short)0 ); indices.put( (short)(1 + i * 2) ); indices.put( (short)(2 + i * 2) ); } indices.position( 0 ); }
Example #6
Source File: Flare.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@SuppressLint("FloatMath") public Flare( int nRays, float radius ) { super( 0, 0, 0, 0 ); int gradient[] = {0xFFFFFFFF, 0x00FFFFFF}; texture = new Gradient( gradient ); this.nRays = nRays; angle = 45; angularSpeed = 180; vertices = ByteBuffer. allocateDirect( (nRays * 2 + 1) * 4 * (Float.SIZE / 8) ). order( ByteOrder.nativeOrder() ). asFloatBuffer(); indices = ByteBuffer. allocateDirect( nRays * 3 * Short.SIZE / 8 ). order( ByteOrder.nativeOrder() ). asShortBuffer(); float v[] = new float[4]; v[0] = 0; v[1] = 0; v[2] = 0.25f; v[3] = 0; vertices.put( v ); v[2] = 0.75f; v[3] = 0; for (int i=0; i < nRays; i++) { float a = i * 3.1415926f * 2 / nRays; v[0] = FloatMath.cos( a ) * radius; v[1] = FloatMath.sin( a ) * radius; vertices.put( v ); a += 3.1415926f * 2 / nRays / 2; v[0] = FloatMath.cos( a ) * radius; v[1] = FloatMath.sin( a ) * radius; vertices.put( v ); indices.put( (short)0 ); indices.put( (short)(1 + i * 2) ); indices.put( (short)(2 + i * 2) ); } indices.position( 0 ); }
Example #7
Source File: Flare.java From pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@SuppressLint("FloatMath") public Flare( int nRays, float radius ) { super( 0, 0, 0, 0 ); int gradient[] = {0xFFFFFFFF, 0x00FFFFFF}; texture = new Gradient( gradient ); this.nRays = nRays; angle = 45; angularSpeed = 180; vertices = ByteBuffer. allocateDirect( (nRays * 2 + 1) * 4 * (Float.SIZE / 8) ). order( ByteOrder.nativeOrder() ). asFloatBuffer(); indices = ByteBuffer. allocateDirect( nRays * 3 * Short.SIZE / 8 ). order( ByteOrder.nativeOrder() ). asShortBuffer(); float v[] = new float[4]; v[0] = 0; v[1] = 0; v[2] = 0.25f; v[3] = 0; vertices.put( v ); v[2] = 0.75f; v[3] = 0; for (int i=0; i < nRays; i++) { float a = i * 3.1415926f * 2 / nRays; v[0] = FloatMath.cos( a ) * radius; v[1] = FloatMath.sin( a ) * radius; vertices.put( v ); a += 3.1415926f * 2 / nRays / 2; v[0] = FloatMath.cos( a ) * radius; v[1] = FloatMath.sin( a ) * radius; vertices.put( v ); indices.put( (short)0 ); indices.put( (short)(1 + i * 2) ); indices.put( (short)(2 + i * 2) ); } indices.position( 0 ); }
Example #8
Source File: Flare.java From remixed-dungeon with GNU General Public License v3.0 | 4 votes |
public Flare( int nRays, float radius ) { super( 0, 0, 0, 0 ); // FIXME // Texture is incorrectly created every time we need // to show the effect, it must be refactored int gradient[] = {0xFFFFFFFF, 0x00FFFFFF}; texture = new Gradient( gradient ); this.nRays = nRays; angle = 45; angularSpeed = 180; vertices = ByteBuffer. allocateDirect( (nRays * 2 + 1) * 4 * (Float.SIZE / 8) ). order( ByteOrder.nativeOrder() ). asFloatBuffer(); indices = ByteBuffer. allocateDirect( nRays * 3 * Short.SIZE / 8 ). order( ByteOrder.nativeOrder() ). asShortBuffer(); float v[] = new float[4]; v[0] = 0; v[1] = 0; v[2] = 0.25f; v[3] = 0; vertices.put( v ); v[2] = 0.75f; v[3] = 0; for (int i=0; i < nRays; i++) { float a = i * 3.1415926f * 2 / nRays; v[0] = (float) (Math.cos( a ) * radius); v[1] = (float) (Math.sin( a ) * radius); vertices.put( v ); a += 3.1415926f * 2 / nRays / 2; v[0] = (float) (Math.cos( a ) * radius); v[1] = (float) (Math.sin( a ) * radius); vertices.put( v ); indices.put( (short)0 ); indices.put( (short)(1 + i * 2) ); indices.put( (short)(2 + i * 2) ); } indices.position( 0 ); }