artofillusion.material
Class LinearMaterialMapping

java.lang.Object
  extended by artofillusion.material.MaterialMapping
      extended by artofillusion.material.LinearMaterialMapping

public class LinearMaterialMapping
extends MaterialMapping

LinearMaterialMapping is a MaterialMapping which represents a linear mapping (this includes rotations, translations, and scalings) of between material coordinates and world coordinates.


Constructor Summary
LinearMaterialMapping(java.io.DataInputStream in, Object3D theObject, Material theMaterial)
           
LinearMaterialMapping(Object3D theObject, Material3D theMaterial)
           
 
Method Summary
 void copy(MaterialMapping mapping)
          Make this mapping identical to another one.
 MaterialMapping duplicate()
          Create a new MaterialMapping which is identical to this one.
 MaterialMapping duplicate(Object3D obj, Material mat)
          Create a new MaterialMapping which is identical to this one, but for a different object and Material.
 Vec3 getCenter()
          Get a vector whose components contain the center position for the mapping.
 Widget getEditingPanel(Object3D obj, MaterialPreviewer preview)
          This method should return a Widget in which the user can edit the mapping.
 void getMaterialSpec(Vec3 pos, MaterialSpec spec, double size, double time)
          Given a point inside the object for which this mapping is being used, find the corresponding material properties.
static java.lang.String getName()
           
 Vec3 getRotations()
          Get a vector whose components contain the rotation angles for the mapping.
 Vec3 getScale()
          Get a vector whose components contain the scale factors for the mapping.
 double getStepSize()
          Get the step size to use for integrating the material.
 boolean isScaledToObject()
          Get whether the material is scaled based on the size of the object.
static boolean legalMapping(Object3D obj, Material mat)
           
 void setCenter(Vec3 center)
          Set the center position for the mapping.
 void setRotations(Vec3 angles)
          Set the rotation angles for the mapping.
 void setScale(Vec3 scale)
          Set the scale factors for the mapping.
 void setScaledToObject(boolean scaled)
          Set whether the material is scaled based on the size of the object.
 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 artofillusion.material.MaterialMapping
castsShadows, getMaterial, getObject, indexOfRefraction, isScattering
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearMaterialMapping

public LinearMaterialMapping(Object3D theObject,
                             Material3D theMaterial)

LinearMaterialMapping

public LinearMaterialMapping(java.io.DataInputStream in,
                             Object3D theObject,
                             Material theMaterial)
                      throws java.io.IOException,
                             java.io.InvalidObjectException
Throws:
java.io.IOException
java.io.InvalidObjectException
Method Detail

getName

public static java.lang.String getName()

legalMapping

public static boolean legalMapping(Object3D obj,
                                   Material mat)

getCenter

public Vec3 getCenter()
Get a vector whose components contain the center position for the mapping.


setCenter

public void setCenter(Vec3 center)
Set the center position for the mapping.


getScale

public Vec3 getScale()
Get a vector whose components contain the scale factors for the mapping.


setScale

public void setScale(Vec3 scale)
Set the scale factors for the mapping.


isScaledToObject

public boolean isScaledToObject()
Get whether the material is scaled based on the size of the object.


setScaledToObject

public void setScaledToObject(boolean scaled)
Set whether the material is scaled based on the size of the object.


getRotations

public Vec3 getRotations()
Get a vector whose components contain the rotation angles for the mapping.


setRotations

public void setRotations(Vec3 angles)
Set the rotation angles for the mapping.


getStepSize

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

Specified by:
getStepSize in class MaterialMapping

getMaterialSpec

public void getMaterialSpec(Vec3 pos,
                            MaterialSpec spec,
                            double size,
                            double time)
Description copied from class: MaterialMapping
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.

Specified by:
getMaterialSpec in class MaterialMapping

duplicate

public MaterialMapping duplicate()
Description copied from class: MaterialMapping
Create a new MaterialMapping which is identical to this one.

Specified by:
duplicate in class MaterialMapping

duplicate

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

Specified by:
duplicate in class MaterialMapping

copy

public void copy(MaterialMapping mapping)
Description copied from class: MaterialMapping
Make this mapping identical to another one.

Specified by:
copy in class MaterialMapping

getEditingPanel

public Widget getEditingPanel(Object3D obj,
                              MaterialPreviewer preview)
Description copied from class: MaterialMapping
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.

Specified by:
getEditingPanel in class MaterialMapping

writeToFile

public void writeToFile(java.io.DataOutputStream out)
                 throws java.io.IOException
Description copied from class: MaterialMapping
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.

Specified by:
writeToFile in class MaterialMapping
Throws:
java.io.IOException


Copyright © 1999-2011 by Peter Eastman.