WaterMaterial


public final class WaterMaterial extends Material


A Material which implements a water effect.

Summary

Public methods

static final @NonNull ListenableFuture<@NonNull WaterMaterial>
@MainThread
create(@NonNull Session session, boolean isAlphaMapVersion)

Public factory function for a WaterMaterial, where the material is asynchronously loaded.

final void

Disposes the given water material resource.

final void

Sets the alpha map for the alpha map version of the water material.

final void
@MainThread
setAlphaStepMultiplier(float alphaStepMultiplier)

Sets the alpha step multiplier for the alpha map version of the water material.

final void
@MainThread
setNormalBoundary(float normalBoundary)

Sets the normal boundary for the alpha map version of the water material.

final void

Sets the normal map texture for the water material.

final void
@MainThread
setNormalSpeed(float normalSpeed)

Sets the normal speed for the water material.

final void
@MainThread
setNormalTiling(float normalTiling)

Sets the normal tiling for the water material.

final void
@MainThread
setNormalZ(float normalZ)

Sets the normal z for the alpha map version of the water material.

final void

Sets the reflection cube texture for the water material.

Public methods

create

Added in 1.0.0-alpha04
@MainThread
public static final @NonNull ListenableFuture<@NonNull WaterMaterialcreate(@NonNull Session session, boolean isAlphaMapVersion)

Public factory function for a WaterMaterial, where the material is asynchronously loaded.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
@NonNull Session session

The Session to use for loading the model.

boolean isAlphaMapVersion

If the water material should be the alpha map version or not.

Returns
@NonNull ListenableFuture<@NonNull WaterMaterial>

a ListenableFuture. Listeners will be called on the main thread if Runnable::run is supplied.

dispose

Added in 1.0.0-alpha04
@MainThread
public final void dispose()

Disposes the given water material resource.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Currently, a glTF model (which this material will be used with) can't be disposed. This means that calling dispose on the material will lead to a crash if the call is made out of order, that is, if the material is disposed before the glTF model that uses it.

setAlphaMap

Added in 1.0.0-alpha04
@MainThread
public final void setAlphaMap(@NonNull Texture alphaMap)

Sets the alpha map for the alpha map version of the water material.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
@NonNull Texture alphaMap

The alpha map.

Throws
kotlin.IllegalStateException

if the water material is not the alpha map version.

setAlphaStepMultiplier

Added in 1.0.0-alpha04
@MainThread
public final void setAlphaStepMultiplier(float alphaStepMultiplier)

Sets the alpha step multiplier for the alpha map version of the water material.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
float alphaStepMultiplier

The alpha step multiplier.

Throws
kotlin.IllegalStateException

if the water material is not the alpha map version.

setNormalBoundary

Added in 1.0.0-alpha04
@MainThread
public final void setNormalBoundary(float normalBoundary)

Sets the normal boundary for the alpha map version of the water material.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
float normalBoundary

The normal boundary.

Throws
kotlin.IllegalStateException

if the water material is not the alpha map version.

setNormalMap

Added in 1.0.0-alpha04
@MainThread
public final void setNormalMap(@NonNull Texture normalMap)

Sets the normal map texture for the water material.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
@NonNull Texture normalMap

The Texture to be used as the normal map.

setNormalSpeed

Added in 1.0.0-alpha04
@MainThread
public final void setNormalSpeed(float normalSpeed)

Sets the normal speed for the water material.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
float normalSpeed

The speed of the normal map.

setNormalTiling

Added in 1.0.0-alpha04
@MainThread
public final void setNormalTiling(float normalTiling)

Sets the normal tiling for the water material.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
float normalTiling

The tiling of the normal map.

setNormalZ

Added in 1.0.0-alpha04
@MainThread
public final void setNormalZ(float normalZ)

Sets the normal z for the alpha map version of the water material.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
float normalZ

The normal z.

Throws
kotlin.IllegalStateException

if the water material is not the alpha map version.

setReflectionCube

Added in 1.0.0-alpha04
@MainThread
public final void setReflectionCube(@NonNull CubeMapTexture reflectionCube)

Sets the reflection cube texture for the water material.

This method must be called from the main thread. https://developer.android.com/guide/components/processes-and-threads

Parameters
@NonNull CubeMapTexture reflectionCube

The CubeMapTexture to be used as the reflection cube.