Actually enable Region WindLight
This commit is contained in:
@@ -88,6 +88,7 @@ set(viewer_SOURCE_FILES
|
||||
lldaycyclemanager.cpp
|
||||
llenvmanager.cpp
|
||||
llwlhandlers.cpp
|
||||
llregioninfomodel.cpp
|
||||
ascentfloatercontactgroups.cpp
|
||||
ascentkeyword.cpp
|
||||
ascentprefschat.cpp
|
||||
@@ -568,6 +569,7 @@ set(viewer_HEADER_FILES
|
||||
lldaycyclemanager.h
|
||||
llenvmanager.h
|
||||
llwlhandlers.h
|
||||
llregioninfomodel.h
|
||||
ascentfloatercontactgroups.h
|
||||
ascentkeyword.h
|
||||
ascentprefschat.h
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
#include "llanimationstates.h"
|
||||
#include "llcallingcard.h"
|
||||
#include "llconsole.h"
|
||||
#include "llenvmanager.h"
|
||||
#include "llfirstuse.h"
|
||||
#include "llfloatercamera.h"
|
||||
#include "llfloatertools.h"
|
||||
|
||||
#include "llgroupmgr.h"
|
||||
#include "llhomelocationresponder.h"
|
||||
#include "llhudmanager.h"
|
||||
@@ -645,6 +645,8 @@ void LLAgent::toggleTPosed()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgent::setRegion(LLViewerRegion *regionp)
|
||||
{
|
||||
bool teleport = true;
|
||||
|
||||
llassert(regionp);
|
||||
if (mRegionp != regionp)
|
||||
{
|
||||
@@ -682,6 +684,8 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
|
||||
gSky.mVOGroundp->setRegion(regionp);
|
||||
}
|
||||
|
||||
// Notify windlight managers
|
||||
teleport = (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -713,6 +717,15 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
|
||||
mRegionsVisited.insert(handle);
|
||||
|
||||
LLSelectMgr::getInstance()->updateSelectionCenter();
|
||||
|
||||
if (teleport)
|
||||
{
|
||||
LLEnvManagerNew::instance().onTeleport();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLEnvManagerNew::instance().onRegionCrossing();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
217
indra/newview/llregioninfomodel.cpp
Normal file
217
indra/newview/llregioninfomodel.cpp
Normal file
@@ -0,0 +1,217 @@
|
||||
/**
|
||||
* @file llregioninfomodel.cpp
|
||||
* @brief Region info model
|
||||
*
|
||||
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2011, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llregioninfomodel.h"
|
||||
|
||||
// libs
|
||||
#include "message.h"
|
||||
#include "llregionflags.h"
|
||||
|
||||
// viewer
|
||||
#include "llagent.h"
|
||||
#include "llviewerregion.h"
|
||||
|
||||
void LLRegionInfoModel::reset()
|
||||
{
|
||||
mSimAccess = 0;
|
||||
mAgentLimit = 0;
|
||||
|
||||
mRegionFlags = 0;
|
||||
mEstateID = 0;
|
||||
mParentEstateID = 0;
|
||||
|
||||
mPricePerMeter = 0;
|
||||
mRedirectGridX = 0;
|
||||
mRedirectGridY = 0;
|
||||
|
||||
mBillableFactor = 0.0f;
|
||||
mObjectBonusFactor = 0.0f;
|
||||
mWaterHeight = 0.0f;
|
||||
mTerrainRaiseLimit = 0.0f;
|
||||
mTerrainLowerLimit = 0.0f;
|
||||
mSunHour = 0.0f;
|
||||
|
||||
mUseEstateSun = false;
|
||||
|
||||
mSimType.clear();
|
||||
mSimName.clear();
|
||||
}
|
||||
|
||||
LLRegionInfoModel::LLRegionInfoModel()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
boost::signals2::connection LLRegionInfoModel::setUpdateCallback(const update_signal_t::slot_type& cb)
|
||||
{
|
||||
return mUpdateSignal.connect(cb);
|
||||
}
|
||||
|
||||
void LLRegionInfoModel::sendRegionTerrain(const LLUUID& invoice) const
|
||||
{
|
||||
std::string buffer;
|
||||
std::vector<std::string> strings;
|
||||
|
||||
// ==========================================
|
||||
// Assemble and send setregionterrain message
|
||||
// "setregionterrain"
|
||||
// strings[0] = float water height
|
||||
// strings[1] = float terrain raise
|
||||
// strings[2] = float terrain lower
|
||||
// strings[3] = 'Y' use estate time
|
||||
// strings[4] = 'Y' fixed sun
|
||||
// strings[5] = float sun_hour
|
||||
// strings[6] = from estate, 'Y' use global time
|
||||
// strings[7] = from estate, 'Y' fixed sun
|
||||
// strings[8] = from estate, float sun_hour
|
||||
|
||||
// *NOTE: this resets estate sun info.
|
||||
BOOL estate_global_time = true;
|
||||
BOOL estate_fixed_sun = false;
|
||||
F32 estate_sun_hour = 0.f;
|
||||
|
||||
buffer = llformat("%f", mWaterHeight);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", mTerrainRaiseLimit);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", mTerrainLowerLimit);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (mUseEstateSun ? "Y" : "N"));
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (getUseFixedSun() ? "Y" : "N"));
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", mSunHour);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (estate_global_time ? "Y" : "N") );
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") );
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", estate_sun_hour);
|
||||
strings.push_back(buffer);
|
||||
|
||||
sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings);
|
||||
}
|
||||
|
||||
bool LLRegionInfoModel::getUseFixedSun() const
|
||||
{
|
||||
return mRegionFlags & REGION_FLAGS_SUN_FIXED;
|
||||
}
|
||||
|
||||
void LLRegionInfoModel::setUseFixedSun(bool fixed)
|
||||
{
|
||||
if (fixed)
|
||||
{
|
||||
mRegionFlags |= REGION_FLAGS_SUN_FIXED;
|
||||
}
|
||||
else
|
||||
{
|
||||
mRegionFlags &= ~REGION_FLAGS_SUN_FIXED;
|
||||
}
|
||||
}
|
||||
|
||||
void LLRegionInfoModel::update(LLMessageSystem* msg)
|
||||
{
|
||||
reset();
|
||||
|
||||
msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, mSimName);
|
||||
msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, mEstateID);
|
||||
msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, mParentEstateID);
|
||||
msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_RegionFlags, mRegionFlags);
|
||||
msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_SimAccess, mSimAccess);
|
||||
msg->getU8Fast(_PREHASH_RegionInfo, _PREHASH_MaxAgents, mAgentLimit);
|
||||
msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, mObjectBonusFactor);
|
||||
msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, mBillableFactor);
|
||||
msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, mWaterHeight);
|
||||
msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, mTerrainRaiseLimit);
|
||||
msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, mTerrainLowerLimit);
|
||||
msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_PricePerMeter, mPricePerMeter);
|
||||
msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridX, mRedirectGridX);
|
||||
msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_RedirectGridY, mRedirectGridY);
|
||||
|
||||
msg->getBOOL(_PREHASH_RegionInfo, _PREHASH_UseEstateSun, mUseEstateSun);
|
||||
|
||||
// actually the "last set" sun hour, not the current sun hour. JC
|
||||
msg->getF32(_PREHASH_RegionInfo, _PREHASH_SunHour, mSunHour);
|
||||
LL_DEBUGS("Windlight Sync") << "Got region sun hour: " << mSunHour << LL_ENDL;
|
||||
|
||||
// the only reasonable way to decide if we actually have any data is to
|
||||
// check to see if any of these fields have nonzero sizes
|
||||
if (msg->getSize(_PREHASH_RegionInfo2, _PREHASH_ProductSKU) > 0 ||
|
||||
msg->getSize(_PREHASH_RegionInfo2, "ProductName") > 0)
|
||||
{
|
||||
msg->getString(_PREHASH_RegionInfo2, "ProductName", mSimType);
|
||||
}
|
||||
|
||||
// Let interested parties know that region info has been updated.
|
||||
mUpdateSignal();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLRegionInfoModel::sendEstateOwnerMessage(
|
||||
LLMessageSystem* msg,
|
||||
const std::string& request,
|
||||
const LLUUID& invoice,
|
||||
const std::vector<std::string>& strings)
|
||||
{
|
||||
LLViewerRegion* cur_region = gAgent.getRegion();
|
||||
|
||||
if (!cur_region)
|
||||
{
|
||||
llwarns << "Agent region not set" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
llinfos << "Sending estate request '" << request << "'" << llendl;
|
||||
msg->newMessage("EstateOwnerMessage");
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
|
||||
msg->nextBlock("MethodData");
|
||||
msg->addString("Method", request);
|
||||
msg->addUUID("Invoice", invoice);
|
||||
|
||||
if (strings.empty())
|
||||
{
|
||||
msg->nextBlock("ParamList");
|
||||
msg->addString("Parameter", NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string>::const_iterator it = strings.begin();
|
||||
std::vector<std::string>::const_iterator end = strings.end();
|
||||
for (unsigned i = 0; it != end; ++it, ++i)
|
||||
{
|
||||
lldebugs << "- [" << i << "] " << (*it) << llendl;
|
||||
msg->nextBlock("ParamList");
|
||||
msg->addString("Parameter", *it);
|
||||
}
|
||||
}
|
||||
|
||||
msg->sendReliable(cur_region->getHost());
|
||||
}
|
||||
100
indra/newview/llregioninfomodel.h
Normal file
100
indra/newview/llregioninfomodel.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* @file llregioninfomodel.h
|
||||
* @brief Region info model
|
||||
*
|
||||
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2011, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLREGIONINFOMODEL_H
|
||||
#define LL_LLREGIONINFOMODEL_H
|
||||
|
||||
class LLMessageSystem;
|
||||
|
||||
#include "llmemory.h"
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
/**
|
||||
* Contains region info, notifies interested parties of its changes.
|
||||
*/
|
||||
class LLRegionInfoModel : public LLSingleton<LLRegionInfoModel>
|
||||
{
|
||||
LOG_CLASS(LLRegionInfoModel);
|
||||
|
||||
public:
|
||||
typedef boost::signals2::signal<void()> update_signal_t;
|
||||
boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb);
|
||||
|
||||
void sendRegionTerrain(const LLUUID& invoice) const; /// upload region terrain data
|
||||
|
||||
bool getUseFixedSun() const;
|
||||
|
||||
void setUseFixedSun(bool fixed);
|
||||
|
||||
// *TODO: Add getters and make the data private.
|
||||
U8 mSimAccess;
|
||||
U8 mAgentLimit;
|
||||
|
||||
U32 mRegionFlags;
|
||||
U32 mEstateID;
|
||||
U32 mParentEstateID;
|
||||
|
||||
S32 mPricePerMeter;
|
||||
S32 mRedirectGridX;
|
||||
S32 mRedirectGridY;
|
||||
|
||||
F32 mBillableFactor;
|
||||
F32 mObjectBonusFactor;
|
||||
F32 mWaterHeight;
|
||||
F32 mTerrainRaiseLimit;
|
||||
F32 mTerrainLowerLimit;
|
||||
F32 mSunHour; // 6..30
|
||||
|
||||
BOOL mUseEstateSun;
|
||||
|
||||
std::string mSimName;
|
||||
std::string mSimType;
|
||||
|
||||
protected:
|
||||
friend class LLSingleton<LLRegionInfoModel>;
|
||||
friend class LLViewerRegion;
|
||||
|
||||
LLRegionInfoModel();
|
||||
|
||||
/**
|
||||
* Refresh model with data from the incoming server message.
|
||||
*/
|
||||
void update(LLMessageSystem* msg);
|
||||
|
||||
private:
|
||||
void reset();
|
||||
|
||||
// *FIXME: Duplicated code from LLPanelRegionInfo
|
||||
static void sendEstateOwnerMessage(
|
||||
LLMessageSystem* msg,
|
||||
const std::string& request,
|
||||
const LLUUID& invoice,
|
||||
const std::vector<std::string>& strings);
|
||||
|
||||
update_signal_t mUpdateSignal;
|
||||
};
|
||||
|
||||
#endif // LL_LLREGIONINFOMODEL_H
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "llfloaterreporter.h"
|
||||
#include "llfloaterregioninfo.h"
|
||||
#include "llhttpnode.h"
|
||||
#include "llregioninfomodel.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llstartup.h"
|
||||
#include "lltrans.h"
|
||||
@@ -647,6 +648,9 @@ std::string LLViewerRegion::accessToShortString(U8 sim_access)
|
||||
void LLViewerRegion::processRegionInfo(LLMessageSystem* msg, void**)
|
||||
{
|
||||
// send it to 'observers'
|
||||
// *TODO: switch the floaters to using LLRegionInfoModel
|
||||
llinfos << "Processing region info" << llendl;
|
||||
LLRegionInfoModel::getInstance()->update(msg);
|
||||
LLFloaterGodTools::processRegionInfo(msg);
|
||||
LLFloaterRegionInfo::processRegionInfo(msg);
|
||||
LLFloaterReporter::processRegionInfo(msg);
|
||||
@@ -1495,8 +1499,8 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
|
||||
capabilityNames.append("DispatchRegionInfo");
|
||||
capabilityNames.append("EstateChangeInfo");
|
||||
capabilityNames.append("EventQueueGet");
|
||||
/*capabilityNames.append("EnvironmentSettings");
|
||||
capabilityNames.append("ObjectMedia");
|
||||
capabilityNames.append("EnvironmentSettings");
|
||||
/*capabilityNames.append("ObjectMedia");
|
||||
capabilityNames.append("ObjectMediaNavigate");*/
|
||||
|
||||
if (gSavedSettings.getBOOL("UseHTTPInventory")) //Caps suffixed with 2 by LL. Don't update until rest of fetch system is updated first.
|
||||
|
||||
Reference in New Issue
Block a user