BsHandleSliderDisc.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsHandleSlider.h"
  4. #include "BsTorus.h"
  5. namespace BansheeEngine
  6. {
  7. class BS_ED_EXPORT HandleSliderDisc : public HandleSlider
  8. {
  9. public:
  10. HandleSliderDisc(const Vector3& normal, float radius, bool fixedScale);
  11. ~HandleSliderDisc();
  12. bool intersects(const Ray& ray, float& t) const;
  13. void handleInput(const CameraHandlerPtr& camera, const Vector2I& inputDelta);
  14. void setCutoffPlane(Degree angle, bool enabled);
  15. Radian getDelta() const { return mDelta; }
  16. Radian getStartAngle() const { return mStartAngle; }
  17. protected:
  18. void activate(const CameraHandlerPtr& camera, const Vector2I& pointerPos);
  19. void reset() { mDelta = 0.0f; }
  20. Vector3 calculateClosestPointOnArc(const Ray& inputRay, const Vector3& center, const Vector3& up,
  21. float radius, Degree startAngle, Degree angleAmount);
  22. Degree pointOnCircleToAngle(Vector3 up, Vector3 point);
  23. static const float TORUS_RADIUS;
  24. Vector3 mNormal;
  25. float mRadius;
  26. bool mHasCutoffPlane;
  27. Plane mCutoffPlane;
  28. Vector3 mDirection;
  29. Vector3 mStartPosition;
  30. Degree mStartAngle;
  31. Degree mDelta;
  32. Torus mCollider;
  33. };
  34. }