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.
    • setTexture

      public void setTexture(TextureWithMetadata selectedItem)
    • getTexture

      public TextureWithMetadata getTexture()
    • 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)