diff options
Diffstat (limited to 'engine/decal_clip.h')
| -rw-r--r-- | engine/decal_clip.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/engine/decal_clip.h b/engine/decal_clip.h new file mode 100644 index 0000000..095634c --- /dev/null +++ b/engine/decal_clip.h @@ -0,0 +1,73 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef DECAL_CLIP_H +#define DECAL_CLIP_H +#ifdef _WIN32 +#pragma once +#endif + + +#include "mathlib/vector.h" +#include "mathlib/vector2d.h" +#include "mathlib/compressed_vector.h" +#include "materialsystem/imaterialsystem.h" +#include "materialsystem/imaterial.h" +#include "filesystem.h" +#include "decal_private.h" +#include "gl_model_private.h" + + +#define MAX_DECALCLIPVERT 48 + + +class CDecalVert +{ +public: + Vector m_vPos; + int m_decalIndex; // used by the cache code + + // These are the texcoords for the decal itself + Vector2D m_ctCoords; + // Lightmap texcoords for the decal. + Vector2D m_cLMCoords; +}; + + +// Clip pOutVerts/nStartVerts into the decal's texture space. +CDecalVert* R_DoDecalSHClip( + CDecalVert *pInVerts, + CDecalVert *pOutVerts, + decal_t *pDecal, + int nStartVerts, + const Vector &vecNormal ); + +// Generate clipped vertex list for decal pdecal projected onto polygon psurf +CDecalVert* R_DecalVertsClip( + CDecalVert *pOutVerts, + decal_t *pDecal, + SurfaceHandle_t surfID, + IMaterial *pMaterial ); + +// Compute the unscaled basis for the decal. +void R_DecalComputeBasis( + Vector const& surfaceNormal, + Vector const* pSAxis, + Vector* textureSpaceBasis ); + +// Compute the basis for the decal and scale the axes so the whole decal fits +// into the (0,0) - (1,1) range. +void R_SetupDecalTextureSpaceBasis( + decal_t *pDecal, + Vector &vSurfNormal, + IMaterial *pMaterial, + Vector textureSpaceBasis[3], + float decalWorldScale[2] ); + +extern ALIGN16 CDecalVert g_DecalClipVerts[MAX_DECALCLIPVERT] ALIGN16_POST; + +#endif // DECAL_CLIP_H |