| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #pragma once
- #include "BsEditorPrerequisites.h"
- #include "BsHandleSlider.h"
- #include "BsCapsule.h"
- #include "BsSphere.h"
- namespace BansheeEngine
- {
- /**
- * @brief Handle slider that returns a delta value as you drag the pointer
- * along a line. For intersection purposes the line is internally
- * by a capsule and a sphere at its cap (assuming we'll use this for
- * arrow-like handles).
- */
- class BS_ED_EXPORT HandleSliderLine : public HandleSlider
- {
- public:
- /**
- * @brief Constructs a new line slider.
- *
- * @param direction Direction of the line.
- * @param length Length of the slider (i.e. the line).
- * @param fixedScale If true the handle slider will always try to maintain the same visible
- * area in the viewport regardless of distance from camera.
- */
- HandleSliderLine(const Vector3& direction, float length, bool fixedScale);
- ~HandleSliderLine();
- /**
- * @copydoc HandleSlider::intersects
- */
- bool intersects(const Ray& ray, float& t) const override;
- /**
- * @copydoc HandleSlider::handleInput
- */
- void handleInput(const CameraHandlerPtr& camera, const Vector2I& inputDelta) override;
- /**
- * @brief Returns a delta value that is the result of dragging/sliding the pointer
- * along the line. This changes every frame and will be zero unless the slider is active.
- */
- float getDelta() const { return mDelta; }
- protected:
- /**
- * @copydoc HandleSlider::activate
- */
- void activate(const CameraHandlerPtr& camera, const Vector2I& pointerPos) override { mStartPosition = getPosition(); }
- /**
- * @copydoc HandleSlider::reset
- */
- void reset() override { mDelta = 0.0f; }
- static const float CAPSULE_RADIUS;
- static const float SPHERE_RADIUS;
- Vector3 mDirection;
- float mLength;
- float mDelta;
- Vector3 mStartPosition;
- Capsule mCapsuleCollider;
- Sphere mSphereCollider;
- };
- }
|