public class MaterialDesc extends Object
Materials can be assigned to objects that are rendered using resource handles.
For details, see ResourceManager.
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
MaterialDesc.MaterialAlphaMode |
Describes available alpha rendering modes of materials.
|
static class |
MaterialDesc.MaterialType |
Enumerates material types.
|
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
MATERIAL_CLEAR_COAT_BIT |
Specifies whether to use clear-coat parameters to simulate the multilayer material that has a thin
translucent layer over a standard layer.
|
static int |
MATERIAL_DOUBLE_SIDED_BIT |
Specifies whether this material is double-sided (disabled by default).
|
static int |
MATERIAL_NORMAL_MAP_BIT |
Specifies whether this material has a normal map enabled.
|
static int |
MATERIAL_SHADOW_RECEIVER_BIT |
Specifies whether this material receives shadows.
|
| 构造器 | 说明 |
|---|---|
MaterialDesc() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
float |
getAlphaCutoff() |
Obtains the alpha cutoff value of this material.
|
MaterialDesc.MaterialAlphaMode |
getAlphaMode() |
Obtains the alpha rendering mode of this material.
|
GpuResourceHandle |
getAmbientOcclusion() |
Obtains the handle to the ambient occlusion texture.
|
float |
getAmbientOcclusionFactor() |
Obtains the ambient occlusion factor of this material.
|
GpuResourceHandle |
getBaseColor() |
Obtains the handle to the base color texture.
|
Vector4 |
getBaseColorFactor() |
Obtains the base color factor of this material.
|
float |
getClearCoatFactor() |
Obtains the clear coat factor of this material, which is used if
MATERIAL_CLEAR_COAT_BIT
is set by calling setMaterialFlags(int). |
float |
getClearCoatRoughness() |
Obtains the clear coat roughness of this material, which is used if
MATERIAL_CLEAR_COAT_BIT is set by calling setMaterialFlags(int). |
GpuResourceHandle |
getEmissive() |
Obtains the handle to the emissive texture.
|
Vector3 |
getEmissiveFactor() |
Obtains the emissive factor of this material.
|
float |
getGlossinessFactor() |
Obtains the glossiness factor of this material, which is used if the material type is set to
MaterialType#SPECULAR_GLOSSINESS. |
GpuResourceHandle |
getMaterial() |
Obtains the handle to the material texture.
|
int |
getMaterialFlags() |
Obtains the material flags that define the shader variant to be used by this material.
|
float |
getMetallicFactor() |
Obtains the metallic factor of this material, which is used if the material type is set to
MaterialType#METALLIC_ROUGHNESS. |
GpuResourceHandle |
getNormal() |
Obtains the handle to the normal texture.
|
float |
getNormalScale() |
Obtains the normal scale.
|
float |
getReflectance() |
Obtains the reflectance of this material.
|
float |
getRoughnessFactor() |
Obtains the roughness factor of this material, which is used if the material type is set to
MaterialType#METALLIC_ROUGHNESS. |
GpuResourceHandle |
getSampler() |
Obtains the handle to the sampler used by this material.
|
Vector3 |
getSpecularFactor() |
Obtains the specular factor (specular RGB color) of this material, which is used if the material type is
set to
MaterialType#SPECULAR_GLOSSINESS. |
MaterialDesc.MaterialType |
getType() |
Obtains the type of this material.
|
void |
setAlphaCutoff(float alphaCutoff) |
Sets the alpha cutoff value of this material, which is used if the alpha mode is set to
MaterialAlphaMode#MASK. |
void |
setAlphaMode(MaterialDesc.MaterialAlphaMode alphaMode) |
Sets the alpha rendering mode of this material.
|
void |
setAmbientOcclusion(GpuResourceHandle ambientOcclusion) |
Sets a handle for the ambient occlusion texture.
|
void |
setAmbientOcclusionFactor(float ambientOcclusionFactor) |
Sets the ambient occlusion factor of this material.
|
void |
setBaseColor(GpuResourceHandle baseColor) |
Sets a handle for the base color texture of this material.
|
void |
setBaseColorFactor(Vector4 baseColorFactor) |
Sets the base color factor of this material.
|
void |
setClearCoatFactor(float clearCoatFactor) |
Sets the clear coat factor of this materiel.
|
void |
setClearCoatRoughness(float clearCoatRoughness) |
Sets the clear coat roughness of this material, which is used if
MATERIAL_CLEAR_COAT_BIT is set by calling setMaterialFlags(int). |
void |
setEmissive(GpuResourceHandle emissive) |
Sets a handle for the emissive texture of this material.
|
void |
setEmissiveFactor(Vector3 emissiveFactor) |
Sets the emissive factor of this material.
|
void |
setGlossinessFactor(float glossinessFactor) |
Sets the glossiness factor of this material.
|
void |
setMaterial(GpuResourceHandle material) |
Sets a handle for the material texture.
|
void |
setMaterialFlags(int materialFlags) |
Sets the material flags that define the shader variant to be used by this material.
|
void |
setMetallicFactor(float metallicFactor) |
Sets the metallic factor of this material.
|
void |
setNormal(GpuResourceHandle normal) |
Sets a handle for the normal texture of this material.
|
void |
setNormalScale(float normalScale) |
Sets the normal scale of this material.
|
void |
setReflectance(float reflectance) |
Sets the reflectance of this material at normal incidence.
|
void |
setRoughnessFactor(float roughnessFactor) |
Sets the roughness factor of this material.
|
void |
setSampler(GpuResourceHandle sampler) |
Sets a handle for the sampler used by this material.
|
void |
setSpecularFactor(Vector3 specularFactor) |
Sets the specular factor (specular RGB color) of this material.
|
void |
setType(MaterialDesc.MaterialType type) |
Sets the type of this material.
|
public static final int MATERIAL_CLEAR_COAT_BIT
setMaterialFlags(int).public static final int MATERIAL_DOUBLE_SIDED_BIT
setMaterialFlags(int).public static final int MATERIAL_NORMAL_MAP_BIT
setMaterialFlags(int).public static final int MATERIAL_SHADOW_RECEIVER_BIT
setMaterialFlags(int).public MaterialDesc.MaterialType getType()
public void setType(MaterialDesc.MaterialType type)
type - Indicates the material type.public GpuResourceHandle getBaseColor()
null otherwise.public void setBaseColor(GpuResourceHandle baseColor)
baseColor - Indicates the GpuResourceHandle object defining the handle to the base color texture.public GpuResourceHandle getNormal()
null otherwise.public void setNormal(GpuResourceHandle normal)
normal - Indicates the GpuResourceHandle object defining the handle to the normal texture.public GpuResourceHandle getEmissive()
null otherwise.public void setEmissive(GpuResourceHandle emissive)
emissive - Indicates the GpuResourceHandle object defining the handle to the emissive texture.public GpuResourceHandle getMaterial()
setType(ohos.agp.render.render3d.resources.MaterialDesc.MaterialType).null otherwise.public void setMaterial(GpuResourceHandle material)
getMaterial().material - Indicates the GpuResourceHandle object defining the handle to the material texture.public GpuResourceHandle getAmbientOcclusion()
null otherwise.public void setAmbientOcclusion(GpuResourceHandle ambientOcclusion)
ambientOcclusion - Indicates the GpuResourceHandle object defining the handle to the
ambient occlusion texture.public GpuResourceHandle getSampler()
public void setSampler(GpuResourceHandle sampler)
sampler - Indicates the GpuResourceHandle object defining the handle to the sampler.public Vector4 getBaseColorFactor()
setBaseColor(ohos.agp.render.render3d.resources.GpuResourceHandle), the texture values will be multiplied by this factor.public void setBaseColorFactor(Vector4 baseColorFactor)
getBaseColorFactor().baseColorFactor - Indicates the Vector4 object containing the base color factor.public Vector3 getEmissiveFactor()
setEmissive(ohos.agp.render.render3d.resources.GpuResourceHandle), the texture values will be multiplied by this factor.
The factor value ranges from 0.0 (not emissive) to 1.0 (fully emissive).public void setEmissiveFactor(Vector3 emissiveFactor)
getEmissiveFactor().emissiveFactor - Indicates the Vector3 object containing the emissive factor.public float getAmbientOcclusionFactor()
setAmbientOcclusion(ohos.agp.render.render3d.resources.GpuResourceHandle), the texture value will be multiplied by this factor.
The factor value ranges from 0.0 (no ambient occlusion) to 1.0 (all ambient occlusion).public void setAmbientOcclusionFactor(float ambientOcclusionFactor)
getAmbientOcclusionFactor().ambientOcclusionFactor - Indicates the ambient occlusion factor to set.public float getRoughnessFactor()
MaterialType#METALLIC_ROUGHNESS. The factor value ranges from 0.0 (smooth) to 1.0 (rough).public void setRoughnessFactor(float roughnessFactor)
getRoughnessFactor().roughnessFactor - Indicates the roughness factor to set.public float getMetallicFactor()
MaterialType#METALLIC_ROUGHNESS. The factor value ranges from 0.0 (dielectric) to 1.0 (metallic).public void setMetallicFactor(float metallicFactor)
getMetallicFactor().metallicFactor - Indicates the metallic factor.public float getReflectance()
public void setReflectance(float reflectance)
0.04.reflectance - Indicates the reflectance to set.public float getNormalScale()
public void setNormalScale(float normalScale)
getNormalScale().normalScale - Indicates the normal scale to set.public Vector3 getSpecularFactor()
MaterialType#SPECULAR_GLOSSINESS. This value is linear, and the default value is
1.0, 1.0, 1.0.public void setSpecularFactor(Vector3 specularFactor)
getSpecularFactor().specularFactor - Indicates the Vector3 object containing the specular factor.public float getGlossinessFactor()
MaterialType#SPECULAR_GLOSSINESS. The glossiness factor defines how glossy (or smooth) a material is.
The factor value ranges from 0.0 (completely rough or not glossy) to 1.0 (perfectly smooth or fully glossy).public void setGlossinessFactor(float glossinessFactor)
getGlossinessFactor().glossinessFactor - Indicates the glossiness factor to set.public float getClearCoatFactor()
MATERIAL_CLEAR_COAT_BIT
is set by calling setMaterialFlags(int). The default value is 0.0.public void setClearCoatFactor(float clearCoatFactor)
0.5.
For details, see getClearCoatFactor().clearCoatFactor - Indicates the clear coat factor to set.public float getClearCoatRoughness()
MATERIAL_CLEAR_COAT_BIT is set by calling setMaterialFlags(int).
The default value is 0.5.public void setClearCoatRoughness(float clearCoatRoughness)
MATERIAL_CLEAR_COAT_BIT is set by calling setMaterialFlags(int).
The default value is 0.5.clearCoatRoughness - Indicates the clear coat roughness to set.public MaterialDesc.MaterialAlphaMode getAlphaMode()
public void setAlphaMode(MaterialDesc.MaterialAlphaMode alphaMode)
MaterialDesc.MaterialAlphaMode.alphaMode - Indicates the alpha rendering mode to set.public float getAlphaCutoff()
public void setAlphaCutoff(float alphaCutoff)
MaterialAlphaMode#MASK. The value ranges from 0.0 to 1.0.alphaCutoff - Indicates the alpha cutoff value to set.public int getMaterialFlags()
MATERIAL_DOUBLE_SIDED_BIT, MATERIAL_CLEAR_COAT_BIT,
MATERIAL_SHADOW_RECEIVER_BIT, and MATERIAL_NORMAL_MAP_BIT.public void setMaterialFlags(int materialFlags)
getMaterialFlags().materialFlags - Indicates the material flags to set.