lightSystem.h 935 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <glm/vec3.hpp>
  3. #include <deque>
  4. //donotupdatelightsystem
  5. //donotoptimizelightsystem
  6. bool constexpr dontUpdateLightSystem = 1;
  7. struct ChunkSystem;
  8. struct Chunk;
  9. struct LightSystem
  10. {
  11. struct Light
  12. {
  13. glm::ivec3 pos = {};
  14. char intensity = 0; //0..15
  15. };
  16. std::deque<Light> sunLigtsToAdd;
  17. std::deque<Light> sunLigtsToRemove;
  18. std::deque<Light> ligtsToAdd;
  19. std::deque<Light> ligtsToRemove;
  20. void update(ChunkSystem &chunkSystem);
  21. void addSunLight(ChunkSystem &chunkSystem, glm::ivec3 pos, char intensity);
  22. void addSunLightAndPropagateDown(ChunkSystem &chunkSystem, glm::ivec3 pos, char intensity);
  23. void removeSunLight(ChunkSystem &chunkSystem, glm::ivec3 pos, char oldVal);
  24. void addLight(ChunkSystem &chunkSystem, glm::ivec3 pos, char intensity);
  25. void removeLight(ChunkSystem &chunkSystem, glm::ivec3 pos, char oldVal);
  26. void setSunlightForAnEntireChunk(Chunk &chunk, ChunkSystem &chunkSystem);
  27. };