Class MaterialData


  • public class MaterialData
    extends Object
    Material data that can be stored into a file
    A value of null means the default value of a material
    Author:
    Darius Dinger
    • Constructor Summary

      Constructors 
      Constructor Description
      MaterialData()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void fromBytes​(byte[] data)
      Constructing dataStructure material from a byte array.

      Format:
      First Sector [MetaData]:
      DefaultDiffuseColor (byte) | DefaultGlowColor (byte) | DiffuseMap size in bytes (short) | NormalMap size in bytes (short) | SpecularMap size in bytes (short) | DisplacementMap size in bytes (short) | AmbientOcclusionMap size in bytes (short) | AlphaMap size in bytes (short) | ReflectionMap size in bytes (short) | GlowMap size in bytes (short) | DefaultDisplacementFactor (byte) | DefaultTiling (byte) | DefaultShininess (byte) | DefaultShineDamping (byte)

      Second Sector [Colors]:
      DiffuseColor (3 floats) | GlowColor (3 floats)

      Third Sector [Textures]:
      DiffuseMapPath (string) | NormalMapPath (string) | SpecularMapPath (string) | DisplacementMapPath (string) | AmbientOcclusionMapPath (string) | AlphaMapPath (string) | ReflectionMapPath (string) | GlowMapPath (string)

      Fourth Sector [Floats]:
      DisplacementFactor (float) | Tiling (float) | Shininess (float) | ShineDamping (float)
      Material getInstance​(String texPath, boolean asResource)
      Getting a new instance of the dataStructure material
      byte[] toBytes()
      Converting the dataStructure material into a byte array.

      Format:
      First Sector [MetaData]:
      DefaultDiffuseColor (byte) | DefaultGlowColor (byte) | DiffuseMap size in bytes (short) | NormalMap size in bytes (short) | SpecularMap size in bytes (short) | DisplacementMap size in bytes (short) | AmbientOcclusionMap size in bytes (short) | AlphaMap size in bytes (short) | ReflectionMap size in bytes (short) | GlowMap size in bytes (short) | DefaultDisplacementFactor (byte) | DefaultTiling (byte) | DefaultShininess (byte) | DefaultShineDamping (byte)

      Second Sector [Colors]:
      DiffuseColor (3 floats) | GlowColor (3 floats)

      Third Sector [Textures]:
      DiffuseMapPath (String) | NormalMapPath (String) | SpecularMapPath (String) | DisplacementMapPath (String) | AmbientOcclusionMapPath (String) | AlphaMapPath (String) | ReflectionMapPath (String) | GlowMapPath (String)

      Fourth Sector [Floats]:
      DisplacementFactor (float) | Tiling (float) | Shininess (float) | ShineDamping (float)
    • Field Detail

      • diffuseColor

        public Color diffuseColor
      • glowColor

        public Color glowColor
      • diffuseMap

        public String diffuseMap
      • normalMap

        public String normalMap
      • specularMap

        public String specularMap
      • displacementMap

        public String displacementMap
      • ambientOcclusionMap

        public String ambientOcclusionMap
      • alphaMap

        public String alphaMap
      • reflectionMap

        public String reflectionMap
      • glowMap

        public String glowMap
      • displacementFactor

        public Float displacementFactor
      • tiling

        public Float tiling
      • shininess

        public Float shininess
      • shineDamping

        public Float shineDamping
    • Constructor Detail

      • MaterialData

        public MaterialData()
    • Method Detail

      • fromBytes

        public void fromBytes​(byte[] data)
        Constructing dataStructure material from a byte array.

        Format:
        First Sector [MetaData]:
        DefaultDiffuseColor (byte) | DefaultGlowColor (byte) | DiffuseMap size in bytes (short) | NormalMap size in bytes (short) | SpecularMap size in bytes (short) | DisplacementMap size in bytes (short) | AmbientOcclusionMap size in bytes (short) | AlphaMap size in bytes (short) | ReflectionMap size in bytes (short) | GlowMap size in bytes (short) | DefaultDisplacementFactor (byte) | DefaultTiling (byte) | DefaultShininess (byte) | DefaultShineDamping (byte)

        Second Sector [Colors]:
        DiffuseColor (3 floats) | GlowColor (3 floats)

        Third Sector [Textures]:
        DiffuseMapPath (string) | NormalMapPath (string) | SpecularMapPath (string) | DisplacementMapPath (string) | AmbientOcclusionMapPath (string) | AlphaMapPath (string) | ReflectionMapPath (string) | GlowMapPath (string)

        Fourth Sector [Floats]:
        DisplacementFactor (float) | Tiling (float) | Shininess (float) | ShineDamping (float)
        Parameters:
        data - Byte array to construct dataStructure material from
      • toBytes

        public byte[] toBytes()
        Converting the dataStructure material into a byte array.

        Format:
        First Sector [MetaData]:
        DefaultDiffuseColor (byte) | DefaultGlowColor (byte) | DiffuseMap size in bytes (short) | NormalMap size in bytes (short) | SpecularMap size in bytes (short) | DisplacementMap size in bytes (short) | AmbientOcclusionMap size in bytes (short) | AlphaMap size in bytes (short) | ReflectionMap size in bytes (short) | GlowMap size in bytes (short) | DefaultDisplacementFactor (byte) | DefaultTiling (byte) | DefaultShininess (byte) | DefaultShineDamping (byte)

        Second Sector [Colors]:
        DiffuseColor (3 floats) | GlowColor (3 floats)

        Third Sector [Textures]:
        DiffuseMapPath (String) | NormalMapPath (String) | SpecularMapPath (String) | DisplacementMapPath (String) | AmbientOcclusionMapPath (String) | AlphaMapPath (String) | ReflectionMapPath (String) | GlowMapPath (String)

        Fourth Sector [Floats]:
        DisplacementFactor (float) | Tiling (float) | Shininess (float) | ShineDamping (float)
        Returns:
        Converted byte array
      • getInstance

        public Material getInstance​(String texPath,
                                    boolean asResource)
        Getting a new instance of the dataStructure material
        Parameters:
        texPath - Location of the texture files
        asResource - Load from resources
        Returns:
        New material instance