BsSamplerOverrides.h 2.2 KB

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