hmi.graphics.scenegraph
Class GMaterial

java.lang.Object
  extended by hmi.xml.XMLStructureAdapter
      extended by hmi.graphics.scenegraph.GMaterial
All Implemented Interfaces:
XMLStructure

public class GMaterial
extends XMLStructureAdapter

A GMaterial defines the appearance, or material, for some GMesh Currently, this is just basic OpenGL material settings, like the ambient, diffus and specular color, and the specular shininess.

Author:
Job Zwiers

Field Summary
private  float[] ambientColor
           
private  float[] diffuseColor
           
private  GTexture diffuseTexture
           
private  float[] emissionColor
           
private static int LIGHT_ATTRIBUTE_SIZE
           
private  String name
          The name of the material
private  float offsetS
           
private  float offsetT
           
private  String opaqueMode
           
private  float repeatS
           
private  boolean repeatSettingsTransferred
           
private  float repeatT
           
private  String shader
           
private  float shininess
           
private  float[] specularColor
           
private  boolean transparencyEnabled
           
private  GTexture transparentTexture
           
private static String XMLTAG
          The XML Stag for XML encoding
 
Fields inherited from class hmi.xml.XMLStructureAdapter
ATTRIBUTE_TOKEN_DELIMITERS, COMMA_SEPARATOR, DECODEDARRAYSIZE, DEFAULT_RECOVER_MODE, NEWLINE, SYSTEMNEWLINE, TAB, TAB_STRING
 
Constructor Summary
GMaterial()
           
GMaterial(String name)
           
