BsReflectionCubemap.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. BS_PARAM_BLOCK_BEGIN(ReflectionCubemapFilterParamDef)
  13. BS_PARAM_BLOCK_ENTRY(int, gCubeFace)
  14. BS_PARAM_BLOCK_END
  15. extern ReflectionCubemapFilterParamDef gReflectionCubemapFilterDef;
  16. /** Performs filtering on cubemap faces in order for make them suitable for specular evaluation. */
  17. class ReflectionCubemapFilterMat : public RendererMaterial<ReflectionCubemapFilterMat>
  18. {
  19. RMAT_DEF("ReflectionCubemapFilter.bsl")
  20. public:
  21. ReflectionCubemapFilterMat();
  22. /** Downsamples the provided texture face and outputs it to the provided target. */
  23. void execute(const SPtr<Texture>& source, UINT32 face, const TextureSurface& surface,
  24. const SPtr<RenderTarget>& target);
  25. private:
  26. SPtr<GpuParamBlockBuffer> mParamBuffer;
  27. GpuParamTexture mInputTexture;
  28. };
  29. /** Helper class that handles reflection cubemap generation. */
  30. class ReflectionCubemap
  31. {
  32. public:
  33. /**
  34. * Performs filtering on the cubemap, populating its mip-maps with filtered values that can be used for
  35. * evaluating specular reflections.
  36. */
  37. static void filterCubemapForSpecular(const SPtr<Texture>& cubemap);
  38. };
  39. /** @} */
  40. }}