# Class ARModel

java.lang.Object
com.codename1.ar.ARModel

public final class ARModel extends Object

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 Type
  Method
  Description
  `static ARModel`
  `fromGltf(byte[] glbOrGltf)`
  Creates a model from in-memory glTF 2.0 bytes (binary `.glb` or JSON `.gltf`).
  `static ARModel`
  `fromGltf(InputStream in)`
  Reads all bytes from the stream and creates a glTF model.
  `static ARModel`
  `fromMesh(Mesh mesh, int argbColor)`
  Creates a model from a mesh rendered in a single solid color.
  `static ARModel`
  `fromMesh(Mesh mesh, Image texture)`
  Creates a model from a mesh with a base-color texture.
  `Image`
  `getBaseColorImage()`
  The decoded base-color image, or null when the model has none.
  `int`
  `getColor()`
  The solid base color as `0xAARRGGBB`, used when the model carries no texture.
  `byte[]`
  `getGltfBytes()`
  The raw glTF bytes as a newly allocated array, or null for mesh-based models.
  `Mesh`
  `getMesh()`
  The model geometry.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### fromGltf

    public static ARModel fromGltf(byte[] glbOrGltf)

    Creates a model from in-memory glTF 2.0 bytes (binary `.glb` or 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

    public static ARModel fromGltf(InputStream in) throws IOException

    Reads all bytes from the stream and creates a glTF model. The stream is closed.

    ###### Parameters

    - `in`: a stream over `.glb` or `.gltf` bytes

    ###### Returns

    the model descriptor

    Throws:
      `IOException`

  - ### fromMesh

    public static ARModel fromMesh(Mesh mesh, int argbColor)

    Creates a model from a mesh rendered in a single solid color.

    ###### Parameters

    - `mesh`: the geometry, in meters

    - `argbColor`: the solid base color as `0xAARRGGBB`

    ###### Returns

    the model descriptor

  - ### fromMesh

    public static ARModel fromMesh(Mesh mesh, Image texture)

    Creates a model from a mesh with a base-color texture.

    ###### Parameters

    - `mesh`: the geometry, in meters, with texture coordinates

    - `texture`: the base-color image

    ###### Returns

    the model descriptor

  - ### getGltfBytes

    public byte[] getGltfBytes()
    The raw glTF bytes as a newly allocated array, or null for mesh-based models.

  - ### getMesh

    public Mesh getMesh()
    The model geometry. For glTF models the geometry is parsed on first access.

  - ### getBaseColorImage

    public Image 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 as `0xAARRGGBB`, used when the model carries no texture. Defaults to opaque white.