Texture
public class Texture implements AutoCloseable
Represents a Texture in SceneCore.
A texture is an image that can be applied to a 3D model to give it color, detail, and realism. It can also be used as an alpha mask for a SurfaceEntity.
It's important to close a Texture when it's no longer needed to free up resources. This can be done by calling the close method or letting it get garbage collected.
Summary
Public methods |
|
|---|---|
void |
Closes the given |
static final @NonNull Texture |
Public factory for a Texture, asynchronously loading a preprocessed texture from a |
Public methods
close
@MainThread
public void close()
Closes the given Texture.
The Texture can be explicitly closed at anytime or garbage collected. In both cases, its resources are freed and an exception will be thrown if the Texture is used after being closed.
create
@MainThread
public static final @NonNull Texture create(@NonNull Session session, @NonNull Path path)
Public factory for a Texture, asynchronously loading a preprocessed texture from a Path relative to the application's assets/ folder.
Currently, only URLs and relative paths from the assets/ directory are supported.
| Parameters | |
|---|---|
@NonNull Session session |
|
@NonNull Path path |
The Path of the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if |