artofillusion
Class MaterialPreviewer

java.lang.Object
  extended by CustomWidget
      extended by artofillusion.MaterialPreviewer
All Implemented Interfaces:
RenderListener

public class MaterialPreviewer
extends CustomWidget
implements RenderListener

MaterialPreviewer is a component used for renderering previews of Materials. It displays a scene consisting of a Sphere with the desired Material applied to it, a ground plane, and a single light. Optionally, an Object3D may be specified which will then be used instead of a Sphere.


Field Summary
static int HANDLE_SIZE
           
 
Constructor Summary
MaterialPreviewer(ObjectInfo obj, int width, int height)
          Create a MaterialPreviewer to display the specified object, with its current texture and material.
MaterialPreviewer(Texture tex, Material mat, int width, int height)
          Create a MaterialPreviewer to display a Texture and/or Material mapped to a sphere.
MaterialPreviewer(Texture tex, Material mat, Object3D obj, int width, int height)
          Same as above, except you can specify a different object to use instead of a sphere.
 
Method Summary
 void cancelRendering()
          Cancel rendering.
 ObjectInfo getObject()
          Get the object on which the texture and material are being displayed.
 Scene getScene()
          Get the scene being rendererd as the preview.
 void imageComplete(ComplexImage image)
          Called when rendering is complete.
 void imageUpdated(java.awt.Image image)
          Called when more pixels are available for the current image.
 void render()
          Render the preview.
 void renderingCanceled()
          Called when rendering is cancelled.
 void setMaterial(Material mat, MaterialMapping map)
           
 void setTexture(Texture tex, TextureMapping map)
           
 void statusChanged(java.lang.String status)
          The renderer may call this method periodically during rendering, to give the listener text descriptions of the current status of rendering.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HANDLE_SIZE

public static final int HANDLE_SIZE
See Also:
Constant Field Values
Constructor Detail

MaterialPreviewer

public MaterialPreviewer(Texture tex,
                         Material mat,
                         int width,
                         int height)
Create a MaterialPreviewer to display a Texture and/or Material mapped to a sphere. Either tex or mat may be null.


MaterialPreviewer

public MaterialPreviewer(Texture tex,
                         Material mat,
                         Object3D obj,
                         int width,
                         int height)
Same as above, except you can specify a different object to use instead of a sphere.


MaterialPreviewer

public MaterialPreviewer(ObjectInfo obj,
                         int width,
                         int height)
Create a MaterialPreviewer to display the specified object, with its current texture and material.

Method Detail

getObject

public ObjectInfo getObject()
Get the object on which the texture and material are being displayed.


getScene

public Scene getScene()
Get the scene being rendererd as the preview.


setTexture

public void setTexture(Texture tex,
                       TextureMapping map)

setMaterial

public void setMaterial(Material mat,
                        MaterialMapping map)

render

public void render()
Render the preview.


cancelRendering

public void cancelRendering()
Cancel rendering.


imageUpdated

public void imageUpdated(java.awt.Image image)
Called when more pixels are available for the current image.

Specified by:
imageUpdated in interface RenderListener

statusChanged

public void statusChanged(java.lang.String status)
The renderer may call this method periodically during rendering, to give the listener text descriptions of the current status of rendering.

Specified by:
statusChanged in interface RenderListener

imageComplete

public void imageComplete(ComplexImage image)
Called when rendering is complete.

Specified by:
imageComplete in interface RenderListener

renderingCanceled

public void renderingCanceled()
Called when rendering is cancelled.

Specified by:
renderingCanceled in interface RenderListener


Copyright © 1999-2011 by Peter Eastman.