BsHandleSliderPlane.cpp 994 B

123456789101112131415161718192021222324252627282930313233
  1. #include "BsHandleSliderPlane.h"
  2. #include "BsHandleManager.h"
  3. #include "BsRect3.h"
  4. #include "BsVector3.h"
  5. namespace BansheeEngine
  6. {
  7. HandleSliderPlane::HandleSliderPlane(const Vector3& dir1, const Vector3& dir2, float length, float snapValue, bool fixedScale)
  8. :HandleSlider(fixedScale, snapValue), mLength(length)
  9. {
  10. mDirection1 = Vector3::normalize(dir1);
  11. mDirection2 = Vector3::normalize(dir2);
  12. std::array<Vector3, 2> axes = { mDirection1, mDirection2 };
  13. std::array<float, 2> extents = { length, length };
  14. Rect3 collider(Vector3::ZERO, axes, extents);
  15. HandleManager::instance()._registerRectCollider(collider, this);
  16. }
  17. HandleSliderPlane::~HandleSliderPlane()
  18. {
  19. HandleManager::instance()._unregisterSlider(this);
  20. }
  21. Vector3 HandleSliderPlane::updateDelta(const Vector3& oldValue) const
  22. {
  23. return oldValue;
  24. // TODO - Don't forget to consider currently active transform (and also custom handle transform)
  25. // - Both position and direction need to consider it
  26. }
  27. }