UserMaterialVariableRuntime.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "UserMaterialVariableRuntime.h"
  2. #include "Resources/UserMaterialVariable.h"
  3. //==============================================================================
  4. // ConstructVisitor::operator() <RsrcPtr<Texture> > =
  5. //==============================================================================
  6. template <>
  7. void UserMaterialVariableRuntime::ConstructVisitor::
  8. operator()<RsrcPtr<Texture> >(const RsrcPtr<Texture>& x) const
  9. {
  10. udvr.data = &x;
  11. }
  12. //==============================================================================
  13. // Constructor =
  14. //==============================================================================
  15. UserMaterialVariableRuntime::UserMaterialVariableRuntime(
  16. const UserMaterialVariable& umv_)
  17. : umv(umv_)
  18. {
  19. // Initialize the data using a visitor
  20. boost::apply_visitor(ConstructVisitor(*this), umv.getDataVariant());
  21. }
  22. //==============================================================================
  23. // Destructor =
  24. //==============================================================================
  25. UserMaterialVariableRuntime::~UserMaterialVariableRuntime()
  26. {}
  27. //==============================================================================
  28. // Specialized Accessors =
  29. //==============================================================================
  30. template<>
  31. UserMaterialVariableRuntime::ConstPtrRsrcPtrTexture&
  32. UserMaterialVariableRuntime::getValue<
  33. UserMaterialVariableRuntime::ConstPtrRsrcPtrTexture>()
  34. {
  35. throw EXCEPTION("You shouldn't call this getter");
  36. return boost::get<ConstPtrRsrcPtrTexture>(data);
  37. }
  38. template<>
  39. void UserMaterialVariableRuntime::setValue<
  40. UserMaterialVariableRuntime::ConstPtrRsrcPtrTexture>(
  41. const ConstPtrRsrcPtrTexture& v)
  42. {
  43. throw EXCEPTION("You shouldn't call this setter");
  44. boost::get<ConstPtrRsrcPtrTexture>(data) = v;
  45. }