Esempio n. 1
0
 /**
  * Returns the buffer for the attribute at the provided index, or null if none can be found. The
  * buffer is returned filled and ready for reading.
  *
  * @param index The index to lookup
  * @return The attribute buffer, filled and flipped
  */
 public ByteBuffer getAttributeBuffer(int index) {
   final VertexAttribute attribute = getAttribute(index);
   if (attribute == null) {
     return null;
   }
   return attribute.getData();
 }
Esempio n. 2
0
 /**
  * Returns the name of the attribute at the provided index, or null if none can be found.
  *
  * @param index The index to lookup
  * @return The name of the attribute, or null if none can be found
  */
 public String getAttributeName(int index) {
   final VertexAttribute attribute = getAttribute(index);
   if (attribute == null) {
     return null;
   }
   return attribute.getName();
 }
Esempio n. 3
0
 /**
  * Returns the type of the attribute at the provided index, or null if none can be found.
  *
  * @param index The index to lookup
  * @return The type of the attribute, or null if none can be found
  */
 public DataType getAttributeType(int index) {
   final VertexAttribute attribute = getAttribute(index);
   if (attribute == null) {
     return null;
   }
   return attribute.getType();
 }
Esempio n. 4
0
 /**
  * Returns the size of the attribute at the provided index, or -1 if none can be found.
  *
  * @param index The index to lookup
  * @return The size of the attribute, or -1 if none can be found
  */
 public int getAttributeSize(int index) {
   final VertexAttribute attribute = getAttribute(index);
   if (attribute == null) {
     return -1;
   }
   return attribute.getSize();
 }
Esempio n. 5
0
 /**
  * Erweitert die Geometrie um ein Vertexattribut vom Typ GL_FLOAT.
  *
  * @param index Index / Location des Attributs
  * @param size Anzahl der Komponenten des Attributs
  * @param offset Offset im Vertex gemessen in Byte
  */
 public void addVertexAttribute(int index, int size, int offset) {
   VertexAttribute attr = new VertexAttribute();
   attr.index = index;
   attr.size = size;
   attr.offset = offset;
   attributes.add(attr);
 }
Esempio n. 6
0
  private int calculateOffsets() {
    int count = 0;
    for (int i = 0; i < attributes.length; i++) {
      VertexAttribute attribute = attributes[i];
      attribute.offset = count;
      if (attribute.usage == VertexAttributes.Usage.ColorPacked) count += 4;
      else count += 4 * attribute.numComponents;
    }

    return count;
  }
Esempio n. 7
0
 /**
  * Adds an attribute.
  *
  * @param attribute The attribute to add
  */
 public void addAttribute(int index, VertexAttribute attribute) {
   attributes.put(index, attribute);
   nameToIndex.put(attribute.getName(), index);
 }