|
|||||||||
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 | |
boolean |
anisotropic
Indicates whether the material is anisotropic (light reflection varies with respect to direction). |
protected double[] |
color
Holds the color information ( Diffuse color R,G,B, Specular Color R,G,B, Specular exponent). |
protected double[] |
glow
Ambient lighting color values in RGB (glow) (range [0,1]). |
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 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. |
double[] |
getAmbient()
Gets the glow light components (r, g, b). |
double[] |
getDiffuse()
Gets the diffuse color components in RGB (range 0 to 1). |
double[] |
getDS()
Returns the diffuse and specular light components. |
double[] |
getDSA()
Gets the diffuse, specular, and ambient light components. |
double[] |
getSpecular()
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[] c)
Deprecated. Use specific color-setting functions, see setDS(double, double, double, double, double, double, double) . |
Material |
setColor(double dr,
double dg,
double db)
Deprecated. Use specific color-setting functions, see setDiffuse(double, double, double) . |
Material |
setColor(double dr,
double dg,
double db,
double sr,
double sg,
double sb,
double sp)
Deprecated. Use specific color-setting functions, see setDS(double, double, double, double, double, double, double) . |
Material |
setColor(double dr,
double dg,
double db,
double sr,
double sg,
double sb,
double sp,
double ar,
double ag,
double ab)
Deprecated. Use specific color-setting functions, see setDSA(double, double, double, double, double, double, double, double, double, double) . |
Material |
setDiffuse(double r,
double g,
double b)
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 |
setDS(double dr,
double dg,
double db,
double sr,
double sg,
double sb,
double p)
Sets the diffuse and specular values of color. |
Material |
setDSA(double dr,
double dg,
double db,
double sr,
double sg,
double sb,
double p,
double ar,
double ag,
double ab)
Sets the diffuse, specular, and ambient values of color. |
Material |
setGlow(double[] g)
Deprecated. Use specific color setting function, setAmbient(double, double, double) |
Material |
setGlow(double r,
double g,
double b)
Deprecated. Use specific color setting function, setAmbient(double, double, double) |
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[] color
protected double transparency
protected double[] glow
protected Texture texture
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 setColor(double[] c)
setDS(double, double, double, double, double, double, double)
.
c
- color values corresponding to [dred, dgreen, dblue, sred,
sgreen, sblue, s exponent].
public Material setDiffuse(double r, double g, double b)
r
- redg
- greenb
- bluepublic double[] getDiffuse()
public Material setSpecular(double r, double g, double b, double p)
r
- redg
- greenb
- blue
public double[] getSpecular()
public Material setAmbient(double r, double g, double b)
r
- redg
- greenb
- blue
public double[] getAmbient()
public Material setDS(double dr, double dg, double db, double sr, double sg, double sb, double p)
dr
- diffuse reddg
- diffuse greendb
- diffuse bluesr
- specular redsg
- specular greensb
- specular blue
public double[] getDS()
public Material setDSA(double dr, double dg, double db, double sr, double sg, double sb, double p, 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 double[] getDSA()
public Material setColor(double dr, double dg, double db)
setDiffuse(double, double, double)
.
dr
- diffuse reddg
- diffuse greendb
- diffuse blue
public Material setColor(double dr, double dg, double db, double sr, double sg, double sb, double sp)
setDS(double, double, double, double, double, double, double)
.
dr
- diffuse reddg
- diffuse greendb
- diffuse bluesr
- specular redsg
- specular greensb
- specular bluesp
- specular exponent
setDS(double, double, double, double, double, double, double)
public Material setColor(double dr, double dg, double db, double sr, double sg, double sb, double sp, double ar, double ag, double ab)
setDSA(double, double, double, double, double, double, double, double, double, double)
.
dr
- diffuse reddg
- diffuse greendb
- diffuse bluesr
- 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 Material setGlow(double[] g)
setAmbient(double, double, double)
g
- array of [red, green, blue] values in range 0..1
setAmbient(double, double, double)
public Material setGlow(double r, double g, double b)
setAmbient(double, double, double)
r
- redg
- greenb
- blue
setAmbient(double, double, double)
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 |