artofillusion.view
Class TexturedVertexShader

java.lang.Object
  extended by artofillusion.view.TexturedVertexShader
All Implemented Interfaces:
VertexShader

public class TexturedVertexShader
extends java.lang.Object
implements VertexShader

This is a VertexShader which renders a textured mesh with smooth shading.


Constructor Summary
TexturedVertexShader(RenderingMesh mesh, Object3D object, double time, Vec3 viewDir)
          Create a TexturedVertexShader for a mesh.
 
Method Summary
static void clearCachedShaders(RenderingMesh mesh)
          Clear any cached information about a RenderingMesh.
 void getColor(int face, int vertex, RGBColor color)
          Select the color for a vertex.
 void getTextureSpec(TextureSpec spec)
          Get the color of the surface.
 boolean isUniformFace(int face)
          Get whether a particular face should be rendered with a single uniform color.
 boolean isUniformTexture()
          Get whether this shader represents a uniform texture.
 VertexShader optimize()
          In some cases, a texture can be represented by a simpler shader.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TexturedVertexShader

public TexturedVertexShader(RenderingMesh mesh,
                            Object3D object,
                            double time,
                            Vec3 viewDir)
Create a TexturedVertexShader for a mesh.

Parameters:
mesh - the mesh to render
object - the object to which the mesh corresponds
time - the current time
viewDir - the direction from which it is being viewed
Method Detail

optimize

public VertexShader optimize()
In some cases, a texture can be represented by a simpler shader. In addition, it is sometimes possible to reuse shaders, thus avoiding having to repeat texture calculations. This method returns a shader which produces identical results to this one, but may or may not actually be the same object.


getColor

public void getColor(int face,
                     int vertex,
                     RGBColor color)
Select the color for a vertex.

Specified by:
getColor in interface VertexShader
Parameters:
face - the index of the triangle being rendered
vertex - the index of the vertex to color
color - the vertex color will be returned in this object

isUniformFace

public boolean isUniformFace(int face)
Get whether a particular face should be rendered with a single uniform color.

Specified by:
isUniformFace in interface VertexShader
Parameters:
face - the index of the triangle being rendered

isUniformTexture

public boolean isUniformTexture()
Get whether this shader represents a uniform texture. If this returns true, all texture properties are uniform over the entire surface (although different parts may still be colored differently due to lighting).

Specified by:
isUniformTexture in interface VertexShader

getTextureSpec

public void getTextureSpec(TextureSpec spec)
Get the color of the surface. This should only be called if isUniformTexture() returns true.

Specified by:
getTextureSpec in interface VertexShader
Parameters:
spec - the surface color will be returned in this object

clearCachedShaders

public static void clearCachedShaders(RenderingMesh mesh)
Clear any cached information about a RenderingMesh.



Copyright © 1999-2011 by Peter Eastman.