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 00013 #ifndef _HBASEVIEW_H 00014 #define _HBASEVIEW_H 00015 00016 #ifdef H_PACK_8 00017 #pragma pack(push) 00018 #pragma pack(8) 00019 #endif 00020 00021 #include "HTools.h" 00022 #include "HTManager.h" 00023 #include "HEventListener.h" 00024 00025 class HDB; 00026 class HBaseModel; 00027 class HCamera; 00028 class HEventInfo; 00029 class HSelectionSet; 00030 class HBaseOperator; 00031 class HConstantFrameRate; 00032 class HSharedKey; 00033 class HImCuttingGeometry; 00034 class HOutputHandler; 00035 class HOutputHandlerOptions; 00036 class HInputHandler; 00037 class HInputHandlerOptions; 00038 class HUtilityAntialiasing; 00039 class HMarkupManager; 00040 class HShadow; 00041 class HUndoManager; 00042 class HEventManager; 00043 class HObjectManager; 00044 class HOpCameraManipulate; 00045 class HDebugZBuffer; 00046 class HConstFRSimpType; 00047 00048 00054 typedef bool(*HSignalNotifyFunction)(int signal, void *signal_data, void *user_data); 00055 00056 00057 00061 enum HRenderMode 00062 { 00063 HRenderWireframe = 1, 00064 HRenderTriangulation = 2, 00065 HRenderSilhouette = 3, 00066 HRenderHiddenLine = 4, 00067 HRenderHiddenLineHOOPS = 5, 00068 HRenderHiddenLineFast = 6, 00069 HRenderFlat = 7, 00070 HRenderGouraud = 8, 00071 HRenderGouraudWithEdges = 9, 00072 HRenderPhong = 10, 00073 HRenderShaded = 11, 00074 HRenderShadedWithLines = 12, 00075 HRenderWireframeWithSilhouette = 13, 00076 HRenderShadedWireframe = 14, 00077 HRenderVertices = 15, 00078 HRenderShadedVertices = 16, 00079 HRenderGouraudWithLines = 17, 00080 HRenderLOD1 = 18, 00081 HRenderLOD2 = 19, 00082 HRenderBRepHiddenLine = 20, 00083 HRenderBRepHiddenLineFast = 21, 00084 HRenderBRepWireframe = 22, 00085 HRenderGoochShaded = 23, 00086 HRenderFakeHiddenLine = 24, 00087 HRenderUnknown = 0 00088 }; 00089 00093 enum ViewMode 00094 { 00095 HViewNone, 00096 HViewXY, 00097 HViewYX, 00098 HViewXZ, 00099 HViewZX, 00100 HViewYZ, 00101 HViewZY, 00102 HViewIso, 00103 HViewIsoFrontRightTop, 00104 HViewIsoBackRightTop, 00105 HViewIsoBackLeftTop, 00106 HViewIsoBackLeftBottom, 00107 HViewIsoBackRightBottom, 00108 HViewIsoFrontLeftTop, 00109 HViewIsoFrontLeftBottom, 00110 HViewIsoFrontRightBottom, 00111 00112 HViewSEIso, 00113 HViewSWIso, 00114 HViewNEIso, 00115 HViewNWIso, 00116 00117 HViewFront, 00118 HViewBack, 00119 HViewRight, 00120 HViewLeft, 00121 HViewTop, 00122 HViewBottom, 00123 00124 HViewUnknown 00125 }; 00126 00127 00131 enum LightingIntMode 00132 { 00133 LightingIntUnknown, 00134 LightingIntGouraud, 00135 LightingIntPhong 00136 }; 00137 00138 00147 enum FramerateMode 00148 { 00149 FramerateOff, 00150 FramerateFixed, 00151 FramerateTarget 00152 }; 00159 enum ProjMode 00160 { 00161 ProjUnknown, 00162 ProjPerspective, 00163 ProjOrthographic, 00164 ProjStretched 00165 }; 00166 00167 00168 00172 enum HandednessMode 00173 { 00174 HandednessLeft, 00175 HandednessRight, 00176 HandednessNone 00177 }; 00178 00179 00183 enum DisplayListType 00184 { 00185 DisplayListOff, 00186 DisplayListGeometry, 00187 DisplayListSegment 00188 }; 00189 00193 enum MultiThreadingType 00194 { 00195 MultiThreadingOff, 00196 MultiThreadingBasic, 00197 MultiThreadingFull 00198 }; 00199 00203 enum HLRMode 00204 { 00205 AnalyticHiddenLine, 00206 FastHiddenLine, 00207 FakeHiddenLine 00208 }; 00209 00210 00212 enum AxisMode 00213 { 00214 AxisOff, 00215 AxisSimple, 00216 AxisCenter, 00217 AxisOn 00218 }; 00219 00221 enum UpDirection 00222 { 00223 UpDirectionX = 0xFADE, 00224 UpDirectionY, 00225 UpDirectionZ 00226 }; 00227 00228 00232 enum ViewUpdateMode 00233 { 00234 OnDemand, 00235 Continuous, 00236 Deferred 00237 }; 00238 00239 00241 enum HShadowRenderingMode 00242 { 00243 SoftwareShadow, 00244 HardwareShadow, 00245 SoftwareOpenglShadow 00246 }; 00247 00249 enum HBloomShape 00250 { 00251 RadialBloom, 00252 StarBloom 00253 }; 00254 00256 enum HQuickMovesMethod 00257 { 00258 HQuickMoves_None, 00259 HQuickMoves_XOR, 00260 HQuickMoves_Overlay, 00261 HQuickMoves_Spriting 00262 }; 00263 00264 00271 enum HViewSelectionLevel 00272 { 00273 HSelectionLevelEntity, 00274 HSelectionLevelSegment, 00275 HSelectionLevelSegmentTree 00276 }; 00282 enum SplatSymbol 00283 { 00284 SplatRound, 00285 SplatSquare 00286 }; 00287 00288 00289 00296 typedef void(*HBaseViewEmitMessageFunction)(const char* message, unsigned int length, void * user_data); 00297 00298 00300 00332 class MVO_API HBaseView : public HUpdateListener , public HMouseListener, public HObjectManipulationListener 00333 { 00334 00335 public: 00336 00337 00367 HBaseView(HBaseModel *model, 00368 const char * alias = 0, 00369 const char * driver_type = 0, 00370 const char * instance_name = 0, 00371 void * window_handle = 0, 00372 void * colormap = 0, 00373 void * clip_override = 0, 00374 void * window_handle_2 = 0, 00375 const char * driver_path = 0); 00376 00404 void RebindView( 00405 const char * alias = 0, 00406 const char * driver_type = 0, 00407 const char * instance_name = 0, 00408 void * window_handle = 0, 00409 void * colormap = 0, 00410 void * clip_override = 0, 00411 void * window_handle_2 = 0, 00412 int debug_flags = 0 00413 ); 00414 00419 virtual ~HBaseView(); 00420 00425 virtual void Init(); 00426 00432 virtual void FitWorld(HPoint * center_out = 0); 00433 00441 virtual void FitWorldExact(HPoint * center_out = 0); 00442 00447 virtual void ZoomToExtents(); 00448 00452 virtual void ZoomToInitialCamera(); 00453 00454 00459 void FitSegment(HC_KEY seg_key); 00460 00465 void FitSelection(HC_KEY key = INVALID_KEY, bool adjustToShellNormal = false); 00466 00470 void FitItemByPath(HC_KEY key, int incl_count, HC_KEY * incl_path); 00471 00473 void RenderAntialiasing(); 00474 00476 void InitAntialiasing(); 00477 00479 HUtilityAntialiasing * GetAntialiasing() { return m_pAntialiasing; } 00480 00482 HMarkupManager * GetMarkupManager(); 00483 00485 bool HaveMarkupManager() {return (m_pMarkupManager != 0);} 00486 00490 void SetMarkupManager( HMarkupManager* markup ) { m_pMarkupManager = markup; } 00491 00493 void RenderWireframe(); 00494 00497 void RenderSilhouette(); 00498 00500 void RenderHiddenLine(); 00501 00503 void RenderHiddenLineFast(); 00504 00506 void RenderFlat(); 00507 00509 void RenderGooch(); 00510 00512 void RenderGouraud(); 00513 00515 void RenderPhong(); 00516 00518 void RenderWireframeWithSilhouette(); 00519 00521 void RenderShadedWireframe(); 00522 00524 void RenderVertices(); 00525 00527 void RenderShadedVertices(); 00528 00532 void RenderFakeHiddenLine(); 00533 00536 void RenderBRepHiddenLine(); 00537 00540 void RenderBRepHiddenLineFast(); 00541 00543 void RenderBRepWireframe(); 00544 00549 void RenderShaded(); 00550 00552 void RenderShadedWithLines(); 00553 00555 void RenderGouraudWithLines(); 00556 00558 void RenderLOD1(); 00560 void RenderLOD2(); 00561 00562 00564 void RemoveTransforms(); 00565 00572 virtual void Update(); 00573 00579 virtual void ForceUpdate(); 00580 00592 virtual HFileInputResult FileInput(const __wchar_t * FileName, HInputHandler * handler, HInputHandlerOptions * options = 0); 00593 00605 virtual HFileInputResult FileInput(const char * FileName, HInputHandler * handler, HInputHandlerOptions * options = 0){ 00606 return FileInput((__wchar_t*)H_WCS(FileName).encodedText(), handler, options); 00607 } 00608 00620 #ifdef H_USHORT_OVERLOAD 00621 virtual HFileInputResult FileInput(const unsigned short * FileName, HInputHandler * handler, HInputHandlerOptions * options = 0){ 00622 H_UTF16 utf16; 00623 utf16.encodedText((utf16_char*)FileName); 00624 return FileInput((__wchar_t*)H_WCS(utf16).encodedText(), handler, options); 00625 } 00626 #endif 00627 00653 virtual HFileOutputResult FileOutput(const __wchar_t * FileName, HOutputHandler * handler, HOutputHandlerOptions * options = 0); 00654 00680 virtual HFileOutputResult FileOutput(const char * FileName, HOutputHandler * handler, HOutputHandlerOptions * options = 0){ 00681 return FileOutput((__wchar_t*)H_WCS(FileName).encodedText(), handler, options); 00682 } 00683 00684 // accessors 00685 00687 const char* GetDriverPath() { return m_sDriverPath; } 00688 00690 const char* GetDriverType() { return m_sDriverType; } 00691 00693 virtual void UpdateHighlighting(); 00694 00696 HSelectionSet* GetSelection() { return m_pSelection; } 00697 00701 void SetSelection(HSelectionSet* selection) { m_pSelection = selection; } 00702 00704 virtual HBaseModel * GetModel() { return m_pModel; } 00705 00708 HC_KEY GetModelKey(); 00709 00711 HRenderMode GetRenderMode () { return m_RenderMode; } 00712 00714 ViewMode GetViewMode () { return m_ViewMode; } 00715 00722 virtual void SetViewMode (ViewMode mode, bool invert = false, bool fitWorld = true); 00723 00725 bool GetCPLineVisibility() {return m_bCPLineVisibility; } 00726 00728 bool GetCPFaceVisibility() {return m_bCPFaceVisibility; } 00729 00737 void SetCPGeomVisibility(bool lines, bool faces=false); 00738 00739 00745 bool GetCuttingPlanesExist(const char *plane = 0); 00746 00750 void SetCuttingPlanesExist(bool state); 00751 00753 bool GetCuttingPlanesVisibility() {return m_bCuttingPlanesVisibility; } 00754 00758 void SetCuttingPlanesVisibility(bool visible); 00759 00761 HConstantFrameRate* GetConstantFrameRateObject() { return m_pConstantFrameRate; } 00762 00766 void SetConstantFrameRateObject(HConstantFrameRate* cf) { m_pConstantFrameRate = cf; } 00767 00769 void SetEventCheckerCallback(void (* EventChecker)(HIC_Rendition const *nr)); 00770 00772 void SetKeyStateCallback(bool (* KeyState)(unsigned int, int &)) { m_pfKeyState = KeyState; } 00773 00775 bool (*GetKeyStateCallback())(unsigned int, int &) { return m_pfKeyState; } 00776 00778 void (*GetEventCheckerCallback())(HIC_Rendition const *nr) { return m_pfEventChecker; } 00779 00780 00788 void SetOcclusionCullingMode(bool mode, bool UseOctree = true, int threshold = 50); 00789 00790 00793 HandednessMode GetHandedness(); 00794 00806 virtual void SetHandedness(HandednessMode mode, bool emit_message=false); 00807 00812 virtual void SetHandednessFromMessage(const char *in_data, unsigned int data_length); 00813 00820 virtual void SetFontSize(const char *font_size, bool emit_message=false); 00821 00826 virtual void SetFontSizeFromMessage(const char *in_data, unsigned int data_length); 00827 00829 bool GetBackplaneCulling(); 00830 00837 void SetBackplaneCulling(bool cull); 00838 00842 ProjMode GetProjMode(); 00843 00847 void SetProjMode(ProjMode mode); 00848 00850 DisplayListType GetDisplayListType(); 00851 00855 void SetDisplayListType(DisplayListType type); 00856 00858 bool GetDisplayListMode(); 00859 00863 void SetDisplayListMode(bool mode); 00864 00866 HandednessMode GetPolygonHandednessMode(); 00867 00879 void SetPolygonHandednessMode(HandednessMode); 00880 00883 bool GetLodMode(); 00884 00891 void SetLodMode(bool onoff); 00892 00894 bool GetSpritingMode() { return m_bSpritingAllowed; } 00895 00901 void SetSpritingMode(bool onoff) { m_bSpritingAllowed = onoff; } 00902 00906 int GetLodThreshold(); 00907 00912 void SetLodThreshold(int val); 00913 00915 HC_KEY GetViewKey() { return m_ViewKey; } 00917 void SetViewKey( HC_KEY view_key ) { m_ViewKey = view_key; } 00918 00920 HC_KEY GetIncludeLinkKey() { return m_lIncludeLinkKey; } 00922 void SetIncludeLinkKey( HC_KEY link ) { m_lIncludeLinkKey = link; } 00923 00925 HC_KEY GetSceneKey() { return m_SceneKey; } 00926 00930 void SetSceneKey( HC_KEY scene_key ) { m_SceneKey = scene_key; } 00931 00933 HC_KEY GetOverwriteKey() { return m_OverwriteKey; } 00934 00936 HC_KEY GetShadowMapSegmentKey() { return HC_KShow_Owner_By_Key (m_lIncludeLinkKey); } 00937 00939 HC_KEY GetLightsKey() { return m_LightsKey; } 00940 00944 void SetLightsKey( HC_KEY lights_key ) { m_LightsKey = lights_key; } 00945 00947 float GetZoomLimit() { return m_fZoomLimit; } 00948 00952 void SetZoomLimit( float zoomLimit ) { m_fZoomLimit = zoomLimit; } 00953 00955 virtual void SetZoomLimit(); 00956 00958 HC_KEY GetWindowspaceKey() { return m_WindowspaceKey; } 00959 00963 void SetWindowspaceKey( HC_KEY winspace_key ) { m_WindowspaceKey = winspace_key; } 00964 00966 HC_KEY GetConstructionKey() { return m_ConstructionKey; } 00967 00971 void SetConstructionKey( HC_KEY construct_key ) { m_ConstructionKey = construct_key; } 00972 00974 HC_KEY GetBBoxGeometryKey() { return m_BBoxGeometryKey; } 00976 void SetBBoxGeometryKey( HC_KEY bbox_key ) { m_BBoxGeometryKey = bbox_key; } 00977 00979 HC_KEY GetCuttingPlanesKey() { return m_CuttingPlanesKey; } 00980 00984 void SetCuttingPlanesKey( HC_KEY cuttingplanes_key ) { m_CuttingPlanesKey = cuttingplanes_key; } 00985 00987 HC_KEY GetCuttingPlaneGeomKey() { return m_CuttingPlaneGeomKey; } 00988 00992 void SetCuttingPlaneGeomKey( HC_KEY cuttingplanegeom_key ) { m_CuttingPlaneGeomKey = cuttingplanegeom_key; } 00994 HC_KEY GetIntersectPolylinesKey() { return m_IntersectPolylinesKey; } 00995 00999 void SetIntersectPolylinesKey( HC_KEY intersectpolylines_key ) { m_IntersectPolylinesKey = intersectpolylines_key; } 01000 01002 HC_KEY GetProgressBarKey() { return m_ProgressBarKey; } 01007 void SetProgressBarKey( HC_KEY key ) { m_ProgressBarKey = key; } 01008 01009 01011 int GetUpdateInterrupted() { return m_UpdateInterrupted; } 01012 01016 void SetUpdateInterrupted( int val ) { m_UpdateInterrupted = val; } 01017 01019 float GetIdleTime(); 01020 01022 void ResetIdleTime(); 01023 01026 HQuickMovesMethod GetQuickMovesMethod () const; 01027 01029 class HDebugZBuffer *GetDebugZBuffer() { return m_pDebugZBuffer; } 01030 01033 void SetDebugZBuffer(HDebugZBuffer *dzb) { m_pDebugZBuffer = dzb; }; 01034 01036 AxisMode GetAxisMode() {return m_bAxisMode; } 01037 01042 virtual void SetAxisMode(AxisMode mode); 01043 01047 virtual void OnSetAxisMode( AxisMode mode ); 01048 01050 void UpdateAxisTriad() { SetAxisMode(GetAxisMode()); } 01051 01057 virtual void AdjustAxisWindow( int axis_window_pixels_in = -1, HIntRectangle *rect_in=0 ); 01058 01060 static void AdjustAxisWindowCallback(int signal, void * signal_data, void * user_data); 01061 01063 static void AdjustWindowCallback(int signal, void * signal_data, void * user_data); 01064 01066 HShadowMode GetShadowMode() {return m_ShadowMode; } 01067 01072 virtual void SetShadowMode (HShadowMode sm, bool saveMode = true); 01073 01085 virtual void SetReflectionPlane(bool state, float opacity=0.5f, bool fading=true, bool attenuate=false, 01086 float hither=0.0f, float yon=1.0f, bool blur=false, int blur_level=1); 01087 01089 HC_KEY GetDefaultLightKey(int which = 0) { return m_SceneLight[which]; } 01090 01091 01093 bool GetTransparentSelectionBoxMode() {return m_bTransparentSelectionBox; } 01094 01098 void SetTransparentSelectionBoxMode(bool mode) { m_bTransparentSelectionBox = mode; } 01099 01105 virtual void DeleteSelectionList(bool emit_message=false); 01106 01113 void RotateOnUpdate(const char *sname); 01114 01122 virtual void SetWindowColor(HPoint rgb, bool emit_message=false); 01123 01134 virtual void SetWindowColor(HPoint rgbtop, HPoint rgbbottom, bool emit_message=false); 01135 01147 virtual void SetWindowColorRange(HPoint rgbtop, HPoint rgbbottom, int percentage, bool emit_message=false); 01148 01149 01157 virtual void SetWindowMaterial(const char * name, bool emit_message=false); 01158 01164 virtual void SetWindowColorFromMessage(const char *in_data, unsigned int data_length); 01165 01169 void GetWindowColor(HPoint &color_out); 01170 01175 void GetWindowColor(HPoint &color_top, HPoint &color_bottom); 01176 01182 void GetWindowColor(HPoint &color_top, HPoint &color_bottom, int &percentage); 01183 01188 void GetWindowMaterial(char * out_material, char * out_pattern); 01189 01193 void SetOperator(HBaseOperator *NewOperator); 01194 01195 01197 void SetCurrentOperator(HBaseOperator *NewOperator) { SetOperator(NewOperator); } 01198 01202 HBaseOperator* GetOperator() { return m_pOperator; } 01203 01208 HBaseOperator* GetCurrentOperator() { return m_pOperator; } 01209 01210 01212 HC_KEY GetAxisTriadKey() {return m_AxisTriadKey;} 01213 01215 bool GetHideOverlappedText(){ return m_bHideOverlappedText;} 01216 01220 void SetHideOverlappedText(bool hide); 01221 01225 void SetNavCube(bool onoff) { m_bNavCube = onoff;} 01226 01228 bool GetSmoothTransition() { return m_bSmoothTransition;} 01229 01233 void SetSmoothTransition(bool onoff) { m_bSmoothTransition = onoff;} 01234 01238 void SetSmoothTransitionDuration(float duration) { m_SmoothTransitionDuration = duration;} 01239 01241 float GetSmoothTransitionDuration() { return m_SmoothTransitionDuration;} 01242 01244 bool IsLightFollowCamera(){return m_bLightFollowsCamera;} 01245 01249 void SetLightFollowsCamera(bool onoroff); 01250 01251 static const int MaxLights = 6; 01252 01256 void SetLightCount(int count); 01257 01261 int GetLightCount() { return m_LightCount; } 01262 01271 virtual void CameraPositionChanged(bool emit_message=false, bool smooth_camera_transition=false); 01272 01273 01277 virtual void PrepareForCameraChange(); 01278 01279 01289 virtual void SetCamera(HPoint pos, HPoint tar, HPoint up, float fieldx, float fieldy, const char *proj); 01290 01300 virtual void SetInitialCamera(HPoint pos, HPoint tar, HPoint up, float fieldx, float fieldy, char const * proj); 01301 01302 01312 virtual void GetCamera(HPoint *pos, HPoint *tar, HPoint *up, float &fieldx, float &fieldy, char *proj); 01313 01318 virtual void SetCamera(HCamera camera); 01319 01324 virtual void GetCamera(HCamera *camera); 01325 01331 virtual void SetCameraFromMessage(const char *data, unsigned int data_length); 01332 01340 virtual void InsertHSFData(const char *segment, const char *in_data, unsigned int data_length, bool emit_message=false); 01341 01347 virtual void InsertHSFDataFromMessage(const char *in_data, unsigned int data_length); 01348 01355 virtual void EmitHSFData(const char *segment, const char *in_data, unsigned int data_length); 01356 01362 virtual void SetRenderMode (HRenderMode NewRenderMode, bool emit_message=false); 01363 01369 virtual void SetRenderModeFromMessage(const char *in_data, unsigned int data_length); 01370 01374 virtual void EmitFlushMessage(); 01375 01383 virtual void FlushFromMessage(const char *in_data, unsigned int data_length); 01384 01385 01391 virtual void Flush(bool emit_message=false); 01392 01399 void SetEmitMessageFunction( 01400 HBaseViewEmitMessageFunction new_emit_message_function, 01401 void * user_data=0) { 01402 emit_message_function=new_emit_message_function; 01403 emit_message_function_user_data=user_data;}; 01404 01409 bool EmittingMessages() {return emit_message_function != 0;}; 01410 01414 HBaseViewEmitMessageFunction GetEmitMessageFunction() {return emit_message_function;}; 01415 01419 void * GetEmitMessageFunctionUserData() {return emit_message_function_user_data;}; 01420 01426 virtual void EmitSelectMessage(HC_KEY key, bool isSelect); 01427 01433 virtual void SelectFromMessage(const char *in_data, unsigned int data_length); 01434 01438 virtual void EmitDeSelectAllMessage(); 01439 01440 01444 virtual void EmitDeleteSelectionListMessage(); 01445 01446 01450 virtual void DeleteSelectionListFromMessage(); 01451 01452 01456 virtual void DeSelectAllFromMessage(); 01457 01458 01463 virtual void EmitSetModellingMatrixMessage(HC_KEY key); 01464 01465 01470 virtual void EmitSetModellingMatrixMessage(); 01471 01479 virtual void EmitSegment(HC_KEY key, bool emit_contents_only = false); 01480 01485 virtual void EmitDeleteByKeyMessage(HC_KEY key); 01486 01492 virtual void DeleteByKeyFromMessage(const char *in_data, unsigned int data_length); 01493 01499 virtual void SetModellingMatrixFromMessage(const char *in_data, unsigned int data_length); 01500 01504 HSharedKey * GetSharedKey() {return m_pSharedKey;}; 01505 01506 01510 virtual void StartSharedKey(); 01511 01512 01514 enum HAnimateMode { 01515 HAnimateScene = 0x00000001 01516 }; 01517 01518 01526 virtual void Animate (int animation_steps = 30, HAnimateMode animate_flags = HAnimateScene, int MaxRotation = 360); 01527 01530 virtual void SetGeometryChanged(); 01531 01535 bool GetSceneBoundingSet() { return m_bSceneBoundingSet; } 01536 01541 void SetSceneBounding(HPoint &min, HPoint &max); 01542 01544 void InvalidateSceneBounding() { m_bSceneBoundingSet = false; } 01545 01549 void SetFastMarkerDrawing(bool b_fast); 01550 01554 bool GetFastMarkerDrawing(); 01555 01561 void SetDoubleBuffering(bool double_buffer); 01562 01564 virtual void ClearGeometryChanged() {m_bGeometryChanged = false; }; 01565 01567 virtual bool GeometryChanged() {return m_bGeometryChanged;}; 01568 01574 unsigned long SetSignalNotify( int signal, HSignalNotifyFunction callback, void *user_data ); 01575 01578 void UnSetSignalNotify( unsigned long cookie ); 01579 01584 void SetColorInterpolation(bool onoff); 01585 01591 void SetColorIndexInterpolation(bool onoff, bool isolines = false); 01592 01598 bool GetColorIndexInterpolation(char * option = 0); 01599 01608 bool GetFrameBufferEffectsOptions(char * options = 0, int *border = 0); 01609 01615 void Notify(int signal, void * signal_data = 0); 01616 01623 int UpdateEvent(bool antialias = false, bool forceUpdate = false); 01627 bool GetUpdateRequested() { return m_bUpdateRequested; } 01631 void RequestUpdate() { m_bUpdateRequested = true; } 01635 void ClearUpdateRequest() { m_bUpdateRequested = false; } 01636 01642 void SetSuppressUpdate(bool suppress) { 01643 suppress?m_SuppressUpdate++:m_SuppressUpdate--; 01644 if (m_SuppressUpdate<0) 01645 m_SuppressUpdate = 0; 01646 } 01647 01652 bool GetSuppressUpdate() { return m_SuppressUpdate > 0; } 01653 01659 void SetSuppressUpdateTick(bool suppress) { 01660 suppress?m_SuppressUpdateTick++:m_SuppressUpdateTick--; 01661 if (m_SuppressUpdateTick<0) 01662 m_SuppressUpdateTick = 0; 01663 } 01664 01669 bool GetSuppressUpdateTick() { return m_SuppressUpdateTick > 0; } 01670 01686 void SetViewUpdateMode(ViewUpdateMode mode, float rate = 0.01f); 01687 01691 ViewUpdateMode GetViewUpdateMode() { return m_ViewUpdateMode; } 01692 01700 static bool UpdateTick(float request_time, float actual_time, void * user_data); 01701 01709 static bool StreamProgressCallback(unsigned long so_far, unsigned long expected, void * user_data); 01710 01712 void FlushProgressBar(); 01713 01715 HUndoManager *GetUndoManager(); 01716 01718 HEventManager *GetEventManager(); 01719 01721 HObjectManager *GetHObjectManager(); 01722 01724 bool GetDynamicHighlighting() { return m_bDynamicHighlighting; } 01725 01729 void SetDynamicHighlighting(bool state); 01730 01736 virtual int OnNoButtonDownAndMove(HEventInfo &hevent); 01737 01742 virtual int OnLButtonDownAndMove(HEventInfo &hevent); 01743 01749 virtual int OnLButtonDblClk(HEventInfo &hevent); 01750 01755 virtual int OnRButtonDownAndMove(HEventInfo &hevent); 01760 virtual int OnMButtonDownAndMove(HEventInfo &hevent); 01765 virtual int OnLRButtonDownAndMove(HEventInfo &hevent); 01766 01771 virtual int OnLButtonDown(HEventInfo &hevent); 01772 01777 virtual int OnMouseMove(HEventInfo &hevent); 01778 01784 virtual int OnLButtonUp(HEventInfo &hevent); 01785 01786 #if 0 01787 01791 virtual int OnMouseWheel(HEventInfo &hevent); 01792 #else 01793 01797 virtual int OnMouseWheel(HEventInfo &hevent); 01798 01801 virtual bool ComputeReasonableTarget(HPoint & new_tar, HPoint const & mouse_win, HPoint const & tar_orig); 01802 01803 /* This method adjusts the old field to the new target so the picture on the screen won't change. */ 01804 void ComputeNewField(float & width, float & height, HPoint const & new_tar, 01805 HCamera const & old_camera); 01806 #endif 01807 01809 virtual int OnKeyDown(HEventInfo &hevent); 01810 01812 virtual int OnKeyUp(HEventInfo &hevent); 01813 01816 virtual void SetShadowColor(HPoint color); 01817 01822 virtual void SetShadowLightDirection(bool explicit_light, HPoint const * direction = 0); 01823 01828 virtual bool GetShadowLightDirection(HPoint * direction = 0); 01829 01833 virtual void SetShadowIgnoresTransparency(bool ignore); 01834 01838 virtual bool GetShadowIgnoresTransparency(); 01839 01842 virtual void DoDynamicHighlighting(HPoint mouse_pos); 01843 01846 virtual void SetShadowResolution(int res); 01847 01850 virtual void SetShadowBlurring(int blur); 01851 01853 virtual void InternalUpdate(); 01854 01858 virtual void SetShadowRegenerationMode(bool onoff) { m_bShadowRegeneration = onoff; } 01859 01862 virtual void SetShadowRegenerationToggle() { m_bShadowRegenerationToggle = true; m_bShadowRegeneration = false; } 01863 01866 bool GetCuttingPlaneRegenerationMode() { return m_bCuttingPlaneRegeneration; } 01867 01872 virtual void SetCuttingPlaneRegenerationMode(bool onoff) { m_bCuttingPlaneRegeneration = onoff; } 01873 01877 bool GetShadowRegenerationMode() { return m_bShadowRegeneration; } 01878 01882 virtual void SetCameraChanged( bool val=true ) { m_bCameraChanged = val; if(val) ResetIdleTime(); } 01883 01885 virtual bool GetCameraChanged() { return m_bCameraChanged; } 01886 01890 virtual void SetInvertMouseWheelZoom( bool val=true ) { m_bInvertMouseWheelZoom = val;} 01891 01893 virtual bool GetInvertMouseWheelZoom() { return m_bInvertMouseWheelZoom; } 01894 01895 01899 virtual void SetAxisManipulateOperator(HOpCameraManipulate *op); 01900 01905 virtual void SetVisibilitySelectionMode(bool onoff); 01906 01908 virtual bool GetVisibilitySelectionMode(); 01909 01912 virtual void SetRelatedSelectionLimit(int limit); 01913 01915 virtual int GetRelatedSelectionLimit(); 01916 01921 virtual void SetDetailSelection(bool onoff); 01922 01924 virtual bool GetDetailSelectionMode(); 01925 01929 virtual void SetRespectSelectionCulling(bool onoff); 01931 virtual bool GetRespectSelectionCulling(); 01932 01940 virtual void SmartFilterCircumcuboid(const char *segment, const char *defaults, HPoint *bottomfrontleft, HPoint *topbackright); 01941 01948 int SetupHandlesEvent(HBaseView *view, HC_KEY key, bool complex); 01949 01951 virtual bool GetHasObjects() { return m_bHasObjects; } 01952 01956 virtual void SetHasObjects(bool hasobjects); 01957 01958 01962 virtual void SetHandleOperator(HBaseOperator *op) { m_pHandleOperator = op; } 01963 01967 virtual HBaseOperator *GetHandleOperator() { return m_pHandleOperator; } 01968 01972 virtual float GetDefaultSelectionProximity() { return m_DefaultSelectionProximity; } 01976 virtual void SetDefaultSelectionProximity(float selectionproximity); 01977 01980 bool GetAllowInteractiveShadows(){ 01981 return m_bAllowInteractiveShadows; 01982 } 01983 01989 void SetAllowInteractiveShadows(bool onoff) { 01990 m_bAllowInteractiveShadows = onoff; 01991 } 01992 01995 HShadowRenderingMode GetShadowRenderingMode(); 01996 02001 void SetShadowRenderingMode(HShadowRenderingMode mode); 02002 02005 bool GetAllowInteractiveCutGeometry() { return m_bAllowInteractiveCutGeometry; } 02006 02011 void SetAllowInteractiveCutGeometry(bool onoff){ 02012 m_bAllowInteractiveCutGeometry = onoff; 02013 } 02014 02017 HCutGeometryVisibility GetCutGeometryVisibility(); 02018 02022 void SetCutGeometryVisibility(HCutGeometryVisibility visibility); 02023 02024 02027 void * GetWindowHandle() { return m_pWindowHandle; } 02028 02032 bool GetInitialCameraSet() { return m_bInitialCameraSet; } 02033 02034 02035 02042 int ObjectMovedEvent(HBaseView *view, HC_KEY key, HPoint *pos); 02043 02047 void SetRecordCamera(bool rc); 02048 02050 bool GetRecordMode() { return m_bRecordCamera; } 02051 02055 void InjectEvent(HEventInfo const & hevent); 02056 02057 02062 void SetForceFastHiddenLine(bool force) { m_bForceFastHiddenLine = force; } 02063 02065 bool GetForceFastHiddenLine() { return m_bForceFastHiddenLine; } 02066 02072 void SetTransparency(char const * text, bool fast_z_sort=false); 02073 02078 void SetLineAntialiasing( bool onoff ); 02079 02081 bool GetLineAntialiasing() { return m_bLineAntialiasing; } 02082 02086 void SetTextAntialiasing( bool onoff ); 02087 02092 void SetDepthOfField(bool onoff, float strength = 1.0f); 02093 02098 void SetDepthOfFieldRange(float near=0.0f, float far=0.0f); 02099 02101 bool GetTextAntialiasing() { return m_bTextAntialiasing; } 02102 02106 void SetIsoDefault(ViewMode vm) { m_IsoDefault = vm; }\ 02107 02109 ViewMode GetIsoDefault() { return m_IsoDefault; } 02110 02117 void SetCullingThreshold(int cullingthreshold); 02118 02122 int GetCullingThreshold(); 02123 02130 void SetHardExtent(int cutoff); 02131 02135 int GetHardExtent(); 02136 02141 void BeginShellSelection(); 02142 02145 void EndShellSelection(); 02146 02148 HSelectionSet * GetHighlightSelection() { return m_pHighlight; } 02149 02156 void SetViewAxis(HVector *front_axis, HVector *top_axis) { m_FrontAxis = front_axis; m_TopAxis = top_axis; } 02161 void GetViewAxis(HVector *front_axis, HVector *top_axis) { *front_axis = m_FrontAxis; *top_axis = m_TopAxis; } 02162 02166 void SetDefaultHSRA(); 02167 02168 02172 void SetMaximumUpdateTime(float mut) { m_MaximumUpdateTime = mut; } 02173 02177 float GetMaximumUpdateTime() { return m_MaximumUpdateTime; } 02178 02182 virtual const HSelectionHighlightMode GetHighlightMode() { return m_HighlightMode; } 02183 02188 virtual void SetHighlightMode(HSelectionHighlightMode m); 02189 02193 virtual void SetReferenceSelection(bool use_ref); 02194 02201 bool GetKeyState(unsigned int key, int &flags); 02202 02204 void ResetKeyState(); 02205 02209 void SetFastFitWorld(bool fw) { m_bFastFitWorld = fw; } 02210 02214 void SetDetailedFitWorld(bool fw) { m_bDetailedFitWorld = fw; } 02215 02219 bool GetFastFitWorld() { return m_bFastFitWorld; } 02220 02224 bool GetDetailedFitWorld() { return m_bDetailedFitWorld; } 02225 02231 void GetSceneExtents(HPoint &min, HPoint &max); 02232 02236 void SetLightScaling(float sv); 02237 02238 void SetXYSizeOverride(int x,int y) { m_XSize_override = x, m_YSize_override = y; } 02239 02240 02242 int GetXSize() {return m_XSize;} 02243 02245 int GetYSize() {return m_YSize;} 02246 02248 HViewSelectionLevel GetViewSelectionLevel(); 02249 02258 void SetViewSelectionLevel(HViewSelectionLevel level); 02259 02268 void EnableTargetFrameRate(bool enable=true, int target=100, int threshold=10, int steps=5); 02269 02274 float GetFramerate(); 02275 02277 FramerateMode GetFramerateMode(); 02278 02280 int GetFramerateCullingThreshold(); 02281 02286 int GetFramerateSteps(); 02287 02289 bool IsFramerateLodEnabled(); 02290 02304 void SetFramerateMode(FramerateMode mode, float framerate = 0.1f, int cullingthreshold = 150, 02305 bool enableLods = false, int steps = 20, int cutoff = 1); 02306 02308 bool IsFrameRateEnabled(); 02309 02311 bool GetViewActive(); 02312 02314 void cleanupSimpList(); 02315 02319 void SetAnnotationResize(bool value); 02320 02322 bool GetAnnotationResize() { return m_AnnotationCookie==0?false:true; } 02323 02325 bool GetFirstUpdate() { return m_bFirstUpdate; } 02326 02328 void SetDisplayHandlesOnDblClk(bool dh) { m_bDisplayHandlesOnDblClk = dh; } 02329 02331 bool HasInitialView() { return m_has_initial_view; } 02332 02334 void HasInitialView(bool does_it) { m_has_initial_view=does_it; } 02335 02337 void ExhaustiveUpdate(); 02338 02340 bool GetUpdateNotFinished() { return m_bUpdateNotFinished; } 02341 02343 void SetUpdateNotFinished(bool NotFinished) { m_bUpdateNotFinished = NotFinished; } 02344 02345 /* This method sets the mousewheel sensitivity which is used to control the apparent sensitivity of the mousewheel for MVO operators. 02346 \param sensitivity value is strictly positive float. */ 02347 void SetMouseWheelSensitivity(float sensitivity) { 02348 if (sensitivity > 0) 02349 m_MouseWheelSensitivity = sensitivity; 02350 } 02351 /* Use this in an operator to modify the return value of HEventInfo::GetMouseWheelDelta() 02352 \return value of the operator mousewheel sensitivity, a strictly positive value. */ 02353 float GetMouseWheelSensitivity() { return m_MouseWheelSensitivity; } 02354 02356 void SetSplatRendering(bool onoff); 02357 02359 bool GetSplatRendering() { return m_bSplatRendering; }; 02360 02362 void SetSplatSize(int splat_size); 02363 02365 int GetSplatSize() { return m_SplatSize; }; 02366 02368 void SetSplatSymbol(SplatSymbol symbol); 02369 02371 SplatSymbol GetSplatSymbol() {return m_SplatSymbol;}; 02372 02373 02377 void UpdateFakeHLRColor(HPoint paper_color); 02378 02380 void SetHardwareAntialiasing(int antialiasinglevel) { m_HardwareAntialiasing = antialiasinglevel; } 02381 02383 int GetHardwareAntialiasing() { return m_HardwareAntialiasing; } 02384 02388 static void StaticForceUpdateRequest(void * view_pointer); 02389 02390 /* 02391 This method can be used to visualize the internal bounding stored on segments 02392 and some types of geometry. The bounding is drawn outside of the model so it does not 02393 interfere with static trees. It is semi-transparent with a color that indicates the 02394 bounding density: blue is very dense, red is sparse, green is somewhere in between. 02395 \param draw_something If this value is false, any existing bounding geometry will simply 02396 be discarded. If it is true, a new bounding geometry will also be generated. 02397 \param key The key of the segment or geometry whose bounding should be visualized. 02398 \param incl_count The number of keys in the incl_path array. 02399 \param incl_path This array of keys should be structured for a PShow. That is, the leaf 02400 as the first entry followed by a series of include keys mapping a path to the view. 02401 */ 02402 void VisualizeBounding(bool draw_something, HC_KEY key=INVALID_KEY, int incl_count=0, HC_KEY * incl_path=0); 02403 02404 02405 /* 02406 Retrieves the color set by an earlier call to SetFakeHLRColor. 02407 \return the color as an rgb triplet with values from 0.0 to 1.0. 02408 */ 02409 HPoint GetFakeHLRColor(); 02410 02411 /* 02412 Sets the color to be used in fake hidden-line render mode. 02413 \param color An rgb triplet with values from 0.0 to 1.0. 02414 */ 02415 void SetFakeHLRColor(HPoint color); 02416 02417 /* 02418 Orients the camera to point at selected geometry and sets depth-of-field to keep it in focus. 02419 \param onoff passing true will focus on the selected geometry, passing false will remove an earlier depth-of-field setting. 02420 */ 02421 void FocusOnSelection(bool onoff = true); 02422 02423 /* 02424 \return true if the view is currently focused on a selection via a previous call to FocusOnSelection(), false otherwise. 02425 */ 02426 bool GetFocusOnSelection() { return m_FocusedOnSelection; } 02427 02429 HTouchManager *GetTouchManager() { return m_TouchManager; } 02430 02431 protected: 02432 HC_KEY m_FakeHLRStyle; 02433 HC_KEY m_FakeHLRSource; 02434 bool m_bCPLineVisibility; 02435 bool m_bCPFaceVisibility; 02436 int m_CPMode; 02437 bool m_bCuttingPlanesExist; 02438 bool m_bCuttingPlanesVisibility; 02439 bool m_bSpritingAllowed; 02440 bool m_bAxisTriadTransparencyAllowed; 02441 int m_AxisWindowSize; 02443 bool m_bForceFastHiddenLine; 02444 bool m_bLineAntialiasing; 02445 bool m_bTextAntialiasing; 02446 bool m_bBeginShellSelection; 02447 bool m_bDisplayHandlesOnDblClk; 02448 bool m_has_initial_view; 02449 02450 HTouchManager *m_TouchManager; 02452 int m_HardwareAntialiasing; 02453 ViewMode m_IsoDefault; 02454 HSelectionHighlightMode m_HighlightMode; 02455 DisplayListType m_DisplayListType; 02459 bool m_bGeometryChanged; 02460 HPoint m_SceneBoundingMin; 02461 HPoint m_SceneBoundingMax; 02462 bool m_bSceneBoundingSet; 02463 bool m_bFastFitWorld; 02464 bool m_bDetailedFitWorld; 02465 HImCuttingGeometry * m_pHImCuttingGeometry; 02466 HUtilityAntialiasing * m_pAntialiasing; 02467 HMarkupManager * m_pMarkupManager; 02468 AxisMode m_bAxisMode; 02469 bool m_bHideOverlappedText; 02470 bool m_bNavCube; 02471 bool m_bSmoothTransition; 02472 float m_SmoothTransitionDuration; 02473 bool m_bLightFollowsCamera; 02474 int m_WindowColorPercentage; 02475 HVector m_FrontAxis; 02476 HVector m_TopAxis; 02478 HBaseModel* m_pModel; 02479 HC_KEY m_ViewKey; 02481 HC_KEY m_SceneKey; 02483 HC_KEY m_OverwriteKey; 02485 HC_KEY m_BBoxGeometryKey; 02487 HC_KEY m_WindowspaceKey; 02489 HC_KEY m_ConstructionKey; 02491 HC_KEY m_CuttingPlanesKey; 02493 HC_KEY m_CuttingPlaneGeomKey; 02495 HC_KEY m_IntersectPolylinesKey; 02497 HC_KEY m_AxisTriadKey; 02499 HC_KEY m_ProgressBarKey; 02500 02501 02502 HC_KEY m_InfoTextKey; 02503 02505 HC_KEY m_lIncludeLinkKey; 02506 HC_KEY m_LightsKey; 02507 HC_KEY m_SceneLight[MaxLights]; 02508 HRenderMode m_RenderMode; 02509 ViewMode m_ViewMode; 02510 HBaseOperator* m_pOperator; 02511 HEventInfo* m_pEvent; 02512 HSelectionSet* m_pSelection; 02513 HSelectionSet* m_pHighlight; 02514 HConstantFrameRate *m_pConstantFrameRate; 02515 HShadowMode m_ShadowMode; 02516 HSharedKey * m_pSharedKey; 02517 int m_UpdateInterrupted; 02518 int m_InUpdateInternal; 02519 void (* m_pfEventChecker)(HIC_Rendition const *nr); 02520 bool (* m_pfKeyState)(unsigned int, int &); 02521 ViewUpdateMode m_ViewUpdateMode; 02522 bool m_bUpdateRequested; 02523 HEventManager * m_pEventManager; 02524 HUndoManager * m_pUndoManager; 02525 HObjectManager *m_pObjectManager; 02526 class HDebugZBuffer *m_pDebugZBuffer; 02527 bool m_bLButtonDown; 02528 bool m_bMouseMove; 02529 HOpCameraManipulate *m_pManipulateOperator; 02530 bool m_bShadowRegeneration; 02531 bool m_bShadowRegenerationToggle; 02532 bool m_bCuttingPlaneRegeneration; 02533 bool m_bCameraChanged; 02534 float m_IdleTime; 02535 bool m_bFirstUpdate; 02536 HBaseOperator * m_pHandleOperator; 02537 bool m_bAllowInteractiveShadows; 02538 bool m_bAllowInteractiveCutGeometry; 02539 float m_DefaultSelectionProximity; 02540 float m_MaximumUpdateTime; 02541 HCamera m_InitialCamera; 02542 bool m_bInitialCameraSet; 02543 bool m_bRecordCamera; 02544 bool m_bTransparentSelectionBox; 02545 bool m_bInvertMouseWheelZoom; 02546 unsigned long m_AnnotationCookie; 02547 unsigned long m_AxisResizeCookie; 02548 FramerateMode m_FramerateMode; 02549 bool m_bSplatRendering; 02550 int m_SplatSize; 02551 SplatSymbol m_SplatSymbol; 02552 bool m_FocusedOnSelection; 02553 02560 void ComputeShadowParams(HPlane& shadow_plane, HPoint& light_pos); 02561 02567 void AdjustShadowPlane(HPlane& shadow_plane, HPoint const & light_pos); 02568 02574 void SetShadowParams(const HPlane& shadow_plane, const HPoint& light_pos, 02575 const HPoint* color = 0, const char * filter = 0); 02576 02583 virtual void SetShadowParams(HShadow* shadowObj); 02584 02587 void RefreshViewSize(); 02588 02594 void QueryDeviceCapabilities(); 02595 02604 virtual void UpdateInternal(bool antialias = false, bool force_update = false); 02605 02606 02611 virtual void SetupLights(); 02612 02613 private: 02614 float m_LastRecordTime; 02616 char * m_sDriverPath; // fully rooted pathname of driver instance 02617 char * m_sDriverType; // driver type; e.g. msw, opengl, x11 02618 char * m_sAlias; 02619 void * m_pWindowHandle; 02620 void * m_pColormap; 02621 void * m_pClipOverride; 02622 void * m_pWindowHandle2; 02623 struct vlist_s *m_SignalRequestsList; 02624 HBaseViewEmitMessageFunction emit_message_function; 02625 void * emit_message_function_user_data; 02626 HTClient * m_pUpdateTimerClient; 02627 bool m_bPrevBackplaneCullMode; // this caches backplane cull mode (which is switched off when capping planes are turned off with cutting planes on ) 02628 bool m_bHasObjects; 02629 float m_fZoomLimit; 02630 int m_SuppressUpdate; 02631 int m_SuppressUpdateTick; 02632 bool m_bDynamicHighlighting; 02633 int m_XSize; 02634 int m_YSize; 02635 int m_XSize_override; 02636 int m_YSize_override; 02637 float m_LastMouseWheelTime; 02638 float m_MouseWheelSensitivity; 02639 bool m_KeyMap[256]; 02640 int m_KeyFlags; 02641 bool m_bOwnDriver; 02642 bool m_bUpdateNotFinished; 02643 int m_NotFinishedCounter; 02644 HPoint m_FakeHLRColor; 02645 HConstFRSimpType **SimpList; 02646 int simpListLength; 02647 int m_OldCullingThreshold; 02648 float *m_pTempClipArray; 02649 ViewUpdateMode m_OldViewUpdateMode; 02650 bool m_UseExplicitShadowLight; 02651 HPoint m_ExplicitShadowLightDirection; 02652 int m_LightCount; 02653 02654 //no default constructor 02655 HBaseView() {;}; 02656 02657 //obsolete 02658 HBaseView(HBaseModel *model, char const * alias, char const * driver_type,char const * instance_name, long window_handle, long colormap) { 02659 UNREFERENCED(model); 02660 UNREFERENCED(alias); 02661 UNREFERENCED(driver_type); 02662 UNREFERENCED(instance_name); 02663 UNREFERENCED(window_handle); 02664 UNREFERENCED(colormap); 02665 } 02666 02667 //obsolete 02668 void RebindView(HBaseModel *model, char const * alias, char const * driver_type,char const * instance_name, long window_handle, long colormap) { 02669 UNREFERENCED(model); 02670 UNREFERENCED(alias); 02671 UNREFERENCED(driver_type); 02672 UNREFERENCED(instance_name); 02673 UNREFERENCED(window_handle); 02674 UNREFERENCED(colormap); 02675 } 02676 02677 }; 02678 02679 02680 #ifdef H_PACK_8 02681 #pragma pack(pop) 02682 #endif 02683 02684 #endif