box2dtools renaming some for clarity
Change-Id: Idd872213ee3140e82fbd6e8e8bd1ebff78dfdc18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101132 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
committed by
Thorsten Behrens
parent
b33413cc4c
commit
7de41aa023
@@ -323,7 +323,7 @@ namespace slideshow::internal
|
||||
{
|
||||
mpShapeManager->notifyShapeUpdate( mpShape );
|
||||
if ( mpBox2DWorld->isInitialized() )
|
||||
mpBox2DWorld->queuePositionUpdate( mpShape->getXShape(), rOutPos );
|
||||
mpBox2DWorld->queueDynamicPositionUpdate( mpShape->getXShape(), rOutPos );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -205,7 +205,7 @@ box2DWorld::box2DWorld(const ::basegfx::B2DVector& rSlideSize)
|
||||
, mbShapesInitialized(false)
|
||||
, mbHasWorldStepper(false)
|
||||
, mpXShapeToBodyMap()
|
||||
, maShapeUpdateQueue()
|
||||
, maShapeParallelUpdateQueue()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -307,9 +307,9 @@ void box2DWorld::setShapeCollision(
|
||||
|
||||
void box2DWorld::processUpdateQueue(const double fPassedTime)
|
||||
{
|
||||
while (!maShapeUpdateQueue.empty())
|
||||
while (!maShapeParallelUpdateQueue.empty())
|
||||
{
|
||||
Box2DShapeUpdateInformation& aQueueElement = maShapeUpdateQueue.front();
|
||||
Box2DDynamicUpdateInformation& aQueueElement = maShapeParallelUpdateQueue.front();
|
||||
|
||||
if (aQueueElement.mnDelayForSteps > 0)
|
||||
{
|
||||
@@ -340,7 +340,7 @@ void box2DWorld::processUpdateQueue(const double fPassedTime)
|
||||
case BOX2D_UPDATE_ANGULAR_VELOCITY:
|
||||
setShapeAngularVelocity(aQueueElement.mxShape, aQueueElement.mfAngularVelocity);
|
||||
}
|
||||
maShapeUpdateQueue.pop();
|
||||
maShapeParallelUpdateQueue.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,47 +378,47 @@ void box2DWorld::setHasWorldStepper(const bool bHasWorldStepper)
|
||||
mbHasWorldStepper = bHasWorldStepper;
|
||||
}
|
||||
|
||||
void box2DWorld::queuePositionUpdate(
|
||||
void box2DWorld::queueDynamicPositionUpdate(
|
||||
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
|
||||
const basegfx::B2DPoint& rOutPos)
|
||||
{
|
||||
Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_POSITION };
|
||||
Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_POSITION };
|
||||
aQueueElement.maPosition = rOutPos;
|
||||
maShapeUpdateQueue.push(aQueueElement);
|
||||
maShapeParallelUpdateQueue.push(aQueueElement);
|
||||
}
|
||||
|
||||
void box2DWorld::queueLinearVelocityUpdate(
|
||||
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
|
||||
const basegfx::B2DVector& rVelocity)
|
||||
{
|
||||
Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_LINEAR_VELOCITY, 1 };
|
||||
Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_LINEAR_VELOCITY, 1 };
|
||||
aQueueElement.maVelocity = rVelocity;
|
||||
maShapeUpdateQueue.push(aQueueElement);
|
||||
maShapeParallelUpdateQueue.push(aQueueElement);
|
||||
}
|
||||
|
||||
void box2DWorld::queueRotationUpdate(
|
||||
void box2DWorld::queueDynamicRotationUpdate(
|
||||
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape, const double fAngle)
|
||||
{
|
||||
Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_ANGLE };
|
||||
Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_ANGLE };
|
||||
aQueueElement.mfAngle = fAngle;
|
||||
maShapeUpdateQueue.push(aQueueElement);
|
||||
maShapeParallelUpdateQueue.push(aQueueElement);
|
||||
}
|
||||
|
||||
void box2DWorld::queueAngularVelocityUpdate(
|
||||
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
|
||||
const double fAngularVelocity)
|
||||
{
|
||||
Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_ANGULAR_VELOCITY, 1 };
|
||||
Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_ANGULAR_VELOCITY, 1 };
|
||||
aQueueElement.mfAngularVelocity = fAngularVelocity;
|
||||
maShapeUpdateQueue.push(aQueueElement);
|
||||
maShapeParallelUpdateQueue.push(aQueueElement);
|
||||
}
|
||||
|
||||
void box2DWorld::queueShapeVisibilityUpdate(
|
||||
const css::uno::Reference<com::sun::star::drawing::XShape>& xShape, const bool bVisibility)
|
||||
{
|
||||
Box2DShapeUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_VISIBILITY };
|
||||
Box2DDynamicUpdateInformation aQueueElement = { xShape, {}, BOX2D_UPDATE_VISIBILITY };
|
||||
aQueueElement.mbVisibility = bVisibility;
|
||||
maShapeUpdateQueue.push(aQueueElement);
|
||||
maShapeParallelUpdateQueue.push(aQueueElement);
|
||||
}
|
||||
|
||||
void box2DWorld::queueShapeAnimationUpdate(
|
||||
@@ -432,11 +432,11 @@ void box2DWorld::queueShapeAnimationUpdate(
|
||||
queueShapeVisibilityUpdate(xShape, pAttrLayer->getVisibility());
|
||||
return;
|
||||
case slideshow::internal::AttributeType::Rotate:
|
||||
queueRotationUpdate(xShape, pAttrLayer->getRotationAngle());
|
||||
queueDynamicRotationUpdate(xShape, pAttrLayer->getRotationAngle());
|
||||
return;
|
||||
case slideshow::internal::AttributeType::PosX:
|
||||
case slideshow::internal::AttributeType::PosY:
|
||||
queuePositionUpdate(xShape, { pAttrLayer->getPosX(), pAttrLayer->getPosY() });
|
||||
queueDynamicPositionUpdate(xShape, { pAttrLayer->getPosX(), pAttrLayer->getPosY() });
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
|
||||
@@ -50,7 +50,7 @@ enum box2DNonsimulatedShapeUpdateType
|
||||
|
||||
/// Holds required information to perform an update to box2d
|
||||
/// body of a shape that was altered by an animation effect
|
||||
struct Box2DShapeUpdateInformation
|
||||
struct Box2DDynamicUpdateInformation
|
||||
{
|
||||
css::uno::Reference<css::drawing::XShape> mxShape;
|
||||
union {
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
std::unordered_map<css::uno::Reference<css::drawing::XShape>, Box2DBodySharedPtr>
|
||||
mpXShapeToBodyMap;
|
||||
/// Holds any information needed to keep LO animations and Box2D world in sync
|
||||
std::queue<Box2DShapeUpdateInformation> maShapeUpdateQueue;
|
||||
std::queue<Box2DDynamicUpdateInformation> maShapeParallelUpdateQueue;
|
||||
|
||||
/// Creates a static frame in Box2D world that corresponds to the slide borders
|
||||
void createStaticFrameAroundSlide(const ::basegfx::B2DVector& rSlideSize);
|
||||
@@ -157,8 +157,9 @@ private:
|
||||
const int nPositionIterations = 2);
|
||||
|
||||
/// Queue a rotation update on the next step of the box2DWorld for the corresponding body
|
||||
void queueRotationUpdate(const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
|
||||
const double fAngle);
|
||||
void
|
||||
queueDynamicRotationUpdate(const css::uno::Reference<com::sun::star::drawing::XShape>& xShape,
|
||||
const double fAngle);
|
||||
|
||||
/// Queue an angular velocity update for the corresponding body
|
||||
/// to take place after the next step of the box2DWorld
|
||||
@@ -226,8 +227,8 @@ public:
|
||||
void setHasWorldStepper(const bool bHasWorldStepper);
|
||||
|
||||
/// Queue a position update the next step of the box2DWorld for the corresponding body
|
||||
void queuePositionUpdate(const css::uno::Reference<css::drawing::XShape>& xShape,
|
||||
const ::basegfx::B2DPoint& rOutPos);
|
||||
void queueDynamicPositionUpdate(const css::uno::Reference<css::drawing::XShape>& xShape,
|
||||
const ::basegfx::B2DPoint& rOutPos);
|
||||
|
||||
/// Queue a linear velocity update for the corresponding body
|
||||
/// to take place after the next step of the box2DWorld
|
||||
|
||||
Reference in New Issue
Block a user