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.

176 lines
4.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef FACEEDIT_MATERIALPAGE_H
  7. #define FACEEDIT_MATERIALPAGE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "resource.h"
  12. #include "TextureBox.h"
  13. #include "IEditorTexture.h"
  14. #include "wndTex.h"
  15. #include "MapFace.h"
  16. #include "materialdlg.h"
  17. class CMapSolid;
  18. // Flags for the Apply function
  19. #define FACE_APPLY_MATERIAL 0x01
  20. #define FACE_APPLY_MAPPING 0x02
  21. #define FACE_APPLY_LIGHTMAP_SCALE 0x04
  22. #define FACE_APPLY_ALIGN_EDGE 0x08 // NOT included in FACE_APPLY_ALL!
  23. #define FACE_APPLY_CONTENTS_DATA 0x10
  24. #define FACE_APPLY_ALL FACE_APPLY_MATERIAL | FACE_APPLY_MAPPING | FACE_APPLY_LIGHTMAP_SCALE
  25. class CFaceEditMaterialPage : public CPropertyPage
  26. {
  27. DECLARE_DYNAMIC( CFaceEditMaterialPage );
  28. public:
  29. enum
  30. {
  31. MATERIALPAGETOOL_NONE = 0,
  32. MATERIALPAGETOOL_MATERIAL,
  33. MATERIALPAGETOOL_SMOOTHING_GROUP
  34. };
  35. //=========================================================================
  36. //
  37. // Creation/Destruction
  38. //
  39. CFaceEditMaterialPage();
  40. ~CFaceEditMaterialPage();
  41. void Init( void );
  42. //=========================================================================
  43. //
  44. // Update
  45. //
  46. void ClickFace( CMapSolid *pSolid, int faceIndex, int cmd, int clickMode = -1 ); // primary interface update call
  47. void Apply( CMapFace *pOnlyFace, int flags );
  48. void NotifyGraphicsChanged( void );
  49. void UpdateDialogData( CMapFace *pFace = NULL );
  50. void SetMaterialPageTool( unsigned short iMaterialTool );
  51. unsigned short GetMaterialPageTool( void ) { return m_iMaterialTool; }
  52. // Called when a new material is detected.
  53. void NotifyNewMaterial( IEditorTexture *pTex );
  54. //=========================================================================
  55. //
  56. // Dialog Data
  57. //
  58. //{{AFX_DATA( CFaceEditMaterialPage )
  59. enum { IDD = IDD_FACEEDIT };
  60. //}}AFX_DATA
  61. //=========================================================================
  62. //
  63. // Virtual Overrides
  64. //
  65. //{{AFX_VIRTUAL( CFaceEditMaterialPage )
  66. BOOL OnSetActive( void );
  67. virtual BOOL PreTranslateMessage( MSG *pMsg );
  68. //}}AFX_VIRTUAL
  69. //=========================================================================
  70. //
  71. // Face Attributes
  72. //
  73. struct FaceAttributeInfo_t
  74. {
  75. unsigned int uControlID; // Control ID of corresponding checkbox.
  76. unsigned int *puAttribute; // Pointer to bit flags attribute being modified.
  77. unsigned int uFlag; // Bit flag(s) to set in the above attribute.
  78. };
  79. static unsigned int m_FaceContents;
  80. static unsigned int m_FaceSurface;
  81. protected:
  82. CEdit m_shiftX;
  83. CEdit m_shiftY;
  84. CEdit m_scaleX;
  85. CEdit m_scaleY;
  86. CEdit m_rotate;
  87. CEdit m_cLightmapScale;
  88. CButton m_cHideMask;
  89. CButton m_cExpand;
  90. wndTex m_texture;
  91. BOOL m_bInitialized;
  92. BOOL m_bHideMask;
  93. BOOL m_bIgnoreResize;
  94. BOOL m_bTreatAsOneFace; // whether to consider all selected faces as one face.
  95. FaceOrientation_t m_eOrientation; // The orientation of the lifted face.
  96. IEditorTexture *m_pCurTex;
  97. wndTex m_TexturePic;
  98. CTextureBox m_TextureList;
  99. CComboBox m_TextureGroupList;
  100. unsigned short m_iMaterialTool;
  101. CFaceSmoothingDlg m_FaceSmoothDlg;
  102. void SetReadOnly( bool bIsReadOnly );
  103. //=========================================================================
  104. //
  105. // Texture Browser/Update
  106. //
  107. void SelectTexture( LPCSTR pszTextureName );
  108. void UpdateTexture( void );
  109. //=========================================================================
  110. //
  111. // Texture Alignement
  112. //
  113. void AlignToView( CMapFace *pFace );
  114. void CopyTCoordSystem( const CMapFace *pFrom, CMapFace *pTo );
  115. void GetAllFaceExtents( Extents_t Extents );
  116. //=========================================================================
  117. //
  118. // Message Map
  119. //
  120. //{{AFX_MSG( CFaceEditMaterialPage )
  121. afx_msg void OnButtonApply( void );
  122. afx_msg BOOL OnAlign(UINT uCmd);
  123. afx_msg void OnHideMask();
  124. afx_msg BOOL OnJustify( UINT uCmd );
  125. afx_msg void OnMode();
  126. afx_msg void OnVScroll( UINT nSBCode, UINT nPos, CScrollBar *pScrollBar );
  127. afx_msg void OnDeltaPosFloatSpin( NMHDR* pNMHDR, LRESULT* pResult );
  128. afx_msg void OnSize( UINT, int, int );
  129. afx_msg void OnSelChangeTexture( void );
  130. afx_msg void OnCheckUnCheck( void );
  131. afx_msg void OnTreatAsOne( void );
  132. afx_msg void OnReplace( void );
  133. afx_msg BOOL OnSwitchMode( UINT id );
  134. afx_msg void OnBrowse( void );
  135. afx_msg void OnChangeTextureGroup( void );
  136. afx_msg void OnButtonSmoothingGroups( void );
  137. afx_msg void OnButtonShiftXRandom( void );
  138. afx_msg void OnButtonShiftYRandom( void );
  139. //}}AFX_MSG
  140. DECLARE_MESSAGE_MAP()
  141. public:
  142. afx_msg void OnBnClickedFaceMarkButton();
  143. };
  144. #endif // FACEEDIT_MATERIALPAGE_H