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


Java Usage.TextureCoordinates方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.VertexAttributes.Usage.TextureCoordinates方法的典型用法代码示例。如果您正苦于以下问题:Java Usage.TextureCoordinates方法的具体用法?Java Usage.TextureCoordinates怎么用?Java Usage.TextureCoordinates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.VertexAttributes.Usage的用法示例。


在下文中一共展示了Usage.TextureCoordinates方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
@Override
public void create() {
	
        rotationSpeed = 0.5f;
        mesh = new Mesh(true, 4, 6,
                        new VertexAttribute(VertexAttributes.Usage.Position, 3,"attr_Position"),
                        new VertexAttribute(Usage.TextureCoordinates, 2, "attr_texCoords"));
        texture = new Texture(Gdx.files.internal("data/Jellyfish.jpg"));
        mesh.setVertices(new float[] { 
                         -1024f, -1024f, 0, 0, 1,
                          1024f, -1024f, 0, 1, 1,
                          1024f,  1024f, 0, 1, 0,
                         -1024f,  1024f, 0, 0, 0
        });
        mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0 });

        cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());            
        xScale = Gdx.graphics.getWidth()/(float)TARGET_WIDTH;
        yScale = Gdx.graphics.getHeight()/(float)TARGET_HEIGHT;
        font = loadBitmapFont("default.fnt", "default.png");
        scale = Math.min(xScale, yScale);
        cam.zoom = 1/scale;
      //  cam.project(start_position);
        cam.position.set(0, 0, 0);
        batch = new SpriteBatch();
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:27,代码来源:TestCamera.java

示例2: ShaderEffect

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
/**
 * Instantiates a new ShaderEffect. The ShaderEffect will NOT own shader
 * program, so it will not dispose it either!
 * 
 * @param program
 *            the ShaderProgram to use for this effect
 */
public ShaderEffect(ShaderProgram program) {
	this.program = program;

	if (meshRefCount++ <= 0) {
		mesh = new Mesh(VertexDataType.VertexArray, true, 4, 0,
				new VertexAttribute(Usage.Position, 2, ShaderProgram.POSITION_ATTRIBUTE),
				new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));

		// @formatter:off
		float[] verts = {
				// vertex    texture
				  -1, -1,    0f, 0f,
				   1, -1,    1f, 0f,
				   1,  1,    1f, 1f,
				  -1,  1,    0f, 1f,
		};
		// @formatter:on

		mesh.setVertices(verts);
	}
}
 
开发者ID:spookygames,项目名称:gdx-gfx,代码行数:29,代码来源:ShaderEffect.java

示例3: createAttributes

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
/** @param usage bitwise mask of the {@link com.badlogic.gdx.graphics.VertexAttributes.Usage}, only Position, Color, Normal and
 *           TextureCoordinates is supported. */
public static VertexAttributes createAttributes (long usage) {
	final Array<VertexAttribute> attrs = new Array<VertexAttribute>();
	if ((usage & Usage.Position) == Usage.Position)
		attrs.add(new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE));
	if ((usage & Usage.Color) == Usage.Color) attrs.add(new VertexAttribute(Usage.Color, 4, ShaderProgram.COLOR_ATTRIBUTE));
	if ((usage & Usage.ColorPacked) == Usage.ColorPacked)
		attrs.add(new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE));
	if ((usage & Usage.Normal) == Usage.Normal)
		attrs.add(new VertexAttribute(Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE));
	if ((usage & Usage.TextureCoordinates) == Usage.TextureCoordinates)
		attrs.add(new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));
	final VertexAttribute attributes[] = new VertexAttribute[attrs.size];
	for (int i = 0; i < attributes.length; i++)
		attributes[i] = attrs.get(i);
	return new VertexAttributes(attributes);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:19,代码来源:MeshBuilder.java

示例4: PolygonSpriteBatch

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
/** Constructs a new PolygonSpriteBatch. Sets the projection matrix to an orthographic projection with y-axis point upwards,
 * x-axis point to the right and the origin being in the bottom left corner of the screen. The projection will be pixel perfect
 * with respect to the current screen resolution.
 * <p>
 * The defaultShader specifies the shader to use. Note that the names for uniforms for this default shader are different than
 * the ones expect for shaders set with {@link #setShader(ShaderProgram)}. See {@link SpriteBatch#createDefaultShader()}.
 * @param size The max number of vertices and number of triangles in a single batch. Max of 10920.
 * @param defaultShader The default shader to use. This is not owned by the PolygonSpriteBatch and must be disposed separately. */
