java.lang.Object
com.marginallyclever.ro3.node.Node
com.marginallyclever.ro3.node.nodes.Material

public class Material extends Node

Material contains properties for rendering a surface. The first use case is to apply a texture to a Mesh.

This class provides several functionalities:

  • It can set and get the texture.
  • It can set and get the diffuse color.
  • It can set and get the specular color.
  • It can set and get the emission color.
  • It can set and get the shininess.
  • It can set and get the lit status.
  • It can serialize and deserialize itself to and from JSON format.
  • Constructor Details

    • Material

      public Material()
    • Material

      public Material(String name)
  • Method Details

    • getComponents

      public void getComponents(List<JPanel> list)
      Description copied from class: Node
      Build a Swing Component that represents this Node.
      Overrides:
      getComponents in class Node
      Parameters:
      list - the list to add components to.
    • setDiffuseTexture

      public void setDiffuseTexture(TextureWithMetadata texture)
    • getDiffuseTexture

      public TextureWithMetadata getDiffuseTexture()
    • setNormalTexture

      public void setNormalTexture(TextureWithMetadata texture)
    • getNormalTexture

      public TextureWithMetadata getNormalTexture()
    • setSpecularTexture

      public void setSpecularTexture(TextureWithMetadata texture)
    • getSpecularTexture

      public TextureWithMetadata getSpecularTexture()
    • toJSON

      public org.json.JSONObject toJSON()
      Description copied from class: Node
      Serialize this node and its children to a JSON object and its children. Classes that override this method should call super.toJSON() first, then add to the object returned.
      Overrides:
      toJSON in class Node
      Returns:
      the JSON object.
    • fromJSON

      public void fromJSON(org.json.JSONObject from)
      Description copied from class: Node
      Deserialize this node and its children from a JSON object and its children. Classes that override this method should call super.fromJSON(). When they do it will trigger the creation of child nodes. The child nodes will then call their own fromJSON() methods.
      Overrides:
      fromJSON in class Node
      Parameters:
      from - the JSON object to read from.
    • getDiffuseColor

      public Color getDiffuseColor()
    • setDiffuseColor

      public void setDiffuseColor(Color color)
    • getSpecularColor

      public Color getSpecularColor()
    • setSpecularColor

      public void setSpecularColor(Color color)
    • getEmissionColor

      public Color getEmissionColor()
    • setEmissionColor

      public void setEmissionColor(Color color)
    • setShininess

      public void setShininess(int arg0)
    • getShininess

      public int getShininess()
    • isLit

      public boolean isLit()
    • setLit

      public void setLit(boolean isLit)
    • getIcon

      public Icon getIcon()
      Description copied from class: Node
      Set a custom icon for this node.
      Overrides:
      getIcon in class Node
      Returns:
      the icon, or null if none.
    • setSpecularStrength

      public void setSpecularStrength(double specularStrength)
    • getSpecularStrength

      public double getSpecularStrength()