MaterialRuntimeVariable.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "anki/scene/MaterialRuntimeVariable.h"
  2. #include "anki/resource/MaterialVariable.h"
  3. namespace anki {
  4. //==============================================================================
  5. template <>
  6. void MaterialRuntimeVariable::ConstructVisitor::
  7. operator()<TextureResourcePointer >(const TextureResourcePointer& x) const
  8. {
  9. var.data = &x;
  10. }
  11. //==============================================================================
  12. MaterialRuntimeVariable::MaterialRuntimeVariable(
  13. const MaterialVariable& mvar_)
  14. : mvar(mvar_)
  15. {
  16. // Initialize the data using a visitor
  17. boost::apply_visitor(ConstructVisitor(*this), mvar.getVariant());
  18. }
  19. //==============================================================================
  20. MaterialRuntimeVariable::~MaterialRuntimeVariable()
  21. {}
  22. //==============================================================================
  23. // Specialized Accessors =
  24. //==============================================================================
  25. template<>
  26. MaterialRuntimeVariable::ConstPtrRsrcPtrTexture&
  27. MaterialRuntimeVariable::getValue<
  28. MaterialRuntimeVariable::ConstPtrRsrcPtrTexture>()
  29. {
  30. throw ANKI_EXCEPTION("You shouldn't call this getter");
  31. return boost::get<ConstPtrRsrcPtrTexture>(data);
  32. }
  33. template<>
  34. void MaterialRuntimeVariable::setValue<
  35. MaterialRuntimeVariable::ConstPtrRsrcPtrTexture>(
  36. const ConstPtrRsrcPtrTexture& v)
  37. {
  38. throw ANKI_EXCEPTION("You shouldn't call this setter");
  39. boost::get<ConstPtrRsrcPtrTexture>(data) = v;
  40. }
  41. } // end namespace