BsReflectionProbeSampling.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsRenderBeastPrerequisites.h"
  5. #include "BsRendererMaterial.h"
  6. #include "BsParamBlocks.h"
  7. namespace bs { namespace ct
  8. {
  9. /** @addtogroup RenderBeast
  10. * @{
  11. */
  12. /** Information about a single reflection probe, as seen by the lighting shader. */
  13. struct ReflProbeData
  14. {
  15. Vector3 position;
  16. float radius;
  17. Vector3 boxExtents;
  18. Matrix4 invBoxTransform;
  19. float transitionDistance;
  20. UINT32 cubemapIdx;
  21. UINT32 type;
  22. };
  23. /** Contains GPU buffers used by the renderer to manipulate reflection probes. */
  24. class GPUReflProbeData
  25. {
  26. public:
  27. GPUReflProbeData();
  28. /** Updates the internal buffers with a new set of probes. */
  29. void setProbes(const Vector<ReflProbeData>& probeData, UINT32 numProbes);
  30. /** Returns a GPU bindable buffer containing information about every reflection probe. */
  31. SPtr<GpuBuffer> getProbeBuffer() const { return mProbeBuffer; }
  32. /** Returns the number of reflection probes in the probe buffer. */
  33. UINT32 getNumProbes() const { return mNumProbes; }
  34. private:
  35. SPtr<GpuBuffer> mProbeBuffer;
  36. UINT32 mNumProbes;
  37. };
  38. BS_PARAM_BLOCK_BEGIN(ReflProbeParamsParamDef)
  39. BS_PARAM_BLOCK_ENTRY(INT32, gReflCubemapNumMips)
  40. BS_PARAM_BLOCK_ENTRY(INT32, gNumProbes)
  41. BS_PARAM_BLOCK_ENTRY(INT32, gSkyCubemapAvailable)
  42. BS_PARAM_BLOCK_ENTRY(INT32, gSkyCubemapNumMips)
  43. BS_PARAM_BLOCK_END
  44. extern ReflProbeParamsParamDef gReflProbeParamsParamDef;
  45. /** Renderer information specific to a single reflection probe. */
  46. class RendererReflectionProbe
  47. {
  48. public:
  49. RendererReflectionProbe(ReflectionProbe* probe);
  50. /** Populates the structure with reflection probe parameters. */
  51. void getParameters(ReflProbeData& output) const;
  52. ReflectionProbe* probe;
  53. UINT32 arrayIdx;
  54. SPtr<Texture> texture;
  55. bool customTexture : 1;
  56. bool textureDirty : 1;
  57. bool arrayDirty : 1;
  58. bool errorFlagged : 1;
  59. };
  60. /** @} */
  61. }}