Overview | Package | Class | Use | Tree | Index | Help
| Rings Version 0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## threeD.raytracer.shaders
Class ReflectionShader

    java.lang.Object
      java.util.AbstractCollection
          java.util.AbstractSet
              java.util.HashSet
                  threeD.raytracer.shaders.ShaderSet
                      threeD.raytracer.shaders.ReflectionShader

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Collection, ColorProducer, Editable, Producer, java.io.Serializable, java.util.Set, Shader

public class ReflectionShader
extends ShaderSet
implements Shader, Editable

A ReflectionShader object provides a shading method for reflective surfaces. The ReflectionShader class uses a shading algorithm based on Shlick's approximation to the Fresnel equations.

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class threeD.raytracer.util.Editable
`Editable.Selection`

Constructor Summary
`ReflectionShader()` Constructs a new ReflectionShader object with a reflectivity of 0.0 and white as a reflective color.
`ReflectionShader(double reflectivity, ColorProducer reflectiveColor)` Constructs a new ReflectionShader object with the specified reflectivity and reflective color.

Method Summary
`RGB` | `evaluate(java.lang.Object[] args)` Produces a color using the specified arguments.
`double` | `getBlur()`
`Texture` | `getEnvironmentMap()`
`Producer[]` | `getInputPropertyValues()`
`java.lang.String[]` | `getPropertyDescriptions()` Returns an array of String objects with descriptions for each editable property of this ReflectionShader object.
`java.lang.String[]` | `getPropertyNames()` Returns an array of String objects with names for each editable property of this ReflectionShader object.
`java.lang.Class[]` | `getPropertyTypes()` Returns an array of Class objects representing the class types of each editable property of this ReflectionShader object.
`java.lang.Object[]` | `getPropertyValues()` Returns the values of the properties of this ReflectionShader object as an Object array.
`ColorProducer` | `getReflectiveColor()` Returns the reflective color used by this ReflectionShader object as ColorProducer object.
`double` | `getReflectivity()`
`void` | `setBlur(double blur)` Sets the blur factor used by this ReflectionShader object.
`void` | `setEnvironmentMap(Texture map)` Sets the Texture object used as an environment map for this ReflectionShader object.
`void` | `setInputPropertyValue(int index, Producer p)` Sets the values of properties of this HighlightShader object to those specified.
`void` | `setPropertyValue(java.lang.Object value, int index)` Sets the value of the property of this ReflectionShader object at the specified index to the specified value.
`void` | `setPropertyValues(java.lang.Object[] values)` Sets the values of editable properties of this ReflectionShader object to those specified.
`void` | `setReflectiveColor(ColorProducer color)` Sets the reflective color used by this ReflectionShader object to the color represented by the specified ColorProducer object.
`void` | `setReflectivity(double reflectivity)` Sets the reflectivity value used by this ReflectionShader object.
`RGB` | `shade(ShaderParameters p)` Method specified by the Shader interface.
`java.lang.String` | `toString()` Returns "Reflection Shader".

Methods inherited from class threeD.raytracer.shaders.ShaderSet
`add, addAll`

Methods inherited from class java.util.HashSet
`clear, clone, contains, isEmpty, iterator, remove, size`

Methods inherited from class java.util.AbstractSet
`equals, hashCode, removeAll`

Methods inherited from class java.util.AbstractCollection
`containsAll, retainAll, toArray, toArray`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Set
`containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray`

Constructor Detail

### ReflectionShader

    public ReflectionShader()

  Constructs a new ReflectionShader object with a reflectivity of 0.0 and white as a reflective color.

### ReflectionShader

    public ReflectionShader(double reflectivity,
                            ColorProducer reflectiveColor)

  Constructs a new ReflectionShader object with the specified reflectivity and reflective color.

Method Detail

### shade

    public RGB shade(ShaderParameters p)

  Method specified by the Shader interface.

  Specified by:
    `shade` in interface `Shader`
  Overrides:
    `shade` in class `ShaderSet`
  Returns:
    The sum of the values given by the shade method for each Shader object stored by this ShaderSet object.

