Merge remote-tracking branch 'singu/master' into curlthreading2
Conflicts: indra/llcommon/CMakeLists.txt indra/llmessage/llcurl.cpp indra/llmessage/llcurl.h indra/llmessage/llhttpclient.cpp indra/llmessage/llhttpclient.h indra/llmessage/llpumpio.cpp indra/llmessage/llpumpio.h indra/llmessage/llurlrequest.cpp indra/llmessage/llurlrequest.h indra/newview/hipporestrequest.cpp indra/newview/llappviewer.cpp indra/newview/llspatialpartition.cpp indra/newview/llviewermedia.cpp indra/newview/llxmlrpctransaction.cpp Conflicts resolved by choosing curlthreading2 for any llmessage file regardless (which looks correct upon investigation); the rest also turned out to need to use curlthreading2, except in one line where I added a semi-colon after an assert(), and the assert was changed in singu/master.
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
<key>OpenCircuit</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>template</string>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>false</boolean>
|
||||
</map>
|
||||
@@ -370,6 +370,14 @@
|
||||
</map>
|
||||
|
||||
<!-- Server to client -->
|
||||
<key>DisplayNameUpdate</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>ParcelVoiceInfo</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
@@ -419,6 +427,22 @@
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>SetDisplayNameReply</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>SimConsoleResponse</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>DirLandReply</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
@@ -515,8 +539,24 @@
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<!-- UDPDeprecated Messages -->
|
||||
|
||||
<key>NavMeshStatusUpdate</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>AgentStateUpdate</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<!-- UDPDeprecated Messages -->
|
||||
<key>ScriptRunningReply</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
@@ -569,26 +609,9 @@
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<!-- Server to client -->
|
||||
<key>DisplayNameUpdate</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
<key>SetDisplayNameReply</key>
|
||||
<map>
|
||||
<key>flavor</key>
|
||||
<string>llsd</string>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
<key>trusted-sender</key>
|
||||
<boolean>true</boolean>
|
||||
</map>
|
||||
|
||||
</map>
|
||||
<key>capBans</key>
|
||||
|
||||
@@ -76,7 +76,6 @@ if (VIEWER)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcrashlogger)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llplugin)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llui)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llxuixml)
|
||||
|
||||
# viewer plugins directory
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}plugins)
|
||||
|
||||
@@ -190,10 +190,10 @@ if (LINUX)
|
||||
endif (NOT STANDALONE)
|
||||
if (${ARCH} STREQUAL "x86_64")
|
||||
add_definitions(-DLINUX64=1 -pipe)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fomit-frame-pointer -mmmx -msse -mfpmath=sse -msse2 -ffast-math -ftree-vectorize -fweb -fexpensive-optimizations -frename-registers")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -ffast-math -funroll-loops")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ffast-math")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math")
|
||||
else (${ARCH} STREQUAL "x86_64")
|
||||
if (NOT STANDALONE)
|
||||
set(MARCH_FLAG " -march=pentium4")
|
||||
@@ -327,7 +327,7 @@ else (STANDALONE)
|
||||
glib-2.0
|
||||
gstreamer-0.10
|
||||
gtk-2.0
|
||||
llfreetype2
|
||||
freetype2
|
||||
pango-1.0
|
||||
)
|
||||
endif (STANDALONE)
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
set(LLXUIXML_INCLUDE_DIRS
|
||||
${LIBS_OPEN_DIR}/llxuixml
|
||||
)
|
||||
|
||||
set(LLXUIXML_LIBRARIES llxuixml)
|
||||
@@ -15,5 +15,5 @@ else (STANDALONE)
|
||||
else(LINUX)
|
||||
set(PNG_LIBRARIES png15)
|
||||
endif()
|
||||
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/libpng15)
|
||||
set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/)
|
||||
endif (STANDALONE)
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
#include "lluuid.h"
|
||||
#include "llframetimer.h"
|
||||
#include "llassettype.h"
|
||||
#include "llextendedstatus.h"
|
||||
|
||||
#include "lllistener.h"
|
||||
|
||||
const F32 LL_WIND_UPDATE_INTERVAL = 0.1f;
|
||||
const F32 LL_ROLLOFF_MULTIPLIER_UNDER_WATER = 5.f; // How much sounds are weaker under water
|
||||
const F32 LL_WIND_UNDERWATER_CENTER_FREQ = 20.f;
|
||||
|
||||
const F32 ATTACHED_OBJECT_TIMEOUT = 5.0f;
|
||||
|
||||
@@ -72,6 +72,8 @@ bool attemptDelayLoad()
|
||||
|
||||
FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels);
|
||||
|
||||
FMOD::ChannelGroup *LLAudioEngine_FMODEX::mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT] = {0};
|
||||
|
||||
LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler)
|
||||
{
|
||||
mInited = false;
|
||||
@@ -130,9 +132,9 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
||||
|
||||
LL_DEBUGS("AppInit") << "LLAudioEngine_FMODEX::init() initializing FMOD" << LL_ENDL;
|
||||
|
||||
result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE);
|
||||
if(Check_FMOD_Error(result, "FMOD::Memory_Initialize"))
|
||||
return false;
|
||||
//result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE);
|
||||
//if(Check_FMOD_Error(result, "FMOD::Memory_Initialize"))
|
||||
// return false;
|
||||
|
||||
result = FMOD::System_Create(&mSystem);
|
||||
if(Check_FMOD_Error(result, "FMOD::System_Create"))
|
||||
@@ -159,7 +161,13 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
||||
|
||||
U32 fmod_flags = FMOD_INIT_NORMAL;
|
||||
if(mEnableProfiler)
|
||||
{
|
||||
fmod_flags |= FMOD_INIT_ENABLE_PROFILE;
|
||||
mSystem->createChannelGroup("None", &mChannelGroups[AUDIO_TYPE_NONE]);
|
||||
mSystem->createChannelGroup("SFX", &mChannelGroups[AUDIO_TYPE_SFX]);
|
||||
mSystem->createChannelGroup("UI", &mChannelGroups[AUDIO_TYPE_UI]);
|
||||
mSystem->createChannelGroup("Ambient", &mChannelGroups[AUDIO_TYPE_AMBIENT]);
|
||||
}
|
||||
|
||||
#if LL_LINUX
|
||||
bool audio_ok = false;
|
||||
@@ -604,6 +612,9 @@ void LLAudioChannelFMODEX::play()
|
||||
Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::pause");
|
||||
|
||||
getSource()->setPlayedOnce(true);
|
||||
|
||||
if(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()])
|
||||
mChannelp->setChannelGroup(LLAudioEngine_FMODEX::mChannelGroups[getSource()->getType()]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace FMOD
|
||||
{
|
||||
class System;
|
||||
class Channel;
|
||||
class ChannelGroup;
|
||||
class Sound;
|
||||
class DSP;
|
||||
}
|
||||
@@ -83,6 +84,9 @@ protected:
|
||||
FMOD::DSP *mWindDSP;
|
||||
FMOD::System *mSystem;
|
||||
bool mEnableProfiler;
|
||||
|
||||
public:
|
||||
static FMOD::ChannelGroup *mChannelGroups[LLAudioEngine::AUDIO_TYPE_COUNT];
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -106,6 +106,15 @@ void LLListener_FMODEX::commitDeferredChanges()
|
||||
|
||||
void LLListener_FMODEX::setRolloffFactor(F32 factor)
|
||||
{
|
||||
//An internal FMODEx optimization skips 3D updates if there have not been changes to the 3D sound environment.
|
||||
//Sadly, a change in rolloff is not accounted for, thus we must touch the listener properties as well.
|
||||
//In short: Changing the position ticks a dirtyflag inside fmodex, which makes it not skip 3D processing next update call.
|
||||
if(mRolloffFactor != factor)
|
||||
{
|
||||
LLVector3 pos = mVelocity - LLVector3(0.f,0.f,.1f);
|
||||
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)pos.mV, NULL, NULL, NULL);
|
||||
mSystem->set3DListenerAttributes(0, (FMOD_VECTOR*)mVelocity.mV, NULL, NULL, NULL);
|
||||
}
|
||||
mRolloffFactor = factor;
|
||||
mSystem->set3DSettings(mDopplerFactor, 1.f, mRolloffFactor);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,6 @@ void LLStreamingAudio_FMODEX::update()
|
||||
|
||||
if(mFMODInternetStreamChannelp)
|
||||
{
|
||||
//llinfos << "progress = " << progress << llendl;
|
||||
if(!mMetaData)
|
||||
mMetaData = new LLSD;
|
||||
|
||||
@@ -396,12 +395,12 @@ LLAudioStreamManagerFMODEX::LLAudioStreamManagerFMODEX(FMOD::System *system, con
|
||||
{
|
||||
mInternetStreamURL = url;
|
||||
|
||||
FMOD_CREATESOUNDEXINFO exinfo;
|
||||
/*FMOD_CREATESOUNDEXINFO exinfo;
|
||||
memset(&exinfo,0,sizeof(exinfo));
|
||||
exinfo.cbsize = sizeof(exinfo);
|
||||
exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_MPEG; //Hint to speed up loading.
|
||||
exinfo.suggestedsoundtype = FMOD_SOUND_TYPE_OGGVORBIS; //Hint to speed up loading.*/
|
||||
|
||||
FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, &exinfo, &mInternetStream);
|
||||
FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, 0, &mInternetStream);
|
||||
|
||||
if (result!= FMOD_OK)
|
||||
{
|
||||
@@ -484,4 +483,4 @@ void LLStreamingAudio_FMODEX::setBufferSizes(U32 streambuffertime, U32 decodebuf
|
||||
settings.cbsize=sizeof(settings);
|
||||
settings.defaultDecodeBufferSize = decodebuffertime;//ms
|
||||
mSystem->setAdvancedSettings(&settings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
#include "llcharacter.h"
|
||||
#include "llstring.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
#define SKEL_HEADER "Linden Skeleton 1.0"
|
||||
|
||||
@@ -194,19 +193,14 @@ void LLCharacter::requestStopMotion( LLMotion* motion)
|
||||
//-----------------------------------------------------------------------------
|
||||
// updateMotions()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation");
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim");
|
||||
|
||||
void LLCharacter::updateMotions(e_update_t update_type)
|
||||
{
|
||||
if (update_type == HIDDEN_UPDATE)
|
||||
{
|
||||
LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION);
|
||||
mMotionController.updateMotionsMinimal();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFastTimer t(FTM_UPDATE_ANIMATION);
|
||||
// unpause if the number of outstanding pause requests has dropped to the initial one
|
||||
if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1)
|
||||
{
|
||||
|
||||
@@ -250,9 +250,9 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
head_rot_local = nlerp(head_slerp_amt, mLastHeadRot, head_rot_local);
|
||||
mLastHeadRot = head_rot_local;
|
||||
|
||||
if(mNeckState->getJoint() && mNeckState->getJoint()->getParent()) //Guess this has crashed? Taken from snowglobe -Shyotl
|
||||
// Set the head rotation.
|
||||
if(mNeckState->getJoint() && mNeckState->getJoint()->getParent())
|
||||
{
|
||||
// Set the head rotation.
|
||||
LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld;
|
||||
head_rot_local = head_rot_local * ~torsoRotLocal;
|
||||
mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) );
|
||||
|
||||
@@ -637,9 +637,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
||||
motionp->fadeIn();
|
||||
}
|
||||
|
||||
// **********************
|
||||
//**********************
|
||||
// MOTION INACTIVE
|
||||
// **********************
|
||||
//**********************
|
||||
if (motionp->isStopped() && mAnimTime > motionp->getStopTime() + motionp->getEaseOutDuration())
|
||||
{
|
||||
// this motion has gone on too long, deactivate it
|
||||
@@ -659,9 +659,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
||||
}
|
||||
}
|
||||
|
||||
// **********************
|
||||
//**********************
|
||||
// MOTION EASE OUT
|
||||
// **********************
|
||||
//**********************
|
||||
else if (motionp->isStopped() && mAnimTime > motionp->getStopTime())
|
||||
{
|
||||
// is this the first iteration in the ease out phase?
|
||||
@@ -684,9 +684,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
||||
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
|
||||
}
|
||||
|
||||
// **********************
|
||||
//**********************
|
||||
// MOTION ACTIVE
|
||||
// **********************
|
||||
//**********************
|
||||
else if (mAnimTime > motionp->mActivationTimestamp + motionp->getEaseInDuration())
|
||||
{
|
||||
posep->setWeight(motionp->getFadeWeight());
|
||||
@@ -707,9 +707,9 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
||||
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
|
||||
}
|
||||
|
||||
// **********************
|
||||
//**********************
|
||||
// MOTION EASE IN
|
||||
// **********************
|
||||
//**********************
|
||||
else if (mAnimTime >= motionp->mActivationTimestamp)
|
||||
{
|
||||
if (mLastTime < motionp->mActivationTimestamp)
|
||||
@@ -837,6 +837,7 @@ void LLMotionController::updateMotions(bool force_update)
|
||||
}
|
||||
|
||||
updateLoadingMotions();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ class LLVisualParam
|
||||
{
|
||||
public:
|
||||
typedef boost::function<LLVisualParam*(S32)> visual_param_mapper;
|
||||
|
||||
LLVisualParam();
|
||||
virtual ~LLVisualParam();
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ set(llcommon_SOURCE_FILES
|
||||
llformat.cpp
|
||||
llframetimer.cpp
|
||||
llheartbeat.cpp
|
||||
llinitparam.cpp
|
||||
llinstancetracker.cpp
|
||||
llindraconfigfile.cpp
|
||||
llliveappconfig.cpp
|
||||
@@ -173,6 +174,7 @@ set(llcommon_HEADER_FILES
|
||||
llheartbeat.h
|
||||
llhttpstatuscodes.h
|
||||
llindexedqueue.h
|
||||
llinitparam.h
|
||||
llinstancetracker.h
|
||||
llindraconfigfile.h
|
||||
llkeythrottle.h
|
||||
@@ -214,6 +216,7 @@ set(llcommon_HEADER_FILES
|
||||
llsingleton.h
|
||||
llskiplist.h
|
||||
llskipmap.h
|
||||
llsortedvector.h
|
||||
llstack.h
|
||||
llstacktrace.h
|
||||
llstat.h
|
||||
@@ -228,6 +231,7 @@ set(llcommon_HEADER_FILES
|
||||
llthreadsafequeue.h
|
||||
lltimer.h
|
||||
lltreeiterators.h
|
||||
lltypeinfolookup.h
|
||||
lluri.h
|
||||
lluuid.h
|
||||
lluuidhashmap.h
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
#ifndef LL_LINDEN_COMMON_H
|
||||
#define LL_LINDEN_COMMON_H
|
||||
|
||||
// *NOTE: Please keep includes here to a minimum!
|
||||
//
|
||||
// Files included here are included in every library .cpp file and
|
||||
// are not precompiled.
|
||||
|
||||
#include "cwdebug.h"
|
||||
|
||||
#if defined(LL_WINDOWS) && defined(_DEBUG)
|
||||
@@ -55,34 +60,11 @@
|
||||
#include <ctime>
|
||||
#include <iosfwd>
|
||||
|
||||
// Work around Microsoft compiler warnings in STL headers
|
||||
#ifdef LL_WINDOWS
|
||||
#pragma warning (disable : 4702) // unreachable code
|
||||
#pragma warning (disable : 4244) // conversion from time_t to S32
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
// *TODO: Eliminate these, most library .cpp files don't need them.
|
||||
// Add them to llviewerprecompiledheaders.h if necessary.
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#ifdef LL_WINDOWS
|
||||
// Reenable warnings we disabled above
|
||||
#pragma warning (3 : 4702) // unreachable code, we like level 3, not 4
|
||||
// moved msvc warnings to llpreprocessor.h *TODO - delete this comment after merge conflicts are unlikely -brad
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
// Linden only libs in alpha-order other than stdtypes.h
|
||||
// *NOTE: Please keep includes here to a minimum, see above.
|
||||
#include "stdtypes.h"
|
||||
#include "lldefs.h"
|
||||
#include "llerror.h"
|
||||
#include "llextendedstatus.h"
|
||||
// Don't do this, adds 15K lines of header code to every library file.
|
||||
//#include "llfasttimer.h"
|
||||
#include "llfile.h"
|
||||
#include "llformat.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -148,7 +148,7 @@ const char *LLAssetType::lookup(LLAssetType::EType asset_type)
|
||||
}
|
||||
|
||||
// static
|
||||
LLAssetType::EType LLAssetType::lookup( const char* name )
|
||||
LLAssetType::EType LLAssetType::lookup(const char* name)
|
||||
{
|
||||
return lookup(ll_safe_string(name));
|
||||
}
|
||||
@@ -186,7 +186,7 @@ const char *LLAssetType::lookupHumanReadable(LLAssetType::EType asset_type)
|
||||
}
|
||||
|
||||
// static
|
||||
LLAssetType::EType LLAssetType::lookupHumanReadable( const char* name )
|
||||
LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name)
|
||||
{
|
||||
return lookupHumanReadable(ll_safe_string(name));
|
||||
}
|
||||
@@ -208,12 +208,9 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_
|
||||
return AT_NONE;
|
||||
}
|
||||
|
||||
//NOTE: LLAssetType::lookupDragAndDropType & LLAssetType::generateDescriptionFor moved to newview/llviewerassettype.h
|
||||
|
||||
// static
|
||||
bool LLAssetType::lookupCanLink(EType asset_type)
|
||||
{
|
||||
//Check that enabling all these other types as linkable doesn't break things.
|
||||
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
|
||||
const AssetEntry *entry = dict->lookup(asset_type);
|
||||
if (entry)
|
||||
@@ -221,9 +218,6 @@ bool LLAssetType::lookupCanLink(EType asset_type)
|
||||
return entry->mCanLink;
|
||||
}
|
||||
return false;
|
||||
|
||||
/*return (asset_type == AT_CLOTHING || asset_type == AT_OBJECT || asset_type == AT_CATEGORY ||
|
||||
asset_type == AT_BODYPART || asset_type == AT_GESTURE);*/
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -268,4 +262,3 @@ bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "llerror.h"
|
||||
#include "llstl.h"
|
||||
|
||||
namespace LLInitParam
|
||||
{
|
||||
@@ -205,20 +206,12 @@ namespace LLInitParam
|
||||
mutable std::string mValueName;
|
||||
};
|
||||
|
||||
class Parser
|
||||
class LL_COMMON_API Parser
|
||||
{
|
||||
LOG_CLASS(Parser);
|
||||
|
||||
public:
|
||||
|
||||
struct CompareTypeID
|
||||
{
|
||||
bool operator()(const std::type_info* lhs, const std::type_info* rhs) const
|
||||
{
|
||||
return lhs->before(*rhs);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<std::pair<std::string, bool> > name_stack_t;
|
||||
typedef std::pair<name_stack_t::iterator, name_stack_t::iterator> name_stack_range_t;
|
||||
typedef std::vector<std::string> possible_values_t;
|
||||
@@ -227,9 +220,9 @@ namespace LLInitParam
|
||||
typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&);
|
||||
typedef boost::function<void (name_stack_t&, S32, S32, const possible_values_t*)> parser_inspect_func_t;
|
||||
|
||||
typedef std::map<const std::type_info*, parser_read_func_t, CompareTypeID> parser_read_func_map_t;
|
||||
typedef std::map<const std::type_info*, parser_write_func_t, CompareTypeID> parser_write_func_map_t;
|
||||
typedef std::map<const std::type_info*, parser_inspect_func_t, CompareTypeID> parser_inspect_func_map_t;
|
||||
typedef std::map<const std::type_info*, parser_read_func_t> parser_read_func_map_t;
|
||||
typedef std::map<const std::type_info*, parser_write_func_t> parser_write_func_map_t;
|
||||
typedef std::map<const std::type_info*, parser_inspect_func_t> parser_inspect_func_map_t;
|
||||
|
||||
Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map)
|
||||
: mParseSilently(false),
|
||||
@@ -301,7 +294,7 @@ namespace LLInitParam
|
||||
class Param;
|
||||
|
||||
// various callbacks and constraints associated with an individual param
|
||||
struct ParamDescriptor
|
||||
struct LL_COMMON_API ParamDescriptor
|
||||
{
|
||||
struct UserData
|
||||
{
|
||||
@@ -341,7 +334,7 @@ namespace LLInitParam
|
||||
typedef boost::shared_ptr<ParamDescriptor> ParamDescriptorPtr;
|
||||
|
||||
// each derived Block class keeps a static data structure maintaining offsets to various params
|
||||
class BlockDescriptor
|
||||
class LL_COMMON_API BlockDescriptor
|
||||
{
|
||||
public:
|
||||
BlockDescriptor();
|
||||
@@ -369,7 +362,7 @@ namespace LLInitParam
|
||||
class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed
|
||||
};
|
||||
|
||||
class BaseBlock
|
||||
class LL_COMMON_API BaseBlock
|
||||
{
|
||||
public:
|
||||
//TODO: implement in terms of owned_ptr
|
||||
@@ -566,7 +559,7 @@ namespace LLInitParam
|
||||
static bool equals(const BaseBlock::Lazy<T>& a, const BaseBlock::Lazy<T>& b) { return !a.empty() || !b.empty(); }
|
||||
};
|
||||
|
||||
class Param
|
||||
class LL_COMMON_API Param
|
||||
{
|
||||
public:
|
||||
void setProvided(bool is_provided = true)
|
||||
@@ -1253,15 +1246,16 @@ namespace LLInitParam
|
||||
return mValues.back();
|
||||
}
|
||||
|
||||
void add(const value_t& item)
|
||||
self_t& add(const value_t& item)
|
||||
{
|
||||
param_value_t param_value;
|
||||
param_value.setValue(item);
|
||||
mValues.push_back(param_value);
|
||||
setProvided();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void add(const typename name_value_lookup_t::name_t& name)
|
||||
self_t& add(const typename name_value_lookup_t::name_t& name)
|
||||
{
|
||||
value_t value;
|
||||
|
||||
@@ -1271,6 +1265,8 @@ namespace LLInitParam
|
||||
add(value);
|
||||
mValues.back().setValueName(name);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// implicit conversion
|
||||
@@ -1441,13 +1437,14 @@ namespace LLInitParam
|
||||
return mValues.back();
|
||||
}
|
||||
|
||||
void add(const value_t& item)
|
||||
self_t& add(const value_t& item)
|
||||
{
|
||||
mValues.push_back(item);
|
||||
setProvided();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void add(const typename name_value_lookup_t::name_t& name)
|
||||
self_t& add(const typename name_value_lookup_t::name_t& name)
|
||||
{
|
||||
value_t value;
|
||||
|
||||
@@ -1457,6 +1454,7 @@ namespace LLInitParam
|
||||
add(value);
|
||||
mValues.back().setValueName(name);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// implicit conversion
|
||||
@@ -2057,8 +2055,8 @@ namespace LLInitParam
|
||||
|
||||
|
||||
// block param interface
|
||||
bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name);
|
||||
void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const;
|
||||
LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name);
|
||||
LL_COMMON_API void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const;
|
||||
bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const
|
||||
{
|
||||
//TODO: implement LLSD params as schema type Any
|
||||
@@ -174,6 +174,7 @@ public:
|
||||
F64 averageCount = curr.count + prevCount * (1.0 - timeInCurrent);
|
||||
return averageCount;
|
||||
}
|
||||
|
||||
// call each time the key wants use
|
||||
State noteAction(const T& id, S32 weight = 1)
|
||||
{
|
||||
|
||||
@@ -73,6 +73,15 @@ const S32 LSL_PRIM_TEXGEN = 22;
|
||||
const S32 LSL_PRIM_POINT_LIGHT = 23;
|
||||
const S32 LSL_PRIM_CAST_SHADOWS = 24;
|
||||
const S32 LSL_PRIM_GLOW = 25;
|
||||
const S32 LSL_PRIM_TEXT = 26;
|
||||
const S32 LSL_PRIM_NAME = 27;
|
||||
const S32 LSL_PRIM_DESC = 28;
|
||||
const S32 LSL_PRIM_ROT_LOCAL = 29;
|
||||
const S32 LSL_PRIM_PHYSICS_SHAPE_TYPE = 30;
|
||||
const S32 LSL_PRIM_OMEGA = 32;
|
||||
const S32 LSL_PRIM_POS_LOCAL = 33;
|
||||
const S32 LSL_PRIM_LINK_TARGET = 34;
|
||||
const S32 LSL_PRIM_SLICE = 35;
|
||||
|
||||
const S32 LSL_PRIM_TYPE_BOX = 0;
|
||||
const S32 LSL_PRIM_TYPE_CYLINDER= 1;
|
||||
@@ -132,6 +141,15 @@ const S32 LSL_PRIM_SCULPT_TYPE_MASK = 7;
|
||||
const S32 LSL_PRIM_SCULPT_FLAG_INVERT = 64;
|
||||
const S32 LSL_PRIM_SCULPT_FLAG_MIRROR = 128;
|
||||
|
||||
const S32 LSL_PRIM_PHYSICS_SHAPE_PRIM = 0;
|
||||
const S32 LSL_PRIM_PHYSICS_SHAPE_NONE = 1;
|
||||
const S32 LSL_PRIM_PHYSICS_SHAPE_CONVEX = 2;
|
||||
|
||||
const S32 LSL_DENSITY = 1;
|
||||
const S32 LSL_FRICTION = 2;
|
||||
const S32 LSL_RESTITUTION = 4;
|
||||
const S32 LSL_GRAVITY_MULTIPLIER = 8;
|
||||
|
||||
const S32 LSL_ALL_SIDES = -1;
|
||||
const S32 LSL_LINK_ROOT = 1;
|
||||
const S32 LSL_LINK_FIRST_CHILD = 2;
|
||||
@@ -189,6 +207,13 @@ const S32 OBJECT_RUNNING_SCRIPT_COUNT = 9;
|
||||
const S32 OBJECT_TOTAL_SCRIPT_COUNT = 10;
|
||||
const S32 OBJECT_SCRIPT_MEMORY = 11;
|
||||
const S32 OBJECT_SCRIPT_TIME = 12;
|
||||
const S32 OBJECT_PRIM_EQUIVALENCE = 13;
|
||||
const S32 OBJECT_SERVER_COST = 14;
|
||||
const S32 OBJECT_STREAMING_COST = 15;
|
||||
const S32 OBJECT_PHYSICS_COST = 16;
|
||||
|
||||
// llTextBox() magic token string - yes it's a hack.
|
||||
char const* const TEXTBOX_MAGIC_TOKEN = "!!llTextBox!!";
|
||||
|
||||
// changed() event flags
|
||||
const U32 CHANGED_NONE = 0x0;
|
||||
@@ -216,4 +241,156 @@ const U32 LSL_STATUS_INTERNAL_ERROR = 1999;
|
||||
|
||||
// Start per-function errors below, starting at 2000:
|
||||
const U32 LSL_STATUS_WHITELIST_FAILED = 2001;
|
||||
|
||||
// Memory profiling support
|
||||
const S32 LSL_PROFILE_SCRIPT_NONE = 0;
|
||||
const S32 LSL_PROFILE_SCRIPT_MEMORY = 1;
|
||||
|
||||
// HTTP responses contents type
|
||||
const S32 LSL_CONTENT_TYPE_TEXT = 0;
|
||||
const S32 LSL_CONTENT_TYPE_HTML = 1;
|
||||
|
||||
// Ray casting
|
||||
const S32 LSL_RCERR_UNKNOWN = -1;
|
||||
const S32 LSL_RCERR_SIM_PERF_LOW = -2;
|
||||
const S32 LSL_RCERR_CAST_TIME_EXCEEDED = -3;
|
||||
|
||||
const S32 LSL_RC_REJECT_TYPES = 0;
|
||||
const S32 LSL_RC_DETECT_PHANTOM = 1;
|
||||
const S32 LSL_RC_DATA_FLAGS = 2;
|
||||
const S32 LSL_RC_MAX_HITS = 3;
|
||||
|
||||
const S32 LSL_RC_REJECT_AGENTS = 1;
|
||||
const S32 LSL_RC_REJECT_PHYSICAL = 2;
|
||||
const S32 LSL_RC_REJECT_NONPHYSICAL = 4;
|
||||
const S32 LSL_RC_REJECT_LAND = 8;
|
||||
|
||||
const S32 LSL_RC_GET_NORMAL = 1;
|
||||
const S32 LSL_RC_GET_ROOT_KEY = 2;
|
||||
const S32 LSL_RC_GET_LINK_NUM = 4;
|
||||
|
||||
// Estate management
|
||||
const S32 LSL_ESTATE_ACCESS_ALLOWED_AGENT_ADD = 4;
|
||||
const S32 LSL_ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 8;
|
||||
const S32 LSL_ESTATE_ACCESS_ALLOWED_GROUP_ADD = 16;
|
||||
const S32 LSL_ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 32;
|
||||
const S32 LSL_ESTATE_ACCESS_BANNED_AGENT_ADD = 64;
|
||||
const S32 LSL_ESTATE_ACCESS_BANNED_AGENT_REMOVE = 128;
|
||||
|
||||
// Key Frame Motion:
|
||||
const S32 LSL_KFM_COMMAND = 0;
|
||||
const S32 LSL_KFM_MODE = 1;
|
||||
const S32 LSL_KFM_DATA = 2;
|
||||
const S32 LSL_KFM_FORWARD = 0;
|
||||
const S32 LSL_KFM_LOOP = 1;
|
||||
const S32 LSL_KFM_PING_PONG = 2;
|
||||
const S32 LSL_KFM_REVERSE = 3;
|
||||
const S32 LSL_KFM_ROTATION = 1;
|
||||
const S32 LSL_KFM_TRANSLATION = 2;
|
||||
const S32 LSL_KFM_CMD_PLAY = 0;
|
||||
const S32 LSL_KFM_CMD_STOP = 1;
|
||||
const S32 LSL_KFM_CMD_PAUSE = 2;
|
||||
|
||||
// Second Life Server/12 12.04.30.255166 constants for llGetAgentList
|
||||
const S32 AGENT_LIST_PARCEL = 1;
|
||||
const S32 AGENT_LIST_PARCEL_OWNER = 2;
|
||||
const S32 AGENT_LIST_REGION = 4;
|
||||
|
||||
|
||||
// --- SL Constants ABOVE this line ---
|
||||
// --- OpenSim / Aurora-Sim constants Below ---
|
||||
// OpenSim Constants (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\LSL_Constants.cs)
|
||||
// Constants for cmWindlight (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\CM_Constants.cs)
|
||||
const S32 CHANGED_ANIMATION = 16384;
|
||||
const S32 PARCEL_DETAILS_CLAIMDATE = 10; // used by OpenSim osSetParcelDetails
|
||||
const S32 STATS_TIME_DILATION = 0;
|
||||
const S32 STATS_SIM_FPS = 1;
|
||||
const S32 STATS_PHYSICS_FPS = 2;
|
||||
const S32 STATS_AGENT_UPDATES = 3;
|
||||
const S32 STATS_ROOT_AGENTS = 4;
|
||||
const S32 STATS_CHILD_AGENTS = 5;
|
||||
const S32 STATS_TOTAL_PRIMS = 6;
|
||||
const S32 STATS_ACTIVE_PRIMS = 7;
|
||||
const S32 STATS_FRAME_MS = 8;
|
||||
const S32 STATS_NET_MS = 9;
|
||||
const S32 STATS_PHYSICS_MS = 10;
|
||||
const S32 STATS_IMAGE_MS = 11;
|
||||
const S32 STATS_OTHER_MS = 12;
|
||||
const S32 STATS_IN_PACKETS_PER_SECOND = 13;
|
||||
const S32 STATS_OUT_PACKETS_PER_SECOND = 14;
|
||||
const S32 STATS_UNACKED_BYTES = 15;
|
||||
const S32 STATS_AGENT_MS = 16;
|
||||
const S32 STATS_PENDING_DOWNLOADS = 17;
|
||||
const S32 STATS_PENDING_UPLOADS = 18;
|
||||
const S32 STATS_ACTIVE_SCRIPTS = 19;
|
||||
const S32 STATS_SCRIPT_LPS = 20;
|
||||
// osNPC
|
||||
const S32 OS_NPC_FLY = 0;
|
||||
const S32 OS_NPC_NO_FLY = 1;
|
||||
const S32 OS_NPC_LAND_AT_TARGET = 2;
|
||||
const S32 OS_NPC_SIT_NOW = 0;
|
||||
const U32 OS_NPC_CREATOR_OWNED = 0x1;
|
||||
const U32 OS_NPC_NOT_OWNED = 0x2;
|
||||
const U32 OS_NPC_SENSE_AS_AGENT = 0x4;
|
||||
const U32 OS_NPC_RUNNING = 4;
|
||||
// Lightshare / Windlight
|
||||
const S32 WL_WATER_COLOR = 0;
|
||||
const S32 WL_WATER_FOG_DENSITY_EXPONENT = 1;
|
||||
const S32 WL_UNDERWATER_FOG_MODIFIER = 2;
|
||||
const S32 WL_REFLECTION_WAVELET_SCALE = 3;
|
||||
const S32 WL_FRESNEL_SCALE = 4;
|
||||
const S32 WL_FRESNEL_OFFSET = 5;
|
||||
const S32 WL_REFRACT_SCALE_ABOVE = 6;
|
||||
const S32 WL_REFRACT_SCALE_BELOW = 7;
|
||||
const S32 WL_BLUR_MULTIPLIER = 8;
|
||||
const S32 WL_BIG_WAVE_DIRECTION = 9;
|
||||
const S32 WL_LITTLE_WAVE_DIRECTION = 10;
|
||||
const S32 WL_NORMAL_MAP_TEXTURE = 11;
|
||||
const S32 WL_HORIZON = 12;
|
||||
const S32 WL_HAZE_HORIZON = 13;
|
||||
const S32 WL_BLUE_DENSITY = 14;
|
||||
const S32 WL_HAZE_DENSITY = 15;
|
||||
const S32 WL_DENSITY_MULTIPLIER = 16;
|
||||
const S32 WL_DISTANCE_MULTIPLIER = 17;
|
||||
const S32 WL_MAX_ALTITUDE = 18;
|
||||
const S32 WL_SUN_MOON_COLOR = 19;
|
||||
const S32 WL_AMBIENT = 20;
|
||||
const S32 WL_EAST_ANGLE = 21;
|
||||
const S32 WL_SUN_GLOW_FOCUS = 22;
|
||||
const S32 WL_SUN_GLOW_SIZE = 23;
|
||||
const S32 WL_SCENE_GAMMA = 24;
|
||||
const S32 WL_STAR_BRIGHTNESS = 25;
|
||||
const S32 WL_CLOUD_COLOR = 26;
|
||||
const S32 WL_CLOUD_XY_DENSITY = 27;
|
||||
const S32 WL_CLOUD_COVERAGE = 28;
|
||||
const S32 WL_CLOUD_SCALE = 29;
|
||||
const S32 WL_CLOUD_DETAIL_XY_DENSITY = 30;
|
||||
const S32 WL_CLOUD_SCROLL_X = 31;
|
||||
const S32 WL_CLOUD_SCROLL_Y = 32;
|
||||
const S32 WL_CLOUD_SCROLL_Y_LOCK = 33;
|
||||
const S32 WL_CLOUD_SCROLL_X_LOCK = 34;
|
||||
const S32 WL_DRAW_CLASSIC_CLOUDS = 35;
|
||||
const S32 WL_SUN_MOON_POSITION = 36;
|
||||
// Aurora-Sim Constants (\Aurora\AuroraDotNetEngine\APIs\AA_Constants.cs) -->
|
||||
const S32 BOT_FOLLOW_FLAG_NONE = 0;
|
||||
const S32 BOT_FOLLOW_FLAG_INDEFINITELY = 1;
|
||||
const S32 BOT_FOLLOW_WALK = 0;
|
||||
const S32 BOT_FOLLOW_RUN = 1;
|
||||
const S32 BOT_FOLLOW_FLY = 2;
|
||||
const S32 BOT_FOLLOW_TELEPORT = 3;
|
||||
const S32 BOT_FOLLOW_WAIT = 4;
|
||||
const S32 BOT_FOLLOW_TRIGGER_HERE_EVENT = 1;
|
||||
const S32 BOT_FOLLOW_FLAG_FORCEDIRECTPATH = 4;
|
||||
// string constants from Aurora-Sim
|
||||
char const* const ENABLE_GRAVITY = "enable_gravity";
|
||||
char const* const GRAVITY_FORCE_X = "gravity_force_x";
|
||||
char const* const GRAVITY_FORCE_Y = "gravity_force_y";
|
||||
char const* const GRAVITY_FORCE_Z = "gravity_force_z";
|
||||
char const* const ADD_GRAVITY_POINT = "add_gravity_point";
|
||||
char const* const ADD_GRAVITY_FORCE = "add_gravity_force";
|
||||
char const* const START_TIME_REVERSAL_SAVING = "start_time_reversal_saving";
|
||||
char const* const STOP_TIME_REVERSAL_SAVING = "stop_time_reversal_saving";
|
||||
char const* const START_TIME_REVERSAL = "start_time_reversal";
|
||||
char const* const STOP_TIME_REVERSAL = "stop_time_reversal";
|
||||
|
||||
#endif
|
||||
|
||||
@@ -376,24 +376,24 @@ private:
|
||||
// uses the MSVC compiler intrinsics __cpuid() and __rdtsc().
|
||||
|
||||
// Delays for the specified amount of milliseconds
|
||||
static void _Delay(unsigned int ms)
|
||||
static void _Delay(unsigned int ms)
|
||||
{
|
||||
LARGE_INTEGER freq, c1, c2;
|
||||
__int64 x;
|
||||
LARGE_INTEGER freq, c1, c2;
|
||||
__int64 x;
|
||||
|
||||
// Get High-Res Timer frequency
|
||||
// Get High-Res Timer frequency
|
||||
if (!QueryPerformanceFrequency(&freq))
|
||||
return;
|
||||
|
||||
|
||||
// Convert ms to High-Res Timer value
|
||||
x = freq.QuadPart/1000*ms;
|
||||
|
||||
// Get first snapshot of High-Res Timer value
|
||||
// Get first snapshot of High-Res Timer value
|
||||
QueryPerformanceCounter(&c1);
|
||||
do
|
||||
{
|
||||
// Get second snapshot
|
||||
QueryPerformanceCounter(&c2);
|
||||
// Get second snapshot
|
||||
QueryPerformanceCounter(&c2);
|
||||
}while(c2.QuadPart-c1.QuadPart < x);
|
||||
// Loop while (second-first < x)
|
||||
}
|
||||
|
||||
@@ -52,5 +52,4 @@ private:
|
||||
LLProcessorInfoImpl* mImpl;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif // LLPROCESSOR_H
|
||||
|
||||
@@ -60,6 +60,9 @@ static const char LEGACY_NON_HEADER[] = "<llsd>";
|
||||
const std::string LLSD_BINARY_HEADER("LLSD/Binary");
|
||||
const std::string LLSD_XML_HEADER("LLSD/XML");
|
||||
|
||||
//used to deflate a gzipped asset (currently used for navmeshes)
|
||||
#define windowBits 15
|
||||
#define ENABLE_ZLIB_GZIP 32
|
||||
/**
|
||||
* LLSDSerialize
|
||||
*/
|
||||
@@ -2172,3 +2175,80 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
|
||||
free(result);
|
||||
return true;
|
||||
}
|
||||
//This unzip function will only work with a gzip header and trailer - while the contents
|
||||
//of the actual compressed data is the same for either format (gzip vs zlib ), the headers
|
||||
//and trailers are different for the formats.
|
||||
U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size )
|
||||
{
|
||||
U8* result = NULL;
|
||||
U32 cur_size = 0;
|
||||
z_stream strm;
|
||||
|
||||
const U32 CHUNK = 0x4000;
|
||||
|
||||
U8 *in = new U8[size];
|
||||
is.read((char*) in, size);
|
||||
|
||||
U8 out[CHUNK];
|
||||
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = size;
|
||||
strm.next_in = in;
|
||||
|
||||
|
||||
S32 ret = inflateInit2(&strm, windowBits | ENABLE_ZLIB_GZIP );
|
||||
do
|
||||
{
|
||||
strm.avail_out = CHUNK;
|
||||
strm.next_out = out;
|
||||
ret = inflate(&strm, Z_NO_FLUSH);
|
||||
if (ret == Z_STREAM_ERROR)
|
||||
{
|
||||
inflateEnd(&strm);
|
||||
free(result);
|
||||
delete [] in;
|
||||
valid = false;
|
||||
}
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case Z_NEED_DICT:
|
||||
ret = Z_DATA_ERROR;
|
||||
case Z_DATA_ERROR:
|
||||
case Z_MEM_ERROR:
|
||||
inflateEnd(&strm);
|
||||
free(result);
|
||||
delete [] in;
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
|
||||
U32 have = CHUNK-strm.avail_out;
|
||||
|
||||
result = (U8*) realloc(result, cur_size + have);
|
||||
memcpy(result+cur_size, out, have);
|
||||
cur_size += have;
|
||||
|
||||
} while (ret == Z_OK);
|
||||
|
||||
inflateEnd(&strm);
|
||||
delete [] in;
|
||||
|
||||
if (ret != Z_STREAM_END)
|
||||
{
|
||||
free(result);
|
||||
valid = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//result now points to the decompressed LLSD block
|
||||
{
|
||||
outsize= cur_size;
|
||||
valid = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -755,6 +755,9 @@ public:
|
||||
LLPointer<LLSDXMLParser> p = new LLSDXMLParser;
|
||||
return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED);
|
||||
}
|
||||
// Line oriented parser, 30% faster than fromXML(), but can
|
||||
// only be used when you know you have the complete XML
|
||||
// document available in the stream.
|
||||
static S32 fromXMLDocument(LLSD& sd, std::istream& str)
|
||||
{
|
||||
LLPointer<LLSDXMLParser> p = new LLSDXMLParser();
|
||||
@@ -791,4 +794,5 @@ public:
|
||||
//dirty little zip functions -- yell at davep
|
||||
LL_COMMON_API std::string zip_llsd(LLSD& data);
|
||||
LL_COMMON_API bool unzip_llsd(LLSD& data, std::istream& is, S32 size);
|
||||
LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size);
|
||||
#endif // LL_LLSDSERIALIZE_H
|
||||
|
||||
152
indra/llcommon/llsortedvector.h
Normal file
152
indra/llcommon/llsortedvector.h
Normal file
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* @file llsortedvector.h
|
||||
* @author Nat Goodspeed
|
||||
* @date 2012-04-08
|
||||
* @brief LLSortedVector class wraps a vector that we maintain in sorted
|
||||
* order so we can perform binary-search lookups.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Copyright (c) 2012, Linden Research, Inc.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#if ! defined(LL_LLSORTEDVECTOR_H)
|
||||
#define LL_LLSORTEDVECTOR_H
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
/**
|
||||
* LLSortedVector contains a std::vector<std::pair> that we keep sorted on the
|
||||
* first of the pair. This makes insertion somewhat more expensive than simple
|
||||
* std::vector::push_back(), but allows us to use binary search for lookups.
|
||||
* It's intended for small aggregates where lookup is far more performance-
|
||||
* critical than insertion; in such cases a binary search on a small, sorted
|
||||
* std::vector can be more performant than a std::map lookup.
|
||||
*/
|
||||
template <typename KEY, typename VALUE>
|
||||
class LLSortedVector
|
||||
{
|
||||
public:
|
||||
typedef LLSortedVector<KEY, VALUE> self;
|
||||
typedef KEY key_type;
|
||||
typedef VALUE mapped_type;
|
||||
typedef std::pair<key_type, mapped_type> value_type;
|
||||
typedef std::vector<value_type> PairVector;
|
||||
typedef typename PairVector::iterator iterator;
|
||||
typedef typename PairVector::const_iterator const_iterator;
|
||||
|
||||
/// Empty
|
||||
LLSortedVector() {}
|
||||
|
||||
/// Fixed initial size
|
||||
LLSortedVector(std::size_t size):
|
||||
mVector(size)
|
||||
{}
|
||||
|
||||
/// Bulk load
|
||||
template <typename ITER>
|
||||
LLSortedVector(ITER begin, ITER end):
|
||||
mVector(begin, end)
|
||||
{
|
||||
// Allow caller to dump in a bunch of (pairs convertible to)
|
||||
// value_type if desired, but make sure we sort afterwards.
|
||||
std::sort(mVector.begin(), mVector.end());
|
||||
}
|
||||
|
||||
/// insert(key, value)
|
||||
std::pair<iterator, bool> insert(const key_type& key, const mapped_type& value)
|
||||
{
|
||||
return insert(value_type(key, value));
|
||||
}
|
||||
|
||||
/// insert(value_type)
|
||||
std::pair<iterator, bool> insert(const value_type& pair)
|
||||
{
|
||||
typedef std::pair<iterator, bool> iterbool;
|
||||
iterator found = std::lower_bound(mVector.begin(), mVector.end(), pair,
|
||||
less<value_type>());
|
||||
// have to check for end() before it's even valid to dereference
|
||||
if (found == mVector.end())
|
||||
{
|
||||
std::size_t index(mVector.size());
|
||||
mVector.push_back(pair);
|
||||
// don't forget that push_back() invalidates 'found'
|
||||
return iterbool(mVector.begin() + index, true);
|
||||
}
|
||||
if (found->first == pair.first)
|
||||
{
|
||||
return iterbool(found, false);
|
||||
}
|
||||
// remember that insert() invalidates 'found' -- save index
|
||||
std::size_t index(found - mVector.begin());
|
||||
mVector.insert(found, pair);
|
||||
// okay, convert from index back to iterator
|
||||
return iterbool(mVector.begin() + index, true);
|
||||
}
|
||||
|
||||
iterator begin() { return mVector.begin(); }
|
||||
iterator end() { return mVector.end(); }
|
||||
const_iterator begin() const { return mVector.begin(); }
|
||||
const_iterator end() const { return mVector.end(); }
|
||||
|
||||
bool empty() const { return mVector.empty(); }
|
||||
std::size_t size() const { return mVector.size(); }
|
||||
|
||||
/// find
|
||||
iterator find(const key_type& key)
|
||||
{
|
||||
iterator found = std::lower_bound(mVector.begin(), mVector.end(),
|
||||
value_type(key, mapped_type()),
|
||||
less<value_type>());
|
||||
if (found == mVector.end() || found->first != key)
|
||||
return mVector.end();
|
||||
return found;
|
||||
}
|
||||
|
||||
const_iterator find(const key_type& key) const
|
||||
{
|
||||
return const_cast<self*>(this)->find(key);
|
||||
}
|
||||
|
||||
private:
|
||||
// Define our own 'less' comparator so we can specialize without messing
|
||||
// with std::less.
|
||||
template <typename T>
|
||||
struct less: public std::less<T> {};
|
||||
|
||||
// Specialize 'less' for an LLSortedVector::value_type involving
|
||||
// std::type_info*. This is one of LLSortedVector's foremost use cases. We
|
||||
// specialize 'less' rather than just defining a specific comparator
|
||||
// because LLSortedVector should be usable for other key_types as well.
|
||||
template <typename T>
|
||||
struct less< std::pair<std::type_info*, T> >:
|
||||
public std::binary_function<std::pair<std::type_info*, T>,
|
||||
std::pair<std::type_info*, T>,
|
||||
bool>
|
||||
{
|
||||
bool operator()(const std::pair<std::type_info*, T>& lhs,
|
||||
const std::pair<std::type_info*, T>& rhs) const
|
||||
{
|
||||
return lhs.first->before(*rhs.first);
|
||||
}
|
||||
};
|
||||
|
||||
// Same as above, but with const std::type_info*.
|
||||
template <typename T>
|
||||
struct less< std::pair<const std::type_info*, T> >:
|
||||
public std::binary_function<std::pair<const std::type_info*, T>,
|
||||
std::pair<const std::type_info*, T>,
|
||||
bool>
|
||||
{
|
||||
bool operator()(const std::pair<const std::type_info*, T>& lhs,
|
||||
const std::pair<const std::type_info*, T>& rhs) const
|
||||
{
|
||||
return lhs.first->before(*rhs.first);
|
||||
}
|
||||
};
|
||||
|
||||
PairVector mVector;
|
||||
};
|
||||
|
||||
#endif /* ! defined(LL_LLSORTEDVECTOR_H) */
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <deque>
|
||||
#include "stdtypes.h" // llcommon/stdtypes.h, needed for S32 and U32.
|
||||
#include <typeinfo>
|
||||
|
||||
// Use to compare the first element only of a pair
|
||||
// e.g. typedef std::set<std::pair<int, Data*>, compare_pair<int, Data*> > some_pair_set_t;
|
||||
@@ -477,4 +477,54 @@ llbind2nd(const _Operation& __oper, const _Tp& __x)
|
||||
return llbinder2nd<_Operation>(__oper, _Arg2_type(__x));
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare std::type_info* pointers a la std::less. We break this out as a
|
||||
* separate function for use in two different std::less specializations.
|
||||
*/
|
||||
inline
|
||||
bool before(const std::type_info* lhs, const std::type_info* rhs)
|
||||
{
|
||||
#if LL_LINUX && defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
|
||||
// If we're building on Linux with gcc, and it's either gcc 3.x or
|
||||
// 4.{0,1,2,3}, then we have to use a workaround. Note that we use gcc on
|
||||
// Mac too, and some people build with gcc on Windows (cygwin or mingw).
|
||||
// On Linux, different load modules may produce different type_info*
|
||||
// pointers for the same type. Have to compare name strings to get good
|
||||
// results.
|
||||
return strcmp(lhs->name(), rhs->name()) < 0;
|
||||
#else // not Linux, or gcc 4.4+
|
||||
// Just use before(), as we normally would
|
||||
return lhs->before(*rhs);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialize std::less<std::type_info*> to use std::type_info::before().
|
||||
* See MAINT-1175. It is NEVER a good idea to directly compare std::type_info*
|
||||
* because, on Linux, you might get different std::type_info* pointers for the
|
||||
* same type (from different load modules)!
|
||||
*/
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct less<const std::type_info*>:
|
||||
public std::binary_function<const std::type_info*, const std::type_info*, bool>
|
||||
{
|
||||
bool operator()(const std::type_info* lhs, const std::type_info* rhs) const
|
||||
{
|
||||
return before(lhs, rhs);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct less<std::type_info*>:
|
||||
public std::binary_function<std::type_info*, std::type_info*, bool>
|
||||
{
|
||||
bool operator()(std::type_info* lhs, std::type_info* rhs) const
|
||||
{
|
||||
return before(lhs, rhs);
|
||||
}
|
||||
};
|
||||
} // std
|
||||
|
||||
#endif // LL_LLSTL_H
|
||||
|
||||
@@ -42,10 +42,10 @@ template <class Object> class LLStrider
|
||||
U8* mBytep;
|
||||
};
|
||||
U32 mSkip;
|
||||
//U32 mTypeSize;
|
||||
|
||||
public:
|
||||
|
||||
LLStrider() { mObjectp = NULL; /*mTypeSize = */mSkip = sizeof(Object); }
|
||||
LLStrider() { mObjectp = NULL; mSkip = sizeof(Object); }
|
||||
~LLStrider() { }
|
||||
|
||||
const LLStrider<Object>& operator = (Object *first) { mObjectp = first; return *this;}
|
||||
@@ -60,9 +60,6 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//void setTypeSize (S32 typeBytes){ mTypeSize = (typeBytes ? typeBytes : sizeof(Object)); }
|
||||
|
||||
//bool isStrided() const { return mTypeSize != mSkip; }
|
||||
void skip(const U32 index) { mBytep += mSkip*index;}
|
||||
U32 getSkip() const { return mSkip; }
|
||||
Object* get() { return mObjectp; }
|
||||
@@ -70,72 +67,9 @@ public:
|
||||
Object& operator *() { return *mObjectp; }
|
||||
Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; }
|
||||
Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; }
|
||||
|
||||
Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); }
|
||||
/*void assignArray(U8* __restrict source, const size_t elem_size, const size_t elem_count)
|
||||
{
|
||||
llassert_always(sizeof(Object) <= elem_size);
|
||||
|
||||
U8* __restrict dest = mBytep; //refer to dest instead of mBytep to benefit from __restrict hint
|
||||
const U32 bytes = elem_size * elem_count; //total bytes to copy from source to dest
|
||||
|
||||
//stride == sizeof(element) implies entire buffer is unstrided and thus memcpy-able, provided source buffer elements match in size.
|
||||
//Because LLStrider is often passed an LLVector3 even if the reprensentation is LLVector4 in the vertex buffer, mTypeSize is set to
|
||||
//the TRUE vbo datatype size via VertexBufferStrider::get
|
||||
if(!isStrided() && mTypeSize == elem_size)
|
||||
{
|
||||
if(bytes >= sizeof(LLVector4) * 4) //Should be able to pull at least 3 16byte blocks from this. Smaller isn't really beneficial.
|
||||
{
|
||||
U8* __restrict aligned_source = LL_NEXT_ALIGNED_ADDRESS(source);
|
||||
U8* __restrict aligned_dest = LL_NEXT_ALIGNED_ADDRESS(dest);
|
||||
const U32 source_offset = aligned_source - source; //Offset to first aligned location in source buffer.
|
||||
const U32 dest_offset = aligned_dest - dest; //Offset to first aligned location in dest buffer.
|
||||
llassert_always(source_offset < 16);
|
||||
llassert_always(dest_offset < 16);
|
||||
if(source_offset == dest_offset) //delta to aligned location matches between source and destination! _mm_*_ps should be viable.
|
||||
{
|
||||
const U32 end_offset = (bytes - source_offset) % sizeof(LLVector4); //buffers may not neatly end on a 16byte alignment boundary.
|
||||
const U32 aligned_bytes = bytes - source_offset - end_offset; //how many bytes to copy from aligned start to aligned end.
|
||||
|
||||
llassert_always(aligned_bytes > 0);
|
||||
|
||||
if(source_offset) //memcpy up to the aligned location if needed
|
||||
memcpy(dest,source,source_offset);
|
||||
LLVector4a::memcpyNonAliased16((F32*) aligned_dest, (F32*) aligned_source, aligned_bytes);
|
||||
if(end_offset) //memcpy to the very end if needed.
|
||||
memcpy(aligned_dest+aligned_bytes,aligned_source+aligned_bytes,end_offset);
|
||||
}
|
||||
else //buffers non-uniformly offset from aligned location. Using _mm_*u_ps.
|
||||
{
|
||||
U32 end = bytes/sizeof(LLVector4); //sizeof(LLVector4) = 16 bytes = 128 bits
|
||||
|
||||
llassert_always(end > 0);
|
||||
|
||||
__m128* dst = (__m128*) dest;
|
||||
__m128* src = (__m128*) source;
|
||||
|
||||
for (U32 i = 0; i < end; i++) //copy 128bit chunks
|
||||
{
|
||||
__m128 res = _mm_loadu_ps((F32*)&src[i]);
|
||||
_mm_storeu_ps((F32*)&dst[i], res);
|
||||
}
|
||||
end*=16;//Convert to real byte offset
|
||||
if(end < bytes) //just memcopy the rest
|
||||
memcpy(dest+end,source+end,bytes-end);
|
||||
}
|
||||
}
|
||||
else //Too small. just do a simple memcpy.
|
||||
memcpy(dest,source,bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(U32 i=0;i<elem_count;i++)
|
||||
{
|
||||
memcpy(dest,source,sizeof(Object));
|
||||
dest+=mSkip;
|
||||
source+=elem_size;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
};
|
||||
|
||||
#endif // LL_LLSTRIDER_H
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "llstring.h"
|
||||
#include "llerror.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
#if LL_WINDOWS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
@@ -604,16 +603,10 @@ std::string utf8str_removeCRLF(const std::string& utf8str)
|
||||
}
|
||||
const char CR = 13;
|
||||
|
||||
S32 i = utf8str.find(CR);
|
||||
if(i == std::string::npos)
|
||||
return utf8str; //Save us from a reserve call.
|
||||
|
||||
std::string out;
|
||||
out.reserve(utf8str.length());
|
||||
const S32 len = (S32)utf8str.length();
|
||||
if(i)
|
||||
out.assign(utf8str,0,i); //Copy previous text to buffer
|
||||
for( ++i; i < len; i++ )
|
||||
for( S32 i = 0; i < len; i++ )
|
||||
{
|
||||
if( utf8str[i] != CR )
|
||||
{
|
||||
|
||||
@@ -35,11 +35,10 @@
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <locale>
|
||||
#include <iomanip>
|
||||
#include "llsd.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
#if LL_LINUX || LL_SOLARIS
|
||||
#include <wctype.h>
|
||||
@@ -47,6 +46,7 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#if LL_SOLARIS
|
||||
// stricmp and strnicmp do not exist on Solaris:
|
||||
@@ -246,40 +246,77 @@ private:
|
||||
static std::string sLocale;
|
||||
|
||||
public:
|
||||
typedef typename std::basic_string<T>::size_type size_type;
|
||||
typedef std::basic_string<T> string_type;
|
||||
typedef typename string_type::size_type size_type;
|
||||
|
||||
public:
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Static Utility functions that operate on std::strings
|
||||
|
||||
static const std::basic_string<T> null;
|
||||
static const string_type null;
|
||||
|
||||
typedef std::map<LLFormatMapString, LLFormatMapString> format_map_t;
|
||||
LL_COMMON_API static void getTokens(const std::basic_string<T>& instr, std::vector<std::basic_string<T> >& tokens, const std::basic_string<T>& delims);
|
||||
LL_COMMON_API static void formatNumber(std::basic_string<T>& numStr, std::basic_string<T> decimals);
|
||||
LL_COMMON_API static bool formatDatetime(std::basic_string<T>& replacement, std::basic_string<T> token, std::basic_string<T> param, S32 secFromEpoch);
|
||||
LL_COMMON_API static S32 format(std::basic_string<T>& s, const format_map_t& substitutions);
|
||||
LL_COMMON_API static S32 format(std::basic_string<T>& s, const LLSD& substitutions);
|
||||
LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const format_map_t& substitutions);
|
||||
LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const LLSD& substitutions);
|
||||
/// considers any sequence of delims as a single field separator
|
||||
LL_COMMON_API static void getTokens(const string_type& instr,
|
||||
std::vector<string_type >& tokens,
|
||||
const string_type& delims);
|
||||
/// like simple scan overload, but returns scanned vector
|
||||
static std::vector<string_type> getTokens(const string_type& instr,
|
||||
const string_type& delims);
|
||||
/// add support for keep_delims and quotes (either could be empty string)
|
||||
static void getTokens(const string_type& instr,
|
||||
std::vector<string_type>& tokens,
|
||||
const string_type& drop_delims,
|
||||
const string_type& keep_delims,
|
||||
const string_type& quotes=string_type());
|
||||
/// like keep_delims-and-quotes overload, but returns scanned vector
|
||||
static std::vector<string_type> getTokens(const string_type& instr,
|
||||
const string_type& drop_delims,
|
||||
const string_type& keep_delims,
|
||||
const string_type& quotes=string_type());
|
||||
/// add support for escapes (could be empty string)
|
||||
static void getTokens(const string_type& instr,
|
||||
std::vector<string_type>& tokens,
|
||||
const string_type& drop_delims,
|
||||
const string_type& keep_delims,
|
||||
const string_type& quotes,
|
||||
const string_type& escapes);
|
||||
/// like escapes overload, but returns scanned vector
|
||||
static std::vector<string_type> getTokens(const string_type& instr,
|
||||
const string_type& drop_delims,
|
||||
const string_type& keep_delims,
|
||||
const string_type& quotes,
|
||||
const string_type& escapes);
|
||||
|
||||
LL_COMMON_API static void formatNumber(string_type& numStr, string_type decimals);
|
||||
LL_COMMON_API static bool formatDatetime(string_type& replacement, string_type token, string_type param, S32 secFromEpoch);
|
||||
LL_COMMON_API static S32 format(string_type& s, const format_map_t& substitutions);
|
||||
LL_COMMON_API static S32 format(string_type& s, const LLSD& substitutions);
|
||||
LL_COMMON_API static bool simpleReplacement(string_type& replacement, string_type token, const format_map_t& substitutions);
|
||||
LL_COMMON_API static bool simpleReplacement(string_type& replacement, string_type token, const LLSD& substitutions);
|
||||
LL_COMMON_API static void setLocale (std::string inLocale);
|
||||
LL_COMMON_API static std::string getLocale (void);
|
||||
|
||||
static bool isValidIndex(const std::basic_string<T>& string, size_type i)
|
||||
static bool isValidIndex(const string_type& string, size_type i)
|
||||
{
|
||||
return !string.empty() && (0 <= i) && (i <= string.size());
|
||||
}
|
||||
|
||||
static void trimHead(std::basic_string<T>& string);
|
||||
static void trimTail(std::basic_string<T>& string);
|
||||
static void trim(std::basic_string<T>& string) { trimHead(string); trimTail(string); }
|
||||
static void truncate(std::basic_string<T>& string, size_type count);
|
||||
static bool contains(const string_type& string, T c, size_type i=0)
|
||||
{
|
||||
return string.find(c, i) != string_type::npos;
|
||||
}
|
||||
|
||||
static void toUpper(std::basic_string<T>& string);
|
||||
static void toLower(std::basic_string<T>& string);
|
||||
static void trimHead(string_type& string);
|
||||
static void trimTail(string_type& string);
|
||||
static void trim(string_type& string) { trimHead(string); trimTail(string); }
|
||||
static void truncate(string_type& string, size_type count);
|
||||
|
||||
static void toUpper(string_type& string);
|
||||
static void toLower(string_type& string);
|
||||
|
||||
// True if this is the head of s.
|
||||
static BOOL isHead( const std::basic_string<T>& string, const T* s );
|
||||
static BOOL isHead( const string_type& string, const T* s );
|
||||
|
||||
/**
|
||||
* @brief Returns true if string starts with substr
|
||||
@@ -287,8 +324,8 @@ public:
|
||||
* If etither string or substr are empty, this method returns false.
|
||||
*/
|
||||
static bool startsWith(
|
||||
const std::basic_string<T>& string,
|
||||
const std::basic_string<T>& substr);
|
||||
const string_type& string,
|
||||
const string_type& substr);
|
||||
|
||||
/**
|
||||
* @brief Returns true if string ends in substr
|
||||
@@ -296,19 +333,32 @@ public:
|
||||
* If etither string or substr are empty, this method returns false.
|
||||
*/
|
||||
static bool endsWith(
|
||||
const std::basic_string<T>& string,
|
||||
const std::basic_string<T>& substr);
|
||||
const string_type& string,
|
||||
const string_type& substr);
|
||||
|
||||
static void addCRLF(std::basic_string<T>& string);
|
||||
static void removeCRLF(std::basic_string<T>& string);
|
||||
static void addCRLF(string_type& string);
|
||||
static void removeCRLF(string_type& string);
|
||||
|
||||
static void replaceTabsWithSpaces( std::basic_string<T>& string, size_type spaces_per_tab );
|
||||
static void replaceNonstandardASCII( std::basic_string<T>& string, T replacement );
|
||||
static void replaceChar( std::basic_string<T>& string, T target, T replacement );
|
||||
static void replaceString( std::basic_string<T>& string, std::basic_string<T> target, std::basic_string<T> replacement );
|
||||
static void replaceTabsWithSpaces( string_type& string, size_type spaces_per_tab );
|
||||
static void replaceNonstandardASCII( string_type& string, T replacement );
|
||||
static void replaceChar( string_type& string, T target, T replacement );
|
||||
static void replaceString( string_type& string, string_type target, string_type replacement );
|
||||
|
||||
static BOOL containsNonprintable(const std::basic_string<T>& string);
|
||||
static void stripNonprintable(std::basic_string<T>& string);
|
||||
static BOOL containsNonprintable(const string_type& string);
|
||||
static void stripNonprintable(string_type& string);
|
||||
|
||||
/**
|
||||
* Double-quote an argument string if needed, unless it's already
|
||||
* double-quoted. Decide whether it's needed based on the presence of any
|
||||
* character in @a triggers (default space or double-quote). If we quote
|
||||
* it, escape any embedded double-quote with the @a escape string (default
|
||||
* backslash).
|
||||
*
|
||||
* Passing triggers="" means always quote, unless it's already double-quoted.
|
||||
*/
|
||||
static string_type quote(const string_type& str,
|
||||
const string_type& triggers=" \"",
|
||||
const string_type& escape="\\");
|
||||
|
||||
/**
|
||||
* @brief Unsafe way to make ascii characters. You should probably
|
||||
@@ -317,18 +367,18 @@ public:
|
||||
* The 2 and 4 byte std::string probably work, so LLWStringUtil::_makeASCII
|
||||
* should work.
|
||||
*/
|
||||
static void _makeASCII(std::basic_string<T>& string);
|
||||
static void _makeASCII(string_type& string);
|
||||
|
||||
// Conversion to other data types
|
||||
static BOOL convertToBOOL(const std::basic_string<T>& string, BOOL& value);
|
||||
static BOOL convertToU8(const std::basic_string<T>& string, U8& value);
|
||||
static BOOL convertToS8(const std::basic_string<T>& string, S8& value);
|
||||
static BOOL convertToS16(const std::basic_string<T>& string, S16& value);
|
||||
static BOOL convertToU16(const std::basic_string<T>& string, U16& value);
|
||||
static BOOL convertToU32(const std::basic_string<T>& string, U32& value);
|
||||
static BOOL convertToS32(const std::basic_string<T>& string, S32& value);
|
||||
static BOOL convertToF32(const std::basic_string<T>& string, F32& value);
|
||||
static BOOL convertToF64(const std::basic_string<T>& string, F64& value);
|
||||
static BOOL convertToBOOL(const string_type& string, BOOL& value);
|
||||
static BOOL convertToU8(const string_type& string, U8& value);
|
||||
static BOOL convertToS8(const string_type& string, S8& value);
|
||||
static BOOL convertToS16(const string_type& string, S16& value);
|
||||
static BOOL convertToU16(const string_type& string, U16& value);
|
||||
static BOOL convertToU32(const string_type& string, U32& value);
|
||||
static BOOL convertToS32(const string_type& string, S32& value);
|
||||
static BOOL convertToF32(const string_type& string, F32& value);
|
||||
static BOOL convertToF64(const string_type& string, F64& value);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Utility functions for working with char*'s and strings
|
||||
@@ -336,24 +386,24 @@ public:
|
||||
// Like strcmp but also handles empty strings. Uses
|
||||
// current locale.
|
||||
static S32 compareStrings(const T* lhs, const T* rhs);
|
||||
static S32 compareStrings(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs);
|
||||
static S32 compareStrings(const string_type& lhs, const string_type& rhs);
|
||||
|
||||
// case insensitive version of above. Uses current locale on
|
||||
// Win32, and falls back to a non-locale aware comparison on
|
||||
// Linux.
|
||||
static S32 compareInsensitive(const T* lhs, const T* rhs);
|
||||
static S32 compareInsensitive(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs);
|
||||
static S32 compareInsensitive(const string_type& lhs, const string_type& rhs);
|
||||
|
||||
// Case sensitive comparison with good handling of numbers. Does not use current locale.
|
||||
// a.k.a. strdictcmp()
|
||||
static S32 compareDict(const std::basic_string<T>& a, const std::basic_string<T>& b);
|
||||
static S32 compareDict(const string_type& a, const string_type& b);
|
||||
|
||||
// Case *in*sensitive comparison with good handling of numbers. Does not use current locale.
|
||||
// a.k.a. strdictcmp()
|
||||
static S32 compareDictInsensitive(const std::basic_string<T>& a, const std::basic_string<T>& b);
|
||||
static S32 compareDictInsensitive(const string_type& a, const string_type& b);
|
||||
|
||||
// Puts compareDict() in a form appropriate for LL container classes to use for sorting.
|
||||
static BOOL precedesDict( const std::basic_string<T>& a, const std::basic_string<T>& b );
|
||||
static BOOL precedesDict( const string_type& a, const string_type& b );
|
||||
|
||||
// A replacement for strncpy.
|
||||
// If the dst buffer is dst_size bytes long or more, ensures that dst is null terminated and holds
|
||||
@@ -361,7 +411,7 @@ public:
|
||||
static void copy(T* dst, const T* src, size_type dst_size);
|
||||
|
||||
// Copies src into dst at a given offset.
|
||||
static void copyInto(std::basic_string<T>& dst, const std::basic_string<T>& src, size_type offset);
|
||||
static void copyInto(string_type& dst, const string_type& src, size_type offset);
|
||||
|
||||
static bool isPartOfWord(T c) { return (c == (T)'_') || LLStringOps::isAlnum(c); }
|
||||
|
||||
@@ -371,7 +421,7 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
LL_COMMON_API static size_type getSubstitution(const std::basic_string<T>& instr, size_type& start, std::vector<std::basic_string<T> >& tokens);
|
||||
LL_COMMON_API static size_type getSubstitution(const string_type& instr, size_type& start, std::vector<string_type >& tokens);
|
||||
};
|
||||
|
||||
template<class T> const std::basic_string<T> LLStringUtilBase<T>::null;
|
||||
@@ -649,6 +699,321 @@ namespace LLStringFn
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// static
|
||||
template <class T>
|
||||
std::vector<typename LLStringUtilBase<T>::string_type>
|
||||
LLStringUtilBase<T>::getTokens(const string_type& instr, const string_type& delims)
|
||||
{
|
||||
std::vector<string_type> tokens;
|
||||
getTokens(instr, tokens, delims);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
// static
|
||||
template <class T>
|
||||
std::vector<typename LLStringUtilBase<T>::string_type>
|
||||
LLStringUtilBase<T>::getTokens(const string_type& instr,
|
||||
const string_type& drop_delims,
|
||||
const string_type& keep_delims,
|
||||
const string_type& quotes)
|
||||
{
|
||||
std::vector<string_type> tokens;
|
||||
getTokens(instr, tokens, drop_delims, keep_delims, quotes);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
// static
|
||||
template <class T>
|
||||
std::vector<typename LLStringUtilBase<T>::string_type>
|
||||
LLStringUtilBase<T>::getTokens(const string_type& instr,
|
||||
const string_type& drop_delims,
|
||||
const string_type& keep_delims,
|
||||
const string_type& quotes,
|
||||
const string_type& escapes)
|
||||
{
|
||||
std::vector<string_type> tokens;
|
||||
getTokens(instr, tokens, drop_delims, keep_delims, quotes, escapes);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
namespace LLStringUtilBaseImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* Input string scanner helper for getTokens(), or really any other
|
||||
* character-parsing routine that may have to deal with escape characters.
|
||||
* This implementation defines the concept (also an interface, should you
|
||||
* choose to implement the concept by subclassing) and provides trivial
|
||||
* implementations for a string @em without escape processing.
|
||||
*/
|
||||
template <class T>
|
||||
struct InString
|
||||
{
|
||||
typedef std::basic_string<T> string_type;
|
||||
typedef typename string_type::const_iterator const_iterator;
|
||||
|
||||
InString(const_iterator b, const_iterator e):
|
||||
mIter(b),
|
||||
mEnd(e)
|
||||
{}
|
||||
virtual ~InString() {}
|
||||
|
||||
bool done() const { return mIter == mEnd; }
|
||||
/// Is the current character (*mIter) escaped? This implementation can
|
||||
/// answer trivially because it doesn't support escapes.
|
||||
virtual bool escaped() const { return false; }
|
||||
/// Obtain the current character and advance @c mIter.
|
||||
virtual T next() { return *mIter++; }
|
||||
/// Does the current character match specified character?
|
||||
virtual bool is(T ch) const { return (! done()) && *mIter == ch; }
|
||||
/// Is the current character any one of the specified characters?
|
||||
virtual bool oneof(const string_type& delims) const
|
||||
{
|
||||
return (! done()) && LLStringUtilBase<T>::contains(delims, *mIter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan forward from @from until either @a delim or end. This is primarily
|
||||
* useful for processing quoted substrings.
|
||||
*
|
||||
* If we do see @a delim, append everything from @from until (excluding)
|
||||
* @a delim to @a into, advance @c mIter to skip @a delim, and return @c
|
||||
* true.
|
||||
*
|
||||
* If we do not see @a delim, do not alter @a into or @c mIter and return
|
||||
* @c false. Do not pass GO, do not collect $200.
|
||||
*
|
||||
* @note The @c false case described above implements normal getTokens()
|
||||
* treatment of an unmatched open quote: treat the quote character as if
|
||||
* escaped, that is, simply collect it as part of the current token. Other
|
||||
* plausible behaviors directly affect the way getTokens() deals with an
|
||||
* unmatched quote: e.g. throwing an exception to treat it as an error, or
|
||||
* assuming a close quote beyond end of string (in which case return @c
|
||||
* true).
|
||||
*/
|
||||
virtual bool collect_until(string_type& into, const_iterator from, T delim)
|
||||
{
|
||||
const_iterator found = std::find(from, mEnd, delim);
|
||||
// If we didn't find delim, change nothing, just tell caller.
|
||||
if (found == mEnd)
|
||||
return false;
|
||||
// Found delim! Append everything between from and found.
|
||||
into.append(from, found);
|
||||
// advance past delim in input
|
||||
mIter = found + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
const_iterator mIter, mEnd;
|
||||
};
|
||||
|
||||
/// InString subclass that handles escape characters
|
||||
template <class T>
|
||||
class InEscString: public InString<T>
|
||||
{
|
||||
public:
|
||||
typedef InString<T> super;
|
||||
typedef typename super::string_type string_type;
|
||||
typedef typename super::const_iterator const_iterator;
|
||||
using super::done;
|
||||
using super::mIter;
|
||||
using super::mEnd;
|
||||
|
||||
InEscString(const_iterator b, const_iterator e, const string_type& escapes):
|
||||
super(b, e),
|
||||
mEscapes(escapes)
|
||||
{
|
||||
// Even though we've already initialized 'mIter' via our base-class
|
||||
// constructor, set it again to check for initial escape char.
|
||||
setiter(b);
|
||||
}
|
||||
|
||||
/// This implementation uses the answer cached by setiter().
|
||||
virtual bool escaped() const { return mIsEsc; }
|
||||
virtual T next()
|
||||
{
|
||||
// If we're looking at the escape character of an escape sequence,
|
||||
// skip that character. This is the one time we can modify 'mIter'
|
||||
// without using setiter: for this one case we DO NOT CARE if the
|
||||
// escaped character is itself an escape.
|
||||
if (mIsEsc)
|
||||
++mIter;
|
||||
// If we were looking at an escape character, this is the escaped
|
||||
// character; otherwise it's just the next character.
|
||||
T result(*mIter);
|
||||
// Advance mIter, checking for escape sequence.
|
||||
setiter(mIter + 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual bool is(T ch) const
|
||||
{
|
||||
// Like base-class is(), except that an escaped character matches
|
||||
// nothing.
|
||||
return (! done()) && (! mIsEsc) && *mIter == ch;
|
||||
}
|
||||
|
||||
virtual bool oneof(const string_type& delims) const
|
||||
{
|
||||
// Like base-class oneof(), except that an escaped character matches
|
||||
// nothing.
|
||||
return (! done()) && (! mIsEsc) && LLStringUtilBase<T>::contains(delims, *mIter);
|
||||
}
|
||||
|
||||
virtual bool collect_until(string_type& into, const_iterator from, T delim)
|
||||
{
|
||||
// Deal with escapes in the characters we collect; that is, an escaped
|
||||
// character must become just that character without the preceding
|
||||
// escape. Collect characters in a separate string rather than
|
||||
// directly appending to 'into' in case we do not find delim, in which
|
||||
// case we're supposed to leave 'into' unmodified.
|
||||
string_type collected;
|
||||
// For scanning purposes, we're going to work directly with 'mIter'.
|
||||
// Save its current value in case we fail to see delim.
|
||||
const_iterator save_iter(mIter);
|
||||
// Okay, set 'mIter', checking for escape.
|
||||
setiter(from);
|
||||
while (! done())
|
||||
{
|
||||
// If we see an unescaped delim, stop and report success.
|
||||
if ((! mIsEsc) && *mIter == delim)
|
||||
{
|
||||
// Append collected chars to 'into'.
|
||||
into.append(collected);
|
||||
// Don't forget to advance 'mIter' past delim.
|
||||
setiter(mIter + 1);
|
||||
return true;
|
||||
}
|
||||
// We're not at end, and either we're not looking at delim or it's
|
||||
// escaped. Collect this character and keep going.
|
||||
collected.push_back(next());
|
||||
}
|
||||
// Here we hit 'mEnd' without ever seeing delim. Restore mIter and tell
|
||||
// caller.
|
||||
setiter(save_iter);
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
void setiter(const_iterator i)
|
||||
{
|
||||
mIter = i;
|
||||
|
||||
// Every time we change 'mIter', set 'mIsEsc' to be able to repetitively
|
||||
// answer escaped() without having to rescan 'mEscapes'. mIsEsc caches
|
||||
// contains(mEscapes, *mIter).
|
||||
|
||||
// We're looking at an escaped char if we're not already at end (that
|
||||
// is, *mIter is even meaningful); if *mIter is in fact one of the
|
||||
// specified escape characters; and if there's one more character
|
||||
// following it. That is, if an escape character is the very last
|
||||
// character of the input string, it loses its special meaning.
|
||||
mIsEsc = (! done()) &&
|
||||
LLStringUtilBase<T>::contains(mEscapes, *mIter) &&
|
||||
(mIter+1) != mEnd;
|
||||
}
|
||||
|
||||
const string_type mEscapes;
|
||||
bool mIsEsc;
|
||||
};
|
||||
|
||||
/// getTokens() implementation based on InString concept
|
||||
template <typename INSTRING, typename string_type>
|
||||
void getTokens(INSTRING& instr, std::vector<string_type>& tokens,
|
||||
const string_type& drop_delims, const string_type& keep_delims,
|
||||
const string_type& quotes)
|
||||
{
|
||||
// There are times when we want to match either drop_delims or
|
||||
// keep_delims. Concatenate them up front to speed things up.
|
||||
string_type all_delims(drop_delims + keep_delims);
|
||||
// no tokens yet
|
||||
tokens.clear();
|
||||
|
||||
// try for another token
|
||||
while (! instr.done())
|
||||
{
|
||||
// scan past any drop_delims
|
||||
while (instr.oneof(drop_delims))
|
||||
{
|
||||
// skip this drop_delim
|
||||
instr.next();
|
||||
// but if that was the end of the string, done
|
||||
if (instr.done())
|
||||
return;
|
||||
}
|
||||
// found the start of another token: make a slot for it
|
||||
tokens.push_back(string_type());
|
||||
if (instr.oneof(keep_delims))
|
||||
{
|
||||
// *iter is a keep_delim, a token of exactly 1 character. Append
|
||||
// that character to the new token and proceed.
|
||||
tokens.back().push_back(instr.next());
|
||||
continue;
|
||||
}
|
||||
// Here we have a non-delimiter token, which might consist of a mix of
|
||||
// quoted and unquoted parts. Use bash rules for quoting: you can
|
||||
// embed a quoted substring in the midst of an unquoted token (e.g.
|
||||
// ~/"sub dir"/myfile.txt); you can ram two quoted substrings together
|
||||
// to make a single token (e.g. 'He said, "'"Don't."'"'). We diverge
|
||||
// from bash in that bash considers an unmatched quote an error. Our
|
||||
// param signature doesn't allow for errors, so just pretend it's not
|
||||
// a quote and embed it.
|
||||
// At this level, keep scanning until we hit the next delimiter of
|
||||
// either type (drop_delims or keep_delims).
|
||||
while (! instr.oneof(all_delims))
|
||||
{
|
||||
// If we're looking at an open quote, search forward for
|
||||
// a close quote, collecting characters along the way.
|
||||
if (instr.oneof(quotes) &&
|
||||
instr.collect_until(tokens.back(), instr.mIter+1, *instr.mIter))
|
||||
{
|
||||
// collect_until is cleverly designed to do exactly what we
|
||||
// need here. No further action needed if it returns true.
|
||||
}
|
||||
else
|
||||
{
|
||||
// Either *iter isn't a quote, or there's no matching close
|
||||
// quote: in other words, just an ordinary char. Append it to
|
||||
// current token.
|
||||
tokens.back().push_back(instr.next());
|
||||
}
|
||||
// having scanned that segment of this token, if we've reached the
|
||||
// end of the string, we're done
|
||||
if (instr.done())
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace LLStringUtilBaseImpl
|
||||
|
||||
// static
|
||||
template <class T>
|
||||
void LLStringUtilBase<T>::getTokens(const string_type& string, std::vector<string_type>& tokens,
|
||||
const string_type& drop_delims, const string_type& keep_delims,
|
||||
const string_type& quotes)
|
||||
{
|
||||
// Because this overload doesn't support escapes, use simple InString to
|
||||
// manage input range.
|
||||
LLStringUtilBaseImpl::InString<T> instring(string.begin(), string.end());
|
||||
LLStringUtilBaseImpl::getTokens(instring, tokens, drop_delims, keep_delims, quotes);
|
||||
}
|
||||
|
||||
// static
|
||||
template <class T>
|
||||
void LLStringUtilBase<T>::getTokens(const string_type& string, std::vector<string_type>& tokens,
|
||||
const string_type& drop_delims, const string_type& keep_delims,
|
||||
const string_type& quotes, const string_type& escapes)
|
||||
{
|
||||
// This overload must deal with escapes. Delegate that to InEscString
|
||||
// (unless there ARE no escapes).
|
||||
boost::scoped_ptr< LLStringUtilBaseImpl::InString<T> > instrp;
|
||||
if (escapes.empty())
|
||||
instrp.reset(new LLStringUtilBaseImpl::InString<T>(string.begin(), string.end()));
|
||||
else
|
||||
instrp.reset(new LLStringUtilBaseImpl::InEscString<T>(string.begin(), string.end(), escapes));
|
||||
LLStringUtilBaseImpl::getTokens(*instrp, tokens, drop_delims, keep_delims, quotes);
|
||||
}
|
||||
|
||||
// static
|
||||
template<class T>
|
||||
@@ -678,7 +1043,7 @@ S32 LLStringUtilBase<T>::compareStrings(const T* lhs, const T* rhs)
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
S32 LLStringUtilBase<T>::compareStrings(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs)
|
||||
S32 LLStringUtilBase<T>::compareStrings(const string_type& lhs, const string_type& rhs)
|
||||
{
|
||||
return LLStringOps::collate(lhs.c_str(), rhs.c_str());
|
||||
}
|
||||
@@ -704,8 +1069,8 @@ S32 LLStringUtilBase<T>::compareInsensitive(const T* lhs, const T* rhs )
|
||||
}
|
||||
else
|
||||
{
|
||||
std::basic_string<T> lhs_string(lhs);
|
||||
std::basic_string<T> rhs_string(rhs);
|
||||
string_type lhs_string(lhs);
|
||||
string_type rhs_string(rhs);
|
||||
LLStringUtilBase<T>::toUpper(lhs_string);
|
||||
LLStringUtilBase<T>::toUpper(rhs_string);
|
||||
result = LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str());
|
||||
@@ -715,10 +1080,10 @@ S32 LLStringUtilBase<T>::compareInsensitive(const T* lhs, const T* rhs )
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
S32 LLStringUtilBase<T>::compareInsensitive(const std::basic_string<T>& lhs, const std::basic_string<T>& rhs)
|
||||
S32 LLStringUtilBase<T>::compareInsensitive(const string_type& lhs, const string_type& rhs)
|
||||
{
|
||||
std::basic_string<T> lhs_string(lhs);
|
||||
std::basic_string<T> rhs_string(rhs);
|
||||
string_type lhs_string(lhs);
|
||||
string_type rhs_string(rhs);
|
||||
LLStringUtilBase<T>::toUpper(lhs_string);
|
||||
LLStringUtilBase<T>::toUpper(rhs_string);
|
||||
return LLStringOps::collate(lhs_string.c_str(), rhs_string.c_str());
|
||||
@@ -729,7 +1094,7 @@ S32 LLStringUtilBase<T>::compareInsensitive(const std::basic_string<T>& lhs, con
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
S32 LLStringUtilBase<T>::compareDict(const std::basic_string<T>& astr, const std::basic_string<T>& bstr)
|
||||
S32 LLStringUtilBase<T>::compareDict(const string_type& astr, const string_type& bstr)
|
||||
{
|
||||
const T* a = astr.c_str();
|
||||
const T* b = bstr.c_str();
|
||||
@@ -770,7 +1135,7 @@ S32 LLStringUtilBase<T>::compareDict(const std::basic_string<T>& astr, const std
|
||||
|
||||
// static
|
||||
template<class T>
|
||||
S32 LLStringUtilBase<T>::compareDictInsensitive(const std::basic_string<T>& astr, const std::basic_string<T>& bstr)
|
||||
S32 LLStringUtilBase<T>::compareDictInsensitive(const string_type& astr, const string_type& bstr)
|
||||
{
|
||||
const T* a = astr.c_str();
|
||||
const T* b = bstr.c_str();
|
||||
@@ -805,7 +1170,7 @@ S32 LLStringUtilBase<T>::compareDictInsensitive(const std::basic_string<T>& astr
|
||||
// Puts compareDict() in a form appropriate for LL container classes to use for sorting.
|
||||
// static
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::precedesDict( const std::basic_string<T>& a, const std::basic_string<T>& b )
|
||||
BOOL LLStringUtilBase<T>::precedesDict( const string_type& a, const string_type& b )
|
||||
{
|
||||
if( a.size() && b.size() )
|
||||
{
|
||||
@@ -819,7 +1184,7 @@ BOOL LLStringUtilBase<T>::precedesDict( const std::basic_string<T>& a, const std
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::toUpper(std::basic_string<T>& string)
|
||||
void LLStringUtilBase<T>::toUpper(string_type& string)
|
||||
{
|
||||
if( !string.empty() )
|
||||
{
|
||||
@@ -833,7 +1198,7 @@ void LLStringUtilBase<T>::toUpper(std::basic_string<T>& string)
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::toLower(std::basic_string<T>& string)
|
||||
void LLStringUtilBase<T>::toLower(string_type& string)
|
||||
{
|
||||
if( !string.empty() )
|
||||
{
|
||||
@@ -847,7 +1212,7 @@ void LLStringUtilBase<T>::toLower(std::basic_string<T>& string)
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::trimHead(std::basic_string<T>& string)
|
||||
void LLStringUtilBase<T>::trimHead(string_type& string)
|
||||
{
|
||||
if( !string.empty() )
|
||||
{
|
||||
@@ -862,7 +1227,7 @@ void LLStringUtilBase<T>::trimHead(std::basic_string<T>& string)
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::trimTail(std::basic_string<T>& string)
|
||||
void LLStringUtilBase<T>::trimTail(string_type& string)
|
||||
{
|
||||
if( string.size() )
|
||||
{
|
||||
@@ -881,7 +1246,7 @@ void LLStringUtilBase<T>::trimTail(std::basic_string<T>& string)
|
||||
// Replace line feeds with carriage return-line feed pairs.
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::addCRLF(std::basic_string<T>& string)
|
||||
void LLStringUtilBase<T>::addCRLF(string_type& string)
|
||||
{
|
||||
const T LF = 10;
|
||||
const T CR = 13;
|
||||
@@ -923,7 +1288,7 @@ void LLStringUtilBase<T>::addCRLF(std::basic_string<T>& string)
|
||||
// Remove all carriage returns
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::removeCRLF(std::basic_string<T>& string)
|
||||
void LLStringUtilBase<T>::removeCRLF(string_type& string)
|
||||
{
|
||||
const T CR = 13;
|
||||
|
||||
@@ -944,10 +1309,10 @@ void LLStringUtilBase<T>::removeCRLF(std::basic_string<T>& string)
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::replaceChar( std::basic_string<T>& string, T target, T replacement )
|
||||
void LLStringUtilBase<T>::replaceChar( string_type& string, T target, T replacement )
|
||||
{
|
||||
size_type found_pos = 0;
|
||||
while( (found_pos = string.find(target, found_pos)) != std::basic_string<T>::npos )
|
||||
while( (found_pos = string.find(target, found_pos)) != string_type::npos )
|
||||
{
|
||||
string[found_pos] = replacement;
|
||||
found_pos++; // avoid infinite defeat if target == replacement
|
||||
@@ -956,10 +1321,10 @@ void LLStringUtilBase<T>::replaceChar( std::basic_string<T>& string, T target, T
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::replaceString( std::basic_string<T>& string, std::basic_string<T> target, std::basic_string<T> replacement )
|
||||
void LLStringUtilBase<T>::replaceString( string_type& string, string_type target, string_type replacement )
|
||||
{
|
||||
size_type found_pos = 0;
|
||||
while( (found_pos = string.find(target, found_pos)) != std::basic_string<T>::npos )
|
||||
while( (found_pos = string.find(target, found_pos)) != string_type::npos )
|
||||
{
|
||||
string.replace( found_pos, target.length(), replacement );
|
||||
found_pos += replacement.length(); // avoid infinite defeat if replacement contains target
|
||||
@@ -968,7 +1333,7 @@ void LLStringUtilBase<T>::replaceString( std::basic_string<T>& string, std::basi
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::replaceNonstandardASCII( std::basic_string<T>& string, T replacement )
|
||||
void LLStringUtilBase<T>::replaceNonstandardASCII( string_type& string, T replacement )
|
||||
{
|
||||
const char LF = 10;
|
||||
const S8 MIN = 32;
|
||||
@@ -988,12 +1353,12 @@ void LLStringUtilBase<T>::replaceNonstandardASCII( std::basic_string<T>& string,
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::replaceTabsWithSpaces( std::basic_string<T>& str, size_type spaces_per_tab )
|
||||
void LLStringUtilBase<T>::replaceTabsWithSpaces( string_type& str, size_type spaces_per_tab )
|
||||
{
|
||||
const T TAB = '\t';
|
||||
const T SPACE = ' ';
|
||||
|
||||
std::basic_string<T> out_str;
|
||||
string_type out_str;
|
||||
// Replace tabs with spaces
|
||||
for (size_type i = 0; i < str.length(); i++)
|
||||
{
|
||||
@@ -1012,7 +1377,7 @@ void LLStringUtilBase<T>::replaceTabsWithSpaces( std::basic_string<T>& str, size
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::containsNonprintable(const std::basic_string<T>& string)
|
||||
BOOL LLStringUtilBase<T>::containsNonprintable(const string_type& string)
|
||||
{
|
||||
const char MIN = 32;
|
||||
BOOL rv = FALSE;
|
||||
@@ -1029,7 +1394,7 @@ BOOL LLStringUtilBase<T>::containsNonprintable(const std::basic_string<T>& strin
|
||||
|
||||
//static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::stripNonprintable(std::basic_string<T>& string)
|
||||
void LLStringUtilBase<T>::stripNonprintable(string_type& string)
|
||||
{
|
||||
const char MIN = 32;
|
||||
size_type j = 0;
|
||||
@@ -1060,8 +1425,43 @@ void LLStringUtilBase<T>::stripNonprintable(std::basic_string<T>& string)
|
||||
delete []c_string;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
std::basic_string<T> LLStringUtilBase<T>::quote(const string_type& str,
|
||||
const string_type& triggers,
|
||||
const string_type& escape)
|
||||
{
|
||||
size_type len(str.length());
|
||||
// If the string is already quoted, assume user knows what s/he's doing.
|
||||
if (len >= 2 && str[0] == '"' && str[len-1] == '"')
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
// Not already quoted: do we need to? triggers.empty() is a special case
|
||||
// meaning "always quote."
|
||||
if ((! triggers.empty()) && str.find_first_of(triggers) == string_type::npos)
|
||||
{
|
||||
// no trigger characters, don't bother quoting
|
||||
return str;
|
||||
}
|
||||
|
||||
// For whatever reason, we must quote this string.
|
||||
string_type result;
|
||||
result.push_back('"');
|
||||
for (typename string_type::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci)
|
||||
{
|
||||
if (*ci == '"')
|
||||
{
|
||||
result.append(escape);
|
||||
}
|
||||
result.push_back(*ci);
|
||||
}
|
||||
result.push_back('"');
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::_makeASCII(std::basic_string<T>& string)
|
||||
void LLStringUtilBase<T>::_makeASCII(string_type& string)
|
||||
{
|
||||
// Replace non-ASCII chars with LL_UNKNOWN_CHAR
|
||||
for (size_type i = 0; i < string.length(); i++)
|
||||
@@ -1091,7 +1491,7 @@ void LLStringUtilBase<T>::copy( T* dst, const T* src, size_type dst_size )
|
||||
|
||||
// static
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_string<T>& src, size_type offset)
|
||||
void LLStringUtilBase<T>::copyInto(string_type& dst, const string_type& src, size_type offset)
|
||||
{
|
||||
if ( offset == dst.length() )
|
||||
{
|
||||
@@ -1101,7 +1501,7 @@ void LLStringUtilBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_s
|
||||
}
|
||||
else
|
||||
{
|
||||
std::basic_string<T> tail = dst.substr(offset);
|
||||
string_type tail = dst.substr(offset);
|
||||
|
||||
dst = dst.substr(0, offset);
|
||||
dst += src;
|
||||
@@ -1112,7 +1512,7 @@ void LLStringUtilBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_s
|
||||
// True if this is the head of s.
|
||||
//static
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::isHead( const std::basic_string<T>& string, const T* s )
|
||||
BOOL LLStringUtilBase<T>::isHead( const string_type& string, const T* s )
|
||||
{
|
||||
if( string.empty() )
|
||||
{
|
||||
@@ -1128,8 +1528,8 @@ BOOL LLStringUtilBase<T>::isHead( const std::basic_string<T>& string, const T* s
|
||||
// static
|
||||
template<class T>
|
||||
bool LLStringUtilBase<T>::startsWith(
|
||||
const std::basic_string<T>& string,
|
||||
const std::basic_string<T>& substr)
|
||||
const string_type& string,
|
||||
const string_type& substr)
|
||||
{
|
||||
if(string.empty() || (substr.empty())) return false;
|
||||
if(0 == string.find(substr)) return true;
|
||||
@@ -1139,8 +1539,8 @@ bool LLStringUtilBase<T>::startsWith(
|
||||
// static
|
||||
template<class T>
|
||||
bool LLStringUtilBase<T>::endsWith(
|
||||
const std::basic_string<T>& string,
|
||||
const std::basic_string<T>& substr)
|
||||
const string_type& string,
|
||||
const string_type& substr)
|
||||
{
|
||||
if(string.empty() || (substr.empty())) return false;
|
||||
std::string::size_type idx = string.rfind(substr);
|
||||
@@ -1150,14 +1550,14 @@ bool LLStringUtilBase<T>::endsWith(
|
||||
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToBOOL(const std::basic_string<T>& string, BOOL& value)
|
||||
BOOL LLStringUtilBase<T>::convertToBOOL(const string_type& string, BOOL& value)
|
||||
{
|
||||
if( string.empty() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::basic_string<T> temp( string );
|
||||
string_type temp( string );
|
||||
trim(temp);
|
||||
if(
|
||||
(temp == "1") ||
|
||||
@@ -1187,7 +1587,7 @@ BOOL LLStringUtilBase<T>::convertToBOOL(const std::basic_string<T>& string, BOOL
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToU8(const std::basic_string<T>& string, U8& value)
|
||||
BOOL LLStringUtilBase<T>::convertToU8(const string_type& string, U8& value)
|
||||
{
|
||||
S32 value32 = 0;
|
||||
BOOL success = convertToS32(string, value32);
|
||||
@@ -1200,7 +1600,7 @@ BOOL LLStringUtilBase<T>::convertToU8(const std::basic_string<T>& string, U8& va
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToS8(const std::basic_string<T>& string, S8& value)
|
||||
BOOL LLStringUtilBase<T>::convertToS8(const string_type& string, S8& value)
|
||||
{
|
||||
S32 value32 = 0;
|
||||
BOOL success = convertToS32(string, value32);
|
||||
@@ -1213,7 +1613,7 @@ BOOL LLStringUtilBase<T>::convertToS8(const std::basic_string<T>& string, S8& va
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToS16(const std::basic_string<T>& string, S16& value)
|
||||
BOOL LLStringUtilBase<T>::convertToS16(const string_type& string, S16& value)
|
||||
{
|
||||
S32 value32 = 0;
|
||||
BOOL success = convertToS32(string, value32);
|
||||
@@ -1226,7 +1626,7 @@ BOOL LLStringUtilBase<T>::convertToS16(const std::basic_string<T>& string, S16&
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToU16(const std::basic_string<T>& string, U16& value)
|
||||
BOOL LLStringUtilBase<T>::convertToU16(const string_type& string, U16& value)
|
||||
{
|
||||
S32 value32 = 0;
|
||||
BOOL success = convertToS32(string, value32);
|
||||
@@ -1239,17 +1639,17 @@ BOOL LLStringUtilBase<T>::convertToU16(const std::basic_string<T>& string, U16&
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToU32(const std::basic_string<T>& string, U32& value)
|
||||
BOOL LLStringUtilBase<T>::convertToU32(const string_type& string, U32& value)
|
||||
{
|
||||
if( string.empty() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::basic_string<T> temp( string );
|
||||
string_type temp( string );
|
||||
trim(temp);
|
||||
U32 v;
|
||||
std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
|
||||
std::basic_istringstream<T> i_stream((string_type)temp);
|
||||
if(i_stream >> v)
|
||||
{
|
||||
value = v;
|
||||
@@ -1259,17 +1659,17 @@ BOOL LLStringUtilBase<T>::convertToU32(const std::basic_string<T>& string, U32&
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToS32(const std::basic_string<T>& string, S32& value)
|
||||
BOOL LLStringUtilBase<T>::convertToS32(const string_type& string, S32& value)
|
||||
{
|
||||
if( string.empty() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::basic_string<T> temp( string );
|
||||
string_type temp( string );
|
||||
trim(temp);
|
||||
S32 v;
|
||||
std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
|
||||
std::basic_istringstream<T> i_stream((string_type)temp);
|
||||
if(i_stream >> v)
|
||||
{
|
||||
//TODO: figure out overflow and underflow reporting here
|
||||
@@ -1286,7 +1686,7 @@ BOOL LLStringUtilBase<T>::convertToS32(const std::basic_string<T>& string, S32&
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToF32(const std::basic_string<T>& string, F32& value)
|
||||
BOOL LLStringUtilBase<T>::convertToF32(const string_type& string, F32& value)
|
||||
{
|
||||
F64 value64 = 0.0;
|
||||
BOOL success = convertToF64(string, value64);
|
||||
@@ -1299,17 +1699,17 @@ BOOL LLStringUtilBase<T>::convertToF32(const std::basic_string<T>& string, F32&
|
||||
}
|
||||
|
||||
template<class T>
|
||||
BOOL LLStringUtilBase<T>::convertToF64(const std::basic_string<T>& string, F64& value)
|
||||
BOOL LLStringUtilBase<T>::convertToF64(const string_type& string, F64& value)
|
||||
{
|
||||
if( string.empty() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
std::basic_string<T> temp( string );
|
||||
string_type temp( string );
|
||||
trim(temp);
|
||||
F64 v;
|
||||
std::basic_istringstream<T> i_stream((std::basic_string<T>)temp);
|
||||
std::basic_istringstream<T> i_stream((string_type)temp);
|
||||
if(i_stream >> v)
|
||||
{
|
||||
//TODO: figure out overflow and underflow reporting here
|
||||
@@ -1326,7 +1726,7 @@ BOOL LLStringUtilBase<T>::convertToF64(const std::basic_string<T>& string, F64&
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void LLStringUtilBase<T>::truncate(std::basic_string<T>& string, size_type count)
|
||||
void LLStringUtilBase<T>::truncate(string_type& string, size_type count)
|
||||
{
|
||||
size_type cur_size = string.size();
|
||||
string.resize(count < cur_size ? count : cur_size);
|
||||
|
||||
117
indra/llcommon/lltypeinfolookup.h
Normal file
117
indra/llcommon/lltypeinfolookup.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* @file lltypeinfolookup.h
|
||||
* @author Nat Goodspeed
|
||||
* @date 2012-04-08
|
||||
* @brief Template data structure like std::map<std::type_info*, T>
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Copyright (c) 2012, Linden Research, Inc.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#if ! defined(LL_LLTYPEINFOLOOKUP_H)
|
||||
#define LL_LLTYPEINFOLOOKUP_H
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <functional> // std::binary_function
|
||||
#include <typeinfo>
|
||||
|
||||
/**
|
||||
* The following helper classes are based on the Boost.Unordered documentation:
|
||||
* http://www.boost.org/doc/libs/1_45_0/doc/html/unordered/hash_equality.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* Compute hash for a string passed as const char*
|
||||
*/
|
||||
struct const_char_star_hash: public std::unary_function<const char*, std::size_t>
|
||||
{
|
||||
std::size_t operator()(const char* str) const
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
for ( ; *str; ++str)
|
||||
{
|
||||
boost::hash_combine(seed, *str);
|
||||
}
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute equality for strings passed as const char*
|
||||
*
|
||||
* I (nat) suspect that this is where the default behavior breaks for the
|
||||
* const char* values returned from std::type_info::name(). If you compare the
|
||||
* two const char* pointer values, as a naive, unspecialized implementation
|
||||
* will surely do, they'll compare unequal.
|
||||
*/
|
||||
struct const_char_star_equal: public std::binary_function<const char*, const char*, bool>
|
||||
{
|
||||
bool operator()(const char* lhs, const char* rhs) const
|
||||
{
|
||||
return strcmp(lhs, rhs) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* LLTypeInfoLookup is specifically designed for use cases for which you might
|
||||
* consider std::map<std::type_info*, VALUE>. We have several such data
|
||||
* structures in the viewer. The trouble with them is that at least on Linux,
|
||||
* you can't rely on always getting the same std::type_info* for a given type:
|
||||
* different load modules will produce different std::type_info*.
|
||||
* LLTypeInfoLookup contains a workaround to address this issue.
|
||||
*
|
||||
* The API deliberately diverges from std::map in several respects:
|
||||
* * It avoids iterators, not only begin()/end() but also as return values
|
||||
* from insert() and find(). This bypasses transform_iterator overhead.
|
||||
* * Since we literally use compile-time types as keys, the essential insert()
|
||||
* and find() methods accept the key type as a @em template parameter,
|
||||
* accepting and returning value_type as a normal runtime value. This is to
|
||||
* permit future optimization (e.g. compile-time type hashing) without
|
||||
* changing the API.
|
||||
*/
|
||||
template <typename VALUE>
|
||||
class LLTypeInfoLookup
|
||||
{
|
||||
// Use this for our underlying implementation: lookup by
|
||||
// std::type_info::name() string. This is one of the rare cases in which I
|
||||
// dare use const char* directly, rather than std::string, because I'm
|
||||
// sure that every value returned by std::type_info::name() is static.
|
||||
// HOWEVER, specify our own hash + equality functors: naively comparing
|
||||
// distinct const char* values won't work.
|
||||
typedef boost::unordered_map<const char*, VALUE,
|
||||
const_char_star_hash, const_char_star_equal> impl_map_type;
|
||||
|
||||
public:
|
||||
typedef VALUE value_type;
|
||||
|
||||
LLTypeInfoLookup() {}
|
||||
|
||||
bool empty() const { return mMap.empty(); }
|
||||
std::size_t size() const { return mMap.size(); }
|
||||
|
||||
template <typename KEY>
|
||||
bool insert(const value_type& value)
|
||||
{
|
||||
// Obtain and store the std::type_info::name() string as the key.
|
||||
// Return just the bool from std::map::insert()'s return pair.
|
||||
return mMap.insert(typename impl_map_type::value_type(typeid(KEY).name(), value)).second;
|
||||
}
|
||||
|
||||
template <typename KEY>
|
||||
boost::optional<value_type> find() const
|
||||
{
|
||||
// Use the std::type_info::name() string as the key.
|
||||
typename impl_map_type::const_iterator found = mMap.find(typeid(KEY).name());
|
||||
if (found == mMap.end())
|
||||
return boost::optional<value_type>();
|
||||
return found->second;
|
||||
}
|
||||
|
||||
private:
|
||||
impl_map_type mMap;
|
||||
};
|
||||
|
||||
#endif /* ! defined(LL_LLTYPEINFOLOOKUP_H) */
|
||||
@@ -33,9 +33,9 @@
|
||||
|
||||
// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
|
||||
#if LL_WINDOWS
|
||||
# undef WIN32_LEAN_AND_MEAN
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "lldefs.h"
|
||||
@@ -452,7 +452,8 @@ static void get_random_bytes(void *buf, int nbytes)
|
||||
return;
|
||||
}
|
||||
|
||||
#if LL_WINDOWS
|
||||
#if LL_WINDOWS
|
||||
|
||||
typedef struct _ASTAT_
|
||||
{
|
||||
ADAPTER_STATUS adapt;
|
||||
@@ -460,58 +461,44 @@ typedef struct _ASTAT_
|
||||
}ASTAT, * PASTAT;
|
||||
|
||||
// static
|
||||
S32 LLUUID::getNodeID(unsigned char * node_id)
|
||||
S32 LLUUID::getNodeID(unsigned char *node_id)
|
||||
{
|
||||
ASTAT Adapter;
|
||||
NCB Ncb;
|
||||
UCHAR uRetCode;
|
||||
LANA_ENUM lenum;
|
||||
int i;
|
||||
int retval = 0;
|
||||
ASTAT Adapter;
|
||||
NCB Ncb;
|
||||
UCHAR uRetCode;
|
||||
LANA_ENUM lenum;
|
||||
int i;
|
||||
int retval = 0;
|
||||
|
||||
memset( &Ncb, 0, sizeof(Ncb) );
|
||||
Ncb.ncb_command = NCBENUM;
|
||||
Ncb.ncb_buffer = (UCHAR *)&lenum;
|
||||
Ncb.ncb_length = sizeof(lenum);
|
||||
uRetCode = Netbios( &Ncb );
|
||||
// printf( "The NCBENUM return code is: 0x%x \n", uRetCode );
|
||||
memset( &Ncb, 0, sizeof(Ncb) );
|
||||
Ncb.ncb_command = NCBENUM;
|
||||
Ncb.ncb_buffer = (UCHAR *)&lenum;
|
||||
Ncb.ncb_length = sizeof(lenum);
|
||||
uRetCode = Netbios( &Ncb );
|
||||
|
||||
for(i=0; i < lenum.length ;i++)
|
||||
{
|
||||
memset( &Ncb, 0, sizeof(Ncb) );
|
||||
Ncb.ncb_command = NCBRESET;
|
||||
Ncb.ncb_lana_num = lenum.lana[i];
|
||||
for(i=0; i < lenum.length ;i++)
|
||||
{
|
||||
memset( &Ncb, 0, sizeof(Ncb) );
|
||||
Ncb.ncb_command = NCBRESET;
|
||||
Ncb.ncb_lana_num = lenum.lana[i];
|
||||
|
||||
uRetCode = Netbios( &Ncb );
|
||||
// printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
|
||||
// lenum.lana[i], uRetCode );
|
||||
uRetCode = Netbios( &Ncb );
|
||||
|
||||
memset( &Ncb, 0, sizeof (Ncb) );
|
||||
Ncb.ncb_command = NCBASTAT;
|
||||
Ncb.ncb_lana_num = lenum.lana[i];
|
||||
memset( &Ncb, 0, sizeof (Ncb) );
|
||||
Ncb.ncb_command = NCBASTAT;
|
||||
Ncb.ncb_lana_num = lenum.lana[i];
|
||||
|
||||
strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */
|
||||
Ncb.ncb_buffer = (unsigned char *)&Adapter;
|
||||
Ncb.ncb_length = sizeof(Adapter);
|
||||
strcpy( (char *)Ncb.ncb_callname, "* " ); /* Flawfinder: ignore */
|
||||
Ncb.ncb_buffer = (unsigned char *)&Adapter;
|
||||
Ncb.ncb_length = sizeof(Adapter);
|
||||
|
||||
uRetCode = Netbios( &Ncb );
|
||||
// printf( "The NCBASTAT on LANA %d return code is: 0x%x \n",
|
||||
// lenum.lana[i], uRetCode );
|
||||
if ( uRetCode == 0 )
|
||||
{
|
||||
// printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
|
||||
// lenum.lana[i],
|
||||
// Adapter.adapt.adapter_address[0],
|
||||
// Adapter.adapt.adapter_address[1],
|
||||
// Adapter.adapt.adapter_address[2],
|
||||
// Adapter.adapt.adapter_address[3],
|
||||
// Adapter.adapt.adapter_address[4],
|
||||
// Adapter.adapt.adapter_address[5] );
|
||||
uRetCode = Netbios( &Ncb );
|
||||
if ( uRetCode == 0 )
|
||||
{
|
||||
memcpy(node_id,Adapter.adapt.adapter_address,6); /* Flawfinder: ignore */
|
||||
retval = 1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include "stdtypes.h"
|
||||
#include "llpreprocessor.h"
|
||||
|
||||
@@ -133,6 +132,7 @@ public:
|
||||
|
||||
U8 mData[UUID_BYTES];
|
||||
};
|
||||
|
||||
typedef std::vector<LLUUID> uuid_vec_t;
|
||||
|
||||
// Construct
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
#include "lluuid.h"
|
||||
#include "llstring.h"
|
||||
#include "llmemtype.h"
|
||||
#include "llthread.h"
|
||||
#include "llmemtype.h"
|
||||
#include "aithreadsafe.h"
|
||||
|
||||
const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#ifndef LL_LLPNGWRAPPER_H
|
||||
#define LL_LLPNGWRAPPER_H
|
||||
|
||||
#include "png.h"
|
||||
#include "libpng15/png.h"
|
||||
#include "llimage.h"
|
||||
|
||||
class LLPngWrapper
|
||||
|
||||
@@ -1700,6 +1700,6 @@ LLPointer<LLInventoryCategory> ll_create_category_from_sd(const LLSD& sd_cat)
|
||||
LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString()));
|
||||
rv->setPreferredType(
|
||||
LLFolderType::lookup(
|
||||
sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
|
||||
sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
|
||||
LLInventoryType::IT_NONE, // 46 AT_NONE
|
||||
LLInventoryType::IT_NONE, // 47 AT_NONE
|
||||
LLInventoryType::IT_NONE, // 48 AT_NONE
|
||||
LLInventoryType::IT_MESH // 49 AT_MESH
|
||||
LLInventoryType::IT_MESH // 49 AT_MESH
|
||||
};
|
||||
|
||||
// static
|
||||
|
||||
@@ -51,7 +51,7 @@ const S32 PARCEL_UNIT_AREA = 16;
|
||||
const F32 PARCEL_HEIGHT = 50.f;
|
||||
|
||||
//Height above ground which parcel boundries exist for explicitly banned avatars
|
||||
const F32 BAN_HEIGHT = 768.f;
|
||||
const F32 BAN_HEIGHT = 5000.f;
|
||||
|
||||
// Maximum number of entries in an access list
|
||||
const S32 PARCEL_MAX_ACCESS_LIST = 300;
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
void setMediaURLResetTimer(F32 time);
|
||||
virtual void setLocalID(S32 local_id);
|
||||
|
||||
// blow away all the extra crap lurking in parcels, including urls, access lists, etc
|
||||
// blow away all the extra stuff lurking in parcels, including urls, access lists, etc
|
||||
void clearParcel();
|
||||
|
||||
// This value is not persisted out to the parcel file, it is only
|
||||
@@ -686,6 +686,7 @@ public:
|
||||
std::map<LLUUID,LLAccessEntry> mBanList;
|
||||
std::map<LLUUID,LLAccessEntry> mTempBanList;
|
||||
std::map<LLUUID,LLAccessEntry> mTempAccessList;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@
|
||||
#ifndef LL_LLPERMISSIONSFLAGS_H
|
||||
#define LL_LLPERMISSIONSFLAGS_H
|
||||
|
||||
// llpermissionsflags.h
|
||||
// Copyright 2002, Linden Research, Inc.
|
||||
//
|
||||
// Flags for various permissions bits.
|
||||
// Shared between viewer and simulator.
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "lltransactiontypes.h"
|
||||
|
||||
#include "../newview/hippogridmanager.h"
|
||||
|
||||
|
||||
const U8 TRANSACTION_FLAGS_NONE = 0;
|
||||
const U8 TRANSACTION_FLAG_SOURCE_GROUP = 1;
|
||||
const U8 TRANSACTION_FLAG_DEST_GROUP = 2;
|
||||
|
||||
@@ -74,6 +74,7 @@ const S32 TRANS_CLASSIFIED_RENEW = 2005;
|
||||
// automatically end up in the list below :-(
|
||||
// So make sure you check the transaction_description table
|
||||
const S32 TRANS_RECURRING_GENERIC = 2100;
|
||||
|
||||
// Codes 3000-3999 reserved for inventory transactions
|
||||
const S32 TRANS_GIVE_INVENTORY = 3000;
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "v3math.h"
|
||||
#include "llvector4a.h"
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
|
||||
#define OCT_ERRS LL_ERRS("OctreeErrors")
|
||||
@@ -89,11 +88,12 @@ public:
|
||||
|
||||
typedef LLOctreeTraveler<T> oct_traveler;
|
||||
typedef LLTreeTraveler<T> tree_traveler;
|
||||
typedef typename std::set<LLPointer<T> > element_list;
|
||||
typedef typename element_list::iterator element_iter;
|
||||
typedef typename element_list::const_iterator const_element_iter;
|
||||
typedef LLPointer<T>* element_list;
|
||||
typedef LLPointer<T>* element_iter;
|
||||
typedef const LLPointer<T>* const_element_iter;
|
||||
typedef typename std::vector<LLTreeListener<T>*>::iterator tree_listener_iter;
|
||||
typedef typename std::vector<LLOctreeNode<T>* > child_list;
|
||||
typedef LLOctreeNode<T>** child_list;
|
||||
typedef LLOctreeNode<T>** child_iter;
|
||||
typedef LLTreeNode<T> BaseType;
|
||||
typedef LLOctreeNode<T> oct_node;
|
||||
typedef LLOctreeListener<T> oct_listener;
|
||||
@@ -115,6 +115,9 @@ public:
|
||||
: mParent((oct_node*)parent),
|
||||
mOctant(octant)
|
||||
{
|
||||
mData = NULL;
|
||||
mDataEnd = NULL;
|
||||
|
||||
mCenter = center;
|
||||
mSize = size;
|
||||
|
||||
@@ -133,6 +136,16 @@ public:
|
||||
{
|
||||
BaseType::destroyListeners();
|
||||
|
||||
for (U32 i = 0; i < mElementCount; ++i)
|
||||
{
|
||||
mData[i]->setBinIndex(-1);
|
||||
mData[i] = NULL;
|
||||
}
|
||||
|
||||
free(mData);
|
||||
mData = NULL;
|
||||
mDataEnd = NULL;
|
||||
|
||||
for (U32 i = 0; i < getChildCount(); i++)
|
||||
{
|
||||
delete getChild(i);
|
||||
@@ -229,12 +242,17 @@ public:
|
||||
}
|
||||
|
||||
void accept(oct_traveler* visitor) { visitor->visit(this); }
|
||||
virtual bool isLeaf() const { return mChild.empty(); }
|
||||
virtual bool isLeaf() const { return mChildCount == 0; }
|
||||
|
||||
U32 getElementCount() const { return mElementCount; }
|
||||
bool isEmpty() const { return mElementCount == 0; }
|
||||
element_list& getData() { return mData; }
|
||||
const element_list& getData() const { return mData; }
|
||||
|
||||
element_iter getDataBegin() { return mData; }
|
||||
element_iter getDataEnd() { return mDataEnd; }
|
||||
const_element_iter getDataBegin() const { return mData; }
|
||||
const_element_iter getDataEnd() const { return mDataEnd; }
|
||||
|
||||
U32 getChildCount() const { return mChildCount; }
|
||||
oct_node* getChild(U32 index) { return mChild[index]; }
|
||||
const oct_node* getChild(U32 index) const { return mChild[index]; }
|
||||
@@ -299,7 +317,7 @@ public:
|
||||
|
||||
virtual bool insert(T* data)
|
||||
{
|
||||
if (data == NULL)
|
||||
if (data == NULL || data->getBinIndex() != -1)
|
||||
{
|
||||
OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << llendl;
|
||||
return false;
|
||||
@@ -309,22 +327,19 @@ public:
|
||||
//is it here?
|
||||
if (isInside(data->getPositionGroup()))
|
||||
{
|
||||
if (((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius())) ||
|
||||
if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||
|
||||
(data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity)))
|
||||
{ //it belongs here
|
||||
#if LL_OCTREE_PARANOIA_CHECK
|
||||
//if this is a redundant insertion, error out (should never happen)
|
||||
if (mData.find(data) != mData.end())
|
||||
{
|
||||
llwarns << "Redundant octree insertion detected. " << data << llendl;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
mElementCount++;
|
||||
mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount);
|
||||
|
||||
mData.insert(data);
|
||||
//avoid unref on uninitialized memory
|
||||
memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>));
|
||||
|
||||
mData[mElementCount-1] = data;
|
||||
mDataEnd = mData + mElementCount;
|
||||
data->setBinIndex(mElementCount-1);
|
||||
BaseType::insert(data);
|
||||
|
||||
mElementCount = mData.size();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -358,10 +373,16 @@ public:
|
||||
|
||||
if( lt == 0x7 )
|
||||
{
|
||||
mData.insert(data);
|
||||
BaseType::insert(data);
|
||||
mElementCount++;
|
||||
mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount);
|
||||
|
||||
mElementCount = mData.size();
|
||||
//avoid unref on uninitialized memory
|
||||
memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>));
|
||||
|
||||
mData[mElementCount-1] = data;
|
||||
mDataEnd = mData + mElementCount;
|
||||
data->setBinIndex(mElementCount-1);
|
||||
BaseType::insert(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -410,23 +431,59 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
void _remove(T* data, S32 i)
|
||||
{ //precondition -- mElementCount > 0, idx is in range [0, mElementCount)
|
||||
|
||||
mElementCount--;
|
||||
data->setBinIndex(-1);
|
||||
|
||||
if (mElementCount > 0)
|
||||
{
|
||||
if (mElementCount != i)
|
||||
{
|
||||
mData[i] = mData[mElementCount]; //might unref data, do not access data after this point
|
||||
mData[i]->setBinIndex(i);
|
||||
}
|
||||
|
||||
mData[mElementCount] = NULL; //needed for unref
|
||||
mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount);
|
||||
mDataEnd = mData+mElementCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
mData[0] = NULL; //needed for unref
|
||||
free(mData);
|
||||
mData = NULL;
|
||||
mDataEnd = NULL;
|
||||
}
|
||||
|
||||
this->notifyRemoval(data);
|
||||
checkAlive();
|
||||
}
|
||||
|
||||
bool remove(T* data)
|
||||
{
|
||||
if (mData.find(data) != mData.end())
|
||||
{ //we have data
|
||||
mData.erase(data);
|
||||
mElementCount = mData.size();
|
||||
this->notifyRemoval(data);
|
||||
checkAlive();
|
||||
return true;
|
||||
S32 i = data->getBinIndex();
|
||||
|
||||
if (i >= 0 && i < (S32)mElementCount)
|
||||
{
|
||||
if (mData[i] == data)
|
||||
{ //found it
|
||||
_remove(data, i);
|
||||
llassert(data->getBinIndex() == -1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (isInside(data))
|
||||
|
||||
if (isInside(data))
|
||||
{
|
||||
oct_node* dest = getNodeAt(data);
|
||||
|
||||
if (dest != this)
|
||||
{
|
||||
return dest->remove(data);
|
||||
bool ret = dest->remove(data);
|
||||
llassert(data->getBinIndex() == -1);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,19 +502,20 @@ public:
|
||||
//node is now root
|
||||
llwarns << "!!! OCTREE REMOVING FACE BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl;
|
||||
node->removeByAddress(data);
|
||||
llassert(data->getBinIndex() == -1);
|
||||
return true;
|
||||
}
|
||||
|
||||
void removeByAddress(T* data)
|
||||
{
|
||||
if (mData.find(data) != mData.end())
|
||||
for (U32 i = 0; i < mElementCount; ++i)
|
||||
{
|
||||
mData.erase(data);
|
||||
mElementCount = mData.size();
|
||||
this->notifyRemoval(data);
|
||||
llwarns << "FOUND!" << llendl;
|
||||
checkAlive();
|
||||
return;
|
||||
if (mData[i] == data)
|
||||
{ //we have data
|
||||
_remove(data, i);
|
||||
llwarns << "FOUND!" << llendl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (U32 i = 0; i < getChildCount(); i++)
|
||||
@@ -469,8 +527,8 @@ public:
|
||||
|
||||
void clearChildren()
|
||||
{
|
||||
mChild.clear();
|
||||
mChildCount = 0;
|
||||
|
||||
U32* foo = (U32*) mChildMap;
|
||||
foo[0] = foo[1] = 0xFFFFFFFF;
|
||||
}
|
||||
@@ -532,7 +590,7 @@ public:
|
||||
|
||||
mChildMap[child->getOctant()] = mChildCount;
|
||||
|
||||
mChild.push_back(child);
|
||||
mChild[mChildCount] = child;
|
||||
++mChildCount;
|
||||
child->setParent(this);
|
||||
|
||||
@@ -561,9 +619,12 @@ public:
|
||||
mChild[index]->destroy();
|
||||
delete mChild[index];
|
||||
}
|
||||
mChild.erase(mChild.begin() + index);
|
||||
|
||||
--mChildCount;
|
||||
|
||||
mChild[index] = mChild[mChildCount];
|
||||
|
||||
|
||||
//rebuild child map
|
||||
U32* foo = (U32*) mChildMap;
|
||||
foo[0] = foo[1] = 0xFFFFFFFF;
|
||||
@@ -619,11 +680,12 @@ protected:
|
||||
oct_node* mParent;
|
||||
U8 mOctant;
|
||||
|
||||
child_list mChild;
|
||||
LLOctreeNode<T>* mChild[8];
|
||||
U8 mChildMap[8];
|
||||
U32 mChildCount;
|
||||
|
||||
element_list mData;
|
||||
element_iter mDataEnd;
|
||||
U32 mElementCount;
|
||||
|
||||
};
|
||||
|
||||
@@ -324,16 +324,16 @@ public:
|
||||
LLVector4a& min = node->mExtents[0];
|
||||
LLVector4a& max = node->mExtents[1];
|
||||
|
||||
if (!branch->getData().empty())
|
||||
if (!branch->isEmpty())
|
||||
{ //node has data, find AABB that binds data set
|
||||
const LLVolumeTriangle* tri = *(branch->getData().begin());
|
||||
const LLVolumeTriangle* tri = *(branch->getDataBegin());
|
||||
|
||||
//initialize min/max to first available vertex
|
||||
min = *(tri->mV[0]);
|
||||
max = *(tri->mV[0]);
|
||||
|
||||
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =
|
||||
branch->getData().begin(); iter != branch->getData().end(); ++iter)
|
||||
branch->getDataBegin(); iter != branch->getDataEnd(); ++iter)
|
||||
{ //for each triangle in node
|
||||
|
||||
//stretch by triangles in node
|
||||
@@ -348,7 +348,7 @@ public:
|
||||
max.setMax(max, *tri->mV[2]);
|
||||
}
|
||||
}
|
||||
else if (!branch->getChildren().empty())
|
||||
else if (!branch->isLeaf())
|
||||
{ //no data, but child nodes exist
|
||||
LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(0)->getListener(0);
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle>
|
||||
void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle>* node)
|
||||
{
|
||||
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =
|
||||
node->getData().begin(); iter != node->getData().end(); ++iter)
|
||||
node->getDataBegin(); iter != node->getDataEnd(); ++iter)
|
||||
{
|
||||
const LLVolumeTriangle* tri = *iter;
|
||||
|
||||
@@ -236,8 +236,8 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch)
|
||||
}
|
||||
|
||||
//children fit, check data
|
||||
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin();
|
||||
iter != branch->getData().end(); ++iter)
|
||||
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin();
|
||||
iter != branch->getDataEnd(); ++iter)
|
||||
{
|
||||
const LLVolumeTriangle* tri = *iter;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class LLVolumeTriangle : public LLRefCount
|
||||
public:
|
||||
LLVolumeTriangle()
|
||||
{
|
||||
|
||||
mBinIndex = -1;
|
||||
}
|
||||
|
||||
LLVolumeTriangle(const LLVolumeTriangle& rhs)
|
||||
@@ -64,9 +64,14 @@ public:
|
||||
U16 mIndex[3];
|
||||
|
||||
F32 mRadius;
|
||||
mutable S32 mBinIndex;
|
||||
|
||||
|
||||
virtual const LLVector4a& getPositionGroup() const;
|
||||
virtual const F32& getBinRadius() const;
|
||||
|
||||
S32 getBinIndex() const { return mBinIndex; }
|
||||
void setBinIndex(S32 idx) const { mBinIndex = idx; }
|
||||
};
|
||||
|
||||
class LLVolumeOctreeListener : public LLOctreeListener<LLVolumeTriangle>
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
#include "llapr.h"
|
||||
#include "llareslistener.h"
|
||||
#include "llscopedvolatileaprpool.h"
|
||||
|
||||
#if defined(LL_WINDOWS)
|
||||
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
|
||||
@@ -468,6 +467,7 @@ bool LLAres::process(U64 timeout)
|
||||
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
|
||||
apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM];
|
||||
apr_int32_t nsds = 0;
|
||||
apr_status_t status;
|
||||
int nactive = 0;
|
||||
int bitmask;
|
||||
|
||||
@@ -478,8 +478,6 @@ bool LLAres::process(U64 timeout)
|
||||
return nsds > 0;
|
||||
}
|
||||
|
||||
LLScopedVolatileAPRPool scoped_pool;
|
||||
|
||||
for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++)
|
||||
{
|
||||
if (ARES_GETSOCK_READABLE(bitmask, i))
|
||||
@@ -495,7 +493,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
apr_socket_t *aprSock = NULL;
|
||||
|
||||
apr_status_t status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], scoped_pool);
|
||||
status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], LLAPRRootPool::get()());
|
||||
if (status != APR_SUCCESS)
|
||||
{
|
||||
ll_apr_warn_status(status);
|
||||
@@ -504,7 +502,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
aprFds[nactive].desc.s = aprSock;
|
||||
aprFds[nactive].desc_type = APR_POLL_SOCKET;
|
||||
aprFds[nactive].p = scoped_pool;
|
||||
aprFds[nactive].p = LLAPRRootPool::get()();
|
||||
aprFds[nactive].rtnevents = 0;
|
||||
aprFds[nactive].client_data = &socks[i];
|
||||
|
||||
@@ -513,7 +511,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
if (nactive > 0)
|
||||
{
|
||||
apr_status_t status = apr_poll(aprFds, nactive, &nsds, timeout);
|
||||
status = apr_poll(aprFds, nactive, &nsds, timeout);
|
||||
|
||||
if (status != APR_SUCCESS && status != APR_TIMEUP)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llbuffer.h"
|
||||
#include <iterator>
|
||||
|
||||
#include "llmath.h"
|
||||
#include "llmemtype.h"
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "lldispatcher.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include "llstl.h"
|
||||
#include "message.h"
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@
|
||||
|
||||
#include "llbuffer.h"
|
||||
#include "llbufferstream.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llmemorystream.h"
|
||||
#include "llsd.h"
|
||||
#include "llsdserialize.h"
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "llapr.h"
|
||||
#include "llbuffer.h"
|
||||
#include "llbufferstream.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llhttpnode.h"
|
||||
#include "lliopipe.h"
|
||||
#include "lliosocket.h"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "llapr.h"
|
||||
|
||||
#include "llbuffer.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llhost.h"
|
||||
#include "llmemtype.h"
|
||||
#include "llpumpio.h"
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
* OS poll indicates it will not block.
|
||||
*/
|
||||
|
||||
#include "llaprpool.h"
|
||||
#include "lliopipe.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "llchainio.h"
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llioutil.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
/**
|
||||
* LLIOFlush
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "llstring.h"
|
||||
#include "lluuid.h"
|
||||
#include "net.h"
|
||||
#include "llaprpool.h"
|
||||
|
||||
//
|
||||
// constants
|
||||
@@ -58,7 +57,7 @@
|
||||
const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096;
|
||||
|
||||
static bool gMailEnabled = true;
|
||||
static LLAPRPool gMailPool;
|
||||
static apr_pool_t* gMailPool;
|
||||
static apr_sockaddr_t* gSockAddr;
|
||||
static apr_socket_t* gMailSocket;
|
||||
|
||||
@@ -83,7 +82,7 @@ bool connect_smtp()
|
||||
gSockAddr->sa.sin.sin_family,
|
||||
SOCK_STREAM,
|
||||
APR_PROTO_TCP,
|
||||
gMailPool());
|
||||
gMailPool);
|
||||
if(ll_apr_warn_status(status)) return false;
|
||||
status = apr_socket_connect(gMailSocket, gSockAddr);
|
||||
if(ll_apr_warn_status(status))
|
||||
@@ -140,19 +139,19 @@ BOOL LLMail::send(
|
||||
}
|
||||
|
||||
// static
|
||||
void LLMail::init(const std::string& hostname)
|
||||
void LLMail::init(const std::string& hostname, apr_pool_t* pool)
|
||||
{
|
||||
gMailSocket = NULL;
|
||||
if (hostname.empty())
|
||||
if(hostname.empty() || !pool)
|
||||
{
|
||||
gMailPool = NULL;
|
||||
gSockAddr = NULL;
|
||||
gMailPool.destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
gMailPool.create();
|
||||
gMailPool = pool;
|
||||
|
||||
// Collect all the information into a sockaddr structure. the
|
||||
// collect all the information into a socaddr sturcture. the
|
||||
// documentation is a bit unclear, but I either have to
|
||||
// specify APR_UNSPEC or not specify any flags. I am not sure
|
||||
// which option is better.
|
||||
@@ -162,7 +161,7 @@ void LLMail::init(const std::string& hostname)
|
||||
APR_UNSPEC,
|
||||
25,
|
||||
APR_IPV4_ADDR_OK,
|
||||
gMailPool());
|
||||
gMailPool);
|
||||
ll_apr_warn_status(status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,15 @@
|
||||
#ifndef LL_LLMAIL_H
|
||||
#define LL_LLMAIL_H
|
||||
|
||||
typedef struct apr_pool_t apr_pool_t;
|
||||
|
||||
#include "llsd.h"
|
||||
|
||||
class LLMail
|
||||
{
|
||||
public:
|
||||
// if hostname is NULL, then the host is resolved as 'mail'
|
||||
static void init(const std::string& hostname);
|
||||
static void init(const std::string& hostname, apr_pool_t* pool);
|
||||
|
||||
// Allow all email transmission to be disabled/enabled.
|
||||
static void enable(bool mail_enabled);
|
||||
|
||||
@@ -388,7 +388,7 @@ bool LLMimeParser::Impl::parseHeaders(
|
||||
// not to read past limit when we get() the newline.
|
||||
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
|
||||
istr.getline(mBuffer, max_get, '\r');
|
||||
mScanCount += istr.gcount();
|
||||
mScanCount += (S32)istr.gcount();
|
||||
int c = istr.get();
|
||||
if(EOF == c)
|
||||
{
|
||||
@@ -496,7 +496,7 @@ void LLMimeParser::Impl::scanPastSeparator(
|
||||
// past limit when we get() the newline.
|
||||
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
|
||||
istr.getline(mBuffer, max_get, '\r');
|
||||
mScanCount += istr.gcount();
|
||||
mScanCount += (S32)istr.gcount();
|
||||
if(istr.gcount() >= LINE_BUFFER_LENGTH - 1)
|
||||
{
|
||||
// that's way too long to be a separator, so ignore it.
|
||||
|
||||
@@ -88,7 +88,7 @@ bool LLSDMessage::httpListener(const LLSD& request)
|
||||
request,
|
||||
url, "POST", reply, error),
|
||||
LLSD(), // headers
|
||||
timeout);
|
||||
(F32)timeout);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
|
||||
|
||||
// S64 not supported in LLSD so we just truncate it
|
||||
case MVT_S64:
|
||||
addS32(varname, *(S64*)mvci.getData());
|
||||
addS32(varname, (S32)*(S64*)mvci.getData());
|
||||
break;
|
||||
|
||||
case MVT_F32:
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "message.h"
|
||||
#include "lltimer.h"
|
||||
#include "llextendedstatus.h"
|
||||
|
||||
const S32 LL_XFER_LARGE_PAYLOAD = 7680;
|
||||
|
||||
|
||||
@@ -98,10 +98,8 @@ std::string get_shared_secret();
|
||||
class LLMessagePollInfo
|
||||
{
|
||||
public:
|
||||
LLMessagePollInfo(void) : mPool(LLThread::tldata().mRootPool) { }
|
||||
apr_socket_t *mAPRSocketp;
|
||||
apr_pollfd_t mPollFD;
|
||||
LLAPRPool mPool;
|
||||
};
|
||||
|
||||
namespace
|
||||
@@ -291,13 +289,15 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
|
||||
}
|
||||
// LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl;
|
||||
|
||||
mPollInfop = new LLMessagePollInfo;
|
||||
|
||||
//
|
||||
// Create the data structure that we can poll on
|
||||
//
|
||||
apr_socket_t *aprSocketp = NULL;
|
||||
apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, mPollInfop->mPool());
|
||||
apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, LLAPRRootPool::get()());
|
||||
|
||||
mPollInfop = new LLMessagePollInfo;
|
||||
mPollInfop->mAPRSocketp = aprSocketp;
|
||||
mPollInfop->mPollFD.p = mPollInfop->mPool();
|
||||
mPollInfop->mPollFD.p = LLAPRRootPool::get()();
|
||||
mPollInfop->mPollFD.desc_type = APR_POLL_SOCKET;
|
||||
mPollInfop->mPollFD.reqevents = APR_POLLIN;
|
||||
mPollInfop->mPollFD.rtnevents = 0;
|
||||
@@ -3147,7 +3147,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
|
||||
LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
|
||||
}
|
||||
|
||||
U32 now = time(NULL);
|
||||
U32 now = (U32)time(NULL);
|
||||
|
||||
now /= window;
|
||||
|
||||
@@ -3167,7 +3167,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
|
||||
}
|
||||
|
||||
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
|
||||
U32 now = time(NULL);
|
||||
U32 now = (U32)time(NULL);
|
||||
|
||||
now /= window;
|
||||
|
||||
@@ -3213,7 +3213,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
|
||||
LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
|
||||
}
|
||||
|
||||
U32 now = time(NULL);
|
||||
U32 now = (U32)time(NULL);
|
||||
|
||||
now /= window;
|
||||
|
||||
|
||||
@@ -945,7 +945,6 @@ char const* const _PREHASH_SysGPU = LLMessageStringTable::getInstance()->getStri
|
||||
char const* const _PREHASH_AvatarInterestsReply = LLMessageStringTable::getInstance()->getString("AvatarInterestsReply");
|
||||
char const* const _PREHASH_StartLure = LLMessageStringTable::getInstance()->getString("StartLure");
|
||||
char const* const _PREHASH_SysRAM = LLMessageStringTable::getInstance()->getString("SysRAM");
|
||||
char const* const _PREHASH_ObjectPosition = LLMessageStringTable::getInstance()->getString("ObjectPosition");
|
||||
char const* const _PREHASH_SitPosition = LLMessageStringTable::getInstance()->getString("SitPosition");
|
||||
char const* const _PREHASH_StartTime = LLMessageStringTable::getInstance()->getString("StartTime");
|
||||
char const* const _PREHASH_BornOn = LLMessageStringTable::getInstance()->getString("BornOn");
|
||||
@@ -1001,7 +1000,6 @@ char const* const _PREHASH_SnapshotID = LLMessageStringTable::getInstance()->get
|
||||
char const* const _PREHASH_Aspect = LLMessageStringTable::getInstance()->getString("Aspect");
|
||||
char const* const _PREHASH_ParamSize = LLMessageStringTable::getInstance()->getString("ParamSize");
|
||||
char const* const _PREHASH_VoteCast = LLMessageStringTable::getInstance()->getString("VoteCast");
|
||||
char const* const _PREHASH_CastsShadows = LLMessageStringTable::getInstance()->getString("CastsShadows");
|
||||
char const* const _PREHASH_EveryoneMask = LLMessageStringTable::getInstance()->getString("EveryoneMask");
|
||||
char const* const _PREHASH_ObjectSpinUpdate = LLMessageStringTable::getInstance()->getString("ObjectSpinUpdate");
|
||||
char const* const _PREHASH_MaturePublish = LLMessageStringTable::getInstance()->getString("MaturePublish");
|
||||
@@ -1050,7 +1048,6 @@ char const* const _PREHASH_SimIP = LLMessageStringTable::getInstance()->getStrin
|
||||
char const* const _PREHASH_GodID = LLMessageStringTable::getInstance()->getString("GodID");
|
||||
char const* const _PREHASH_TeleportMinPrice = LLMessageStringTable::getInstance()->getString("TeleportMinPrice");
|
||||
char const* const _PREHASH_VoteItem = LLMessageStringTable::getInstance()->getString("VoteItem");
|
||||
char const* const _PREHASH_ObjectRotation = LLMessageStringTable::getInstance()->getString("ObjectRotation");
|
||||
char const* const _PREHASH_SitRotation = LLMessageStringTable::getInstance()->getString("SitRotation");
|
||||
char const* const _PREHASH_SnapSelection = LLMessageStringTable::getInstance()->getString("SnapSelection");
|
||||
char const* const _PREHASH_SoundTrigger = LLMessageStringTable::getInstance()->getString("SoundTrigger");
|
||||
|
||||
@@ -945,7 +945,6 @@ extern char const* const _PREHASH_SysGPU;
|
||||
extern char const* const _PREHASH_AvatarInterestsReply;
|
||||
extern char const* const _PREHASH_StartLure;
|
||||
extern char const* const _PREHASH_SysRAM;
|
||||
extern char const* const _PREHASH_ObjectPosition;
|
||||
extern char const* const _PREHASH_SitPosition;
|
||||
extern char const* const _PREHASH_StartTime;
|
||||
extern char const* const _PREHASH_BornOn;
|
||||
@@ -1001,7 +1000,6 @@ extern char const* const _PREHASH_SnapshotID;
|
||||
extern char const* const _PREHASH_Aspect;
|
||||
extern char const* const _PREHASH_ParamSize;
|
||||
extern char const* const _PREHASH_VoteCast;
|
||||
extern char const* const _PREHASH_CastsShadows;
|
||||
extern char const* const _PREHASH_EveryoneMask;
|
||||
extern char const* const _PREHASH_ObjectSpinUpdate;
|
||||
extern char const* const _PREHASH_MaturePublish;
|
||||
@@ -1050,7 +1048,6 @@ extern char const* const _PREHASH_SimIP;
|
||||
extern char const* const _PREHASH_GodID;
|
||||
extern char const* const _PREHASH_TeleportMinPrice;
|
||||
extern char const* const _PREHASH_VoteItem;
|
||||
extern char const* const _PREHASH_ObjectRotation;
|
||||
extern char const* const _PREHASH_SitRotation;
|
||||
extern char const* const _PREHASH_SnapSelection;
|
||||
extern char const* const _PREHASH_SoundTrigger;
|
||||
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
std::string getHoverText() const { return mHoverText; };
|
||||
std::string getHoverLink() const { return mHoverLink; };
|
||||
|
||||
std::string getMediaName() const { return mMediaName; };
|
||||
const std::string& getMediaName() const { return mMediaName; };
|
||||
std::string getMediaDescription() const { return mMediaDescription; };
|
||||
|
||||
// Crash the plugin. If you use this outside of a testbed, you will be punished.
|
||||
|
||||
@@ -17,6 +17,7 @@ include_directories(
|
||||
|
||||
set(llprimitive_SOURCE_FILES
|
||||
llmaterialtable.cpp
|
||||
llmediaentry.cpp
|
||||
llmodel.cpp
|
||||
llprimitive.cpp
|
||||
llprimtexturelist.cpp
|
||||
|
||||
@@ -137,6 +137,7 @@ void LLMaterialTable::initTableTransNames(std::map<std::string, std::string> nam
|
||||
infop->mName = namemap[name];
|
||||
}
|
||||
}
|
||||
|
||||
void LLMaterialTable::initBasicTable()
|
||||
{
|
||||
// *TODO: Translate
|
||||
|
||||
596
indra/llprimitive/llmediaentry.cpp
Normal file
596
indra/llprimitive/llmediaentry.cpp
Normal file
@@ -0,0 +1,596 @@
|
||||
/**
|
||||
* @file llmediaentry.cpp
|
||||
* @brief This is a single instance of media data related to the face of a prim
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, 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 "linden_common.h"
|
||||
#include "llmediaentry.h"
|
||||
#include "lllslconstants.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
// LLSD key defines
|
||||
// DO NOT REORDER OR REMOVE THESE!
|
||||
|
||||
// Some LLSD keys. Do not change!
|
||||
#define MEDIA_ALT_IMAGE_ENABLE_KEY_STR "alt_image_enable"
|
||||
#define MEDIA_CONTROLS_KEY_STR "controls"
|
||||
#define MEDIA_CURRENT_URL_KEY_STR "current_url"
|
||||
#define MEDIA_HOME_URL_KEY_STR "home_url"
|
||||
#define MEDIA_AUTO_LOOP_KEY_STR "auto_loop"
|
||||
#define MEDIA_AUTO_PLAY_KEY_STR "auto_play"
|
||||
#define MEDIA_AUTO_SCALE_KEY_STR "auto_scale"
|
||||
#define MEDIA_AUTO_ZOOM_KEY_STR "auto_zoom"
|
||||
#define MEDIA_FIRST_CLICK_INTERACT_KEY_STR "first_click_interact"
|
||||
#define MEDIA_WIDTH_PIXELS_KEY_STR "width_pixels"
|
||||
#define MEDIA_HEIGHT_PIXELS_KEY_STR "height_pixels"
|
||||
|
||||
// "security" fields
|
||||
#define MEDIA_WHITELIST_ENABLE_KEY_STR "whitelist_enable"
|
||||
#define MEDIA_WHITELIST_KEY_STR "whitelist"
|
||||
|
||||
// "permissions" fields
|
||||
#define MEDIA_PERMS_INTERACT_KEY_STR "perms_interact"
|
||||
#define MEDIA_PERMS_CONTROL_KEY_STR "perms_control"
|
||||
|
||||
// "general" fields
|
||||
const char* LLMediaEntry::ALT_IMAGE_ENABLE_KEY = MEDIA_ALT_IMAGE_ENABLE_KEY_STR;
|
||||
const char* LLMediaEntry::CONTROLS_KEY = MEDIA_CONTROLS_KEY_STR;
|
||||
const char* LLMediaEntry::CURRENT_URL_KEY = MEDIA_CURRENT_URL_KEY_STR;
|
||||
const char* LLMediaEntry::HOME_URL_KEY = MEDIA_HOME_URL_KEY_STR;
|
||||
const char* LLMediaEntry::AUTO_LOOP_KEY = MEDIA_AUTO_LOOP_KEY_STR;
|
||||
const char* LLMediaEntry::AUTO_PLAY_KEY = MEDIA_AUTO_PLAY_KEY_STR;
|
||||
const char* LLMediaEntry::AUTO_SCALE_KEY = MEDIA_AUTO_SCALE_KEY_STR;
|
||||
const char* LLMediaEntry::AUTO_ZOOM_KEY = MEDIA_AUTO_ZOOM_KEY_STR;
|
||||
const char* LLMediaEntry::FIRST_CLICK_INTERACT_KEY = MEDIA_FIRST_CLICK_INTERACT_KEY_STR;
|
||||
const char* LLMediaEntry::WIDTH_PIXELS_KEY = MEDIA_WIDTH_PIXELS_KEY_STR;
|
||||
const char* LLMediaEntry::HEIGHT_PIXELS_KEY = MEDIA_HEIGHT_PIXELS_KEY_STR;
|
||||
|
||||
// "security" fields
|
||||
const char* LLMediaEntry::WHITELIST_ENABLE_KEY = MEDIA_WHITELIST_ENABLE_KEY_STR;
|
||||
const char* LLMediaEntry::WHITELIST_KEY = MEDIA_WHITELIST_KEY_STR;
|
||||
|
||||
// "permissions" fields
|
||||
const char* LLMediaEntry::PERMS_INTERACT_KEY = MEDIA_PERMS_INTERACT_KEY_STR;
|
||||
const char* LLMediaEntry::PERMS_CONTROL_KEY = MEDIA_PERMS_CONTROL_KEY_STR;
|
||||
|
||||
#define DEFAULT_URL_PREFIX "http://"
|
||||
|
||||
// Constructor(s)
|
||||
LLMediaEntry::LLMediaEntry() :
|
||||
mAltImageEnable(false),
|
||||
mControls(STANDARD),
|
||||
mCurrentURL(""),
|
||||
mHomeURL(""),
|
||||
mAutoLoop(false),
|
||||
mAutoPlay(false),
|
||||
mAutoScale(false),
|
||||
mAutoZoom(false),
|
||||
mFirstClickInteract(false),
|
||||
mWidthPixels(0),
|
||||
mHeightPixels(0),
|
||||
mWhiteListEnable(false),
|
||||
// mWhiteList
|
||||
mPermsInteract(PERM_ALL),
|
||||
mPermsControl(PERM_ALL),
|
||||
mMediaIDp(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
LLMediaEntry::LLMediaEntry(const LLMediaEntry &rhs) :
|
||||
mMediaIDp(NULL)
|
||||
{
|
||||
// "general" fields
|
||||
mAltImageEnable = rhs.mAltImageEnable;
|
||||
mControls = rhs.mControls;
|
||||
mCurrentURL = rhs.mCurrentURL;
|
||||
mHomeURL = rhs.mHomeURL;
|
||||
mAutoLoop = rhs.mAutoLoop;
|
||||
mAutoPlay = rhs.mAutoPlay;
|
||||
mAutoScale = rhs.mAutoScale;
|
||||
mAutoZoom = rhs.mAutoZoom;
|
||||
mFirstClickInteract = rhs.mFirstClickInteract;
|
||||
mWidthPixels = rhs.mWidthPixels;
|
||||
mHeightPixels = rhs.mHeightPixels;
|
||||
|
||||
// "security" fields
|
||||
mWhiteListEnable = rhs.mWhiteListEnable;
|
||||
mWhiteList = rhs.mWhiteList;
|
||||
|
||||
// "permissions" fields
|
||||
mPermsInteract = rhs.mPermsInteract;
|
||||
mPermsControl = rhs.mPermsControl;
|
||||
}
|
||||
|
||||
LLMediaEntry::~LLMediaEntry()
|
||||
{
|
||||
if (NULL != mMediaIDp)
|
||||
{
|
||||
delete mMediaIDp;
|
||||
}
|
||||
}
|
||||
|
||||
LLSD LLMediaEntry::asLLSD() const
|
||||
{
|
||||
LLSD sd;
|
||||
asLLSD(sd);
|
||||
return sd;
|
||||
}
|
||||
|
||||
//
|
||||
// LLSD functions
|
||||
//
|
||||
void LLMediaEntry::asLLSD(LLSD& sd) const
|
||||
{
|
||||
// "general" fields
|
||||
sd[ALT_IMAGE_ENABLE_KEY] = mAltImageEnable;
|
||||
sd[CONTROLS_KEY] = (LLSD::Integer)mControls;
|
||||
sd[CURRENT_URL_KEY] = mCurrentURL;
|
||||
sd[HOME_URL_KEY] = mHomeURL;
|
||||
sd[AUTO_LOOP_KEY] = mAutoLoop;
|
||||
sd[AUTO_PLAY_KEY] = mAutoPlay;
|
||||
sd[AUTO_SCALE_KEY] = mAutoScale;
|
||||
sd[AUTO_ZOOM_KEY] = mAutoZoom;
|
||||
sd[FIRST_CLICK_INTERACT_KEY] = mFirstClickInteract;
|
||||
sd[WIDTH_PIXELS_KEY] = mWidthPixels;
|
||||
sd[HEIGHT_PIXELS_KEY] = mHeightPixels;
|
||||
|
||||
// "security" fields
|
||||
sd[WHITELIST_ENABLE_KEY] = mWhiteListEnable;
|
||||
sd.erase(WHITELIST_KEY);
|
||||
for (U32 i=0; i<mWhiteList.size(); i++)
|
||||
{
|
||||
sd[WHITELIST_KEY].append(mWhiteList[i]);
|
||||
}
|
||||
|
||||
// "permissions" fields
|
||||
sd[PERMS_INTERACT_KEY] = mPermsInteract;
|
||||
sd[PERMS_CONTROL_KEY] = mPermsControl;
|
||||
}
|
||||
|
||||
// static
|
||||
bool LLMediaEntry::checkLLSD(const LLSD& sd)
|
||||
{
|
||||
if (sd.isUndefined()) return true;
|
||||
LLMediaEntry temp;
|
||||
return temp.fromLLSDInternal(sd, true);
|
||||
}
|
||||
|
||||
void LLMediaEntry::fromLLSD(const LLSD& sd)
|
||||
{
|
||||
(void)fromLLSDInternal(sd, true);
|
||||
}
|
||||
|
||||
void LLMediaEntry::mergeFromLLSD(const LLSD& sd)
|
||||
{
|
||||
(void)fromLLSDInternal(sd, false);
|
||||
}
|
||||
|
||||
// *NOTE: returns true if NO failures to set occurred, false otherwise.
|
||||
// However, be aware that if a failure to set does occur, it does
|
||||
// not stop setting fields from the LLSD!
|
||||
bool LLMediaEntry::fromLLSDInternal(const LLSD& sd, bool overwrite)
|
||||
{
|
||||
// *HACK: we sort of cheat here and assume that status is a
|
||||
// bit field. We "or" into status and instead of returning
|
||||
// it, we return whether it finishes off as LSL_STATUS_OK or not.
|
||||
U32 status = LSL_STATUS_OK;
|
||||
|
||||
// "general" fields
|
||||
if ( overwrite || sd.has(ALT_IMAGE_ENABLE_KEY) )
|
||||
{
|
||||
status |= setAltImageEnable( sd[ALT_IMAGE_ENABLE_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(CONTROLS_KEY) )
|
||||
{
|
||||
status |= setControls( (MediaControls)(LLSD::Integer)sd[CONTROLS_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(CURRENT_URL_KEY) )
|
||||
{
|
||||
// Don't check whitelist
|
||||
status |= setCurrentURLInternal( sd[CURRENT_URL_KEY], false );
|
||||
}
|
||||
if ( overwrite || sd.has(HOME_URL_KEY) )
|
||||
{
|
||||
status |= setHomeURL( sd[HOME_URL_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(AUTO_LOOP_KEY) )
|
||||
{
|
||||
status |= setAutoLoop( sd[AUTO_LOOP_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(AUTO_PLAY_KEY) )
|
||||
{
|
||||
status |= setAutoPlay( sd[AUTO_PLAY_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(AUTO_SCALE_KEY) )
|
||||
{
|
||||
status |= setAutoScale( sd[AUTO_SCALE_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(AUTO_ZOOM_KEY) )
|
||||
{
|
||||
status |= setAutoZoom( sd[AUTO_ZOOM_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(FIRST_CLICK_INTERACT_KEY) )
|
||||
{
|
||||
status |= setFirstClickInteract( sd[FIRST_CLICK_INTERACT_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(WIDTH_PIXELS_KEY) )
|
||||
{
|
||||
status |= setWidthPixels( (LLSD::Integer)sd[WIDTH_PIXELS_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(HEIGHT_PIXELS_KEY) )
|
||||
{
|
||||
status |= setHeightPixels( (LLSD::Integer)sd[HEIGHT_PIXELS_KEY] );
|
||||
}
|
||||
|
||||
// "security" fields
|
||||
if ( overwrite || sd.has(WHITELIST_ENABLE_KEY) )
|
||||
{
|
||||
status |= setWhiteListEnable( sd[WHITELIST_ENABLE_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(WHITELIST_KEY) )
|
||||
{
|
||||
status |= setWhiteList( sd[WHITELIST_KEY] );
|
||||
}
|
||||
|
||||
// "permissions" fields
|
||||
if ( overwrite || sd.has(PERMS_INTERACT_KEY) )
|
||||
{
|
||||
status |= setPermsInteract( 0xff & (LLSD::Integer)sd[PERMS_INTERACT_KEY] );
|
||||
}
|
||||
if ( overwrite || sd.has(PERMS_CONTROL_KEY) )
|
||||
{
|
||||
status |= setPermsControl( 0xff & (LLSD::Integer)sd[PERMS_CONTROL_KEY] );
|
||||
}
|
||||
|
||||
return LSL_STATUS_OK == status;
|
||||
}
|
||||
|
||||
LLMediaEntry& LLMediaEntry::operator=(const LLMediaEntry &rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
{
|
||||
// "general" fields
|
||||
mAltImageEnable = rhs.mAltImageEnable;
|
||||
mControls = rhs.mControls;
|
||||
mCurrentURL = rhs.mCurrentURL;
|
||||
mHomeURL = rhs.mHomeURL;
|
||||
mAutoLoop = rhs.mAutoLoop;
|
||||
mAutoPlay = rhs.mAutoPlay;
|
||||
mAutoScale = rhs.mAutoScale;
|
||||
mAutoZoom = rhs.mAutoZoom;
|
||||
mFirstClickInteract = rhs.mFirstClickInteract;
|
||||
mWidthPixels = rhs.mWidthPixels;
|
||||
mHeightPixels = rhs.mHeightPixels;
|
||||
|
||||
// "security" fields
|
||||
mWhiteListEnable = rhs.mWhiteListEnable;
|
||||
mWhiteList = rhs.mWhiteList;
|
||||
|
||||
// "permissions" fields
|
||||
mPermsInteract = rhs.mPermsInteract;
|
||||
mPermsControl = rhs.mPermsControl;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool LLMediaEntry::operator==(const LLMediaEntry &rhs) const
|
||||
{
|
||||
return (
|
||||
// "general" fields
|
||||
mAltImageEnable == rhs.mAltImageEnable &&
|
||||
mControls == rhs.mControls &&
|
||||
mCurrentURL == rhs.mCurrentURL &&
|
||||
mHomeURL == rhs.mHomeURL &&
|
||||
mAutoLoop == rhs.mAutoLoop &&
|
||||
mAutoPlay == rhs.mAutoPlay &&
|
||||
mAutoScale == rhs.mAutoScale &&
|
||||
mAutoZoom == rhs.mAutoZoom &&
|
||||
mFirstClickInteract == rhs.mFirstClickInteract &&
|
||||
mWidthPixels == rhs.mWidthPixels &&
|
||||
mHeightPixels == rhs.mHeightPixels &&
|
||||
|
||||
// "security" fields
|
||||
mWhiteListEnable == rhs.mWhiteListEnable &&
|
||||
mWhiteList == rhs.mWhiteList &&
|
||||
|
||||
// "permissions" fields
|
||||
mPermsInteract == rhs.mPermsInteract &&
|
||||
mPermsControl == rhs.mPermsControl
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
bool LLMediaEntry::operator!=(const LLMediaEntry &rhs) const
|
||||
{
|
||||
return (
|
||||
// "general" fields
|
||||
mAltImageEnable != rhs.mAltImageEnable ||
|
||||
mControls != rhs.mControls ||
|
||||
mCurrentURL != rhs.mCurrentURL ||
|
||||
mHomeURL != rhs.mHomeURL ||
|
||||
mAutoLoop != rhs.mAutoLoop ||
|
||||
mAutoPlay != rhs.mAutoPlay ||
|
||||
mAutoScale != rhs.mAutoScale ||
|
||||
mAutoZoom != rhs.mAutoZoom ||
|
||||
mFirstClickInteract != rhs.mFirstClickInteract ||
|
||||
mWidthPixels != rhs.mWidthPixels ||
|
||||
mHeightPixels != rhs.mHeightPixels ||
|
||||
|
||||
// "security" fields
|
||||
mWhiteListEnable != rhs.mWhiteListEnable ||
|
||||
mWhiteList != rhs.mWhiteList ||
|
||||
|
||||
// "permissions" fields
|
||||
mPermsInteract != rhs.mPermsInteract ||
|
||||
mPermsControl != rhs.mPermsControl
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setWhiteList( const std::vector<std::string> &whitelist )
|
||||
{
|
||||
// *NOTE: This code is VERY similar to the setWhitelist below.
|
||||
// IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER!
|
||||
U32 size = 0;
|
||||
U32 count = 0;
|
||||
// First count to make sure the size constraint is not violated
|
||||
std::vector<std::string>::const_iterator iter = whitelist.begin();
|
||||
std::vector<std::string>::const_iterator end = whitelist.end();
|
||||
for ( ; iter < end; ++iter)
|
||||
{
|
||||
const std::string &entry = (*iter);
|
||||
size += entry.length() + 1; // Include one for \0
|
||||
count ++;
|
||||
if (size > MAX_WHITELIST_SIZE || count > MAX_WHITELIST_COUNT)
|
||||
{
|
||||
return LSL_STATUS_BOUNDS_ERROR;
|
||||
}
|
||||
}
|
||||
// Next clear the vector
|
||||
mWhiteList.clear();
|
||||
// Then re-iterate and copy entries
|
||||
iter = whitelist.begin();
|
||||
for ( ; iter < end; ++iter)
|
||||
{
|
||||
const std::string &entry = (*iter);
|
||||
mWhiteList.push_back(entry);
|
||||
}
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setWhiteList( const LLSD &whitelist )
|
||||
{
|
||||
// If whitelist is undef, the whitelist is cleared
|
||||
if (whitelist.isUndefined())
|
||||
{
|
||||
mWhiteList.clear();
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
|
||||
// However, if the whitelist is an empty array, erase it.
|
||||
if (whitelist.isArray())
|
||||
{
|
||||
// *NOTE: This code is VERY similar to the setWhitelist above.
|
||||
// IF YOU CHANGE THIS IMPLEMENTATION, BE SURE TO CHANGE THE OTHER!
|
||||
U32 size = 0;
|
||||
U32 count = 0;
|
||||
// First check to make sure the size and count constraints are not violated
|
||||
LLSD::array_const_iterator iter = whitelist.beginArray();
|
||||
LLSD::array_const_iterator end = whitelist.endArray();
|
||||
for ( ; iter < end; ++iter)
|
||||
{
|
||||
const std::string &entry = (*iter).asString();
|
||||
size += entry.length() + 1; // Include one for \0
|
||||
count ++;
|
||||
if (size > MAX_WHITELIST_SIZE || count > MAX_WHITELIST_COUNT)
|
||||
{
|
||||
return LSL_STATUS_BOUNDS_ERROR;
|
||||
}
|
||||
}
|
||||
// Next clear the vector
|
||||
mWhiteList.clear();
|
||||
// Then re-iterate and copy entries
|
||||
iter = whitelist.beginArray();
|
||||
for ( ; iter < end; ++iter)
|
||||
{
|
||||
const std::string &entry = (*iter).asString();
|
||||
mWhiteList.push_back(entry);
|
||||
}
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LSL_STATUS_MALFORMED_PARAMS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void prefix_with(std::string &str, const char *chars, const char *prefix)
|
||||
{
|
||||
// Given string 'str', prefix all instances of any character in 'chars'
|
||||
// with 'prefix'
|
||||
size_t found = str.find_first_of(chars);
|
||||
size_t prefix_len = strlen(prefix);
|
||||
while (found != std::string::npos)
|
||||
{
|
||||
str.insert(found, prefix, prefix_len);
|
||||
found = str.find_first_of(chars, found+prefix_len+1);
|
||||
}
|
||||
}
|
||||
|
||||
static bool pattern_match(const std::string &candidate_str, const std::string &pattern)
|
||||
{
|
||||
// If the pattern is empty, it matches
|
||||
if (pattern.empty()) return true;
|
||||
|
||||
// 'pattern' is a glob pattern, we only accept '*' chars
|
||||
// copy it
|
||||
std::string expression = pattern;
|
||||
|
||||
// Escape perl's regexp chars with a backslash, except all "*" chars
|
||||
prefix_with(expression, ".[{()\\+?|^$", "\\");
|
||||
prefix_with(expression, "*", ".");
|
||||
|
||||
// case-insensitive matching:
|
||||
boost::regex regexp(expression, boost::regex::perl|boost::regex::icase);
|
||||
return boost::regex_match(candidate_str, regexp);
|
||||
}
|
||||
|
||||
bool LLMediaEntry::checkCandidateUrl(const std::string& url) const
|
||||
{
|
||||
if (getWhiteListEnable())
|
||||
{
|
||||
return checkUrlAgainstWhitelist(url, getWhiteList());
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
bool LLMediaEntry::checkUrlAgainstWhitelist(const std::string& url,
|
||||
const std::vector<std::string> &whitelist)
|
||||
{
|
||||
bool passes = true;
|
||||
// *NOTE: no entries? Don't check
|
||||
if (whitelist.size() > 0)
|
||||
{
|
||||
passes = false;
|
||||
|
||||
// Case insensitive: the reason why we toUpper both this and the
|
||||
// filter
|
||||
std::string candidate_url = url;
|
||||
// Use lluri to see if there is a path part in the candidate URL. No path? Assume "/"
|
||||
LLURI candidate_uri(candidate_url);
|
||||
std::vector<std::string>::const_iterator iter = whitelist.begin();
|
||||
std::vector<std::string>::const_iterator end = whitelist.end();
|
||||
for ( ; iter < end; ++iter )
|
||||
{
|
||||
std::string filter = *iter;
|
||||
|
||||
LLURI filter_uri(filter);
|
||||
bool scheme_passes = pattern_match( candidate_uri.scheme(), filter_uri.scheme() );
|
||||
if (filter_uri.scheme().empty())
|
||||
{
|
||||
filter_uri = LLURI(DEFAULT_URL_PREFIX + filter);
|
||||
}
|
||||
bool authority_passes = pattern_match( candidate_uri.authority(), filter_uri.authority() );
|
||||
bool path_passes = pattern_match( candidate_uri.escapedPath(), filter_uri.escapedPath() );
|
||||
|
||||
if (scheme_passes && authority_passes && path_passes)
|
||||
{
|
||||
passes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return passes;
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setStringFieldWithLimit( std::string &field, const std::string &value, U32 limit )
|
||||
{
|
||||
if ( value.length() > limit )
|
||||
{
|
||||
return LSL_STATUS_BOUNDS_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
field = value;
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setControls(LLMediaEntry::MediaControls controls)
|
||||
{
|
||||
if (controls == STANDARD ||
|
||||
controls == MINI)
|
||||
{
|
||||
mControls = controls;
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
return LSL_STATUS_BOUNDS_ERROR;
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setPermsInteract( U8 val )
|
||||
{
|
||||
mPermsInteract = val & PERM_MASK;
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setPermsControl( U8 val )
|
||||
{
|
||||
mPermsControl = val & PERM_MASK;
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setCurrentURL(const std::string& current_url)
|
||||
{
|
||||
return setCurrentURLInternal( current_url, true );
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setCurrentURLInternal(const std::string& current_url, bool check_whitelist)
|
||||
{
|
||||
if ( ! check_whitelist || checkCandidateUrl(current_url))
|
||||
{
|
||||
return setStringFieldWithLimit( mCurrentURL, current_url, MAX_URL_LENGTH );
|
||||
}
|
||||
else
|
||||
{
|
||||
return LSL_STATUS_WHITELIST_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setHomeURL(const std::string& home_url)
|
||||
{
|
||||
return setStringFieldWithLimit( mHomeURL, home_url, MAX_URL_LENGTH );
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setWidthPixels(U16 width)
|
||||
{
|
||||
if (width > MAX_WIDTH_PIXELS) return LSL_STATUS_BOUNDS_ERROR;
|
||||
mWidthPixels = width;
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
|
||||
U32 LLMediaEntry::setHeightPixels(U16 height)
|
||||
{
|
||||
if (height > MAX_HEIGHT_PIXELS) return LSL_STATUS_BOUNDS_ERROR;
|
||||
mHeightPixels = height;
|
||||
return LSL_STATUS_OK;
|
||||
}
|
||||
|
||||
const LLUUID &LLMediaEntry::getMediaID() const
|
||||
{
|
||||
// Lazily generate media ID
|
||||
if (NULL == mMediaIDp)
|
||||
{
|
||||
mMediaIDp = new LLUUID();
|
||||
mMediaIDp->generate();
|
||||
}
|
||||
return *mMediaIDp;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,6 @@ LLModel::~LLModel()
|
||||
bool get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S32& tc_offset, S32& norm_offset, S32 &idx_stride,
|
||||
domSource* &pos_source, domSource* &tc_source, domSource* &norm_source)
|
||||
{
|
||||
|
||||
idx_stride = 0;
|
||||
|
||||
for (U32 j = 0; j < inputs.getCount(); ++j)
|
||||
@@ -209,7 +208,6 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
|
||||
n[idx[i+norm_offset]*3+1],
|
||||
n[idx[i+norm_offset]*3+2]));
|
||||
}
|
||||
|
||||
|
||||
BOOL found = FALSE;
|
||||
|
||||
@@ -276,7 +274,6 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
|
||||
face = LLVolumeFace();
|
||||
point_map.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!verts.empty())
|
||||
@@ -509,7 +506,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
|
||||
{
|
||||
material = std::string(poly->getMaterial());
|
||||
}
|
||||
|
||||
|
||||
materials.push_back(material);
|
||||
face_list.push_back(face);
|
||||
face_list.rbegin()->fillFromLegacyData(verts, indices);
|
||||
@@ -539,7 +536,6 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
|
||||
|
||||
const domInputLocalOffset_Array& inputs = poly->getInput_array();
|
||||
|
||||
|
||||
S32 v_offset = -1;
|
||||
S32 n_offset = -1;
|
||||
S32 t_offset = -1;
|
||||
@@ -651,8 +647,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
|
||||
vert.mTexCoord.setVec(t->get(t_idx),
|
||||
t->get(t_idx+1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
verts.push_back(vert);
|
||||
}
|
||||
}
|
||||
@@ -1467,7 +1462,6 @@ LLSD LLModel::writeModel(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LLVector2 tc_range = max_tc - min_tc;
|
||||
|
||||
for (U32 j = 0; j < (U32)face.mNumVertices; ++j)
|
||||
@@ -1983,6 +1977,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn
|
||||
|
||||
//build a map of material slot names to face indexes
|
||||
bool reorder = false;
|
||||
|
||||
std::set<std::string> base_mat;
|
||||
std::set<std::string> cur_mat;
|
||||
|
||||
|
||||
@@ -2,31 +2,25 @@
|
||||
* @file object_flags.h
|
||||
* @brief Flags for object creation and transmission
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("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
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
* 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.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* 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$
|
||||
*/
|
||||
|
||||
@@ -34,43 +28,47 @@
|
||||
#define LL_OBJECT_FLAGS_H
|
||||
|
||||
// downstream flags from sim->viewer
|
||||
const U32 FLAGS_USE_PHYSICS = 0x00000001;
|
||||
const U32 FLAGS_CREATE_SELECTED = 0x00000002;
|
||||
const U32 FLAGS_OBJECT_MODIFY = 0x00000004;
|
||||
const U32 FLAGS_OBJECT_COPY = 0x00000008;
|
||||
const U32 FLAGS_OBJECT_ANY_OWNER = 0x00000010;
|
||||
const U32 FLAGS_OBJECT_YOU_OWNER = 0x00000020;
|
||||
const U32 FLAGS_SCRIPTED = 0x00000040;
|
||||
const U32 FLAGS_HANDLE_TOUCH = 0x00000080;
|
||||
const U32 FLAGS_OBJECT_MOVE = 0x00000100;
|
||||
const U32 FLAGS_TAKES_MONEY = 0x00000200;
|
||||
const U32 FLAGS_PHANTOM = 0x00000400;
|
||||
const U32 FLAGS_INVENTORY_EMPTY = 0x00000800;
|
||||
const U32 FLAGS_USE_PHYSICS = (1U << 0);
|
||||
const U32 FLAGS_CREATE_SELECTED = (1U << 1);
|
||||
const U32 FLAGS_OBJECT_MODIFY = (1U << 2);
|
||||
const U32 FLAGS_OBJECT_COPY = (1U << 3);
|
||||
const U32 FLAGS_OBJECT_ANY_OWNER = (1U << 4);
|
||||
const U32 FLAGS_OBJECT_YOU_OWNER = (1U << 5);
|
||||
const U32 FLAGS_SCRIPTED = (1U << 6);
|
||||
const U32 FLAGS_HANDLE_TOUCH = (1U << 7);
|
||||
const U32 FLAGS_OBJECT_MOVE = (1U << 8);
|
||||
const U32 FLAGS_TAKES_MONEY = (1U << 9);
|
||||
const U32 FLAGS_PHANTOM = (1U << 10);
|
||||
const U32 FLAGS_INVENTORY_EMPTY = (1U << 11);
|
||||
|
||||
const U32 FLAGS_JOINT_HINGE = 0x00001000;
|
||||
const U32 FLAGS_JOINT_P2P = 0x00002000;
|
||||
const U32 FLAGS_JOINT_LP2P = 0x00004000;
|
||||
// const U32 FLAGS_JOINT_WHEEL = 0x00008000;
|
||||
const U32 FLAGS_INCLUDE_IN_SEARCH = 0x00008000;
|
||||
const U32 FLAGS_AFFECTS_NAVMESH = (1U << 12);
|
||||
const U32 FLAGS_CHARACTER = (1U << 13);
|
||||
const U32 FLAGS_VOLUME_DETECT = (1U << 14);
|
||||
const U32 FLAGS_INCLUDE_IN_SEARCH = (1U << 15);
|
||||
|
||||
const U32 FLAGS_ALLOW_INVENTORY_DROP = 0x00010000;
|
||||
const U32 FLAGS_OBJECT_TRANSFER = 0x00020000;
|
||||
const U32 FLAGS_OBJECT_GROUP_OWNED = 0x00040000;
|
||||
//const U32 FLAGS_OBJECT_YOU_OFFICER = 0x00080000;
|
||||
const U32 FLAGS_ALLOW_INVENTORY_DROP = (1U << 16);
|
||||
const U32 FLAGS_OBJECT_TRANSFER = (1U << 17);
|
||||
const U32 FLAGS_OBJECT_GROUP_OWNED = (1U << 18);
|
||||
//const U32 FLAGS_UNUSED_000 = (1U << 19); // was FLAGS_OBJECT_YOU_OFFICER
|
||||
|
||||
const U32 FLAGS_CAMERA_DECOUPLED = 0x00100000;
|
||||
const U32 FLAGS_ANIM_SOURCE = 0x00200000;
|
||||
const U32 FLAGS_CAMERA_SOURCE = 0x00400000;
|
||||
const U32 FLAGS_CAMERA_DECOUPLED = (1U << 20);
|
||||
const U32 FLAGS_ANIM_SOURCE = (1U << 21);
|
||||
const U32 FLAGS_CAMERA_SOURCE = (1U << 22);
|
||||
|
||||
const U32 FLAGS_CAST_SHADOWS = 0x00800000;
|
||||
//const U32 FLAGS_UNUSED_001 = (1U << 23); // was FLAGS_CAST_SHADOWS
|
||||
|
||||
const U32 FLAGS_OBJECT_OWNER_MODIFY = 0x10000000;
|
||||
//const U32 FLAGS_UNUSED_002 = (1U << 24);
|
||||
//const U32 FLAGS_UNUSED_003 = (1U << 25);
|
||||
//const U32 FLAGS_UNUSED_004 = (1U << 26);
|
||||
//const U32 FLAGS_UNUSED_005 = (1U << 27);
|
||||
|
||||
const U32 FLAGS_TEMPORARY_ON_REZ = 0x20000000;
|
||||
const U32 FLAGS_TEMPORARY = 0x40000000;
|
||||
const U32 FLAGS_ZLIB_COMPRESSED = 0x80000000;
|
||||
const U32 FLAGS_OBJECT_OWNER_MODIFY = (1U << 28);
|
||||
|
||||
const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE;
|
||||
const U32 FLAGS_TEMPORARY_ON_REZ = (1U << 29);
|
||||
const U32 FLAGS_TEMPORARY = (1U << 30);
|
||||
//const U32 FLAGS_UNUSED_007 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED
|
||||
|
||||
const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE;
|
||||
|
||||
typedef enum e_havok_joint_type
|
||||
{
|
||||
|
||||
@@ -2001,7 +2001,6 @@ BOOL LLImageGL::getMask(const LLVector2 &tc)
|
||||
|
||||
void LLImageGL::setCategory(S32 category)
|
||||
{
|
||||
#if 0 //turn this off temporarily because it is not in use now.
|
||||
if(!gAuditTexture)
|
||||
{
|
||||
return ;
|
||||
@@ -2022,7 +2021,6 @@ void LLImageGL::setCategory(S32 category)
|
||||
mCategory = -1 ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//for debug use
|
||||
@@ -2053,14 +2051,16 @@ S32 LLImageGL::getTextureCounterIndex(U32 val)
|
||||
void LLImageGL::incTextureCounter(U32 val, S32 ncomponents, S32 category)
|
||||
{
|
||||
sTextureLoadedCounter[getTextureCounterIndex(val)]++ ;
|
||||
sTextureMemByCategory[category] += (S32)val * ncomponents ;
|
||||
if(category > -1)
|
||||
sTextureMemByCategory[category] += (S32)val * ncomponents ;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLImageGL::decTextureCounter(U32 val, S32 ncomponents, S32 category)
|
||||
{
|
||||
sTextureLoadedCounter[getTextureCounterIndex(val)]-- ;
|
||||
sTextureMemByCategory[category] += (S32)val * ncomponents ;
|
||||
if(category > -1)
|
||||
sTextureMemByCategory[category] -= (S32)val * ncomponents ;
|
||||
}
|
||||
|
||||
void LLImageGL::setCurTexSizebar(S32 index, BOOL set_pick_size)
|
||||
|
||||
@@ -33,34 +33,247 @@
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llpostprocess.h"
|
||||
#include "llglslshader.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llrender.h"
|
||||
#include "llvertexbuffer.h"
|
||||
|
||||
#include "lldir.h"
|
||||
#include "llgl.h"
|
||||
#include "llglslshader.h"
|
||||
#include "llrender.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
#include "llvertexbuffer.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
extern LLGLSLShader gPostColorFilterProgram;
|
||||
extern LLGLSLShader gPostNightVisionProgram;
|
||||
extern LLGLSLShader gPostGaussianBlurProgram;
|
||||
extern LLGLSLShader gPostPosterizeProgram;
|
||||
|
||||
static const unsigned int NOISE_SIZE = 512;
|
||||
|
||||
/// CALCULATING LUMINANCE (Using NTSC lum weights)
|
||||
/// http://en.wikipedia.org/wiki/Luma_%28video%29
|
||||
static const float LUMINANCE_R = 0.299f;
|
||||
static const float LUMINANCE_G = 0.587f;
|
||||
static const float LUMINANCE_B = 0.114f;
|
||||
|
||||
static const char * const XML_FILENAME = "postprocesseffects.xml";
|
||||
|
||||
LLPostProcess::LLPostProcess(void) :
|
||||
mVBO(NULL),
|
||||
mAllEffects(LLSD::emptyMap()),
|
||||
mScreenWidth(1), mScreenHeight(1)
|
||||
template<> LLSD LLPostProcessShader::LLShaderSetting<LLVector4>::getDefaultValue()
|
||||
{
|
||||
mSceneRenderTexture = NULL ;
|
||||
mNoiseTexture = NULL ;
|
||||
|
||||
return mDefault.getValue();
|
||||
}
|
||||
template<> void LLPostProcessShader::LLShaderSetting<LLVector4>::setValue(const LLSD& value)
|
||||
{
|
||||
mValue = ll_vector4_from_sd(value);
|
||||
}
|
||||
|
||||
LLSD LLPostProcessShader::getDefaults()
|
||||
{
|
||||
LLSD defaults;
|
||||
for(std::vector<LLShaderSettingBase*>::iterator it=mSettings.begin();it!=mSettings.end();++it)
|
||||
{
|
||||
defaults[(*it)->mSettingName]=(*it)->getDefaultValue();
|
||||
}
|
||||
return defaults;
|
||||
}
|
||||
void LLPostProcessShader::loadSettings(const LLSD& settings)
|
||||
{
|
||||
for(std::vector<LLShaderSettingBase*>::iterator it=mSettings.begin();it!=mSettings.end();++it)
|
||||
{
|
||||
LLSD value = settings[(*it)->mSettingName];
|
||||
(*it)->setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
class LLColorFilterShader : public LLPostProcessShader
|
||||
{
|
||||
private:
|
||||
LLShaderSetting<bool> mEnabled;
|
||||
LLShaderSetting<F32> mGamma, mBrightness, mContrast, mSaturation;
|
||||
LLShaderSetting<LLVector4> mContrastBase;
|
||||
public:
|
||||
LLColorFilterShader() :
|
||||
mEnabled("enable_color_filter",false),
|
||||
mGamma("gamma",1.f),
|
||||
mBrightness("brightness",1.f),
|
||||
mContrast("contrast",1.f),
|
||||
mSaturation("saturation",1.f),
|
||||
mContrastBase("contrast_base",LLVector4(1.f,1.f,1.f,0.5f))
|
||||
{
|
||||
mSettings.push_back(&mEnabled);
|
||||
mSettings.push_back(&mGamma);
|
||||
mSettings.push_back(&mBrightness);
|
||||
mSettings.push_back(&mContrast);
|
||||
mSettings.push_back(&mSaturation);
|
||||
mSettings.push_back(&mContrastBase);
|
||||
}
|
||||
|
||||
bool isEnabled() { return mEnabled && gPostColorFilterProgram.mProgramObject; }
|
||||
S32 getColorChannel() { return 0; }
|
||||
S32 getDepthChannel() { return -1; }
|
||||
|
||||
QuadType bind()
|
||||
{
|
||||
if(!isEnabled())
|
||||
return QUAD_NONE;
|
||||
|
||||
/// CALCULATING LUMINANCE (Using NTSC lum weights)
|
||||
/// http://en.wikipedia.org/wiki/Luma_%28video%29
|
||||
static const float LUMINANCE_R = 0.299f;
|
||||
static const float LUMINANCE_G = 0.587f;
|
||||
static const float LUMINANCE_B = 0.114f;
|
||||
|
||||
gPostColorFilterProgram.bind();
|
||||
|
||||
gPostColorFilterProgram.uniform1f("gamma", mGamma);
|
||||
gPostColorFilterProgram.uniform1f("brightness", mBrightness);
|
||||
gPostColorFilterProgram.uniform1f("contrast", mContrast);
|
||||
float baseI = (mContrastBase.mValue[VX] + mContrastBase.mValue[VY] + mContrastBase.mValue[VZ]) / 3.0f;
|
||||
baseI = mContrastBase.mValue[VW] / ((baseI < 0.001f) ? 0.001f : baseI);
|
||||
float baseR = mContrastBase.mValue[VX] * baseI;
|
||||
float baseG = mContrastBase.mValue[VY] * baseI;
|
||||
float baseB = mContrastBase.mValue[VZ] * baseI;
|
||||
gPostColorFilterProgram.uniform3fv("contrastBase", 1, LLVector3(baseR, baseG, baseB).mV);
|
||||
gPostColorFilterProgram.uniform1f("saturation", mSaturation);
|
||||
gPostColorFilterProgram.uniform3fv("lumWeights", 1, LLVector3(LUMINANCE_R, LUMINANCE_G, LUMINANCE_B).mV);
|
||||
return QUAD_NORMAL;
|
||||
}
|
||||
bool draw(U32 pass) {return pass == 1;}
|
||||
void unbind()
|
||||
{
|
||||
gPostColorFilterProgram.unbind();
|
||||
}
|
||||
};
|
||||
|
||||
class LLNightVisionShader : public LLPostProcessShader
|
||||
{
|
||||
private:
|
||||
LLShaderSetting<bool> mEnabled;
|
||||
LLShaderSetting<F32> mBrightnessMult, mNoiseStrength;
|
||||
public:
|
||||
LLNightVisionShader() :
|
||||
mEnabled("enable_night_vision",false),
|
||||
mBrightnessMult("brightness_multiplier",3.f),
|
||||
mNoiseStrength("noise_strength",.4f)
|
||||
{
|
||||
mSettings.push_back(&mEnabled);
|
||||
mSettings.push_back(&mBrightnessMult);
|
||||
mSettings.push_back(&mNoiseStrength);
|
||||
}
|
||||
bool isEnabled() { return mEnabled && gPostNightVisionProgram.mProgramObject; }
|
||||
S32 getColorChannel() { return 0; }
|
||||
S32 getDepthChannel() { return -1; }
|
||||
QuadType bind()
|
||||
{
|
||||
if(!isEnabled())
|
||||
return QUAD_NONE;
|
||||
|
||||
gPostNightVisionProgram.bind();
|
||||
|
||||
LLPostProcess::getInstance()->bindNoise(1);
|
||||
|
||||
gPostNightVisionProgram.uniform1f("brightMult", mBrightnessMult);
|
||||
gPostNightVisionProgram.uniform1f("noiseStrength", mNoiseStrength);
|
||||
|
||||
return QUAD_NOISE;
|
||||
|
||||
}
|
||||
bool draw(U32 pass) {return pass == 1;}
|
||||
void unbind()
|
||||
{
|
||||
gPostNightVisionProgram.unbind();
|
||||
}
|
||||
};
|
||||
|
||||
class LLGaussBlurShader : public LLPostProcessShader
|
||||
{
|
||||
private:
|
||||
LLShaderSetting<bool> mEnabled;
|
||||
LLShaderSetting<S32> mNumPasses;
|
||||
GLint mPassLoc;
|
||||
public:
|
||||
LLGaussBlurShader() :
|
||||
mEnabled("enable_gauss_blur",false),
|
||||
mNumPasses("gauss_blur_passes",2),
|
||||
mPassLoc(0)
|
||||
{
|
||||
mSettings.push_back(&mEnabled);
|
||||
mSettings.push_back(&mNumPasses);
|
||||
}
|
||||
bool isEnabled() { return mEnabled && mNumPasses && gPostGaussianBlurProgram.mProgramObject; }
|
||||
S32 getColorChannel() { return 0; }
|
||||
S32 getDepthChannel() { return -1; }
|
||||
QuadType bind()
|
||||
{
|
||||
if(!isEnabled())
|
||||
return QUAD_NONE;
|
||||
|
||||
gPostGaussianBlurProgram.bind();
|
||||
|
||||
mPassLoc = gPostGaussianBlurProgram.getUniformLocation("horizontalPass");
|
||||
|
||||
return QUAD_NORMAL;
|
||||
}
|
||||
bool draw(U32 pass)
|
||||
{
|
||||
if((S32)pass > mNumPasses*2)
|
||||
return false;
|
||||
glUniform1iARB(mPassLoc, (pass-1) % 2);
|
||||
return true;
|
||||
}
|
||||
void unbind()
|
||||
{
|
||||
gPostGaussianBlurProgram.unbind();
|
||||
}
|
||||
};
|
||||
|
||||
class LLPosterizeShader : public LLPostProcessShader
|
||||
{
|
||||
private:
|
||||
LLShaderSetting<bool> mEnabled;
|
||||
LLShaderSetting<S32> mNumLayers;
|
||||
public:
|
||||
LLPosterizeShader() :
|
||||
mEnabled("enable_posterize",false),
|
||||
mNumLayers("posterize_layers",2)
|
||||
{
|
||||
mSettings.push_back(&mEnabled);
|
||||
mSettings.push_back(&mNumLayers);
|
||||
}
|
||||
bool isEnabled() { return mEnabled && gPostPosterizeProgram.mProgramObject; }
|
||||
S32 getColorChannel() { return 0; }
|
||||
S32 getDepthChannel() { return -1; }
|
||||
QuadType bind()
|
||||
{
|
||||
if(!isEnabled())
|
||||
return QUAD_NONE;
|
||||
|
||||
gPostPosterizeProgram.bind();
|
||||
|
||||
gPostPosterizeProgram.uniform1i("layerCount", mNumLayers);
|
||||
|
||||
return QUAD_NORMAL;
|
||||
}
|
||||
bool draw(U32 pass)
|
||||
{
|
||||
return pass == 1;
|
||||
}
|
||||
void unbind()
|
||||
{
|
||||
gPostPosterizeProgram.unbind();
|
||||
}
|
||||
};
|
||||
|
||||
LLPostProcess::LLPostProcess(void) :
|
||||
mVBO(NULL),
|
||||
mDepthTexture(0),
|
||||
mNoiseTexture(NULL),
|
||||
mScreenWidth(0),
|
||||
mScreenHeight(0),
|
||||
mNoiseTextureScale(0.f),
|
||||
mSelectedEffectInfo(LLSD::emptyMap()),
|
||||
mAllEffectInfo(LLSD::emptyMap())
|
||||
{
|
||||
mShaders.push_back(new LLColorFilterShader());
|
||||
mShaders.push_back(new LLNightVisionShader());
|
||||
mShaders.push_back(new LLGaussBlurShader());
|
||||
mShaders.push_back(new LLPosterizeShader());
|
||||
|
||||
/* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender.*/
|
||||
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME));
|
||||
LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL;
|
||||
@@ -71,99 +284,43 @@ LLPostProcess::LLPostProcess(void) :
|
||||
{
|
||||
LLPointer<LLSDParser> parser = new LLSDXMLParser();
|
||||
|
||||
parser->parse(effectsXML, mAllEffects, LLSDSerialize::SIZE_UNLIMITED);
|
||||
parser->parse(effectsXML, mAllEffectInfo, LLSDSerialize::SIZE_UNLIMITED);
|
||||
}
|
||||
|
||||
if (!mAllEffects.has("default"))
|
||||
if (!mAllEffectInfo.has("default"))
|
||||
mAllEffectInfo["default"] = LLSD::emptyMap();
|
||||
|
||||
LLSD& defaults = mAllEffectInfo["default"];
|
||||
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
LLSD & defaultEffect = (mAllEffects["default"] = LLSD::emptyMap());
|
||||
|
||||
/*defaultEffect["enable_night_vision"] = LLSD::Boolean(false);
|
||||
defaultEffect["enable_color_filter"] = LLSD::Boolean(false);*/
|
||||
|
||||
/// NVG Defaults
|
||||
defaultEffect["brightness_multiplier"] = 3.0;
|
||||
defaultEffect["noise_size"] = 25.0;
|
||||
defaultEffect["noise_strength"] = 0.4;
|
||||
|
||||
// TODO BTest potentially add this to tweaks?
|
||||
mNoiseTextureScale = 1.0f;
|
||||
|
||||
/// Color Filter Defaults
|
||||
defaultEffect["gamma"] = 1.0;
|
||||
defaultEffect["brightness"] = 1.0;
|
||||
defaultEffect["contrast"] = 1.0;
|
||||
defaultEffect["saturation"] = 1.0;
|
||||
|
||||
LLSD& contrastBase = (defaultEffect["contrast_base"] = LLSD::emptyArray());
|
||||
contrastBase.append(1.0);
|
||||
contrastBase.append(1.0);
|
||||
contrastBase.append(1.0);
|
||||
contrastBase.append(0.5);
|
||||
|
||||
defaultEffect["gauss_blur_passes"] = 2;
|
||||
LLSD shader_defaults = (*it)->getDefaults();
|
||||
for (LLSD::map_const_iterator it2 = defaults.beginMap();it2 != defaults.endMap();++it2)
|
||||
{
|
||||
if(!defaults.has(it2->first))
|
||||
defaults[it2->first]=it2->second;
|
||||
}
|
||||
}
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
(*it)->loadSettings(defaults);
|
||||
}
|
||||
|
||||
setSelectedEffect("default");
|
||||
// */
|
||||
}
|
||||
|
||||
LLPostProcess::~LLPostProcess(void)
|
||||
{
|
||||
invalidate() ;
|
||||
}
|
||||
|
||||
/*static*/void LLPostProcess::cleanupClass()
|
||||
{
|
||||
if(instanceExists())
|
||||
getInstance()->invalidate() ;
|
||||
}
|
||||
|
||||
void LLPostProcess::setSelectedEffect(std::string const & effectName)
|
||||
{
|
||||
mSelectedEffectName = effectName;
|
||||
static_cast<LLSD &>(tweaks) = mAllEffects[effectName];
|
||||
}
|
||||
|
||||
void LLPostProcess::saveEffect(std::string const & effectName)
|
||||
{
|
||||
mAllEffects[effectName] = tweaks;
|
||||
|
||||
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME));
|
||||
//llinfos << "Saving PostProcess Effects settings to " << pathName << llendl;
|
||||
|
||||
llofstream effectsXML(pathName);
|
||||
|
||||
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
|
||||
|
||||
formatter->format(mAllEffects, effectsXML);
|
||||
}
|
||||
void LLPostProcess::invalidate()
|
||||
{
|
||||
mSceneRenderTexture = NULL ;
|
||||
mNoiseTexture = NULL ;
|
||||
mVBO = NULL ;
|
||||
}
|
||||
|
||||
void LLPostProcess::apply(unsigned int width, unsigned int height)
|
||||
{
|
||||
if(shadersEnabled())
|
||||
{
|
||||
if (mVBO.isNull() || width != mScreenWidth || height != mScreenHeight)
|
||||
{
|
||||
initialize(width, height);
|
||||
}
|
||||
doEffects();
|
||||
}
|
||||
destroyGL() ;
|
||||
}
|
||||
|
||||
void LLPostProcess::initialize(unsigned int width, unsigned int height)
|
||||
{
|
||||
invalidate();
|
||||
destroyGL();
|
||||
mScreenWidth = width;
|
||||
mScreenHeight = height;
|
||||
|
||||
createScreenTexture();
|
||||
createScreenTextures();
|
||||
createNoiseTexture();
|
||||
|
||||
//Setup our VBO.
|
||||
{
|
||||
@@ -185,127 +342,129 @@ void LLPostProcess::initialize(unsigned int width, unsigned int height)
|
||||
|
||||
mVBO->flush();
|
||||
}
|
||||
|
||||
checkError();
|
||||
createNoiseTexture();
|
||||
checkError();
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
inline bool LLPostProcess::shadersEnabled(void)
|
||||
void LLPostProcess::createScreenTextures()
|
||||
{
|
||||
return (tweaks.useColorFilter().asBoolean() ||
|
||||
tweaks.useNightVisionShader().asBoolean() ||
|
||||
tweaks.useGaussBlurFilter().asBoolean() );
|
||||
}
|
||||
const LLTexUnit::eTextureType type = LLTexUnit::TT_RECT_TEXTURE;
|
||||
|
||||
void LLPostProcess::applyShaders(void)
|
||||
{
|
||||
bool copy_buffer = false;
|
||||
if (tweaks.useColorFilter())
|
||||
mRenderTarget[0].allocate(mScreenWidth,mScreenHeight,GL_RGBA,FALSE,FALSE,type,FALSE);
|
||||
if(mRenderTarget[0].getFBO())//Only need pingpong between two rendertargets if FBOs are supported.
|
||||
mRenderTarget[1].allocate(mScreenWidth,mScreenHeight,GL_RGBA,FALSE,FALSE,type,FALSE);
|
||||
stop_glerror();
|
||||
|
||||
if(mDepthTexture)
|
||||
LLImageGL::deleteTextures(type, 0, 0, 1, &mDepthTexture, true);
|
||||
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
applyColorFilterShader();
|
||||
checkError();
|
||||
copy_buffer = true;
|
||||
}
|
||||
if (tweaks.useGaussBlurFilter())
|
||||
{
|
||||
/// If any of the above shaders have been called update the frame buffer;
|
||||
if (copy_buffer)
|
||||
copyFrameBuffer();
|
||||
applyGaussBlurShader();
|
||||
checkError();
|
||||
copy_buffer = true;
|
||||
}
|
||||
if (tweaks.useNightVisionShader())
|
||||
{
|
||||
/// If any of the above shaders have been called update the frame buffer;
|
||||
if (copy_buffer)
|
||||
copyFrameBuffer();
|
||||
applyNightVisionShader();
|
||||
checkError();
|
||||
copy_buffer = true;
|
||||
}
|
||||
}
|
||||
|
||||
void LLPostProcess::applyColorFilterShader(void)
|
||||
{
|
||||
if(gPostColorFilterProgram.mProgramObject == 0)
|
||||
return;
|
||||
|
||||
gPostColorFilterProgram.bind();
|
||||
|
||||
gGL.getTexUnit(0)->bind(mSceneRenderTexture);
|
||||
|
||||
gPostColorFilterProgram.uniform1f("gamma", tweaks.getGamma());
|
||||
gPostColorFilterProgram.uniform1f("brightness", tweaks.getBrightness());
|
||||
gPostColorFilterProgram.uniform1f("contrast", tweaks.getContrast());
|
||||
float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f;
|
||||
baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI);
|
||||
float baseR = tweaks.getContrastBaseR() * baseI;
|
||||
float baseG = tweaks.getContrastBaseG() * baseI;
|
||||
float baseB = tweaks.getContrastBaseB() * baseI;
|
||||
gPostColorFilterProgram.uniform3fv("contrastBase", 1, LLVector3(baseR, baseG, baseB).mV);
|
||||
gPostColorFilterProgram.uniform1f("saturation", tweaks.getSaturation());
|
||||
gPostColorFilterProgram.uniform3fv("lumWeights", 1, LLVector3(LUMINANCE_R, LUMINANCE_G, LUMINANCE_B).mV);
|
||||
|
||||
/// Draw a screen space quad
|
||||
drawOrthoQuad(QUAD_NORMAL);
|
||||
gPostColorFilterProgram.unbind();
|
||||
}
|
||||
|
||||
void LLPostProcess::applyNightVisionShader(void)
|
||||
{
|
||||
if(gPostNightVisionProgram.mProgramObject == 0)
|
||||
return;
|
||||
|
||||
gPostNightVisionProgram.bind();
|
||||
|
||||
gGL.getTexUnit(0)->bind(mSceneRenderTexture);
|
||||
gGL.getTexUnit(1)->bind(mNoiseTexture);
|
||||
|
||||
gPostNightVisionProgram.uniform1f("brightMult", tweaks.getBrightMult());
|
||||
gPostNightVisionProgram.uniform1f("noiseStrength", tweaks.getNoiseStrength());
|
||||
mNoiseTextureScale = 0.001f + ((100.f - tweaks.getNoiseSize()) / 100.f);
|
||||
mNoiseTextureScale *= (mScreenHeight / NOISE_SIZE);
|
||||
|
||||
/// Draw a screen space quad
|
||||
drawOrthoQuad(QUAD_NOISE);
|
||||
gPostNightVisionProgram.unbind();
|
||||
}
|
||||
|
||||
void LLPostProcess::applyGaussBlurShader(void)
|
||||
{
|
||||
int pass_count = tweaks.getGaussBlurPasses();
|
||||
if(!pass_count || gPostGaussianBlurProgram.mProgramObject == 0)
|
||||
return;
|
||||
|
||||
gPostGaussianBlurProgram.bind();
|
||||
|
||||
gGL.getTexUnit(0)->bind(mSceneRenderTexture);
|
||||
|
||||
GLint horiz_pass = gPostGaussianBlurProgram.getUniformLocation("horizontalPass");
|
||||
for(int i = 0;i<pass_count;++i)
|
||||
{
|
||||
for(int j = 0;j<2;++j)
|
||||
if((*it)->getDepthChannel()>=0)
|
||||
{
|
||||
if(i || j)
|
||||
copyFrameBuffer();
|
||||
glUniform1iARB(horiz_pass, j);
|
||||
drawOrthoQuad(QUAD_NORMAL);
|
||||
LLImageGL::generateTextures(type, GL_DEPTH_COMPONENT24, 1, &mDepthTexture);
|
||||
gGL.getTexUnit(0)->bindManual(type, mDepthTexture);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(type), 0, GL_DEPTH_COMPONENT24, mScreenWidth, mScreenHeight, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false);
|
||||
stop_glerror();
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
stop_glerror();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPostProcess::createNoiseTexture()
|
||||
{
|
||||
std::vector<GLubyte> buffer(NOISE_SIZE * NOISE_SIZE);
|
||||
for (unsigned int i = 0; i < NOISE_SIZE; i++){
|
||||
for (unsigned int k = 0; k < NOISE_SIZE; k++){
|
||||
buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f);
|
||||
}
|
||||
}
|
||||
|
||||
mNoiseTexture = new LLImageGL(FALSE) ;
|
||||
if(mNoiseTexture->createGLTexture())
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseTexture->getTexName());
|
||||
LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]);
|
||||
stop_glerror();
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
||||
void LLPostProcess::destroyGL()
|
||||
{
|
||||
mRenderTarget[0].release();
|
||||
mRenderTarget[1].release();
|
||||
if(mDepthTexture)
|
||||
LLImageGL::deleteTextures(LLTexUnit::TT_RECT_TEXTURE, 0, 0, 1, &mDepthTexture, true);
|
||||
mDepthTexture=0;
|
||||
mNoiseTexture = NULL ;
|
||||
mVBO = NULL ;
|
||||
}
|
||||
|
||||
/*static*/void LLPostProcess::cleanupClass()
|
||||
{
|
||||
if(instanceExists())
|
||||
getInstance()->destroyGL() ;
|
||||
}
|
||||
|
||||
void LLPostProcess::copyFrameBuffer()
|
||||
{
|
||||
mRenderTarget[!!mRenderTarget[0].getFBO()].bindTexture(0,0);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
||||
|
||||
if(mDepthTexture)
|
||||
{
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
if((*it)->isEnabled() && (*it)->getDepthChannel()>=0)
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LLPostProcess::bindNoise(U32 channel)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bind(mNoiseTexture);
|
||||
}
|
||||
|
||||
void LLPostProcess::renderEffects(unsigned int width, unsigned int height)
|
||||
{
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
if((*it)->isEnabled())
|
||||
{
|
||||
if (mVBO.isNull() || width != mScreenWidth || height != mScreenHeight)
|
||||
{
|
||||
initialize(width, height);
|
||||
}
|
||||
doEffects();
|
||||
return;
|
||||
}
|
||||
}
|
||||
gPostGaussianBlurProgram.unbind();
|
||||
}
|
||||
|
||||
void LLPostProcess::doEffects(void)
|
||||
{
|
||||
LLVertexBuffer::unbind();
|
||||
|
||||
mNoiseTextureScale = 0.001f + ((100.f - mSelectedEffectInfo["noise_size"].asFloat()) / 100.f);
|
||||
mNoiseTextureScale *= (mScreenHeight / NOISE_SIZE);
|
||||
|
||||
/// Copy the screen buffer to the render texture
|
||||
copyFrameBuffer();
|
||||
stop_glerror();
|
||||
|
||||
//Disable depth. Set blendmode to replace.
|
||||
LLGLDepthTest depth(GL_FALSE);
|
||||
LLGLDepthTest depth(GL_FALSE,GL_FALSE);
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||
|
||||
@@ -319,7 +478,6 @@ void LLPostProcess::doEffects(void)
|
||||
gGL.loadIdentity();
|
||||
|
||||
applyShaders();
|
||||
checkError();
|
||||
|
||||
LLGLSLShader::bindNoShader();
|
||||
|
||||
@@ -333,13 +491,46 @@ void LLPostProcess::doEffects(void)
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA); //Restore blendstate. Alpha is ASSUMED for hud/ui render, etc.
|
||||
|
||||
gGL.getTexUnit(1)->disable();
|
||||
checkError();
|
||||
}
|
||||
|
||||
void LLPostProcess::copyFrameBuffer()
|
||||
void LLPostProcess::applyShaders(void)
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(mSceneRenderTexture->getTarget(), mSceneRenderTexture->getTexName());
|
||||
glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, mScreenWidth, mScreenHeight, 0);
|
||||
QuadType quad;
|
||||
bool primary_rendertarget = 1;
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
if((quad = (*it)->bind()) != QUAD_NONE)
|
||||
{
|
||||
S32 color_channel = (*it)->getColorChannel();
|
||||
S32 depth_channel = (*it)->getDepthChannel();
|
||||
|
||||
if(depth_channel >= 0)
|
||||
gGL.getTexUnit(depth_channel)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture);
|
||||
|
||||
U32 pass = 1;
|
||||
|
||||
while((*it)->draw(pass++))
|
||||
{
|
||||
mRenderTarget[!primary_rendertarget].bindTarget();
|
||||
|
||||
if(color_channel >= 0)
|
||||
mRenderTarget[mRenderTarget[0].getFBO() ? primary_rendertarget : !primary_rendertarget].bindTexture(0,color_channel);
|
||||
|
||||
drawOrthoQuad(quad);
|
||||
mRenderTarget[!primary_rendertarget].flush();
|
||||
if(mRenderTarget[0].getFBO())
|
||||
primary_rendertarget = !primary_rendertarget;
|
||||
}
|
||||
(*it)->unbind();
|
||||
}
|
||||
}
|
||||
//Only need to copy to framebuffer if FBOs are supported, else we've already been drawing to the framebuffer to begin with.
|
||||
if(mRenderTarget[0].getFBO())
|
||||
{
|
||||
//copyContentsToFramebuffer also binds the main framebuffer.
|
||||
LLRenderTarget::copyContentsToFramebuffer(mRenderTarget[primary_rendertarget],0,0,mScreenWidth,mScreenHeight,0,0,mScreenWidth,mScreenHeight,GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
void LLPostProcess::drawOrthoQuad(QuadType type)
|
||||
@@ -364,64 +555,59 @@ void LLPostProcess::drawOrthoQuad(QuadType type)
|
||||
mVBO->drawArrays(LLRender::TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
void LLPostProcess::createScreenTexture()
|
||||
void LLPostProcess::setSelectedEffect(std::string const & effectName)
|
||||
{
|
||||
std::vector<GLubyte> data(mScreenWidth * mScreenHeight * 3, 0) ;
|
||||
|
||||
mSceneRenderTexture = new LLImageGL(FALSE) ;
|
||||
if(mSceneRenderTexture->createGLTexture())
|
||||
mSelectedEffectName = effectName;
|
||||
mSelectedEffectInfo = mAllEffectInfo[effectName];
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mSceneRenderTexture->getTexName());
|
||||
LLImageGL::setManualImage(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, mScreenWidth, mScreenHeight, GL_RGB, GL_UNSIGNED_BYTE, &data[0]);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
(*it)->loadSettings(mSelectedEffectInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPostProcess::createNoiseTexture()
|
||||
{
|
||||
std::vector<GLubyte> buffer(NOISE_SIZE * NOISE_SIZE);
|
||||
for (unsigned int i = 0; i < NOISE_SIZE; i++){
|
||||
for (unsigned int k = 0; k < NOISE_SIZE; k++){
|
||||
buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f);
|
||||
}
|
||||
}
|
||||
|
||||
mNoiseTexture = new LLImageGL(FALSE) ;
|
||||
if(mNoiseTexture->createGLTexture())
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseTexture->getTexName());
|
||||
LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
|
||||
}
|
||||
}
|
||||
|
||||
bool LLPostProcess::checkError(void)
|
||||
void LLPostProcess::setSelectedEffectValue(std::string const & setting, LLSD value)
|
||||
{
|
||||
GLenum glErr;
|
||||
bool retCode = false;
|
||||
|
||||
glErr = glGetError();
|
||||
while (glErr != GL_NO_ERROR)
|
||||
{
|
||||
// shaderErrorLog << (const char *) gluErrorString(glErr) << std::endl;
|
||||
char const * err_str_raw = (const char *) gluErrorString(glErr);
|
||||
|
||||
if(err_str_raw == NULL)
|
||||
{
|
||||
std::ostringstream err_builder;
|
||||
err_builder << "unknown error number " << glErr;
|
||||
mShaderErrorString = err_builder.str();
|
||||
}
|
||||
else
|
||||
{
|
||||
mShaderErrorString = err_str_raw;
|
||||
}
|
||||
|
||||
retCode = true;
|
||||
glErr = glGetError();
|
||||
}
|
||||
return retCode;
|
||||
char buf[256];
|
||||
S32 elem=0;
|
||||
if(sscanf(setting.c_str(),"%255[^[][%d]", buf, &elem) == 2)
|
||||
{
|
||||
mSelectedEffectInfo[static_cast<const char*>(buf)][elem] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
mSelectedEffectInfo[setting] = value;
|
||||
}
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
(*it)->loadSettings(mSelectedEffectInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPostProcess::resetSelectedEffect()
|
||||
{
|
||||
if(!llsd_equals(mAllEffectInfo[mSelectedEffectName], mSelectedEffectInfo))
|
||||
{
|
||||
mSelectedEffectInfo = mAllEffectInfo[mSelectedEffectName];
|
||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||
{
|
||||
(*it)->loadSettings(mSelectedEffectInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPostProcess::saveEffectAs(std::string const & effectName)
|
||||
{
|
||||
mAllEffectInfo[effectName] = mSelectedEffectInfo;
|
||||
|
||||
std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME));
|
||||
//llinfos << "Saving PostProcess Effects settings to " << pathName << llendl;
|
||||
|
||||
llofstream effectsXML(pathName);
|
||||
|
||||
LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
|
||||
|
||||
formatter->format(mAllEffectInfo, effectsXML);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,189 +34,123 @@
|
||||
#define LL_POSTPROCESS_H
|
||||
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include "llgl.h"
|
||||
#include "llglheaders.h"
|
||||
#include "llsd.h"
|
||||
#include "llrendertarget.h"
|
||||
|
||||
class LLSD;
|
||||
|
||||
typedef enum _QuadType {
|
||||
QUAD_NONE,
|
||||
QUAD_NORMAL,
|
||||
QUAD_NOISE
|
||||
} QuadType;
|
||||
|
||||
//LLPostProcessShader is an attempt to encapsulate the shaders a little better.
|
||||
class LLPostProcessShader : public LLRefCount //Abstract. PostProcess shaders derive off of this common base.
|
||||
{
|
||||
protected:
|
||||
//LLShaderSetting is used to associate key names to member variables to avoid LLSD lookups when drawing.
|
||||
//It also facilitates automating the assigning of defaults to, as well as parsing from, the effects LLSD list.
|
||||
//This replaces the entire old PostProcessTweaks structure. More will be done in the future to move into a more
|
||||
//xml-driven configuration.
|
||||
struct LLShaderSettingBase
|
||||
{
|
||||
LLShaderSettingBase(const char* name) : mSettingName(name) {}
|
||||
const char* mSettingName; //LLSD key names as found in postprocesseffects.xml. eg 'contrast_base'
|
||||
virtual LLSD getDefaultValue() = 0; //Converts the member variable as an LLSD. Used to set defaults absent in postprocesseffects.xml
|
||||
virtual void setValue(const LLSD& value) = 0; //Connects the LLSD element to the member variable. Used when loading effects (such as default)
|
||||
};
|
||||
template<typename T>
|
||||
struct LLShaderSetting : public LLShaderSettingBase
|
||||
{
|
||||
LLShaderSetting(const char* setting_name, T def) : LLShaderSettingBase(setting_name), mValue(def), mDefault(def) {}
|
||||
T mValue; //The member variable mentioned above.
|
||||
T mDefault; //Set via ctor. Value is inserted into the defaults LLSD list if absent from postprocesseffects.xml
|
||||
LLSD getDefaultValue() { return mDefault; } //See LLShaderSettingBase::getDefaultValue
|
||||
void setValue(const LLSD& value) { mValue = value; } //See LLShaderSettingBase::setValue
|
||||
operator T() { return mValue; } //Typecast operator overload so this object can be handled as if it was whatever T represents.
|
||||
};
|
||||
std::vector<LLShaderSettingBase*> mSettings; //Contains a list of all the 'settings' this shader uses. Manually add via push_back in ctor.
|
||||
public:
|
||||
virtual ~LLPostProcessShader() {};
|
||||
virtual bool isEnabled() = 0; //Returning false avoids bind/draw/unbind calls. If no shaders are enabled, framebuffer copying is skipped.
|
||||
virtual S32 getColorChannel() = 0; //If color buffer is used in this shader returns > -1 to cue LLPostProcess on copying it from the framebuffer.
|
||||
virtual S32 getDepthChannel() = 0; //If depth buffer is used in this shader returns > -1 to cue LLPostProcess on copying it from the framebuffer.
|
||||
virtual QuadType bind() = 0; //Bind shader and textures, set up attribs. Returns the 'type' of quad to be drawn.
|
||||
virtual bool draw(U32 pass) = 0; //returning false means finished. Used to update per-pass attributes and such. LLPostProcess will call
|
||||
//drawOrthoQuad when this returns true, increment pass, then call this again, and keep repeating this until false is returned.
|
||||
virtual void unbind() = 0; //Unbind shader and textures.
|
||||
|
||||
LLSD getDefaults(); //Returns a full LLSD kvp list filled with default values.
|
||||
void loadSettings(const LLSD& settings); //Parses the effects LLSD list and sets the member variables linked to them (via LLShaderSetting::setValue())
|
||||
};
|
||||
|
||||
//LLVector4 does not implicitly convert to and from LLSD, so template specilizations are necessary.
|
||||
template<> LLSD LLPostProcessShader::LLShaderSetting<LLVector4>::getDefaultValue();
|
||||
template<> void LLPostProcessShader::LLShaderSetting<LLVector4>::setValue(const LLSD& value);
|
||||
|
||||
class LLPostProcess : public LLSingleton<LLPostProcess>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef enum _QuadType {
|
||||
QUAD_NORMAL,
|
||||
QUAD_NOISE
|
||||
} QuadType;
|
||||
|
||||
/// GLSL Shader Encapsulation Struct
|
||||
//typedef std::map<const char *, GLuint> glslUniforms;
|
||||
|
||||
struct PostProcessTweaks : public LLSD {
|
||||
inline PostProcessTweaks() : LLSD(LLSD::emptyMap())
|
||||
{
|
||||
}
|
||||
|
||||
inline LLSD & brightMult() {
|
||||
return (*this)["brightness_multiplier"];
|
||||
}
|
||||
|
||||
inline LLSD & noiseStrength() {
|
||||
return (*this)["noise_strength"];
|
||||
}
|
||||
|
||||
inline LLSD & noiseSize() {
|
||||
return (*this)["noise_size"];
|
||||
}
|
||||
|
||||
inline LLSD & brightness() {
|
||||
return (*this)["brightness"];
|
||||
}
|
||||
|
||||
inline LLSD & contrast() {
|
||||
return (*this)["contrast"];
|
||||
}
|
||||
|
||||
inline LLSD & contrastBaseR() {
|
||||
return (*this)["contrast_base"][0];
|
||||
}
|
||||
|
||||
inline LLSD & contrastBaseG() {
|
||||
return (*this)["contrast_base"][1];
|
||||
}
|
||||
|
||||
inline LLSD & contrastBaseB() {
|
||||
return (*this)["contrast_base"][2];
|
||||
}
|
||||
|
||||
inline LLSD & contrastBaseIntensity() {
|
||||
return (*this)["contrast_base"][3];
|
||||
}
|
||||
|
||||
inline LLSD & saturation() {
|
||||
return (*this)["saturation"];
|
||||
}
|
||||
|
||||
inline LLSD & useNightVisionShader() {
|
||||
return (*this)["enable_night_vision"];
|
||||
}
|
||||
|
||||
inline LLSD & useColorFilter() {
|
||||
return (*this)["enable_color_filter"];
|
||||
}
|
||||
|
||||
inline LLSD & useGaussBlurFilter() {
|
||||
return (*this)["enable_gauss_blur"];
|
||||
}
|
||||
|
||||
inline F32 getBrightMult() const {
|
||||
return F32((*this)["brightness_multiplier"].asReal());
|
||||
}
|
||||
|
||||
inline F32 getNoiseStrength() const {
|
||||
return F32((*this)["noise_strength"].asReal());
|
||||
}
|
||||
|
||||
inline F32 getNoiseSize() const {
|
||||
return F32((*this)["noise_size"].asReal());
|
||||
}
|
||||
|
||||
inline F32 getGamma() const {
|
||||
return F32((*this)["gamma"].asReal());
|
||||
}
|
||||
|
||||
inline F32 getBrightness() const {
|
||||
return F32((*this)["brightness"].asReal());
|
||||
}
|
||||
|
||||
inline F32 getContrast() const {
|
||||
return F32((*this)["contrast"].asReal());
|
||||
}
|
||||
|
||||
inline F32 getContrastBaseR() const {
|
||||
return F32((*this)["contrast_base"][0].asReal());
|
||||
}
|
||||
|
||||
inline F32 getContrastBaseG() const {
|
||||
return F32((*this)["contrast_base"][1].asReal());
|
||||
}
|
||||
|
||||
inline F32 getContrastBaseB() const {
|
||||
return F32((*this)["contrast_base"][2].asReal());
|
||||
}
|
||||
|
||||
inline F32 getContrastBaseIntensity() const {
|
||||
return F32((*this)["contrast_base"][3].asReal());
|
||||
}
|
||||
|
||||
inline F32 getSaturation() const {
|
||||
return F32((*this)["saturation"].asReal());
|
||||
}
|
||||
|
||||
inline LLSD & getGaussBlurPasses() {
|
||||
return (*this)["gauss_blur_passes"];
|
||||
}
|
||||
};
|
||||
|
||||
PostProcessTweaks tweaks;
|
||||
|
||||
// the map of all availible effects
|
||||
LLSD mAllEffects;
|
||||
|
||||
private:
|
||||
std::list<LLPointer<LLPostProcessShader> > mShaders; //List of all registered LLPostProcessShader instances.
|
||||
|
||||
LLPointer<LLVertexBuffer> mVBO;
|
||||
LLPointer<LLImageGL> mSceneRenderTexture ;
|
||||
U32 mNextDrawTarget; //Need to pingpong between two rendertargets. Cannot sample target texture of currently bound FBO.
|
||||
// However this is ONLY the case if fbos are actually supported, else swapping isn't needed.
|
||||
LLRenderTarget mRenderTarget[2];
|
||||
U32 mDepthTexture;
|
||||
LLPointer<LLImageGL> mNoiseTexture ;
|
||||
|
||||
U32 mScreenWidth;
|
||||
U32 mScreenHeight;
|
||||
F32 mNoiseTextureScale;
|
||||
|
||||
// The name of currently selected effect in mAllEffectInfo
|
||||
std::string mSelectedEffectName;
|
||||
// The map of settings for currently selected effect.
|
||||
LLSD mSelectedEffectInfo;
|
||||
// The map of all availible effects
|
||||
LLSD mAllEffectInfo;
|
||||
|
||||
public:
|
||||
LLPostProcess(void);
|
||||
|
||||
~LLPostProcess(void);
|
||||
private:
|
||||
// OpenGL initialization
|
||||
void initialize(unsigned int width, unsigned int height); //Sets mScreenWidth and mScreenHeight
|
||||
// calls createScreenTextures and createNoiseTexture
|
||||
// creates VBO
|
||||
void createScreenTextures(); //Creates color texture and depth texture(if needed).
|
||||
void createNoiseTexture(); //Creates 'random' noise texture.
|
||||
|
||||
void apply(unsigned int width, unsigned int height);
|
||||
void invalidate() ;
|
||||
|
||||
// Cleanup of global data that's only inited once per class.
|
||||
public:
|
||||
// Teardown
|
||||
// Called on destroyGL or cleanupClass. Releases VBOs, rendertargets and textures.
|
||||
void destroyGL();
|
||||
// Cleanup of global data that's only inited once per class.
|
||||
static void cleanupClass();
|
||||
|
||||
void setSelectedEffect(std::string const & effectName);
|
||||
|
||||
inline std::string const & getSelectedEffect(void) const {
|
||||
return mSelectedEffectName;
|
||||
}
|
||||
|
||||
void saveEffect(std::string const & effectName);
|
||||
|
||||
private:
|
||||
/// read in from file
|
||||
std::string mShaderErrorString;
|
||||
unsigned int mScreenWidth;
|
||||
unsigned int mScreenHeight;
|
||||
|
||||
float mNoiseTextureScale;
|
||||
|
||||
// the name of currently selected effect in mAllEffects
|
||||
// invariant: tweaks == mAllEffects[mSelectedEffectName]
|
||||
std::string mSelectedEffectName;
|
||||
|
||||
/// General functions
|
||||
void initialize(unsigned int width, unsigned int height);
|
||||
void doEffects(void);
|
||||
void applyShaders(void);
|
||||
bool shadersEnabled(void);
|
||||
|
||||
/// Night Vision Functions
|
||||
void applyNightVisionShader(void);
|
||||
|
||||
/// Color Filter Functions
|
||||
void applyColorFilterShader(void);
|
||||
|
||||
/// Gaussian blur Filter Functions
|
||||
void applyGaussBlurShader(void);
|
||||
|
||||
/// OpenGL Helper Functions
|
||||
// Setup for draw.
|
||||
void copyFrameBuffer();
|
||||
void createScreenTexture();
|
||||
void createNoiseTexture();
|
||||
bool checkError(void);
|
||||
void drawOrthoQuad(QuadType type);
|
||||
void bindNoise(U32 channel);
|
||||
|
||||
// Draw
|
||||
void renderEffects(unsigned int width, unsigned int height); //Entry point for newview.
|
||||
private:
|
||||
void doEffects(void); //Sets up viewmatrix, blits the framebuffer, then calls applyShaders.
|
||||
void applyShaders(void); //Iterates over all active post shaders, manages binding, calls drawOrthoQuad for render.
|
||||
void drawOrthoQuad(QuadType type); //Finally draws fullscreen quad with the shader currently bound.
|
||||
|
||||
public:
|
||||
// UI interaction
|
||||
// Getters
|
||||
inline LLSD const & getAllEffectInfo(void) const { return mAllEffectInfo; }
|
||||
inline std::string const & getSelectedEffectName(void) const { return mSelectedEffectName; }
|
||||
inline LLSD const & getSelectedEffectInfo(void) const { return mSelectedEffectInfo; }
|
||||
// Setters
|
||||
void setSelectedEffect(std::string const & effectName);
|
||||
void setSelectedEffectValue(std::string const & setting, LLSD value);
|
||||
void resetSelectedEffect();
|
||||
void saveEffectAs(std::string const & effectName);
|
||||
};
|
||||
#endif // LL_POSTPROCESS_H
|
||||
|
||||
@@ -1480,9 +1480,8 @@ void LLRender::translateUI(F32 x, F32 y, F32 z)
|
||||
llerrs << "Need to push a UI translation frame before offsetting" << llendl;
|
||||
}
|
||||
|
||||
mUIOffset.back().mV[0] += x;
|
||||
mUIOffset.back().mV[1] += y;
|
||||
mUIOffset.back().mV[2] += z;
|
||||
LLVector4a add(x,y,x);
|
||||
mUIOffset.back()->add(add);
|
||||
}
|
||||
|
||||
void LLRender::scaleUI(F32 x, F32 y, F32 z)
|
||||
@@ -1492,27 +1491,28 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z)
|
||||
llerrs << "Need to push a UI transformation frame before scaling." << llendl;
|
||||
}
|
||||
|
||||
mUIScale.back().scaleVec(LLVector3(x,y,z));
|
||||
LLVector4a scale(x,y,z);
|
||||
mUIScale.back()->mul(scale);
|
||||
}
|
||||
|
||||
void LLRender::pushUIMatrix()
|
||||
{
|
||||
if (mUIOffset.empty())
|
||||
{
|
||||
mUIOffset.push_back(LLVector3(0,0,0));
|
||||
mUIOffset.push_back(new LLVector4a(0.f));
|
||||
}
|
||||
else
|
||||
{
|
||||
mUIOffset.push_back(mUIOffset.back());
|
||||
mUIOffset.push_back(new LLVector4a(*mUIOffset.back()));
|
||||
}
|
||||
|
||||
if (mUIScale.empty())
|
||||
{
|
||||
mUIScale.push_back(LLVector3(1,1,1));
|
||||
mUIScale.push_back(new LLVector4a(1.f));
|
||||
}
|
||||
else
|
||||
{
|
||||
mUIScale.push_back(mUIScale.back());
|
||||
mUIScale.push_back(new LLVector4a(*mUIScale.back()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1522,7 +1522,9 @@ void LLRender::popUIMatrix()
|
||||
{
|
||||
llerrs << "UI offset stack blown." << llendl;
|
||||
}
|
||||
delete mUIOffset.back();
|
||||
mUIOffset.pop_back();
|
||||
delete mUIScale.back();
|
||||
mUIScale.pop_back();
|
||||
}
|
||||
|
||||
@@ -1532,7 +1534,7 @@ LLVector3 LLRender::getUITranslation()
|
||||
{
|
||||
return LLVector3(0,0,0);
|
||||
}
|
||||
return mUIOffset.back();
|
||||
return LLVector3(mUIOffset.back()->getF32ptr());
|
||||
}
|
||||
|
||||
LLVector3 LLRender::getUIScale()
|
||||
@@ -1541,7 +1543,7 @@ LLVector3 LLRender::getUIScale()
|
||||
{
|
||||
return LLVector3(1,1,1);
|
||||
}
|
||||
return mUIScale.back();
|
||||
return LLVector3(mUIOffset.back()->getF32ptr());
|
||||
}
|
||||
|
||||
|
||||
@@ -1551,8 +1553,8 @@ void LLRender::loadUIIdentity()
|
||||
{
|
||||
llerrs << "Need to push UI translation frame before clearing offset." << llendl;
|
||||
}
|
||||
mUIOffset.back().setVec(0,0,0);
|
||||
mUIScale.back().setVec(1,1,1);
|
||||
mUIOffset.back()->splat(0.f);
|
||||
mUIScale.back()->splat(1.f);
|
||||
}
|
||||
|
||||
void LLRender::setColorMask(bool writeColor, bool writeAlpha)
|
||||
@@ -1913,7 +1915,7 @@ void LLRender::flush()
|
||||
}
|
||||
}
|
||||
|
||||
void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
|
||||
void LLRender::vertex4a(const LLVector4a& vertex)
|
||||
{
|
||||
//the range of mVerticesp, mColorsp and mTexcoordsp is [0, 4095]
|
||||
if (mCount > 2048)
|
||||
@@ -1935,12 +1937,13 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
|
||||
|
||||
if (mUIOffset.empty())
|
||||
{
|
||||
mVerticesp[mCount] = LLVector3(x,y,z);
|
||||
mVerticesp[mCount]=vertex;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
|
||||
mVerticesp[mCount] = vert;
|
||||
//LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
|
||||
mVerticesp[mCount].setAdd(vertex,*mUIOffset.back());
|
||||
mVerticesp[mCount].mul(*mUIScale.back());
|
||||
}
|
||||
|
||||
if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
|
||||
@@ -1968,7 +1971,7 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
}
|
||||
|
||||
void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count)
|
||||
void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count)
|
||||
{
|
||||
if (mCount + vert_count > 4094)
|
||||
{
|
||||
@@ -2025,7 +2028,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count)
|
||||
mVerticesp[mCount] = mVerticesp[mCount-1];
|
||||
}
|
||||
|
||||
void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count)
|
||||
void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count)
|
||||
{
|
||||
if (mCount + vert_count > 4094)
|
||||
{
|
||||
@@ -2083,7 +2086,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 v
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
}
|
||||
|
||||
void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count)
|
||||
void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count)
|
||||
{
|
||||
if (mCount + vert_count > 4094)
|
||||
{
|
||||
@@ -2143,26 +2146,6 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLCol
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
}
|
||||
|
||||
void LLRender::vertex2i(const GLint& x, const GLint& y)
|
||||
{
|
||||
vertex3f((GLfloat) x, (GLfloat) y, 0);
|
||||
}
|
||||
|
||||
void LLRender::vertex2f(const GLfloat& x, const GLfloat& y)
|
||||
{
|
||||
vertex3f(x,y,0);
|
||||
}
|
||||
|
||||
void LLRender::vertex2fv(const GLfloat* v)
|
||||
{
|
||||
vertex3f(v[0], v[1], 0);
|
||||
}
|
||||
|
||||
void LLRender::vertex3fv(const GLfloat* v)
|
||||
{
|
||||
vertex3f(v[0], v[1], v[2]);
|
||||
}
|
||||
|
||||
void LLRender::texCoord2f(const GLfloat& x, const GLfloat& y)
|
||||
{
|
||||
mTexcoordsp[mCount] = LLVector2(x,y);
|
||||
|
||||
@@ -364,12 +364,14 @@ public:
|
||||
|
||||
void begin(const GLuint& mode);
|
||||
void end();
|
||||
void vertex2i(const GLint& x, const GLint& y);
|
||||
void vertex2f(const GLfloat& x, const GLfloat& y);
|
||||
void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z);
|
||||
void vertex2fv(const GLfloat* v);
|
||||
void vertex3fv(const GLfloat* v);
|
||||
|
||||
|
||||
LL_FORCE_INLINE void vertex2i(const GLint& x, const GLint& y) { vertex4a(LLVector4a((GLfloat)x,(GLfloat)y,0.f)); }
|
||||
LL_FORCE_INLINE void vertex2f(const GLfloat& x, const GLfloat& y) { vertex4a(LLVector4a(x,y,0.f)); }
|
||||
LL_FORCE_INLINE void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) { vertex4a(LLVector4a(x,y,z)); }
|
||||
LL_FORCE_INLINE void vertex2fv(const GLfloat* v) { vertex4a(LLVector4a(v[0],v[1],0.f)); }
|
||||
LL_FORCE_INLINE void vertex3fv(const GLfloat* v) { vertex4a(LLVector4a(v[0],v[1],v[2])); }
|
||||
void vertex4a(const LLVector4a& v);
|
||||
|
||||
void texCoord2i(const GLint& x, const GLint& y);
|
||||
void texCoord2f(const GLfloat& x, const GLfloat& y);
|
||||
void texCoord2fv(const GLfloat* tc);
|
||||
@@ -387,9 +389,9 @@ public:
|
||||
void diffuseColor4fv(const F32* c);
|
||||
void diffuseColor4ubv(const U8* c);
|
||||
|
||||
void vertexBatchPreTransformed(LLVector3* verts, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U*, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count);
|
||||
void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U*, S32 vert_count);
|
||||
|
||||
void setColorMask(bool writeColor, bool writeAlpha);
|
||||
void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha);
|
||||
@@ -449,7 +451,7 @@ private:
|
||||
F32 mCurrAlphaFuncVal;
|
||||
|
||||
LLPointer<LLVertexBuffer> mBuffer;
|
||||
LLStrider<LLVector3> mVerticesp;
|
||||
LLStrider<LLVector4a> mVerticesp;
|
||||
LLStrider<LLVector2> mTexcoordsp;
|
||||
LLStrider<LLColor4U> mColorsp;
|
||||
std::vector<LLTexUnit*> mTexUnits;
|
||||
@@ -463,8 +465,8 @@ private:
|
||||
|
||||
F32 mMaxAnisotropy;
|
||||
|
||||
std::vector<LLVector3> mUIOffset;
|
||||
std::vector<LLVector3> mUIScale;
|
||||
std::vector<LLVector4a*> mUIOffset;
|
||||
std::vector<LLVector4a*> mUIScale;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -76,6 +76,45 @@ LLRenderTarget::~LLRenderTarget()
|
||||
release();
|
||||
}
|
||||
|
||||
void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt)
|
||||
{
|
||||
//for accounting, get the number of pixels added/subtracted
|
||||
S32 pix_diff = (resx*resy)-(mResX*mResY);
|
||||
|
||||
mResX = resx;
|
||||
mResY = resy;
|
||||
|
||||
for (U32 i = 0; i < mTex.size(); ++i)
|
||||
{ //resize color attachments
|
||||
gGL.getTexUnit(0)->bindManual(mUsage, mTex[i]);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false);
|
||||
sBytesAllocated += pix_diff*4;
|
||||
}
|
||||
|
||||
if (mDepth)
|
||||
{ //resize depth attachment
|
||||
if (mStencil && mFBO)
|
||||
{
|
||||
//use render buffers where stencil buffers are in play
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, mDepth);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, mResX, mResY);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(mUsage, mDepth);
|
||||
U32 internal_type = LLTexUnit::getInternalType(mUsage);
|
||||
if(!mStencil)
|
||||
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false);
|
||||
else
|
||||
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH24_STENCIL8, mResX, mResY, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL, false);
|
||||
}
|
||||
|
||||
sBytesAllocated += pix_diff*4;
|
||||
}
|
||||
if(mSampleBuffer)
|
||||
mSampleBuffer->resize(resx,resy);
|
||||
}
|
||||
|
||||
void LLRenderTarget::setSampleBuffer(LLMultisampleBuffer* buffer)
|
||||
{
|
||||
@@ -95,9 +134,10 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo
|
||||
mUsage = usage;
|
||||
mUseDepth = depth;
|
||||
|
||||
|
||||
if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject)
|
||||
{
|
||||
glGenFramebuffers(1, (GLuint *) &mFBO);
|
||||
|
||||
if (depth)
|
||||
{
|
||||
if (!allocateDepth())
|
||||
@@ -107,8 +147,6 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo
|
||||
}
|
||||
}
|
||||
|
||||
glGenFramebuffers(1, (GLuint *) &mFBO);
|
||||
|
||||
if (mDepth)
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
|
||||
@@ -126,7 +164,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo
|
||||
}
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
@@ -219,7 +257,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
|
||||
|
||||
bool LLRenderTarget::allocateDepth()
|
||||
{
|
||||
if (mStencil)
|
||||
if (mStencil && mFBO)
|
||||
{
|
||||
//use render buffers where stencil buffers are in play
|
||||
glGenRenderbuffers(1, (GLuint *) &mDepth);
|
||||
@@ -231,24 +269,30 @@ bool LLRenderTarget::allocateDepth()
|
||||
}
|
||||
else
|
||||
{
|
||||
LLImageGL::generateTextures(mUsage, GL_DEPTH_COMPONENT24, 1, &mDepth);
|
||||
if(!mStencil)
|
||||
LLImageGL::generateTextures(mUsage, GL_DEPTH_COMPONENT24, 1, &mDepth);
|
||||
else
|
||||
LLImageGL::generateTextures(mUsage, GL_DEPTH24_STENCIL8, 1, &mDepth);
|
||||
gGL.getTexUnit(0)->bindManual(mUsage, mDepth);
|
||||
|
||||
U32 internal_type = LLTexUnit::getInternalType(mUsage);
|
||||
stop_glerror();
|
||||
clear_glerror();
|
||||
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false);
|
||||
if(!mStencil)
|
||||
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false);
|
||||
else
|
||||
LLImageGL::setManualImage(internal_type, 0, GL_DEPTH24_STENCIL8, mResX, mResY, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL, false);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
}
|
||||
|
||||
sBytesAllocated += mResX*mResY*4;
|
||||
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
llwarns << "Unable to allocate depth buffer for render target." << llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
sBytesAllocated += mResX*mResY*4;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -301,13 +345,19 @@ void LLRenderTarget::release()
|
||||
{
|
||||
if (mDepth)
|
||||
{
|
||||
if (mStencil)
|
||||
if (mStencil && mFBO)
|
||||
{
|
||||
glDeleteRenderbuffers(1, (GLuint*) &mDepth);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{
|
||||
//Release before delete.
|
||||
if(mFBO)
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, LLTexUnit::getInternalType(mUsage), 0, 0);
|
||||
}
|
||||
LLImageGL::deleteTextures(mUsage, 0, 0, 1, &mDepth, true);
|
||||
stop_glerror();
|
||||
}
|
||||
@@ -339,6 +389,9 @@ void LLRenderTarget::release()
|
||||
|
||||
if (mTex.size() > 0)
|
||||
{
|
||||
//Release before delete.
|
||||
for (U32 i = 0; i < mTex.size(); ++i)
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, LLTexUnit::getInternalType(mUsage), 0, 0);
|
||||
sBytesAllocated -= mResX*mResY*4*mTex.size();
|
||||
LLImageGL::deleteTextures(mUsage, mInternalFormat[0], 0, mTex.size(), &mTex[0], true);
|
||||
mTex.clear();
|
||||
@@ -448,6 +501,7 @@ void LLRenderTarget::flush(bool fetch_depth)
|
||||
{
|
||||
gGL.getTexUnit(0)->bind(this);
|
||||
glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, 0, 0, 0, 0, mResX, mResY);
|
||||
stop_glerror();
|
||||
|
||||
if (fetch_depth)
|
||||
{
|
||||
@@ -456,8 +510,10 @@ void LLRenderTarget::flush(bool fetch_depth)
|
||||
allocateDepth();
|
||||
}
|
||||
|
||||
gGL.getTexUnit(0)->bind(this);
|
||||
glCopyTexImage2D(LLTexUnit::getInternalType(mUsage), 0, GL_DEPTH24_STENCIL8, 0, 0, mResX, mResY, 0);
|
||||
gGL.getTexUnit(0)->bind(this,true);
|
||||
glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, 0, 0, 0, 0, mResX, mResY);
|
||||
stop_glerror();
|
||||
//glCopyTexImage2D(LLTexUnit::getInternalType(mUsage), 0, GL_DEPTH24_STENCIL8, 0, 0, mResX, mResY, 0);
|
||||
}
|
||||
|
||||
gGL.getTexUnit(0)->disable();
|
||||
@@ -467,7 +523,7 @@ void LLRenderTarget::flush(bool fetch_depth)
|
||||
stop_glerror();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
stop_glerror();
|
||||
|
||||
|
||||
if (mSampleBuffer)
|
||||
{
|
||||
LLGLEnable multisample(GL_MULTISAMPLE);
|
||||
@@ -477,7 +533,7 @@ void LLRenderTarget::flush(bool fetch_depth)
|
||||
check_framebuffer_status();
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, mSampleBuffer->mFBO);
|
||||
check_framebuffer_status();
|
||||
|
||||
|
||||
stop_glerror();
|
||||
if(gGLManager.mIsATI)
|
||||
{
|
||||
@@ -490,10 +546,21 @@ void LLRenderTarget::flush(bool fetch_depth)
|
||||
}
|
||||
stop_glerror();
|
||||
|
||||
//Following case never currently evalutes true, but it's still good to have.
|
||||
if (mTex.size() > 1)
|
||||
{
|
||||
{
|
||||
for (U32 i = 1; i < mTex.size(); ++i)
|
||||
{
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0 + i);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0 + i);
|
||||
stop_glerror();
|
||||
glBlitFramebuffer(0, 0, mResX, mResY, 0, 0, mResX, mResY, GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
/*for (U32 i = 1; i < mTex.size(); ++i)
|
||||
{
|
||||
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
LLTexUnit::getInternalType(mUsage), mTex[i], 0);
|
||||
stop_glerror();
|
||||
@@ -510,13 +577,12 @@ void LLRenderTarget::flush(bool fetch_depth)
|
||||
stop_glerror();
|
||||
glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, GL_RENDERBUFFER, mSampleBuffer->mTex[i]);
|
||||
stop_glerror();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, S32 srcX1, S32 srcY1,
|
||||
S32 dstX0, S32 dstY0, S32 dstX1, S32 dstY1, U32 mask, U32 filter)
|
||||
{
|
||||
@@ -537,7 +603,7 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mask == GL_DEPTH_BUFFER_BIT && source.mStencil != mStencil)
|
||||
if (mask == GL_DEPTH_BUFFER_BIT && !mStencil && source.mStencil != mStencil)
|
||||
{
|
||||
stop_glerror();
|
||||
|
||||
@@ -626,7 +692,8 @@ void LLRenderTarget::getViewport(S32* viewport)
|
||||
// LLMultisampleBuffer implementation
|
||||
//==================================================
|
||||
LLMultisampleBuffer::LLMultisampleBuffer() :
|
||||
mSamples(0)
|
||||
mSamples(0),
|
||||
mColorFormat(0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -727,6 +794,7 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth
|
||||
mUsage = usage;
|
||||
mUseDepth = depth;
|
||||
mStencil = stencil;
|
||||
mColorFormat = color_fmt;
|
||||
|
||||
{
|
||||
|
||||
@@ -764,6 +832,42 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth
|
||||
return addColorAttachment(color_fmt);
|
||||
}
|
||||
|
||||
void LLMultisampleBuffer::resize(U32 resx, U32 resy)
|
||||
{
|
||||
//for accounting, get the number of pixels added/subtracted
|
||||
S32 pix_diff = (resx*resy)-(mResX*mResY);
|
||||
|
||||
mResX = resx;
|
||||
mResY = resy;
|
||||
|
||||
for (U32 i = 0; i < mTex.size(); ++i)
|
||||
{ //resize color attachments
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, mTex[i]);
|
||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, mColorFormat, mResX, mResY);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
sBytesAllocated += pix_diff*4;
|
||||
}
|
||||
|
||||
if (mDepth)
|
||||
{ //resize depth attachment
|
||||
if (mStencil)
|
||||
{
|
||||
//use render buffers where stencil buffers are in play
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, mDepth);
|
||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH24_STENCIL8, mResX, mResY);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, mDepth);
|
||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH_COMPONENT24, mResX, mResY);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
|
||||
}
|
||||
sBytesAllocated += pix_diff*4;
|
||||
}
|
||||
}
|
||||
|
||||
bool LLMultisampleBuffer::addColorAttachment(U32 color_fmt)
|
||||
{
|
||||
if (color_fmt == 0)
|
||||
@@ -813,12 +917,13 @@ bool LLMultisampleBuffer::allocateDepth()
|
||||
clear_glerror();
|
||||
if (mStencil)
|
||||
{
|
||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH24_STENCIL8, mResX, mResY);
|
||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH24_STENCIL8, mResX, mResY);
|
||||
}
|
||||
else
|
||||
{
|
||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH_COMPONENT16_ARB, mResX, mResY);
|
||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, mSamples, GL_DEPTH_COMPONENT24, mResX, mResY);
|
||||
}
|
||||
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
llwarns << "Unable to allocate depth buffer for multisample render target." << llendl;
|
||||
@@ -829,4 +934,3 @@ bool LLMultisampleBuffer::allocateDepth()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,12 @@ public:
|
||||
//multiple calls will release previously allocated resources
|
||||
bool allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, bool use_fbo = FALSE);
|
||||
|
||||
//resize existing attachments to use new resolution and color format
|
||||
// CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined
|
||||
// DO NOT use for screen space buffers or for scratch space for an image that might be uploaded
|
||||
// DO use for render targets that resize often and aren't likely to ruin someone's day if they break
|
||||
void resize(U32 resx, U32 resy, U32 color_fmt);
|
||||
|
||||
//provide this render target with a multisample resource.
|
||||
void setSampleBuffer(LLMultisampleBuffer* buffer);
|
||||
|
||||
@@ -145,6 +151,8 @@ public:
|
||||
//one renderable attachment (i.e. color buffer, depth buffer).
|
||||
bool isComplete() const;
|
||||
|
||||
U32 getFBO() const {return mFBO;}
|
||||
|
||||
static LLRenderTarget* getCurrentBoundTarget() { return sBoundTarget; }
|
||||
|
||||
protected:
|
||||
@@ -168,6 +176,7 @@ protected:
|
||||
class LLMultisampleBuffer : public LLRenderTarget
|
||||
{
|
||||
U32 mSamples;
|
||||
U32 mColorFormat;
|
||||
public:
|
||||
LLMultisampleBuffer();
|
||||
virtual ~LLMultisampleBuffer();
|
||||
@@ -180,6 +189,7 @@ public:
|
||||
bool allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, U32 samples);
|
||||
virtual bool addColorAttachment(U32 color_fmt);
|
||||
virtual bool allocateDepth();
|
||||
void resize(U32 resx, U32 resy);
|
||||
};
|
||||
|
||||
#endif //!LL_MESA_HEADLESS
|
||||
|
||||
@@ -679,7 +679,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
|
||||
vec4 diffuseLookup(vec2 texcoord)
|
||||
{
|
||||
switch (vary_texture_index.r))
|
||||
switch (vary_texture_index))
|
||||
{
|
||||
case 0: ret = texture2D(tex0, texcoord); break;
|
||||
case 1: ret = texture2D(tex1, texcoord); break;
|
||||
@@ -703,7 +703,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
|
||||
if (texture_index_channels > 1)
|
||||
{
|
||||
text[count++] = strdup("VARYING_FLAT ivec4 vary_texture_index;\n");
|
||||
text[count++] = strdup("VARYING_FLAT int vary_texture_index;\n");
|
||||
}
|
||||
|
||||
text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n");
|
||||
@@ -721,7 +721,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
{ //switches are unreliable on some NVIDIA drivers
|
||||
for (S32 i = 0; i < texture_index_channels; ++i)
|
||||
{
|
||||
std::string if_string = llformat("\t%sif (vary_texture_index.r == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i);
|
||||
std::string if_string = llformat("\t%sif (vary_texture_index == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i);
|
||||
text[count++] = strdup(if_string.c_str());
|
||||
}
|
||||
text[count++] = strdup("\treturn vec4(1,0,1,1);\n");
|
||||
@@ -730,13 +730,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
else
|
||||
{
|
||||
text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
|
||||
text[count++] = strdup("\tswitch (vary_texture_index.r)\n");
|
||||
text[count++] = strdup("\tswitch (vary_texture_index)\n");
|
||||
text[count++] = strdup("\t{\n");
|
||||
|
||||
//switch body
|
||||
for (S32 i = 0; i < texture_index_channels; ++i)
|
||||
{
|
||||
std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i);
|
||||
std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i);
|
||||
text[count++] = strdup(case_str.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -1249,7 +1249,7 @@ void LLVertexBuffer::setupVertexArray()
|
||||
1, //TYPE_WEIGHT,
|
||||
4, //TYPE_WEIGHT4,
|
||||
4, //TYPE_CLOTHWEIGHT,
|
||||
4, //TYPE_TEXTURE_INDEX
|
||||
1, //TYPE_TEXTURE_INDEX
|
||||
};
|
||||
|
||||
U32 attrib_type[] =
|
||||
@@ -1266,7 +1266,7 @@ void LLVertexBuffer::setupVertexArray()
|
||||
GL_FLOAT, //TYPE_WEIGHT,
|
||||
GL_FLOAT, //TYPE_WEIGHT4,
|
||||
GL_FLOAT, //TYPE_CLOTHWEIGHT,
|
||||
GL_UNSIGNED_BYTE, //TYPE_TEXTURE_INDEX
|
||||
GL_UNSIGNED_INT, //TYPE_TEXTURE_INDEX
|
||||
};
|
||||
|
||||
bool attrib_integer[] =
|
||||
@@ -2313,7 +2313,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
|
||||
#if !LL_DARWIN
|
||||
S32 loc = TYPE_TEXTURE_INDEX;
|
||||
void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12);
|
||||
glVertexAttribIPointer(loc, 4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
glVertexAttribIPointer(loc, 1, GL_UNSIGNED_INT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
#endif
|
||||
}
|
||||
if (data_mask & MAP_VERTEX)
|
||||
|
||||
@@ -12,7 +12,6 @@ include(LLRender)
|
||||
include(LLWindow)
|
||||
include(LLVFS)
|
||||
include(LLXML)
|
||||
include(LLXUIXML)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
@@ -24,7 +23,6 @@ include_directories(
|
||||
${LLWINDOW_INCLUDE_DIRS}
|
||||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
${LLXUIXML_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llui_SOURCE_FILES
|
||||
@@ -73,6 +71,7 @@ set(llui_SOURCE_FILES
|
||||
lltextparser.cpp
|
||||
lltrans.cpp
|
||||
llui.cpp
|
||||
lluicolor.cpp
|
||||
lluictrl.cpp
|
||||
lluictrlfactory.cpp
|
||||
lluiimage.cpp
|
||||
@@ -142,6 +141,7 @@ set(llui_HEADER_FILES
|
||||
lluictrl.h
|
||||
lluifwd.h
|
||||
llui.h
|
||||
lluicolor.h
|
||||
lluiimage.h
|
||||
lluistring.h
|
||||
lluixmltags.h
|
||||
@@ -165,7 +165,6 @@ target_link_libraries(llui
|
||||
llwindow
|
||||
llimage
|
||||
llvfs # ugh, just for LLDir
|
||||
llxuixml
|
||||
llxml
|
||||
llcommon # must be after llimage, llwindow, llrender
|
||||
llmath
|
||||
|
||||
@@ -217,6 +217,7 @@ public:
|
||||
virtual BOOL canSaveAs() const { return FALSE; }
|
||||
|
||||
virtual void saveAs() {}
|
||||
virtual void saveAsType(BOOL type=false) {}
|
||||
|
||||
// <edit>
|
||||
virtual LLUUID getItemID() { return LLUUID::null; }
|
||||
|
||||
@@ -666,6 +666,7 @@ LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect,
|
||||
mFgUnselectedColor( LLUI::sColorsGroup->getColor("ScrollUnselectedColor") ),
|
||||
mFgDisabledColor( LLUI::sColorsGroup->getColor("ScrollDisabledColor") ),
|
||||
mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ),
|
||||
mDefaultListTextColor( LLUI::sColorsGroup->getColor("DefaultListText") ),
|
||||
mBorderThickness( 2 ),
|
||||
mOnDoubleClickCallback( NULL ),
|
||||
mOnMaximumSelectCallback( NULL ),
|
||||
@@ -3543,6 +3544,10 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
|
||||
{
|
||||
cell->setColor(color);
|
||||
}
|
||||
else
|
||||
{
|
||||
cell->setColor(mDefaultListTextColor);
|
||||
}
|
||||
new_item->setColumn(index, cell);
|
||||
if (columnp->mHeader && !value.asString().empty())
|
||||
{
|
||||
|
||||
@@ -697,6 +697,7 @@ private:
|
||||
LLColor4 mFgUnselectedColor;
|
||||
LLColor4 mFgDisabledColor;
|
||||
LLColor4 mHighlightedColor;
|
||||
LLColor4 mDefaultListTextColor;
|
||||
|
||||
S32 mBorderThickness;
|
||||
void (*mOnDoubleClickCallback)(void* userdata);
|
||||
|
||||
@@ -751,7 +751,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
|
||||
else
|
||||
{
|
||||
tab_panel_top = getRect().getHeight() - getTopBorderHeight();
|
||||
tab_panel_bottom = (TABCNTR_TAB_HEIGHT - TABCNTR_BUTTON_PANEL_OVERLAP); // Run to the edge, covering up the border
|
||||
tab_panel_bottom = (TABCNTR_TAB_HEIGHT + LLPANEL_BORDER_WIDTH*2 - TABCNTR_BUTTON_PANEL_OVERLAP); // Run to the edge, covering up the border
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -520,7 +520,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
|
||||
|
||||
const S32 NUM_VERTICES = 9 * 4; // 9 quads
|
||||
LLVector2 uv[NUM_VERTICES];
|
||||
LLVector3 pos[NUM_VERTICES];
|
||||
LLVector4a pos[NUM_VERTICES];
|
||||
|
||||
S32 index = 0;
|
||||
|
||||
@@ -528,157 +528,157 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
|
||||
{
|
||||
// draw bottom left
|
||||
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
// draw bottom middle
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
uv[index].set(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
// draw bottom right
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
// draw left
|
||||
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
// draw middle
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
// draw right
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom);
|
||||
pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
pos[index].set(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
// draw top left
|
||||
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop);
|
||||
pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||
pos[index].set(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
// draw top middle
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
// draw top right
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop);
|
||||
pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
pos[index].set(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop);
|
||||
pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||
pos[index].set(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop);
|
||||
pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||
pos[index].set(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
|
||||
index++;
|
||||
|
||||
|
||||
gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES);
|
||||
}
|
||||
gGL.end();
|
||||
@@ -720,7 +720,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
|
||||
{
|
||||
const S32 NUM_VERTICES = 4; // 9 quads
|
||||
LLVector2 uv[NUM_VERTICES];
|
||||
LLVector3 pos[NUM_VERTICES];
|
||||
LLVector4a pos[NUM_VERTICES];
|
||||
|
||||
gGL.begin(LLRender::QUADS);
|
||||
{
|
||||
@@ -734,19 +734,19 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
|
||||
S32 scaled_height = llround(height * ui_scale.mV[VY]);
|
||||
|
||||
uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
|
||||
pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f);
|
||||
pos[index].set(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
|
||||
pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f);
|
||||
pos[index].set(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
|
||||
pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY], 0.f);
|
||||
pos[index].set(ui_translation.mV[VX], ui_translation.mV[VY], 0.f);
|
||||
index++;
|
||||
|
||||
uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
|
||||
pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f);
|
||||
pos[index].set(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f);
|
||||
index++;
|
||||
|
||||
gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES);
|
||||
|
||||
@@ -336,6 +336,7 @@ bool LLView::addChild(LLView* child, S32 tab_group)
|
||||
|
||||
// add to front of child list, as normal
|
||||
mChildList.push_front(child);
|
||||
mChildHashMap[child->getName()]=child;
|
||||
|
||||
// add to ctrl list if is LLUICtrl
|
||||
if (child->isCtrl())
|
||||
@@ -374,6 +375,14 @@ void LLView::removeChild(LLView* child)
|
||||
// if we are removing an item we are currently iterating over, that would be bad
|
||||
llassert(child->mInDraw == false);
|
||||
mChildList.remove( child );
|
||||
for(boost::unordered_map<const std::string, LLView*>::iterator it=mChildHashMap.begin(); it != mChildHashMap.end(); ++it)
|
||||
{
|
||||
if(it->second == child)
|
||||
{
|
||||
mChildHashMap.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
child->mParentView = NULL;
|
||||
if (child->isCtrl())
|
||||
{
|
||||
@@ -607,6 +616,7 @@ void LLView::deleteAllChildren()
|
||||
LLView* viewp = mChildList.front();
|
||||
delete viewp; // will remove the child from mChildList
|
||||
}
|
||||
mChildHashMap.clear();
|
||||
}
|
||||
|
||||
void LLView::setAllChildrenEnabled(BOOL b)
|
||||
@@ -1506,13 +1516,18 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_
|
||||
//if(name.empty())
|
||||
// return NULL;
|
||||
// Look for direct children *first*
|
||||
BOOST_FOREACH(LLView* childp, mChildList)
|
||||
/*BOOST_FOREACH(LLView* childp, mChildList)
|
||||
{
|
||||
llassert(childp);
|
||||
if (childp->getName() == name)
|
||||
{
|
||||
return childp;
|
||||
}
|
||||
}*/
|
||||
boost::unordered_map<const std::string, LLView*>::const_iterator it = mChildHashMap.find(name);
|
||||
if(it != mChildHashMap.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
if (recurse)
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "llcursortypes.h"
|
||||
#include "llinitparam.h"
|
||||
#include "llfocusmgr.h"
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
const U32 FOLLOWS_NONE = 0x00;
|
||||
const U32 FOLLOWS_LEFT = 0x01;
|
||||
@@ -186,6 +187,15 @@ public:
|
||||
|
||||
void initFromParams(const LLView::Params&);
|
||||
|
||||
template<typename T>
|
||||
struct CachedUICtrl
|
||||
{
|
||||
CachedUICtrl():mPtr(NULL){}
|
||||
T* connect(LLView* parent,const char* pName){return mPtr = parent->getChild<T>(pName);}
|
||||
T* operator->(){return mPtr;}
|
||||
operator T*() const{return mPtr;}
|
||||
T* mPtr;
|
||||
};
|
||||
protected:
|
||||
LLView(const LLView::Params&);
|
||||
//friend class LLUICtrlFactory;
|
||||
@@ -454,6 +464,7 @@ public:
|
||||
const child_list_t* getChildList() const { return &mChildList; }
|
||||
child_list_const_iter_t beginChild() const { return mChildList.begin(); }
|
||||
child_list_const_iter_t endChild() const { return mChildList.end(); }
|
||||
boost::unordered_map<const std::string, LLView*> mChildHashMap;
|
||||
|
||||
// LLMouseHandler functions
|
||||
// Default behavior is to pass events to children
|
||||
@@ -467,13 +478,17 @@ public:
|
||||
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect); // Display mToolTipMsg if no child handles it.
|
||||
/*virtual*/ const std::string& getName() const;
|
||||
/*virtual*/ const std::string& getName() const;
|
||||
/*virtual*/ void onMouseCaptureLost();
|
||||
/*virtual*/ BOOL hasMouseCapture();
|
||||
/*virtual*/ BOOL isView(); // Hack to support LLFocusMgr
|
||||
/*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
|
||||
/*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
|
||||
|
||||
template <class T> T* findChild(const std::string& name)
|
||||
{
|
||||
return getChild<T>(name,true,false);
|
||||
}
|
||||
template <class T> T* getChild(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const
|
||||
{
|
||||
LLView* child = getChildView(name, recurse, FALSE);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
project(llxuixml)
|
||||
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
include(LLMath)
|
||||
include(LLXML)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${LLMATH_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llxuixml_SOURCE_FILES
|
||||
llinitparam.cpp
|
||||
lluicolor.cpp
|
||||
)
|
||||
|
||||
set(llxuixml_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
llinitparam.h
|
||||
lluicolor.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${llxuixml_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
list(APPEND llxuixml_SOURCE_FILES ${llxuixml_HEADER_FILES})
|
||||
|
||||
add_library (llxuixml ${llxuixml_SOURCE_FILES})
|
||||
# Libraries on which this library depends, needed for Linux builds
|
||||
# Sort by high-level to low-level
|
||||
target_link_libraries(llxuixml
|
||||
llxml
|
||||
llcommon
|
||||
llmath
|
||||
)
|
||||
@@ -254,6 +254,10 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"OBJECT_TOTAL_SCRIPT_COUNT" { count(); yylval.ival = OBJECT_TOTAL_SCRIPT_COUNT; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_SCRIPT_MEMORY" { count(); yylval.ival = OBJECT_SCRIPT_MEMORY; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_SCRIPT_TIME" { count(); yylval.ival = OBJECT_SCRIPT_TIME; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_PRIM_EQUIVALENCE" { count(); yylval.ival = OBJECT_PRIM_EQUIVALENCE; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_SERVER_COST" { count(); yylval.ival = OBJECT_SERVER_COST; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_STREAMING_COST" { count(); yylval.ival = OBJECT_STREAMING_COST; return(INTEGER_CONSTANT); }
|
||||
"OBJECT_PHYSICS_COST" { count(); yylval.ival = OBJECT_SCRIPT_TIME; return(INTEGER_CONSTANT); }
|
||||
|
||||
"TYPE_INTEGER" { count(); yylval.ival = LST_INTEGER; return(INTEGER_CONSTANT); }
|
||||
"TYPE_FLOAT" { count(); yylval.ival = LST_FLOATINGPOINT; return(INTEGER_CONSTANT); }
|
||||
@@ -347,7 +351,6 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"REMOTE_DATA_REQUEST" { count(); yylval.ival = LSL_REMOTE_DATA_REQUEST; return(INTEGER_CONSTANT); }
|
||||
"REMOTE_DATA_REPLY" { count(); yylval.ival = LSL_REMOTE_DATA_REPLY; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
"PSYS_PART_FLAGS" { count(); yylval.ival = LLPS_PART_FLAGS; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_START_COLOR" { count(); yylval.ival = LLPS_PART_START_COLOR; return (INTEGER_CONSTANT); }
|
||||
"PSYS_PART_START_ALPHA" { count(); yylval.ival = LLPS_PART_START_ALPHA; return (INTEGER_CONSTANT); }
|
||||
@@ -357,7 +360,6 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"PSYS_PART_END_SCALE" { count(); yylval.ival = LLPS_PART_END_SCALE; return (INTEGER_CONSTANT); }
|
||||
"PSYS_PART_MAX_AGE" { count(); yylval.ival = LLPS_PART_MAX_AGE; return (INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
"PSYS_PART_WIND_MASK" { count(); yylval.ival = LLPartData::LL_PART_WIND_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_INTERP_COLOR_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_COLOR_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_INTERP_SCALE_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_SCALE_MASK; return(INTEGER_CONSTANT); }
|
||||
@@ -368,7 +370,6 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"PSYS_PART_EMISSIVE_MASK" { count(); yylval.ival = LLPartData::LL_PART_EMISSIVE_MASK; return(INTEGER_CONSTANT); }
|
||||
"PSYS_PART_TARGET_LINEAR_MASK" { count(); yylval.ival = LLPartData::LL_PART_TARGET_LINEAR_MASK; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
"PSYS_SRC_MAX_AGE" { count(); yylval.ival = LLPS_SRC_MAX_AGE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_PATTERN" { count(); yylval.ival = LLPS_SRC_PATTERN; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_INNERANGLE" { count(); yylval.ival = LLPS_SRC_INNERANGLE; return(INTEGER_CONSTANT); }
|
||||
@@ -393,7 +394,6 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"PSYS_SRC_PATTERN_ANGLE_CONE" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE; return(INTEGER_CONSTANT); }
|
||||
"PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
"VEHICLE_TYPE_NONE" { count(); yylval.ival = VEHICLE_TYPE_NONE; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_TYPE_SLED" { count(); yylval.ival = VEHICLE_TYPE_SLED; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_TYPE_CAR" { count(); yylval.ival = VEHICLE_TYPE_CAR; return(INTEGER_CONSTANT); }
|
||||
@@ -408,8 +408,6 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"VEHICLE_ANGULAR_MOTOR_DIRECTION" { count(); yylval.ival = VEHICLE_ANGULAR_MOTOR_DIRECTION; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_LINEAR_MOTOR_OFFSET" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_OFFSET; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
|
||||
"VEHICLE_HOVER_HEIGHT" { count(); yylval.ival = VEHICLE_HOVER_HEIGHT; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_HOVER_EFFICIENCY" { count(); yylval.ival = VEHICLE_HOVER_EFFICIENCY; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_HOVER_TIMESCALE" { count(); yylval.ival = VEHICLE_HOVER_TIMESCALE; return(INTEGER_CONSTANT); }
|
||||
@@ -444,8 +442,6 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"VEHICLE_FLAG_MOUSELOOK_BANK" { count(); yylval.ival = VEHICLE_FLAG_MOUSELOOK_BANK; return(INTEGER_CONSTANT); }
|
||||
"VEHICLE_FLAG_CAMERA_DECOUPLED" { count(); yylval.ival = VEHICLE_FLAG_CAMERA_DECOUPLED; return(INTEGER_CONSTANT); }
|
||||
|
||||
|
||||
|
||||
"PRIM_TYPE" { count(); yylval.ival = LSL_PRIM_TYPE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_MATERIAL" { count(); yylval.ival = LSL_PRIM_MATERIAL; return(INTEGER_CONSTANT); }
|
||||
"PRIM_PHYSICS" { count(); yylval.ival = LSL_PRIM_PHYSICS; return(INTEGER_CONSTANT); }
|
||||
@@ -463,6 +459,15 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"PRIM_FULLBRIGHT" { count(); yylval.ival = LSL_PRIM_FULLBRIGHT; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TEXGEN" { count(); yylval.ival = LSL_PRIM_TEXGEN; return(INTEGER_CONSTANT); }
|
||||
"PRIM_GLOW" { count(); yylval.ival = LSL_PRIM_GLOW; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TEXT" { count(); yylval.ival = LSL_PRIM_TEXT; return(INTEGER_CONSTANT); }
|
||||
"PRIM_NAME" { count(); yylval.ival = LSL_PRIM_NAME; return(INTEGER_CONSTANT); }
|
||||
"PRIM_DESC" { count(); yylval.ival = LSL_PRIM_DESC; return(INTEGER_CONSTANT); }
|
||||
"PRIM_ROT_LOCAL" { count(); yylval.ival = LSL_PRIM_ROT_LOCAL; return(INTEGER_CONSTANT); }
|
||||
"PRIM_PHYSICS_SHAPE_TYPE" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_TYPE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_OMEGA" { count(); yylval.ival = LSL_PRIM_OMEGA; return(INTEGER_CONSTANT); }
|
||||
"PRIM_POS_LOCAL" { count(); yylval.ival = LSL_PRIM_POS_LOCAL; return(INTEGER_CONSTANT); }
|
||||
"PRIM_LINK_TARGET" { count(); yylval.ival = LSL_PRIM_LINK_TARGET; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SLICE" { count(); yylval.ival = LSL_PRIM_SLICE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_TYPE_BOX" { count(); yylval.ival = LSL_PRIM_TYPE_BOX; return(INTEGER_CONSTANT); }
|
||||
"PRIM_TYPE_CYLINDER" { count(); yylval.ival = LSL_PRIM_TYPE_CYLINDER; return(INTEGER_CONSTANT); }
|
||||
@@ -522,6 +527,15 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"PRIM_SCULPT_FLAG_MIRROR" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_MIRROR; return(INTEGER_CONSTANT); }
|
||||
"PRIM_SCULPT_FLAG_INVERT" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_INVERT; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PRIM_PHYSICS_SHAPE_PRIM" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_PRIM; return(INTEGER_CONSTANT); }
|
||||
"PRIM_PHYSICS_SHAPE_NONE" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_NONE; return(INTEGER_CONSTANT); }
|
||||
"PRIM_PHYSICS_SHAPE_CONVEX" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_CONVEX; return(INTEGER_CONSTANT); }
|
||||
|
||||
"DENSITY" { count(); yylval.ival = LSL_DENSITY; return(INTEGER_CONSTANT); }
|
||||
"FRICTION" { count(); yylval.ival = LSL_FRICTION; return(INTEGER_CONSTANT); }
|
||||
"RESTITUTION" { count(); yylval.ival = LSL_RESTITUTION; return(INTEGER_CONSTANT); }
|
||||
"GRAVITY_MULTIPLIER" { count(); yylval.ival = LSL_GRAVITY_MULTIPLIER; return(INTEGER_CONSTANT); }
|
||||
|
||||
"MASK_BASE" { count(); yylval.ival = 0; return(INTEGER_CONSTANT); }
|
||||
"MASK_OWNER" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); }
|
||||
"MASK_GROUP" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); }
|
||||
@@ -595,6 +609,7 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"HTTP_BODY_MAXLENGTH" { count(); yylval.ival = HTTP_BODY_MAXLENGTH; return(INTEGER_CONSTANT); }
|
||||
"HTTP_BODY_TRUNCATED" { count(); yylval.ival = HTTP_BODY_TRUNCATED; return(INTEGER_CONSTANT); }
|
||||
"HTTP_VERIFY_CERT" { count(); yylval.ival = HTTP_VERIFY_CERT; return(INTEGER_CONSTANT); }
|
||||
"HTTP_VERBOSE_THROTTLE" { count(); yylval.ival = HTTP_VERBOSE_THROTTLE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PARCEL_COUNT_TOTAL" { count(); yylval.ival = OC_TOTAL; return(INTEGER_CONSTANT); }
|
||||
"PARCEL_COUNT_OWNER" { count(); yylval.ival = OC_OWNER; return(INTEGER_CONSTANT); }
|
||||
@@ -675,6 +690,54 @@ extern "C" { int yyerror(const char *fmt, ...); }
|
||||
"STATUS_INTERNAL_ERROR" { count(); yylval.ival = LSL_STATUS_INTERNAL_ERROR; return(INTEGER_CONSTANT); }
|
||||
"STATUS_WHITELIST_FAILED" { count(); yylval.ival = LSL_STATUS_WHITELIST_FAILED; return(INTEGER_CONSTANT); }
|
||||
|
||||
"PROFILE_SCRIPT_NONE" { count(); yylval.ival = LSL_PROFILE_SCRIPT_NONE; return(INTEGER_CONSTANT); }
|
||||
"PROFILE_SCRIPT_MEMORY" { count(); yylval.ival = LSL_PROFILE_SCRIPT_MEMORY; return(INTEGER_CONSTANT); }
|
||||
|
||||
"CONTENT_TYPE_TEXT" { count(); yylval.ival = LSL_CONTENT_TYPE_TEXT; return(INTEGER_CONSTANT); }
|
||||
"CONTENT_TYPE_HTML" { count(); yylval.ival = LSL_CONTENT_TYPE_HTML; return(INTEGER_CONSTANT); }
|
||||
|
||||
"RCERR_UNKNOWN" { count(); yylval.ival = LSL_RCERR_UNKNOWN; return(INTEGER_CONSTANT); }
|
||||
"RCERR_SIM_PERF_LOW" { count(); yylval.ival = LSL_RCERR_SIM_PERF_LOW; return(INTEGER_CONSTANT); }
|
||||
"RCERR_CAST_TIME_EXCEEDED" { count(); yylval.ival = LSL_RCERR_CAST_TIME_EXCEEDED; return(INTEGER_CONSTANT); }
|
||||
|
||||
"RC_REJECT_TYPES" { count(); yylval.ival = LSL_RC_REJECT_TYPES; return(INTEGER_CONSTANT); }
|
||||
"RC_DETECT_PHANTOM" { count(); yylval.ival = LSL_RC_DETECT_PHANTOM; return(INTEGER_CONSTANT); }
|
||||
"RC_DATA_FLAGS" { count(); yylval.ival = LSL_RC_DATA_FLAGS; return(INTEGER_CONSTANT); }
|
||||
"RC_MAX_HITS" { count(); yylval.ival = LSL_RC_MAX_HITS; return(INTEGER_CONSTANT); }
|
||||
|
||||
"RC_REJECT_AGENTS" { count(); yylval.ival = LSL_RC_REJECT_AGENTS; return(INTEGER_CONSTANT); }
|
||||
"RC_REJECT_PHYSICAL" { count(); yylval.ival = LSL_RC_REJECT_PHYSICAL; return(INTEGER_CONSTANT); }
|
||||
"RC_REJECT_NONPHYSICAL" { count(); yylval.ival = LSL_RC_REJECT_NONPHYSICAL; return(INTEGER_CONSTANT); }
|
||||
"RC_REJECT_LAND" { count(); yylval.ival = LSL_RC_REJECT_LAND; return(INTEGER_CONSTANT); }
|
||||
|
||||
"RC_GET_NORMAL" { count(); yylval.ival = LSL_RC_GET_NORMAL; return(INTEGER_CONSTANT); }
|
||||
"RC_GET_ROOT_KEY" { count(); yylval.ival = LSL_RC_GET_ROOT_KEY; return(INTEGER_CONSTANT); }
|
||||
"RC_GET_LINK_NUM" { count(); yylval.ival = LSL_RC_GET_LINK_NUM; return(INTEGER_CONSTANT); }
|
||||
|
||||
"ESTATE_ACCESS_ALLOWED_AGENT_ADD" { count(); yylval.ival = LSL_ESTATE_ACCESS_ALLOWED_AGENT_ADD; return(INTEGER_CONSTANT); }
|
||||
"ESTATE_ACCESS_ALLOWED_AGENT_REMOVE" { count(); yylval.ival = LSL_ESTATE_ACCESS_ALLOWED_AGENT_REMOVE; return(INTEGER_CONSTANT); }
|
||||
"ESTATE_ACCESS_ALLOWED_GROUP_ADD" { count(); yylval.ival = LSL_ESTATE_ACCESS_ALLOWED_GROUP_ADD; return(INTEGER_CONSTANT); }
|
||||
"ESTATE_ACCESS_ALLOWED_GROUP_REMOVE" { count(); yylval.ival = LSL_ESTATE_ACCESS_ALLOWED_GROUP_REMOVE; return(INTEGER_CONSTANT); }
|
||||
"ESTATE_ACCESS_BANNED_AGENT_ADD" { count(); yylval.ival = LSL_ESTATE_ACCESS_BANNED_AGENT_ADD; return(INTEGER_CONSTANT); }
|
||||
"ESTATE_ACCESS_BANNED_AGENT_REMOVE" { count(); yylval.ival = LSL_ESTATE_ACCESS_BANNED_AGENT_REMOVE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"KFM_COMMAND" { count(); yylval.ival = LSL_KFM_COMMAND; return(INTEGER_CONSTANT); }
|
||||
"KFM_MODE" { count(); yylval.ival = LSL_KFM_MODE; return(INTEGER_CONSTANT); }
|
||||
"KFM_DATA" { count(); yylval.ival = LSL_KFM_DATA; return(INTEGER_CONSTANT); }
|
||||
"KFM_FORWARD" { count(); yylval.ival = LSL_KFM_FORWARD; return(INTEGER_CONSTANT); }
|
||||
"KFM_LOOP" { count(); yylval.ival = LSL_KFM_LOOP; return(INTEGER_CONSTANT); }
|
||||
"KFM_PING_PONG" { count(); yylval.ival = LSL_KFM_PING_PONG; return(INTEGER_CONSTANT); }
|
||||
"KFM_REVERSE" { count(); yylval.ival = LSL_KFM_REVERSE; return(INTEGER_CONSTANT); }
|
||||
"KFM_ROTATION" { count(); yylval.ival = LSL_KFM_ROTATION; return(INTEGER_CONSTANT); }
|
||||
"KFM_TRANSLATION" { count(); yylval.ival = LSL_KFM_TRANSLATION; return(INTEGER_CONSTANT); }
|
||||
"KFM_CMD_PLAY" { count(); yylval.ival = LSL_KFM_CMD_PLAY; return(INTEGER_CONSTANT); }
|
||||
"KFM_CMD_STOP" { count(); yylval.ival = LSL_KFM_CMD_STOP; return(INTEGER_CONSTANT); }
|
||||
"KFM_CMD_PAUSE" { count(); yylval.ival = LSL_KFM_CMD_PAUSE; return(INTEGER_CONSTANT); }
|
||||
|
||||
"AGENT_LIST_PARCEL" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); }
|
||||
"AGENT_LIST_PARCEL_OWNER" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); }
|
||||
"AGENT_LIST_REGION" { count(); yylval.ival = 4; return(INTEGER_CONSTANT); }
|
||||
|
||||
{L}({L}|{N})* { count(); yylval.sval = new char[strlen(yytext) + 1]; strcpy(yylval.sval, yytext); return(IDENTIFIER); }
|
||||
|
||||
{N}+{E} { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); }
|
||||
|
||||
@@ -40,7 +40,8 @@ enum LLScriptHTTPRequestParameterKey
|
||||
HTTP_METHOD,
|
||||
HTTP_MIMETYPE,
|
||||
HTTP_BODY_MAXLENGTH,
|
||||
HTTP_VERIFY_CERT
|
||||
HTTP_VERIFY_CERT,
|
||||
HTTP_VERBOSE_THROTTLE
|
||||
};
|
||||
|
||||
enum LLScriptHTTPResponseMetadataKey
|
||||
|
||||
@@ -469,102 +469,109 @@ void LLScriptLibrary::init()
|
||||
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetEnv", "s", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "llRegionSayTo", NULL, "kis");
|
||||
|
||||
// energy, sleep, dummy_func, name, return type, parameters, help text, gods-only
|
||||
|
||||
// Adding missing (more recent) LSL functions.
|
||||
|
||||
addFunction(10.f, 0.f, dummy_func, "llCastRay", "l", "vvl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetSPMaxMemory", "i", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetUsedMemory", "i", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llGodLikeRezObject", NULL, "kv");
|
||||
addFunction(10.f, 0.f, dummy_func, "llScriptProfiler", NULL, "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetInventoryPermMask", NULL, "sii");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetObjectPermMask", NULL, "ii");
|
||||
// Even more recent
|
||||
// Server v11.08.10.238207 new functions:
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetMemoryLimit", "i", "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetMemoryLimit", "i", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetLinkMedia", "i", "iil");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetLinkMedia", "l", "iil");
|
||||
addFunction(10.f, 0.f, dummy_func, "llClearLinkMedia", "i", "ii");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetLinkCamera", NULL, "ivv");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetContentType", NULL, "ki");
|
||||
addFunction(10.f, 0.f, dummy_func, "llLinkSitTarget", NULL, "ivr");
|
||||
addFunction(10.f, 0.f, dummy_func, "llLinkSitTarget", NULL, "ivq");
|
||||
addFunction(10.f, 0.f, dummy_func, "llAvatarOnLinkSitTarget", "k", "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetMassMKS", "f", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetMemoryLimit", "i", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetParcelMusicURL", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetPhysicsMaterial", "l", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llManageEstateAccess", "i", "ik");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetAngularVelocity", NULL, "vi");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetKeyframedMotion", NULL, "ll");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetPhysicsMaterial", NULL, "iffff");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetRegionPos", "i", "v");
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetVelocity", NULL, "vi");
|
||||
// Server v11.09.09.240509 new functions:
|
||||
addFunction(10.f, 0.f, dummy_func, "llCastRay", "l", "vvl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetMassMKS", "f", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetPhysicsMaterial", NULL, "iffff");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetPhysicsMaterial", "l", NULL);
|
||||
// Server v11.10.18.243270 new functions:
|
||||
addFunction(10.f, 0.f, dummy_func, "llManageEstateAccess", "i", "ik");
|
||||
// Server RC magnum v11.10.31.244254 new function:
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetKeyframedMotion", NULL, "ll");
|
||||
// Server RC Le Tigre v11.10.30.245889 new function:
|
||||
addFunction(10.f, 0.f, dummy_func, "llTransferLindenDollars", "k", "ki");
|
||||
|
||||
// llGenerateKey officially implemented now added
|
||||
addFunction(10.f, 0.f, dummy_func, "llGenerateKey", "k", NULL);
|
||||
|
||||
//Pathfinder functions. Current state: alpha, thus subject to change.
|
||||
//This and the preceding line are to be removed in future revisions of this file.
|
||||
// Server new function 2011-12-13:
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetParcelMusicURL", "s", NULL);
|
||||
|
||||
// Missing script functions as of 2011-12-13
|
||||
addFunction(10.f, 0.f, dummy_func, "llScriptProfiler", NULL, "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetSPMaxMemory", "i", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetUsedMemory", "i", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llSetAngularVelocity", NULL, "vi");
|
||||
|
||||
// Server 12.01.24.248357 new functions
|
||||
addFunction(0.f, 0.f, dummy_func, "llSetRegionPos", "i", "v");
|
||||
|
||||
// Server 12.04.13.253827 new function
|
||||
addFunction(0.f, 0.f, dummy_func, "llGetAgentList", "l", "il");
|
||||
|
||||
// Server RC Magnum 12.05.25.258071 new functions:
|
||||
addFunction(0.f, 0.f, dummy_func, "llAttachToAvatarTemp", NULL, "i");
|
||||
addFunction(0.f, 0.f, dummy_func, "llTeleportAgent", NULL, "ksvv");
|
||||
addFunction(0.f, 0.f, dummy_func, "llTeleportAgentGlobalCoords", NULL, "kvvv");
|
||||
|
||||
// Pathfinding functions
|
||||
addFunction(10.f, 0.f, dummy_func, "llCreateCharacter", NULL, "l");
|
||||
addFunction(10.f, 0.f, dummy_func, "llDeleteCharacter", NULL, NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "llEvade", NULL, "kl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llExecCharacterCmd", NULL, "il");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetClosestNavPoint", "l", "vl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llFleeFrom", NULL, "vfl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetClosestNavPoint", NULL, "vl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llGetStaticPath", NULL, "vvfl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llNavigateTo", NULL, "vl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llPatrolPoints", NULL, "ll");
|
||||
addFunction(10.f, 0.f, dummy_func, "llPursue", NULL, "kl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llUpdateCharacter", NULL, "l");
|
||||
addFunction(10.f, 0.f, dummy_func, "llWanderWithin", NULL, "vfl");
|
||||
addFunction(10.f, 0.f, dummy_func, "llWanderWithin", NULL, "vvl");
|
||||
|
||||
|
||||
|
||||
// REGARDING OSSL FUNCTIONS
|
||||
// SL-LSL Functions to be added above this line
|
||||
// ---------------------------------------------
|
||||
// NOTE bytecode placement no longer applies, viewers do not compile scripts anymore (confirmed with LL, also noted by Phoenix/Firestorm team.)
|
||||
// REGARDING NON SL-LSL FUNCTIONS (OSSL, aaFunctions, botFunctions)
|
||||
// These additions should be posted underneath the llFunctions
|
||||
// These functions pertain to OpenSimulator and are in no part applicable to SecondLife by Linden Labs
|
||||
// The Current State of these functions are in flux and development is ongoing. Not all the functions are presently
|
||||
// documented and therefore the description may be incomplete and require further attention.
|
||||
// OpenSimulator is written in C# and not CPP therefore some values for example "double = float" etc. are different.
|
||||
|
||||
// OSSL corrections and syntax additions added + set in same order as found in OSSL_stub.cs of OpenSim Source (Updated PM October-21-2010
|
||||
// based on OpenSimulator Ver. 0.7.x DEV/Master Git # a7acb650d400a280a7b9edabd304376dff9c81af - a7acb65-r/14142
|
||||
// fully documented and therefore the description may be incomplete and require further attention.
|
||||
// OpenSim & Aurora-Sim are written in C# and not CPP therefore some values for example "double = float" etc. are different.
|
||||
//
|
||||
// OSSL corrections and syntax additions added + set initially in same order as found in IOSSL_Api.cs of Aurora-Sim & OpenSim Source
|
||||
// updates added @ end of each subsection for update timeline maint.
|
||||
// Updates by WhiteStar Magic
|
||||
|
||||
// It should be noted though, that the order of OSSL functions is not important for correct functionality.
|
||||
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetRegionWaterHeight", NULL, "f");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetRegionSunSettings", NULL, "iif");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetEstateSunSettings", NULL, "if");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetCurrentSunHour", "f", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osSunGetParam","f", "s"); // Deprecated. Use osGetSunParam instead
|
||||
addFunction(10.f, 0.f, dummy_func, "osSunSetParam", "sf", NULL); // Deprecated. Use osSetSunParam instead
|
||||
addFunction(10.f, 0.f, dummy_func, "osWindActiveModelPluginName", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osParcelJoin", NULL, "vv");
|
||||
addFunction(10.f, 0.f, dummy_func, "osParcelSubdivide", NULL, "vv");
|
||||
addFunction(10.f, 0.f, dummy_func, "osParcelSetDetails", NULL, "vv"); // Deprecated. Use osSetParcelDetails instead.
|
||||
// addFunction(10.f, 0.f, dummy_func, "osWindParamSet", NULL, "ssf"); // This function was renamed before it was implemented. Leaving this in for now.
|
||||
// addFunction(10.f, 0.f, dummy_func, "osWindParamGet", "f", "ss"); // This function was renamed before it was implemented. Leaving this in for now.
|
||||
addFunction(10.f, 0.f, dummy_func, "osList2Double", "f", "li");
|
||||
//
|
||||
// OSSL Functions COMMON to OpenSim & Aurora-Sim
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureURL", NULL, "ksssi");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureData", NULL, "ksssi");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureURLBlend", NULL, "ksssii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureDataBlend", NULL, "ksssii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureURLBlendFace", NULL, "ksssfiiii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureData", NULL, "ksssi");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureDataBlend", NULL, "ksssii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureDataBlendFace", NULL, "ksssfiiii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osTerrainGetHeight", "f", "ii"); // Deprecated. Use osGetTerrainHeight instead
|
||||
addFunction(10.f, 0.f, dummy_func, "osTerrainSetHeight", NULL, "iif"); // Deprecated. Use osSetTerrainHeight instead
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetTerrainHeight", "f", "ii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetTerrainHeight", NULL, "iif");
|
||||
addFunction(10.f, 0.f, dummy_func, "osTerrainFlush", NULL, NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osRegionRestart", "i", "f");
|
||||
addFunction(10.f, 0.f, dummy_func, "osRegionNotice",NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osConsoleCommand", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetParcelMediaURL", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetParcelSIPAddress", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetPrimFloatOnWater", NULL, "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "osTeleportAgent", NULL, "ksvv");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetParcelSIPAddress", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetAgentIP", "s", "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetAgents", "l", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osTeleportAgent", NULL, "ksvv"); // Polymorphic
|
||||
addFunction(10.f, 0.f, dummy_func, "osTeleportOwner", NULL, "svv"); // Polymorphic
|
||||
addFunction(10.f, 0.f, dummy_func, "osAvatarPlayAnimation", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osAvatarStopAnimation", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osForceAttachToAvatar", NULL, "i"); // May.03.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osForceDetachFromAvatar", NULL, NULL); // May.03.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osMovePen", NULL, "sii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osDrawLine", NULL, "siiii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osDrawLine", NULL, "siiii"); // Polymorphic
|
||||
addFunction(10.f, 0.f, dummy_func, "osDrawText", NULL, "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "osDrawEllipse", NULL, "sii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osDrawRectangle", NULL, "sii");
|
||||
@@ -574,14 +581,27 @@ void LLScriptLibrary::init()
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetFontSize", NULL, "si");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetFontName", NULL, "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetPenSize", NULL, "si");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetPenColor", NULL, "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetPenCap", NULL, "sss");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetPenColour", NULL, "ss"); // Deprecated. Use osSetPenColor instead
|
||||
addFunction(10.f, 0.f, dummy_func, "osDrawImage", NULL, "siis");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetDrawStringSize", "v", "sssi");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetStateEvents", NULL, "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "osList2Double", "f", "li");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetRegionWaterHeight", NULL, "f");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetRegionSunSettings", NULL, "iif");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetEstateSunSettings", NULL, "if");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetCurrentSunHour", "f", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetSunParam","f", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetSunParam", "sf", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osWindActiveModelPluginName", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetWindParam", NULL, "ssf");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetWindParam", "f", "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "osParcelJoin", NULL, "vv");
|
||||
addFunction(10.f, 0.f, dummy_func, "osParcelSubdivide", NULL, "vv");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetParcelDetails", NULL, "vl");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetScriptEngineName", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetSimulatorVersion", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osParseJSON", "s", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osParseJSONNew", "s", "s"); // mar.5.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osMessageObject", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osMakeNotecard", NULL, "sl");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetNotecardLine", "s", "si");
|
||||
@@ -592,16 +612,16 @@ void LLScriptLibrary::init()
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetGridNick", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetGridName", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetGridLoginURI", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetGridHomeURI","s",NULL); // mar.5.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetGridGatekeeperURI", "s", "NULL"); //mar.11.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetGridCustom","s","k"); // mar.5.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osFormatString", "s", "sl");
|
||||
addFunction(10.f, 0.f, dummy_func, "osMatchString", "l", "ssi");
|
||||
addFunction(10.f, 0.f, dummy_func, "osReplaceString", "s", "sssi"); // mar.5.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osLoadedCreationDate", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osLoadedCreationTime", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osLoadedCreationID", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetLinkPrimitiveParams", "l", "il");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcCreate", "k", "ssvk");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcMoveTo", NULL, "kv");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSay", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcRemove", NULL, "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetMapTexture", "k", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetRegionMapTexture", "k", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetRegionStats", "l", NULL);
|
||||
@@ -613,52 +633,105 @@ void LLScriptLibrary::init()
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetPrimitiveParams", "l", "kl");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetPrimitiveParams", NULL, "kl");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetProjectionParams", NULL, "kikfff");
|
||||
addFunction(10.f, 0.f, dummy_func, "osUnixTimeToTimestamp", "s", "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetPenColor", NULL, "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetSunParam","f", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetSunParam", NULL, "sf");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetParcelDetails", NULL, "vl");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetTerrainHeight", "f", "ii");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetTerrainHeight", NULL, "iif");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetAvatarList", "l", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osTeleportOwner", NULL, "svv");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetWindParam","f", "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetWindParam", NULL, "ssf");
|
||||
|
||||
addFunction(10.f, 0.f, dummy_func, "osUnixTimeToTimestamp", "s", "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetInventoryDesc", "s", "s"); //mar.17.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osInviteToGroup", "i", "k"); // May.03.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osEjectFromGroup", "i", "k"); // May.03.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetTerrainTexture", NULL, "ik"); // May.03.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetTerrainTextureHeight", NULL, "iff"); // May.03.2012
|
||||
|
||||
// LightShare functions
|
||||
//
|
||||
// OSSL Functions OpenSim Unique
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetStateEvents", NULL, "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "osIsNpc","i","k"); // mar.5.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcCreate", "k", "ssvk");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSaveAppearance", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcLoadAppearance", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcGetPos","k","k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcMoveTo", NULL, "kv");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcMoveToTarget", NULL, "kvi");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcGetOwner","k","k"); // mar.5.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcGetRot", "r", "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSetRot", NULL, "kr");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcStopMoveToTarget", NULL, "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSay", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSay", NULL, "kis"); // May.03.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSit", NULL, "kki");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcStand", NULL, "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcRemove", NULL, "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcPlayAnimation",NULL,"ks"); // mar.5.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcStopAnimation",NULL,"ks"); // mar.5.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osOwnerSaveAppearance", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osAgentSaveAppearance", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcShout", NULL, "kis"); // May.03.2012
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcWhisper", NULL, "kis"); // May.03.2012
|
||||
//
|
||||
// OSSL Functions Aurora-Sim Unique
|
||||
addFunction(10.f, 0.f, dummy_func, "osReturnObject", NULL, "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osReturnObjects", NULL, "f");
|
||||
addFunction(10.f, 0.f, dummy_func, "osShutDown", NULL, NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osAddAgentToGroup", NULL, "kss");
|
||||
addFunction(10.f, 0.f, dummy_func, "osRezObject", NULL, "svvriiiii");
|
||||
//
|
||||
// LightShare functions (Careminster Variant)
|
||||
addFunction(10.f, 0.f, dummy_func, "cmSetWindlightScene", "i", "l");
|
||||
addFunction(10.f, 0.f, dummy_func, "cmSetWindlightSceneTargeted", "i", "lk");
|
||||
addFunction(10.f, 0.f, dummy_func, "cmGetWindlightScene", "l", "l");
|
||||
// LightShare functions - alternate versions
|
||||
// don't ask me why they renamed 'em, but we need to include both versions -- MC
|
||||
// LightShare functions - alternate versions (os & aa variant)
|
||||
addFunction(10.f, 0.f, dummy_func, "lsSetWindlightScene", "i", "l");
|
||||
addFunction(10.f, 0.f, dummy_func, "lsSetWindlightSceneTargeted", "i", "lk");
|
||||
addFunction(10.f, 0.f, dummy_func, "lsGetWindlightScene", "l", "l");
|
||||
|
||||
// New OSSL functions 08-10-2011
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSaveAppearance", "k", "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcLoadAppearance", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcMoveToTarget", NULL, "kvi");
|
||||
addFunction(10.f, 0.f, dummy_func, "osOwnerSaveAppearance", "k", "s");
|
||||
|
||||
// More new stuffs
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcGetRot", "r", "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSetRot", NULL, "kr");
|
||||
addFunction(10.f, 0.f, dummy_func, "osAgentSaveAppearance", "k", "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcGetPos", "v", "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcStopMoveToTarget", NULL, "k");
|
||||
|
||||
addFunction(10.f, 0.f, dummy_func, "osIsNpc", "i", "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcGetOwner", "k", "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetGridCustom", "s", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "osGetGridHomeURI", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcPlayAnimation", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcSit", NULL, "kki");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcStand", NULL, "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "osNpcStopAnimation", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "osSetRot", NULL, "kq");
|
||||
|
||||
//
|
||||
// aaFunctions Aurora-Sim ONLY
|
||||
addFunction(10.f, 0.f, dummy_func, "aaSetCloudDensity", NULL, "f");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaUpdateDatabase", NULL, "sss");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaQueryDatabase", "l", "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaDeserializeXMLValues", "l", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaDeserializeXMLKeys","l", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaSetConeOfSilence", NULL, "f");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaSerializeXML", "s", "ll");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetTeam", "s", "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetHealth", "f", "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaJoinCombat", NULL, "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaLeaveCombat", NULL, "k");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaJoinCombatTeam", NULL, "ks");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaRequestCombatPermission", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaThawAvatar", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaFreezeAvatar", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetTeamMembers", "l", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetLastOwner", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "aaSayDistance", NULL, "ifs");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaSayTo", NULL, "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetWalkDisabled ", "i", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaSetWalkDisabled", NULL, "si");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetFlyDisabled ", "i", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaSetFlyDisabled", NULL, "sf");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaAvatarFullName2Key ", "s", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaRaiseError", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetText ", "s", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetTextColor ", "r", NULL);
|
||||
addFunction(10.f, 0.f, dummy_func, "aaSetEnv ", NULL, "sl");
|
||||
addFunction(10.f, 0.f, dummy_func, "aaGetIsInfiniteRegion", "i", NULL);
|
||||
// botFunctions Aurora-Sim ONLY
|
||||
addFunction(10.f, 0.f, dummy_func, "botGetWaitingTime", "v", "i");
|
||||
addFunction(10.f, 0.f, dummy_func, "botSetMap", NULL, "slii");
|
||||
addFunction(10.f, 0.f, dummy_func, "botCreateBot", "s", "sssv");
|
||||
addFunction(10.f, 0.f, dummy_func, "botRemoveBot", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "botPauseMovement", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "botResumeMovement", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "botFollowAvatar", NULL, "ssff");
|
||||
addFunction(10.f, 0.f, dummy_func, "botStopFollowAvatar", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "botSendChatMessage", NULL, "ssii");
|
||||
addFunction(10.f, 0.f, dummy_func, "botSendIM",NULL,"sss");
|
||||
addFunction(10.f, 0.f, dummy_func, "botSetShouldFly", NULL, "si");
|
||||
addFunction(10.f, 0.f, dummy_func, "botSitObject", NULL, "ssv");
|
||||
addFunction(10.f, 0.f, dummy_func, "botStandUp", NULL, "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "botTouchObject", NULL, "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "botAddTag", NULL, "ss");
|
||||
addFunction(10.f, 0.f, dummy_func, "botGetBotsWithTag", "l", "s");
|
||||
addFunction(10.f, 0.f, dummy_func, "botRemoveBotsWithTag", NULL, "s");
|
||||
// energy, sleep, dummy_func, name, return type, parameters
|
||||
}
|
||||
|
||||
LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, BOOL god_only)
|
||||
|
||||
@@ -37,7 +37,6 @@ include(LLUI)
|
||||
include(LLVFS)
|
||||
include(LLWindow)
|
||||
include(LLXML)
|
||||
include(LLXUIXML)
|
||||
include(LScript)
|
||||
include(Linking)
|
||||
include(NDOF)
|
||||
@@ -72,7 +71,6 @@ include_directories(
|
||||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLWINDOW_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
${LLXUIXML_INCLUDE_DIRS}
|
||||
${LSCRIPT_INCLUDE_DIRS}
|
||||
${LSCRIPT_INCLUDE_DIRS}/lscript_compile
|
||||
)
|
||||
@@ -98,11 +96,7 @@ set(viewer_SOURCE_FILES
|
||||
ascentprefschat.cpp
|
||||
ascentprefssys.cpp
|
||||
ascentprefsvan.cpp
|
||||
#dhparam.cpp
|
||||
#dsaparam.cpp
|
||||
emeraldboobutils.cpp
|
||||
dofloaterhex.cpp
|
||||
dohexeditor.cpp
|
||||
floatersculptpreview.cpp
|
||||
hbfloatergrouptitles.cpp
|
||||
hgfloatertexteditor.cpp
|
||||
@@ -115,6 +109,7 @@ set(viewer_SOURCE_FILES
|
||||
jcfloaterareasearch.cpp
|
||||
chatbar_as_cmdline.cpp
|
||||
qtoolalign.cpp
|
||||
NACLantispam.cpp
|
||||
llaccountingcostmanager.cpp
|
||||
llagent.cpp
|
||||
llagentaccess.cpp
|
||||
@@ -223,7 +218,6 @@ set(viewer_SOURCE_FILES
|
||||
llfloatergroupinvite.cpp
|
||||
llfloatergroups.cpp
|
||||
llfloaterhandler.cpp
|
||||
llfloaterhardwaresettings.cpp
|
||||
llfloaterhtmlcurrency.cpp
|
||||
llfloatermediabrowser.cpp
|
||||
llfloaterhtmlsimple.cpp
|
||||
@@ -251,6 +245,7 @@ set(viewer_SOURCE_FILES
|
||||
llfloaterpostprocess.cpp
|
||||
llfloaterpreference.cpp
|
||||
llfloaterproperties.cpp
|
||||
llfloaterregiondebugconsole.cpp
|
||||
llfloaterregioninfo.cpp
|
||||
llfloaterreporter.cpp
|
||||
llfloatersearchreplace.cpp
|
||||
@@ -380,6 +375,7 @@ set(viewer_SOURCE_FILES
|
||||
llpanelmsgs.cpp
|
||||
llpanelnetwork.cpp
|
||||
llpanelobject.cpp
|
||||
llpanelpathfindingrebakenavmesh.cpp
|
||||
llpanelpermissions.cpp
|
||||
llpanelpick.cpp
|
||||
llpanelplace.cpp
|
||||
@@ -388,6 +384,15 @@ set(viewer_SOURCE_FILES
|
||||
llpanelweb.cpp
|
||||
llparcelselection.cpp
|
||||
llpatchvertexarray.cpp
|
||||
llpathfindingcharacter.cpp
|
||||
llpathfindingcharacterlist.cpp
|
||||
llpathfindinglinkset.cpp
|
||||
llpathfindinglinksetlist.cpp
|
||||
llpathfindingmanager.cpp
|
||||
llpathfindingnavmesh.cpp
|
||||
llpathfindingnavmeshstatus.cpp
|
||||
llpathfindingobject.cpp
|
||||
llpathfindingobjectlist.cpp
|
||||
llphysicsmotion.cpp
|
||||
llphysicsshapebuilderutil.cpp
|
||||
llpolymesh.cpp
|
||||
@@ -527,7 +532,6 @@ set(viewer_SOURCE_FILES
|
||||
llvopartgroup.cpp
|
||||
llvosky.cpp
|
||||
llvosurfacepatch.cpp
|
||||
llvotextbubble.cpp
|
||||
llvotree.cpp
|
||||
llvovolume.cpp
|
||||
llvowater.cpp
|
||||
@@ -575,6 +579,7 @@ set(viewer_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
ViewerInstall.cmake
|
||||
|
||||
NACLantispam.h
|
||||
sgmemstat.h
|
||||
sgversion.h
|
||||
llviewerobjectbackup.h
|
||||
@@ -594,8 +599,6 @@ set(viewer_HEADER_FILES
|
||||
ascentprefssys.h
|
||||
ascentprefsvan.h
|
||||
emeraldboobutils.h
|
||||
dofloaterhex.h
|
||||
dohexeditor.h
|
||||
floatersculptpreview.h
|
||||
hbfloatergrouptitles.h
|
||||
hgfloatertexteditor.h
|
||||
@@ -719,7 +722,6 @@ set(viewer_HEADER_FILES
|
||||
llfloatergroupinvite.h
|
||||
llfloatergroups.h
|
||||
llfloaterhandler.h
|
||||
llfloaterhardwaresettings.h
|
||||
llfloaterhtmlcurrency.h
|
||||
llfloatermediabrowser.h
|
||||
llfloaterhtmlsimple.h
|
||||
@@ -747,6 +749,7 @@ set(viewer_HEADER_FILES
|
||||
llfloaterpreference.h
|
||||
llfloaterperms.h
|
||||
llfloaterproperties.h
|
||||
llfloaterregiondebugconsole.h
|
||||
llfloaterregioninfo.h
|
||||
llfloaterreporter.h
|
||||
llfloatersearchreplace.h
|
||||
@@ -869,7 +872,6 @@ set(viewer_HEADER_FILES
|
||||
llpanellandmedia.h
|
||||
llpanellandobjects.h
|
||||
llpanellandoptions.h
|
||||
llpanelLCD.h
|
||||
llpanellogin.h
|
||||
llpanelmaininventory.h
|
||||
llpanelmorph.h
|
||||
@@ -877,6 +879,7 @@ set(viewer_HEADER_FILES
|
||||
llpanelmsgs.h
|
||||
llpanelnetwork.h
|
||||
llpanelobject.h
|
||||
llpanelpathfindingrebakenavmesh.h
|
||||
llpanelpermissions.h
|
||||
llpanelpick.h
|
||||
llpanelplace.h
|
||||
@@ -885,6 +888,15 @@ set(viewer_HEADER_FILES
|
||||
llpanelweb.h
|
||||
llparcelselection.h
|
||||
llpatchvertexarray.h
|
||||
llpathfindingcharacter.h
|
||||
llpathfindingcharacterlist.h
|
||||
llpathfindinglinkset.h
|
||||
llpathfindinglinksetlist.h
|
||||
llpathfindingmanager.h
|
||||
llpathfindingnavmesh.h
|
||||
llpathfindingnavmeshstatus.h
|
||||
llpathfindingobject.h
|
||||
llpathfindingobjectlist.h
|
||||
llphysicsmotion.h
|
||||
llphysicsshapebuilderutil.h
|
||||
llpolymesh.h
|
||||
@@ -1028,7 +1040,6 @@ set(viewer_HEADER_FILES
|
||||
llvopartgroup.h
|
||||
llvosky.h
|
||||
llvosurfacepatch.h
|
||||
llvotextbubble.h
|
||||
llvotree.h
|
||||
llvotreenew.h
|
||||
llvovolume.h
|
||||
@@ -1550,7 +1561,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
|
||||
${LLVFS_LIBRARIES}
|
||||
${LLWINDOW_LIBRARIES}
|
||||
${LLXML_LIBRARIES}
|
||||
${LLXUIXML_LIBRARIES}
|
||||
${LSCRIPT_LIBRARIES}
|
||||
${LLMATH_LIBRARIES}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
@@ -1585,6 +1595,14 @@ if (LINUX)
|
||||
|
||||
set(product ${VIEWER_BRANDING_NAME_CAMELCASE}-${ARCH}-${viewer_VERSION})
|
||||
|
||||
if (FMODEX)
|
||||
if(MANIFEST_LIBRARIES)
|
||||
set(MANIFEST_LIBRARIES "${MANIFEST_LIBRARIES}|${FMODEX_LIBRARY}")
|
||||
else(MANIFEST_LIBRARIES)
|
||||
set(MANIFEST_LIBRARIES "--extra_libraries=${FMODEX_LIBRARY}")
|
||||
endif(MANIFEST_LIBRARIES)
|
||||
endif (FMODEX)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${product}.tar.bz2
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
@@ -1603,6 +1621,7 @@ if (LINUX)
|
||||
--dest=${CMAKE_CURRENT_BINARY_DIR}/packaged
|
||||
--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched
|
||||
--buildtype=${CMAKE_BUILD_TYPE}
|
||||
${MANIFEST_LIBRARIES}
|
||||
DEPENDS secondlife-stripped ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
|
||||
)
|
||||
|
||||
|
||||
421
indra/newview/NACLantispam.cpp
Normal file
421
indra/newview/NACLantispam.cpp
Normal file
@@ -0,0 +1,421 @@
|
||||
/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
* Version 2, December 2004
|
||||
*
|
||||
* Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
*
|
||||
* Everyone is permitted to copy and distribute verbatim or modified
|
||||
* copies of this license document, and changing it is allowed as long
|
||||
* as the name is changed.
|
||||
*
|
||||
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
*
|
||||
* 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "NACLantispam.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llagent.h"
|
||||
#include <time.h>
|
||||
|
||||
U32 NACLAntiSpamRegistry::globalAmount;
|
||||
U32 NACLAntiSpamRegistry::globalTime;
|
||||
bool NACLAntiSpamRegistry::bGlobalQueue;
|
||||
NACLAntiSpamQueue* NACLAntiSpamRegistry::queues[NACLAntiSpamRegistry::QUEUE_MAX] = {0};
|
||||
std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*> NACLAntiSpamRegistry::globalEntries;
|
||||
std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*>::iterator NACLAntiSpamRegistry::it2;
|
||||
|
||||
const std::string COLLISION_SOUNDS[] ={"dce5fdd4-afe4-4ea1-822f-dd52cac46b08","51011582-fbca-4580-ae9e-1a5593f094ec","68d62208-e257-4d0c-bbe2-20c9ea9760bb","75872e8c-bc39-451b-9b0b-042d7ba36cba","6a45ba0b-5775-4ea8-8513-26008a17f873","992a6d1b-8c77-40e0-9495-4098ce539694","2de4da5a-faf8-46be-bac6-c4d74f1e5767","6e3fb0f7-6d9c-42ca-b86b-1122ff562d7d","14209133-4961-4acc-9649-53fc38ee1667","bc4a4348-cfcc-4e5e-908e-8a52a8915fe6","9e5c1297-6eed-40c0-825a-d9bcd86e3193","e534761c-1894-4b61-b20c-658a6fb68157","8761f73f-6cf9-4186-8aaa-0948ed002db1","874a26fd-142f-4173-8c5b-890cd846c74d","0e24a717-b97e-4b77-9c94-b59a5a88b2da","75cf3ade-9a5b-4c4d-bb35-f9799bda7fb2","153c8bf7-fb89-4d89-b263-47e58b1b4774","55c3e0ce-275a-46fa-82ff-e0465f5e8703","24babf58-7156-4841-9a3f-761bdbb8e237","aca261d8-e145-4610-9e20-9eff990f2c12","0642fba6-5dcf-4d62-8e7b-94dbb529d117","25a863e8-dc42-4e8a-a357-e76422ace9b5","9538f37c-456e-4047-81be-6435045608d4","8c0f84c3-9afd-4396-b5f5-9bca2c911c20","be582e5d-b123-41a2-a150-454c39e961c8","c70141d4-ba06-41ea-bcbc-35ea81cb8335","7d1826f4-24c4-4aac-8c2e-eff45df37783","063c97d3-033a-4e9b-98d8-05c8074922cb","00000000-0000-0000-0000-000000000120"};
|
||||
const int COLLISION_SOUNDS_SIZE=29;
|
||||
|
||||
// NaClAntiSpamQueueEntry
|
||||
|
||||
NACLAntiSpamQueueEntry::NACLAntiSpamQueueEntry()
|
||||
{
|
||||
entryTime=0;
|
||||
entryAmount=0;
|
||||
blocked=false;
|
||||
}
|
||||
void NACLAntiSpamQueueEntry::clearEntry()
|
||||
{
|
||||
entryTime=0;
|
||||
entryAmount=0;
|
||||
blocked=false;
|
||||
}
|
||||
U32 NACLAntiSpamQueueEntry::getEntryAmount()
|
||||
{
|
||||
return entryAmount;
|
||||
}
|
||||
U32 NACLAntiSpamQueueEntry::getEntryTime()
|
||||
{
|
||||
return entryTime;
|
||||
}
|
||||
void NACLAntiSpamQueueEntry::updateEntryAmount()
|
||||
{
|
||||
entryAmount++;
|
||||
}
|
||||
void NACLAntiSpamQueueEntry::updateEntryTime()
|
||||
{
|
||||
entryTime=time(0);
|
||||
}
|
||||
void NACLAntiSpamQueueEntry::setBlocked()
|
||||
{
|
||||
blocked=true;
|
||||
}
|
||||
bool NACLAntiSpamQueueEntry::getBlocked()
|
||||
{
|
||||
return blocked;
|
||||
}
|
||||
|
||||
// NaClAntiSpamQueue
|
||||
|
||||
NACLAntiSpamQueue::NACLAntiSpamQueue(U32 time, U32 amount)
|
||||
{
|
||||
queueTime=time;
|
||||
queueAmount=amount;
|
||||
}
|
||||
void NACLAntiSpamQueue::setAmount(U32 amount)
|
||||
{
|
||||
queueAmount=amount;
|
||||
}
|
||||
void NACLAntiSpamQueue::setTime(U32 time)
|
||||
{
|
||||
queueTime=time;
|
||||
}
|
||||
void NACLAntiSpamQueue::clearEntries()
|
||||
{
|
||||
for(it = entries.begin(); it != entries.end(); it++)
|
||||
{
|
||||
it->second->clearEntry();
|
||||
}
|
||||
}
|
||||
void NACLAntiSpamQueue::purgeEntries()
|
||||
{
|
||||
for(it = entries.begin(); it != entries.end(); it++)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
entries.clear();
|
||||
}
|
||||
void NACLAntiSpamQueue::blockEntry(LLUUID& source)
|
||||
{
|
||||
it=entries.find(source.asString());
|
||||
if(it == entries.end())
|
||||
{
|
||||
entries[source.asString()]=new NACLAntiSpamQueueEntry();
|
||||
}
|
||||
entries[source.asString()]->setBlocked();
|
||||
}
|
||||
int NACLAntiSpamQueue::checkEntry(LLUUID& name, U32 multiplier)
|
||||
{
|
||||
it=entries.find(name.asString());
|
||||
if(it != entries.end())
|
||||
{
|
||||
if(it->second->getBlocked()) return 2;
|
||||
U32 eTime=it->second->getEntryTime();
|
||||
U32 currentTime=time(0);
|
||||
if((currentTime-eTime) <= queueTime)
|
||||
{
|
||||
it->second->updateEntryAmount();
|
||||
U32 eAmount=it->second->getEntryAmount();
|
||||
if(eAmount > (queueAmount*multiplier))
|
||||
{
|
||||
it->second->setBlocked();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
it->second->clearEntry();
|
||||
it->second->updateEntryAmount();
|
||||
it->second->updateEntryTime();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entries[name.asString()]=new NACLAntiSpamQueueEntry();
|
||||
entries[name.asString()]->updateEntryAmount();
|
||||
entries[name.asString()]->updateEntryTime();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// NaClAntiSpamRegistry
|
||||
|
||||
static const char* QUEUE_NAME[NACLAntiSpamRegistry::QUEUE_MAX] = {
|
||||
"Chat",
|
||||
"Inventory",
|
||||
"Instant Message",
|
||||
"Calling Card",
|
||||
"Sound",
|
||||
"Sound Preload",
|
||||
"Script Dialog",
|
||||
"Teleport"};
|
||||
|
||||
NACLAntiSpamRegistry::NACLAntiSpamRegistry(U32 time, U32 amount)
|
||||
{
|
||||
globalTime=time;
|
||||
globalAmount=amount;
|
||||
static LLCachedControl<bool> _NACL_AntiSpamGlobalQueue(gSavedSettings,"_NACL_AntiSpamGlobalQueue");
|
||||
bGlobalQueue=_NACL_AntiSpamGlobalQueue;
|
||||
for(int queue = 0; queue < QUEUE_MAX; ++queue)
|
||||
{
|
||||
queues[queue] = new NACLAntiSpamQueue(time,amount);
|
||||
}
|
||||
}
|
||||
const char* NACLAntiSpamRegistry::getQueueName(U32 queue_id)
|
||||
{
|
||||
if(queue_id >= QUEUE_MAX)
|
||||
return "Unknown";
|
||||
return QUEUE_NAME[queue_id];
|
||||
}
|
||||
void NACLAntiSpamRegistry::registerQueues(U32 time, U32 amount)
|
||||
{
|
||||
globalTime=time;
|
||||
globalAmount=amount;
|
||||
static LLCachedControl<bool> _NACL_AntiSpamGlobalQueue(gSavedSettings,"_NACL_AntiSpamGlobalQueue");
|
||||
bGlobalQueue=_NACL_AntiSpamGlobalQueue;
|
||||
for(int queue = 0; queue < QUEUE_MAX; ++queue)
|
||||
{
|
||||
queues[queue] = new NACLAntiSpamQueue(time,amount);
|
||||
}
|
||||
}
|
||||
void NACLAntiSpamRegistry::registerQueue(U32 name, U32 time, U32 amount)
|
||||
{
|
||||
/*
|
||||
it=queues.find(name);
|
||||
if(it == queues.end())
|
||||
{
|
||||
queues[name]=new NACLAntiSpamQueue(time,amount);
|
||||
}
|
||||
*/
|
||||
}
|
||||
void NACLAntiSpamRegistry::setRegisteredQueueTime(U32 name, U32 time)
|
||||
{
|
||||
if(name >= QUEUE_MAX || queues[name] == 0)
|
||||
{
|
||||
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
queues[name]->setTime(time);
|
||||
}
|
||||
void NACLAntiSpamRegistry::setRegisteredQueueAmount(U32 name, U32 amount)
|
||||
{
|
||||
if(name >= QUEUE_MAX || queues[name] == 0)
|
||||
{
|
||||
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
queues[name]->setAmount(amount);
|
||||
}
|
||||
void NACLAntiSpamRegistry::setAllQueueTimes(U32 time)
|
||||
{
|
||||
globalTime=time;
|
||||
for(int queue = 0; queue < QUEUE_MAX; ++queue)
|
||||
queues[queue]->setTime(time);
|
||||
}
|
||||
void NACLAntiSpamRegistry::setAllQueueAmounts(U32 amount)
|
||||
{
|
||||
globalAmount=amount;
|
||||
for(int queue = 0; queue < QUEUE_MAX; ++queue)
|
||||
{
|
||||
if(queue == QUEUE_SOUND || queue == QUEUE_SOUND_PRELOAD)
|
||||
queues[queue]->setAmount(amount*5);
|
||||
else
|
||||
queues[queue]->setAmount(amount);
|
||||
}
|
||||
}
|
||||
void NACLAntiSpamRegistry::clearRegisteredQueue(U32 name)
|
||||
{
|
||||
if(name >= QUEUE_MAX || queues[name] == 0)
|
||||
{
|
||||
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
queues[name]->clearEntries();
|
||||
}
|
||||
void NACLAntiSpamRegistry::purgeRegisteredQueue(U32 name)
|
||||
{
|
||||
if(name >= QUEUE_MAX || queues[name] == 0)
|
||||
{
|
||||
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
queues[name]->purgeEntries();
|
||||
}
|
||||
void NACLAntiSpamRegistry::blockOnQueue(U32 name, LLUUID& source)
|
||||
{
|
||||
if(bGlobalQueue)
|
||||
{
|
||||
NACLAntiSpamRegistry::blockGlobalEntry(source);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(name >= QUEUE_MAX || queues[name] == 0)
|
||||
{
|
||||
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
|
||||
return;
|
||||
}
|
||||
queues[name]->blockEntry(source);
|
||||
}
|
||||
}
|
||||
void NACLAntiSpamRegistry::blockGlobalEntry(LLUUID& source)
|
||||
{
|
||||
it2=globalEntries.find(source.asString());
|
||||
if(it2 == globalEntries.end())
|
||||
{
|
||||
globalEntries[source.asString()]=new NACLAntiSpamQueueEntry();
|
||||
}
|
||||
globalEntries[source.asString()]->setBlocked();
|
||||
}
|
||||
bool NACLAntiSpamRegistry::checkQueue(U32 name, LLUUID& source, U32 multiplier)
|
||||
{
|
||||
if(source.isNull()) return false;
|
||||
if(gAgent.getID() == source) return false;
|
||||
LLViewerObject *obj=gObjectList.findObject(source);
|
||||
if(obj)
|
||||
if(obj->permYouOwner()) return false;
|
||||
|
||||
int result;
|
||||
if(bGlobalQueue)
|
||||
{
|
||||
result=NACLAntiSpamRegistry::checkGlobalEntry(source,multiplier);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(name >= QUEUE_MAX || queues[name] == 0)
|
||||
{
|
||||
LL_ERRS("AntiSpam") << "CODE BUG: Attempting to use a antispam queue that was not created or was outside of the reasonable range of queues. Queue: " << getQueueName(name) << llendl;
|
||||
return false;
|
||||
}
|
||||
result=queues[name]->checkEntry(source,multiplier);
|
||||
}
|
||||
if(result==0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(result==2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gSavedSettings.getBOOL("AntiSpamNotify"))
|
||||
{
|
||||
LLSD args;
|
||||
args["MESSAGE"] = std::string(getQueueName(name))+": Blocked object "+source.asString();
|
||||
LLNotificationsUtil::add("SystemMessageTip", args);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Global queue stoof
|
||||
void NACLAntiSpamRegistry::setGlobalQueue(bool value)
|
||||
{
|
||||
NACLAntiSpamRegistry::purgeAllQueues();
|
||||
bGlobalQueue=value;
|
||||
}
|
||||
void NACLAntiSpamRegistry::setGlobalAmount(U32 amount)
|
||||
{
|
||||
globalAmount=amount;
|
||||
}
|
||||
void NACLAntiSpamRegistry::setGlobalTime(U32 time)
|
||||
{
|
||||
globalTime=time;
|
||||
}
|
||||
void NACLAntiSpamRegistry::clearAllQueues()
|
||||
{
|
||||
if(bGlobalQueue)
|
||||
NACLAntiSpamRegistry::clearGlobalEntries();
|
||||
else
|
||||
for(int queue = 0; queue < QUEUE_MAX; ++queue)
|
||||
{
|
||||
queues[queue]->clearEntries();
|
||||
}
|
||||
}
|
||||
void NACLAntiSpamRegistry::purgeAllQueues()
|
||||
{
|
||||
if(bGlobalQueue)
|
||||
NACLAntiSpamRegistry::purgeGlobalEntries();
|
||||
else
|
||||
for(int queue = 0; queue < QUEUE_MAX; ++queue)
|
||||
{
|
||||
queues[queue]->purgeEntries();
|
||||
}
|
||||
}
|
||||
int NACLAntiSpamRegistry::checkGlobalEntry(LLUUID& name, U32 multiplier)
|
||||
{
|
||||
it2=globalEntries.find(name.asString());
|
||||
if(it2 != globalEntries.end())
|
||||
{
|
||||
if(it2->second->getBlocked()) return 2;
|
||||
U32 eTime=it2->second->getEntryTime();
|
||||
U32 currentTime=time(0);
|
||||
if((currentTime-eTime) <= globalTime)
|
||||
{
|
||||
it2->second->updateEntryAmount();
|
||||
U32 eAmount=it2->second->getEntryAmount();
|
||||
if(eAmount > (globalAmount*multiplier))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
it2->second->clearEntry();
|
||||
it2->second->updateEntryAmount();
|
||||
it2->second->updateEntryTime();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
globalEntries[name.asString()]=new NACLAntiSpamQueueEntry();
|
||||
globalEntries[name.asString()]->updateEntryAmount();
|
||||
globalEntries[name.asString()]->updateEntryTime();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
void NACLAntiSpamRegistry::clearGlobalEntries()
|
||||
{
|
||||
for(it2 = globalEntries.begin(); it2 != globalEntries.end(); it2++)
|
||||
{
|
||||
it2->second->clearEntry();
|
||||
}
|
||||
}
|
||||
void NACLAntiSpamRegistry::purgeGlobalEntries()
|
||||
{
|
||||
for(it2 = globalEntries.begin(); it2 != globalEntries.end(); it2++)
|
||||
{
|
||||
delete it2->second;
|
||||
it2->second = 0;
|
||||
}
|
||||
globalEntries.clear();
|
||||
}
|
||||
bool NACLAntiSpamRegistry::handleNaclAntiSpamGlobalQueueChanged(const LLSD& newvalue)
|
||||
{
|
||||
setGlobalQueue(newvalue.asBoolean());
|
||||
return true;
|
||||
}
|
||||
bool NACLAntiSpamRegistry::handleNaclAntiSpamTimeChanged(const LLSD& newvalue)
|
||||
{
|
||||
setAllQueueTimes(newvalue.asInteger());
|
||||
return true;
|
||||
}
|
||||
bool NACLAntiSpamRegistry::handleNaclAntiSpamAmountChanged(const LLSD& newvalue)
|
||||
{
|
||||
setAllQueueAmounts(newvalue.asInteger());
|
||||
return true;
|
||||
}
|
||||
|
||||
107
indra/newview/NACLantispam.h
Normal file
107
indra/newview/NACLantispam.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
* Version 2, December 2004
|
||||
*
|
||||
* Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
*
|
||||
* Everyone is permitted to copy and distribute verbatim or modified
|
||||
* copies of this license document, and changing it is allowed as long
|
||||
* as the name is changed.
|
||||
*
|
||||
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
*
|
||||
* 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
*/
|
||||
|
||||
#ifndef NACLANTISPAM_H
|
||||
#define NACLANTISPAM_H
|
||||
#include <boost/tr1/unordered_map.hpp>
|
||||
#include "stdtypes.h"
|
||||
#include "lluuid.h"
|
||||
class NACLAntiSpamQueueEntry
|
||||
{
|
||||
friend class NACLAntiSpamQueue;
|
||||
friend class NACLAntiSpamRegistry;
|
||||
protected:
|
||||
NACLAntiSpamQueueEntry();
|
||||
void clearEntry();
|
||||
U32 getEntryAmount();
|
||||
U32 getEntryTime();
|
||||
void updateEntryAmount();
|
||||
void updateEntryTime();
|
||||
bool getBlocked();
|
||||
void setBlocked();
|
||||
private:
|
||||
U32 entryAmount;
|
||||
U32 entryTime;
|
||||
bool blocked;
|
||||
};
|
||||
class NACLAntiSpamQueue
|
||||
{
|
||||
friend class NACLAntiSpamRegistry;
|
||||
protected:
|
||||
NACLAntiSpamQueue(U32 time, U32 amount);
|
||||
void setAmount(U32 amount);
|
||||
void setTime(U32 time);
|
||||
void clearEntries();
|
||||
void purgeEntries();
|
||||
void blockEntry(LLUUID& source);
|
||||
int checkEntry(LLUUID& source, U32 multiplier);
|
||||
private:
|
||||
std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*> entries;
|
||||
std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*>::iterator it;
|
||||
U32 queueAmount;
|
||||
U32 queueTime;
|
||||
};
|
||||
class NACLAntiSpamRegistry
|
||||
{
|
||||
public:
|
||||
NACLAntiSpamRegistry(U32 time=2, U32 amount=10);
|
||||
static void registerQueues(U32 time=2, U32 amount=10);
|
||||
static void registerQueue(U32 name, U32 time, U32 amount);
|
||||
static void setRegisteredQueueTime(U32 name, U32 time);
|
||||
static void setRegisteredQueueAmount(U32 name,U32 amount);
|
||||
static void setAllQueueTimes(U32 amount);
|
||||
static void setAllQueueAmounts(U32 time);
|
||||
static bool checkQueue(U32 name, LLUUID& source, U32 multiplier=1);
|
||||
static bool handleNaclAntiSpamGlobalQueueChanged(const LLSD& newvalue);
|
||||
static bool handleNaclAntiSpamTimeChanged(const LLSD& newvalue);
|
||||
static bool handleNaclAntiSpamAmountChanged(const LLSD& newvalue);
|
||||
static void clearRegisteredQueue(U32 name);
|
||||
static void purgeRegisteredQueue(U32 name);
|
||||
static void clearAllQueues();
|
||||
static void purgeAllQueues();
|
||||
static void setGlobalQueue(bool value);
|
||||
static void setGlobalAmount(U32 amount);
|
||||
static void setGlobalTime(U32 time);
|
||||
static void blockOnQueue(U32 name,LLUUID& owner_id);
|
||||
enum {
|
||||
QUEUE_CHAT,
|
||||
QUEUE_INVENTORY,
|
||||
QUEUE_IM,
|
||||
QUEUE_CALLING_CARD,
|
||||
QUEUE_SOUND,
|
||||
QUEUE_SOUND_PRELOAD,
|
||||
QUEUE_SCRIPT_DIALOG,
|
||||
QUEUE_TELEPORT,
|
||||
QUEUE_MAX
|
||||
};
|
||||
private:
|
||||
static const char* getQueueName(U32 queue_id);
|
||||
static NACLAntiSpamQueue* queues[QUEUE_MAX];
|
||||
static std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*> globalEntries;
|
||||
static std::tr1::unordered_map<std::string,NACLAntiSpamQueueEntry*>::iterator it2;
|
||||
static U32 globalTime;
|
||||
static U32 globalAmount;
|
||||
static bool bGlobalQueue;
|
||||
|
||||
static int checkGlobalEntry(LLUUID& source, U32 multiplier);
|
||||
static void clearGlobalEntries();
|
||||
static void purgeGlobalEntries();
|
||||
static void blockGlobalEntry(LLUUID& source);
|
||||
};
|
||||
|
||||
extern const std::string COLLISION_SOUNDS[];
|
||||
extern const int COLLISION_SOUNDS_SIZE;
|
||||
|
||||
#endif //NACLANTISPAM_H
|
||||
@@ -14,7 +14,7 @@ key Key type. Use NULL_KEY to test for empty keys
|
||||
vector Vector type of 3 floats. Used to represent 3D motion, Euler angles, and color.:Access components by .x, .y. or .z
|
||||
rotation Rotation type of 4 floats. Used to represent rotation.:Access components by .x, .y., .z, or .w
|
||||
list List of various data types
|
||||
quaternion Rotation type of 4 floats. Used to represent rotation.:Access components by .x, .y, .z, or .w
|
||||
quaternion Rotation type of 4 floats. Used to represent rotation.:Access components by .x, .y, .z, or .w
|
||||
|
||||
# events
|
||||
[word 0, .3, .5]
|
||||
@@ -52,7 +52,7 @@ changed changed( integer change ):Triggered various event change the task:(tes
|
||||
remote_data remote_data(integer event_type, key channel, key message_id, string sender,integer idata, string sdata):Triggered by various XML-RPC calls (event_type will be one of REMOTE_DATA_CHANNEL, REMOTE_DATA_REQUEST, REMOTE_DATA_REPLY)
|
||||
http_response http_response(key request_id, integer status, list metadata, string body):Triggered when task receives a response to one of its llHTTPRequests
|
||||
http_request http_request(key id, string method, string body):Triggered when task receives an http request against a public URL
|
||||
transaction_result transaction_result(key id, integer success, string data):Triggered when task receives asynchronous data.
|
||||
transaction_result transaction_result(key id, integer success, string data):Triggered when task receives asynchronous data.
|
||||
path_update path_update(integer type, list reserved):Triggered when the state of a pathfinder character changes. Note; "list reserved" is not currently used
|
||||
|
||||
# integer constants
|
||||
@@ -70,9 +70,10 @@ STATUS_BLOCK_GRAB_OBJECT This status flag keeps the object from being moved by g
|
||||
STATUS_DIE_AT_EDGE Passed in the llSetStatus library function. If TRUE, objects that reach the edge of the world just die:rather than teleporting back to the owner
|
||||
STATUS_RETURN_AT_EDGE Passed in the llSetStatus library function. If TRUE, script rezzed objects that reach the edge of the world:are returned rather than killed:STATUS_RETURN_AT_EDGE trumps STATUS_DIE_AT_EDGE if both are set
|
||||
STATUS_CAST_SHADOWS Passed in the llSetStatus library function. If TRUE, object casts shadows on other objects
|
||||
|
||||
AGENT Passed in llSensor library function to look for other Agents; DEPRECATED: Use AGENT_BY_LEGACY_NAME
|
||||
AGENT_BY_USERNAME Passed in llSensor library function to look for other Agents by username
|
||||
AGENT_BY_LEGACY_NAME Passed in llSensor library function to look for other Agents by legacy name
|
||||
AGENT_BY_LEGACY_NAME Passed in llSensor library function to look for other Agents by legacy name
|
||||
AGENT_BY_USERNAME Passed in llSensor library function to look for other Agents by username
|
||||
ACTIVE Passed in llSensor library function to look for moving objects
|
||||
PASSIVE Passed in llSensor library function to look for objects that aren't moving
|
||||
SCRIPTED Passed in llSensor library function to look for scripted objects
|
||||
@@ -171,10 +172,10 @@ OBJECT_VELOCITY Used with llGetObjectDetails to get an object's velocity
|
||||
OBJECT_OWNER Used with llGetObjectDetails to get an object's owner's key. Will be NULL_KEY if group owned
|
||||
OBJECT_GROUP Used with llGetObjectDetails to get an object's group's key
|
||||
OBJECT_CREATOR Used with llGetObjectDetails to get an object's creator's key
|
||||
OBJECT_RUNNING_SCRIPT_COUNT Used with llGetObjectDetails to get an object's velocity.
|
||||
OBJECT_TOTAL_SCRIPT_COUNT Used with llGetObjectDetails to get an object's owner's key. Will be NULL_KEY if group owned.
|
||||
OBJECT_SCRIPT_MEMORY Used with llGetObjectDetails to get an object's group's key.
|
||||
OBJECT_SCRIPT_TIME Used with llGetObjectDetails to get an object's creator's key.
|
||||
OBJECT_RUNNING_SCRIPT_COUNT Gets the number of running scripts attached to the object or agent
|
||||
OBJECT_TOTAL_SCRIPT_COUNT Gets the number of scripts, both running and stopped, attached to the object or agent.
|
||||
OBJECT_SCRIPT_MEMORY Gets the total amount of script memory allocated to the object or agent, in bytes.
|
||||
OBJECT_SCRIPT_TIME Gets the total amount of average script CPU time used by the object or agent, in seconds.
|
||||
OBJECT_PRIM_EQUIVALENCE Gets the prim equivalence of the object.
|
||||
OBJECT_SERVER_COST Used with llGetObjectDetails to get the server cost.
|
||||
OBJECT_STREAMING_COST Used with llGetObjectDetails to get the streaming (download) cost.
|
||||
@@ -185,8 +186,8 @@ VEHICLE_TYPE_NONE Used with llSetVehicleType to turn off vehicle support
|
||||
VEHICLE_TYPE_SLED Used with llSetVehicleType to make a simple vehicle that bumps along the ground, and likes to move along its local x-axis
|
||||
VEHICLE_TYPE_CAR Used with llSetVehicleType to make a vehicle that bounces along the ground but needs the motors to be driven from external controls or timer events
|
||||
VEHICLE_TYPE_BOAT Used with llSetVehicleType to make a vehicle that hovers over water with lots of friction and some angular deflection
|
||||
VEHICLE_TYPE_AIRPLANE Used with llSetVehicleType to make a vehicle that uses linear deflection for lift, and banking to turn, but doesn't hover
|
||||
VEHICLE_TYPE_BALLOON Used with llSetVehicleType to make a vehicle that uses hover, and friction, but doesn't use deflection
|
||||
VEHICLE_TYPE_AIRPLANE Used with llSetVehicleType to make a vehicle that uses linear deflection for lift, and banking to turn, but doesn't hover
|
||||
VEHICLE_TYPE_BALLOON Used with llSetVehicleType to make a vehicle that uses hover, and friction, but doesn't use deflection
|
||||
|
||||
VEHICLE_REFERENCE_FRAME Rotation of vehicle axes relative to local frame
|
||||
|
||||
@@ -289,14 +290,14 @@ ATTACH_LLLEG Passed to llAttachToAvatar to attach task to left lower leg
|
||||
ATTACH_BELLY Passed to llAttachToAvatar to attach task to belly
|
||||
ATTACH_LEFT_PEC Passed to llAttachToAvatar to attach task to left pectoral
|
||||
ATTACH_RIGHT_PEC Passed to llAttachToAvatar to attach task to right pectoral
|
||||
ATTACH_HUD_BOTTOM Passed to llAttachToAvatar to attach task to bottom hud area
|
||||
ATTACH_HUD_BOTTOM_LEFT Passed to llAttachToAvatar to attach task to bottom left hud area
|
||||
ATTACH_HUD_BOTTOM_RIGHT Passed to llAttachToAvatar to attach task to bottom right hud area
|
||||
ATTACH_HUD_CENTER_1 Passed to llAttachToAvatar to attach task to center 1 hud area
|
||||
ATTACH_HUD_CENTER_2 Passed to llAttachToAvatar to attach task to center 2 hud area
|
||||
ATTACH_HUD_TOP_RIGHT Passed to llAttachToAvatar to attach task to top right hud area
|
||||
ATTACH_HUD_TOP_CENTER Passed to llAttachToAvatar to attach task to top center hud area
|
||||
ATTACH_HUD_TOP_LEFT Passed to llAttachToAvatar to attach task to top left hud area
|
||||
ATTACH_HUD_CENTER_1 Passed to llAttachToAvatar to attach task to center 1 hud area
|
||||
ATTACH_HUD_BOTTOM_LEFT Passed to llAttachToAvatar to attach task to bottom left hud area
|
||||
ATTACH_HUD_BOTTOM Passed to llAttachToAvatar to attach task to bottom hud area
|
||||
ATTACH_HUD_BOTTOM_RIGHT Passed to llAttachToAvatar to attach task to bottom right hud area
|
||||
ATTACH_HUD_TOP_RIGHT Passed to llAttachToAvatar to attach task to top right hud area
|
||||
##The following attachment points exist only as numbers thus far, but will be ready when the time comes.
|
||||
#ATTACH_NECK Passed to llAttachToAvatar to attach task to neck
|
||||
#ATTACH_ROOT Passed to llAttachToAvatar to attach task to avatar center/root
|
||||
@@ -369,29 +370,28 @@ REMOTE_DATA_REPLY Value of event_type in remote_event if XML-RPC reply is receiv
|
||||
PRIM_NAME For primitive name (from server v1.40 onwards). Followed by a string.
|
||||
PRIM_DESC For primitive description (from server v1.40 onwards). Followed by a string.
|
||||
PRIM_TYPE Followed by PRIM_TYPE_BOX, PRIM_TYPE_CYLINDER, PRIM_TYPE_PRISM, PRIM_TYPE_SPHERE, PRIM_TYPE_TORUS, PRIM_TYPE_TUBE, or PRIM_TYPE_SCULPT and their arguments
|
||||
PRIM_SLICE Get and set the 'slice' parameter of all shapes. Takes a vector parameter of the form <start_slice, end_slice, 0>
|
||||
PRIM_PHYSICS_SHAPE_TYPE For primitive physics shape type. Followed with either PRIM_PHYSICS_SHAPE_PRIM, PRIM_PHYSICS_SHAPE_NONE or PRIM_PHYSICS_SHAPE_CONVEX.
|
||||
PRIM_MATERIAL Followed by PRIM_MATERIAL_STONE, PRIM_MATERIAL_METAL, PRIM_MATERIAL_GLASS, PRIM_MATERIAL_WOOD, PRIM_MATERIAL_FLESH, PRIM_MATERIAL_PLASTIC, or PRIM_MATERIAL_RUBBER
|
||||
PRIM_PHYSICS Sets physics to TRUE or FALSE
|
||||
PRIM_FLEXIBLE Followed by TRUE or FALSE, integer softness, float gravity, float friction, float wind, float tension, and vector force
|
||||
PRIM_POINT_LIGHT Followed by TRUE or FALSE, vector color, float intensity, float radius, float falloff
|
||||
PRIM_TEMP_ON_REZ Sets temporay on rez to TRUE or FALSE
|
||||
PRIM_TEMP_ON_REZ Sets temporary on rez to TRUE or FALSE
|
||||
PRIM_PHANTOM Sets phantom to TRUE or FALSE
|
||||
PRIM_CAST_SHADOWS DEPRECATED. Takes 1 parameter, an integer, but has no effect when set and always returns 0 if used in llGetPrimitiveParams
|
||||
PRIM_POSITION Sets primitive position to a vector position
|
||||
PRIM_POS_LOCAL Sets the prim's local position
|
||||
PRIM_SIZE Sets primitive size to a vector size
|
||||
PRIM_ROTATION Sets primitive rotation
|
||||
PRIM_ROT_LOCAL Sets the prim's local rotation
|
||||
PRIM_TEXT Used to get or set the object's floating text.
|
||||
PRIM_TEXTURE Followed by an integer face, key id, vector repeats, vector offsets,:and float rotation in radians
|
||||
PRIM_TEXT For primitive hovertext. Followed by a string, a vector color and a float alpha
|
||||
PRIM_COLOR Followed by an integer face, vector color, and float alpha
|
||||
PRIM_BUMP_SHINY Followed by an integer face, one of PRIM_SHINY_NONE, PRIM_SHINY_LOW,:PRIM_SHINY_MEDIUM, or PRIM_SHINY_HIGH,:and one of PRIM_BUMP_NONE, PRIM_BUMP_BRIGHT, PRIM_BUMP_DARK, etc
|
||||
PRIM_FULLBRIGHT Followed by an integer face, and TRUE or FALSE
|
||||
PRIM_TEXGEN Followed by an integer face, and one of PRIM_TEXGEN_DEFAULT or PRIM_TEXGEN_PLANAR
|
||||
PRIM_GLOW Followed by an integer face, and a float from 0.0 to 1.0 specifying glow amount
|
||||
PRIM_OMEGA Makes the object spin at the specified axis and rate
|
||||
PRIM_POS_LOCAL Sets the prim's local position
|
||||
PRIM_ROT_LOCAL Sets the prim's local rotation
|
||||
PRIM_OMEGA Makes the object spin at the specified axis and rate
|
||||
PRIM_LINK_TARGET Used to get or set multiple links with a single PrimParameters call
|
||||
PRIM_SLICE Get and set the 'slice' parameter of all shapes. Takes a vector parameter of the form <start_slice, end_slice, 0>
|
||||
|
||||
PROFILE_NONE Disables profiling
|
||||
PROFILE_SCRIPT_MEMORY Enables memory profiling
|
||||
@@ -454,9 +454,10 @@ PRIM_SCULPT_TYPE_MASK Mask used to determine stitching type
|
||||
PRIM_SCULPT_FLAG_INVERT Flag to specify that the surface normals should be inverted
|
||||
PRIM_SCULPT_FLAG_MIRROR Flag to specify that the prim should be reflected along X axis
|
||||
|
||||
PRIM_PHYSICS_SHAPE_TYPE For primitive physics shape type. Followed with either PRIM_PHYSICS_SHAPE_PRIM, PRIM_PHYSICS_SHAPE_NONE or PRIM_PHYSICS_SHAPE_CONVEX.
|
||||
PRIM_PHYSICS_SHAPE_PRIM Use the normal prim shape for physics (this is the default for all non-mesh objects)
|
||||
PRIM_PHYSICS_SHAPE_CONVEX Ignore this prim in the physics shape. This cannot be applied to the root prim.
|
||||
PRIM_PHYSICS_SHAPE_NONE Use the convex hull of the prim shape for physics (this is the default for mesh objects)
|
||||
PRIM_PHYSICS_SHAPE_CONVEX Ignore this prim in the physics shape. This cannot be applied to the root prim.
|
||||
|
||||
MASK_BASE Base permissions
|
||||
MASK_OWNER Owner permissions
|
||||
@@ -526,19 +527,13 @@ REGION_FLAG_BLOCK_FLY Used with llGetRegionFlags to find if a region blocks f
|
||||
REGION_FLAG_ALLOW_DIRECT_TELEPORT Used with llGetRegionFlags to find if a region allows direct teleports
|
||||
REGION_FLAG_RESTRICT_PUSHOBJECT Used with llGetRegionFlags to find if a region restricts llPushObject() calls
|
||||
|
||||
ESTATE_ACCESS_ALLOWED_AGENT_ADD Used with llManageEstateAccess to add an agent to this estate's allowed residents list.
|
||||
ESTATE_ACCESS_ALLOWED_AGENT_REMOVE Used with llManageEstateAccess to remove an agent from this estate's allowed residents list.
|
||||
ESTATE_ACCESS_ALLOWED_GROUP_ADD Used with llManageEstateAccess to add a group to this estate's allowed groups list.
|
||||
ESTATE_ACCESS_ALLOWED_GROUP_REMOVE Used with llManageEstateAccess to remove a group from this estate's allowed groups list.
|
||||
ESTATE_ACCESS_BANNED_AGENT_ADD Used with llManageEstateAccess to add an agent to this estate's banned residents list.
|
||||
ESTATE_ACCESS_BANNED_AGENT_REMOVE Used with llManageEstateAccess to remove an agent from this estate's banned residents list.
|
||||
|
||||
HTTP_METHOD Used with llHTTPRequest to specify the method, "GET", "POST", "PUT", or "DELETE"
|
||||
HTTP_MIMETYPE Used with llHTTPRequest to specify the MIME type, defaults to "text/plain"
|
||||
HTTP_BODY_MAXLENGTH Used with llHTTPRequest to specify the maximum response body to return
|
||||
HTTP_VERIFY_CERT Used with llHTTPRequest to specify SSL certificate verification
|
||||
HTTP_BODY_TRUNCATED Used with http_response to indicate truncation point in bytes
|
||||
HTTP_VERBOSE_THROTTLE Used with llHTTPRequest to shout error messages to DEBUG_CHANNEL if the outgoing request rate exceeds the server limit.
|
||||
HTTP_BODY_MAXLENGTH Used with llHTTPRequest to specify the maximum body size for the date returned from the request. Mono scripts can request from 1byte to 16k, non-mono scripts can request from 1byte to 4k. The default is 2k.
|
||||
|
||||
PARCEL_COUNT_TOTAL Used with llGetParcelPrimCount to get the total number of prims on the parcel
|
||||
PARCEL_COUNT_OWNER Used with llGetParcelPrimCount to get the number of prims on the parcel owned by the owner
|
||||
@@ -613,7 +608,132 @@ STATUS_NOT_SUPPORTED Feature not supported
|
||||
STATUS_INTERNAL_ERROR An internal error occurred
|
||||
STATUS_WHITELIST_FAILED URL failed to pass whitelist
|
||||
|
||||
# windlight constants
|
||||
RC_DATA_FLAGS Option for llCastRay() followed with a bitwise combination of RC_GET_NORMAL, RC_GET_ROOT_KEY and RC_GET_LINK_NUM.
|
||||
RC_DETECT_PHANTOM Option for llCastRay() followed with TRUE to detect phantom AND volume detect objects, FASLE otherwise.
|
||||
RC_GET_LINK_NUM Flag used in the RC_DATA_FLAGS mask to get link numbers in llCastRay() results.
|
||||
RC_GET_NORMAL Flag used in the RC_DATA_FLAGS mask to get hit normals in llCastRay() results.
|
||||
RC_GET_ROOT_KEY Flag used in the RC_DATA_FLAGS mask to get root keys in llCastRay() results.
|
||||
RC_MAX_HITS Option for llCastRay() followed with an integer specifying the maximum number of hits to return (must be <= 256).
|
||||
RC_REJECT_TYPES Option for llCastRay() used to ignore specific types of objects, followed with a bitwise combination of RC_REJECT_AGENTS, RC_REJECT_PHYSICAL, RC_REJECT_NONPHYSICAL and RC_REJECT_LAND.
|
||||
RC_REJECT_AGENTS Flag used in the RC_REJECT_TYPES mask to reject agents in llCastRay().
|
||||
RC_REJECT_PHYSICAL Flag used in the RC_REJECT_TYPES mask to reject physical objects in llCastRay().
|
||||
RC_REJECT_NONPHYSICAL Flag used in the RC_REJECT_TYPES mask to reject non-physical objects in llCastRay().
|
||||
RC_REJECT_LAND Flag used in the RC_REJECT_TYPES mask to reject land in llCastRay().
|
||||
|
||||
RCERR_CAST_TIME_EXCEEDED Returned by llCastRay() when the raycast failed because the parcel or agent has exceeded the maximum time allowed for raycasting.
|
||||
RCERR_SIM_PERF_LOW Returned by llCastRay() when the raycast failed because simulator performance is low.
|
||||
RCERR_UNKNOWN Returned by llCastRay() when the raycast failed for an unspecified reason.
|
||||
|
||||
ESTATE_ACCESS_ALLOWED_AGENT_ADD Used with llManageEstateAccess to add an agent to this estate's allowed residents list.
|
||||
ESTATE_ACCESS_ALLOWED_AGENT_REMOVE Used with llManageEstateAccess to remove an agent from this estate's allowed residents list.
|
||||
ESTATE_ACCESS_ALLOWED_GROUP_ADD Used with llManageEstateAccess to add a group to this estate's allowed groups list.
|
||||
ESTATE_ACCESS_ALLOWED_GROUP_REMOVE Used with llManageEstateAccess to remove a group from this estate's allowed groups list.
|
||||
ESTATE_ACCESS_BANNED_AGENT_ADD Used with llManageEstateAccess to add an agent to this estate's banned residents list.
|
||||
ESTATE_ACCESS_BANNED_AGENT_REMOVE Used with llManageEstateAccess to remove an agent from this estate's banned residents list.
|
||||
|
||||
DENSITY For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the density.
|
||||
FRICTION For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the friction.
|
||||
RESTITUTION For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the restitution.
|
||||
GRAVITY_MULTIPLIER For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the gravity multiplier.
|
||||
|
||||
KFM_COMMAND Option for llSetKeyframedMotion(), followed by one of KFM_CMD_STOP, KFM_CMD_PLAY, KFM_CMD_PAUSE. Note that KFM_COMMAND must be the only option in the list, and cannot be specified in the same function call that sets the keyframes list.
|
||||
KFM_CMD_PLAY Option for llSetKeyframedMotion(), used after KFM_COMMAND to play the motion.
|
||||
KFM_CMD_STOP Option for llSetKeyframedMotion(), used after KFM_COMMAND to stop the motion.
|
||||
KFM_CMD_PAUSE Option for llSetKeyframedMotion(), used after KFM_COMMAND to pause the motion.
|
||||
KFM_CMD_SET_MODE TODO: add documentation
|
||||
KFM_MODE Option for llSetKeyframedMotion(), used to specify the playback mode, followed by one of KFM_FORWARD, KFM_LOOP, KFM_PING_PONG or KFM_REVERSE.
|
||||
KFM_FORWARD Option for llSetKeyframedMotion(), used after KFM_MODE to specify the forward playback mode.
|
||||
KFM_LOOP Option for llSetKeyframedMotion(), used after KFM_MODE to specify the loop playback mode.
|
||||
KFM_PING_PONG Option for llSetKeyframedMotion(), used after KFM_MODE to specify the ping pong playback mode.
|
||||
KFM_REVERSE Option for llSetKeyframedMotion(), used after KFM_MODE to specify the reverse playback mode.
|
||||
KFM_DATA Option for llSetKeyframedMotion(), followed by a bitwise combination of KFM_TRANSLATION and KFM_ROTATION. If you specify one or the other, you should only include translations or rotations in your keyframe list.
|
||||
KFM_ROTATION Option for llSetKeyframedMotion(), used after KFM_DATA, possibly as a bitwise combination with KFM_TRANSLATION.
|
||||
KFM_TRANSLATION Option for llSetKeyframedMotion(), used after KFM_DATA, possibly as a bitwise combination with KFM_ROTATION.
|
||||
|
||||
CHARACTER_CMD_STOP TODO: add documentation
|
||||
CHARACTER_CMD_JUMP TODO: add documentation
|
||||
|
||||
CHARACTER_DESIRED_SPEED TODO: add documentation
|
||||
CHARACTER_RADIUS TODO: add documentation
|
||||
CHARACTER_LENGTH TODO: add documentation
|
||||
CHARACTER_ORIENTATION TODO: add documentation
|
||||
CHARACTER_AVOIDANCE_MODE TODO: add documentation
|
||||
PURSUIT_OFFSET TODO: add documentation
|
||||
REQUIRE_LINE_OF_SIGHT TODO: add documentation
|
||||
PURSUIT_FUZZ_FACTOR TODO: add documentation
|
||||
PURSUIT_INTERCEPT TODO: add documentation
|
||||
FORCE_DIRECT_PATH TODO: add documentation
|
||||
VERTICAL TODO: add documentation
|
||||
HORIZONTAL TODO: add documentation
|
||||
AVOID_CHARACTERS TODO: add documentation
|
||||
AVOID_DYNAMIC_OBSTACLES TODO: add documentation
|
||||
|
||||
PU_EVADE_HIDDEN Triggered when an llEvade character thinks it has hidden from its pursuer.
|
||||
PU_EVADE_SPOTTED Triggered when an llEvade character switches from hiding to running
|
||||
PU_FAILURE_INVALID_GOAL Goal is not on the navigation-mesh and cannot be reached.
|
||||
PU_FAILURE_INVALID_START Character cannot navigate from the current location - e.g., the character is off the navmesh or too high above it.
|
||||
PU_FAILURE_NO_VALID_DESTINATION There's no good place for the character to go - e.g., it is patrolling and all the patrol points are now unreachable.
|
||||
PU_FAILURE_OTHER Unknown failure
|
||||
PU_FAILURE_TARGET_GONE Target (for llPursue or llEvade) can no longer be tracked - e.g., it left the region or is an avatar that is now more than about 30m outside the region.
|
||||
PU_FAILURE_UNREACHABLE Goal is no longer reachable for some reason - e.g., an obstacle blocks the path.
|
||||
PU_GOAL_REACHED Character has reached the goal and will stop or choose a new goal (if wandering).
|
||||
PU_SLOWDOWN_DISTANCE_REACHED Character is near current goal.
|
||||
|
||||
CHARACTER_TYPE TODO: add documentation
|
||||
CHARACTER_TYPE_A TODO: add documentation
|
||||
CHARACTER_TYPE_B TODO: add documentation
|
||||
CHARACTER_TYPE_C TODO: add documentation
|
||||
CHARACTER_TYPE_D TODO: add documentation
|
||||
CHARACTER_TYPE_NONE TODO: add documentation
|
||||
|
||||
TRAVERSAL_TYPE TODO: add documentation
|
||||
TRAVERSAL_TYPE_SLOW TODO: add documentation
|
||||
TRAVERSAL_TYPE_FAST TODO: add documentation
|
||||
TRAVERSAL_TYPE_NONE TODO: add documentation
|
||||
|
||||
CHARACTER_MAX_ACCEL TODO: add documentation
|
||||
CHARACTER_MAX_DECEL TODO: add documentation
|
||||
CHARACTER_MAX_ANGULAR_SPEED TODO: add documentation
|
||||
CHARACTER_MAX_ANGULAR_ACCEL TODO: add documentation
|
||||
CHARACTER_TURN_SPEED_MULTIPLIER TODO: add documentation
|
||||
CHARACTER_DESIRED_TURN_SPEED TODO: add documentation
|
||||
CHARACTER_MAX_TURN_RADIUS TODO: add documentation
|
||||
# --- OpenSim and Aurora-Sim constants Below ---
|
||||
# OpenSim Constants (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\LSL_Constants.cs)
|
||||
# Constants for cmWindlight (\OpenSim\Region\ScriptEngine\Shared\Api\Runtime\CM_Constants.cs)
|
||||
CHANGED_ANIMATION OpenSim change event animation change detection.
|
||||
# osGetRegionStats
|
||||
STATS_TIME_DILATION returned value from osGetRegionStats(), 1st of 21 items in returned list.
|
||||
STATS_SIM_FPS returned value from osGetRegionStats(), 2nd of 21 items in returned list.
|
||||
STATS_PHYSICS_FPS returned value from osGetRegionStats(), 3rd of 21 items in returned list.
|
||||
STATS_AGENT_UPDATES returned value from osGetRegionStats(), 4th of 21 items in returned list.
|
||||
STATS_ROOT_AGENTS returned value from osGetRegionStats(), 5th of 21 items in returned list.
|
||||
STATS_CHILD_AGENTS returned value from osGetRegionStats(), 6th of 21 items in returned list.
|
||||
STATS_TOTAL_PRIMS returned value from osGetRegionStats(), 7th of 21 items in returned list.
|
||||
STATS_ACTIVE_PRIMS returned value from osGetRegionStats(), 8th of 21 items in returned list.
|
||||
STATS_FRAME_MS returned value from osGetRegionStats(), 9th of 21 items in returned list.
|
||||
STATS_NET_MS returned value from osGetRegionStats(), 10th of 21 items in returned list.
|
||||
STATS_PHYSICS_MS returned value from osGetRegionStats(), 11th of 21 items in returned list.
|
||||
STATS_IMAGE_MS returned value from osGetRegionStats(), 12th of 21 items in returned list.
|
||||
STATS_OTHER_MS returned value from osGetRegionStats(), 13th of 21 items in returned list.
|
||||
STATS_IN_PACKETS_PER_SECOND returned value from osGetRegionStats(), 14th of 21 items in returned list.
|
||||
STATS_OUT_PACKETS_PER_SECOND returned value from osGetRegionStats(), 15th of 21 items in returned list.
|
||||
STATS_UNACKED_BYTES returned value from osGetRegionStats(), 16th of 21 items in returned list.
|
||||
STATS_AGENT_MS returned value from osGetRegionStats(), 17th of 21 items in returned list.
|
||||
STATS_PENDING_DOWNLOADS returned value from osGetRegionStats(), 18th of 21 items in returned list.
|
||||
STATS_PENDING_UPLOADS returned value from osGetRegionStats(), 19th of 21 items in returned list.
|
||||
STATS_ACTIVE_SCRIPTS returned value from osGetRegionStats(), 20th of 21 items in returned list.
|
||||
STATS_SCRIPT_LPS returned value from osGetRegionStats(), 21st of 21 items in returned list.
|
||||
# OpenSim NPC
|
||||
OS_NPC_FLY used by osNPC.
|
||||
OS_NPC_NO_FLY used by osNPC.
|
||||
OS_NPC_LAND_AT_TARGET used by osNPC.
|
||||
OS_NPC_SIT_NOW used by osNPC.
|
||||
OS_NPC_CREATOR_OWNED used by osNPC.
|
||||
OS_NPC_NOT_OWNED used by osNPC.
|
||||
OS_NPC_SENSE_AS_AGENT used by osNPC.
|
||||
OS_NPC_RUNNING used by osNPC.
|
||||
# Windlight/Lightshare
|
||||
WL_WATER_COLOR Windlight Water Colour
|
||||
WL_WATER_FOG_DENSITY_EXPONENT Windlight Water Fog Density Exponent
|
||||
WL_UNDERWATER_FOG_MODIFIER Windlight Underwater Fog Modifier
|
||||
@@ -651,112 +771,28 @@ WL_CLOUD_SCROLL_Y Windlight Cloud Scroll Y
|
||||
WL_CLOUD_SCROLL_Y_LOCK Windlight Cloud Scroll Y Lock
|
||||
WL_CLOUD_SCROLL_X_LOCK Windlight Cloud Scroll X Lock
|
||||
WL_DRAW_CLASSIC_CLOUDS Windlight Draw Classic Clouds
|
||||
|
||||
# keyframe constants
|
||||
KFM_COMMAND Option for llSetKeyframedMotion(), followed by one of KFM_CMD_STOP, KFM_CMD_PLAY, KFM_CMD_PAUSE. Note that KFM_COMMAND must be the only option in the list, and cannot be specified in the same function call that sets the keyframes list.
|
||||
KFM_MODE Option for llSetKeyframedMotion(), used to specify the playback mode, followed by one of KFM_FORWARD, KFM_LOOP, KFM_PING_PONG or KFM_REVERSE.
|
||||
KFM_DATA Option for llSetKeyframedMotion(), followed by a bitwise combination of KFM_TRANSLATION and KFM_ROTATION. If you specify one or the other, you should only include translations or rotations in your keyframe list.
|
||||
KFM_FORWARD Option for llSetKeyframedMotion(), used after KFM_MODE to specify the forward playback mode.
|
||||
KFM_LOOP Option for llSetKeyframedMotion(), used after KFM_MODE to specify the loop playback mode.
|
||||
KFM_PING_PONG Option for llSetKeyframedMotion(), used after KFM_MODE to specify the ping pong playback mode.
|
||||
KFM_REVERSE Option for llSetKeyframedMotion(), used after KFM_MODE to specify the reverse playback mode.
|
||||
KFM_ROTATION Option for llSetKeyframedMotion(), used after KFM_DATA, possibly as a bitwise combination with KFM_TRANSLATION.
|
||||
KFM_TRANSLATION Option for llSetKeyframedMotion(), used after KFM_DATA, possibly as a bitwise combination with KFM_ROTATION.
|
||||
KFM_CMD_PLAY Option for llSetKeyframedMotion(), used after KFM_COMMAND to play the motion.
|
||||
KFM_CMD_STOP Option for llSetKeyframedMotion(), used after KFM_COMMAND to stop the motion.
|
||||
KFM_CMD_PAUSE Option for llSetKeyframedMotion(), used after KFM_COMMAND to pause the motion.
|
||||
|
||||
# OSSL constants
|
||||
STATS_TIME_DILATION
|
||||
STATS_SIM_FPS
|
||||
STATS_PHYSICS_FPS
|
||||
STATS_AGENT_UPDATES
|
||||
STATS_ROOT_AGENTS
|
||||
STATS_CHILD_AGENTS
|
||||
STATS_TOTAL_PRIMS
|
||||
STATS_ACTIVE_PRIMS
|
||||
STATS_FRAME_MS
|
||||
STATS_NET_MS
|
||||
STATS_PHYSICS_MS
|
||||
STATS_IMAGE_MS
|
||||
STATS_OTHER_MS
|
||||
STATS_IN_PACKETS_PER_SECOND
|
||||
STATS_OUT_PACKETS_PER_SECOND
|
||||
STATS_UNACKED_BYTES
|
||||
STATS_AGENT_MS
|
||||
STATS_PENDING_DOWNLOADS
|
||||
STATS_PENDING_UPLOADS
|
||||
STATS_ACTIVE_SCRIPTS
|
||||
STATS_SCRIPT_LPS
|
||||
|
||||
## Constants for osNpc* functions
|
||||
NPC
|
||||
OS_NPC_CREATOR_OWNED
|
||||
OS_NPC_NOT_OWNED
|
||||
OS_NPC_SENSE_AS_AGENT
|
||||
OS_NPC_FLY
|
||||
OS_NPC_NO_FLY
|
||||
OS_NPC_LAND_AT_TARGET
|
||||
OS_NPC_SIT_NOW
|
||||
|
||||
## Missing LSL constants (from http://wiki.secondlife.com/wiki/Category:LSL_Constants)
|
||||
|
||||
# physics constants
|
||||
DENSITY For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the density.
|
||||
FRICTION For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the friction.
|
||||
RESTITUTION For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the restitution.
|
||||
GRAVITY_MULTIPLIER For use with llSetPhysicsMaterial() as a bitwise value in its material_bits parameter, to set the gravity multiplier.
|
||||
|
||||
##Even more missing constants, thanks to Justin Clark Casey for pointing me into the right direction
|
||||
##Liru: Were these supposed to be LSL? They're undocumented, commenting out for now.
|
||||
#CAMERA_FOCUS_OFFSET_X
|
||||
#CAMERA_FOCUS_OFFSET_Y
|
||||
#CAMERA_FOCUS_OFFSET_Z
|
||||
#CAMERA_FOCUS_X
|
||||
#CAMERA_FOCUS_Y
|
||||
#CAMERA_FOCUS_Z
|
||||
#CAMERA_POSITION_X
|
||||
#CAMERA_POSITION_Y
|
||||
#CAMERA_POSITION_Z
|
||||
#CHANGED_ANIMATION
|
||||
#CHANGED_REGION_RESTART
|
||||
#DATA_SIM_RELEASE
|
||||
#LIST_STAT_HARMONIC_MEAN
|
||||
#PARCEL_DETAILS_CLAIMDATE
|
||||
#VEHICLE_FLAG_LOCK_HOVER_HEIGHT
|
||||
#VEHICLE_FLAG_LOCK_ROTATION
|
||||
#VEHICLE_FLAG_NO_X
|
||||
#VEHICLE_FLAG_NO_Y
|
||||
#VEHICLE_FLAG_NO_Z
|
||||
#VEHICLE_RANGE_BLOCK
|
||||
#VEHICLE_ROLL_FRAME
|
||||
#LSL_STATUS_BOUNDS_ERROR
|
||||
#LSL_STATUS_INTERNAL_ERROR
|
||||
#LSL_STATUS_MALFORMED_PARAMS
|
||||
#LSL_STATUS_NOT_FOUND
|
||||
#LSL_STATUS_NOT_SUPPORTED
|
||||
#LSL_STATUS_OK
|
||||
#LSL_STATUS_TYPE_MISMATCH
|
||||
#LSL_STATUS_WHITELIST_FAILED
|
||||
|
||||
# castray constants
|
||||
RCERR_UNKNOWN Returned by llCastRay() when the raycast failed for an unspecified reason.
|
||||
RCERR_SIM_PERF_LOW Returned by llCastRay() when the raycast failed because simulator performance is low.
|
||||
RCERR_CAST_TIME_EXCEEDED Returned by llCastRay() when the raycast failed because the parcel or agent has exceeded the maximum time allowed for raycasting.
|
||||
|
||||
RC_REJECT_TYPES Option for llCastRay() used to ignore specific types of objects, followed with a bitwise combination of RC_REJECT_AGENTS, RC_REJECT_PHYSICAL, RC_REJECT_NONPHYSICAL and RC_REJECT_LAND.
|
||||
RC_DETECT_PHANTOM Option for llCastRay() followed with TRUE to detect phantom AND volume detect objects, FASLE otherwise.
|
||||
RC_DATA_FLAGS Option for llCastRay() followed with a bitwise combination of RC_GET_NORMAL, RC_GET_ROOT_KEY and RC_GET_LINK_NUM.
|
||||
RC_MAX_HITS Option for llCastRay() followed with an integer specifying the maximum number of hits to return (must be <= 256).
|
||||
|
||||
RC_REJECT_AGENTS Flag used in the RC_REJECT_TYPES mask to reject agents in llCastRay().
|
||||
RC_REJECT_PHYSICAL Flag used in the RC_REJECT_TYPES mask to reject physical objects in llCastRay().
|
||||
RC_REJECT_NONPHYSICAL Flag used in the RC_REJECT_TYPES mask to reject non-physical objects in llCastRay().
|
||||
RC_REJECT_LAND Flag used in the RC_REJECT_TYPES mask to reject land in llCastRay().
|
||||
|
||||
RC_GET_NORMAL Flag used in the RC_DATA_FLAGS mask to get hit normals in llCastRay() results.
|
||||
RC_GET_ROOT_KEY Flag used in the RC_DATA_FLAGS mask to get root keys in llCastRay() results.
|
||||
RC_GET_LINK_NUM Flag used in the RC_DATA_FLAGS mask to get link numbers in llCastRay() results.
|
||||
# Aurora-Sim Constants (\Aurora\AuroraDotNetEngine\APIs\AA_Constants.cs) -->
|
||||
ENABLE_GRAVITY enable_gravity.
|
||||
GRAVITY_FORCE_X gravity_force_x.
|
||||
GRAVITY_FORCE_Y gravity_force_y.
|
||||
GRAVITY_FORCE_Z gravity_force_z.
|
||||
ADD_GRAVITY_POINT add_gravity_point.
|
||||
ADD_GRAVITY_FORCE add_gravity_force.
|
||||
START_TIME_REVERSAL_SAVING start_time_reversal_saving.
|
||||
STOP_TIME_REVERSAL_SAVING stop_time_reversal_saving.
|
||||
START_TIME_REVERSAL start_time_reversal.
|
||||
STOP_TIME_REVERSAL stop_time_reversal.
|
||||
# Aurora botFunctions
|
||||
BOT_FOLLOW_FLAG_NONE value 0.
|
||||
BOT_FOLLOW_FLAG_INDEFINITELY value 1.
|
||||
BOT_TAG_FIND_ALL value AllBots.
|
||||
BOT_FOLLOW_WALK value 0.
|
||||
BOT_FOLLOW_RUN value 1.
|
||||
BOT_FOLLOW_FLY value 2.
|
||||
BOT_FOLLOW_TELEPORT value 3.
|
||||
BOT_FOLLOW_WAIT value 4.
|
||||
BOT_FOLLOW_TRIGGER_HERE_EVENT value 1.
|
||||
BOT_FOLLOW_FLAG_FORCEDIRECTPATH value 4.
|
||||
|
||||
# string constants
|
||||
[word .1, .3, .5]
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
<string>settings_sh.xml</string>
|
||||
<string>settings_rlv.xml</string>
|
||||
</array>
|
||||
|
||||
<key>SianaRenderDeferredInvisiprim</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
@@ -895,6 +894,171 @@
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>AntiSpamAlerts</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, dialogs from alerts will be blocked.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AntiSpamFriendshipOffers</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, dialogs from friendship requests will be blocked.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AntiSpamGroupInvites</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, dialogs from group invites will be blocked.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AntiSpamGroupNotices</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, dialogs from group notices will be blocked.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AntiSpamItemOffers</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, dialogs from inventory item offers will be blocked.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AntiSpamNotify</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, notifications will appear any time a spamtype is blocked.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>AntiSpamScripts</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, dialogs from scripts, including script-driven teleports and questions, and other interactive script stuff, will be blocked.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>AntiSpamTeleports</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, dialogs from teleport requests from other residents will be blocked.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>_NACL_Antispam</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>When true, all dialogs will be blocked, resets on restart.</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>_NACL_AntiSpamGlobalQueue</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Collect spamtypes together, instead of individually counting them</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>_NACL_AntiSpamTime</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Time in seconds for spamtype to accumulate the _NACL_AntiSpamAmount and be blocked</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>_NACL_AntiSpamAmount</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Amount of spamtype to be reached before the blocking will occur.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>30</integer>
|
||||
</map>
|
||||
<key>_NACL_AntiSpamSoundMulti</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string> </string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>20</integer>
|
||||
</map>
|
||||
<key>_NACL_AntiSpamNewlines</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>How many newlines a message can have before it's considered spam.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>20</integer>
|
||||
</map>
|
||||
<key>_NACL_AntiSpamSoundPreloadMulti</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string> </string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>20</integer>
|
||||
</map>
|
||||
<!-- Vanilla SL settings that are now optionally Account-Specific -->
|
||||
<key>AgentChatColor</key>
|
||||
<map>
|
||||
@@ -1725,6 +1889,17 @@
|
||||
<key>Value</key>
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
<key>AudioLevelUnderwaterRolloff</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Controls the distance-based dropoff of audio volume when camera is submerged (fraction or multiple of default audio rolloff)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>4.0</real>
|
||||
</map>
|
||||
<key>AudioLevelSFX</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
@@ -1796,7 +1971,7 @@
|
||||
<key>Comment</key>
|
||||
<string>Enable texture auditting.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
@@ -7056,6 +7231,17 @@
|
||||
<key>Value</key>
|
||||
<string>help/index.html</string>
|
||||
</map>
|
||||
<key>WebProfileURL</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>URL for Web Profiles</string>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string>https://my.secondlife.com/[AGENT_NAME]</string>
|
||||
</map>
|
||||
<key>HighResSnapshot</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
@@ -13212,7 +13398,7 @@
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<integer>10</integer>
|
||||
<integer>5</integer>
|
||||
</map>
|
||||
<key>SystemLanguage</key>
|
||||
<map>
|
||||
@@ -15086,3 +15272,4 @@
|
||||
</map>
|
||||
</map>
|
||||
</llsd>
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>LogChatIM</key>
|
||||
<map>
|
||||
@@ -472,7 +472,7 @@
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>LogChatTimestamp</key>
|
||||
<map>
|
||||
@@ -483,7 +483,7 @@
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>LogInstantMessages</key>
|
||||
<map>
|
||||
|
||||
@@ -141,94 +141,6 @@
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
|
||||
<key>SGBlockGeneralSpam</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable automatic general spam blocking</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>SGBlockCardSpam</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable automatic calling card spam blocking</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>SGBlockChatSpam</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable automatic chat spam blocking</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>SGBlockDialogSpam</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable automatic dialog spam blocking</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>SGSpamTime</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Time of Evalulating spam. (Default: 1.000)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
<key>SGSpamCount</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Number of items spammed per time period in SGSpamTime. (Default: 4)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<real>4</real>
|
||||
</map>
|
||||
<key>SGChatSpamTime</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Time of Evalulating spam. (Default: 1.000)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>1.0</real>
|
||||
</map>
|
||||
<key>SGChatSpamCount</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Number of items spammed per time set in SGSpamTime. (Default: 10)</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<real>10.0</real>
|
||||
</map>
|
||||
<key>ShyotlUseLegacyTextureBatching</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @file colorFilterF.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 gl_FragColor;
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect tex0;
|
||||
uniform int layerCount;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color = pow(floor(pow(vec3(texture2D(tex0, vary_texcoord0.st)),vec3(.6)) * layerCount)/layerCount,vec3(1.66666));
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
||||
@@ -23,9 +23,9 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
ATTRIBUTE ivec4 texture_index;
|
||||
ATTRIBUTE int texture_index;
|
||||
|
||||
VARYING_FLAT ivec4 vary_texture_index;
|
||||
VARYING_FLAT int vary_texture_index;
|
||||
|
||||
void passTextureIndex()
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user