[RLVa] Cleanup for the last commits
camAvDist, camMax and camMin are now combined into: -camPole: returns the saved pole of the highest degree -updatePole: updates the saved pole to the highest degree when the related exception is changed Poles are now cached in a map called m_Poles in the RlvHandler.
This commit is contained in:
@@ -975,7 +975,7 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters)
|
||||
// [RLVa:LF] - @camdistmax, @camdistmin
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX))
|
||||
{
|
||||
F32 dist_max(gRlvHandler.camMax(RLV_BHVR_CAMDISTMAX));
|
||||
F32 dist_max(gRlvHandler.camPole(RLV_BHVR_CAMDISTMAX));
|
||||
if (0 >= dist_max)
|
||||
{
|
||||
if (!cameraMouselook())
|
||||
@@ -986,7 +986,7 @@ void LLAgentCamera::cameraOrbitIn(const F32 meters)
|
||||
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMIN))
|
||||
{
|
||||
F32 dist_min(gRlvHandler.camMin(RLV_BHVR_CAMDISTMIN));
|
||||
F32 dist_min(gRlvHandler.camPole(RLV_BHVR_CAMDISTMIN));
|
||||
if (cameraMouselook() && dist_min > 0)
|
||||
changeCameraToDefault(); // Just to be sure we're not in mouselook
|
||||
}
|
||||
@@ -2041,7 +2041,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
bool rlvConstrained = false; // You Only Constrain Once
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX))
|
||||
{
|
||||
F32 max_dist(gRlvHandler.camMax(RLV_BHVR_CAMDISTMAX));
|
||||
F32 max_dist(gRlvHandler.camPole(RLV_BHVR_CAMDISTMAX));
|
||||
if (total_dist > max_dist)
|
||||
{
|
||||
camera_position_global = agent_pos + (max_dist/total_dist)*offset;
|
||||
@@ -2050,7 +2050,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
}
|
||||
if (!rlvConstrained && gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMIN))
|
||||
{
|
||||
F32 min_dist(gRlvHandler.camMin(RLV_BHVR_CAMDISTMIN));
|
||||
F32 min_dist(gRlvHandler.camPole(RLV_BHVR_CAMDISTMIN));
|
||||
if (total_dist < min_dist)
|
||||
{
|
||||
camera_position_global = agent_pos + (min_dist/total_dist)*offset;
|
||||
@@ -2225,7 +2225,7 @@ void LLAgentCamera::resetCamera()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgentCamera::changeCameraToMouselook(BOOL animate)
|
||||
{
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMIN) && gRlvHandler.camMin(RLV_BHVR_CAMDISTMIN) > 0) return; // [RLVa:LF] - @camdistmin
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMIN) && gRlvHandler.camPole(RLV_BHVR_CAMDISTMIN) > 0) return; // [RLVa:LF] - @camdistmin
|
||||
|
||||
if (!gSavedSettings.getBOOL("EnableMouselook")
|
||||
|| LLViewerJoystick::getInstance()->getOverrideCamera())
|
||||
@@ -2315,7 +2315,7 @@ void LLAgentCamera::changeCameraToDefault()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgentCamera::changeCameraToFollow(BOOL animate)
|
||||
{
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) && 0 >= gRlvHandler.camMax(RLV_BHVR_CAMDISTMAX)) return; // [RLVa:LF] - @camdistmax
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) && 0 >= gRlvHandler.camPole(RLV_BHVR_CAMDISTMAX)) return; // [RLVa:LF] - @camdistmax
|
||||
|
||||
if (LLViewerJoystick::getInstance()->getOverrideCamera())
|
||||
{
|
||||
@@ -2375,7 +2375,7 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate)
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
|
||||
{
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) && 0 >= gRlvHandler.camMax(RLV_BHVR_CAMDISTMAX)) return; // [RLVa:LF] - @camdistmax
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) && 0 >= gRlvHandler.camPole(RLV_BHVR_CAMDISTMAX)) return; // [RLVa:LF] - @camdistmax
|
||||
|
||||
if (LLViewerJoystick::getInstance()->getOverrideCamera())
|
||||
{
|
||||
@@ -2460,7 +2460,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgentCamera::changeCameraToCustomizeAvatar()
|
||||
{
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) && 0 >= gRlvHandler.camMax(RLV_BHVR_CAMDISTMAX)) return; // [RLVa:LF] - @camdistmax
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) && 0 >= gRlvHandler.camPole(RLV_BHVR_CAMDISTMAX)) return; // [RLVa:LF] - @camdistmax
|
||||
|
||||
if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid())
|
||||
{
|
||||
|
||||
@@ -722,9 +722,9 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts)
|
||||
|
||||
// RLVa:LF - @camzoommax
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMZOOMMAX))
|
||||
vertical_fov_rads = llmin(vertical_fov_rads, gRlvHandler.camMax(RLV_BHVR_CAMZOOMMAX));
|
||||
vertical_fov_rads = llmin(vertical_fov_rads, gRlvHandler.camPole(RLV_BHVR_CAMZOOMMAX));
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMZOOMMIN))
|
||||
vertical_fov_rads = llmax(vertical_fov_rads, gRlvHandler.camMin(RLV_BHVR_CAMZOOMMIN));
|
||||
vertical_fov_rads = llmax(vertical_fov_rads, gRlvHandler.camPole(RLV_BHVR_CAMZOOMMIN));
|
||||
|
||||
if (vertical_fov_rads == old_fov) return;
|
||||
|
||||
|
||||
@@ -3795,7 +3795,7 @@ bool LLVOAvatar::isVisuallyMuted() const
|
||||
(mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) ||
|
||||
(mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f) ||
|
||||
// [RLVa:LF] - RLV 2.9 camavdist
|
||||
(gRlvHandler.hasBehaviour(RLV_BHVR_CAMAVDIST) && (gAgent.getPosGlobalFromAgent(const_cast<LLVOAvatar&>(*this).getCharacterPosition()) - gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition())).magVec() > gRlvHandler.camAvDist()) ||
|
||||
(gRlvHandler.hasBehaviour(RLV_BHVR_CAMAVDIST) && (gAgent.getPosGlobalFromAgent(const_cast<LLVOAvatar&>(*this).getCharacterPosition()) - gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition())).magVec() > gRlvHandler.camPole(RLV_BHVR_CAMAVDIST)) ||
|
||||
// [/RLVa:LF]
|
||||
isLangolier();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llappearancemgr.h"
|
||||
#include "llappviewer.h"
|
||||
#include "llgroupactions.h"
|
||||
@@ -841,28 +842,16 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const
|
||||
return true;
|
||||
}
|
||||
|
||||
F32 RlvHandler::camMax(const ERlvBehaviour& bhvr) const
|
||||
void RlvHandler::updatePole(const ERlvBehaviour& bhvr, bool max)
|
||||
{
|
||||
F32 ret(F32_MAX);
|
||||
F32 pole(max ? F32_MAX : F32_MIN);
|
||||
for (rlv_exception_map_t::const_iterator i = m_Exceptions.lower_bound(bhvr),
|
||||
end = m_Exceptions.upper_bound(bhvr); i != end; ++i)
|
||||
{
|
||||
F32 val(boost::get<F32>(i->second.varOption));
|
||||
if (val < ret) ret = val;
|
||||
if (max ? val < pole : val > pole) pole = val;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
F32 RlvHandler::camMin(const ERlvBehaviour& bhvr) const
|
||||
{
|
||||
F32 ret(F32_MIN);
|
||||
for (rlv_exception_map_t::const_iterator i = m_Exceptions.lower_bound(bhvr),
|
||||
end = m_Exceptions.upper_bound(bhvr); i != end; ++i)
|
||||
{
|
||||
F32 val(boost::get<F32>(i->second.varOption));
|
||||
if (val > ret) ret = val;
|
||||
}
|
||||
return ret;
|
||||
m_Poles[bhvr] = pole;
|
||||
}
|
||||
|
||||
LLColor3 RlvHandler::camDrawColor() const
|
||||
@@ -878,18 +867,6 @@ LLColor3 RlvHandler::camDrawColor() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
F32 RlvHandler::camAvDist() const
|
||||
{
|
||||
F32 ret(F32_MAX);
|
||||
for (rlv_exception_map_t::const_iterator i = m_Exceptions.lower_bound(RLV_BHVR_CAMAVDIST),
|
||||
end = m_Exceptions.upper_bound(RLV_BHVR_CAMAVDIST); i != end; ++i)
|
||||
{
|
||||
F32 dist(boost::get<F32>(i->second.varOption));
|
||||
if (ret > dist) ret = dist;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Composite folders
|
||||
//
|
||||
@@ -1357,6 +1334,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
|
||||
addException(rlvCmd.getObjectID(), eBhvr, zoom);
|
||||
else
|
||||
removeException(rlvCmd.getObjectID(), eBhvr, zoom);
|
||||
updatePole(eBhvr, eBhvr == RLV_BHVR_CAMDISTMAX);
|
||||
if (hasBehaviour(eBhvr))
|
||||
{
|
||||
LLViewerCamera& inst(LLViewerCamera::instance());
|
||||
@@ -1373,6 +1351,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
|
||||
addException(rlvCmd.getObjectID(), eBhvr, zoom);
|
||||
else
|
||||
removeException(rlvCmd.getObjectID(), eBhvr, zoom);
|
||||
updatePole(eBhvr, eBhvr == RLV_BHVR_CAMDISTMAX);
|
||||
if (hasBehaviour(eBhvr))
|
||||
{
|
||||
if (eBhvr == RLV_BHVR_CAMDISTMAX && zoom <= 0)
|
||||
@@ -1427,6 +1406,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
|
||||
addException(rlvCmd.getObjectID(), eBhvr, dist);
|
||||
else
|
||||
removeException(rlvCmd.getObjectID(), eBhvr, dist);
|
||||
updatePole(eBhvr, false);
|
||||
break;
|
||||
}
|
||||
// The following block is only valid if there's no option
|
||||
|
||||
@@ -100,10 +100,9 @@ public:
|
||||
bool canTouch(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; // @touch
|
||||
bool filterChat(std::string& strUTF8Text, bool fFilterEmote) const; // @sendchat, @recvchat and @redirchat
|
||||
bool redirectChatOrEmote(const std::string& strUTF8Test) const; // @redirchat and @rediremote
|
||||
F32 camMax(const ERlvBehaviour& bhvr) const; // @cam*max
|
||||
F32 camMin(const ERlvBehaviour& bhvr) const; // @cam*min
|
||||
void updatePole(const ERlvBehaviour& bhvr, bool max); // @cam*min, @cam*max, and @camavdist
|
||||
F32 camPole(const ERlvBehaviour& bhvr) { return m_Poles[bhvr]; } // @cam*min, @cam*max, and @camavdist
|
||||
LLColor3 camDrawColor() const; // @camdrawcolor
|
||||
F32 camAvDist() const; // @camavdist
|
||||
|
||||
// Command processing helper functions
|
||||
ERlvCmdRet processCommand(const LLUUID& idObj, const std::string& strCommand, bool fFromObj);
|
||||
@@ -196,6 +195,7 @@ public:
|
||||
protected:
|
||||
rlv_object_map_t m_Objects; // Map of objects that have active restrictions (idObj -> RlvObject)
|
||||
rlv_exception_map_t m_Exceptions; // Map of currently active restriction exceptions (ERlvBehaviour -> RlvException)
|
||||
std::map<ERlvBehaviour, F32> m_Poles; // Map of polest poles from exceptions that store polar values.
|
||||
S16 m_Behaviours[RLV_BHVR_COUNT];
|
||||
|
||||
rlv_command_list_t m_Retained;
|
||||
|
||||
Reference in New Issue
Block a user