Alphabetical Class Index   Class Hierarchy   Compound Members   File Members   File List  

TK_Shell Class Reference

Handles the TKE_Shell opcode. More...

#include <BOpcodeShell.h>

Inheritance diagram for TK_Shell:

TK_Polyhedron BBaseOpcodeHandler BControlledMemoryObject

List of all members.

Public Member Functions

TK_Status Read (BStreamFileToolkit &tk) alter
TK_Status ReadAscii (BStreamFileToolkit &tk) alter
 Deprecated.
void Reset () alter
void set_flist (int count, int const *list=0) alter
 obsolete. Provided for compatibility
TK_Status Write (BStreamFileToolkit &tk) alter
TK_Status WriteAscii (BStreamFileToolkit &tk) alter
 Deprecated.

Protected Member Functions

TK_Status EnumerateEdges ()
int const * GetFaces () const
int GetFacesLength () const
int GetLodLevel () const
TK_Status SetFaces (int length, int const *face_list=0) alter
TK_Status SetLodLevel (int level) alter
 Sets the lod level for this representation (as in HOOPS, '0' means original base resolution).

Protected Attributes

unsigned char m_compression_scheme
int * m_flist
int m_flistlen
char m_lodlevel
int m_substage


Detailed Description

Handles the TKE_Shell opcode.

TK_Shell provides 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.


Member Function Documentation

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.

int const* TK_Shell::GetFaces (  )  const [inline, protected]

Returns:
a pointer to the face list, an array of integers

int TK_Shell::GetFacesLength (  )  const [inline, protected]

Returns:
the length of the face list (as in HOOPS, '0' means original base resolution)

int TK_Shell::GetLodLevel (  )  const [inline, protected]

Returns:
the LOD level

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 the BStreamFileToolkit object.
Returns:
The result of the function call.

Implements BBaseOpcodeHandler.

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.

Reimplemented from BBaseOpcodeHandler.

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 edge---the (0, 1) edge---with 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 separately---it's a part of the face it's in.

If the TKSH_TRISTRIPS bit is set in suboptions (e.g. via the functoin 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.

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 the BStreamFileToolkit object.
Returns:
The result of the function call.

Implements BBaseOpcodeHandler.


Member Data Documentation

unsigned char TK_Shell::m_compression_scheme [protected]

The compression scheme currently in use

int* TK_Shell::m_flist [protected]

Facelist array; could be in tristrips format if (mp_subop & TKSH_TRISTRIPS)

int TK_Shell::m_flistlen [protected]

Length of the face list

char TK_Shell::m_lodlevel [protected]

The current lod level. LOD level identifiers are numbers between 0 and 7, inclusive

int TK_Shell::m_substage [protected]

Tracks progress in subroutines


The documentation for this class was generated from the following file: