Package com.badlogic.gdx.graphics

Examples of com.badlogic.gdx.graphics.VertexAttribute


    if (!skinned)
      return true;
    int w = 0;
    final int n = renderable.mesh.getVertexAttributes().size();
    for (int i = 0; i < n; i++) {
      final VertexAttribute attr = renderable.mesh.getVertexAttributes().get(i);
      if (attr.usage == Usage.BoneWeight)
        w |= (1 << attr.unit);
    }
    return w == weights;
  }
View Full Code Here


    // 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);

    this.buffers = new Mesh[buffers];
    for (int i = 0; i < buffers; i++) {
      this.buffers[i] = 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"));
    }
    mesh = this.buffers[0];

    vertices = new float[size * VERTEX_SIZE];
    triangles = new short[size * 3];
 
View Full Code Here

   * @param size The maximum number of images this cache can hold. The memory required to hold the images is allocated up front.
   * @param useIndices If true, indexed geometry will be used. */
  public SpriteCache (int size, ShaderProgram shader, boolean useIndices) {
    this.shader = shader;

    mesh = new Mesh(true, size * (useIndices ? 4 : 6), useIndices ? size * 6 : 0, 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.setAutoBind(false);

    if (useIndices) {
      int length = size * 6;
      short[] indices = new short[length];
View Full Code Here

    int textureUnit = 0;
    int numAttributes = attributes.size();

    for (int i = 0; i < numAttributes; i++) {
      VertexAttribute attribute = attributes.get(i);

      switch (attribute.usage) {
      case Usage.Position:
        gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
        gl.glVertexPointer(attribute.numComponents, GL10.GL_FLOAT, attributes.vertexSize, attribute.offset);
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);
 
        if (attribute.usage == Usage.ColorPacked)
          shader.setVertexAttribute(location, attribute.numComponents, GL20.GL_UNSIGNED_BYTE, true, attributes.vertexSize,
            attribute.offset);
        else
          shader.setVertexAttribute(location, attribute.numComponents, GL20.GL_FLOAT, false, 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);
 
View Full Code Here

    int textureUnit = 0;
    int numAttributes = attributes.size();

    for (int i = 0; i < numAttributes; i++) {

      VertexAttribute attribute = attributes.get(i);
      switch (attribute.usage) {
      case Usage.Position:
        break; // no-op, we also need a position bound in gles
      case Usage.Color:
      case Usage.ColorPacked:
View Full Code Here

    int textureUnit = 0;
    int numAttributes = attributes.size();

    for (int i = 0; i < numAttributes; i++) {
      VertexAttribute attribute = attributes.get(i);

      switch (attribute.usage) {
      case Usage.Position:
        gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
        gl.glVertexPointer(attribute.numComponents, GL10.GL_FLOAT, attributes.vertexSize, attribute.offset);
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);
 
        if (attribute.usage == Usage.ColorPacked)
          shader.setVertexAttribute(location, attribute.numComponents, GL20.GL_UNSIGNED_BYTE, true, attributes.vertexSize,
            attribute.offset);
        else
          shader.setVertexAttribute(location, attribute.numComponents, GL20.GL_FLOAT, false, 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);
 
View Full Code Here

    int textureUnit = 0;
    int numAttributes = attributes.size();

    for (int i = 0; i < numAttributes; i++) {

      VertexAttribute attribute = attributes.get(i);
      switch (attribute.usage) {
      case Usage.Position:
        break; // no-op, we also need a position bound in gles
      case Usage.Color:
      case Usage.ColorPacked:
View Full Code Here

    int numAttributes = attributes.size();

    byteBuffer.limit(buffer.limit() * 4);

    for (int i = 0; i < numAttributes; i++) {
      VertexAttribute attribute = attributes.get(i);

      switch (attribute.usage) {
      case Usage.Position:
        byteBuffer.position(attribute.offset);
        gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
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.