public PolygonSpriteBatch (int size, ShaderProgram defaultShader) {
	// 32767 is max index, so 32767 / 3 - (32767 / 3 % 3) = 10920.
	if (size > 10920) throw new IllegalArgumentException("Can't have more than 10920 triangles per batch: " + size);

	mesh = new Mesh(VertexDataType.VertexArray, false, size, size * 3, new VertexAttribute(Usage.Position, 2,
		ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE),
		new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));

	vertices = new float[size * VERTEX_SIZE];
	triangles = new short[size * 3];

	if (defaultShader == null) {
		shader = SpriteBatch.createDefaultShader();
		ownsShader = true;
	} else
		shader = defaultShader;

	projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:28,代码来源:PolygonSpriteBatch.java

示例5: create

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
@Override
public void create () {
	mesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(Usage.ColorPacked, 4,
		"a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
	float c1 = Color.toFloatBits(255, 0, 0, 255);
	float c2 = Color.toFloatBits(255, 0, 0, 255);
	float c3 = Color.toFloatBits(0, 0, 255, 255);

	mesh.setVertices(new float[] {-0.5f, -0.5f, 0, c1, 0, 0, 0.5f, -0.5f, 0, c2, 1, 0, 0, 0.5f, 0, c3, 0.5f, 1});

	stencilMesh = new Mesh(true, 3, 0, new VertexAttribute(Usage.Position, 3, "a_Position"), new VertexAttribute(
		Usage.ColorPacked, 4, "a_Color"), new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoords"));
	stencilMesh.setVertices(new float[] {-0.5f, 0.5f, 0, c1, 0, 0, 0.5f, 0.5f, 0, c2, 1, 0, 0, -0.5f, 0, c3, 0.5f, 1});

	texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));

	spriteBatch = new SpriteBatch();
	frameBuffer = new FrameBuffer(Format.RGB565, 128, 128, false);
	stencilFrameBuffer = new FrameBuffer(Format.RGB565, 128, 128, false, true);
	createShader(Gdx.graphics);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:22,代码来源:FrameBufferTest.java

示例6: init

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
private void init(String tex0, float w, float h) {
    setTexture0(tex0);

    // Init comparator
    comp = new DistToCameraComparator<IRenderable>();
    // Init vertices
    float[] vertices = new float[20];
    fillVertices(vertices, w, h);

    // We wont need indices if we use GL_TRIANGLE_FAN to draw our quad
    // TRIANGLE_FAN will draw the verts in this order: 0, 1, 2; 0, 2, 3
    mesh = new Mesh(VertexDataType.VertexArray, true, 4, 6, new VertexAttribute(Usage.Position, 2, ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE), new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));

    mesh.setVertices(vertices, 0, vertices.length);
    mesh.getIndicesBuffer().position(0);
    mesh.getIndicesBuffer().limit(6);

    short[] indices = new short[] { 0, 1, 2, 0, 2, 3 };
    mesh.setIndices(indices);

    quaternion = new Quaternion();
    aux = new Vector3();

}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:25,代码来源:BillboardStarRenderSystem.java

示例7: StaticPlaneSimulationObject

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
public StaticPlaneSimulationObject(Vector3 planeNormal, float planeConstant, float friction, int width, int height,
        Texture texture, boolean disposeTexture)
{
    super();

    this.texture = texture;
    this.disposeTexture = disposeTexture;

    this.mesh = new Mesh(true, 4, 6, new VertexAttribute(Usage.Position, 3, "position"), new VertexAttribute(
            Usage.TextureCoordinates, 2, "texture"));

    this.mesh.setVertices(new float[] {
            // Bottom left, tex
            -width / 2f, -height / 2f, 0, 0, 0,
            // Bottom right, tex
            width / 2f, -height / 2f, 0, width, 0,
            // Top right, tex
            width / 2f, height / 2f, 0, width, height,
            // Top left, tex
            -width / 2f, height / 2f, 0, 0, height });
    this.mesh.setIndices(new short[] { 0, 1, 2, 0, 3, 2 });

    this.staticPlaneShape = new btStaticPlaneShape(planeNormal, planeConstant);

    initialize(this.staticPlaneShape, 0, -1, DEFAULT_START_TRANSFORM);
}
 
开发者ID:sterwill,项目名称:gdx-bullet-demos,代码行数:27,代码来源:StaticPlaneSimulationObject.java

