Class MaterialFactory
- java.lang.Object
-
- com.google.ar.sceneform.rendering.MaterialFactory
-
@RequiresApi(api=24) public final class MaterialFactory extends java.lang.ObjectUtility class used to construct defaultMaterials.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMATERIAL_COLORName of material parameter for controlling the color ofmakeOpaqueWithColor(Context, Color)andmakeTransparentWithColor(Context, Color)materials.static java.lang.StringMATERIAL_METALLICName of material parameter for controlling the metallic property of allMaterialFactorymaterials.static java.lang.StringMATERIAL_REFLECTANCEName of material parameter for controlling the reflectance property of allMaterialFactorymaterials.static java.lang.StringMATERIAL_ROUGHNESSName of material parameter for controlling the roughness property of allMaterialFactorymaterials.static java.lang.StringMATERIAL_TEXTUREName of material parameter for controlling the texture ofmakeOpaqueWithTexture(Context, Texture)andmakeTransparentWithTexture(Context, Texture)materials.
-
Constructor Summary
Constructors Constructor Description MaterialFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.CompletableFuture<Material>makeOpaqueWithColor(android.content.Context context, Color color)static java.util.concurrent.CompletableFuture<Material>makeOpaqueWithTexture(android.content.Context context, Texture texture)static java.util.concurrent.CompletableFuture<Material>makeTransparentWithColor(android.content.Context context, Color color)static java.util.concurrent.CompletableFuture<Material>makeTransparentWithTexture(android.content.Context context, Texture texture)
-
-
-
Field Detail
-
MATERIAL_COLOR
public static final java.lang.String MATERIAL_COLOR
Name of material parameter for controlling the color ofmakeOpaqueWithColor(Context, Color)andmakeTransparentWithColor(Context, Color)materials.
-
MATERIAL_TEXTURE
public static final java.lang.String MATERIAL_TEXTURE
Name of material parameter for controlling the texture ofmakeOpaqueWithTexture(Context, Texture)andmakeTransparentWithTexture(Context, Texture)materials.
-
MATERIAL_METALLIC
public static final java.lang.String MATERIAL_METALLIC
Name of material parameter for controlling the metallic property of allMaterialFactorymaterials. The metallic property defines whether the surface is a metallic (conductor) or a non-metallic (dielectric) surface. This property should be used as a binary value, set to either 0 or 1. Intermediate values are only truly useful to create transitions between different types of surfaces when using textures. The default value is 0.
-
MATERIAL_ROUGHNESS
public static final java.lang.String MATERIAL_ROUGHNESS
Name of material parameter for controlling the roughness property of allMaterialFactorymaterials. The roughness property controls the perceived smoothness of the surface. When roughness is set to 0, the surface is perfectly smooth and highly glossy. The rougher a surface is, the "blurrier" the reflections are. The default value is 0.4.
-
MATERIAL_REFLECTANCE
public static final java.lang.String MATERIAL_REFLECTANCE
Name of material parameter for controlling the reflectance property of allMaterialFactorymaterials. The reflectance property only affects non-metallic surfaces. This property can be used to control the specular intensity. This value is defined between 0 and 1 and represents a remapping of a percentage of reflectance. The default value is 0.5.
-
-
Method Detail
-
makeOpaqueWithColor
public static java.util.concurrent.CompletableFuture<Material> makeOpaqueWithColor(android.content.Context context, Color color)
Creates an opaqueMaterialwith theColorpassed in. TheColorcan be modified by callingMaterial.setFloat3(String, Color)withMATERIAL_COLOR. The metallicness, roughness, and reflectance can be modified usingMaterial.setFloat(String, float).- Parameters:
context- a context used for loading the material resourcecolor- the color for the material to render- Returns:
- material that will render the given color
- See Also:
MATERIAL_METALLIC,MATERIAL_ROUGHNESS,MATERIAL_REFLECTANCE
-
makeTransparentWithColor
public static java.util.concurrent.CompletableFuture<Material> makeTransparentWithColor(android.content.Context context, Color color)
Creates a transparentMaterialwith theColorpassed in. TheColorcan be modified by callingMaterial.setFloat4(String, Color)withMATERIAL_COLOR. The metallicness, roughness, and reflectance can be modified usingMaterial.setFloat(String, float).- Parameters:
context- a context used for loading the material resourcecolor- the color for the material to render- Returns:
- material that will render the given color
- See Also:
MATERIAL_METALLIC,MATERIAL_ROUGHNESS,MATERIAL_REFLECTANCE
-
makeOpaqueWithTexture
public static java.util.concurrent.CompletableFuture<Material> makeOpaqueWithTexture(android.content.Context context, Texture texture)
Creates an opaqueMaterialwith theTexturepassed in. TheTexturecan be modified by callingMaterial.setTexture(String, Texture)withMATERIAL_TEXTURE. The metallicness, roughness, and reflectance can be modified usingMaterial.setFloat(String, float).- Parameters:
context- a context used for loading the material resourcetexture- the texture for the material to render- Returns:
- material that will render the given texture
- See Also:
MATERIAL_METALLIC,MATERIAL_ROUGHNESS,MATERIAL_REFLECTANCE
-
makeTransparentWithTexture
public static java.util.concurrent.CompletableFuture<Material> makeTransparentWithTexture(android.content.Context context, Texture texture)
Creates a transparentMaterialwith theTexturepassed in. TheTexturecan be modified by callingMaterial.setTexture(String, Texture)withMATERIAL_TEXTURE. The metallicness, roughness, and reflectance can be modified usingMaterial.setFloat(String, float).- Parameters:
context- a context used for loading the material resourcetexture- the texture for the material to render- Returns:
- material that will render the given texture
- See Also:
MATERIAL_METALLIC,MATERIAL_ROUGHNESS,MATERIAL_REFLECTANCE
-
-