|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartofillusion.texture.TextureMapping
public abstract class TextureMapping
A TextureMapping describes the mapping of a Texture's texture coordinates to points on the surface of an object. It operates in two ways. First, it generates RenderingTriangles whic contain the necessary information to be rendered. Second, since some renderers can directly render certain objects without ever breaking them into triangles, it must be able to directly calculate the material properties for a point in space.
This is an abstract class. Its subclasses describe various types of mappings which are appropriate for various types of objects and materials.
Field Summary | |
---|---|
static short |
BACK_ONLY
|
static short |
FRONT_AND_BACK
|
static short |
FRONT_ONLY
|
Constructor Summary | |
---|---|
TextureMapping()
|
Method Summary | |
---|---|
short |
appliesTo()
Determine whether this texture is applied to front faces, back faces, or both. |
boolean |
appliesToFace(boolean front)
Determine whether this texture is applied to front (or back) faces. |
abstract void |
copy(TextureMapping map)
Make this mapping identical to another one. |
abstract TextureMapping |
duplicate()
Create a new TextureMapping which is identical to this one. |
abstract TextureMapping |
duplicate(Object3D obj,
Texture tex)
Create a new TextureMapping which is identical to this one, but for a different object and texture. |
abstract double |
getDisplacement(Vec3 pos,
double size,
double t,
double[] param)
Given a point on the surface, evaluate the displacement function. |
abstract Widget |
getEditingPanel(Object3D obj,
MaterialPreviewer preview)
This method should return a Widget in which the user can edit the mapping. |
static java.lang.String |
getName()
Get the name of this type of mapping. |
abstract Object3D |
getObject()
Get the object this mapping is applied to. |
TextureParameter[] |
getParameters()
Get the list of texture parameters associated with this mapping and its texture. |
abstract Texture |
getTexture()
Get the Texture associated with this TextureMapping. |
abstract void |
getTextureSpec(Vec3 pos,
TextureSpec spec,
double angle,
double size,
double t,
double[] param)
Given a point on the surface for which this mapping is being used, find the corresponding surface properties. |
abstract void |
getTransparency(Vec3 pos,
RGBColor trans,
double angle,
double size,
double t,
double[] param)
Same as above, except only return the transparent color. |
RenderingTriangle |
mapTriangle(int v1,
int v2,
int v3,
int n1,
int n2,
int n3,
Vec3[] vert)
Given the vertices to be mapped and their normal vectors, generate a RenderingTriangle. |
void |
setAppliesTo(short whichFaces)
Set whether this texture should apply to front faces, back faces, or both. |
void |
setParameters(RenderingTriangle tri,
double[] p1,
double[] p2,
double[] p3,
RenderingMesh mesh)
This method is called once the texture parameters for the vertices of a triangle are known. |
abstract void |
writeToFile(java.io.DataOutputStream out)
Every subclass of TextureMapping must define a constructor which takes a Texture and an Object3D as its arguments: |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short FRONT_AND_BACK
public static final short FRONT_ONLY
public static final short BACK_ONLY
Constructor Detail |
---|
public TextureMapping()
Method Detail |
---|
public abstract void writeToFile(java.io.DataOutputStream out) throws java.io.IOException
public MappingSubclass(Object3D obj, Texture texture)
In addition, every subclass must include a method of the form
public static boolean legalMapping(Object3D obj, Texture texture)
which returns true if the mapping can be used with the specified object and Texture. Finally, every subclass must include a constructor with the signature
public MappingSubclass(DataInputStream in, Object3D obj, Texture texture) throws IOException, InvalidObjectException
which reconstructs the mapping by reading its data from an input stream. The following method writes the object's data to an output stream.
java.io.IOException
public abstract Texture getTexture()
public abstract Object3D getObject()
public static java.lang.String getName()
public RenderingTriangle mapTriangle(int v1, int v2, int v3, int n1, int n2, int n3, Vec3[] vert)
public void setParameters(RenderingTriangle tri, double[] p1, double[] p2, double[] p3, RenderingMesh mesh)
public abstract void getTextureSpec(Vec3 pos, TextureSpec spec, double angle, double size, double t, double[] param)
pos
- the point at which to evaluate the texturespec
- the surface properties will be stored in thisangle
- the dot product of the view direction with the surface normalsize
- the width of the region over which to average the surface propertiest
- the time at which to evaluate the surface propertiesparam
- the texture parameter values at the pointpublic abstract void getTransparency(Vec3 pos, RGBColor trans, double angle, double size, double t, double[] param)
public abstract double getDisplacement(Vec3 pos, double size, double t, double[] param)
public abstract TextureMapping duplicate()
public abstract TextureMapping duplicate(Object3D obj, Texture tex)
public abstract void copy(TextureMapping map)
public TextureParameter[] getParameters()
public short appliesTo()
public final boolean appliesToFace(boolean front)
public void setAppliesTo(short whichFaces)
public abstract Widget getEditingPanel(Object3D obj, MaterialPreviewer preview)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |