Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.VertexAttribute


      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();
  }
View Full Code Here


    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;
View Full Code Here

    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;
View Full Code Here

   * @param defaultShader the default shader to use. This is not owned by the SpriteBatch and must be disposed separately. */
  public SpriteBatch (int size, int buffers, ShaderProgram defaultShader) {
    this.buffers = new Mesh[buffers];

    for (int i = 0; i < buffers; i++) {
      this.buffers[i] = 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];
 
View Full Code Here

      // write vertex attributes
      writer.newChunk(G3dConstants.VERTEX_ATTRIBUTES);
      writer.writeInt(mesh.mesh.getVertexAttributes().size());
      for (int i = 0; i < mesh.mesh.getVertexAttributes().size(); i++) {
        VertexAttribute attribute = mesh.mesh.getVertexAttributes().get(i);
        writer.newChunk(G3dConstants.VERTEX_ATTRIBUTE);
        writer.writeInt(attribute.usage);
        writer.writeInt(attribute.numComponents);
        writer.writeString(attribute.alias);
        writer.endChunk();
View Full Code Here

  }

  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;
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.VertexAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.