### 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`
  Overrides:
    `evaluate` in class `ShaderSet`
  Returns:
    this.shade(args[0]).
  Throws:
    `java.lang.IllegalArgumentException` - If args[0] is not a ShaderParameters object.

### setReflectivity

    public void setReflectivity(double reflectivity)

  Sets the reflectivity value used by this ReflectionShader object.

### setBlur

    public void setBlur(double blur)

  Sets the blur factor used by this ReflectionShader object.

  Parameters:
    `blur` - Blur factor to use.

### setReflectiveColor

    public void setReflectiveColor(ColorProducer color)

  Sets the reflective color used by this ReflectionShader object to the color represented by the specified ColorProducer object.

### setEnvironmentMap

    public void setEnvironmentMap(Texture map)

  Sets the Texture object used as an environment map for this ReflectionShader object.

  Parameters:
    `map` - The Texture object to use.

### getReflectivity

    public double getReflectivity()

  Returns:
    The reflectivity value used by this ReflectionShader object.

### getBlur

    public double getBlur()

  Returns:
    The blur factor used by this ReflectionShader object.

### getReflectiveColor

    public ColorProducer getReflectiveColor()

  Returns the reflective color used by this ReflectionShader object as ColorProducer object.

### getEnvironmentMap

    public Texture getEnvironmentMap()

  Returns:
    The Texture object used as an environment map for this ReflectionShader object.

### getPropertyNames

    public java.lang.String[] getPropertyNames()

  Returns an array of String objects with names for each editable property of this ReflectionShader object.

  Specified by:
    `getPropertyNames` in interface `Editable`

### getPropertyDescriptions

    public java.lang.String[] getPropertyDescriptions()

  Returns an array of String objects with descriptions for each editable property of this ReflectionShader object.

  Specified by:
    `getPropertyDescriptions` in interface `Editable`

### getPropertyTypes

    public java.lang.Class[] getPropertyTypes()

  Returns an array of Class objects representing the class types of each editable property of this ReflectionShader object.

  Specified by:
    `getPropertyTypes` in interface `Editable`

### getPropertyValues

    public java.lang.Object[] getPropertyValues()

  Returns the values of the properties of this ReflectionShader object as an Object array.

  Specified by:
    `getPropertyValues` in interface `Editable`

### setPropertyValue

    public void setPropertyValue(java.lang.Object value,
                                 int index)

  Sets the value of the property of this ReflectionShader object at the specified index to the specified value.

  Specified by:
    `setPropertyValue` in interface `Editable`
  Throws:
    `java.lang.IllegalArgumentException` - If the object specified is not of the correct type.
    `java.lang.IndexOutOfBoundsException` - If the index specified does not correspond to an editable property of this ReflectionShader object.

### setPropertyValues

    public void setPropertyValues(java.lang.Object[] values)

  Sets the values of editable properties of this ReflectionShader object to those specified.

  Specified by:
    `setPropertyValues` in interface `Editable`
  Throws:
    `java.lang.IllegalArgumentException` - If one of the objects specified is not of the correct type. (Note: none of the values after the erroneous value will be set)
    `java.lang.IndexOutOfBoundsException` - If the length of the specified array is longer than permitted.

### getInputPropertyValues

    public Producer[] getInputPropertyValues()

  Specified by:
    `getInputPropertyValues` in interface `Editable`
  Returns:
    {reflective color}.

### setInputPropertyValue

    public void setInputPropertyValue(int index,
                                      Producer p)

  Sets the values of properties of this HighlightShader object to those specified.

  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.IllegalArgumentException` - If the Producer object specified is not of the correct type.
    `java.lang.IndexOutOfBoundsException` - If the lindex != 0;

### toString

    public java.lang.String toString()

  Returns "Reflection Shader".

  Overrides:
    `toString` in class `ShaderSet`
  Returns:
    "ShaderSet".

Overview | Package | Class | Use | Tree | Index | Help
| Rings Version 0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2003-05 Mike Murray