Java Code Examples for com.badlogic.gdx.graphics.VertexAttributes.Usage#TextureCoordinates

The following examples show how to use com.badlogic.gdx.graphics.VertexAttributes.Usage#TextureCoordinates . 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: FullscreenQuad.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
private Mesh createFullscreenQuad () {
	// vertex coord
	verts[X1] = -1;
	verts[Y1] = -1;

	verts[X2] = 1;
	verts[Y2] = -1;

	verts[X3] = 1;
	verts[Y3] = 1;

	verts[X4] = -1;
	verts[Y4] = 1;

	// tex coords
	verts[U1] = 0f;
	verts[V1] = 0f;

	verts[U2] = 1f;
	verts[V2] = 0f;

	verts[U3] = 1f;
	verts[V3] = 1f;

	verts[U4] = 0f;
	verts[V4] = 1f;

	Mesh tmpMesh = new Mesh(VertexDataType.VertexArray, true, 4, 0, new VertexAttribute(Usage.Position, 2, "a_position"),
		new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoord0"));

	tmpMesh.setVertices(verts);
	return tmpMesh;
}
 
Example 2
Source File: G3dtLoader.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
private static VertexAttribute[] createVertexAttributes (boolean hasNormals, int uvs) {
	VertexAttribute[] attributes = new VertexAttribute[1 + (hasNormals ? 1 : 0) + uvs];
	int idx = 0;
	attributes[idx++] = new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE);
	if (hasNormals) attributes[idx++] = new VertexAttribute(Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE);
	for (int i = 0; i < uvs; i++) {
		attributes[idx++] = new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + i);
	}
	return attributes;
}
 
Example 3
Source File: LightMap.java    From uracer-kotd with Apache License 2.0 5 votes vote down vote up
private Mesh createLightMapMesh() {
	// vertex coord
	verts[X1] = -1;
	verts[Y1] = -1;

	verts[X2] = 1;
	verts[Y2] = -1;

	verts[X3] = 1;
	verts[Y3] = 1;

	verts[X4] = -1;
	verts[Y4] = 1;

	// tex coords
	verts[U1] = 0f;
	verts[V1] = 0f;

	verts[U2] = 1f;
	verts[V2] = 0f;

	verts[U3] = 1f;
	verts[V3] = 1f;

	verts[U4] = 0f;
	verts[V4] = 1f;

	Mesh tmpMesh = new Mesh( true, 4, 0, new VertexAttribute( Usage.Position, 2, "a_position" ), new VertexAttribute(
			Usage.TextureCoordinates, 2, "a_texCoord" ) );

	tmpMesh.setVertices( verts );
	return tmpMesh;

}
 
Example 4
Source File: LightMap.java    From box2dlights with Apache License 2.0 5 votes vote down vote up
private Mesh createLightMapMesh() {
	float[] verts = new float[VERT_SIZE];
	// vertex coord
	verts[X1] = -1;
	verts[Y1] = -1;

	verts[X2] = 1;
	verts[Y2] = -1;

	verts[X3] = 1;
	verts[Y3] = 1;

	verts[X4] = -1;
	verts[Y4] = 1;

	// tex coords
	verts[U1] = 0f;
	verts[V1] = 0f;

	verts[U2] = 1f;
	verts[V2] = 0f;

	verts[U3] = 1f;
	verts[V3] = 1f;

	verts[U4] = 0f;
	verts[V4] = 1f;

	Mesh tmpMesh = new Mesh(true, 4, 0, new VertexAttribute(
			Usage.Position, 2, "a_position"), new VertexAttribute(
			Usage.TextureCoordinates, 2, "a_texCoord"));

	tmpMesh.setVertices(verts);
	return tmpMesh;

}
 
Example 5
Source File: FullscreenQuad.java    From RuinsOfRevenge with MIT License 5 votes vote down vote up
private Mesh createFullscreenQuad() {
	// vertex coord
	verts[X1] = -1;
	verts[Y1] = -1;

	verts[X2] = 1;
	verts[Y2] = -1;

	verts[X3] = 1;
	verts[Y3] = 1;

	verts[X4] = -1;
	verts[Y4] = 1;

	// tex coords
	verts[U1] = 0f;
	verts[V1] = 0f;

	verts[U2] = 1f;
	verts[V2] = 0f;

	verts[U3] = 1f;
	verts[V3] = 1f;

	verts[U4] = 0f;
	verts[V4] = 1f;

	Mesh tmpMesh = new Mesh( VertexDataType.VertexArray, true, 4, 0, new VertexAttribute( Usage.Position, 2, "a_position" ),
			new VertexAttribute( Usage.TextureCoordinates, 2, "a_texCoord0" ) );

	tmpMesh.setVertices( verts );
	return tmpMesh;
}
 
Example 6
Source File: ViewportQuadMesh.java    From gdx-vfx with Apache License 2.0 4 votes vote down vote up
public ViewportQuadMesh() {
	this(new VertexAttribute(Usage.Position, 2, "a_position"),
			new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoord0"));
}