Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.VertexAttribute


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


      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

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

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

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

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

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

   * @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) {
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, 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];

 
View Full Code Here

    }

    final int numAttributes = attributes.size();
    if (locations == null) {
      for (int i = 0; i < numAttributes; i++) {
        final VertexAttribute attribute = attributes.get(i);
        final int location = shader.getAttributeLocation(attribute.alias);
        if (location < 0) continue;
        shader.enableVertexAttribute(location);

        shader.setVertexAttribute(location, attribute.numComponents, attribute.type, attribute.normalized, attributes.vertexSize,
            attribute.offset);
      }
    } else {
      for (int i = 0; i < numAttributes; i++) {
        final VertexAttribute attribute = attributes.get(i);
        final int location = locations[i];
        if (location < 0) continue;
        shader.enableVertexAttribute(location);

        shader.setVertexAttribute(location, attribute.numComponents, attribute.type, attribute.normalized, attributes.vertexSize,
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.