Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HConstantFrameRate.h
Go to the documentation of this file.
00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc.
00002 //
00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
00004 // and considered a trade secret as defined under civil and criminal statutes.
00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
00006 // unauthorized use or misappropriation of its trade secrets.  Use of this information
00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
00009 
00010 // HConstantFrameRate.h: interface for the HConstantFrameRate class.
00011 //
00013 
00018 #ifndef HCONSTANTFRAMERATE_H
00019 #define HCONSTANTFRAMERATE_H
00020 
00021 #ifdef H_PACK_8
00022 #pragma pack(push)
00023 #pragma pack(8)
00024 #endif
00025 
00026 #include "HTools.h"
00027 #include "hic_types.h"
00028 
00029 class HTClient;
00030 
00034 enum ConstFRType
00035 {
00036     ConstFRNoSimpType,          
00037     ConstFRNoSimpAAType,        
00038     ConstFRWireframeBBoxType,   
00039     ConstFRSolidBBoxType,       
00040     ConstFRWireframeType,       
00041     ConstFRLodClampType,        
00042     ConstFRLodThresholdType,    
00043     ConstFRUserType,            
00044     ConstFRExtentType           
00045 };
00046 
00050 enum HActivityType
00051 {
00052     NoActivity,             
00053     MovementActivity,       
00054     CuttingPlaneActivity,   
00055     GeneralActivity         
00056 };
00057 
00058 
00062 enum DetailChangeMode
00063 {
00064     NoDetailChange,             
00065     AllowDetailChangeOnce,      
00066     AllowDetailChange           
00067 };
00068 
00069 
00070 class HConstantFrameRate;
00071 
00072 class HBaseView;
00073 
00079 class MVO_API HConstFRSimpType
00080 {
00081 public:
00082     int             m_SimpLevelMin;  
00083     int             m_SimpLevelMax;  
00086     HConstFRSimpType()
00087     {
00088         m_SimpLevelMin=0;
00089         m_SimpLevelMax=0;
00090     }
00091 
00096     HConstFRSimpType(int min, int max)
00097     {
00098         m_SimpLevelMin=min;
00099         m_SimpLevelMax=max;
00100     }
00101     virtual ~HConstFRSimpType() {}
00102 
00103     virtual void Reset(HConstantFrameRate *pCfr) {
00104         UNREFERENCED(pCfr);
00105     } 
00106 
00107 
00114     virtual void Set(HConstantFrameRate *pCfr, int SimpLevel) = 0;
00121     virtual void Update(HConstantFrameRate *pCfr, int SimpLevel);
00122 
00124     virtual ConstFRType GetType() = 0;      
00126     int GetMinSimpLevel() { return m_SimpLevelMin; };
00128     int GetMaxSimpLevel() { return m_SimpLevelMax; };
00129 
00131     static HConstFRSimpType **CreateList(int size) { return new HConstFRSimpType *[size]; };
00132  
00133 };
00134 
00135 
00141 class  MVO_API HFrExtent : public HConstFRSimpType
00142 {
00143 public:
00145      HFrExtent() : HConstFRSimpType()  { m_Multiplier = 5; m_bUseLOD = false; }
00146 
00151      HFrExtent(int min, int max) : HConstFRSimpType(min,max) { m_Multiplier = 5; m_bUseLOD = false; }
00152 
00153     virtual ~HFrExtent() {}
00159     void SetMultiplier(int mp) { m_Multiplier = mp; }
00166     void Set(HConstantFrameRate *pCfr, int SimpLevel);
00172     void SetUseLod(bool ul) { m_bUseLOD = ul; }
00173     bool GetUseLod() const { return m_bUseLOD;}
00175     ConstFRType GetType() { return ConstFRExtentType; }
00182     static HConstFRSimpType * Create(int min, int max) {return new HFrExtent(min, max); };   
00183 
00184 protected:
00185     int m_Multiplier;
00186     bool m_bUseLOD;
00187 };
00188 
00192 class MVO_API HFrNoSimpAA : public HConstFRSimpType
00193 {
00194 public:
00196     HFrNoSimpAA() : HConstFRSimpType(0, 1) {} 
00197 
00202     HFrNoSimpAA(int min, int max) : HConstFRSimpType(min,max) {};
00203 
00204     virtual ~HFrNoSimpAA() {}
00205 
00213     void Set(HConstantFrameRate *pCfr, int SimpLevel);
00215     ConstFRType GetType() { return ConstFRNoSimpAAType; }
00222     void Update(HConstantFrameRate *pCfr, int SimpLevel);
00223 
00230     static HConstFRSimpType * Create(int min, int max) {return new HFrNoSimpAA(min, max); };                                  
00231 
00232 };
00233 
00238 class MVO_API HFrNoSimp : public HConstFRSimpType
00239 {
00240 public:
00242     HFrNoSimp() : HConstFRSimpType(0, 1) {} 
00247     HFrNoSimp(int min, int max) : HConstFRSimpType(min,max) {};
00248 
00249     virtual ~HFrNoSimp() {}
00250 
00257     void Set(HConstantFrameRate *pCfr, int SimpLevel);
00259     ConstFRType GetType() { return ConstFRNoSimpType; }
00260 
00261 
00268     static HConstFRSimpType * Create(int min, int max) {return new HFrNoSimp(min, max); };   
00269 
00270  
00271 };
00272 
00273 
00278 class MVO_API HFrLodClamp : public HConstFRSimpType
00279 {
00280 public:
00282     HFrLodClamp()
00283         : HConstFRSimpType() 
00284     { m_bSegmentSwitch = false; }
00285 
00290     HFrLodClamp(int min, int max)
00291         : HConstFRSimpType(min, max)
00292     { m_bSegmentSwitch = false; }
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