MaterialFactory

public final class MaterialFactory

Utility class used to construct default Materials.

Constants

String MATERIAL_COLOR Name of material parameter for controlling the color of makeOpaqueWithColor(Context, Color) and makeTransparentWithColor(Context, Color) materials.
String MATERIAL_METALLIC Name of material parameter for controlling the metallic property of all MaterialFactory materials.
String MATERIAL_REFLECTANCE Name of material parameter for controlling the reflectance property of all MaterialFactory materials.
String MATERIAL_ROUGHNESS Name of material parameter for controlling the roughness property of all MaterialFactory materials.
String MATERIAL_TEXTURE Name of material parameter for controlling the texture of makeOpaqueWithTexture(Context, Texture) and makeTransparentWithTexture(Context, Texture) materials.

Public Constructors

Public Methods

static CompletableFuture<Material>
makeOpaqueWithColor(Context context, Color color)
Creates an opaque Material with the Color passed in.
static CompletableFuture<Material>
makeOpaqueWithTexture(Context context, Texture texture)
Creates an opaque Material with the Texture passed in.
static CompletableFuture<Material>
makeTransparentWithColor(Context context, Color color)
Creates a transparent Material with the Color passed in.
static CompletableFuture<Material>
makeTransparentWithTexture(Context context, Texture texture)
Creates a transparent Material with the Texture passed in.

Inherited Methods

Constants

public static final String MATERIAL_COLOR

Name of material parameter for controlling the color of makeOpaqueWithColor(Context, Color) and makeTransparentWithColor(Context, Color) materials.

Constant Value: "color"

public static final String MATERIAL_METALLIC

Name of material parameter for controlling the metallic property of all MaterialFactory materials. 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.

Constant Value: "metallic"

public static final String MATERIAL_REFLECTANCE

Name of material parameter for controlling the reflectance property of all MaterialFactory materials. 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.

Constant Value: "reflectance"

public static final String MATERIAL_ROUGHNESS

Name of material parameter for controlling the roughness property of all MaterialFactory materials. 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.

Constant Value: "roughness"

public static final String MATERIAL_TEXTURE

Name of material parameter for controlling the texture of makeOpaqueWithTexture(Context, Texture) and makeTransparentWithTexture(Context, Texture) materials.

Constant Value: "texture"

Public Constructors

public MaterialFactory ()

Public Methods

public static CompletableFuture<Material> makeOpaqueWithColor (Context context, Color color)

Creates an opaque Material with the Color passed in. The Color can be modified by calling setFloat3(String, Color) with MATERIAL_COLOR. The metallicness, roughness, and reflectance can be modified using setFloat(String, float).

Parameters
context a context used for loading the material resource
color the color for the material to render
Returns
  • material that will render the given color

public static CompletableFuture<Material> makeOpaqueWithTexture (Context context, Texture texture)

Creates an opaque Material with the Texture passed in. The Texture can be modified by calling setTexture(String, Texture) with MATERIAL_TEXTURE. The metallicness, roughness, and reflectance can be modified using setFloat(String, float).

Parameters
context a context used for loading the material resource
texture the texture for the material to render
Returns
  • material that will render the given texture

public static CompletableFuture<Material> makeTransparentWithColor (Context context, Color color)

Creates a transparent Material with the Color passed in. The Color can be modified by calling setFloat4(String, Color) with MATERIAL_COLOR. The metallicness, roughness, and reflectance can be modified using setFloat(String, float).

Parameters
context a context used for loading the material resource
color the color for the material to render
Returns
  • material that will render the given color

public static CompletableFuture<Material> makeTransparentWithTexture (Context context, Texture texture)

Creates a transparent Material with the Texture passed in. The Texture can be modified by calling setTexture(String, Texture) with MATERIAL_TEXTURE. The metallicness, roughness, and reflectance can be modified using setFloat(String, float).

Parameters
context a context used for loading the material resource
texture the texture for the material to render
Returns
  • material that will render the given texture

Send feedback about...