artofillusion.material
Class MaterialMapping

java.lang.Object
  extended by artofillusion.material.MaterialMapping
Direct Known Subclasses:
LinearMaterialMapping, UniformMaterialMapping

public abstract class MaterialMapping
extends java.lang.Object

A MaterialMapping describes the mapping of a Material's coordinates to the local coordinate system of an object. This is an abstract class. Its subclasses describe various types of mappings which are appropriate for various types of objects and materials.


Method Summary
 boolean castsShadows()
          Return true if this mapping's Material casts shadows.
abstract  void copy(MaterialMapping map)
          Make this mapping identical to another one.
abstract  MaterialMapping duplicate()
          Create a new MaterialMapping which is identical to this one.
abstract  MaterialMapping duplicate(Object3D obj, Material mat)
          Create a new MaterialMapping which is identical to this one, but for a different object and Material.
abstract  Widget getEditingPanel(Object3D obj, MaterialPreviewer preview)
          This method should return a Widget in which the user can edit the mapping.
 Material getMaterial()
          Get the Material which is being mapped.
abstract  void getMaterialSpec(Vec3 pos, MaterialSpec spec, double size, double t)
          Given a point inside the object for which this mapping is being used, find the corresponding material properties.
static java.lang.String getName()
          Get the name of this type of mapping.
 Object3D getObject()
          Get the object to which the material is applied.
abstract  double getStepSize()
          Get the step size to use for integrating the material.
 double indexOfRefraction()
          Get the index of refraction for this mapping's Material.
 boolean isScattering()
          Return true if this mapping's Material has internal scattering.
abstract  void writeToFile(java.io.DataOutputStream out)
          Every subclass of MaterialMapping must define a constructor which takes a Material and an Object3D as its arguments:
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeToFile

public abstract void writeToFile(java.io.DataOutputStream out)
                          throws java.io.IOException
Every subclass of MaterialMapping must define a constructor which takes a Material and an Object3D as its arguments:

public MappingSubclass(Object3D theObject, Material theMaterial)

In addition, every subclass must include a constructor with the signature

public MappingSubclass(DataInputStream in, Object3D theObject, Material theMaterial) throws IOException, InvalidObjectException

which reconstructs the mapping by reading its data from an input stream. The following method writes the object's data to an output stream.

Throws:
java.io.IOException

getName

public static java.lang.String getName()
Get the name of this type of mapping. Subclasses should override this method to return an appropriate name.


indexOfRefraction

public double indexOfRefraction()
Get the index of refraction for this mapping's Material.


getStepSize

public abstract double getStepSize()
Get the step size to use for integrating the material.


isScattering

public boolean isScattering()
Return true if this mapping's Material has internal scattering.


castsShadows

public boolean castsShadows()
Return true if this mapping's Material casts shadows.


getMaterial

public Material getMaterial()
Get the Material which is being mapped.


getObject

public Object3D getObject()
Get the object to which the material is applied.


getMaterialSpec

public abstract void getMaterialSpec(Vec3 pos,
                                     MaterialSpec spec,
                                     double size,
                                     double t)
Given a point inside the object for which this mapping is being used, find the corresponding material properties. The properties should be averaged over a region of width size.


duplicate

public abstract MaterialMapping duplicate()
Create a new MaterialMapping which is identical to this one.


duplicate

public abstract MaterialMapping duplicate(Object3D obj,
                                          Material mat)
Create a new MaterialMapping which is identical to this one, but for a different object and Material.


copy

public abstract void copy(MaterialMapping map)
Make this mapping identical to another one.


getEditingPanel

public abstract Widget getEditingPanel(Object3D obj,
                                       MaterialPreviewer preview)
This method should return a Widget in which the user can edit the mapping. The parameters are the object whose mapping is being edited, and a MaterialPreviewer which should be rendered whenever one of the mapping's parameters changes.



Copyright © 1999-2011 by Peter Eastman.