Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.cult3d.world
Class Material

    java.lang.Object
      |
      +--com.cult3d.world.Material

public class Material
extends java.lang.Object

This class allows you to change material properties on a CultObject. Example code to change transparancy on a Cult3D object ``

      CultObject object = new CultObject("Gringo");
      Material m = new Material(true);
      m.setTransparancy(0.5f);
      object.setMaterialAt(0, m, false, false);

or you can use this method that is present in version 5.3 `

      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);

`

Since:
  Cult3D 4.2
See Also:
  `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

### UNCHANGED

    public static final float UNCHANGED

### RM_UNCHANGED

    public static final int RM_UNCHANGED

  Used in conjunction with setRenderMethod()
  Since:
    Cult3D 4.2

### RM_CONSTANTSHADING

    public static final int RM_CONSTANTSHADING

  Used in conjunction with setRenderMethod() and getRenderMethod()
  Since:
    Cult3D 4.2

### RM_FLATSHADING

    public static final int RM_FLATSHADING

  Used in conjunction with setRenderMethod() and getRenderMethod()
  Since:
    Cult3D 4.2

### RM_GOURADSHADING

    public static final int RM_GOURADSHADING

  Used in conjunction with setRenderMethod() and getRenderMethod()
  Since:
    Cult3D 4.2

### RM_PHONGSHADING

    public static final int RM_PHONGSHADING

  Used in conjunction with setRenderMethod() and getRenderMethod()
  Since:
    Cult3D 4.2

Constructor Detail

### Material

    public Material(boolean preserve)

  Constructor to do a new java representation of a material.
  Parameters:
    `preserve` - When applying material to a CultObject set to true to preserve the old material values otherwise the values will be discarded.
  Since:
    Cult3D 4.2

Method Detail

### getMaterialName

    public static java.lang.String getMaterialName(int materialIndex)

  Gets this CultObjects material name at specified index. If the material could not be found, this method will throw a NameNotFoundException.
  Parameters:
    `The` - material index you want to know the name of
  Returns:
    The name of the material, see method description for details.
  Throws:
    NameNotFoundException - if the material could not be found
  Since:
    Cult3D 5.3

### getMaterialIndex

    public static int getMaterialIndex(java.lang.String materialName)

  Gets this CultObjects material name by index. If the material could not be found, this method will throw a NameNotFoundException
  Parameters:
    `The` - material name you want to know the index of
  Returns:
    The index of the specified material.
  Throws:
    NameNotFoundException - if the material could not be found
  Since:
    Cult3D 5.3

### setRenderMethod

    public void setRenderMethod(int method)

  Changes the render algorithm of this material.
  Parameters:
    `method` - How this material will be rendered.
  Since:
    Cult3D 4.2
  See Also:
    `RM_CONSTANTSHADING`, `RM_FLATSHADING`, `RM_GOURADSHADING`, `RM_PHONGSHADING`

### getRenderMethod

    public int getRenderMethod()

  Gets the current render algorithm of this material.
  Returns:
    The algorithm this material are currently rendered in.
  Since:
    Cult3D 4.2
  See Also:
    `RM_CONSTANTSHADING`, `RM_FLATSHADING`, `RM_GOURADSHADING`, `RM_PHONGSHADING`

### setAmbientColor

    public void setAmbientColor(java.awt.Color c)

  Sets the ambient color on this material.
  The ambient color is the color of the object where it is in shadow.
  Parameters:
    `c` - The new ambient color, as a java.awt.Color, to change the ambient color to.
  Since:
    Cult3D 4.2

### setAmbientColor

    public void setAmbientColor(float r,
                                float g,
                                float b)

  Sets the ambient color on this material.
  The ambient color is the color of the object where it is in shadow.
  Parameters:
    `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
  Since:
    Cult3D 4.2

### setAmbientColor

    public void setAmbientColor(RGB rgb)

  Sets the ambient color on this material.
  The ambient color is the color of the object where it is in shadow.
  Parameters:
    `rgb` - The new ambient color, as a com.cult3d.world.RGB, to change to.
  Since:
    Cult3D 4.2
  See Also:
    `RGB`

