CmSamplerState.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "CmSamplerState.h"
  2. #include "CmSamplerStateRTTI.h"
  3. #include "CmRenderStateManager.h"
  4. #include "CmRenderSystem.h"
  5. #include "CmException.h"
  6. namespace CamelotEngine
  7. {
  8. void SamplerState::initialize(const SAMPLER_STATE_DESC& desc)
  9. {
  10. mData = desc;
  11. CoreGpuObject::initialize();
  12. }
  13. const SamplerStatePtr& SamplerState::getDefault()
  14. {
  15. return RenderStateManager::instance().getDefaultSamplerState();
  16. }
  17. FilterOptions SamplerState::getTextureFiltering(FilterType ft) const
  18. {
  19. switch (ft)
  20. {
  21. case FT_MIN:
  22. return mData.minFilter;
  23. case FT_MAG:
  24. return mData.magFilter;
  25. case FT_MIP:
  26. return mData.mipFilter;
  27. }
  28. return mData.minFilter;
  29. }
  30. const Color& SamplerState::getBorderColor() const
  31. {
  32. return mData.borderColor;
  33. }
  34. SamplerStatePtr SamplerState::create(const SAMPLER_STATE_DESC& desc)
  35. {
  36. return RenderStateManager::instance().createSamplerState(desc);
  37. }
  38. /************************************************************************/
  39. /* RTTI */
  40. /************************************************************************/
  41. RTTITypeBase* SamplerState::getRTTIStatic()
  42. {
  43. return SamplerStateRTTI::instance();
  44. }
  45. RTTITypeBase* SamplerState::getRTTI() const
  46. {
  47. return SamplerState::getRTTIStatic();
  48. }
  49. }