|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthmi.xml.XMLStructureAdapter
hmi.graphics.scenegraph.VertexAttribute
public class VertexAttribute
A VertexAttribute defines the data for a single mesh vertex attribute, which can be either a predefined OpenGL attribute or a user-defined GLSL attribute. A VertexAttribute can be indexed data, in which case the index is specific for this VertexAttribute. (The alternative is to maintain a common index in GMesh, in which case the VertexData-specific index is removed, by means of the deindexify method. The plain vertex data is kept in an float array; the actual list size is are returned by the getVertexDataSize method (less then or equal to the the physical vertexData array length) A single attribute value will (usually) occupy between 1 and 4 floats. The actual number is kept as the attributeValueSize. The number of distinct attribute values is returned by getNrOfValues(). It is by definition equal to vertexDataSize/attributeValueSize; The index data is kept in an int array, where the list size is returned by getNrOfIndices(), which is less than or equal to the physical length of the int array returned by getIndices(). The vertexData and indexData arrays can be set directly, or thay can be modified via the addAttributeValuef* and addIndex methods. (These methods take care of allocating and (if necessary) resizing the data arrays.)
| Field Summary | |
|---|---|
private int |
attributeValueSize
|
private static int |
DATAITEMSPERLINE
|
private int[] |
indexData
|
private int |
indexDataSize
|
private static int |
INDICESPERLINE
|
private String |
name
|
private static boolean |
showVertexAttributeData
|
private float[] |
vertexData
|
private int |
vertexDataSize
|
private static String |
XMLTAG
|
| Fields inherited from class hmi.xml.XMLStructureAdapter |
|---|
ATTRIBUTE_TOKEN_DELIMITERS, COMMA_SEPARATOR, DECODEDARRAYSIZE, DEFAULT_RECOVER_MODE, NEWLINE, SYSTEMNEWLINE, TAB, TAB_STRING |
| Constructor Summary | |
|---|---|
VertexAttribute()
|
|
VertexAttribute(String name)
The constructor, defining the attribute name. |
|
VertexAttribute(String name,
int attributeValueSize)
The constructor, defining the attribute name and the size of a single attribute value, in number of floats. |
|
VertexAttribute(String name,
int attributeValueSize,
float[] vertexData)
The constructor, defining the attribute name and the size of a single attribute value, in number of floats. |
|
VertexAttribute(String name,
int attributeValueSize,
float[] vertexData,
int[] indexData)
The constructor, defining the attribute name and the size of a single attribute value, in number of floats. |
|
VertexAttribute(XMLTokenizer tokenizer)
|
|
| Method Summary | |
|---|---|
void |
addAttributeValue1f(float x)
Add a single float to the vertexData array; |
void |
addAttributeValue2f(float x,
float y)
Add a two floats to the vertexData array; |
void |
addAttributeValue3f(float x,
float y,
float z)
Add a three floats to the vertexData array; |
void |
addAttributeValue4f(float x,
float y,
float z,
float w)
Add a four floats to the vertexData array; |
void |
addIndex(int idx)
Add an index to the indexData array; |
void |
affineTransform(float[] mat4X4)
Transforms the attribute values, using the specified 4x4 matrix. |
StringBuilder |
appendAttributeString(StringBuilder buf,
XMLFormatting fmt)
appends the attributes to buf. |
StringBuilder |
appendContent(StringBuilder buf,
XMLFormatting fmt)
Appends the attribute values to an XML encoding |
void |
decodeAttributes(HashMap<String,String> attrMap,
XMLTokenizer tokenizer)
decodes the attributes. |
void |
decodeContent(XMLTokenizer tokenizer)
Decodes the attribute values from an XML encoding |
private void |
ensureIndexDataArraySize(int requestedSize)
|
private void |
ensureVertexDataArraySize(int requestedSize)
|
int |
getAttributeValueSize()
Returns the attribute value size. |
int[] |
getIndexData()
Returns the indexData array. |
String |
getName()
Returns the attribute name |
int |
getNrOfIndices()
Returns the number of indices, that is, size of the indexData. (<= indexData.length) |
int |
getNrOfValues()
Returns the number of vertex data values, that is, vertexDataSize / attributeValueSize |
float[] |
getVertexData()
Returns the vertexData array. |
int |
getVertexDataSize()
Returns the size of the vertexData. (<= vertexData.length) |
String |
getXMLTag()
returns the XML Stag for XML encoding |
boolean |
hasIndex()
Returns true iff this VertexAttribute has (attribute-specific) index data. |
void |
linearTransform(float[] mat3X3)
Transforms the attribute values, using the specified 3x3 matrix. |
void |
readBinary(DataInput dataIn)
|
protected void |
remapData(int nrOfDistinctVertices,
int[] map)
|
void |
setAttributeValueSize(int attributeValueSize)
Sets the attribute value size |
void |
setIndexData(int[] indexData)
Sets the indexData array. |
static void |
setShowVertexAttributeData(boolean show)
|
void |
setVertexData(float[] vertexData)
Sets the vertexData array. |
static boolean |
showVertexAttributeData()
|
String |
toString()
appends the id and sid XML attributes to buf. |
void |
writeBinary(DataOutput dataOut)
|
static String |
xmlTag()
The XML Stag for XML encoding |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private String name
private float[] vertexData
private int vertexDataSize
private int indexDataSize
private int[] indexData
private int attributeValueSize
private static boolean showVertexAttributeData
private static final int DATAITEMSPERLINE
private static final int INDICESPERLINE
private static final String XMLTAG
| Constructor Detail |
|---|
public VertexAttribute()
public VertexAttribute(String name)
public VertexAttribute(String name,
int attributeValueSize)
public VertexAttribute(String name,
int attributeValueSize,
float[] vertexData)
public VertexAttribute(String name,
int attributeValueSize,
float[] vertexData,
int[] indexData)
public VertexAttribute(XMLTokenizer tokenizer)
throws IOException
IOException| Method Detail |
|---|
public String getName()
public int getAttributeValueSize()
public void setAttributeValueSize(int attributeValueSize)
public void setVertexData(float[] vertexData)
public float[] getVertexData()
public int getVertexDataSize()
public int getNrOfValues()
public void setIndexData(int[] indexData)
public void addIndex(int idx)
public boolean hasIndex()
public int[] getIndexData()
public int getNrOfIndices()
public void addAttributeValue1f(float x)
public void addAttributeValue2f(float x,
float y)
public void addAttributeValue3f(float x,
float y,
float z)
public void addAttributeValue4f(float x,
float y,
float z,
float w)
private void ensureVertexDataArraySize(int requestedSize)
private void ensureIndexDataArraySize(int requestedSize)
protected void remapData(int nrOfDistinctVertices,
int[] map)
public void affineTransform(float[] mat4X4)
public void linearTransform(float[] mat3X3)
public String toString()
toString in class XMLStructureAdapterpublic static void setShowVertexAttributeData(boolean show)
public static boolean showVertexAttributeData()
public StringBuilder appendAttributeString(StringBuilder buf,
XMLFormatting fmt)
appendAttributeString in class XMLStructureAdapter
public void decodeAttributes(HashMap<String,String> attrMap,
XMLTokenizer tokenizer)
decodeAttributes in class XMLStructureAdapter
public StringBuilder appendContent(StringBuilder buf,
XMLFormatting fmt)
appendContent in class XMLStructureAdapter
public void decodeContent(XMLTokenizer tokenizer)
throws IOException
decodeContent in class XMLStructureAdapterIOExceptionpublic static String xmlTag()
public String getXMLTag()
getXMLTag in interface XMLStructuregetXMLTag in class XMLStructureAdapter
public void writeBinary(DataOutput dataOut)
throws IOException
IOException
public void readBinary(DataInput dataIn)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||