|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectrender.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). |
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. |
boolean |
tableMode
Flag determining wheter to precompute and store color tables for direct look up intead of on the fly computation. |
| 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. |
Texture |
getTexture()
|
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. |
boolean |
loadLookupTable(java.io.File saved)
Reconstructs lookup table from output of lookupTableToString resP and res gets loaded as well returns whether or not succeeded |
boolean |
loadLookupTable(java.io.ObjectInputStream input)
|
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. |
boolean |
saveLookupTable(java.io.File file)
Returns true if save was successful What it writes to the file: 1) first: resP 2) look up table's entries The output file of this is passed into loadlookupTable to recreate the material's lookup table without having to recalculate those values. |
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)
Set a texture to the material. |
Material |
setTransparency(double t)
Sets the transparency of the material (0 transparent to 1 opaque). |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public boolean tableMode
public int resP
public int res
public boolean isDoubleSided
public boolean anisotropic
public double noiseF
public double noiseA
| 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)
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 value
public Material setDiffuse(double r,
double g,
double b)
r - redg - greenb - blue
public 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 components
public 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 Texture getTexture()
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.Runnablepublic boolean saveLookupTable(java.io.File file)
public boolean loadLookupTable(java.io.File saved)
public boolean loadLookupTable(java.io.ObjectInputStream input)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||