public abstract class Material
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Material.BLENDING
Blending modes
|
static class |
Material.COLORS
Colors
|
static class |
Material.SHADING
Shading
|
static class |
Material.SIDE
Material sides
|
Constructor and Description |
---|
Material() |
Modifier and Type | Method and Description |
---|---|
boolean |
bufferGuessUVType() |
Material.COLORS |
bufferGuessVertexColorType() |
Shader |
buildShader(WebGLRenderingContext gl,
ProgramParameters parameters) |
abstract Material |
clone() |
Material |
clone(Material material) |
void |
deallocate(WebGLRenderer renderer) |
double |
getAlphaTest() |
BlendingFactorDest |
getBlendDst() |
BlendEquationMode |
getBlendEquation() |
Material.BLENDING |
getBlending() |
BlendingFactorSrc |
getBlendSrc() |
static Material |
getBufferMaterial(GeometryObject object,
GeometryGroup geometryGroup) |
int |
getId()
Gets unique number of this material instance.
|
java.lang.String |
getName()
Gets material name.
|
double |
getOpacity()
Gets opacity.
|
double |
getPolygonOffsetFactor() |
double |
getPolygonOffsetUnits() |
Shader |
getShader() |
Material.SIDE |
getSides() |
boolean |
isDepthTest() |
boolean |
isDepthWrite() |
boolean |
isNeedsUpdate() |
boolean |
isPolygonOffset() |
boolean |
isShadowPass() |
boolean |
isTransparent() |
boolean |
isVisible() |
boolean |
materialNeedsSmoothNormals() |
void |
refreshUniforms(Camera camera,
boolean isGammaInput) |
void |
setAlphaTest(double alphaTest)
Sets the alpha value to be used when running an alpha test.
|
void |
setBlendDst(BlendingFactorDest blendDst)
Sets blending destination.
|
void |
setBlendEquation(BlendEquationMode blendEquation)
Sets blending equation to use when applying blending.
|
void |
setBlending(Material.BLENDING blending)
Sets which blending to use when displaying objects with this material.
|
void |
setBlendSrc(BlendingFactorSrc blendSrc)
Sets blending source.
|
void |
setDepthTest(boolean depthTest)
Whether to have depth test enabled when rendering this material.
|
void |
setDepthWrite(boolean depthWrite)
Whether rendering this material has any effect on the depth buffer.
|
void |
setName(java.lang.String name) |
void |
setNeedsUpdate(boolean visible)
Specifies that the material needs to be updated, WebGL wise.
|
void |
setOpacity(double opacity)
Sets opacity.
|
void |
setPolygonOffset(boolean polygonOffset)
Whether to use polygon offset.
|
void |
setPolygonOffsetFactor(double polygonOffsetFactor)
Sets the polygon offset factor.
|
void |
setPolygonOffsetUnits(double polygonOffsetUnits)
Sets the polygon offset units.
|
void |
setShader(Shader shader) |
void |
setShadowPass(boolean isShadowPass) |
void |
setSide(Material.SIDE side)
Defines which of the face sides will be rendered - front, back or both.
|
void |
setTransparent(boolean transparent)
Defines whether this material is transparent.
|
void |
setVisible(boolean visible)
Defines whether this material is visible.
|
java.lang.String |
toString() |
void |
updateProgramParameters(ProgramParameters parameters) |
public int getId()
public java.lang.String getName()
public void setName(java.lang.String name)
public boolean isVisible()
public void setVisible(boolean visible)
Default is true.
public Material.SIDE getSides()
public void setSide(Material.SIDE side)
Default is Material.SIDE.FRONT
side
- see options Material.SIDE
.public boolean isNeedsUpdate()
public void setNeedsUpdate(boolean visible)
This property is automatically set to true when instancing a new material.
public double getOpacity()
public void setOpacity(double opacity)
public boolean isTransparent()
public void setTransparent(boolean transparent)
This has an effect on rendering, as transparent objects need an special treatment, and are rendered after the opaque (i.e. non transparent) objects.
public Material.BLENDING getBlending()
public void setBlending(Material.BLENDING blending)
Default is Material.BLENDING.NORMAL
.
public BlendingFactorSrc getBlendSrc()
public void setBlendSrc(BlendingFactorSrc blendSrc)
BlendingFactorSrc
constants.
Default is BlendingFactorSrc.SRC_ALPHA
.
blendSrc
- public BlendingFactorDest getBlendDst()
public void setBlendDst(BlendingFactorDest blendDst)
BlendingFactorDest
constants.
Default is BlendingFactorDest.ONE_MINUS_SRC_ALPHA
.
blendDst
- public BlendEquationMode getBlendEquation()
public void setBlendEquation(BlendEquationMode blendEquation)
BlendEquationMode
constants.
Default is BlendEquationMode.FUNC_ADD
.
blendEquation
- public boolean isDepthTest()
public void setDepthTest(boolean depthTest)
Default is true.
public boolean isDepthWrite()
public void setDepthWrite(boolean depthWrite)
Default is true.
When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
public boolean isPolygonOffset()
public void setPolygonOffset(boolean polygonOffset)
Default is false.
This corresponds to the POLYGON_OFFSET_FILL WebGL feature.
public double getPolygonOffsetFactor()
public void setPolygonOffsetFactor(double polygonOffsetFactor)
Default is 0.
public double getPolygonOffsetUnits()
public void setPolygonOffsetUnits(double polygonOffsetUnits)
Default is 0.
public double getAlphaTest()
public void setAlphaTest(double alphaTest)
Default is 0.
public boolean isShadowPass()
public void setShadowPass(boolean isShadowPass)
public Shader getShader()
public abstract Material clone()
clone
in class java.lang.Object
public void updateProgramParameters(ProgramParameters parameters)
public Shader buildShader(WebGLRenderingContext gl, ProgramParameters parameters)
public void setShader(Shader shader)
public void refreshUniforms(Camera camera, boolean isGammaInput)
public boolean materialNeedsSmoothNormals()
public Material.COLORS bufferGuessVertexColorType()
public boolean bufferGuessUVType()
public static Material getBufferMaterial(GeometryObject object, GeometryGroup geometryGroup)
public void deallocate(WebGLRenderer renderer)
public java.lang.String toString()
toString
in class java.lang.Object