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.

97 lines
2.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Defines a decal helper. The decal attaches itself to nearby
  4. // solids, dynamically creating decal faces as necessary.
  5. //
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef MAPDECAL_H
  9. #define MAPDECAL_H
  10. #pragma once
  11. #include "MapHelper.h"
  12. class CHelperInfo;
  13. class CMapFace;
  14. class CRender3D;
  15. class IEditorTexture;
  16. //
  17. // Structure containing a decal face and the solid to which it is attached.
  18. // We keep one of these for every decal face that is created.
  19. //
  20. struct DecalFace_t
  21. {
  22. CMapFace *pFace; // Textured face representing the decal.
  23. CMapSolid *pSolid; // The solid to which the face is attached.
  24. };
  25. class CMapDecal : public CMapHelper
  26. {
  27. public:
  28. DECLARE_MAPCLASS(CMapDecal,CMapHelper)
  29. //
  30. // Factory for building from a list of string parameters.
  31. //
  32. static CMapClass *CreateMapDecal(CHelperInfo *pInfo, CMapEntity *pParent);
  33. //
  34. // Construction/destruction:
  35. //
  36. CMapDecal(void);
  37. CMapDecal(float *pfMins, float *pfMaxs);
  38. ~CMapDecal(void);
  39. void CalcBounds(BOOL bFullUpdate = FALSE);
  40. virtual CMapClass *Copy(bool bUpdateDependencies);
  41. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  42. virtual void OnNotifyDependent(CMapClass *pObject, Notify_Dependent_t eNotifyType);
  43. virtual void OnParentKeyChanged(const char* szKey, const char* szValue);
  44. virtual void OnPaste(CMapClass *pCopy, CMapWorld *pSourceWorld, CMapWorld *pDestWorld, const CMapObjectList &OriginalList, CMapObjectList &NewList);
  45. virtual void OnRemoveFromWorld(CMapWorld *pWorld, bool bNotifyChildren);
  46. virtual void Render3D(CRender3D *pRender);
  47. int SerializeRMF(std::fstream &File, BOOL bRMF);
  48. int SerializeMAP(std::fstream &File, BOOL bRMF);
  49. bool IsVisualElement(void) { return(true); }
  50. const char* GetDescription() { return("Decal helper"); }
  51. virtual void PostloadWorld(CMapWorld *pWorld);
  52. void DecalAllSolids(CMapWorld *pWorld);
  53. bool ShouldRenderLast(void) { return true; }
  54. protected:
  55. //
  56. // Implements CMapAtom transformation functions.
  57. //
  58. void DoTransform(const VMatrix &matrix);
  59. void AddSolid(CMapSolid *pSolid);
  60. int CanDecalSolid(CMapSolid *pSolid, CMapFace **ppFaces);
  61. int DecalSolid(CMapSolid *pSolid);
  62. void RebuildDecalFaces(void);
  63. IEditorTexture *m_pTexture; // Pointer to the texture this decal uses.
  64. CMapObjectList m_Solids; // List of solids to which we are attached.
  65. CUtlVector<DecalFace_t*> m_Faces; // List of decal faces and the solids that they are attached to.
  66. };
  67. #endif // MAPDECAL_H