BOpcodeShell.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 #ifndef BBINFILETK_SHELL
11 #define BBINFILETK_SHELL
12 
13 #include "BOpcodeHandler.h"
14 #include "BPolyhedron.h"
15 
16 
17 
19 
25 class BBINFILETK_API TK_Shell : public TK_Polyhedron {
26  protected:
27  virtual TK_Status read_advanced (BStreamFileToolkit & tk);
28  virtual TK_Status read_uncompressed_points (BStreamFileToolkit & tk);
29  virtual TK_Status read_uncompressed_faces (BStreamFileToolkit & tk);
30  virtual TK_Status read_bounding (BStreamFileToolkit & tk);
31 
32 
33 
34 
35  virtual TK_Status read_advanced_ascii (BStreamFileToolkit & tk);
36  virtual TK_Status read_uncompressed_points_ascii (BStreamFileToolkit & tk);
37  virtual TK_Status read_uncompressed_faces_ascii (BStreamFileToolkit & tk);
38  virtual TK_Status read_bounding_ascii (BStreamFileToolkit & tk);
39 
40 
41  virtual TK_Status compute_advanced (BStreamFileToolkit & tk);
42  virtual TK_Status write_advanced (BStreamFileToolkit & tk);
43  virtual TK_Status write_uncompressed_points (BStreamFileToolkit & tk);
44  virtual TK_Status write_uncompressed_faces (BStreamFileToolkit & tk);
45  virtual TK_Status write_bounding (BStreamFileToolkit & tk);
46  TK_Status write_null (BStreamFileToolkit & tk);
47 
48 
49 
50 
51 
52  virtual TK_Status write_advanced_ascii (BStreamFileToolkit & tk);
53  virtual TK_Status write_uncompressed_points_ascii (BStreamFileToolkit & tk);
54  virtual TK_Status write_uncompressed_faces_ascii (BStreamFileToolkit & tk);
55  virtual TK_Status write_bounding_ascii (BStreamFileToolkit & tk);
56  TK_Status write_null_ascii (BStreamFileToolkit & tk);
57  TK_Status compute_advanced_ascii(BStreamFileToolkit & tk);
58 
59 
60  protected:
61  int m_substage;
62  unsigned char m_compression_scheme;
63  int m_flistlen;
64  int *m_flist;
65  char m_lodlevel;
104  TK_Status SetFaces( int length, int const *face_list = 0 );
106  TK_Status SetLodLevel( int level ) { m_lodlevel = (char)level; return TK_Normal; };
108  int const *GetFaces() const { return m_flist; };
110  int GetFacesLength() const { return m_flistlen; };
112  int GetLodLevel() const { return m_lodlevel; };
115  TK_Status EnumerateEdges();
116 
117  public:
118  TK_Shell ();
119  ~TK_Shell ();
120 
122  void set_flist (int count, int const * list = 0) { SetFaces( count, list ); };
123 
126 
127 
128  TK_Status ReadAscii (BStreamFileToolkit & tk);
129  TK_Status WriteAscii(BStreamFileToolkit & tk);
130 
131  void Reset ();
132 }; //end declaration of class TK_Shell
133 
134 
135 
136 /*
137  * SOME UTILITY MACROS
138  */
139 #define SEMI_PROTECT(x) do {x} while (0)
140 
141 //warning: implicitly references the BStreamFileToolkit &, tk
142 #define ENSURE_ALLOCATED(var,type,count) SEMI_PROTECT( \
143  if (count > 0) { \
144  BSTREAM_ALLOC_ARRAY(var, count, type); \
145  if( (var) == 0 ) \
146  return tk.Error(); \
147  } \
148 )
149 
150 //warning: implicitly references the BStreamFileToolkit &, tk
151 #define ENSURE_ALLOCATED_CLEAR(var,type,count) SEMI_PROTECT( \
152  BSTREAM_ALLOC_ARRAY(var, count, type); \
153  if( (var) == 0 ) \
154  return tk.Error(); \
155  memset (var, 0, (count) * sizeof(type)); \
156 )
157 
158 #endif
int GetFacesLength() const
Definition: BOpcodeShell.h:110
void set_flist(int count, int const *list=0)
obsolete. Provided for compatibility
Definition: BOpcodeShell.h:122
Handles the TKE_Shell opcode.
Definition: BOpcodeShell.h:25
int m_substage
Definition: BOpcodeShell.h:61
Contains data types which are used by BBaseOpcodeHandler.
virtual void Reset()
The BStreamFileToolkit class provides support for importing/exporting HOOPS Stream File information...
Definition: BStreamFileToolkit.h:367
int m_flistlen
Definition: BOpcodeShell.h:63
int * m_flist
Definition: BOpcodeShell.h:64
virtual TK_Status Read(BStreamFileToolkit &tk)=0
int GetLodLevel() const
Definition: BOpcodeShell.h:112
char m_lodlevel
Definition: BOpcodeShell.h:65
int const * GetFaces() const
Definition: BOpcodeShell.h:108
Definition: BStream.h:275
TK_Status
Codes which can be either passed to various toolkit functions, or indicate the result of a toolkit fu...
Definition: BStream.h:274
TK_Status SetLodLevel(int level)
Sets the lod level for this representation (as in HOOPS, '0' means original base resolution) ...
Definition: BOpcodeShell.h:106
Base class for shell and mesh.
Definition: BPolyhedron.h:22
unsigned char m_compression_scheme
Definition: BOpcodeShell.h:62
virtual TK_Status Write(BStreamFileToolkit &tk)=0