BsSamplerOverrides.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Contains data about an overridden sampler states for a single pass stage.
  9. */
  10. struct StageSamplerOverrides
  11. {
  12. SPtr<SamplerStateCore>* stateOverrides;
  13. UINT32 numStates;
  14. };
  15. /**
  16. * @brief Contains data about an overridden sampler states for a single pass.
  17. */
  18. struct PassSamplerOverrides
  19. {
  20. StageSamplerOverrides* stages;
  21. UINT32 numStages;
  22. };
  23. /**
  24. * @brief Contains data about an overridden sampler states in the entire material.
  25. */
  26. struct MaterialSamplerOverrides
  27. {
  28. PassSamplerOverrides* passes;
  29. UINT32 numPasses;
  30. UINT32 refCount;
  31. };
  32. /**
  33. * @brief Helper class for generating sampler overrides.
  34. */
  35. class BS_BSRND_EXPORT SamplerOverrideUtility
  36. {
  37. public:
  38. /**
  39. * @brief Generates a set of sampler overrides for the specified material. Overrides are
  40. * generates according to the provided render options.
  41. */
  42. static MaterialSamplerOverrides* generateSamplerOverrides(const SPtr<MaterialCore>& material, const SPtr<RenderBeastOptions>& options);
  43. /**
  44. * @brief Destroys sampler overrides previously generated with ::generateSamplerOverrides.
  45. */
  46. static void destroySamplerOverrides(MaterialSamplerOverrides* overrides);
  47. /**
  48. * @brief Checks if the provided sampler state requires an override, in case the render options have
  49. * requirements not fulfilled by current sampler state (e.g. filtering type).
  50. */
  51. static bool checkNeedsOverride(const SPtr<SamplerStateCore>& samplerState, const SPtr<RenderBeastOptions>& options);
  52. /**
  53. * @brief Generates a new sampler state override using the provided state as the basis. Overridden properties
  54. * are taken from the provided render options.
  55. */
  56. static SPtr<SamplerStateCore> generateSamplerOverride(const SPtr<SamplerStateCore>& samplerState, const SPtr<RenderBeastOptions>& options);
  57. };
  58. }