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$ 00013 // 00014 00018 #ifndef _HBASEVIEW_H 00019 #define _HBASEVIEW_H 00020 00021 #ifdef H_PACK_8 00022 #pragma pack(push) 00023 #pragma pack(8) 00024 #endif 00025 00026 #include "HTools.h" 00027 #include "HTManager.h" 00028 #include "HEventListener.h" 00029 00030 class HDB; 00031 class HBaseModel; 00032 class HCamera; 00033 class HEventInfo; 00034 class HSelectionSet; 00035 class HBaseOperator; 00036 class HConstantFrameRate; 00037 class HSharedKey; 00038 class HImCuttingGeometry; 00039 class HOutputHandler; 00040 class HOutputHandlerOptions; 00041 class HInputHandler; 00042 class HInputHandlerOptions; 00043 class HUtilityAntialiasing; 00044 class HMarkupManager; 00045 class HShadow; 00046 class HUndoManager; 00047 class HEventManager; 00048 class HObjectManager; 00049 class HOpCameraManipulate; 00050 class HDebugZBuffer; 00051 class HConstFRSimpType; 00052 00053 00059 typedef bool(*HSignalNotifyFunction)(int signal, void *signal_data, void *user_data); 00060 00061 00062 00066 enum HRenderMode 00067 { 00068 HRenderWireframe = 1, 00069 HRenderTriangulation = 2, 00070 HRenderSilhouette = 3, 00071 HRenderHiddenLine = 4, 00072 HRenderHiddenLineHOOPS = 5, 00073 HRenderHiddenLineFast = 6, 00074 HRenderFlat = 7, 00075 HRenderGouraud = 8, 00076 HRenderGouraudWithEdges = 9, 00077 HRenderPhong = 10, 00078 HRenderShaded = 11, 00079 HRenderShadedWithLines = 12, 00080 HRenderWireframeWithSilhouette = 13, 00081 HRenderShadedWireframe = 14, 00082 HRenderVertices = 15, 00083 HRenderShadedVertices = 16, 00084 HRenderGouraudWithLines = 17, 00085 HRenderLOD1 = 18, 00086 HRenderLOD2 = 19, 00087 HRenderBRepHiddenLine = 20, 00088 HRenderBRepHiddenLineFast = 21, 00089 HRenderBRepWireframe = 22, 00090 HRenderGoochShaded = 23, 00091 HRenderFakeHiddenLine = 24, 00092 HRenderUnknown = 0 00093 }; 00094 00098 enum ViewMode 00099 { 00100 HViewNone, 00101 HViewXY, 00102 HViewYX, 00103 HViewXZ, 00104 HViewZX, 00105 HViewYZ, 00106 HViewZY, 00107 HViewIso, 00108 HViewIsoFrontRightTop, 00109 HViewIsoBackRightTop, 00110 HViewIsoBackLeftTop, 00111 HViewIsoBackLeftBottom, 00112 HViewIsoBackRightBottom, 00113 HViewIsoFrontLeftTop, 00114 HViewIsoFrontLeftBottom, 00115 HViewIsoFrontRightBottom, 00116 00117 HViewSEIso, 00118 HViewSWIso, 00119 HViewNEIso, 00120 HViewNWIso, 00121 00122 HViewFront, 00123 HViewBack, 00124 HViewRight, 00125 HViewLeft, 00126 HViewTop, 00127 HViewBottom, 00128 00129 HViewUnknown 00130 }; 00131 00132 00136 enum LightingIntMode 00137 { 00138 LightingIntUnknown, 00139 LightingIntGouraud, 00140 LightingIntPhong 00141 }; 00142 00143 00152 enum FramerateMode 00153 { 00154 FramerateOff, 00155 FramerateFixed, 00156 FramerateTarget 00157 }; 00164 enum ProjMode 00165 { 00166 ProjUnknown, 00167 ProjPerspective, 00168 ProjOrthographic, 00169 ProjStretched 00170 }; 00171 00172 00173 00177 enum HandednessMode 00178 { 00179 HandednessLeft, 00180 HandednessRight, 00181 HandednessNone 00182 }; 00183 00184 00188 enum DisplayListType 00189 { 00190 DisplayListOff, 00191 DisplayListGeometry, 00192 DisplayListSegment 00193 }; 00194 00198 enum MultiThreadingType 00199 { 00200 MultiThreadingOff, 00201 MultiThreadingBasic, 00202 MultiThreadingFull 00203 }; 00204 00208 enum HLRMode 00209 { 00210 AnalyticHiddenLine, 00211 FastHiddenLine, 00212 FakeHiddenLine 00213 }; 00214 00215 00217 enum AxisMode 00218 { 00219 AxisOff, 00220 AxisSimple, 00221 AxisCenter, 00222 AxisOn 00223 }; 00224 00226 enum UpDirection 00227 { 00228 UpDirectionX = 0xFADE, 00229 UpDirectionY, 00230 UpDirectionZ 00231 }; 00232 00233 00237 enum ViewUpdateMode 00238 { 00239 OnDemand, 00240 Continuous, 00241 Deferred 00242 }; 00243 00244 00246 enum HShadowRenderingMode 00247 { 00248 SoftwareShadow, 00249 HardwareShadow, 00250 SoftwareOpenglShadow 00251 }; 00252 00254 enum HBloomShape 00255 { 00256 RadialBloom, 00257 StarBloom 00258 }; 00259 00261 enum HQuickMovesMethod 00262 { 00263 HQuickMoves_None, 00264 HQuickMoves_XOR, 00265 HQuickMoves_Overlay, 00266 HQuickMoves_Spriting 00267 }; 00268 00269 00276 enum HViewSelectionLevel 00277 { 00278 HSelectionLevelEntity, 00279 HSelectionLevelSegment, 00280 HSelectionLevelSegmentTree 00281 }; 00287 enum SplatSymbol 00288 { 00289 SplatRound, 00290 SplatSquare 00291 }; 00292 00293 00294 00301 typedef void(*HBaseViewEmitMessageFunction)(const char* message, unsigned int length, void * user_data); 00302 00303 00305 00337 class MVO_API HBaseView : public HUpdateListener , public HMouseListener, public HObjectManipulationListener 00338 { 00339 00340 public: 00341 00342 00372 HBaseView(HBaseModel *model, 00373 const char * alias = 0, 00374 const char * driver_type = 0, 00375 const char * instance_name = 0, 00376 void * window_handle = 0, 00377 void * colormap = 0, 00378 void * clip_override = 0, 00379 void * window_handle_2 = 0, 00380 const char * driver_path = 0); 00381 00409 void RebindView( 00410 const char * alias = 0, 00411 const char * driver_type = 0, 00412 const char * instance_name = 0, 00413 void * window_handle = 0, 00414 void * colormap = 0, 00415 void * clip_override = 0, 00416 void * window_handle_2 = 0, 00417 int debug_flags = 0 00418 ); 00419 00424 virtual ~HBaseView(); 00425 00430 virtual void Init(); 00431 00437 virtual void FitWorld(HPoint * center_out = 0); 00438 00446 virtual void FitWorldExact(HPoint * center_out = 0); 00447 00452 virtual void ZoomToExtents(); 00453 00457 virtual void ZoomToInitialCamera(); 00458 00459 00464 void FitSegment(HC_KEY seg_key); 00465 00470 void FitSelection(HC_KEY key = INVALID_KEY, bool adjustToShellNormal = false); 00471 00475 void FitItemByPath(HC_KEY key, int incl_count, HC_KEY * incl_path); 00476 00478 void RenderAntialiasing(); 00479 00481 void InitAntialiasing(); 00482 00484 HUtilityAntialiasing * GetAntialiasing() { return m_pAntialiasing; } 00485 00487 HMarkupManager * GetMarkupManager(); 00488 00490 bool HaveMarkupManager() {return (m_pMarkupManager != 0);} 00491 00495 void SetMarkupManager( HMarkupManager* markup ) { m_pMarkupManager = markup; } 00496 00498 void RenderWireframe(); 00499 00502 void RenderSilhouette(); 00503 00505 void RenderHiddenLine(); 00506 00508 void RenderHiddenLineFast(); 00509 00511 void RenderFlat(); 00512 00514 void RenderGooch(); 00515 00517 void RenderGouraud(); 00518 00520 void RenderPhong(); 00521 00523 void RenderWireframeWithSilhouette(); 00524 00526 void RenderShadedWireframe(); 00527 00529 void RenderVertices(); 00530 00532 void RenderShadedVertices(); 00533 00537 void RenderFakeHiddenLine(); 00538 00541 void RenderBRepHiddenLine(); 00542 00545 void RenderBRepHiddenLineFast(); 00546 00548 void RenderBRepWireframe(); 00549 00554 void RenderShaded(); 00555 00557 void RenderShadedWithLines(); 00558 00560 void RenderGouraudWithLines(); 00561 00563 void RenderLOD1(); 00565 void RenderLOD2(); 00566 00567 00569 void RemoveTransforms(); 00570 00577 virtual void Update(); 00578 00584 virtual void ForceUpdate(); 00585 00597 virtual HFileInputResult FileInput(const __wchar_t * FileName, HInputHandler * handler, HInputHandlerOptions * options = 0); 00598 00610 virtual HFileInputResult FileInput(const char * FileName, HInputHandler * handler, HInputHandlerOptions * options = 0){ 00611 return FileInput((__wchar_t*)H_WCS(FileName).encodedText(), handler, options); 00612 } 00613 00625 #ifdef H_USHORT_OVERLOAD 00626 virtual HFileInputResult FileInput(const unsigned short * FileName, HInputHandler * handler, HInputHandlerOptions * options = 0){ 00627 H_UTF16 utf16; 00628 utf16.encodedText((utf16_char*)FileName); 00629 return FileInput((__wchar_t*)H_WCS(utf16).encodedText(), handler, options); 00630 } 00631 #endif 00632 00658 virtual HFileOutputResult FileOutput(const __wchar_t * FileName, HOutputHandler * handler, HOutputHandlerOptions * options = 0); 00659 00685 virtual HFileOutputResult FileOutput(const char * FileName, HOutputHandler * handler, HOutputHandlerOptions * options = 0){ 00686 return FileOutput((__wchar_t*)H_WCS(FileName).encodedText(), handler, options); 00687 } 00688 00689 // accessors 00690 00692 const char* GetDriverPath( void ) { return (const char*)m_sDriverPath; } 00693 00695 const char* GetDriverType( void ) { return (const char*)m_sDriverType; } 00696 00698 virtual void UpdateHighlighting(); 00699 00701 HSelectionSet* GetSelection( void ) { return m_pSelection; } 00702 00706 void SetSelection( HSelectionSet* selection ) { m_pSelection = selection; } 00707 00709 virtual HBaseModel * GetModel() { return(m_pModel); } 00710 00713 HC_KEY GetModelKey(); 00714 00716 HRenderMode GetRenderMode () { return(m_RenderMode); } 00717 00719 ViewMode GetViewMode () { return(m_ViewMode); } 00720 00727 virtual void SetViewMode (ViewMode mode, bool invert = false, bool fitWorld = true); 00728 00730 bool GetCPLineVisibility() {return m_bCPLineVisibility; } 00731 00733 bool GetCPFaceVisibility() {return m_bCPFaceVisibility; } 00734 00742 void SetCPGeomVisibility(bool lines, bool faces=false); 00743 00744 00750 bool GetCuttingPlanesExist(const char *plane = 0); 00751 00755 void SetCuttingPlanesExist(bool state); 00756 00758 bool GetCuttingPlanesVisibility() {return m_bCuttingPlanesVisibility; } 00759 00763 void SetCuttingPlanesVisibility(bool visible); 00764 00766 HConstantFrameRate* GetConstantFrameRateObject( void ) { return m_pConstantFrameRate; } 00767 00771 void SetConstantFrameRateObject( HConstantFrameRate* cf ) { m_pConstantFrameRate = cf; } 00772 00774 void SetEventCheckerCallback(void (* EventChecker)(HIC_Rendition const *nr)); 00775 00777 void SetKeyStateCallback(bool (* KeyState)(unsigned int, int &)) { m_pfKeyState = KeyState; } 00778 00780 bool (*GetKeyStateCallback())(unsigned int, int &) { return m_pfKeyState; } 00781 00783 void (*GetEventCheckerCallback())(HIC_Rendition const *nr) { return m_pfEventChecker; } 00784 00785 00793 void SetOcclusionCullingMode(bool mode, bool UseOctree = true, int threshold = 50); 00794 00795 00798 HandednessMode GetHandedness(); 00799 00811 virtual void SetHandedness(HandednessMode mode, bool emit_message=false); 00812 00817 virtual void SetHandednessFromMessage(const char *in_data, unsigned int data_length); 00818 00825 virtual void SetFontSize(const char *font_size, bool emit_message=false); 00826 00831 virtual void SetFontSizeFromMessage(const char *in_data, unsigned int data_length); 00832 00834 bool GetBackplaneCulling(); 00835 00842 void SetBackplaneCulling(bool cull); 00843 00847 ProjMode GetProjMode(); 00848 00852 void SetProjMode(ProjMode mode); 00853 00855 DisplayListType GetDisplayListType(); 00856 00860 void SetDisplayListType(DisplayListType type); 00861 00863 bool GetDisplayListMode(); 00864 00868 void SetDisplayListMode(bool mode); 00869 00871 HandednessMode GetPolygonHandednessMode(); 00872 00884 void SetPolygonHandednessMode(HandednessMode); 00885 00888 bool GetLodMode(); 00889 00896 void SetLodMode(bool onoff); 00897 00899 bool GetSpritingMode() { return m_bSpritingAllowed; } 00900 00906 void SetSpritingMode(bool onoff) { m_bSpritingAllowed = onoff; } 00907 00911 int GetLodThreshold(); 00912 00917 void SetLodThreshold(int val); 00918 00920 HC_KEY GetViewKey( void ) { return m_ViewKey; } 00922 void SetViewKey( HC_KEY view_key ) { m_ViewKey = view_key; } 00923 00925 HC_KEY GetIncludeLinkKey( void ) { return m_lIncludeLinkKey; } 00927 void SetIncludeLinkKey( HC_KEY link ) { m_lIncludeLinkKey = link; } 00928 00930 HC_KEY GetSceneKey( void ) { return m_SceneKey; } 00931 00935 void SetSceneKey( HC_KEY scene_key ) { m_SceneKey = scene_key; } 00936 00938 HC_KEY GetOverwriteKey( void ) { return m_OverwriteKey; } 00939 00941 HC_KEY GetShadowMapSegmentKey( void ) { return HC_KShow_Owner_By_Key (m_lIncludeLinkKey); } 00942 00944 HC_KEY GetLightsKey( void ) { return m_LightsKey; } 00945 00949 void SetLightsKey( HC_KEY lights_key ) { m_LightsKey = lights_key; } 00950 00952 float GetZoomLimit( void ) { return m_fZoomLimit; } 00953 00957 void SetZoomLimit( float zoomLimit ) { m_fZoomLimit = zoomLimit; } 00958 00960 virtual void SetZoomLimit(); 00961 00963 HC_KEY GetWindowspaceKey( void ) { return m_WindowspaceKey; } 00964 00968 void SetWindowspaceKey( HC_KEY winspace_key ) { m_WindowspaceKey = winspace_key; } 00969 00971 HC_KEY GetConstructionKey( void ) { return m_ConstructionKey; } 00972 00976 void SetConstructionKey( HC_KEY construct_key ) { m_ConstructionKey = construct_key; } 00977 00979 HC_KEY GetBBoxGeometryKey( void ) { return m_BBoxGeometryKey; } 00981 void SetBBoxGeometryKey( HC_KEY bbox_key ) { m_BBoxGeometryKey = bbox_key; } 00982 00984 HC_KEY GetCuttingPlanesKey( void ) { return m_CuttingPlanesKey; } 00985 00989 void SetCuttingPlanesKey( HC_KEY cuttingplanes_key ) { m_CuttingPlanesKey = cuttingplanes_key; } 00990 00992 HC_KEY GetCuttingPlaneGeomKey( void ) { return m_CuttingPlaneGeomKey; } 00993 00997 void SetCuttingPlaneGeomKey( HC_KEY cuttingplanegeom_key ) { m_CuttingPlaneGeomKey = cuttingplanegeom_key; } 00999 HC_KEY GetIntersectPolylinesKey( void ) { return m_IntersectPolylinesKey; } 01000 01004 void SetIntersectPolylinesKey( HC_KEY intersectpolylines_key ) { m_IntersectPolylinesKey = intersectpolylines_key; } 01005 01007 HC_KEY GetProgressBarKey( void ) { return m_ProgressBarKey; } 01012 void SetProgressBarKey( HC_KEY key ) { m_ProgressBarKey = key; } 01013 01014 01016 int GetUpdateInterrupted() { return m_UpdateInterrupted; } 01017 01021 void SetUpdateInterrupted( int val ) { m_UpdateInterrupted = val; } 01022 01024 float GetIdleTime( void ); 01025 01027 void ResetIdleTime( void ); 01028 01031 HQuickMovesMethod GetQuickMovesMethod () const; 01032 01034 class HDebugZBuffer *GetDebugZBuffer() { return m_pDebugZBuffer; } 01035 01038 void SetDebugZBuffer(HDebugZBuffer *dzb) { m_pDebugZBuffer = dzb; }; 01039 01041 AxisMode GetAxisMode() {return m_bAxisMode; } 01042 01047 virtual void SetAxisMode(AxisMode mode); 01048 01052 virtual void OnSetAxisMode( AxisMode mode ); 01053 01055 void UpdateAxisTriad() { SetAxisMode(GetAxisMode()); } 01056 01062 virtual void AdjustAxisWindow( int axis_window_pixels_in = -1, HIntRectangle *rect_in=0 ); 01063 01065 static void AdjustAxisWindowCallback(int signal, void * signal_data, void * user_data); 01066 01068 static void AdjustWindowCallback(int signal, void * signal_data, void * user_data); 01069 01071 HShadowMode GetShadowMode() {return m_ShadowMode; } 01072 01077 virtual void SetShadowMode (HShadowMode sm, bool saveMode = true); 01078 01090 virtual void SetReflectionPlane(bool state, float opacity=0.5f, bool fading=true, bool attenuate=false, 01091 float hither=0.0f, float yon=1.0f, bool blur=false, int blur_level=1); 01092 01094 HC_KEY GetDefaultLightKey(int which = 0) { return m_SceneLight[which]; } 01095 01096 01098 bool GetTransparentSelectionBoxMode() {return m_bTransparentSelectionBox; } 01099 01103 void SetTransparentSelectionBoxMode(bool mode) { m_bTransparentSelectionBox = mode; } 01104 01110 virtual void DeleteSelectionList(bool emit_message=false); 01111 01118 void RotateOnUpdate(const char *sname); 01119 01127 virtual void SetWindowColor(HPoint rgb, bool emit_message=false); 01128 01139 virtual void SetWindowColor(HPoint rgbtop, HPoint rgbbottom, bool emit_message=false); 01140 01152 virtual void SetWindowColorRange(HPoint rgbtop, HPoint rgbbottom, int percentage, bool emit_message=false); 01153 01154 01162 virtual void SetWindowMaterial(const char * name, bool emit_message=false); 01163 01169 virtual void SetWindowColorFromMessage(const char *in_data, unsigned int data_length); 01170 01174 void GetWindowColor(HPoint &color_out); 01175 01180 void GetWindowColor(HPoint &color_top, HPoint &color_bottom); 01181 01187 void GetWindowColor(HPoint &color_top, HPoint &color_bottom, int &percentage); 01188 01193 void GetWindowMaterial(char * out_material, char * out_pattern); 01194 01198 void SetOperator(HBaseOperator *NewOperator); 01199 01200 01202 void SetCurrentOperator(HBaseOperator *NewOperator) { SetOperator(NewOperator); } 01203 01207 HBaseOperator* GetOperator() { return(m_pOperator); } 01208 01213 HBaseOperator* GetCurrentOperator() { return(m_pOperator); } 01214 01215 01217 HC_KEY GetAxisTriadKey() {return m_AxisTriadKey;} 01218 01220 bool GetHideOverlappedText(){ return m_bHideOverlappedText;} 01221 01225 void SetHideOverlappedText(bool hide); 01226 01230 void SetNavCube(bool onoff) { m_bNavCube = onoff;} 01231 01233 bool GetSmoothTransition() { return m_bSmoothTransition;} 01234 01238 void SetSmoothTransition(bool onoff) { m_bSmoothTransition = onoff;} 01239 01243 void SetSmoothTransitionDuration(float duration) { m_SmoothTransitionDuration = duration;} 01244 01246 float GetSmoothTransitionDuration() { return m_SmoothTransitionDuration;} 01247 01249 bool IsLightFollowCamera(){return m_bLightFollowsCamera;} 01250 01254 void SetLightFollowsCamera(bool onoroff); 01255 01256 static const int MaxLights = 6; 01257 01261 void SetLightCount(int count); 01262 01266 int GetLightCount() { return m_LightCount; } 01267 01276 virtual void CameraPositionChanged(bool emit_message=false, bool smooth_camera_transition=false); 01277 01278 01282 virtual void PrepareForCameraChange(); 01283 01284 01294 virtual void SetCamera(HPoint pos, HPoint tar, HPoint up, float fieldx, float fieldy, const char *proj); 01295 01305 virtual void SetInitialCamera(HPoint pos, HPoint tar, HPoint up, float fieldx, float fieldy, char const * proj); 01306 01307 01317 virtual void GetCamera(HPoint *pos, HPoint *tar, HPoint *up, float &fieldx, float &fieldy, char *proj); 01318 01323 virtual void SetCamera(HCamera camera); 01324 01329 virtual void GetCamera(HCamera *camera); 01330 01336 virtual void SetCameraFromMessage(const char *data, unsigned int data_length); 01337 01345 virtual void InsertHSFData(const char *segment, const char *in_data, unsigned int data_length, bool emit_message=false); 01346 01352 virtual void InsertHSFDataFromMessage(const char *in_data, unsigned int data_length); 01353 01360 virtual void EmitHSFData(const char *segment, const char *in_data, unsigned int data_length); 01361 01367 virtual void SetRenderMode (HRenderMode NewRenderMode, bool emit_message=false); 01368 01374 virtual void SetRenderModeFromMessage(const char *in_data, unsigned int data_length); 01375 01379 virtual void EmitFlushMessage(); 01380 01388 virtual void FlushFromMessage(const char *in_data, unsigned int data_length); 01389 01390 01396 virtual void Flush(bool emit_message=false); 01397 01404 void SetEmitMessageFunction( 01405 HBaseViewEmitMessageFunction new_emit_message_function, 01406 void * user_data=0) { 01407 emit_message_function=new_emit_message_function; 01408 emit_message_function_user_data=user_data;}; 01409 01414 bool EmittingMessages(){return (emit_message_function!=0);}; 01415 01419 HBaseViewEmitMessageFunction GetEmitMessageFunction() {return emit_message_function;}; 01420 01424 void * GetEmitMessageFunctionUserData() {return emit_message_function_user_data;}; 01425 01431 virtual void EmitSelectMessage(HC_KEY key, bool isSelect); 01432 01438 virtual void SelectFromMessage(const char *in_data, unsigned int data_length); 01439 01443 virtual void EmitDeSelectAllMessage(); 01444 01445 01449 virtual void EmitDeleteSelectionListMessage(); 01450 01451 01455 virtual void DeleteSelectionListFromMessage(); 01456 01457 01461 virtual void DeSelectAllFromMessage(); 01462 01463 01468 virtual void EmitSetModellingMatrixMessage(HC_KEY key); 01469 01470 01475 virtual void EmitSetModellingMatrixMessage(); 01476 01484 virtual void EmitSegment(HC_KEY key, bool emit_contents_only = false); 01485 01490 virtual void EmitDeleteByKeyMessage(HC_KEY key); 01491 01497 virtual void DeleteByKeyFromMessage(const char *in_data, unsigned int data_length); 01498 01504 virtual void SetModellingMatrixFromMessage(const char *in_data, unsigned int data_length); 01505 01509 HSharedKey * GetSharedKey() {return m_pSharedKey;}; 01510 01511 01515 virtual void StartSharedKey(); 01516 01517 01519 enum HAnimateMode { 01520 HAnimateScene = 0x00000001 01521 }; 01522 01523 01531 virtual void Animate (int animation_steps = 30, HAnimateMode animate_flags = HAnimateScene, int MaxRotation = 360); 01532 01535 virtual void SetGeometryChanged(); 01536 01540 bool GetSceneBoundingSet() { return m_bSceneBoundingSet; } 01541 01546 void SetSceneBounding(HPoint &min, HPoint &max); 01547 01549 void InvalidateSceneBounding() { m_bSceneBoundingSet = false; } 01550 01554 void SetFastMarkerDrawing(bool b_fast); 01555 01559 bool GetFastMarkerDrawing(); 01560 01566 void SetDoubleBuffering(bool double_buffer); 01567 01569 virtual void ClearGeometryChanged() {m_bGeometryChanged = false; }; 01570 01572 virtual bool GeometryChanged() {return m_bGeometryChanged;}; 01573 01579 unsigned long SetSignalNotify( int signal, HSignalNotifyFunction callback, void *user_data ); 01580 01583 void UnSetSignalNotify( unsigned long cookie ); 01584 01589 void SetColorInterpolation(bool onoff); 01590 01596 void SetColorIndexInterpolation(bool onoff, bool isolines = false); 01597 01603 bool GetColorIndexInterpolation(char * option = 0); 01604 01613 bool GetFrameBufferEffectsOptions(char * options = 0, int *border = 0); 01614 01620 void Notify(int signal, void * signal_data = 0); 01621 01628 int UpdateEvent(bool antialias = false, bool forceUpdate = false); 01632 bool GetUpdateRequested() { return m_bUpdateRequested; } 01636 void RequestUpdate() { m_bUpdateRequested = true; } 01640 void ClearUpdateRequest() { m_bUpdateRequested = false; } 01641 01647 void SetSuppressUpdate(bool suppress) { 01648 suppress?m_SuppressUpdate++:m_SuppressUpdate--; 01649 if (m_SuppressUpdate<0) 01650 m_SuppressUpdate = 0; 01651 } 01652 01657 bool GetSuppressUpdate() { return (m_SuppressUpdate > 0); } 01658 01664 void SetSuppressUpdateTick(bool suppress) { 01665 suppress?m_SuppressUpdateTick++:m_SuppressUpdateTick--; 01666 if (m_SuppressUpdateTick<0) 01667 m_SuppressUpdateTick = 0; 01668 } 01669 01674 bool GetSuppressUpdateTick() { return (m_SuppressUpdateTick > 0); } 01675 01691 void SetViewUpdateMode(ViewUpdateMode mode, float rate = 0.01f); 01692 01696 ViewUpdateMode GetViewUpdateMode() { return m_ViewUpdateMode; } 01697 01705 static bool UpdateTick(float request_time, float actual_time, void * user_data); 01706 01714 static bool StreamProgressCallback(unsigned long so_far, unsigned long expected, void * user_data); 01715 01717 void FlushProgressBar(); 01718 01720 HUndoManager *GetUndoManager(); 01721 01723 HEventManager *GetEventManager(); 01724 01726 HObjectManager *GetHObjectManager(); 01727 01729 bool GetDynamicHighlighting() { return m_bDynamicHighlighting; } 01730 01734 void SetDynamicHighlighting(bool state); 01735 01741 virtual int OnNoButtonDownAndMove(HEventInfo &hevent); 01742 01747 virtual int OnLButtonDownAndMove(HEventInfo &hevent); 01748 01754 virtual int OnLButtonDblClk(HEventInfo &hevent); 01755 01760 virtual int OnRButtonDownAndMove(HEventInfo &hevent); 01765 virtual int OnMButtonDownAndMove(HEventInfo &hevent); 01770 virtual int OnLRButtonDownAndMove(HEventInfo &hevent); 01771 01776 virtual int OnLButtonDown(HEventInfo &hevent); 01777 01782 virtual int OnMouseMove(HEventInfo &hevent); 01783 01789 virtual int OnLButtonUp(HEventInfo &hevent); 01790 01791 #if 0 01792 01796 virtual int OnMouseWheel(HEventInfo &hevent); 01797 #else 01798 01802 virtual int OnMouseWheel(HEventInfo &hevent); 01803 01806 virtual bool ComputeReasonableTarget(HPoint & new_tar, HPoint const & mouse_win, HPoint const & tar_orig); 01807 01808 /* This method adjusts the old field to the new target so the picture on the screen won't change. */ 01809 void ComputeNewField(float & width, float & height, HPoint const & new_tar, 01810 HCamera const & old_camera); 01811 #endif 01812 01814 virtual int OnKeyDown(HEventInfo &hevent); 01815 01817 virtual int OnKeyUp(HEventInfo &hevent); 01818 01821 virtual void SetShadowColor(HPoint color); 01822 01827 virtual void SetShadowLightDirection(bool explicit_light, HPoint const * direction = 0); 01828 01833 virtual bool GetShadowLightDirection(HPoint * direction = 0); 01834 01838 virtual void SetShadowIgnoresTransparency(bool ignore); 01839 01843 virtual bool GetShadowIgnoresTransparency(); 01844 01847 virtual void DoDynamicHighlighting(HPoint mouse_pos); 01848 01851 virtual void SetShadowResolution(int res); 01852 01855 virtual void SetShadowBlurring(int blur); 01856 01858 virtual void InternalUpdate(); 01859 01863 virtual void SetShadowRegenerationMode(bool onoff) { m_bShadowRegeneration = onoff; } 01864 01867 virtual void SetShadowRegenerationToggle() { m_bShadowRegenerationToggle = true; m_bShadowRegeneration = false; } 01868 01871 bool GetCuttingPlaneRegenerationMode() { return m_bCuttingPlaneRegeneration; } 01872 01877 virtual void SetCuttingPlaneRegenerationMode(bool onoff) { m_bCuttingPlaneRegeneration = onoff; } 01878 01882 bool GetShadowRegenerationMode() { return m_bShadowRegeneration; } 01883 01887 virtual void SetCameraChanged( bool val=true ) { m_bCameraChanged = val; if(val) ResetIdleTime(); } 01888 01890 virtual bool GetCameraChanged() { return m_bCameraChanged; } 01891 01895 virtual void SetInvertMouseWheelZoom( bool val=true ) { m_bInvertMouseWheelZoom = val;} 01896 01898 virtual bool GetInvertMouseWheelZoom() { return m_bInvertMouseWheelZoom; } 01899 01900 01904 virtual void SetAxisManipulateOperator(HOpCameraManipulate *op); 01905 01910 virtual void SetVisibilitySelectionMode(bool onoff); 01911 01913 virtual bool GetVisibilitySelectionMode(); 01914 01917 virtual void SetRelatedSelectionLimit(int limit); 01918 01920 virtual int GetRelatedSelectionLimit(); 01921 01926 virtual void SetDetailSelection(bool onoff); 01927 01929 virtual bool GetDetailSelectionMode(); 01930 01938 virtual void SmartFilterCircumcuboid(const char *segment, const char *defaults, HPoint *bottomfrontleft, HPoint *topbackright); 01939 01946 int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 01947 01949 virtual bool GetHasObjects() { return m_bHasObjects; } 01950 01954 virtual void SetHasObjects(bool hasobjects); 01955 01956 01960 virtual void SetHandleOperator(HBaseOperator *op) { m_pHandleOperator = op; } 01961 01965 virtual HBaseOperator *GetHandleOperator() { return m_pHandleOperator; } 01966 01970 virtual float GetDefaultSelectionProximity() { return m_DefaultSelectionProximity; } 01974 virtual void SetDefaultSelectionProximity(float selectionproximity); 01975 01978 bool GetAllowInteractiveShadows(){ 01979 return m_bAllowInteractiveShadows; 01980 } 01981 01987 void SetAllowInteractiveShadows(bool onoff) { 01988 m_bAllowInteractiveShadows = onoff; 01989 } 01990 01993 HShadowRenderingMode GetShadowRenderingMode(); 01994 01999 void SetShadowRenderingMode(HShadowRenderingMode mode); 02000 02003 bool GetAllowInteractiveCutGeometry() { return m_bAllowInteractiveCutGeometry; } 02004 02009 void SetAllowInteractiveCutGeometry(bool onoff){ 02010 m_bAllowInteractiveCutGeometry = onoff; 02011 } 02012 02015 HCutGeometryVisibility GetCutGeometryVisibility(); 02016 02020 void SetCutGeometryVisibility(HCutGeometryVisibility visibility); 02021 02022 02025 void * GetWindowHandle() { return m_pWindowHandle; } 02026 02030 bool GetInitialCameraSet() { return m_bInitialCameraSet; } 02031 02032 02033 02040 int ObjectMovedEvent(HBaseView *view, HC_KEY key, HPoint *pos); 02041 02045 void SetRecordCamera(bool rc); 02046 02048 bool GetRecordMode() { return m_bRecordCamera; } 02049 02053 void InjectEvent(HEventInfo const & hevent); 02054 02055 02060 void SetForceFastHiddenLine(bool force) { m_bForceFastHiddenLine = force; } 02061 02063 bool GetForceFastHiddenLine() { return m_bForceFastHiddenLine; } 02064 02070 void SetTransparency(char const * text, bool fast_z_sort=false); 02071 02076 void SetLineAntialiasing( bool onoff ); 02077 02079 bool GetLineAntialiasing() { return m_bLineAntialiasing; } 02080 02084 void SetTextAntialiasing( bool onoff ); 02085 02090 void SetDepthOfField(bool onoff, float strength = 1.0f); 02091 02096 void SetDepthOfFieldRange(float near=0.0f, float far=0.0f); 02097 02099 bool GetTextAntialiasing() { return m_bTextAntialiasing; } 02100 02104 void SetIsoDefault(ViewMode vm) { m_IsoDefault = vm; }\ 02105 02107 ViewMode GetIsoDefault() { return m_IsoDefault; } 02108 02115 void SetCullingThreshold(int cullingthreshold); 02116 02120 int GetCullingThreshold(); 02121 02128 void SetHardExtent(int cutoff); 02129 02133 int GetHardExtent(); 02134 02139 void BeginShellSelection(); 02140 02143 void EndShellSelection(); 02144 02146 HSelectionSet * GetHighlightSelection() { return m_pHighlight; } 02147 02154 void SetViewAxis(HVector *front_axis, HVector *top_axis) { m_FrontAxis = front_axis; m_TopAxis = top_axis; } 02159 void GetViewAxis(HVector *front_axis, HVector *top_axis) { *front_axis = m_FrontAxis; *top_axis = m_TopAxis; } 02160 02164 void SetDefaultHSRA(); 02165 02166 02170 void SetMaximumUpdateTime(float mut) { m_MaximumUpdateTime = mut; } 02171 02175 float GetMaximumUpdateTime() { return m_MaximumUpdateTime; } 02176 02180 virtual const HSelectionHighlightMode GetHighlightMode() { return m_HighlightMode; } 02181 02186 virtual void SetHighlightMode(HSelectionHighlightMode m); 02187 02191 virtual void SetReferenceSelection(bool use_ref); 02192 02199 bool GetKeyState(unsigned int key, int &flags); 02200 02202 void ResetKeyState(); 02203 02207 void SetFastFitWorld(bool fw) { m_bFastFitWorld = fw; } 02208 02214 void GetSceneExtents(HPoint &min, HPoint &max); 02215 02219 void SetLightScaling(float sv); 02220 02221 void SetXYSizeOverride(int x,int y) { m_XSize_override = x, m_YSize_override = y; } 02222 02223 02225 int GetXSize() {return m_XSize;} 02226 02228 int GetYSize() {return m_YSize;} 02229 02231 HViewSelectionLevel GetViewSelectionLevel(); 02232 02241 void SetViewSelectionLevel(HViewSelectionLevel level); 02242 02251 void EnableTargetFrameRate(bool enable=true, int target=100, int threshold=10, int steps=5); 02252 02257 float GetFramerate(); 02258 02260 FramerateMode GetFramerateMode(); 02261 02263 int GetFramerateCullingThreshold(); 02264 02269 int GetFramerateSteps(); 02270 02272 bool IsFramerateLodEnabled(); 02273 02287 void SetFramerateMode(FramerateMode mode, float framerate = 0.1f, int cullingthreshold = 150, 02288 bool enableLods = false, int steps = 20, int cutoff = 1); 02289 02291 bool IsFrameRateEnabled(); 02292 02294 bool GetViewActive(); 02295 02297 void cleanupSimpList(); 02298 02302 void SetAnnotationResize(bool value); 02303 02305 bool GetAnnotationResize() { return m_AnnotationCookie==0?false:true; } 02306 02308 bool GetFirstUpdate() { return m_bFirstUpdate; } 02309 02311 void SetDisplayHandlesOnDblClk(bool dh) { m_bDisplayHandlesOnDblClk = dh; } 02312 02314 bool HasInitialView() { return m_has_initial_view; } 02315 02317 void HasInitialView(bool does_it) { m_has_initial_view=does_it; } 02318 02320 void ExhaustiveUpdate(); 02321 02323 bool GetUpdateNotFinished() { return m_bUpdateNotFinished; } 02324 02326 void SetUpdateNotFinished(bool NotFinished) { m_bUpdateNotFinished = NotFinished; } 02327 02328 /* This method sets the mousewheel sensitivity which is used to control the apparent sensitivity of the mousewheel for MVO operators. 02329 \param sensitivity value is strictly positive float. */ 02330 void SetMouseWheelSensitivity(float sensitivity) { 02331 if (sensitivity > 0) 02332 m_MouseWheelSensitivity = sensitivity; 02333 } 02334 /* Use this in an operator to modify the return value of HEventInfo::GetMouseWheelDelta() 02335 \return value of the operator mousewheel sensitivity, a strictly positive value. */ 02336 float GetMouseWheelSensitivity() { return m_MouseWheelSensitivity; } 02337 02339 void SetSplatRendering(bool onoff); 02340 02342 bool GetSplatRendering() { return m_bSplatRendering; }; 02343 02345 void SetSplatSize(int splat_size); 02346 02348 int GetSplatSize() { return m_SplatSize; }; 02349 02351 void SetSplatSymbol(SplatSymbol symbol); 02352 02354 SplatSymbol GetSplatSymbol() {return m_SplatSymbol;}; 02355 02356 02360 void UpdateFakeHLRColor(HPoint paper_color); 02361 02363 void SetHardwareAntialiasing(int antialiasinglevel) { m_HardwareAntialiasing = antialiasinglevel; } 02364 02366 int GetHardwareAntialiasing() { return m_HardwareAntialiasing; } 02367 02371 static void StaticForceUpdateRequest(void * view_pointer); 02372 02373 /* 02374 This method can be used to visualize the internal bounding stored on segments 02375 and some types of geometry. The bounding is drawn outside of the model so it does not 02376 interfere with static trees. It is semi-transparent with a color that indicates the 02377 bounding density: blue is very dense, red is sparse, green is somewhere in between. 02378 \param draw_something If this value is false, any existing bounding geometry will simply 02379 be discarded. If it is true, a new bounding geometry will also be generated. 02380 \param key The key of the segment or geometry whose bounding should be visualized. 02381 \param incl_count The number of keys in the incl_path array. 02382 \param incl_path This array of keys should be structured for a PShow. That is, the leaf 02383 as the first entry followed by a series of include keys mapping a path to the view. 02384 */ 02385 void VisualizeBounding(bool draw_something, HC_KEY key=INVALID_KEY, int incl_count=0, HC_KEY * incl_path=0); 02386 02387 02388 /* 02389 Retrieves the color set by an earlier call to SetFakeHLRColor. 02390 \return the color as an rgb triplet with values from 0.0 to 1.0. 02391 */ 02392 HPoint GetFakeHLRColor(); 02393 02394 /* 02395 Sets the color to be used in fake hidden-line render mode. 02396 \param color An rgb triplet with values from 0.0 to 1.0. 02397 */ 02398 void SetFakeHLRColor(HPoint color); 02399 02400 /* 02401 Orients the camera to point at selected geometry and sets depth-of-field to keep it in focus. 02402 \param onoff passing true will focus on the selected geometry, passing false will remove an earlier depth-of-field setting. 02403 */ 02404 void FocusOnSelection(bool onoff = true); 02405 02406 /* 02407 \return true if the view is currently focused on a selection via a previous call to FocusOnSelection(), false otherwise. 02408 */ 02409 bool GetFocusOnSelection() { return m_FocusedOnSelection; } 02410 02412 HTouchManager *GetTouchManager() { return m_TouchManager; } 02413 02414 protected: 02415 HC_KEY m_FakeHLRStyle; 02416 HC_KEY m_FakeHLRSource; 02417 bool m_bCPLineVisibility; 02418 bool m_bCPFaceVisibility; 02419 int m_CPMode; 02420 bool m_bCuttingPlanesExist; 02421 bool m_bCuttingPlanesVisibility; 02422 bool m_bSpritingAllowed; 02423 bool m_bAxisTriadTransparencyAllowed; 02424 int m_AxisWindowSize; 02426 bool m_bForceFastHiddenLine; 02427 bool m_bLineAntialiasing; 02428 bool m_bTextAntialiasing; 02429 bool m_bBeginShellSelection; 02430 bool m_bDisplayHandlesOnDblClk; 02431 bool m_has_initial_view; 02432 HTouchManager *m_TouchManager; 02434 int m_HardwareAntialiasing; 02435 ViewMode m_IsoDefault; 02436 HSelectionHighlightMode m_HighlightMode; 02437 DisplayListType m_DisplayListType; 02441 bool m_bGeometryChanged; 02442 HPoint m_SceneBoundingMin; 02443 HPoint m_SceneBoundingMax; 02444 bool m_bSceneBoundingSet; 02445 bool m_bFastFitWorld; 02446 HImCuttingGeometry * m_pHImCuttingGeometry; 02447 HUtilityAntialiasing * m_pAntialiasing; 02448 HMarkupManager * m_pMarkupManager; 02449 AxisMode m_bAxisMode; 02450 bool m_bHideOverlappedText; 02451 bool m_bNavCube; 02452 bool m_bSmoothTransition; 02453 float m_SmoothTransitionDuration; 02454 bool m_bLightFollowsCamera; 02455 int m_WindowColorPercentage; 02456 HVector m_FrontAxis; 02457 HVector m_TopAxis; 02459 HBaseModel* m_pModel; 02460 HC_KEY m_ViewKey; 02462 HC_KEY m_SceneKey; 02464 HC_KEY m_OverwriteKey; 02466 HC_KEY m_BBoxGeometryKey; 02468 HC_KEY m_WindowspaceKey; 02470 HC_KEY m_ConstructionKey; 02472 HC_KEY m_CuttingPlanesKey; 02474 HC_KEY m_CuttingPlaneGeomKey; 02476 HC_KEY m_IntersectPolylinesKey; 02478 HC_KEY m_AxisTriadKey; 02480 HC_KEY m_ProgressBarKey; 02481 02482 02483 HC_KEY m_InfoTextKey; 02484 02486 HC_KEY m_lIncludeLinkKey; 02487 HC_KEY m_LightsKey; 02488 HC_KEY m_SceneLight[MaxLights]; 02489 HRenderMode m_RenderMode; 02490 ViewMode m_ViewMode; 02491 HBaseOperator* m_pOperator; 02492 HEventInfo* m_pEvent; 02493 HSelectionSet* m_pSelection; 02494 HSelectionSet* m_pHighlight; 02495 HConstantFrameRate *m_pConstantFrameRate; 02496 HShadowMode m_ShadowMode; 02497 HSharedKey * m_pSharedKey; 02498 int m_UpdateInterrupted; 02499 int m_InUpdateInternal; 02500 void (* m_pfEventChecker)(HIC_Rendition const *nr); 02501 bool (* m_pfKeyState)(unsigned int, int &); 02502 ViewUpdateMode m_ViewUpdateMode; 02503 bool m_bUpdateRequested; 02504 HEventManager * m_pEventManager; 02505 HUndoManager * m_pUndoManager; 02506 HObjectManager *m_pObjectManager; 02507 class HDebugZBuffer *m_pDebugZBuffer; 02508 bool m_bLButtonDown; 02509 bool m_bMouseMove; 02510 HOpCameraManipulate *m_pManipulateOperator; 02511 bool m_bShadowRegeneration; 02512 bool m_bShadowRegenerationToggle; 02513 bool m_bCuttingPlaneRegeneration; 02514 bool m_bCameraChanged; 02515 float m_IdleTime; 02516 bool m_bFirstUpdate; 02517 HBaseOperator * m_pHandleOperator; 02518 bool m_bAllowInteractiveShadows; 02519 bool m_bAllowInteractiveCutGeometry; 02520 float m_DefaultSelectionProximity; 02521 float m_MaximumUpdateTime; 02522 HCamera m_InitialCamera; 02523 bool m_bInitialCameraSet; 02524 bool m_bRecordCamera; 02525 bool m_bTransparentSelectionBox; 02526 bool m_bInvertMouseWheelZoom; 02527 unsigned long m_AnnotationCookie; 02528 unsigned long m_AxisResizeCookie; 02529 FramerateMode m_FramerateMode; 02530 bool m_bSplatRendering; 02531 int m_SplatSize; 02532 SplatSymbol m_SplatSymbol; 02533 bool m_FocusedOnSelection; 02534 02541 void ComputeShadowParams(HPlane& shadow_plane, HPoint& light_pos); 02542 02548 void AdjustShadowPlane(HPlane& shadow_plane, HPoint const & light_pos); 02549 02555 void SetShadowParams(const HPlane& shadow_plane, const HPoint& light_pos, 02556 const HPoint* color = 0, const char * filter = 0); 02557 02564 virtual void SetShadowParams(HShadow* shadowObj); 02565 02568 void RefreshViewSize(); 02569 02575 void QueryDeviceCapabilities(); 02576 02585 virtual void UpdateInternal(bool antialias = false, bool force_update = false); 02586 02587 02592 virtual void SetupLights(); 02593 02594 private: 02595 float m_LastRecordTime; 02597 char * m_sDriverPath; // fully rooted pathname of driver instance 02598 char * m_sDriverType; // driver type; e.g. msw, opengl, x11 02599 char * m_sAlias; 02600 void * m_pWindowHandle; 02601 void * m_pColormap; 02602 void * m_pClipOverride; 02603 void * m_pWindowHandle2; 02604 struct vlist_s *m_SignalRequestsList; 02605 HBaseViewEmitMessageFunction emit_message_function; 02606 void * emit_message_function_user_data; 02607 HTClient * m_pUpdateTimerClient; 02608 bool m_bPrevBackplaneCullMode; // this caches backplane cull mode (which is switched off when capping planes are turned off with cutting planes on ) 02609 bool m_bHasObjects; 02610 float m_fZoomLimit; 02611 int m_SuppressUpdate; 02612 int m_SuppressUpdateTick; 02613 bool m_bDynamicHighlighting; 02614 int m_XSize; 02615 int m_YSize; 02616 int m_XSize_override; 02617 int m_YSize_override; 02618 float m_LastMouseWheelTime; 02619 float m_MouseWheelSensitivity; 02620 bool m_KeyMap[256]; 02621 int m_KeyFlags; 02622 bool m_bOwnDriver; 02623 bool m_bUpdateNotFinished; 02624 int m_NotFinishedCounter; 02625 HPoint m_FakeHLRColor; 02626 HConstFRSimpType **SimpList; 02627 int simpListLength; 02628 int m_OldCullingThreshold; 02629 float *m_pTempClipArray; 02630 ViewUpdateMode m_OldViewUpdateMode; 02631 bool m_UseExplicitShadowLight; 02632 HPoint m_ExplicitShadowLightDirection; 02633 int m_LightCount; 02634 02635 //no default constructor 02636 HBaseView() {;}; 02637 02638 //obsolete 02639 HBaseView(HBaseModel *model, char * alias, char * driver_type,char * instance_name, long window_handle, long colormap) {;}; 02640 02641 //obsolete 02642 void RebindView(HBaseModel *model, char * alias, char * driver_type,char * instance_name, long window_handle, long colormap) {;}; 02643 02644 }; 02645 02646 02647 #ifdef H_PACK_8 02648 #pragma pack(pop) 02649 #endif 02650 02651 #endif