-
public class MaterialA Filament Material defines the visual appearance of an object. Materials function as a templates from which MaterialInstances can be spawned. Use Builder to construct a Material object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumMaterial.ShadingSupported shading models
public enumMaterial.InterpolationAttribute interpolation types in the fragment shader
public enumMaterial.BlendingModeSupported blending modes
public enumMaterial.RefractionModeSupported refraction modes
public enumMaterial.RefractionTypeSupported refraction types
public enumMaterial.VertexDomainSupported types of vertex domains
public enumMaterial.CullingModeFace culling Mode
public classMaterial.Parameterpublic classMaterial.Builder
-
Constructor Summary
Constructors Constructor Description Material(long nativeMaterial)
-
Method Summary
Modifier and Type Method Description MaterialInstancecreateInstance()Creates a new instance of this material. MaterialInstancecreateInstance(@NonNull() String name)Creates a new instance of this material with a specified name. MaterialInstancegetDefaultInstance()Returns the material's default instance. StringgetName()Returns the name of this material. Material.ShadinggetShading()Returns the shading model of this material. Material.InterpolationgetInterpolation()Returns the interpolation mode of this material. Material.BlendingModegetBlendingMode()Returns the blending mode of this material. Material.RefractionModegetRefractionMode()Returns the refraction mode of this material. Material.RefractionTypegetRefractionType()Returns the refraction type of this material. Material.VertexDomaingetVertexDomain()Returns the vertex domain of this material. Material.CullingModegetCullingMode()Returns the default culling mode of this material. booleanisColorWriteEnabled()Indicates whether instances of this material will, by default, write to the color buffer. booleanisDepthWriteEnabled()Indicates whether instances of this material will, by default, write to the depth buffer. booleanisDepthCullingEnabled()Indicates whether instances of this material will, by default, use depth testing. booleanisDoubleSided()Indicates whether this material is double-sided. booleanisAlphaToCoverageEnabled()Indicates whether instances of this material will use alpha to coverage. floatgetMaskThreshold()Returns the alpha mask threshold used when the blending mode is set to masked. floatgetSpecularAntiAliasingVariance()Returns the screen-space variance for specular-antialiasing. floatgetSpecularAntiAliasingThreshold()Returns the clamping threshold for specular-antialiasing. Set<VertexBuffer.VertexAttribute>getRequiredAttributes()Returns a set of VertexBuffer.VertexAttributes that are required by this material. intgetParameterCount()Returns the number of parameters declared by this material.The returned value can be 0. List<Material.Parameter>getParameters()Returns a list of Parameter objects representing this material's parameters.The list may be empty if the material has no declared parameters. booleanhasParameter(@NonNull() String name)Indicates whether a parameter of the given name exists on this material. voidsetDefaultParameter(@NonNull() String name, boolean x)Sets the value of a bool parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, float x)Sets the value of a float parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, int x)Sets the value of an int parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, boolean x, boolean y)Sets the value of a bool2 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, float x, float y)Sets the value of a float2 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, int x, int y)Sets the value of an int2 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, boolean x, boolean y, boolean z)Sets the value of a bool3 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, float x, float y, float z)Sets the value of a float3 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, int x, int y, int z)Sets the value of a int3 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, boolean x, boolean y, boolean z, boolean w)Sets the value of a bool4 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, float x, float y, float z, float w)Sets the value of a float4 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, int x, int y, int z, int w)Sets the value of a int4 parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.BooleanElement type, @NonNull() @Size(min = 1) Array<boolean> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)Set a bool parameter array by name. voidsetDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.IntElement type, @NonNull() @Size(min = 1) Array<int> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)Set an int parameter array by name. voidsetDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.FloatElement type, @NonNull() @Size(min = 1) Array<float> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)Set a float parameter array by name. voidsetDefaultParameter(@NonNull() String name, @NonNull() Colors.RgbType type, float r, float g, float b)Sets the color of the given parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, @NonNull() Colors.RgbaType type, float r, float g, float b, float a)Sets the color of the given parameter on this material's default instance. voidsetDefaultParameter(@NonNull() String name, @NonNull() Texture texture, @NonNull() TextureSampler sampler)Sets a texture and sampler parameter on this material's default instance. longgetNativeObject()-
-
Method Detail
-
createInstance
@NonNull() MaterialInstance createInstance()
Creates a new instance of this material. Material instances should be freed using destroyMaterialInstance.
-
createInstance
@NonNull() MaterialInstance createInstance(@NonNull() String name)
Creates a new instance of this material with a specified name. Material instances should befreed using destroyMaterialInstance.
- Parameters:
name- arbitrary label to associate with the given material instance
-
getDefaultInstance
@NonNull() MaterialInstance getDefaultInstance()
Returns the material's default instance.
-
getName
String getName()
Returns the name of this material. The material name is used for debugging purposes.
-
getShading
Material.Shading getShading()
Returns the shading model of this material.
-
getInterpolation
Material.Interpolation getInterpolation()
Returns the interpolation mode of this material. This affects how variables are interpolated.
-
getBlendingMode
Material.BlendingMode getBlendingMode()
Returns the blending mode of this material.
-
getRefractionMode
Material.RefractionMode getRefractionMode()
Returns the refraction mode of this material.
-
getRefractionType
Material.RefractionType getRefractionType()
Returns the refraction type of this material.
-
getVertexDomain
Material.VertexDomain getVertexDomain()
Returns the vertex domain of this material.
-
getCullingMode
Material.CullingMode getCullingMode()
Returns the default culling mode of this material.
-
isColorWriteEnabled
boolean isColorWriteEnabled()
Indicates whether instances of this material will, by default, write to the color buffer.
-
isDepthWriteEnabled
boolean isDepthWriteEnabled()
Indicates whether instances of this material will, by default, write to the depth buffer.
-
isDepthCullingEnabled
boolean isDepthCullingEnabled()
Indicates whether instances of this material will, by default, use depth testing.
-
isDoubleSided
boolean isDoubleSided()
Indicates whether this material is double-sided.
-
isAlphaToCoverageEnabled
boolean isAlphaToCoverageEnabled()
Indicates whether instances of this material will use alpha to coverage.
-
getMaskThreshold
float getMaskThreshold()
Returns the alpha mask threshold used when the blending mode is set to masked.
-
getSpecularAntiAliasingVariance
float getSpecularAntiAliasingVariance()
Returns the screen-space variance for specular-antialiasing. This value is between 0 and 1.
-
getSpecularAntiAliasingThreshold
float getSpecularAntiAliasingThreshold()
Returns the clamping threshold for specular-antialiasing. This value is between 0 and 1.
-
getRequiredAttributes
Set<VertexBuffer.VertexAttribute> getRequiredAttributes()
Returns a set of VertexBuffer.VertexAttributes that are required by this material.
-
getParameterCount
int getParameterCount()
Returns the number of parameters declared by this material.The returned value can be 0.
-
getParameters
List<Material.Parameter> getParameters()
Returns a list of Parameter objects representing this material's parameters.The list may be empty if the material has no declared parameters.
-
hasParameter
boolean hasParameter(@NonNull() String name)
Indicates whether a parameter of the given name exists on this material.
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, boolean x)
Sets the value of a bool parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the material parameter
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, float x)
Sets the value of a float parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the material parameter
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, int x)
Sets the value of an int parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the material parameter
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, boolean x, boolean y)
Sets the value of a bool2 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, float x, float y)
Sets the value of a float2 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, int x, int y)
Sets the value of an int2 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, boolean x, boolean y, boolean z)
Sets the value of a bool3 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second componentz- the value of the third component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, float x, float y, float z)
Sets the value of a float3 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second componentz- the value of the third component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, int x, int y, int z)
Sets the value of a int3 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second componentz- the value of the third component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, boolean x, boolean y, boolean z, boolean w)
Sets the value of a bool4 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second componentz- the value of the third componentw- the value of the fourth component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, float x, float y, float z, float w)
Sets the value of a float4 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second componentz- the value of the third componentw- the value of the fourth component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, int x, int y, int z, int w)
Sets the value of a int4 parameter on this material's default instance.
- Parameters:
name- the name of the material parameterx- the value of the first componenty- the value of the second componentz- the value of the third componentw- the value of the fourth component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.BooleanElement type, @NonNull() @Size(min = 1) Array<boolean> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)
Set a bool parameter array by name.
- Parameters:
name- name of the parameter array as defined by this Materialtype- the number of components for each individual parameterv- array of values to set to the named parameter arrayoffset- the number of elements invto skipcount- the number of elements in the parameter array to setFor example, to set a parameter array of 4 bool4s:{@code * boolean[] a = new boolean[4 * 4]; * material.setDefaultParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 0, 4); * }
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.IntElement type, @NonNull() @Size(min = 1) Array<int> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)
Set an int parameter array by name.
- Parameters:
name- name of the parameter array as defined by this Materialtype- the number of components for each individual parameterv- array of values to set to the named parameter arrayoffset- the number of elements invto skipcount- the number of elements in the parameter array to setFor example, to set a parameter array of 4 int4s:{@code * int[] a = new int[4 * 4]; * material.setDefaultParameter("param", MaterialInstance.IntElement.INT4, a, 0, 4); * }
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.FloatElement type, @NonNull() @Size(min = 1) Array<float> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)
Set a float parameter array by name.
- Parameters:
name- name of the parameter array as defined by this Materialtype- the number of components for each individual parameterv- array of values to set to the named parameter arrayoffset- the number of elements invto skipcount- the number of elements in the parameter array to setFor example, to set a parameter array of 4 float4s:{@code * float[] a = new float[4 * 4]; * material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 0, 4); * }
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, @NonNull() Colors.RgbType type, float r, float g, float b)
Sets the color of the given parameter on this material's default instance.
- Parameters:
name- the name of the material color parametertype- whether the color is specified in the linear or sRGB spacer- red componentg- green componentb- blue component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, @NonNull() Colors.RgbaType type, float r, float g, float b, float a)
Sets the color of the given parameter on this material's default instance.
- Parameters:
name- the name of the material color parametertype- whether the color is specified in the linear or sRGB spacer- red componentg- green componentb- blue componenta- alpha component
-
setDefaultParameter
void setDefaultParameter(@NonNull() String name, @NonNull() Texture texture, @NonNull() TextureSampler sampler)
Sets a texture and sampler parameter on this material's default instance.
- Parameters:
name- The name of the material texture parametertexture- The texture to set as parametersampler- The sampler to be used with this texture
-
getNativeObject
long getNativeObject()
-
-
-
-