Merge commit 'a028c4edba8a5ddb340afc8eebb56b06b363bab1'
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
#ifndef LL_LLCHAT_H
|
||||
#define LL_LLCHAT_H
|
||||
|
||||
#include "llstring.h"
|
||||
#include "lluuid.h"
|
||||
#include "v3math.h"
|
||||
|
||||
@@ -71,7 +70,7 @@ typedef enum e_chat_audible_level
|
||||
class LLChat
|
||||
{
|
||||
public:
|
||||
LLChat(const std::string& text = LLStringUtil::null)
|
||||
LLChat(const std::string& text = std::string())
|
||||
: mText(text),
|
||||
mFromName(),
|
||||
mFromID(),
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
# include <syslog.h>
|
||||
# include <unistd.h>
|
||||
#endif // !LL_WINDOWS
|
||||
#if LL_WINDOWS
|
||||
# include <windows.h>
|
||||
#endif // LL_WINDOWS
|
||||
#include <vector>
|
||||
|
||||
#include "llapp.h"
|
||||
|
||||
@@ -349,13 +349,13 @@ namespace
|
||||
|
||||
virtual LLSD::Boolean asBoolean() const { return !mData.empty(); }
|
||||
|
||||
virtual bool has(const LLSD::String&) const;
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
|
||||
|
||||
virtual bool has(const LLSD::String&) const;
|
||||
virtual LLSD get(const LLSD::String&) const;
|
||||
LLSD& insert(const LLSD::String& k, const LLSD& v);
|
||||
void insert(const LLSD::String& k, const LLSD& v);
|
||||
virtual void erase(const LLSD::String&);
|
||||
LLSD& ref(const LLSD::String&);
|
||||
virtual const LLSD& ref(const LLSD::String&) const;
|
||||
@@ -394,14 +394,9 @@ namespace
|
||||
return (i != mData.end()) ? i->second : LLSD();
|
||||
}
|
||||
|
||||
LLSD& ImplMap::insert(const LLSD::String& k, const LLSD& v)
|
||||
void ImplMap::insert(const LLSD::String& k, const LLSD& v)
|
||||
{
|
||||
mData.insert(DataMap::value_type(k, v));
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImplMap::erase(const LLSD::String& k)
|
||||
@@ -444,15 +439,13 @@ namespace
|
||||
|
||||
virtual LLSD::Boolean asBoolean() const { return !mData.empty(); }
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::String)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::String)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::String)
|
||||
virtual int size() const;
|
||||
|
||||
using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
|
||||
using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
|
||||
using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
|
||||
|
||||
virtual LLSD get(LLSD::Integer) const;
|
||||
void set(LLSD::Integer, const LLSD&);
|
||||
LLSD& insert(LLSD::Integer, const LLSD&);
|
||||
void insert(LLSD::Integer, const LLSD&);
|
||||
void append(const LLSD&);
|
||||
virtual void erase(LLSD::Integer);
|
||||
LLSD& ref(LLSD::Integer);
|
||||
@@ -501,14 +494,10 @@ namespace
|
||||
mData[index] = v;
|
||||
}
|
||||
|
||||
LLSD& ImplArray::insert(LLSD::Integer i, const LLSD& v)
|
||||
void ImplArray::insert(LLSD::Integer i, const LLSD& v)
|
||||
{
|
||||
if (i < 0) {
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
DataVector::size_type index = i;
|
||||
|
||||
@@ -518,11 +507,6 @@ namespace
|
||||
}
|
||||
|
||||
mData.insert(mData.begin() + index, v);
|
||||
#ifdef LL_MSVC7
|
||||
return *((LLSD*)this);
|
||||
#else
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ImplArray::append(const LLSD& v)
|
||||
@@ -765,11 +749,16 @@ LLSD LLSD::emptyMap()
|
||||
|
||||
bool LLSD::has(const String& k) const { return safe(impl).has(k); }
|
||||
LLSD LLSD::get(const String& k) const { return safe(impl).get(k); }
|
||||
void LLSD::insert(const String& k, const LLSD& v) { makeMap(impl).insert(k, v); }
|
||||
|
||||
LLSD& LLSD::insert(const String& k, const LLSD& v)
|
||||
LLSD& LLSD::with(const String& k, const LLSD& v)
|
||||
{
|
||||
makeMap(impl).insert(k, v);
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#ifdef LL_MSVC7
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#else
|
||||
return *this;
|
||||
#endif
|
||||
}
|
||||
void LLSD::erase(const String& k) { makeMap(impl).erase(k); }
|
||||
|
||||
@@ -790,11 +779,16 @@ int LLSD::size() const { return safe(impl).size(); }
|
||||
|
||||
LLSD LLSD::get(Integer i) const { return safe(impl).get(i); }
|
||||
void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
|
||||
void LLSD::insert(Integer i, const LLSD& v) { makeArray(impl).insert(i, v); }
|
||||
|
||||
LLSD& LLSD::insert(Integer i, const LLSD& v)
|
||||
LLSD& LLSD::with(Integer i, const LLSD& v)
|
||||
{
|
||||
makeArray(impl).insert(i, v);
|
||||
return *this;
|
||||
#ifdef LL_MSVC7
|
||||
return *dynamic_cast<LLSD*>(this);
|
||||
#else
|
||||
return *this;
|
||||
#endif
|
||||
}
|
||||
void LLSD::append(const LLSD& v) { makeArray(impl).append(v); }
|
||||
void LLSD::erase(Integer i) { makeArray(impl).erase(i); }
|
||||
@@ -821,9 +815,15 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
|
||||
{
|
||||
std::ostringstream out;
|
||||
if (useXMLFormat)
|
||||
out << LLSDXMLStreamer(llsd);
|
||||
{
|
||||
LLSDXMLStreamer xml_streamer(llsd);
|
||||
out << xml_streamer;
|
||||
}
|
||||
else
|
||||
out << LLSDNotationStreamer(llsd);
|
||||
{
|
||||
LLSDNotationStreamer notation_streamer(llsd);
|
||||
out << notation_streamer;
|
||||
}
|
||||
out_string = out.str();
|
||||
}
|
||||
int len = out_string.length();
|
||||
|
||||
@@ -226,8 +226,9 @@ public:
|
||||
|
||||
bool has(const String&) const;
|
||||
LLSD get(const String&) const;
|
||||
LLSD& insert(const String&, const LLSD&);
|
||||
void insert(const String&, const LLSD&);
|
||||
void erase(const String&);
|
||||
LLSD& with(const String&, const LLSD&);
|
||||
|
||||
LLSD& operator[](const String&);
|
||||
LLSD& operator[](const char* c) { return (*this)[String(c)]; }
|
||||
@@ -241,9 +242,10 @@ public:
|
||||
|
||||
LLSD get(Integer) const;
|
||||
void set(Integer, const LLSD&);
|
||||
LLSD& insert(Integer, const LLSD&);
|
||||
void insert(Integer, const LLSD&);
|
||||
void append(const LLSD&);
|
||||
void erase(Integer);
|
||||
LLSD& with(Integer, const LLSD&);
|
||||
|
||||
const LLSD& operator[](Integer) const;
|
||||
LLSD& operator[](Integer);
|
||||
|
||||
@@ -639,7 +639,7 @@ protected:
|
||||
* </code>
|
||||
*/
|
||||
template <class Formatter>
|
||||
class LLSDOStreamer : public Formatter
|
||||
class LLSDOStreamer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@@ -660,7 +660,8 @@ public:
|
||||
std::ostream& str,
|
||||
const LLSDOStreamer<Formatter>& formatter)
|
||||
{
|
||||
formatter.format(formatter.mSD, str, formatter.mOptions);
|
||||
LLPointer<Formatter> f = new Formatter;
|
||||
f->format(formatter.mSD, str, formatter.mOptions);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,75 @@ extern int errno;
|
||||
static const S32 CPUINFO_BUFFER_SIZE = 16383;
|
||||
LLCPUInfo gSysCPU;
|
||||
|
||||
#if LL_WINDOWS
|
||||
#ifndef DLLVERSIONINFO
|
||||
typedef struct _DllVersionInfo
|
||||
{
|
||||
DWORD cbSize;
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwMinorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformID;
|
||||
}DLLVERSIONINFO;
|
||||
#endif
|
||||
|
||||
#ifndef DLLGETVERSIONPROC
|
||||
typedef int (FAR WINAPI *DLLGETVERSIONPROC) (DLLVERSIONINFO *);
|
||||
#endif
|
||||
|
||||
bool get_shell32_dll_version(DWORD& major, DWORD& minor, DWORD& build_number)
|
||||
{
|
||||
bool result = false;
|
||||
const U32 BUFF_SIZE = 32767;
|
||||
WCHAR tempBuf[BUFF_SIZE];
|
||||
if(GetSystemDirectory((LPWSTR)&tempBuf, BUFF_SIZE))
|
||||
{
|
||||
|
||||
std::basic_string<WCHAR> shell32_path(tempBuf);
|
||||
|
||||
// Shell32.dll contains the DLLGetVersion function.
|
||||
// according to msdn its not part of the API
|
||||
// so you have to go in and get it.
|
||||
// http://msdn.microsoft.com/en-us/library/bb776404(VS.85).aspx
|
||||
shell32_path += TEXT("\\shell32.dll");
|
||||
|
||||
HMODULE hDllInst = LoadLibrary(shell32_path.c_str()); //load the DLL
|
||||
if(hDllInst)
|
||||
{ // Could successfully load the DLL
|
||||
DLLGETVERSIONPROC pDllGetVersion;
|
||||
/*
|
||||
You must get this function explicitly because earlier versions of the DLL
|
||||
don't implement this function. That makes the lack of implementation of the
|
||||
function a version marker in itself.
|
||||
*/
|
||||
pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hDllInst,
|
||||
"DllGetVersion");
|
||||
|
||||
if(pDllGetVersion)
|
||||
{
|
||||
// DLL supports version retrieval function
|
||||
DLLVERSIONINFO dvi;
|
||||
|
||||
ZeroMemory(&dvi, sizeof(dvi));
|
||||
dvi.cbSize = sizeof(dvi);
|
||||
HRESULT hr = (*pDllGetVersion)(&dvi);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{ // Finally, the version is at our hands
|
||||
major = dvi.dwMajorVersion;
|
||||
minor = dvi.dwMinorVersion;
|
||||
build_number = dvi.dwBuildNumber;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
FreeLibrary(hDllInst); // Release DLL
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
LLOSInfo::LLOSInfo() :
|
||||
mMajorVer(0), mMinorVer(0), mBuild(0)
|
||||
{
|
||||
@@ -98,6 +167,11 @@ LLOSInfo::LLOSInfo() :
|
||||
mMinorVer = osvi.dwMinorVersion;
|
||||
mBuild = osvi.dwBuildNumber;
|
||||
|
||||
DWORD shell32_major, shell32_minor, shell32_build;
|
||||
bool got_shell32_version = get_shell32_dll_version(shell32_major,
|
||||
shell32_minor,
|
||||
shell32_build);
|
||||
|
||||
switch(osvi.dwPlatformId)
|
||||
{
|
||||
case VER_PLATFORM_WIN32_NT:
|
||||
@@ -122,14 +196,50 @@ LLOSInfo::LLOSInfo() :
|
||||
else
|
||||
mOSStringSimple = "Microsoft Windows Server 2003 ";
|
||||
}
|
||||
else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
|
||||
else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion <= 1)
|
||||
{
|
||||
if(osvi.wProductType == VER_NT_WORKSTATION)
|
||||
if(osvi.dwMinorVersion == 0)
|
||||
{
|
||||
mOSStringSimple = "Microsoft Windows Vista ";
|
||||
else mOSStringSimple = "Microsoft Windows Vista Server ";
|
||||
}
|
||||
else if(osvi.dwMinorVersion == 1)
|
||||
{
|
||||
mOSStringSimple = "Microsoft Windows 7 ";
|
||||
}
|
||||
|
||||
if(osvi.wProductType != VER_NT_WORKSTATION)
|
||||
{
|
||||
mOSStringSimple += "Server ";
|
||||
}
|
||||
|
||||
///get native system info if available..
|
||||
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); ///function pointer for loading GetNativeSystemInfo
|
||||
SYSTEM_INFO si; //System Info object file contains architecture info
|
||||
PGNSI pGNSI; //pointer object
|
||||
ZeroMemory(&si, sizeof(SYSTEM_INFO)); //zero out the memory in information
|
||||
pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); //load kernel32 get function
|
||||
if(NULL != pGNSI) //check if it has failed
|
||||
pGNSI(&si); //success
|
||||
else
|
||||
GetSystemInfo(&si); //if it fails get regular system info
|
||||
//(Warning: If GetSystemInfo it may result in incorrect information in a WOW64 machine, if the kernel fails to load)
|
||||
|
||||
//msdn microsoft finds 32 bit and 64 bit flavors this way..
|
||||
//http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx (example code that contains quite a few more flavors
|
||||
//of windows than this code does (in case it is needed for the future)
|
||||
if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) //check for 64 bit
|
||||
{
|
||||
mOSStringSimple += "64-bit ";
|
||||
}
|
||||
else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL )
|
||||
{
|
||||
mOSStringSimple += "32-bit ";
|
||||
}
|
||||
}
|
||||
else // Use the registry on early versions of Windows NT.
|
||||
{
|
||||
mOSStringSimple = "Microsoft Windows (unrecognized) ";
|
||||
|
||||
HKEY hKey;
|
||||
WCHAR szProductType[80];
|
||||
DWORD dwBufLen;
|
||||
@@ -170,6 +280,7 @@ LLOSInfo::LLOSInfo() :
|
||||
csdversion.c_str(),
|
||||
(osvi.dwBuildNumber & 0xffff));
|
||||
}
|
||||
|
||||
mOSString = mOSStringSimple + tmpstr;
|
||||
}
|
||||
break;
|
||||
@@ -199,6 +310,21 @@ LLOSInfo::LLOSInfo() :
|
||||
mOSString = mOSStringSimple;
|
||||
break;
|
||||
}
|
||||
|
||||
std::string compatibility_mode;
|
||||
if(got_shell32_version)
|
||||
{
|
||||
if(osvi.dwMajorVersion != shell32_major
|
||||
|| osvi.dwMinorVersion != shell32_minor)
|
||||
{
|
||||
compatibility_mode = llformat(" compatibility mode. real ver: %d.%d (Build %d)",
|
||||
shell32_major,
|
||||
shell32_minor,
|
||||
shell32_build);
|
||||
}
|
||||
}
|
||||
mOSString += compatibility_mode;
|
||||
|
||||
#else
|
||||
struct utsname un;
|
||||
if(uname(&un) != -1)
|
||||
@@ -226,8 +352,8 @@ LLOSInfo::LLOSInfo() :
|
||||
else if (ostype == "Linux")
|
||||
{
|
||||
// Only care about major and minor Linux versions, truncate at second '.'
|
||||
S32 idx1 = mOSStringSimple.find_first_of(".", 0);
|
||||
S32 idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos;
|
||||
std::string::size_type idx1 = mOSStringSimple.find_first_of(".", 0);
|
||||
std::string::size_type idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos;
|
||||
std::string simple = mOSStringSimple.substr(0, idx2);
|
||||
if (simple.length() > 0)
|
||||
mOSStringSimple = simple;
|
||||
@@ -393,15 +519,15 @@ LLCPUInfo::LLCPUInfo()
|
||||
mHasSSE = info->_Ext.SSE_StreamingSIMD_Extensions;
|
||||
mHasSSE2 = info->_Ext.SSE2_StreamingSIMD2_Extensions;
|
||||
mHasAltivec = info->_Ext.Altivec_Extensions;
|
||||
mCPUMhz = (S32)(proc.GetCPUFrequency(50)/1000000.0);
|
||||
mCPUMHz = (F64)(proc.GetCPUFrequency(50)/1000000.0);
|
||||
mFamily.assign( info->strFamily );
|
||||
mCPUString = "Unknown";
|
||||
|
||||
#if LL_WINDOWS || LL_DARWIN || LL_SOLARIS
|
||||
out << proc.strCPUName;
|
||||
if (200 < mCPUMhz && mCPUMhz < 10000) // *NOTE: cpu speed is often way wrong, do a sanity check
|
||||
if (200 < mCPUMHz && mCPUMHz < 10000) // *NOTE: cpu speed is often way wrong, do a sanity check
|
||||
{
|
||||
out << " (" << mCPUMhz << " MHz)";
|
||||
out << " (" << mCPUMHz << " MHz)";
|
||||
}
|
||||
mCPUString = out.str();
|
||||
|
||||
@@ -446,7 +572,7 @@ LLCPUInfo::LLCPUInfo()
|
||||
if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz)
|
||||
&& 200.0 < mhz && mhz < 10000.0)
|
||||
{
|
||||
mCPUMhz = (S32)llrint(mhz);
|
||||
mCPUMHz = (F64)llrint(mhz);
|
||||
}
|
||||
if (!cpuinfo["model name"].empty())
|
||||
mCPUString = cpuinfo["model name"];
|
||||
@@ -469,9 +595,9 @@ bool LLCPUInfo::hasSSE2() const
|
||||
return mHasSSE2;
|
||||
}
|
||||
|
||||
S32 LLCPUInfo::getMhz() const
|
||||
F64 LLCPUInfo::getMHz() const
|
||||
{
|
||||
return mCPUMhz;
|
||||
return mCPUMHz;
|
||||
}
|
||||
|
||||
std::string LLCPUInfo::getCPUString() const
|
||||
@@ -518,7 +644,7 @@ void LLCPUInfo::stream(std::ostream& s) const
|
||||
s << "->mHasSSE: " << (U32)mHasSSE << std::endl;
|
||||
s << "->mHasSSE2: " << (U32)mHasSSE2 << std::endl;
|
||||
s << "->mHasAltivec: " << (U32)mHasAltivec << std::endl;
|
||||
s << "->mCPUMhz: " << mCPUMhz << std::endl;
|
||||
s << "->mCPUMHz: " << mCPUMHz << std::endl;
|
||||
s << "->mCPUString: " << mCPUString << std::endl;
|
||||
}
|
||||
|
||||
@@ -595,6 +721,26 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb)
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
MEMORYSTATUSEX state;
|
||||
state.dwLength = sizeof(state);
|
||||
GlobalMemoryStatusEx(&state);
|
||||
|
||||
avail_physical_mem_kb = (U32)(state.ullAvailPhys/1024) ;
|
||||
avail_virtual_mem_kb = (U32)(state.ullAvailVirtual/1024) ;
|
||||
|
||||
#else
|
||||
//do not know how to collect available memory info for other systems.
|
||||
//leave it blank here for now.
|
||||
|
||||
avail_physical_mem_kb = -1 ;
|
||||
avail_virtual_mem_kb = -1 ;
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLMemoryInfo::stream(std::ostream& s) const
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
bool hasAltivec() const;
|
||||
bool hasSSE() const;
|
||||
bool hasSSE2() const;
|
||||
S32 getMhz() const;
|
||||
F64 getMHz() const;
|
||||
|
||||
// Family is "AMD Duron" or "Intel Pentium Pro"
|
||||
const std::string& getFamily() const { return mFamily; }
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
bool mHasSSE;
|
||||
bool mHasSSE2;
|
||||
bool mHasAltivec;
|
||||
S32 mCPUMhz;
|
||||
F64 mCPUMHz;
|
||||
std::string mFamily;
|
||||
std::string mCPUString;
|
||||
};
|
||||
@@ -120,6 +120,9 @@ public:
|
||||
** be returned.
|
||||
*/
|
||||
U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes
|
||||
|
||||
//get the available memory infomation in KiloBytes.
|
||||
static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -314,6 +314,21 @@ void LLImageRaw::deleteData()
|
||||
LLImageBase::deleteData();
|
||||
}
|
||||
|
||||
void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components)
|
||||
{
|
||||
if(data == getData())
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
deleteData();
|
||||
|
||||
LLImageBase::setSize(width, height, components) ;
|
||||
LLImageBase::setDataAndSize(data, width * height * components) ;
|
||||
|
||||
sGlobalRawMemory += getDataSize();
|
||||
}
|
||||
|
||||
BOOL LLImageRaw::resize(U16 width, U16 height, S8 components)
|
||||
{
|
||||
if ((getWidth() == width) && (getHeight() == height) && (getComponents() == components))
|
||||
@@ -561,6 +576,11 @@ void LLImageRaw::compositeScaled4onto3(LLImageRaw* src)
|
||||
// Vertical: scale but no composite
|
||||
S32 temp_data_size = src->getWidth() * dst->getHeight() * src->getComponents();
|
||||
U8* temp_buffer = new U8[ temp_data_size ];
|
||||
if (!temp_buffer )
|
||||
{
|
||||
llerrs << "Out of memory in LLImageRaw::compositeScaled4onto3()" << llendl;
|
||||
return;
|
||||
}
|
||||
for( S32 col = 0; col < src->getWidth(); col++ )
|
||||
{
|
||||
copyLineScaled( src->getData() + (src->getComponents() * col), temp_buffer + (src->getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() );
|
||||
@@ -813,6 +833,11 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
|
||||
S32 temp_data_size = src->getWidth() * dst->getHeight() * getComponents();
|
||||
llassert_always(temp_data_size > 0);
|
||||
U8* temp_buffer = new U8[ temp_data_size ];
|
||||
if (!temp_buffer )
|
||||
{
|
||||
llerrs << "Out of memory in LLImageRaw::copyScaled()" << llendl;
|
||||
return;
|
||||
}
|
||||
for( S32 col = 0; col < src->getWidth(); col++ )
|
||||
{
|
||||
copyLineScaled( src->getData() + (getComponents() * col), temp_buffer + (getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() );
|
||||
@@ -829,6 +854,52 @@ void LLImageRaw::copyScaled( LLImageRaw* src )
|
||||
}
|
||||
|
||||
|
||||
//scale down image by not blending a pixel with its neighbors.
|
||||
BOOL LLImageRaw::scaleDownWithoutBlending( S32 new_width, S32 new_height)
|
||||
{
|
||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
||||
|
||||
S8 c = getComponents() ;
|
||||
llassert((1 == c) || (3 == c) || (4 == c) );
|
||||
|
||||
S32 old_width = getWidth();
|
||||
S32 old_height = getHeight();
|
||||
|
||||
S32 new_data_size = old_width * new_height * c ;
|
||||
llassert_always(new_data_size > 0);
|
||||
|
||||
F32 ratio_x = (F32)old_width / new_width ;
|
||||
F32 ratio_y = (F32)old_height / new_height ;
|
||||
if( ratio_x < 1.0f || ratio_y < 1.0f )
|
||||
{
|
||||
return TRUE; // Nothing to do.
|
||||
}
|
||||
ratio_x -= 1.0f ;
|
||||
ratio_y -= 1.0f ;
|
||||
|
||||
U8* new_data = new U8[new_data_size] ;
|
||||
llassert_always(new_data != NULL) ;
|
||||
|
||||
U8* old_data = getData() ;
|
||||
S32 i, j, k, s, t;
|
||||
for(i = 0, s = 0, t = 0 ; i < new_height ; i++)
|
||||
{
|
||||
for(j = 0 ; j < new_width ; j++)
|
||||
{
|
||||
for(k = 0 ; k < c ; k++)
|
||||
{
|
||||
new_data[s++] = old_data[t++] ;
|
||||
}
|
||||
t += (S32)(ratio_x * c + 0.1f) ;
|
||||
}
|
||||
t += (S32)(ratio_y * old_width * c + 0.1f) ;
|
||||
}
|
||||
|
||||
setDataAndSize(new_data, new_width, new_height, c) ;
|
||||
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
|
||||
{
|
||||
LLMemType mt1((LLMemType::EMemType)mMemType);
|
||||
@@ -850,6 +921,11 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )
|
||||
S32 temp_data_size = old_width * new_height * getComponents();
|
||||
llassert_always(temp_data_size > 0);
|
||||
U8* temp_buffer = new U8[ temp_data_size ];
|
||||
if (!temp_buffer )
|
||||
{
|
||||
llerrs << "Out of memory in LLImageRaw::scale()" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
for( S32 col = 0; col < old_width; col++ )
|
||||
{
|
||||
copyLineScaled( getData() + (getComponents() * col), temp_buffer + (getComponents() * col), old_height, new_height, old_width, old_width );
|
||||
|
||||
@@ -189,6 +189,7 @@ public:
|
||||
void contractToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE, BOOL scale_image = TRUE);
|
||||
void biasedScaleToPowerOfTwo(S32 max_dim = MAX_IMAGE_SIZE);
|
||||
BOOL scale( S32 new_width, S32 new_height, BOOL scale_image = TRUE );
|
||||
BOOL scaleDownWithoutBlending( S32 new_width, S32 new_height) ;
|
||||
|
||||
// Fill the buffer with a constant color
|
||||
void fill( const LLColor4U& color );
|
||||
@@ -237,6 +238,8 @@ protected:
|
||||
|
||||
U8 fastFractionalMult(U8 a,U8 b);
|
||||
|
||||
void setDataAndSize(U8 *data, S32 width, S32 height, S8 components) ;
|
||||
|
||||
public:
|
||||
static S32 sGlobalRawMemory;
|
||||
static S32 sRawImageCount;
|
||||
|
||||
@@ -179,8 +179,8 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
|
||||
mMaxBytes(0),
|
||||
mRawDiscardLevel(-1),
|
||||
mRate(0.0f),
|
||||
mReversible(FALSE)
|
||||
|
||||
mReversible(FALSE),
|
||||
mAreaUsedForDataSizeCalcs(0)
|
||||
{
|
||||
//We assume here that if we wanted to create via
|
||||
//a dynamic library that the approriate open calls were made
|
||||
|
||||
@@ -1,281 +1,281 @@
|
||||
/**
|
||||
* @file llglstates.h
|
||||
* @brief LLGL states definitions
|
||||
*
|
||||
* $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$
|
||||
*/
|
||||
|
||||
//THIS HEADER SHOULD ONLY BE INCLUDED FROM llgl.h
|
||||
#ifndef LL_LLGLSTATES_H
|
||||
#define LL_LLGLSTATES_H
|
||||
|
||||
#include "llimagegl.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLDepthTest
|
||||
{
|
||||
// Enabled by default
|
||||
public:
|
||||
LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled = GL_TRUE, GLenum depth_func = GL_LEQUAL);
|
||||
|
||||
~LLGLDepthTest();
|
||||
|
||||
void checkState();
|
||||
|
||||
GLboolean mPrevDepthEnabled;
|
||||
GLenum mPrevDepthFunc;
|
||||
GLboolean mPrevWriteEnabled;
|
||||
private:
|
||||
static GLboolean sDepthEnabled; // defaults to GL_FALSE
|
||||
static GLenum sDepthFunc; // defaults to GL_LESS
|
||||
static GLboolean sWriteEnabled; // defaults to GL_TRUE
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSDefault
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mColorMaterial;
|
||||
LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, mFog,
|
||||
mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth,
|
||||
mTextureGenQ, mTextureGenR, mTextureGenS, mTextureGenT,
|
||||
mGLMultisample;
|
||||
public:
|
||||
LLGLSDefault()
|
||||
:
|
||||
// Enable
|
||||
mColorMaterial(GL_COLOR_MATERIAL),
|
||||
// Disable
|
||||
mAlphaTest(GL_ALPHA_TEST),
|
||||
mBlend(GL_BLEND),
|
||||
mCullFace(GL_CULL_FACE),
|
||||
mDither(GL_DITHER),
|
||||
mFog(GL_FOG),
|
||||
mLineSmooth(GL_LINE_SMOOTH),
|
||||
mLineStipple(GL_LINE_STIPPLE),
|
||||
mNormalize(GL_NORMALIZE),
|
||||
mPolygonSmooth(GL_POLYGON_SMOOTH),
|
||||
mTextureGenQ(GL_TEXTURE_GEN_Q),
|
||||
mTextureGenR(GL_TEXTURE_GEN_R),
|
||||
mTextureGenS(GL_TEXTURE_GEN_S),
|
||||
mTextureGenT(GL_TEXTURE_GEN_T),
|
||||
mGLMultisample(GL_MULTISAMPLE_ARB)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSObjectSelect
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mBlend, mFog, mAlphaTest;
|
||||
LLGLEnable mCullFace;
|
||||
public:
|
||||
LLGLSObjectSelect()
|
||||
: mBlend(GL_BLEND), mFog(GL_FOG),
|
||||
mAlphaTest(GL_ALPHA_TEST),
|
||||
mCullFace(GL_CULL_FACE)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSObjectSelectAlpha
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mAlphaTest;
|
||||
public:
|
||||
LLGLSObjectSelectAlpha()
|
||||
: mAlphaTest(GL_ALPHA_TEST)
|
||||
{}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSUIDefault
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mBlend, mAlphaTest;
|
||||
LLGLDisable mCullFace;
|
||||
LLGLDepthTest mDepthTest;
|
||||
public:
|
||||
LLGLSUIDefault()
|
||||
: mBlend(GL_BLEND), mAlphaTest(GL_ALPHA_TEST),
|
||||
mCullFace(GL_CULL_FACE),
|
||||
mDepthTest(GL_FALSE, GL_TRUE, GL_LEQUAL)
|
||||
{}
|
||||
};
|
||||
|
||||
class LLGLSNoAlphaTest // : public LLGLSUIDefault
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mAlphaTest;
|
||||
public:
|
||||
LLGLSNoAlphaTest()
|
||||
: mAlphaTest(GL_ALPHA_TEST)
|
||||
{}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSFog
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mFog;
|
||||
public:
|
||||
LLGLSFog()
|
||||
: mFog(GL_FOG)
|
||||
{}
|
||||
};
|
||||
|
||||
class LLGLSNoFog
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mFog;
|
||||
public:
|
||||
LLGLSNoFog()
|
||||
: mFog(GL_FOG)
|
||||
{}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSPipeline
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mCullFace;
|
||||
LLGLDepthTest mDepthTest;
|
||||
public:
|
||||
LLGLSPipeline()
|
||||
: mCullFace(GL_CULL_FACE),
|
||||
mDepthTest(GL_TRUE, GL_TRUE, GL_LEQUAL)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSPipelineAlpha // : public LLGLSPipeline
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mBlend, mAlphaTest;
|
||||
public:
|
||||
LLGLSPipelineAlpha()
|
||||
: mBlend(GL_BLEND),
|
||||
mAlphaTest(GL_ALPHA_TEST)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSPipelineEmbossBump
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mFog;
|
||||
public:
|
||||
LLGLSPipelineEmbossBump()
|
||||
: mFog(GL_FOG)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSPipelineSelection
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mCullFace;
|
||||
public:
|
||||
LLGLSPipelineSelection()
|
||||
: mCullFace(GL_CULL_FACE)
|
||||
{}
|
||||
};
|
||||
|
||||
class LLGLSPipelineAvatar
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mNormalize;
|
||||
public:
|
||||
LLGLSPipelineAvatar()
|
||||
: mNormalize(GL_NORMALIZE)
|
||||
{}
|
||||
};
|
||||
|
||||
class LLGLSPipelineSkyBox
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mAlphaTest, mCullFace, mFog;
|
||||
public:
|
||||
LLGLSPipelineSkyBox()
|
||||
: mAlphaTest(GL_ALPHA_TEST), mCullFace(GL_CULL_FACE), mFog(GL_FOG)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSTracker
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mCullFace, mBlend, mAlphaTest;
|
||||
public:
|
||||
LLGLSTracker() :
|
||||
mCullFace(GL_CULL_FACE),
|
||||
mBlend(GL_BLEND),
|
||||
mAlphaTest(GL_ALPHA_TEST)
|
||||
|
||||
{ }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSSpecular
|
||||
{
|
||||
public:
|
||||
LLGLSSpecular(const LLColor4& color, F32 shininess)
|
||||
{
|
||||
if (shininess > 0.0f)
|
||||
{
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color.mV);
|
||||
S32 shiny = (S32)(shininess*128.f);
|
||||
shiny = llclamp(shiny,0,128);
|
||||
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, shiny);
|
||||
}
|
||||
}
|
||||
~LLGLSSpecular()
|
||||
{
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, LLColor4(0.f,0.f,0.f,0.f).mV);
|
||||
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class LLGLSBlendFunc : public LLGLSPipeline {
|
||||
protected:
|
||||
GLint mSavedSrc, mSavedDst;
|
||||
LLGLEnable mBlend;
|
||||
|
||||
public:
|
||||
LLGLSBlendFunc(GLenum srcFunc, GLenum dstFunc) :
|
||||
mBlend(GL_BLEND)
|
||||
{
|
||||
glGetIntegerv(GL_BLEND_SRC, &mSavedSrc);
|
||||
glGetIntegerv(GL_BLEND_DST, &mSavedDst);
|
||||
glBlendFunc(srcFunc, dstFunc);
|
||||
}
|
||||
|
||||
~LLGLSBlendFunc(void) {
|
||||
glBlendFunc(mSavedSrc, mSavedDst);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @file llglstates.h
|
||||
* @brief LLGL states definitions
|
||||
*
|
||||
* $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$
|
||||
*/
|
||||
|
||||
//THIS HEADER SHOULD ONLY BE INCLUDED FROM llgl.h
|
||||
#ifndef LL_LLGLSTATES_H
|
||||
#define LL_LLGLSTATES_H
|
||||
|
||||
#include "llimagegl.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLDepthTest
|
||||
{
|
||||
// Enabled by default
|
||||
public:
|
||||
LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled = GL_TRUE, GLenum depth_func = GL_LEQUAL);
|
||||
|
||||
~LLGLDepthTest();
|
||||
|
||||
void checkState();
|
||||
|
||||
GLboolean mPrevDepthEnabled;
|
||||
GLenum mPrevDepthFunc;
|
||||
GLboolean mPrevWriteEnabled;
|
||||
private:
|
||||
static GLboolean sDepthEnabled; // defaults to GL_FALSE
|
||||
static GLenum sDepthFunc; // defaults to GL_LESS
|
||||
static GLboolean sWriteEnabled; // defaults to GL_TRUE
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSDefault
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mColorMaterial;
|
||||
LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, mFog,
|
||||
mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth,
|
||||
mTextureGenQ, mTextureGenR, mTextureGenS, mTextureGenT,
|
||||
mGLMultisample;
|
||||
public:
|
||||
LLGLSDefault()
|
||||
:
|
||||
// Enable
|
||||
mColorMaterial(GL_COLOR_MATERIAL),
|
||||
// Disable
|
||||
mAlphaTest(GL_ALPHA_TEST),
|
||||
mBlend(GL_BLEND),
|
||||
mCullFace(GL_CULL_FACE),
|
||||
mDither(GL_DITHER),
|
||||
mFog(GL_FOG),
|
||||
mLineSmooth(GL_LINE_SMOOTH),
|
||||
mLineStipple(GL_LINE_STIPPLE),
|
||||
mNormalize(GL_NORMALIZE),
|
||||
mPolygonSmooth(GL_POLYGON_SMOOTH),
|
||||
mTextureGenQ(GL_TEXTURE_GEN_Q),
|
||||
mTextureGenR(GL_TEXTURE_GEN_R),
|
||||
mTextureGenS(GL_TEXTURE_GEN_S),
|
||||
mTextureGenT(GL_TEXTURE_GEN_T),
|
||||
mGLMultisample(GL_MULTISAMPLE_ARB)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSObjectSelect
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mBlend, mFog, mAlphaTest;
|
||||
LLGLEnable mCullFace;
|
||||
public:
|
||||
LLGLSObjectSelect()
|
||||
: mBlend(GL_BLEND), mFog(GL_FOG),
|
||||
mAlphaTest(GL_ALPHA_TEST),
|
||||
mCullFace(GL_CULL_FACE)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSObjectSelectAlpha
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mAlphaTest;
|
||||
public:
|
||||
LLGLSObjectSelectAlpha()
|
||||
: mAlphaTest(GL_ALPHA_TEST)
|
||||
{}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSUIDefault
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mBlend, mAlphaTest;
|
||||
LLGLDisable mCullFace;
|
||||
LLGLDepthTest mDepthTest;
|
||||
public:
|
||||
LLGLSUIDefault()
|
||||
: mBlend(GL_BLEND), mAlphaTest(GL_ALPHA_TEST),
|
||||
mCullFace(GL_CULL_FACE),
|
||||
mDepthTest(GL_FALSE, GL_TRUE, GL_LEQUAL)
|
||||
{}
|
||||
};
|
||||
|
||||
class LLGLSNoAlphaTest // : public LLGLSUIDefault
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mAlphaTest;
|
||||
public:
|
||||
LLGLSNoAlphaTest()
|
||||
: mAlphaTest(GL_ALPHA_TEST)
|
||||
{}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSFog
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mFog;
|
||||
public:
|
||||
LLGLSFog()
|
||||
: mFog(GL_FOG)
|
||||
{}
|
||||
};
|
||||
|
||||
class LLGLSNoFog
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mFog;
|
||||
public:
|
||||
LLGLSNoFog()
|
||||
: mFog(GL_FOG)
|
||||
{}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSPipeline
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mCullFace;
|
||||
LLGLDepthTest mDepthTest;
|
||||
public:
|
||||
LLGLSPipeline()
|
||||
: mCullFace(GL_CULL_FACE),
|
||||
mDepthTest(GL_TRUE, GL_TRUE, GL_LEQUAL)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSPipelineAlpha // : public LLGLSPipeline
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mBlend, mAlphaTest;
|
||||
public:
|
||||
LLGLSPipelineAlpha()
|
||||
: mBlend(GL_BLEND),
|
||||
mAlphaTest(GL_ALPHA_TEST)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSPipelineEmbossBump
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mFog;
|
||||
public:
|
||||
LLGLSPipelineEmbossBump()
|
||||
: mFog(GL_FOG)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSPipelineSelection
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mCullFace;
|
||||
public:
|
||||
LLGLSPipelineSelection()
|
||||
: mCullFace(GL_CULL_FACE)
|
||||
{}
|
||||
};
|
||||
|
||||
class LLGLSPipelineAvatar
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mNormalize;
|
||||
public:
|
||||
LLGLSPipelineAvatar()
|
||||
: mNormalize(GL_NORMALIZE)
|
||||
{}
|
||||
};
|
||||
|
||||
class LLGLSPipelineSkyBox
|
||||
{
|
||||
protected:
|
||||
LLGLDisable mAlphaTest, mCullFace, mFog;
|
||||
public:
|
||||
LLGLSPipelineSkyBox()
|
||||
: mAlphaTest(GL_ALPHA_TEST), mCullFace(GL_CULL_FACE), mFog(GL_FOG)
|
||||
{ }
|
||||
};
|
||||
|
||||
class LLGLSTracker
|
||||
{
|
||||
protected:
|
||||
LLGLEnable mCullFace, mBlend, mAlphaTest;
|
||||
public:
|
||||
LLGLSTracker() :
|
||||
mCullFace(GL_CULL_FACE),
|
||||
mBlend(GL_BLEND),
|
||||
mAlphaTest(GL_ALPHA_TEST)
|
||||
|
||||
{ }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class LLGLSSpecular
|
||||
{
|
||||
public:
|
||||
LLGLSSpecular(const LLColor4& color, F32 shininess)
|
||||
{
|
||||
if (shininess > 0.0f)
|
||||
{
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color.mV);
|
||||
S32 shiny = (S32)(shininess*128.f);
|
||||
shiny = llclamp(shiny,0,128);
|
||||
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, shiny);
|
||||
}
|
||||
}
|
||||
~LLGLSSpecular()
|
||||
{
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, LLColor4(0.f,0.f,0.f,0.f).mV);
|
||||
glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
class LLGLSBlendFunc : public LLGLSPipeline {
|
||||
protected:
|
||||
GLint mSavedSrc, mSavedDst;
|
||||
LLGLEnable mBlend;
|
||||
|
||||
public:
|
||||
LLGLSBlendFunc(GLenum srcFunc, GLenum dstFunc) :
|
||||
mBlend(GL_BLEND)
|
||||
{
|
||||
glGetIntegerv(GL_BLEND_SRC, &mSavedSrc);
|
||||
glGetIntegerv(GL_BLEND_DST, &mSavedDst);
|
||||
glBlendFunc(srcFunc, dstFunc);
|
||||
}
|
||||
|
||||
~LLGLSBlendFunc(void) {
|
||||
glBlendFunc(mSavedSrc, mSavedDst);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -734,7 +734,7 @@ void LLNotificationChannelBase::connectChanged(const LLStandardSignal::slot_type
|
||||
// only about new notifications
|
||||
for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
|
||||
{
|
||||
slot.get_slot_function()(LLSD().insert("sigtype", "load").insert("id", (*it)->id()));
|
||||
slot.get_slot_function()(LLSD().with("sigtype", "load").with("id", (*it)->id()));
|
||||
}
|
||||
// and then connect the signal so that all future notifications will also be
|
||||
// forwarded.
|
||||
@@ -922,7 +922,7 @@ void LLNotificationChannel::setComparator(LLNotificationComparator comparator)
|
||||
mItems.swap(s2);
|
||||
|
||||
// notify clients that we've been resorted
|
||||
mChanged(LLSD().insert("sigtype", "sort"));
|
||||
mChanged(LLSD().with("sigtype", "sort"));
|
||||
}
|
||||
|
||||
bool LLNotificationChannel::isEmpty() const
|
||||
@@ -1432,7 +1432,7 @@ void LLNotifications::add(const LLNotificationPtr pNotif)
|
||||
llerrs << "Notification added a second time to the master notification channel." << llendl;
|
||||
}
|
||||
|
||||
updateItem(LLSD().insert("sigtype", "add").insert("id", pNotif->id()), pNotif);
|
||||
updateItem(LLSD().with("sigtype", "add").with("id", pNotif->id()), pNotif);
|
||||
}
|
||||
|
||||
void LLNotifications::cancel(LLNotificationPtr pNotif)
|
||||
@@ -1442,7 +1442,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
|
||||
{
|
||||
llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl;
|
||||
}
|
||||
updateItem(LLSD().insert("sigtype", "delete").insert("id", pNotif->id()), pNotif);
|
||||
updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
|
||||
pNotif->cancel();
|
||||
}
|
||||
|
||||
@@ -1451,7 +1451,7 @@ void LLNotifications::update(const LLNotificationPtr pNotif)
|
||||
LLNotificationSet::iterator it=mItems.find(pNotif);
|
||||
if (it != mItems.end())
|
||||
{
|
||||
updateItem(LLSD().insert("sigtype", "change").insert("id", pNotif->id()), pNotif);
|
||||
updateItem(LLSD().with("sigtype", "change").with("id", pNotif->id()), pNotif);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ bool LLLFSThread::Request::processRequest()
|
||||
if (mOperation == FILE_READ)
|
||||
{
|
||||
llassert(mOffset >= 0);
|
||||
LLAPRFile infile ;
|
||||
LLAPRFile infile ; // auto-closes
|
||||
infile.open(mFileName, LL_APR_RB, LLAPRFile::local);
|
||||
if (!infile.getFileHandle())
|
||||
{
|
||||
@@ -200,7 +200,6 @@ bool LLLFSThread::Request::processRequest()
|
||||
llassert_always(off >= 0);
|
||||
mBytesRead = infile.read(mBuffer, mBytes );
|
||||
complete = true;
|
||||
infile.close() ;
|
||||
// llinfos << "LLLFSThread::READ:" << mFileName << " Bytes: " << mBytesRead << llendl;
|
||||
}
|
||||
else if (mOperation == FILE_WRITE)
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
#if defined(LL_DARWIN)
|
||||
#include <QuickTime/QuickTime.h>
|
||||
#elif defined(LL_WINDOWS)
|
||||
#undef __STDC_CONSTANT_MACROS //Needed, as boost/unordered_map.hpp already defines INT32_C, etc.
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
#define _STDINT_H //Visual Studio 2010 includes its own stdint header already
|
||||
#endif
|
||||
#include "MacTypes.h"
|
||||
#include "QTML.h"
|
||||
#include "Movies.h"
|
||||
|
||||
@@ -260,6 +260,13 @@ const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f;
|
||||
std::map<std::string, std::string> LLAgent::sTeleportErrorMessages;
|
||||
std::map<std::string, std::string> LLAgent::sTeleportProgressMessages;
|
||||
|
||||
BOOL isAgentAvatarValid()
|
||||
{
|
||||
return (gAgent.getAvatarObject() &&
|
||||
(gAgent.getAvatarObject()->getRegion() != NULL) &&
|
||||
(!gAgent.getAvatarObject()->isDead()));
|
||||
}
|
||||
|
||||
class LLAgentFriendObserver : public LLFriendObserver
|
||||
{
|
||||
public:
|
||||
@@ -548,8 +555,11 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera)
|
||||
LLSelectMgr::getInstance()->deselectAll();
|
||||
}
|
||||
|
||||
// Hide all popup menus
|
||||
gMenuHolder->hideMenus();
|
||||
if (gMenuHolder != NULL)
|
||||
{
|
||||
// Hide all popup menus
|
||||
gMenuHolder->hideMenus();
|
||||
}
|
||||
}
|
||||
|
||||
static const LLCachedControl<bool> freeze_time("FreezeTime",false);
|
||||
@@ -588,6 +598,8 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera)
|
||||
}
|
||||
|
||||
setFocusOnAvatar(TRUE, ANIMATE);
|
||||
|
||||
mCameraFOVZoomFactor = 0.f;
|
||||
}
|
||||
|
||||
mHUDTargetZoom = 1.f;
|
||||
@@ -610,7 +622,7 @@ void LLAgent::onAppFocusGained()
|
||||
|
||||
void LLAgent::ageChat()
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// get amount of time since I last chatted
|
||||
F64 elapsed_time = (F64)mAvatarObject->mChatTimer.getElapsedTimeF32();
|
||||
@@ -627,7 +639,7 @@ void LLAgent::unlockView()
|
||||
{
|
||||
if (getFocusOnAvatar())
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
setFocusGlobal( LLVector3d::zero, mAvatarObject->mID );
|
||||
}
|
||||
@@ -844,7 +856,7 @@ void LLAgent::resetClientTag()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgent::setFlying(BOOL fly)
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if(mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != mAvatarObject->mSignaledAnimations.end())
|
||||
{
|
||||
@@ -881,13 +893,15 @@ void LLAgent::setFlying(BOOL fly)
|
||||
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_FLY_COUNT);
|
||||
}
|
||||
setControlFlags(AGENT_CONTROL_FLY);
|
||||
gSavedSettings.setBOOL("FlyBtnState", TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
clearControlFlags(AGENT_CONTROL_FLY);
|
||||
gSavedSettings.setBOOL("FlyBtnState", FALSE);
|
||||
}
|
||||
|
||||
|
||||
gSavedSettings.setBOOL("FlyBtnState",fly);
|
||||
|
||||
mbFlagsDirty = TRUE;
|
||||
}
|
||||
|
||||
@@ -1066,6 +1080,7 @@ void LLAgent::sendMessage()
|
||||
if (!mRegionp)
|
||||
{
|
||||
llerrs << "No region for agent yet!" << llendl;
|
||||
return;
|
||||
}
|
||||
gMessageSystem->sendMessage(mRegionp->getHost());
|
||||
}
|
||||
@@ -1094,7 +1109,7 @@ void LLAgent::sendReliableMessage()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLVector3 LLAgent::getVelocity() const
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
return mAvatarObject->getVelocity();
|
||||
}
|
||||
@@ -1115,7 +1130,7 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
|
||||
llerrs << "setPositionAgent is not a number" << llendl;
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLVector3 pos_agent_sitting;
|
||||
LLVector3d pos_agent_d;
|
||||
@@ -1153,7 +1168,7 @@ void LLAgent::slamLookAt(const LLVector3 &look_at)
|
||||
//-----------------------------------------------------------------------------
|
||||
const LLVector3d &LLAgent::getPositionGlobal() const
|
||||
{
|
||||
if (mAvatarObject.notNull() && !mAvatarObject->mDrawable.isNull())
|
||||
if (isAgentAvatarValid() && !mAvatarObject->mDrawable.isNull())
|
||||
{
|
||||
mPositionGlobal = getPosGlobalFromAgent(mAvatarObject->getRenderPosition());
|
||||
}
|
||||
@@ -1298,7 +1313,7 @@ LLVector3 LLAgent::getReferenceUpVector()
|
||||
{
|
||||
// this vector is in the coordinate frame of the avatar's parent object, or the world if none
|
||||
LLVector3 up_vector = LLVector3::z_axis;
|
||||
if (mAvatarObject.notNull() &&
|
||||
if (isAgentAvatarValid() &&
|
||||
mAvatarObject->getParent() &&
|
||||
mAvatarObject->mDrawable.notNull())
|
||||
{
|
||||
@@ -1348,7 +1363,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
|
||||
|
||||
F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
|
||||
|
||||
if (mAvatarObject.notNull() && mAvatarObject->mIsSitting)
|
||||
if (isAgentAvatarValid() && mAvatarObject->mIsSitting)
|
||||
{
|
||||
look_down_limit = 130.f * DEG_TO_RAD;
|
||||
}
|
||||
@@ -2240,10 +2255,9 @@ void LLAgent::clearAFK()
|
||||
|
||||
// Gods can sometimes get into away state (via gestures)
|
||||
// without setting the appropriate control flag. JC
|
||||
LLVOAvatar* av = mAvatarObject;
|
||||
if (mControlFlags & AGENT_CONTROL_AWAY
|
||||
|| (av
|
||||
&& (av->mSignaledAnimations.find(ANIM_AGENT_AWAY) != av->mSignaledAnimations.end())))
|
||||
|| (isAgentAvatarValid()
|
||||
&& (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AWAY) != mAvatarObject->mSignaledAnimations.end())))
|
||||
{
|
||||
sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP);
|
||||
clearControlFlags(AGENT_CONTROL_AWAY);
|
||||
@@ -2307,7 +2321,7 @@ BOOL LLAgent::getBusy() const
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *), void *callback_data, F32 stop_distance, F32 rot_threshold)
|
||||
{
|
||||
if (!gAgent.getAvatarObject())
|
||||
if (!isAgentAvatarValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2353,7 +2367,10 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s
|
||||
if ( distance > 1.f && heightDelta > (sqrtf(mAutoPilotStopDistance) + 1.f))
|
||||
{
|
||||
setFlying(TRUE);
|
||||
mAutoPilotFlyOnStop = TRUE;
|
||||
// Do not force flying for "Sit" behavior to prevent flying after pressing "Stand"
|
||||
// from an object. See EXT-1655.
|
||||
if ("Sit" != mAutoPilotBehaviorName)
|
||||
mAutoPilotFlyOnStop = TRUE;
|
||||
}
|
||||
|
||||
mAutoPilot = TRUE;
|
||||
@@ -2422,6 +2439,13 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
|
||||
{
|
||||
resetAxes(mAutoPilotTargetFacing);
|
||||
}
|
||||
// Restore previous flying state before invoking mAutoPilotFinishedCallback to allow
|
||||
// callback function to change the flying state (like in near_sit_down_point()).
|
||||
// If the user cancelled, don't change the fly state
|
||||
if (!user_cancel)
|
||||
{
|
||||
setFlying(mAutoPilotFlyOnStop);
|
||||
}
|
||||
//NB: auto pilot can terminate for a reason other than reaching the destination
|
||||
if (mAutoPilotFinishedCallback)
|
||||
{
|
||||
@@ -2429,11 +2453,6 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
|
||||
}
|
||||
mLeaderID = LLUUID::null;
|
||||
|
||||
// If the user cancelled, don't change the fly state
|
||||
if (!user_cancel)
|
||||
{
|
||||
setFlying(mAutoPilotFlyOnStop);
|
||||
}
|
||||
setControlFlags(AGENT_CONTROL_STOP);
|
||||
|
||||
if (user_cancel && !mAutoPilotBehaviorName.empty())
|
||||
@@ -2468,10 +2487,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
|
||||
mAutoPilotTargetGlobal = object->getPositionGlobal();
|
||||
}
|
||||
|
||||
if (mAvatarObject.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!isAgentAvatarValid()) return;
|
||||
|
||||
if (mAvatarObject->mInAir)
|
||||
{
|
||||
@@ -2549,7 +2565,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
|
||||
// If we're flying, handle autopilot points above or below you.
|
||||
if (getFlying() && xy_distance < AUTOPILOT_HEIGHT_ADJUST_DISTANCE)
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
F64 current_height = mAvatarObject->getPositionGlobal().mdV[VZ];
|
||||
F32 delta_z = (F32)(mAutoPilotTargetGlobal.mdV[VZ] - current_height);
|
||||
@@ -2684,11 +2700,7 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y)
|
||||
{
|
||||
static LLVector3 last_at_axis;
|
||||
|
||||
|
||||
if (mAvatarObject.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!isAgentAvatarValid()) return;
|
||||
|
||||
LLQuaternion av_inv_rot = ~mAvatarObject->mRoot.getWorldRotation();
|
||||
LLVector3 root_at = LLVector3::x_axis * mAvatarObject->mRoot.getWorldRotation();
|
||||
@@ -2960,7 +2972,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
}
|
||||
|
||||
// Disable mouselook-specific animations
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
|
||||
{
|
||||
@@ -3006,7 +3018,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
gMorphView->setVisible( FALSE );
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if(mCustomAnim)
|
||||
{
|
||||
@@ -3048,7 +3060,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
|
||||
gConsole->setVisible( TRUE );
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// Trigger mouselook-specific animations
|
||||
if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
|
||||
@@ -3109,7 +3121,7 @@ void LLAgent::endAnimationUpdateUI()
|
||||
}
|
||||
|
||||
// freeze avatar
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// <edit>
|
||||
//mPauseRequest = mAvatarObject->requestPause();
|
||||
@@ -3117,9 +3129,9 @@ void LLAgent::endAnimationUpdateUI()
|
||||
}
|
||||
}
|
||||
|
||||
if (getAvatarObject())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
getAvatarObject()->updateAttachmentVisibility(mCameraMode);
|
||||
mAvatarObject->updateAttachmentVisibility(mCameraMode);
|
||||
}
|
||||
|
||||
gFloaterTools->dirty();
|
||||
@@ -3145,7 +3157,7 @@ void LLAgent::updateCamera()
|
||||
|
||||
validateFocusObject();
|
||||
|
||||
if (mAvatarObject.notNull() &&
|
||||
if (isAgentAvatarValid() &&
|
||||
mAvatarObject->mIsSitting &&
|
||||
camera_mode == CAMERA_MODE_MOUSELOOK)
|
||||
{
|
||||
@@ -3259,7 +3271,7 @@ void LLAgent::updateCamera()
|
||||
//Ventrella
|
||||
if ( mCameraMode == CAMERA_MODE_FOLLOW )
|
||||
{
|
||||
if ( mAvatarObject.notNull() )
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
//--------------------------------------------------------------------------------
|
||||
// this is where the avatar's position and rotation are given to followCam, and
|
||||
@@ -3275,6 +3287,7 @@ void LLAgent::updateCamera()
|
||||
mFollowCam.copyParams(*current_cam);
|
||||
mFollowCam.setSubjectPositionAndRotation( mAvatarObject->getRenderPosition(), avatarRotationForFollowCam );
|
||||
mFollowCam.update();
|
||||
LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3504,6 +3517,11 @@ void LLAgent::updateCamera()
|
||||
}
|
||||
}
|
||||
|
||||
void LLAgent::updateLastCamera()
|
||||
{
|
||||
mLastCameraMode = mCameraMode;
|
||||
}
|
||||
|
||||
void LLAgent::updateFocusOffset()
|
||||
{
|
||||
validateFocusObject();
|
||||
@@ -3654,7 +3672,7 @@ LLVector3d LLAgent::calcThirdPersonFocusOffset()
|
||||
focus_offset.setVec(gSavedSettings.getVector3("FocusOffsetDefault"));
|
||||
|
||||
LLQuaternion agent_rot = mFrameAgent.getQuaternion();
|
||||
if (!mAvatarObject.isNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
agent_rot *= ((LLViewerObject*)(mAvatarObject->getParent()))->getRenderRotation();
|
||||
}
|
||||
@@ -3666,7 +3684,7 @@ LLVector3d LLAgent::calcThirdPersonFocusOffset()
|
||||
void LLAgent::setupSitCamera()
|
||||
{
|
||||
// agent frame entering this function is in world coordinates
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLQuaternion parent_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
|
||||
// slam agent coordinate frame to proper parent local version
|
||||
@@ -3734,7 +3752,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
{
|
||||
// Compute base camera position and look-at points.
|
||||
//F32 camera_land_height;
|
||||
LLVector3d frame_center_global = mAvatarObject.isNull() ? getPositionGlobal()
|
||||
LLVector3d frame_center_global = !isAgentAvatarValid() ? getPositionGlobal()
|
||||
: getPosGlobalFromAgent(mAvatarObject->mRoot.getWorldPosition());
|
||||
|
||||
LLVector3 upAxis = getUpAxis();
|
||||
@@ -3751,7 +3769,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
}// End Ventrella
|
||||
else if (mCameraMode == CAMERA_MODE_MOUSELOOK)
|
||||
{
|
||||
if (mAvatarObject.isNull() || mAvatarObject->mDrawable.isNull())
|
||||
if (!isAgentAvatarValid() || mAvatarObject->mDrawable.isNull())
|
||||
{
|
||||
llwarns << "Null avatar drawable!" << llendl;
|
||||
return LLVector3d::zero;
|
||||
@@ -3786,7 +3804,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
F32 camera_distance = 0.f;
|
||||
|
||||
if (mSitCameraEnabled
|
||||
&& mAvatarObject.notNull()
|
||||
&& isAgentAvatarValid()
|
||||
&& mAvatarObject->mIsSitting
|
||||
&& mSitCameraReferenceObject.notNull())
|
||||
{
|
||||
@@ -3803,7 +3821,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
local_camera_offset = mCameraZoomFraction * mCameraOffsetDefault * gSavedSettings.getF32("CameraOffsetScale");
|
||||
|
||||
// are we sitting down?
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLQuaternion parent_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
|
||||
// slam agent coordinate frame to proper parent local version
|
||||
@@ -3819,7 +3837,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
local_camera_offset = mFrameAgent.rotateToAbsolute( local_camera_offset );
|
||||
}
|
||||
|
||||
if (!mCameraCollidePlane.isExactlyZero() && (mAvatarObject.isNull() || !mAvatarObject->mIsSitting))
|
||||
if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !mAvatarObject->mIsSitting))
|
||||
{
|
||||
LLVector3 plane_normal;
|
||||
plane_normal.setVec(mCameraCollidePlane.mV);
|
||||
@@ -3872,11 +3890,11 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
||||
// set the global camera position
|
||||
LLVector3d camera_offset;
|
||||
|
||||
LLVector3 av_pos = mAvatarObject.isNull() ? LLVector3::zero : mAvatarObject->getRenderPosition();
|
||||
LLVector3 av_pos = !isAgentAvatarValid() ? LLVector3::zero : mAvatarObject->getRenderPosition();
|
||||
camera_offset.setVec( local_camera_offset );
|
||||
camera_position_global = frame_center_global + head_offset + camera_offset;
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
LLVector3d camera_lag_d;
|
||||
F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE);
|
||||
@@ -4077,7 +4095,7 @@ void LLAgent::changeCameraToMouselook(BOOL animate)
|
||||
gFocusMgr.setKeyboardFocus( NULL );
|
||||
if (gSavedSettings.getBOOL("AONoStandsInMouselook")) LLFloaterAO::stopMotion(LLFloaterAO::getCurrentStandId(), FALSE,TRUE);
|
||||
|
||||
mLastCameraMode = mCameraMode;
|
||||
updateLastCamera();
|
||||
mCameraMode = CAMERA_MODE_MOUSELOOK;
|
||||
U32 old_flags = mControlFlags;
|
||||
setControlFlags(AGENT_CONTROL_MOUSELOOK);
|
||||
@@ -4139,7 +4157,7 @@ void LLAgent::changeCameraToFollow(BOOL animate)
|
||||
}
|
||||
startCameraAnimation();
|
||||
|
||||
mLastCameraMode = mCameraMode;
|
||||
updateLastCamera();
|
||||
mCameraMode = CAMERA_MODE_FOLLOW;
|
||||
|
||||
// bang-in the current focus, position, and up vector of the follow cam
|
||||
@@ -4150,7 +4168,7 @@ void LLAgent::changeCameraToFollow(BOOL animate)
|
||||
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
mAvatarObject->mPelvisp->setPosition(LLVector3::zero);
|
||||
mAvatarObject->startMotion( ANIM_AGENT_BODY_NOISE );
|
||||
@@ -4208,7 +4226,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate)
|
||||
|
||||
mCameraZoomFraction = INITIAL_ZOOM_FRACTION;
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if (!mAvatarObject->mIsSitting)
|
||||
{
|
||||
@@ -4242,7 +4260,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate)
|
||||
mTargetCameraDistance = MIN_CAMERA_DISTANCE;
|
||||
animate = FALSE;
|
||||
}
|
||||
mLastCameraMode = mCameraMode;
|
||||
updateLastCamera();
|
||||
mCameraMode = CAMERA_MODE_THIRD_PERSON;
|
||||
U32 old_flags = mControlFlags;
|
||||
clearControlFlags(AGENT_CONTROL_MOUSELOOK);
|
||||
@@ -4254,7 +4272,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate)
|
||||
}
|
||||
|
||||
// Remove any pitch from the avatar
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
|
||||
at_axis = LLViewerCamera::getInstance()->getAtAxis();
|
||||
@@ -4338,7 +4356,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani
|
||||
LLVOAvatar::onCustomizeStart();
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
if(avatar_animate)
|
||||
{
|
||||
@@ -4458,7 +4476,7 @@ void LLAgent::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id)
|
||||
{
|
||||
if (focus.isExactlyZero())
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
mFocusTargetGlobal = getPosGlobalFromAgent(mAvatarObject->mHeadp->getWorldPosition());
|
||||
}
|
||||
@@ -4503,7 +4521,7 @@ void LLAgent::setFocusGlobal(const LLVector3d& focus, const LLUUID &object_id)
|
||||
{
|
||||
if (focus.isExactlyZero())
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
mFocusTargetGlobal = getPosGlobalFromAgent(mAvatarObject->mHeadp->getWorldPosition());
|
||||
}
|
||||
@@ -4641,7 +4659,7 @@ void LLAgent::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate)
|
||||
if (mCameraMode == CAMERA_MODE_THIRD_PERSON)
|
||||
{
|
||||
LLVector3 at_axis;
|
||||
if (mAvatarObject.notNull() && mAvatarObject->getParent())
|
||||
if (isAgentAvatarValid() && mAvatarObject->getParent())
|
||||
{
|
||||
LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
|
||||
at_axis = LLViewerCamera::getInstance()->getAtAxis();
|
||||
@@ -4708,7 +4726,7 @@ void LLAgent::lookAtLastChat()
|
||||
if (chatter->isAvatar())
|
||||
{
|
||||
LLVOAvatar *chatter_av = (LLVOAvatar*)chatter;
|
||||
if (mAvatarObject.notNull() && chatter_av->mHeadp)
|
||||
if (isAgentAvatarValid() && chatter_av->mHeadp)
|
||||
{
|
||||
delta_pos = chatter_av->mHeadp->getWorldPosition() - mAvatarObject->mHeadp->getWorldPosition();
|
||||
}
|
||||
@@ -4897,13 +4915,13 @@ void LLAgent::setStartPosition( U32 location_id )
|
||||
const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters();
|
||||
|
||||
LLVector3 agent_pos = getPositionAgent();
|
||||
LLVector3 agent_look_at = mFrameAgent.getAtAxis();
|
||||
LLVector3 agent_look_at = mFrameAgent.getAtAxis();
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// the z height is at the agent's feet
|
||||
agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ];
|
||||
}
|
||||
// the z height is at the agent's feet
|
||||
agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ];
|
||||
}
|
||||
|
||||
agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET );
|
||||
agent_pos.mV[VY] = llclamp( agent_pos.mV[VY], INSET, REGION_WIDTH - INSET );
|
||||
@@ -5020,7 +5038,7 @@ void LLAgent::onAnimStop(const LLUUID& id)
|
||||
setControlFlags(AGENT_CONTROL_FINISH_ANIM);
|
||||
|
||||
// now trigger dusting self off animation
|
||||
if (mAvatarObject.notNull() && !mAvatarObject->mBelowWater && rand() % 3 == 0)
|
||||
if (isAgentAvatarValid() && !mAvatarObject->mBelowWater && rand() % 3 == 0)
|
||||
sendAnimationRequest( ANIM_AGENT_BRUSH, ANIM_REQUEST_START );
|
||||
}
|
||||
else if (id == ANIM_AGENT_PRE_JUMP || id == ANIM_AGENT_LAND || id == ANIM_AGENT_MEDIUM_LAND)
|
||||
@@ -5127,6 +5145,9 @@ int LLAgent::convertTextToMaturity(char text)
|
||||
|
||||
bool LLAgent::sendMaturityPreferenceToServer(int preferredMaturity)
|
||||
{
|
||||
if (!getRegion())
|
||||
return false;
|
||||
|
||||
// Update agent access preference on the server
|
||||
std::string url = getRegion()->getCapability("UpdateAgentInformation");
|
||||
if (!url.empty())
|
||||
@@ -5189,7 +5210,7 @@ const LLAgentAccess& LLAgent::getAgentAccess()
|
||||
|
||||
void LLAgent::buildFullname(std::string& name) const
|
||||
{
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
name = mAvatarObject->getFullname();
|
||||
}
|
||||
@@ -5207,7 +5228,7 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const
|
||||
name.erase(0, name.length());
|
||||
}
|
||||
|
||||
if (mAvatarObject.notNull())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
name += mAvatarObject->getFullname();
|
||||
}
|
||||
@@ -5406,7 +5427,7 @@ void LLAgent::buildLocationString(std::string& str)
|
||||
|
||||
LLQuaternion LLAgent::getHeadRotation()
|
||||
{
|
||||
if (mAvatarObject.isNull() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp)
|
||||
if (!isAgentAvatarValid() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp)
|
||||
{
|
||||
return LLQuaternion::DEFAULT;
|
||||
}
|
||||
@@ -6051,8 +6072,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
|
||||
{
|
||||
gAgent.mNumPendingQueries--;
|
||||
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (!avatarp || avatarp->isDead())
|
||||
if (!isAgentAvatarValid())
|
||||
{
|
||||
llwarns << "No avatar for user in cached texture update!" << llendl;
|
||||
return;
|
||||
@@ -6084,7 +6104,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
|
||||
&& gAgent.mActiveCacheQueries[ texture_index ] == query_id)
|
||||
{
|
||||
//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
|
||||
avatarp->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id);
|
||||
gAgent.getAvatarObject()->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id);
|
||||
//avatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
|
||||
gAgent.mActiveCacheQueries[ texture_index ] = 0;
|
||||
num_results++;
|
||||
@@ -6093,20 +6113,19 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
|
||||
|
||||
llinfos << "Received cached texture response for " << num_results << " textures." << llendl;
|
||||
|
||||
avatarp->updateMeshTextures();
|
||||
gAgent.getAvatarObject()->updateMeshTextures();
|
||||
|
||||
if (gAgent.mNumPendingQueries == 0)
|
||||
{
|
||||
// RN: not sure why composites are disabled at this point
|
||||
avatarp->setCompositeUpdatesEnabled(TRUE);
|
||||
gAgent.getAvatarObject()->setCompositeUpdatesEnabled(TRUE);
|
||||
gAgent.sendAgentSetAppearance();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLAgent::anyControlGrabbed() const
|
||||
{
|
||||
U32 i;
|
||||
for (i = 0; i < TOTAL_CONTROLS; i++)
|
||||
for (U32 i = 0; i < TOTAL_CONTROLS; i++)
|
||||
{
|
||||
if (gAgent.mControlsTakenCount[i] > 0)
|
||||
return TRUE;
|
||||
@@ -6152,11 +6171,10 @@ BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global )
|
||||
|
||||
void LLAgent::clearVisualParams(void *data)
|
||||
{
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (avatarp)
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
avatarp->clearVisualParamWeights();
|
||||
avatarp->updateVisualParams();
|
||||
gAgent.getAvatarObject()->clearVisualParamWeights();
|
||||
gAgent.getAvatarObject()->updateVisualParams();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6183,9 +6201,9 @@ bool LLAgent::teleportCore(bool is_local)
|
||||
// sync with other viewers. Discuss in DEV-14145/VWR-6744 before reenabling.
|
||||
|
||||
// Stop all animation before actual teleporting
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (avatarp)
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
for ( LLVOAvatar::AnimIterator anim_it= avatarp->mPlayingAnimations.begin();
|
||||
anim_it != avatarp->mPlayingAnimations.end();
|
||||
++anim_it)
|
||||
@@ -6477,10 +6495,9 @@ void LLAgent::stopCurrentAnimations()
|
||||
{
|
||||
// This function stops all current overriding animations on this
|
||||
// avatar, propagating this change back to the server.
|
||||
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (avatarp)
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
for ( LLVOAvatar::AnimIterator anim_it =
|
||||
avatarp->mPlayingAnimations.begin();
|
||||
anim_it != avatarp->mPlayingAnimations.end();
|
||||
@@ -7578,7 +7595,7 @@ void LLAgent::addWearableToAgentInventory(
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLAgent::sendAgentSetAppearance()
|
||||
{
|
||||
if (mAvatarObject.isNull()) return;
|
||||
if (!isAgentAvatarValid()) return;
|
||||
|
||||
if (mNumPendingQueries > 0 && !gAgent.cameraCustomizeAvatar())
|
||||
{
|
||||
|
||||
@@ -123,6 +123,8 @@ inline bool operator==(const LLGroupData &a, const LLGroupData &b)
|
||||
return (a.mID == b.mID);
|
||||
}
|
||||
|
||||
BOOL isAgentAvatarValid();
|
||||
|
||||
// forward declarations
|
||||
|
||||
//
|
||||
@@ -449,6 +451,7 @@ public:
|
||||
void cameraPanLeft(const F32 meters);
|
||||
void cameraPanUp(const F32 meters);
|
||||
|
||||
void updateLastCamera();
|
||||
void updateFocusOffset();
|
||||
void validateFocusObject();
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ void request_initial_instant_messages()
|
||||
if (!requested
|
||||
&& gMessageSystem
|
||||
&& LLMuteList::getInstance()->isLoaded()
|
||||
&& gAgent.getAvatarObject())
|
||||
&& isAgentAvatarValid())
|
||||
{
|
||||
// Auto-accepted inventory items may require the avatar object
|
||||
// to build a correct name. Likewise, inventory offers from
|
||||
@@ -800,7 +800,7 @@ bool LLAppViewer::init()
|
||||
minSpecs += "\n";
|
||||
unsupported = true;
|
||||
}
|
||||
if(gSysCPU.getMhz() < minCPU)
|
||||
if(gSysCPU.getMHz() < minCPU)
|
||||
{
|
||||
minSpecs += LLNotifications::instance().getGlobalString("UnsupportedCPU");
|
||||
minSpecs += "\n";
|
||||
@@ -2358,7 +2358,7 @@ void LLAppViewer::writeSystemInfo()
|
||||
//need to put in something to lie about this stuff
|
||||
gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString();
|
||||
gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily();
|
||||
gDebugInfo["CPUInfo"]["CPUMhz"] = gSysCPU.getMhz();
|
||||
gDebugInfo["CPUInfo"]["CPUMhz"] = gSysCPU.getMHz();
|
||||
gDebugInfo["CPUInfo"]["CPUAltivec"] = gSysCPU.hasAltivec();
|
||||
gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE();
|
||||
gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2();
|
||||
@@ -2633,26 +2633,27 @@ void LLAppViewer::initMarkerFile()
|
||||
|
||||
if(LLAPRFile::isExist(logout_marker_file, LL_APR_RB))
|
||||
{
|
||||
LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << LL_ENDL;
|
||||
gLastExecEvent = LAST_EXEC_LOGOUT_FROZE;
|
||||
LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
|
||||
LLAPRFile::remove(logout_marker_file);
|
||||
}
|
||||
if(LLAPRFile::isExist(llerror_marker_file, LL_APR_RB))
|
||||
{
|
||||
llinfos << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << llendl;
|
||||
if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
|
||||
else gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
|
||||
LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
|
||||
LLAPRFile::remove(llerror_marker_file);
|
||||
}
|
||||
if(LLAPRFile::isExist(error_marker_file, LL_APR_RB))
|
||||
{
|
||||
LL_INFOS("MarkerFile") << "Last exec crashed, setting LastExecEvent to " << LAST_EXEC_OTHER_CRASH << LL_ENDL;
|
||||
if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
|
||||
else gLastExecEvent = LAST_EXEC_OTHER_CRASH;
|
||||
LL_INFOS("MarkerFile") << "Last exec crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
|
||||
LLAPRFile::remove(error_marker_file);
|
||||
}
|
||||
|
||||
LLAPRFile::remove(logout_marker_file);
|
||||
LLAPRFile::remove(llerror_marker_file);
|
||||
LLAPRFile::remove(error_marker_file);
|
||||
|
||||
// No new markers if another instance is running.
|
||||
if(anotherInstanceRunning())
|
||||
{
|
||||
@@ -3988,7 +3989,7 @@ void LLAppViewer::idleNetwork()
|
||||
// Check that the circuit between the viewer and the agent's current
|
||||
// region is still alive
|
||||
LLViewerRegion *agent_region = gAgent.getRegion();
|
||||
if (agent_region)
|
||||
if (agent_region && (LLStartUp::getStartupState()==STATE_STARTED))
|
||||
{
|
||||
LLUUID this_region_id = agent_region->getRegionID();
|
||||
bool this_region_alive = agent_region->isAlive();
|
||||
|
||||
@@ -627,9 +627,9 @@ void LLFeatureManager::applyBaseMasks()
|
||||
|
||||
#if LL_SOLARIS && defined(__sparc) // even low MHz SPARCs are fast
|
||||
#error The 800 is hinky. Would something like a LL_MIN_MHZ make more sense here?
|
||||
if (gSysCPU.getMhz() < 800)
|
||||
if (gSysCPU.getMHz() < 800)
|
||||
#else
|
||||
if (gSysCPU.getMhz() < 1100)
|
||||
if (gSysCPU.getMHz() < 1100)
|
||||
#endif
|
||||
{
|
||||
maskFeatures("CPUSlow");
|
||||
|
||||
@@ -405,7 +405,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj,
|
||||
}
|
||||
|
||||
// Collect all of the objects
|
||||
LLDynamicArray<LLViewerObject*> objects;
|
||||
std::vector<LLViewerObject*> objects;
|
||||
|
||||
root->addThisAndNonJointChildren(objects);
|
||||
addAsFamily(objects, add_to_end);
|
||||
@@ -451,7 +451,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const std::vector<LLV
|
||||
BOOL send_to_sim)
|
||||
{
|
||||
// Collect all of the objects, children included
|
||||
LLDynamicArray<LLViewerObject*> objects;
|
||||
std::vector<LLViewerObject*> objects;
|
||||
|
||||
//clear primary object (no primary object)
|
||||
mSelectedObjects->mPrimaryObject = NULL;
|
||||
@@ -575,7 +575,7 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s
|
||||
if(!object->isSelected()) return;
|
||||
|
||||
// Collect all of the objects, and remove them
|
||||
LLDynamicArray<LLViewerObject*> objects;
|
||||
std::vector<LLViewerObject*> objects;
|
||||
|
||||
if (include_entire_object)
|
||||
{
|
||||
@@ -821,7 +821,7 @@ LLObjectSelectionHandle LLSelectMgr::setHoverObject(LLViewerObject *objectp, S32
|
||||
{
|
||||
|
||||
// Collect all of the objects
|
||||
LLDynamicArray<LLViewerObject*> objects;
|
||||
std::vector<LLViewerObject*> objects;
|
||||
objectp = objectp->getRootEdit();
|
||||
objectp->addThisAndNonJointChildren(objects);
|
||||
|
||||
@@ -1312,7 +1312,7 @@ void LLSelectMgr::promoteSelectionToRoot()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLSelectMgr::demoteSelectionToIndividuals()
|
||||
{
|
||||
LLDynamicArray<LLViewerObject*> objects;
|
||||
std::vector<LLViewerObject*> objects;
|
||||
|
||||
for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
|
||||
iter != getSelection()->root_end(); iter++)
|
||||
@@ -1321,7 +1321,7 @@ void LLSelectMgr::demoteSelectionToIndividuals()
|
||||
object->addThisAndNonJointChildren(objects);
|
||||
}
|
||||
|
||||
if (objects.getLength())
|
||||
if (!objects.empty())
|
||||
{
|
||||
deselectAll();
|
||||
for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
|
||||
@@ -3604,7 +3604,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
|
||||
{
|
||||
LLViewerObject* attach_object = mSelectedObjects->getFirstRootObject();
|
||||
|
||||
if (!attach_object || !gAgent.getAvatarObject() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD)
|
||||
if (!attach_object || !isAgentAvatarValid() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4888,7 +4888,7 @@ void LLSelectMgr::updateSelectionSilhouette(LLObjectSelectionHandle object_handl
|
||||
generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin());
|
||||
changed_objects.push_back(objectp);
|
||||
}
|
||||
else if (objectp->isAttachment())
|
||||
else if (objectp->isAttachment() && objectp->getRootEdit() && objectp->getRootEdit()->mDrawable.notNull())
|
||||
{
|
||||
//RN: hack for orthogonal projection of HUD attachments
|
||||
LLViewerJointAttachment* attachment_pt = (LLViewerJointAttachment*)objectp->getRootEdit()->mDrawable->getParent();
|
||||
@@ -4916,9 +4916,9 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
|
||||
|
||||
LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
if (for_hud && avatar)
|
||||
if (isAgentAvatarValid() && for_hud)
|
||||
{
|
||||
LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
LLBBox hud_bbox = avatar->getHUDBBox();
|
||||
|
||||
F32 cur_zoom = gAgent.mHUDCurZoom;
|
||||
@@ -5012,7 +5012,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
|
||||
}
|
||||
}
|
||||
|
||||
if (for_hud && avatar)
|
||||
if (isAgentAvatarValid() && for_hud)
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
@@ -5374,7 +5374,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
|
||||
if (volume)
|
||||
{
|
||||
F32 silhouette_thickness;
|
||||
if (is_hud_object && gAgent.getAvatarObject())
|
||||
if (isAgentAvatarValid() && is_hud_object)
|
||||
{
|
||||
silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgent.mHUDCurZoom;
|
||||
}
|
||||
@@ -5569,7 +5569,7 @@ void LLSelectMgr::updateSelectionCenter()
|
||||
{
|
||||
mSelectedObjects->mSelectType = getSelectTypeForObject(object);
|
||||
|
||||
if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
|
||||
if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
|
||||
{
|
||||
mPauseRequest = gAgent.getAvatarObject()->requestPause();
|
||||
}
|
||||
@@ -5578,7 +5578,7 @@ void LLSelectMgr::updateSelectionCenter()
|
||||
mPauseRequest = NULL;
|
||||
}
|
||||
|
||||
if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && gAgent.getAvatarObject())
|
||||
if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && isAgentAvatarValid())
|
||||
{
|
||||
// reset hud ZOOM
|
||||
gAgent.mHUDTargetZoom = 1.f;
|
||||
|
||||
@@ -476,7 +476,7 @@ bool idle_startup()
|
||||
{
|
||||
std::string diagnostic = "Could not start address resolution system";
|
||||
LL_WARNS("AppInit") << diagnostic << LL_ENDL;
|
||||
LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().insert("DIAGNOSTIC", diagnostic));
|
||||
LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -536,7 +536,7 @@ bool idle_startup()
|
||||
{
|
||||
std::string diagnostic = llformat(" Error: %d", gMessageSystem->getErrorCode());
|
||||
LL_WARNS("AppInit") << diagnostic << LL_ENDL;
|
||||
LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().insert("DIAGNOSTIC", diagnostic));
|
||||
LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
|
||||
}
|
||||
|
||||
#if LL_WINDOWS
|
||||
@@ -559,7 +559,7 @@ bool idle_startup()
|
||||
}
|
||||
else
|
||||
{
|
||||
LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().insert("PATH", message_template_path));
|
||||
LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().with("PATH", message_template_path));
|
||||
}
|
||||
|
||||
if(gMessageSystem && gMessageSystem->isOK())
|
||||
|
||||
@@ -960,6 +960,7 @@ LLSurfacePatch *LLSurface::resolvePatchRegion(const LLVector3 &pos_region) const
|
||||
|
||||
LLSurfacePatch *LLSurface::resolvePatchGlobal(const LLVector3d &pos_global) const
|
||||
{
|
||||
llassert(mRegionp);
|
||||
LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(pos_global);
|
||||
return resolvePatchRegion(pos_region);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ LLViewerJoystick::LLViewerJoystick()
|
||||
memset(mBtn, 0, sizeof(mBtn));
|
||||
|
||||
// factor in bandwidth? bandwidth = gViewerStats->mKBitStat
|
||||
mPerfScale = 4000.f / gSysCPU.getMhz();
|
||||
mPerfScale = 4000.f / gSysCPU.getMHz();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -370,11 +370,10 @@ void LLViewerObject::markDead()
|
||||
|
||||
if (flagAnimSource())
|
||||
{
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (avatarp && !avatarp->isDead())
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
// stop motions associated with this object
|
||||
avatarp->stopMotionFromSource(mID);
|
||||
gAgent.getAvatarObject()->stopMotionFromSource(mID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,11 +578,11 @@ void LLViewerObject::removeChild(LLViewerObject *childp)
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerObject::addThisAndAllChildren(LLDynamicArray<LLViewerObject*>& objects)
|
||||
void LLViewerObject::addThisAndAllChildren(std::vector<LLViewerObject*>& objects)
|
||||
{
|
||||
objects.put(this);
|
||||
objects.push_back(this);
|
||||
for (child_list_t::iterator iter = mChildList.begin();
|
||||
iter != mChildList.end(); iter++)
|
||||
iter != mChildList.end(); ++iter)
|
||||
{
|
||||
LLViewerObject* child = *iter;
|
||||
if (!child->isAvatar())
|
||||
@@ -593,16 +592,16 @@ void LLViewerObject::addThisAndAllChildren(LLDynamicArray<LLViewerObject*>& obje
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerObject::addThisAndNonJointChildren(LLDynamicArray<LLViewerObject*>& objects)
|
||||
void LLViewerObject::addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects)
|
||||
{
|
||||
objects.put(this);
|
||||
objects.push_back(this);
|
||||
// don't add any attachments when temporarily selecting avatar
|
||||
if (isAvatar())
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (child_list_t::iterator iter = mChildList.begin();
|
||||
iter != mChildList.end(); iter++)
|
||||
iter != mChildList.end(); ++iter)
|
||||
{
|
||||
LLViewerObject* child = *iter;
|
||||
if ( (!child->isAvatar()) && (!child->isJointChild()))
|
||||
@@ -615,7 +614,7 @@ void LLViewerObject::addThisAndNonJointChildren(LLDynamicArray<LLViewerObject*>&
|
||||
BOOL LLViewerObject::isChild(LLViewerObject *childp) const
|
||||
{
|
||||
for (child_list_t::const_iterator iter = mChildList.begin();
|
||||
iter != mChildList.end(); iter++)
|
||||
iter != mChildList.end(); ++iter)
|
||||
{
|
||||
LLViewerObject* testchild = *iter;
|
||||
if (testchild == childp)
|
||||
@@ -629,7 +628,7 @@ BOOL LLViewerObject::isChild(LLViewerObject *childp) const
|
||||
BOOL LLViewerObject::isSeat() const
|
||||
{
|
||||
for (child_list_t::const_iterator iter = mChildList.begin();
|
||||
iter != mChildList.end(); iter++)
|
||||
iter != mChildList.end(); ++iter)
|
||||
{
|
||||
LLViewerObject* child = *iter;
|
||||
if (child->isAvatar())
|
||||
@@ -2915,7 +2914,8 @@ void LLViewerObject::updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax)
|
||||
LLVector3 size = getScale();
|
||||
newMin.setVec(center-size);
|
||||
newMax.setVec(center+size);
|
||||
mDrawable->setPositionGroup((newMin + newMax) * 0.5f);
|
||||
if(mDrawable.notNull())
|
||||
mDrawable->setPositionGroup((newMin + newMax) * 0.5f);
|
||||
}
|
||||
|
||||
F32 LLViewerObject::getBinRadius()
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <map>
|
||||
|
||||
#include "llassetstorage.h"
|
||||
#include "lldarrayptr.h"
|
||||
#include "llhudtext.h"
|
||||
#include "llhudicon.h"
|
||||
#include "llinventory.h"
|
||||
@@ -243,8 +242,8 @@ public:
|
||||
virtual void removeChild(LLViewerObject *childp);
|
||||
const_child_list_t& getChildren() const { return mChildList; }
|
||||
S32 numChildren() const { return mChildList.size(); }
|
||||
void addThisAndAllChildren(LLDynamicArray<LLViewerObject*>& objects);
|
||||
void addThisAndNonJointChildren(LLDynamicArray<LLViewerObject*>& objects);
|
||||
void addThisAndAllChildren(std::vector<LLViewerObject*>& objects);
|
||||
void addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects);
|
||||
BOOL isChild(LLViewerObject *childp) const;
|
||||
BOOL isSeat() const;
|
||||
|
||||
|
||||
@@ -1235,8 +1235,7 @@ void LLViewerObjectList::generatePickList(LLCamera &camera)
|
||||
}
|
||||
|
||||
// add all hud objects to pick list
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
if (avatarp)
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
LLVOAvatar* avatarp = gAgent.getAvatarObject();
|
||||
for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
|
||||
|
||||
@@ -763,13 +763,17 @@ BOOL LLViewerParcelMgr::canHearSound(const LLVector3d &pos_global) const
|
||||
BOOL LLViewerParcelMgr::inAgentParcel(const LLVector3d &pos_global) const
|
||||
{
|
||||
LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(pos_global);
|
||||
if (region != gAgent.getRegion())
|
||||
LLViewerRegion* agent_region = gAgent.getRegion();
|
||||
if (!region || !agent_region)
|
||||
return FALSE;
|
||||
|
||||
if (region != agent_region)
|
||||
{
|
||||
// Can't be in the agent parcel if you're not in the same region.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LLVector3 pos_region = gAgent.getRegion()->getPosRegionFromGlobal(pos_global);
|
||||
LLVector3 pos_region = agent_region->getPosRegionFromGlobal(pos_global);
|
||||
S32 row = S32(pos_region.mV[VY] / PARCEL_GRID_STEP_METERS);
|
||||
S32 column = S32(pos_region.mV[VX] / PARCEL_GRID_STEP_METERS);
|
||||
|
||||
@@ -838,8 +842,11 @@ void LLViewerParcelMgr::renderParcelCollision()
|
||||
if (mRenderCollision && gSavedSettings.getBOOL("ShowBanLines"))
|
||||
{
|
||||
LLViewerRegion* regionp = gAgent.getRegion();
|
||||
BOOL use_pass = mCollisionParcel->getParcelFlag(PF_USE_PASS_LIST);
|
||||
renderCollisionSegments(mCollisionSegments, use_pass, regionp);
|
||||
if (regionp)
|
||||
{
|
||||
BOOL use_pass = mCollisionParcel->getParcelFlag(PF_USE_PASS_LIST);
|
||||
renderCollisionSegments(mCollisionSegments, use_pass, regionp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1684,10 +1691,16 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
|
||||
{
|
||||
optionally_start_music(music_url);
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl;
|
||||
// clears the URL
|
||||
gAudiop->startInternetStream(LLStringUtil::null);
|
||||
}
|
||||
}
|
||||
else if (!gAudiop->getInternetStreamURL().empty())
|
||||
{
|
||||
llinfos << "Stopping parcel music" << llendl;
|
||||
llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl;
|
||||
gAudiop->startInternetStream(LLStringUtil::null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1585,7 +1585,7 @@ const LLVector3 LLVOAvatar::getRenderPosition() const
|
||||
{
|
||||
return getPositionAgent();
|
||||
}
|
||||
else if (isRoot())
|
||||
else if (isRoot() || !mDrawable->getParent())
|
||||
{
|
||||
return mDrawable->getPositionAgent();
|
||||
}
|
||||
@@ -3029,7 +3029,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
|
||||
mDrawable->movePartition();
|
||||
|
||||
//force a move if sitting on an active object
|
||||
if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive())
|
||||
if (getParent() && ((LLViewerObject*)getParent())->mDrawable.notNull() && ((LLViewerObject*) getParent())->mDrawable->isActive())
|
||||
{
|
||||
gPipeline.markMoved(mDrawable, TRUE);
|
||||
}
|
||||
@@ -7358,7 +7358,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
|
||||
{
|
||||
if (!mDrawable || mDrawable.isNull())
|
||||
if (!mDrawable || mDrawable.isNull() || sit_object->mDrawable.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ void LLVOVolume::updateTextureVirtualSize()
|
||||
{
|
||||
// Update the pixel area of all faces
|
||||
|
||||
if(!isVisible())
|
||||
if(!isVisible() || mDrawable.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1037,13 +1037,14 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable)
|
||||
|
||||
U32 LLPipeline::addObject(LLViewerObject *vobj)
|
||||
{
|
||||
llassert_always(vobj);
|
||||
if (gNoRender)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const LLCachedControl<bool> render_delay_creation("RenderDelayCreation",false);
|
||||
if (render_delay_creation)
|
||||
if (!vobj->isAvatar() && render_delay_creation)
|
||||
{
|
||||
mCreateQ.push_back(vobj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user