Team Fortress 2 Source Code as on 22/4/2020
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.

139 lines
3.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef DMEDAGRENDERPANEL_H
  8. #define DMEDAGRENDERPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "tier1/utlvector.h"
  13. #include "matsys_controls/PotteryWheelPanel.h"
  14. #include "datamodel/dmehandle.h"
  15. //-----------------------------------------------------------------------------
  16. // Forward declarations
  17. //-----------------------------------------------------------------------------
  18. class CDmeDag;
  19. class CDmeModel;
  20. class CDmeAnimationList;
  21. class CDmeChannelsClip;
  22. class CDmeSourceSkin;
  23. class CDmeSourceAnimation;
  24. class CDmeDCCMakefile;
  25. class CDmeDrawSettings;
  26. class vgui::MenuBar;
  27. namespace vgui
  28. {
  29. class IScheme;
  30. }
  31. //-----------------------------------------------------------------------------
  32. // Material Viewer Panel
  33. //-----------------------------------------------------------------------------
  34. class CDmeDagRenderPanel : public CPotteryWheelPanel
  35. {
  36. DECLARE_CLASS_SIMPLE( CDmeDagRenderPanel, CPotteryWheelPanel );
  37. public:
  38. // constructor, destructor
  39. CDmeDagRenderPanel( vgui::Panel *pParent, const char *pName );
  40. virtual ~CDmeDagRenderPanel();
  41. // Overriden methods of vgui::Panel
  42. virtual void PerformLayout();
  43. virtual void Paint();
  44. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  45. // Sets the current scene + animation list
  46. void SetDmeElement( CDmeDag *pScene );
  47. void SetAnimationList( CDmeAnimationList *pAnimationList );
  48. void SetVertexAnimationList( CDmeAnimationList *pAnimationList );
  49. void DrawJoints( bool bDrawJoint );
  50. void DrawJointNames( bool bDrawJointNames );
  51. void DrawGrid( bool bDrawGrid );
  52. CDmeDag *GetDmeElement();
  53. // Other methods which hook into DmePanel
  54. void SetDmeElement( CDmeSourceSkin *pSkin );
  55. void SetDmeElement( CDmeSourceAnimation *pAnimation );
  56. void SetDmeElement( CDmeDCCMakefile *pDCCMakefile );
  57. // Select animation by name
  58. void SelectAnimation( const char *pAnimName );
  59. void SelectVertexAnimation( const char *pAnimName );
  60. private:
  61. // Select animation by index
  62. void SelectAnimation( int nIndex );
  63. void SelectVertexAnimation( int nIndex );
  64. // paint it!
  65. void OnPaint3D();
  66. void OnMouseDoublePressed( vgui::MouseCode code );
  67. virtual void OnKeyCodePressed( vgui::KeyCode code );
  68. MESSAGE_FUNC( OnSmoothShade, "SmoothShade" );
  69. MESSAGE_FUNC( OnFlatShade, "FlatShade" );
  70. MESSAGE_FUNC( OnWireframe, "Wireframe" );
  71. MESSAGE_FUNC( OnBoundingBox, "BoundingBox" );
  72. MESSAGE_FUNC( OnNormals, "Normals" );
  73. MESSAGE_FUNC( OnWireframeOnShaded, "WireframeOnShaded" );
  74. MESSAGE_FUNC( OnBackfaceCulling, "BackfaceCulling" );
  75. MESSAGE_FUNC( OnXRay, "XRay" );
  76. MESSAGE_FUNC( OnGrayShade, "GrayShade" );
  77. MESSAGE_FUNC( OnFrame, "Frame" );
  78. // Draw joint names
  79. void DrawJointNames( CDmeDag *pRoot, CDmeDag *pDag, const matrix3x4_t& parentToWorld );
  80. // Rebuilds the list of operators
  81. void RebuildOperatorList();
  82. // Update Menu Status
  83. void UpdateMenu();
  84. CTextureReference m_DefaultEnvCubemap;
  85. CTextureReference m_DefaultHDREnvCubemap;
  86. vgui::HFont m_hFont;
  87. bool m_bDrawJointNames : 1;
  88. bool m_bDrawJoints : 1;
  89. bool m_bDrawGrid : 1;
  90. CDmeHandle< CDmeAnimationList > m_hAnimationList;
  91. CDmeHandle< CDmeAnimationList > m_hVertexAnimationList;
  92. CDmeHandle< CDmeChannelsClip > m_hCurrentAnimation;
  93. CDmeHandle< CDmeChannelsClip > m_hCurrentVertexAnimation;
  94. CUtlVector< IDmeOperator* > m_operators;
  95. float m_flStartTime;
  96. CDmeHandle< CDmeDag > m_hDag;
  97. CDmeDrawSettings *m_pDrawSettings;
  98. CDmeHandle< CDmeDrawSettings, true > m_hDrawSettings;
  99. vgui::MenuBar *m_pMenuBar;
  100. // Menu item numbers
  101. vgui::Menu *m_pShadingMenu;
  102. int m_nMenuSmoothShade;
  103. int m_nMenuFlatShade;
  104. int m_nMenuWireframe;
  105. int m_nMenuBoundingBox;
  106. int m_nMenuNormals;
  107. int m_nMenuWireframeOnShaded;
  108. int m_nMenuBackfaceCulling;
  109. int m_nMenuXRay;
  110. int m_nMenuGrayShade;
  111. };
  112. #endif // DMEDAGRENDERPANEL_H