示例8: DrawingBatch

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
/**
 * Create a new DrawingBatch
 *
 * @param size          - the size of the batch
 * @param shader        - the shader program to use
 * @param disposeShader - should the batch dispose the shader when it disposes
 */
public DrawingBatch(int size, ShaderProgram shader, boolean disposeShader) {
    //8191 max size
    if (size > 8191) throw new IllegalArgumentException("Can't have more than 8191 sprites per batch: " + size);
    
    this.shader = shader;
    this.disposeShader = disposeShader;
    
    //aliases reference variables in basic.vertex.glsl
    mesh = new Mesh(false, size * 4, size * 6,
                    new VertexAttribute(Usage.Position, 2, "a_position"),
                    new VertexAttribute(Usage.TextureCoordinates, 2, "a_texCoord0"),
                    new VertexAttribute(Usage.ColorPacked, 4, "a_multTint"),
                    new VertexAttribute(Usage.ColorPacked, 4, "a_addTint"));
    
    //4 bytes per type @ 2 vals per position, 1 val per color, 2 val per coordinate, and 2 vals for both tints together
    verticies = new float[size * (4 * (2 + 2 + 1 + 1))];
    
    int     len     = size * 6;
    short[] indices = new short[len];
    short   j       = 0;
    for (int i = 0; i < len; i += 6, j += 4) {
        indices[i] = j;
        indices[i + 1] = (short) (j + 1);
        indices[i + 2] = (short) (j + 2);
        indices[i + 3] = (short) (j + 2);
        indices[i + 4] = (short) (j + 3);
        indices[i + 5] = j;
    }
    mesh.setIndices(indices);
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:38,代码来源:DrawingBatch.java

示例9: createFullScreenQuad

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
private Mesh createFullScreenQuad() {
	float[] verts = new float[16];// VERT_SIZE
	int i = 0;
	verts[i++] = -1; // x1
	verts[i++] = -1; // y1

	verts[i++] = 0f; // u1
	verts[i++] = 0f; // v1

	verts[i++] = 1f; // x2
	verts[i++] = -1; // y2

	verts[i++] = 1f; // u2
	verts[i++] = 0f; // v2

	verts[i++] = 1f; // x3
	verts[i++] = 1f; // y2

	verts[i++] = 1f; // u3
	verts[i++] = 1f; // v3

	verts[i++] = -1; // x4
	verts[i++] = 1f; // y4

	verts[i++] = 0f; // u4
	verts[i++] = 1f; // v4

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

	tmpMesh.setVertices(verts);
	return tmpMesh;

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:36,代码来源:Bloom.java

示例10: createLightMapMesh

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
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;

}
 
开发者ID:bitbrain,项目名称:rbcgj-2016,代码行数:37,代码来源:LightMap.java

示例11: FontBatch

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
/** Constructs a new SpriteBatch. Sets the projection matrix to an orthographic projection with y-axis point upwards, x-axis
 * point to the right and the origin being in the bottom left corner of the screen. The projection will be pixel perfect with
 * respect to the current screen resolution.
 * <p>
 * The defaultShader specifies the shader to use. Note that the names for uniforms for this default shader are different than
 * the ones expect for shaders set with {@link #setShader(ShaderProgram)}. See {@link #createDefaultShader()}.
 * @param size The max number of sprites in a single batch. Max of 5460.
 * @param defaultShader The default shader to use. This is not owned by the SpriteBatch and must be disposed separately. */
public FontBatch (int size, ShaderProgram defaultShader) {
	this.vertexsize = size;
	size = 1000;
	// 32767 is max index, so 32767 / 6 - (32767 / 6 % 3) = 5460.
	if (size > 5460) throw new IllegalArgumentException("Can't have more than 5460 sprites per batch: " + size);

	Mesh.VertexDataType vertexDataType = Mesh.VertexDataType.VertexArray;
	if (Gdx.gl30 != null) {
		vertexDataType = Mesh.VertexDataType.VertexBufferObjectWithVAO;
	}
	mesh = new Mesh(vertexDataType, false, size * 4, size * 6, new VertexAttribute(Usage.Position, vertexsize-3,
		ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE),
		new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));

	projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

	vertices = new float[size * 4*vertexsize];

	int len = size * 6;
	short[] indices = new short[len];
	short j = 0;
	for (int i = 0; i < len; i += 6, j += 4) {
		indices[i] = j;
		indices[i + 1] = (short)(j + 1);
		indices[i + 2] = (short)(j + 2);
		indices[i + 3] = (short)(j + 2);
		indices[i + 4] = (short)(j + 3);
		indices[i + 5] = j;
	}
	mesh.setIndices(indices);

	if (defaultShader == null) {
		shader = createDefaultShader();
		ownsShader = true;
	} else
		shader = defaultShader;
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:46,代码来源:FontBatch.java

示例12: createFullscreenQuad

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
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;
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:34,代码来源:FullscreenQuad.java

示例13: create

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
@Override
public void create () {
	super.create();

	final Texture texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
	disposables.add(texture);
	final Material material = new Material(TextureAttribute.createDiffuse(texture), ColorAttribute.createSpecular(1, 1, 1, 1),
		FloatAttribute.createShininess(8f));
	final long attributes = Usage.Position | Usage.Normal | Usage.TextureCoordinates;

	final Model sphere = modelBuilder.createSphere(4f, 4f, 4f, 24, 24, material, attributes);
	disposables.add(sphere);
	world.addConstructor("sphere", new BulletConstructor(sphere, 10f, new btSphereShape(2f)));

	final Model cylinder = modelBuilder.createCylinder(4f, 6f, 4f, 16, material, attributes);
	disposables.add(cylinder);
	world.addConstructor("cylinder", new BulletConstructor(cylinder, 10f, new btCylinderShape(tmpV1.set(2f, 3f, 2f))));

	final Model capsule = modelBuilder.createCapsule(2f, 6f, 16, material, attributes);
	disposables.add(capsule);
	world.addConstructor("capsule", new BulletConstructor(capsule, 10f, new btCapsuleShape(2f, 2f)));

	final Model box = modelBuilder.createBox(4f, 4f, 2f, material, attributes);
	disposables.add(box);
	world.addConstructor("box2", new BulletConstructor(box, 10f, new btBoxShape(tmpV1.set(2f, 2f, 1f))));

	final Model cone = modelBuilder.createCone(4f, 6f, 4f, 16, material, attributes);
	disposables.add(cone);
	world.addConstructor("cone", new BulletConstructor(cone, 10f, new btConeShape(2f, 6f)));

	// Create the entities
	world.add("ground", 0f, 0f, 0f).setColor(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(),
		0.25f + 0.5f * (float)Math.random(), 1f);
	world.add("sphere", 0, 5, 5);
	world.add("cylinder", 5, 5, 0);
	world.add("box2", 0, 5, 0);
	world.add("capsule", 5, 5, 5);
	world.add("cone", 10, 5, 0);
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:40,代码来源:BasicShapesTest.java

示例14: createFullscreenQuad

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
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;
}
 
开发者ID:bitbrain,项目名称:braingdx,代码行数:35,代码来源:FullscreenQuad.java

示例15: SpriteBatch

import com.badlogic.gdx.graphics.VertexAttributes.Usage; //导入方法依赖的package包/类
/** Constructs a new SpriteBatch. Sets the projection matrix to an orthographic projection with y-axis point upwards, x-axis
 * point to the right and the origin being in the bottom left corner of the screen. The projection will be pixel perfect with
 * respect to the current screen resolution.
 * <p>
 * The defaultShader specifies the shader to use. Note that the names for uniforms for this default shader are different than
 * the ones expect for shaders set with {@link #setShader(ShaderProgram)}. See {@link #createDefaultShader()}.
 * @param size The max number of sprites in a single batch. Max of 5460.
 * @param defaultShader The default shader to use. This is not owned by the SpriteBatch and must be disposed separately. */
public SpriteBatch (int size, ShaderProgram defaultShader) {
	// 32767 is max index, so 32767 / 6 - (32767 / 6 % 3) = 5460.
	if (size > 5460) throw new IllegalArgumentException("Can't have more than 5460 sprites per batch: " + size);

	mesh = new Mesh(VertexDataType.VertexArray, false, size * 4, size * 6, new VertexAttribute(Usage.Position, 2,
		ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE),
		new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));

	projectionMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

	vertices = new float[size * Sprite.SPRITE_SIZE];

	int len = size * 6;
	short[] indices = new short[len];
	short j = 0;
	for (int i = 0; i < len; i += 6, j += 4) {
		indices[i] = j;
		indices[i + 1] = (short)(j + 1);
		indices[i + 2] = (short)(j + 2);
		indices[i + 3] = (short)(j + 2);
		indices[i + 4] = (short)(j + 3);
		indices[i + 5] = j;
	}
	mesh.setIndices(indices);

	if (defaultShader == null) {
		shader = createDefaultShader();
		ownsShader = true;
	} else
		shader = defaultShader;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:40,代码来源:SpriteBatch.java


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