00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id: 7375f81a3218323c17c7706cf80941a27a4a57d3 $ 00013 // 00014 00015 // HConstantFrameRate.h: interface for the HConstantFrameRate class. 00016 // 00018 00023 #ifndef HCONSTANTFRAMERATE_H 00024 #define HCONSTANTFRAMERATE_H 00025 00026 #ifdef H_PACK_8 00027 #pragma pack(push) 00028 #pragma pack(8) 00029 #endif 00030 00031 #include "HTools.h" 00032 #include "hic_types.h" 00033 00034 class HTClient; 00035 00039 enum ConstFRType 00040 { 00041 ConstFRNoSimpType, 00042 ConstFRNoSimpAAType, 00043 ConstFRWireframeBBoxType, 00044 ConstFRSolidBBoxType, 00045 ConstFRWireframeType, 00046 ConstFRLodClampType, 00047 ConstFRLodThresholdType, 00048 ConstFRUserType, 00049 ConstFRExtentType 00050 }; 00051 00055 enum HActivityType 00056 { 00057 NoActivity, 00058 MovementActivity, 00059 CuttingPlaneActivity, 00060 GeneralActivity 00061 }; 00062 00063 00067 enum DetailChangeMode 00068 { 00069 NoDetailChange, 00070 AllowDetailChangeOnce, 00071 AllowDetailChange 00072 }; 00073 00074 00075 class HConstantFrameRate; 00076 00077 class HBaseView; 00078 00084 class MVO_API HConstFRSimpType 00085 { 00086 public: 00087 int m_SimpLevelMin; 00088 int m_SimpLevelMax; 00091 HConstFRSimpType() 00092 { 00093 m_SimpLevelMin=0; 00094 m_SimpLevelMax=0; 00095 } 00096 00101 HConstFRSimpType(int min, int max) 00102 { 00103 m_SimpLevelMin=min; 00104 m_SimpLevelMax=max; 00105 } 00106 virtual ~HConstFRSimpType() {} 00107 00108 virtual void Reset(HConstantFrameRate *pCfr) { 00109 UNREFERENCED(pCfr); 00110 } 00111 00112 00119 virtual void Set(HConstantFrameRate *pCfr, int SimpLevel) = 0; 00126 virtual void Update(HConstantFrameRate *pCfr, int SimpLevel); 00127 00129 virtual ConstFRType GetType() = 0; 00131 int GetMinSimpLevel() { return m_SimpLevelMin; }; 00133 int GetMaxSimpLevel() { return m_SimpLevelMax; }; 00134 00136 static HConstFRSimpType **CreateList(int size) { return new HConstFRSimpType *[size]; }; 00137 00138 }; 00139 00140 00146 class MVO_API HFrExtent : public HConstFRSimpType 00147 { 00148 public: 00150 HFrExtent() : HConstFRSimpType() { m_Multiplier = 5; m_bUseLOD = false; } 00151 00156 HFrExtent(int min, int max) : HConstFRSimpType(min,max) { m_Multiplier = 5; m_bUseLOD = false; } 00157 00158 virtual ~HFrExtent() {} 00164 void SetMultiplier(int mp) { m_Multiplier = mp; } 00171 void Set(HConstantFrameRate *pCfr, int SimpLevel); 00177 void SetUseLod(bool ul) { m_bUseLOD = ul; } 00178 bool GetUseLod() const { return m_bUseLOD;} 00180 ConstFRType GetType() { return ConstFRExtentType; } 00187 static HConstFRSimpType * Create(int min, int max) {return new HFrExtent(min, max); }; 00188 00189 protected: 00190 int m_Multiplier; 00191 bool m_bUseLOD; 00192 }; 00193 00197 class MVO_API HFrNoSimpAA : public HConstFRSimpType 00198 { 00199 public: 00201 HFrNoSimpAA() : HConstFRSimpType(0, 1) {} 00202 00207 HFrNoSimpAA(int min, int max) : HConstFRSimpType(min,max) {}; 00208 00209 virtual ~HFrNoSimpAA() {} 00210 00218 void Set(HConstantFrameRate *pCfr, int SimpLevel); 00220 ConstFRType GetType() { return ConstFRNoSimpAAType; } 00227 void Update(HConstantFrameRate *pCfr, int SimpLevel); 00228 00235 static HConstFRSimpType * Create(int min, int max) {return new HFrNoSimpAA(min, max); }; 00236 00237 }; 00238 00243 class MVO_API HFrNoSimp : public HConstFRSimpType 00244 { 00245 public: 00247 HFrNoSimp() : HConstFRSimpType(0, 1) {} 00252 HFrNoSimp(int min, int max) : HConstFRSimpType(min,max) {}; 00253 00254 virtual ~HFrNoSimp() {} 00255 00262 void Set(HConstantFrameRate *pCfr, int SimpLevel); 00264 ConstFRType GetType() { return ConstFRNoSimpType; } 00265 00266 00273 static HConstFRSimpType * Create(int min, int max) {return new HFrNoSimp(min, max); }; 00274 00275 00276 }; 00277 00278 00283 class MVO_API HFrLodClamp : public HConstFRSimpType 00284 { 00285 public: 00287 HFrLodClamp() : HConstFRSimpType() { m_bSegmentSwitch = false; } 00292 HFrLodClamp(int min, int max) : HConstFRSimpType(min,max) {} 00293 00294 void Reset(HConstantFrameRate *pCfr); 00295 virtual ~HFrLodClamp() {} 00296 00305 void Set(HConstantFrameRate *pCfr, int SimpLevel); 00307 ConstFRType GetType() { return ConstFRLodClampType; } 00314 static HConstFRSimpType * Create(int min, int max) {return new HFrLodClamp(min, max); }; 00315 void SetSegmentSwitch(bool ssl) { m_bSegmentSwitch = ssl; } 00316 bool m_bSegmentSwitch; 00317 00318 00319 }; 00320 00325 class MVO_API HFrLodThreshold : public HConstFRSimpType 00326 { 00327 public: 00329 HFrLodThreshold() : HConstFRSimpType() {} 00330 00335 HFrLodThreshold(int min, int max) : HConstFRSimpType(min,max) {} 00336 00337 virtual ~HFrLodThreshold() {} 00338 00345 void Set(HConstantFrameRate *pCfr, int SimpLevel); 00347 ConstFRType GetType() { return ConstFRLodThresholdType; } 00354 static HConstFRSimpType * Create(int min, int max) {return new HFrLodThreshold(min, max); }; 00355 00356 }; 00357 00358 00363 class MVO_API HFrSolidBBox : public HConstFRSimpType 00364 { 00365 public: 00367 HFrSolidBBox() : HConstFRSimpType() {} 00372 HFrSolidBBox(int min, int max) : HConstFRSimpType(min,max) {} 00373 00374 virtual ~HFrSolidBBox() {} 00375 00382 void Set(HConstantFrameRate *pCfr, int SimpLevel); 00384 ConstFRType GetType() { return ConstFRSolidBBoxType; } 00385 00387 static void RegisterCallbacks(); 00394 static HConstFRSimpType * Create(int min, int max) {return new HFrSolidBBox(min, max); }; 00395 00396 private: 00397 static void draw_solid_bbx_tree(HIC_Rendition *rendition, HIC_Segment_Info * geo3); 00398 static void draw_solid_bbx(HIC_Rendition *rendition, HIC_Segment_Info * geo3); 00399 00400 }; 00401 00406 class MVO_API HFrWireframeBBox : public HConstFRSimpType 00407 { 00408 public: 00410 HFrWireframeBBox() : HConstFRSimpType() {} 00411 00416 HFrWireframeBBox(int min, int max) : HConstFRSimpType(min,max) {} 00417 00418 virtual ~HFrWireframeBBox() {} 00419 00426 void Set(HConstantFrameRate *pCfr, int SimpLevel); 00428 ConstFRType GetType() { return ConstFRWireframeBBoxType; } 00429 00431 static void RegisterCallbacks(); 00432 00433 00440 static HConstFRSimpType * Create(int min, int max) {return new HFrWireframeBBox(min, max); }; 00441 private: 00442 static void draw_wireframe_bbx(HIC_Rendition *rendition,HIC_Segment_Info * geo3); 00443 00444 }; 00445 00451 class MVO_API HFrWireframe : public HConstFRSimpType 00452 { 00453 public: 00454 00456 HFrWireframe() : HConstFRSimpType() {} 00457 00462 HFrWireframe(int min, int max) : HConstFRSimpType(min,max) {} 00463 00464 virtual ~HFrWireframe() {} 00465 00473 void Set(HConstantFrameRate *pCfr, int SimpLevel); 00474 00476 ConstFRType GetType() { return ConstFRWireframeType; } 00477 00484 static HConstFRSimpType * Create(int min, int max) {return new HFrWireframe(min, max); }; 00485 00486 }; 00487 00488 00490 00495 class MVO_API HConstantFrameRate 00496 { 00497 friend class HConstFRSimpType; 00498 friend class HFrNoSimp; 00499 public: 00504 HConstantFrameRate(HBaseView *view); 00505 virtual ~HConstantFrameRate(); 00506 00507 HBaseView* GetView() { return m_pHView; } 00514 void UpdateLevel(int SimpLevel, int SimpListPos); 00515 00516 protected: 00517 HBaseView *m_pHView; 00518 bool m_bConstFRActive; 00523 float m_TargetFrameRate; 00524 00529 HConstFRSimpType **m_pSimpList; 00530 00531 bool m_pOwnsList; 00532 00533 00534 int m_SimpLevel; 00535 int m_SimpListPos; 00537 int m_SimpListLength; 00542 DetailChangeMode m_SimplificationDecrease; 00543 DetailChangeMode m_SimplificationIncrease; 00544 DetailChangeMode m_SimplificationIncreaseOnIdle; 00546 int m_FrameRateCounter; 00551 DetailChangeMode m_DetailIncMode; 00552 DetailChangeMode m_DetailIncOnIdleMode; 00556 DetailChangeMode m_DetailDecMode; 00557 00558 float m_DeadZone; 00559 int m_lastupdown; 00563 bool m_bEmergencyDecrease; 00564 00568 HActivityType m_ActivityType; 00569 00575 void SetHoopsSimplificationOptions(int SimpLevel, int SimpListPos); 00576 00583 void AdjustListPointers(int &SimpLevel, int &SimpListPos); 00584 00585 00590 void AdjustDetail(float FrameRate); 00591 00592 00596 void StartTimer(); 00597 00601 void StopTimer(); 00602 00603 bool IsLowestDetail(); 00604 void ChangeDetail(int change, int *SimpLevel = 0, int *SimpListPos = 0); 00605 00606 00607 00608 public: 00609 00623 bool GetMode(HConstFRSimpType ***sd = 0L ,float *target_framerate = 0L, int *length = 0L); 00624 00634 void Init(float target_framerate=20.0, HConstFRSimpType **sd = 0, int length = 0, float deadzone =3.0); 00635 00638 void Shutdown(); 00639 00640 00641 bool GetActive() {return m_bConstFRActive;} 00648 void Watch(); 00649 00650 00657 void Start(); 00658 00663 void Stop(); 00664 00670 void IncreaseDetailTemp(); 00671 00677 bool ViewpointHasChanged(bool update = true); 00678 00683 void SetDetailIncMode (DetailChangeMode mode) {m_DetailIncMode=mode; m_SimplificationIncrease = mode;} 00684 void SetDetailIncOnIdleMode (DetailChangeMode mode) {m_DetailIncOnIdleMode=mode; m_SimplificationIncreaseOnIdle = mode;} 00685 00688 DetailChangeMode GetDetailIncMode () {return m_DetailIncMode; } 00689 00694 void SetDetailDecMode (DetailChangeMode mode) {m_DetailDecMode=mode; m_SimplificationDecrease = mode;} 00697 DetailChangeMode GetDetailDecMode () {return m_DetailDecMode; } 00700 void ResetListPointers() { m_SimpLevel=0; m_SimpListPos = 0; } 00701 00703 float GetTargetFrameRate() { return m_TargetFrameRate; } 00707 void SetTargetFrameRate( float framerate ) { m_TargetFrameRate = framerate;} 00712 void SetDeadZone( float deadzone ) { m_DeadZone = deadzone;} 00716 void SetEmergencyDetailDecrease( bool detaildecrease ) { m_bEmergencyDecrease = detaildecrease;} 00721 void SetActivityType(HActivityType at) { m_ActivityType = at; } 00722 00725 HActivityType GetActivityType() { return m_ActivityType;} 00726 int GetSimpLevel() { return m_SimpLevel;} 00732 void AdjustLodOptions(); 00734 bool GetDetailIncreaseState() { return m_bIncreaseDetailTemp; } 00739 void SetDetailLevel ( int listpos, int simplevel) { m_SimpListPos = listpos; m_SimpLevel = simplevel; } 00740 00745 HConstFRSimpType * GetSimpType(ConstFRType stype); 00749 void SetSimpLevel(int simplevel) { m_SimpLevel = simplevel; } 00750 00753 void AdjustDefaultDetailLevelToModel(); 00754 00762 static bool Tick(float request_time, float actual_time, void * user_data); 00763 00764 void SetDisableIncreaseTemp(bool it) { m_bDisableIncreaseTemp = it; } 00765 void InitiateDelay() { m_bOneDelay = true; } 00766 int GetDetailLevelNum(); 00767 int GetTotalDetailLevelNum(); 00768 00769 void SetWatchActivity(bool wa) { m_bWatchActivity = wa; } 00770 void MajorDetailDecrease(); 00771 void MajorDetailIncrease(); 00772 00773 00774 private: 00775 bool m_bFullDetailTemp; 00776 bool m_bWatchActivity; 00777 bool m_bIncreaseDetailTemp; 00778 float m_oldPos[11]; 00779 HTClient * m_pUpdateTimerClient; 00780 bool m_bDisableIncreaseTemp; 00781 bool m_bOneDelay; 00782 float m_OneDelayStart; 00783 bool m_bAdjustNextTime; 00784 float m_AdjustTime; 00785 bool m_bIncrease; 00786 int m_CounterThreshold; 00787 int m_TempDetailIncrement; 00788 bool m_bFirstIncrease; 00789 00790 00791 }; 00792 00793 00794 #ifdef H_PACK_8 00795 #pragma pack(pop) 00796 #endif 00797 00798 #endif 00799 00800 00801 00802 00803 00804 00805 00806