Package com.irurueta.geometry.io
Class Material
java.lang.Object
com.irurueta.geometry.io.Material
- Direct Known Subclasses:
Material3DS,MaterialOBJ
Structure containing parameters defining a material, such as color, texture,
etc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TextureAlpha texture.private shortAmbient blue color component value.private shortAmbient green color component value.private shortAmbient red color component value.private TextureAmbient texture.private TextureBump texture.private shortDiffuse blue color component value.private shortDiffuse green color component value.private shortDiffuse red color component value.private TextureDiffuse texture.private intMaterial ID.private IlluminationIllumination of this material.private shortSpecular blue color component value.private floatSpecular coefficient that determines how much shininess the material has.private booleanIndicates if specular coefficient is available or not.private shortSpecular green color component value.private shortSpecular red color component value.private TextureSpecular texture.private shortTransparency value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns alpha texture.shortReturns ambient blue color component value.shortReturns ambient green color component value.shortReturns ambient red color component value.Returns ambient texture.Returns bump texture.shortReturns diffuse blue color component value.shortReturns diffuse green color component value.shortReturns diffuse red color component value.Returns diffuse texture.intgetId()Returns id of material.Returns illumination method to be used for this material.shortReturns specular blue color component value.floatReturns specular coefficient.shortReturns specular green color component value.shortReturns specular red color component value.Returns specular texture.shortReturns transparency of this material.booleanIndicates if alpha texture has been defined and is available.booleanIndicates if ambient blue color component value is available.booleanIndicates if ambient color has been defined.booleanIndicates if ambient green color component value is available.booleanIndicates if ambient red color component value is available.booleanIndicates if ambient texture has been defined and is available.booleanIndicates if bump texture has been defined and is available.booleanIndicates if diffuse blue color component value is available.booleanIndicates if diffuse color has been defined.booleanIndicates if diffuse green color component value is available.booleanIndicates if diffuse red color component value is available.booleanIndicates if diffuse texture has been defined and is available.booleanIndicates if an illumination has been defined and is available.booleanIndicates if specular blue color component value is available.booleanIndicates if specular coefficient has been defined for this material.booleanIndicates if specular color has been defined.booleanIndicates if specular green color component value is available.booleanIndicates if specular red color component value is available.booleanIndicates if specular texture has been defined and is availablebooleanIndicates if transparency has been defined and is available.voidsetAlphaTextureMap(Texture alphaTextureMap) Sets alpha texture.voidsetAmbientBlueColor(short ambientBlueColor) Sets ambient blue color component value.voidsetAmbientColor(short red, short green, short blue) Sets all color components of ambient color.voidsetAmbientGreenColor(short ambientGreenColor) Sets ambient green color component value.voidsetAmbientRedColor(short ambientRedColor) Sets ambient red color component value.voidsetAmbientTextureMap(Texture ambientTextureMap) Sets ambient texture.voidsetBumpTextureMap(Texture bumpTextureMap) Sets bump texture.voidsetDiffuseBlueColor(short diffuseBlueColor) Sets diffuse blue color component value.voidsetDiffuseColor(short red, short green, short blue) Sets all color components of diffuse color.voidsetDiffuseGreenColor(short diffuseGreenColor) Sets diffuse green color component value.voidsetDiffuseRedColor(short diffuseRedColor) Sets diffuse red color component value.voidsetDiffuseTextureMap(Texture diffuseTextureMap) Sets diffuse texture.voidsetId(int id) Sets id of material.voidsetIllumination(Illumination illumination) Sets illumination method to be used for this material.voidsetSpecularBlueColor(short specularBlueColor) Sets specular blue color component value.voidsetSpecularCoefficient(float specularCoefficient) Sets specular coefficient.voidsetSpecularColor(short red, short green, short blue) Sets all color components of specular color.voidsetSpecularGreenColor(short specularGreenColor) Sets specular green color component value.voidsetSpecularRedColor(short specularRedColor) Sets specular red color component value.voidsetSpecularTextureMap(Texture specularTextureMap) Sets specular texture.voidsetTransparency(short transparency) Sets transparency of this material.
-
Field Details
-
id
private int idMaterial ID. This value is generated automatically when loading a 3D file, and it is intended to uniquely identify a material. -
ambientRedColor
private short ambientRedColorAmbient red color component value. If defined, must be between 0 and 255 (both included). -
ambientGreenColor
private short ambientGreenColorAmbient green color component value. If defined, must be between 0 and 255 (both included). -
ambientBlueColor
private short ambientBlueColorAmbient blue color component value. If defined, must be between 0 and 255 (both included). -
diffuseRedColor
private short diffuseRedColorDiffuse red color component value. If defined, must be between 0 and 255 (both included). -
diffuseGreenColor
private short diffuseGreenColorDiffuse green color component value. If defined, must be between 0 and 255 (both included). -
diffuseBlueColor
private short diffuseBlueColorDiffuse blue color component value. If defined, must be between 0 and 255 (both included). -
specularRedColor
private short specularRedColorSpecular red color component value. If defined, must be between 0 and 255 (both included). -
specularGreenColor
private short specularGreenColorSpecular green color component value. If defined, must be between 0 and 255 (both included). -
specularBlueColor
private short specularBlueColorSpecular blue color component value. If defined, must be between 0 and 255 (both included). -
specularCoefficient
private float specularCoefficientSpecular coefficient that determines how much shininess the material has. -
specularCoefficientAvailable
private boolean specularCoefficientAvailableIndicates if specular coefficient is available or not. -
ambientTextureMap
Ambient texture. -
diffuseTextureMap
Diffuse texture. -
specularTextureMap
Specular texture. -
alphaTextureMap
Alpha texture. -
bumpTextureMap
Bump texture. -
transparency
private short transparencyTransparency value. If defined, must be a value between 0 and 100 (both included). -
illumination
Illumination of this material.
-
-
Constructor Details
-
Material
public Material()
-
-
Method Details
-
getId
public int getId()Returns id of material. This value is generated automatically when loading a 3D file, and it is intended to uniquely identify a material- Returns:
- id of material.
-
setId
public void setId(int id) Sets id of material. This value must be generated when loading a 3D file, and it is intended to uniquely identify a material.- Parameters:
id- id of material to be set.
-
getAmbientRedColor
public short getAmbientRedColor()Returns ambient red color component value. If defined, must be between 0 and 255 (both included).- Returns:
- ambient red color component value.
-
setAmbientRedColor
public void setAmbientRedColor(short ambientRedColor) Sets ambient red color component value. If defined, must be between 0 and 255 (both included).- Parameters:
ambientRedColor- ambient red color component value to be set.
-
isAmbientRedColorAvailable
public boolean isAmbientRedColorAvailable()Indicates if ambient red color component value is available. Returns true if ambient red color is not negative.- Returns:
- true if ambient red color is not negative.
-
getAmbientGreenColor
public short getAmbientGreenColor()Returns ambient green color component value. If defined, must be between 0 and 255 (both included).- Returns:
- ambient green color component value.
-
setAmbientGreenColor
public void setAmbientGreenColor(short ambientGreenColor) Sets ambient green color component value. If defined, must be between 0 and 255 (both included).- Parameters:
ambientGreenColor- ambient green color component value to be set.
-
isAmbientGreenColorAvailable
public boolean isAmbientGreenColorAvailable()Indicates if ambient green color component value is available. Returns true if ambient green color is not negative.- Returns:
- true if ambient green color is not negative.
-
getAmbientBlueColor
public short getAmbientBlueColor()Returns ambient blue color component value. If defined, must be between 0 and 255 (both included).- Returns:
- ambient blue color component value.
-
setAmbientBlueColor
public void setAmbientBlueColor(short ambientBlueColor) Sets ambient blue color component value. If defined, must be between 0 and 255 (both included).- Parameters:
ambientBlueColor- ambient blue color component value to be set.
-
isAmbientBlueColorAvailable
public boolean isAmbientBlueColorAvailable()Indicates if ambient blue color component value is available. Returns true if ambient blue color is not negative.- Returns:
- true if ambient blue color is not negative.
-
setAmbientColor
public void setAmbientColor(short red, short green, short blue) Sets all color components of ambient color. Ambient color usually refers to the color of the light that gives a certain tonality to all the objects of a scene.- Parameters:
red- ambient red color component to be set. If defined, must be between 0 and 255 (both included).green- ambient green color component to be set. If defined, must be between 0 and 255 (both included).blue- ambient blue color component to be set. If defined, must be between 0 and 255 (both included).
-
isAmbientColorAvailable
public boolean isAmbientColorAvailable()Indicates if ambient color has been defined.- Returns:
- true if all components of ambient color have been defined (are not negative).
-
getDiffuseRedColor
public short getDiffuseRedColor()Returns diffuse red color component value. If defined, must be between 0 and 255 (both included).- Returns:
- diffuse red color component value.
-
setDiffuseRedColor
public void setDiffuseRedColor(short diffuseRedColor) Sets diffuse red color component value. If defined, must be between 0 and 255 (both included).- Parameters:
diffuseRedColor- diffuse red color component value to be set.
-
isDiffuseRedColorAvailable
public boolean isDiffuseRedColorAvailable()Indicates if diffuse red color component value is available. Returns true if diffuse red color is not negative.- Returns:
- true if diffuse red color is not negative.
-
getDiffuseGreenColor
public short getDiffuseGreenColor()Returns diffuse green color component value. If defined, must be between 0 and 255 (both included).- Returns:
- diffuse green color component value.
-
setDiffuseGreenColor
public void setDiffuseGreenColor(short diffuseGreenColor) Sets diffuse green color component value. If defined, must be between 0 and 255 (both included).- Parameters:
diffuseGreenColor- diffuse green color component value to be set.
-
isDiffuseGreenColorAvailable
public boolean isDiffuseGreenColorAvailable()Indicates if diffuse green color component value is available. Returns true if diffuse green color is not negative.- Returns:
- true if diffuse green color is not negative.
-
getDiffuseBlueColor
public short getDiffuseBlueColor()Returns diffuse blue color component value. If defined, must be between 0 and 255 (both included).- Returns:
- diffuse blue color component value.
-
setDiffuseBlueColor
public void setDiffuseBlueColor(short diffuseBlueColor) Sets diffuse blue color component value. If defined, must be between 0 and 255 (both included).- Parameters:
diffuseBlueColor- diffuse blue color component value to be set.
-
isDiffuseBlueColorAvailable
public boolean isDiffuseBlueColorAvailable()Indicates if diffuse blue color component value is available. Returns true if diffuse blue color is not negative.- Returns:
- true if diffuse blue color is not negative.
-
setDiffuseColor
public void setDiffuseColor(short red, short green, short blue) Sets all color components of diffuse color. Diffuse color usually refers to the surface color of a given object without accounting for highlights or shininess.- Parameters:
red- diffuse red color component to be set. If defined, must be between 0 and 255 (both included).green- diffuse green color component to be set. If defined, must be between 0 and 255 (both included).blue- diffuse blue color component to be set. If defined, must be between 0 and 255 (both included).
-
isDiffuseColorAvailable
public boolean isDiffuseColorAvailable()Indicates if diffuse color has been defined.- Returns:
- true if all components of diffuse color have been defined (are not negative).
-
getSpecularRedColor
public short getSpecularRedColor()Returns specular red color component value. If defined, must be between 0 and 255 (both included).- Returns:
- specular red color component value.
-
setSpecularRedColor
public void setSpecularRedColor(short specularRedColor) Sets specular red color component value. If defined, must be between 0 and 255 (both included).- Parameters:
specularRedColor- specular red color component value to be set.
-
isSpecularRedColorAvailable
public boolean isSpecularRedColorAvailable()Indicates if specular red color component value is available. Returns true if specular red color is not negative.- Returns:
- true if specular red color is not negative.
-
getSpecularGreenColor
public short getSpecularGreenColor()Returns specular green color component value. If defined, must be between 0 and 255 (both included).- Returns:
- specular green color component value.
-
setSpecularGreenColor
public void setSpecularGreenColor(short specularGreenColor) Sets specular green color component value. If defined, must be between 0 and 255 (both included).- Parameters:
specularGreenColor- specular green color component value to be set.
-
isSpecularGreenColorAvailable
public boolean isSpecularGreenColorAvailable()Indicates if specular green color component value is available. Returns true if specular green color is not negative.- Returns:
- true if specular green color is not negative.
-
getSpecularBlueColor
public short getSpecularBlueColor()Returns specular blue color component value. If defined, must be between 0 and 255 (both included).- Returns:
- specular blue color component value.
-
setSpecularBlueColor
public void setSpecularBlueColor(short specularBlueColor) Sets specular blue color component value. If defined, must be between 0 and 255 (both included).- Parameters:
specularBlueColor- specular blue color component value to be set.
-
isSpecularBlueColorAvailable
public boolean isSpecularBlueColorAvailable()Indicates if specular blue color component value is available. Returns true if specular blue color is not negative.- Returns:
- true if specular blue color is not negative.
-
setSpecularColor
public void setSpecularColor(short red, short green, short blue) Sets all color components of specular color. Specular color usually refers to the color of the highlights on an object surface when it shines because of the light.- Parameters:
red- specular red color component to be set. If defined, must be between 0 and 255 (both included).green- specular green color component to be set. If defined, must be between 0 and 255 (both included).blue- specular blue color component to be set. If defined, must be between 0 and 255 (both included).
-
isSpecularColorAvailable
public boolean isSpecularColorAvailable()Indicates if specular color has been defined.- Returns:
- true if all components of specular color have been defined (are not negative).
-
getSpecularCoefficient
public float getSpecularCoefficient()Returns specular coefficient. This indicates the amount of shininess of an object.- Returns:
- specular coefficient.
-
setSpecularCoefficient
public void setSpecularCoefficient(float specularCoefficient) Sets specular coefficient. This indicates the amount of shininess of an object.- Parameters:
specularCoefficient- specular coefficient to be set.
-
isSpecularCoefficientAvailable
public boolean isSpecularCoefficientAvailable()Indicates if specular coefficient has been defined for this material.- Returns:
- true if specular coefficient has been defined and is available, false otherwise.
-
getAmbientTextureMap
Returns ambient texture. Ambient texture usually refers to the texture used to give a certain tonality to an object, as if it was lit by some source of light.- Returns:
- ambient texture.
-
setAmbientTextureMap
Sets ambient texture. Ambient texture usually refers to the texture used to give a certain tonality to anb object, as if it was lit by some source of light.- Parameters:
ambientTextureMap- ambient texture to be set.
-
isAmbientTextureMapAvailable
public boolean isAmbientTextureMapAvailable()Indicates if ambient texture has been defined and is available.- Returns:
- true if ambient texture has been defined and is available, false otherwise.
-
getDiffuseTextureMap
Returns diffuse texture. Diffuse texture usually refers to the texture applied on the surface of an object as its color.- Returns:
- diffuse texture.
-
setDiffuseTextureMap
Sets diffuse texture. Diffuse texture usually refers to the texture applied on the surface of an object as its color.- Parameters:
diffuseTextureMap- diffuse texture to be set.
-
isDiffuseTextureMapAvailable
public boolean isDiffuseTextureMapAvailable()Indicates if diffuse texture has been defined and is available.- Returns:
- true if diffuse texture has been defined and is available, false otherwise.
-
getSpecularTextureMap
Returns specular texture. Specular texture usually refers to the highlights or sparkles applied on the surface of an object.- Returns:
- specular texture.
-
setSpecularTextureMap
Sets specular texture. Specular texture usually refers to the highlights or sparkles applied on the surface of an object.- Parameters:
specularTextureMap- specular texture to be set.
-
isSpecularTextureMapAvailable
public boolean isSpecularTextureMapAvailable()Indicates if specular texture has been defined and is available- Returns:
- true if specular texture has been defined and is available, false otherwise.
-
getAlphaTextureMap
Returns alpha texture. Alpha texture usually contains information related to transparency.- Returns:
- alpha texture.
-
setAlphaTextureMap
Sets alpha texture. Alpha texture usually contains information related to transparency.- Parameters:
alphaTextureMap- alpha texture to be set.
-
isAlphaTextureMapAvailable
public boolean isAlphaTextureMapAvailable()Indicates if alpha texture has been defined and is available.- Returns:
- true if alpha texture has been defined and is available, false otherwise.
-
getBumpTextureMap
Returns bump texture. Bump textures are used to give the appearance of bumpiness or rugosity to plain surfaces.- Returns:
- bump texture.
-
setBumpTextureMap
Sets bump texture. Bump textures are used to give the appearance of bumpiness or rugosity to plain surfaces.- Parameters:
bumpTextureMap- bump texture.
-
isBumpTextureMapAvailable
public boolean isBumpTextureMapAvailable()Indicates if bump texture has been defined and is available.- Returns:
- true if bump texture has been defined and is available, false otherwise.
-
getTransparency
public short getTransparency()Returns transparency of this material. If defined, value must be between 0 (no transparency) and 100 (totally transparent).- Returns:
- transparency of this material.
-
setTransparency
public void setTransparency(short transparency) Sets transparency of this material. If defined, value must be between 0 (no transparency) and 100 (totally transparent).- Parameters:
transparency- transparency of this material to be set.
-
isTransparencyAvailable
public boolean isTransparencyAvailable()Indicates if transparency has been defined and is available.- Returns:
- true if transparency is not negative, false otherwise.
-
getIllumination
Returns illumination method to be used for this material.- Returns:
- illumination.
-
setIllumination
Sets illumination method to be used for this material.- Parameters:
illumination- illumination method to be used.
-
isIlluminationAvailable
public boolean isIlluminationAvailable()Indicates if an illumination has been defined and is available.- Returns:
- true if illumination has been defined, false otherwise.
-