### getAmbientColor

    public RGB getAmbientColor()

  Gets the ambient color of this material.
  Returns:
    The ambient color of this material as a com.cult3d.world.RGB
  Since:
    Cult3D 4.2
  See Also:
    `RGB`

### setDiffuseColor

    public void setDiffuseColor(java.awt.Color c)

  Sets the diffuse color on this material.
  The diffuse color is the color that the object reflects when illuminated by a light source.
  Parameters:
    `c` - The new diffuse color, as a java.awt.Color, to change to.
  Since:
    Cult3D 4.2

### setDiffuseColor

    public void setDiffuseColor(float r,
                                float g,
                                float b)

  Sets the diffuse color on this material.
  The diffuse color is the color that the object reflects when illuminated by a light source.
  Parameters:
    `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
  Since:
    Cult3D 4.2

### setDiffuseColor

    public void setDiffuseColor(RGB rgb)

  Sets the diffuse color on this material.
  The diffuse color is the color that the object reflects when illuminated by a light source.
  Parameters:
    `rgb` - The new RGB color to change the diffuse color to.
  Since:
    Cult3D 4.2
  See Also:
    `RGB`

### getDiffuseColor

    public RGB getDiffuseColor()

  Gets the diffuse color of this material. The diffuse color is the color that the object reflects when illuminated by a light source.
  Returns:
    The diffuse color of this material as a com.cult3d.world.RGB
  Since:
    Cult3D 4.2
  See Also:
    `RGB`

### setSpecularColor

    public void setSpecularColor(java.awt.Color c)

  Sets the specular color on this material.
  Specular color is the color used by reflective components (highlight and reflection map).
  Parameters:
    `c` - The new specular color, as a java.awt.Color, to change to.
  Since:
    Cult3D 4.2

### setSpecularColor

    public void setSpecularColor(float r,
                                 float g,
                                 float b)

  Sets the specular color on this material.
  Specular color is the color used by reflective components (highlight and reflection map).
  Parameters:
    `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
  Since:
    Cult3D 4.2

### setSpecularColor

    public void setSpecularColor(RGB rgb)

  Sets the specular color on this material.
  Specular color is the color used by reflective components (highlight and reflection map).
  Parameters:
    `rgb` - The new RGB color to change the specular color to.
  Since:
    Cult3D 4.2
  See Also:
    `RGB`

### getSpecularColor

    public RGB getSpecularColor()

  Gets the specular color of this material.
  Specular color is the color used by reflective components (highlight and reflection map).
  Returns:
    The specular color of this material as a com.cult3d.world.RGB
  Since:
    Cult3D 4.2
  See Also:
    `RGB`

### setSmoothness

    public void setSmoothness(float f)

  Sets the smoothness of the phong exponent. Smoothness is the phong exponent. Which affects the highlight on the surface. A high value (1.0 is max) makes a small highlight and a small value (min 0.0) makes a big highlight
  Parameters:
    `f` - The value to set the new smoothness to. The value must be between 0.0 and 1.0.
  Since:
    Cult3D 4.2

### getSmoothness

    public float getSmoothness()

  Sets the smoothness of the phong exponent. Smoothness is the phong exponent. Which affects the highlight on the surface. A high value (1.0 is max) makes a small highlight and a small value (min 0.0) makes a big highlight
  Returns:
    The value of this material's smoothness. The returned value is between 0.0 and 1.0, where 0.0 are smallest highlight and 1.0 are full hightlight.
  Since:
    Cult3D 4.2

### setTransparancy

    public void setTransparancy(float f)

  Sets the transparancy Strength to this material.
  Parameters:
    `f` - The strength of the transparancy given as a float between 0.0 and 1.0. Where 1.0 is 100% transparancy.
  Since:
    Cult3D 4.2

### getTransparancy

    public float getTransparancy()

  Gets the transparancy strength of this material.
  Returns:
    The strength of the transparancy given as a float between 0.0 and 1.0. Where 1.0 is 100% transparancy.
  Since:
    Cult3D 4.2

### setBump

    public void setBump(float f)

  Sets the bump strength on this material.
  Parameters:
    `f` - The strength of the bump given as a float between 0.0 and 1.0. Where 1.0 is full bump.
  Since:
    Cult3D 4.2

