17 #ifndef CAMERAMOVEMENTLOGIC_H
18 #define CAMERAMOVEMENTLOGIC_H
20 #include <Engine/Logic.h>
168 virtual void init()
override;
173 virtual void update()
override;
218 QRectF getExpandedBBoxOfPlayerActors()
const;
221 float computeFov(
const QRectF& actorsBBox)
const;
222 void boundCameraViewport(
QPointF* lookAt,
float* fov)
const;
223 void fillCameraViewport(
QPointF* lookAt,
float* fov)
const;
226 Camera* mCamera =
nullptr;
227 float mMinFov = 16.0f;
228 float mXPullFactor = 0.08f;
229 float mYPullFactor = 0.08f;
230 float mTowedXPullFactor = 0.04f;
231 float mTowedYPullFactor = 0.04f;
232 float mLookaheadScale = 1.0f;
233 float mFovPullFactor = 1.0f;
234 float mXFovBorder = 0.1f;
235 float mYFovBorder = 0.1f;
241 #endif // CAMERAMOVEMENTLOGIC_H
void setXPullFactor(float value)
Sets xPullFactor.
float fovPullFactor
Speed of adjusting to the correct fov width.
Definition: CameraMovementLogic.h:73
void setLookaheadScale(float value)
Sets lookaheadScale.
void setMinFov(float value)
Sets minFov.
float getMinFov() const
Returns minFov.
Definition: CameraMovementLogic.h:87
float getXFovBorder() const
Returns xFovBorder.
Definition: CameraMovementLogic.h:150
void yPullFactorChanged()
Emitted when yPullFactor changes.
void setXFovBorder(float value)
Sets xFovBorder.
float getTowedYPullFactor() const
Returns towedYPullFactor.
Definition: CameraMovementLogic.h:123
float xFovBorder
Extra width added to the bounding box of Actor::PlayerActors.
Definition: CameraMovementLogic.h:77
void setTowedXPullFactor(float value)
Sets towedXPullFactor.
float xPullFactor
Strength of horizontal force that pull the camera to the center of the bounding box.
Definition: CameraMovementLogic.h:47
float getYFovBorder() const
Returns yFovBorder.
Definition: CameraMovementLogic.h:159
float getXPullFactor() const
Returns xPullFactor.
Definition: CameraMovementLogic.h:96
Actor actor
Parent actor that is affected by this Logic's behavior.
Definition: Logic.h:36
void lookaheadScaleChanged()
Emitted when lookaheadScale changes.
void fovPullFactorChanged()
Emitted when fovPullFactor changes.
float getLookaheadScale() const
Returns lookaheadScale.
Definition: CameraMovementLogic.h:132
void setYFovBorder(float value)
Sets yFovBorder.
float minFov
Minimum field of view the Camera will adjust to.
Definition: CameraMovementLogic.h:43
Logic to make the camera follow the bounding box of all Actor::PlayerActors.
Definition: CameraMovementLogic.h:37
virtual void update() override
Updates the parent actor Camera's properties to follow the constraints from the scene.
void towedXPullFactorChanged()
Emitted when towedXPullFactor changes.
Non-visual entities in the QML item tree that define behavior for their parent Actor.
Definition: Logic.h:31
float getFovPullFactor() const
Returns fovPullFactor.
Definition: CameraMovementLogic.h:141
void setYPullFactor(float value)
Sets yPullFactor.
float getTowedXPullFactor() const
Returns towedXPullFactor.
Definition: CameraMovementLogic.h:114
virtual void init() override
Initializes the parent actor Camera with parameters for the current scene.
float towedXPullFactor
Strength of horizontal towing forces that slowly pull the camera to the center of the bounding box...
Definition: CameraMovementLogic.h:57
void xFovBorderChanged()
Emitted when xFovBorder changes.
float lookaheadScale
Extra distance that the camera leads the PlayerActors.
Definition: CameraMovementLogic.h:68
void towedYPullFactorChanged()
Emitted when towedYPullFactor changes.
Representation of an entity within the Game scene.
Definition: Actor.h:40
float towedYPullFactor
Strength of vertical towing forces that slowly pull the camera to the center of the bounding box...
Definition: CameraMovementLogic.h:63
void setTowedYPullFactor(float value)
Sets towedYPullFactor.
QQuickItem which represents the Camera into the game world.
Definition: Camera.h:42
void setFovPullFactor(float value)
Sets fovPullFactor.
void minFovChanged()
Emitted when minFov changes.
float yFovBorder
Extra height added to the bounding box of Actor::PlayerActors.
Definition: CameraMovementLogic.h:81
void yFovBorderChanged()
Emitted when yFovBorder changes.
void xPullFactorChanged()
Emitted when xPullFactor changes.
float getYPullFactor() const
Returns yPullFactor.
Definition: CameraMovementLogic.h:105
float yPullFactor
Strength of vertical force that pull the camera to the center of the bounding box.
Definition: CameraMovementLogic.h:51