BsReflectionProbeSampling.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_ENTRY(float, gSkyBrightness)
  44. BS_PARAM_BLOCK_END
  45. extern ReflProbeParamsParamDef gReflProbeParamsParamDef;
  46. /** Renderer information specific to a single reflection probe. */
  47. class RendererReflectionProbe
  48. {
  49. public:
  50. RendererReflectionProbe(ReflectionProbe* probe);
  51. /** Populates the structure with reflection probe parameters. */
  52. void getParameters(ReflProbeData& output) const;
  53. ReflectionProbe* probe;
  54. UINT32 arrayIdx;
  55. SPtr<Texture> texture;
  56. bool customTexture : 1;
  57. bool textureDirty : 1;
  58. bool arrayDirty : 1;
  59. bool errorFlagged : 1;
  60. };
  61. /** @} */
  62. }}