Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HStreamer.h
1 //
2 // Copyright (c) 2000 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 
13 #ifndef _H_STREAMER_H_
14 #define _H_STREAMER_H_
15 
16 #ifdef H_PACK_8
17 #pragma pack(push)
18 #pragma pack(8)
19 #endif
20 
21 
22 #include "HTools.h"
23 #include "HStream.h"
24 
25 
26 class HStreamerTK;
27 class HStreamFileToolkit;
28 class HStreamerBuffer;
29 class HTClient;
30 class Pause_Info;
31 struct vlist_s;
32 struct vhash_s;
33 
38 typedef void (*HStreamerConditionNoticeFunction)(unsigned int condition, void * user_data);
39 
43 #define HSTREAMER_CONDITION_COMPLETE_READ_PAUSES 0
44 
48 #define HSTREAMER_CONDITION_COMPLETE_SWEETENING 2
49 
53 #define HSTREAMER_CONDITION_VIEW_UPDATE 3
54 
58 #define HSTREAMER_CONDITION_NO_DICTIONARY 4
59 
63 #define HSTREAMER_CONDITION_VERSION_MISMATCH 5
64 
68 #define HSTREAMER_CONDITION_COMPLETE_READ_DICTIONARY 6
69 
70 
71 
73 
81 class HStreamer
82 {
83  friend class HTK_HStreamer_Shell;
84 
85 public:
86 
90  HStreamer();
91 
95  ~HStreamer();
96 
110  void Setup( HC_KEY model_key, int n_pause=0 );
111 
117  void SetConditionNoticeFunction( HStreamerConditionNoticeFunction condition_notice_helper_function,
118  void * user_data);
119 
124  void LoadFile( const char * filename );
125 
130  void Sweeten(HC_KEY key);
131 
140  void Sweeten( const HPoint& camera_position,
141  const HPoint& camera_target,
142  const HPoint& camera_up,
143  const float field[2],
144  const char * projection );
145 
146 
147 
149  HStreamFileToolkit * GetStreamFileToolkit() { return (HStreamFileToolkit*) m_ptk; };
150 
155  bool ReadStreamBufferQue();
156 
157 private:
158 
159  // cleans up the lists which contain new'ed objects
160  void FreeKeyLodPairList(vlist_s*& plist);
161 
162  // sweeten the next batch of entities on pending list
163  void SweetenBatch();
164  // sweeten entities on the unknown-size list
165  void SweetenNext();
166 
167  // walks the HOOPS database begining at the start key to add each shell
168  // and mesh to the sweeten list for sweetening
169  TK_Status TreeWalker (HC_KEY start_key, BStreamFileToolkit const * tk , int lod_level = -1);
170 
171  // walks the HOOPS database begining at the start key and adds the geometry
172  // to the sweeten list for sweetening if it falls in the view of the camera supplied
173  TK_Status TreeWalker( HC_KEY start_key,
174  BStreamFileToolkit const * tk ,
175  const HPoint& position,
176  const HPoint& target,
177  const HPoint& up,
178  const float field[2],
179  const char * projection,
180  int lod_level = -1);
181 
182  // recursive utility function to walk HOOPS database
183  TK_Status Walk (BStreamFileToolkit const * tk, float const * in_matrix, int test_case, int lod_level);
184 
185  // parses the buffer in to the model key
186  TK_Status ParseBuffer(HStreamerTK * tk, HStreamerBuffer * block);
187  // parses the pause information
188  TK_Status ParsePauseInfo(HStreamerBuffer * block);
189 
190  // notifies the condition/error notice to the registered handler
191  void NotifyCondition(unsigned int condition);
192 
193  enum parse_stage {
194  parse_Header,
195  parse_FileInfo,
196  parse_PauseInfo,
197  parse_AllPauses,
198  parse_Dictionary,
199  parse_Single,
200  parse_Normal,
201  parse_Error
202  };
203 
204  // the streamtoolkit to use for streaming
205  HStreamerTK * m_ptk;
206  // MVO timer client registered with HTManager to recieve timer events
207  HTClient * m_pBufferPollTimer;
208 
209  int m_nPauseJump; // initial read to this pause in the streamfile
210  vlist_s * m_pDiscardedBlockIds; // stream buffers requested but not of any significance any more
211  vlist_s * m_pSweetenList; // list of shells for sweetening
212  vlist_s * m_pPendingSweetenList; // list of shells which are requested for sweetening and are pending
213  vhash_s * m_pAlreadySweetenedList;// shells already sweetened
214  vlist_s * m_pUnknownSizeList; // shells of unknown size
215  parse_stage m_ParseStage; // current parsing state
216  Pause_Info* m_PauseInfo; // information about pause in the current hsf file
217  HC_KEY m_model_key; // the segment key where the file has to be read
218 
219  // callback function for condition and error notices
220  HStreamerConditionNoticeFunction m_condition_notice_helper_function;
221  // user data to be passed to the condition notice function
222  void * m_condition_notice_user_data;
223 
224  // the id of the last of a batch of requests
225  int m_sweeten_end_id;
226 
227 };
228 
229 
230 #ifdef H_PACK_8
231 #pragma pack(pop)
232 #endif
233 
234 #endif
235 
236 
237 
void SetConditionNoticeFunction(HStreamerConditionNoticeFunction condition_notice_helper_function, void *user_data)
The HStreamer class provides functionality for on-demand and view-dependent streaming of HSF files...
Definition: HStreamer.h:81
#define HC_KEY
bool ReadStreamBufferQue()
Definition: HTManager.h:162
void LoadFile(const char *filename)
HStreamFileToolkit * GetStreamFileToolkit()
Definition: HStreamer.h:149
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
void Sweeten(HC_KEY key)
void Setup(HC_KEY model_key, int n_pause=0)