Salta ai contenuti
Seleziona lingua:Italiano
Questa pagina è disponibile solo in inglese.

Entities, meshes, textures, and 3D scene content

Aggiornato il 2 min di lettura

AuRea 3D content revolves around AuEntity. This class represents anything that can be transformed in space and, optionally, animated. In practical terms, the most important public hierarchy is:

  • AuEntity: common base type;
  • AuGroup: a transformable node used to group other entities;
  • AuObject: base type for rendered objects;
  • AuBasicObject: an object defined by mesh, texture, and color;
  • AuPbrObject: an object intended for physically based rendering workflows.

Both AuWorld and AuAnchor implement AuContainer, so they can directly receive entities:

val object3d = AuBasicObject(mesh, texture, 0xFFFFFFFFU, transform)
world.add(object3d)

or:

val object3d = AuBasicObject(mesh, texture, 0xFFFFFFFFU, transform)
anchor.add(object3d)

The choice depends on the intended behavior:

  • added to the world: content remains stable in the global scene;
  • added to an anchor: content follows a marker;
  • added to an AuGroup: content becomes part of a transformable sub-hierarchy.

Every AuEntity has a transformation matrix. This allows the application to:

  • position the object;
  • rotate it;
  • scale it;
  • update its pose over time.

When several elements must move together, it is better to place them inside an AuGroup and transform the group instead of manipulating each child individually.

The mesh defines the geometry of the object. AuRea supports two main approaches:

  • ready-to-use shapes such as rectangles, cubes, arrows, and frames;
  • meshes loaded from files or built from custom buffers.

Example with a built-in shape:

val mesh = AuMesh.Cube(width = 0.1f, height = 0.1f, depth = 0.1f)

Example with an OBJ file:

val mesh = AuMesh("models/chair.obj")

For more advanced cases, a mesh can also be built from AuVertexBuffer and AuIndexBuffer. In regular integrations, however, these types are best seen as the lower-level path for custom geometry that already exists in application code or content pipelines.

The texture defines the surface appearance of the object. In most cases, it starts from a bitmap loaded through AuLoader:

val bitmap = AuLoader.loadBitmap("textures/panel.png")
val texture = AuTexture(
bitmap,
AuTexture.WrapMode.CLAMP_TO_EDGE,
AuTexture.Filter.LINEAR,
AuTexture.Filter.LINEAR
)

When needed, textures can also be created from raw pixel buffers, for example for generated or precomputed assets.

AuBasicObject is the simplest choice when you already have a mesh and a texture and want an object that is immediately usable in the scene.

val panel = AuBasicObject(mesh, texture, 0xFFFFFFFFU, transform)
anchor.add(panel)

AuPbrObject is the better fit when the project uses a more realistic material pipeline, with dedicated textures such as albedo and roughness.

Animations are separate native entities that can be attached to any AuEntity. The right mental model is:

  • the object defines the base presence and transformation;
  • the animation applies a time-based variation.

Available animations include spin, jump, pulse, and flash. From a usage perspective:

val spin = AuAnimation.Spin(anglePerSecond = 1.5f, x = 0f, y = 1f, z = 0f)
object3d.add(spin)
  • Keep reusable assets such as meshes and textures separate from the scene objects that use them.
  • Use AuGroup to build readable hierarchies.
  • Add content to the world only when it should be global; everything else should live under anchors or groups.
  • Treat meshes, textures, animations, and objects as native resources.