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.

51 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // The copyright to the contents herein is the property of Valve, L.L.C.
  4. // The contents may be used and/or copied only with the written permission of
  5. // Valve, L.L.C., or in accordance with the terms and conditions stipulated in
  6. // the agreement/contract under which the contents have been supplied.
  7. //
  8. // Purpose:
  9. //
  10. // $Workfile: $
  11. // $Date: $
  12. // $NoKeywords: $
  13. //=============================================================================
  14. #ifndef IMAGEPACKER_H
  15. #define IMAGEPACKER_H
  16. #ifdef _WIN32
  17. #pragma once
  18. #endif
  19. #define MAX_MAX_LIGHTMAP_WIDTH 2048
  20. //-----------------------------------------------------------------------------
  21. // This packs a single lightmap
  22. //-----------------------------------------------------------------------------
  23. class CImagePacker
  24. {
  25. public:
  26. bool Reset( int maxLightmapWidth, int maxLightmapHeight );
  27. bool AddBlock( int width, int height, int *returnX, int *returnY );
  28. protected:
  29. int GetMaxYIndex( int firstX, int width );
  30. int m_MaxLightmapWidth;
  31. int m_MaxLightmapHeight;
  32. int m_pLightmapWavefront[MAX_MAX_LIGHTMAP_WIDTH];
  33. int m_AreaUsed;
  34. int m_MinimumHeight;
  35. // For optimization purposes:
  36. // These store the width + height of the first image
  37. // that was unable to be stored in this image
  38. int m_MaxBlockWidth;
  39. int m_MaxBlockHeight;
  40. };
  41. #endif // IMAGEPACKER_H