Merge branch 'master' of git://github.com/Shyotl/SingularityViewer
This commit is contained in:
@@ -231,6 +231,7 @@ set(llcommon_HEADER_FILES
|
|||||||
llstrider.h
|
llstrider.h
|
||||||
llstring.h
|
llstring.h
|
||||||
llstringtable.h
|
llstringtable.h
|
||||||
|
llstaticstringtable.h
|
||||||
llsys.h
|
llsys.h
|
||||||
llthread.h
|
llthread.h
|
||||||
llthreadsafequeue.h
|
llthreadsafequeue.h
|
||||||
|
|||||||
@@ -41,7 +41,11 @@ public:
|
|||||||
~LLAlignedArray();
|
~LLAlignedArray();
|
||||||
|
|
||||||
void push_back(const T& elem);
|
void push_back(const T& elem);
|
||||||
U32 size() const { return mElementCount; }
|
void pop_back() { if(!!mElementCount) --mElementCount; }
|
||||||
|
bool empty() const { return !mElementCount; }
|
||||||
|
T& front() { return operator[](0); }
|
||||||
|
T& back() { return operator[](mElementCount-1); }
|
||||||
|
U32 size() const { return mElementCount; }
|
||||||
void resize(U32 size);
|
void resize(U32 size);
|
||||||
T* append(S32 N);
|
T* append(S32 N);
|
||||||
T& operator[](int idx);
|
T& operator[](int idx);
|
||||||
|
|||||||
@@ -663,14 +663,6 @@ void LLPrivateMemoryPoolTester::operator delete[](void* addr)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment);
|
|
||||||
|
|
||||||
#ifdef SHOW_ASSERT
|
|
||||||
#define ll_assert_aligned(ptr,alignment) ll_assert_aligned_func(reinterpret_cast<uintptr_t>(ptr),((U32)alignment))
|
|
||||||
#else
|
|
||||||
#define ll_assert_aligned(ptr,alignment)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//EVENTUALLY REMOVE THESE:
|
//EVENTUALLY REMOVE THESE:
|
||||||
#include "llpointer.h"
|
#include "llpointer.h"
|
||||||
#include "llsingleton.h"
|
#include "llsingleton.h"
|
||||||
|
|||||||
82
indra/llcommon/llstaticstringtable.h
Normal file
82
indra/llcommon/llstaticstringtable.h
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/**
|
||||||
|
* @file llstringtable.h
|
||||||
|
* @brief The LLStringTable class provides a _fast_ method for finding
|
||||||
|
* unique copies of strings.
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation;
|
||||||
|
* version 2.1 of the License only.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_STATIC_STRING_TABLE_H
|
||||||
|
#define LL_STATIC_STRING_TABLE_H
|
||||||
|
|
||||||
|
#include "lldefs.h"
|
||||||
|
#include <boost/unordered_map.hpp>
|
||||||
|
#include "llstl.h"
|
||||||
|
|
||||||
|
class LLStaticHashedString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
LLStaticHashedString(const std::string& s)
|
||||||
|
{
|
||||||
|
string_hash = makehash(s);
|
||||||
|
string = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& String() const { return string; }
|
||||||
|
size_t Hash() const { return string_hash; }
|
||||||
|
|
||||||
|
bool operator==(const LLStaticHashedString& b) const { return String() == b.String(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
size_t makehash(const std::string& s)
|
||||||
|
{
|
||||||
|
size_t len = s.size();
|
||||||
|
const char* c = s.c_str();
|
||||||
|
size_t hashval = 0;
|
||||||
|
for (size_t i=0; i<len; i++)
|
||||||
|
{
|
||||||
|
hashval = ((hashval<<5) + hashval) + *c++;
|
||||||
|
}
|
||||||
|
return hashval;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string string;
|
||||||
|
size_t string_hash;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LLStaticStringHasher
|
||||||
|
{
|
||||||
|
enum { bucket_size = 8 };
|
||||||
|
size_t operator()(const LLStaticHashedString& key_value) const { return key_value.Hash(); }
|
||||||
|
bool operator()(const LLStaticHashedString& left, const LLStaticHashedString& right) const { return left.Hash() < right.Hash(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename MappedObject >
|
||||||
|
class LLStaticStringTable
|
||||||
|
: public boost::unordered_map< LLStaticHashedString, MappedObject, LLStaticStringHasher >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -299,10 +299,15 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
|
|||||||
++sRawImageCount;
|
++sRawImageCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components)
|
LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_copy)
|
||||||
: LLImageBase(), mCacheEntries(0)
|
: LLImageBase(), mCacheEntries(0)
|
||||||
{
|
{
|
||||||
if(allocateDataSize(width, height, components) && data)
|
|
||||||
|
if(no_copy)
|
||||||
|
{
|
||||||
|
setDataAndSize(data, width, height, components);
|
||||||
|
}
|
||||||
|
else if(allocateDataSize(width, height, components) && data)
|
||||||
{
|
{
|
||||||
memcpy(getData(), data, width*height*components);
|
memcpy(getData(), data, width*height*components);
|
||||||
}
|
}
|
||||||
@@ -762,8 +767,17 @@ void LLImageRaw::fill( const LLColor4U& color )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLPointer<LLImageRaw> LLImageRaw::duplicate()
|
||||||
|
{
|
||||||
|
if(getNumRefs() < 2)
|
||||||
|
{
|
||||||
|
return this; //nobody else refences to this image, no need to duplicate.
|
||||||
|
}
|
||||||
|
|
||||||
|
//make a duplicate
|
||||||
|
LLPointer<LLImageRaw> dup = new LLImageRaw(getData(), getWidth(), getHeight(), getComponents());
|
||||||
|
return dup;
|
||||||
|
}
|
||||||
|
|
||||||
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
|
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
|
||||||
void LLImageRaw::copy(LLImageRaw* src)
|
void LLImageRaw::copy(LLImageRaw* src)
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
LLImageRaw();
|
LLImageRaw();
|
||||||
LLImageRaw(U16 width, U16 height, S8 components);
|
LLImageRaw(U16 width, U16 height, S8 components);
|
||||||
LLImageRaw(U8 *data, U16 width, U16 height, S8 components);
|
LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_copy = false);
|
||||||
LLImageRaw(LLImageRaw const* src, U16 width, U16 height, U16 crop_offset, bool crop_vertically);
|
LLImageRaw(LLImageRaw const* src, U16 width, U16 height, U16 crop_offset, bool crop_vertically);
|
||||||
// Construct using createFromFile (used by tools)
|
// Construct using createFromFile (used by tools)
|
||||||
//LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false);
|
//LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only = false);
|
||||||
@@ -204,6 +204,9 @@ public:
|
|||||||
|
|
||||||
// Copy operations
|
// Copy operations
|
||||||
|
|
||||||
|
//duplicate this raw image if refCount > 1.
|
||||||
|
LLPointer<LLImageRaw> duplicate();
|
||||||
|
|
||||||
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
|
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
|
||||||
void copy( LLImageRaw* src );
|
void copy( LLImageRaw* src );
|
||||||
|
|
||||||
|
|||||||
@@ -727,7 +727,8 @@ bool LLGLManager::initGL()
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
|
//Singu Note: Multisampled texture stuff in v3 is dead, however we DO use multisampled FBOs.
|
||||||
if (mHasFramebufferMultisample)
|
if (mHasFramebufferMultisample)
|
||||||
{
|
{
|
||||||
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
|
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
|
||||||
|
|||||||
@@ -91,11 +91,22 @@ LLShaderFeatures::LLShaderFeatures()
|
|||||||
// LLGLSL Shader implementation
|
// LLGLSL Shader implementation
|
||||||
//===============================
|
//===============================
|
||||||
LLGLSLShader::LLGLSLShader(S32 shader_class)
|
LLGLSLShader::LLGLSLShader(S32 shader_class)
|
||||||
: mProgramObject(0), mShaderClass(shader_class), mActiveTextureChannels(0), mShaderLevel(0), mShaderGroup(SG_DEFAULT), mUniformsDirty(FALSE)
|
: mProgramObject(0),
|
||||||
|
mShaderClass(shader_class),
|
||||||
|
mAttributeMask(0),
|
||||||
|
mTotalUniformSize(0),
|
||||||
|
mActiveTextureChannels(0),
|
||||||
|
mShaderLevel(0),
|
||||||
|
mShaderGroup(SG_DEFAULT),
|
||||||
|
mUniformsDirty(FALSE)
|
||||||
{
|
{
|
||||||
LLShaderMgr::getGlobalShaderList().push_back(this);
|
LLShaderMgr::getGlobalShaderList().push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLGLSLShader::~LLGLSLShader()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
void LLGLSLShader::unload()
|
void LLGLSLShader::unload()
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
@@ -103,6 +114,7 @@ void LLGLSLShader::unload()
|
|||||||
mTexture.clear();
|
mTexture.clear();
|
||||||
mUniform.clear();
|
mUniform.clear();
|
||||||
mShaderFiles.clear();
|
mShaderFiles.clear();
|
||||||
|
mDefines.clear();
|
||||||
|
|
||||||
if (mProgramObject)
|
if (mProgramObject)
|
||||||
{
|
{
|
||||||
@@ -127,8 +139,8 @@ void LLGLSLShader::unload()
|
|||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGLSLShader::createShader(vector<string> * attributes,
|
BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
||||||
vector<string> * uniforms,
|
std::vector<LLStaticHashedString> * uniforms,
|
||||||
U32 varying_count,
|
U32 varying_count,
|
||||||
const char** varyings)
|
const char** varyings)
|
||||||
{
|
{
|
||||||
@@ -151,7 +163,7 @@ BOOL LLGLSLShader::createShader(vector<string> * attributes,
|
|||||||
vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
|
vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
|
||||||
for ( ; fileIter != mShaderFiles.end(); fileIter++ )
|
for ( ; fileIter != mShaderFiles.end(); fileIter++ )
|
||||||
{
|
{
|
||||||
GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, mFeatures.mIndexedTextureChannels);
|
GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels);
|
||||||
LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL;
|
LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL;
|
||||||
if (shaderhandle > 0)
|
if (shaderhandle > 0)
|
||||||
{
|
{
|
||||||
@@ -217,7 +229,8 @@ BOOL LLGLSLShader::createShader(vector<string> * attributes,
|
|||||||
|
|
||||||
for (S32 i = 0; i < channel_count; i++)
|
for (S32 i = 0; i < channel_count; i++)
|
||||||
{
|
{
|
||||||
uniform1i(llformat("tex%d", i), i);
|
LLStaticHashedString uniName(llformat("tex%d", i));
|
||||||
|
uniform1i(uniName, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 cur_tex = channel_count; //adjust any texture channels that might have been overwritten
|
S32 cur_tex = channel_count; //adjust any texture channels that might have been overwritten
|
||||||
@@ -290,7 +303,7 @@ void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
|
BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attributes)
|
||||||
{
|
{
|
||||||
//before linking, make sure reserved attributes always have consistent locations
|
//before linking, make sure reserved attributes always have consistent locations
|
||||||
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
||||||
@@ -309,6 +322,8 @@ BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
|
|||||||
if (res)
|
if (res)
|
||||||
{ //read back channel locations
|
{ //read back channel locations
|
||||||
|
|
||||||
|
mAttributeMask = 0;
|
||||||
|
|
||||||
//read back reserved channels first
|
//read back reserved channels first
|
||||||
for (U32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
for (U32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
||||||
{
|
{
|
||||||
@@ -317,6 +332,7 @@ BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
|
|||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
mAttribute[i] = index;
|
mAttribute[i] = index;
|
||||||
|
mAttributeMask |= 1 << i;
|
||||||
LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
|
LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +340,7 @@ BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
|
|||||||
{
|
{
|
||||||
for (U32 i = 0; i < numAttributes; i++)
|
for (U32 i = 0; i < numAttributes; i++)
|
||||||
{
|
{
|
||||||
const char* name = (*attributes)[i].c_str();
|
const char* name = (*attributes)[i].String().c_str();
|
||||||
S32 index = glGetAttribLocationARB(mProgramObject, name);
|
S32 index = glGetAttribLocationARB(mProgramObject, name);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
@@ -340,7 +356,7 @@ BOOL LLGLSLShader::mapAttributes(const vector<string> * attributes)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
|
void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> * uniforms)
|
||||||
{
|
{
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
{
|
{
|
||||||
@@ -349,11 +365,55 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
|
|||||||
|
|
||||||
GLenum type;
|
GLenum type;
|
||||||
GLsizei length;
|
GLsizei length;
|
||||||
GLint size;
|
GLint size = -1;
|
||||||
char name[1024]; /* Flawfinder: ignore */
|
char name[1024]; /* Flawfinder: ignore */
|
||||||
name[0] = 0;
|
name[0] = 0;
|
||||||
|
|
||||||
glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name);
|
glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name);
|
||||||
|
#if !LL_DARWIN
|
||||||
|
if (size > 0)
|
||||||
|
{
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case GL_FLOAT_VEC2: size *= 2; break;
|
||||||
|
case GL_FLOAT_VEC3: size *= 3; break;
|
||||||
|
case GL_FLOAT_VEC4: size *= 4; break;
|
||||||
|
case GL_DOUBLE: size *= 2; break;
|
||||||
|
case GL_DOUBLE_VEC2: size *= 2; break;
|
||||||
|
case GL_DOUBLE_VEC3: size *= 6; break;
|
||||||
|
case GL_DOUBLE_VEC4: size *= 8; break;
|
||||||
|
case GL_INT_VEC2: size *= 2; break;
|
||||||
|
case GL_INT_VEC3: size *= 3; break;
|
||||||
|
case GL_INT_VEC4: size *= 4; break;
|
||||||
|
case GL_UNSIGNED_INT_VEC2: size *= 2; break;
|
||||||
|
case GL_UNSIGNED_INT_VEC3: size *= 3; break;
|
||||||
|
case GL_UNSIGNED_INT_VEC4: size *= 4; break;
|
||||||
|
case GL_BOOL_VEC2: size *= 2; break;
|
||||||
|
case GL_BOOL_VEC3: size *= 3; break;
|
||||||
|
case GL_BOOL_VEC4: size *= 4; break;
|
||||||
|
case GL_FLOAT_MAT2: size *= 4; break;
|
||||||
|
case GL_FLOAT_MAT3: size *= 9; break;
|
||||||
|
case GL_FLOAT_MAT4: size *= 16; break;
|
||||||
|
case GL_FLOAT_MAT2x3: size *= 6; break;
|
||||||
|
case GL_FLOAT_MAT2x4: size *= 8; break;
|
||||||
|
case GL_FLOAT_MAT3x2: size *= 6; break;
|
||||||
|
case GL_FLOAT_MAT3x4: size *= 12; break;
|
||||||
|
case GL_FLOAT_MAT4x2: size *= 8; break;
|
||||||
|
case GL_FLOAT_MAT4x3: size *= 12; break;
|
||||||
|
case GL_DOUBLE_MAT2: size *= 8; break;
|
||||||
|
case GL_DOUBLE_MAT3: size *= 18; break;
|
||||||
|
case GL_DOUBLE_MAT4: size *= 32; break;
|
||||||
|
case GL_DOUBLE_MAT2x3: size *= 12; break;
|
||||||
|
case GL_DOUBLE_MAT2x4: size *= 16; break;
|
||||||
|
case GL_DOUBLE_MAT3x2: size *= 12; break;
|
||||||
|
case GL_DOUBLE_MAT3x4: size *= 24; break;
|
||||||
|
case GL_DOUBLE_MAT4x2: size *= 16; break;
|
||||||
|
case GL_DOUBLE_MAT4x3: size *= 24; break;
|
||||||
|
}
|
||||||
|
mTotalUniformSize += size;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
S32 location = glGetUniformLocationARB(mProgramObject, name);
|
S32 location = glGetUniformLocationARB(mProgramObject, name);
|
||||||
if (location != -1)
|
if (location != -1)
|
||||||
{
|
{
|
||||||
@@ -365,7 +425,10 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
|
|||||||
is_array[0] = 0;
|
is_array[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mUniformMap[name] = location;
|
LLStaticHashedString hashedName(name);
|
||||||
|
mUniformNameMap[location] = name;
|
||||||
|
mUniformMap[hashedName] = location;
|
||||||
|
|
||||||
LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL;
|
LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL;
|
||||||
|
|
||||||
//find the index of this uniform
|
//find the index of this uniform
|
||||||
@@ -386,7 +449,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
|
|||||||
for (U32 i = 0; i < uniforms->size(); i++)
|
for (U32 i = 0; i < uniforms->size(); i++)
|
||||||
{
|
{
|
||||||
if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1)
|
if ( (mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] == -1)
|
||||||
&& ((*uniforms)[i] == name))
|
&& ((*uniforms)[i].String() == name))
|
||||||
{
|
{
|
||||||
//found it
|
//found it
|
||||||
mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location;
|
mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location;
|
||||||
@@ -396,7 +459,17 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLGLSLShader::addPermutation(std::string name, std::string value)
|
||||||
|
{
|
||||||
|
mDefines[name] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLGLSLShader::removePermutation(std::string name)
|
||||||
|
{
|
||||||
|
mDefines[name].erase();
|
||||||
|
}
|
||||||
|
|
||||||
GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type)
|
GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type)
|
||||||
{
|
{
|
||||||
@@ -410,13 +483,15 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGLSLShader::mapUniforms(const vector<string> * uniforms)
|
BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
||||||
{
|
{
|
||||||
BOOL res = TRUE;
|
BOOL res = TRUE;
|
||||||
|
|
||||||
|
mTotalUniformSize = 0;
|
||||||
mActiveTextureChannels = 0;
|
mActiveTextureChannels = 0;
|
||||||
mUniform.clear();
|
mUniform.clear();
|
||||||
mUniformMap.clear();
|
mUniformMap.clear();
|
||||||
|
mUniformNameMap.clear();
|
||||||
mTexture.clear();
|
mTexture.clear();
|
||||||
mValue.clear();
|
mValue.clear();
|
||||||
//initialize arrays
|
//initialize arrays
|
||||||
@@ -437,6 +512,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<string> * uniforms)
|
|||||||
|
|
||||||
unbind();
|
unbind();
|
||||||
|
|
||||||
|
LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << llendl;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,6 +571,58 @@ void LLGLSLShader::bindNoShader(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLGLSLShader::bindTexture(const std::string &uniform, LLTexture *texture, LLTexUnit::eTextureType mode)
|
||||||
|
{
|
||||||
|
S32 channel = 0;
|
||||||
|
channel = getUniformLocation(uniform);
|
||||||
|
|
||||||
|
return bindTexture(channel, texture, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLGLSLShader::bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode)
|
||||||
|
{
|
||||||
|
if (uniform < 0 || uniform >= (S32)mTexture.size())
|
||||||
|
{
|
||||||
|
UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uniform = mTexture[uniform];
|
||||||
|
|
||||||
|
if (uniform > -1)
|
||||||
|
{
|
||||||
|
gGL.getTexUnit(uniform)->bind(texture, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return uniform;
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLGLSLShader::unbindTexture(const std::string &uniform, LLTexUnit::eTextureType mode)
|
||||||
|
{
|
||||||
|
S32 channel = 0;
|
||||||
|
channel = getUniformLocation(uniform);
|
||||||
|
|
||||||
|
return unbindTexture(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLGLSLShader::unbindTexture(S32 uniform, LLTexUnit::eTextureType mode)
|
||||||
|
{
|
||||||
|
if (uniform < 0 || uniform >= (S32)mTexture.size())
|
||||||
|
{
|
||||||
|
UNIFORM_ERRS << "Uniform out of range: " << uniform << LL_ENDL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uniform = mTexture[uniform];
|
||||||
|
|
||||||
|
if (uniform > -1)
|
||||||
|
{
|
||||||
|
gGL.getTexUnit(uniform)->unbind(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return uniform;
|
||||||
|
}
|
||||||
|
|
||||||
S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode)
|
S32 LLGLSLShader::enableTexture(S32 uniform, LLTexUnit::eTextureType mode)
|
||||||
{
|
{
|
||||||
if (uniform < 0 || uniform >= (S32)mTexture.size())
|
if (uniform < 0 || uniform >= (S32)mTexture.size())
|
||||||
@@ -817,18 +945,18 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLint LLGLSLShader::getUniformLocation(const string& uniform)
|
GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform)
|
||||||
{
|
{
|
||||||
GLint ret = -1;
|
GLint ret = -1;
|
||||||
if (mProgramObject > 0)
|
if (mProgramObject > 0)
|
||||||
{
|
{
|
||||||
std::map<string, GLint>::iterator iter = mUniformMap.find(uniform);
|
LLStaticStringTable<GLint>::iterator iter = mUniformMap.find(uniform);
|
||||||
if (iter != mUniformMap.end())
|
if (iter != mUniformMap.end())
|
||||||
{
|
{
|
||||||
if (gDebugGL)
|
if (gDebugGL)
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.c_str()))
|
if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str()))
|
||||||
{
|
{
|
||||||
llerrs << "Uniform does not match." << llendl;
|
llerrs << "Uniform does not match." << llendl;
|
||||||
}
|
}
|
||||||
@@ -865,7 +993,7 @@ GLint LLGLSLShader::getAttribLocation(U32 attrib)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniform1i(const string& uniform, GLint v)
|
void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v)
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
@@ -881,7 +1009,24 @@ void LLGLSLShader::uniform1i(const string& uniform, GLint v)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniform1f(const string& uniform, GLfloat v)
|
void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint j)
|
||||||
|
{
|
||||||
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
|
if (location >= 0)
|
||||||
|
{
|
||||||
|
std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
|
||||||
|
LLVector4 vec(i,j,0.f,0.f);
|
||||||
|
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||||
|
{
|
||||||
|
glUniform2iARB(location, i, j);
|
||||||
|
mValue[location] = vec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v)
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
@@ -897,7 +1042,7 @@ void LLGLSLShader::uniform1f(const string& uniform, GLfloat v)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniform2f(const string& uniform, GLfloat x, GLfloat y)
|
void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y)
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
@@ -914,7 +1059,7 @@ void LLGLSLShader::uniform2f(const string& uniform, GLfloat x, GLfloat y)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniform3f(const string& uniform, GLfloat x, GLfloat y, GLfloat z)
|
void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z)
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
@@ -930,23 +1075,7 @@ void LLGLSLShader::uniform3f(const string& uniform, GLfloat x, GLfloat y, GLfloa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniform4f(const string& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
|
||||||
{
|
|
||||||
GLint location = getUniformLocation(uniform);
|
|
||||||
|
|
||||||
if (location >= 0)
|
|
||||||
{
|
|
||||||
std::map<GLint, LLVector4>::iterator iter = mValue.find(location);
|
|
||||||
LLVector4 vec(x,y,z,w);
|
|
||||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
|
||||||
{
|
|
||||||
glUniform4fARB(location, x,y,z,w);
|
|
||||||
mValue[location] = vec;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLGLSLShader::uniform1fv(const string& uniform, U32 count, const GLfloat* v)
|
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
@@ -962,7 +1091,7 @@ void LLGLSLShader::uniform1fv(const string& uniform, U32 count, const GLfloat* v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniform2fv(const string& uniform, U32 count, const GLfloat* v)
|
void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
@@ -978,7 +1107,7 @@ void LLGLSLShader::uniform2fv(const string& uniform, U32 count, const GLfloat* v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniform3fv(const string& uniform, U32 count, const GLfloat* v)
|
void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
@@ -994,7 +1123,7 @@ void LLGLSLShader::uniform3fv(const string& uniform, U32 count, const GLfloat* v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v)
|
void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v)
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
@@ -1012,27 +1141,7 @@ void LLGLSLShader::uniform4fv(const string& uniform, U32 count, const GLfloat* v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGLSLShader::uniformMatrix2fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v)
|
void LLGLSLShader::uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat* v)
|
||||||
{
|
|
||||||
GLint location = getUniformLocation(uniform);
|
|
||||||
|
|
||||||
if (location >= 0)
|
|
||||||
{
|
|
||||||
glUniformMatrix2fvARB(location, count, transpose, v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLGLSLShader::uniformMatrix3fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v)
|
|
||||||
{
|
|
||||||
GLint location = getUniformLocation(uniform);
|
|
||||||
|
|
||||||
if (location >= 0)
|
|
||||||
{
|
|
||||||
glUniformMatrix3fvARB(location, count, transpose, v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLGLSLShader::uniformMatrix4fv(const string& uniform, U32 count, GLboolean transpose, const GLfloat* v)
|
|
||||||
{
|
{
|
||||||
GLint location = getUniformLocation(uniform);
|
GLint location = getUniformLocation(uniform);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "llgl.h"
|
#include "llgl.h"
|
||||||
#include "llrender.h"
|
#include "llrender.h"
|
||||||
|
#include "llstaticstringtable.h"
|
||||||
|
|
||||||
class LLShaderFeatures
|
class LLShaderFeatures
|
||||||
{
|
{
|
||||||
@@ -68,6 +69,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
LLGLSLShader(S32 shader_class);
|
LLGLSLShader(S32 shader_class);
|
||||||
|
~LLGLSLShader();
|
||||||
|
|
||||||
static GLhandleARB sCurBoundShader;
|
static GLhandleARB sCurBoundShader;
|
||||||
static LLGLSLShader* sCurBoundShaderPtr;
|
static LLGLSLShader* sCurBoundShaderPtr;
|
||||||
@@ -75,16 +77,16 @@ public:
|
|||||||
static bool sNoFixedFunction;
|
static bool sNoFixedFunction;
|
||||||
|
|
||||||
void unload();
|
void unload();
|
||||||
BOOL createShader(std::vector<std::string> * attributes,
|
BOOL createShader(std::vector<LLStaticHashedString> * attributes,
|
||||||
std::vector<std::string> * uniforms,
|
std::vector<LLStaticHashedString> * uniforms,
|
||||||
U32 varying_count = 0,
|
U32 varying_count = 0,
|
||||||
const char** varyings = NULL);
|
const char** varyings = NULL);
|
||||||
BOOL attachObject(std::string object);
|
BOOL attachObject(std::string object);
|
||||||
void attachObject(GLhandleARB object);
|
void attachObject(GLhandleARB object);
|
||||||
void attachObjects(GLhandleARB* objects = NULL, S32 count = 0);
|
void attachObjects(GLhandleARB* objects = NULL, S32 count = 0);
|
||||||
BOOL mapAttributes(const std::vector<std::string> * attributes);
|
BOOL mapAttributes(const std::vector<LLStaticHashedString> * attributes);
|
||||||
BOOL mapUniforms(const std::vector<std::string> * uniforms);
|
BOOL mapUniforms(const std::vector<LLStaticHashedString> *);
|
||||||
void mapUniform(GLint index, const std::vector<std::string> * uniforms);
|
void mapUniform(GLint index, const std::vector<LLStaticHashedString> *);
|
||||||
void uniform1i(U32 index, GLint i);
|
void uniform1i(U32 index, GLint i);
|
||||||
void uniform1f(U32 index, GLfloat v);
|
void uniform1f(U32 index, GLfloat v);
|
||||||
void uniform2f(U32 index, GLfloat x, GLfloat y);
|
void uniform2f(U32 index, GLfloat x, GLfloat y);
|
||||||
@@ -95,34 +97,35 @@ public:
|
|||||||
void uniform2fv(U32 index, U32 count, const GLfloat* v);
|
void uniform2fv(U32 index, U32 count, const GLfloat* v);
|
||||||
void uniform3fv(U32 index, U32 count, const GLfloat* v);
|
void uniform3fv(U32 index, U32 count, const GLfloat* v);
|
||||||
void uniform4fv(U32 index, U32 count, const GLfloat* v);
|
void uniform4fv(U32 index, U32 count, const GLfloat* v);
|
||||||
void uniform1i(const std::string& uniform, GLint i);
|
void uniform2i(const LLStaticHashedString& uniform, GLint i, GLint j);
|
||||||
void uniform1f(const std::string& uniform, GLfloat v);
|
|
||||||
void uniform2f(const std::string& uniform, GLfloat x, GLfloat y);
|
|
||||||
void uniform3f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z);
|
|
||||||
void uniform4f(const std::string& uniform, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
|
||||||
void uniform1iv(const std::string& uniform, U32 count, const GLint* i);
|
|
||||||
void uniform1fv(const std::string& uniform, U32 count, const GLfloat* v);
|
|
||||||
void uniform2fv(const std::string& uniform, U32 count, const GLfloat* v);
|
|
||||||
void uniform3fv(const std::string& uniform, U32 count, const GLfloat* v);
|
|
||||||
void uniform4fv(const std::string& uniform, U32 count, const GLfloat* v);
|
|
||||||
void uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v);
|
void uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v);
|
||||||
void uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v);
|
void uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v);
|
||||||
void uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v);
|
void uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v);
|
||||||
void uniformMatrix2fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
|
void uniform1i(const LLStaticHashedString& uniform, GLint i);
|
||||||
void uniformMatrix3fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
|
void uniform1f(const LLStaticHashedString& uniform, GLfloat v);
|
||||||
void uniformMatrix4fv(const std::string& uniform, U32 count, GLboolean transpose, const GLfloat *v);
|
void uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y);
|
||||||
|
void uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z);
|
||||||
|
void uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
|
||||||
|
void uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
|
||||||
|
void uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
|
||||||
|
void uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v);
|
||||||
|
void uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat *v);
|
||||||
|
|
||||||
void setMinimumAlpha(F32 minimum);
|
void setMinimumAlpha(F32 minimum);
|
||||||
|
|
||||||
void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
void vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||||
void vertexAttrib4fv(U32 index, GLfloat* v);
|
void vertexAttrib4fv(U32 index, GLfloat* v);
|
||||||
|
|
||||||
GLint getUniformLocation(const std::string& uniform);
|
//GLint getUniformLocation(const std::string& uniform);
|
||||||
|
GLint getUniformLocation(const LLStaticHashedString& uniform);
|
||||||
GLint getUniformLocation(U32 index);
|
GLint getUniformLocation(U32 index);
|
||||||
|
|
||||||
GLint getAttribLocation(U32 attrib);
|
GLint getAttribLocation(U32 attrib);
|
||||||
GLint mapUniformTextureChannel(GLint location, GLenum type);
|
GLint mapUniformTextureChannel(GLint location, GLenum type);
|
||||||
|
|
||||||
|
void addPermutation(std::string name, std::string value);
|
||||||
|
void removePermutation(std::string name);
|
||||||
|
|
||||||
//enable/disable texture channel for specified uniform
|
//enable/disable texture channel for specified uniform
|
||||||
//if given texture uniform is active in the shader,
|
//if given texture uniform is active in the shader,
|
||||||
//the corresponding channel will be active upon return
|
//the corresponding channel will be active upon return
|
||||||
@@ -130,6 +133,13 @@ public:
|
|||||||
S32 enableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
|
S32 enableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
|
||||||
S32 disableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
|
S32 disableTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
|
||||||
|
|
||||||
|
// bindTexture returns the texture unit we've bound the texture to.
|
||||||
|
// You can reuse the return value to unbind a texture when required.
|
||||||
|
S32 bindTexture(const std::string& uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
|
||||||
|
S32 bindTexture(S32 uniform, LLTexture *texture, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
|
||||||
|
S32 unbindTexture(const std::string& uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
|
||||||
|
S32 unbindTexture(S32 uniform, LLTexUnit::eTextureType mode = LLTexUnit::TT_TEXTURE);
|
||||||
|
|
||||||
BOOL link(BOOL suppress_errors = FALSE);
|
BOOL link(BOOL suppress_errors = FALSE);
|
||||||
void bind();
|
void bind();
|
||||||
void unbind();
|
void unbind();
|
||||||
@@ -142,10 +152,13 @@ public:
|
|||||||
|
|
||||||
GLhandleARB mProgramObject;
|
GLhandleARB mProgramObject;
|
||||||
std::vector<GLint> mAttribute; //lookup table of attribute enum to attribute channel
|
std::vector<GLint> mAttribute; //lookup table of attribute enum to attribute channel
|
||||||
|
U32 mAttributeMask; //mask of which reserved attributes are set (lines up with LLVertexBuffer::getTypeMask())
|
||||||
std::vector<GLint> mUniform; //lookup table of uniform enum to uniform location
|
std::vector<GLint> mUniform; //lookup table of uniform enum to uniform location
|
||||||
std::map<std::string, GLint> mUniformMap; //lookup map of uniform name to uniform location
|
LLStaticStringTable<GLint> mUniformMap; //lookup map of uniform name to uniform location
|
||||||
|
std::map<GLint, std::string> mUniformNameMap; //lookup map of uniform location to uniform name
|
||||||
std::map<GLint, LLVector4> mValue; //lookup map of uniform location to last known value
|
std::map<GLint, LLVector4> mValue; //lookup map of uniform location to last known value
|
||||||
std::vector<GLint> mTexture;
|
std::vector<GLint> mTexture;
|
||||||
|
S32 mTotalUniformSize;
|
||||||
S32 mActiveTextureChannels;
|
S32 mActiveTextureChannels;
|
||||||
S32 mShaderClass;
|
S32 mShaderClass;
|
||||||
S32 mShaderLevel;
|
S32 mShaderLevel;
|
||||||
@@ -154,6 +167,7 @@ public:
|
|||||||
LLShaderFeatures mFeatures;
|
LLShaderFeatures mFeatures;
|
||||||
std::vector< std::pair< std::string, GLenum > > mShaderFiles;
|
std::vector< std::pair< std::string, GLenum > > mShaderFiles;
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
std::map<std::string, std::string> mDefines;
|
||||||
};
|
};
|
||||||
|
|
||||||
//UI shader (declared here so llui_libtest will link properly)
|
//UI shader (declared here so llui_libtest will link properly)
|
||||||
|
|||||||
@@ -1099,6 +1099,26 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
|
|||||||
intformat = GL_RGBA8;
|
intformat = GL_RGBA8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pixformat == GL_LUMINANCE && pixtype == GL_UNSIGNED_BYTE)
|
||||||
|
{ //GL_LUMINANCE is deprecated, convert to GL_RGBA
|
||||||
|
use_scratch = true;
|
||||||
|
scratch = new U32[width*height];
|
||||||
|
|
||||||
|
U32 pixel_count = (U32) (width*height);
|
||||||
|
for (U32 i = 0; i < pixel_count; i++)
|
||||||
|
{
|
||||||
|
U8 lum = ((U8*) pixels)[i];
|
||||||
|
|
||||||
|
U8* pix = (U8*) &scratch[i];
|
||||||
|
pix[0] = pix[1] = pix[2] = lum;
|
||||||
|
pix[3] = 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixformat = GL_RGBA;
|
||||||
|
intformat = GL_RGBA8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE)
|
if (pixformat == GL_LUMINANCE_ALPHA && pixtype == GL_UNSIGNED_BYTE)
|
||||||
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
|
{ //GL_LUMINANCE_ALPHA is deprecated, convert to RGBA
|
||||||
use_scratch = true;
|
use_scratch = true;
|
||||||
|
|||||||
@@ -51,6 +51,28 @@ extern LLGLSLShader gPostPosterizeProgram;
|
|||||||
extern LLGLSLShader gPostMotionBlurProgram;
|
extern LLGLSLShader gPostMotionBlurProgram;
|
||||||
extern LLGLSLShader gPostVignetteProgram;
|
extern LLGLSLShader gPostVignetteProgram;
|
||||||
|
|
||||||
|
static LLStaticHashedString sGamma("gamma");
|
||||||
|
static LLStaticHashedString sBrightness("brightness");
|
||||||
|
static LLStaticHashedString sContrast("contrast");
|
||||||
|
static LLStaticHashedString sContrastBase("contrastBase");
|
||||||
|
static LLStaticHashedString sSaturation("saturation");
|
||||||
|
static LLStaticHashedString sBrightMult("brightMult");
|
||||||
|
static LLStaticHashedString sNoiseStrength("noiseStrength");
|
||||||
|
static LLStaticHashedString sLayerCount("layerCount");
|
||||||
|
|
||||||
|
static LLStaticHashedString sVignetteStrength("vignette_strength");
|
||||||
|
static LLStaticHashedString sVignettRadius("vignette_radius");
|
||||||
|
static LLStaticHashedString sVignetteDarkness("vignette_darkness");
|
||||||
|
static LLStaticHashedString sVignetteDesaturation("vignette_desaturation");
|
||||||
|
static LLStaticHashedString sVignetteChromaticAberration("vignette_chromatic_aberration");
|
||||||
|
static LLStaticHashedString sScreenRes("screen_res");
|
||||||
|
|
||||||
|
static LLStaticHashedString sHorizontalPass("horizontalPass");
|
||||||
|
|
||||||
|
static LLStaticHashedString sPrevProj("prev_proj");
|
||||||
|
static LLStaticHashedString sInvProj("inv_proj");
|
||||||
|
static LLStaticHashedString sBlurStrength("blur_strength");
|
||||||
|
|
||||||
static const unsigned int NOISE_SIZE = 512;
|
static const unsigned int NOISE_SIZE = 512;
|
||||||
|
|
||||||
static const char * const XML_FILENAME = "postprocesseffects.xml";
|
static const char * const XML_FILENAME = "postprocesseffects.xml";
|
||||||
@@ -155,16 +177,16 @@ public:
|
|||||||
|
|
||||||
/*virtual*/ QuadType preDraw()
|
/*virtual*/ QuadType preDraw()
|
||||||
{
|
{
|
||||||
getShader().uniform1f("gamma", mGamma);
|
getShader().uniform1f(sGamma, mGamma);
|
||||||
getShader().uniform1f("brightness", mBrightness);
|
getShader().uniform1f(sBrightness, mBrightness);
|
||||||
getShader().uniform1f("contrast", mContrast);
|
getShader().uniform1f(sContrast, mContrast);
|
||||||
float baseI = (mContrastBase.get()[VX] + mContrastBase.get()[VY] + mContrastBase.get()[VZ]) / 3.0f;
|
float baseI = (mContrastBase.get()[VX] + mContrastBase.get()[VY] + mContrastBase.get()[VZ]) / 3.0f;
|
||||||
baseI = mContrastBase.get()[VW] / llmax(baseI,0.001f);
|
baseI = mContrastBase.get()[VW] / llmax(baseI,0.001f);
|
||||||
float baseR = mContrastBase.get()[VX] * baseI;
|
float baseR = mContrastBase.get()[VX] * baseI;
|
||||||
float baseG = mContrastBase.get()[VY] * baseI;
|
float baseG = mContrastBase.get()[VY] * baseI;
|
||||||
float baseB = mContrastBase.get()[VZ] * baseI;
|
float baseB = mContrastBase.get()[VZ] * baseI;
|
||||||
getShader().uniform3fv("contrastBase", 1, LLVector3(baseR, baseG, baseB).mV);
|
getShader().uniform3fv(sContrastBase, 1, LLVector3(baseR, baseG, baseB).mV);
|
||||||
getShader().uniform1f("saturation", mSaturation);
|
getShader().uniform1f(sSaturation, mSaturation);
|
||||||
|
|
||||||
return QUAD_NORMAL;
|
return QUAD_NORMAL;
|
||||||
}
|
}
|
||||||
@@ -187,8 +209,8 @@ public:
|
|||||||
{
|
{
|
||||||
LLPostProcess::getInstance()->bindNoise(1);
|
LLPostProcess::getInstance()->bindNoise(1);
|
||||||
|
|
||||||
getShader().uniform1f("brightMult", mBrightnessMult);
|
getShader().uniform1f(sBrightMult, mBrightnessMult);
|
||||||
getShader().uniform1f("noiseStrength", mNoiseStrength);
|
getShader().uniform1f(sNoiseStrength, mNoiseStrength);
|
||||||
|
|
||||||
return QUAD_NOISE;
|
return QUAD_NOISE;
|
||||||
}
|
}
|
||||||
@@ -206,7 +228,7 @@ public:
|
|||||||
}
|
}
|
||||||
/*virtual*/ QuadType preDraw()
|
/*virtual*/ QuadType preDraw()
|
||||||
{
|
{
|
||||||
getShader().uniform1i("layerCount", mNumLayers);
|
getShader().uniform1i(sLayerCount, mNumLayers);
|
||||||
return QUAD_NORMAL;
|
return QUAD_NORMAL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -232,12 +254,13 @@ public:
|
|||||||
/*virtual*/ QuadType preDraw()
|
/*virtual*/ QuadType preDraw()
|
||||||
{
|
{
|
||||||
LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions();
|
LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions();
|
||||||
getShader().uniform1f("vignette_strength", mStrength);
|
|
||||||
getShader().uniform1f("vignette_radius", mRadius);
|
getShader().uniform1f(sVignetteStrength, mStrength);
|
||||||
getShader().uniform1f("vignette_darkness", mDarkness);
|
getShader().uniform1f(sVignettRadius, mRadius);
|
||||||
getShader().uniform1f("vignette_desaturation", mDesaturation);
|
getShader().uniform1f(sVignetteDarkness, mDarkness);
|
||||||
getShader().uniform1f("vignette_chromatic_aberration", mChromaticAberration);
|
getShader().uniform1f(sVignetteDesaturation, mDesaturation);
|
||||||
getShader().uniform2fv("screen_res", 1, screen_rect.mV);
|
getShader().uniform1f(sVignetteChromaticAberration, mChromaticAberration);
|
||||||
|
getShader().uniform2fv(sScreenRes, 1, screen_rect.mV);
|
||||||
return QUAD_NORMAL;
|
return QUAD_NORMAL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -259,7 +282,7 @@ public:
|
|||||||
/*virtual*/ S32 getDepthChannel() const { return -1; }
|
/*virtual*/ S32 getDepthChannel() const { return -1; }
|
||||||
/*virtual*/ QuadType preDraw()
|
/*virtual*/ QuadType preDraw()
|
||||||
{
|
{
|
||||||
mPassLoc = getShader().getUniformLocation("horizontalPass");
|
mPassLoc = getShader().getUniformLocation(sHorizontalPass);
|
||||||
return QUAD_NORMAL;
|
return QUAD_NORMAL;
|
||||||
}
|
}
|
||||||
/*virtual*/ bool draw(U32 pass)
|
/*virtual*/ bool draw(U32 pass)
|
||||||
@@ -295,10 +318,10 @@ public:
|
|||||||
|
|
||||||
LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions();
|
LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions();
|
||||||
|
|
||||||
getShader().uniformMatrix4fv("prev_proj", 1, GL_FALSE, prev_proj.m);
|
getShader().uniformMatrix4fv(sPrevProj, 1, GL_FALSE, prev_proj.m);
|
||||||
getShader().uniformMatrix4fv("inv_proj", 1, GL_FALSE, inv_proj.m);
|
getShader().uniformMatrix4fv(sInvProj, 1, GL_FALSE, inv_proj.m);
|
||||||
getShader().uniform2fv("screen_res", 1, screen_rect.mV);
|
getShader().uniform2fv(sScreenRes, 1, screen_rect.mV);
|
||||||
getShader().uniform1i("blur_strength", mStrength);
|
getShader().uniform1i(sBlurStrength, mStrength);
|
||||||
|
|
||||||
return QUAD_NORMAL;
|
return QUAD_NORMAL;
|
||||||
}
|
}
|
||||||
@@ -312,7 +335,7 @@ public:
|
|||||||
LLPostProcess::LLPostProcess(void) :
|
LLPostProcess::LLPostProcess(void) :
|
||||||
mVBO(NULL),
|
mVBO(NULL),
|
||||||
mDepthTexture(0),
|
mDepthTexture(0),
|
||||||
mNoiseTexture(NULL),
|
mNoiseTexture(0),
|
||||||
mScreenWidth(0),
|
mScreenWidth(0),
|
||||||
mScreenHeight(0),
|
mScreenHeight(0),
|
||||||
mNoiseTextureScale(0.f),
|
mNoiseTextureScale(0.f),
|
||||||
@@ -407,7 +430,10 @@ void LLPostProcess::createScreenTextures()
|
|||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
if(mDepthTexture)
|
if(mDepthTexture)
|
||||||
|
{
|
||||||
LLImageGL::deleteTextures(1, &mDepthTexture);
|
LLImageGL::deleteTextures(1, &mDepthTexture);
|
||||||
|
mDepthTexture = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
for(std::list<LLPointer<LLPostProcessShader> >::iterator it=mShaders.begin();it!=mShaders.end();++it)
|
||||||
{
|
{
|
||||||
@@ -434,16 +460,25 @@ void LLPostProcess::createNoiseTexture()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mNoiseTexture = new LLImageGL(FALSE) ;
|
if(mNoiseTexture)
|
||||||
if(mNoiseTexture->createGLTexture())
|
|
||||||
{
|
{
|
||||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseTexture->getTexName());
|
LLImageGL::deleteTextures(1, &mNoiseTexture);
|
||||||
LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RED, NOISE_SIZE, NOISE_SIZE, GL_RED, GL_UNSIGNED_BYTE, &buffer[0]);
|
mNoiseTexture = 0;
|
||||||
stop_glerror();
|
|
||||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
|
||||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
|
|
||||||
stop_glerror();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLImageGL::generateTextures(1, &mNoiseTexture);
|
||||||
|
stop_glerror();
|
||||||
|
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseTexture);
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
|
if(gGLManager.mGLVersion >= 4.f)
|
||||||
|
LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_R8, NOISE_SIZE, NOISE_SIZE, GL_RED, GL_UNSIGNED_BYTE, &buffer[0], false);
|
||||||
|
else
|
||||||
|
LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE8, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0], false);
|
||||||
|
stop_glerror();
|
||||||
|
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||||
|
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
|
||||||
|
stop_glerror();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPostProcess::destroyGL()
|
void LLPostProcess::destroyGL()
|
||||||
@@ -453,7 +488,9 @@ void LLPostProcess::destroyGL()
|
|||||||
if(mDepthTexture)
|
if(mDepthTexture)
|
||||||
LLImageGL::deleteTextures(1, &mDepthTexture);
|
LLImageGL::deleteTextures(1, &mDepthTexture);
|
||||||
mDepthTexture=0;
|
mDepthTexture=0;
|
||||||
mNoiseTexture = NULL ;
|
if(mNoiseTexture)
|
||||||
|
LLImageGL::deleteTextures(1, &mNoiseTexture);
|
||||||
|
mNoiseTexture=0 ;
|
||||||
mVBO = NULL ;
|
mVBO = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,6 +504,7 @@ void LLPostProcess::copyFrameBuffer()
|
|||||||
{
|
{
|
||||||
mRenderTarget[!!mRenderTarget[0].getFBO()].bindTexture(0,0);
|
mRenderTarget[!!mRenderTarget[0].getFBO()].bindTexture(0,0);
|
||||||
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
||||||
|
stop_glerror();
|
||||||
|
|
||||||
if(mDepthTexture)
|
if(mDepthTexture)
|
||||||
{
|
{
|
||||||
@@ -476,6 +514,7 @@ void LLPostProcess::copyFrameBuffer()
|
|||||||
{
|
{
|
||||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture);
|
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture);
|
||||||
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
||||||
|
stop_glerror();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -485,7 +524,7 @@ void LLPostProcess::copyFrameBuffer()
|
|||||||
|
|
||||||
void LLPostProcess::bindNoise(U32 channel)
|
void LLPostProcess::bindNoise(U32 channel)
|
||||||
{
|
{
|
||||||
gGL.getTexUnit(channel)->bind(mNoiseTexture);
|
gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE,mNoiseTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPostProcess::renderEffects(unsigned int width, unsigned int height)
|
void LLPostProcess::renderEffects(unsigned int width, unsigned int height)
|
||||||
@@ -508,8 +547,7 @@ void LLPostProcess::doEffects(void)
|
|||||||
{
|
{
|
||||||
LLVertexBuffer::unbind();
|
LLVertexBuffer::unbind();
|
||||||
|
|
||||||
mNoiseTextureScale = 0.001f + ((100.f - mSelectedEffectInfo["noise_size"].asFloat()) / 100.f);
|
mNoiseTextureScale = (1.f - (mSelectedEffectInfo["noise_size"].asFloat() - 1.f) *(9.f/990.f)) / (float)NOISE_SIZE;
|
||||||
mNoiseTextureScale *= (mScreenHeight / NOISE_SIZE);
|
|
||||||
|
|
||||||
/// Copy the screen buffer to the render texture
|
/// Copy the screen buffer to the render texture
|
||||||
copyFrameBuffer();
|
copyFrameBuffer();
|
||||||
@@ -562,13 +600,19 @@ void LLPostProcess::applyShaders(void)
|
|||||||
QuadType quad = (*it)->preDraw();
|
QuadType quad = (*it)->preDraw();
|
||||||
while((*it)->draw(pass++))
|
while((*it)->draw(pass++))
|
||||||
{
|
{
|
||||||
mRenderTarget[!primary_rendertarget].bindTarget();
|
LLRenderTarget& write_target = mRenderTarget[!primary_rendertarget];
|
||||||
|
LLRenderTarget& read_target = mRenderTarget[mRenderTarget[0].getFBO() ? primary_rendertarget : !primary_rendertarget];
|
||||||
|
write_target.bindTarget();
|
||||||
|
|
||||||
if(color_channel >= 0)
|
if(color_channel >= 0)
|
||||||
mRenderTarget[mRenderTarget[0].getFBO() ? primary_rendertarget : !primary_rendertarget].bindTexture(0,color_channel);
|
read_target.bindTexture(0,color_channel);
|
||||||
|
|
||||||
drawOrthoQuad(quad);
|
drawOrthoQuad(quad);
|
||||||
mRenderTarget[!primary_rendertarget].flush();
|
|
||||||
|
if(color_channel >= 0 && !mRenderTarget[0].getFBO())
|
||||||
|
gGL.getTexUnit(color_channel)->unbind(read_target.getUsage());
|
||||||
|
|
||||||
|
write_target.flush();
|
||||||
if(mRenderTarget[0].getFBO())
|
if(mRenderTarget[0].getFBO())
|
||||||
primary_rendertarget = !primary_rendertarget;
|
primary_rendertarget = !primary_rendertarget;
|
||||||
}
|
}
|
||||||
@@ -593,8 +637,13 @@ void LLPostProcess::drawOrthoQuad(QuadType type)
|
|||||||
LLStrider<LLVector2> uv2;
|
LLStrider<LLVector2> uv2;
|
||||||
mVBO->getTexCoord1Strider(uv2);
|
mVBO->getTexCoord1Strider(uv2);
|
||||||
|
|
||||||
float offs[2] = {(float) rand() / (float) RAND_MAX, (float) rand() / (float) RAND_MAX};
|
float offs[2] = {
|
||||||
float scale[2] = {mScreenWidth * mNoiseTextureScale / mScreenHeight, mNoiseTextureScale};
|
llround(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE),
|
||||||
|
llround(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE) };
|
||||||
|
float scale[2] = {
|
||||||
|
(float)mScreenWidth * mNoiseTextureScale,
|
||||||
|
(float)mScreenHeight * mNoiseTextureScale };
|
||||||
|
|
||||||
uv2[0] = LLVector2(offs[0],offs[1]);
|
uv2[0] = LLVector2(offs[0],offs[1]);
|
||||||
uv2[1] = LLVector2(offs[0],offs[1]+scale[1]);
|
uv2[1] = LLVector2(offs[0],offs[1]+scale[1]);
|
||||||
uv2[2] = LLVector2(offs[0]+scale[0],offs[1]);
|
uv2[2] = LLVector2(offs[0]+scale[0],offs[1]);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ private:
|
|||||||
// However this is ONLY the case if fbos are actually supported, else swapping isn't needed.
|
// However this is ONLY the case if fbos are actually supported, else swapping isn't needed.
|
||||||
LLRenderTarget mRenderTarget[2];
|
LLRenderTarget mRenderTarget[2];
|
||||||
U32 mDepthTexture;
|
U32 mDepthTexture;
|
||||||
LLPointer<LLImageGL> mNoiseTexture ;
|
U32 mNoiseTexture ;
|
||||||
|
|
||||||
U32 mScreenWidth;
|
U32 mScreenWidth;
|
||||||
U32 mScreenHeight;
|
U32 mScreenHeight;
|
||||||
|
|||||||
@@ -1496,7 +1496,7 @@ void LLRender::translateUI(F32 x, F32 y, F32 z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLVector4a add(x,y,z);
|
LLVector4a add(x,y,z);
|
||||||
mUIOffset.back()->add(add);
|
mUIOffset.back().add(add);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLRender::scaleUI(F32 x, F32 y, F32 z)
|
void LLRender::scaleUI(F32 x, F32 y, F32 z)
|
||||||
@@ -1507,33 +1507,27 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLVector4a scale(x,y,z);
|
LLVector4a scale(x,y,z);
|
||||||
mUIScale.back()->mul(scale);
|
mUIScale.back().mul(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLRender::pushUIMatrix()
|
void LLRender::pushUIMatrix()
|
||||||
{
|
{
|
||||||
if (mUIOffset.empty())
|
if (mUIOffset.empty())
|
||||||
{
|
{
|
||||||
mUIOffset.push_back(static_cast<LLVector4a*>(ll_aligned_malloc_16(sizeof(LLVector4a))));
|
mUIOffset.push_back(LLVector4a(0.f));
|
||||||
mUIOffset.back()->splat(0.f);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const LLVector4a* last_entry = mUIOffset.back();
|
mUIOffset.push_back(mUIOffset.back());
|
||||||
mUIOffset.push_back(static_cast<LLVector4a*>(ll_aligned_malloc_16(sizeof(LLVector4a))));
|
|
||||||
*mUIOffset.back() = *last_entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mUIScale.empty())
|
if (mUIScale.empty())
|
||||||
{
|
{
|
||||||
mUIScale.push_back(static_cast<LLVector4a*>(ll_aligned_malloc_16(sizeof(LLVector4a))));
|
mUIScale.push_back(LLVector4a(1.f));
|
||||||
mUIScale.back()->splat(1.f);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const LLVector4a* last_entry = mUIScale.back();
|
mUIScale.push_back(mUIScale.back());
|
||||||
mUIScale.push_back(static_cast<LLVector4a*>(ll_aligned_malloc_16(sizeof(LLVector4a))));
|
|
||||||
*mUIScale.back() = *last_entry;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1543,9 +1537,7 @@ void LLRender::popUIMatrix()
|
|||||||
{
|
{
|
||||||
llerrs << "UI offset stack blown." << llendl;
|
llerrs << "UI offset stack blown." << llendl;
|
||||||
}
|
}
|
||||||
ll_aligned_free_16(mUIOffset.back());
|
|
||||||
mUIOffset.pop_back();
|
mUIOffset.pop_back();
|
||||||
ll_aligned_free_16(mUIScale.back());
|
|
||||||
mUIScale.pop_back();
|
mUIScale.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1555,7 +1547,7 @@ LLVector3 LLRender::getUITranslation()
|
|||||||
{
|
{
|
||||||
return LLVector3(0,0,0);
|
return LLVector3(0,0,0);
|
||||||
}
|
}
|
||||||
return LLVector3(mUIOffset.back()->getF32ptr());
|
return LLVector3(mUIOffset.back().getF32ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVector3 LLRender::getUIScale()
|
LLVector3 LLRender::getUIScale()
|
||||||
@@ -1564,7 +1556,7 @@ LLVector3 LLRender::getUIScale()
|
|||||||
{
|
{
|
||||||
return LLVector3(1,1,1);
|
return LLVector3(1,1,1);
|
||||||
}
|
}
|
||||||
return LLVector3(mUIScale.back()->getF32ptr());
|
return LLVector3(mUIScale.back().getF32ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1574,8 +1566,8 @@ void LLRender::loadUIIdentity()
|
|||||||
{
|
{
|
||||||
llerrs << "Need to push UI translation frame before clearing offset." << llendl;
|
llerrs << "Need to push UI translation frame before clearing offset." << llendl;
|
||||||
}
|
}
|
||||||
mUIOffset.back()->splat(0.f);
|
mUIOffset.back().splat(0.f);
|
||||||
mUIScale.back()->splat(1.f);
|
mUIScale.back().splat(1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLRender::setColorMask(bool writeColor, bool writeAlpha)
|
void LLRender::setColorMask(bool writeColor, bool writeAlpha)
|
||||||
@@ -1977,8 +1969,8 @@ void LLRender::vertex4a(const LLVector4a& vertex)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
|
//LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
|
||||||
mVerticesp[mCount].setAdd(vertex,*mUIOffset.back());
|
mVerticesp[mCount].setAdd(vertex,mUIOffset.back());
|
||||||
mVerticesp[mCount].mul(*mUIScale.back());
|
mVerticesp[mCount].mul(mUIScale.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
|
if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "v3math.h"
|
#include "v3math.h"
|
||||||
#include "v4coloru.h"
|
#include "v4coloru.h"
|
||||||
#include "v4math.h"
|
#include "v4math.h"
|
||||||
|
#include "llalignedarray.h"
|
||||||
#include "llstrider.h"
|
#include "llstrider.h"
|
||||||
#include "llpointer.h"
|
#include "llpointer.h"
|
||||||
#include "llglheaders.h"
|
#include "llglheaders.h"
|
||||||
@@ -466,9 +467,8 @@ private:
|
|||||||
|
|
||||||
F32 mMaxAnisotropy;
|
F32 mMaxAnisotropy;
|
||||||
|
|
||||||
std::vector<LLVector4a*> mUIOffset;
|
LLAlignedArray<LLVector4a, 64> mUIOffset;
|
||||||
std::vector<LLVector4a*> mUIScale;
|
LLAlignedArray<LLVector4a, 64> mUIScale;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern F32 gGLModelView[16];
|
extern F32 gGLModelView[16];
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ LLRenderTarget::~LLRenderTarget()
|
|||||||
release();
|
release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt)
|
void LLRenderTarget::resize(U32 resx, U32 resy)
|
||||||
{
|
{
|
||||||
//for accounting, get the number of pixels added/subtracted
|
//for accounting, get the number of pixels added/subtracted
|
||||||
S32 pix_diff = (resx*resy)-(mResX*mResY);
|
S32 pix_diff = (resx*resy)-(mResX*mResY);
|
||||||
@@ -80,10 +80,12 @@ void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt)
|
|||||||
mResX = resx;
|
mResX = resx;
|
||||||
mResY = resy;
|
mResY = resy;
|
||||||
|
|
||||||
|
llassert(mInternalFormat.size() == mTex.size());
|
||||||
|
|
||||||
for (U32 i = 0; i < mTex.size(); ++i)
|
for (U32 i = 0; i < mTex.size(); ++i)
|
||||||
{ //resize color attachments
|
{ //resize color attachments
|
||||||
gGL.getTexUnit(0)->bindManual(mUsage, mTex[i]);
|
gGL.getTexUnit(0)->bindManual(mUsage, mTex[i]);
|
||||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false);
|
LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, mInternalFormat[i], mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false);
|
||||||
sBytesAllocated += pix_diff*4;
|
sBytesAllocated += pix_diff*4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public:
|
|||||||
// CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined
|
// CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined
|
||||||
// DO NOT use for screen space buffers or for scratch space for an image that might be uploaded
|
// DO NOT use for screen space buffers or for scratch space for an image that might be uploaded
|
||||||
// DO use for render targets that resize often and aren't likely to ruin someone's day if they break
|
// DO use for render targets that resize often and aren't likely to ruin someone's day if they break
|
||||||
void resize(U32 resx, U32 resy, U32 color_fmt);
|
void resize(U32 resx, U32 resy);
|
||||||
|
|
||||||
//provide this render target with a multisample resource.
|
//provide this render target with a multisample resource.
|
||||||
void setSampleBuffer(LLMultisampleBuffer* buffer);
|
void setSampleBuffer(LLMultisampleBuffer* buffer);
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, S32 texture_index_channels)
|
GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map<std::string, std::string>* defines, S32 texture_index_channels)
|
||||||
{
|
{
|
||||||
std::pair<std::multimap<std::string, CachedObjectInfo >::iterator, std::multimap<std::string, CachedObjectInfo>::iterator> range;
|
std::pair<std::multimap<std::string, CachedObjectInfo >::iterator, std::multimap<std::string, CachedObjectInfo>::iterator> range;
|
||||||
range = mShaderObjects.equal_range(filename);
|
range = mShaderObjects.equal_range(filename);
|
||||||
@@ -669,12 +669,14 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||||||
if(SHPackDeferredNormals)
|
if(SHPackDeferredNormals)
|
||||||
text[count++] = strdup("#define PACK_NORMALS\n");
|
text[count++] = strdup("#define PACK_NORMALS\n");
|
||||||
|
|
||||||
//copy preprocessor definitions into buffer
|
if(defines)
|
||||||
for (std::map<std::string,std::string>::iterator iter = mDefinitions.begin(); iter != mDefinitions.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)
|
||||||
{
|
{
|
||||||
@@ -924,7 +926,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||||||
if (shader_level > 1)
|
if (shader_level > 1)
|
||||||
{
|
{
|
||||||
shader_level--;
|
shader_level--;
|
||||||
return loadShaderFile(filename,shader_level,type,texture_index_channels);
|
return loadShaderFile(filename,shader_level,type, defines, texture_index_channels);
|
||||||
}
|
}
|
||||||
LL_WARNS("ShaderLoading") << "Failed to load " << filename << LL_ENDL;
|
LL_WARNS("ShaderLoading") << "Failed to load " << filename << LL_ENDL;
|
||||||
}
|
}
|
||||||
@@ -1044,7 +1046,9 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||||||
mReservedUniforms.push_back("texture_matrix1");
|
mReservedUniforms.push_back("texture_matrix1");
|
||||||
mReservedUniforms.push_back("texture_matrix2");
|
mReservedUniforms.push_back("texture_matrix2");
|
||||||
mReservedUniforms.push_back("texture_matrix3");
|
mReservedUniforms.push_back("texture_matrix3");
|
||||||
llassert(mReservedUniforms.size() == LLShaderMgr::TEXTURE_MATRIX3+1);
|
mReservedUniforms.push_back("object_plane_s");
|
||||||
|
mReservedUniforms.push_back("object_plane_t");
|
||||||
|
llassert(mReservedUniforms.size() == LLShaderMgr::OBJECT_PLANE_T+1);
|
||||||
|
|
||||||
mReservedUniforms.push_back("viewport");
|
mReservedUniforms.push_back("viewport");
|
||||||
|
|
||||||
@@ -1185,7 +1189,47 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||||||
mReservedUniforms.push_back("lightMap");
|
mReservedUniforms.push_back("lightMap");
|
||||||
mReservedUniforms.push_back("bloomMap");
|
mReservedUniforms.push_back("bloomMap");
|
||||||
mReservedUniforms.push_back("projectionMap");
|
mReservedUniforms.push_back("projectionMap");
|
||||||
|
mReservedUniforms.push_back("norm_mat");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("matrixPalette");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("screenTex");
|
||||||
|
mReservedUniforms.push_back("screenDepth");
|
||||||
|
mReservedUniforms.push_back("refTex");
|
||||||
|
mReservedUniforms.push_back("eyeVec");
|
||||||
|
mReservedUniforms.push_back("time");
|
||||||
|
mReservedUniforms.push_back("d1");
|
||||||
|
mReservedUniforms.push_back("d2");
|
||||||
|
mReservedUniforms.push_back("lightDir");
|
||||||
|
mReservedUniforms.push_back("specular");
|
||||||
|
mReservedUniforms.push_back("lightExp");
|
||||||
|
mReservedUniforms.push_back("waterFogColor");
|
||||||
|
mReservedUniforms.push_back("waterFogDensity");
|
||||||
|
mReservedUniforms.push_back("waterFogKS");
|
||||||
|
mReservedUniforms.push_back("refScale");
|
||||||
|
mReservedUniforms.push_back("waterHeight");
|
||||||
|
mReservedUniforms.push_back("waterPlane");
|
||||||
|
mReservedUniforms.push_back("normScale");
|
||||||
|
mReservedUniforms.push_back("fresnelScale");
|
||||||
|
mReservedUniforms.push_back("fresnelOffset");
|
||||||
|
mReservedUniforms.push_back("blurMultiplier");
|
||||||
|
mReservedUniforms.push_back("sunAngle");
|
||||||
|
mReservedUniforms.push_back("scaledAngle");
|
||||||
|
mReservedUniforms.push_back("sunAngle2");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("camPosLocal");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("gWindDir");
|
||||||
|
mReservedUniforms.push_back("gSinWaveParams");
|
||||||
|
mReservedUniforms.push_back("gGravity");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("detail_0");
|
||||||
|
mReservedUniforms.push_back("detail_1");
|
||||||
|
mReservedUniforms.push_back("detail_2");
|
||||||
|
mReservedUniforms.push_back("detail_3");
|
||||||
|
mReservedUniforms.push_back("alpha_ramp");
|
||||||
|
|
||||||
|
mReservedUniforms.push_back("origin");
|
||||||
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
|
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
|
||||||
|
|
||||||
std::set<std::string> dupe_check;
|
std::set<std::string> dupe_check;
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public:
|
|||||||
TEXTURE_MATRIX1,
|
TEXTURE_MATRIX1,
|
||||||
TEXTURE_MATRIX2,
|
TEXTURE_MATRIX2,
|
||||||
TEXTURE_MATRIX3,
|
TEXTURE_MATRIX3,
|
||||||
|
OBJECT_PLANE_S,
|
||||||
|
OBJECT_PLANE_T,
|
||||||
VIEWPORT,
|
VIEWPORT,
|
||||||
LIGHT_POSITION,
|
LIGHT_POSITION,
|
||||||
LIGHT_DIRECTION,
|
LIGHT_DIRECTION,
|
||||||
@@ -164,6 +166,45 @@ public:
|
|||||||
DEFERRED_LIGHT,
|
DEFERRED_LIGHT,
|
||||||
DEFERRED_BLOOM,
|
DEFERRED_BLOOM,
|
||||||
DEFERRED_PROJECTION,
|
DEFERRED_PROJECTION,
|
||||||
|
DEFERRED_NORM_MATRIX,
|
||||||
|
|
||||||
|
AVATAR_MATRIX,
|
||||||
|
WATER_SCREENTEX,
|
||||||
|
WATER_SCREENDEPTH,
|
||||||
|
WATER_REFTEX,
|
||||||
|
WATER_EYEVEC,
|
||||||
|
WATER_TIME,
|
||||||
|
WATER_WAVE_DIR1,
|
||||||
|
WATER_WAVE_DIR2,
|
||||||
|
WATER_LIGHT_DIR,
|
||||||
|
WATER_SPECULAR,
|
||||||
|
WATER_SPECULAR_EXP,
|
||||||
|
WATER_FOGCOLOR,
|
||||||
|
WATER_FOGDENSITY,
|
||||||
|
WATER_FOGKS,
|
||||||
|
WATER_REFSCALE,
|
||||||
|
WATER_WATERHEIGHT,
|
||||||
|
WATER_WATERPLANE,
|
||||||
|
WATER_NORM_SCALE,
|
||||||
|
WATER_FRESNEL_SCALE,
|
||||||
|
WATER_FRESNEL_OFFSET,
|
||||||
|
WATER_BLUR_MULTIPLIER,
|
||||||
|
WATER_SUN_ANGLE,
|
||||||
|
WATER_SCALED_ANGLE,
|
||||||
|
WATER_SUN_ANGLE2,
|
||||||
|
|
||||||
|
WL_CAMPOSLOCAL,
|
||||||
|
|
||||||
|
AVATAR_WIND,
|
||||||
|
AVATAR_SINWAVE,
|
||||||
|
AVATAR_GRAVITY,
|
||||||
|
|
||||||
|
TERRAIN_DETAIL0,
|
||||||
|
TERRAIN_DETAIL1,
|
||||||
|
TERRAIN_DETAIL2,
|
||||||
|
TERRAIN_DETAIL3,
|
||||||
|
TERRAIN_ALPHARAMP,
|
||||||
|
SHINY_ORIGIN,
|
||||||
END_RESERVED_UNIFORMS
|
END_RESERVED_UNIFORMS
|
||||||
} eGLSLReservedUniforms;
|
} eGLSLReservedUniforms;
|
||||||
|
|
||||||
@@ -176,7 +217,7 @@ public:
|
|||||||
void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE);
|
void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE);
|
||||||
BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
|
BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
|
||||||
BOOL validateProgramObject(GLhandleARB obj);
|
BOOL validateProgramObject(GLhandleARB obj);
|
||||||
GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, S32 texture_index_channels = -1);
|
GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1);
|
||||||
|
|
||||||
// Implemented in the application to actually point to the shader directory.
|
// Implemented in the application to actually point to the shader directory.
|
||||||
virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual
|
virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual
|
||||||
|
|||||||
@@ -207,9 +207,6 @@ public:
|
|||||||
void setImageFlash(LLPointer<LLUIImage> image);
|
void setImageFlash(LLPointer<LLUIImage> image);
|
||||||
void setImagePressed(LLPointer<LLUIImage> image);
|
void setImagePressed(LLPointer<LLUIImage> image);
|
||||||
|
|
||||||
void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
|
|
||||||
BOOL getCommitOnReturn() const { return mCommitOnReturn; }
|
|
||||||
|
|
||||||
static void onHeldDown(void *userdata); // to be called by gIdleCallbacks
|
static void onHeldDown(void *userdata); // to be called by gIdleCallbacks
|
||||||
void setHelpURLCallback(const std::string &help_url);
|
void setHelpURLCallback(const std::string &help_url);
|
||||||
const std::string& getHelpURL() const { return mHelpURL; }
|
const std::string& getHelpURL() const { return mHelpURL; }
|
||||||
|
|||||||
@@ -159,8 +159,12 @@ void LLPanel::addBorder(LLViewBorder::EBevel border_bevel,
|
|||||||
|
|
||||||
void LLPanel::removeBorder()
|
void LLPanel::removeBorder()
|
||||||
{
|
{
|
||||||
delete mBorder;
|
if (mBorder)
|
||||||
mBorder = NULL;
|
{
|
||||||
|
removeChild(mBorder);
|
||||||
|
delete mBorder;
|
||||||
|
mBorder = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -277,7 +281,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
|
|||||||
// handle user hitting ESC to defocus
|
// handle user hitting ESC to defocus
|
||||||
if (key == KEY_ESCAPE && mask == MASK_NONE)
|
if (key == KEY_ESCAPE && mask == MASK_NONE)
|
||||||
{
|
{
|
||||||
gFocusMgr.setKeyboardFocus(NULL);
|
setFocus(FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if( (mask == MASK_SHIFT) && (KEY_TAB == key))
|
else if( (mask == MASK_SHIFT) && (KEY_TAB == key))
|
||||||
@@ -304,29 +308,25 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have a default button, click it when
|
// If RETURN was pressed and something has focus, call onCommit()
|
||||||
// return is pressed, unless current focus is a return-capturing button
|
if (!handled && cur_focus && key == KEY_RETURN && mask == MASK_NONE)
|
||||||
// in which case *that* button will handle the return key
|
|
||||||
LLButton* focused_button = dynamic_cast<LLButton*>(cur_focus);
|
|
||||||
if (cur_focus && !(focused_button && focused_button->getCommitOnReturn()))
|
|
||||||
{
|
{
|
||||||
// RETURN key means hit default button in this case
|
if (cur_focus->getCommitOnReturn())
|
||||||
if (key == KEY_RETURN && mask == MASK_NONE
|
|
||||||
&& mDefaultBtn != NULL
|
|
||||||
&& mDefaultBtn->getVisible()
|
|
||||||
&& mDefaultBtn->getEnabled())
|
|
||||||
{
|
{
|
||||||
|
// current focus is a return-capturing element,
|
||||||
|
// let *that* element handle the return key
|
||||||
|
handled = FALSE;
|
||||||
|
}
|
||||||
|
else if (mDefaultBtn && mDefaultBtn->getVisible() && mDefaultBtn->getEnabled())
|
||||||
|
{
|
||||||
|
// If we have a default button, click it when return is pressed
|
||||||
mDefaultBtn->onCommit();
|
mDefaultBtn->onCommit();
|
||||||
handled = TRUE;
|
handled = TRUE;
|
||||||
}
|
}
|
||||||
}
|
else if (cur_focus->acceptsTextInput())
|
||||||
|
|
||||||
if (key == KEY_RETURN && mask == MASK_NONE)
|
|
||||||
{
|
|
||||||
// set keyboard focus to self to trigger commitOnFocusLost behavior on current ctrl
|
|
||||||
if (cur_focus && cur_focus->acceptsTextInput())
|
|
||||||
{
|
{
|
||||||
|
// call onCommit for text input handling control
|
||||||
cur_focus->onCommit();
|
cur_focus->onCommit();
|
||||||
handled = TRUE;
|
handled = TRUE;
|
||||||
}
|
}
|
||||||
@@ -363,34 +363,16 @@ void LLPanel::handleVisibilityChange ( BOOL new_visibility )
|
|||||||
|
|
||||||
void LLPanel::setFocus(BOOL b)
|
void LLPanel::setFocus(BOOL b)
|
||||||
{
|
{
|
||||||
if( b )
|
if( b && !hasFocus())
|
||||||
{
|
{
|
||||||
if (!gFocusMgr.childHasKeyboardFocus(this))
|
// give ourselves focus preemptively, to avoid infinite loop
|
||||||
{
|
LLUICtrl::setFocus(TRUE);
|
||||||
//refresh();
|
// then try to pass to first valid child
|
||||||
if (!focusFirstItem())
|
focusFirstItem();
|
||||||
{
|
|
||||||
LLUICtrl::setFocus(TRUE);
|
|
||||||
}
|
|
||||||
onFocusReceived();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( this == gFocusMgr.getKeyboardFocus() )
|
LLUICtrl::setFocus(b);
|
||||||
{
|
|
||||||
gFocusMgr.setKeyboardFocus( NULL );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//RN: why is this here?
|
|
||||||
LLView::ctrl_list_t ctrls = getCtrlList();
|
|
||||||
for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
|
|
||||||
{
|
|
||||||
LLUICtrl* ctrl = *ctrl_it;
|
|
||||||
ctrl->setFocus( FALSE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ LLUICtrl::LLUICtrl() :
|
|||||||
mDoubleClickSignal(NULL),
|
mDoubleClickSignal(NULL),
|
||||||
mTentative(FALSE),
|
mTentative(FALSE),
|
||||||
mTabStop(TRUE),
|
mTabStop(TRUE),
|
||||||
mIsChrome(FALSE)
|
mIsChrome(FALSE),
|
||||||
|
mCommitOnReturn(FALSE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +79,8 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque
|
|||||||
mDoubleClickSignal(NULL),
|
mDoubleClickSignal(NULL),
|
||||||
mTentative( FALSE ),
|
mTentative( FALSE ),
|
||||||
mTabStop( TRUE ),
|
mTabStop( TRUE ),
|
||||||
mIsChrome(FALSE)
|
mIsChrome(FALSE),
|
||||||
|
mCommitOnReturn(FALSE)
|
||||||
{
|
{
|
||||||
if(commit_callback)
|
if(commit_callback)
|
||||||
setCommitCallback(commit_callback);
|
setCommitCallback(commit_callback);
|
||||||
@@ -178,6 +180,13 @@ BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// can't tab to children of a non-tab-stop widget
|
||||||
|
BOOL LLUICtrl::canFocusChildren() const
|
||||||
|
{
|
||||||
|
return TRUE;//hasTabStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LLUICtrl::onCommit()
|
void LLUICtrl::onCommit()
|
||||||
{
|
{
|
||||||
if (mCommitSignal)
|
if (mCommitSignal)
|
||||||
@@ -528,7 +537,8 @@ BOOL LLUICtrl::focusNextItem(BOOL text_fields_only)
|
|||||||
{
|
{
|
||||||
// this assumes that this method is called on the focus root.
|
// this assumes that this method is called on the focus root.
|
||||||
LLCtrlQuery query = getTabOrderQuery();
|
LLCtrlQuery query = getTabOrderQuery();
|
||||||
if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
|
static LLUICachedControl<bool> tab_to_text_fields_only ("TabToTextFieldsOnly", false);
|
||||||
|
if(text_fields_only || tab_to_text_fields_only)
|
||||||
{
|
{
|
||||||
query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
|
query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
|
||||||
}
|
}
|
||||||
@@ -540,7 +550,8 @@ BOOL LLUICtrl::focusPrevItem(BOOL text_fields_only)
|
|||||||
{
|
{
|
||||||
// this assumes that this method is called on the focus root.
|
// this assumes that this method is called on the focus root.
|
||||||
LLCtrlQuery query = getTabOrderQuery();
|
LLCtrlQuery query = getTabOrderQuery();
|
||||||
if(text_fields_only || LLUI::sConfigGroup->getBOOL("TabToTextFieldsOnly"))
|
static LLUICachedControl<bool> tab_to_text_fields_only ("TabToTextFieldsOnly", false);
|
||||||
|
if(text_fields_only || tab_to_text_fields_only)
|
||||||
{
|
{
|
||||||
query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
|
query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
|
||||||
}
|
}
|
||||||
@@ -552,7 +563,7 @@ LLUICtrl* LLUICtrl::findRootMostFocusRoot()
|
|||||||
{
|
{
|
||||||
LLUICtrl* focus_root = NULL;
|
LLUICtrl* focus_root = NULL;
|
||||||
LLUICtrl* next_view = this;
|
LLUICtrl* next_view = this;
|
||||||
while(next_view)
|
while(next_view/* && next_view->hasTabStop()*/)
|
||||||
{
|
{
|
||||||
if (next_view->isFocusRoot())
|
if (next_view->isFocusRoot())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public:
|
|||||||
/*virtual*/ BOOL isCtrl() const;
|
/*virtual*/ BOOL isCtrl() const;
|
||||||
/*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
|
/*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
|
||||||
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
|
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
|
||||||
|
/*virtual*/ BOOL canFocusChildren() const;
|
||||||
/*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*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
||||||
@@ -132,6 +133,9 @@ public:
|
|||||||
|
|
||||||
LLUICtrl* getParentUICtrl() const;
|
LLUICtrl* getParentUICtrl() const;
|
||||||
|
|
||||||
|
void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
|
||||||
|
BOOL getCommitOnReturn() const { return mCommitOnReturn; }
|
||||||
|
|
||||||
//Start using these!
|
//Start using these!
|
||||||
boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb );
|
boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb );
|
||||||
boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb );
|
boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb );
|
||||||
@@ -198,6 +202,8 @@ private:
|
|||||||
BOOL mIsChrome;
|
BOOL mIsChrome;
|
||||||
BOOL mTentative;
|
BOOL mTentative;
|
||||||
|
|
||||||
|
bool mCommitOnReturn;
|
||||||
|
|
||||||
class DefaultTabGroupFirstSorter;
|
class DefaultTabGroupFirstSorter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1377,7 +1377,10 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
|
|||||||
S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;
|
S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;
|
||||||
S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;
|
S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;
|
||||||
viewp->translate( delta_x, delta_y );
|
viewp->translate( delta_x, delta_y );
|
||||||
viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
|
if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight())
|
||||||
|
{
|
||||||
|
viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ void main()
|
|||||||
|
|
||||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||||
|
|
||||||
|
color.a = .0;
|
||||||
frag_color = color;
|
frag_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* @file debugF.glsl
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2011, 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$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DEFINE_GL_FRAGCOLOR
|
||||||
|
out vec4 frag_color;
|
||||||
|
#else
|
||||||
|
#define frag_color gl_FragColor
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform sampler2D depthMap;
|
||||||
|
|
||||||
|
uniform float delta;
|
||||||
|
|
||||||
|
VARYING vec2 tc0;
|
||||||
|
VARYING vec2 tc1;
|
||||||
|
VARYING vec2 tc2;
|
||||||
|
VARYING vec2 tc3;
|
||||||
|
VARYING vec2 tc4;
|
||||||
|
VARYING vec2 tc5;
|
||||||
|
VARYING vec2 tc6;
|
||||||
|
VARYING vec2 tc7;
|
||||||
|
VARYING vec2 tc8;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 depth1 =
|
||||||
|
vec4(texture2D(depthMap, tc0).r,
|
||||||
|
texture2D(depthMap, tc1).r,
|
||||||
|
texture2D(depthMap, tc2).r,
|
||||||
|
texture2D(depthMap, tc3).r);
|
||||||
|
|
||||||
|
vec4 depth2 =
|
||||||
|
vec4(texture2D(depthMap, tc4).r,
|
||||||
|
texture2D(depthMap, tc5).r,
|
||||||
|
texture2D(depthMap, tc6).r,
|
||||||
|
texture2D(depthMap, tc7).r);
|
||||||
|
|
||||||
|
depth1 = min(depth1, depth2);
|
||||||
|
float depth = min(depth1.x, depth1.y);
|
||||||
|
depth = min(depth, depth1.z);
|
||||||
|
depth = min(depth, depth1.w);
|
||||||
|
depth = min(depth, texture2D(depthMap, tc8).r);
|
||||||
|
|
||||||
|
gl_FragDepth = depth;
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/**
|
||||||
|
* @file debugF.glsl
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2011, 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$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#extension GL_ARB_texture_rectangle : enable
|
||||||
|
|
||||||
|
#ifdef DEFINE_GL_FRAGCOLOR
|
||||||
|
out vec4 frag_color;
|
||||||
|
#else
|
||||||
|
#define frag_color gl_FragColor
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform sampler2DRect depthMap;
|
||||||
|
|
||||||
|
uniform float delta;
|
||||||
|
|
||||||
|
VARYING vec2 tc0;
|
||||||
|
VARYING vec2 tc1;
|
||||||
|
VARYING vec2 tc2;
|
||||||
|
VARYING vec2 tc3;
|
||||||
|
VARYING vec2 tc4;
|
||||||
|
VARYING vec2 tc5;
|
||||||
|
VARYING vec2 tc6;
|
||||||
|
VARYING vec2 tc7;
|
||||||
|
VARYING vec2 tc8;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 depth1 =
|
||||||
|
vec4(texture2DRect(depthMap, tc0).r,
|
||||||
|
texture2DRect(depthMap, tc1).r,
|
||||||
|
texture2DRect(depthMap, tc2).r,
|
||||||
|
texture2DRect(depthMap, tc3).r);
|
||||||
|
|
||||||
|
vec4 depth2 =
|
||||||
|
vec4(texture2DRect(depthMap, tc4).r,
|
||||||
|
texture2DRect(depthMap, tc5).r,
|
||||||
|
texture2DRect(depthMap, tc6).r,
|
||||||
|
texture2DRect(depthMap, tc7).r);
|
||||||
|
|
||||||
|
depth1 = min(depth1, depth2);
|
||||||
|
float depth = min(depth1.x, depth1.y);
|
||||||
|
depth = min(depth, depth1.z);
|
||||||
|
depth = min(depth, depth1.w);
|
||||||
|
depth = min(depth, texture2DRect(depthMap, tc8).r);
|
||||||
|
|
||||||
|
gl_FragDepth = depth;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* @file debugV.glsl
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* Copyright (C) 2011, 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 modelview_projection_matrix;
|
||||||
|
|
||||||
|
ATTRIBUTE vec3 position;
|
||||||
|
|
||||||
|
uniform vec2 screen_res;
|
||||||
|
|
||||||
|
uniform vec2 delta;
|
||||||
|
|
||||||
|
VARYING vec2 tc0;
|
||||||
|
VARYING vec2 tc1;
|
||||||
|
VARYING vec2 tc2;
|
||||||
|
VARYING vec2 tc3;
|
||||||
|
VARYING vec2 tc4;
|
||||||
|
VARYING vec2 tc5;
|
||||||
|
VARYING vec2 tc6;
|
||||||
|
VARYING vec2 tc7;
|
||||||
|
VARYING vec2 tc8;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = vec4(position, 1.0);
|
||||||
|
|
||||||
|
vec2 tc = (position.xy*0.5+0.5)*screen_res;
|
||||||
|
tc0 = tc+vec2(-delta.x,-delta.y);
|
||||||
|
tc1 = tc+vec2(0,-delta.y);
|
||||||
|
tc2 = tc+vec2(delta.x,-delta.y);
|
||||||
|
tc3 = tc+vec2(-delta.x,0);
|
||||||
|
tc4 = tc+vec2(0,0);
|
||||||
|
tc5 = tc+vec2(delta.x,0);
|
||||||
|
tc6 = tc+vec2(-delta.x,delta.y);
|
||||||
|
tc7 = tc+vec2(0,delta.y);
|
||||||
|
tc8 = tc+vec2(delta.x,delta.y);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ void fullbright_shiny_lighting()
|
|||||||
|
|
||||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||||
|
|
||||||
color.a = max(color.a, vertex_color.a);
|
color.a = 0.0;
|
||||||
|
|
||||||
frag_color = color;
|
frag_color = color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void fullbright_shiny_lighting()
|
|||||||
|
|
||||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||||
|
|
||||||
color.a = max(color.a, vertex_color.a);
|
color.a = 0.0;
|
||||||
|
|
||||||
frag_color = color;
|
frag_color = color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void fullbright_shiny_lighting_water()
|
|||||||
|
|
||||||
color.rgb = fullbrightShinyAtmosTransport(color.rgb);
|
color.rgb = fullbrightShinyAtmosTransport(color.rgb);
|
||||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||||
color.a = max(color.a, vertex_color.a);
|
color.a = 1.0;
|
||||||
|
|
||||||
frag_color = applyWaterFog(color);
|
frag_color = applyWaterFog(color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void fullbright_shiny_lighting_water()
|
|||||||
|
|
||||||
color.rgb = fullbrightShinyAtmosTransport(color.rgb);
|
color.rgb = fullbrightShinyAtmosTransport(color.rgb);
|
||||||
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
color.rgb = fullbrightScaleSoftClip(color.rgb);
|
||||||
color.a = max(color.a, vertex_color.a);
|
color.a = 0.0;
|
||||||
|
|
||||||
frag_color = applyWaterFog(color);
|
frag_color = applyWaterFog(color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ out vec4 frag_color;
|
|||||||
VARYING vec4 vertex_color;
|
VARYING vec4 vertex_color;
|
||||||
VARYING vec2 vary_texcoord0;
|
VARYING vec2 vary_texcoord0;
|
||||||
|
|
||||||
vec4 diffuseLookup(vec2 texcoord);
|
/* vec4 diffuseLookup(vec2 texcoord); */
|
||||||
|
|
||||||
vec3 fullbrightAtmosTransport(vec3 light);
|
vec3 fullbrightAtmosTransport(vec3 light);
|
||||||
vec4 applyWaterFog(vec4 color);
|
vec4 applyWaterFog(vec4 color);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void shiny_lighting()
|
|||||||
color.rgb = atmosLighting(color.rgb);
|
color.rgb = atmosLighting(color.rgb);
|
||||||
|
|
||||||
color.rgb = scaleSoftClip(color.rgb);
|
color.rgb = scaleSoftClip(color.rgb);
|
||||||
color.a = max(color.a, vertex_color.a);
|
color.a = 1.0;
|
||||||
frag_color = color;
|
frag_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void shiny_lighting()
|
|||||||
color.rgb = atmosLighting(color.rgb);
|
color.rgb = atmosLighting(color.rgb);
|
||||||
|
|
||||||
color.rgb = scaleSoftClip(color.rgb);
|
color.rgb = scaleSoftClip(color.rgb);
|
||||||
color.a = max(color.a, vertex_color.a);
|
color.a = 1.0;
|
||||||
frag_color = color;
|
frag_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void shiny_lighting_water()
|
|||||||
color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
|
color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
|
||||||
|
|
||||||
color.rgb = atmosLighting(color.rgb);
|
color.rgb = atmosLighting(color.rgb);
|
||||||
color.a = max(color.a, vertex_color.a);
|
color.a = 1.0;
|
||||||
frag_color = applyWaterFog(color);
|
frag_color = applyWaterFog(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void shiny_lighting_water()
|
|||||||
color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
|
color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
|
||||||
|
|
||||||
color.rgb = atmosLighting(color.rgb);
|
color.rgb = atmosLighting(color.rgb);
|
||||||
color.a = max(color.a, vertex_color.a);
|
color.a = 1.0;
|
||||||
frag_color = applyWaterFog(color);
|
frag_color = applyWaterFog(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,11 +48,9 @@ void main()
|
|||||||
mat = modelview_matrix * mat;
|
mat = modelview_matrix * mat;
|
||||||
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
|
vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
|
||||||
|
|
||||||
|
vertex_color = emissive;
|
||||||
|
|
||||||
calcAtmospherics(pos.xyz);
|
calcAtmospherics(pos.xyz);
|
||||||
|
|
||||||
vertex_color = emissive;
|
|
||||||
|
|
||||||
gl_Position = projection_matrix*vec4(pos, 1.0);
|
gl_Position = projection_matrix*vec4(pos, 1.0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4332,9 +4332,10 @@ public:
|
|||||||
<< llendl;
|
<< llendl;
|
||||||
//dec_busy_count();
|
//dec_busy_count();
|
||||||
gInventory.removeObserver(this);
|
gInventory.removeObserver(this);
|
||||||
|
doOnIdleOneTime(mCallable);
|
||||||
|
|
||||||
// lets notify observers that loading is finished.
|
// lets notify observers that loading is finished.
|
||||||
gAgentWearables.notifyLoadingFinished();
|
//gAgentWearables.notifyLoadingFinished();
|
||||||
delete this;
|
delete this;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1509,7 +1509,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
|
|||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette",
|
LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv(LLViewerShaderMgr::AVATAR_MATRIX,
|
||||||
maxJoints,
|
maxJoints,
|
||||||
FALSE,
|
FALSE,
|
||||||
(GLfloat*) mat[0].mMatrix);
|
(GLfloat*) mat[0].mMatrix);
|
||||||
|
|||||||
@@ -570,6 +570,7 @@ void LLDrawPoolBump::renderFullbrightShiny()
|
|||||||
{
|
{
|
||||||
LLGLEnable blend_enable(GL_BLEND);
|
LLGLEnable blend_enable(GL_BLEND);
|
||||||
|
|
||||||
|
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||||
if (mVertexShaderLevel > 1)
|
if (mVertexShaderLevel > 1)
|
||||||
{
|
{
|
||||||
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||||
@@ -578,6 +579,7 @@ void LLDrawPoolBump::renderFullbrightShiny()
|
|||||||
{
|
{
|
||||||
LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask);
|
LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask);
|
||||||
}
|
}
|
||||||
|
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -896,7 +898,9 @@ void LLDrawPoolBump::renderPostDeferred(S32 pass)
|
|||||||
switch (pass)
|
switch (pass)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
gGL.setColorMask(true, true);
|
||||||
renderFullbrightShiny();
|
renderFullbrightShiny();
|
||||||
|
gGL.setColorMask(true, false);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
renderBump(LLRenderPass::PASS_POST_BUMP);
|
renderBump(LLRenderPass::PASS_POST_BUMP);
|
||||||
@@ -1370,9 +1374,14 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
|
|||||||
LLGLDisable blend(GL_BLEND);
|
LLGLDisable blend(GL_BLEND);
|
||||||
gGL.setColorMask(TRUE, TRUE);
|
gGL.setColorMask(TRUE, TRUE);
|
||||||
gNormalMapGenProgram.bind();
|
gNormalMapGenProgram.bind();
|
||||||
gNormalMapGenProgram.uniform1f("norm_scale", gSavedSettings.getF32("RenderNormalMapScale"));
|
|
||||||
gNormalMapGenProgram.uniform1f("stepX", 1.f/bump->getWidth());
|
static LLStaticHashedString sNormScale("norm_scale");
|
||||||
gNormalMapGenProgram.uniform1f("stepY", 1.f/bump->getHeight());
|
static LLStaticHashedString sStepX("stepX");
|
||||||
|
static LLStaticHashedString sStepY("stepY");
|
||||||
|
|
||||||
|
gNormalMapGenProgram.uniform1f(sNormScale, gSavedSettings.getF32("RenderNormalMapScale"));
|
||||||
|
gNormalMapGenProgram.uniform1f(sStepX, 1.f/bump->getWidth());
|
||||||
|
gNormalMapGenProgram.uniform1f(sStepX, 1.f/bump->getHeight());
|
||||||
|
|
||||||
LLVector2 v((F32) bump->getWidth()/gPipeline.mScreen.getWidth(),
|
LLVector2 v((F32) bump->getWidth()/gPipeline.mScreen.getWidth(),
|
||||||
(F32) bump->getHeight()/gPipeline.mScreen.getHeight());
|
(F32) bump->getHeight()/gPipeline.mScreen.getHeight());
|
||||||
|
|||||||
@@ -362,8 +362,8 @@ void LLDrawPoolTerrain::renderFullShader()
|
|||||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||||
llassert(shader);
|
llassert(shader);
|
||||||
|
|
||||||
shader->uniform4fv("object_plane_s", 1, tp0.mV);
|
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
|
||||||
shader->uniform4fv("object_plane_t", 1, tp1.mV);
|
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
|
||||||
|
|
||||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||||
gGL.loadIdentity();
|
gGL.loadIdentity();
|
||||||
@@ -873,8 +873,8 @@ void LLDrawPoolTerrain::renderSimple()
|
|||||||
|
|
||||||
if (LLGLSLShader::sNoFixedFunction)
|
if (LLGLSLShader::sNoFixedFunction)
|
||||||
{
|
{
|
||||||
sShader->uniform4fv("object_plane_s", 1, tp0.mV);
|
sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
|
||||||
sShader->uniform4fv("object_plane_t", 1, tp1.mV);
|
sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -449,8 +449,8 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shader->uniform4fv("object_plane_s", 1, tp0);
|
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0);
|
||||||
shader->uniform4fv("object_plane_t", 1, tp1);
|
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1);
|
||||||
}
|
}
|
||||||
|
|
||||||
gGL.diffuseColor3f(1.f, 1.f, 1.f);
|
gGL.diffuseColor3f(1.f, 1.f, 1.f);
|
||||||
@@ -624,12 +624,12 @@ void LLDrawPoolWater::shade()
|
|||||||
mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT);
|
mWaterNormp->setFilteringOption(LLTexUnit::TFO_POINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 screentex = shader->enableTexture(LLViewerShaderMgr::WATER_SCREENTEX);
|
S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX);
|
||||||
|
|
||||||
if (screentex > -1)
|
if (screentex > -1)
|
||||||
{
|
{
|
||||||
shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
|
shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
|
||||||
shader->uniform1f(LLViewerShaderMgr::WATER_FOGDENSITY,
|
shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY,
|
||||||
param_mgr->getFogDensity());
|
param_mgr->getFogDensity());
|
||||||
gPipeline.mWaterDis.bindTexture(0, screentex);
|
gPipeline.mWaterDis.bindTexture(0, screentex);
|
||||||
}
|
}
|
||||||
@@ -641,7 +641,7 @@ void LLDrawPoolWater::shade()
|
|||||||
if (mVertexShaderLevel == 1)
|
if (mVertexShaderLevel == 1)
|
||||||
{
|
{
|
||||||
sWaterFogColor.mV[3] = param_mgr->mDensitySliderValue;
|
sWaterFogColor.mV[3] = param_mgr->mDensitySliderValue;
|
||||||
shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
|
shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV);
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 screenRes[] =
|
F32 screenRes[] =
|
||||||
@@ -649,10 +649,10 @@ void LLDrawPoolWater::shade()
|
|||||||
1.f/gGLViewport[2],
|
1.f/gGLViewport[2],
|
||||||
1.f/gGLViewport[3]
|
1.f/gGLViewport[3]
|
||||||
};
|
};
|
||||||
shader->uniform2fv("screenRes", 1, screenRes);
|
shader->uniform2fv(LLShaderMgr::DEFERRED_SCREEN_RES, 1, screenRes);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
S32 diffTex = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
|
S32 diffTex = shader->enableTexture(LLShaderMgr::DIFFUSE_MAP);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
light_dir.normVec();
|
light_dir.normVec();
|
||||||
@@ -661,26 +661,26 @@ void LLDrawPoolWater::shade()
|
|||||||
light_diffuse *= 6.f;
|
light_diffuse *= 6.f;
|
||||||
|
|
||||||
//shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix);
|
//shader->uniformMatrix4fv("inverse_ref", 1, GL_FALSE, (GLfloat*) gGLObliqueProjectionInverse.mMatrix);
|
||||||
shader->uniform1f(LLViewerShaderMgr::WATER_WATERHEIGHT, eyedepth);
|
shader->uniform1f(LLShaderMgr::WATER_WATERHEIGHT, eyedepth);
|
||||||
shader->uniform1f(LLViewerShaderMgr::WATER_TIME, sTime);
|
shader->uniform1f(LLShaderMgr::WATER_TIME, sTime);
|
||||||
shader->uniform3fv(LLViewerShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV);
|
shader->uniform3fv(LLShaderMgr::WATER_EYEVEC, 1, LLViewerCamera::getInstance()->getOrigin().mV);
|
||||||
shader->uniform3fv(LLViewerShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV);
|
shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV);
|
||||||
shader->uniform1f(LLViewerShaderMgr::WATER_SPECULAR_EXP, light_exp);
|
shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp);
|
||||||
shader->uniform2fv(LLViewerShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV);
|
shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, param_mgr->getWave1Dir().mV);
|
||||||
shader->uniform2fv(LLViewerShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV);
|
shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, param_mgr->getWave2Dir().mV);
|
||||||
shader->uniform3fv(LLViewerShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV);
|
shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV);
|
||||||
|
|
||||||
shader->uniform3fv("normScale", 1, param_mgr->getNormalScale().mV);
|
shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, param_mgr->getNormalScale().mV);
|
||||||
shader->uniform1f("fresnelScale", param_mgr->getFresnelScale());
|
shader->uniform1f(LLShaderMgr::WATER_FRESNEL_SCALE, param_mgr->getFresnelScale());
|
||||||
shader->uniform1f("fresnelOffset", param_mgr->getFresnelOffset());
|
shader->uniform1f(LLShaderMgr::WATER_FRESNEL_OFFSET, param_mgr->getFresnelOffset());
|
||||||
shader->uniform1f("blurMultiplier", param_mgr->getBlurMultiplier());
|
shader->uniform1f(LLShaderMgr::WATER_BLUR_MULTIPLIER, param_mgr->getBlurMultiplier());
|
||||||
|
|
||||||
F32 sunAngle = llmax(0.f, light_dir.mV[2]);
|
F32 sunAngle = llmax(0.f, light_dir.mV[2]);
|
||||||
F32 scaledAngle = 1.f - sunAngle;
|
F32 scaledAngle = 1.f - sunAngle;
|
||||||
|
|
||||||
shader->uniform1f("sunAngle", sunAngle);
|
shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE, sunAngle);
|
||||||
shader->uniform1f("scaledAngle", scaledAngle);
|
shader->uniform1f(LLShaderMgr::WATER_SCALED_ANGLE, scaledAngle);
|
||||||
shader->uniform1f("sunAngle2", 0.1f + 0.2f*sunAngle);
|
shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle);
|
||||||
|
|
||||||
LLColor4 water_color;
|
LLColor4 water_color;
|
||||||
LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
|
LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
|
||||||
@@ -688,12 +688,12 @@ void LLDrawPoolWater::shade()
|
|||||||
if (LLViewerCamera::getInstance()->cameraUnderWater())
|
if (LLViewerCamera::getInstance()->cameraUnderWater())
|
||||||
{
|
{
|
||||||
water_color.setVec(1.f, 1.f, 1.f, 0.4f);
|
water_color.setVec(1.f, 1.f, 1.f, 0.4f);
|
||||||
shader->uniform1f(LLViewerShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow());
|
shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
|
water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
|
||||||
shader->uniform1f(LLViewerShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove());
|
shader->uniform1f(LLShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (water_color.mV[3] > 0.9f)
|
if (water_color.mV[3] > 0.9f)
|
||||||
@@ -739,12 +739,12 @@ void LLDrawPoolWater::shade()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
|
shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
|
||||||
shader->disableTexture(LLViewerShaderMgr::WATER_SCREENTEX);
|
shader->disableTexture(LLShaderMgr::WATER_SCREENTEX);
|
||||||
shader->disableTexture(LLViewerShaderMgr::BUMP_MAP);
|
shader->disableTexture(LLShaderMgr::BUMP_MAP);
|
||||||
shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
|
shader->disableTexture(LLShaderMgr::DIFFUSE_MAP);
|
||||||
shader->disableTexture(LLViewerShaderMgr::WATER_REFTEX);
|
shader->disableTexture(LLShaderMgr::WATER_REFTEX);
|
||||||
shader->disableTexture(LLViewerShaderMgr::WATER_SCREENDEPTH);
|
shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH);
|
||||||
|
|
||||||
if (deferred_render)
|
if (deferred_render)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) cons
|
|||||||
gGL.translatef(0.f,-camHeightLocal, 0.f);
|
gGL.translatef(0.f,-camHeightLocal, 0.f);
|
||||||
|
|
||||||
// Draw WL Sky
|
// Draw WL Sky
|
||||||
shader->uniform3f("camPosLocal", 0.f, camHeightLocal, 0.f);
|
static LLStaticHashedString sCamPosLocal("camPosLocal");
|
||||||
|
shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f);
|
||||||
|
|
||||||
gSky.mVOWLSkyp->drawDome();
|
gSky.mVOWLSkyp->drawDome();
|
||||||
|
|
||||||
@@ -219,7 +220,8 @@ void LLDrawPoolWLSky::renderStars(void) const
|
|||||||
|
|
||||||
if (gPipeline.canUseVertexShaders())
|
if (gPipeline.canUseVertexShaders())
|
||||||
{
|
{
|
||||||
star_shader->uniform1f("custom_alpha", star_alpha.mV[3]);
|
static LLStaticHashedString sCustomAlpha("custom_alpha");
|
||||||
|
star_shader->uniform1f(sCustomAlpha, star_alpha.mV[3]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -294,7 +296,8 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
|
|||||||
if (gPipeline.canUseVertexShaders())
|
if (gPipeline.canUseVertexShaders())
|
||||||
{
|
{
|
||||||
// Okay, so the moon isn't a star, but it's close enough.
|
// Okay, so the moon isn't a star, but it's close enough.
|
||||||
star_shader->uniform1f("custom_alpha", color.mV[VW]);
|
static LLStaticHashedString sCustomAlpha("custom_alpha");
|
||||||
|
star_shader->uniform1f(sCustomAlpha, color.mV[VW]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth)
|
|||||||
llassert(mFullHeight <= 512);
|
llassert(mFullHeight <= 512);
|
||||||
llassert(mFullWidth <= 512);
|
llassert(mFullWidth <= 512);
|
||||||
|
|
||||||
if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete())
|
if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI)
|
||||||
{ //using offscreen render target, just use the bottom left corner
|
{ //using offscreen render target, just use the bottom left corner
|
||||||
mOrigin.set(0, 0);
|
mOrigin.set(0, 0);
|
||||||
}
|
}
|
||||||
@@ -218,13 +218,12 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 //THIS CAUSES MAINT-1092
|
bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI;
|
||||||
bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete();
|
|
||||||
if (use_fbo)
|
if (use_fbo)
|
||||||
{
|
{
|
||||||
gPipeline.mWaterDis.bindTarget();
|
gPipeline.mWaterDis.bindTarget();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
LLGLSLShader::bindNoShader();
|
LLGLSLShader::bindNoShader();
|
||||||
LLVertexBuffer::unbind();
|
LLVertexBuffer::unbind();
|
||||||
@@ -259,12 +258,10 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 //THIS CAUSES MAINT-1092
|
|
||||||
if (use_fbo)
|
if (use_fbo)
|
||||||
{
|
{
|
||||||
gPipeline.mWaterDis.flush();
|
gPipeline.mWaterDis.flush();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,9 @@
|
|||||||
|
|
||||||
#define LL_MAX_INDICES_COUNT 1000000
|
#define LL_MAX_INDICES_COUNT 1000000
|
||||||
|
|
||||||
|
static LLStaticHashedString sTextureIndexIn("texture_index_in");
|
||||||
|
static LLStaticHashedString sColorIn("color_in");
|
||||||
|
|
||||||
BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE
|
BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE
|
||||||
|
|
||||||
#define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2])
|
#define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2])
|
||||||
@@ -1414,7 +1417,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||||||
vp[2] = 0;
|
vp[2] = 0;
|
||||||
vp[3] = 0;
|
vp[3] = 0;
|
||||||
|
|
||||||
gTransformPositionProgram.uniform1i("texture_index_in", val);
|
gTransformPositionProgram.uniform1i(sTextureIndexIn, val);
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
glBeginTransformFeedback(GL_POINTS);
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||||
|
|
||||||
@@ -1432,7 +1435,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||||||
|
|
||||||
S32 val = *((S32*) color.mV);
|
S32 val = *((S32*) color.mV);
|
||||||
|
|
||||||
gTransformColorProgram.uniform1i("color_in", val);
|
gTransformColorProgram.uniform1i(sColorIn, val);
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
glBeginTransformFeedback(GL_POINTS);
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
||||||
@@ -1453,7 +1456,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||||||
(glow << 16) |
|
(glow << 16) |
|
||||||
(glow << 24);
|
(glow << 24);
|
||||||
|
|
||||||
gTransformColorProgram.uniform1i("color_in", glow32);
|
gTransformColorProgram.uniform1i(sColorIn, glow32);
|
||||||
glBeginTransformFeedback(GL_POINTS);
|
glBeginTransformFeedback(GL_POINTS);
|
||||||
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||||
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
push_for_transform(buff, vf.mNumVertices, mGeomCount);
|
||||||
|
|||||||
@@ -1696,7 +1696,8 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
|
|||||||
|
|
||||||
gGL.getModelviewMatrix().inverse().mult_vec_matrix(plane);
|
gGL.getModelviewMatrix().inverse().mult_vec_matrix(plane);
|
||||||
|
|
||||||
gClipProgram.uniform4fv("clip_plane", 1, plane.v);
|
static LLStaticHashedString sClipPlane("clip_plane");
|
||||||
|
gClipProgram.uniform4fv(sClipPlane, 1, plane.v);
|
||||||
|
|
||||||
BOOL particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
|
BOOL particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES);
|
||||||
#if ENABLE_CLASSIC_CLOUDS
|
#if ENABLE_CLASSIC_CLOUDS
|
||||||
|
|||||||
@@ -3255,12 +3255,17 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// FIXME SH-3860 - this creates a race condition, where COF
|
||||||
|
// changes (base outfit link added) after appearance update
|
||||||
|
// request has been submitted.
|
||||||
sWearablesLoadedCon = gAgentWearables.addLoadedCallback(LLStartUp::saveInitialOutfit);
|
sWearablesLoadedCon = gAgentWearables.addLoadedCallback(LLStartUp::saveInitialOutfit);
|
||||||
|
|
||||||
bool do_copy = true;
|
bool do_copy = true;
|
||||||
bool do_append = false;
|
bool do_append = false;
|
||||||
LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
|
LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
|
||||||
LLAppearanceMgr::instance().wearInventoryCategory(cat, do_copy, do_append);
|
// Need to fetch cof contents before we can wear.
|
||||||
|
callAfterCategoryFetch(LLAppearanceMgr::instance().getCOF(),
|
||||||
|
boost::bind(&LLAppearanceMgr::wearInventoryCategory, LLAppearanceMgr::getInstance(), cat, do_copy, do_append));
|
||||||
lldebugs << "initial outfit category id: " << cat_id << llendl;
|
lldebugs << "initial outfit category id: " << cat_id << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,13 @@
|
|||||||
#define UNIFORM_ERRS LL_ERRS("Shader")
|
#define UNIFORM_ERRS LL_ERRS("Shader")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static LLStaticHashedString sTexture0("texture0");
|
||||||
|
static LLStaticHashedString sTexture1("texture1");
|
||||||
|
static LLStaticHashedString sTex0("tex0");
|
||||||
|
static LLStaticHashedString sTex1("tex1");
|
||||||
|
static LLStaticHashedString sGlowMap("glowMap");
|
||||||
|
static LLStaticHashedString sScreenMap("screenMap");
|
||||||
|
|
||||||
// Lots of STL stuff in here, using namespace std to keep things more readable
|
// Lots of STL stuff in here, using namespace std to keep things more readable
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
@@ -90,6 +97,8 @@ LLGLSLShader gTwoTextureAddProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
|||||||
LLGLSLShader gOneTextureNoColorProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
LLGLSLShader gOneTextureNoColorProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
||||||
LLGLSLShader gDebugProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
LLGLSLShader gDebugProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
||||||
LLGLSLShader gClipProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
LLGLSLShader gClipProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
||||||
|
LLGLSLShader gDownsampleDepthProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
||||||
|
LLGLSLShader gDownsampleDepthRectProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
||||||
LLGLSLShader gAlphaMaskProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
LLGLSLShader gAlphaMaskProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
||||||
|
|
||||||
LLGLSLShader gUIProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
LLGLSLShader gUIProgram(LLViewerShaderMgr::SHADER_INTERFACE);
|
||||||
@@ -241,47 +250,6 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void)
|
|||||||
if (mReservedAttribs.empty())
|
if (mReservedAttribs.empty())
|
||||||
{
|
{
|
||||||
LLShaderMgr::initAttribsAndUniforms();
|
LLShaderMgr::initAttribsAndUniforms();
|
||||||
|
|
||||||
mAvatarUniforms.push_back("matrixPalette");
|
|
||||||
mAvatarUniforms.push_back("gWindDir");
|
|
||||||
mAvatarUniforms.push_back("gSinWaveParams");
|
|
||||||
mAvatarUniforms.push_back("gGravity");
|
|
||||||
|
|
||||||
mWLUniforms.push_back("camPosLocal");
|
|
||||||
|
|
||||||
mTerrainUniforms.reserve(5);
|
|
||||||
mTerrainUniforms.push_back("detail_0");
|
|
||||||
mTerrainUniforms.push_back("detail_1");
|
|
||||||
mTerrainUniforms.push_back("detail_2");
|
|
||||||
mTerrainUniforms.push_back("detail_3");
|
|
||||||
mTerrainUniforms.push_back("alpha_ramp");
|
|
||||||
|
|
||||||
mGlowUniforms.push_back("glowDelta");
|
|
||||||
mGlowUniforms.push_back("glowStrength");
|
|
||||||
|
|
||||||
mGlowExtractUniforms.push_back("minLuminance");
|
|
||||||
mGlowExtractUniforms.push_back("maxExtractAlpha");
|
|
||||||
mGlowExtractUniforms.push_back("lumWeights");
|
|
||||||
mGlowExtractUniforms.push_back("warmthWeights");
|
|
||||||
mGlowExtractUniforms.push_back("warmthAmount");
|
|
||||||
|
|
||||||
mShinyUniforms.push_back("origin");
|
|
||||||
|
|
||||||
mWaterUniforms.reserve(12);
|
|
||||||
mWaterUniforms.push_back("screenTex");
|
|
||||||
mWaterUniforms.push_back("screenDepth");
|
|
||||||
mWaterUniforms.push_back("refTex");
|
|
||||||
mWaterUniforms.push_back("eyeVec");
|
|
||||||
mWaterUniforms.push_back("time");
|
|
||||||
mWaterUniforms.push_back("d1");
|
|
||||||
mWaterUniforms.push_back("d2");
|
|
||||||
mWaterUniforms.push_back("lightDir");
|
|
||||||
mWaterUniforms.push_back("specular");
|
|
||||||
mWaterUniforms.push_back("lightExp");
|
|
||||||
mWaterUniforms.push_back("fogCol");
|
|
||||||
mWaterUniforms.push_back("kd");
|
|
||||||
mWaterUniforms.push_back("refScale");
|
|
||||||
mWaterUniforms.push_back("waterHeight");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,11 +299,6 @@ void LLViewerShaderMgr::setShaders()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//setup preprocessor definitions
|
|
||||||
LLShaderMgr::instance()->mDefinitions.clear();
|
|
||||||
LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gSavedSettings.getU32("RenderFSAASamples"));
|
|
||||||
LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits);
|
|
||||||
|
|
||||||
initAttribsAndUniforms();
|
initAttribsAndUniforms();
|
||||||
gPipeline.releaseGLBuffers();
|
gPipeline.releaseGLBuffers();
|
||||||
|
|
||||||
@@ -724,7 +687,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
|
|||||||
for (U32 i = 0; i < shaders.size(); i++)
|
for (U32 i = 0; i < shaders.size(); i++)
|
||||||
{
|
{
|
||||||
// Note usage of GL_FRAGMENT_SHADER_ARB
|
// Note usage of GL_FRAGMENT_SHADER_ARB
|
||||||
if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER_ARB, index_channels[i]) == 0)
|
if (loadShaderFile(shaders[i].first, shaders[i].second, GL_FRAGMENT_SHADER_ARB, NULL, index_channels[i]) == 0)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -756,7 +719,7 @@ BOOL LLViewerShaderMgr::loadShadersEnvironment()
|
|||||||
gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainV.glsl", GL_VERTEX_SHADER_ARB));
|
gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT];
|
gTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT];
|
||||||
success = gTerrainProgram.createShader(NULL, &mTerrainUniforms);
|
success = gTerrainProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
@@ -792,7 +755,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
|
|||||||
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
|
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
|
gWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
|
||||||
success = gWaterProgram.createShader(NULL, &mWaterUniforms);
|
success = gWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -806,7 +769,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
|
|||||||
gUnderWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
|
gUnderWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
|
||||||
gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
|
|
||||||
success = gUnderWaterProgram.createShader(NULL, &mWaterUniforms);
|
success = gUnderWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -824,7 +787,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
|
|||||||
gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gTerrainWaterProgram.mShaderFiles.push_back(make_pair("environment/terrainWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gTerrainWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT];
|
gTerrainWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT];
|
||||||
gTerrainWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gTerrainWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
terrainWaterSuccess = gTerrainWaterProgram.createShader(NULL, &mTerrainUniforms);
|
terrainWaterSuccess = gTerrainWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Keep track of water shader levels
|
/// Keep track of water shader levels
|
||||||
@@ -872,7 +835,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowV.glsl", GL_VERTEX_SHADER_ARB));
|
gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gGlowProgram.mShaderFiles.push_back(make_pair("effects/glowF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gGlowProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
|
gGlowProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
|
||||||
success = gGlowProgram.createShader(NULL, &mGlowUniforms);
|
success = gGlowProgram.createShader(NULL, NULL);
|
||||||
LLPipeline::sRenderGlow = success;
|
LLPipeline::sRenderGlow = success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -883,7 +846,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractV.glsl", GL_VERTEX_SHADER_ARB));
|
gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gGlowExtractProgram.mShaderFiles.push_back(make_pair("effects/glowExtractF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gGlowExtractProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
|
gGlowExtractProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT];
|
||||||
success = gGlowExtractProgram.createShader(NULL, &mGlowExtractUniforms);
|
success = gGlowExtractProgram.createShader(NULL, NULL);
|
||||||
LLPipeline::sRenderGlow = success;
|
LLPipeline::sRenderGlow = success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -895,13 +858,16 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
//load Color Filter Shader
|
//load Color Filter Shader
|
||||||
//if (success)
|
//if (success)
|
||||||
{
|
{
|
||||||
vector<string> shaderUniforms;
|
static std::vector<LLStaticHashedString> shaderUniforms;
|
||||||
shaderUniforms.reserve(6);
|
if(shaderUniforms.empty())
|
||||||
shaderUniforms.push_back("gamma");
|
{
|
||||||
shaderUniforms.push_back("brightness");
|
shaderUniforms.reserve(6);
|
||||||
shaderUniforms.push_back("contrast");
|
shaderUniforms.push_back(LLStaticHashedString("gamma"));
|
||||||
shaderUniforms.push_back("contrastBase");
|
shaderUniforms.push_back(LLStaticHashedString("brightness"));
|
||||||
shaderUniforms.push_back("saturation");
|
shaderUniforms.push_back(LLStaticHashedString("contrast"));
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("contrastBase"));
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("saturation"));
|
||||||
|
}
|
||||||
|
|
||||||
gPostColorFilterProgram.mName = "Color Filter Shader (Post)";
|
gPostColorFilterProgram.mName = "Color Filter Shader (Post)";
|
||||||
gPostColorFilterProgram.mShaderFiles.clear();
|
gPostColorFilterProgram.mShaderFiles.clear();
|
||||||
@@ -911,18 +877,20 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
if(gPostColorFilterProgram.createShader(NULL, &shaderUniforms))
|
if(gPostColorFilterProgram.createShader(NULL, &shaderUniforms))
|
||||||
{
|
{
|
||||||
gPostColorFilterProgram.bind();
|
gPostColorFilterProgram.bind();
|
||||||
gPostColorFilterProgram.uniform1i("tex0", 0);
|
gPostColorFilterProgram.uniform1i(sTex0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//load Night Vision Shader
|
//load Night Vision Shader
|
||||||
//if (success)
|
//if (success)
|
||||||
{
|
{
|
||||||
vector<string> shaderUniforms;
|
static std::vector<LLStaticHashedString> shaderUniforms;
|
||||||
shaderUniforms.reserve(3);
|
if(shaderUniforms.empty())
|
||||||
shaderUniforms.push_back("brightMult");
|
{
|
||||||
shaderUniforms.push_back("noiseStrength");
|
shaderUniforms.reserve(3);
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("brightMult"));
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("noiseStrength"));
|
||||||
|
}
|
||||||
gPostNightVisionProgram.mName = "Night Vision Shader (Post)";
|
gPostNightVisionProgram.mName = "Night Vision Shader (Post)";
|
||||||
gPostNightVisionProgram.mShaderFiles.clear();
|
gPostNightVisionProgram.mShaderFiles.clear();
|
||||||
gPostNightVisionProgram.mShaderFiles.push_back(make_pair("effects/nightVisionF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gPostNightVisionProgram.mShaderFiles.push_back(make_pair("effects/nightVisionF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
@@ -931,16 +899,19 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
if(gPostNightVisionProgram.createShader(NULL, &shaderUniforms))
|
if(gPostNightVisionProgram.createShader(NULL, &shaderUniforms))
|
||||||
{
|
{
|
||||||
gPostNightVisionProgram.bind();
|
gPostNightVisionProgram.bind();
|
||||||
gPostNightVisionProgram.uniform1i("tex0", 0);
|
gPostNightVisionProgram.uniform1i(sTex0, 0);
|
||||||
gPostNightVisionProgram.uniform1i("tex1", 1);
|
gPostNightVisionProgram.uniform1i(sTex1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (success)
|
//if (success)
|
||||||
{
|
{
|
||||||
vector<string> shaderUniforms;
|
static std::vector<LLStaticHashedString> shaderUniforms;
|
||||||
shaderUniforms.reserve(1);
|
if(shaderUniforms.empty())
|
||||||
shaderUniforms.push_back("horizontalPass");
|
{
|
||||||
|
shaderUniforms.reserve(1);
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("horizontalPass"));
|
||||||
|
}
|
||||||
|
|
||||||
gPostGaussianBlurProgram.mName = "Gaussian Blur Shader (Post)";
|
gPostGaussianBlurProgram.mName = "Gaussian Blur Shader (Post)";
|
||||||
gPostGaussianBlurProgram.mShaderFiles.clear();
|
gPostGaussianBlurProgram.mShaderFiles.clear();
|
||||||
@@ -950,14 +921,17 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
if(gPostGaussianBlurProgram.createShader(NULL, &shaderUniforms))
|
if(gPostGaussianBlurProgram.createShader(NULL, &shaderUniforms))
|
||||||
{
|
{
|
||||||
gPostGaussianBlurProgram.bind();
|
gPostGaussianBlurProgram.bind();
|
||||||
gPostGaussianBlurProgram.uniform1i("tex0", 0);
|
gPostGaussianBlurProgram.uniform1i(sTex0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
vector<string> shaderUniforms;
|
static std::vector<LLStaticHashedString> shaderUniforms;
|
||||||
shaderUniforms.reserve(1);
|
if(shaderUniforms.empty())
|
||||||
shaderUniforms.push_back("layerCount");
|
{
|
||||||
|
shaderUniforms.reserve(1);
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("layerCount"));
|
||||||
|
}
|
||||||
|
|
||||||
gPostPosterizeProgram.mName = "Posterize Shader (Post)";
|
gPostPosterizeProgram.mName = "Posterize Shader (Post)";
|
||||||
gPostPosterizeProgram.mShaderFiles.clear();
|
gPostPosterizeProgram.mShaderFiles.clear();
|
||||||
@@ -967,16 +941,19 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
if(gPostPosterizeProgram.createShader(NULL, &shaderUniforms))
|
if(gPostPosterizeProgram.createShader(NULL, &shaderUniforms))
|
||||||
{
|
{
|
||||||
gPostPosterizeProgram.bind();
|
gPostPosterizeProgram.bind();
|
||||||
gPostPosterizeProgram.uniform1i("tex0", 0);
|
gPostPosterizeProgram.uniform1i(sTex0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
vector<string> shaderUniforms;
|
static std::vector<LLStaticHashedString> shaderUniforms;
|
||||||
shaderUniforms.reserve(3);
|
if(shaderUniforms.empty())
|
||||||
shaderUniforms.push_back("inv_proj");
|
{
|
||||||
shaderUniforms.push_back("prev_proj");
|
shaderUniforms.reserve(3);
|
||||||
shaderUniforms.push_back("screen_res");
|
shaderUniforms.push_back(LLStaticHashedString("inv_proj"));
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("prev_proj"));
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("screen_res"));
|
||||||
|
}
|
||||||
|
|
||||||
gPostMotionBlurProgram.mName = "Motion Blur Shader (Post)";
|
gPostMotionBlurProgram.mName = "Motion Blur Shader (Post)";
|
||||||
gPostMotionBlurProgram.mShaderFiles.clear();
|
gPostMotionBlurProgram.mShaderFiles.clear();
|
||||||
@@ -986,17 +963,20 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
if(gPostMotionBlurProgram.createShader(NULL, &shaderUniforms))
|
if(gPostMotionBlurProgram.createShader(NULL, &shaderUniforms))
|
||||||
{
|
{
|
||||||
gPostMotionBlurProgram.bind();
|
gPostMotionBlurProgram.bind();
|
||||||
gPostMotionBlurProgram.uniform1i("tex0", 0);
|
gPostMotionBlurProgram.uniform1i(sTex0, 0);
|
||||||
gPostMotionBlurProgram.uniform1i("tex1", 1);
|
gPostMotionBlurProgram.uniform1i(sTex1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
vector<string> shaderUniforms;
|
static std::vector<LLStaticHashedString> shaderUniforms;
|
||||||
shaderUniforms.reserve(3);
|
if(shaderUniforms.empty())
|
||||||
shaderUniforms.push_back("vignette_darkness");
|
{
|
||||||
shaderUniforms.push_back("vignette_radius");
|
shaderUniforms.reserve(3);
|
||||||
shaderUniforms.push_back("screen_res");
|
shaderUniforms.push_back(LLStaticHashedString("vignette_darkness"));
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("vignette_radius"));
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("screen_res"));
|
||||||
|
}
|
||||||
|
|
||||||
gPostVignetteProgram.mName = "Vignette Shader (Post)";
|
gPostVignetteProgram.mName = "Vignette Shader (Post)";
|
||||||
gPostVignetteProgram.mShaderFiles.clear();
|
gPostVignetteProgram.mShaderFiles.clear();
|
||||||
@@ -1006,7 +986,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||||||
if(gPostVignetteProgram.createShader(NULL, &shaderUniforms))
|
if(gPostVignetteProgram.createShader(NULL, &shaderUniforms))
|
||||||
{
|
{
|
||||||
gPostVignetteProgram.bind();
|
gPostVignetteProgram.bind();
|
||||||
gPostVignetteProgram.uniform1i("tex0", 0);
|
gPostVignetteProgram.uniform1i(sTex0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1314,7 +1294,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||||||
gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterV.glsl", GL_VERTEX_SHADER_ARB));
|
gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gDeferredWaterProgram.mShaderFiles.push_back(make_pair("deferred/waterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gDeferredWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
gDeferredWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
||||||
success = gDeferredWaterProgram.createShader(NULL, &mWaterUniforms);
|
success = gDeferredWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1373,7 +1353,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||||||
gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER_ARB));
|
gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gDeferredAvatarShadowProgram.mShaderFiles.push_back(make_pair("deferred/avatarShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gDeferredAvatarShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
gDeferredAvatarShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
||||||
success = gDeferredAvatarShadowProgram.createShader(NULL, &mAvatarUniforms);
|
success = gDeferredAvatarShadowProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1394,7 +1374,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||||||
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER_ARB));
|
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gDeferredTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
gDeferredTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
||||||
success = gDeferredTerrainProgram.createShader(NULL, &mTerrainUniforms);
|
success = gDeferredTerrainProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1405,7 +1385,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||||||
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER_ARB));
|
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gDeferredAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
gDeferredAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
||||||
success = gDeferredAvatarProgram.createShader(NULL, &mAvatarUniforms);
|
success = gDeferredAvatarProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1425,7 +1405,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||||||
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaNonIndexedNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
||||||
|
|
||||||
success = gDeferredAvatarAlphaProgram.createShader(NULL, &mAvatarUniforms);
|
success = gDeferredAvatarAlphaProgram.createShader(NULL, NULL);
|
||||||
|
|
||||||
gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;
|
gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;
|
||||||
gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true;
|
gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true;
|
||||||
@@ -1490,7 +1470,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||||||
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
||||||
gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||||
success = gDeferredWLSkyProgram.createShader(NULL, &mWLUniforms);
|
success = gDeferredWLSkyProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1501,14 +1481,19 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||||||
gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gDeferredWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
gDeferredWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
|
||||||
gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||||
success = gDeferredWLCloudProgram.createShader(NULL, &mWLUniforms);
|
success = gDeferredWLCloudProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gDeferredStarProgram.mName = "Deferred Star Program";
|
gDeferredStarProgram.mName = "Deferred Star Program";
|
||||||
vector<string> shaderUniforms(mWLUniforms);
|
static std::vector<LLStaticHashedString> shaderUniforms;
|
||||||
shaderUniforms.push_back("custom_alpha");
|
static bool bUniformsInitted = false;
|
||||||
|
if(!bUniformsInitted)
|
||||||
|
{
|
||||||
|
bUniformsInitted = true;
|
||||||
|
shaderUniforms.push_back(LLStaticHashedString("custom_alpha"));
|
||||||
|
}
|
||||||
gDeferredStarProgram.mShaderFiles.clear();
|
gDeferredStarProgram.mShaderFiles.clear();
|
||||||
gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsV.glsl", GL_VERTEX_SHADER_ARB));
|
gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gDeferredStarProgram.mShaderFiles.push_back(make_pair("deferred/starsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
@@ -1819,7 +1804,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
|
gObjectShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gObjectShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gObjectShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gObjectShinyNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectShinyNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gObjectShinyNonIndexedProgram.createShader(NULL, &mShinyUniforms);
|
success = gObjectShinyNonIndexedProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1836,7 +1821,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
|
gObjectShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gObjectShinyNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectShinyNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
gObjectShinyNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gObjectShinyNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
success = gObjectShinyNonIndexedWaterProgram.createShader(NULL, &mShinyUniforms);
|
success = gObjectShinyNonIndexedWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1852,7 +1837,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB));
|
gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gObjectFullbrightShinyNonIndexedProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gObjectFullbrightShinyNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectFullbrightShinyNonIndexedProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gObjectFullbrightShinyNonIndexedProgram.createShader(NULL, &mShinyUniforms);
|
success = gObjectFullbrightShinyNonIndexedProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1870,7 +1855,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectFullbrightShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gObjectFullbrightShinyNonIndexedWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gObjectFullbrightShinyNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectFullbrightShinyNonIndexedWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
gObjectFullbrightShinyNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gObjectFullbrightShinyNonIndexedWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
success = gObjectFullbrightShinyNonIndexedWaterProgram.createShader(NULL, &mShinyUniforms);
|
success = gObjectFullbrightShinyNonIndexedWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -1949,12 +1934,11 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectBumpProgram.mShaderFiles.push_back(make_pair("objects/bumpF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gObjectBumpProgram.mShaderFiles.push_back(make_pair("objects/bumpF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gObjectBumpProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectBumpProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gObjectBumpProgram.createShader(NULL, NULL);
|
success = gObjectBumpProgram.createShader(NULL, NULL);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{ //lldrawpoolbump assumes "texture0" has channel 0 and "texture1" has channel 1
|
{ //lldrawpoolbump assumes "texture0" has channel 0 and "texture1" has channel 1
|
||||||
gObjectBumpProgram.bind();
|
gObjectBumpProgram.bind();
|
||||||
gObjectBumpProgram.uniform1i("texture0", 0);
|
gObjectBumpProgram.uniform1i(sTexture0, 0);
|
||||||
gObjectBumpProgram.uniform1i("texture1", 1);
|
gObjectBumpProgram.uniform1i(sTexture1, 1);
|
||||||
gObjectBumpProgram.unbind();
|
gObjectBumpProgram.unbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2103,7 +2087,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
|
gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gObjectShinyProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gObjectShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gObjectShinyProgram.createShader(NULL, &mShinyUniforms);
|
success = gObjectShinyProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -2120,7 +2104,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
|
gObjectShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gObjectShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
gObjectShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gObjectShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
success = gObjectShinyWaterProgram.createShader(NULL, &mShinyUniforms);
|
success = gObjectShinyWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -2136,7 +2120,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB));
|
gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gObjectFullbrightShinyProgram.createShader(NULL, &mShinyUniforms);
|
success = gObjectFullbrightShinyProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -2154,7 +2138,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gObjectFullbrightShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gObjectFullbrightShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
gObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
success = gObjectFullbrightShinyWaterProgram.createShader(NULL, &mShinyUniforms);
|
success = gObjectFullbrightShinyWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mVertexShaderLevel[SHADER_AVATAR] > 0)
|
if (mVertexShaderLevel[SHADER_AVATAR] > 0)
|
||||||
@@ -2168,6 +2152,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectSimpleProgram.mFeatures.hasAtmospherics = true;
|
gSkinnedObjectSimpleProgram.mFeatures.hasAtmospherics = true;
|
||||||
gSkinnedObjectSimpleProgram.mFeatures.hasLighting = true;
|
gSkinnedObjectSimpleProgram.mFeatures.hasLighting = true;
|
||||||
gSkinnedObjectSimpleProgram.mFeatures.hasObjectSkinning = true;
|
gSkinnedObjectSimpleProgram.mFeatures.hasObjectSkinning = true;
|
||||||
|
gSkinnedObjectSimpleProgram.mFeatures.hasAlphaMask = true;
|
||||||
gSkinnedObjectSimpleProgram.mFeatures.disableTextureIndex = true;
|
gSkinnedObjectSimpleProgram.mFeatures.disableTextureIndex = true;
|
||||||
gSkinnedObjectSimpleProgram.mShaderFiles.clear();
|
gSkinnedObjectSimpleProgram.mShaderFiles.clear();
|
||||||
gSkinnedObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
gSkinnedObjectSimpleProgram.mShaderFiles.push_back(make_pair("objects/simpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
@@ -2184,6 +2169,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectFullbrightProgram.mFeatures.hasTransport = true;
|
gSkinnedObjectFullbrightProgram.mFeatures.hasTransport = true;
|
||||||
gSkinnedObjectFullbrightProgram.mFeatures.isFullbright = true;
|
gSkinnedObjectFullbrightProgram.mFeatures.isFullbright = true;
|
||||||
gSkinnedObjectFullbrightProgram.mFeatures.hasObjectSkinning = true;
|
gSkinnedObjectFullbrightProgram.mFeatures.hasObjectSkinning = true;
|
||||||
|
gSkinnedObjectFullbrightProgram.mFeatures.hasAlphaMask = true;
|
||||||
gSkinnedObjectFullbrightProgram.mFeatures.disableTextureIndex = true;
|
gSkinnedObjectFullbrightProgram.mFeatures.disableTextureIndex = true;
|
||||||
gSkinnedObjectFullbrightProgram.mShaderFiles.clear();
|
gSkinnedObjectFullbrightProgram.mShaderFiles.clear();
|
||||||
gSkinnedObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
gSkinnedObjectFullbrightProgram.mShaderFiles.push_back(make_pair("objects/fullbrightSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
@@ -2234,12 +2220,13 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectFullbrightShinyProgram.mFeatures.isShiny = true;
|
gSkinnedObjectFullbrightShinyProgram.mFeatures.isShiny = true;
|
||||||
gSkinnedObjectFullbrightShinyProgram.mFeatures.isFullbright = true;
|
gSkinnedObjectFullbrightShinyProgram.mFeatures.isFullbright = true;
|
||||||
gSkinnedObjectFullbrightShinyProgram.mFeatures.hasObjectSkinning = true;
|
gSkinnedObjectFullbrightShinyProgram.mFeatures.hasObjectSkinning = true;
|
||||||
|
gSkinnedObjectFullbrightShinyProgram.mFeatures.hasAlphaMask = true;
|
||||||
gSkinnedObjectFullbrightShinyProgram.mFeatures.disableTextureIndex = true;
|
gSkinnedObjectFullbrightShinyProgram.mFeatures.disableTextureIndex = true;
|
||||||
gSkinnedObjectFullbrightShinyProgram.mShaderFiles.clear();
|
gSkinnedObjectFullbrightShinyProgram.mShaderFiles.clear();
|
||||||
gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gSkinnedObjectFullbrightShinyProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gSkinnedObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gSkinnedObjectFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gSkinnedObjectFullbrightShinyProgram.createShader(NULL, &mShinyUniforms);
|
success = gSkinnedObjectFullbrightShinyProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -2250,13 +2237,14 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectShinySimpleProgram.mFeatures.hasGamma = true;
|
gSkinnedObjectShinySimpleProgram.mFeatures.hasGamma = true;
|
||||||
gSkinnedObjectShinySimpleProgram.mFeatures.hasAtmospherics = true;
|
gSkinnedObjectShinySimpleProgram.mFeatures.hasAtmospherics = true;
|
||||||
gSkinnedObjectShinySimpleProgram.mFeatures.hasObjectSkinning = true;
|
gSkinnedObjectShinySimpleProgram.mFeatures.hasObjectSkinning = true;
|
||||||
|
gSkinnedObjectShinySimpleProgram.mFeatures.hasAlphaMask = true;
|
||||||
gSkinnedObjectShinySimpleProgram.mFeatures.isShiny = true;
|
gSkinnedObjectShinySimpleProgram.mFeatures.isShiny = true;
|
||||||
gSkinnedObjectShinySimpleProgram.mFeatures.disableTextureIndex = true;
|
gSkinnedObjectShinySimpleProgram.mFeatures.disableTextureIndex = true;
|
||||||
gSkinnedObjectShinySimpleProgram.mShaderFiles.clear();
|
gSkinnedObjectShinySimpleProgram.mShaderFiles.clear();
|
||||||
gSkinnedObjectShinySimpleProgram.mShaderFiles.push_back(make_pair("objects/shinySimpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
gSkinnedObjectShinySimpleProgram.mShaderFiles.push_back(make_pair("objects/shinySimpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gSkinnedObjectShinySimpleProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gSkinnedObjectShinySimpleProgram.mShaderFiles.push_back(make_pair("objects/shinyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gSkinnedObjectShinySimpleProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gSkinnedObjectShinySimpleProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gSkinnedObjectShinySimpleProgram.createShader(NULL, &mShinyUniforms);
|
success = gSkinnedObjectShinySimpleProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -2287,6 +2275,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectFullbrightWaterProgram.mFeatures.hasTransport = true;
|
gSkinnedObjectFullbrightWaterProgram.mFeatures.hasTransport = true;
|
||||||
gSkinnedObjectFullbrightWaterProgram.mFeatures.isFullbright = true;
|
gSkinnedObjectFullbrightWaterProgram.mFeatures.isFullbright = true;
|
||||||
gSkinnedObjectFullbrightWaterProgram.mFeatures.hasObjectSkinning = true;
|
gSkinnedObjectFullbrightWaterProgram.mFeatures.hasObjectSkinning = true;
|
||||||
|
gSkinnedObjectFullbrightWaterProgram.mFeatures.hasAlphaMask = true;
|
||||||
gSkinnedObjectFullbrightWaterProgram.mFeatures.hasWaterFog = true;
|
gSkinnedObjectFullbrightWaterProgram.mFeatures.hasWaterFog = true;
|
||||||
gSkinnedObjectFullbrightWaterProgram.mFeatures.disableTextureIndex = true;
|
gSkinnedObjectFullbrightWaterProgram.mFeatures.disableTextureIndex = true;
|
||||||
gSkinnedObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gSkinnedObjectFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
@@ -2306,6 +2295,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isShiny = true;
|
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isShiny = true;
|
||||||
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isFullbright = true;
|
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.isFullbright = true;
|
||||||
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasObjectSkinning = true;
|
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasObjectSkinning = true;
|
||||||
|
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasAlphaMask = true;
|
||||||
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasWaterFog = true;
|
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.hasWaterFog = true;
|
||||||
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.disableTextureIndex = true;
|
gSkinnedObjectFullbrightShinyWaterProgram.mFeatures.disableTextureIndex = true;
|
||||||
gSkinnedObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gSkinnedObjectFullbrightShinyWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
@@ -2313,7 +2303,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
gSkinnedObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinySkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gSkinnedObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gSkinnedObjectFullbrightShinyWaterProgram.mShaderFiles.push_back(make_pair("objects/fullbrightShinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gSkinnedObjectFullbrightShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gSkinnedObjectFullbrightShinyWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gSkinnedObjectFullbrightShinyWaterProgram.createShader(NULL, &mShinyUniforms);
|
success = gSkinnedObjectFullbrightShinyWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -2324,6 +2314,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasGamma = true;
|
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasGamma = true;
|
||||||
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasAtmospherics = true;
|
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasAtmospherics = true;
|
||||||
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasObjectSkinning = true;
|
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasObjectSkinning = true;
|
||||||
|
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasAlphaMask = true;
|
||||||
gSkinnedObjectShinySimpleWaterProgram.mFeatures.isShiny = true;
|
gSkinnedObjectShinySimpleWaterProgram.mFeatures.isShiny = true;
|
||||||
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasWaterFog = true;
|
gSkinnedObjectShinySimpleWaterProgram.mFeatures.hasWaterFog = true;
|
||||||
gSkinnedObjectShinySimpleWaterProgram.mFeatures.disableTextureIndex = true;
|
gSkinnedObjectShinySimpleWaterProgram.mFeatures.disableTextureIndex = true;
|
||||||
@@ -2332,7 +2323,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||||||
gSkinnedObjectShinySimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/shinySimpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
gSkinnedObjectShinySimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/shinySimpleSkinnedV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gSkinnedObjectShinySimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gSkinnedObjectShinySimpleWaterProgram.mShaderFiles.push_back(make_pair("objects/shinyWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gSkinnedObjectShinySimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
gSkinnedObjectShinySimpleWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
|
||||||
success = gSkinnedObjectShinySimpleWaterProgram.createShader(NULL, &mShinyUniforms);
|
success = gSkinnedObjectShinySimpleWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2370,7 +2361,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
|
|||||||
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
|
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gAvatarProgram.mShaderFiles.push_back(make_pair("avatar/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
|
gAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
|
||||||
success = gAvatarProgram.createShader(NULL, &mAvatarUniforms);
|
success = gAvatarProgram.createShader(NULL, NULL);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
@@ -2389,7 +2380,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
|
|||||||
// Note: no cloth under water:
|
// Note: no cloth under water:
|
||||||
gAvatarWaterProgram.mShaderLevel = llmin(mVertexShaderLevel[SHADER_AVATAR], 1);
|
gAvatarWaterProgram.mShaderLevel = llmin(mVertexShaderLevel[SHADER_AVATAR], 1);
|
||||||
gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
gAvatarWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
|
||||||
success = gAvatarWaterProgram.createShader(NULL, &mAvatarUniforms);
|
success = gAvatarWaterProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Keep track of avatar levels
|
/// Keep track of avatar levels
|
||||||
@@ -2408,7 +2399,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
|
|||||||
gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB));
|
gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gAvatarPickProgram.mShaderFiles.push_back(make_pair("avatar/pickAvatarF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gAvatarPickProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
|
gAvatarPickProgram.mShaderLevel = mVertexShaderLevel[SHADER_AVATAR];
|
||||||
success = gAvatarPickProgram.createShader(NULL, &mAvatarUniforms);
|
success = gAvatarPickProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -2490,7 +2481,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gSplatTextureRectProgram.bind();
|
gSplatTextureRectProgram.bind();
|
||||||
gSplatTextureRectProgram.uniform1i("screenMap", 0);
|
gSplatTextureRectProgram.uniform1i(sScreenMap, 0);
|
||||||
gSplatTextureRectProgram.unbind();
|
gSplatTextureRectProgram.unbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2506,8 +2497,8 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gGlowCombineProgram.bind();
|
gGlowCombineProgram.bind();
|
||||||
gGlowCombineProgram.uniform1i("glowMap", 0);
|
gGlowCombineProgram.uniform1i(sGlowMap, 0);
|
||||||
gGlowCombineProgram.uniform1i("screenMap", 1);
|
gGlowCombineProgram.uniform1i(sScreenMap, 1);
|
||||||
gGlowCombineProgram.unbind();
|
gGlowCombineProgram.unbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2523,8 +2514,8 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gGlowCombineFXAAProgram.bind();
|
gGlowCombineFXAAProgram.bind();
|
||||||
gGlowCombineFXAAProgram.uniform1i("glowMap", 0);
|
gGlowCombineFXAAProgram.uniform1i(sGlowMap, 0);
|
||||||
gGlowCombineFXAAProgram.uniform1i("screenMap", 1);
|
gGlowCombineFXAAProgram.uniform1i(sScreenMap, 1);
|
||||||
gGlowCombineFXAAProgram.unbind();
|
gGlowCombineFXAAProgram.unbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2541,8 +2532,8 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gTwoTextureAddProgram.bind();
|
gTwoTextureAddProgram.bind();
|
||||||
gTwoTextureAddProgram.uniform1i("tex0", 0);
|
gTwoTextureAddProgram.uniform1i(sTex0, 0);
|
||||||
gTwoTextureAddProgram.uniform1i("tex1", 1);
|
gTwoTextureAddProgram.uniform1i(sTex1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2557,7 +2548,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gOneTextureNoColorProgram.bind();
|
gOneTextureNoColorProgram.bind();
|
||||||
gOneTextureNoColorProgram.uniform1i("tex0", 0);
|
gOneTextureNoColorProgram.uniform1i(sTex0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2577,7 +2568,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gSolidColorProgram.bind();
|
gSolidColorProgram.bind();
|
||||||
gSolidColorProgram.uniform1i("tex0", 0);
|
gSolidColorProgram.uniform1i(sTex0, 0);
|
||||||
gSolidColorProgram.unbind();
|
gSolidColorProgram.unbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2622,6 +2613,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
|
|||||||
success = gClipProgram.createShader(NULL, NULL);
|
success = gClipProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
gDownsampleDepthProgram.mName = "DownsampleDepth Shader";
|
||||||
|
gDownsampleDepthProgram.mShaderFiles.clear();
|
||||||
|
gDownsampleDepthProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
|
gDownsampleDepthProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
|
gDownsampleDepthProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
|
||||||
|
success = gDownsampleDepthProgram.createShader(NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
gDownsampleDepthRectProgram.mName = "DownsampleDepthRect Shader";
|
||||||
|
gDownsampleDepthRectProgram.mShaderFiles.clear();
|
||||||
|
gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB));
|
||||||
|
gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
|
gDownsampleDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
|
||||||
|
success = gDownsampleDepthRectProgram.createShader(NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
gAlphaMaskProgram.mName = "Alpha Mask Shader";
|
gAlphaMaskProgram.mName = "Alpha Mask Shader";
|
||||||
@@ -2660,7 +2671,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
|
|||||||
gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gWLSkyProgram.mShaderFiles.push_back(make_pair("windlight/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
|
gWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
|
||||||
gWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
gWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||||
success = gWLSkyProgram.createShader(NULL, &mWLUniforms);
|
success = gWLSkyProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@@ -2672,7 +2683,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
|
|||||||
gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
gWLCloudProgram.mShaderFiles.push_back(make_pair("windlight/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||||
gWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
|
gWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
|
||||||
gWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
gWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
|
||||||
success = gWLCloudProgram.createShader(NULL, &mWLUniforms);
|
success = gWLCloudProgram.createShader(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|||||||
@@ -80,57 +80,6 @@ public:
|
|||||||
SHADER_COUNT
|
SHADER_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
SHINY_ORIGIN = END_RESERVED_UNIFORMS
|
|
||||||
} eShinyUniforms;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
WATER_SCREENTEX = END_RESERVED_UNIFORMS,
|
|
||||||
WATER_SCREENDEPTH,
|
|
||||||
WATER_REFTEX,
|
|
||||||
WATER_EYEVEC,
|
|
||||||
WATER_TIME,
|
|
||||||
WATER_WAVE_DIR1,
|
|
||||||
WATER_WAVE_DIR2,
|
|
||||||
WATER_LIGHT_DIR,
|
|
||||||
WATER_SPECULAR,
|
|
||||||
WATER_SPECULAR_EXP,
|
|
||||||
WATER_FOGCOLOR,
|
|
||||||
WATER_FOGDENSITY,
|
|
||||||
WATER_REFSCALE,
|
|
||||||
WATER_WATERHEIGHT,
|
|
||||||
} eWaterUniforms;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
WL_CAMPOSLOCAL = END_RESERVED_UNIFORMS,
|
|
||||||
WL_WATERHEIGHT
|
|
||||||
} eWLUniforms;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
TERRAIN_DETAIL0 = END_RESERVED_UNIFORMS,
|
|
||||||
TERRAIN_DETAIL1,
|
|
||||||
TERRAIN_DETAIL2,
|
|
||||||
TERRAIN_DETAIL3,
|
|
||||||
TERRAIN_ALPHARAMP
|
|
||||||
} eTerrainUniforms;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GLOW_DELTA = END_RESERVED_UNIFORMS
|
|
||||||
} eGlowUniforms;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
AVATAR_MATRIX = END_RESERVED_UNIFORMS,
|
|
||||||
AVATAR_WIND,
|
|
||||||
AVATAR_SINWAVE,
|
|
||||||
AVATAR_GRAVITY,
|
|
||||||
} eAvatarUniforms;
|
|
||||||
|
|
||||||
// simple model of forward iterator
|
// simple model of forward iterator
|
||||||
// http://www.sgi.com/tech/stl/ForwardIterator.html
|
// http://www.sgi.com/tech/stl/ForwardIterator.html
|
||||||
class shader_iter
|
class shader_iter
|
||||||
@@ -235,6 +184,7 @@ extern LLGLSLShader gTransformTexCoordProgram;
|
|||||||
extern LLGLSLShader gTransformNormalProgram;
|
extern LLGLSLShader gTransformNormalProgram;
|
||||||
extern LLGLSLShader gTransformColorProgram;
|
extern LLGLSLShader gTransformColorProgram;
|
||||||
extern LLGLSLShader gTransformTangentProgram;
|
extern LLGLSLShader gTransformTangentProgram;
|
||||||
|
|
||||||
//utility shaders
|
//utility shaders
|
||||||
extern LLGLSLShader gOcclusionProgram;
|
extern LLGLSLShader gOcclusionProgram;
|
||||||
extern LLGLSLShader gOcclusionCubeProgram;
|
extern LLGLSLShader gOcclusionCubeProgram;
|
||||||
@@ -244,6 +194,8 @@ extern LLGLSLShader gSplatTextureRectProgram;
|
|||||||
extern LLGLSLShader gGlowCombineFXAAProgram;
|
extern LLGLSLShader gGlowCombineFXAAProgram;
|
||||||
extern LLGLSLShader gDebugProgram;
|
extern LLGLSLShader gDebugProgram;
|
||||||
extern LLGLSLShader gClipProgram;
|
extern LLGLSLShader gClipProgram;
|
||||||
|
extern LLGLSLShader gDownsampleDepthProgram;
|
||||||
|
extern LLGLSLShader gDownsampleDepthRectProgram;
|
||||||
|
|
||||||
//output tex0[tc0] + tex1[tc1]
|
//output tex0[tc0] + tex1[tc1]
|
||||||
extern LLGLSLShader gTwoTextureAddProgram;
|
extern LLGLSLShader gTwoTextureAddProgram;
|
||||||
|
|||||||
@@ -1208,7 +1208,12 @@ void LLViewerFetchedTexture::addToCreateTexture()
|
|||||||
destroyRawImage();
|
destroyRawImage();
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
mRawImage->scale(w >> i, h >> i) ;
|
|
||||||
|
{
|
||||||
|
//make a duplicate in case somebody else is using this raw image
|
||||||
|
mRawImage = mRawImage->duplicate();
|
||||||
|
mRawImage->scale(w >> i, h >> i) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2540,7 +2545,11 @@ void LLViewerFetchedTexture::setCachedRawImage()
|
|||||||
mIsRawImageValid = 0;
|
mIsRawImageValid = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mRawImage->scale(w >> i, h >> i) ;
|
{
|
||||||
|
//make a duplicate in case somebody else is using this raw image
|
||||||
|
mRawImage = mRawImage->duplicate();
|
||||||
|
mRawImage->scale(w >> i, h >> i) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(mCachedRawImage.notNull())
|
if(mCachedRawImage.notNull())
|
||||||
mCachedRawImage->setInCache(false);
|
mCachedRawImage->setInCache(false);
|
||||||
|
|||||||
@@ -4733,7 +4733,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||||||
|
|
||||||
if (is_rigged)
|
if (is_rigged)
|
||||||
{
|
{
|
||||||
drawablep->setState(LLDrawable::RIGGED);
|
if (!drawablep->isState(LLDrawable::RIGGED))
|
||||||
|
{
|
||||||
|
drawablep->setState(LLDrawable::RIGGED);
|
||||||
|
|
||||||
|
//first time this is drawable is being marked as rigged,
|
||||||
|
// do another LoD update to use avatar bounding box
|
||||||
|
vobj->updateLOD();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -320,12 +320,12 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader)
|
|||||||
if (shader->mShaderGroup == LLGLSLShader::SG_WATER)
|
if (shader->mShaderGroup == LLGLSLShader::SG_WATER)
|
||||||
{
|
{
|
||||||
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::getInstance()->getRotatedLightDir().mV);
|
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::getInstance()->getRotatedLightDir().mV);
|
||||||
shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV);
|
shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
|
||||||
shader->uniform4fv("waterFogColor", 1, LLDrawPoolWater::sWaterFogColor.mV);
|
shader->uniform4fv(LLShaderMgr::WATER_FOGCOLOR, 1, LLDrawPoolWater::sWaterFogColor.mV);
|
||||||
shader->uniform4fv("waterPlane", 1, mWaterPlane.mV);
|
shader->uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, mWaterPlane.mV);
|
||||||
shader->uniform1f("waterFogDensity", getFogDensity());
|
shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, getFogDensity());
|
||||||
shader->uniform1f("waterFogKS", mWaterFogKS);
|
shader->uniform1f(LLShaderMgr::WATER_FOGKS, mWaterFogKS);
|
||||||
shader->uniform1f("distance_multiplier", 0);
|
shader->uniform1f(LLViewerShaderMgr::DISTANCE_MULTIPLIER, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -373,8 +373,8 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader)
|
|||||||
|
|
||||||
if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT)
|
if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT)
|
||||||
{
|
{
|
||||||
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV);
|
shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV);
|
||||||
shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV);
|
shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (shader->mShaderGroup == LLGLSLShader::SG_SKY)
|
else if (shader->mShaderGroup == LLGLSLShader::SG_SKY)
|
||||||
@@ -382,7 +382,7 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader)
|
|||||||
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mClampedLightDir.mV);
|
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mClampedLightDir.mV);
|
||||||
}
|
}
|
||||||
|
|
||||||
shader->uniform1f("scene_light_strength", mSceneLightStrength);
|
shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,22 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
static LLStaticHashedString sStarBrightness("star_brightness");
|
||||||
|
static LLStaticHashedString sPresetNum("preset_num");
|
||||||
|
static LLStaticHashedString sSunAngle("sun_angle");
|
||||||
|
static LLStaticHashedString sEastAngle("east_angle");
|
||||||
|
static LLStaticHashedString sEnableCloudScroll("enable_cloud_scroll");
|
||||||
|
static LLStaticHashedString sCloudScrollRate("cloud_scroll_rate");
|
||||||
|
static LLStaticHashedString sLightNorm("lightnorm");
|
||||||
|
static LLStaticHashedString sCloudDensity("cloud_pos_density1");
|
||||||
|
static LLStaticHashedString sCloudScale("cloud_scale");
|
||||||
|
static LLStaticHashedString sCloudShadow("cloud_shadow");
|
||||||
|
static LLStaticHashedString sDensityMultiplier("density_multiplier");
|
||||||
|
static LLStaticHashedString sDistanceMultiplier("distance_multiplier");
|
||||||
|
static LLStaticHashedString sHazeDensity("haze_density");
|
||||||
|
static LLStaticHashedString sHazeHorizon("haze_horizon");
|
||||||
|
static LLStaticHashedString sMaxY("max_y");
|
||||||
|
|
||||||
LLWLParamSet::LLWLParamSet(void) :
|
LLWLParamSet::LLWLParamSet(void) :
|
||||||
mName("Unnamed Preset"),
|
mName("Unnamed Preset"),
|
||||||
mCloudScrollXOffset(0.f), mCloudScrollYOffset(0.f)
|
mCloudScrollXOffset(0.f), mCloudScrollYOffset(0.f)
|
||||||
@@ -54,21 +70,24 @@ static LLFastTimer::DeclareTimer FTM_WL_PARAM_UPDATE("WL Param Update");
|
|||||||
void LLWLParamSet::update(LLGLSLShader * shader) const
|
void LLWLParamSet::update(LLGLSLShader * shader) const
|
||||||
{
|
{
|
||||||
LLFastTimer t(FTM_WL_PARAM_UPDATE);
|
LLFastTimer t(FTM_WL_PARAM_UPDATE);
|
||||||
|
LLSD::map_const_iterator i = mParamValues.beginMap();
|
||||||
for(LLSD::map_const_iterator i = mParamValues.beginMap();
|
std::vector<LLStaticHashedString>::const_iterator n = mParamHashedNames.begin();
|
||||||
i != mParamValues.endMap();
|
for(;(i != mParamValues.endMap()) && (n != mParamHashedNames.end());++i, n++)
|
||||||
++i)
|
|
||||||
{
|
{
|
||||||
const std::string& param = i->first;
|
const LLStaticHashedString& param = *n;
|
||||||
|
|
||||||
if( param == "star_brightness" || param == "preset_num" || param == "sun_angle" ||
|
// check that our pre-hashed names are still tracking the mParamValues map correctly
|
||||||
param == "east_angle" || param == "enable_cloud_scroll" ||
|
//
|
||||||
param == "cloud_scroll_rate" || param == "lightnorm" )
|
llassert(param.String() == i->first);
|
||||||
|
|
||||||
|
if (param == sStarBrightness || param == sPresetNum || param == sSunAngle ||
|
||||||
|
param == sEastAngle || param == sEnableCloudScroll ||
|
||||||
|
param == sCloudScrollRate || param == sLightNorm )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == "cloud_pos_density1")
|
if (param == sCloudDensity)
|
||||||
{
|
{
|
||||||
LLVector4 val;
|
LLVector4 val;
|
||||||
val.mV[0] = F32(i->second[0].asReal()) + mCloudScrollXOffset;
|
val.mV[0] = F32(i->second[0].asReal()) + mCloudScrollXOffset;
|
||||||
@@ -80,10 +99,10 @@ void LLWLParamSet::update(LLGLSLShader * shader) const
|
|||||||
shader->uniform4fv(param, 1, val.mV);
|
shader->uniform4fv(param, 1, val.mV);
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
else if (param == "cloud_scale" || param == "cloud_shadow" ||
|
else if (param == sCloudScale || param == sCloudShadow ||
|
||||||
param == "density_multiplier" || param == "distance_multiplier" ||
|
param == sDensityMultiplier || param == sDistanceMultiplier ||
|
||||||
param == "haze_density" || param == "haze_horizon" ||
|
param == sHazeDensity || param == sHazeHorizon ||
|
||||||
param == "max_y" )
|
param == sMaxY )
|
||||||
{
|
{
|
||||||
F32 val = (F32) i->second[0].asReal();
|
F32 val = (F32) i->second[0].asReal();
|
||||||
|
|
||||||
@@ -384,3 +403,14 @@ void LLWLParamSet::updateCloudScrolling(void)
|
|||||||
mCloudScrollYOffset += F32(delta_t * (getCloudScrollY() - 10.f) / 100.f);
|
mCloudScrollYOffset += F32(delta_t * (getCloudScrollY() - 10.f) / 100.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLWLParamSet::updateHashedNames()
|
||||||
|
{
|
||||||
|
mParamHashedNames.clear();
|
||||||
|
// Iterate through values
|
||||||
|
for(LLSD::map_iterator iter = mParamValues.beginMap(); iter != mParamValues.endMap(); ++iter)
|
||||||
|
{
|
||||||
|
mParamHashedNames.push_back(LLStaticHashedString(iter->first));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include "v4math.h"
|
#include "v4math.h"
|
||||||
#include "v4color.h"
|
#include "v4color.h"
|
||||||
|
#include "llstaticstringtable.h"
|
||||||
|
|
||||||
class LLWLParamSet;
|
class LLWLParamSet;
|
||||||
class LLGLSLShader;
|
class LLGLSLShader;
|
||||||
@@ -54,9 +55,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
LLSD mParamValues;
|
LLSD mParamValues;
|
||||||
|
std::vector<LLStaticHashedString> mParamHashedNames;
|
||||||
|
|
||||||
float mCloudScrollXOffset, mCloudScrollYOffset;
|
float mCloudScrollXOffset, mCloudScrollYOffset;
|
||||||
|
|
||||||
|
void updateHashedNames();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LLWLParamSet();
|
LLWLParamSet();
|
||||||
@@ -184,6 +188,8 @@ inline void LLWLParamSet::setAll(const LLSD& val)
|
|||||||
if(val.isMap()) {
|
if(val.isMap()) {
|
||||||
mParamValues = val;
|
mParamValues = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateHashedNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const LLSD& LLWLParamSet::getAll()
|
inline const LLSD& LLWLParamSet::getAll()
|
||||||
|
|||||||
@@ -204,6 +204,12 @@ LLFastTimer::DeclareTimer FTM_RENDER_DEFERRED("Deferred Shading");
|
|||||||
static LLFastTimer::DeclareTimer FTM_STATESORT_DRAWABLE("Sort Drawables");
|
static LLFastTimer::DeclareTimer FTM_STATESORT_DRAWABLE("Sort Drawables");
|
||||||
static LLFastTimer::DeclareTimer FTM_STATESORT_POSTSORT("Post Sort");
|
static LLFastTimer::DeclareTimer FTM_STATESORT_POSTSORT("Post Sort");
|
||||||
|
|
||||||
|
static LLStaticHashedString sNormMat("norm_mat");
|
||||||
|
static LLStaticHashedString sOffset("offset");
|
||||||
|
static LLStaticHashedString sDelta("delta");
|
||||||
|
static LLStaticHashedString sDistFactor("dist_factor");
|
||||||
|
static LLStaticHashedString sKern("kern");
|
||||||
|
static LLStaticHashedString sKernScale("kern_scale");
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
std::string gPoolNames[] =
|
std::string gPoolNames[] =
|
||||||
{
|
{
|
||||||
@@ -768,10 +774,12 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||||||
BOOL RenderDepthOfField = gSavedSettings.getBOOL("RenderDepthOfField");
|
BOOL RenderDepthOfField = gSavedSettings.getBOOL("RenderDepthOfField");
|
||||||
static const LLCachedControl<F32> RenderShadowResolutionScale("RenderShadowResolutionScale",1.0f);
|
static const LLCachedControl<F32> RenderShadowResolutionScale("RenderShadowResolutionScale",1.0f);
|
||||||
|
|
||||||
|
const U32 occlusion_divisor = 3;
|
||||||
|
|
||||||
//allocate deferred rendering color buffers
|
//allocate deferred rendering color buffers
|
||||||
if (!mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
if (!mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
||||||
if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
||||||
|
if (!mOcclusionDepth.allocate(resX/occlusion_divisor, resY/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
||||||
if (!addDeferredAttachments(mDeferredScreen)) return false;
|
if (!addDeferredAttachments(mDeferredScreen)) return false;
|
||||||
|
|
||||||
if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
if (!mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
||||||
@@ -801,6 +809,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||||||
for (U32 i = 0; i < 4; i++)
|
for (U32 i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false;
|
if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false;
|
||||||
|
if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -808,6 +817,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||||||
for (U32 i = 0; i < 4; i++)
|
for (U32 i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
mShadow[i].release();
|
mShadow[i].release();
|
||||||
|
mShadowOcclusion[i].release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,6 +830,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||||||
for (U32 i = 4; i < 6; i++)
|
for (U32 i = 4; i < 6; i++)
|
||||||
{
|
{
|
||||||
if (!mShadow[i].allocate(spot_shadow_map_width, height, 0, TRUE, FALSE)) return false;
|
if (!mShadow[i].allocate(spot_shadow_map_width, height, 0, TRUE, FALSE)) return false;
|
||||||
|
if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -827,6 +838,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||||||
for (U32 i = 4; i < 6; i++)
|
for (U32 i = 4; i < 6; i++)
|
||||||
{
|
{
|
||||||
mShadow[i].release();
|
mShadow[i].release();
|
||||||
|
mShadowOcclusion[i].release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,13 +855,14 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||||||
for (U32 i = 0; i < 6; i++)
|
for (U32 i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
mShadow[i].release();
|
mShadow[i].release();
|
||||||
|
mShadowOcclusion[i].release();
|
||||||
}
|
}
|
||||||
mFXAABuffer.release();
|
mFXAABuffer.release();
|
||||||
mScreen.release();
|
mScreen.release();
|
||||||
mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
|
mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
|
||||||
mDeferredDepth.release();
|
mDeferredDepth.release();
|
||||||
|
mOcclusionDepth.release();
|
||||||
|
|
||||||
if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
||||||
if(samples > 1 && mScreen.getFBO())
|
if(samples > 1 && mScreen.getFBO())
|
||||||
{
|
{
|
||||||
@@ -969,12 +982,14 @@ void LLPipeline::releaseScreenBuffers()
|
|||||||
mDeferredScreen.release();
|
mDeferredScreen.release();
|
||||||
mDeferredDepth.release();
|
mDeferredDepth.release();
|
||||||
mDeferredLight.release();
|
mDeferredLight.release();
|
||||||
|
mOcclusionDepth.release();
|
||||||
|
|
||||||
//mHighlight.release();
|
//mHighlight.release();
|
||||||
|
|
||||||
for (U32 i = 0; i < 6; i++)
|
for (U32 i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
mShadow[i].release();
|
mShadow[i].release();
|
||||||
|
mShadowOcclusion[i].release();
|
||||||
}
|
}
|
||||||
|
|
||||||
mSampleBuffer.release();
|
mSampleBuffer.release();
|
||||||
@@ -2161,7 +2176,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
|
|||||||
|
|
||||||
if (to_texture)
|
if (to_texture)
|
||||||
{
|
{
|
||||||
mScreen.bindTarget();
|
if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
|
||||||
|
{
|
||||||
|
mOcclusionDepth.bindTarget();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mScreen.bindTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sUseOcclusion > 1)
|
if (sUseOcclusion > 1)
|
||||||
@@ -2299,7 +2321,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
|
|||||||
|
|
||||||
if (to_texture)
|
if (to_texture)
|
||||||
{
|
{
|
||||||
mScreen.flush();
|
if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
|
||||||
|
{
|
||||||
|
mOcclusionDepth.flush();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mScreen.flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2367,6 +2396,79 @@ void LLPipeline::markOccluder(LLSpatialGroup* group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space)
|
||||||
|
{
|
||||||
|
LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||||
|
|
||||||
|
LLGLSLShader* shader = NULL;
|
||||||
|
|
||||||
|
if (scratch_space)
|
||||||
|
{
|
||||||
|
scratch_space->copyContents(source,
|
||||||
|
0, 0, source.getWidth(), source.getHeight(),
|
||||||
|
0, 0, scratch_space->getWidth(), scratch_space->getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.bindTarget();
|
||||||
|
dest.clear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
if(mDeferredVB.isNull())
|
||||||
|
{
|
||||||
|
mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0);
|
||||||
|
mDeferredVB->allocateBuffer(8, 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLStrider<LLVector3> vert;
|
||||||
|
mDeferredVB->getVertexStrider(vert);
|
||||||
|
LLStrider<LLVector2> tc0;
|
||||||
|
|
||||||
|
vert[0].set(-1,1,0);
|
||||||
|
vert[1].set(-1,-3,0);
|
||||||
|
vert[2].set(3,1,0);
|
||||||
|
|
||||||
|
if (source.getUsage() == LLTexUnit::TT_RECT_TEXTURE)
|
||||||
|
{
|
||||||
|
shader = &gDownsampleDepthRectProgram;
|
||||||
|
shader->bind();
|
||||||
|
shader->uniform2f(sDelta, 1.f, 1.f);
|
||||||
|
shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, source.getWidth(), source.getHeight());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shader = &gDownsampleDepthProgram;
|
||||||
|
shader->bind();
|
||||||
|
shader->uniform2f(sDelta, 1.f/source.getWidth(), 1.f/source.getHeight());
|
||||||
|
shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, 1.f, 1.f);
|
||||||
|
}
|
||||||
|
|
||||||
|
gGL.getTexUnit(0)->bind(scratch_space ? scratch_space : &source, TRUE);
|
||||||
|
|
||||||
|
{
|
||||||
|
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
|
||||||
|
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||||
|
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
dest.flush();
|
||||||
|
|
||||||
|
if (last_shader)
|
||||||
|
{
|
||||||
|
last_shader->bind();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shader->unbind();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLPipeline::doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space)
|
||||||
|
{
|
||||||
|
downsampleDepthBuffer(source, dest, scratch_space);
|
||||||
|
dest.bindTarget();
|
||||||
|
doOcclusion(camera);
|
||||||
|
dest.flush();
|
||||||
|
}
|
||||||
|
|
||||||
void LLPipeline::doOcclusion(LLCamera& camera)
|
void LLPipeline::doOcclusion(LLCamera& camera)
|
||||||
{
|
{
|
||||||
if (LLGLSLShader::sNoFixedFunction && LLPipeline::sUseOcclusion > 1 && sCull->hasOcclusionGroups())
|
if (LLGLSLShader::sNoFixedFunction && LLPipeline::sUseOcclusion > 1 && sCull->hasOcclusionGroups())
|
||||||
@@ -4182,7 +4284,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
|
|||||||
gGL.setColorMask(true, false);
|
gGL.setColorMask(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
|
void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
|
||||||
{
|
{
|
||||||
LLFastTimer t(FTM_POST_DEFERRED_POOLS);
|
LLFastTimer t(FTM_POST_DEFERRED_POOLS);
|
||||||
U32 cur_type = 0;
|
U32 cur_type = 0;
|
||||||
@@ -4198,7 +4300,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
|
|||||||
gGL.setColorMask(true, false);
|
gGL.setColorMask(true, false);
|
||||||
|
|
||||||
pool_set_t::iterator iter1 = mPools.begin();
|
pool_set_t::iterator iter1 = mPools.begin();
|
||||||
BOOL occlude = LLPipeline::sUseOcclusion > 1;
|
BOOL occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion;
|
||||||
|
|
||||||
while ( iter1 != mPools.end() )
|
while ( iter1 != mPools.end() )
|
||||||
{
|
{
|
||||||
@@ -4212,7 +4314,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
|
|||||||
gGLLastMatrix = NULL;
|
gGLLastMatrix = NULL;
|
||||||
gGL.loadMatrix(gGLModelView);
|
gGL.loadMatrix(gGLModelView);
|
||||||
LLGLSLShader::bindNoShader();
|
LLGLSLShader::bindNoShader();
|
||||||
doOcclusion(camera);
|
doOcclusion(camera, mScreen, mOcclusionDepth, &mDeferredDepth);
|
||||||
gGL.setColorMask(true, false);
|
gGL.setColorMask(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5304,7 +5406,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera)
|
|||||||
// crazy cast so that we can overwrite the fade value
|
// crazy cast so that we can overwrite the fade value
|
||||||
// even though gcc enforces sets as const
|
// even though gcc enforces sets as const
|
||||||
// (fade value doesn't affect sort so this is safe)
|
// (fade value doesn't affect sort so this is safe)
|
||||||
Light* farthest_light = ((Light*) (&(*(mNearbyLights.rbegin()))));
|
Light* farthest_light = (const_cast<Light*>(&(*(mNearbyLights.rbegin()))));
|
||||||
if (light->dist < farthest_light->dist)
|
if (light->dist < farthest_light->dist)
|
||||||
{
|
{
|
||||||
if (farthest_light->fade >= 0.f)
|
if (farthest_light->fade >= 0.f)
|
||||||
@@ -7478,10 +7580,10 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n
|
|||||||
shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
|
shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
|
||||||
|
|
||||||
|
|
||||||
if (shader.getUniformLocation("norm_mat") >= 0)
|
if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0)
|
||||||
{
|
{
|
||||||
glh::matrix4f norm_mat = glh_get_current_modelview().inverse().transpose();
|
glh::matrix4f norm_mat = glh_get_current_modelview().inverse().transpose();
|
||||||
shader.uniformMatrix4fv("norm_mat", 1, FALSE, norm_mat.m);
|
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7617,8 +7719,8 @@ void LLPipeline::renderDeferredLighting()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gDeferredSunProgram.uniform3fv("offset", slice, offset);
|
gDeferredSunProgram.uniform3fv(sOffset, slice, offset);
|
||||||
gDeferredSunProgram.uniform2f("screenRes", mDeferredLight.getWidth(), mDeferredLight.getHeight());
|
gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight());
|
||||||
|
|
||||||
{
|
{
|
||||||
LLGLDisable blend(GL_BLEND);
|
LLGLDisable blend(GL_BLEND);
|
||||||
@@ -7662,10 +7764,10 @@ void LLPipeline::renderDeferredLighting()
|
|||||||
x += 1.f;
|
x += 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
gDeferredBlurLightProgram.uniform2f("delta", 1.f, 0.f);
|
gDeferredBlurLightProgram.uniform2f(sDelta, 1.f, 0.f);
|
||||||
gDeferredBlurLightProgram.uniform1f("dist_factor", dist_factor);
|
gDeferredBlurLightProgram.uniform1f(sDistFactor, dist_factor);
|
||||||
gDeferredBlurLightProgram.uniform3fv("kern", kern_length, gauss[0].mV);
|
gDeferredBlurLightProgram.uniform3fv(sKern, kern_length, gauss[0].mV);
|
||||||
gDeferredBlurLightProgram.uniform1f("kern_scale", blur_size * (kern_length/2.f - 0.5f));
|
gDeferredBlurLightProgram.uniform1f(sKernScale, blur_size * (kern_length/2.f - 0.5f));
|
||||||
|
|
||||||
{
|
{
|
||||||
LLGLDisable blend(GL_BLEND);
|
LLGLDisable blend(GL_BLEND);
|
||||||
@@ -7682,7 +7784,7 @@ void LLPipeline::renderDeferredLighting()
|
|||||||
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||||
mDeferredLight.bindTarget();
|
mDeferredLight.bindTarget();
|
||||||
|
|
||||||
gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f);
|
gDeferredBlurLightProgram.uniform2f(sDelta, 0.f, 1.f);
|
||||||
|
|
||||||
{
|
{
|
||||||
LLGLDisable blend(GL_BLEND);
|
LLGLDisable blend(GL_BLEND);
|
||||||
@@ -7749,7 +7851,7 @@ void LLPipeline::renderDeferredLighting()
|
|||||||
LLPipeline::END_RENDER_TYPES);
|
LLPipeline::END_RENDER_TYPES);
|
||||||
|
|
||||||
|
|
||||||
renderGeomPostDeferred(*LLViewerCamera::getInstance());
|
renderGeomPostDeferred(*LLViewerCamera::getInstance(), false);
|
||||||
gPipeline.popRenderTypeMask();
|
gPipeline.popRenderTypeMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8598,9 +8700,15 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
|
|||||||
gDeferredShadowCubeProgram.bind();
|
gDeferredShadowCubeProgram.bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLRenderTarget& occlusion_target = mShadowOcclusion[LLViewerCamera::sCurCameraID-1];
|
||||||
|
|
||||||
|
occlusion_target.bindTarget();
|
||||||
updateCull(shadow_cam, result);
|
updateCull(shadow_cam, result);
|
||||||
|
occlusion_target.flush();
|
||||||
|
|
||||||
stateSort(shadow_cam, result);
|
stateSort(shadow_cam, result);
|
||||||
|
|
||||||
|
|
||||||
//generate shadow map
|
//generate shadow map
|
||||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||||
gGL.pushMatrix();
|
gGL.pushMatrix();
|
||||||
@@ -8679,7 +8787,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
|
|||||||
gDeferredShadowCubeProgram.bind();
|
gDeferredShadowCubeProgram.bind();
|
||||||
gGLLastMatrix = NULL;
|
gGLLastMatrix = NULL;
|
||||||
gGL.loadMatrix(gGLModelView);
|
gGL.loadMatrix(gGLModelView);
|
||||||
doOcclusion(shadow_cam);
|
|
||||||
|
LLRenderTarget& occlusion_source = mShadow[LLViewerCamera::sCurCameraID-1];
|
||||||
|
|
||||||
|
doOcclusion(shadow_cam, occlusion_source, occlusion_target);
|
||||||
|
|
||||||
if (use_shader)
|
if (use_shader)
|
||||||
{
|
{
|
||||||
@@ -9823,7 +9934,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
|
|||||||
resY != avatar->mImpostor.getHeight())
|
resY != avatar->mImpostor.getHeight())
|
||||||
{
|
{
|
||||||
LLFastTimer t(FTM_IMPOSTOR_RESIZE);
|
LLFastTimer t(FTM_IMPOSTOR_RESIZE);
|
||||||
avatar->mImpostor.resize(resX,resY,GL_RGBA);
|
avatar->mImpostor.resize(resX,resY);
|
||||||
}
|
}
|
||||||
|
|
||||||
avatar->mImpostor.bindTarget();
|
avatar->mImpostor.bindTarget();
|
||||||
|
|||||||
@@ -177,6 +177,12 @@ public:
|
|||||||
// Object related methods
|
// Object related methods
|
||||||
void markVisible(LLDrawable *drawablep, LLCamera& camera);
|
void markVisible(LLDrawable *drawablep, LLCamera& camera);
|
||||||
void markOccluder(LLSpatialGroup* group);
|
void markOccluder(LLSpatialGroup* group);
|
||||||
|
|
||||||
|
//downsample source to dest, taking the maximum depth value per pixel in source and writing to dest
|
||||||
|
// if source's depth buffer cannot be bound for reading, a scratch space depth buffer must be provided
|
||||||
|
void downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL);
|
||||||
|
|
||||||
|
void doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL);
|
||||||
void doOcclusion(LLCamera& camera);
|
void doOcclusion(LLCamera& camera);
|
||||||
void markNotCulled(LLSpatialGroup* group, LLCamera &camera);
|
void markNotCulled(LLSpatialGroup* group, LLCamera &camera);
|
||||||
void markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE);
|
void markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE);
|
||||||
@@ -274,7 +280,7 @@ public:
|
|||||||
|
|
||||||
void renderGeom(LLCamera& camera, BOOL forceVBOUpdate = FALSE);
|
void renderGeom(LLCamera& camera, BOOL forceVBOUpdate = FALSE);
|
||||||
void renderGeomDeferred(LLCamera& camera);
|
void renderGeomDeferred(LLCamera& camera);
|
||||||
void renderGeomPostDeferred(LLCamera& camera);
|
void renderGeomPostDeferred(LLCamera& camera, bool do_occlusion=true);
|
||||||
void renderGeomShadow(LLCamera& camera);
|
void renderGeomShadow(LLCamera& camera);
|
||||||
void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0, U32 noise_map = 0xFFFFFFFF);
|
void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0, U32 noise_map = 0xFFFFFFFF);
|
||||||
void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep);
|
void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep);
|
||||||
@@ -573,6 +579,7 @@ public:
|
|||||||
LLRenderTarget mFXAABuffer;
|
LLRenderTarget mFXAABuffer;
|
||||||
LLRenderTarget mEdgeMap;
|
LLRenderTarget mEdgeMap;
|
||||||
LLRenderTarget mDeferredDepth;
|
LLRenderTarget mDeferredDepth;
|
||||||
|
LLRenderTarget mOcclusionDepth;
|
||||||
LLRenderTarget mDeferredLight;
|
LLRenderTarget mDeferredLight;
|
||||||
LLMultisampleBuffer mSampleBuffer;
|
LLMultisampleBuffer mSampleBuffer;
|
||||||
LLRenderTarget mPhysicsDisplay;
|
LLRenderTarget mPhysicsDisplay;
|
||||||
@@ -585,6 +592,7 @@ public:
|
|||||||
|
|
||||||
//sun shadow map
|
//sun shadow map
|
||||||
LLRenderTarget mShadow[6];
|
LLRenderTarget mShadow[6];
|
||||||
|
LLRenderTarget mShadowOcclusion[6];
|
||||||
std::vector<LLVector3> mShadowFrustPoints[4];
|
std::vector<LLVector3> mShadowFrustPoints[4];
|
||||||
LLVector4 mShadowError;
|
LLVector4 mShadowError;
|
||||||
LLVector4 mShadowFOV;
|
LLVector4 mShadowFOV;
|
||||||
|
|||||||
Reference in New Issue
Block a user