1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 03:45:32 +00:00

Pointer mode verbiage.

protected member variables for vranimation
This commit is contained in:
Mads Buvik Sandvei 2020-06-25 23:20:38 +02:00
parent d405bcc910
commit 60ffaea195
5 changed files with 19 additions and 17 deletions

View file

@ -247,7 +247,7 @@ void HandController::operator()(osg::Node* node, osg::NodeVisitor* nv)
auto weaponType = world->getActiveWeaponType();
// Morrowind models do not hold most weapons at a natural angle, so i rotate the hand
// to more natural angles on weapons to allow more comfortable combat.
if (!windowManager->isGuiMode() && !animation->isPointingForward())
if (!windowManager->isGuiMode() && !animation->fingerPointingMode())
{
switch (weaponType)
@ -495,8 +495,11 @@ void VRAnimation::updateParts()
Environment::get().getSession()->setPlayerScale(sizeFactor);
}
void VRAnimation::setPointForward(bool enabled)
void VRAnimation::setFingerPointingMode(bool enabled)
{
if (enabled == mFingerPointingMode)
return;
auto finger = mNodeMap.find("bip01 r finger1");
if (finger != mNodeMap.end())
{
@ -524,7 +527,7 @@ void VRAnimation::setPointForward(bool enabled)
mPointerTarget = MWRender::RayResult{};
}
mIsPointingForward = enabled;
mFingerPointingMode = enabled;
}
osg::ref_ptr<osg::Geometry> VRAnimation::createPointerGeometry(void)

View file

@ -53,8 +53,8 @@ public:
virtual void updateParts();
/// Overrides finger animations to point forward
void setPointForward(bool enabled);
bool isPointingForward(void) const { return mIsPointingForward; }
void setFingerPointingMode(bool enabled);
bool fingerPointingMode() const { return mFingerPointingMode; }
bool canPlaceObject();
///< @return true if it is possible to place on object where the player is currently pointing
@ -73,14 +73,14 @@ protected:
float getVelocity(const std::string& groupname) const override;
public:
protected:
std::shared_ptr<VRSession> mSession;
osg::ref_ptr<ForearmController> mForearmControllers[2];
osg::ref_ptr<HandController> mHandControllers[2];
osg::ref_ptr<FingerController> mIndexFingerControllers[2];
osg::ref_ptr<osg::MatrixTransform> mModelOffset;
bool mIsPointingForward{ false };
bool mFingerPointingMode{ false };
osg::ref_ptr<osg::Geometry> mPointerGeometry{ nullptr };
osg::ref_ptr<osg::MatrixTransform> mPointerRescale{ nullptr };
osg::ref_ptr<osg::MatrixTransform> mPointerTransform{ nullptr };

View file

@ -714,10 +714,10 @@ void VRGUIManager::updateTracking(osg::Camera* camera)
bool VRGUIManager::updateFocus()
{
auto* anim = MWVR::Environment::get().getPlayerAnimation();
if (anim && anim->mPointerTarget.mHit)
if (anim && anim->getPointerTarget().mHit)
{
std::shared_ptr<VRGUILayer> newFocusLayer = nullptr;
auto* node = anim->mPointerTarget.mHitNode;
auto* node = anim->getPointerTarget().mHitNode;
if (node->getName() == "VRGUILayer")
{
VRGUILayerUserData* userData = static_cast<VRGUILayerUserData*>(node->getUserData());
@ -727,7 +727,7 @@ bool VRGUIManager::updateFocus()
if (newFocusLayer && newFocusLayer->mLayerName != "Notification")
{
setFocusLayer(newFocusLayer.get());
computeGuiCursor(anim->mPointerTarget.mHitPointLocal);
computeGuiCursor(anim->getPointerTarget().mHitPointLocal);
return true;
}
}

View file

@ -48,8 +48,7 @@ void OpenXRInputManager::updateActivationIndication(void)
bool show = guiMode | mActivationIndication;
auto* playerAnimation = Environment::get().getPlayerAnimation();
if (playerAnimation)
if (show != playerAnimation->isPointingForward())
playerAnimation->setPointForward(show);
playerAnimation->setFingerPointingMode(show);
}
@ -91,10 +90,10 @@ void OpenXRInputManager::pointActivation(bool onPress)
{
auto* world = MWBase::Environment::get().getWorld();
auto* anim = MWVR::Environment::get().getPlayerAnimation();
if (world && anim && anim->mPointerTarget.mHit)
if (world && anim && anim->getPointerTarget().mHit)
{
auto* node = anim->mPointerTarget.mHitNode;
MWWorld::Ptr ptr = anim->mPointerTarget.mHitObject;
auto* node = anim->getPointerTarget().mHitNode;
MWWorld::Ptr ptr = anim->getPointerTarget().mHitObject;
auto& dnd = MWBase::Environment::get().getWindowManager()->getDragAndDrop();
if (node && node->getName() == "VRGUILayer")

View file

@ -1127,8 +1127,8 @@ namespace MWWorld
// TODO: Rename this method to getTargetObject?
// "getFacedObject" doesn't make sense with finger pointing.
auto* anim = MWVR::Environment::get().getPlayerAnimation();
if (anim && anim->mPointerTarget.mHit)
return anim->mPointerTarget.mHitObject;
if (anim && anim->getPointerTarget().mHit)
return anim->getPointerTarget().mHitObject;
else
return MWWorld::Ptr();
#endif