Bouncy Castle Rendering Toolkit 1.0

org.bouncycastle.graphics.rt
Class Hit

java.lang.Object
  |
  +--org.bouncycastle.graphics.rt.Hit

public class Hit
extends java.lang.Object


Field Summary
 ColorCalculator colorCalc
           
 Ray i
           
 NormalCalculator normCalc
           
 Renderable obj
           
 Shader shader
           
 TextureMapper stMapper
           
 boolean subtractedSurface
           
 float t
           
 int timeSlice
           
 float tTotal
           
 
Method Summary
 Color3f color()
          return the base color for the surface this hit is on.
 Ray continuationRay()
          set r so that it represents a continuation of the incident one, i.e.
 void dispose()
           
 float distance()
          return the distance traveled to this hit.
static Hit getInstance(Renderable obj, float t, ColorCalculator colorCalc, NormalCalculator normCalc, TextureMapper stMapper, Shader shader)
          return an instance of a Hit object, with passed in values set.
 Vector3f I()
          return the incident ray direction vector.
 boolean isInside()
          returns whether or not the incident ray is inside some object.
 int level()
          return the recursion level of this hit.
 Vector3f N()
          return the current shading normal.
 float NDotI()
          return the dot product of the shading normal N with the direction of the incident ray I.
 Renderable object()
          return the object we hit.
 Vector3f oN()
          return the object space normal.
 Point3f oP()
          return the hit location in object coordinates
 Point3f P()
          return the hit location in world coordinates
 void perturbN(float factor)
          Perturb the current shading normal by adding some random deviation perpendicular to the tip of the current shading normal, scaled by the factor factor.
 void perturbN(float u, float v)
          Perturb the current shading normal by adding a deviation perpendicular to the tip of the current shading normal, given by the vector (u, v, 0), after being aligned so that it is transformed to being perpendicular to the axis of the shading normal.
 void perturbN(Vector3f pTurb)
          Perturb the current shading normal by adding some vector to it in object space and then transforming it to our current world space.
 Ray reflectedRay()
          return the reflected ray for the incident one and the current shading normal
 Ray refractedRay(float riIn, float riOut)
          return a refracted ray for the incident one and the shading normal.
 float S()
          return the s texture coordinate.
 float size()
          return the rough area covered by this object in screen space.
 float T()
          return the t texture coordinate.
 LightDataList visibleLights(World world)
          return a visible light list for this hit for the given world
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

obj

public Renderable obj

t

public float t

tTotal

public float tTotal

normCalc

public NormalCalculator normCalc

colorCalc

public ColorCalculator colorCalc

stMapper

public TextureMapper stMapper

shader

public Shader shader

timeSlice

public int timeSlice

i

public Ray i

subtractedSurface

public boolean subtractedSurface
Method Detail

getInstance

public static Hit getInstance(Renderable obj,
                              float t,
                              ColorCalculator colorCalc,
                              NormalCalculator normCalc,
                              TextureMapper stMapper,
                              Shader shader)
return an instance of a Hit object, with passed in values set.
Parameters:
obj - the object hit.
t - the distance traveled to this hit.
colorCalc - the base color calculator for the hit.
normCalc - the normal calculator for the hit.
stMapper - the mapper to get texture coordinates from
shader - the shader to invoke for the hit
Returns:
a free (possibly new) Hit object.

dispose

public void dispose()

visibleLights

public LightDataList visibleLights(World world)
return a visible light list for this hit for the given world

level

public final int level()
return the recursion level of this hit.
Returns:
the recursion level.

N

public Vector3f N()
return the current shading normal.
Returns:
the current shading normal.

oN

public Vector3f oN()
return the object space normal.
Returns:
the object space normal.

perturbN

public void perturbN(float factor)
Perturb the current shading normal by adding some random deviation perpendicular to the tip of the current shading normal, scaled by the factor factor.

Note: this method changes the stored surface normal.

Parameters:
factor - the scale for the perturbation.

perturbN

public void perturbN(float u,
                     float v)
Perturb the current shading normal by adding a deviation perpendicular to the tip of the current shading normal, given by the vector (u, v, 0), after being aligned so that it is transformed to being perpendicular to the axis of the shading normal.

Note: this method changes the stored surface normal.

Parameters:
factor - the scale for the perturbation.

perturbN

public void perturbN(Vector3f pTurb)
Perturb the current shading normal by adding some vector to it in object space and then transforming it to our current world space.

Note: this method changes the stored surface normal.

Parameters:
pTurb - the vector to be used to perturb the shading normal.

I

public Vector3f I()
return the incident ray direction vector.

NDotI

public float NDotI()
return the dot product of the shading normal N with the direction of the incident ray I.
Returns:
N.I

S

public float S()
return the s texture coordinate.

T

public float T()
return the t texture coordinate.

color

public Color3f color()
return the base color for the surface this hit is on.

oP

public Point3f oP()
return the hit location in object coordinates

P

public Point3f P()
return the hit location in world coordinates

distance

public float distance()
return the distance traveled to this hit.

size

public float size()
return the rough area covered by this object in screen space.

object

public Renderable object()
return the object we hit.

isInside

public boolean isInside()
returns whether or not the incident ray is inside some object.
Returns:
true, if inside, false otherwise.

continuationRay

public Ray continuationRay()
set r so that it represents a continuation of the incident one, i.e. has the same direction, but its origin is the point the incident one has just hit.
Parameters:
r - the ray to contain the result.

reflectedRay

public Ray reflectedRay()
return the reflected ray for the incident one and the current shading normal
Returns:
the reflected ray.

refractedRay

public Ray refractedRay(float riIn,
                        float riOut)
return a refracted ray for the incident one and the shading normal. If the ray is internally reflected we return null. The calculation is done using Snell's law.
Parameters:
riIn - index of refraction for current material.
riOut - index of refraction for material we are entering.
Returns:
the refracted ray.

Bouncy Castle Rendering Toolkit 1.0