Team Fortress 2 Source Code as on 22/4/2020
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.

73 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DECAL_CLIP_H
  8. #define DECAL_CLIP_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "mathlib/vector.h"
  13. #include "mathlib/vector2d.h"
  14. #include "mathlib/compressed_vector.h"
  15. #include "materialsystem/imaterialsystem.h"
  16. #include "materialsystem/imaterial.h"
  17. #include "filesystem.h"
  18. #include "decal_private.h"
  19. #include "gl_model_private.h"
  20. #define MAX_DECALCLIPVERT 48
  21. class CDecalVert
  22. {
  23. public:
  24. Vector m_vPos;
  25. int m_decalIndex; // used by the cache code
  26. // These are the texcoords for the decal itself
  27. Vector2D m_ctCoords;
  28. // Lightmap texcoords for the decal.
  29. Vector2D m_cLMCoords;
  30. };
  31. // Clip pOutVerts/nStartVerts into the decal's texture space.
  32. CDecalVert* R_DoDecalSHClip(
  33. CDecalVert *pInVerts,
  34. CDecalVert *pOutVerts,
  35. decal_t *pDecal,
  36. int nStartVerts,
  37. const Vector &vecNormal );
  38. // Generate clipped vertex list for decal pdecal projected onto polygon psurf
  39. CDecalVert* R_DecalVertsClip(
  40. CDecalVert *pOutVerts,
  41. decal_t *pDecal,
  42. SurfaceHandle_t surfID,
  43. IMaterial *pMaterial );
  44. // Compute the unscaled basis for the decal.
  45. void R_DecalComputeBasis(
  46. Vector const& surfaceNormal,
  47. Vector const* pSAxis,
  48. Vector* textureSpaceBasis );
  49. // Compute the basis for the decal and scale the axes so the whole decal fits
  50. // into the (0,0) - (1,1) range.
  51. void R_SetupDecalTextureSpaceBasis(
  52. decal_t *pDecal,
  53. Vector &vSurfNormal,
  54. IMaterial *pMaterial,
  55. Vector textureSpaceBasis[3],
  56. float decalWorldScale[2] );
  57. extern ALIGN16 CDecalVert g_DecalClipVerts[MAX_DECALCLIPVERT] ALIGN16_POST;
  58. #endif // DECAL_CLIP_H