Skip to content

niGeometryData⚓︎

niGeometryData objects contain the geometry data necessary to render a niGeometry object. When a niGeometry-based object is created, the actual geometry data is stored in an attached niGeometryData object.

The distinction between niGeometry and niGeometryData (and other pairs of NetImmerse classes with similarly distinguished names, such as niTriShape and niTriShapeData) is that niGeometry stores data that cannot be shared when an object is instanced, and niGeometryData stores data that can be shared when an object is instanced. So, for example, when a scene graph is cloned, duplicate copies of the niGeometry objects in the original scene graph are created for the new scene graph, but new niGeometryData objects are not created. Instead, the newly-created niGeometry objects refer to the same niGeometryData objects referred to by the original scene graph.

This type inherits the following: niObject

Properties⚓︎

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)

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:


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()