Class ARModel
The renderable content of an ARNode: geometry plus an optional base-color
texture or solid color. Models are immutable descriptors - the platform
backend uploads them into its native renderer when the node is attached to
an anchor.
Create a model either from a glTF 2.0 asset (.glb or .gltf bytes,
parsed with com.codename1.gpu.GltfLoader) or directly from a
com.codename1.gpu.Mesh such as one built by
com.codename1.gpu.Primitives. Geometry units are meters in the anchor's
local frame.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ARModelfromGltf(byte[] glbOrGltf) Creates a model from in-memory glTF 2.0 bytes (binary.glbor JSON.gltf).static ARModelfromGltf(InputStream in) Reads all bytes from the stream and creates a glTF model.static ARModelCreates a model from a mesh rendered in a single solid color.static ARModelCreates a model from a mesh with a base-color texture.The decoded base-color image, or null when the model has none.intgetColor()The solid base color as0xAARRGGBB, used when the model carries no texture.byte[]The raw glTF bytes as a newly allocated array, or null for mesh-based models.getMesh()The model geometry.
-
Method Details
-
fromGltf
Creates a model from in-memory glTF 2.0 bytes (binary
.glbor JSON.gltf). The geometry and base-color texture are parsed lazily on first access.Parameters
glbOrGltf: the raw model bytes
Returns
the model descriptor
-
fromGltf
Reads all bytes from the stream and creates a glTF model. The stream is closed.
Parameters
in: a stream over.glbor.gltfbytes
Returns
the model descriptor
- Throws:
IOException
-
fromMesh
-
fromMesh
-
getGltfBytes
public byte[] getGltfBytes()The raw glTF bytes as a newly allocated array, or null for mesh-based models. -
getMesh
The model geometry. For glTF models the geometry is parsed on first access. -
getBaseColorImage
The decoded base-color image, or null when the model has none. For glTF models the image is extracted on first access. -
getColor
public int getColor()The solid base color as0xAARRGGBB, used when the model carries no texture. Defaults to opaque white.
-