summaryrefslogtreecommitdiff
path: root/hammer/mapdecal.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /hammer/mapdecal.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'hammer/mapdecal.h')
-rw-r--r--hammer/mapdecal.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/hammer/mapdecal.h b/hammer/mapdecal.h
new file mode 100644
index 0000000..c1f5e0e
--- /dev/null
+++ b/hammer/mapdecal.h
@@ -0,0 +1,97 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Defines a decal helper. The decal attaches itself to nearby
+// solids, dynamically creating decal faces as necessary.
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef MAPDECAL_H
+#define MAPDECAL_H
+#pragma once
+
+#include "MapHelper.h"
+
+
+
+class CHelperInfo;
+class CMapFace;
+class CRender3D;
+class IEditorTexture;
+
+
+//
+// Structure containing a decal face and the solid to which it is attached.
+// We keep one of these for every decal face that is created.
+//
+struct DecalFace_t
+{
+ CMapFace *pFace; // Textured face representing the decal.
+ CMapSolid *pSolid; // The solid to which the face is attached.
+};
+
+
+class CMapDecal : public CMapHelper
+{
+ public:
+
+ DECLARE_MAPCLASS(CMapDecal,CMapHelper)
+
+ //
+ // Factory for building from a list of string parameters.
+ //
+ static CMapClass *CreateMapDecal(CHelperInfo *pInfo, CMapEntity *pParent);
+
+ //
+ // Construction/destruction:
+ //
+ CMapDecal(void);
+ CMapDecal(float *pfMins, float *pfMaxs);
+ ~CMapDecal(void);
+
+ void CalcBounds(BOOL bFullUpdate = FALSE);
+
+ virtual CMapClass *Copy(bool bUpdateDependencies);
+ virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
+
+ virtual void OnNotifyDependent(CMapClass *pObject, Notify_Dependent_t eNotifyType);
+ virtual void OnParentKeyChanged(const char* szKey, const char* szValue);
+ virtual void OnPaste(CMapClass *pCopy, CMapWorld *pSourceWorld, CMapWorld *pDestWorld, const CMapObjectList &OriginalList, CMapObjectList &NewList);
+ virtual void OnRemoveFromWorld(CMapWorld *pWorld, bool bNotifyChildren);
+
+ virtual void Render3D(CRender3D *pRender);
+
+ int SerializeRMF(std::fstream &File, BOOL bRMF);
+ int SerializeMAP(std::fstream &File, BOOL bRMF);
+
+ bool IsVisualElement(void) { return(true); }
+
+ const char* GetDescription() { return("Decal helper"); }
+
+ virtual void PostloadWorld(CMapWorld *pWorld);
+
+ void DecalAllSolids(CMapWorld *pWorld);
+
+ bool ShouldRenderLast(void) { return true; }
+
+ protected:
+
+ //
+ // Implements CMapAtom transformation functions.
+ //
+ void DoTransform(const VMatrix &matrix);
+
+ void AddSolid(CMapSolid *pSolid);
+
+ int CanDecalSolid(CMapSolid *pSolid, CMapFace **ppFaces);
+ int DecalSolid(CMapSolid *pSolid);
+
+ void RebuildDecalFaces(void);
+
+ IEditorTexture *m_pTexture; // Pointer to the texture this decal uses.
+ CMapObjectList m_Solids; // List of solids to which we are attached.
+ CUtlVector<DecalFace_t*> m_Faces; // List of decal faces and the solids that they are attached to.
+};
+
+
+#endif // MAPDECAL_H