15#include <unordered_map>
57 css::uno::Reference<css::drawing::XShape>
mxShape;
116 void setShapePosition(
const css::uno::Reference<css::drawing::XShape> xShape,
117 const ::basegfx::B2DPoint& rOutPos);
134 const ::basegfx::B2DPoint& rOutPos,
135 const double fPassedTime);
159 void setShapeAngle(
const css::uno::Reference<com::sun::star::drawing::XShape> xShape,
160 const double fAngle);
178 const css::uno::Reference<com::sun::star::drawing::XShape> xShape,
const double fAngle,
179 const double fPassedTime);
190 const double fAngularVelocity);
203 void setShapeCollision(
const css::uno::Reference<com::sun::star::drawing::XShape> xShape,
204 const bool bCanCollide);
221 void step(
const float fTimeStep = 1.0f / 100.0f,
const int nVelocityIterations = 6,
222 const int nPositionIterations = 2);
227 const double fAngle);
232 const double fAngularVelocity,
const int nDelayForSteps = 0);
236 const bool bVisibility);
239 const ::basegfx::B2DPoint& rOutPos);
242 box2DWorld(const ::basegfx::B2DVector& rSlideSize);
257 double stepAmount(
const double fPassedTime,
const float fTimeStep = 1.0f / 100.0f,
258 const int nVelocityIterations = 6,
const int nPositionIterations = 2);
286 const double fDensity,
const double fBounciness);
306 const float fDensity = 1.0f,
const float fFriction = 0.3f);
320 const ::basegfx::B2DPoint& rOutPos);
324 const ::basegfx::B2DVector& rVelocity,
325 const int nDelayForSteps = 0);
332 const bool bIsFirstUpdate);
336 const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
338 const bool bIsFirstUpdate);
374 box2DBody(std::shared_ptr<b2Body> pBox2DBody,
double fScaleFactor);
398 const double fPassedTime);
Class that manages a single box2D Body.
void setPosition(const ::basegfx::B2DPoint &rPos)
Set the position of box2d body.
std::shared_ptr< b2Body > mpBox2DBody
Pointer to the body that this class manages.
void setAngularVelocity(const double fAngularVelocity)
Sets angular velocity of the body.
void setCollision(const bool bCanCollide)
Sets whether the body have collisions or not.
void setPositionByLinearVelocity(const ::basegfx::B2DPoint &rDesiredPos, const double fPassedTime)
Moves body to the specified position.
box2DBodyType getType() const
box2DBody(std::shared_ptr< b2Body > pBox2DBody, double fScaleFactor)
void setAngle(const double fAngle)
Set angle of the box2d body.
void setLinearVelocity(const ::basegfx::B2DVector &rVelocity)
Sets linear velocity of the body.
void setType(box2DBodyType eType)
Set type of the body.
::basegfx::B2DPoint getPosition() const
double mfScaleFactor
Scale factor for conversions between LO user space coordinates to Box2D World coordinates.
void setRestitution(const double fRestitution)
Set restitution of the box2d body.
void setDensityAndRestitution(const double fDensity, const double fRestitution)
Set density and restitution of the box2d body.
void setAngleByAngularVelocity(const double fDesiredAngle, const double fPassedTime)
Rotate body to specified angle of rotation.
Class that manages the Box2D World.
void queueDynamicRotationUpdate(const css::uno::Reference< com::sun::star::drawing::XShape > &xShape, const double fAngle)
Queue a rotation update that is simulated as if shape's corresponding box2D body rotated to given ang...
double mfScaleFactor
Scale factor for conversions between LO user space coordinates to Box2D World coordinates.
void setShapeAngularVelocity(const css::uno::Reference< com::sun::star::drawing::XShape > xShape, const double fAngularVelocity)
Sets angular velocity of the shape's corresponding Box2D body.
void queueShapePositionUpdate(const css::uno::Reference< css::drawing::XShape > &xShape, const ::basegfx::B2DPoint &rOutPos)
void initiateAllShapesAsStaticBodies(const slideshow::internal::ShapeManagerSharedPtr &pShapeManager)
Initiate all the shapes in the current slide in the box2DWorld as static ones.
Box2DBodySharedPtr makeShapeStatic(const slideshow::internal::ShapeSharedPtr &pShape)
Make the Box2D body corresponding to the given shape a static one.
void queueShapeAnimationUpdate(const css::uno::Reference< css::drawing::XShape > &xShape, const slideshow::internal::ShapeAttributeLayerSharedPtr &pAttrLayer, const slideshow::internal::AttributeType eAttrType, const bool bIsFirstUpdate)
Queue an appropriate update for the animation effect that is in parallel with a physics animation.
void queueShapeAnimationEndUpdate(const css::uno::Reference< css::drawing::XShape > &xShape, const slideshow::internal::AttributeType eAttrType)
Queue an appropriate update for the animation effect that just ended.
bool mbAlreadyStepped
Flag used to stop overstepping that occurs when a physics animation effect transfers step-lock to ano...
void setHasWorldStepper(const bool bHasWorldStepper)
Set the flag for whether the box2DWorld has a stepper or not.
void setShapeCollision(const css::uno::Reference< com::sun::star::drawing::XShape > xShape, const bool bCanCollide)
Sets whether a shape's corresponding Box2D body has collision in the Box2D World or not.
std::queue< Box2DDynamicUpdateInformation > maShapeParallelUpdateQueue
Queue that holds any required information to keep LO animation effects and Box2DWorld in sync.
void queueShapeVisibilityUpdate(const css::uno::Reference< css::drawing::XShape > &xShape, const bool bVisibility)
Queue an collision update that sets the collision of shape's corresponding box2D body when processed.
void setShapePositionByLinearVelocity(const css::uno::Reference< css::drawing::XShape > xShape, const ::basegfx::B2DPoint &rOutPos, const double fPassedTime)
Moves shape's corresponding Box2D body to specified position.
void queueLinearVelocityUpdate(const css::uno::Reference< css::drawing::XShape > &xShape, const ::basegfx::B2DVector &rVelocity, const int nDelayForSteps=0)
Queue a update that sets the corresponding box2D body's linear velocity to the given value when proce...
void alertPhysicsAnimationStart(const ::basegfx::B2DVector &rSlideSize, const slideshow::internal::ShapeManagerSharedPtr &pShapeManager)
Alert that a physics animation effect has started.
box2DWorld(const ::basegfx::B2DVector &rSlideSize)
void setShapePosition(const css::uno::Reference< css::drawing::XShape > xShape, const ::basegfx::B2DPoint &rOutPos)
Sets shape's corresponding Box2D body to the specified position.
void alertPhysicsAnimationEnd(const slideshow::internal::ShapeSharedPtr &pShape)
Alert that a physics animation effect has ended.
void step(const float fTimeStep=1.0f/100.0f, const int nVelocityIterations=6, const int nPositionIterations=2)
Simulate and step through time in the Box2D World.
void queueDynamicPositionUpdate(const css::uno::Reference< css::drawing::XShape > &xShape, const ::basegfx::B2DPoint &rOutPos)
Queue a position update that is simulated as if shape's corresponding box2D body moved to given posit...
double stepAmount(const double fPassedTime, const float fTimeStep=1.0f/100.0f, const int nVelocityIterations=6, const int nPositionIterations=2)
Simulate and step through a given amount of time in the Box2D World.
int mnPhysicsAnimationCounter
Number of Physics Animations going on.
bool isInitialized() const
void queueAngularVelocityUpdate(const css::uno::Reference< com::sun::star::drawing::XShape > &xShape, const double fAngularVelocity, const int nDelayForSteps=0)
Queue an angular velocity update that sets the shape's corresponding box2D body angular velocity to t...
void processUpdateQueue(const double fPassedTime)
Process the updates queued in the maShapeParallelUpdateQueue.
void setShapeLinearVelocity(const css::uno::Reference< com::sun::star::drawing::XShape > xShape, const basegfx::B2DVector &rVelocity)
Sets linear velocity of the shape's corresponding Box2D body.
bool initiateWorld(const ::basegfx::B2DVector &rSlideSize)
bool hasWorldStepper() const
Box2DBodySharedPtr createStaticBody(const slideshow::internal::ShapeSharedPtr &rShape, const float fDensity=1.0f, const float fFriction=0.3f)
Create a static body that is represented by the shape's geometry.
bool mbHasWorldStepper
Holds whether or not there is a PhysicsAnimation that is stepping the Box2D World.
std::unique_ptr< b2World > mpBox2DWorld
Pointer to the real Box2D World that this class manages.
void createStaticFrameAroundSlide(const ::basegfx::B2DVector &rSlideSize)
Creates a static frame in Box2D world that corresponds to the slide borders.
Box2DBodySharedPtr makeShapeDynamic(const css::uno::Reference< css::drawing::XShape > &xShape, const basegfx::B2DVector &rStartVelocity, const double fDensity, const double fBounciness)
Make the shape's corresponding box2D body a dynamic one.
void setShapeAngleByAngularVelocity(const css::uno::Reference< com::sun::star::drawing::XShape > xShape, const double fAngle, const double fPassedTime)
Rotates shape's corresponding Box2D body to specified angle.
void setShapeAngle(const css::uno::Reference< com::sun::star::drawing::XShape > xShape, const double fAngle)
Sets rotation angle of the shape's corresponding Box2D body.
void queueShapePathAnimationUpdate(const css::uno::Reference< com::sun::star::drawing::XShape > &xShape, const slideshow::internal::ShapeAttributeLayerSharedPtr &pAttrLayer, const bool bIsFirstUpdate)
Queue an appropriate update for a path animation that is in parallel with a physics animation.
std::unordered_map< css::uno::Reference< css::drawing::XShape >, Box2DBodySharedPtr > mpXShapeToBodyMap
Box2DBodySharedPtr makeBodyStatic(const Box2DBodySharedPtr &pBox2DBody)
Make the Box2D body a static one.
Box2DBodySharedPtr makeBodyDynamic(const Box2DBodySharedPtr &pBox2DBody)
Make the Box2D body a dynamic one.
std::shared_ptr< box2DBody > Box2DBodySharedPtr
::std::shared_ptr< box2DWorld > Box2DWorldSharedPtr
box2DNonsimulatedShapeUpdateType
@ BOX2D_UPDATE_LINEAR_VELOCITY
@ BOX2D_UPDATE_POSITION_CHANGE
@ BOX2D_UPDATE_VISIBILITY
@ BOX2D_UPDATE_ANGULAR_VELOCITY
::std::shared_ptr< ShapeAttributeLayer > ShapeAttributeLayerSharedPtr
AttributeType
Type of to-be-animated attribute.
std::shared_ptr< ShapeManager > ShapeManagerSharedPtr
::std::shared_ptr< Shape > ShapeSharedPtr