### getBump

    public float getBump()

  Gets the strength of the bump.
  Returns:
    The bump strength of this material. The value is between 0.0 and 1.0 where 1.0 is full bump.
  Since:
    Cult3D 4.2

### setReflection

    public void setReflection(float f)

  Sets the reflection strength on this material
  Parameters:
    `f` - The reflection strength of this material. The value is between0.0 and 1.0 where 1.0 is full reflection.
  Since:
    Cult3D 4.2

### getReflection

    public float getReflection()

  Gets the reflection strength of this material.
  Returns:
    The reflection strength of this material. The value is between 0.0 and 1.0 where 1.0 is full reflection.
  Since:
    Cult3D 4.2

### setSelfIllumination

    public void setSelfIllumination(float f)

  Self-illumination creates the illusion of an material glowing.
  Parameters:
    `f` - The strength of the self-illumination given as a float between 0.0 and 1.0. Where 1.0 is full self-illumination.
  Since:
    Cult3D 4.2

### getSelfIllumination

    public float getSelfIllumination()

  Gets the strength of the current self-illumination of this material.
  Returns:
    The strength of the self-illumination given as a float between 0.0 and 1.0. Where 1.0 is full self-illumination.
  Since:
    Cult3D 4.2

### setSpecularIntensity

    public void setSpecularIntensity(float intensity)

  Specular intensity sets the intensity of the Specular color of this material.
  Parameters:
    `intensity` - The strength of the specular intensity given as a float between 0.0 and 1.0. Where 1.0 is intensity.
  Since:
    Cult3D 5.3

### getSpecularIntensity

    public float getSpecularIntensity()

  Gets the strength of the current specular intensity of this material.
  Returns:
    The strength of the specular intensity given as a float between 0.0 and 1.0. Where 1.0 is full intensity
  Since:
    Cult3D 5.3

### setAmbientIntensity

    public void setAmbientIntensity(float intensity)

  Ambient intensity sets the intensity of the ambient color of this material.
  Parameters:
    `intensity` - The strength of the specular intensity given as a float between 0.0 and 1.0. Where 1.0 is intensity.
  Since:
    Cult3D 5.3

### getAmbientIntensity

    public float getAmbientIntensity()

  Gets the strength of the current ambient intensity of this material.
  Returns:
    The strength of the ambient intensity given as a float between 0.0 and 1.0. Where 1.0 is full intensity
  Since:
    Cult3D 5.3

### setDiffuseIntensity

    public void setDiffuseIntensity(float intensity)

  Diffuse intensity sets the intensity of the diffuse color of this material.
  Parameters:
    `intensity` - The strength of the specular intensity given as a float between 0.0 and 1.0. Where 1.0 is the highest intensity.
  Since:
    Cult3D 5.3

### getDiffuseIntensity

    public float getDiffuseIntensity()

  Gets the strength of the current diffuse intensity of this material.
  Returns:
    The strength of the diffuse intensity given as a float between 0.0 and 1.0. Where 1.0 is full intensity
  Since:
    Cult3D 5.3

### getTexture

    public Texture getTexture()

  Creates a new texture object if texture is available.
  Returns:
    a texture object or null if the material doesn't have a texture.
  Since:
    Cult3D 5.3

### getBumpTexture

    public Texture getBumpTexture()

  Creates a new texture object if bump texture is available.
  Returns:
    a texture object or null if the material doesn't have a bump texture.
  Since:
    Cult3D 5.3

### getReflectionTexture

    public Texture getReflectionTexture()

  Creates a new texture object if reflection texture is available.
  Returns:
    a texture object or null if the material doesn't have a reflection texture.
  Since:
    Cult3D 5.3

### getInfo

    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.

  Returns:
    A string representing this object.
  Since:
    Cult3D 5.3

### toString

    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.

  Overrides:
    toString in class java.lang.Object
  Returns:
    A String representing this class.

### setRefraction

    public void setRefraction(float f)

  Since:
    Cult3D 4.2

### getRefraction

    public float getRefraction()

  Since:
    Cult3D 4.2

### setSmoothAngle

    public void setSmoothAngle(float f)

  Since:
    Cult3D 4.2

### getSmoothAngle

    public float getSmoothAngle()

  Since:
    Cult3D 4.2

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD