当前位置: 首页>>代码示例>>Java>>正文


Java TextureCache.createGradient方法代码示例

本文整理汇总了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);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:34,代码来源:SurfaceScene.java

示例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 );
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:35,代码来源:SurfaceScene.java

示例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);
}
 
开发者ID:G2159687,项目名称:ESPD,代码行数:51,代码来源:Flare.java

示例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 );
}
 
开发者ID:mango-tree,项目名称:UNIST-pixel-dungeon,代码行数:54,代码来源:Flare.java

示例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 );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:53,代码来源:Flare.java


注:本文中的com.watabou.gltextures.TextureCache.createGradient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。