本文整理汇总了Java中com.watabou.gltextures.TextureCache.createGradient方法的典型用法代码示例。如果您正苦于以下问题:Java TextureCache.createGradient方法的具体用法?Java TextureCache.createGradient怎么用?Java TextureCache.createGradient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.watabou.gltextures.TextureCache
的用法示例。
在下文中一共展示了TextureCache.createGradient方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Sky
import com.watabou.gltextures.TextureCache; //导入方法依赖的package包/类
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);
}
示例2: Sky
import com.watabou.gltextures.TextureCache; //导入方法依赖的package包/类
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 );
}
示例3: Flare
import com.watabou.gltextures.TextureCache; //导入方法依赖的package包/类
@SuppressLint("FloatMath")
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);
}
示例4: Flare
import com.watabou.gltextures.TextureCache; //导入方法依赖的package包/类
@SuppressLint("FloatMath")
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 );
}
示例5: Flare
import com.watabou.gltextures.TextureCache; //导入方法依赖的package包/类
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 );
}