< Previous | Contents | Manuals Home | Boris FX | Next >
Mesh Re-Numbering
The original vertex, normal, and texture indices for each resulting vertex can be stored and used to reconstruct the original numbering, by suitable importers and exporters.
Note: Only the Filmbox and OBJ importers currently store this information; only the OBJ and Filmbox exporters currently export it (though the resulting FBX files are widely usable).
It is common for there to be multiple vertices at a single XYZ position, with different UV coordinates or normals. To get unique XYZ vertices, use the ToUniqueVertexMap, FromUniqueVertexMap, etc functions to generate/emulate that on the fly, especially for constructed, primitive, or modified meshes. The Filmbox and OBJ exporters can do this, for example code consult the OBJ exporter (mshobj.szl).
The following functions are all for Mesh objects:
.ClearOriginalNormalNumbers() Removes any existing original normal number
data.
.ClearOriginalNumbers() Removes any existing original number data
(vertex, normal, and texture).
.ClearOriginalTextureNumbers() Removes any existing original texture number
data.
.ClearOriginalVertexNumbers() Removes any existing original vertex number
data.
.FromOriginalNormalMap() Returns a read-only list with one element for
each original normal. That element is the number of any of the vertices created from the original normal. See also ToOriginalNormalMap, nOriginalNormal, OriginalNormal, etc.
.FromOriginalTextureMap() Returns a read-only list with one element for
each original texture coordinate. That element is the number of any of the vertices created from the original texture coordinate. See also ToOriginalTextureMap, nOriginalTexture, OriginalTexture, etc.
.FromOriginalVertexMap() Returns a read-only list with one element for
each original vertex. That element is the number of any of the vertices created from the original vertex. See also
ToOriginalVertexMap, nOriginalVertex, OriginalVertex, etc.
.FromUniqueNormalMap() Returns a read-only list with one element for
each unique normal. That element is the number of any of the vertices with the same normal. See also ToUniqueNormalMap, nUniqueNormal, etc.
.FromUniqueTextureMap() Returns a read-only list with one element for
each unique texture coordinate. That element is the number of any of the vertices with the same texture coordinate. See also ToUniqueTextureMap, nUniqueTexture, etc.
.FromUniqueVertexMap() Returns a read-only list with one element for
each unique vertex. That element is the number of any of the vertices with the same position. See also ToUniqueVertexMap, nUniqueVertex, etc.
.hasOriginalNormalNumbers() Has stored original normal index numbers
from import; the number matches the number of vertices present.
.hasOriginalTextureNumbers() Has stored original texture index numbers
from import; the number matches the number of vertices present.
.hasOriginalVertexNumbers() Has stored original vertex numbers from
import; the number matches the number of vertices present.
.nOriginalNormal The number of stored original normal indices from the importer. Read-only. (This number must match the number of current vertices for that information to be usable.)
.nOriginalTexture The number of stored original texture indices from the importer. Read-only. (This number must match the number of current vertices for that information to be usable.)
.nOriginalVertex The number of stored original vertex numbers from the importer. Read-only. (This number must match the number of current vertices for that information to be usable.)
.nUniqueNormal The number of unique normals, ie discarding redundant normals. Read-only. See ToUniqueNormalMap(), FromUniqueNormalMap().
.nUniqueTexture The number of unique texture coordinates, ie discarding redundant texture coordinates.
Read-only. See also ToUniqueTextureMap(), FromUniqueTextureMap().
.nUniqueVertex The number of unique vertices, ie discarding redundant vertices that occupy the same location. Read-only. See also RepeatedVertexLoops(), ToUniqueVertexMap(), FromUniqueVertexMap(), and UpdateVertexMaps().
.OriginalNormal(v) Returns the original normal index for the given vertex, as stored by the importer. See also HasOriginalVertexNumbers, OriginalVertexMap and SetOriginalVertex.
.OriginalTexture(v) Returns the original texture index for the given vertex, as stored by the importer. See also HasOriginalVertexNumbers, OriginalVertexMap and SetOriginalVertex.
.OriginalVertex(v) Returns the original vertex index for the given vertex, as stored by the importer. See also HasOriginalVertexNumbers, OriginalVertexMap and SetOriginalVertex.
.RepeatedVertexLoops() Returns a read-only list that has a vertex
number for each vertex. If list[v] is 0 (illegal), the vertex v is not repeated. If list[v] is nonzero, it is another vertex number at the exact same xyz location. The vertex number can be chased from one to another until arriving back at the original location, at which chasing should be stopped! See also NUniqueVertex(), ToUniqueVertexMap(), and FromUniqueVertexMap().
.SetOriginalNormal(v, v0) Sets the original normal index for the given
vertex v to v0. Call UpdateOriginalMaps after making changes.
.SetOriginalTexture(v, v0) Sets the original texture index for the given
vertex v to v0. Call UpdateOriginalMaps after making changes.
.SetOriginalVertex(v, v0) Sets the original vertex number for the given
vertex v to v0. Call UpdateOriginalMaps after making changes.
.ToOriginalNormalMap() Returns a read-only list of the original normal
indices for each vertex, as stored by the importer. See also SetOriginalNormal(), FromOriginalNormalMap().
.ToOriginalTextureMap() Returns a read-only list of the original vertex
numbers for each vertex, as stored by the importer. See also SetOriginalTexture(), FromOriginalTextureMap().
.ToOriginalVertexMap() Returns a read-only list of the original vertex
numbers for each vertex, as stored by the importer. See also SetOriginalVertex(), FromOriginalVertexMap().
.ToUniqueVertexMap() Returns a read-only list with an element for
each vertex, giving a unique vertex number. There will be fewer unique vertex numbers, see NUniqueVertex(), FromUniqueVertexMap(), RepeatedVertexLoops(), and UpdateVertexMaps().
.ToUniqueNormalMap() Returns a read-only list of a unique normal
index for each vertex. See also FromUniqueNormalMap().
.ToUniqueTextureMap() Returns a read-only list of a unique texture
vertex index for each vertex. See also FromUniqueTextureMap().
.ToUniqueVertexMap() Returns a read-only list of a unique vertex
index for each vertex. See also FromUniqueVertexMap().
.UpdateOriginalMaps() Causes the original-vertex/normal/texture-
index maps information to be updated after it has been changed, ie via SetOriginalNormal/Texture/Vertex().
.UpdateVertexMaps() Forces the unique and repeated-vertex
information to be recalculated after vertices have been changed, added, or removed, ie for RepeatedVertexLoops(), ToUniqueVertexMap(), FromUniqueVertexMap(), nUniqueVertex, etc.
©2024 Boris FX, Inc. — UNOFFICIAL — Converted from original PDF.