Rings
Version 0.3

threeD.raytracer.shaders
Class BlendingShader

java.lang.Object
  extended bythreeD.raytracer.shaders.BlendingShader
All Implemented Interfaces:
ColorProducer, Editable, Producer, Shader

public class BlendingShader
extends java.lang.Object
implements Shader, Editable

A BlendingShader object provides a method for blending values from two different ColorProducer instances based on lighting. This is best for cool to warm shading or cartoon shading.


Nested Class Summary
 
Nested classes inherited from class threeD.raytracer.util.Editable
Editable.Selection
 
Constructor Summary
BlendingShader()
          Constructs a new BlendingShader using white as a hot color and black as a cold color.
BlendingShader(ColorProducer hot, ColorProducer cold)
          Constructs a new BlendingShader using the specified hot and cold colors.
 
Method Summary
 RGB evaluate(java.lang.Object[] args)
          Produces a color using the specified arguments.
 Producer[] getInputPropertyValues()
           
 java.lang.String[] getPropertyDescriptions()
          Returns an array of String objects with descriptions for each editable property of this Editable object.
 java.lang.String[] getPropertyNames()
          Returns an array of String objects with names for each editable property of this Editable object.
 java.lang.Class[] getPropertyTypes()
          Returns an array of Class objects representing the class types of each editable property of this Editable object.
 java.lang.Object[] getPropertyValues()
          Returns the values of the properties of this Editable object as an Object array.
 void setInputPropertyValue(int index, Producer p)
           
 void setPropertyValue(java.lang.Object o, int index)
          Sets the value of the property of this Editable object at the specified index to the specified value.
 void setPropertyValues(java.lang.Object[] values)
          Sets the values of properties of this Editable object to those specified.
 RGB shade(ShaderParameters p)
          Returns an RGB object that represents the shaded color calculated using the values of the specified ShaderParameters object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlendingShader

public BlendingShader()
Constructs a new BlendingShader using white as a hot color and black as a cold color.


BlendingShader

public BlendingShader(ColorProducer hot,
                      ColorProducer cold)
Constructs a new BlendingShader using the specified hot and cold colors.

Parameters:
hot - ColorProducer to use for hot color.
cold - ColorProducer to use for cold color.
Method Detail

shade

public RGB shade(ShaderParameters p)
Description copied from interface: Shader
Returns an RGB object that represents the shaded color calculated using the values of the specified ShaderParameters object.

Specified by:
shade in interface Shader
See Also:
Shader.shade(threeD.raytracer.shaders.ShaderParameters)

getPropertyNames

public java.lang.String[] getPropertyNames()
Description copied from interface: Editable
Returns an array of String objects with names for each editable property of this Editable object.

Specified by:
getPropertyNames in interface Editable
See Also:
Editable.getPropertyNames()

getPropertyDescriptions

public java.lang.String[] getPropertyDescriptions()
Description copied from interface: Editable
Returns an array of String objects with descriptions for each editable property of this Editable object.

Specified by:
getPropertyDescriptions in interface Editable
See Also:
Editable.getPropertyDescriptions()

getPropertyTypes

public java.lang.Class[] getPropertyTypes()
Description copied from interface: Editable
Returns an array of Class objects representing the class types of each editable property of this Editable object.

Specified by:
getPropertyTypes in interface Editable
See Also:
Editable.getPropertyTypes()

getPropertyValues

public java.lang.Object[] getPropertyValues()
Description copied from interface: Editable
Returns the values of the properties of this Editable object as an Object array.

Specified by:
getPropertyValues in interface Editable
See Also:
Editable.getPropertyValues()

setPropertyValue

public void setPropertyValue(java.lang.Object o,
                             int index)
Description copied from interface: Editable
Sets the value of the property of this Editable object at the specified index to the specified value.

Specified by:
setPropertyValue in interface Editable
See Also:
Editable.setPropertyValue(java.lang.Object, int)

setPropertyValues

public void setPropertyValues(java.lang.Object[] values)
Description copied from interface: Editable
Sets the values of properties of this Editable object to those specified.

Specified by:
setPropertyValues in interface Editable
See Also:
Editable.setPropertyValues(java.lang.Object[])

getInputPropertyValues

public Producer[] getInputPropertyValues()
Specified by:
getInputPropertyValues in interface Editable
Returns:
An array of Producer objects containing the property values of those properties that are repeatedly evaluated.
See Also:
Editable.getInputPropertyValues()

setInputPropertyValue

public void setInputPropertyValue(int index,
                                  Producer p)
Specified by:
setInputPropertyValue in interface Editable
Parameters:
index - Index of input property (array index from this.getInputPropertyValue).
p - Producer object to use for input property.
Throws:
java.lang.IndexOutOfBoundsException - If the property index is out of bounds.
See Also:
Editable.setInputPropertyValue(int, threeD.raytracer.util.Producer)

evaluate

public RGB evaluate(java.lang.Object[] args)
Description copied from interface: ColorProducer
Produces a color using the specified arguments.

Specified by:
evaluate in interface ColorProducer
Parameters:
args - Arguments.
Returns:
The RGB color produced.
See Also:
ColorProducer.evaluate(java.lang.Object[])

toString

public java.lang.String toString()
Returns:
"Blending Shader".

Rings
Version 0.3

Copyright 2003-05 Mike Murray