|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.cult3d.world.Material
This class allows you to change material properties on a CultObject.
Example code to change transparancy on a Cult3D object
or you can use this method that is present in version 5.3
CultObject object = new CultObject("Gringo");
Material m = new Material(true);
m.setTransparancy(0.5f);
object.setMaterialAt(0, m, false, false);
int materialIndex = Material.getMaterialIndex("MaterialName");
CultObject object = new CultObject("SubMaterialObject");
Material mat = object.getMaterialAt(materialIndex);
mat.setTransparancy(0.5f);
object.setMaterialAt(materialIndex, mat, false, false);
CultObject
Field Summary | |
static int |
RM_CONSTANTSHADING
Used in conjunction with setRenderMethod() and getRenderMethod() |
static int |
RM_FLATSHADING
Used in conjunction with setRenderMethod() and getRenderMethod() |
static int |
RM_GOURADSHADING
Used in conjunction with setRenderMethod() and getRenderMethod() |
static int |
RM_PHONGSHADING
Used in conjunction with setRenderMethod() and getRenderMethod() |
static int |
RM_UNCHANGED
Used in conjunction with setRenderMethod() |
static float |
UNCHANGED
|
Constructor Summary | |
Material(boolean preserve)
Constructor to do a new java representation of a material. |
Method Summary | |
RGB |
getAmbientColor()
Gets the ambient color of this material. |
float |
getAmbientIntensity()
Gets the strength of the current ambient intensity of this material. |
float |
getBump()
Gets the strength of the bump. |
Texture |
getBumpTexture()
Creates a new texture object if bump texture is available. |
RGB |
getDiffuseColor()
Gets the diffuse color of this material. |
float |
getDiffuseIntensity()
Gets the strength of the current diffuse intensity of this material. |
java.lang.String |
getInfo()
Returns a string representation of the values of this object. |
static int |
getMaterialIndex(java.lang.String materialName)
Gets this CultObjects material name by index. |
static java.lang.String |
getMaterialName(int materialIndex)
Gets this CultObjects material name at specified index. |
float |
getReflection()
Gets the reflection strength of this material. |
Texture |
getReflectionTexture()
Creates a new texture object if reflection texture is available. |
float |
getRefraction()
|
int |
getRenderMethod()
Gets the current render algorithm of this material. |
float |
getSelfIllumination()
Gets the strength of the current self-illumination of this material. |
float |
getSmoothAngle()
|
float |
getSmoothness()
Sets the smoothness of the phong exponent. |
RGB |
getSpecularColor()
Gets the specular color of this material. |
float |
getSpecularIntensity()
Gets the strength of the current specular intensity of this material. |
Texture |
getTexture()
Creates a new texture object if texture is available. |
float |
getTransparancy()
Gets the transparancy strength of this material. |
void |
setAmbientColor(java.awt.Color c)
Sets the ambient color on this material. |
void |
setAmbientColor(float r,
float g,
float b)
Sets the ambient color on this material. |
void |
setAmbientColor(RGB rgb)
Sets the ambient color on this material. |
void |
setAmbientIntensity(float intensity)
Ambient intensity sets the intensity of the ambient color of this material. |
void |
setBump(float f)
Sets the bump strength on this material. |
void |
setDiffuseColor(java.awt.Color c)
Sets the diffuse color on this material. |
void |
setDiffuseColor(float r,
float g,
float b)
Sets the diffuse color on this material. |
void |
setDiffuseColor(RGB rgb)
Sets the diffuse color on this material. |
void |
setDiffuseIntensity(float intensity)
Diffuse intensity sets the intensity of the diffuse color of this material. |
void |
setReflection(float f)
Sets the reflection strength on this material |
void |
setRefraction(float f)
|
void |
setRenderMethod(int method)
Changes the render algorithm of this material. |
void |
setSelfIllumination(float f)
Self-illumination creates the illusion of an material glowing. |
void |
setSmoothAngle(float f)
|
void |
setSmoothness(float f)
Sets the smoothness of the phong exponent. |
void |
setSpecularColor(java.awt.Color c)
Sets the specular color on this material. |
void |
setSpecularColor(float r,
float g,
float b)
Sets the specular color on this material. |
void |
setSpecularColor(RGB rgb)
Sets the specular color on this material. |
void |
setSpecularIntensity(float intensity)
Specular intensity sets the intensity of the Specular color of this material. |
void |
setTransparancy(float f)
Sets the transparancy Strength to this material. |
java.lang.String |
toString()
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final float UNCHANGED
public static final int RM_UNCHANGED
public static final int RM_CONSTANTSHADING
public static final int RM_FLATSHADING
public static final int RM_GOURADSHADING
public static final int RM_PHONGSHADING
Constructor Detail |
public Material(boolean preserve)
preserve
- When applying material to a CultObject set to true to preserve the old material values otherwise
the values will be discarded.Method Detail |
public static java.lang.String getMaterialName(int materialIndex)
The
- material index you want to know the name ofpublic static int getMaterialIndex(java.lang.String materialName)
The
- material name you want to know the index ofpublic void setRenderMethod(int method)
method
- How this material will be rendered.RM_CONSTANTSHADING
,
RM_FLATSHADING
,
RM_GOURADSHADING
,
RM_PHONGSHADING
public int getRenderMethod()
RM_CONSTANTSHADING
,
RM_FLATSHADING
,
RM_GOURADSHADING
,
RM_PHONGSHADING
public void setAmbientColor(java.awt.Color c)
c
- The new ambient color, as a java.awt.Color, to change the ambient color to.public void setAmbientColor(float r, float g, float b)
r
- The red part of the color, given as a float between 0.0 and 1.0 g
- The green part of the color, given as a float between 0.0 and 1.0 b
- The blue part of the color, given as a float between 0.0 and 1.0 public void setAmbientColor(RGB rgb)
rgb
- The new ambient color, as a com.cult3d.world.RGB, to change to.RGB
public RGB getAmbientColor()
RGB
public void setDiffuseColor(java.awt.Color c)
c
- The new diffuse color, as a java.awt.Color, to change to.public void setDiffuseColor(float r, float g, float b)
r
- The red part of the color, given as a float between 0.0 and 1.0g
- The green part of the color, given as a float between 0.0 and 1.0b
- The blue part of the color, given as a float between 0.0 and 1.0public void setDiffuseColor(RGB rgb)
rgb
- The new RGB color to change the diffuse color to.RGB
public RGB getDiffuseColor()
RGB
public void setSpecularColor(java.awt.Color c)
c
- The new specular color, as a java.awt.Color, to change to.public void setSpecularColor(float r, float g, float b)
r
- The red part of the color, given as a float between 0.0 and 1.0g
- The green part of the color, given as a float between 0.0 and 1.0b
- The blue part of the color, given as a float between 0.0 and 1.0public void setSpecularColor(RGB rgb)
rgb
- The new RGB color to change the specular color to.RGB
public RGB getSpecularColor()
RGB
public void setSmoothness(float f)
f
- The value to set the new smoothness to. The value must be between 0.0 and 1.0.public float getSmoothness()
public void setTransparancy(float f)
f
- The strength of the transparancy given as a float between 0.0 and 1.0. Where 1.0 is 100% transparancy.public float getTransparancy()
public void setBump(float f)
f
- The strength of the bump given as a float between 0.0 and 1.0. Where 1.0 is full bump.public float getBump()
public void setReflection(float f)
f
- The reflection strength of this material. The value is between0.0 and 1.0 where 1.0 is full reflection.public float getReflection()
public void setSelfIllumination(float f)
f
- The strength of the self-illumination given as a float between 0.0 and 1.0. Where 1.0 is full self-illumination.public float getSelfIllumination()
public void setSpecularIntensity(float intensity)
intensity
- The strength of the specular intensity given as a float between 0.0 and 1.0. Where 1.0 is intensity.public float getSpecularIntensity()
public void setAmbientIntensity(float intensity)
intensity
- The strength of the specular intensity given as a float between 0.0 and 1.0. Where 1.0 is intensity.public float getAmbientIntensity()
public void setDiffuseIntensity(float intensity)
intensity
- The strength of the specular intensity given as a float between 0.0 and 1.0. Where 1.0 is the highest intensity.public float getDiffuseIntensity()
public Texture getTexture()
public Texture getBumpTexture()
public Texture getReflectionTexture()
public java.lang.String getInfo()
Returns a string representation of the values of this object.
The string contains the name of this class, the material name, render method, color type, intensity, strength, smoothnes, trasnparancy and existing texture names.
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
public java.lang.String toString()
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
public void setRefraction(float f)
public float getRefraction()
public void setSmoothAngle(float f)
public float getSmoothAngle()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |