當前位置: 首頁>>代碼示例>>Java>>正文


Java Usage.Generic方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.VertexAttributes.Usage.Generic方法的典型用法代碼示例。如果您正苦於以下問題:Java Usage.Generic方法的具體用法?Java Usage.Generic怎麽用?Java Usage.Generic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.VertexAttributes.Usage的用法示例。


在下文中一共展示了Usage.Generic方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: PositionalLight

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //導入方法依賴的package包/類
public PositionalLight (RayHandler rayHandler, int rays, Color color, float distance, float x, float y, float directionDegree) {
	super(rayHandler, rays, color, directionDegree, distance);
	start.x = x;
	start.y = y;
	sin = new float[rays];
	cos = new float[rays];
	endX = new float[rays];
	endY = new float[rays];

	lightMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum * 2, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	setMesh();
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:18,代碼來源:PositionalLight.java

示例2: DirectionalLight

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //導入方法依賴的package包/類
/** Directional lights simulate light source that locations is at infinite distance. Direction and intensity is same everywhere.
 * -90 direction is straight from up.
 * 
 * @param rayHandler
 * @param rays
 * @param color
 * @param directionDegree */
public DirectionalLight (RayHandler rayHandler, int rays, Color color, float directionDegree) {

	super(rayHandler, rays, color, directionDegree, Float.POSITIVE_INFINITY);

	vertexNum = (vertexNum - 1) * 2;

	start = new Vector2[rayNum];
	end = new Vector2[rayNum];
	for (int i = 0; i < rayNum; i++) {
		start[i] = new Vector2();
		end[i] = new Vector2();
	}
	setDirection(direction);

	lightMesh = new Mesh(VertexDataType.VertexArray, staticLight, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(VertexDataType.VertexArray, staticLight, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	update();
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:30,代碼來源:DirectionalLight.java

示例3: RavChainLight

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //導入方法依賴的package包/類
/** Creates chain light from specified vertices
 * 
 * @param rayHandler not {@code null} instance of RayHandler
 * @param rays number of rays - more rays make light to look more realistic but will decrease performance, can't be less than
 *           MIN_RAYS
 * @param color color, set to {@code null} to use the default color
 * @param distance distance of light
 * @param rayDirection direction of rays
 *           <ul>
 *           <li>1 = left</li>
 *           <li>-1 = right</li>
 *           </ul>
 * @param chain float array of (x, y) vertices from which rays will be evenly distributed */
public RavChainLight (RayHandler rayHandler, int rays, Color color, float distance, int rayDirection, float[] chain) {
	super(rayHandler, rays, color, distance, 0f);

	rayStartOffset = ChainLight.defaultRayStartOffset;
	this.rayDirection = rayDirection;
	vertexNum = (vertexNum - 1) * 2;
	endX = new float[rays];
	endY = new float[rays];
	startX = new float[rays];
	startY = new float[rays];
	this.chain = (chain != null) ? new FloatArray(chain) : new FloatArray();

	lightMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum, 0,
		new VertexAttribute(Usage.Position, 2, "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum * 2, 0,
		new VertexAttribute(Usage.Position, 2, "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	setMesh();
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:34,代碼來源:RavChainLight.java

示例4: ChainLight

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //導入方法依賴的package包/類
/**
 * Creates chain light from specified vertices
 * 
 * @param rayHandler
 *            not {@code null} instance of RayHandler
 * @param rays
 *            number of rays - more rays make light to look more realistic
 *            but will decrease performance, can't be less than MIN_RAYS
 * @param color
 *            color, set to {@code null} to use the default color
 * @param distance
 *            distance of light
 * @param rayDirection
 *            direction of rays
 *            <ul>
 *            <li>1 = left</li>
 *            <li>-1 = right</li>
 *            </ul>
 * @param chain
 *            float array of (x, y) vertices from which rays will be
 *            evenly distributed
 */
public ChainLight(RayHandler rayHandler, int rays, Color color,
		float distance, int rayDirection, float[] chain) {
	
	super(rayHandler, rays, color, distance, 0f);
	rayStartOffset = ChainLight.defaultRayStartOffset;
	this.rayDirection = rayDirection;
	vertexNum = (vertexNum - 1) * 2;
	endX = new float[rays];
	endY = new float[rays];
	startX = new float[rays];
	startY = new float[rays];
	this.chain = (chain != null) ?
				 new FloatArray(chain) : new FloatArray();
	
	lightMesh = new Mesh(
			VertexDataType.VertexArray, false, vertexNum, 0,
			new VertexAttribute(Usage.Position, 2, "vertex_positions"),
			new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
			new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(
			VertexDataType.VertexArray, false, vertexNum * 2,
			0, new VertexAttribute(Usage.Position, 2, "vertex_positions"),
			new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
			new VertexAttribute(Usage.Generic, 1, "s"));
	setMesh();
}
 
開發者ID:bitbrain,項目名稱:rbcgj-2016,代碼行數:49,代碼來源:ChainLight.java

示例5: DirectionalLight

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //導入方法依賴的package包/類
/**
 * Creates directional light which source is at infinite distance,
 * direction and intensity is same everywhere
 * 
 * <p>-90 direction is straight from up
 * 
 * @param rayHandler
 *            not {@code null} instance of RayHandler
 * @param rays
 *            number of rays - more rays make light to look more realistic
 *            but will decrease performance, can't be less than MIN_RAYS
 * @param color
 *            color, set to {@code null} to use the default color
 * @param directionDegree
 *            direction in degrees
 */
public DirectionalLight(RayHandler rayHandler, int rays, Color color,
		float directionDegree) {
	
	super(rayHandler, rays, color, Float.POSITIVE_INFINITY, directionDegree);
	
	vertexNum = (vertexNum - 1) * 2;
	start = new Vector2[rayNum];
	end = new Vector2[rayNum];
	for (int i = 0; i < rayNum; i++) {
		start[i] = new Vector2();
		end[i] = new Vector2();
	}
	
	lightMesh = new Mesh(
			VertexDataType.VertexArray, staticLight, vertexNum, 0,
			new VertexAttribute(Usage.Position, 2, "vertex_positions"),
			new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
			new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(
			VertexDataType.VertexArray, staticLight, vertexNum, 0,
			new VertexAttribute(Usage.Position, 2, "vertex_positions"),
			new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
			new VertexAttribute(Usage.Generic, 1, "s"));
	
	update();
}
 
開發者ID:bitbrain,項目名稱:rbcgj-2016,代碼行數:43,代碼來源:DirectionalLight.java

示例6: initVertices

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //導入方法依賴的package包/類
@Override
protected void initVertices() {
    /** STARS **/
    meshes = new MeshData[1];
    curr = new MeshData();
    meshes[0] = curr;

    aux1 = new Vector3();

    maxVertices = 3000000;

    VertexAttribute[] attribs = buildVertexAttributes();
    curr.mesh = new Mesh(false, maxVertices, 0, attribs);

    curr.vertices = new float[maxVertices * (curr.mesh.getVertexAttributes().vertexSize / 4)];
    curr.vertexSize = curr.mesh.getVertexAttributes().vertexSize / 4;
    curr.colorOffset = curr.mesh.getVertexAttribute(Usage.ColorPacked) != null ? curr.mesh.getVertexAttribute(Usage.ColorPacked).offset / 4 : 0;
    pmOffset = curr.mesh.getVertexAttribute(Usage.Tangent) != null ? curr.mesh.getVertexAttribute(Usage.Tangent).offset / 4 : 0;
    additionalOffset = curr.mesh.getVertexAttribute(Usage.Generic) != null ? curr.mesh.getVertexAttribute(Usage.Generic).offset / 4 : 0;

    /** NEBULA **/

    // Max of 5000 nebula clouds
    int maxQuads = 5000;
    int maxQuadVertices = maxQuads * 4;
    int maxQuadIndices = maxQuads * 6;
    quad = new MeshData();

    quad.mesh = new Mesh(false, maxQuadVertices, maxQuadIndices, VertexAttribute.Position(), VertexAttribute.Normal(), VertexAttribute.TexCoords(0), new VertexAttribute(Usage.Generic, 2, "a_additional"));
    quad.vertices = new float[maxQuadVertices * (quad.mesh.getVertexAttributes().vertexSize / 4)];
    quad.vertexSize = quad.mesh.getVertexAttributes().vertexSize / 4;
    quad.indices = new short[maxQuadIndices];
}
 
開發者ID:langurmonkey,項目名稱:gaiasky,代碼行數:34,代碼來源:MilkyWayRenderSystem.java

示例7: PositionalLight

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //導入方法依賴的package包/類
/** 
 * Creates new positional light and automatically adds it to the specified
 * {@link RayHandler} instance.
 * 
 * @param rayHandler
 *            not null instance of RayHandler
 * @param rays
 *            number of rays - more rays make light to look more realistic
 *            but will decrease performance, can't be less than MIN_RAYS
 * @param color
 *            light color
 * @param distance
 *            light distance (if applicable)
 * @param x
 *            horizontal position in world coordinates
 * @param y
 *            vertical position in world coordinates
 * @param directionDegree
 *            direction in degrees (if applicable) 
 */
public PositionalLight(RayHandler rayHandler, int rays, Color color, float distance, float x, float y, float directionDegree) {
	super(rayHandler, rays, color, distance, directionDegree);
	start.x = x;
	start.y = y;

	lightMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum * 2, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	setMesh();
}
 
開發者ID:bitbrain,項目名稱:rbcgj-2016,代碼行數:34,代碼來源:PositionalLight.java


注:本文中的com.badlogic.gdx.graphics.VertexAttributes.Usage.Generic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。