Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.3 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef MDLPANEL_H
  7. #define MDLPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/Panel.h"
  12. #include "datacache/imdlcache.h"
  13. #include "materialsystem/MaterialSystemUtil.h"
  14. #include "matsys_controls/potterywheelpanel.h"
  15. #include "tier3/mdlutils.h"
  16. //-----------------------------------------------------------------------------
  17. // Forward declarations
  18. //-----------------------------------------------------------------------------
  19. namespace vgui
  20. {
  21. class IScheme;
  22. }
  23. //-----------------------------------------------------------------------------
  24. // MDL Viewer Panel
  25. //-----------------------------------------------------------------------------
  26. class CMDLPanel : public CMergedMDL, public CPotteryWheelPanel
  27. {
  28. DECLARE_CLASS_SIMPLE( CMDLPanel, CPotteryWheelPanel );
  29. public:
  30. // constructor, destructor
  31. CMDLPanel( vgui::Panel *pParent, const char *pName );
  32. virtual ~CMDLPanel();
  33. // Overriden methods of vgui::Panel
  34. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  35. virtual void OnTick();
  36. // Sets the camera to look at the model
  37. void LookAtMDL( );
  38. void SetCollsionModel( bool bVisible );
  39. void SetGroundGrid( bool bVisible );
  40. void SetWireFrame( bool bVisible );
  41. void SetLockView( bool bLocked );
  42. void SetLookAtCamera( bool bLookAtCamera );
  43. // Lock the camera position and angles to an attachment point
  44. void SetCameraAttachment( const char *pszAttachment );
  45. void SetRenderCaptureCameraAttachment( const char *pszAttachment );
  46. void SetDirectionalLightAttachment( int idx, const char *pszAttachment );
  47. void PauseAnimation( bool bState ) { m_bAnimationPause = bState; }
  48. bool IsAnimationPaused() { return m_bAnimationPause; }
  49. void SetCameraOrientOverride( Vector vecNew ) { m_vecCameraOrientOverride = vecNew; }
  50. void SetCameraOrientOverrideEnabled( bool bEnabled ) { m_bCameraOrientOverrideEnabled = bEnabled; }
  51. bool IsCameraOrientOverrideEnabled( void ) { return m_bCameraOrientOverrideEnabled; }
  52. void SetCameraPositionOverride(Vector vecNew) { m_vecCameraPositionOverride = vecNew; }
  53. void SetCameraPositionOverrideEnabled(bool bEnabled) { m_bCameraPositionOverrideEnabled = bEnabled; }
  54. bool IsCameraPositionOverrideEnabled(void) { return m_bCameraPositionOverrideEnabled; }
  55. protected:
  56. virtual void OnPostSetUpBonesPreDraw() OVERRIDE;
  57. virtual void OnModelDrawPassStart( int iPass, CStudioHdr *pStudioHdr, int &nFlags ) OVERRIDE;
  58. virtual void OnModelDrawPassFinished( int iPass, CStudioHdr *pStudioHdr, int &nFlags ) OVERRIDE;
  59. private:
  60. // paint it!
  61. void OnPaint3D();
  62. void OnMouseDoublePressed( vgui::MouseCode code );
  63. void DrawCollisionModel();
  64. void UpdateStudioRenderConfig( void );
  65. int m_iCameraAttachment;
  66. int m_iRenderCaptureCameraAttachment;
  67. int m_iDirectionalLightAttachments[ MATERIAL_MAX_LIGHT_COUNT ];
  68. float m_flAutoPlayTimeBase;
  69. bool m_bDrawCollisionModel : 1;
  70. bool m_bGroundGrid : 1;
  71. bool m_bLockView : 1;
  72. bool m_bWireFrame : 1;
  73. bool m_bLookAtCamera : 1;
  74. bool m_bAnimationPause : 1;
  75. bool m_bCameraOrientOverrideEnabled;
  76. Vector m_vecCameraOrientOverride;
  77. bool m_bCameraPositionOverrideEnabled;
  78. Vector m_vecCameraPositionOverride;
  79. };
  80. #endif // MDLPANEL_H