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.

159 lines
4.6 KiB

  1. //========= Copyright � 1996-2001, Valve LLC, 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. void DrawAxis( bool bDrawAxis );
  53. void ModelInEngineCoordinates( bool bModelInEngineCoordinates );
  54. void ModelZUp( bool bModelZUp );
  55. CDmeDag *GetDmeElement();
  56. // Other methods which hook into DmePanel
  57. void SetDmeElement( CDmeSourceSkin *pSkin );
  58. void SetDmeElement( CDmeSourceAnimation *pAnimation );
  59. void SetDmeElement( CDmeDCCMakefile *pDCCMakefile );
  60. // Select animation by name
  61. void SelectAnimation( const char *pAnimName );
  62. void SelectVertexAnimation( const char *pAnimName );
  63. private:
  64. // Select animation by index
  65. void SelectAnimation( int nIndex );
  66. void SelectVertexAnimation( int nIndex );
  67. // paint it!
  68. void OnPaint3D();
  69. void OnMouseDoublePressed( vgui::MouseCode code );
  70. virtual void OnKeyCodePressed( vgui::KeyCode code );
  71. MESSAGE_FUNC( OnSmoothShade, "SmoothShade" );
  72. MESSAGE_FUNC( OnFlatShade, "FlatShade" );
  73. MESSAGE_FUNC( OnWireframe, "Wireframe" );
  74. MESSAGE_FUNC( OnBoundingBox, "BoundingBox" );
  75. MESSAGE_FUNC( OnNormals, "Normals" );
  76. MESSAGE_FUNC( OnWireframeOnShaded, "WireframeOnShaded" );
  77. MESSAGE_FUNC( OnBackfaceCulling, "BackfaceCulling" );
  78. MESSAGE_FUNC( OnXRay, "XRay" );
  79. MESSAGE_FUNC( OnGrayShade, "GrayShade" );
  80. MESSAGE_FUNC( OnFrame, "Frame" );
  81. // Draw joint names
  82. void DrawJointNames( CDmeDag *pRoot, CDmeDag *pDag, const matrix3x4_t& parentToWorld );
  83. // Draw highlighted vertices
  84. void DrawHighlightPoints();
  85. // Draw the coordinate axis
  86. void DrawAxis();
  87. // Rebuilds the list of operators
  88. void RebuildOperatorList();
  89. // Update Menu Status
  90. void UpdateMenu();
  91. CTextureReference m_DefaultEnvCubemap;
  92. CTextureReference m_DefaultHDREnvCubemap;
  93. vgui::HFont m_hFont;
  94. CMaterialReference m_axisMaterial;
  95. bool m_bDrawJointNames : 1;
  96. bool m_bDrawJoints : 1;
  97. bool m_bDrawGrid : 1;
  98. bool m_bDrawAxis : 1;
  99. // NOTE: m_bModelInEngineCoordinates overrides m_bZUp
  100. bool m_bModelInEngineCoordinates : 1; // Is the model already in engine coordinates
  101. // Note: m_bZUp implies the data is in Z Up coordinates with -Y as the forward axis
  102. bool m_bModelZUp : 1; // Is the model Z Up?
  103. // NOTE: If neither m_bModelInEngineCoordinates nor m_bModelZUp is true then
  104. // the model is in Y Up coordinates with Z as the forward axis
  105. CDmeHandle< CDmeAnimationList > m_hAnimationList;
  106. CDmeHandle< CDmeAnimationList > m_hVertexAnimationList;
  107. CDmeHandle< CDmeChannelsClip > m_hCurrentAnimation;
  108. CDmeHandle< CDmeChannelsClip > m_hCurrentVertexAnimation;
  109. CUtlVector< IDmeOperator* > m_operators;
  110. float m_flStartTime;
  111. CDmeHandle< CDmeDag > m_hDag;
  112. CDmeDrawSettings *m_pDrawSettings;
  113. CDmeHandle< CDmeDrawSettings, HT_STRONG > m_hDrawSettings;
  114. vgui::MenuBar *m_pMenuBar;
  115. // Menu item numbers
  116. vgui::Menu *m_pShadingMenu;
  117. int m_nMenuSmoothShade;
  118. int m_nMenuFlatShade;
  119. int m_nMenuWireframe;
  120. int m_nMenuBoundingBox;
  121. int m_nMenuNormals;
  122. int m_nMenuWireframeOnShaded;
  123. int m_nMenuBackfaceCulling;
  124. int m_nMenuXRay;
  125. int m_nMenuGrayShade;
  126. };
  127. #endif // DMEDAGRENDERPANEL_H