artofillusion
Class RenderingTriangle

java.lang.Object
  extended by artofillusion.RenderingTriangle
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
LayeredTriangle, Linear2DTriangle, Linear3DTriangle, Nonlinear2DTriangle, UniformTriangle, UVMappedTriangle, UVWMappedTriangle

public abstract class RenderingTriangle
extends java.lang.Object
implements java.lang.Cloneable

A RenderingTriangle represents a triangle which is to be rendered to the screen. This is an abstract class, whose subclasses provide details about how the triangle should be displayed. Every RenderingTriangle is associated with a RenderingMesh. The vertices of the triangle are specified as indices into the RenderingMesh's array of vertices. Similarly, the normals are specified as indices into the array of normals.


Field Summary
 int index
           
 int n1
           
 int n2
           
 int n3
           
 RenderingMesh theMesh
           
 int v1
           
 int v2
           
 int v3
           
 
Constructor Summary
RenderingTriangle(int v1, int v2, int v3, int n1, int n2, int n3)
           
 
Method Summary
 RenderingTriangle clone()
           
abstract  double getDisplacement(double u, double v, double w, double size, double t)
          Get the displacement for a point on the triangle.
 double[] getParameters(double u, double v, double w)
          Given the barycentric coordinates for a point in the triangle, calculate the values of the texture parameters at that point.
 TextureMapping getTextureMapping()
          Get the TextureMapping for this triangle.
abstract  void getTextureSpec(TextureSpec spec, double angle, double u, double v, double w, double size, double t)
          Given the barycentric coordinates for a point in the triangle, build a TextureSpec describing the properties of the triangle at that point.
abstract  void getTransparency(RGBColor trans, double angle, double u, double v, double w, double size, double t)
          Same as above, except only return the transparent color.
 void setMesh(RenderingMesh mesh, TextureMapping map, int index)
          Set the mesh that this triangle is part of.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

public int index

v1

public int v1

v2

public int v2

v3

public int v3

n1

public int n1

n2

public int n2

n3

public int n3

theMesh

public RenderingMesh theMesh
Constructor Detail

RenderingTriangle

public RenderingTriangle(int v1,
                         int v2,
                         int v3,
                         int n1,
                         int n2,
                         int n3)
Method Detail

getTextureMapping

public TextureMapping getTextureMapping()
Get the TextureMapping for this triangle.


getTextureSpec

public abstract void getTextureSpec(TextureSpec spec,
                                    double angle,
                                    double u,
                                    double v,
                                    double w,
                                    double size,
                                    double t)
Given the barycentric coordinates for a point in the triangle, build a TextureSpec describing the properties of the triangle at that point. The properties should be averaged over a region of width size.


getTransparency

public abstract void getTransparency(RGBColor trans,
                                     double angle,
                                     double u,
                                     double v,
                                     double w,
                                     double size,
                                     double t)
Same as above, except only return the transparent color. This can save time in cases where only the transparency is required, for example, when tracing shadow rays.


getDisplacement

public abstract double getDisplacement(double u,
                                       double v,
                                       double w,
                                       double size,
                                       double t)
Get the displacement for a point on the triangle.


setMesh

public void setMesh(RenderingMesh mesh,
                    TextureMapping map,
                    int index)
Set the mesh that this triangle is part of. This is automatically called when the triangle is added to the mesh.

Parameters:
mesh - the RenderingMesh this triangle belongs to
map - the TextureMapping for this triangle
index - the index of this triangle within the mesh

getParameters

public double[] getParameters(double u,
                              double v,
                              double w)
Given the barycentric coordinates for a point in the triangle, calculate the values of the texture parameters at that point. If parameters have not been set for the rendering mesh this triangle belongs to, this returns null.


clone

public RenderingTriangle clone()
Overrides:
clone in class java.lang.Object


Copyright © 1999-2011 by Peter Eastman.