|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--render.Material
Deals with aspects of color and material properties of objects.
Stores color properties of material: diffuse light, specular light,
and ambient light.
Holds information about transparency and whether the material is
double sided.
Field Summary | |
protected double[] |
ambient
Ambient lighting color values in RGB (range [0,1]). |
boolean |
anisotropic
Indicates whether the material is anisotropic (light reflection varies with respect to direction). |
protected double[] |
diffuse
Holds diffuse color information ( R, G, B, exponent ) |
protected double |
FL
Focal Length |
boolean |
isDoubleSided
Indicates whether the material is double sided. |
double |
noiseA
Noise amplitude. |
double |
noiseF
Noise frequency. |
int |
res
Resolution of the material. |
int |
resP
Bit depth of the resolution. |
protected double[] |
specular
Holds specular color information (R, G, B, exponent ) |
protected int[] |
table
Stores the precomputed normal map for quick lookup later. |
boolean |
tableMode
Flag determining wheter to precompute and store color tables for direct look up intead of on the fly computation. |
protected Texture |
texture
|
protected double |
transparency
Transparency of the object (0-invisible, 1-opaque). |
protected double[] |
v
|
Constructor Summary | |
Material()
|
Method Summary | |
int |
computePixel(int[] data,
int dx,
int dy,
int NB)
Returns the packed integer of a particular pixel To do extra pixel computation, overload this method |
int |
countTable()
Counts the non-zero entries in the lookup table. |
void |
getAmbient(double[] amb)
Gets the ambient light components (r, g, b). |
void |
getDiffuse(double[] diff)
Gets the diffuse color components in RGB (range 0 to 1). |
void |
getSpecular(double[] spec)
Gets the specular components of color (r, g, b, exponent). |
int |
getTable(int ix,
int iy,
int iz)
Looks up the appropriate color value from the table at x, y, z. |
double |
getTransparency()
Returns the transparency of the material (0 transparent to 1 opaque). |
boolean |
hasTexture()
|
void |
initTable(int p)
Creates and initializes the lookup table to all black. |
void |
recache()
|
void |
run()
Thread that runs in the background ( provided the resources are available - no mouse dragging for example) and computes the normal map table of values for quick look up later. |
Material |
setAmbient(double r,
double g,
double b)
Sets the ambient lighting color values (range 0..1). |
Material |
setColor(double dr,
double dg,
double db)
Sets the diffuse color of an object. |
Material |
setColor(double dr,
double dg,
double db,
double dp)
Sets the diffuse color of an object. |
Material |
setColor(double dr,
double dg,
double db,
double sr,
double sg,
double sb,
double sp)
Sets the diffuse and specular values of color. |
Material |
setColor(double dr,
double dg,
double db,
double dp,
double sr,
double sg,
double sb,
double sp)
Sets the diffuse and specular values of color. |
Material |
setColor(double dr,
double dg,
double db,
double sr,
double sg,
double sb,
double sp,
double ar,
double ag,
double ab)
Sets the diffuse, specular and ambient values of color. |
Material |
setColor(double dr,
double dg,
double db,
double dp,
double sr,
double sg,
double sb,
double sp,
double ar,
double ag,
double ab)
Sets the diffuse, specular and ambient values of color. |
Material |
setDiffuse(double r,
double g,
double b)
Sets the diffuse components of light (range 0..1). |
Material |
setDiffuse(double r,
double g,
double b,
double p)
Sets the diffuse components of light (range 0..1). |
Material |
setDoubleSided(boolean t)
Sets the double sided flag true to indicate whether the object is double sided. |
Material |
setSpecular(double r,
double g,
double b,
double p)
Sets the specular color components (r, g, b, exp). |
void |
setTable(int ix,
int iy,
int iz,
int p)
Sets the x, y, z, value in the lookup table to p. |
Material |
setTexture(Texture texel)
|
Material |
setTransparency(double t)
Sets the transparency of the material (0 transparent to 1 opaque). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public boolean tableMode
public int resP
public int res
protected int[] table
public boolean isDoubleSided
public boolean anisotropic
public double noiseF
public double noiseA
protected double[] diffuse
protected double[] specular
protected double transparency
protected double[] ambient
protected Texture texture
protected double FL
protected double[] v
Constructor Detail |
public Material()
Method Detail |
public int getTable(int ix, int iy, int iz)
ix
- xiy
- yiz
- z
public void setTable(int ix, int iy, int iz, int p)
ix
- xiy
- yiz
- zp
- the packed color valuepublic void initTable(int p)
p
- bit depth resolutionpublic int countTable()
public boolean hasTexture()
public Material setTexture(Texture texel)
public int computePixel(int[] data, int dx, int dy, int NB)
data
- array representing the pixel
indices of data are:
0,1,2 are the x,y,z of the pixel
3,4,5 are the r,g,b values
6,7 are the u,v coordinatesdx
- size of the pixel in xdy
- size of the pixel in yNB
- precision valuepublic Material setDiffuse(double r, double g, double b)
r
- redg
- greenb
- bluepublic Material setDiffuse(double r, double g, double b, double p)
r
- redg
- greenb
- bluep
- exponentpublic void getDiffuse(double[] diff)
public Material setSpecular(double r, double g, double b, double p)
r
- redg
- greenb
- blue
public void getSpecular(double[] spec)
spec
- array of doubles containing 4 specular light componentspublic Material setAmbient(double r, double g, double b)
r
- redg
- greenb
- blue
public void getAmbient(double[] amb)
public Material setColor(double dr, double dg, double db)
dr
- diffuse reddg
- diffuse greendb
- diffuse blue
public Material setColor(double dr, double dg, double db, double dp)
dr
- diffuse reddg
- diffuse greendb
- diffuse bluedp
- diffuse exponent
public Material setColor(double dr, double dg, double db, double sr, double sg, double sb, double sp)
dr
- diffuse reddg
- diffuse greendb
- diffuse bluesr
- specular redsg
- specular greensb
- specular bluesp
- specular exponent
public Material setColor(double dr, double dg, double db, double dp, double sr, double sg, double sb, double sp)
dr
- diffuse reddg
- diffuse greendb
- diffuse bluedp
- diffuse exponentsr
- specular redsg
- specular greensb
- specular bluesp
- specular exponent
public Material setColor(double dr, double dg, double db, double sr, double sg, double sb, double sp, double ar, double ag, double ab)
dr
- diffuse reddg
- diffuse greendb
- diffuse bluesr
- specular redsg
- specular greensb
- specular bluear
- ambient redag
- ambient greenab
- ambient blue
public Material setColor(double dr, double dg, double db, double dp, double sr, double sg, double sb, double sp, double ar, double ag, double ab)
dr
- diffuse reddg
- diffuse greendb
- diffuse bluedp
- diffuse exponentsr
- specular redsg
- specular greensb
- specular bluear
- ambient redag
- ambient greenab
- ambient blue
public Material setDoubleSided(boolean t)
t
- new value of isDoubleSided
public Material setTransparency(double t)
t
- new transparency value
public double getTransparency()
public void recache()
public void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |