Java Code Examples for com.watabou.gltextures.TextureCache#createGradient()
The following examples show how to use
com.watabou.gltextures.TextureCache#createGradient() .
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 shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
public Sky( boolean dayTime ) { super( 0, 0, 1, 1 ); texture = TextureCache.createGradient( 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: Archs.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override protected void createChildren() { arcsBg = new SkinnedBlock( 1, 1, Assets.Interfaces.ARCS_BG ){ @Override protected NoosaScript script() { return NoosaScriptNoLighting.get(); } @Override public void draw() { //arch bg has no alpha component, this improves performance Blending.disable(); super.draw(); Blending.enable(); } }; arcsBg.autoAdjust = true; arcsBg.offsetTo( 0, offsB ); add( arcsBg ); arcsFg = new SkinnedBlock( 1, 1, Assets.Interfaces.ARCS_FG ){ @Override protected NoosaScript script() { return NoosaScriptNoLighting.get(); } }; arcsFg.autoAdjust = true; arcsFg.offsetTo( 0, offsF ); add( arcsFg ); darkness= new Image(TextureCache.createGradient(0x00000000, 0x22000000, 0x55000000, 0x99000000, 0xEE000000)); darkness.angle = 90; add(darkness); }
Example 3
Source File: SurfaceScene.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
public Sky( boolean dayTime ) { super( 0, 0, 1, 1 ); texture = TextureCache.createGradient( 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: Archs.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override protected void createChildren() { arcsBg = new SkinnedBlock( 1, 1, Assets.ARCS_BG ){ @Override protected NoosaScript script() { return NoosaScriptNoLighting.get(); } @Override public void draw() { //arch bg has no alpha component, this improves performance Blending.disable(); super.draw(); Blending.enable(); } }; arcsBg.autoAdjust = true; arcsBg.offsetTo( 0, offsB ); add( arcsBg ); arcsFg = new SkinnedBlock( 1, 1, Assets.ARCS_FG ){ @Override protected NoosaScript script() { return NoosaScriptNoLighting.get(); } }; arcsFg.autoAdjust = true; arcsFg.offsetTo( 0, offsF ); add( arcsFg ); darkness= new Image(TextureCache.createGradient(0x00000000, 0x22000000, 0x55000000, 0x99000000, 0xEE000000)); darkness.angle = 90; add(darkness); }
Example 5
Source File: Flare.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
public Flare( int nRays, float radius ) { super( 0, 0, 0, 0 ); int gradient[] = {0xFFFFFFFF, 0x00FFFFFF}; texture = TextureCache.createGradient( 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 shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 4 votes |
public Flare( int nRays, float radius ) { super( 0, 0, 0, 0 ); int gradient[] = {0xFFFFFFFF, 0x00FFFFFF}; texture = TextureCache.createGradient( 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] = MathUtils.cos( a ) * radius; v[1] = MathUtils.sin( a ) * radius; vertices.put( v ); a += 3.1415926f * 2 / nRays / 2; v[0] = MathUtils.cos( a ) * radius; v[1] = MathUtils.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 ); }