From ba0e3c3c6485fefbe273b6fa8f9121850166b2cc Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 10 Apr 2012 18:20:21 -0700 Subject: Adding the display of the temporary start/end path character on hover state. --- autobuild.xml | 12 +-- indra/newview/llpathfindingpathtool.cpp | 160 ++++++++++++++++++++++---------- indra/newview/llpathfindingpathtool.h | 28 ++++-- 3 files changed, 140 insertions(+), 60 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index e4121f496d..ea2081840f 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1110,9 +1110,9 @@ archive hash - db1b0bc66cd36cea75c02c663ed148cd + 686643e33355a9611802c0ffce84ca1c url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/253482/arch/Darwin/installer/llphysicsextensions-0.1-darwin-20120410.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/253564/arch/Darwin/installer/llphysicsextensions-0.1-darwin-20120410.tar.bz2 name darwin @@ -1122,9 +1122,9 @@ archive hash - dd17cda94c7006a7caf6dd211c25716c + 1af88d80dfedce9ec3dd8dd7430ee8b5 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/253482/arch/Linux/installer/llphysicsextensions-0.1-linux-20120410.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/253564/arch/Linux/installer/llphysicsextensions-0.1-linux-20120411.tar.bz2 name linux @@ -1134,9 +1134,9 @@ archive hash - 989cf12383f055d5c79f1defa7ec851c + d475ff10ae25e90d053acdd3db41d99e url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/253482/arch/CYGWIN/installer/llphysicsextensions-0.1-windows-20120410.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/stinson_llpathinglibrary/rev/253564/arch/CYGWIN/installer/llphysicsextensions-0.1-windows-20120410.tar.bz2 name windows diff --git a/indra/newview/llpathfindingpathtool.cpp b/indra/newview/llpathfindingpathtool.cpp index 3301fe7721..594682c530 100644 --- a/indra/newview/llpathfindingpathtool.cpp +++ b/indra/newview/llpathfindingpathtool.cpp @@ -44,12 +44,7 @@ LLPathfindingPathTool::LLPathfindingPathTool() LLSingleton(), mFinalPathData(), mTempPathData(), - mPathResult(LLPathingLib::LLPL_PATH_NOT_GENERATED), - mHasFinalStartPoint(false), - mHasFinalEndPoint(false), - mHasTempStartPoint(false), - mHasTempEndPoint(false), - mCharacterWidth(1.0f), + mPathResult(LLPathingLib::LLPL_NO_PATH), mCharacterType(kCharacterTypeNone), mPathEventSignal() { @@ -58,7 +53,7 @@ LLPathfindingPathTool::LLPathfindingPathTool() LLPathingLib::initSystem(); } - setCharacterWidth(mCharacterWidth); + setCharacterWidth(1.0f); setCharacterType(mCharacterType); } @@ -77,17 +72,13 @@ BOOL LLPathfindingPathTool::handleMouseDown(S32 pX, S32 pY, MASK pMask) LLVector3 rayStart = mousePos; LLVector3 rayEnd = mousePos + dv * 150; - if (isStartPathToolModKeys(pMask)) + if (isPointAModKeys(pMask)) { - mFinalPathData.mStartPointA = rayStart; - mFinalPathData.mEndPointA = rayEnd; - mHasFinalStartPoint = true; + setFinalA(rayStart, rayEnd); } - else if (isEndPathToolModKeys(pMask)) + else if (isPointBModKeys(pMask)) { - mFinalPathData.mStartPointB = rayStart; - mFinalPathData.mEndPointB = rayEnd; - mHasFinalEndPoint = true; + setFinalB(rayStart, rayEnd); } computeFinalPath(); @@ -110,23 +101,21 @@ BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) LLVector3 rayStart = mousePos; LLVector3 rayEnd = mousePos + dv * 150; - if (isStartPathToolModKeys(pMask)) + if (isPointAModKeys(pMask)) { - mTempPathData.mStartPointA = rayStart; - mTempPathData.mEndPointA = rayEnd; - mHasTempStartPoint = true; - mTempPathData.mStartPointB = mFinalPathData.mStartPointB; - mTempPathData.mEndPointB = mFinalPathData.mEndPointB; - mHasTempEndPoint = mHasFinalEndPoint; - } - else if (isEndPathToolModKeys(pMask)) + setTempA(rayStart, rayEnd); + if (hasFinalB()) + { + setTempB(getFinalBStart(), getFinalBEnd()); + } + } + else if (isPointBModKeys(pMask)) { - mTempPathData.mStartPointB = rayStart; - mTempPathData.mEndPointB = rayEnd; - mHasTempEndPoint = true; - mTempPathData.mStartPointA = mFinalPathData.mStartPointA; - mTempPathData.mEndPointA = mFinalPathData.mEndPointA; - mHasTempStartPoint = mHasFinalStartPoint; + if (hasFinalA()) + { + setTempA(getFinalAStart(), getFinalAEnd()); + } + setTempB(rayStart, rayEnd); } computeTempPath(); @@ -134,8 +123,7 @@ BOOL LLPathfindingPathTool::handleHover(S32 pX, S32 pY, MASK pMask) } else { - mHasTempStartPoint = false; - mHasTempEndPoint = false; + clearTemp(); computeFinalPath(); } @@ -154,15 +142,15 @@ LLPathfindingPathTool::EPathStatus LLPathfindingPathTool::getPathStatus() const { status = kPathStatusNotEnabled; } - else if (!mHasFinalStartPoint && !mHasFinalEndPoint) + else if (!hasFinalA() && !hasFinalB()) { status = kPathStatusChooseStartAndEndPoints; } - else if (!mHasFinalStartPoint) + else if (!hasFinalA()) { status = kPathStatusChooseStartPoint; } - else if (!mHasFinalEndPoint) + else if (!hasFinalB()) { status = kPathStatusChooseEndPoint; } @@ -184,12 +172,11 @@ LLPathfindingPathTool::EPathStatus LLPathfindingPathTool::getPathStatus() const F32 LLPathfindingPathTool::getCharacterWidth() const { - return mCharacterWidth; + return mFinalPathData.mCharacterWidth; } void LLPathfindingPathTool::setCharacterWidth(F32 pCharacterWidth) { - mCharacterWidth = pCharacterWidth; mFinalPathData.mCharacterWidth = pCharacterWidth; mTempPathData.mCharacterWidth = pCharacterWidth; computeFinalPath(); @@ -236,15 +223,13 @@ void LLPathfindingPathTool::setCharacterType(ECharacterType pCharacterType) bool LLPathfindingPathTool::isRenderPath() const { - return (mHasFinalStartPoint && mHasFinalEndPoint) || (mHasTempStartPoint && mHasTempEndPoint); + return (hasFinalA() || hasFinalB() || hasTempA() || hasTempB()); } void LLPathfindingPathTool::clearPath() { - mHasFinalStartPoint = false; - mHasFinalEndPoint = false; - mHasTempStartPoint = false; - mHasTempEndPoint = false; + clearFinal(); + clearTemp(); computeFinalPath(); } @@ -258,20 +243,100 @@ bool LLPathfindingPathTool::isAnyPathToolModKeys(MASK pMask) const return ((pMask & (MASK_CONTROL|MASK_SHIFT)) != 0); } -bool LLPathfindingPathTool::isStartPathToolModKeys(MASK pMask) const +bool LLPathfindingPathTool::isPointAModKeys(MASK pMask) const { return ((pMask & MASK_CONTROL) != 0); } -bool LLPathfindingPathTool::isEndPathToolModKeys(MASK pMask) const +bool LLPathfindingPathTool::isPointBModKeys(MASK pMask) const { return ((pMask & MASK_SHIFT) != 0); } +void LLPathfindingPathTool::setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint) +{ + mFinalPathData.mStartPointA = pStartPoint; + mFinalPathData.mEndPointA = pEndPoint; + mFinalPathData.mHasPointA = true; +} + +bool LLPathfindingPathTool::hasFinalA() const +{ + return mFinalPathData.mHasPointA; +} + +const LLVector3 &LLPathfindingPathTool::getFinalAStart() const +{ + return mFinalPathData.mStartPointA; +} + +const LLVector3 &LLPathfindingPathTool::getFinalAEnd() const +{ + return mFinalPathData.mEndPointA; +} + +void LLPathfindingPathTool::setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint) +{ + mTempPathData.mStartPointA = pStartPoint; + mTempPathData.mEndPointA = pEndPoint; + mTempPathData.mHasPointA = true; +} + +bool LLPathfindingPathTool::hasTempA() const +{ + return mTempPathData.mHasPointA; +} + +void LLPathfindingPathTool::setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint) +{ + mFinalPathData.mStartPointB = pStartPoint; + mFinalPathData.mEndPointB = pEndPoint; + mFinalPathData.mHasPointB = true; +} + +bool LLPathfindingPathTool::hasFinalB() const +{ + return mFinalPathData.mHasPointB; +} + +const LLVector3 &LLPathfindingPathTool::getFinalBStart() const +{ + return mFinalPathData.mStartPointB; +} + +const LLVector3 &LLPathfindingPathTool::getFinalBEnd() const +{ + return mFinalPathData.mEndPointB; +} + +void LLPathfindingPathTool::setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint) +{ + mTempPathData.mStartPointB = pStartPoint; + mTempPathData.mEndPointB = pEndPoint; + mTempPathData.mHasPointB = true; +} + +bool LLPathfindingPathTool::hasTempB() const +{ + return mTempPathData.mHasPointB; +} + +void LLPathfindingPathTool::clearFinal() +{ + mFinalPathData.mHasPointA = false; + mFinalPathData.mHasPointB = false; +} + +void LLPathfindingPathTool::clearTemp() +{ + mTempPathData.mHasPointA = false; + mTempPathData.mHasPointB = false; +} + void LLPathfindingPathTool::computeFinalPath() { - mPathResult = LLPathingLib::LLPL_PATH_NOT_GENERATED; - if (mHasFinalStartPoint && mHasFinalEndPoint && (LLPathingLib::getInstance() != NULL)) + mPathResult = LLPathingLib::LLPL_NO_PATH; + if (LLPathingLib::getInstance() != NULL) { mPathResult = LLPathingLib::getInstance()->generatePath(mFinalPathData); } @@ -280,7 +345,8 @@ void LLPathfindingPathTool::computeFinalPath() void LLPathfindingPathTool::computeTempPath() { - if (mHasTempStartPoint && mHasTempEndPoint && (LLPathingLib::getInstance() != NULL)) + mPathResult = LLPathingLib::LLPL_NO_PATH; + if (LLPathingLib::getInstance() != NULL) { mPathResult = LLPathingLib::getInstance()->generatePath(mTempPathData); } diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index 2b9b363fec..0ec22d959c 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -87,8 +87,27 @@ protected: private: bool isAnyPathToolModKeys(MASK pMask) const; - bool isStartPathToolModKeys(MASK pMask) const; - bool isEndPathToolModKeys(MASK pMask) const; + bool isPointAModKeys(MASK pMask) const; + bool isPointBModKeys(MASK pMask) const; + + void setFinalA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint); + bool hasFinalA() const; + const LLVector3 &getFinalAStart() const; + const LLVector3 &getFinalAEnd() const; + + void setTempA(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint); + bool hasTempA() const; + + void setFinalB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint); + bool hasFinalB() const; + const LLVector3 &getFinalBStart() const; + const LLVector3 &getFinalBEnd() const; + + void setTempB(const LLVector3 &pStartPoint, const LLVector3 &pEndPoint); + bool hasTempB() const; + + void clearFinal(); + void clearTemp(); void computeFinalPath(); void computeTempPath(); @@ -96,11 +115,6 @@ private: LLPathingLib::PathingPacket mFinalPathData; LLPathingLib::PathingPacket mTempPathData; LLPathingLib::LLPLResult mPathResult; - bool mHasFinalStartPoint; - bool mHasFinalEndPoint; - bool mHasTempStartPoint; - bool mHasTempEndPoint; - F32 mCharacterWidth; ECharacterType mCharacterType; path_event_signal_t mPathEventSignal; }; -- cgit v1.2.3