TK_Shell
-
class
TK_Shell Handles the TKE_Shell opcode.
TK_Shellprovides support for writing/reading the TKE_Shell opcode object to/from an HSF file.The HOOPS/3dGS scene-graph can contain ‘shell’ primitives which consist of a points array and a connectivity list to define the facets of the shell.
Inherits from:
TK_PolyhedronIndex
Methods
compute_advanced()compute_advanced_ascii()EnumerateEdges()GetFaces()GetFacesLength()Read()read_advanced()read_advanced_ascii()read_uncompressed_faces()read_uncompressed_faces_ascii()ReadAscii()Reset()set_flist()SetFaces()TK_Shell()Write()write_advanced()write_advanced_ascii()write_uncompressed_faces()write_uncompressed_faces_ascii()WriteAscii()~TK_Shell()
Variables
Methods
-
virtual TK_Status
TK_Shell::read_advanced(BStreamFileToolkit &tk) protected virtual
-
virtual TK_Status
TK_Shell::compute_advanced(BStreamFileToolkit &tk) protected virtual
-
virtual TK_Status
TK_Shell::write_advanced(BStreamFileToolkit &tk) protected virtual
-
virtual TK_Status
TK_Shell::read_advanced_ascii(BStreamFileToolkit &tk) protected virtual
-
virtual TK_Status
TK_Shell::read_uncompressed_faces_ascii(BStreamFileToolkit &tk) protected virtual
-
virtual TK_Status
TK_Shell::write_advanced_ascii(BStreamFileToolkit &tk) protected virtual
-
virtual TK_Status
TK_Shell::write_uncompressed_faces_ascii(BStreamFileToolkit &tk) protected virtual
-
TK_Status
TK_Shell::compute_advanced_ascii(BStreamFileToolkit &tk) protected
-
TK_Status
TK_Shell::read_uncompressed_faces(BStreamFileToolkit &tk) protected
-
TK_Status
TK_Shell::write_uncompressed_faces(BStreamFileToolkit &tk) protected
-
TK_Status
TK_Shell::SetFaces(int length, int const *face_list = 0) protected
Allocate an array of the provided length for the face list, and set values if given. The face_list is an array of integers. The first integer is the number of vertices that should be connected to form the first face. For example, “3” for a triangle. The next three integers (in this example) are the offsets into the points array at which the three x-y-z’s can be found. The first point in the points array is considered to be at offset zero, so “0, 1, 2” in the face_list array would form the triangle from the first three entries in points.
Continuing with the example, a second triangle might be specified as “3, 0, 1, 3”, meaning “form a face using three vertices. The vertices are at offsets zero, one, and three in the points array”. So this second face happens to share an edgethe (0, 1) edgewith the first face. A third face might be “4, 1, 2, 11, 12”, forming a quadrilateral. Faces continue being formed until an flist_length number of integers in face_list have been processed.
One special case: if a vertex count in the list is negative, that means “continue with the previous face and subtract a polygon formed from the following vertices”. This allows you to build faces with true holes in them. Multiple holes get an “even-odd” rule applied. A region is part of the face if there are an odd number of edges between it and infinity in the plane of the face. Otherwise a region is considered exterior and is not drawn. The edges of the hole receive the usual edge attributes. For face-numbering purposes (for example, Edit_Shell_Faces) the hole is not counted separatelyit’s a part of the face it’s in.
If the TKSH_TRISTRIPS bit is set in suboptions (e.g. via the function
TK_Polyhedron::SetSubop), the shell is assumed to contain triangles only and may not contain holes, and the “faces” are actually the way that vertices are connected into triangle strips. Start with the length of the strip, followed by the vertex indices to be connected. The first 3 vertices form a triangle, and every additional vertex is combined with the two previous ones to define one additional triangle. Exactly as with OpenGL’s GL_TRIANGLE_STRIP primitive, the orientation of every even triangle is reversed, beginning with the second.
-
int const *
TK_Shell::GetFaces() const protected const
Returns
a pointer to the face list, an array of integers
-
TK_Status
TK_Shell::EnumerateEdges() protected
overloads from
TK_Polyhedron. Creates the mp_edge_enumeration array that lists all of the pairs of vertices that connect together as edges.
-
TK_Status
TK_Shell::Read(BStreamFileToolkit &tk) virtual
Reads data from the toolkit buffer, decodes/decompresses it, and maps it to the opcode handlers data members. User-defined classes which need to write out custom data should utilize one of the available
GetData()methods.Parameters
tk: A reference to theBStreamFileToolkitobject.Returns
The result of the function call.
-
TK_Status
TK_Shell::Write(BStreamFileToolkit &tk) virtual
Encodes/compresses data and writes data to the toolkit buffer. User-defined classes which need to write out custom data should utilize one of the available
PutData()methods, and first write out the opcode associated with the group of binary data followed by the data itself.Parameters
tk: A reference to theBStreamFileToolkitobject.Returns
The result of the function call.
-
TK_Status
TK_Shell::ReadAscii(BStreamFileToolkit &tk) Deprecated.
-
TK_Status
TK_Shell::WriteAscii(BStreamFileToolkit &tk) Deprecated.
-
void
TK_Shell::Reset() virtual
Resets the current opcode handler. This is called by the toolkit when it is done processing an opcode. This method reinitializes any opcode handler variables and frees up temporary data.
Variables