HConstantFrameRate.h
Go to the documentation of this file.
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 // HConstantFrameRate.h: interface for the HConstantFrameRate class.
11 //
13 
18 #ifndef HCONSTANTFRAMERATE_H
19 #define HCONSTANTFRAMERATE_H
20 
21 #ifdef H_PACK_8
22 #pragma pack(push)
23 #pragma pack(8)
24 #endif
25 
26 #include "HTools.h"
27 #include "hic_types.h"
28 
29 class HTClient;
30 
35 {
45 };
46 
51 {
56 };
57 
58 
63 {
67 };
68 
69 
70 class HConstantFrameRate;
71 
72 class HBaseView;
73 
79 class MVO_API HConstFRSimpType
80 {
81 public:
87  {
88  m_SimpLevelMin=0;
89  m_SimpLevelMax=0;
90  }
91 
96  HConstFRSimpType(int min, int max)
97  {
98  m_SimpLevelMin=min;
99  m_SimpLevelMax=max;
100  }
101  virtual ~HConstFRSimpType() {}
102 
103  virtual void Reset(HConstantFrameRate *pCfr) {
104  UNREFERENCED(pCfr);
105  }
106 
107 
114  virtual void Set(HConstantFrameRate *pCfr, int SimpLevel) = 0;
121  virtual void Update(HConstantFrameRate *pCfr, int SimpLevel);
122 
124  virtual ConstFRType GetType() = 0;
126  int GetMinSimpLevel() { return m_SimpLevelMin; };
128  int GetMaxSimpLevel() { return m_SimpLevelMax; };
129 
131  static HConstFRSimpType **CreateList(int size) { return new HConstFRSimpType *[size]; };
132 
133 };
134 
135 
141 class MVO_API HFrExtent : public HConstFRSimpType
142 {
143 public:
145  HFrExtent() : HConstFRSimpType() { m_Multiplier = 5; m_bUseLOD = false; }
146 
151  HFrExtent(int min, int max) : HConstFRSimpType(min,max) { m_Multiplier = 5; m_bUseLOD = false; }
152 
153  virtual ~HFrExtent() {}
159  void SetMultiplier(int mp) { m_Multiplier = mp; }
166  void Set(HConstantFrameRate *pCfr, int SimpLevel);
172  void SetUseLod(bool ul) { m_bUseLOD = ul; }
173  bool GetUseLod() const { return m_bUseLOD;}
182  static HConstFRSimpType * Create(int min, int max) {return new HFrExtent(min, max); };
183 
184 protected:
185  int m_Multiplier;
186  bool m_bUseLOD;
187 };
188 
192 class MVO_API HFrNoSimpAA : public HConstFRSimpType
193 {
194 public:
197 
202  HFrNoSimpAA(int min, int max) : HConstFRSimpType(min,max) {};
203 
204  virtual ~HFrNoSimpAA() {}
205 
213  void Set(HConstantFrameRate *pCfr, int SimpLevel);
222  void Update(HConstantFrameRate *pCfr, int SimpLevel);
223 
230  static HConstFRSimpType * Create(int min, int max) {return new HFrNoSimpAA(min, max); };
231 
232 };
233 
238 class MVO_API HFrNoSimp : public HConstFRSimpType
239 {
240 public:
247  HFrNoSimp(int min, int max) : HConstFRSimpType(min,max) {};
248 
249  virtual ~HFrNoSimp() {}
250 
257  void Set(HConstantFrameRate *pCfr, int SimpLevel);
260 
261 
268  static HConstFRSimpType * Create(int min, int max) {return new HFrNoSimp(min, max); };
269 
270 
271 };
272 
273 
278 class MVO_API HFrLodClamp : public HConstFRSimpType
279 {
280 public:
283  : HConstFRSimpType()
284  { m_bSegmentSwitch = false; }
285 
290  HFrLodClamp(int min, int max)
291  : HConstFRSimpType(min, max)
292  { m_bSegmentSwitch = false; }
293 
294  void Reset(HConstantFrameRate *pCfr);
295  virtual ~HFrLodClamp() {}
296 
304  void Set(HConstantFrameRate *pCfr, int SimpLevel);
313  static HConstFRSimpType * Create(int min, int max) {return new HFrLodClamp(min, max); };
314  void SetSegmentSwitch(bool ssl) { m_bSegmentSwitch = ssl; }
315  bool m_bSegmentSwitch;
316 
317 
318 };
319 
324 class MVO_API HFrLodThreshold : public HConstFRSimpType
325 {
326 public:
329 
334  HFrLodThreshold(int min, int max) : HConstFRSimpType(min,max) {}
335 
336  virtual ~HFrLodThreshold() {}
337 
344  void Set(HConstantFrameRate *pCfr, int SimpLevel);
353  static HConstFRSimpType * Create(int min, int max) {return new HFrLodThreshold(min, max); };
354 
355 };
356 
357 
362 class MVO_API HFrSolidBBox : public HConstFRSimpType
363 {
364 public:
371  HFrSolidBBox(int min, int max) : HConstFRSimpType(min,max) {}
372 
373  virtual ~HFrSolidBBox() {}
374 
381  void Set(HConstantFrameRate *pCfr, int SimpLevel);
384 
386  static void RegisterCallbacks();
393  static HConstFRSimpType * Create(int min, int max) {return new HFrSolidBBox(min, max); };
394 
395 private:
396  static void draw_solid_bbx_tree(HIC_Rendition *rendition, HIC_Segment_Info * geo3);
397  static void draw_solid_bbx(HIC_Rendition *rendition, HIC_Segment_Info * geo3);
398 
399 };
400 
405 class MVO_API HFrWireframeBBox : public HConstFRSimpType
406 {
407 public:
410 
415  HFrWireframeBBox(int min, int max) : HConstFRSimpType(min,max) {}
416 
417  virtual ~HFrWireframeBBox() {}
418 
425  void Set(HConstantFrameRate *pCfr, int SimpLevel);
428 
430  static void RegisterCallbacks();
431 
432 
439  static HConstFRSimpType * Create(int min, int max) {return new HFrWireframeBBox(min, max); };
440 private:
441  static void draw_wireframe_bbx(HIC_Rendition *rendition,HIC_Segment_Info * geo3);
442 
443 };
444 
450 class MVO_API HFrWireframe : public HConstFRSimpType
451 {
452 public:
453 
456 
461  HFrWireframe(int min, int max) : HConstFRSimpType(min,max) {}
462 
463  virtual ~HFrWireframe() {}
464 
472  void Set(HConstantFrameRate *pCfr, int SimpLevel);
473 
476 
483  static HConstFRSimpType * Create(int min, int max) {return new HFrWireframe(min, max); };
484 
485 };
486 
487 
489 
494 class MVO_API HConstantFrameRate
495 {
496  friend class HConstFRSimpType;
497  friend class HFrNoSimp;
498 public:
504  virtual ~HConstantFrameRate();
505 
506  HBaseView* GetView() { return m_pHView; }
513  void UpdateLevel(int SimpLevel, int SimpListPos);
514 
515 protected:
523 
529 
530  bool m_pOwnsList;
531 
532 
551  DetailChangeMode m_DetailIncOnIdleMode;
556 
557  float m_DeadZone;
558  int m_lastupdown;
563 
568 
574  void SetHoopsSimplificationOptions(int SimpLevel, int SimpListPos);
575 
582  void AdjustListPointers(int &SimpLevel, int &SimpListPos);
583 
584 
589  void AdjustDetail(float FrameRate);
590 
591 
595  void StartTimer();
596 
600  void StopTimer();
601 
602  bool IsLowestDetail();
603  void ChangeDetail(int change, int *SimpLevel = 0, int *SimpListPos = 0);
604 
605 
606 
607 public:
608 
622  bool GetMode(HConstFRSimpType ***sd = 0L ,float *target_framerate = 0L, int *length = 0L);
623 
633  void Init(float target_framerate=20.0, HConstFRSimpType **sd = 0, int length = 0, float deadzone =3.0);
634 
637  void Shutdown();
638 
639 
640  bool GetActive() {return m_bConstFRActive;}
647  void Watch();
648 
649 
656  void Start();
657 
662  void Stop();
663 
669  void IncreaseDetailTemp();
670 
676  bool ViewpointHasChanged(bool update = true);
677 
682  void SetDetailIncMode (DetailChangeMode mode) {m_DetailIncMode=mode; m_SimplificationIncrease = mode;}
683  void SetDetailIncOnIdleMode (DetailChangeMode mode) {m_DetailIncOnIdleMode=mode; m_SimplificationIncreaseOnIdle = mode;}
684 
687  DetailChangeMode GetDetailIncMode () {return m_DetailIncMode; }
688 
693  void SetDetailDecMode (DetailChangeMode mode) {m_DetailDecMode=mode; m_SimplificationDecrease = mode;}
696  DetailChangeMode GetDetailDecMode () {return m_DetailDecMode; }
699  void ResetListPointers() { m_SimpLevel=0; m_SimpListPos = 0; }
700 
702  float GetTargetFrameRate() { return m_TargetFrameRate; }
706  void SetTargetFrameRate( float framerate ) { m_TargetFrameRate = framerate;}
711  void SetDeadZone( float deadzone ) { m_DeadZone = deadzone;}
715  void SetEmergencyDetailDecrease( bool detaildecrease ) { m_bEmergencyDecrease = detaildecrease;}
720  void SetActivityType(HActivityType at) { m_ActivityType = at; }
721 
724  HActivityType GetActivityType() { return m_ActivityType;}
725  int GetSimpLevel() { return m_SimpLevel;}
731  void AdjustLodOptions();
733  bool GetDetailIncreaseState() { return m_bIncreaseDetailTemp; }
738  void SetDetailLevel ( int listpos, int simplevel) { m_SimpListPos = listpos; m_SimpLevel = simplevel; }
739 
744  HConstFRSimpType * GetSimpType(ConstFRType stype);
748  void SetSimpLevel(int simplevel) { m_SimpLevel = simplevel; }
749 
752  void AdjustDefaultDetailLevelToModel();
753 
761  static bool Tick(float request_time, float actual_time, void * user_data);
762 
763  void SetDisableIncreaseTemp(bool it) { m_bDisableIncreaseTemp = it; }
764  void InitiateDelay() { m_bOneDelay = true; }
765  int GetDetailLevelNum();
766  int GetTotalDetailLevelNum();
767 
768  void SetWatchActivity(bool wa) { m_bWatchActivity = wa; }
769  void MajorDetailDecrease();
770  void MajorDetailIncrease();
771 
772 
773 private:
774  bool m_bFullDetailTemp;
775  bool m_bWatchActivity;
776  bool m_bIncreaseDetailTemp;
777  float m_oldPos[11];
778  HTClient * m_pUpdateTimerClient;
779  bool m_bDisableIncreaseTemp;
780  bool m_bOneDelay;
781  float m_OneDelayStart;
782  bool m_bAdjustNextTime;
783  float m_AdjustTime;
784  bool m_bIncrease;
785  int m_CounterThreshold;
786  int m_TempDetailIncrement;
787  bool m_bFirstIncrease;
788 
789 
790  };
791 
792 
793 #ifdef H_PACK_8
794 #pragma pack(pop)
795 #endif
796 
797 #endif
798 
799 
800 
801 
802 
803 
804 
805 
DetailChangeMode
Definition: HConstantFrameRate.h:62
Indicates that a cutting plane is being manipulated.
Definition: HConstantFrameRate.h:54
float m_TargetFrameRate
Definition: HConstantFrameRate.h:522
static HConstFRSimpType ** CreateList(int size)
Definition: HConstantFrameRate.h:131
HFrWireframe(int min, int max)
Definition: HConstantFrameRate.h:461
The HConstantFrameRate class provides support for maintaining a constant framerate when rendering...
Definition: HConstantFrameRate.h:494
HFrLodClamp(int min, int max)
Definition: HConstantFrameRate.h:290
Definition: HConstantFrameRate.h:450
HConstFRSimpType(int min, int max)
Definition: HConstantFrameRate.h:96
HFrWireframeBBox()
Definition: HConstantFrameRate.h:409
virtual void Set(HConstantFrameRate *pCfr, int SimpLevel)=0
void SetDetailIncMode(DetailChangeMode mode)
Definition: HConstantFrameRate.h:682
DetailChangeMode m_SimplificationIncreaseOnIdle
Definition: HConstantFrameRate.h:543
void SetActivityType(HActivityType at)
Definition: HConstantFrameRate.h:720
static HConstFRSimpType * Create(int min, int max)
Definition: HConstantFrameRate.h:483
HActivityType GetActivityType()
Definition: HConstantFrameRate.h:724
Definition: HConstantFrameRate.h:324
int GetMinSimpLevel()
Definition: HConstantFrameRate.h:126
HFrNoSimpAA(int min, int max)
Definition: HConstantFrameRate.h:202
void SetDetailDecMode(DetailChangeMode mode)
Definition: HConstantFrameRate.h:693
HFrNoSimp(int min, int max)
Definition: HConstantFrameRate.h:247
DetailChangeMode GetDetailDecMode()
Definition: HConstantFrameRate.h:696
void SetDeadZone(float deadzone)
Definition: HConstantFrameRate.h:711
Definition: HConstantFrameRate.h:238
void SetSimpLevel(int simplevel)
Definition: HConstantFrameRate.h:748
No simplification. The scene is antialiased.
Definition: HConstantFrameRate.h:37
HFrWireframeBBox(int min, int max)
Definition: HConstantFrameRate.h:415
HFrExtent(int min, int max)
Definition: HConstantFrameRate.h:151
int m_SimpLevelMax
Definition: HConstantFrameRate.h:83
HFrNoSimp()
Definition: HConstantFrameRate.h:242
float m_DeadZone
Definition: HConstantFrameRate.h:557
virtual void Update(HConstantFrameRate *pCfr, int SimpLevel)
int m_FrameRateCounter
Definition: HConstantFrameRate.h:545
Definition: HConstantFrameRate.h:278
Definition: HTManager.h:157
int m_SimpLevel
Definition: HConstantFrameRate.h:533
ConstFRType GetType()
Definition: HConstantFrameRate.h:306
Indicates no activity that would affect the constant framerate logic.
Definition: HConstantFrameRate.h:52
HFrLodClamp()
Definition: HConstantFrameRate.h:282
HFrWireframe()
Definition: HConstantFrameRate.h:455
int GetMaxSimpLevel()
Definition: HConstantFrameRate.h:128
DetailChangeMode m_SimplificationIncrease
Definition: HConstantFrameRate.h:542
void SetUseLod(bool ul)
Definition: HConstantFrameRate.h:172
LOD threshold type. LOD level for each individual object based on size on screen. ...
Definition: HConstantFrameRate.h:42
Wireframe bounding box similfication type.
Definition: HConstantFrameRate.h:38
Solid bounding box simplification type.
Definition: HConstantFrameRate.h:39
ConstFRType GetType()
Definition: HConstantFrameRate.h:427
ConstFRType
Definition: HConstantFrameRate.h:34
ConstFRType GetType()
Definition: HConstantFrameRate.h:346
Definition: HConstantFrameRate.h:362
HConstFRSimpType ** m_pSimpList
Definition: HConstantFrameRate.h:528
Wireframe simplification type.
Definition: HConstantFrameRate.h:40
void SetDetailLevel(int listpos, int simplevel)
Definition: HConstantFrameRate.h:738
int m_SimpListPos
Definition: HConstantFrameRate.h:534
DetailChangeMode m_SimplificationDecrease
Definition: HConstantFrameRate.h:541
LOD clamp type. All objects share the same detail level.
Definition: HConstantFrameRate.h:41
HFrSolidBBox()
Definition: HConstantFrameRate.h:366
Definition: HConstantFrameRate.h:405
HConstFRSimpType()
Definition: HConstantFrameRate.h:86
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:332
int m_SimpListLength
Definition: HConstantFrameRate.h:536
ConstFRType GetType()
Definition: HConstantFrameRate.h:175
void SetEmergencyDetailDecrease(bool detaildecrease)
Definition: HConstantFrameRate.h:715
static HConstFRSimpType * Create(int min, int max)
Definition: HConstantFrameRate.h:268
HActivityType m_ActivityType
Definition: HConstantFrameRate.h:567
HFrLodThreshold()
Definition: HConstantFrameRate.h:328
DetailChangeMode m_DetailIncMode
Definition: HConstantFrameRate.h:550
bool GetActive()
Definition: HConstantFrameRate.h:640
No simplification.
Definition: HConstantFrameRate.h:36
void ResetListPointers()
Definition: HConstantFrameRate.h:699
Indicates that some activity is occuring that isn't movement or cutting plane related.
Definition: HConstantFrameRate.h:55
int m_SimpLevelMin
Definition: HConstantFrameRate.h:82
Definition: HConstantFrameRate.h:79
DetailChangeMode GetDetailIncMode()
Definition: HConstantFrameRate.h:687
static HConstFRSimpType * Create(int min, int max)
Definition: HConstantFrameRate.h:439
int GetSimpLevel()
Definition: HConstantFrameRate.h:725
static HConstFRSimpType * Create(int min, int max)
Definition: HConstantFrameRate.h:182
HFrLodThreshold(int min, int max)
Definition: HConstantFrameRate.h:334
Indicates movement activity in the scene.
Definition: HConstantFrameRate.h:53
DetailChangeMode m_DetailDecMode
Definition: HConstantFrameRate.h:555
bool m_bEmergencyDecrease
Definition: HConstantFrameRate.h:562
static HConstFRSimpType * Create(int min, int max)
Definition: HConstantFrameRate.h:393
ConstFRType GetType()
Definition: HConstantFrameRate.h:215
Definition: HConstantFrameRate.h:141
ConstFRType GetType()
Definition: HConstantFrameRate.h:383
float GetTargetFrameRate()
Definition: HConstantFrameRate.h:702
Only one detail change is allowed.
Definition: HConstantFrameRate.h:65
HFrNoSimpAA()
Definition: HConstantFrameRate.h:196
ConstFRType GetType()
Definition: HConstantFrameRate.h:259
static HConstFRSimpType * Create(int min, int max)
Definition: HConstantFrameRate.h:353
ConstFRType GetType()
Definition: HConstantFrameRate.h:475
HBaseView * GetView()
Definition: HConstantFrameRate.h:506
HFrExtent()
Definition: HConstantFrameRate.h:145
HFrSolidBBox(int min, int max)
Definition: HConstantFrameRate.h:371
static HConstFRSimpType * Create(int min, int max)
Definition: HConstantFrameRate.h:230
void SetTargetFrameRate(float framerate)
Definition: HConstantFrameRate.h:706
void SetMultiplier(int mp)
Definition: HConstantFrameRate.h:159
Detail change is allowed based on target framerate.
Definition: HConstantFrameRate.h:66
bool m_bConstFRActive
Definition: HConstantFrameRate.h:517
HActivityType
Definition: HConstantFrameRate.h:50
Placeholder type.
Definition: HConstantFrameRate.h:43
Definition: HConstantFrameRate.h:192
static HConstFRSimpType * Create(int min, int max)
Definition: HConstantFrameRate.h:313
No detail level change.
Definition: HConstantFrameRate.h:64
HBaseView * m_pHView
Definition: HConstantFrameRate.h:516
Maximum extent simplification type.
Definition: HConstantFrameRate.h:44