---
Product: Aspose.3D
Platform: java
Page Type: reference
Canonical URL: https://reference.aspose.org/3d/java/trimesh
---

# TriMesh

## Overview

`TriMesh` is a class in Aspose.3D FOSS for Java.
Inherits from: `Entity`, `Iterable<Vertex>`.

A TriMesh contains raw data that can be used by GPU directly.

This class provides 48 methods for working with TriMesh objects in Java programs.
Available methods include: `A3DObject`, `Entity`, `SceneObject`, `TriMesh`, `addTriangle`, `beginVertex`, `copyFrom`, `endVertex`, `findProperty`, `fromMesh`, `fromRawData`, `getBoundingBox`, and 27 additional methods.
All public members are accessible to any Java application after installing the Aspose.3D FOSS for Java package.
Properties: `boundingBox`, `capacity`, `entityRendererKey`, `excluded`, `indicesCount`, `name`, and 8 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `vertexDeclaration` | `VertexDeclaration` | Read | The vertex layout of the TriMesh. |
| `verticesCount` | `int` | Read | The count of vertices in this TriMesh
 @return The count of vertices in this TriMesh
 / |
| `indicesCount` | `int` | Read | The count of indices in this TriMesh
 @return The count of indices in this TriMesh
 / |
| `unmergedVerticesCount` | `int` | Read | The count of unmerged vertices that passed in by beginVertex() and endVertex(). |
| `capacity` | `int` | Read | The capacity of pre-allocated vertices. |
| `verticesSizeInBytes` | `int` | Read | The total size of all vertices in bytes
 @return The total size of all vertices in bytes
 / |
| `parentNode` | `Node` | Read/Write | Gets or sets the parent node. |
| `parentNodes` | `ArrayList<Node>` | Read | Gets the parent nodes. |
| `excluded` | `boolean` | Read/Write | Gets or sets the excluded. |
| `boundingBox` | `BoundingBox` | Read | Gets the bounding box. |
| `entityRendererKey` | `EntityRendererKey` | Read | Gets the entity renderer key. |
| `scene` | `Scene` | Read | Gets the scene. |
| `name` | `String` | Read/Write | Gets or sets the name. |
| `properties` | `PropertyCollection` | Read | Gets the properties. |

## Methods

| Signature | Description |
|-----------|-------------|
| `TriMesh(name: String, declaration: VertexDeclaration)` | Initialize an instance of TriMesh
 @param name The name of this TriMesh
 @param declaration The vertex's declaration
 / |
| `getVertexDeclaration()` → `VertexDeclaration` | The vertex layout of the TriMesh. |
| `getVerticesCount()` → `int` | The count of vertices in this TriMesh
 @return The count of vertices in this TriMesh
 / |
| `getIndicesCount()` → `int` | The count of indices in this TriMesh
 @return The count of indices in this TriMesh
 / |
| `getUnmergedVerticesCount()` → `int` | The count of unmerged vertices that passed in by beginVertex() and endVertex(). |
| `getCapacity()` → `int` | The capacity of pre-allocated vertices. |
| `getVerticesSizeInBytes()` → `int` | The total size of all vertices in bytes
 @return The total size of all vertices in bytes
 / |
| `fromMesh(declaration: VertexDeclaration, mesh: Mesh)` → `TriMesh` | **Not implemented in the FOSS edition — throws at runtime.** Create a TriMesh from given mesh object with given vertex layout. |
| `copyFrom(input: TriMesh, vd: VertexDeclaration)` → `TriMesh` | **Not implemented in the FOSS edition — throws at runtime.** Copy the TriMesh from input with new vertex layout
 @param input The input TriMesh for copying
 @param vd The new vertex declaration of the output TriMesh
 @return A new TriMesh instance with new vertex declaration. |
| `fromMesh(mesh: Mesh, useFloat: boolean)` → `TriMesh` | **Not implemented in the FOSS edition — throws at runtime.** Create a TriMesh from given mesh object, the vertex declaration are based on the input mesh's structure. |
| `fromMesh(mesh: Mesh)` → `TriMesh` | **Not implemented in the FOSS edition — throws at runtime.** Create a TriMesh from given mesh object, the vertex declaration are based on the input mesh's structure. |
| `beginVertex()` → `Vertex` | **Not implemented in the FOSS edition — throws at runtime.** Begin adding vertex
 @return The reference of internal vertex object in type Vertex
 / |
| `endVertex()` → `int` | **Not implemented in the FOSS edition — throws at runtime.** End adding vertex
 / |
| `writeVerticesTo(stream: Stream)` | **Not implemented in the FOSS edition — throws at runtime.** Write vertices data to the specified stream
 / |
| `write16bIndicesTo(stream: Stream)` | **Not implemented in the FOSS edition — throws at runtime.** Write the indices data as 16bit integer to the stream
 / |
| `write32bIndicesTo(stream: Stream)` | **Not implemented in the FOSS edition — throws at runtime.** Write the indices data as 32bit integer to the stream
 / |
| `writeVerticesTo(stream: OutputStream)` | **Not implemented in the FOSS edition — throws at runtime.** Write vertices to an OutputStream
 / |
| `write16bIndicesTo(stream: OutputStream)` | **Not implemented in the FOSS edition — throws at runtime.** Write 16-bit indices to an OutputStream
 / |
| `write32bIndicesTo(stream: OutputStream)` | **Not implemented in the FOSS edition — throws at runtime.** Write 32-bit indices to an OutputStream
 / |
| `verticesToArray()` → `byte[]` | **Not implemented in the FOSS edition — throws at runtime.** Vertices data as byte array
 @return Vertices data
 / |
| `indicesToArray(result: short[])` | **Not implemented in the FOSS edition — throws at runtime.** Indices data as short array
 @param result Result array
 / |
| `indicesToArray(result: int[])` | **Not implemented in the FOSS edition — throws at runtime.** Indices data as int array
 @param result Result array
 / |
| `toString()` → `String` | Calls toString on this TriMesh instance. |
| `fromRawData(vd: VertexDeclaration, vertices: byte[], indices: int[], generateVertexMapping: boolean)` → `TriMesh` | **Not implemented in the FOSS edition — throws at runtime.** Create a TriMesh from raw data
 @param vd Vertex declaration
 @param vertices Vertices data
 @param indices Indices data
 @param generateVertexMapping Generate vertex mapping
 @return TriMesh instance |
| `loadVerticesFromBytes(verticesInBytes: byte[])` | **Not implemented in the FOSS edition — throws at runtime.** Load vertices from byte array
 @param verticesInBytes Vertices data
 / |
| `addTriangle(a: int, b: int, c: int)` | Add a triangle
 @param a First vertex index
 @param b Second vertex index
 @param c Third vertex index
 / |
| `iterator()` → `java.util.Iterator<Vertex>` | **Not implemented in the FOSS edition — throws at runtime.** Calls iterator on this TriMesh instance. |
| `Entity(name: String)` | Calls Entity(name) on this TriMesh instance. |
| `getParentNode()` → `Node` | Returns the parent node. |
| `setParentNode(value: Node)` | Sets the parent node value. |
| `getParentNodes()` → `ArrayList<Node>` | Returns the parent nodes. |
| `getExcluded()` → `boolean` | Returns the excluded. |
| `setExcluded(value: boolean)` | Sets the excluded value. |
| `getBoundingBox()` → `BoundingBox` | Returns the bounding box. |
| `getEntityRendererKey()` → `EntityRendererKey` | Returns the entity renderer key. |
| `SceneObject()` | Calls SceneObject on this TriMesh instance. |
| `SceneObject(name: String)` | Calls SceneObject(name) on this TriMesh instance. |
| `getScene()` → `Scene` | Returns the scene. |
| `A3DObject()` | Calls A3DObject on this TriMesh instance. |
| `A3DObject(name: String)` | Calls A3DObject(name) on this TriMesh instance. |
| `getName()` → `String` | Returns the name. |
| `setName(name: String)` | Initialize an instance of TriMesh |
| `getProperties()` → `PropertyCollection` | Returns the properties. |
| `findProperty(name: String)` → `Property` | Calls findProperty(name) on this TriMesh instance. |
| `getProperty(name: String)` → `Object` | Calls getProperty(name) on this TriMesh instance. |
| `setProperty(name: String, value: Object)` | Sets the property value. |
| `removeProperty(name: String)` → `boolean` | Calls removeProperty(name) on this TriMesh instance. |
| `removeProperty(property: Property)` → `boolean` | Calls removeProperty(property) on this TriMesh instance. |

## See Also
- [Aspose.3D for Java — Enterprise API Reference](https://reference.aspose.com/3d/java/com.aspose.threed/trimesh/)