Skip to content

niTriShapeData⚓︎

Contains the geometry data for an NiTriShape object.

This type inherits the following: niTriBasedGeometryData, niGeometryData, niObject

Properties⚓︎

activeTriangleCount⚓︎

The active triangle count of the object.

Returns:

  • result (number)

bounds⚓︎

The model-space bounding sphere of the object.

Returns:


colors⚓︎

Read-only. The vertex colors for the object. The length of the array is equal to vertexCount.

Returns:


normals⚓︎

Read-only. The list of unitized, model-space vertex normals for the object. The length of the array is equal to vertexCount.

Returns:


refCount⚓︎

Read-only. The number of references that exist for this object. When this value reaches zero, the object will be deleted.

Returns:

  • result (number)

RTTI⚓︎

Read-only. The runtime type information for this object. This is an alias for the .runTimeTypeInformation property.

Returns:


runTimeTypeInformation⚓︎

Read-only. The runtime type information for this object.

Returns:


texCoords⚓︎

Read-only. The array of texture coordinates. The length of the array is equal to vertexCount times textureSets.

Returns:


textures⚓︎

Read-only. The array of texture coordinates. The length of the array is equal to vertexCount times textureSets.

Returns:


textureSets⚓︎

The number of texture coordinate sets in the data.

Returns:

  • result (number)

triangleCount⚓︎

Read-only. The triangle count of the object.

Returns:

  • result (number)

triangles⚓︎

The access to the triangles of the object. The length of the array is equal to the number of active triangles.

Returns:


uniqueID⚓︎

Read-only. A unique ID for this model, assigned at model creation.

Returns:

  • result (number)

vertexCount⚓︎

Read-only. The vertex count for the object.

Returns:

  • result (number)

vertices⚓︎

Read-only. The array of vertex position data. The length of the array is equal to vertexCount.

Returns:


Methods⚓︎

clone⚓︎

Creates a copy of this object.

local result = myObject:clone()

Returns:


copy⚓︎

Creates a copy of the data. An optional table of filters can be passed to remove information from the copy.

local copiedData = myObject:copy({ normals = ..., colors = ..., texCoords = ... })

Parameters:

  • filters (table): Optional.
    • normals (boolean): Default: true. If false, the geometry data's normals will be absent from the copy.
    • colors (boolean): Default: true. If false, the geometry data's colors will be absent from the copy.
    • texCoords (boolean): Default: true. If false, the geometry data's texture coordinates will be absent from the copy.

Returns:


isInstanceOfType⚓︎

Determines if the object is of a given type, or of a type derived from the given type.

local result = myObject:isInstanceOfType(type)

Parameters:

Returns:

  • result (boolean)

isOfType⚓︎

Determines if the object is of a given type.

local result = myObject:isOfType(type)

Parameters:

Returns:

  • result (boolean)

markAsChanged⚓︎

Tells the renderer that the object has changed. Should be called after you have finished changing any vertex data.

If you have altered vertex positions, you may need to also call updateModelBound. You should call it if vertices have been moved outside the bounds of the original model.

myObject:markAsChanged()

saveBinary⚓︎

Serializes the object, and writes it to the given file.

local success = myObject:saveBinary(path)

Parameters:

  • path (string): The path to write the file at, relative to the Morrowind installation folder.

Returns:

  • success (boolean): If true the object was successfully serialized.

updateModelBound⚓︎

Updates the geometry bounds to match the vertex data. You should call it if vertices have been moved outside the bounds of the original model, or if the effective bounds have become significantly smaller.

If you already know the effective radius of the vertex data, you could more efficiently set the bounds directly instead of calling this function.

myObject:updateModelBound()