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.

71 lines
1.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef IINCREMENTAL_H
  8. #define IINCREMENTAL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "mathlib/vector.h"
  13. #include "utlvector.h"
  14. typedef unsigned short IncrementalLightID;
  15. // Incremental lighting manager.
  16. class IIncremental
  17. {
  18. // IIncremental overrides.
  19. public:
  20. virtual ~IIncremental() {}
  21. // Sets up for incremental mode. The BSP file (in bsplib) should be loaded
  22. // already so it can detect if the incremental file is up to date.
  23. virtual bool Init( char const *pBSPFilename, char const *pIncrementalFilename ) = 0;
  24. // Prepare to light. You must call Init once, but then you can
  25. // do as many Prepare/AddLight/Finalize phases as you want.
  26. virtual bool PrepareForLighting() = 0;
  27. // Called every time light is added to a face.
  28. // NOTE: This is the ONLY threadsafe function in IIncremental.
  29. virtual void AddLightToFace(
  30. IncrementalLightID lightID,
  31. int iFace,
  32. int iSample,
  33. int lmSize,
  34. float dot,
  35. int iThread ) = 0;
  36. // Called when it's done applying light from the specified light to the specified face.
  37. virtual void FinishFace (
  38. IncrementalLightID lightID,
  39. int iFace,
  40. int iThread ) = 0;
  41. // For each face that was changed during the lighting process, save out
  42. // new data for it in the incremental file.
  43. // Returns false if the incremental lighting isn't active.
  44. virtual bool Finalize() = 0;
  45. // Grows touched to a size of 'numfaces' and sets each byte to 0 or 1 telling
  46. // if the face's lightmap was updated in Finalize.
  47. virtual void GetFacesTouched( CUtlVector<unsigned char> &touched ) = 0;
  48. // This saves the .r0 file and updates the lighting in the BSP file.
  49. virtual bool Serialize() = 0;
  50. };
  51. extern IIncremental* GetIncremental();
  52. #endif // IINCREMENTAL_H