TK_Shell Class Reference

#include <BOpcodeShell.h>

Inheritance diagram for TK_Shell:

Inheritance graph
[legend]
Collaboration diagram for TK_Shell:

Collaboration graph
[legend]
List of all members.

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.

Definition at line 55 of file BOpcodeShell.h.

Public Member Functions

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).
int const * GetFaces () const
int GetFacesLength () const
int GetLodLevel () const
TK_Status EnumerateEdges ()
virtual void serialize (const void *pTag=NULL) throw ( DWFException )
void optimize (bool bOptimize=true, double nVertexTolerance=0.0, double nVertexNormalsTolerance=0.0, double nTextureParametersTolerance=0.0)
void set_flist (int count, int const *list=0) alter
 obsolete. Provided for compatibility
TK_Status Read (BStreamFileToolkit &tk) alter
TK_Status Write (BStreamFileToolkit &tk) alter
void Reset (void) alter

Protected Attributes

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


Member Function Documentation

TK_Status TK_Shell::EnumerateEdges  ) 
 

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]
 

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

Definition at line 143 of file BOpcodeShell.h.

int TK_Shell::GetFacesLength  )  const [inline]
 

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

Definition at line 145 of file BOpcodeShell.h.

int TK_Shell::GetLodLevel  )  const [inline]
 

Returns:
the LOD level

Definition at line 147 of file BOpcodeShell.h.

void TK_Shell::optimize bool  bOptimize = true,
double  nVertexTolerance = 0.0,
double  nVertexNormalsTolerance = 0.0,
double  nTextureParametersTolerance = 0.0
[inline]
 

Performs face vertex coordinate, normals and texture parameters optimization.

Parameters:
bOptimize If true, this shell data will be optimized before serialization.
nVertexTolerance  > 0.0 indicates an absolute delta in object-relative-units. < 0.0 indicates a percentage of object size in feature-relative-units.
nVertexNormalsTolerance 
nTextureParametersTolerance 
Note:
"Tolerance" controls the identification of duplicate points. If a specification is given in object-relative units (oru), then the points that are separated by a distance less than this value are considered equal. Often, one cannot ascertain a "good" value for an object-relative tolerance. In this case, specify the tolerance using "feature-relative units (fru)". Feature size is defined to be the smallest non-zero distance between any two adjacent vertices on any face. It is calculated internally by Compute_Optimized_Shell, and is constant for the entire collection of faces. The feature-relative tolerance is expressed as a percentage of this minimum distance. A setting less than "tolerance = 100% fru" guarantees that unequal vertices on a single face won't be eliminated.

Definition at line 176 of file BOpcodeShell.h.

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 void   )  [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.

virtual void TK_Shell::serialize const void *  pTag = NULL  )  throw ( DWFException ) [virtual]
 

This method will write the handler's opcode and data to the W3D stream.

Parameters:
pTag An optional tag to associate the data.
Exceptions:
DWFException 

Reimplemented from BBaseOpcodeHandler.

TK_Status TK_Shell::SetFaces int  length,
int const *  face_list = 0
 

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

Definition at line 96 of file BOpcodeShell.h.

int* TK_Shell::m_flist [protected]
 

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

Definition at line 98 of file BOpcodeShell.h.

int TK_Shell::m_flistlen [protected]
 

Length of the face list

Definition at line 97 of file BOpcodeShell.h.

char TK_Shell::m_lodlevel [protected]
 

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

Definition at line 99 of file BOpcodeShell.h.

int TK_Shell::m_substage [protected]
 

Tracks progress in subroutines

Definition at line 95 of file BOpcodeShell.h.


The documentation for this class was generated from the following file:
Generated on Tue Jan 6 22:41:46 2009 for Autodesk DWF 3D Toolkit by  doxygen 1.4.5