MOAP Radar patch set

This commit is contained in:
Robin Cornelius
2013-04-05 23:10:32 +10:00
committed by David Walter Seikel
parent 5845bcd9de
commit 0528bbd5ef
15 changed files with 720 additions and 15 deletions
+6
View File
@@ -702,6 +702,12 @@
<key>FetchLib</key>
<boolean>true</boolean>
<key>ObjectMedia</key>
<boolean>false</boolean>
<key>ObjectMediaNavigate</key>
<boolean>false</boolean>
</map>
<key>messageBans</key>
+6 -8
View File
@@ -6,7 +6,7 @@
*
* $LicenseInfo:firstyear=2006&license=viewergpl$
*
* Copyright (c) 2006-2009, Linden Research, Inc.
* Copyright (c) 2006-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
@@ -14,13 +14,13 @@
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
@@ -30,11 +30,12 @@
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*
*/
#include "linden_common.h"
#include "llsdutil.h"
#include "llsdutil_math.h"
#include "v3math.h"
#include "v4math.h"
@@ -165,9 +166,6 @@ LLSD ll_sd_from_color4(const LLColor4& c)
LLColor4 ll_color4_from_sd(const LLSD& sd)
{
LLColor4 c;
c.mV[0] = (F32)sd[0].asReal();
c.mV[1] = (F32)sd[1].asReal();
c.mV[2] = (F32)sd[2].asReal();
c.mV[3] = (F32)sd[3].asReal();
c.setValue(sd);
return c;
}
+4
View File
@@ -274,6 +274,7 @@ set(viewer_SOURCE_FILES
llmaniprotate.cpp
llmanipscale.cpp
llmaniptranslate.cpp
llmediadataclient.cpp
llmapresponders.cpp
llmediaremotectrl.cpp
llmemoryview.cpp
@@ -508,6 +509,7 @@ set(viewer_SOURCE_FILES
wlfloaterwindlightsend.cpp
wlretrievesettings.cpp
wlsettingsmanager.cpp
rcmoapradar.cpp
)
set(VIEWER_BINARY_NAME "imprudence-bin" CACHE STRING
@@ -737,6 +739,7 @@ set(viewer_HEADER_FILES
llmaniprotate.h
llmanipscale.h
llmaniptranslate.h
llmediadataclient.h
llmapresponders.h
llmediaremotectrl.h
llmemoryview.h
@@ -981,6 +984,7 @@ set(viewer_HEADER_FILES
wlfloaterwindlightsend.h
wlretrievesettings.h
wlsettingsmanager.h
rcmoapradar.h
)
source_group("CMake Rules" FILES ViewerInstall.cmake)
@@ -2,6 +2,123 @@
<llsd>
<map>
<!-- begin RC hacking -->
<key>PrimMediaMasterEnabled</key>
<map>
<key>Comment</key>
<string>Whether or not Media on a Prim is enabled.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>PrimMediaMaxRetries</key>
<map>
<key>Comment</key>
<string>Maximum number of retries for media queries.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>4</integer>
</map>
<key>PrimMediaRequestQueueDelay</key>
<map>
<key>Comment</key>
<string>Timer delay for fetching media from the queue (in seconds).</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>PrimMediaRetryTimerDelay</key>
<map>
<key>Comment</key>
<string>Timer delay for retrying on media queries (in seconds).</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>5.0</real>
</map>
<key>PrimMediaMaxSortedQueueSize</key>
<map>
<key>Comment</key>
<string>Maximum number of objects the viewer will load media for initially</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>100000</integer>
</map>
<key>PrimMediaMaxRoundRobinQueueSize</key>
<map>
<key>Comment</key>
<string>Maximum number of objects the viewer will continuously update media for</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>100000</integer>
</map>
<key>ShowMOAPRadar</key>
<map>
<key>Comment</key>
<string>Show the MOAP radar</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>FloaterMOAPRadarRect</key>
<map>
<key>Comment</key>
<string>Rectangle for MOAP Radar</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Rect</string>
<key>Value</key>
<array>
<integer>0</integer>
<integer>400</integer>
<integer>200</integer>
<integer>0</integer>
</array>
</map>
<key>MOAPRadarKeepOpen</key>
<map>
<key>Comment</key>
<string>Keeps MOAP radar updates running in background</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>MOAPRadarUpdateRate</key>
<map>
<key>Comment</key>
<string>MOAP Radar update rate (0 = high, 1 = medium, 2 = low)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>1</integer>
</map>
<!-- BEGIN IMPRUDENCE-SPECIFIC SETTINGS -->
<!-- begin Aurora-specific settings -->
@@ -14645,6 +14762,17 @@
<real>1.0</real>
</array>
</map>
<key>moapbeacon</key>
<map>
<key>Comment</key>
<string>Beacon / Highlight MOAP sources</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>particlesbeacon</key>
<map>
<key>Comment</key>
@@ -54,6 +54,7 @@ LLFloaterBeacons::LLFloaterBeacons(const LLSD& seed)
LLPipeline::setRenderScriptedTouchBeacons(gSavedSettings.getBOOL("scripttouchbeacon"));
LLPipeline::setRenderScriptedBeacons( gSavedSettings.getBOOL("scriptsbeacon"));
LLPipeline::setRenderPhysicalBeacons( gSavedSettings.getBOOL("physicalbeacon"));
LLPipeline::setRenderMOAPBeacons( gSavedSettings.getBOOL("moapbeacon"));
LLPipeline::setRenderSoundBeacons( gSavedSettings.getBOOL("soundsbeacon"));
LLPipeline::setRenderParticleBeacons( gSavedSettings.getBOOL("particlesbeacon"));
LLPipeline::setRenderHighlights( gSavedSettings.getBOOL("renderhighlights"));
@@ -67,6 +68,7 @@ BOOL LLFloaterBeacons::postBuild()
childSetCommitCallback("physical", onClickUICheck, this);
childSetCommitCallback("sounds", onClickUICheck, this);
childSetCommitCallback("particles", onClickUICheck, this);
childSetCommitCallback("moap", onClickUICheck, this);
childSetCommitCallback("highlights", onClickUICheck, this);
childSetCommitCallback("beacons", onClickUICheck, this);
return TRUE;
@@ -132,6 +134,7 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl, void* data)
else if(name == "physical") LLPipeline::setRenderPhysicalBeacons(check->get());
else if(name == "sounds") LLPipeline::setRenderSoundBeacons(check->get());
else if(name == "particles") LLPipeline::setRenderParticleBeacons(check->get());
else if(name == "moap") LLPipeline::setRenderMOAPBeacons(check->get());
else if(name == "highlights")
{
LLPipeline::toggleRenderHighlights(NULL);
+12
View File
@@ -206,6 +206,8 @@
#include "rlvhandler.h"
// [/RLVa:KB]
#include "rcmoapradar.h"
#if LL_WINDOWS
#include "llwindebug.h"
#include "lldxhardware.h"
@@ -2079,6 +2081,16 @@ bool idle_startup()
LLRect window(0, gViewerWindow->getWindowHeight(), gViewerWindow->getWindowWidth(), 0);
gViewerWindow->adjustControlRectanglesForFirstUse(window);
if (gSavedSettings.getBOOL("ShowRadar"))
{
LLFloaterAvatarList::showInstance();
}
if (gSavedSettings.getBOOL("ShowMOAPRadar"))
{
LLFloaterMOAPRadar::showInstance();
}
if(gSavedSettings.getBOOL("ShowMiniMap"))
{
LLFloaterMap::showInstance();
+32
View File
@@ -238,6 +238,8 @@
#include "llfloaterteleporthistory.h"
#include "slfloatermediafilter.h"
#include "rcmoapradar.h"
using namespace LLVOAvatarDefines;
void init_client_menu(LLMenuGL* menu);
void init_server_menu(LLMenuGL* menu);
@@ -5216,6 +5218,34 @@ class LLViewEnableLastChatter : public view_listener_t
}
};
class LLViewToggleRadar: public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLFloaterAvatarList::toggle(0);
bool vis = false;
if(LLFloaterAvatarList::getInstance())
{
vis = (bool)LLFloaterAvatarList::getInstance()->getVisible();
}
return true;
}
};
class LLViewToggleMOAPRadar: public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLFloaterMOAPRadar::toggle(0);
bool vis = false;
if(LLFloaterMOAPRadar::getInstance())
{
vis = (bool)LLFloaterMOAPRadar::getInstance()->getVisible();
}
return true;
}
};
class LLEditEnableDeselect : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@@ -11215,6 +11245,8 @@ void initialize_menus()
addMenu(new LLViewEnableMouselook(), "View.EnableMouselook");
addMenu(new LLViewEnableJoystickFlycam(), "View.EnableJoystickFlycam");
addMenu(new LLViewEnableLastChatter(), "View.EnableLastChatter");
addMenu(new LLViewToggleRadar(), "View.ToggleAvatarList");
addMenu(new LLViewToggleMOAPRadar(), "View.ToggleMOAPList");
addMenu(new LLViewCheckBuildMode(), "View.CheckBuildMode");
addMenu(new LLViewCheckJoystickFlycam(), "View.CheckJoystickFlycam");
+7 -1
View File
@@ -157,7 +157,13 @@ public:
enum { MEDIA_TYPE_NONE = 0, MEDIA_TYPE_WEB_PAGE = 1 };
// Return codes for processUpdateMessage
enum { MEDIA_URL_REMOVED = 0x1, MEDIA_URL_ADDED = 0x2, MEDIA_URL_UPDATED = 0x4, INVALID_UPDATE = 0x80000000 };
enum {
MEDIA_URL_REMOVED = 0x1,
MEDIA_URL_ADDED = 0x2,
MEDIA_URL_UPDATED = 0x4,
MEDIA_FLAGS_CHANGED = 0x8,
INVALID_UPDATE = 0x80000000
};
virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
void **user_data,
+2
View File
@@ -1436,6 +1436,8 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
capabilityNames.append("EstateChangeInfo");
capabilityNames.append("EventQueueGet");
capabilityNames.append("FetchInventory");
capabilityNames.append("ObjectMedia");
capabilityNames.append("ObjectMediaNavigate");
capabilityNames.append("FetchLib");
capabilityNames.append("FetchLibDescendents");
capabilityNames.append("GetDisplayNames");
+394 -4
View File
@@ -68,6 +68,9 @@
#include "rlvhandler.h"
// [/RLVa:KB]
#include "llmediaentry.h"
#include "llmediadataclient.h"
const S32 MIN_QUIET_FRAMES_COALESCE = 30;
const F32 FORCE_SIMPLE_RENDER_AREA = 512.f;
const F32 FORCE_CULL_AREA = 8.f;
@@ -79,6 +82,93 @@ F32 LLVOVolume::sLODFactor = 1.f;
F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop
F32 LLVOVolume::sDistanceFactor = 1.0f;
S32 LLVOVolume::sNumLODChanges = 0;
LLPointer<LLObjectMediaDataClient> LLVOVolume::sObjectMediaClient = NULL;
LLPointer<LLObjectMediaNavigateClient> LLVOVolume::sObjectMediaNavigateClient = NULL;
// Implementation class of LLMediaDataClientObject. See llmediadataclient.h
class LLMediaDataClientObjectImpl : public LLMediaDataClientObject
{
public:
LLMediaDataClientObjectImpl(LLVOVolume *obj, bool isNew) : mObject(obj), mNew(isNew) {}
LLMediaDataClientObjectImpl() { mObject = NULL; }
virtual U8 getMediaDataCount() const
{ return mObject->getNumTEs(); }
virtual LLSD getMediaDataLLSD(U8 index) const
{
LLSD result;
LLTextureEntry *te = mObject->getTE(index);
if (NULL != te)
{
llassert((te->getMediaData() != NULL) == te->hasMedia());
if (te->getMediaData() != NULL)
{
result = te->getMediaData()->asLLSD();
// XXX HACK: workaround bug in asLLSD() where whitelist is not set properly
// See DEV-41949
if (!result.has(LLMediaEntry::WHITELIST_KEY))
{
result[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
}
}
}
return result;
}
virtual LLUUID getID() const
{ return mObject->getID(); }
virtual void mediaNavigateBounceBack(U8 index)
{ mObject->mediaNavigateBounceBack(index); }
virtual bool hasMedia() const
{ return mObject->hasMedia();}
virtual void updateObjectMediaData(LLSD const &data, const std::string &version_string)
{ mObject->updateObjectMediaData(data, version_string); }
virtual F64 getMediaInterest() const
{
//F64 interest = mObject->getTotalMediaInterest();
//FIXME
F64 interest = 1024;
if (interest < (F64)0.0)
{
// media interest not valid yet, try pixel area
interest = mObject->getPixelArea();
// HACK: force recalculation of pixel area if interest is the "magic default" of 1024.
if (interest == 1024.f)
{
const_cast<LLVOVolume*>(static_cast<LLVOVolume*>(mObject))->setPixelAreaAndAngle(gAgent);
interest = mObject->getPixelArea();
}
}
return interest;
}
virtual bool isInterestingEnough() const
{
return true; //FUCKEDUP --> LLViewerMedia::isInterestingEnough(mObject, getMediaInterest());
}
virtual std::string getCapabilityUrl(const std::string &name) const
{ return mObject->getRegion()->getCapability(name); }
virtual bool isDead() const
{ return mObject->isDead(); }
virtual U32 getMediaVersion() const
{ return LLTextureEntry::getVersionFromMediaVersionString(mObject->getMediaURL()); }
virtual bool isNew() const
{ return mNew; }
private:
LLPointer<LLVOVolume> mObject;
bool mNew;
};
LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
: LLViewerObject(id, pcode, regionp),
@@ -123,6 +213,18 @@ void LLVOVolume::markDead()
// static
void LLVOVolume::initClass()
{
// gSavedSettings better be around
if (gSavedSettings.getBOOL("PrimMediaMasterEnabled"))
{
const F32 queue_timer_delay = gSavedSettings.getF32("PrimMediaRequestQueueDelay");
const F32 retry_timer_delay = gSavedSettings.getF32("PrimMediaRetryTimerDelay");
const U32 max_retries = gSavedSettings.getU32("PrimMediaMaxRetries");
const U32 max_sorted_queue_size = gSavedSettings.getU32("PrimMediaMaxSortedQueueSize");
const U32 max_round_robin_queue_size = gSavedSettings.getU32("PrimMediaMaxRoundRobinQueueSize");
sObjectMediaClient = new LLObjectMediaDataClient(queue_timer_delay, retry_timer_delay, max_retries,
max_sorted_queue_size, max_round_robin_queue_size);
}
}
@@ -132,6 +234,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
LLDataPacker *dp)
{
LLColor4U color;
const S32 teDirtyBits = (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR|TEM_CHANGE_MEDIA);
// Do base class updates...
U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp);
@@ -199,10 +302,15 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
//
// Unpack texture entry data
//
if (unpackTEMessage(mesgsys, _PREHASH_ObjectData, block_num) & (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR))
S32 result =unpackTEMessage(mesgsys, _PREHASH_ObjectData, block_num);
if (result & teDirtyBits)
{
updateTEData();
}
if (result & TEM_CHANGE_MEDIA)
{
retval |= MEDIA_FLAGS_CHANGED;
}
}
else
{
@@ -235,9 +343,16 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
// llerrs << "Bogus TE data in " << getID() << ", crashing!" << llendl;
llwarns << "Bogus TE data in " << getID() << llendl;
}
else if (res2 & (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR))
else
{
updateTEData();
if (res2 & teDirtyBits)
{
updateTEData();
}
if (res2 & TEM_CHANGE_MEDIA)
{
retval |= MEDIA_FLAGS_CHANGED;
}
}
U32 value = dp->getPassFlags();
@@ -275,13 +390,39 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
U8 tdpbuffer[1024];
LLDataPackerBinaryBuffer tdp(tdpbuffer, 1024);
mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextureEntry, tdpbuffer, 0, block_num);
if ( unpackTEMessage(tdp) & (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR))
S32 result = unpackTEMessage(tdp);
if (result & teDirtyBits)
{
updateTEData();
}
if (result & TEM_CHANGE_MEDIA)
{
retval |= MEDIA_FLAGS_CHANGED;
}
}
}
}
if (retval & (MEDIA_URL_REMOVED | MEDIA_URL_ADDED | MEDIA_URL_UPDATED | MEDIA_FLAGS_CHANGED))
{
// If only the media URL changed, and it isn't a media version URL,
// ignore it
if ( ! ( retval & (MEDIA_URL_ADDED | MEDIA_URL_UPDATED) &&
mMedia && ! mMedia->mMediaURL.empty() &&
! LLTextureEntry::isMediaVersionString(mMedia->mMediaURL) ) )
{
// If the media changed at all, request new media data
LL_DEBUGS("MediaOnAPrim") << "Media update: " << getID() << ": retval=" << retval << " Media URL: " <<
((mMedia) ? mMedia->mMediaURL : std::string("")) << LL_ENDL;
requestMediaDataUpdate(retval & MEDIA_FLAGS_CHANGED);
}
else {
LL_INFOS("MediaOnAPrim") << "Ignoring media update for: " << getID() << " Media URL: " <<
((mMedia) ? mMedia->mMediaURL : std::string("")) << LL_ENDL;
}
}
// ...and clean up any media impls
cleanUpMediaImpls();
return retval;
}
@@ -2894,4 +3035,253 @@ void LLHUDPartition::shift(const LLVector3 &offset)
//HUD objects don't shift with region crossing. That would be silly.
}
void LLVOVolume::requestMediaDataUpdate(bool isNew)
{
if (sObjectMediaClient)
sObjectMediaClient->fetchMedia(new LLMediaDataClientObjectImpl(this, isNew));
}
void LLVOVolume::cleanUpMediaImpls()
{
// Iterate through our TEs and remove any Impls that are no longer used
const U8 numTEs = getNumTEs();
for (U8 i = 0; i < numTEs; i++)
{
const LLTextureEntry* te = getTE(i);
if( ! te->hasMedia())
{
// Delete the media IMPL!
removeMediaImpl(i) ;
}
}
}
void LLVOVolume::removeMediaImpl(S32 texture_index)
{
if(mMediaImplList.size() <= (U32)texture_index || mMediaImplList[texture_index].isNull())
{
return ;
}
//make the face referencing to mMediaImplList[texture_index] to point back to the old texture.
if(mDrawable)
{
LLFace* facep = mDrawable->getFace(texture_index) ;
if(facep)
{
//LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[texture_index]->getMediaTextureID()) ;
//if(media_tex)
//{
// media_tex->removeMediaFromFace(facep) ;
//}
}
}
//check if some other face(s) of this object reference(s)to this media impl.
S32 i ;
S32 end = (S32)mMediaImplList.size() ;
for(i = 0; i < end ; i++)
{
if( i != texture_index && mMediaImplList[i] == mMediaImplList[texture_index])
{
break ;
}
}
if(i == end) //this object does not need this media impl.
{
//mMediaImplList[texture_index]->removeObject(this) ;
}
mMediaImplList[texture_index] = NULL ;
return ;
}
void LLVOVolume::addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index)
{
if((S32)mMediaImplList.size() < texture_index + 1)
{
mMediaImplList.resize(texture_index + 1) ;
}
if(mMediaImplList[texture_index].notNull())
{
if(mMediaImplList[texture_index] == media_impl)
{
return ;
}
removeMediaImpl(texture_index) ;
}
mMediaImplList[texture_index] = media_impl;
//media_impl->addObject(this) ;
//add the face to show the media if it is in playing
if(mDrawable)
{
LLFace* facep = mDrawable->getFace(texture_index) ;
if(facep)
{
//LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[texture_index]->getMediaTextureID()) ;
//if(media_tex)
//{
// media_tex->addMediaToFace(facep) ;
//}
}
else //the face is not available now, start media on this face later.
{
//media_impl->setUpdated(TRUE) ;
}
}
return ;
}
void LLVOVolume::sendMediaDataUpdate()
{
if (sObjectMediaClient)
sObjectMediaClient->updateMedia(new LLMediaDataClientObjectImpl(this, false));
}
void LLVOVolume::updateObjectMediaData(const LLSD &media_data_array, const std::string &media_version)
{
// media_data_array is an array of media entry maps
// media_version is the version string in the response.
U32 fetched_version = LLTextureEntry::getVersionFromMediaVersionString(media_version);
// Only update it if it is newer!
if ( (S32)fetched_version > mLastFetchedMediaVersion)
{
mLastFetchedMediaVersion = fetched_version;
//llinfos << "updating:" << this->getID() << " " << ll_pretty_print_sd(media_data_array) << llendl;
LLSD::array_const_iterator iter = media_data_array.beginArray();
LLSD::array_const_iterator end = media_data_array.endArray();
U8 texture_index = 0;
for (; iter != end; ++iter, ++texture_index)
{
syncMediaData(texture_index, *iter, false/*merge*/, false/*ignore_agent*/);
}
}
}
bool LLVOVolume::hasMedia() const
{
bool result = false;
const U8 numTEs = getNumTEs();
for (U8 i = 0; i < numTEs; i++)
{
const LLTextureEntry* te = getTE(i);
if(te->hasMedia())
{
result = true;
break;
}
}
return result;
}
void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool merge, bool ignore_agent)
{
if(mDead)
{
// If the object has been marked dead, don't process media updates.
return;
}
LLTextureEntry *te = getTE(texture_index);
// LL_DEBUGS("MediaOnAPrim") << "BEFORE: texture_index = " << texture_index
// << " hasMedia = " << te->hasMedia() << " : "
// << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl;
std::string previous_url;
LLMediaEntry* mep = te->getMediaData();
if(mep)
{
// Save the "current url" from before the update so we can tell if
// it changes.
previous_url = mep->getCurrentURL();
}
if (merge)
{
te->mergeIntoMediaData(media_data);
}
else {
// XXX Question: what if the media data is undefined LLSD, but the
// update we got above said that we have media flags?? Here we clobber
// that, assuming the data from the service is more up-to-date.
te->updateMediaData(media_data);
}
mep = te->getMediaData();
if(mep)
{
bool update_from_self = false;
if (!ignore_agent)
{
LLUUID updating_agent = LLTextureEntry::getAgentIDFromMediaVersionString(getMediaURL());
update_from_self = (updating_agent == gAgent.getID());
}
//viewer_media_t media_impl = LLViewerMedia::updateMediaImpl(mep, previous_url, update_from_self);
//addMediaImpl(media_impl, texture_index) ;
}
else
{
//removeMediaImpl(texture_index);
}
// LL_DEBUGS("MediaOnAPrim") << "AFTER: texture_index = " << texture_index
// << " hasMedia = " << te->hasMedia() << " : "
// << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl;
}
void LLVOVolume::mediaNavigateBounceBack(U8 texture_index)
{
/*
// Find the media entry for this navigate
const LLMediaEntry* mep = NULL;
viewer_media_t impl = getMediaImpl(texture_index);
LLTextureEntry *te = getTE(texture_index);
if(te)
{
mep = te->getMediaData();
}
if (mep && impl)
{
std::string url = mep->getCurrentURL();
// Look for a ":", if not there, assume "http://"
if (!url.empty() && std::string::npos == url.find(':'))
{
url = "http://" + url;
}
// If the url we're trying to "bounce back" to is either empty or not
// allowed by the whitelist, try the home url. If *that* doesn't work,
// set the media as failed and unload it
if (url.empty() || !mep->checkCandidateUrl(url))
{
url = mep->getHomeURL();
// Look for a ":", if not there, assume "http://"
if (!url.empty() && std::string::npos == url.find(':'))
{
url = "http://" + url;
}
}
if (url.empty() || !mep->checkCandidateUrl(url))
{
// The url to navigate back to is not good, and we have nowhere else
// to go.
LL_WARNS("MediaOnAPrim") << "FAILED to bounce back URL \"" << url << "\" -- unloading impl" << LL_ENDL;
impl->setMediaFailed(true);
}
else {
// Okay, navigate now
LL_INFOS("MediaOnAPrim") << "bouncing back to URL: " << url << LL_ENDL;
impl->navigateTo(url, "", false, true);
}
}
*/
}
+53
View File
@@ -36,6 +36,8 @@
#include "llviewerobject.h"
#include "llviewerimage.h"
#include "llframetimer.h"
#include "llmediadataclient.h"
#include "llviewermedia.h"
#include "llapr.h"
#include <map>
@@ -43,6 +45,8 @@ class LLViewerTextureAnim;
class LLDrawPool;
class LLSelectNode;
typedef std::vector<viewer_media_t> media_list_t;
enum LLVolumeInterfaceType
{
INTERFACE_FLEXIBLE = 1,
@@ -217,6 +221,46 @@ public:
// tag: vaa emerald local_asset_browser
void setSculptChanged(BOOL has_changed) { mSculptChanged = has_changed; }
// Functions that deal with media, or media navigation
// Update this object's media data with the given media data array
// (typically this is only called upon a response from a server request)
void updateObjectMediaData(const LLSD &media_data_array, const std::string &media_version);
// Bounce back media at the given index to its current URL (or home URL, if current URL is empty)
void mediaNavigateBounceBack(U8 texture_index);
// Returns whether or not this object has permission to navigate or control
// the given media entry
enum MediaPermType {
MEDIA_PERM_INTERACT, MEDIA_PERM_CONTROL
};
bool hasMediaPermission(const LLMediaEntry* media_entry, MediaPermType perm_type);
void mediaNavigated(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, std::string new_location);
void mediaEvent(LLViewerMediaImpl *impl, LLPluginClassMedia* plugin, LLViewerMediaObserver::EMediaEvent event);
// Sync the given media data with the impl and the given te
void syncMediaData(S32 te, const LLSD &media_data, bool merge, bool ignore_agent);
// Send media data update to the simulator.
void sendMediaDataUpdate();
viewer_media_t getMediaImpl(U8 face_id) const;
S32 getFaceIndexWithMediaImpl(const LLViewerMediaImpl* media_impl, S32 start_face_id);
F64 getTotalMediaInterest() const;
bool hasMedia() const;
LLVector3 getApproximateFaceNormal(U8 face_id);
// Returns 'true' iff the media data for this object is in flight
bool isMediaDataBeingFetched() const;
// Returns the "last fetched" media version, or -1 if not fetched yet
S32 getLastFetchedMediaVersion() const { return mLastFetchedMediaVersion; }
protected:
S32 computeLODDetail(F32 distance, F32 radius);
@@ -224,6 +268,11 @@ protected:
LLFace* addFace(S32 face_index);
void updateTEData();
void requestMediaDataUpdate(bool isNew);
void cleanUpMediaImpls();
void addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index) ;
void removeMediaImpl(S32 texture_index) ;
public:
LLViewerTextureAnim *mTextureAnimp;
U8 mTexAnimMode;
@@ -242,12 +291,16 @@ private:
LLVolumeInterface *mVolumeImpl;
LLPointer<LLViewerImage> mSculptTexture;
S32 mIndexInTex; // index of this volume in the texture's volume list
media_list_t mMediaImplList;
S32 mLastFetchedMediaVersion; // as fetched from the server, starts as -1
// statics
public:
static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop
static F32 sLODFactor; // LOD scale factor
static F32 sDistanceFactor; // LOD distance factor
static LLPointer<LLObjectMediaDataClient> sObjectMediaClient;
static LLPointer<LLObjectMediaNavigateClient> sObjectMediaNavigateClient;
protected:
static S32 sNumLODChanges;
+61
View File
@@ -232,6 +232,7 @@ BOOL LLPipeline::sPickAvatar = TRUE;
BOOL LLPipeline::sDynamicLOD = TRUE;
BOOL LLPipeline::sShowHUDAttachments = TRUE;
BOOL LLPipeline::sRenderPhysicalBeacons = TRUE;
BOOL LLPipeline::sRenderMOAPBeacons = FALSE;
BOOL LLPipeline::sRenderScriptedBeacons = FALSE;
BOOL LLPipeline::sRenderScriptedTouchBeacons = TRUE;
BOOL LLPipeline::sRenderParticleBeacons = FALSE;
@@ -2149,6 +2150,43 @@ void renderPhysicalBeacons(LLDrawable* drawablep)
}
}
void renderMOAPBeacons(LLDrawable* drawablep)
{
LLViewerObject *vobj = drawablep->getVObj();
if(!vobj || vobj->isAvatar())
return;
BOOL beacon=FALSE;
U8 tecount=vobj->getNumTEs();
for(int x=0;x<tecount;x++)
{
if(vobj->getTE(x)->hasMedia())
{
beacon=TRUE;
break;
}
}
if(beacon==TRUE)
{
if (gPipeline.sRenderBeacons)
{
gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
}
if (gPipeline.sRenderHighlight)
{
S32 face_id;
S32 count = drawablep->getNumFaces();
for (face_id = 0; face_id < count; face_id++)
{
gPipeline.mHighlightFaces.push_back(drawablep->getFace(face_id) );
}
}
}
}
void renderParticleBeacons(LLDrawable* drawablep)
{
// Look for attachments, objects, etc.
@@ -2329,6 +2367,11 @@ void LLPipeline::postSort(LLCamera& camera)
forAllVisibleDrawables(renderPhysicalBeacons);
}
if(sRenderMOAPBeacons)
{
forAllVisibleDrawables(renderMOAPBeacons);
}
if (sRenderParticleBeacons)
{
forAllVisibleDrawables(renderParticleBeacons);
@@ -4562,6 +4605,24 @@ BOOL LLPipeline::getRenderScriptedTouchBeacons(void*)
return sRenderScriptedTouchBeacons;
}
// static
void LLPipeline::setRenderMOAPBeacons(BOOL val)
{
sRenderMOAPBeacons = val;
}
// static
void LLPipeline::toggleRenderMOAPBeacons(void*)
{
sRenderMOAPBeacons = !sRenderMOAPBeacons;
}
// static
BOOL LLPipeline::getRenderMOAPBeacons(void*)
{
return sRenderMOAPBeacons;
}
// static
void LLPipeline::setRenderPhysicalBeacons(BOOL val)
{
+5
View File
@@ -271,6 +271,10 @@ public:
static void toggleRenderPhysicalBeacons(void* data);
static BOOL getRenderPhysicalBeacons(void* data);
static void setRenderMOAPBeacons(BOOL val);
static void toggleRenderMOAPBeacons(void * data);
static BOOL getRenderMOAPBeacons(void * data);
static void setRenderScriptedBeacons(BOOL val);
static void toggleRenderScriptedBeacons(void* data);
static BOOL getRenderScriptedBeacons(void* data);
@@ -572,6 +576,7 @@ protected:
S32 mLightingDetail;
static BOOL sRenderPhysicalBeacons;
static BOOL sRenderMOAPBeacons;
static BOOL sRenderScriptedTouchBeacons;
static BOOL sRenderScriptedBeacons;
static BOOL sRenderParticleBeacons;
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="false"
width="250" height="225"
width="250" height="255"
name="beacons" title="Beacons"
rect_control="FloaterBeaconsRect" control_name="BeaconsEnabled">
<panel bottom="10" follows="left|top|right|bottom" left="10" width="230" height="200" name="beacons_panel">
<panel bottom="10" follows="left|top|right|bottom" left="10" width="230" height="240" name="beacons_panel">
<check_box bottom_delta="-33" follows="left|top" left="0" name="touch_only" label="Scripted Objects with Touch Only" control_name="scripttouchbeacon" />
<check_box bottom_delta="-20" follows="left|top" left="0" name="scripted" label="Scripted Objects" control_name="scriptsbeacon" />
<check_box bottom_delta="-20" follows="left|top" left="0" name="physical" label="Physical Objects" control_name="physicalbeacon" />
<check_box bottom_delta="-20" follows="left|top" left="0" name="sounds" label="Sound Sources" control_name="soundsbeacon" />
<check_box bottom_delta="-20" follows="left|top" left="0" name="particles" label="Particle Sources" control_name="particlesbeacon" />
<check_box bottom_delta="-20" follows="left|top" left="0" name="highlights" label="Render Highlights" control_name="renderhighlights" />
<check_box bottom_delta="-20" follows="left|top" left="0" name="moap" label="MOAP Objects" control_name="moapbeacon" />
<check_box bottom_delta="-20" follows="left|top" left="0" name="beacons" label="Render Beacons" control_name="renderbeacons" />
<text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-30" drop_shadow_visible="true" enabled="true" follows="left|top"
@@ -385,6 +385,10 @@
<on_click function="ShowFloater" userdata="mini map" />
<on_check control="ShowMiniMap" />
</menu_item_check>
<menu_item_check enabled="true" label="MOAP Radar" name="MOAPRadar" shortcut="">
<on_click function="View.ToggleMOAPList" userdata="moapradar" />
<on_check control="ShowMOAPRadar" />
</menu_item_check>
<menu_item_separator />
<menu_item_check label="Animation Overrider" name="AO"
shortcut="control|shift|O">