:orphan:

========
TKE_Mesh
========

Opcode
======

.. csv-table::

	"ASCII", "M"
	"Hexadecimal", "0x4D"
	"Decimal", "77"
	
	
Operands
========

Byte suboptions, int rows, int columns, variable points, [variable attributes] 

.. csv-table::

	"suboptions", "information about formatting. Uses a subset of the bits defined in ``TKE_Shell``"
	"rows", "the number of rows of vertices in the mesh"
	"columns", "the number of columns of vertices in the mesh"
	"points", "the vertex locations"
	"attributes", "polyhedron attributes bound to faces, edges or vertices. Present if and only if suboptions has the ``TKSH_HAS_OPTIONALS`` bit set. See :doc:`attributes.html </general/hsf/opcodes/attributes>` for details."


Suboptions
----------

As mentioned above, ``TKE_Mesh`` suboption share a definition with ``TKE_Shell``, and use a subset of its suboptions bits. The following bits are relevant here:

.. csv-table::

	"0x01", "``TKSH_COMPRESSED_POINTS`` -- Points are compressed"
	"0x08", "``TKSH_HAS_OPTIONALS`` -- Vertices, edges and/or faces have attributes, and the attributes section of the format exists. See :doc:`attributes.html </general/hsf/opcodes/attributes>`"
	"0x80", "``TKSH_EXPANDED`` -- Suboptions2 currently has no bits relevant to ``TKE_Mesh``, so this bit will not be set (and thus there is currently no suboptions2)"
	
	
Notes
=====

A mesh is a rectangular array of faces with implicit regular connectivity. The mesh is inserted into the currently opened segment. 

As in ``TKE_Shell``, points are either compressed or uncompressed vertex data. Compression status is dictated by the ``TKSH_COMPRESSED_POINTS`` bit in the shell suboptions. If uncompressed, it will consist of triples of 32-bit floating point coordinates in the order xyzxyz... If compressed, it will consist of a compression scheme identifier, followed by data that is specific to that compression scheme. The specifics of the compressed format are described in :doc:`attributes.html </general/hsf/opcodes/attributes>` in the "array of compressed floats" section. 


Points (uncompressed)
---------------------

``int`` pointcount, ``float array`` uncompressed triplets of point data, in order xyzxyz... 
 
 
Points (compressed)
-------------------

``byte`` compression scheme, ``int`` pointcount, ``variable`` array of compressed floats. See the "array of compressed floats" section of :doc:`attributes.html </general/hsf/opcodes/attributes>`.
