Merge branch 'master' of git@github.com:Shyotl/SingularityViewer.git
This commit is contained in:
@@ -281,7 +281,7 @@ U8* LLImageBase::allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 si
|
|||||||
// LLImageRaw
|
// LLImageRaw
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
AIThreadSafeSimpleDC<S32> LLImageRaw::sGlobalRawMemory;
|
AIThreadSafeSimpleDC<S64> LLImageRaw::sGlobalRawMemory;
|
||||||
S32 LLImageRaw::sRawImageCount = 0;
|
S32 LLImageRaw::sRawImageCount = 0;
|
||||||
S32 LLImageRaw::sRawImageCachedCount = 0;
|
S32 LLImageRaw::sRawImageCachedCount = 0;
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ LLImageRaw::~LLImageRaw()
|
|||||||
U8* LLImageRaw::allocateData(S32 size)
|
U8* LLImageRaw::allocateData(S32 size)
|
||||||
{
|
{
|
||||||
U8* res = LLImageBase::allocateData(size);
|
U8* res = LLImageBase::allocateData(size);
|
||||||
*AIAccess<S32>(sGlobalRawMemory) += getDataSize();
|
*AIAccess<S64>(sGlobalRawMemory) += getDataSize();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ U8* LLImageRaw::reallocateData(S32 size)
|
|||||||
{
|
{
|
||||||
S32 old_data_size = getDataSize();
|
S32 old_data_size = getDataSize();
|
||||||
U8* res = LLImageBase::reallocateData(size);
|
U8* res = LLImageBase::reallocateData(size);
|
||||||
*AIAccess<S32>(sGlobalRawMemory) += getDataSize() - old_data_size;
|
*AIAccess<S64>(sGlobalRawMemory) += getDataSize() - old_data_size;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ U8* LLImageRaw::reallocateData(S32 size)
|
|||||||
void LLImageRaw::deleteData()
|
void LLImageRaw::deleteData()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
*AIAccess<S32>(sGlobalRawMemory) -= getDataSize();
|
*AIAccess<S64>(sGlobalRawMemory) -= getDataSize();
|
||||||
}
|
}
|
||||||
LLImageBase::deleteData();
|
LLImageBase::deleteData();
|
||||||
}
|
}
|
||||||
@@ -392,7 +392,7 @@ void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components)
|
|||||||
LLImageBase::setSize(width, height, components) ;
|
LLImageBase::setSize(width, height, components) ;
|
||||||
LLImageBase::setDataAndSize(data, width * height * components) ;
|
LLImageBase::setDataAndSize(data, width * height * components) ;
|
||||||
|
|
||||||
*AIAccess<S32>(sGlobalRawMemory) += getDataSize();
|
*AIAccess<S64>(sGlobalRawMemory) += getDataSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLImageRaw::resize(U16 width, U16 height, S8 components)
|
BOOL LLImageRaw::resize(U16 width, U16 height, S8 components)
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ protected:
|
|||||||
void setDataAndSize(U8 *data, S32 width, S32 height, S8 components) ;
|
void setDataAndSize(U8 *data, S32 width, S32 height, S8 components) ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static AIThreadSafeSimpleDC<S32> sGlobalRawMemory;
|
static AIThreadSafeSimpleDC<S64> sGlobalRawMemory;
|
||||||
static S32 sRawImageCount;
|
static S32 sRawImageCount;
|
||||||
|
|
||||||
static S32 sRawImageCachedCount;
|
static S32 sRawImageCachedCount;
|
||||||
|
|||||||
@@ -962,3 +962,4 @@ P(wholeModelFeeResponder);
|
|||||||
P(wholeModelUploadResponder);
|
P(wholeModelUploadResponder);
|
||||||
P2(XMLRPCResponder, connect_40s);
|
P2(XMLRPCResponder, connect_40s);
|
||||||
P2(crashLoggerResponder, transfer_300s);
|
P2(crashLoggerResponder, transfer_300s);
|
||||||
|
P(getUpdateInfoResponder);
|
||||||
@@ -414,7 +414,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attach existing objects
|
// Attach existing objects
|
||||||
if (!LLShaderMgr::instance()->attachShaderFeatures(this))
|
if (!LLShaderMgr::instance()->attachClassSharedShaders(*this, mShaderClass) || !LLShaderMgr::instance()->attachShaderFeatures(this))
|
||||||
{
|
{
|
||||||
if(mProgramObject)
|
if(mProgramObject)
|
||||||
glDeleteObjectARB(mProgramObject);
|
glDeleteObjectARB(mProgramObject);
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ U32 wpo2(U32 i);
|
|||||||
|
|
||||||
U32 LLImageGL::sUniqueCount = 0;
|
U32 LLImageGL::sUniqueCount = 0;
|
||||||
U32 LLImageGL::sBindCount = 0;
|
U32 LLImageGL::sBindCount = 0;
|
||||||
S32Bytes LLImageGL::sGlobalTextureMemory(0);
|
S64Bytes LLImageGL::sGlobalTextureMemory(0);
|
||||||
S32Bytes LLImageGL::sBoundTextureMemory(0);
|
S64Bytes LLImageGL::sBoundTextureMemory(0);
|
||||||
S32Bytes LLImageGL::sCurBoundTextureMemory(0);
|
S64Bytes LLImageGL::sCurBoundTextureMemory(0);
|
||||||
S32 LLImageGL::sCount = 0;
|
S32 LLImageGL::sCount = 0;
|
||||||
|
|
||||||
BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
|
BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
|
||||||
@@ -78,9 +78,9 @@ S32 LLImageGL::sCurTexPickSize = -1 ;
|
|||||||
LLPointer<LLImageGL> LLImageGL::sHighlightTexturep = NULL;
|
LLPointer<LLImageGL> LLImageGL::sHighlightTexturep = NULL;
|
||||||
S32 LLImageGL::sMaxCategories = 1 ;
|
S32 LLImageGL::sMaxCategories = 1 ;
|
||||||
|
|
||||||
std::vector<S32Bytes> LLImageGL::sTextureMemByCategory;
|
std::vector<S64Bytes> LLImageGL::sTextureMemByCategory;
|
||||||
std::vector<S32Bytes> LLImageGL::sTextureMemByCategoryBound ;
|
std::vector<S64Bytes> LLImageGL::sTextureMemByCategoryBound ;
|
||||||
std::vector<S32Bytes> LLImageGL::sTextureCurMemByCategoryBound ;
|
std::vector<S64Bytes> LLImageGL::sTextureCurMemByCategoryBound ;
|
||||||
//------------------------
|
//------------------------
|
||||||
// ****************************************************************************************************
|
// ****************************************************************************************************
|
||||||
//End for texture auditing use only
|
//End for texture auditing use only
|
||||||
@@ -293,7 +293,7 @@ void LLImageGL::updateStats(F32 current_time)
|
|||||||
LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_STATS);
|
LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_STATS);
|
||||||
sLastFrameTime = current_time;
|
sLastFrameTime = current_time;
|
||||||
sBoundTextureMemory = sCurBoundTextureMemory;
|
sBoundTextureMemory = sCurBoundTextureMemory;
|
||||||
sCurBoundTextureMemory = S32Bytes(0);
|
sCurBoundTextureMemory = S64Bytes(0);
|
||||||
|
|
||||||
if(gAuditTexture)
|
if(gAuditTexture)
|
||||||
{
|
{
|
||||||
@@ -305,7 +305,7 @@ void LLImageGL::updateStats(F32 current_time)
|
|||||||
for(U32 i = 0 ; i < sTextureCurMemByCategoryBound.size() ; i++)
|
for(U32 i = 0 ; i < sTextureCurMemByCategoryBound.size() ; i++)
|
||||||
{
|
{
|
||||||
sTextureMemByCategoryBound[i] = sTextureCurMemByCategoryBound[i] ;
|
sTextureMemByCategoryBound[i] = sTextureCurMemByCategoryBound[i] ;
|
||||||
sTextureCurMemByCategoryBound[i] = (S32Bytes)0 ;
|
sTextureCurMemByCategoryBound[i] = (S64Bytes)0 ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,9 +233,9 @@ public:
|
|||||||
static F32 sLastFrameTime;
|
static F32 sLastFrameTime;
|
||||||
|
|
||||||
// Global memory statistics
|
// Global memory statistics
|
||||||
static S32Bytes sGlobalTextureMemory; // Tracks main memory texmem
|
static S64Bytes sGlobalTextureMemory; // Tracks main memory texmem
|
||||||
static S32Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame
|
static S64Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame
|
||||||
static S32Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame
|
static S64Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame
|
||||||
static U32 sBindCount; // Tracks number of texture binds for current frame
|
static U32 sBindCount; // Tracks number of texture binds for current frame
|
||||||
static U32 sUniqueCount; // Tracks number of unique texture binds for current frame
|
static U32 sUniqueCount; // Tracks number of unique texture binds for current frame
|
||||||
static BOOL sGlobalUseAnisotropic;
|
static BOOL sGlobalUseAnisotropic;
|
||||||
@@ -288,9 +288,9 @@ public:
|
|||||||
//for debug use: show texture category distribution
|
//for debug use: show texture category distribution
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
|
||||||
static std::vector<S32Bytes> sTextureMemByCategory;
|
static std::vector<S64Bytes> sTextureMemByCategory;
|
||||||
static std::vector<S32Bytes> sTextureMemByCategoryBound ;
|
static std::vector<S64Bytes> sTextureMemByCategoryBound ;
|
||||||
static std::vector<S32Bytes> sTextureCurMemByCategoryBound ;
|
static std::vector<S64Bytes> sTextureCurMemByCategoryBound ;
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
// ****************************************************************************************************
|
// ****************************************************************************************************
|
||||||
//End of definitions for texture auditing use only
|
//End of definitions for texture auditing use only
|
||||||
|
|||||||
@@ -611,95 +611,90 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||||||
if (minor_version <= 19)
|
if (minor_version <= 19)
|
||||||
{
|
{
|
||||||
text[count++] = strdup("#version 110\n");
|
text[count++] = strdup("#version 110\n");
|
||||||
text[count++] = strdup("#define ATTRIBUTE attribute\n");
|
|
||||||
text[count++] = strdup("#define VARYING varying\n");
|
|
||||||
text[count++] = strdup("#define VARYING_FLAT varying\n");
|
|
||||||
// Need to enable extensions here instead of in the shader files,
|
|
||||||
// before any non-preprocessor directives (per spec)
|
|
||||||
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
|
|
||||||
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
|
|
||||||
}
|
}
|
||||||
else if (minor_version <= 29)
|
else if (minor_version <= 29)
|
||||||
{
|
{
|
||||||
//set version to 1.20
|
//set version to 1.20
|
||||||
text[count++] = strdup("#version 120\n");
|
text[count++] = strdup("#version 120\n");
|
||||||
text[count++] = strdup("#define FXAA_GLSL_120 1\n");
|
if (type == GL_FRAGMENT_SHADER_ARB)
|
||||||
text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
|
{
|
||||||
text[count++] = strdup("#define ATTRIBUTE attribute\n");
|
// Need to enable extensions here instead of in the shader files,
|
||||||
text[count++] = strdup("#define VARYING varying\n");
|
// before any non-preprocessor directives (per spec)
|
||||||
text[count++] = strdup("#define VARYING_FLAT varying\n");
|
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
|
||||||
// Need to enable extensions here instead of in the shader files,
|
text[count++] = strdup("#define FXAA_GLSL_120 1\n");
|
||||||
// before any non-preprocessor directives (per spec)
|
text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
|
||||||
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
|
}
|
||||||
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
text[count++] = strdup("#define ATTRIBUTE attribute\n");
|
||||||
|
text[count++] = strdup("#define VARYING varying\n");
|
||||||
|
text[count++] = strdup("#define VARYING_FLAT varying\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (major_version < 4)
|
if (major_version < 4)
|
||||||
{
|
{
|
||||||
//set version to 1.30
|
if (major_version > 1 || minor_version >= 40)
|
||||||
text[count++] = strdup("#version 130\n");
|
{
|
||||||
// Need to enable extensions here instead of in the shader files,
|
//set version to 1.40
|
||||||
// before any non-preprocessor directives (per spec)
|
text[count++] = strdup("#version 140\n");
|
||||||
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
|
}
|
||||||
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
|
else
|
||||||
|
{
|
||||||
|
//set version to 1.30
|
||||||
|
text[count++] = strdup("#version 130\n");
|
||||||
|
}
|
||||||
if (minor_version == 50 && gGLManager.mHasGpuShader5)
|
if (minor_version == 50 && gGLManager.mHasGpuShader5)
|
||||||
{
|
{
|
||||||
|
// Need to enable extensions here instead of in the shader files,
|
||||||
|
// before any non-preprocessor directives (per spec)
|
||||||
text[count++] = strdup("#extension GL_ARB_gpu_shader5 : enable\n");
|
text[count++] = strdup("#extension GL_ARB_gpu_shader5 : enable\n");
|
||||||
}
|
}
|
||||||
//some implementations of GLSL 1.30 require integer precision be explicitly declared
|
//some implementations of GLSL 1.30 require integer precision be explicitly declared
|
||||||
text[count++] = strdup("precision mediump int;\n");
|
text[count++] = strdup("precision mediump int;\n");
|
||||||
text[count++] = strdup("precision highp float;\n");
|
text[count++] = strdup("precision highp float;\n");
|
||||||
text[count++] = strdup("#define FXAA_GLSL_130 1\n");
|
if (type == GL_FRAGMENT_SHADER_ARB)
|
||||||
|
{
|
||||||
|
text[count++] = strdup("#define FXAA_GLSL_130 1\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //set version to 400
|
{ //set version to 400
|
||||||
text[count++] = strdup("#version 400\n");
|
text[count++] = strdup("#version 400\n");
|
||||||
// Need to enable extensions here instead of in the shader files,
|
if (type == GL_FRAGMENT_SHADER_ARB)
|
||||||
// before any non-preprocessor directives (per spec)
|
{
|
||||||
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
|
text[count++] = strdup("#define FXAA_GLSL_400 1\n");
|
||||||
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
|
}
|
||||||
text[count++] = strdup("#define FXAA_GLSL_400 1\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");
|
|
||||||
|
|
||||||
text[count++] = strdup("#define ATTRIBUTE in\n");
|
|
||||||
|
|
||||||
if (type == GL_VERTEX_SHADER_ARB)
|
if (type == GL_VERTEX_SHADER_ARB)
|
||||||
{ //"varying" state is "out" in a vertex program, "in" in a fragment program
|
{ //"varying" state is "out" in a vertex program, "in" in a fragment program
|
||||||
// ("varying" is deprecated after version 1.20)
|
// ("varying" is deprecated after version 1.20)
|
||||||
|
text[count++] = strdup("#define ATTRIBUTE in\n");
|
||||||
text[count++] = strdup("#define VARYING out\n");
|
text[count++] = strdup("#define VARYING out\n");
|
||||||
text[count++] = strdup("#define VARYING_FLAT flat out\n");
|
text[count++] = strdup("#define VARYING_FLAT flat out\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");
|
||||||
text[count++] = strdup("#define VARYING in\n");
|
text[count++] = strdup("#define VARYING in\n");
|
||||||
text[count++] = strdup("#define VARYING_FLAT flat in\n");
|
text[count++] = strdup("#define VARYING_FLAT flat in\n");
|
||||||
}
|
|
||||||
|
|
||||||
//backwards compatibility with legacy texture lookup syntax
|
//backwards compatibility with legacy texture lookup syntax
|
||||||
text[count++] = strdup("#define texture2D texture\n");
|
text[count++] = strdup("#define texture2D texture\n");
|
||||||
text[count++] = strdup("#define textureCube texture\n");
|
text[count++] = strdup("#define textureCube texture\n");
|
||||||
text[count++] = strdup("#define texture2DLod textureLod\n");
|
text[count++] = strdup("#define texture2DLod textureLod\n");
|
||||||
text[count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n");
|
text[count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n");
|
||||||
|
|
||||||
if (major_version > 1 || minor_version >= 40)
|
|
||||||
{ //GLSL 1.40 replaces texture2DRect et al with texture
|
|
||||||
text[count++] = strdup("#define texture2DRect texture\n");
|
|
||||||
text[count++] = strdup("#define shadow2DRect(a,b) vec2(texture(a,b))\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defines)
|
if(defines)
|
||||||
{
|
{
|
||||||
for (std::map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
|
for (std::map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
|
||||||
{
|
{
|
||||||
std::string define = "#define " + iter->first + " " + iter->second + "\n";
|
std::string define = "#define " + iter->first + " " + iter->second + "\n";
|
||||||
text[count++] = (GLcharARB *) strdup(define.c_str());
|
text[count++] = (GLcharARB *) strdup(define.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB)
|
if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB)
|
||||||
@@ -796,7 +791,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||||||
LL_ERRS() << "Indexed texture rendering requires GLSL 1.30 or later." << LL_ENDL;
|
LL_ERRS() << "Indexed texture rendering requires GLSL 1.30 or later." << LL_ENDL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if( type == GL_FRAGMENT_SHADER_ARB )
|
||||||
{
|
{
|
||||||
text[count++] = strdup("#define HAS_DIFFUSE_LOOKUP 0\n");
|
text[count++] = strdup("#define HAS_DIFFUSE_LOOKUP 0\n");
|
||||||
}
|
}
|
||||||
@@ -1214,6 +1209,7 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||||||
mReservedUniforms.push_back("ssao_factor");
|
mReservedUniforms.push_back("ssao_factor");
|
||||||
mReservedUniforms.push_back("ssao_factor_inv");
|
mReservedUniforms.push_back("ssao_factor_inv");
|
||||||
mReservedUniforms.push_back("ssao_effect");
|
mReservedUniforms.push_back("ssao_effect");
|
||||||
|
mReservedUniforms.push_back("ssao_scale");
|
||||||
mReservedUniforms.push_back("kern_scale");
|
mReservedUniforms.push_back("kern_scale");
|
||||||
mReservedUniforms.push_back("noise_scale");
|
mReservedUniforms.push_back("noise_scale");
|
||||||
mReservedUniforms.push_back("near_clip");
|
mReservedUniforms.push_back("near_clip");
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ public:
|
|||||||
DEFERRED_SSAO_FACTOR,
|
DEFERRED_SSAO_FACTOR,
|
||||||
DEFERRED_SSAO_FACTOR_INV,
|
DEFERRED_SSAO_FACTOR_INV,
|
||||||
DEFERRED_SSAO_EFFECT,
|
DEFERRED_SSAO_EFFECT,
|
||||||
|
DEFERRED_SSAO_SCALE,
|
||||||
DEFERRED_KERN_SCALE,
|
DEFERRED_KERN_SCALE,
|
||||||
DEFERRED_NOISE_SCALE,
|
DEFERRED_NOISE_SCALE,
|
||||||
DEFERRED_NEAR_CLIP,
|
DEFERRED_NEAR_CLIP,
|
||||||
@@ -239,6 +240,7 @@ DISPLAY_GAMMA,
|
|||||||
|
|
||||||
// Implemented in the application to actually update out of date uniforms for a particular shader
|
// Implemented in the application to actually update out of date uniforms for a particular shader
|
||||||
virtual void updateShaderUniforms(LLGLSLShader * shader) = 0; // Pure Virtual
|
virtual void updateShaderUniforms(LLGLSLShader * shader) = 0; // Pure Virtual
|
||||||
|
virtual bool attachClassSharedShaders(LLGLSLShader& shader, S32 shader_class) = 0; // Pure Virtual
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct CachedObjectInfo
|
struct CachedObjectInfo
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ U32 LLVertexBuffer::sCurVAOName = 1;
|
|||||||
U32 LLVertexBuffer::sAllocatedIndexBytes = 0;
|
U32 LLVertexBuffer::sAllocatedIndexBytes = 0;
|
||||||
U32 LLVertexBuffer::sIndexCount = 0;
|
U32 LLVertexBuffer::sIndexCount = 0;
|
||||||
|
|
||||||
LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL;
|
|
||||||
U32 LLVertexBuffer::sBindCount = 0;
|
U32 LLVertexBuffer::sBindCount = 0;
|
||||||
U32 LLVertexBuffer::sSetCount = 0;
|
U32 LLVertexBuffer::sSetCount = 0;
|
||||||
S32 LLVertexBuffer::sCount = 0;
|
S32 LLVertexBuffer::sCount = 0;
|
||||||
@@ -117,6 +116,7 @@ bool LLVertexBuffer::sMapped = false;
|
|||||||
bool LLVertexBuffer::sUseStreamDraw = true;
|
bool LLVertexBuffer::sUseStreamDraw = true;
|
||||||
bool LLVertexBuffer::sUseVAO = false;
|
bool LLVertexBuffer::sUseVAO = false;
|
||||||
bool LLVertexBuffer::sPreferStreamDraw = false;
|
bool LLVertexBuffer::sPreferStreamDraw = false;
|
||||||
|
LLVertexBuffer* LLVertexBuffer::sUtilityBuffer = nullptr;
|
||||||
|
|
||||||
|
|
||||||
U32 LLVBOPool::genBuffer()
|
U32 LLVBOPool::genBuffer()
|
||||||
@@ -135,7 +135,7 @@ void LLVBOPool::deleteBuffer(U32 name)
|
|||||||
LLVertexBuffer::unbind();
|
LLVertexBuffer::unbind();
|
||||||
|
|
||||||
glBindBufferARB(mType, name);
|
glBindBufferARB(mType, name);
|
||||||
glBufferDataARB(mType, 0, NULL, mUsage);
|
glBufferDataARB(mType, 0, nullptr, mUsage);
|
||||||
glBindBufferARB(mType, 0);
|
glBindBufferARB(mType, 0);
|
||||||
|
|
||||||
glDeleteBuffersARB(1, &name);
|
glDeleteBuffersARB(1, &name);
|
||||||
@@ -154,7 +154,7 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||||||
{
|
{
|
||||||
llassert(vbo_block_size(size) == size);
|
llassert(vbo_block_size(size) == size);
|
||||||
|
|
||||||
volatile U8* ret = NULL;
|
volatile U8* ret = nullptr;
|
||||||
|
|
||||||
U32 i = vbo_block_index(size);
|
U32 i = vbo_block_index(size);
|
||||||
|
|
||||||
@@ -186,12 +186,12 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||||||
|
|
||||||
if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB)
|
if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB)
|
||||||
{
|
{
|
||||||
glBufferDataARB(mType, size, 0, mUsage);
|
glBufferDataARB(mType, size, nullptr, mUsage);
|
||||||
ret = (U8*) ll_aligned_malloc<64>(size);
|
ret = (U8*) ll_aligned_malloc<64>(size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //always use a true hint of static draw when allocating non-client-backed buffers
|
{ //always use a true hint of static draw when allocating non-client-backed buffers
|
||||||
glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB);
|
glBufferDataARB(mType, size, nullptr, GL_STATIC_DRAW_ARB);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindBufferARB(mType, 0);
|
glBindBufferARB(mType, 0);
|
||||||
@@ -449,7 +449,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
GLenum array[] =
|
static const GLenum array[] =
|
||||||
{
|
{
|
||||||
GL_VERTEX_ARRAY,
|
GL_VERTEX_ARRAY,
|
||||||
GL_NORMAL_ARRAY,
|
GL_NORMAL_ARRAY,
|
||||||
@@ -457,7 +457,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
|
|||||||
GL_COLOR_ARRAY,
|
GL_COLOR_ARRAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
GLenum mask[] =
|
static const GLenum mask[] =
|
||||||
{
|
{
|
||||||
MAP_VERTEX,
|
MAP_VERTEX,
|
||||||
MAP_NORMAL,
|
MAP_NORMAL,
|
||||||
@@ -564,77 +564,96 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, con
|
|||||||
gGL.syncMatrices();
|
gGL.syncMatrices();
|
||||||
|
|
||||||
U32 count = pos.size();
|
U32 count = pos.size();
|
||||||
|
|
||||||
llassert(norm.size() >= pos.size());
|
llassert(norm.size() >= pos.size());
|
||||||
llassert(count > 0);
|
llassert(count > 0);
|
||||||
|
|
||||||
if( count == 0 )
|
if (count == 0)
|
||||||
{
|
{
|
||||||
LL_WARNS() << "Called drawArrays with 0 vertices" << LL_ENDL;
|
LL_WARNS() << "Called drawArrays with 0 vertices" << LL_ENDL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( norm.size() < pos.size() )
|
if (norm.size() < pos.size())
|
||||||
{
|
{
|
||||||
LL_WARNS() << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << LL_ENDL;
|
LL_WARNS() << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << LL_ENDL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unbind();
|
if (!sUtilityBuffer)
|
||||||
|
|
||||||
setupClientArrays(MAP_VERTEX | MAP_NORMAL);
|
|
||||||
|
|
||||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
|
||||||
|
|
||||||
if (shader)
|
|
||||||
{
|
{
|
||||||
glVertexAttribPointerARB(TYPE_VERTEX, 3, GL_FLOAT, GL_FALSE, 0, pos[0].mV);
|
sUtilityBuffer = new LLVertexBuffer(MAP_VERTEX | MAP_NORMAL | MAP_TEXCOORD0, GL_STREAM_DRAW);
|
||||||
glVertexAttribPointerARB(TYPE_NORMAL, 3, GL_FLOAT, GL_FALSE, 0, norm[0].mV);
|
sUtilityBuffer->allocateBuffer(count, count, true);
|
||||||
}
|
}
|
||||||
else
|
if (sUtilityBuffer->getNumVerts() < (S32)count)
|
||||||
{
|
{
|
||||||
glVertexPointer(3, GL_FLOAT, 0, pos[0].mV);
|
sUtilityBuffer->resizeBuffer(count, count);
|
||||||
glNormalPointer(GL_FLOAT, 0, norm[0].mV);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glDrawArrays(sGLMode[mode], 0, count);
|
LLStrider<LLVector3> vertex_strider;
|
||||||
|
LLStrider<LLVector3> normal_strider;
|
||||||
|
sUtilityBuffer->getVertexStrider(vertex_strider);
|
||||||
|
sUtilityBuffer->getNormalStrider(normal_strider);
|
||||||
|
for (U32 i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
*(vertex_strider++) = pos[i];
|
||||||
|
*(normal_strider++) = norm[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
sUtilityBuffer->setBuffer(MAP_VERTEX | MAP_NORMAL);
|
||||||
|
sUtilityBuffer->drawArrays(mode, 0, pos.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp)
|
void LLVertexBuffer::drawElements(U32 mode, const S32 num_vertices, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp)
|
||||||
{
|
{
|
||||||
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
|
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
|
||||||
|
|
||||||
|
if (num_vertices <= 0)
|
||||||
|
{
|
||||||
|
LL_WARNS() << "Called drawElements with 0 vertices" << LL_ENDL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_indices <= 0)
|
||||||
|
{
|
||||||
|
LL_WARNS() << "Called drawElements with 0 indices" << LL_ENDL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gGL.syncMatrices();
|
gGL.syncMatrices();
|
||||||
|
|
||||||
|
if (!sUtilityBuffer)
|
||||||
|
{
|
||||||
|
sUtilityBuffer = new LLVertexBuffer(MAP_VERTEX | MAP_NORMAL | MAP_TEXCOORD0, GL_STREAM_DRAW);
|
||||||
|
sUtilityBuffer->allocateBuffer(num_vertices, num_indices, true);
|
||||||
|
}
|
||||||
|
if (sUtilityBuffer->getNumVerts() < num_vertices || sUtilityBuffer->getNumIndices() < num_indices)
|
||||||
|
{
|
||||||
|
sUtilityBuffer->resizeBuffer(llmax(sUtilityBuffer->getNumVerts(), num_vertices), llmax(sUtilityBuffer->getNumIndices(), num_indices));
|
||||||
|
}
|
||||||
|
|
||||||
U32 mask = LLVertexBuffer::MAP_VERTEX;
|
U32 mask = LLVertexBuffer::MAP_VERTEX;
|
||||||
|
|
||||||
|
LLStrider<U16> index_strider;
|
||||||
|
LLStrider<LLVector4a> vertex_strider;
|
||||||
|
sUtilityBuffer->getIndexStrider(index_strider);
|
||||||
|
sUtilityBuffer->getVertexStrider(vertex_strider);
|
||||||
|
const S32 index_size = ((num_indices * sizeof(U16)) + 0xF) & ~0xF;
|
||||||
|
const S32 vertex_size = ((num_vertices * 4 * sizeof(F32)) + 0xF) & ~0xF;
|
||||||
|
LLVector4a::memcpyNonAliased16((F32*)index_strider.get(), (F32*)indicesp, index_size);
|
||||||
|
LLVector4a::memcpyNonAliased16((F32*)vertex_strider.get(), (F32*)pos, vertex_size);
|
||||||
if (tc)
|
if (tc)
|
||||||
{
|
{
|
||||||
mask = mask | LLVertexBuffer::MAP_TEXCOORD0;
|
mask = mask | LLVertexBuffer::MAP_TEXCOORD0;
|
||||||
|
LLStrider<LLVector2> tc_strider;
|
||||||
|
sUtilityBuffer->getTexCoord0Strider(tc_strider);
|
||||||
|
const S32 tc_size = ((num_vertices * 2 * sizeof(F32)) + 0xF) & ~0xF;
|
||||||
|
LLVector4a::memcpyNonAliased16((F32*)tc_strider.get(), (F32*)tc, tc_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
unbind();
|
sUtilityBuffer->setBuffer(mask);
|
||||||
|
sUtilityBuffer->draw(mode, num_indices, 0);
|
||||||
setupClientArrays(mask);
|
|
||||||
|
|
||||||
if (LLGLSLShader::sNoFixedFunction)
|
|
||||||
{
|
|
||||||
glVertexAttribPointerARB(TYPE_VERTEX, 3, GL_FLOAT, GL_FALSE, 16, pos);
|
|
||||||
if (tc)
|
|
||||||
{
|
|
||||||
glVertexAttribPointerARB(TYPE_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, 0, tc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glVertexPointer(3, GL_FLOAT, 16, pos);
|
|
||||||
if (tc)
|
|
||||||
{
|
|
||||||
glTexCoordPointer(2, GL_FLOAT, 0, tc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glDrawElements(sGLMode[mode], num_indices, GL_UNSIGNED_SHORT, indicesp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const
|
void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_offset) const
|
||||||
@@ -822,7 +841,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS);
|
//LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
glDrawArrays(sGLMode[mode], first, count);
|
glDrawArrays(sGLMode[mode], first, count);
|
||||||
}
|
}
|
||||||
@@ -834,12 +853,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
|
|||||||
void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping)
|
void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping)
|
||||||
{
|
{
|
||||||
sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject;
|
sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject;
|
||||||
sDisableVBOMapping = sEnableVBOs;// && no_vbo_mapping; //Temporary workaround for vbo mapping being straight up broken
|
sDisableVBOMapping = sEnableVBOs;// && no_vbo_mapping;
|
||||||
|
|
||||||
if (!sPrivatePoolp)
|
|
||||||
{
|
|
||||||
sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
@@ -882,11 +896,8 @@ void LLVertexBuffer::cleanupClass()
|
|||||||
sStreamVBOPool.cleanup();
|
sStreamVBOPool.cleanup();
|
||||||
sDynamicVBOPool.cleanup();
|
sDynamicVBOPool.cleanup();
|
||||||
|
|
||||||
if(sPrivatePoolp)
|
delete sUtilityBuffer;
|
||||||
{
|
sUtilityBuffer = nullptr;
|
||||||
LLPrivateMemoryPoolManager::getInstance()->deletePool(sPrivatePoolp);
|
|
||||||
sPrivatePoolp = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -944,8 +955,8 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
|
|||||||
mGLBuffer(0),
|
mGLBuffer(0),
|
||||||
mGLIndices(0),
|
mGLIndices(0),
|
||||||
mGLArray(0),
|
mGLArray(0),
|
||||||
mMappedData(NULL),
|
mMappedData(nullptr),
|
||||||
mMappedIndexData(NULL),
|
mMappedIndexData(nullptr),
|
||||||
mMappedDataUsingVBOs(false),
|
mMappedDataUsingVBOs(false),
|
||||||
mMappedIndexDataUsingVBOs(false),
|
mMappedIndexDataUsingVBOs(false),
|
||||||
mVertexLocked(false),
|
mVertexLocked(false),
|
||||||
@@ -953,7 +964,7 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
|
|||||||
mFinal(false),
|
mFinal(false),
|
||||||
mEmpty(true),
|
mEmpty(true),
|
||||||
mMappable(false),
|
mMappable(false),
|
||||||
mFence(NULL)
|
mFence(nullptr)
|
||||||
{
|
{
|
||||||
mMappable = (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping);
|
mMappable = (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping);
|
||||||
|
|
||||||
@@ -1031,7 +1042,7 @@ LLVertexBuffer::~LLVertexBuffer()
|
|||||||
delete mFence;
|
delete mFence;
|
||||||
}
|
}
|
||||||
|
|
||||||
mFence = NULL;
|
mFence = nullptr;
|
||||||
|
|
||||||
sVertexCount -= mNumVerts;
|
sVertexCount -= mNumVerts;
|
||||||
sIndexCount -= mNumIndices;
|
sIndexCount -= mNumIndices;
|
||||||
@@ -1109,7 +1120,7 @@ void LLVertexBuffer::releaseBuffer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mGLBuffer = 0;
|
mGLBuffer = 0;
|
||||||
mMappedData = NULL;
|
mMappedData = nullptr;
|
||||||
|
|
||||||
sGLCount--;
|
sGLCount--;
|
||||||
}
|
}
|
||||||
@@ -1126,7 +1137,7 @@ void LLVertexBuffer::releaseIndices()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mGLIndices = 0;
|
mGLIndices = 0;
|
||||||
mMappedIndexData = NULL;
|
mMappedIndexData = nullptr;
|
||||||
|
|
||||||
sGLCount--;
|
sGLCount--;
|
||||||
}
|
}
|
||||||
@@ -1155,7 +1166,7 @@ void LLVertexBuffer::createGLBuffer(U32 size)
|
|||||||
{
|
{
|
||||||
static int gl_buffer_idx = 0;
|
static int gl_buffer_idx = 0;
|
||||||
mGLBuffer = ++gl_buffer_idx;
|
mGLBuffer = ++gl_buffer_idx;
|
||||||
mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
|
mMappedData = (U8*)ll_aligned_malloc_16(size);
|
||||||
mSize = size;
|
mSize = size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1187,7 +1198,7 @@ void LLVertexBuffer::createGLIndices(U32 size)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
|
mMappedIndexData = (U8*)ll_aligned_malloc_16(size);
|
||||||
static int gl_buffer_idx = 0;
|
static int gl_buffer_idx = 0;
|
||||||
mGLIndices = ++gl_buffer_idx;
|
mGLIndices = ++gl_buffer_idx;
|
||||||
mIndicesSize = size;
|
mIndicesSize = size;
|
||||||
@@ -1204,8 +1215,8 @@ void LLVertexBuffer::destroyGLBuffer()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FREE_MEM(sPrivatePoolp, (void*) mMappedData);
|
ll_aligned_free_16((void*) mMappedData);
|
||||||
mMappedData = NULL;
|
mMappedData = nullptr;
|
||||||
mEmpty = true;
|
mEmpty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1224,8 +1235,8 @@ void LLVertexBuffer::destroyGLIndices()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData);
|
ll_aligned_free_16((void*) mMappedIndexData);
|
||||||
mMappedIndexData = NULL;
|
mMappedIndexData = nullptr;
|
||||||
mEmpty = true;
|
mEmpty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1529,7 +1540,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
volatile U8* src = NULL;
|
volatile U8* src = nullptr;
|
||||||
waitFence();
|
waitFence();
|
||||||
if (gGLManager.mHasMapBufferRange)
|
if (gGLManager.mHasMapBufferRange)
|
||||||
{
|
{
|
||||||
@@ -1716,7 +1727,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
volatile U8* src = NULL;
|
volatile U8* src = nullptr;
|
||||||
waitFence();
|
waitFence();
|
||||||
if (gGLManager.mHasMapBufferRange)
|
if (gGLManager.mHasMapBufferRange)
|
||||||
{
|
{
|
||||||
@@ -1849,7 +1860,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, getSize(), NULL, mUsage);
|
glBufferDataARB(GL_ARRAY_BUFFER_ARB, getSize(), nullptr, mUsage); // <alchemy/>
|
||||||
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData);
|
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
@@ -1887,7 +1898,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
mMappedData = NULL;
|
mMappedData = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
mVertexLocked = false;
|
mVertexLocked = false;
|
||||||
@@ -1916,7 +1927,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, getIndicesSize(), NULL, mUsage);
|
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, getIndicesSize(), nullptr, mUsage); // <alchemy/>
|
||||||
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData);
|
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
@@ -1955,7 +1966,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||||||
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
|
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
mMappedIndexData = NULL;
|
mMappedIndexData = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
mIndexLocked = false;
|
mIndexLocked = false;
|
||||||
@@ -1970,7 +1981,8 @@ void LLVertexBuffer::unmapBuffer()
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
template <class T,S32 type> struct VertexBufferStrider
|
template <class T, S32 type>
|
||||||
|
struct VertexBufferStrider
|
||||||
{
|
{
|
||||||
typedef LLStrider<T> strider_t;
|
typedef LLStrider<T> strider_t;
|
||||||
static bool get(LLVertexBuffer& vbo,
|
static bool get(LLVertexBuffer& vbo,
|
||||||
@@ -1983,7 +1995,7 @@ template <class T,S32 type> struct VertexBufferStrider
|
|||||||
|
|
||||||
volatile U8* ptr = vbo.mapVertexBuffer(type, index, count, map_range);
|
volatile U8* ptr = vbo.mapVertexBuffer(type, index, count, map_range);
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == nullptr)
|
||||||
{
|
{
|
||||||
LL_WARNS() << "mapVertexBuffer failed!" << LL_ENDL;
|
LL_WARNS() << "mapVertexBuffer failed!" << LL_ENDL;
|
||||||
return false;
|
return false;
|
||||||
@@ -2011,7 +2023,7 @@ struct VertexBufferStrider<T, LLVertexBuffer::TYPE_INDEX>
|
|||||||
{
|
{
|
||||||
volatile U8* ptr = vbo.mapIndexBuffer(index, count, map_range);
|
volatile U8* ptr = vbo.mapIndexBuffer(index, count, map_range);
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == nullptr)
|
||||||
{
|
{
|
||||||
LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL;
|
LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL;
|
||||||
return false;
|
return false;
|
||||||
@@ -2176,16 +2188,6 @@ void LLVertexBuffer::flush()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bind for transform feedback (quick 'n dirty)
|
|
||||||
void LLVertexBuffer::bindForFeedback(U32 channel, U32 type, U32 index, U32 count)
|
|
||||||
{
|
|
||||||
#ifdef GL_TRANSFORM_FEEDBACK_BUFFER
|
|
||||||
U32 offset = mOffsets[type] + sTypeSize[type]*index;
|
|
||||||
U32 size= (sTypeSize[type]*count);
|
|
||||||
glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, channel, mGLBuffer, offset, size);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set for rendering
|
// Set for rendering
|
||||||
void LLVertexBuffer::setBuffer(U32 data_mask)
|
void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ public:
|
|||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// base class
|
// base class
|
||||||
class LLPrivateMemoryPool;
|
|
||||||
class LLVertexBuffer : public LLRefCount
|
class LLVertexBuffer : public LLRefCount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -142,7 +141,7 @@ public:
|
|||||||
static void cleanupClass();
|
static void cleanupClass();
|
||||||
static void setupClientArrays(U32 data_mask);
|
static void setupClientArrays(U32 data_mask);
|
||||||
static void drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm);
|
static void drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm);
|
||||||
static void drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp);
|
static void drawElements(U32 mode, const S32 num_vertices, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp);
|
||||||
|
|
||||||
static void unbind(); //unbind any bound vertex buffer
|
static void unbind(); //unbind any bound vertex buffer
|
||||||
|
|
||||||
@@ -227,8 +226,6 @@ public:
|
|||||||
volatile U8* mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range);
|
volatile U8* mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range);
|
||||||
volatile U8* mapIndexBuffer(S32 index, S32 count, bool map_range);
|
volatile U8* mapIndexBuffer(S32 index, S32 count, bool map_range);
|
||||||
|
|
||||||
void bindForFeedback(U32 channel, U32 type, U32 index, U32 count);
|
|
||||||
|
|
||||||
// set for rendering
|
// set for rendering
|
||||||
virtual void setBuffer(U32 data_mask); // calls setupVertexBuffer() if data_mask is not 0
|
virtual void setBuffer(U32 data_mask); // calls setupVertexBuffer() if data_mask is not 0
|
||||||
void flush(); //flush pending data to GL memory
|
void flush(); //flush pending data to GL memory
|
||||||
@@ -327,9 +324,6 @@ protected:
|
|||||||
|
|
||||||
static S32 determineUsage(S32 usage);
|
static S32 determineUsage(S32 usage);
|
||||||
|
|
||||||
private:
|
|
||||||
static LLPrivateMemoryPool* sPrivatePoolp;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static S32 sCount;
|
static S32 sCount;
|
||||||
static S32 sGLCount;
|
static S32 sGLCount;
|
||||||
@@ -353,6 +347,9 @@ public:
|
|||||||
static U32 sIndexCount;
|
static U32 sIndexCount;
|
||||||
static U32 sBindCount;
|
static U32 sBindCount;
|
||||||
static U32 sSetCount;
|
static U32 sSetCount;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static LLVertexBuffer* sUtilityBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
#include "llnotifications.h"
|
#include "llnotifications.h"
|
||||||
#include "llfunctorregistry.h"
|
#include "llfunctorregistry.h"
|
||||||
|
#include "lldraghandle.h"
|
||||||
|
|
||||||
const S32 MAX_ALLOWED_MSG_WIDTH = 400;
|
const S32 MAX_ALLOWED_MSG_WIDTH = 400;
|
||||||
const F32 DEFAULT_BUTTON_DELAY = 0.5f;
|
const F32 DEFAULT_BUTTON_DELAY = 0.5f;
|
||||||
@@ -233,6 +234,12 @@ LLAlertDialog::LLAlertDialog( LLNotificationPtr notification, bool modal)
|
|||||||
msg_box->setColor( LLUI::sColorsGroup->getColor( "AlertTextColor" ) );
|
msg_box->setColor( LLUI::sColorsGroup->getColor( "AlertTextColor" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLDragHandle* handle = getDragHandle();
|
||||||
|
if (handle)
|
||||||
|
{
|
||||||
|
getDragHandle()->setTextColor(LLUI::sColorsGroup->getColor(mCaution ? "AlertCautionTextColor" : "AlertTextColor"));
|
||||||
|
}
|
||||||
|
|
||||||
LLRect rect;
|
LLRect rect;
|
||||||
rect.setLeftTopAndSize( msg_x, msg_y, text_rect.getWidth(), text_rect.getHeight() );
|
rect.setLeftTopAndSize( msg_x, msg_y, text_rect.getWidth(), text_rect.getHeight() );
|
||||||
msg_box->setRect( rect );
|
msg_box->setRect( rect );
|
||||||
@@ -257,6 +264,10 @@ LLAlertDialog::LLAlertDialog( LLNotificationPtr notification, bool modal)
|
|||||||
button_data.mText);
|
button_data.mText);
|
||||||
|
|
||||||
btn->setClickedCallback(boost::bind(&LLAlertDialog::onButtonPressed, this, _1, button_data.mUrl));
|
btn->setClickedCallback(boost::bind(&LLAlertDialog::onButtonPressed, this, _1, button_data.mUrl));
|
||||||
|
if (mCaution)
|
||||||
|
{
|
||||||
|
btn->setColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor"));
|
||||||
|
}
|
||||||
|
|
||||||
addChild(btn);
|
addChild(btn);
|
||||||
|
|
||||||
@@ -370,6 +381,11 @@ bool LLAlertDialog::setCheckBox( const std::string& check_title, const std::stri
|
|||||||
max_msg_width, LINE_HEIGHT);
|
max_msg_width, LINE_HEIGHT);
|
||||||
|
|
||||||
mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, boost::bind(&LLAlertDialog::onClickIgnore, this, _1));
|
mCheck = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font, boost::bind(&LLAlertDialog::onClickIgnore, this, _1));
|
||||||
|
mCheck->setEnabledColor(LLUI::sColorsGroup->getColor( mCaution ? "AlertCautionTextColor" : "AlertTextColor"));
|
||||||
|
if (mCaution)
|
||||||
|
{
|
||||||
|
mCheck->setButtonColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor"));
|
||||||
|
}
|
||||||
addChild(mCheck);
|
addChild(mCheck);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -100,8 +100,10 @@ public:
|
|||||||
// LLCheckBoxCtrl interface
|
// LLCheckBoxCtrl interface
|
||||||
virtual BOOL toggle() { return mButton->toggleState(); } // returns new state
|
virtual BOOL toggle() { return mButton->toggleState(); } // returns new state
|
||||||
|
|
||||||
void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; }
|
void setEnabledColor(const LLColor4 &color) { mTextEnabledColor = color; setEnabled(getEnabled()); }
|
||||||
void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; }
|
void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; setEnabled(getEnabled()); }
|
||||||
|
|
||||||
|
void setButtonColor(const LLColor4 &color) { if (mButton) mButton->setColor(color); }
|
||||||
|
|
||||||
void setLabel( const LLStringExplicit& label );
|
void setLabel( const LLStringExplicit& label );
|
||||||
std::string getLabel() const;
|
std::string getLabel() const;
|
||||||
|
|||||||
@@ -301,6 +301,13 @@ BOOL LLDragHandle::handleMouseUp(S32 x, S32 y, MASK mask)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLDragHandle::setTextColor(const LLColor4& color)
|
||||||
|
{
|
||||||
|
if (mTitleBox)
|
||||||
|
{
|
||||||
|
mTitleBox->setColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask)
|
BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ public:
|
|||||||
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
||||||
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
||||||
|
|
||||||
|
virtual void setTextColor(const LLColor4& color);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LLTextBox* getTitleBox() const { return mTitleBox; }
|
LLTextBox* getTitleBox() const { return mTitleBox; }
|
||||||
void setTitleBox(LLTextBox*);
|
void setTitleBox(LLTextBox*);
|
||||||
|
|||||||
@@ -891,7 +891,7 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt
|
|||||||
assert(!wasFound);
|
assert(!wasFound);
|
||||||
if (passesFilter)
|
if (passesFilter)
|
||||||
{
|
{
|
||||||
LL_INFOS() << "Inserting " << pNotification->getName() << LL_ENDL;
|
//LL_INFOS() << "Inserting " << pNotification->getName() << LL_ENDL;
|
||||||
// not in our list, add it and say so
|
// not in our list, add it and say so
|
||||||
mItems.insert(pNotification);
|
mItems.insert(pNotification);
|
||||||
abortProcessing = mChanged(payload);
|
abortProcessing = mChanged(payload);
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect,
|
|||||||
mNeedsScroll(false),
|
mNeedsScroll(false),
|
||||||
mCanSelect(true),
|
mCanSelect(true),
|
||||||
mColumnsDirty(false),
|
mColumnsDirty(false),
|
||||||
|
mSortEnabled(true),
|
||||||
mMaxItemCount(INT_MAX),
|
mMaxItemCount(INT_MAX),
|
||||||
mMaxContentWidth(0),
|
mMaxContentWidth(0),
|
||||||
mBorderThickness( 2 ),
|
mBorderThickness( 2 ),
|
||||||
@@ -2301,6 +2302,16 @@ BOOL LLScrollListCtrl::setSort(S32 column_idx, BOOL ascending)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLScrollListCtrl::setSortEnabled(bool sort)
|
||||||
|
{
|
||||||
|
bool update = sort && !mSortEnabled;
|
||||||
|
mSortEnabled = sort;
|
||||||
|
if (update)
|
||||||
|
{
|
||||||
|
updateSort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
S32 LLScrollListCtrl::getLinesPerPage()
|
S32 LLScrollListCtrl::getLinesPerPage()
|
||||||
{
|
{
|
||||||
//if mPageLines is NOT provided display all item
|
//if mPageLines is NOT provided display all item
|
||||||
@@ -2942,7 +2953,7 @@ std::string LLScrollListCtrl::getSortColumnName()
|
|||||||
|
|
||||||
BOOL LLScrollListCtrl::hasSortOrder() const
|
BOOL LLScrollListCtrl::hasSortOrder() const
|
||||||
{
|
{
|
||||||
return !mSortColumns.empty();
|
return mSortEnabled && !mSortColumns.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLScrollListCtrl::clearSortOrder()
|
void LLScrollListCtrl::clearSortOrder()
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ public:
|
|||||||
BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; }
|
BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; }
|
||||||
BOOL hasSortOrder() const;
|
BOOL hasSortOrder() const;
|
||||||
void clearSortOrder();
|
void clearSortOrder();
|
||||||
|
void setSortEnabled(bool sort);
|
||||||
|
|
||||||
template<typename T> S32 selectMultiple(const std::vector<T>& vec)
|
template<typename T> S32 selectMultiple(const std::vector<T>& vec)
|
||||||
{
|
{
|
||||||
@@ -423,6 +424,7 @@ private:
|
|||||||
bool mDisplayColumnHeaders;
|
bool mDisplayColumnHeaders;
|
||||||
bool mColumnsDirty;
|
bool mColumnsDirty;
|
||||||
bool mColumnWidthsDirty;
|
bool mColumnWidthsDirty;
|
||||||
|
bool mSortEnabled;
|
||||||
|
|
||||||
mutable item_list mItemList;
|
mutable item_list mItemList;
|
||||||
|
|
||||||
|
|||||||
@@ -596,6 +596,7 @@ set(viewer_SOURCE_FILES
|
|||||||
scriptcounter.cpp
|
scriptcounter.cpp
|
||||||
sgmemstat.cpp
|
sgmemstat.cpp
|
||||||
shcommandhandler.cpp
|
shcommandhandler.cpp
|
||||||
|
shupdatechecker.cpp
|
||||||
shfloatermediaticker.cpp
|
shfloatermediaticker.cpp
|
||||||
wlfPanel_AdvSettings.cpp
|
wlfPanel_AdvSettings.cpp
|
||||||
)
|
)
|
||||||
@@ -1138,6 +1139,7 @@ set(viewer_HEADER_FILES
|
|||||||
sgmemstat.h
|
sgmemstat.h
|
||||||
shcommandhandler.h
|
shcommandhandler.h
|
||||||
shfloatermediaticker.h
|
shfloatermediaticker.h
|
||||||
|
shupdatechecker.h
|
||||||
wlfPanel_AdvSettings.h
|
wlfPanel_AdvSettings.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -873,6 +873,61 @@
|
|||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<boolean>1</boolean>
|
<boolean>1</boolean>
|
||||||
</map>
|
</map>
|
||||||
|
<key>SinguLastKnownReleaseBuild</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Latest known available verson.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>S32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<boolean>0</boolean>
|
||||||
|
</map>
|
||||||
|
<key>SinguLastKnownAlphaBuild</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Latest known available verson.</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>S32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<boolean>0</boolean>
|
||||||
|
</map>
|
||||||
|
<key>WarnRecommendedUpdate</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Enables recommended update notification dialog</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</map>
|
||||||
|
<key>WarnUrgentUpdate</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Enables critical update notification dialog</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</map>
|
||||||
|
<key>WarnUrgentUpdateModal</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Enables critical update modal dialog</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>Boolean</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</map>
|
||||||
<key>UseWebProfiles</key>
|
<key>UseWebProfiles</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
@@ -1004,7 +1059,7 @@
|
|||||||
<key>Type</key>
|
<key>Type</key>
|
||||||
<string>String</string>
|
<string>String</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<string>http://singularity-viewer.github.io</string>
|
<string></string>
|
||||||
</map>
|
</map>
|
||||||
<key>SingularitySplashPagePath</key>
|
<key>SingularitySplashPagePath</key>
|
||||||
<map>
|
<map>
|
||||||
|
|||||||
@@ -45,28 +45,8 @@ uniform float ssao_factor;
|
|||||||
uniform vec2 kern_scale;
|
uniform vec2 kern_scale;
|
||||||
uniform vec2 noise_scale;
|
uniform vec2 noise_scale;
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
vec3 decode_normal(vec2 enc);
|
||||||
{
|
vec4 getPosition(vec2 pos_screen);
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{
|
|
||||||
float depth = texture2D(depthMapDownsampled, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 getKern(int i)
|
vec2 getKern(int i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,59 +99,10 @@ uniform vec3 light_direction[8];
|
|||||||
uniform vec3 light_attenuation[8];
|
uniform vec3 light_attenuation[8];
|
||||||
uniform vec3 light_diffuse[8];
|
uniform vec3 light_diffuse[8];
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
vec3 decode_normal(vec2 enc);
|
||||||
vec3 low_range = cs / vec3(12.92);
|
vec3 srgb_to_linear(vec3 cs);
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
vec3 linear_to_srgb(vec3 cl);
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 linear_to_srgb(vec3 cl)
|
|
||||||
{
|
|
||||||
cl = clamp(cl, vec3(0), vec3(1));
|
|
||||||
vec3 low_range = cl * 12.92;
|
|
||||||
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
|
||||||
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lt.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lt.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lt.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 calcDirectionalLight(vec3 n, vec3 l)
|
vec3 calcDirectionalLight(vec3 n, vec3 l)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,11 +36,7 @@ uniform float minimum_alpha;
|
|||||||
VARYING vec3 vary_normal;
|
VARYING vec3 vary_normal;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ VARYING vec2 vary_fragcoord;
|
|||||||
|
|
||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
|
|
||||||
|
vec3 decode_normal(vec2 enc);
|
||||||
|
vec4 getPosition(vec2 pos_screen);
|
||||||
|
|
||||||
vec2 getKern(int i)
|
vec2 getKern(int i)
|
||||||
{
|
{
|
||||||
vec2 kern[4];
|
vec2 kern[4];
|
||||||
@@ -55,35 +58,6 @@ vec2 getKern(int i)
|
|||||||
return kern[i];
|
return kern[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 tc = vary_fragcoord.xy;
|
vec2 tc = vary_fragcoord.xy;
|
||||||
|
|||||||
@@ -39,11 +39,7 @@ VARYING vec3 vary_mat2;
|
|||||||
VARYING vec4 vertex_color;
|
VARYING vec4 vertex_color;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/**
|
||||||
|
* @file utilityFuncF.glsl
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2007, 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$
|
||||||
|
*/
|
||||||
|
|
||||||
|
uniform mat4 inv_proj;
|
||||||
|
uniform vec2 screen_res;
|
||||||
|
uniform sampler2D depthMap;
|
||||||
|
|
||||||
|
vec2 encode_normal(vec3 n)
|
||||||
|
{
|
||||||
|
float f = sqrt(8 * n.z + 8);
|
||||||
|
return n.xy / f + 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 decode_normal(vec2 enc)
|
||||||
|
{
|
||||||
|
vec2 fenc = enc*4-2;
|
||||||
|
float f = dot(fenc,fenc);
|
||||||
|
float g = sqrt(1-f/4);
|
||||||
|
vec3 n;
|
||||||
|
n.xy = fenc*g;
|
||||||
|
n.z = 1-f/2;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 getPosition(vec2 pos_screen)
|
||||||
|
{
|
||||||
|
float depth = texture2D(depthMap, pos_screen.xy).r;
|
||||||
|
vec2 sc = pos_screen.xy*2.0;
|
||||||
|
sc -= vec2(1.0,1.0);
|
||||||
|
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||||
|
vec4 pos = inv_proj * ndc;
|
||||||
|
pos /= pos.w;
|
||||||
|
pos.w = 1.0;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 srgb_to_linear(vec3 cs)
|
||||||
|
{
|
||||||
|
vec3 low_range = cs / vec3(12.92);
|
||||||
|
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
||||||
|
|
||||||
|
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
||||||
|
vec3 result;
|
||||||
|
#ifdef OLD_SELECT
|
||||||
|
vec3 result;
|
||||||
|
result.r = lte.r ? low_range.r : high_range.r;
|
||||||
|
result.g = lte.g ? low_range.g : high_range.g;
|
||||||
|
result.b = lte.b ? low_range.b : high_range.b;
|
||||||
|
return result;
|
||||||
|
#else
|
||||||
|
return mix(high_range, low_range, lte);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 srgb_to_linear(vec4 cs)
|
||||||
|
{
|
||||||
|
return vec4(srgb_to_linear(cs.rgb), cs.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 linear_to_srgb(vec3 cl)
|
||||||
|
{
|
||||||
|
cl = clamp(cl, vec3(0), vec3(1));
|
||||||
|
vec3 low_range = cl * 12.92;
|
||||||
|
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
||||||
|
|
||||||
|
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
||||||
|
#ifdef OLD_SELECT
|
||||||
|
vec3 result;
|
||||||
|
result.r = lt.r ? low_range.r : high_range.r;
|
||||||
|
result.g = lt.g ? low_range.g : high_range.g;
|
||||||
|
result.b = lt.b ? low_range.b : high_range.b;
|
||||||
|
return result;
|
||||||
|
#else
|
||||||
|
return mix(high_range, low_range, lt);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 linear_to_srgb(vec4 cl)
|
||||||
|
{
|
||||||
|
return vec4(linear_to_srgb(cl.rgb), cl.a);
|
||||||
|
}
|
||||||
@@ -37,11 +37,7 @@ VARYING vec3 vary_normal;
|
|||||||
VARYING vec4 vertex_color;
|
VARYING vec4 vertex_color;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,11 +36,7 @@ uniform float minimum_alpha;
|
|||||||
VARYING vec4 vertex_color;
|
VARYING vec4 vertex_color;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,11 +37,7 @@ uniform sampler2D diffuseMap;
|
|||||||
VARYING vec3 vary_normal;
|
VARYING vec3 vary_normal;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,11 +35,7 @@ VARYING vec3 vary_normal;
|
|||||||
VARYING vec4 vertex_color;
|
VARYING vec4 vertex_color;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,12 +33,7 @@ VARYING vec3 vary_normal;
|
|||||||
VARYING vec4 vertex_color;
|
VARYING vec4 vertex_color;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,16 +39,10 @@ VARYING vec2 vary_texcoord0;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float shadow = 1.0;
|
float alpha = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a;
|
||||||
|
if(alpha < .01)
|
||||||
vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color;
|
|
||||||
if(color.a < .01)
|
|
||||||
discard;
|
discard;
|
||||||
color.rgb = pow(color.rgb, vec3(2.2));
|
|
||||||
color.rgb = fullbrightAtmosTransport(color.rgb);
|
|
||||||
|
|
||||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
frag_color = vec4(0,0,0,alpha);
|
||||||
|
|
||||||
frag_color = color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,17 +46,12 @@ VARYING vec2 vary_texcoord0;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//transform vertex
|
|
||||||
vec4 vert = vec4(position.xyz, 1.0);
|
|
||||||
vec4 pos = (modelview_matrix * vert);
|
|
||||||
passTextureIndex();
|
passTextureIndex();
|
||||||
|
|
||||||
gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
|
gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
|
||||||
|
|
||||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||||
|
|
||||||
calcAtmospherics(pos.xyz);
|
|
||||||
|
|
||||||
vertex_color = emissive;
|
vertex_color = emissive;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,43 +39,8 @@ VARYING vec3 vary_position;
|
|||||||
VARYING vec4 vertex_color;
|
VARYING vec4 vertex_color;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
|
vec3 srgb_to_linear(vec3 cs);
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
vec3 linear_to_srgb(vec3 cl);
|
||||||
{
|
|
||||||
vec3 low_range = cs / vec3(12.92);
|
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 linear_to_srgb(vec3 cl)
|
|
||||||
{
|
|
||||||
cl = clamp(cl, vec3(0), vec3(1));
|
|
||||||
vec3 low_range = cl * 12.92;
|
|
||||||
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
|
||||||
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lt.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lt.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lt.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 fullbrightAtmosTransportDeferred(vec3 light)
|
vec3 fullbrightAtmosTransportDeferred(vec3 light)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,41 +38,7 @@ uniform sampler2D specularMap;
|
|||||||
|
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
vec3 linear_to_srgb(vec3 cs);
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 linear_to_srgb(vec3 cl)
|
|
||||||
{
|
|
||||||
cl = clamp(cl, vec3(0), vec3(1));
|
|
||||||
vec3 low_range = cl * 12.92;
|
|
||||||
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
|
||||||
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lt.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lt.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lt.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,42 +30,10 @@
|
|||||||
|
|
||||||
uniform float emissive_brightness;
|
uniform float emissive_brightness;
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
vec3 decode_normal(vec2 enc);
|
||||||
vec3 low_range = cs / vec3(12.92);
|
vec3 srgb_to_linear(vec3 cs);
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
vec3 linear_to_srgb(vec3 cl);
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 linear_to_srgb(vec3 cl)
|
|
||||||
{
|
|
||||||
cl = clamp(cl, vec3(0), vec3(1));
|
|
||||||
vec3 low_range = cl * 12.92;
|
|
||||||
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
|
||||||
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lt.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lt.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lt.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||||
|
|
||||||
@@ -271,17 +239,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
|
||||||
{
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef WATER_FOG
|
#ifndef WATER_FOG
|
||||||
vec3 getPositionEye()
|
vec3 getPositionEye()
|
||||||
{
|
{
|
||||||
@@ -504,23 +461,6 @@ VARYING vec3 vary_normal;
|
|||||||
VARYING vec4 vertex_color;
|
VARYING vec4 vertex_color;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy);
|
vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||||
|
|||||||
@@ -55,34 +55,8 @@ uniform float far_z;
|
|||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
uniform vec2 noise_scale;
|
uniform vec2 noise_scale;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec3 decode_normal(vec2 enc);
|
||||||
{
|
vec4 getPosition(vec2 pos_screen);
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,55 +63,29 @@ uniform float size;
|
|||||||
|
|
||||||
VARYING vec4 vary_fragcoord;
|
VARYING vec4 vary_fragcoord;
|
||||||
|
|
||||||
|
vec3 decode_normal(vec2 enc);
|
||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
uniform vec2 noise_scale;
|
uniform vec2 noise_scale;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec4 getPosition(vec2 pos_screen);
|
||||||
{
|
vec3 srgb_to_linear(vec3 cs);
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
|
||||||
{
|
|
||||||
vec3 low_range = cs / vec3(12.92);
|
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||||
{
|
{
|
||||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||||
ret.rgb = srgb_to_linear(ret.rgb);
|
ret.rgb = srgb_to_linear(ret.rgb);
|
||||||
|
|
||||||
vec2 dist = tc-vec2(0.5);
|
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||||
|
|
||||||
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
|
float det = min(lod/(proj_lod*0.5), 1.0);
|
||||||
|
|
||||||
float d = dot(dist,dist);
|
float d = min(dist.x, dist.y);
|
||||||
|
|
||||||
ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
|
d *= min(1, d * (proj_lod - lod));
|
||||||
|
|
||||||
|
float edge = 0.25*det;
|
||||||
|
|
||||||
|
ret *= clamp(d/edge, 0.0, 1.0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -148,19 +122,6 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 frag = vary_fragcoord;
|
vec4 frag = vary_fragcoord;
|
||||||
|
|||||||
@@ -53,34 +53,8 @@ uniform mat4 inv_proj;
|
|||||||
uniform vec4 viewport;
|
uniform vec4 viewport;
|
||||||
uniform vec2 noise_scale;
|
uniform vec2 noise_scale;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec3 decode_normal(vec2 enc);
|
||||||
{
|
vec4 getPosition(vec2 pos_screen);
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,25 +37,7 @@ VARYING vec2 vary_fragcoord;
|
|||||||
|
|
||||||
//uniform float display_gamma;
|
//uniform float display_gamma;
|
||||||
|
|
||||||
vec3 linear_to_srgb(vec3 cl)
|
vec3 linear_to_srgb(vec3 cl);
|
||||||
{
|
|
||||||
cl = clamp(cl, vec3(0), vec3(1));
|
|
||||||
vec3 low_range = cl * 12.92;
|
|
||||||
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
|
||||||
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lt.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lt.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lt.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,18 +47,7 @@ VARYING vec2 vary_fragcoord;
|
|||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
uniform vec2 screen_res;
|
uniform vec2 screen_res;
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
vec4 getPosition(vec2 pos_screen);
|
||||||
{
|
|
||||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc /= screen_res;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,53 +74,9 @@ vec3 vary_AtmosAttenuation;
|
|||||||
|
|
||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
vec3 decode_normal(vec2 enc);
|
||||||
{
|
vec3 srgb_to_linear(vec3 cs);
|
||||||
vec3 low_range = cs / vec3(12.92);
|
vec3 linear_to_srgb(vec3 cl);
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 linear_to_srgb(vec3 cl)
|
|
||||||
{
|
|
||||||
vec3 low_range = cl * 12.92;
|
|
||||||
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
|
||||||
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lt.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lt.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lt.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||||
{
|
{
|
||||||
@@ -133,12 +89,6 @@ vec4 getPosition_d(vec2 pos_screen, float depth)
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{ //get position in screen space (world units) given window coordinate and depth map
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).a;
|
|
||||||
return getPosition_d(pos_screen, depth);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 getPositionEye()
|
vec3 getPositionEye()
|
||||||
{
|
{
|
||||||
return vary_PositionEye;
|
return vary_PositionEye;
|
||||||
|
|||||||
@@ -66,50 +66,14 @@ VARYING vec4 vary_fragcoord;
|
|||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
uniform vec2 noise_scale;
|
uniform vec2 noise_scale;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec3 decode_normal(vec2 enc);
|
||||||
{
|
vec4 getPosition(vec2 pos_screen);
|
||||||
float f = sqrt(8 * n.z + 8);
|
vec4 srgb_to_linear(vec4 cs);
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
|
||||||
{
|
|
||||||
vec3 low_range = cs / vec3(12.92);
|
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 correctWithGamma(vec4 col)
|
|
||||||
{
|
|
||||||
return vec4(srgb_to_linear(col.rgb), col.a);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||||
{
|
{
|
||||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||||
ret = correctWithGamma(ret);
|
ret = srgb_to_linear(ret);
|
||||||
|
|
||||||
vec2 dist = tc-vec2(0.5);
|
vec2 dist = tc-vec2(0.5);
|
||||||
|
|
||||||
@@ -125,7 +89,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
|||||||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||||
{
|
{
|
||||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||||
ret = correctWithGamma(ret);
|
ret = srgb_to_linear(ret);
|
||||||
|
|
||||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||||
|
|
||||||
@@ -143,7 +107,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
|||||||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||||
{
|
{
|
||||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||||
ret = correctWithGamma(ret);
|
ret = srgb_to_linear(ret);
|
||||||
|
|
||||||
vec2 dist = tc-vec2(0.5);
|
vec2 dist = tc-vec2(0.5);
|
||||||
|
|
||||||
@@ -154,19 +118,6 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 frag = vary_fragcoord;
|
vec4 frag = vary_fragcoord;
|
||||||
|
|||||||
@@ -37,12 +37,12 @@ uniform sampler2D depthMap;
|
|||||||
|
|
||||||
uniform sampler2D diffuseRect;
|
uniform sampler2D diffuseRect;
|
||||||
|
|
||||||
uniform vec2 kern_scale;
|
uniform vec2 ssao_scale;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
frag_color[0] = 1.0;
|
frag_color[0] = 1.0;
|
||||||
frag_color[1] = texture2D(diffuseRect,vary_fragcoord.xy * kern_scale).r; // Scales to handle lower-res ssao.
|
frag_color[1] = texture2D(diffuseRect,vary_fragcoord.xy * ssao_scale).r; // Scales to handle lower-res ssao.
|
||||||
frag_color[2] = 1.0;
|
frag_color[2] = 1.0;
|
||||||
frag_color[3] = 1.0;
|
frag_color[3] = 1.0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,11 +39,7 @@ VARYING vec3 vary_normal;
|
|||||||
VARYING vec4 vary_texcoord0;
|
VARYING vec4 vary_texcoord0;
|
||||||
VARYING vec4 vary_texcoord1;
|
VARYING vec4 vary_texcoord1;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,11 +37,7 @@ VARYING vec2 vary_texcoord0;
|
|||||||
|
|
||||||
uniform float minimum_alpha;
|
uniform float minimum_alpha;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,48 +56,8 @@ VARYING vec4 refCoord;
|
|||||||
VARYING vec4 littleWave;
|
VARYING vec4 littleWave;
|
||||||
VARYING vec4 view;
|
VARYING vec4 view;
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
vec3 encode_diffuse(vec3 color);
|
||||||
vec3 low_range = cs / vec3(12.92);
|
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 linear_to_srgb(vec3 cl)
|
|
||||||
{
|
|
||||||
cl = clamp(cl, vec3(0), vec3(1));
|
|
||||||
vec3 low_range = cl * 12.92;
|
|
||||||
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
|
||||||
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lt.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lt.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lt.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 applyWaterFog(vec4 color, vec3 viewVec)
|
vec4 applyWaterFog(vec4 color, vec3 viewVec)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,29 +62,7 @@ VARYING vec4 littleWave;
|
|||||||
VARYING vec4 view;
|
VARYING vec4 view;
|
||||||
VARYING vec4 vary_position;
|
VARYING vec4 vary_position;
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
vec2 encode_normal(vec3 n);
|
||||||
{
|
|
||||||
vec3 low_range = cs / vec3(12.92);
|
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,54 +67,26 @@ VARYING vec4 vary_fragcoord;
|
|||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
uniform vec2 noise_scale;
|
uniform vec2 noise_scale;
|
||||||
|
|
||||||
|
vec3 decode_normal(vec2 enc);
|
||||||
vec2 encode_normal(vec3 n)
|
vec4 getPosition(vec2 pos_screen);
|
||||||
{
|
vec3 srgb_to_linear(vec3 cs);
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
|
||||||
{
|
|
||||||
vec3 low_range = cs / vec3(12.92);
|
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||||
{
|
{
|
||||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||||
ret.rgb = srgb_to_linear(ret.rgb);
|
ret.rgb = srgb_to_linear(ret.rgb);
|
||||||
|
|
||||||
vec2 dist = tc-vec2(0.5);
|
|
||||||
|
|
||||||
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
|
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||||
|
|
||||||
float d = dot(dist,dist);
|
float det = min(lod/(proj_lod*0.5), 1.0);
|
||||||
|
|
||||||
ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
|
float d = min(dist.x, dist.y);
|
||||||
|
|
||||||
|
d *= min(1, d * (proj_lod - lod));
|
||||||
|
|
||||||
|
float edge = 0.25*det;
|
||||||
|
|
||||||
|
ret *= clamp(d/edge, 0.0, 1.0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -151,19 +123,6 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 frag = vary_fragcoord;
|
vec4 frag = vary_fragcoord;
|
||||||
|
|||||||
@@ -77,59 +77,9 @@ vec3 vary_AtmosAttenuation;
|
|||||||
|
|
||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
vec3 decode_normal(vec2 enc);
|
||||||
{
|
vec3 srgb_to_linear(vec3 cs);
|
||||||
vec3 low_range = cs / vec3(12.92);
|
vec3 linear_to_srgb(vec3 cl);
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 linear_to_srgb(vec3 cl)
|
|
||||||
{
|
|
||||||
cl = clamp(cl, vec3(0), vec3(1));
|
|
||||||
vec3 low_range = cl * 12.92;
|
|
||||||
vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055;
|
|
||||||
bvec3 lt = lessThan(cl,vec3(0.0031308));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lt.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lt.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lt.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||||
{
|
{
|
||||||
@@ -142,12 +92,6 @@ vec4 getPosition_d(vec2 pos_screen, float depth)
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{ //get position in screen space (world units) given window coordinate and depth map
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
return getPosition_d(pos_screen, depth);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 getPositionEye()
|
vec3 getPositionEye()
|
||||||
{
|
{
|
||||||
return vary_PositionEye;
|
return vary_PositionEye;
|
||||||
|
|||||||
@@ -67,58 +67,26 @@ VARYING vec4 vary_fragcoord;
|
|||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
uniform vec2 noise_scale;
|
uniform vec2 noise_scale;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec3 decode_normal(vec2 enc);
|
||||||
{
|
vec4 getPosition(vec2 pos_screen);
|
||||||
float f = sqrt(8 * n.z + 8);
|
vec4 srgb_to_linear(vec4 cs);
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
|
||||||
{
|
|
||||||
vec2 fenc = enc*4-2;
|
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 srgb_to_linear(vec3 cs)
|
|
||||||
{
|
|
||||||
vec3 low_range = cs / vec3(12.92);
|
|
||||||
vec3 high_range = pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4));
|
|
||||||
bvec3 lte = lessThanEqual(cs,vec3(0.04045));
|
|
||||||
|
|
||||||
#ifdef OLD_SELECT
|
|
||||||
vec3 result;
|
|
||||||
result.r = lte.r ? low_range.r : high_range.r;
|
|
||||||
result.g = lte.g ? low_range.g : high_range.g;
|
|
||||||
result.b = lte.b ? low_range.b : high_range.b;
|
|
||||||
return result;
|
|
||||||
#else
|
|
||||||
return mix(high_range, low_range, lte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 correctWithGamma(vec4 col)
|
|
||||||
{
|
|
||||||
return vec4(srgb_to_linear(col.rgb), col.a);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||||
{
|
{
|
||||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||||
ret = correctWithGamma(ret);
|
ret = srgb_to_linear(ret);
|
||||||
|
|
||||||
vec2 dist = tc-vec2(0.5);
|
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||||
|
|
||||||
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
|
float det = min(lod/(proj_lod*0.5), 1.0);
|
||||||
|
|
||||||
float d = dot(dist,dist);
|
float d = min(dist.x, dist.y);
|
||||||
|
|
||||||
ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0)+det, 1.0);
|
d *= min(1, d * (proj_lod - lod));
|
||||||
|
|
||||||
|
float edge = 0.25*det;
|
||||||
|
|
||||||
|
ret *= clamp(d/edge, 0.0, 1.0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -126,7 +94,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
|||||||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||||
{
|
{
|
||||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||||
ret = correctWithGamma(ret);
|
ret = srgb_to_linear(ret);
|
||||||
|
|
||||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||||
|
|
||||||
@@ -144,7 +112,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
|||||||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||||
{
|
{
|
||||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||||
ret = correctWithGamma(ret);
|
ret = srgb_to_linear(ret);
|
||||||
|
|
||||||
vec2 dist = tc-vec2(0.5);
|
vec2 dist = tc-vec2(0.5);
|
||||||
|
|
||||||
@@ -155,19 +123,6 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
|
||||||
{
|
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
|
||||||
vec4 pos = inv_proj * ndc;
|
|
||||||
pos /= pos.w;
|
|
||||||
pos.w = 1.0;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 frag = vary_fragcoord;
|
vec4 frag = vary_fragcoord;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ uniform float ssao_factor;
|
|||||||
uniform float ssao_factor_inv;
|
uniform float ssao_factor_inv;
|
||||||
|
|
||||||
VARYING vec2 vary_fragcoord;
|
VARYING vec2 vary_fragcoord;
|
||||||
|
uniform vec2 kern_scale;
|
||||||
|
|
||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
uniform vec2 proj_shadow_res;
|
uniform vec2 proj_shadow_res;
|
||||||
@@ -64,33 +65,24 @@ uniform float shadow_offset;
|
|||||||
uniform float spot_shadow_bias;
|
uniform float spot_shadow_bias;
|
||||||
uniform float spot_shadow_offset;
|
uniform float spot_shadow_offset;
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
vec3 decode_normal(vec2 enc);
|
||||||
{
|
vec4 getPosition(vec2 pos_screen);
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
float calcShadow( sampler2DShadow shadowMap, vec4 stc, vec2 res, vec2 pos_screen )
|
||||||
{
|
{
|
||||||
vec2 fenc = enc*4-2;
|
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
vec2 off = vec2(1,1.5)/res;
|
||||||
{
|
stc.x = floor(stc.x*res.x + fract(pos_screen.y*(1.0/kern_scale.y)*0.5))*off.x;
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
float shadow = shadow2D(shadowMap, stc.xyz).x; // cs
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0)).x;
|
||||||
vec4 pos = inv_proj * ndc;
|
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x;
|
||||||
pos /= pos.w;
|
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x*2.0, off.y, 0.0)).x;
|
||||||
pos.w = 1.0;
|
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x;
|
||||||
return pos;
|
|
||||||
|
return shadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
||||||
@@ -98,41 +90,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
|||||||
stc.xyz /= stc.w;
|
stc.xyz /= stc.w;
|
||||||
stc.z += shadow_bias;
|
stc.z += shadow_bias;
|
||||||
|
|
||||||
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
|
return calcShadow(shadowMap, stc, shadow_res, pos_screen)*0.2;
|
||||||
stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*0.666666666))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
|
|
||||||
|
|
||||||
float cs = shadow2D(shadowMap, stc.xyz).x;
|
|
||||||
|
|
||||||
float shadow = cs;
|
|
||||||
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
|
|
||||||
|
|
||||||
|
|
||||||
return shadow*0.2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
||||||
{
|
{
|
||||||
stc.xyz /= stc.w;
|
stc.xyz /= stc.w;
|
||||||
stc.z += spot_shadow_bias*scl;
|
stc.z += spot_shadow_bias*scl;
|
||||||
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/proj_shadow_res.x); //Random dither.
|
|
||||||
stc.x = floor(proj_shadow_res.x * stc.x + fract(pos_screen.y*0.666666666)) / proj_shadow_res.x; // snap
|
|
||||||
|
|
||||||
float cs = shadow2D(shadowMap, stc.xyz).x;
|
return calcShadow(shadowMap, stc, proj_shadow_res, pos_screen)*0.2;
|
||||||
float shadow = cs;
|
|
||||||
|
|
||||||
vec2 off = 1.0/proj_shadow_res;
|
|
||||||
off.y *= 1.5;
|
|
||||||
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x*2.0, -off.y, 0.0)).x;
|
|
||||||
|
|
||||||
return shadow*0.2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ uniform vec4 shadow_clip;
|
|||||||
|
|
||||||
VARYING vec2 vary_fragcoord;
|
VARYING vec2 vary_fragcoord;
|
||||||
|
|
||||||
|
uniform vec2 ssao_scale;
|
||||||
uniform vec2 kern_scale;
|
uniform vec2 kern_scale;
|
||||||
|
|
||||||
uniform mat4 inv_proj;
|
uniform mat4 inv_proj;
|
||||||
@@ -64,34 +65,25 @@ uniform float shadow_offset;
|
|||||||
uniform float spot_shadow_bias;
|
uniform float spot_shadow_bias;
|
||||||
uniform float spot_shadow_offset;
|
uniform float spot_shadow_offset;
|
||||||
|
|
||||||
|
vec3 decode_normal(vec2 enc);
|
||||||
|
vec4 getPosition(vec2 pos_screen);
|
||||||
|
|
||||||
vec2 encode_normal(vec3 n)
|
|
||||||
{
|
|
||||||
float f = sqrt(8 * n.z + 8);
|
|
||||||
return n.xy / f + 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 decode_normal (vec2 enc)
|
float calcShadow( sampler2DShadow shadowMap, vec4 stc, vec2 res, vec2 pos_screen )
|
||||||
{
|
{
|
||||||
vec2 fenc = enc*4-2;
|
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
|
||||||
float f = dot(fenc,fenc);
|
|
||||||
float g = sqrt(1-f/4);
|
|
||||||
vec3 n;
|
|
||||||
n.xy = fenc*g;
|
|
||||||
n.z = 1-f/2;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 getPosition(vec2 pos_screen)
|
vec2 off = vec2(1,1.5)/res;
|
||||||
{
|
stc.x = floor(stc.x*res.x + fract(pos_screen.y*(1.0/kern_scale.y)*0.5))*off.x;
|
||||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
|
||||||
vec2 sc = pos_screen.xy*2.0;
|
|
||||||
sc -= vec2(1.0,1.0);
|
float shadow = shadow2D(shadowMap, stc.xyz).x; // cs
|
||||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0)).x;
|
||||||
vec4 pos = inv_proj * ndc;
|
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x;
|
||||||
pos /= pos.w;
|
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x*2.0, off.y, 0.0)).x;
|
||||||
pos.w = 1.0;
|
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x;
|
||||||
return pos;
|
|
||||||
|
return shadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
||||||
@@ -99,42 +91,18 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
|||||||
stc.xyz /= stc.w;
|
stc.xyz /= stc.w;
|
||||||
stc.z += shadow_bias;
|
stc.z += shadow_bias;
|
||||||
|
|
||||||
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
|
return calcShadow(shadowMap, stc, shadow_res, pos_screen)*0.2;
|
||||||
stc.x = floor(stc.x*shadow_res.x + fract(pos_screen.y*0.666666666))/shadow_res.x;
|
|
||||||
|
|
||||||
float cs = shadow2D(shadowMap, stc.xyz).x;
|
|
||||||
|
|
||||||
float shadow = cs;
|
|
||||||
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
|
|
||||||
|
|
||||||
return shadow*0.2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
|
||||||
{
|
{
|
||||||
stc.xyz /= stc.w;
|
stc.xyz /= stc.w;
|
||||||
stc.z += spot_shadow_bias*scl;
|
stc.z += spot_shadow_bias*scl;
|
||||||
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/proj_shadow_res.x); //Random dither.
|
|
||||||
stc.x = floor(proj_shadow_res.x * stc.x + fract(pos_screen.y*0.666666666)) / proj_shadow_res.x; // snap
|
|
||||||
|
|
||||||
float cs = shadow2D(shadowMap, stc.xyz).x;
|
|
||||||
float shadow = cs;
|
|
||||||
|
|
||||||
vec2 off = 1.0/proj_shadow_res;
|
return calcShadow(shadowMap, stc, proj_shadow_res, pos_screen)*0.2;
|
||||||
off.y *= 1.5;
|
|
||||||
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x;
|
|
||||||
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x*2.0, -off.y, 0.0)).x;
|
|
||||||
|
|
||||||
return shadow*0.2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 pos_screen = vary_fragcoord.xy;
|
vec2 pos_screen = vary_fragcoord.xy;
|
||||||
@@ -244,7 +212,7 @@ void main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
frag_color[0] = shadow;
|
frag_color[0] = shadow;
|
||||||
frag_color[1] = texture2D(diffuseRect,vary_fragcoord.xy * kern_scale).r;
|
frag_color[1] = texture2D(diffuseRect,vary_fragcoord.xy * ssao_scale).r;
|
||||||
|
|
||||||
spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0);
|
spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0);
|
||||||
|
|
||||||
|
|||||||
@@ -554,20 +554,21 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
|
|||||||
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
|
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
|
||||||
LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
|
LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
|
||||||
|
|
||||||
emissive_shader->bind();
|
//emissive_shader->bind();
|
||||||
|
|
||||||
// glow doesn't use vertex colors from the mesh data
|
// glow doesn't use vertex colors from the mesh data
|
||||||
// Singu Note: Pull attribs from shader, since we always have one here.
|
// Singu Note: Pull attribs from shader, since we always have one here.
|
||||||
params.mVertexBuffer->setBuffer(emissive_shader->mAttributeMask);
|
// Singu Note: To avoid ridiculous shader bind cost, simply re-use prior shader, but let llvertexbuffer replace the color attrib ptr with the emissive one.
|
||||||
|
params.mVertexBuffer->setBuffer(current_shader->mAttributeMask | LLVertexBuffer::MAP_EMISSIVE);
|
||||||
|
|
||||||
// do the actual drawing, again
|
// do the actual drawing, again
|
||||||
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||||
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
|
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
|
||||||
|
|
||||||
|
//current_shader->bind();
|
||||||
|
|
||||||
// restore our alpha blend mode
|
// restore our alpha blend mode
|
||||||
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
|
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
|
||||||
|
|
||||||
current_shader->bind();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tex_setup)
|
if (tex_setup)
|
||||||
|
|||||||
@@ -1457,6 +1457,9 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int sMaxCacheHit;
|
||||||
|
extern int sCurCacheHit;
|
||||||
|
|
||||||
void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
|
void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
|
||||||
{
|
{
|
||||||
if ((avatar->isSelf() && !gAgent.needsRenderAvatar()) || !gMeshRepo.meshRezEnabled())
|
if ((avatar->isSelf() && !gAgent.needsRenderAvatar()) || !gMeshRepo.meshRezEnabled())
|
||||||
@@ -1516,44 +1519,57 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
|
|||||||
if (buff)
|
if (buff)
|
||||||
{
|
{
|
||||||
if (sShaderLevel > 0)
|
if (sShaderLevel > 0)
|
||||||
{ //upload matrix palette to shader
|
{
|
||||||
// upload matrix palette to shader
|
auto& mesh_cache = avatar->getRiggedMatrixCache();
|
||||||
LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT];
|
auto& mesh_id = skin->mMeshID;
|
||||||
U32 count = LLSkinningUtil::getMeshJointCount(skin);
|
auto rigged_matrix_data_iter = find_if(mesh_cache.begin(), mesh_cache.end(), [&mesh_id](decltype(mesh_cache[0]) & entry) { return entry.first == mesh_id; });
|
||||||
LLSkinningUtil::initSkinningMatrixPalette(mat, count, skin, avatar);
|
if (rigged_matrix_data_iter != avatar->getRiggedMatrixCache().cend())
|
||||||
|
|
||||||
stop_glerror();
|
|
||||||
|
|
||||||
F32 mp[LL_MAX_JOINTS_PER_MESH_OBJECT*12];
|
|
||||||
|
|
||||||
for (U32 i = 0; i < count; ++i)
|
|
||||||
{
|
{
|
||||||
F32* m = (F32*) mat[i].getF32ptr();
|
LLDrawPoolAvatar::sVertexProgram->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
|
||||||
|
rigged_matrix_data_iter->second.first,
|
||||||
|
FALSE,
|
||||||
|
(GLfloat*)rigged_matrix_data_iter->second.second.data());
|
||||||
|
LLDrawPoolAvatar::sVertexProgram->uniform1f(LLShaderMgr::AVATAR_MAX_WEIGHT, F32(rigged_matrix_data_iter->second.first - 1));
|
||||||
|
|
||||||
U32 idx = i*12;
|
stop_glerror();
|
||||||
|
|
||||||
mp[idx+0] = m[0];
|
|
||||||
mp[idx+1] = m[1];
|
|
||||||
mp[idx+2] = m[2];
|
|
||||||
mp[idx+3] = m[12];
|
|
||||||
|
|
||||||
mp[idx+4] = m[4];
|
|
||||||
mp[idx+5] = m[5];
|
|
||||||
mp[idx+6] = m[6];
|
|
||||||
mp[idx+7] = m[13];
|
|
||||||
|
|
||||||
mp[idx+8] = m[8];
|
|
||||||
mp[idx+9] = m[9];
|
|
||||||
mp[idx+10] = m[10];
|
|
||||||
mp[idx+11] = m[14];
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// upload matrix palette to shader
|
||||||
|
LLMatrix4a mat[LL_MAX_JOINTS_PER_MESH_OBJECT];
|
||||||
|
U32 count = LLSkinningUtil::getMeshJointCount(skin);
|
||||||
|
LLSkinningUtil::initSkinningMatrixPalette(mat, count, skin, avatar);
|
||||||
|
|
||||||
LLDrawPoolAvatar::sVertexProgram->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
|
std::array<F32, LL_MAX_JOINTS_PER_MESH_OBJECT * 12> mp;
|
||||||
count,
|
|
||||||
FALSE,
|
|
||||||
(GLfloat*) mp);
|
|
||||||
|
|
||||||
LLDrawPoolAvatar::sVertexProgram->uniform1f(LLShaderMgr::AVATAR_MAX_WEIGHT, F32(count-1));
|
for (U32 i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
F32* m = (F32*)mat[i].getF32ptr();
|
||||||
|
|
||||||
|
U32 idx = i * 12;
|
||||||
|
|
||||||
|
mp[idx + 0] = m[0];
|
||||||
|
mp[idx + 1] = m[1];
|
||||||
|
mp[idx + 2] = m[2];
|
||||||
|
mp[idx + 3] = m[12];
|
||||||
|
|
||||||
|
mp[idx + 4] = m[4];
|
||||||
|
mp[idx + 5] = m[5];
|
||||||
|
mp[idx + 6] = m[6];
|
||||||
|
mp[idx + 7] = m[13];
|
||||||
|
|
||||||
|
mp[idx + 8] = m[8];
|
||||||
|
mp[idx + 9] = m[9];
|
||||||
|
mp[idx + 10] = m[10];
|
||||||
|
mp[idx + 11] = m[14];
|
||||||
|
}
|
||||||
|
mesh_cache.emplace_back(std::make_pair( skin->mMeshID, std::make_pair(count, mp) ) );
|
||||||
|
LLDrawPoolAvatar::sVertexProgram->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX,
|
||||||
|
count,
|
||||||
|
FALSE,
|
||||||
|
(GLfloat*)mp.data());
|
||||||
|
LLDrawPoolAvatar::sVertexProgram->uniform1f(LLShaderMgr::AVATAR_MAX_WEIGHT, F32(count - 1));
|
||||||
|
}
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
|
|||||||
|
|
||||||
gGL.diffuseColor4fv(color.mV);
|
gGL.diffuseColor4fv(color.mV);
|
||||||
|
|
||||||
LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mPositions, vol_face.mTexCoords, vol_face.mNumIndices, vol_face.mIndices);
|
LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mNumVertices, vol_face.mPositions, vol_face.mTexCoords, vol_face.mNumIndices, vol_face.mIndices);
|
||||||
|
|
||||||
if(prev_shader)
|
if(prev_shader)
|
||||||
{
|
{
|
||||||
@@ -1439,152 +1439,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static LLCachedControl<bool> use_transform_feedback("RenderUseTransformFeedback", false);
|
static LLCachedControl<bool> use_transform_feedback("RenderUseTransformFeedback", false);
|
||||||
|
|
||||||
#ifdef GL_TRANSFORM_FEEDBACK_BUFFER
|
|
||||||
if (use_transform_feedback &&
|
|
||||||
gTransformPositionProgram.mProgramObject && //transform shaders are loaded
|
|
||||||
mVertexBuffer->useVBOs() && //target buffer is in VRAM
|
|
||||||
!rebuild_weights && //TODO: add support for weights
|
|
||||||
!volume.isUnique()) //source volume is NOT flexi
|
|
||||||
{ //use transform feedback to pack vertex buffer
|
|
||||||
LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK);
|
|
||||||
LLGLEnable discard(GL_RASTERIZER_DISCARD);
|
|
||||||
LLVertexBuffer* buff = (LLVertexBuffer*) vf.mVertexBuffer.get();
|
|
||||||
|
|
||||||
if (vf.mVertexBuffer.isNull() || buff->getNumVerts() != vf.mNumVertices)
|
|
||||||
{
|
|
||||||
mVObjp->getVolume()->genTangents(f);
|
|
||||||
LLFace::cacheFaceInVRAM(vf);
|
|
||||||
buff = (LLVertexBuffer*) vf.mVertexBuffer.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
LLGLSLShader* cur_shader = LLGLSLShader::sCurBoundShaderPtr;
|
|
||||||
|
|
||||||
gGL.pushMatrix();
|
|
||||||
gGL.loadMatrix(mat_vert_in);
|
|
||||||
|
|
||||||
if (rebuild_pos)
|
|
||||||
{
|
|
||||||
LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_POSITION);
|
|
||||||
gTransformPositionProgram.bind();
|
|
||||||
|
|
||||||
mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_VERTEX, mGeomIndex, mGeomCount);
|
|
||||||
|
|
||||||
U8 index = mTextureIndex < 255 ? mTextureIndex : 0;
|
|
||||||
|
|
||||||
S32 val = 0;
|
|
||||||
U8* vp = (U8*) &val;
|
|
||||||
vp[0] = index;
|
|
||||||
vp[1] = 0;
|
|
||||||
vp[2] = 0;
|
|
||||||
vp[3] = 0;
|
|
||||||
|
|
||||||
gTransformPositionProgram.uniform1i(sTextureIndexIn, val);
|
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
|
||||||
|
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
|
||||||
|
|
||||||
glEndTransformFeedback();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rebuild_color)
|
|
||||||
{
|
|
||||||
LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_COLOR);
|
|
||||||
gTransformColorProgram.bind();
|
|
||||||
|
|
||||||
mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_COLOR, mGeomIndex, mGeomCount);
|
|
||||||
|
|
||||||
S32 val = *((S32*) color.mV);
|
|
||||||
|
|
||||||
gTransformColorProgram.uniform1i(sColorIn, val);
|
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
|
||||||
glEndTransformFeedback();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rebuild_emissive)
|
|
||||||
{
|
|
||||||
LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_EMISSIVE);
|
|
||||||
gTransformColorProgram.bind();
|
|
||||||
|
|
||||||
mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_EMISSIVE, mGeomIndex, mGeomCount);
|
|
||||||
|
|
||||||
U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255);
|
|
||||||
|
|
||||||
S32 glow32 = glow |
|
|
||||||
(glow << 8) |
|
|
||||||
(glow << 16) |
|
|
||||||
(glow << 24);
|
|
||||||
|
|
||||||
gTransformColorProgram.uniform1i(sColorIn, glow32);
|
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
|
||||||
glEndTransformFeedback();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rebuild_normal)
|
|
||||||
{
|
|
||||||
LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_NORMAL);
|
|
||||||
gTransformNormalProgram.bind();
|
|
||||||
|
|
||||||
mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_NORMAL, mGeomIndex, mGeomCount);
|
|
||||||
|
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_NORMAL);
|
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
|
||||||
glEndTransformFeedback();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rebuild_tangent)
|
|
||||||
{
|
|
||||||
LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_TANGENT);
|
|
||||||
gTransformTangentProgram.bind();
|
|
||||||
|
|
||||||
mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TANGENT, mGeomIndex, mGeomCount);
|
|
||||||
|
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_TANGENT);
|
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
|
||||||
glEndTransformFeedback();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rebuild_tcoord)
|
|
||||||
{
|
|
||||||
LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_TEXTURE);
|
|
||||||
gTransformTexCoordProgram.bind();
|
|
||||||
|
|
||||||
mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD0, mGeomIndex, mGeomCount);
|
|
||||||
|
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_TEXCOORD0);
|
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
|
||||||
glEndTransformFeedback();
|
|
||||||
|
|
||||||
bool do_bump = bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1);
|
|
||||||
|
|
||||||
if (do_bump)
|
|
||||||
{
|
|
||||||
mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD1, mGeomIndex, mGeomCount);
|
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_TEXCOORD0);
|
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
|
||||||
glEndTransformFeedback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindBufferARB(GL_TRANSFORM_FEEDBACK_BUFFER, 0);
|
|
||||||
gGL.popMatrix();
|
|
||||||
|
|
||||||
if (cur_shader)
|
|
||||||
{
|
|
||||||
cur_shader->bind();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
//if it's not fullbright and has no normals, bake sunlight based on face normal
|
//if it's not fullbright and has no normals, bake sunlight based on face normal
|
||||||
//bool bake_sunlight = !getTextureEntry()->getFullbright() &&
|
//bool bake_sunlight = !getTextureEntry()->getFullbright() &&
|
||||||
|
|||||||
@@ -132,8 +132,6 @@ LLNetMap::LLNetMap(const std::string& name) :
|
|||||||
mClosestAgentToCursor(),
|
mClosestAgentToCursor(),
|
||||||
mPopupMenu(NULL)
|
mPopupMenu(NULL)
|
||||||
{
|
{
|
||||||
mPixelsPerMeter = mScale / REGION_WIDTH_METERS;
|
|
||||||
mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
|
|
||||||
setScale(gSavedSettings.getF32("MiniMapScale"));
|
setScale(gSavedSettings.getF32("MiniMapScale"));
|
||||||
|
|
||||||
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml");
|
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml");
|
||||||
@@ -763,9 +761,6 @@ LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos)
|
|||||||
LLVector3 pos_local;
|
LLVector3 pos_local;
|
||||||
pos_local.setVec(relative_pos_global); // convert to floats from doubles
|
pos_local.setVec(relative_pos_global); // convert to floats from doubles
|
||||||
|
|
||||||
// <FS:CR> Aurora Sim
|
|
||||||
mPixelsPerMeter = mScale / REGION_WIDTH_METERS;
|
|
||||||
// </FS:CR> Aurora Sim
|
|
||||||
pos_local.mV[VX] *= mPixelsPerMeter;
|
pos_local.mV[VX] *= mPixelsPerMeter;
|
||||||
pos_local.mV[VY] *= mPixelsPerMeter;
|
pos_local.mV[VY] *= mPixelsPerMeter;
|
||||||
// leave Z component in meters
|
// leave Z component in meters
|
||||||
@@ -786,17 +781,12 @@ LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos)
|
|||||||
|
|
||||||
void LLNetMap::drawRing(const F32 radius, const LLVector3 pos_map, const LLColor4& color)
|
void LLNetMap::drawRing(const F32 radius, const LLVector3 pos_map, const LLColor4& color)
|
||||||
{
|
{
|
||||||
// <FS:CR> Aurora Sim
|
F32 radius_pixels = radius * mPixelsPerMeter;
|
||||||
F32 meters_to_pixels = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
|
|
||||||
//F32 meters_to_pixels = mScale / REGION_WIDTH_METERS;
|
|
||||||
// </FS:CR> Aurora Sim
|
|
||||||
F32 radius_pixels = radius * meters_to_pixels;
|
|
||||||
|
|
||||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
gGL.pushUIMatrix();
|
||||||
gGL.pushMatrix();
|
gGL.translateUI(pos_map.mV[VX], pos_map.mV[VY], 0.f);
|
||||||
gGL.translatef((F32)pos_map.mV[VX], (F32)pos_map.mV[VY], 0.f);
|
gl_washer_2d(radius_pixels, radius_pixels-WIDTH_PIXELS, CIRCLE_STEPS, color, color);
|
||||||
gl_ring(radius_pixels, WIDTH_PIXELS, color, color, CIRCLE_STEPS, FALSE);
|
gGL.popUIMatrix();
|
||||||
gGL.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
|
void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include "llfloaterchat.h" // for add_chat_history()
|
#include "llfloaterchat.h" // for add_chat_history()
|
||||||
#include "lloverlaybar.h" // for gOverlayBar
|
#include "lloverlaybar.h" // for gOverlayBar
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
|
#include "llcheckboxctrl.h"
|
||||||
|
|
||||||
#include "hippogridmanager.h"
|
#include "hippogridmanager.h"
|
||||||
|
|
||||||
@@ -183,6 +184,8 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
|
|||||||
bool layout_script_dialog(notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup");
|
bool layout_script_dialog(notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup");
|
||||||
LLRect rect = mIsTip ? getNotifyTipRect(message)
|
LLRect rect = mIsTip ? getNotifyTipRect(message)
|
||||||
: getNotifyRect(is_textbox ? 10 : mNumOptions, layout_script_dialog, mIsCaution);
|
: getNotifyRect(is_textbox ? 10 : mNumOptions, layout_script_dialog, mIsCaution);
|
||||||
|
if ((form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE || form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE))
|
||||||
|
rect.mBottom -= BTN_HEIGHT;
|
||||||
setRect(rect);
|
setRect(rect);
|
||||||
setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT));
|
setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT));
|
||||||
setBackgroundVisible(FALSE);
|
setBackgroundVisible(FALSE);
|
||||||
@@ -359,6 +362,45 @@ LLNotifyBox::LLNotifyBox(LLNotificationPtr notification)
|
|||||||
addButton("OK", "OK", false, true, layout_script_dialog);
|
addButton("OK", "OK", false, true, layout_script_dialog);
|
||||||
mAddedDefaultBtn = true;
|
mAddedDefaultBtn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string check_title;
|
||||||
|
if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE)
|
||||||
|
{
|
||||||
|
check_title = LLNotificationTemplates::instance().getGlobalString("skipnexttime");
|
||||||
|
}
|
||||||
|
else if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
|
||||||
|
{
|
||||||
|
check_title = LLNotificationTemplates::instance().getGlobalString("alwayschoose");
|
||||||
|
}
|
||||||
|
if (!check_title.empty())
|
||||||
|
{
|
||||||
|
const LLFontGL* font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF);
|
||||||
|
S32 line_height = llfloor(font->getLineHeight() + 0.99f);
|
||||||
|
|
||||||
|
// Extend dialog for "check next time"
|
||||||
|
S32 max_msg_width = getRect().getWidth() - HPAD * 9;
|
||||||
|
S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16;
|
||||||
|
max_msg_width = llmax(max_msg_width, check_width);
|
||||||
|
|
||||||
|
S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;
|
||||||
|
|
||||||
|
LLRect check_rect;
|
||||||
|
check_rect.setOriginAndSize(msg_x, BOTTOM_PAD + BTN_HEIGHT + VPAD*2 + (BTN_HEIGHT + VPAD) * (mNumButtons / 3),
|
||||||
|
max_msg_width, line_height);
|
||||||
|
|
||||||
|
LLCheckboxCtrl* check = new LLCheckboxCtrl(std::string("check"), check_rect, check_title, font,
|
||||||
|
// Lambda abuse.
|
||||||
|
[this](LLUICtrl* ctrl, const LLSD& param)
|
||||||
|
{
|
||||||
|
this->mNotification->setIgnored(ctrl->getValue());
|
||||||
|
});
|
||||||
|
check->setEnabledColor(LLUI::sColorsGroup->getColor(mIsCaution ? "AlertCautionTextColor" : "AlertTextColor"));
|
||||||
|
if (mIsCaution)
|
||||||
|
{
|
||||||
|
check->setButtonColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor"));
|
||||||
|
}
|
||||||
|
addChild(check);
|
||||||
|
}
|
||||||
|
|
||||||
if (++sNotifyBoxCount <= 0)
|
if (++sNotifyBoxCount <= 0)
|
||||||
LL_WARNS() << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << LL_ENDL;
|
LL_WARNS() << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << LL_ENDL;
|
||||||
|
|||||||
@@ -58,10 +58,13 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source,
|
|||||||
mSpeakerClearListener = new SpeakerClearListener(*this);
|
mSpeakerClearListener = new SpeakerClearListener(*this);
|
||||||
//mSpeakerModeratorListener = new SpeakerModeratorUpdateListener(*this);
|
//mSpeakerModeratorListener = new SpeakerModeratorUpdateListener(*this);
|
||||||
mSpeakerMuteListener = new SpeakerMuteListener(*this);
|
mSpeakerMuteListener = new SpeakerMuteListener(*this);
|
||||||
|
mSpeakerBatchBeginListener = new SpeakerBatchBeginListener(*this);
|
||||||
|
mSpeakerBatchEndListener = new SpeakerBatchEndListener(*this);
|
||||||
mSpeakerMgr->addListener(mSpeakerAddListener, "add");
|
mSpeakerMgr->addListener(mSpeakerAddListener, "add");
|
||||||
mSpeakerMgr->addListener(mSpeakerRemoveListener, "remove");
|
mSpeakerMgr->addListener(mSpeakerRemoveListener, "remove");
|
||||||
mSpeakerMgr->addListener(mSpeakerClearListener, "clear");
|
mSpeakerMgr->addListener(mSpeakerClearListener, "clear");
|
||||||
|
mSpeakerMgr->addListener(mSpeakerBatchBeginListener, "batch_begin");
|
||||||
|
mSpeakerMgr->addListener(mSpeakerBatchEndListener, "batch_end");
|
||||||
//mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator");
|
//mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,6 +381,16 @@ bool LLParticipantList::onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLParticipantList::onSpeakerBatchBeginEvent()
|
||||||
|
{
|
||||||
|
mAvatarList->setSortEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLParticipantList::onSpeakerBatchEndEvent()
|
||||||
|
{
|
||||||
|
mAvatarList->setSortEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
|
void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
|
||||||
{
|
{
|
||||||
//if (mExcludeAgent && gAgent.getID() == avatar_id) return;
|
//if (mExcludeAgent && gAgent.getID() == avatar_id) return;
|
||||||
@@ -468,6 +481,17 @@ bool LLParticipantList::SpeakerMuteListener::handleEvent(LLPointer<LLOldEvents::
|
|||||||
return mParent.onSpeakerMuteEvent(event, userdata);
|
return mParent.onSpeakerMuteEvent(event, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LLParticipantList::SpeakerBatchBeginListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
|
||||||
|
{
|
||||||
|
mParent.onSpeakerBatchBeginEvent();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool LLParticipantList::SpeakerBatchEndListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
|
||||||
|
{
|
||||||
|
mParent.onSpeakerBatchEndEvent();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Singu Note: The following functions are actually of the LLParticipantListMenu class, but we haven't married lists with menus yet.
|
// Singu Note: The following functions are actually of the LLParticipantListMenu class, but we haven't married lists with menus yet.
|
||||||
void LLParticipantList::toggleAllowTextChat(const LLSD& userdata)
|
void LLParticipantList::toggleAllowTextChat(const LLSD& userdata)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ protected:
|
|||||||
bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||||
//bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
//bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||||
bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||||
|
void onSpeakerBatchBeginEvent();
|
||||||
|
void onSpeakerBatchEndEvent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of listeners implementing LLOldEvents::LLSimpleListener.
|
* List of listeners implementing LLOldEvents::LLSimpleListener.
|
||||||
@@ -126,6 +128,20 @@ protected:
|
|||||||
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SpeakerBatchBeginListener : public BaseSpeakerListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SpeakerBatchBeginListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
|
||||||
|
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||||
|
};
|
||||||
|
|
||||||
|
class SpeakerBatchEndListener : public BaseSpeakerListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SpeakerBatchEndListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
|
||||||
|
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu used in the participant list.
|
* Menu used in the participant list.
|
||||||
class LLParticipantListMenu : public LLListContextMenu
|
class LLParticipantListMenu : public LLListContextMenu
|
||||||
@@ -202,6 +218,8 @@ private:
|
|||||||
LLPointer<SpeakerClearListener> mSpeakerClearListener;
|
LLPointer<SpeakerClearListener> mSpeakerClearListener;
|
||||||
//LLPointer<SpeakerModeratorUpdateListener> mSpeakerModeratorListener;
|
//LLPointer<SpeakerModeratorUpdateListener> mSpeakerModeratorListener;
|
||||||
LLPointer<SpeakerMuteListener> mSpeakerMuteListener;
|
LLPointer<SpeakerMuteListener> mSpeakerMuteListener;
|
||||||
|
LLPointer<SpeakerBatchBeginListener> mSpeakerBatchBeginListener;
|
||||||
|
LLPointer<SpeakerBatchEndListener> mSpeakerBatchEndListener;
|
||||||
|
|
||||||
validate_speaker_callback_t mValidateSpeakerCallback;
|
validate_speaker_callback_t mValidateSpeakerCallback;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6140,7 +6140,7 @@ void pushWireframe(LLDrawable* drawable)
|
|||||||
for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
|
for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
|
||||||
{
|
{
|
||||||
const LLVolumeFace& face = volume->getVolumeFace(i);
|
const LLVolumeFace& face = volume->getVolumeFace(i);
|
||||||
LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices);
|
LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mNumVertices, face.mPositions, NULL, face.mNumIndices, face.mIndices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1456,7 +1456,7 @@ void pushVerts(LLVolume* volume)
|
|||||||
for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
|
for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
|
||||||
{
|
{
|
||||||
const LLVolumeFace& face = volume->getVolumeFace(i);
|
const LLVolumeFace& face = volume->getVolumeFace(i);
|
||||||
LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices);
|
LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mNumVertices, face.mPositions, NULL, face.mNumIndices, face.mIndices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2325,11 +2325,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
|
|||||||
|
|
||||||
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
|
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
|
||||||
|
|
||||||
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
|
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
|
||||||
|
|
||||||
gGL.diffuseColor4fv(color.mV);
|
gGL.diffuseColor4fv(color.mV);
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
|
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2406,11 +2406,11 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
|
|||||||
{
|
{
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
gGL.diffuseColor4fv(line_color.mV);
|
gGL.diffuseColor4fv(line_color.mV);
|
||||||
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
|
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
|
||||||
|
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
gGL.diffuseColor4fv(color.mV);
|
gGL.diffuseColor4fv(color.mV);
|
||||||
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
|
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2824,7 +2824,7 @@ void renderRaycast(LLDrawable* drawablep)
|
|||||||
{
|
{
|
||||||
//render face positions
|
//render face positions
|
||||||
gGL.diffuseColor4f(0,1,1,0.5f);
|
gGL.diffuseColor4f(0,1,1,0.5f);
|
||||||
LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices);
|
LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mNumVertices, face.mPositions, NULL, face.mNumIndices, face.mIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!volume->isUnique())
|
if (!volume->isUnique())
|
||||||
|
|||||||
@@ -338,7 +338,20 @@ LLSpeakerMgr::~LLSpeakerMgr()
|
|||||||
delete mSpeakerDelayRemover;
|
delete mSpeakerDelayRemover;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::string& name, LLSpeaker::ESpeakerStatus status, LLSpeaker::ESpeakerType type)
|
void LLSpeakerMgr::setSpeakers(const std::vector<LLSpeakerMgr::speaker_entry_t>& speakers)
|
||||||
|
{
|
||||||
|
if (!speakers.empty())
|
||||||
|
{
|
||||||
|
fireEvent(new LLOldEvents::LLEvent(this), "batch_begin");
|
||||||
|
for (auto entry : speakers)
|
||||||
|
{
|
||||||
|
setSpeaker(entry.id, entry.name, entry.status, entry.type, entry.moderator, entry.moderator_muted_text);
|
||||||
|
}
|
||||||
|
fireEvent(new LLOldEvents::LLEvent(this), "batch_end");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::string& name, LLSpeaker::ESpeakerStatus status, LLSpeaker::ESpeakerType type, bool moderator, bool moderator_muted_text)
|
||||||
{
|
{
|
||||||
LLUUID session_id = getSessionID();
|
LLUUID session_id = getSessionID();
|
||||||
if (id.isNull() || (id == session_id))
|
if (id.isNull() || (id == session_id))
|
||||||
@@ -347,34 +360,37 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLPointer<LLSpeaker> speakerp;
|
LLPointer<LLSpeaker> speakerp;
|
||||||
if (mSpeakers.find(id) == mSpeakers.end())
|
auto it = mSpeakers.find(id);
|
||||||
|
if (it == mSpeakers.end() || it->second.isNull())
|
||||||
{
|
{
|
||||||
speakerp = new LLSpeaker(id, name, type);
|
speakerp = new LLSpeaker(id, name, type);
|
||||||
speakerp->mStatus = status;
|
speakerp->mStatus = status;
|
||||||
|
speakerp->mIsModerator = moderator;
|
||||||
|
speakerp->mModeratorMutedText = moderator_muted_text;
|
||||||
mSpeakers.insert(std::make_pair(speakerp->mID, speakerp));
|
mSpeakers.insert(std::make_pair(speakerp->mID, speakerp));
|
||||||
mSpeakersSorted.push_back(speakerp);
|
mSpeakersSorted.push_back(speakerp);
|
||||||
LL_DEBUGS("Speakers") << "Added speaker " << id << LL_ENDL;
|
|
||||||
fireEvent(new LLSpeakerListChangeEvent(this, speakerp->mID), "add");
|
fireEvent(new LLSpeakerListChangeEvent(this, speakerp->mID), "add");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
speakerp = findSpeaker(id);
|
speakerp = it->second;
|
||||||
if (speakerp.notNull())
|
bool update_moderator = (bool)speakerp->mIsModerator != moderator;
|
||||||
|
|
||||||
|
// keep highest priority status (lowest value) instead of overriding current value
|
||||||
|
speakerp->mStatus = llmin(speakerp->mStatus, status);
|
||||||
|
speakerp->mIsModerator = moderator;
|
||||||
|
speakerp->mModeratorMutedText = moderator_muted_text;
|
||||||
|
// RN: due to a weird behavior where IMs from attached objects come from the wearer's agent_id
|
||||||
|
// we need to override speakers that we think are objects when we find out they are really
|
||||||
|
// residents
|
||||||
|
if (type == LLSpeaker::SPEAKER_AGENT)
|
||||||
{
|
{
|
||||||
// keep highest priority status (lowest value) instead of overriding current value
|
speakerp->mType = LLSpeaker::SPEAKER_AGENT;
|
||||||
speakerp->mStatus = llmin(speakerp->mStatus, status);
|
speakerp->lookupName();
|
||||||
// RN: due to a weird behavior where IMs from attached objects come from the wearer's agent_id
|
|
||||||
// we need to override speakers that we think are objects when we find out they are really
|
|
||||||
// residents
|
|
||||||
if (type == LLSpeaker::SPEAKER_AGENT)
|
|
||||||
{
|
|
||||||
speakerp->mType = LLSpeaker::SPEAKER_AGENT;
|
|
||||||
speakerp->lookupName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
if (update_moderator)
|
||||||
{
|
{
|
||||||
LL_WARNS("Speakers") << "Speaker " << id << " not found" << LL_ENDL;
|
fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,13 +550,17 @@ void LLSpeakerMgr::updateSpeakerList()
|
|||||||
std::set<LLUUID> participants;
|
std::set<LLUUID> participants;
|
||||||
LLVoiceClient::getInstance()->getParticipantList(participants);
|
LLVoiceClient::getInstance()->getParticipantList(participants);
|
||||||
// If we are, add all voice client participants to our list of known speakers
|
// If we are, add all voice client participants to our list of known speakers
|
||||||
|
std::vector<speaker_entry_t> speakers;
|
||||||
|
speakers.reserve(participants.size());
|
||||||
for (std::set<LLUUID>::iterator participant_it = participants.begin(); participant_it != participants.end(); ++participant_it)
|
for (std::set<LLUUID>::iterator participant_it = participants.begin(); participant_it != participants.end(); ++participant_it)
|
||||||
{
|
{
|
||||||
setSpeaker(*participant_it,
|
speakers.emplace_back(speaker_entry_t(
|
||||||
LLVoiceClient::getInstance()->getDisplayName(*participant_it),
|
*participant_it,
|
||||||
LLSpeaker::STATUS_VOICE_ACTIVE,
|
LLSpeaker::STATUS_VOICE_ACTIVE,
|
||||||
(LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
|
LLVoiceClient::getInstance()->getDisplayName(*participant_it),
|
||||||
|
(LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL)));
|
||||||
}
|
}
|
||||||
|
setSpeakers(speakers);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -569,10 +589,11 @@ void LLSpeakerMgr::updateSpeakerList()
|
|||||||
}
|
}
|
||||||
else if (gdatap && gdatap->isMemberDataComplete() && !gdatap->mMembers.empty())
|
else if (gdatap && gdatap->isMemberDataComplete() && !gdatap->mMembers.empty())
|
||||||
{
|
{
|
||||||
|
std::vector<speaker_entry_t> speakers;
|
||||||
|
speakers.reserve(gdatap->mMembers.size());
|
||||||
|
|
||||||
// Add group members when we get the complete list (note: can take a while before we get that list)
|
// Add group members when we get the complete list (note: can take a while before we get that list)
|
||||||
LLGroupMgrGroupData::member_list_t::iterator member_it = gdatap->mMembers.begin();
|
LLGroupMgrGroupData::member_list_t::iterator member_it = gdatap->mMembers.begin();
|
||||||
const S32 load_group_max_members = gSavedSettings.getS32("ChatLoadGroupMaxMembers");
|
|
||||||
S32 updated = 0;
|
|
||||||
while (member_it != gdatap->mMembers.end())
|
while (member_it != gdatap->mMembers.end())
|
||||||
{
|
{
|
||||||
LLGroupMemberData* member = member_it->second;
|
LLGroupMemberData* member = member_it->second;
|
||||||
@@ -581,16 +602,16 @@ void LLSpeakerMgr::updateSpeakerList()
|
|||||||
const std::string& localized_online();
|
const std::string& localized_online();
|
||||||
if ((member->getOnlineStatus() == localized_online()) && (mSpeakers.find(id) == mSpeakers.end()))
|
if ((member->getOnlineStatus() == localized_online()) && (mSpeakers.find(id) == mSpeakers.end()))
|
||||||
{
|
{
|
||||||
LLPointer<LLSpeaker> speakerp = setSpeaker(id, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
|
speakers.emplace_back(speaker_entry_t(
|
||||||
speakerp->mIsModerator = ((member->getAgentPowers() & GP_SESSION_MODERATOR) == GP_SESSION_MODERATOR);
|
id,
|
||||||
updated++;
|
LLSpeaker::STATUS_VOICE_ACTIVE,
|
||||||
|
"",
|
||||||
|
LLSpeaker::SPEAKER_AGENT,
|
||||||
|
(member->getAgentPowers() & GP_SESSION_MODERATOR) == GP_SESSION_MODERATOR));
|
||||||
}
|
}
|
||||||
++member_it;
|
++member_it;
|
||||||
// Limit the number of "manually updated" participants to a reasonable number to avoid severe fps drop
|
|
||||||
// *TODO : solve the perf issue of having several hundreds of widgets in the conversation list
|
|
||||||
if (updated >= load_group_max_members)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
setSpeakers(speakers);
|
||||||
mSpeakerListUpdated = true;
|
mSpeakerListUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -617,7 +638,7 @@ void LLSpeakerMgr::updateSpeakerList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Always add the current agent (it has to be there...). Will do nothing if already there.
|
// Always add the current agent (it has to be there...). Will do nothing if already there.
|
||||||
setSpeaker(gAgentID, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
|
setSpeaker(gAgentID, "", LLSpeaker::STATUS_VOICE_ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLSpeakerMgr::setSpeakerNotInChannel(LLSpeaker* speakerp)
|
void LLSpeakerMgr::setSpeakerNotInChannel(LLSpeaker* speakerp)
|
||||||
@@ -737,6 +758,7 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
|
|||||||
{
|
{
|
||||||
if ( !speakers.isMap() ) return;
|
if ( !speakers.isMap() ) return;
|
||||||
|
|
||||||
|
std::vector<speaker_entry_t> speakerentries;
|
||||||
if ( speakers.has("agent_info") && speakers["agent_info"].isMap() )
|
if ( speakers.has("agent_info") && speakers["agent_info"].isMap() )
|
||||||
{
|
{
|
||||||
LLSD::map_const_iterator speaker_it;
|
LLSD::map_const_iterator speaker_it;
|
||||||
@@ -744,26 +766,21 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
|
|||||||
speaker_it != speakers["agent_info"].endMap();
|
speaker_it != speakers["agent_info"].endMap();
|
||||||
++speaker_it)
|
++speaker_it)
|
||||||
{
|
{
|
||||||
LLUUID agent_id(speaker_it->first);
|
bool moderator = false;
|
||||||
|
bool moderator_muted = false;
|
||||||
LLPointer<LLSpeaker> speakerp = setSpeaker(
|
if (speaker_it->second.isMap())
|
||||||
agent_id,
|
|
||||||
LLStringUtil::null,
|
|
||||||
LLSpeaker::STATUS_TEXT_ONLY);
|
|
||||||
|
|
||||||
if ( speaker_it->second.isMap() )
|
|
||||||
{
|
{
|
||||||
BOOL is_moderator = speakerp->mIsModerator;
|
moderator = speaker_it->second["is_moderator"];
|
||||||
speakerp->mIsModerator = speaker_it->second["is_moderator"];
|
moderator_muted = speaker_it->second["mutes"]["text"];
|
||||||
speakerp->mModeratorMutedText =
|
|
||||||
speaker_it->second["mutes"]["text"];
|
|
||||||
// Fire event only if moderator changed
|
|
||||||
if ( is_moderator != speakerp->mIsModerator )
|
|
||||||
{
|
|
||||||
LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << LL_ENDL;
|
|
||||||
fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
speakerentries.emplace_back(
|
||||||
|
LLUUID(speaker_it->first),
|
||||||
|
LLSpeaker::STATUS_TEXT_ONLY,
|
||||||
|
"",
|
||||||
|
LLSpeaker::SPEAKER_AGENT,
|
||||||
|
moderator,
|
||||||
|
moderator_muted
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( speakers.has("agents" ) && speakers["agents"].isArray() )
|
else if ( speakers.has("agents" ) && speakers["agents"].isArray() )
|
||||||
@@ -775,22 +792,20 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
|
|||||||
speaker_it != speakers["agents"].endArray();
|
speaker_it != speakers["agents"].endArray();
|
||||||
++speaker_it)
|
++speaker_it)
|
||||||
{
|
{
|
||||||
const LLUUID agent_id = (*speaker_it).asUUID();
|
speakerentries.emplace_back((*speaker_it).asUUID());
|
||||||
|
|
||||||
LLPointer<LLSpeaker> speakerp = setSpeaker(
|
|
||||||
agent_id,
|
|
||||||
LLStringUtil::null,
|
|
||||||
LLSpeaker::STATUS_TEXT_ONLY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LLSpeakerMgr::setSpeakers(speakerentries);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
||||||
{
|
{
|
||||||
if ( !update.isMap() ) return;
|
if ( !update.isMap() ) return;
|
||||||
|
|
||||||
|
std::vector<speaker_entry_t> speakerentries;
|
||||||
if ( update.has("agent_updates") && update["agent_updates"].isMap() )
|
if ( update.has("agent_updates") && update["agent_updates"].isMap() )
|
||||||
{
|
{
|
||||||
|
|
||||||
LLSD::map_const_iterator update_it;
|
LLSD::map_const_iterator update_it;
|
||||||
for(
|
for(
|
||||||
update_it = update["agent_updates"].beginMap();
|
update_it = update["agent_updates"].beginMap();
|
||||||
@@ -800,8 +815,11 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
|||||||
LLUUID agent_id(update_it->first);
|
LLUUID agent_id(update_it->first);
|
||||||
LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id);
|
LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id);
|
||||||
|
|
||||||
LLSD agent_data = update_it->second;
|
bool new_speaker = false;
|
||||||
|
bool moderator = false;
|
||||||
|
bool moderator_muted = false;
|
||||||
|
|
||||||
|
LLSD agent_data = update_it->second;
|
||||||
if (agent_data.isMap() && agent_data.has("transition"))
|
if (agent_data.isMap() && agent_data.has("transition"))
|
||||||
{
|
{
|
||||||
if (agent_data["transition"].asString() == "LEAVE" && speakerp.notNull())
|
if (agent_data["transition"].asString() == "LEAVE" && speakerp.notNull())
|
||||||
@@ -811,15 +829,17 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
|||||||
else if (agent_data["transition"].asString() == "ENTER")
|
else if (agent_data["transition"].asString() == "ENTER")
|
||||||
{
|
{
|
||||||
// add or update speaker
|
// add or update speaker
|
||||||
speakerp = setSpeaker(agent_id);
|
new_speaker = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LL_WARNS() << "bad membership list update from 'agent_updates' for agent " << agent_id << ", transition " << ll_print_sd(agent_data["transition"]) << LL_ENDL;
|
LL_WARNS() << "bad membership list update from 'agent_updates' for agent " << agent_id << ", transition " << ll_print_sd(agent_data["transition"]) << LL_ENDL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (speakerp.isNull() && !new_speaker)
|
||||||
if (speakerp.isNull()) continue;
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// should have a valid speaker from this point on
|
// should have a valid speaker from this point on
|
||||||
if (agent_data.isMap() && agent_data.has("info"))
|
if (agent_data.isMap() && agent_data.has("info"))
|
||||||
@@ -828,21 +848,21 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
|||||||
|
|
||||||
if (agent_info.has("is_moderator"))
|
if (agent_info.has("is_moderator"))
|
||||||
{
|
{
|
||||||
BOOL is_moderator = speakerp->mIsModerator;
|
moderator = agent_info["is_moderator"];
|
||||||
speakerp->mIsModerator = agent_info["is_moderator"];
|
|
||||||
// Fire event only if moderator changed
|
|
||||||
if ( is_moderator != speakerp->mIsModerator )
|
|
||||||
{
|
|
||||||
LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << LL_ENDL;
|
|
||||||
fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (agent_info.has("mutes"))
|
if (agent_info.has("mutes"))
|
||||||
{
|
{
|
||||||
speakerp->mModeratorMutedText = agent_info["mutes"]["text"];
|
moderator_muted = agent_info["mutes"]["text"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
speakerentries.emplace_back(
|
||||||
|
agent_id,
|
||||||
|
LLSpeaker::STATUS_TEXT_ONLY,
|
||||||
|
"",
|
||||||
|
LLSpeaker::SPEAKER_AGENT,
|
||||||
|
moderator,
|
||||||
|
moderator_muted
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( update.has("updates") && update["updates"].isMap() )
|
else if ( update.has("updates") && update["updates"].isMap() )
|
||||||
@@ -864,7 +884,9 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
|||||||
else if ( agent_transition == "ENTER")
|
else if ( agent_transition == "ENTER")
|
||||||
{
|
{
|
||||||
// add or update speaker
|
// add or update speaker
|
||||||
speakerp = setSpeaker(agent_id);
|
speakerentries.emplace_back(
|
||||||
|
agent_id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -872,6 +894,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LLSpeakerMgr::setSpeakers(speakerentries);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
|
void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id)
|
||||||
@@ -1039,10 +1062,13 @@ void LLLocalSpeakerMgr::updateSpeakerList()
|
|||||||
// pick up non-voice speakers in chat range
|
// pick up non-voice speakers in chat range
|
||||||
uuid_vec_t avatar_ids;
|
uuid_vec_t avatar_ids;
|
||||||
LLWorld::getInstance()->getAvatars(&avatar_ids, nullptr, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS);
|
LLWorld::getInstance()->getAvatars(&avatar_ids, nullptr, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS);
|
||||||
|
std::vector<speaker_entry_t> speakers;
|
||||||
|
speakers.reserve(avatar_ids.size());
|
||||||
for (const auto& id : avatar_ids)
|
for (const auto& id : avatar_ids)
|
||||||
{
|
{
|
||||||
setSpeaker(id);
|
speakers.emplace_back(id);
|
||||||
}
|
}
|
||||||
|
setSpeakers(speakers);
|
||||||
|
|
||||||
// check if text only speakers have moved out of chat range
|
// check if text only speakers have moved out of chat range
|
||||||
for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
|
for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
|
||||||
|
|||||||
@@ -230,10 +230,32 @@ public:
|
|||||||
void update(BOOL resort_ok);
|
void update(BOOL resort_ok);
|
||||||
void setSpeakerTyping(const LLUUID& speaker_id, BOOL typing);
|
void setSpeakerTyping(const LLUUID& speaker_id, BOOL typing);
|
||||||
void speakerChatted(const LLUUID& speaker_id);
|
void speakerChatted(const LLUUID& speaker_id);
|
||||||
|
|
||||||
|
struct speaker_entry_t
|
||||||
|
{
|
||||||
|
speaker_entry_t(const LLUUID& id,
|
||||||
|
LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY,
|
||||||
|
const std::string& name = LLStringUtil::null,
|
||||||
|
LLSpeaker::ESpeakerType type = LLSpeaker::SPEAKER_AGENT,
|
||||||
|
const bool moderator = false,
|
||||||
|
const bool moderator_muted_text = false) :
|
||||||
|
id(id), name(name), status(status), type(type), moderator(moderator), moderator_muted_text(moderator_muted_text)
|
||||||
|
{}
|
||||||
|
const LLUUID id;
|
||||||
|
const std::string name;
|
||||||
|
const LLSpeaker::ESpeakerStatus status;
|
||||||
|
const LLSpeaker::ESpeakerType type;
|
||||||
|
const bool moderator;
|
||||||
|
const bool moderator_muted_text;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setSpeakers(const std::vector<speaker_entry_t>& speakers);
|
||||||
LLPointer<LLSpeaker> setSpeaker(const LLUUID& id,
|
LLPointer<LLSpeaker> setSpeaker(const LLUUID& id,
|
||||||
const std::string& name = LLStringUtil::null,
|
const std::string& name = LLStringUtil::null,
|
||||||
LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY,
|
LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY,
|
||||||
LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT);
|
LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT,
|
||||||
|
bool moderator = false,
|
||||||
|
bool moderator_muted_text = false);
|
||||||
|
|
||||||
BOOL isVoiceActive();
|
BOOL isVoiceActive();
|
||||||
|
|
||||||
|
|||||||
@@ -225,6 +225,7 @@
|
|||||||
#include "llfloaterblacklist.h"
|
#include "llfloaterblacklist.h"
|
||||||
#include "scriptcounter.h"
|
#include "scriptcounter.h"
|
||||||
#include "shfloatermediaticker.h"
|
#include "shfloatermediaticker.h"
|
||||||
|
#include "shupdatechecker.h"
|
||||||
#include "llpacketring.h"
|
#include "llpacketring.h"
|
||||||
// </edit>
|
// </edit>
|
||||||
|
|
||||||
@@ -849,6 +850,7 @@ bool idle_startup()
|
|||||||
|
|
||||||
// Go to the next startup state
|
// Go to the next startup state
|
||||||
LLStartUp::setStartupState( STATE_BROWSER_INIT );
|
LLStartUp::setStartupState( STATE_BROWSER_INIT );
|
||||||
|
check_for_updates();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -583,11 +583,11 @@ void LLGLTexMemBar::draw()
|
|||||||
|
|
||||||
std::string text = "";
|
std::string text = "";
|
||||||
|
|
||||||
S32 global_raw_memory;
|
S64 global_raw_memory;
|
||||||
{
|
{
|
||||||
global_raw_memory = *AIAccess<S32>(LLImageRaw::sGlobalRawMemory);
|
global_raw_memory = *AIAccess<S64>(LLImageRaw::sGlobalRawMemory);
|
||||||
}
|
}
|
||||||
text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB FBO: %d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB Net Tot Tex: %.1f MB Tot Obj: %.1f MB Tot Htp: %d",
|
text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB FBO: %d MB Raw Tot: %lld MB Bias: %.2f Cache: %.1f/%.1f MB Net Tot Tex: %.1f MB Tot Obj: %.1f MB Tot Htp: %d",
|
||||||
total_mem.value(),
|
total_mem.value(),
|
||||||
max_total_mem.value(),
|
max_total_mem.value(),
|
||||||
bound_mem.value(),
|
bound_mem.value(),
|
||||||
|
|||||||
@@ -81,6 +81,7 @@
|
|||||||
#include "llviewerregion.h"
|
#include "llviewerregion.h"
|
||||||
#include "lldrawpoolwater.h"
|
#include "lldrawpoolwater.h"
|
||||||
#include "lldrawpoolbump.h"
|
#include "lldrawpoolbump.h"
|
||||||
|
#include "lldrawpoolavatar.h"
|
||||||
#include "llwlparammanager.h"
|
#include "llwlparammanager.h"
|
||||||
#include "llwaterparammanager.h"
|
#include "llwaterparammanager.h"
|
||||||
#include "llpostprocess.h"
|
#include "llpostprocess.h"
|
||||||
@@ -255,11 +256,24 @@ static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_CLASS("Class");
|
|||||||
static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_BUMP("Bump");
|
static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_BUMP("Bump");
|
||||||
static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_LIST("List");
|
static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_LIST("List");
|
||||||
static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_DELETE("Delete");
|
static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_DELETE("Delete");
|
||||||
|
|
||||||
|
int sMaxCacheHit = 0;
|
||||||
|
int sCurCacheHit = 0;
|
||||||
|
|
||||||
// Paint the display!
|
// Paint the display!
|
||||||
void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, bool tiling)
|
void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, bool tiling)
|
||||||
{
|
{
|
||||||
LL_RECORD_BLOCK_TIME(FTM_RENDER);
|
LL_RECORD_BLOCK_TIME(FTM_RENDER);
|
||||||
|
|
||||||
|
for (auto avatar : LLCharacter::sInstances)
|
||||||
|
{
|
||||||
|
LLVOAvatar* avatarp = dynamic_cast<LLVOAvatar*>(avatar);
|
||||||
|
if (!avatarp) continue;
|
||||||
|
if (avatarp->isDead()) continue;
|
||||||
|
avatarp->clearRiggedMatrixCache();
|
||||||
|
}
|
||||||
|
sCurCacheHit = 0;
|
||||||
|
|
||||||
if (gWindowResized)
|
if (gWindowResized)
|
||||||
{ //skip render on frames where window has been resized
|
{ //skip render on frames where window has been resized
|
||||||
gGL.flush();
|
gGL.flush();
|
||||||
|
|||||||
@@ -952,6 +952,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||||||
|
|
||||||
BOOL success = TRUE;
|
BOOL success = TRUE;
|
||||||
|
|
||||||
|
success = loadShaderFile("deferred/components/utilityFuncF.glsl", mVertexShaderLevel[SHADER_DEFERRED], GL_FRAGMENT_SHADER_ARB);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader";
|
gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader";
|
||||||
@@ -2533,6 +2535,17 @@ void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader)
|
|||||||
LLWaterParamManager::getInstance()->updateShaderUniforms(shader);
|
LLWaterParamManager::getInstance()->updateShaderUniforms(shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* virtual */ bool LLViewerShaderMgr::attachClassSharedShaders(LLGLSLShader& shader, S32 shader_class)
|
||||||
|
{
|
||||||
|
switch (shader_class)
|
||||||
|
{
|
||||||
|
case LLViewerShaderMgr::SHADER_DEFERRED:
|
||||||
|
LL_INFOS() << "deferred/components/utilityFuncF.glsl" << LL_ENDL;
|
||||||
|
return shader.attachObject("deferred/components/utilityFuncF.glsl");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*static*/ void LLShaderMgr::unloadShaderClass(int shader_class)
|
/*static*/ void LLShaderMgr::unloadShaderClass(int shader_class)
|
||||||
{
|
{
|
||||||
std::vector<LLGLSLShader *> &shader_list = getGlobalShaderList();
|
std::vector<LLGLSLShader *> &shader_list = getGlobalShaderList();
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ public:
|
|||||||
|
|
||||||
/* virtual */ void updateShaderUniforms(LLGLSLShader * shader); // Virtual
|
/* virtual */ void updateShaderUniforms(LLGLSLShader * shader); // Virtual
|
||||||
|
|
||||||
|
/* virtual */ bool attachClassSharedShaders(LLGLSLShader& shader, S32 shader_class); // Virtual
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<std::string> mShinyUniforms;
|
std::vector<std::string> mShinyUniforms;
|
||||||
|
|||||||
@@ -444,9 +444,9 @@ void reset_statistics()
|
|||||||
|
|
||||||
void output_statistics(void*)
|
void output_statistics(void*)
|
||||||
{
|
{
|
||||||
S32 global_raw_memory;
|
S64 global_raw_memory;
|
||||||
{
|
{
|
||||||
global_raw_memory = *AIAccess<S32>(LLImageRaw::sGlobalRawMemory);
|
global_raw_memory = *AIAccess<S64>(LLImageRaw::sGlobalRawMemory);
|
||||||
}
|
}
|
||||||
LL_INFOS() << "Number of orphans: " << gObjectList.getOrphanCount() << LL_ENDL;
|
LL_INFOS() << "Number of orphans: " << gObjectList.getOrphanCount() << LL_ENDL;
|
||||||
LL_INFOS() << "Number of dead objects: " << gObjectList.mNumDeadObjects << LL_ENDL;
|
LL_INFOS() << "Number of dead objects: " << gObjectList.mNumDeadObjects << LL_ENDL;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
// extern
|
// extern
|
||||||
const S32Megabytes gMinVideoRam(32);
|
const S32Megabytes gMinVideoRam(32);
|
||||||
const S32Megabytes gMaxVideoRam(1024);
|
const S32Megabytes gMaxVideoRam(2048);
|
||||||
|
|
||||||
|
|
||||||
// statics
|
// statics
|
||||||
@@ -88,11 +88,11 @@ S32 LLViewerTexture::sAuxCount = 0;
|
|||||||
LLFrameTimer LLViewerTexture::sEvaluationTimer;
|
LLFrameTimer LLViewerTexture::sEvaluationTimer;
|
||||||
F32 LLViewerTexture::sDesiredDiscardBias = 0.f;
|
F32 LLViewerTexture::sDesiredDiscardBias = 0.f;
|
||||||
F32 LLViewerTexture::sDesiredDiscardScale = 1.1f;
|
F32 LLViewerTexture::sDesiredDiscardScale = 1.1f;
|
||||||
S32Bytes LLViewerTexture::sBoundTextureMemory;
|
S64Bytes LLViewerTexture::sBoundTextureMemory;
|
||||||
S32Bytes LLViewerTexture::sTotalTextureMemory;
|
S64Bytes LLViewerTexture::sTotalTextureMemory;
|
||||||
S32Megabytes LLViewerTexture::sMaxBoundTextureMemory;
|
S32Megabytes LLViewerTexture::sMaxBoundTextureMemory;
|
||||||
S32Megabytes LLViewerTexture::sMaxTotalTextureMem;
|
S32Megabytes LLViewerTexture::sMaxTotalTextureMem;
|
||||||
S32Bytes LLViewerTexture::sMaxDesiredTextureMem;
|
S64Bytes LLViewerTexture::sMaxDesiredTextureMem;
|
||||||
S8 LLViewerTexture::sCameraMovingDiscardBias = 0;
|
S8 LLViewerTexture::sCameraMovingDiscardBias = 0;
|
||||||
F32 LLViewerTexture::sCameraMovingBias = 0.0f ;
|
F32 LLViewerTexture::sCameraMovingBias = 0.0f ;
|
||||||
S32 LLViewerTexture::sMaxSculptRez = 128 ; //max sculpt image size
|
S32 LLViewerTexture::sMaxSculptRez = 128 ; //max sculpt image size
|
||||||
|
|||||||
@@ -218,11 +218,11 @@ public:
|
|||||||
static LLFrameTimer sEvaluationTimer;
|
static LLFrameTimer sEvaluationTimer;
|
||||||
static F32 sDesiredDiscardBias;
|
static F32 sDesiredDiscardBias;
|
||||||
static F32 sDesiredDiscardScale;
|
static F32 sDesiredDiscardScale;
|
||||||
static S32Bytes sBoundTextureMemory;
|
static S64Bytes sBoundTextureMemory;
|
||||||
static S32Bytes sTotalTextureMemory;
|
static S64Bytes sTotalTextureMemory;
|
||||||
static S32Megabytes sMaxBoundTextureMemory;
|
static S32Megabytes sMaxBoundTextureMemory;
|
||||||
static S32Megabytes sMaxTotalTextureMem;
|
static S32Megabytes sMaxTotalTextureMem;
|
||||||
static S32Bytes sMaxDesiredTextureMem ;
|
static S64Bytes sMaxDesiredTextureMem ;
|
||||||
static S8 sCameraMovingDiscardBias;
|
static S8 sCameraMovingDiscardBias;
|
||||||
static F32 sCameraMovingBias;
|
static F32 sCameraMovingBias;
|
||||||
static S32 sMaxSculptRez ;
|
static S32 sMaxSculptRez ;
|
||||||
|
|||||||
@@ -746,9 +746,9 @@ void LLViewerTextureList::updateImages(F32 max_time)
|
|||||||
}
|
}
|
||||||
cleared = FALSE;
|
cleared = FALSE;
|
||||||
|
|
||||||
S32 global_raw_memory;
|
S64 global_raw_memory;
|
||||||
{
|
{
|
||||||
global_raw_memory = *AIAccess<S32>(LLImageRaw::sGlobalRawMemory);
|
global_raw_memory = *AIAccess<S64>(LLImageRaw::sGlobalRawMemory);
|
||||||
}
|
}
|
||||||
LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages);
|
LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages);
|
||||||
LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount);
|
LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount);
|
||||||
|
|||||||
@@ -1096,6 +1096,21 @@ protected: // Shared with LLVOAvatarSelf
|
|||||||
/** Support classes
|
/** Support classes
|
||||||
** **
|
** **
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef std::array<F32, LL_MAX_JOINTS_PER_MESH_OBJECT * 12> rigged_matrix_array_t;
|
||||||
|
typedef std::vector<std::pair<LLUUID, std::pair<U32, rigged_matrix_array_t> > > rigged_transformation_cache_t;
|
||||||
|
auto& getRiggedMatrixCache()
|
||||||
|
{
|
||||||
|
return mRiggedMatrixDataCache;
|
||||||
|
}
|
||||||
|
void clearRiggedMatrixCache()
|
||||||
|
{
|
||||||
|
mRiggedMatrixDataCache.clear();
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
rigged_transformation_cache_t mRiggedMatrixDataCache;
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
|
|
||||||
//Avatar idle timer
|
//Avatar idle timer
|
||||||
|
|||||||
@@ -5086,10 +5086,15 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||||||
}
|
}
|
||||||
else if (force_fullbright) //Hud is done in a forward render. Fullbright cannot be shared with simple.
|
else if (force_fullbright) //Hud is done in a forward render. Fullbright cannot be shared with simple.
|
||||||
{
|
{
|
||||||
if(type == LLDrawPool::POOL_ALPHA_MASK)
|
LLMaterial* mat = te->getMaterialParams().get();
|
||||||
|
if (type == LLDrawPool::POOL_ALPHA_MASK || (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK ) )
|
||||||
|
{
|
||||||
type = LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK;
|
type = LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
type = LLDrawPool::POOL_FULLBRIGHT;
|
type = LLDrawPool::POOL_FULLBRIGHT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(force_simple && type != LLDrawPool::POOL_FULLBRIGHT && type != LLDrawPool::POOL_ALPHA_MASK && type != LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK)
|
else if(force_simple && type != LLDrawPool::POOL_FULLBRIGHT && type != LLDrawPool::POOL_ALPHA_MASK && type != LLDrawPool::POOL_FULLBRIGHT_ALPHA_MASK)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1688,12 +1688,10 @@ void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const
|
|||||||
end_theta -= angle_adjust_y;
|
end_theta -= angle_adjust_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
gGL.pushUIMatrix();
|
||||||
gGL.pushMatrix();
|
gGL.translateUI(x, y, 0.f);
|
||||||
gGL.translatef((F32)x, (F32)y, 0.f);
|
|
||||||
gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color);
|
gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color);
|
||||||
gGL.popMatrix();
|
gGL.popUIMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|||||||
@@ -7741,7 +7741,7 @@ void LLPipeline::renderDeferredLighting()
|
|||||||
glClearColor(0,0,0,0);
|
glClearColor(0,0,0,0);
|
||||||
|
|
||||||
F32 ssao_scale = llclamp(RenderSSAOResolutionScale.get(), .01f, 1.f);
|
F32 ssao_scale = llclamp(RenderSSAOResolutionScale.get(), .01f, 1.f);
|
||||||
gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_KERN_SCALE, ssao_scale, ssao_scale);
|
gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SSAO_SCALE, ssao_scale, ssao_scale);
|
||||||
|
|
||||||
//Enable bilinear filtering, as the screen tex resolution may not match current framebuffer resolution. Eg, half-res SSAO
|
//Enable bilinear filtering, as the screen tex resolution may not match current framebuffer resolution. Eg, half-res SSAO
|
||||||
// diffuse map should only be found if the sun shader is the SSAO variant.
|
// diffuse map should only be found if the sun shader is the SSAO variant.
|
||||||
@@ -8320,7 +8320,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
|
|||||||
bindDeferredShader(gDeferredSunProgram);
|
bindDeferredShader(gDeferredSunProgram);
|
||||||
|
|
||||||
F32 ssao_scale = llclamp(RenderSSAOResolutionScale.get(), .01f, 1.f);
|
F32 ssao_scale = llclamp(RenderSSAOResolutionScale.get(), .01f, 1.f);
|
||||||
gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_KERN_SCALE, ssao_scale, ssao_scale);
|
gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SSAO_SCALE, ssao_scale, ssao_scale);
|
||||||
|
|
||||||
glClearColor(1,1,1,1);
|
glClearColor(1,1,1,1);
|
||||||
mDeferredLight.clear(GL_COLOR_BUFFER_BIT);
|
mDeferredLight.clear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|||||||
163
indra/newview/shupdatechecker.cpp
Normal file
163
indra/newview/shupdatechecker.cpp
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
#include "llviewerprecompiledheaders.h"
|
||||||
|
|
||||||
|
#include "llviewerwindow.h"
|
||||||
|
#include "llwindow.h"
|
||||||
|
#include "llpanelgeneral.h"
|
||||||
|
#include "llappviewer.h"
|
||||||
|
#include "llbutton.h"
|
||||||
|
#include "llviewercontrol.h"
|
||||||
|
#include "llnotificationsutil.h"
|
||||||
|
#include "llstartup.h"
|
||||||
|
#include "llviewerwindow.h" // to link into child list
|
||||||
|
#include "llnotify.h"
|
||||||
|
#include "lluictrlfactory.h"
|
||||||
|
#include "llhttpclient.h"
|
||||||
|
#include "llversioninfo.h"
|
||||||
|
#include "llbufferstream.h"
|
||||||
|
#include "llweb.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <jsoncpp/reader.h>
|
||||||
|
|
||||||
|
extern AIHTTPTimeoutPolicy getUpdateInfoResponder_timeout;
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// GetUpdateInfoResponder
|
||||||
|
class GetUpdateInfoResponder : public LLHTTPClient::ResponderWithCompleted
|
||||||
|
{
|
||||||
|
LOG_CLASS(GetUpdateInfoResponder);
|
||||||
|
|
||||||
|
public:
|
||||||
|
GetUpdateInfoResponder(std::string type)
|
||||||
|
: mType(type)
|
||||||
|
{}
|
||||||
|
void onNotifyButtonPress(const LLSD& notification, const LLSD& response, std::string name, std::string url)
|
||||||
|
{
|
||||||
|
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||||
|
if (option == 0) // URL
|
||||||
|
{
|
||||||
|
std::string escaped_url = LLWeb::escapeURL(url);
|
||||||
|
if (gViewerWindow)
|
||||||
|
{
|
||||||
|
gViewerWindow->getWindow()->spawnWebBrowser(escaped_url, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (option == 1) // Later
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
/*virtual*/ void completedRaw(LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||||
|
{
|
||||||
|
LLBufferStream istr(channels, buffer.get());
|
||||||
|
std::stringstream strstrm;
|
||||||
|
strstrm << istr.rdbuf();
|
||||||
|
const std::string body = strstrm.str();
|
||||||
|
|
||||||
|
if (mStatus != HTTP_OK)
|
||||||
|
{
|
||||||
|
LL_WARNS() << "Failed to get update info (" << mStatus << ")" << LL_ENDL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Json::Value root;
|
||||||
|
Json::Reader reader;
|
||||||
|
if (!reader.parse(body, root))
|
||||||
|
{
|
||||||
|
LL_WARNS() << "Failed to parse update info: " << reader.getFormattedErrorMessages() << LL_ENDL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string viewer_version = llformat("%s (%i)", LLVersionInfo::getShortVersion(), LLVersionInfo::getBuild());
|
||||||
|
|
||||||
|
const Json::Value data = root[mType];
|
||||||
|
#if LL_WINDOWS
|
||||||
|
std::string recommended_version = data["recommended"]["windows"].asString();
|
||||||
|
std::string minimum_version = data["minimum"]["windows"].asString();
|
||||||
|
#elif LL_LINUX
|
||||||
|
std::string recommended_version = data["recommended"]["linux"].asString();
|
||||||
|
std::string minimum_version = data["minimum"]["linux"].asString();
|
||||||
|
#elif LL_DARWIN
|
||||||
|
std::string recommended_version = data["recommended"]["apple"].asString();
|
||||||
|
std::string minimum_version = data["minimum"]["apple"].asString();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
S32 minimum_build, recommended_build;
|
||||||
|
sscanf(recommended_version.c_str(), "%*i.%*i.%*i (%i)", &recommended_build);
|
||||||
|
sscanf(minimum_version.c_str(), "%*i.%*i.%*i (%i)", &minimum_build);
|
||||||
|
|
||||||
|
LL_INFOS() << LLVersionInfo::getBuild() << LL_ENDL;
|
||||||
|
LLSD args;
|
||||||
|
args["CURRENT_VER"] = viewer_version;
|
||||||
|
args["RECOMMENDED_VER"] = recommended_version;
|
||||||
|
args["MINIMUM_VER"] = minimum_version;
|
||||||
|
args["URL"] = data["url"].asString();
|
||||||
|
args["TYPE"] = mType == "release" ? "Viewer" : "Alpha";
|
||||||
|
|
||||||
|
static LLCachedControl<S32> sLastKnownReleaseBuild("SinguLastKnownReleaseBuild", 0);
|
||||||
|
static LLCachedControl<S32> sLastKnownAlphaBuild("SinguLastKnownAlphaBuild", 0);
|
||||||
|
|
||||||
|
LLCachedControl<S32>& lastver = mType == "release" ? sLastKnownReleaseBuild : sLastKnownAlphaBuild;
|
||||||
|
|
||||||
|
if (LLVersionInfo::getBuild() < minimum_build || LLVersionInfo::getBuild() < recommended_build)
|
||||||
|
{
|
||||||
|
if (lastver.get() < recommended_build)
|
||||||
|
{
|
||||||
|
lastver = recommended_build;
|
||||||
|
LLUI::sIgnoresGroup->setWarning("UrgentUpdateModal", true);
|
||||||
|
LLUI::sIgnoresGroup->setWarning("UrgentUpdate", true);
|
||||||
|
LLUI::sIgnoresGroup->setWarning("RecommendedUpdate", true);
|
||||||
|
}
|
||||||
|
std::string notificaiton;
|
||||||
|
if (LLVersionInfo::getBuild() < minimum_build)
|
||||||
|
{
|
||||||
|
if (LLUI::sIgnoresGroup->getWarning("UrgentUpdateModal"))
|
||||||
|
{
|
||||||
|
notificaiton = "UrgentUpdateModal";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
notificaiton = "UrgentUpdate";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (LLVersionInfo::getBuild() < recommended_build)
|
||||||
|
{
|
||||||
|
notificaiton = "RecommendedUpdate";
|
||||||
|
}
|
||||||
|
if (!notificaiton.empty())
|
||||||
|
{
|
||||||
|
LLNotificationsUtil::add(notificaiton, args, LLSD(), boost::bind(&GetUpdateInfoResponder::onNotifyButtonPress, this, _1, _2, notificaiton, data["url"].asString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return getUpdateInfoResponder_timeout; }
|
||||||
|
/*virtual*/ char const* getName(void) const { return "GetUpdateInfoResponder"; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string mType;
|
||||||
|
};
|
||||||
|
|
||||||
|
void check_for_updates()
|
||||||
|
{
|
||||||
|
#if LL_WINDOWS | LL_LINUX | LL_DARWIN
|
||||||
|
// Hard-code the update url for now.
|
||||||
|
std::string url = "http://singularity-viewer.github.io/pages/api/get_update_info.json";//gSavedSettings.getString("SHUpdateCheckURL");
|
||||||
|
if (!url.empty())
|
||||||
|
{
|
||||||
|
std::string type;
|
||||||
|
auto& channel = LLVersionInfo::getChannel();
|
||||||
|
if (channel == std::string("Singularity"))
|
||||||
|
{
|
||||||
|
type = "release";
|
||||||
|
}
|
||||||
|
else if (channel == std::string("Singularity Test") || channel == std::string("Singularity Alpha"))
|
||||||
|
{
|
||||||
|
type = "alpha";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LLHTTPClient::get(url, new GetUpdateInfoResponder(type));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
6
indra/newview/shupdatechecker.h
Normal file
6
indra/newview/shupdatechecker.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef SH_SHUPDATECHECKER_H
|
||||||
|
#define SH_SHUPDATECHECKER_H
|
||||||
|
|
||||||
|
void check_for_updates();
|
||||||
|
|
||||||
|
#endif //SH_SHUPDATECHECKER_H
|
||||||
@@ -57,20 +57,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="okcancelbuttonscanceldefault">
|
|
||||||
<form>
|
|
||||||
<button
|
|
||||||
index="0"
|
|
||||||
name="OK"
|
|
||||||
text="$yestext"/>
|
|
||||||
<button
|
|
||||||
default="true"
|
|
||||||
index="1"
|
|
||||||
name="Cancel"
|
|
||||||
text="$notext"/>
|
|
||||||
</form>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template name="okcancelignore">
|
<template name="okcancelignore">
|
||||||
<form>
|
<form>
|
||||||
<button
|
<button
|
||||||
@@ -86,6 +72,20 @@
|
|||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template name="okcancelignorecanceldefault">
|
||||||
|
<form>
|
||||||
|
<button
|
||||||
|
index="0"
|
||||||
|
name="OK"
|
||||||
|
text="$yestext"/>
|
||||||
|
<button
|
||||||
|
default="true"
|
||||||
|
index="1"
|
||||||
|
name="Cancel"
|
||||||
|
text="$notext"/>
|
||||||
|
<ignore text="$ignoretext"/>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
<template name="okhelpbuttons">
|
<template name="okhelpbuttons">
|
||||||
<form>
|
<form>
|
||||||
<button
|
<button
|
||||||
@@ -10595,4 +10595,62 @@ Do you wish to export anyway?
|
|||||||
Object successfully exported to: [FILENAME]
|
Object successfully exported to: [FILENAME]
|
||||||
</notification>
|
</notification>
|
||||||
|
|
||||||
|
<notification
|
||||||
|
icon="notifytip.tga"
|
||||||
|
label="Update Available"
|
||||||
|
name="RecommendedUpdate"
|
||||||
|
type="notify">
|
||||||
|
A newer version, [RECOMMENDED_VER], is available for Singularity[TYPE].
|
||||||
|
|
||||||
|
Click [Visit Page] to open
|
||||||
|
[URL]
|
||||||
|
for information and download links for this new version.
|
||||||
|
<tag>confirm</tag>
|
||||||
|
<usetemplate
|
||||||
|
name="okcancelignorecanceldefault"
|
||||||
|
notext="Later"
|
||||||
|
yestext="Visit Page"
|
||||||
|
ignoretext="Ignore recommended update notification"/>
|
||||||
|
</notification>
|
||||||
|
<notification
|
||||||
|
icon="alert.tga"
|
||||||
|
label="Critical Update!"
|
||||||
|
name="UrgentUpdate"
|
||||||
|
priority="high"
|
||||||
|
type="notify">
|
||||||
|
Your version of Singularity[TYPE] is critically out of date!
|
||||||
|
|
||||||
|
It is STRONGLY recommended to download a newer version of this viewer due to grid compatability and/or security concerns.
|
||||||
|
|
||||||
|
Click [Visit Page] to open
|
||||||
|
[URL]
|
||||||
|
for information and download links for newer versions.
|
||||||
|
|
||||||
|
<tag>confirm</tag>
|
||||||
|
<usetemplate
|
||||||
|
name="okcancelignorecanceldefault"
|
||||||
|
notext="Later"
|
||||||
|
yestext="Visit Page"
|
||||||
|
ignoretext="Ignore critical update notification"/>
|
||||||
|
</notification>
|
||||||
|
<notification
|
||||||
|
icon="alert.tga"
|
||||||
|
label="Critical Update"
|
||||||
|
name="UrgentUpdateModal"
|
||||||
|
priority="high"
|
||||||
|
type="alertmodal">
|
||||||
|
Your version of Singularity[TYPE] is critically out of date!
|
||||||
|
|
||||||
|
It is STRONGLY recommended to download a newer version of this viewer due to grid compatability and/or security concerns.
|
||||||
|
|
||||||
|
Click [Visit Page] to open
|
||||||
|
[URL]
|
||||||
|
for information and download links for newer versions.
|
||||||
|
<tag>confirm</tag>
|
||||||
|
<usetemplate
|
||||||
|
name="okcancelignorecanceldefault"
|
||||||
|
notext="Later"
|
||||||
|
yestext="Visit Page"
|
||||||
|
ignoretext="Ignore critical update alert"/>
|
||||||
|
</notification>
|
||||||
</notifications>
|
</notifications>
|
||||||
|
|||||||
Reference in New Issue
Block a user