GMaterial(XMLTokenizer tokenizer)
           
 
Method Summary
 StringBuilder appendAttributeString(StringBuilder buf, XMLFormatting fmt)
          appends the XML attributes to buf.
 StringBuilder appendContent(StringBuilder buf, XMLFormatting fmt)
          Appends a String to buf that encodes the contents for the XML encoding.
 void decodeAttributes(HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          decodes the XML attributes.
 void decodeContent(XMLTokenizer tokenizer)
          decodes the XML contents, i.e. the XML between the STag and ETag of the encoding.
 float[] getAmbientColor()
           
 float[] getDiffuseColor()
           
 GTexture getDiffuseTexture()
           
 float[] getEmissionColor()
           
 String getName()
           
 float getOffsetS()
          Returns the offset for the S coordinate
 float getOffsetT()
          Returns the offset for the T coordinate
 String getOpaqueMode()
           
 float getRepeatS()
          Returns the repeat factor for the S coordinate
 float getRepeatT()
          Returns the repeat factor for the T coordinate
 String getShader()
           
 float getShininess()
           
 float[] getSpecularColor()
           
 GTexture getTransparentTexture()
           
 String getXMLTag()
          returns the XML Stag for XML encoding
 boolean hasContent()
          returns whether the XML encoding should have an contents part, or should be an empty element tag.
 boolean isTransparencyEnabled()
           
 void readBinary(DataInput dataIn)
           
 void setAmbientColor(float[] ambientColor)
           
 void setDiffuseColor(float[] diffuseColor)
           
 void setDiffuseTexture(GTexture texture)
           
 void setEmissionColor(float[] emissionColor)
           
 void setName(String name)
           
 void setOpaqueMode(String opaqueMode)
           
 void setShader(String shader)
           
 void setShininess(float shininess)
           
 void setSpecularColor(float[] specularColor)
           
 void setTransparencyEnabled(boolean mode)
           
 void setTransparentTexture(GTexture texture)
           
 String transferRepeatSettings(GTexture gtex)
           
 void writeBinary(DataOutput dataOut)
           
static String xmlTag()
          The XML Stag for XML encoding of this Class
 
Methods inherited from class hmi.xml.XMLStructureAdapter
appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttributes, appendAttributes, appendAttributeString, appendBooleans, appendCloseEmptyTag, appendCloseSTag, appendComment, appendContent, appendDoubleElement, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendETag, appendETag, appendFloatArrayElement, appendFloatElement, appendFloats, appendIntArrayElement, appendIntElement, appendInts, appendLongElement, appendNewLine, appendNewLine, appendNewLine, appendOpenSTag, appendOptionalDoubleElement, appendOptionalFloatElement, appendOptionalIntElement, appendOptionalLongElement, appendSpaces, appendSpaces, appendSTag, appendSTag, appendSTag, appendStringArrayElement, appendStrings, appendSystemNewLine, appendTab, appendTextElement, appendXML, appendXML, appendXML, appendXML, appendXML, appendXMLStructure, appendXMLStructureList, appendXMLTextElementList, countTokens, countTokens, decodeAttribute, decodeAttribute, decodeBoolean, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeDouble, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeFloat, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeInt, decodeIntArray, decodeIntArray, decodeIntArray, decodeIntArray, decodeLong, decodeStringArray, decodeStringArray, decodeStringArray, decodeStringArray, decodeXMLStructureList, decodeXMLValueElement, getNamespace, getOptionalAttribute, getOptionalAttribute, getOptionalBooleanAttribute, getOptionalDoubleAttribute, getOptionalFloatAttribute, getOptionalIntAttribute, getOptionalLongAttribute, getRequiredAttribute, getRequiredBooleanAttribute, getRequiredDoubleAttribute, getRequiredFloatAttribute, getRequiredIntAttribute, getRequiredLongAttribute, getTagLine, parseXMLElement, postProcess, preProcess, readXML, readXML, readXML, setConsoleAttributeEnabled, setDefaultRecoverMode, setRecoverMode, spaces, toString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, writeXML, writeXML, writeXML, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private String name
The name of the material


emissionColor

private float[] emissionColor

ambientColor

private float[] ambientColor

diffuseColor

private float[] diffuseColor

specularColor

private float[] specularColor

shininess

private float shininess

shader

private String shader

diffuseTexture

private GTexture diffuseTexture

transparentTexture

private GTexture transparentTexture

opaqueMode

private String opaqueMode

transparencyEnabled

private boolean transparencyEnabled

repeatS

private float repeatS

repeatT

private float repeatT

offsetS

private float offsetS

offsetT

private float offsetT

repeatSettingsTransferred

private boolean repeatSettingsTransferred

LIGHT_ATTRIBUTE_SIZE

private static final int LIGHT_ATTRIBUTE_SIZE
See Also:
Constant Field Values

XMLTAG

private static final String XMLTAG
The XML Stag for XML encoding

See Also:
Constant Field Values
Constructor Detail

GMaterial

public GMaterial()

GMaterial

public GMaterial(String name)

GMaterial

public GMaterial(XMLTokenizer tokenizer)
          throws IOException
Throws:
IOException
Method Detail

setName

public void setName(String name)

getName

public String getName()

setShader

public void setShader(String shader)

getShader

public String getShader()

setEmissionColor

public void setEmissionColor(float[] emissionColor)

getEmissionColor

public float[] getEmissionColor()

setAmbientColor

public void setAmbientColor(float[] ambientColor)

getAmbientColor

public float[] getAmbientColor()

setDiffuseColor

public void setDiffuseColor(float[] diffuseColor)

getDiffuseColor

public float[] getDiffuseColor()

setSpecularColor

public void setSpecularColor(float[] specularColor)

getSpecularColor

public float[] getSpecularColor()

setShininess

public void setShininess(float shininess)

getShininess

public float getShininess()

setDiffuseTexture

public void setDiffuseTexture(GTexture texture)

getDiffuseTexture

public GTexture getDiffuseTexture()

setTransparencyEnabled

public void setTransparencyEnabled(boolean mode)

isTransparencyEnabled

public boolean isTransparencyEnabled()

setTransparentTexture

public void setTransparentTexture(GTexture texture)

getTransparentTexture

public GTexture getTransparentTexture()

setOpaqueMode

public void setOpaqueMode(String opaqueMode)

getOpaqueMode

public String getOpaqueMode()

transferRepeatSettings

public String transferRepeatSettings(GTexture gtex)

getRepeatS

public float getRepeatS()
Returns the repeat factor for the S coordinate


getRepeatT

public float getRepeatT()
Returns the repeat factor for the T coordinate


getOffsetS

public float getOffsetS()
Returns the offset for the S coordinate


getOffsetT

public float getOffsetT()
Returns the offset for the T coordinate


appendAttributeString

public StringBuilder appendAttributeString(StringBuilder buf,
                                           XMLFormatting fmt)
appends the XML attributes to buf.

Overrides:
appendAttributeString in class XMLStructureAdapter

decodeAttributes

public void decodeAttributes(HashMap<String,String> attrMap,
                             XMLTokenizer tokenizer)
decodes the XML attributes.

Overrides:
decodeAttributes in class XMLStructureAdapter

appendContent

public StringBuilder appendContent(StringBuilder buf,
                                   XMLFormatting fmt)
Description copied from class: XMLStructureAdapter
Appends a String to buf that encodes the contents for the XML encoding. MUST BE OVERWRITTEN BY IMPLEMENTATIONS. (The default implementation appends nothing). The encoding should start on a new line, using indentation equal to tab. There should be no newline after the encoding.

Overrides:
appendContent in class XMLStructureAdapter

decodeContent

public void decodeContent(XMLTokenizer tokenizer)
                   throws IOException
Description copied from class: XMLStructureAdapter
decodes the XML contents, i.e. the XML between the STag and ETag of the encoding. MUST BE OVERWRITTEN BY IMPLEMENTATIONS.

Overrides:
decodeContent in class XMLStructureAdapter
Throws:
IOException

hasContent

public boolean hasContent()
Description copied from class: XMLStructureAdapter
returns whether the XML encoding should have an contents part, or should be an empty element tag. This method should be overwritten if necessary in classes that inherit from XMLStructureAdapter. The default implementation returns always true.

Overrides:
hasContent in class XMLStructureAdapter

xmlTag

public static String xmlTag()
The XML Stag for XML encoding of this Class


getXMLTag

public String getXMLTag()
returns the XML Stag for XML encoding

Specified by:
getXMLTag in interface XMLStructure
Overrides:
getXMLTag in class XMLStructureAdapter

writeBinary

public void writeBinary(DataOutput dataOut)
                 throws IOException
Throws:
IOException

readBinary

public void readBinary(DataInput dataIn)
                throws IOException
Throws:
IOException