BsSamplerOverrides.h 1.9 KB

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