Merge remote-tracking branch 'Liru/master'
This commit is contained in:
4
README
4
README
@@ -15,8 +15,8 @@ Singularity Viewer is a SecondLife(tm) protocol compatible client application.
|
||||
It can be used to access SecondLife services as well as a number of others such
|
||||
as those based upon the OpenSim platform.
|
||||
|
||||
Singulariy is maintained by a small group of volunteers who can be contacted
|
||||
both, in-world (SingularityViewer group) as well on IRC (#SingularityViewer
|
||||
Singularity is maintained by a small group of volunteers who can be contacted
|
||||
both, in-world (SingularityViewer group) as well as on IRC (#SingularityViewer
|
||||
@ FreeNode). Bug requests and features requests can be submitted through our
|
||||
Issue Tracker (http://code.google.com/p/singularity-viewer/issues/list or from
|
||||
the viewer menu: Help --> Bug Reporting --> Singularity Issue Tracker...)
|
||||
|
||||
@@ -14,7 +14,7 @@ IF("$ENV{PKG_CONFIG_LIBDIR}" STREQUAL "")
|
||||
else (WORD_SIZE EQUAL 32)
|
||||
SET(PKG_CONFIG_NO_MULTI_GUESS /usr/lib64 /usr/lib)
|
||||
SET(PKG_CONFIG_NO_MULTI_LOCAL_GUESS /usr/local/lib64 /usr/local/lib)
|
||||
SET(PKG_CONFIG_MULTI_GUESS /usr/local/lib/x86_64-linux-gnu)
|
||||
SET(PKG_CONFIG_MULTI_GUESS /usr/lib/x86_64-linux-gnu)
|
||||
SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usr/local/lib/x86_64-linux-gnu)
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
|
||||
|
||||
@@ -133,6 +133,26 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
|
||||
|
||||
parameters.cp_reduce = base.getRawDiscardLevel();
|
||||
|
||||
if(parameters.cp_reduce == 0 && *(U16*)(base.getData() + base.getDataSize() - 2) != 0xD9FF)
|
||||
{
|
||||
bool failed = true;
|
||||
for(S32 i = base.getDataSize()-1; i > 42; --i)
|
||||
{
|
||||
if(base.getData()[i] != 0x00)
|
||||
{
|
||||
failed = *(U16*)(base.getData()+i-1) != 0xD9FF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(failed)
|
||||
{
|
||||
opj_image_destroy(image);
|
||||
base.decodeFailed();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* decode the code-stream */
|
||||
/* ---------------------- */
|
||||
|
||||
@@ -212,7 +232,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod
|
||||
|
||||
if(image->numcomps <= first_channel)
|
||||
{
|
||||
llwarns << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl;
|
||||
LL_WARNS("Texture") << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl;
|
||||
if (image)
|
||||
{
|
||||
opj_image_destroy(image);
|
||||
|
||||
@@ -116,6 +116,15 @@ void AICurlEasyRequestStateMachine::multiplex_impl(state_type run_state)
|
||||
{
|
||||
set_state(AICurlEasyRequestStateMachine_waitAdded);
|
||||
idle(); // Wait till AICurlEasyRequestStateMachine::added_to_multi_handle() is called.
|
||||
|
||||
// This is a work around for the case that this request had a bad url, in order to avoid a crash later on.
|
||||
bool empty_url = AICurlEasyRequest_rat(*mCurlEasyRequest)->getLowercaseServicename().empty();
|
||||
if (empty_url)
|
||||
{
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
|
||||
// Only AFTER going idle, add request to curl thread; this is needed because calls to set_state() are
|
||||
// ignored when the statemachine is not idle, and theoretically the callbacks could be called
|
||||
// immediately after this call.
|
||||
|
||||
@@ -214,7 +214,7 @@ std::string AIPerService::extract_canonical_servicename(std::string const& url)
|
||||
}
|
||||
++p;
|
||||
}
|
||||
// Strip of any trailing ":80".
|
||||
// Strip off any trailing ":80".
|
||||
if (p - 3 == port_colon && p[-1] == '0' && p[-2] == '8')
|
||||
{
|
||||
return servicename.substr(0, p - hostname - 3);
|
||||
|
||||
@@ -59,11 +59,12 @@ LLHost::LLHost(const std::string& ip_and_port)
|
||||
mIP = ip_string_to_u32(ip_str.c_str());
|
||||
mPort = atol(port_str.c_str());
|
||||
}
|
||||
mHostNotFound = 0;
|
||||
}
|
||||
|
||||
std::string LLHost::getString() const
|
||||
{
|
||||
return llformat("%s:%u", u32_to_ip_string(mIP), mPort);
|
||||
return llformat("%s:%hu", u32_to_ip_string(mIP), mPort);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,16 +88,27 @@ std::string LLHost::getHostName() const
|
||||
llwarns << "LLHost::getHostName() : Invalid IP address" << llendl;
|
||||
return std::string();
|
||||
}
|
||||
if (mHostNotFound)
|
||||
{
|
||||
// We already checked this... avoid freezing the viewer 5 seconds again and again.
|
||||
llwarns << "LLHost::getHostName() : Returning cached HOST_NOT_FOUND." << llendl;
|
||||
return std::string();
|
||||
}
|
||||
he = gethostbyaddr((char *)&mIP, sizeof(mIP), AF_INET);
|
||||
if (!he)
|
||||
{
|
||||
#if LL_WINDOWS
|
||||
llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: "
|
||||
<< WSAGetLastError() << llendl;
|
||||
int err = WSAGetLastError();
|
||||
int err_host_not_found = WSAHOST_NOT_FOUND;
|
||||
#else
|
||||
llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: "
|
||||
<< h_errno << llendl;
|
||||
int err = h_errno;
|
||||
int err_host_not_found = HOST_NOT_FOUND;
|
||||
#endif
|
||||
llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " << err << llendl;
|
||||
if (err == err_host_not_found)
|
||||
{
|
||||
mHostNotFound = 1;
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
else
|
||||
@@ -125,6 +137,7 @@ BOOL LLHost::setHostByName(const std::string& hostname)
|
||||
if (he)
|
||||
{
|
||||
mIP = *(U32 *)he->h_addr_list[0];
|
||||
mHostNotFound = 0;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -38,7 +38,8 @@ const U32 INVALID_HOST_IP_ADDRESS = 0x0;
|
||||
|
||||
class LLHost {
|
||||
protected:
|
||||
U32 mPort;
|
||||
U16 mPort;
|
||||
mutable U16 mHostNotFound; // Singularity addition; caches a failed IP -> hostname lookup.
|
||||
U32 mIP;
|
||||
public:
|
||||
|
||||
@@ -47,17 +48,20 @@ public:
|
||||
// CREATORS
|
||||
LLHost()
|
||||
: mPort(INVALID_PORT),
|
||||
mHostNotFound(1),
|
||||
mIP(INVALID_HOST_IP_ADDRESS)
|
||||
{ } // STL's hash_map expect this T()
|
||||
|
||||
LLHost( U32 ipv4_addr, U32 port )
|
||||
: mPort( port )
|
||||
: mPort(port),
|
||||
mHostNotFound(0)
|
||||
{
|
||||
mIP = ipv4_addr;
|
||||
}
|
||||
|
||||
LLHost( const std::string& ipv4_addr, U32 port )
|
||||
: mPort( port )
|
||||
: mPort(port),
|
||||
mHostNotFound(0)
|
||||
{
|
||||
mIP = ip_string_to_u32(ipv4_addr.c_str());
|
||||
}
|
||||
@@ -68,6 +72,7 @@ public:
|
||||
U32 port = (U32)(ip_port & (U64)0xFFFFFFFF);
|
||||
mIP = ip;
|
||||
mPort = port;
|
||||
mHostNotFound = 0;
|
||||
}
|
||||
|
||||
explicit LLHost(const std::string& ip_and_port);
|
||||
@@ -76,15 +81,15 @@ public:
|
||||
{ }
|
||||
|
||||
// MANIPULATORS
|
||||
void set( U32 ip, U32 port ) { mIP = ip; mPort = port; }
|
||||
void set( const std::string& ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr.c_str()); mPort = port; }
|
||||
void setAddress( const std::string& ipstr ) { mIP = ip_string_to_u32(ipstr.c_str()); }
|
||||
void setAddress( U32 ip ) { mIP = ip; }
|
||||
void set( U32 ip, U32 port ) { mIP = ip; mPort = port; mHostNotFound = 0; }
|
||||
void set( const std::string& ipstr, U32 port ) { mIP = ip_string_to_u32(ipstr.c_str()); mPort = port; mHostNotFound = 0; }
|
||||
void setAddress( const std::string& ipstr ) { mIP = ip_string_to_u32(ipstr.c_str()); mHostNotFound = 0; }
|
||||
void setAddress( U32 ip ) { mIP = ip; mHostNotFound = 0; }
|
||||
void setPort( U32 port ) { mPort = port; }
|
||||
BOOL setHostByName(const std::string& hname);
|
||||
|
||||
LLHost& operator=(const LLHost &rhs);
|
||||
void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT;};
|
||||
void invalidate() { mIP = INVALID_HOST_IP_ADDRESS; mPort = INVALID_PORT; mHostNotFound = 1; }
|
||||
|
||||
// READERS
|
||||
U32 getAddress() const { return mIP; }
|
||||
|
||||
@@ -48,8 +48,28 @@ LLDir_Win32::LLDir_Win32()
|
||||
|
||||
WCHAR w_str[MAX_PATH];
|
||||
|
||||
HRESULT (WINAPI* pSHGetKnownFolderPath)(REFKNOWNFOLDERID rfid, DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath) = NULL;
|
||||
HMODULE shell = LoadLibrary(L"shell32");
|
||||
if(shell) //SHGetSpecialFolderPath is deprecated from Vista an onwards. Try to use SHGetKnownFolderPath if it's available
|
||||
{
|
||||
pSHGetKnownFolderPath = (HRESULT (WINAPI *)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *))GetProcAddress(shell, "SHGetKnownFolderPath");
|
||||
}
|
||||
|
||||
// Application Data is where user settings go
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_APPDATA, TRUE);
|
||||
if(pSHGetKnownFolderPath)
|
||||
{
|
||||
WCHAR* pPath = NULL;
|
||||
if((*pSHGetKnownFolderPath)(FOLDERID_RoamingAppData, 0, NULL, &pPath) == S_OK)
|
||||
wcscpy_s(w_str,pPath);
|
||||
else
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_APPDATA, TRUE);
|
||||
if(pPath)
|
||||
CoTaskMemFree(pPath);
|
||||
}
|
||||
else //XP doesn't support SHGetKnownFolderPath
|
||||
{
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_APPDATA, TRUE);
|
||||
}
|
||||
|
||||
mOSUserDir = utf16str_to_utf8str(llutf16string(w_str));
|
||||
|
||||
@@ -64,17 +84,14 @@ LLDir_Win32::LLDir_Win32()
|
||||
// We used to store the cache in AppData\Roaming, and the installer
|
||||
// cleans up that version on upgrade. JC
|
||||
|
||||
if(HMODULE shell = LoadLibrary(L"shell32")) //SHGetSpecialFolderPath is deprecated from Vista an onwards. Try to use SHGetSpecialFolderPath if it's available
|
||||
|
||||
if(pSHGetKnownFolderPath)
|
||||
{
|
||||
HRESULT (WINAPI* pSHGetKnownFolderPath)(REFKNOWNFOLDERID rfid, DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath);
|
||||
pSHGetKnownFolderPath = (HRESULT (WINAPI *)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *))GetProcAddress(shell, "SHGetKnownFolderPath");
|
||||
WCHAR* pPath = NULL;
|
||||
if(pSHGetKnownFolderPath && (*pSHGetKnownFolderPath)(FOLDERID_LocalAppData, 0, NULL, &pPath) == S_OK)
|
||||
if((*pSHGetKnownFolderPath)(FOLDERID_LocalAppData, 0, NULL, &pPath) == S_OK)
|
||||
wcscpy_s(w_str,pPath);
|
||||
else
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_LOCAL_APPDATA, TRUE);
|
||||
|
||||
FreeLibrary(shell);
|
||||
if(pPath)
|
||||
CoTaskMemFree(pPath);
|
||||
}
|
||||
@@ -82,6 +99,10 @@ LLDir_Win32::LLDir_Win32()
|
||||
{
|
||||
SHGetSpecialFolderPath(NULL, w_str, CSIDL_LOCAL_APPDATA, TRUE);
|
||||
}
|
||||
|
||||
if(shell)
|
||||
FreeLibrary(shell);
|
||||
|
||||
mOSCacheDir = utf16str_to_utf8str(llutf16string(w_str));
|
||||
|
||||
if (GetTempPath(MAX_PATH, w_str))
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<!--Default for now-->
|
||||
<RenderTerrainLODFactor value="1.0"/>
|
||||
<!--Default for now-->
|
||||
<RenderTreeLODFactor value="0.5"/>
|
||||
<RenderTreeLODFactor value="0.75"/>
|
||||
<!--Try Impostors-->
|
||||
<RenderUseImpostors value="TRUE"/>
|
||||
<!--Default for now-->
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<!--Default for now-->
|
||||
<RenderTerrainLODFactor value="1.0"/>
|
||||
<!--Default for now-->
|
||||
<RenderTreeLODFactor value="0.5"/>
|
||||
<RenderTreeLODFactor value="1.0"/>
|
||||
<!--Try Impostors-->
|
||||
<RenderUseImpostors value="TRUE"/>
|
||||
<!--Default for now-->
|
||||
|
||||
@@ -846,6 +846,17 @@ Found in Advanced->Rendering->Info Displays</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>SLBShowFPS</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Show FPS</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>LogShowHistoryLines</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
@@ -12210,7 +12221,7 @@ This should be as low as possible, but too low may break functionality</string>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
|
||||
<!--<key>RenderAnimateTrees</key>
|
||||
<key>RenderAnimateTrees</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Use GL matrix ops to animate tree branches.</string>
|
||||
@@ -12220,7 +12231,7 @@ This should be as low as possible, but too low may break functionality</string>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>-->
|
||||
</map>
|
||||
<key>RenderNoAlpha</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<!--Default for now-->
|
||||
<RenderTerrainLODFactor value="2.0"/>
|
||||
<!--Default for now-->
|
||||
<RenderTreeLODFactor value="1.0"/>
|
||||
<RenderTreeLODFactor value="2.0"/>
|
||||
<!--Try Impostors-->
|
||||
<RenderUseImpostors value="TRUE"/>
|
||||
<!--Default for now-->
|
||||
|
||||
@@ -90,7 +90,7 @@ RenderTerrainDetail 1 0
|
||||
RenderTerrainScale 1 12.0
|
||||
RenderTerrainLODFactor 1 1
|
||||
RenderTransparentWater 1 0
|
||||
RenderTreeLODFactor 1 0
|
||||
RenderTreeLODFactor 1 0.125
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
VertexShaderEnable 1 0
|
||||
@@ -155,7 +155,7 @@ RenderTerrainDetail 1 1
|
||||
RenderTerrainScale 1 7.0
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTransparentWater 1 1
|
||||
RenderTreeLODFactor 1 0.5
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
VertexShaderEnable 1 1
|
||||
@@ -186,7 +186,7 @@ RenderTerrainDetail 1 1
|
||||
RenderTerrainScale 1 5.0
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTransparentWater 1 1
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderTreeLODFactor 1 2.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
VertexShaderEnable 1 1
|
||||
|
||||
@@ -87,7 +87,7 @@ RenderTerrainDetail 1 0
|
||||
RenderTerrainScale 1 12.0
|
||||
RenderTerrainLODFactor 1 1
|
||||
RenderTransparentWater 1 0
|
||||
RenderTreeLODFactor 1 0
|
||||
RenderTreeLODFactor 1 0.125
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 0.5
|
||||
VertexShaderEnable 1 0
|
||||
@@ -151,7 +151,7 @@ RenderTerrainDetail 1 1
|
||||
RenderTerrainScale 1 7.0
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTransparentWater 1 1
|
||||
RenderTreeLODFactor 1 0.5
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
VertexShaderEnable 1 1
|
||||
@@ -184,7 +184,7 @@ RenderTerrainDetail 1 1
|
||||
RenderTerrainScale 1 5.0
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTransparentWater 1 1
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderTreeLODFactor 1 2.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
VertexShaderEnable 1 1
|
||||
|
||||
@@ -90,7 +90,7 @@ RenderTerrainDetail 1 0
|
||||
RenderTerrainScale 1 12.0
|
||||
RenderTerrainLODFactor 1 1
|
||||
RenderTransparentWater 1 0
|
||||
RenderTreeLODFactor 1 0
|
||||
RenderTreeLODFactor 1 0.125
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 0.5
|
||||
VertexShaderEnable 1 0
|
||||
@@ -155,7 +155,7 @@ RenderTerrainDetail 1 1
|
||||
RenderTerrainScale 1 7.0
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTransparentWater 1 1
|
||||
RenderTreeLODFactor 1 0.5
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 1.125
|
||||
VertexShaderEnable 1 1
|
||||
@@ -188,7 +188,7 @@ RenderTerrainDetail 1 1
|
||||
RenderTerrainScale 1 5.0
|
||||
RenderTerrainLODFactor 1 2.0
|
||||
RenderTransparentWater 1 1
|
||||
RenderTreeLODFactor 1 1.0
|
||||
RenderTreeLODFactor 1 2.0
|
||||
RenderUseImpostors 1 1
|
||||
RenderVolumeLODFactor 1 2.0
|
||||
VertexShaderEnable 1 1
|
||||
|
||||
@@ -85,7 +85,7 @@ LLDebugView::LLDebugView(const std::string& name, const LLRect &rect)
|
||||
mFastTimerView->setVisible(FALSE); // start invisible
|
||||
addChild(mFastTimerView);
|
||||
|
||||
r.set(150, rect.getHeight() - 50, 870, 100);
|
||||
r.set(150, rect.getHeight() - 50, 970, 100);
|
||||
LLTextureView::Params tvp;
|
||||
tvp.name("gTextureView");
|
||||
tvp.rect(r);
|
||||
|
||||
@@ -104,12 +104,12 @@ void LLDrawPoolTree::render(S32 pass)
|
||||
LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1);
|
||||
LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
/*static const LLCachedControl<bool> render_animate_trees("RenderAnimateTrees",false);
|
||||
if (render_animate_trees)
|
||||
static LLCachedControl<bool> sRenderAnimateTrees("RenderAnimateTrees", false);
|
||||
if (sRenderAnimateTrees)
|
||||
{
|
||||
renderTree();
|
||||
}
|
||||
else*/
|
||||
else
|
||||
gGL.getTexUnit(sDiffTex)->bind(mTexturep);
|
||||
|
||||
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
|
||||
@@ -209,7 +209,7 @@ void LLDrawPoolTree::endShadowPass(S32 pass)
|
||||
gDeferredTreeShadowProgram.unbind();
|
||||
}
|
||||
|
||||
/*
|
||||
//
|
||||
void LLDrawPoolTree::renderTree(BOOL selecting)
|
||||
{
|
||||
LLGLState normalize(GL_NORMALIZE, TRUE);
|
||||
@@ -331,7 +331,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
|
||||
//gGL.popMatrix();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}//
|
||||
|
||||
BOOL LLDrawPoolTree::verify() const
|
||||
{
|
||||
|
||||
@@ -75,8 +75,8 @@ public:
|
||||
|
||||
static S32 sDiffTex;
|
||||
|
||||
//private:
|
||||
//void renderTree(BOOL selecting = FALSE);
|
||||
private:
|
||||
void renderTree(BOOL selecting = FALSE);
|
||||
};
|
||||
|
||||
#endif // LL_LLDRAWPOOLTREE_H
|
||||
|
||||
@@ -189,9 +189,11 @@ void LLLogChat::loadHistory(std::string const& filename , void (*callback)(ELogL
|
||||
while (fgets(buffer, LOG_RECALL_BUFSIZ, fptr))
|
||||
{
|
||||
size_t len = strlen(buffer);
|
||||
if (buffer[len - 1] == '\n') // In case the log file doesn't end on a new-line (is that even possible?)
|
||||
int i = len - 1;
|
||||
while (i >= 0 && (buffer[i] == '\r' || buffer[i] == '\n')) // strip newline chars from the end of the string
|
||||
{
|
||||
buffer[len - 1] = '\0';
|
||||
buffer[i] = '\0';
|
||||
i--;
|
||||
}
|
||||
callback(LOG_LINE, buffer, userdata);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ LLPanelGroup::LLPanelGroup(const LLUUID& group_id)
|
||||
|
||||
LLGroupMgr::getInstance()->addObserver(this);
|
||||
|
||||
mCommitCallbackRegistrar.add("Group.CopyURI", boost::bind(copy_group_profile_uri, group_id));
|
||||
mCommitCallbackRegistrar.add("Group.CopyURI", boost::bind(copy_group_profile_uri, boost::ref(mID)));
|
||||
// Pass on construction of this panel to the control factory.
|
||||
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap());
|
||||
}
|
||||
|
||||
@@ -373,9 +373,9 @@ bool LLTextureCacheRemoteWorker::doRead()
|
||||
if (!done && (mState == LOCAL))
|
||||
{
|
||||
llassert(local_size != 0); // we're assuming there is a non empty local file here...
|
||||
if (!mDataSize || mDataSize > local_size - mOffset)
|
||||
if (!mDataSize || mDataSize > local_size/* - mOffset*/)
|
||||
{
|
||||
mDataSize = local_size - mOffset;
|
||||
mDataSize = local_size/* - mOffset*/;
|
||||
}
|
||||
// Allocate read buffer
|
||||
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -84,8 +84,14 @@ public:
|
||||
S32 getFetchState(const LLUUID& id, F32& decode_progress_p, F32& requested_priority_p,
|
||||
U32& fetch_priority_p, F32& fetch_dtime_p, F32& request_dtime_p, bool& can_use_http);
|
||||
void dump();
|
||||
S32 getNumRequests() ;
|
||||
U32 getTotalNumHTTPRequests() ;
|
||||
// Threads: T*
|
||||
S32 getNumRequests();
|
||||
|
||||
// Threads: T*
|
||||
S32 getNumHTTPRequests();
|
||||
|
||||
// Threads: T*
|
||||
U32 getTotalNumHTTPRequests();
|
||||
|
||||
// Public for access by callbacks
|
||||
S32 getPending();
|
||||
|
||||
@@ -81,7 +81,7 @@ static std::string title_string1a("Tex UUID Area DDis(Req) DecodePri(Fetch)
|
||||
static std::string title_string1b("Tex UUID Area DDis(Req) Fetch(DecodePri) [download] pk/max");
|
||||
static std::string title_string2("State");
|
||||
static std::string title_string3("Pkt Bnd");
|
||||
static std::string title_string4(" W x H (Dis) Mem");
|
||||
static std::string title_string4(" W x H (Dis) Mem Type");
|
||||
|
||||
static S32 title_x1 = 0;
|
||||
static S32 title_x2 = 460;
|
||||
@@ -211,6 +211,9 @@ void LLTextureBar::draw()
|
||||
std::string uuid_str;
|
||||
mImagep->mID.toString(uuid_str);
|
||||
uuid_str = uuid_str.substr(0,7);
|
||||
|
||||
std::string vsstr = llformat("%f",mImagep->mMaxVirtualSize);
|
||||
std::string dpstr = llformat("%f",mImagep->getDecodePriority());
|
||||
if (mTextureView->mOrderFetch)
|
||||
{
|
||||
tex_str = llformat("%s %7.0f %d(%d) 0x%08x(%8.0f)",
|
||||
@@ -223,14 +226,14 @@ void LLTextureBar::draw()
|
||||
}
|
||||
else
|
||||
{
|
||||
tex_str = llformat("%s %7.0f %d(%d) %8.0f(0x%08x) %1.2f",
|
||||
tex_str = llformat("%s %7.0f %d(%d) %8.0f(0x%08x) %3d%%",
|
||||
uuid_str.c_str(),
|
||||
mImagep->mMaxVirtualSize,
|
||||
mImagep->mDesiredDiscardLevel,
|
||||
mImagep->mRequestedDiscardLevel,
|
||||
mImagep->getDecodePriority(),
|
||||
mImagep->mFetchPriority,
|
||||
mImagep->mDownloadProgress);
|
||||
llfloor(mImagep->mDownloadProgress*100.f));
|
||||
}
|
||||
|
||||
LLFontGL::getFontMonospace()->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(),
|
||||
@@ -239,12 +242,14 @@ void LLTextureBar::draw()
|
||||
// State
|
||||
// Hack: mirrored from lltexturefetch.cpp
|
||||
struct { const std::string desc; LLColor4 color; } fetch_state_desc[] = {
|
||||
{ "---", LLColor4::red }, // INVALID
|
||||
{ "-?-", LLColor4::red }, // INVALID
|
||||
{ "INI", LLColor4::white }, // INIT
|
||||
{ "DSK", LLColor4::cyan }, // LOAD_FROM_TEXTURE_CACHE
|
||||
{ "DSK", LLColor4::blue }, // CACHE_POST
|
||||
{ "NET", LLColor4::green }, // LOAD_FROM_NETWORK
|
||||
{ "SIM", LLColor4::green }, // LOAD_FROM_SIMULATOR
|
||||
{ "REQ", LLColor4::magenta },// SEND_UDP_REQ
|
||||
{ "UDP", LLColor4::cyan }, // WAIT_UDP_REQ
|
||||
{ "REQ", LLColor4::yellow },// SEND_HTTP_REQ
|
||||
{ "HTP", LLColor4::green }, // WAIT_HTTP_REQ
|
||||
{ "DEC", LLColor4::yellow },// DECODE_IMAGE
|
||||
@@ -252,12 +257,12 @@ void LLTextureBar::draw()
|
||||
{ "WRT", LLColor4::purple },// WRITE_TO_CACHE
|
||||
{ "WRT", LLColor4::orange },// WAIT_ON_WRITE
|
||||
{ "END", LLColor4::red }, // DONE
|
||||
#define LAST_STATE 12
|
||||
#define LAST_STATE 14
|
||||
{ "CRE", LLColor4::magenta }, // LAST_STATE+1
|
||||
{ "FUL", LLColor4::green }, // LAST_STATE+2
|
||||
{ "BAD", LLColor4::red }, // LAST_STATE+3
|
||||
{ "MIS", LLColor4::red }, // LAST_STATE+4
|
||||
{ "---", LLColor4::white }, // LAST_STATE+5
|
||||
{ "-!-", LLColor4::white }, // LAST_STATE+5
|
||||
};
|
||||
const S32 fetch_state_desc_size = (S32)LL_ARRAY_SIZE(fetch_state_desc);
|
||||
S32 state =
|
||||
@@ -370,8 +375,39 @@ void LLTextureBar::draw()
|
||||
|
||||
// draw the image size at the end
|
||||
{
|
||||
std::string num_str = llformat("%3dx%3d (%d) %7d", mImagep->getWidth(), mImagep->getHeight(),
|
||||
mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory() : 0);
|
||||
std::string boost_lvl("UNKNOWN");
|
||||
switch(mImagep->getBoostLevel())
|
||||
{
|
||||
#define BOOST_LVL(type) case LLGLTexture::BOOST_##type: boost_lvl="B_"#type; break;
|
||||
#define CAT_LVL(type) case LLGLTexture::type: boost_lvl=#type; break;
|
||||
BOOST_LVL(NONE)
|
||||
BOOST_LVL(AVATAR_BAKED)
|
||||
BOOST_LVL(AVATAR)
|
||||
BOOST_LVL(CLOUDS)
|
||||
BOOST_LVL(SCULPTED)
|
||||
BOOST_LVL(HIGH)
|
||||
BOOST_LVL(BUMP)
|
||||
BOOST_LVL(TERRAIN)
|
||||
BOOST_LVL(SELECTED)
|
||||
BOOST_LVL(AVATAR_BAKED_SELF)
|
||||
BOOST_LVL(AVATAR_SELF)
|
||||
BOOST_LVL(SUPER_HIGH)
|
||||
BOOST_LVL(HUD)
|
||||
BOOST_LVL(ICON)
|
||||
BOOST_LVL(UI)
|
||||
BOOST_LVL(PREVIEW)
|
||||
BOOST_LVL(MAP)
|
||||
BOOST_LVL(MAP_VISIBLE)
|
||||
CAT_LVL(LOCAL)
|
||||
CAT_LVL(AVATAR_SCRATCH_TEX)
|
||||
CAT_LVL(DYNAMIC_TEX)
|
||||
CAT_LVL(MEDIA)
|
||||
CAT_LVL(OTHER)
|
||||
CAT_LVL(MAX_GL_IMAGE_CATEGORY)
|
||||
default:;
|
||||
};
|
||||
std::string num_str = llformat("%4dx%4d (%+d) %7d %s", mImagep->getWidth(), mImagep->getHeight(),
|
||||
mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory() : 0, boost_lvl.c_str());
|
||||
LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
|
||||
LLFontGL::LEFT, LLFontGL::TOP);
|
||||
}
|
||||
|
||||
@@ -642,7 +642,7 @@ void settings_setup_listeners()
|
||||
gSavedSettings.getControl("OctreeAlphaDistanceFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
|
||||
gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2));
|
||||
gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
|
||||
//gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
|
||||
gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
|
||||
gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
|
||||
gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
|
||||
gSavedSettings.getControl("RenderDepthOfField")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
|
||||
|
||||
@@ -2595,6 +2595,12 @@ void LLViewerMediaImpl::unload()
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mime_type, bool rediscover_type, bool server_request)
|
||||
{
|
||||
if (url.empty())
|
||||
{
|
||||
llwarns << "Calling LLViewerMediaImpl::navigateTo with empty url" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
cancelMimeTypeProbe();
|
||||
|
||||
if(mMediaURL != url)
|
||||
@@ -2639,6 +2645,12 @@ void LLViewerMediaImpl::navigateInternal()
|
||||
// Helpful to have media urls in log file. Shouldn't be spammy.
|
||||
llinfos << "media id= " << mTextureId << " url=" << mMediaURL << " mime_type=" << mMimeType << llendl;
|
||||
|
||||
if (mMediaURL.empty())
|
||||
{
|
||||
llwarns << "Calling LLViewerMediaImpl::navigateInternal() with empty mMediaURL" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(mNavigateSuspended)
|
||||
{
|
||||
llwarns << "Deferring navigate." << llendl;
|
||||
|
||||
@@ -1204,6 +1204,7 @@ void init_debug_ui_menu(LLMenuGL* menu)
|
||||
menu->addChild(new LLMenuItemCheckGL("Show Render Info", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderInfo"));
|
||||
menu->addChild(new LLMenuItemCheckGL("Show Matrices", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowRenderMatrices"));
|
||||
menu->addChild(new LLMenuItemCheckGL("Show Color Under Cursor", menu_toggle_control, NULL, menu_check_control, (void*)"DebugShowColor"));
|
||||
menu->addChild(new LLMenuItemCheckGL("Show FPS", menu_toggle_control, NULL, menu_check_control, (void*)"SLBShowFPS"));
|
||||
|
||||
menu->createJumpKeys();
|
||||
}
|
||||
|
||||
@@ -1071,7 +1071,11 @@ std::string LLViewerParcelMedia::extractDomain(std::string url)
|
||||
url = url.substr(pos + 1, count);
|
||||
}
|
||||
|
||||
if (url.find(gAgent.getRegion()->getHost().getHostName()) == 0 || url.find(last_region) == 0)
|
||||
//Singu note: The call to getHostName() freezes the viewer for a few seconds if the region has no reverse DNS...
|
||||
// Avoid calling it three times therefore -- not to mention that if it fails, it returns an empty string which
|
||||
// does NOT mean that it should match the current url as if the current url contains the current regions hostname!
|
||||
std::string const hostname = gAgent.getRegion()->getHost().getHostName();
|
||||
if ((!hostname.empty() && url.find(hostname) == 0) || url.find(last_region) == 0)
|
||||
{
|
||||
// This must be a scripted object rezzed in the region:
|
||||
// extend the concept of "domain" to encompass the
|
||||
@@ -1080,7 +1084,7 @@ std::string LLViewerParcelMedia::extractDomain(std::string url)
|
||||
|
||||
// Get rid of any port number
|
||||
pos = url.find('/'); // We earlier made sure that there's one
|
||||
url = gAgent.getRegion()->getHost().getHostName() + url.substr(pos);
|
||||
url = hostname + url.substr(pos);
|
||||
|
||||
pos = url.find('?');
|
||||
if (pos != std::string::npos)
|
||||
@@ -1111,10 +1115,12 @@ std::string LLViewerParcelMedia::extractDomain(std::string url)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remember this region, so to cope with requests occuring just after a
|
||||
// TP out of it.
|
||||
last_region = gAgent.getRegion()->getHost().getHostName();
|
||||
if (!hostname.empty()) // Singu note: also make sure that last_region doesn't become empty.
|
||||
{
|
||||
last_region = hostname;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -926,7 +926,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
|
||||
mIsMissingAsset = FALSE;
|
||||
|
||||
mLoadedCallbackDesiredDiscardLevel = S8_MAX;
|
||||
mPauseLoadedCallBacks = TRUE ;
|
||||
mPauseLoadedCallBacks = FALSE ;
|
||||
|
||||
mNeedsCreateTexture = FALSE;
|
||||
|
||||
@@ -1288,6 +1288,7 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
|
||||
// An inappropriately-sized image was uploaded (through a non standard client)
|
||||
// We treat these images as missing assets which causes them to
|
||||
// be renderd as 'missing image' and to stop requesting data
|
||||
llwarns << "!size_ok, setting as missing" << llendl;
|
||||
setIsMissingAsset();
|
||||
destroyRawImage();
|
||||
return FALSE;
|
||||
@@ -1712,6 +1713,7 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
{
|
||||
//discard all oversized textures.
|
||||
destroyRawImage();
|
||||
llwarns << "oversize, setting as missing" << llendl;
|
||||
setIsMissingAsset();
|
||||
mRawDiscardLevel = INVALID_DISCARD_LEVEL ;
|
||||
mIsFetching = FALSE ;
|
||||
@@ -1741,6 +1743,10 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
// We finished but received no data
|
||||
if (current_discard < 0)
|
||||
{
|
||||
llwarns << "!mIsFetching, setting as missing, decode_priority " << decode_priority
|
||||
<< " mRawDiscardLevel " << mRawDiscardLevel
|
||||
<< " current_discard " << current_discard
|
||||
<< llendl;
|
||||
setIsMissingAsset();
|
||||
desired_discard = -1;
|
||||
}
|
||||
@@ -1781,6 +1787,10 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
{
|
||||
make_request = false;
|
||||
}
|
||||
else if(mDesiredDiscardLevel > getMaxDiscardLevel())
|
||||
{
|
||||
make_request = false;
|
||||
}
|
||||
else if (mNeedsCreateTexture || mIsMissingAsset)
|
||||
{
|
||||
make_request = false;
|
||||
@@ -1789,6 +1799,11 @@ bool LLViewerFetchedTexture::updateFetch()
|
||||
{
|
||||
make_request = false;
|
||||
}
|
||||
else if(mCachedRawImage.notNull() && (current_discard < 0 || current_discard > mCachedRawDiscardLevel))
|
||||
{
|
||||
make_request = false;
|
||||
switchToCachedImage() ; //use the cached raw data first
|
||||
}
|
||||
//else if (!isJustBound() && mCachedRawImageReady)
|
||||
//{
|
||||
// make_request = false;
|
||||
@@ -1881,11 +1896,14 @@ void LLViewerFetchedTexture::forceToDeleteRequest()
|
||||
{
|
||||
if (mHasFetcher)
|
||||
{
|
||||
LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
|
||||
//LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
|
||||
mHasFetcher = FALSE;
|
||||
mIsFetching = FALSE ;
|
||||
resetTextureStats();
|
||||
}
|
||||
|
||||
resetTextureStats();
|
||||
|
||||
mDesiredDiscardLevel = getMaxDiscardLevel() + 1; //defer LLAppViewer::getTextureFetch()->deleteRequest to updateFetch?
|
||||
}
|
||||
|
||||
void LLViewerFetchedTexture::setIsMissingAsset()
|
||||
@@ -1928,10 +1946,18 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call
|
||||
mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level) ;
|
||||
}
|
||||
|
||||
if(mPauseLoadedCallBacks && !pause)
|
||||
if(mPauseLoadedCallBacks)
|
||||
{
|
||||
unpauseLoadedCallbacks(src_callback_list) ;
|
||||
if(!pause)
|
||||
{
|
||||
unpauseLoadedCallbacks(src_callback_list) ;
|
||||
}
|
||||
}
|
||||
else if(pause)
|
||||
{
|
||||
pauseLoadedCallbacks(src_callback_list) ;
|
||||
}
|
||||
|
||||
LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, this, pause);
|
||||
mLoadedCallbackList.push_back(entryp);
|
||||
|
||||
|
||||
@@ -1466,6 +1466,7 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **
|
||||
LLViewerFetchedTexture* image = gTextureList.findImage( image_id );
|
||||
if( image )
|
||||
{
|
||||
llwarns << "not in db" << llendl;
|
||||
image->setIsMissingAsset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,6 +309,13 @@ public:
|
||||
U32 ypos = 64;
|
||||
const U32 y_inc = 20;
|
||||
|
||||
static const LLCachedControl<bool> slb_show_fps("SLBShowFPS");
|
||||
if (slb_show_fps)
|
||||
{
|
||||
addText(xpos+280, ypos+5, llformat("FPS %3.1f", LLViewerStats::getInstance()->mFPSStat.getMeanPerSec()));
|
||||
ypos += y_inc;
|
||||
}
|
||||
|
||||
static const LLCachedControl<bool> debug_show_time("DebugShowTime");
|
||||
if (debug_show_time)
|
||||
{
|
||||
|
||||
@@ -2530,7 +2530,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
|
||||
!(attached_object->mDrawable->getSpatialBridge() &&
|
||||
attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0));
|
||||
|
||||
if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid())
|
||||
if (visibleAttachment && attached_object && attached_object->mDrawable && !attached_object->isDead() && attachment->getValid())
|
||||
{
|
||||
// if selecting any attachments, update all of them as non-damped
|
||||
if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment())
|
||||
@@ -3768,6 +3768,23 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
|
||||
else if (!getParent() && mIsSitting && !isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED))
|
||||
{
|
||||
getOffObject();
|
||||
//<edit>
|
||||
//Singu note: this appears to be a safety catch:
|
||||
// when getParent() is NULL and we're note playing ANIM_AGENT_SIT_GROUND_CONSTRAINED then we aren't sitting!
|
||||
// The previous call existed in an attempt to fix this inconsistent state by standing up from an object.
|
||||
// However, since getParent() is NULL that function would crash!
|
||||
// Since we never got crash reports regarding to this, that apparently never happened, except, I discovered
|
||||
// today, when you are ground sitting and then LLMotionController::deleteAllMotions or
|
||||
// LLMotionController::deactivateAllMotions is called, which seems to only happen when previewing an
|
||||
// to-be-uploaded animation on your own avatar (while ground sitting).
|
||||
// Hence, we DO need this safety net but not for standing up from an object but for standing up from the ground.
|
||||
// I fixed the crash in getOffObject(), so it's ok to call that. In order to make things consistent with
|
||||
// the server we need to actually stand up though, or we can't move anymore afterwards.
|
||||
if (isSelf())
|
||||
{
|
||||
gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
|
||||
}
|
||||
//</edit>
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
@@ -6564,7 +6581,7 @@ void LLVOAvatar::getOffObject()
|
||||
|
||||
gAgentCamera.setSitCamera(LLUUID::null);
|
||||
|
||||
if (!sit_object->permYouOwner() && gSavedSettings.getBOOL("RevokePermsOnStandUp"))
|
||||
if (sit_object && !sit_object->permYouOwner() && gSavedSettings.getBOOL("RevokePermsOnStandUp"))
|
||||
{
|
||||
gMessageSystem->newMessageFast(_PREHASH_RevokePermissions);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "llagentcamera.h"
|
||||
#include "lldrawable.h"
|
||||
#include "llface.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "llviewercamera.h"
|
||||
#include "llviewertexturelist.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
@@ -57,6 +58,7 @@
|
||||
#include "noise.h"
|
||||
#include "pipeline.h"
|
||||
#include "llspatialpartition.h"
|
||||
//#include "llviewerwindow.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "raytrace.h"
|
||||
#include "llglslshader.h"
|
||||
@@ -356,12 +358,47 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys,
|
||||
|
||||
void LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
|
||||
{
|
||||
const U16 FRAMES_PER_WIND_UPDATE = 20; // How many frames between wind update per tree
|
||||
const F32 TREE_WIND_SENSITIVITY = 0.005f;
|
||||
const F32 TREE_TRUNK_STIFFNESS = 0.1f;
|
||||
|
||||
if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TREE)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ;
|
||||
|
||||
static LLCachedControl<bool> sRenderAnimateTrees(gSavedSettings, "RenderAnimateTrees");
|
||||
if (sRenderAnimateTrees)
|
||||
{
|
||||
F32 mass_inv;
|
||||
|
||||
// For all tree objects, update the trunk bending with the current wind
|
||||
// Walk sprite list in order away from viewer
|
||||
if (!(mFrameCount % FRAMES_PER_WIND_UPDATE))
|
||||
{
|
||||
// If needed, Get latest wind for this tree
|
||||
mWind = mRegionp->mWind.getVelocity(getPositionRegion());
|
||||
}
|
||||
mFrameCount++;
|
||||
|
||||
mass_inv = 1.f/(5.f + mDepth*mBranches*0.2f);
|
||||
mTrunkVel += (mWind * mass_inv * TREE_WIND_SENSITIVITY); // Pull in direction of wind
|
||||
mTrunkVel -= (mTrunkBend * mass_inv * TREE_TRUNK_STIFFNESS); // Restoring force in direction of trunk
|
||||
mTrunkBend += mTrunkVel;
|
||||
mTrunkVel *= 0.99f; // Add damping
|
||||
|
||||
if (mTrunkBend.length() > 1.f)
|
||||
{
|
||||
mTrunkBend.normalize();
|
||||
}
|
||||
|
||||
if (mTrunkVel.length() > 1.f)
|
||||
{
|
||||
mTrunkVel.normalize();
|
||||
}
|
||||
}
|
||||
|
||||
S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS;
|
||||
F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor;
|
||||
|
||||
for (S32 j = 0; j < sMAX_NUM_TREE_LOD_LEVELS; j++)
|
||||
@@ -373,41 +410,45 @@ void LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
|
||||
}
|
||||
}
|
||||
|
||||
if (mReferenceBuffer.isNull())
|
||||
if (!sRenderAnimateTrees)
|
||||
{
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE);
|
||||
}
|
||||
else if (trunk_LOD != mTrunkLOD)
|
||||
{
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we're not animating but we may *still* need to
|
||||
// regenerate the mesh if we moved, since position
|
||||
// and rotation are baked into the mesh.
|
||||
// *TODO: I don't know what's so special about trees
|
||||
// that they don't get REBUILD_POSITION automatically
|
||||
// at a higher level.
|
||||
const LLVector3 &this_position = getPositionRegion();
|
||||
if (this_position != mLastPosition)
|
||||
if (mReferenceBuffer.isNull())
|
||||
{
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
|
||||
mLastPosition = this_position;
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE);
|
||||
}
|
||||
else if (trunk_LOD != mTrunkLOD)
|
||||
{
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
const LLQuaternion &this_rotation = getRotation();
|
||||
|
||||
if (this_rotation != mLastRotation)
|
||||
// we're not animating but we may *still* need to
|
||||
// regenerate the mesh if we moved, since position
|
||||
// and rotation are baked into the mesh.
|
||||
// *TODO: I don't know what's so special about trees
|
||||
// that they don't get REBUILD_POSITION automatically
|
||||
// at a higher level.
|
||||
const LLVector3 &this_position = getPositionRegion();
|
||||
if (this_position != mLastPosition)
|
||||
{
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
|
||||
mLastRotation = this_rotation;
|
||||
mLastPosition = this_position;
|
||||
}
|
||||
else
|
||||
{
|
||||
const LLQuaternion &this_rotation = getRotation();
|
||||
|
||||
if (this_rotation != mLastRotation)
|
||||
{
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION);
|
||||
mLastRotation = this_rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mTrunkLOD = trunk_LOD;
|
||||
//return TRUE;
|
||||
}
|
||||
|
||||
const F32 TREE_BLEND_MIN = 1.f;
|
||||
@@ -540,8 +581,9 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
||||
max_indices += sLODIndexCount[lod];
|
||||
max_vertices += sLODVertexCount[lod];
|
||||
}
|
||||
|
||||
mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, 0);
|
||||
|
||||
static LLCachedControl<bool> sRenderAnimateTrees(gSavedSettings, "RenderAnimateTrees");
|
||||
mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, sRenderAnimateTrees ? GL_STATIC_DRAW_ARB : 0);
|
||||
mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE);
|
||||
|
||||
LLStrider<LLVector3> vertices;
|
||||
@@ -844,10 +886,18 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
||||
llassert(vertex_count == max_vertices);
|
||||
llassert(index_count == max_indices);
|
||||
}
|
||||
|
||||
//generate tree mesh
|
||||
updateMesh();
|
||||
|
||||
static LLCachedControl<bool> sRenderAnimateTrees(gSavedSettings, "RenderAnimateTrees");
|
||||
if (sRenderAnimateTrees)
|
||||
{
|
||||
mDrawable->getFace(0)->setVertexBuffer(mReferenceBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
//generate tree mesh
|
||||
updateMesh();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1314,3 +1364,110 @@ LLTreePartition::LLTreePartition()
|
||||
mLODPeriod = 1;
|
||||
}
|
||||
|
||||
void LLVOTree::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
|
||||
std::vector<LLVector3> &normals,
|
||||
const LLVector3& obj_cam_vec,
|
||||
const LLMatrix4& local_matrix,
|
||||
const LLMatrix3& normal_matrix)
|
||||
{
|
||||
vertices.clear();
|
||||
normals.clear();
|
||||
|
||||
F32 height = mBillboardScale; // *mBillboardRatio * 0.5;
|
||||
F32 width = height * mTrunkAspect;
|
||||
|
||||
LLVector3 position1 = LLVector3(-width * 0.5, 0, 0) * local_matrix;
|
||||
LLVector3 position2 = LLVector3(-width * 0.5, 0, height) * local_matrix;
|
||||
LLVector3 position3 = LLVector3(width * 0.5, 0, height) * local_matrix;
|
||||
LLVector3 position4 = LLVector3(width * 0.5, 0, 0) * local_matrix;
|
||||
|
||||
LLVector3 position5 = LLVector3(0, -width * 0.5, 0) * local_matrix;
|
||||
LLVector3 position6 = LLVector3(0, -width * 0.5, height) * local_matrix;
|
||||
LLVector3 position7 = LLVector3(0, width * 0.5, height) * local_matrix;
|
||||
LLVector3 position8 = LLVector3(0, width * 0.5, 0) * local_matrix;
|
||||
|
||||
LLVector3 normal = (position1 - position2) % (position2 - position3);
|
||||
normal.normalize();
|
||||
|
||||
vertices.push_back(position1);
|
||||
normals.push_back(normal);
|
||||
vertices.push_back(position2);
|
||||
normals.push_back(normal);
|
||||
|
||||
vertices.push_back(position2);
|
||||
normals.push_back(normal);
|
||||
vertices.push_back(position3);
|
||||
normals.push_back(normal);
|
||||
|
||||
vertices.push_back(position3);
|
||||
normals.push_back(normal);
|
||||
vertices.push_back(position4);
|
||||
normals.push_back(normal);
|
||||
|
||||
vertices.push_back(position4);
|
||||
normals.push_back(normal);
|
||||
vertices.push_back(position1);
|
||||
normals.push_back(normal);
|
||||
|
||||
normal = (position5 - position6) % (position6 - position7);
|
||||
normal.normalize();
|
||||
|
||||
vertices.push_back(position5);
|
||||
normals.push_back(normal);
|
||||
vertices.push_back(position6);
|
||||
normals.push_back(normal);
|
||||
|
||||
vertices.push_back(position6);
|
||||
normals.push_back(normal);
|
||||
vertices.push_back(position7);
|
||||
normals.push_back(normal);
|
||||
|
||||
vertices.push_back(position7);
|
||||
normals.push_back(normal);
|
||||
vertices.push_back(position8);
|
||||
normals.push_back(normal);
|
||||
|
||||
vertices.push_back(position8);
|
||||
normals.push_back(normal);
|
||||
vertices.push_back(position5);
|
||||
normals.push_back(normal);
|
||||
}
|
||||
|
||||
void LLVOTree::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point)
|
||||
{
|
||||
LLVector3 position;
|
||||
LLQuaternion rotation;
|
||||
|
||||
if (mDrawable->isActive())
|
||||
{
|
||||
if (mDrawable->isSpatialRoot())
|
||||
{
|
||||
position = LLVector3();
|
||||
rotation = LLQuaternion();
|
||||
}
|
||||
else
|
||||
{
|
||||
position = mDrawable->getPosition();
|
||||
rotation = mDrawable->getRotation();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
position = getPosition() + getRegion()->getOriginAgent();
|
||||
rotation = getRotation();
|
||||
}
|
||||
|
||||
// trees have bizzare scaling rules... because it's cool to make needless exceptions
|
||||
// PS: the trees are the last remaining tidbit of Philip's code. take a look sometime.
|
||||
F32 radius = getScale().length() * 0.05f;
|
||||
LLVector3 scale = LLVector3(1, 1, 1) * radius;
|
||||
|
||||
// compose final matrix
|
||||
LLMatrix4 local_matrix;
|
||||
local_matrix.initAll(scale, rotation, position);
|
||||
|
||||
generateSilhouetteVertices(nodep->mSilhouetteVertices, nodep->mSilhouetteNormals,
|
||||
LLVector3(0, 0, 0), local_matrix, LLMatrix3());
|
||||
|
||||
nodep->mSilhouetteExists = TRUE;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
class LLFace;
|
||||
class LLDrawPool;
|
||||
class LLSelectNode;
|
||||
class LLViewerFetchedTexture;
|
||||
|
||||
class LLVOTree : public LLViewerObject
|
||||
@@ -122,8 +123,9 @@ public:
|
||||
LLVector3* intersection = NULL, // return the intersection point
|
||||
LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
|
||||
LLVector3* normal = NULL, // return the surface normal at the intersection point
|
||||
LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point
|
||||
);
|
||||
LLVector3* bi_normal = NULL); // return the surface bi-normal at the intersection point
|
||||
|
||||
void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point);
|
||||
|
||||
static S32 sMaxTreeSpecies;
|
||||
|
||||
@@ -162,6 +164,7 @@ public:
|
||||
friend class LLDrawPoolTree;
|
||||
protected:
|
||||
LLVector3 mTrunkBend; // Accumulated wind (used for blowing trees)
|
||||
LLVector3 mTrunkVel; //
|
||||
LLVector3 mWind;
|
||||
|
||||
LLPointer<LLVertexBuffer> mReferenceBuffer; //reference geometry for generating tree mesh
|
||||
@@ -201,6 +204,13 @@ protected:
|
||||
static S32 sLODVertexCount[4];
|
||||
static S32 sLODSlices[4];
|
||||
static F32 sLODAngles[4];
|
||||
|
||||
private:
|
||||
void generateSilhouetteVertices(std::vector<LLVector3> &vertices,
|
||||
std::vector<LLVector3> &normals,
|
||||
const LLVector3& view_vec,
|
||||
const LLMatrix4& mat,
|
||||
const LLMatrix3& norm_mat);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<text name="Exportable Textures" bottom_delta="-20" height="20">Exportable Textures: [COUNT]/[TOTAL]</text>
|
||||
</panel>
|
||||
<panel border="true" bottom_delta="-120" height="115" width="200" follows="bottom|left" name="options panel">
|
||||
<text name="Object info" bottom="-20" height="20" left="5">Options</text>
|
||||
<text name="Options" bottom="-20" height="20" left="5">Options</text>
|
||||
<check_box name="texture export check" label="Export Textures" height="20" bottom_delta="-20" left="10" control_name="DAEExportTextures">
|
||||
<check_box.commit_callback function="ColladaExport.TextureExport"/>
|
||||
</check_box>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<text bottom_delta="-25" height="12" left="215" name="MeshDetailText">Level of Detail:</text>
|
||||
<slider bottom_delta="-22" control_name="RenderVolumeLODFactor" height="16" increment="0.09375" label=" Objects:" label_width="79" max_val="2" min_val="0.5" name="ObjectMeshDetail" show_text="false" width="223"/>
|
||||
<slider bottom_delta="-18" control_name="RenderFlexTimeFactor" height="16" increment="0.1" label=" Flexiprims:" label_width="79" max_val="1" min_val="0" name="FlexibleMeshDetail" show_text="false" width="223"/>
|
||||
<slider bottom_delta="-18" control_name="RenderTreeLODFactor" height="16" increment="0.125" label=" Trees:" label_width="79" max_val="1" min_val="0" name="TreeMeshDetail" show_text="false" width="223"/>
|
||||
<slider bottom_delta="-18" control_name="RenderTreeLODFactor" height="16" increment="0.125" label=" Trees:" label_width="79" max_val="2" min_val="0" name="TreeMeshDetail" show_text="false" width="223"/>
|
||||
<slider bottom_delta="-18" control_name="RenderAvatarLODFactor" height="16" increment="0.125" label=" Avatars:" label_width="79" max_val="1" min_val="0" name="AvatarMeshDetail" show_text="false" width="223"/>
|
||||
<slider bottom_delta="-18" control_name="RenderTerrainLODFactor" height="16" increment="0.125" label=" Terrain:" label_width="79" max_val="2" min_val="1" name="TerrainMeshDetail" show_text="false" width="223"/>
|
||||
<slider bottom_delta="-18" control_name="WLSkyDetail" height="16" decimal_digits="0" increment="8" label=" Sky:" label_width="79" max_val="128" min_val="16" name="SkyMeshDetail" show_text="false" width="223"/>
|
||||
|
||||
Reference in New Issue
Block a user