QAR-650 - Viewer RC 9 merge -> release (post cmake)

merge release@88802 Branch_1-20-Viewer-2-merge-1@89178 -> release
master
Steven Bennetts 2008-06-06 22:43:38 +00:00
parent a7d9a543e5
commit ad33281007
141 changed files with 12991 additions and 11576 deletions

View File

@ -50,6 +50,9 @@ Alissa Sabre
VWR-6430
VWR-1843
VWR-6668
VWR-7153
VWR-7168
VWR-7087
Angus Boyd
VWR-592
Argent Stonecutter

View File

@ -20,16 +20,16 @@ else (STANDALONE)
${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release
)
set(APR_LIBRARIES
debug ${WINLIBS_PREBUILT_DEBUG_DIR}/apr-1
optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/apr-1
debug ${WINLIBS_PREBUILT_DEBUG_DIR}/apr-1.lib
optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/apr-1.lib
)
set(APRUTIL_LIBRARIES
debug ${WINLIBS_PREBUILT_DEBUG_DIR}/aprutil-1
optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/aprutil-1
debug ${WINLIBS_PREBUILT_DEBUG_DIR}/aprutil-1.lib
optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/aprutil-1.lib
)
set(APRICONV_LIBRARIES
debug ${WINLIBS_PREBUILT_DEBUG_DIR}/apriconv-1
optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/apriconv-1
debug ${WINLIBS_PREBUILT_DEBUG_DIR}/apriconv-1.lib
optimized ${WINLIBS_PREBUILT_RELEASE_DIR}/apriconv-1.lib
)
elseif (DARWIN)
set(APR_LIBRARIES

View File

@ -247,6 +247,78 @@ def format_xml(something):
_g_xml_formatter = LLSDXMLFormatter()
return _g_xml_formatter.format(something)
class LLSDXMLPrettyFormatter(LLSDXMLFormatter):
def __init__(self, indent_atom = None):
# Call the super class constructor so that we have the type map
super(LLSDXMLPrettyFormatter, self).__init__()
# Override the type map to use our specialized formatters to
# emit the pretty output.
self.type_map[list] = self.PRETTY_ARRAY
self.type_map[tuple] = self.PRETTY_ARRAY
self.type_map[types.GeneratorType] = self.PRETTY_ARRAY,
self.type_map[dict] = self.PRETTY_MAP
# Private data used for indentation.
self._indent_level = 1
if indent_atom is None:
self._indent_atom = ' '
else:
self._indent_atom = indent_atom
def _indent(self):
"Return an indentation based on the atom and indentation level."
return self._indent_atom * self._indent_level
def PRETTY_ARRAY(self, v):
rv = []
rv.append('<array>\n')
self._indent_level = self._indent_level + 1
rv.extend(["%s%s\n" %
(self._indent(),
self.generate(item))
for item in v])
self._indent_level = self._indent_level - 1
rv.append(self._indent())
rv.append('</array>')
return ''.join(rv)
def PRETTY_MAP(self, v):
rv = []
rv.append('<map>\n')
self._indent_level = self._indent_level + 1
keys = v.keys()
keys.sort()
rv.extend(["%s%s\n%s%s\n" %
(self._indent(),
self.elt('key', key),
self._indent(),
self.generate(v[key]))
for key in keys])
self._indent_level = self._indent_level - 1
rv.append(self._indent())
rv.append('</map>')
return ''.join(rv)
def format(self, something):
data = []
data.append('<?xml version="1.0" ?>\n<llsd>')
data.append(self.generate(something))
data.append('</llsd>\n')
return '\n'.join(data)
def format_pretty_xml(something):
"""@brief Serialize a python object as 'pretty' llsd xml.
The output conforms to the LLSD DTD, unlike the output from the
standard python xml.dom DOM::toprettyxml() method which does not
preserve significant whitespace.
This function is not necessarily suited for serializing very large
objects. It is not optimized by the cllsd module, and sorts on
dict (llsd map) keys alphabetically to ease human reading.
"""
return LLSDXMLPrettyFormatter().format(something)
class LLSDNotationFormatter(object):
def __init__(self):
self.type_map = {
@ -834,6 +906,7 @@ class LLSD(object):
parse = staticmethod(parse)
toXML = staticmethod(format_xml)
toPrettyXML = staticmethod(format_pretty_xml)
toBinary = staticmethod(format_binary)
toNotation = staticmethod(format_notation)

View File

@ -1050,6 +1050,29 @@ namespace LLError
#endif
prefix << site.mFunction << ": ";
if (site.mPrintOnce)
{
std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);
if (messageIter != s.uniqueLogMessages.end())
{
messageIter->second++;
unsigned int num_messages = messageIter->second;
if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0)
{
prefix << "ONCE (" << num_messages << "th time seen): ";
}
else
{
return;
}
}
else
{
prefix << "ONCE: ";
s.uniqueLogMessages[message] = 1;
}
}
if (site.mPrintOnce)
{
std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);

View File

@ -314,72 +314,77 @@ U64 getCurrentRSS()
#elif defined(LL_DARWIN)
static U32 getPageSize()
{
int ctl[2] = { CTL_HW, HW_PAGESIZE };
int page_size;
size_t size = sizeof(page_size);
// This can cause bad stalls! Replace with fast version
if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1)
{
llwarns << "Couldn't get page size" << llendl;
return 0;
} else {
return page_size;
}
}
// static U32 getPageSize()
// {
// int ctl[2] = { CTL_HW, HW_PAGESIZE };
// int page_size;
// size_t size = sizeof(page_size);
// if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1)
// {
// llwarns << "Couldn't get page size" << llendl;
// return 0;
// } else {
// return page_size;
// }
// }
U64 getCurrentRSS()
{
task_t task = mach_task_self();
vm_address_t addr = VM_MIN_ADDRESS;
vm_size_t size = 0;
U64 residentPages = 0;
// Stalls!!!
// task_t task = mach_task_self();
// vm_address_t addr = VM_MIN_ADDRESS;
// vm_size_t size = 0;
// U64 residentPages = 0;
while (true)
{
mach_msg_type_number_t bcount = VM_REGION_BASIC_INFO_COUNT;
vm_region_basic_info binfo;
mach_port_t bobj;
kern_return_t ret;
// while (true)
// {
// mach_msg_type_number_t bcount = VM_REGION_BASIC_INFO_COUNT;
// vm_region_basic_info binfo;
// mach_port_t bobj;
// kern_return_t ret;
addr += size;
// addr += size;
ret = vm_region(task, &addr, &size, VM_REGION_BASIC_INFO,
(vm_region_info_t) &binfo, &bcount, &bobj);
// ret = vm_region(task, &addr, &size, VM_REGION_BASIC_INFO,
// (vm_region_info_t) &binfo, &bcount, &bobj);
if (ret != KERN_SUCCESS)
{
break;
}
// if (ret != KERN_SUCCESS)
// {
// break;
// }
if (bobj != MACH_PORT_NULL)
{
mach_port_deallocate(task, bobj);
}
// if (bobj != MACH_PORT_NULL)
// {
// mach_port_deallocate(task, bobj);
// }
mach_msg_type_number_t ecount = VM_REGION_EXTENDED_INFO_COUNT;
vm_region_extended_info einfo;
mach_port_t eobj;
// mach_msg_type_number_t ecount = VM_REGION_EXTENDED_INFO_COUNT;
// vm_region_extended_info einfo;
// mach_port_t eobj;
ret = vm_region(task, &addr, &size, VM_REGION_EXTENDED_INFO,
(vm_region_info_t) &einfo, &ecount, &eobj);
// ret = vm_region(task, &addr, &size, VM_REGION_EXTENDED_INFO,
// (vm_region_info_t) &einfo, &ecount, &eobj);
if (ret != KERN_SUCCESS)
{
llwarns << "vm_region failed" << llendl;
return 0;
}
// if (ret != KERN_SUCCESS)
// {
// llwarns << "vm_region failed" << llendl;
// return 0;
// }
if (eobj != MACH_PORT_NULL)
{
mach_port_deallocate(task, eobj);
}
// if (eobj != MACH_PORT_NULL)
// {
// mach_port_deallocate(task, eobj);
// }
residentPages += einfo.pages_resident;
}
// residentPages += einfo.pages_resident;
// }
return residentPages * getPageSize();
// return residentPages * getPageSize();
return 0;
}
#elif defined(LL_LINUX)

View File

@ -34,7 +34,7 @@
const S32 LL_VERSION_MAJOR = 1;
const S32 LL_VERSION_MINOR = 20;
const S32 LL_VERSION_PATCH = 6;
const S32 LL_VERSION_PATCH = 9;
const S32 LL_VERSION_BUILD = 0;
const char * const LL_CHANNEL = "Second Life Release";

View File

@ -4789,6 +4789,11 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
mIndices.resize(num_indices);
mEdge.resize(num_indices);
}
else
{
mHasBinormals = FALSE;
}
LLVector3& face_min = mExtents[0];
LLVector3& face_max = mExtents[1];

View File

@ -23,11 +23,10 @@ set(llrender_SOURCE_FILES
llfont.cpp
llfontgl.cpp
llgldbg.cpp
llglimmediate.cpp
llimagegl.cpp
llrender.cpp
llrendertarget.cpp
llvertexbuffer.cpp
llvertexprogramgl.cpp
)
set(llrender_HEADER_FILES
@ -36,11 +35,10 @@ set(llrender_HEADER_FILES
llfontgl.h
llfont.h
llgldbg.h
llglimmediate.h
llimagegl.h
llrender.h
llrendertarget.h
llvertexbuffer.h
llvertexprogramgl.h
)
set_source_files_properties(${llrender_HEADER_FILES}

View File

@ -36,7 +36,7 @@
#include "llfont.h"
#include "llfontgl.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "v4color.h"
#include "llstl.h"
@ -665,7 +665,8 @@ S32 LLFontGL::render(const LLWString &wstr,
mImageGLp->bind(0);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Not guaranteed to be set correctly
// Not guaranteed to be set correctly
gGL.setSceneBlendType(LLRender::BT_ALPHA);
cur_x = ((F32)x * sScaleX);
cur_y = ((F32)y * sScaleY);

View File

@ -41,7 +41,7 @@
#include "llmath.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
//----------------------------------------------------------------------------
@ -61,6 +61,8 @@ S32 LLImageGL::sCount = 0;
BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
F32 LLImageGL::sLastFrameTime = 0.f;
BOOL LLImageGL::sRefCheck = TRUE ;
std::set<LLImageGL*> LLImageGL::sImageList;
//----------------------------------------------------------------------------
@ -130,13 +132,13 @@ void LLImageGL::bindExternalTexture(LLGLuint gl_name, S32 stage, LLGLenum bind_t
gGL.flush();
if (stage > 0)
{
glActiveTextureARB(GL_TEXTURE0_ARB + stage);
gGL.getTexUnit(stage)->activate();
}
glBindTexture(bind_target, gl_name);
sCurrentBoundTextures[stage] = gl_name;
if (stage > 0)
{
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
}
@ -149,9 +151,9 @@ void LLImageGL::unbindTexture(S32 stage, LLGLenum bind_target)
gGL.flush();
if (stage > 0)
{
glActiveTextureARB(GL_TEXTURE0_ARB + stage);
gGL.getTexUnit(stage)->activate();
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
else
{
@ -276,7 +278,10 @@ LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps)
setSize(0, 0, 0);
sImageList.insert(this);
sCount++;
sRefCheck = FALSE ;
createGLTexture(0, imageraw);
sRefCheck = TRUE ;
}
LLImageGL::~LLImageGL()
@ -304,7 +309,9 @@ void LLImageGL::init(BOOL usemipmaps)
mIsResident = 0;
mClampS = FALSE;
mClampT = FALSE;
mMipFilterNearest = FALSE;
mClampR = FALSE;
mMagFilterNearest = FALSE;
mMinFilterNearest = FALSE;
mWidth = 0;
mHeight = 0;
mComponents = 0;
@ -331,17 +338,19 @@ void LLImageGL::cleanup()
//----------------------------------------------------------------------------
//this function is used to check the size of a texture image.
//so dim should be a positive number
static bool check_power_of_two(S32 dim)
{
while(dim > 1)
if(dim < 0)
{
if (dim & 1)
{
return false;
}
dim >>= 1;
return false ;
}
return true;
if(!dim)//0 is a power-of-two number
{
return true ;
}
return !(dim & (dim - 1)) ;
}
//static
@ -418,6 +427,8 @@ void LLImageGL::dump()
BOOL LLImageGL::bindTextureInternal(const S32 stage) const
{
llassert_always(!sRefCheck || (getNumRefs() > 0 && getNumRefs() < 100000)) ;
if (gGLManager.mIsDisabled)
{
llwarns << "Trying to bind a texture while GL is disabled!" << llendl;
@ -439,7 +450,7 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const
gGL.flush();
if (stage > 0)
{
glActiveTextureARB(GL_TEXTURE0_ARB + stage);
gGL.getTexUnit(stage)->activate();
}
glBindTexture(mBindTarget, mTexName);
@ -448,7 +459,7 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const
if (stage > 0)
{
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
if (mLastBindTime != sLastFrameTime)
@ -466,12 +477,12 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const
gGL.flush();
if (stage > 0)
{
glActiveTextureARB(GL_TEXTURE0_ARB+stage);
gGL.getTexUnit(stage)->activate();
}
glBindTexture(mBindTarget, 0);
if (stage > 0)
{
glActiveTextureARB(GL_TEXTURE0_ARB+stage);
gGL.getTexUnit(0)->activate();
}
sCurrentBoundTextures[stage] = 0;
return FALSE;
@ -941,7 +952,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
setImage(data_in, data_hasmips);
setClamp(mClampS, mClampT);
setMipFilterNearest(mMipFilterNearest);
setMipFilterNearest(mMagFilterNearest);
// things will break if we don't unbind after creation
unbindTexture(0, mBindTarget);
@ -1044,8 +1055,23 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
S32 gl_discard = discard_level - mCurrentDiscardLevel;
//explicitly unbind texture
LLImageGL::unbindTexture(0, mTarget);
llverify(bindTextureInternal(0));
if (gDebugGL)
{
if (mTarget == GL_TEXTURE_2D)
{
GLint texname;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname);
if (texname != mTexName)
{
llerrs << "Invalid texture bound!" << llendl;
}
}
}
LLGLint glwidth = 0;
glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_WIDTH, (GLint*)&glwidth);
if (glwidth == 0)
@ -1153,25 +1179,55 @@ void LLImageGL::destroyGLTexture()
//----------------------------------------------------------------------------
void LLImageGL::glClampCubemap (BOOL clamps, BOOL clampt, BOOL clampr)
{
glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT);
glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT);
glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT);
}
void LLImageGL::glClamp (BOOL clamps, BOOL clampt)
{
if (mTexName != 0)
{
glTexParameteri (mBindTarget, GL_TEXTURE_WRAP_S, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT);
glTexParameteri (mBindTarget, GL_TEXTURE_WRAP_T, clampt ? GL_CLAMP_TO_EDGE : GL_REPEAT);
}
}
void LLImageGL::setClampCubemap (BOOL clamps, BOOL clampt, BOOL clampr)
{
mClampS = clamps;
mClampT = clampt;
mClampR = clampr;
glClampCubemap (clamps, clampt, clampr);
}
void LLImageGL::setClamp(BOOL clamps, BOOL clampt)
{
mClampS = clamps;
mClampT = clampt;
if (mTexName != 0)
{
glTexParameteri(mBindTarget, GL_TEXTURE_WRAP_S, clamps ? GL_CLAMP_TO_EDGE : GL_REPEAT);
glTexParameteri(mBindTarget, GL_TEXTURE_WRAP_T, clampt ? GL_CLAMP_TO_EDGE : GL_REPEAT);
}
stop_glerror();
glClamp (clamps, clampt);
}
void LLImageGL::setMipFilterNearest(BOOL nearest, BOOL min_nearest)
void LLImageGL::overrideClamp (BOOL clamps, BOOL clampt)
{
mMipFilterNearest = nearest;
glClamp (clamps, clampt);
}
void LLImageGL::restoreClamp (void)
{
glClamp (mClampS, mClampT);
}
void LLImageGL::setMipFilterNearest(BOOL mag_nearest, BOOL min_nearest)
{
mMagFilterNearest = mag_nearest;
mMinFilterNearest = min_nearest;
if (mTexName != 0)
{
if (min_nearest)
if (mMinFilterNearest)
{
glTexParameteri(mBindTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
@ -1183,7 +1239,7 @@ void LLImageGL::setMipFilterNearest(BOOL nearest, BOOL min_nearest)
{
glTexParameteri(mBindTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
if (mMipFilterNearest)
if (mMagFilterNearest)
{
glTexParameteri(mBindTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
@ -1193,7 +1249,7 @@ void LLImageGL::setMipFilterNearest(BOOL nearest, BOOL min_nearest)
}
if (gGLManager.mHasAnisotropic)
{
if (sGlobalUseAnisotropic && !mMipFilterNearest)
if (sGlobalUseAnisotropic && !mMagFilterNearest)
{
F32 largest_anisotropy;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_anisotropy);

View File

@ -81,6 +81,10 @@ protected:
virtual ~LLImageGL();
BOOL bindTextureInternal(const S32 stage = 0) const;
private:
void glClamp (BOOL clamps, BOOL clampt);
void glClampCubemap (BOOL clamps, BOOL clampt, BOOL clampr = FALSE);
public:
virtual void dump(); // debugging info to llinfos
virtual BOOL bind(const S32 stage = 0) const;
@ -99,8 +103,11 @@ public:
BOOL readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok);
void destroyGLTexture();
void setClampCubemap (BOOL clamps, BOOL clampt, BOOL clampr = FALSE);
void setClamp(BOOL clamps, BOOL clampt);
void setMipFilterNearest(BOOL nearest, BOOL min_nearest = FALSE);
void overrideClamp (BOOL clamps, BOOL clampt);
void restoreClamp (void);
void setMipFilterNearest(BOOL mag_nearest, BOOL min_nearest = FALSE);
void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE);
void dontDiscard() { mDontDiscard = 1; }
@ -117,7 +124,8 @@ public:
BOOL getClampS() const { return mClampS; }
BOOL getClampT() const { return mClampT; }
BOOL getMipFilterNearest() const { return mMipFilterNearest; }
BOOL getClampR() const { return mClampR; }
BOOL getMipFilterNearest() const { return mMagFilterNearest; }
BOOL getHasGLTexture() const { return mTexName != 0; }
LLGLuint getTexName() const { return mTexName; }
@ -167,7 +175,9 @@ protected:
S8 mClampS; // Need to save clamp state
S8 mClampT;
S8 mMipFilterNearest; // if TRUE, set magfilter to GL_NEAREST
S8 mClampR;
S8 mMagFilterNearest; // if TRUE, set magfilter to GL_NEAREST
S8 mMinFilterNearest; // if TRUE, set minfilter to GL_NEAREST
LLGLint mFormatInternal; // = GL internalformat
LLGLenum mFormatPrimary; // = GL format (pixel data format)
@ -197,6 +207,9 @@ public:
#else
BOOL getMissed() const { return FALSE; };
#endif
private://paranoia error check
static BOOL sRefCheck ;
};
#endif // LL_LLIMAGEGL_H

704
indra/llrender/llrender.cpp Normal file
View File

@ -0,0 +1,704 @@
/**
* @file llrender.cpp
* @brief LLRender implementation
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2007, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llrender.h"
#include "llvertexbuffer.h"
LLRender gGL;
static const U32 LL_NUM_TEXTURE_LAYERS = 8;
static GLenum sGLCompareFunc[] =
{
GL_NEVER,
GL_ALWAYS,
GL_LESS,
GL_LEQUAL,
GL_EQUAL,
GL_NOTEQUAL,
GL_GEQUAL,
GL_GREATER
};
const U32 immediate_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD;
static GLenum sGLBlendFactor[] =
{
GL_ONE,
GL_ZERO,
GL_DST_COLOR,
GL_SRC_COLOR,
GL_ONE_MINUS_DST_COLOR,
GL_ONE_MINUS_SRC_COLOR,
GL_DST_ALPHA,
GL_SRC_ALPHA,
GL_ONE_MINUS_DST_ALPHA,
GL_ONE_MINUS_SRC_ALPHA
};
LLTexUnit::LLTexUnit(U32 index)
: mIsEnabled(false), mCurrBlendType(TB_MULT),
mCurrColorOp(TBO_MULT), mCurrAlphaOp(TBO_MULT),
mCurrColorSrc1(TBS_TEX_COLOR), mCurrColorSrc2(TBS_PREV_COLOR),
mCurrAlphaSrc1(TBS_TEX_ALPHA), mCurrAlphaSrc2(TBS_PREV_ALPHA),
mCurrColorScale(1), mCurrAlphaScale(1)
{
llassert_always(index < LL_NUM_TEXTURE_LAYERS);
mIndex = index;
}
U32 LLTexUnit::getIndex(void)
{
return mIndex;
}
void LLTexUnit::enable(void)
{
if (!mIsEnabled)
{
activate();
glEnable(GL_TEXTURE_2D);
mIsEnabled = true;
}
}
void LLTexUnit::disable(void)
{
if (mIsEnabled)
{
activate();
glDisable(GL_TEXTURE_2D);
mIsEnabled = false;
}
}
void LLTexUnit::activate(void)
{
//if (gGL.mCurrTextureUnitIndex != mIndex)
{
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
gGL.mCurrTextureUnitIndex = mIndex;
}
}
// Useful for debugging that you've manually assigned a texture operation to the correct
// texture unit based on the currently set active texture in opengl.
void LLTexUnit::debugTextureUnit(void)
{
GLint activeTexture;
glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture);
if ((GL_TEXTURE0_ARB + mIndex) != activeTexture)
{
llerrs << "Incorrect Texture Unit! Expected: " << (activeTexture - GL_TEXTURE0_ARB) << " Actual: " << mIndex << llendl;
}
}
void LLTexUnit::bindTexture(const LLImageGL* texture)
{
if (texture != NULL)
{
activate();
texture->bind(mIndex);
}
}
void LLTexUnit::unbindTexture(void)
{
activate();
glBindTexture(GL_TEXTURE_2D, 0);
}
void LLTexUnit::setTextureBlendType(eTextureBlendType type)
{
// Do nothing if it's already correctly set.
if (mCurrBlendType == type)
{
return;
}
activate();
mCurrBlendType = type;
S32 scale_amount = 1;
switch (type)
{
case TB_REPLACE:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
break;
case TB_ADD:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
break;
case TB_MULT:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
break;
case TB_MULT_X2:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
scale_amount = 2;
break;
case TB_ALPHA_BLEND:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
break;
case TB_COMBINE:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
break;
default:
llerrs << "Unknown Texture Blend Type: " << type << llendl;
break;
}
setColorScale(scale_amount);
setAlphaScale(1);
}
GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
{
switch(src)
{
// All four cases should return the same value.
case TBS_PREV_COLOR:
case TBS_PREV_ALPHA:
case TBS_ONE_MINUS_PREV_COLOR:
case TBS_ONE_MINUS_PREV_ALPHA:
return GL_PREVIOUS_ARB;
// All four cases should return the same value.
case TBS_TEX_COLOR:
case TBS_TEX_ALPHA:
case TBS_ONE_MINUS_TEX_COLOR:
case TBS_ONE_MINUS_TEX_ALPHA:
return GL_TEXTURE;
// All four cases should return the same value.
case TBS_VERT_COLOR:
case TBS_VERT_ALPHA:
case TBS_ONE_MINUS_VERT_COLOR:
case TBS_ONE_MINUS_VERT_ALPHA:
return GL_PRIMARY_COLOR_ARB;
// All four cases should return the same value.
case TBS_CONST_COLOR:
case TBS_CONST_ALPHA:
case TBS_ONE_MINUS_CONST_COLOR:
case TBS_ONE_MINUS_CONST_ALPHA:
return GL_CONSTANT_ARB;
default:
llwarns << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << llendl;
return GL_PRIMARY_COLOR_ARB;
}
}
GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha)
{
switch(src)
{
// All four cases should return the same value.
case TBS_PREV_COLOR:
case TBS_TEX_COLOR:
case TBS_VERT_COLOR:
case TBS_CONST_COLOR:
return (isAlpha) ? GL_SRC_ALPHA: GL_SRC_COLOR;
// All four cases should return the same value.
case TBS_PREV_ALPHA:
case TBS_TEX_ALPHA:
case TBS_VERT_ALPHA:
case TBS_CONST_ALPHA:
return GL_SRC_ALPHA;
// All four cases should return the same value.
case TBS_ONE_MINUS_PREV_COLOR:
case TBS_ONE_MINUS_TEX_COLOR:
case TBS_ONE_MINUS_VERT_COLOR:
case TBS_ONE_MINUS_CONST_COLOR:
return (isAlpha) ? GL_ONE_MINUS_SRC_ALPHA : GL_ONE_MINUS_SRC_COLOR;
// All four cases should return the same value.
case TBS_ONE_MINUS_PREV_ALPHA:
case TBS_ONE_MINUS_TEX_ALPHA:
case TBS_ONE_MINUS_VERT_ALPHA:
case TBS_ONE_MINUS_CONST_ALPHA:
return GL_ONE_MINUS_SRC_ALPHA;
default:
llwarns << "Unknown eTextureBlendSrc: " << src << ". Using Source Color or Alpha instead." << llendl;
return (isAlpha) ? GL_SRC_ALPHA: GL_SRC_COLOR;
}
}
void LLTexUnit::setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2, bool isAlpha)
{
activate();
if (mCurrBlendType != TB_COMBINE)
{
mCurrBlendType = TB_COMBINE;
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
}
// We want an early out, because this function does a LOT of stuff.
if ( (isAlpha && (mCurrAlphaOp == op) && (mCurrAlphaSrc1 == src1) && (mCurrAlphaSrc2 == src2) )
|| (!isAlpha && (mCurrColorOp == op) && (mCurrColorSrc1 == src1) && (mCurrColorSrc2 == src2) ))
{
return;
}
// Get the gl source enums according to the eTextureBlendSrc sources passed in
GLint source1 = getTextureSource(src1);
GLint source2 = getTextureSource(src2);
// Get the gl operand enums according to the eTextureBlendSrc sources passed in
GLint operand1 = getTextureSourceType(src1, isAlpha);
GLint operand2 = getTextureSourceType(src2, isAlpha);
// Default the scale amount to 1
S32 scale_amount = 1;
GLenum comb_enum, src0_enum, src1_enum, src2_enum, operand0_enum, operand1_enum, operand2_enum;
if (isAlpha)
{
// Set enums to ALPHA ones
comb_enum = GL_COMBINE_ALPHA_ARB;
src0_enum = GL_SOURCE0_ALPHA_ARB;
src1_enum = GL_SOURCE1_ALPHA_ARB;
src2_enum = GL_SOURCE2_ALPHA_ARB;
operand0_enum = GL_OPERAND0_ALPHA_ARB;
operand1_enum = GL_OPERAND1_ALPHA_ARB;
operand2_enum = GL_OPERAND2_ALPHA_ARB;
// cache current combiner
mCurrAlphaOp = op;
mCurrAlphaSrc1 = src1;
mCurrAlphaSrc2 = src2;
}
else
{
// Set enums to ALPHA ones
comb_enum = GL_COMBINE_RGB_ARB;
src0_enum = GL_SOURCE0_RGB_ARB;
src1_enum = GL_SOURCE1_RGB_ARB;
src2_enum = GL_SOURCE2_RGB_ARB;
operand0_enum = GL_OPERAND0_RGB_ARB;
operand1_enum = GL_OPERAND1_RGB_ARB;
operand2_enum = GL_OPERAND2_RGB_ARB;
// cache current combiner
mCurrColorOp = op;
mCurrColorSrc1 = src1;
mCurrColorSrc2 = src2;
}
switch(op)
{
case TBO_REPLACE:
// Slightly special syntax (no second sources), just set all and return.
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, src0_enum, source1);
glTexEnvi(GL_TEXTURE_ENV, operand0_enum, operand1);
(isAlpha) ? setAlphaScale(1) : setColorScale(1);
return;
case TBO_MULT:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_MODULATE);
break;
case TBO_MULT_X2:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_MODULATE);
scale_amount = 2;
break;
case TBO_MULT_X4:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_MODULATE);
scale_amount = 4;
break;
case TBO_ADD:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_ADD);
break;
case TBO_ADD_SIGNED:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_ADD_SIGNED_ARB);
break;
case TBO_SUBTRACT:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_SUBTRACT_ARB);
break;
case TBO_LERP_VERT_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, operand2_enum, GL_SRC_ALPHA);
break;
case TBO_LERP_TEX_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, operand2_enum, GL_SRC_ALPHA);
break;
case TBO_LERP_PREV_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, operand2_enum, GL_SRC_ALPHA);
break;
case TBO_LERP_CONST_ALPHA:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_CONSTANT_ARB);
glTexEnvi(GL_TEXTURE_ENV, operand2_enum, GL_SRC_ALPHA);
break;
case TBO_LERP_VERT_COLOR:
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, operand2_enum, (isAlpha) ? GL_SRC_ALPHA : GL_SRC_COLOR);
break;
default:
llwarns << "Unknown eTextureBlendOp: " << op << ". Setting op to replace." << llendl;
// Slightly special syntax (no second sources), just set all and return.
glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, src0_enum, source1);
glTexEnvi(GL_TEXTURE_ENV, operand0_enum, operand1);
(isAlpha) ? setAlphaScale(1) : setColorScale(1);
return;
}
// Set sources, operands, and scale accordingly
glTexEnvi(GL_TEXTURE_ENV, src0_enum, source1);
glTexEnvi(GL_TEXTURE_ENV, operand0_enum, operand1);
glTexEnvi(GL_TEXTURE_ENV, src1_enum, source2);
glTexEnvi(GL_TEXTURE_ENV, operand1_enum, operand2);
(isAlpha) ? setAlphaScale(scale_amount) : setColorScale(scale_amount);
}
void LLTexUnit::setColorScale(S32 scale)
{
if (mCurrColorScale != scale)
{
mCurrColorScale = scale;
glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, scale );
}
}
void LLTexUnit::setAlphaScale(S32 scale)
{
if (mCurrAlphaScale != scale)
{
mCurrAlphaScale = scale;
glTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale );
}
}
LLRender::LLRender()
{
mCount = 0;
mMode = LLVertexBuffer::TRIANGLES;
mBuffer = new LLVertexBuffer(immediate_mask, 0);
mBuffer->allocateBuffer(4096, 0, TRUE);
mBuffer->getVertexStrider(mVerticesp);
mBuffer->getTexCoordStrider(mTexcoordsp);
mBuffer->getColorStrider(mColorsp);
for (unsigned int i = 0; i < LL_NUM_TEXTURE_LAYERS; i++)
{
mTexUnits.push_back(new LLTexUnit(i));
}
}
LLRender::~LLRender()
{
for (U32 i = 0; i < mTexUnits.size(); i++)
{
delete mTexUnits[i];
}
}
void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
{
flush();
glTranslatef(x,y,z);
}
void LLRender::pushMatrix()
{
flush();
glPushMatrix();
}
void LLRender::popMatrix()
{
flush();
glPopMatrix();
}
void LLRender::setColorMask(bool writeColor, bool writeAlpha)
{
setColorMask(writeColor, writeColor, writeColor, writeAlpha);
}
void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha)
{
flush();
glColorMask(writeColorR, writeColorG, writeColorB, writeAlpha);
}
void LLRender::setSceneBlendType(eBlendType type)
{
flush();
switch (type)
{
case BT_ALPHA:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;
case BT_ADD:
glBlendFunc(GL_ONE, GL_ONE);
break;
case BT_ADD_WITH_ALPHA:
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
break;
case BT_MULT:
glBlendFunc(GL_DST_COLOR, GL_ZERO);
break;
case BT_MULT_X2:
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
break;
case BT_REPLACE:
glBlendFunc(GL_ONE, GL_ZERO);
break;
default:
llerrs << "Unknown Scene Blend Type: " << type << llendl;
break;
}
}
void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
{
flush();
if (func == CF_DEFAULT)
{
glAlphaFunc(GL_GREATER, 0.01f);
}
else
{
glAlphaFunc(sGLCompareFunc[func], value);
}
}
void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
{
flush();
glBlendFunc(sGLBlendFactor[sfactor], sGLBlendFactor[dfactor]);
}
LLTexUnit* LLRender::getTexUnit(U32 index)
{
if (index < mTexUnits.size())
{
return mTexUnits[index];
}
llerrs << "Non-existing texture unit layer requested: " << index << llendl;
return NULL;
}
void LLRender::begin(const GLuint& mode)
{
if (mode != mMode)
{
if (mMode == LLVertexBuffer::QUADS ||
mMode == LLVertexBuffer::LINES ||
mMode == LLVertexBuffer::TRIANGLES ||
mMode == LLVertexBuffer::POINTS)
{
flush();
}
else if (mCount != 0)
{
llerrs << "gGL.begin() called redundantly." << llendl;
}
mMode = mode;
}
}
void LLRender::end()
{
if (mCount == 0)
{
return;
//IMM_ERRS << "GL begin and end called with no vertices specified." << llendl;
}
if ((mMode != LLVertexBuffer::QUADS &&
mMode != LLVertexBuffer::LINES &&
mMode != LLVertexBuffer::TRIANGLES &&
mMode != LLVertexBuffer::POINTS) ||
mCount > 2048)
{
flush();
}
}
void LLRender::flush()
{
if (mCount > 0)
{
#if 0
if (!glIsEnabled(GL_VERTEX_ARRAY))
{
llerrs << "foo 1" << llendl;
}
if (!glIsEnabled(GL_COLOR_ARRAY))
{
llerrs << "foo 2" << llendl;
}
if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY))
{
llerrs << "foo 3" << llendl;
}
if (glIsEnabled(GL_NORMAL_ARRAY))
{
llerrs << "foo 7" << llendl;
}
GLvoid* pointer;
glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer);
if (pointer != &(mBuffer[0].v))
{
llerrs << "foo 4" << llendl;
}
glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer);
if (pointer != &(mBuffer[0].c))
{
llerrs << "foo 5" << llendl;
}
glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer);
if (pointer != &(mBuffer[0].uv))
{
llerrs << "foo 6" << llendl;
}
#endif
mBuffer->setBuffer(immediate_mask);
mBuffer->drawArrays(mMode, 0, mCount);
mVerticesp[0] = mVerticesp[mCount];
mTexcoordsp[0] = mTexcoordsp[mCount];
mColorsp[0] = mColorsp[mCount];
mCount = 0;
}
}
void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
{
if (mCount >= 4096)
{
// llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl;
return;
}
mVerticesp[mCount] = LLVector3(x,y,z);
mCount++;
if (mCount < 4096)
{
mVerticesp[mCount] = mVerticesp[mCount-1];
mColorsp[mCount] = mColorsp[mCount-1];
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
}
}
void LLRender::vertex2i(const GLint& x, const GLint& y)
{
vertex3f((GLfloat) x, (GLfloat) y, 0);
}
void LLRender::vertex2f(const GLfloat& x, const GLfloat& y)
{
vertex3f(x,y,0);
}
void LLRender::vertex2fv(const GLfloat* v)
{
vertex3f(v[0], v[1], 0);
}
void LLRender::vertex3fv(const GLfloat* v)
{
vertex3f(v[0], v[1], v[2]);
}
void LLRender::texCoord2f(const GLfloat& x, const GLfloat& y)
{
mTexcoordsp[mCount] = LLVector2(x,y);
}
void LLRender::texCoord2i(const GLint& x, const GLint& y)
{
texCoord2f((GLfloat) x, (GLfloat) y);
}
void LLRender::texCoord2fv(const GLfloat* tc)
{
texCoord2f(tc[0], tc[1]);
}
void LLRender::color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a)
{
mColorsp[mCount] = LLColor4U(r,g,b,a);
}
void LLRender::color4ubv(const GLubyte* c)
{
color4ub(c[0], c[1], c[2], c[3]);
}
void LLRender::color4f(const GLfloat& r, const GLfloat& g, const GLfloat& b, const GLfloat& a)
{
color4ub((GLubyte) (llclamp(r, 0.f, 1.f)*255),
(GLubyte) (llclamp(g, 0.f, 1.f)*255),
(GLubyte) (llclamp(b, 0.f, 1.f)*255),
(GLubyte) (llclamp(a, 0.f, 1.f)*255));
}
void LLRender::color4fv(const GLfloat* c)
{
color4f(c[0],c[1],c[2],c[3]);
}
void LLRender::color3f(const GLfloat& r, const GLfloat& g, const GLfloat& b)
{
color4f(r,g,b,1);
}
void LLRender::color3fv(const GLfloat* c)
{
color4f(c[0],c[1],c[2],1);
}

239
indra/llrender/llrender.h Normal file
View File

@ -0,0 +1,239 @@
/**
* @file llrender.h
* @brief LLRender definition
*
* This class acts as a wrapper for OpenGL calls.
* The goal of this class is to minimize the number of api calls due to legacy rendering
* code, to define an interface for a multiple rendering API abstraction of the UI
* rendering, and to abstract out direct rendering calls in a way that is cleaner and easier to maintain.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2007, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_LLGLRENDER_H
#define LL_LLGLRENDER_H
#include "stdtypes.h"
#include "llgltypes.h"
#include "llglheaders.h"
#include "llvertexbuffer.h"
class LLTexUnit
{
public:
typedef enum
{
TB_REPLACE = 0,
TB_ADD,
TB_MULT,
TB_MULT_X2,
TB_ALPHA_BLEND,
TB_COMBINE // Doesn't need to be set directly, setTexture___Blend() set TB_COMBINE automatically
} eTextureBlendType;
typedef enum
{
TBO_REPLACE = 0, // Use Source 1
TBO_MULT, // Multiply: ( Source1 * Source2 )
TBO_MULT_X2, // Multiply then scale by 2: ( 2.0 * ( Source1 * Source2 ) )
TBO_MULT_X4, // Multiply then scale by 4: ( 4.0 * ( Source1 * Source2 ) )
TBO_ADD, // Add: ( Source1 + Source2 )
TBO_ADD_SIGNED, // Add then subtract 0.5: ( ( Source1 + Source2 ) - 0.5 )
TBO_SUBTRACT, // Subtract Source2 from Source1: ( Source1 - Source2 )
TBO_LERP_VERT_ALPHA, // Interpolate based on Vertex Alpha (VA): ( Source1 * VA + Source2 * (1-VA) )
TBO_LERP_TEX_ALPHA, // Interpolate based on Texture Alpha (TA): ( Source1 * TA + Source2 * (1-TA) )
TBO_LERP_PREV_ALPHA, // Interpolate based on Previous Alpha (PA): ( Source1 * PA + Source2 * (1-PA) )
TBO_LERP_CONST_ALPHA, // Interpolate based on Const Alpha (CA): ( Source1 * CA + Source2 * (1-CA) )
TBO_LERP_VERT_COLOR // Interpolate based on Vertex Col (VC): ( Source1 * VC + Source2 * (1-VC) )
// *Note* TBO_LERP_VERTEX_COLOR only works with setTextureColorBlend(),
// and falls back to TBO_LERP_VERTEX_ALPHA for setTextureAlphaBlend().
} eTextureBlendOp;
typedef enum
{
TBS_PREV_COLOR = 0, // Color from the previous texture stage
TBS_PREV_ALPHA,
TBS_ONE_MINUS_PREV_COLOR,
TBS_ONE_MINUS_PREV_ALPHA,
TBS_TEX_COLOR, // Color from the texture bound to this stage
TBS_TEX_ALPHA,
TBS_ONE_MINUS_TEX_COLOR,
TBS_ONE_MINUS_TEX_ALPHA,
TBS_VERT_COLOR, // The vertex color currently set
TBS_VERT_ALPHA,
TBS_ONE_MINUS_VERT_COLOR,
TBS_ONE_MINUS_VERT_ALPHA,
TBS_CONST_COLOR, // The constant color value currently set
TBS_CONST_ALPHA,
TBS_ONE_MINUS_CONST_COLOR,
TBS_ONE_MINUS_CONST_ALPHA
} eTextureBlendSrc;
LLTexUnit(U32 index);
U32 getIndex(void);
void enable(void);
void disable(void);
void activate(void);
void bindTexture(const LLImageGL* texture);
void unbindTexture(void);
void setTextureBlendType(eTextureBlendType type);
inline void setTextureColorBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_COLOR)
{ setTextureCombiner(op, src1, src2, false); }
// NOTE: If *_COLOR enums are passed to src1 or src2, the corresponding *_ALPHA enum will be used instead.
inline void setTextureAlphaBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_ALPHA)
{ setTextureCombiner(op, src1, src2, true); }
private:
U32 mIndex;
bool mIsEnabled;
eTextureBlendType mCurrBlendType;
eTextureBlendOp mCurrColorOp;
eTextureBlendSrc mCurrColorSrc1;
eTextureBlendSrc mCurrColorSrc2;
eTextureBlendOp mCurrAlphaOp;
eTextureBlendSrc mCurrAlphaSrc1;
eTextureBlendSrc mCurrAlphaSrc2;
S32 mCurrColorScale;
S32 mCurrAlphaScale;
void debugTextureUnit(void);
void setColorScale(S32 scale);
void setAlphaScale(S32 scale);
GLint getTextureSource(eTextureBlendSrc src);
GLint getTextureSourceType(eTextureBlendSrc src, bool isAlpha = false);
void setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2, bool isAlpha = false);
};
class LLRender
{
friend class LLTexUnit;
public:
typedef enum
{
CF_NEVER = 0,
CF_ALWAYS,
CF_LESS,
CF_LESS_EQUAL,
CF_EQUAL,
CF_NOT_EQUAL,
CF_GREATER_EQUAL,
CF_GREATER,
CF_DEFAULT
} eCompareFunc;
typedef enum
{
BT_ALPHA = 0,
BT_ADD,
BT_ADD_WITH_ALPHA, // Additive blend modulated by the fragment's alpha.
BT_MULT,
BT_MULT_X2,
BT_REPLACE
} eBlendType;
typedef enum
{
BF_ONE = 0,
BF_ZERO,
BF_DEST_COLOR,
BF_SOURCE_COLOR,
BF_ONE_MINUS_DEST_COLOR,
BF_ONE_MINUS_SOURCE_COLOR,
BF_DEST_ALPHA,
BF_SOURCE_ALPHA,
BF_ONE_MINUS_DEST_ALPHA,
BF_ONE_MINUS_SOURCE_ALPHA
} eBlendFactor;
LLRender();
~LLRender();
void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
void pushMatrix();
void popMatrix();
void flush();
void begin(const GLuint& mode);
void end();
void vertex2i(const GLint& x, const GLint& y);
void vertex2f(const GLfloat& x, const GLfloat& y);
void vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z);
void vertex2fv(const GLfloat* v);
void vertex3fv(const GLfloat* v);
void texCoord2i(const GLint& x, const GLint& y);
void texCoord2f(const GLfloat& x, const GLfloat& y);
void texCoord2fv(const GLfloat* tc);
void color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a);
void color4f(const GLfloat& r, const GLfloat& g, const GLfloat& b, const GLfloat& a);
void color4fv(const GLfloat* c);
void color3f(const GLfloat& r, const GLfloat& g, const GLfloat& b);
void color3fv(const GLfloat* c);
void color4ubv(const GLubyte* c);
void setColorMask(bool writeColor, bool writeAlpha);
void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha);
void setSceneBlendType(eBlendType type);
void setAlphaRejectSettings(eCompareFunc func, F32 value = 0.01f);
void blendFunc(eBlendFactor sfactor, eBlendFactor dfactor);
LLTexUnit* getTexUnit(U32 index);
typedef struct Vertex
{
GLfloat v[3];
GLubyte c[4];
GLfloat uv[2];
};
public:
private:
U32 mCount;
U32 mMode;
U32 mCurrTextureUnitIndex;
LLPointer<LLVertexBuffer> mBuffer;
LLStrider<LLVector3> mVerticesp;
LLStrider<LLVector2> mTexcoordsp;
LLStrider<LLColor4U> mColorsp;
std::vector<LLTexUnit*> mTexUnits;
};
extern LLRender gGL;
#endif

View File

@ -32,7 +32,7 @@
#include "linden_common.h"
#include "llrendertarget.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llgl.h"
@ -181,6 +181,7 @@ void LLRenderTarget::clear()
{
LLGLEnable scissor(GL_SCISSOR_TEST);
glScissor(0, 0, mResX, mResY);
stop_glerror();
glClear(mask);
}
}

View File

@ -38,7 +38,7 @@
#include "llglheaders.h"
#include "llmemory.h"
#include "llmemtype.h"
#include "llglimmediate.h"
#include "llrender.h"
//============================================================================
@ -768,11 +768,26 @@ U8* LLVertexBuffer::mapBuffer(S32 access)
sMapped = TRUE;*/
if (!mMappedData)
{
GLint buff;
glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff);
if (buff != mGLBuffer)
{
llerrs << "Invalid GL vertex buffer bound: " << buff << llendl;
}
llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl;
}
if (!mMappedIndexData)
{
GLint buff;
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
if (buff != mGLIndices)
{
llerrs << "Invalid GL index buffer bound: " << buff << llendl;
}
llerrs << "glMapBuffer returned NULL (no index data)" << llendl;
}
@ -952,6 +967,22 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
sIBOActive = TRUE;
}
if (gDebugGL)
{
GLint buff;
glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff);
if (buff != mGLBuffer)
{
llerrs << "Invalid GL vertex buffer bound: " << buff << llendl;
}
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
if (buff != mGLIndices)
{
llerrs << "Invalid GL index buffer bound: " << buff << llendl;
}
}
if (mResized)
{
if (gDebugGL)

View File

@ -45,7 +45,7 @@
#include "llcriticaldamp.h"
#include "llfocusmgr.h"
#include "llwindow.h"
#include "llglimmediate.h"
#include "llrender.h"
static LLRegisterWidget<LLButton> r("button");
@ -571,9 +571,9 @@ void LLButton::draw()
mImagep->draw(getLocalRect(), getEnabled() ? mImageColor : mDisabledImageColor );
if (mCurGlowStrength > 0.01f)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
mImagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
else
@ -581,9 +581,9 @@ void LLButton::draw()
mImagep->draw(0, 0, getEnabled() ? mImageColor : mDisabledImageColor );
if (mCurGlowStrength > 0.01f)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
mImagep->drawSolid(0, 0, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
}

View File

@ -783,8 +783,18 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask)
mList->highlightNthItem(mList->getItemIndex(last_selected_item));
}
result = mList->handleKeyHere(key, mask);
// will only see return key if it is originating from line editor
// since the dropdown button eats the key
if (key == KEY_RETURN)
{
// don't show list and don't eat key input when committing
// free-form text entry with RETURN since user already knows
// what they are trying to select
return FALSE;
}
// if selection has changed, pop open list
if (mList->getLastSelectedItem() != last_selected_item)
else if (mList->getLastSelectedItem() != last_selected_item)
{
showList();
}

View File

@ -46,7 +46,7 @@
#include "llmenugl.h"
#include "llmath.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llfocusmgr.h"
#include "llfont.h"
#include "llcoord.h"

View File

@ -44,7 +44,7 @@
#include "llfocusmgr.h"
#include "llwindow.h"
#include "llcontrol.h"
#include "llglimmediate.h"
#include "llrender.h"
LLScrollbar::LLScrollbar(
const LLString& name, LLRect rect,
@ -518,9 +518,9 @@ void LLScrollbar::draw()
rounded_rect_imagep->draw(mThumbRect, mThumbColor);
if (mCurGlowStrength > 0.01f)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
rounded_rect_imagep->drawSolid(mThumbRect, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}

View File

@ -32,7 +32,7 @@
#include "linden_common.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llscrollcontainer.h"
#include "llscrollbar.h"
#include "llui.h"

View File

@ -42,7 +42,7 @@
#include "llcheckboxctrl.h"
#include "llclipboard.h"
#include "llfocusmgr.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llresmgr.h"
#include "llscrollbar.h"
#include "llstring.h"
@ -1110,6 +1110,8 @@ BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index )
for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++)
{
LLScrollListItem *itemp = *iter;
llassert_always(itemp) ;
if( index >= first_index && index <= last_index )
{
if( itemp->getEnabled() )

View File

@ -102,7 +102,7 @@ LLStyle &LLStyle::operator=(const LLStyle &rhs)
mItalic = rhs.mItalic;
mBold = rhs.mBold;
mUnderline = rhs.mUnderline;
mDropShadow = rhs.mUnderline;
mDropShadow = rhs.mDropShadow;
mIsEmbeddedItem = rhs.mIsEmbeddedItem;
}

View File

@ -40,7 +40,7 @@
#include "llcriticaldamp.h"
#include "lluictrlfactory.h"
#include "lltabcontainervertical.h"
#include "llglimmediate.h"
#include "llrender.h"
const F32 SCROLL_STEP_TIME = 0.4f;
const F32 SCROLL_DELAY_TIME = 0.5f;

View File

@ -36,7 +36,7 @@
#include "lltexteditor.h"
#include "llfontgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llui.h"
#include "lluictrlfactory.h"
#include "llrect.h"

View File

@ -41,7 +41,7 @@
#include "audioengine.h"
#include "v2math.h"
#include "v4color.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llrect.h"
#include "llimagegl.h"
#include "lldir.h"
@ -487,18 +487,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma
if (solid_color)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA);
}
gGL.pushMatrix();
@ -634,7 +624,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma
if (solid_color)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
}

View File

@ -37,7 +37,7 @@
#include <cassert>
#include <boost/tokenizer.hpp>
#include "llglimmediate.h"
#include "llrender.h"
#include "llevent.h"
#include "llfontgl.h"
#include "llfocusmgr.h"

View File

@ -30,7 +30,7 @@
#include "linden_common.h"
#include "llviewborder.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llfocusmgr.h"
static LLRegisterWidget<LLViewBorder> r("view_border");

View File

@ -605,8 +605,6 @@ LLWindowWin32::LLWindowWin32(const char *title, const char *name, S32 x, S32 y,
// Initialize (boot strap) the Language text input management,
// based on the system's (or user's) default settings.
allowLanguageTextInput(NULL, FALSE);
SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer
}
@ -1349,6 +1347,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
//make sure multi sampling is disabled by default
glDisable(GL_MULTISAMPLE_ARB);
//register joystick timer callback
SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer
// ok to post quit messages now
mPostQuit = TRUE;

View File

@ -58,36 +58,45 @@
//this defines the current version of the settings file
const S32 CURRENT_VERSION = 101;
BOOL LLControlVariable::llsd_compare(const LLSD& a, const LLSD & b)
bool LLControlVariable::llsd_compare(const LLSD& a, const LLSD & b)
{
bool result = false;
switch (mType)
{
case TYPE_U32:
case TYPE_S32:
return a.asInteger() == b.asInteger();
result = a.asInteger() == b.asInteger();
break;
case TYPE_BOOLEAN:
return a.asBoolean() == b.asBoolean();
result = a.asBoolean() == b.asBoolean();
break;
case TYPE_F32:
return a.asReal() == b.asReal();
result = a.asReal() == b.asReal();
break;
case TYPE_VEC3:
case TYPE_VEC3D:
return LLVector3d(a) == LLVector3d(b);
result = LLVector3d(a) == LLVector3d(b);
break;
case TYPE_RECT:
return LLRect(a) == LLRect(b);
result = LLRect(a) == LLRect(b);
break;
case TYPE_COL4:
return LLColor4(a) == LLColor4(b);
result = LLColor4(a) == LLColor4(b);
break;
case TYPE_COL3:
return LLColor3(a) == LLColor3(b);
result = LLColor3(a) == LLColor3(b);
break;
case TYPE_COL4U:
return LLColor4U(a) == LLColor4U(b);
result = LLColor4U(a) == LLColor4U(b);
break;
case TYPE_STRING:
return a.asString() == b.asString();
result = a.asString() == b.asString();
break;
default:
// no-op
break;
}
return FALSE;
return result;
}
LLControlVariable::LLControlVariable(const LLString& name, eControlType type,
@ -114,14 +123,34 @@ LLControlVariable::~LLControlVariable()
void LLControlVariable::setValue(const LLSD& value, bool saved_value)
{
bool value_changed = llsd_compare(getValue(), value) == FALSE;
// *FIX:MEP - The following is needed to make the LLSD::ImplString
// work with boolean controls...
LLSD storable_value;
if(TYPE_BOOLEAN == type() && value.isString())
{
BOOL temp;
if(LLString::convertToBOOL(value.asString(), temp))
{
storable_value = temp;
}
else
{
storable_value = FALSE;
}
}
else
{
storable_value = value;
}
bool value_changed = llsd_compare(getValue(), storable_value) == FALSE;
if(saved_value)
{
// If we're going to save this value, return to default but don't fire
resetToDefault(false);
if (llsd_compare(mValues.back(), value) == FALSE)
if (llsd_compare(mValues.back(), storable_value) == FALSE)
{
mValues.push_back(value);
mValues.push_back(storable_value);
}
}
else
@ -129,7 +158,7 @@ void LLControlVariable::setValue(const LLSD& value, bool saved_value)
// This is a unsaved value. Its needs to reside at
// mValues[2] (or greater). It must not affect
// the result of getSaveValue()
if (llsd_compare(mValues.back(), value) == FALSE)
if (llsd_compare(mValues.back(), storable_value) == FALSE)
{
while(mValues.size() > 2)
{
@ -144,13 +173,14 @@ void LLControlVariable::setValue(const LLSD& value, bool saved_value)
}
// Add the 'un-save' value.
mValues.push_back(value);
mValues.push_back(storable_value);
}
}
if(value_changed)
{
mSignal(value);
mSignal(storable_value);
}
}
@ -1147,3 +1177,4 @@ void main()
#endif

View File

@ -127,7 +127,7 @@ public:
{
mSignal(mValues.back());
}
BOOL llsd_compare(const LLSD& a, const LLSD& b);
bool llsd_compare(const LLSD& a, const LLSD& b);
};
//const U32 STRING_CACHE_SIZE = 10000;

View File

@ -1,5 +1,5 @@
/* Localized versions of Info.plist keys */
CFBundleName = "Second Life";
CFBundleShortVersionString = "Second Life version 1.19.1.84396";
CFBundleGetInfoString = "Second Life version 1.19.1.84396, Copyright 2004-2008 Linden Research, Inc.";
CFBundleShortVersionString = "Second Life version 1.20.6.86975";
CFBundleGetInfoString = "Second Life version 1.20.6.86975, Copyright 2004-2008 Linden Research, Inc.";

View File

@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.19.1.84396</string>
<string>1.20.6.86975</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>

View File

@ -49,7 +49,7 @@
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>GridChoice</string>
<string>CmdLineGridChoice</string>
</map>
<key>loginuri</key>
@ -61,7 +61,7 @@
<key>compose</key>
<boolean>true</boolean>
<key>map-to</key>
<string>LoginURI</string>
<string>CmdLineLoginURI</string>
</map>
<key>helperuri</key>
@ -71,7 +71,7 @@
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>HelperURI</string>
<string>CmdLineHelperURI</string>
</map>
<key>debugviews</key>

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,7 @@
#include "llurldispatcher.h"
#include "llurlhistory.h"
#include "llfirstuse.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llweb.h"
#include "llsecondlifeurls.h"
@ -192,24 +192,6 @@
// viewer.cpp - these are only used in viewer, should be easily moved.
extern void disable_win_error_reporting();
//#define APPLE_PREVIEW // Define this if you're doing a preview build on the Mac
#if LL_RELEASE_FOR_DOWNLOAD
// Default userserver for production builds is agni
#ifndef APPLE_PREVIEW
static EGridInfo GridDefaultChoice = GRID_INFO_AGNI;
#else
static EGridInfo GridDefaultChoice = GRID_INFO_ADITI;
#endif
#else
// Default userserver for development builds is none
static EGridInfo GridDefaultChoice = GRID_INFO_NONE;
#endif
#if LL_WINDOWS
extern void create_console();
#endif
#if LL_DARWIN
#include <Carbon/Carbon.h>
extern void init_apple_menu(const char* product);
@ -287,6 +269,7 @@ BOOL gUseWireframe = FALSE;
LLVFS* gStaticVFS = NULL;
LLMemoryInfo gSysMemory;
U64 gMemoryAllocated = 0; // updated in display_stats() in llviewerdisplay.cpp
LLString gLastVersionChannel;
@ -303,6 +286,7 @@ BOOL gPeriodicSlowFrame = FALSE;
BOOL gCrashOnStartup = FALSE;
BOOL gLLErrorActivated = FALSE;
BOOL gLogoutInProgress = FALSE;
////////////////////////////////////////////////////////////
// Internal globals... that should be removed.
static LLString gArgs;
@ -338,6 +322,48 @@ void idle_afk_check()
}
}
//this function checks if the system can allocate (num_chunk)MB memory successfully.
//if this check fails, the allocated memory is NOT freed.
void idle_mem_check(S32 num_chunk)
{
//this flag signals if memory allocation check is necessary
static BOOL check = TRUE ;
if(!check) //if memory check fails before, do not repeat it.
{
return ;
}
check = FALSE ; //before memory check for this frame, turn off check signal for the next frame.
S32 i = 0 ;
char**p = new char*[num_chunk] ;
if(!p)
{
return ;
}
for(i = 0 ; i < num_chunk ; i++)
{
//1MB per chunk
//if the allocation fails, the system should catch it.
p[i] = new char[1024 * 1024] ;
if(!p[i]) //in case that system try-catch is turned off
{
return ;
}
}
//release memory if the allocation check does not fail.
for(i = 0 ; i < num_chunk ; i++)
{
delete[] p[i] ;
}
delete[] p ;
//memory check for this frame succeeds, turn on next frame check.
check = TRUE ;
}
// A callback set in LLAppViewer::init()
static void ui_audio_callback(const LLUUID& uuid)
{
@ -369,6 +395,24 @@ void request_initial_instant_messages()
}
}
// A settings system callback for CrashSubmitBehavior
bool handleCrashSubmitBehaviorChanged(const LLSD& newvalue)
{
S32 cb = newvalue.asInteger();
const S32 NEVER_SUBMIT_REPORT = 2;
if(cb == NEVER_SUBMIT_REPORT)
{
// LLWatchdog::getInstance()->cleanup(); // SJB: cleaning up a running watchdog is unsafe
LLAppViewer::instance()->destroyMainloopTimeout();
}
else if(gSavedSettings.getBOOL("WatchdogEnabled") == TRUE)
{
// LLWatchdog::getInstance()->init();
// LLAppViewer::instance()->initMainloopTimeout("Mainloop Resume");
}
return true;
}
// Use these strictly for things that are constructed at startup,
// or for things that are performance critical. JC
static void settings_to_globals()
@ -464,72 +508,32 @@ static void settings_modify()
gSavedSettings.setBOOL("PTTCurrentlyEnabled", TRUE); //gSavedSettings.getBOOL("EnablePushToTalk"));
}
void initGridChoice()
void LLAppViewer::initGridChoice()
{
LLString gridChoice = gSavedSettings.getString("GridChoice");
if(!gridChoice.empty())
// Used to show first chunk of each argument passed in the
// window title.
{
// find the grid choice from the user setting.
int gridIndex = GRID_INFO_NONE;
for(;gridIndex < GRID_INFO_OTHER; ++gridIndex )
{
if(0 == LLString::compareInsensitive(gGridInfo[gridIndex].mLabel, gridChoice.c_str()))
{
gGridChoice = (EGridInfo)gridIndex;
// Load up the initial grid choice from:
// - hard coded defaults...
// - command line settings...
// - if dev build, persisted settings...
if(GRID_INFO_LOCAL == gGridChoice)
{
gGridName = LOOPBACK_ADDRESS_STRING;
break;
}
else
{
gGridName = gGridInfo[gGridChoice].mName;
break;
}
}
}
// Set the "grid choice", this is specified by command line.
std::string grid_choice = gSavedSettings.getString("CmdLineGridChoice");
LLViewerLogin::getInstance()->setGridChoice(grid_choice);
if(GRID_INFO_OTHER == gridIndex)
{
// *FIX:MEP Can and should we validate that this is an IP address?
gGridChoice = (EGridInfo)gridIndex;
gGridName = llformat("%s", gSavedSettings.getString("GridChoice").c_str());
}
}
#if !LL_RELEASE_FOR_DOWNLOAD
if (gGridChoice == GRID_INFO_NONE)
// Load last server choice by default
// ignored if the command line grid choice has been set
if(grid_choice.empty())
{
// Development version: load last server choice by default (overridden by cmd line args)
S32 server = gSavedSettings.getS32("ServerChoice");
if (server != 0)
gGridChoice = (EGridInfo)llclamp(server, 0, (S32)GRID_INFO_COUNT - 1);
if (server == GRID_INFO_OTHER)
S32 server = gSavedSettings.getS32("ServerChoice");
server = llclamp(server, 0, (S32)GRID_INFO_COUNT - 1);
if(server == GRID_INFO_OTHER)
{
LLString custom_server = gSavedSettings.getString("CustomServer");
if (custom_server.empty())
{
gGridName = "none";
}
else
{
gGridName = custom_server.c_str();
}
LLViewerLogin::getInstance()->setGridChoice(custom_server);
}
else if(server != 0)
{
LLViewerLogin::getInstance()->setGridChoice((EGridInfo)server);
}
gSavedSettings.setString("GridChoice", gGridInfo[gGridChoice].mLabel);
}
#endif
if (gGridChoice == GRID_INFO_NONE)
{
gGridChoice = GridDefaultChoice;
gSavedSettings.setString("GridChoice", gGridInfo[gGridChoice].mLabel);
}
}
@ -577,7 +581,6 @@ LLTextureFetch* LLAppViewer::sTextureFetch = NULL;
LLAppViewer::LLAppViewer() :
mMarkerFile(NULL),
mCrashBehavior(CRASH_BEHAVIOR_ASK),
mReportedCrash(false),
mNumSessions(0),
mPurgeCache(false),
@ -586,7 +589,8 @@ LLAppViewer::LLAppViewer() :
mSavedFinalSnapshot(false),
mQuitRequested(false),
mLogoutRequestSent(false),
mYieldTime(-1)
mYieldTime(-1),
mMainloopTimeout(NULL)
{
if(NULL != sInstance)
{
@ -594,15 +598,11 @@ LLAppViewer::LLAppViewer() :
}
sInstance = this;
// Initialize the mainloop timeout.
mMainloopTimeout = new LLWatchdogTimeout();
}
LLAppViewer::~LLAppViewer()
{
// Initialize the mainloop timeout.
delete mMainloopTimeout;
destroyMainloopTimeout();
// If we got to this destructor somehow, the app didn't hang.
removeMarkerFile();
@ -610,13 +610,6 @@ LLAppViewer::~LLAppViewer()
bool LLAppViewer::init()
{
// *NOTE:Mani - LLCurl::initClass is not thread safe.
// Called before threads are created.
LLCurl::initClass();
initThreads();
//
// Start of the application
//
@ -629,7 +622,6 @@ bool LLAppViewer::init()
// that touches files should really go through the lldir API
gDirUtilp->initAppDirs("SecondLife");
initLogging();
//
@ -638,6 +630,12 @@ bool LLAppViewer::init()
if (!initConfiguration())
return false;
// *NOTE:Mani - LLCurl::initClass is not thread safe.
// Called before threads are created.
LLCurl::initClass();
initThreads();
writeSystemInfo();
// Build a string representing the current version number.
@ -888,10 +886,6 @@ bool LLAppViewer::init()
bool LLAppViewer::mainLoop()
{
mMainloopTimeout = new LLWatchdogTimeout();
// *FIX:Mani - Make this a setting, once new settings exist in this branch.
mMainloopTimeout->setTimeout(5);
//-------------------------------------------
// Run main loop until time to quit
//-------------------------------------------
@ -920,6 +914,8 @@ bool LLAppViewer::mainLoop()
{
LLFastTimer t(LLFastTimer::FTM_FRAME);
pingMainloopTimeout("Main:GatherInput");
{
LLFastTimer t2(LLFastTimer::FTM_MESSAGES);
#if LL_WINDOWS
@ -940,8 +936,13 @@ bool LLAppViewer::mainLoop()
}
#endif
//at the beginning of every frame, check if the system can successfully allocate 10 * 1 MB memory.
idle_mem_check(10) ;
if (!LLApp::isExiting())
{
pingMainloopTimeout("Main:JoystickKeyboard");
// Scan keyboard for movement keys. Command keys and typing
// are handled by windows callbacks. Don't do this until we're
// done initializing. JC
@ -956,6 +957,8 @@ bool LLAppViewer::mainLoop()
gKeyboard->scanKeyboard();
}
pingMainloopTimeout("Main:Messages");
// Update state based on messages, user input, object idle.
{
LLFastTimer t3(LLFastTimer::FTM_IDLE);
@ -972,25 +975,34 @@ bool LLAppViewer::mainLoop()
if (gDoDisconnect && (LLStartUp::getStartupState() == STATE_STARTED))
{
pauseMainloopTimeout();
saveFinalSnapshot();
disconnectViewer();
resumeMainloopTimeout();
}
// Render scene.
if (!LLApp::isExiting())
{
pingMainloopTimeout("Main:Display");
display();
pingMainloopTimeout("Main:Snapshot");
LLFloaterSnapshot::update(); // take snapshots
#if LL_LCD_COMPILE
// update LCD Screen
pingMainloopTimeout("Main:LCD");
gLcdScreen->UpdateDisplay();
#endif
}
}
pingMainloopTimeout("Main:Sleep");
pauseMainloopTimeout();
// Sleep and run background threads
{
LLFastTimer t2(LLFastTimer::FTM_SLEEP);
@ -1073,7 +1085,9 @@ bool LLAppViewer::mainLoop()
//LLVFSThread::sLocal->pause(); // Prevent the VFS thread from running while rendering.
//LLLFSThread::sLocal->pause(); // Prevent the LFS thread from running while rendering.
mMainloopTimeout->ping();
resumeMainloopTimeout();
pingMainloopTimeout("Main:End");
}
}
@ -1098,7 +1112,7 @@ bool LLAppViewer::mainLoop()
delete gServicePump;
mMainloopTimeout->stop();
destroyMainloopTimeout();
llinfos << "Exiting main_loop" << llendflush;
@ -1400,7 +1414,12 @@ bool LLAppViewer::initThreads()
static const bool enable_threads = true;
#endif
LLWatchdog::getInstance()->init();
const S32 NEVER_SUBMIT_REPORT = 2;
if(TRUE == gSavedSettings.getBOOL("WatchdogEnabled")
&& (gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) != NEVER_SUBMIT_REPORT))
{
LLWatchdog::getInstance()->init();
}
LLVFSThread::initClass(enable_threads && true);
LLLFSThread::initClass(enable_threads && true);
@ -1556,6 +1575,19 @@ bool LLAppViewer::initConfiguration()
LLWindow::getFontListSans());
#endif
//*FIX:Mani - Set default to disabling watchdog mainloop
// timeout for mac and linux. There is no call stack info
// on these platform to help debug.
#ifndef LL_RELEASE_FOR_DOWNLOAD
gSavedSettings.setBOOL("WatchdogEnabled", FALSE);
#endif
#ifndef LL_WINDOWS
gSavedSettings.setBOOL("WatchdogEnabled", FALSE);
#endif
gCrashSettings.getControl(CRASH_BEHAVIOR_SETTING)->getSignal()->connect(boost::bind(&handleCrashSubmitBehaviorChanged, _1));
// These are warnings that appear on the first experience of that condition.
// They are already set in the settings_default.xml file, but still need to be added to LLFirstUse
// for disable/reset ability
@ -1787,18 +1819,6 @@ bool LLAppViewer::initConfiguration()
}
}
const LLControlVariable* loginuri = gSavedSettings.getControl("LoginURI");
if(loginuri && LLString::null != loginuri->getValue().asString())
{
addLoginURI(loginuri->getValue().asString());
}
const LLControlVariable* helperuri = gSavedSettings.getControl("HelperURI");
if(helperuri && LLString::null != helperuri->getValue().asString())
{
setHelperURI(helperuri->getValue().asString());
}
const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinFolder");
if(skinfolder && LLString::null != skinfolder->getValue().asString())
{
@ -2180,10 +2200,6 @@ void LLAppViewer::cleanupSavedSettings()
{
gSavedSettings.setF32("RenderFarClip", gAgent.mDrawDistance);
}
// *REMOVE: This is now done via LLAppViewer::setCrashBehavior()
// Left vestigially in case I borked it.
// gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, gCrashBehavior);
}
void LLAppViewer::removeCacheFiles(const char* file_mask)
@ -2210,8 +2226,15 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE();
gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2();
gDebugInfo["RAMInfo"] = llformat("%u", gSysMemory.getPhysicalMemoryKB());
gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB());
gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB
gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple();
// *FIX:Mani - move this ddown in llappviewerwin32
#ifdef LL_WINDOWS
DWORD thread_id = GetCurrentThreadId();
gDebugInfo["MainloopThreadID"] = (S32)thread_id;
#endif
// Dump some debugging info
LL_INFOS("SystemInfo") << gSecondLife
@ -2242,7 +2265,10 @@ void LLAppViewer::handleSyncViewerCrash()
void LLAppViewer::handleViewerCrash()
{
llinfos << "Handle viewer crash entry." << llendl;
// Make sure the watchdog gets turned off...
// LLWatchdog::getInstance()->cleanup(); // SJB: This causes the Watchdog to hang for an extra 20-40s?!
LLAppViewer* pApp = LLAppViewer::instance();
if (pApp->beingDebugged())
{
@ -2297,6 +2323,12 @@ void LLAppViewer::handleViewerCrash()
gDebugInfo["CurrentRegion"] = gAgent.getRegion()->getName();
}
if(LLAppViewer::instance()->mMainloopTimeout)
{
gDebugInfo["MainloopTimeoutState"] = LLAppViewer::instance()->mMainloopTimeout->getState();
}
//Write out the crash status file
//Use marker file style setup, as that's the simplest, especially since
//we're already in a crash situation
@ -2360,12 +2392,6 @@ void LLAppViewer::handleViewerCrash()
return;
}
void LLAppViewer::setCrashBehavior(S32 cb)
{
mCrashBehavior = cb;
gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, mCrashBehavior);
}
bool LLAppViewer::anotherInstanceRunning()
{
// We create a marker file when the program starts and remove the file when it finishes.
@ -2822,61 +2848,6 @@ const LLString& LLAppViewer::getWindowTitle() const
return gWindowTitle;
}
void LLAppViewer::resetURIs() const
{
// Clear URIs when picking a new server
gLoginURIs.clear();
gHelperURI.clear();
}
const std::vector<std::string>& LLAppViewer::getLoginURIs() const
{
if (gLoginURIs.empty())
{
// not specified on the command line, use value from table
gLoginURIs.push_back(gGridInfo[gGridChoice].mLoginURI);
}
return gLoginURIs;
}
const std::string& LLAppViewer::getHelperURI() const
{
if (gHelperURI.empty())
{
// not specified on the command line, use value from table
gHelperURI = gGridInfo[gGridChoice].mHelperURI;
}
return gHelperURI;
}
void LLAppViewer::addLoginURI(const std::string& uri)
{
// *NOTE:Mani - login uri trumps the --grid (gGridChoice) setting.
// Update gGridChoice to reflect the loginURI setting.
gLoginURIs.push_back(uri);
const std::string& top_uri = getLoginURIs()[0];
int i = 0;
for(; i < GRID_INFO_COUNT; ++i)
{
if(top_uri == gGridInfo[i].mLoginURI)
{
gGridChoice = (EGridInfo)i;
break;
}
}
if(GRID_INFO_COUNT == i)
{
gGridChoice = GRID_INFO_OTHER;
}
}
void LLAppViewer::setHelperURI(const std::string& uri)
{
gHelperURI = uri;
}
// Callback from a dialog indicating user was logged out.
void finish_disconnect(S32 option, void* userdata)
{
@ -3014,15 +2985,6 @@ void LLAppViewer::saveNameCache()
}
}
bool LLAppViewer::isInProductionGrid()
{
// *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice,
// but it seems that loginURI trumps that.
const std::string& loginURI = getLoginURIs()[0];
return (loginURI == gGridInfo[GRID_INFO_AGNI].mLoginURI);
}
/*! @brief This class is an LLFrameTimer that can be created with
an elapsed time that starts counting up from the given value
rather than 0.0.
@ -3531,6 +3493,8 @@ static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME;
void LLAppViewer::idleNetwork()
{
pingMainloopTimeout("idleNetwork");
gObjectList.mNumNewObjects = 0;
S32 total_decoded = 0;
@ -3716,18 +3680,58 @@ void LLAppViewer::forceErrorSoftwareException()
throw;
}
void LLAppViewer::startMainloopTimeout(F32 secs)
void LLAppViewer::initMainloopTimeout(const std::string& state, F32 secs)
{
if(secs < 0.0f)
if(!mMainloopTimeout)
{
secs = gSavedSettings.getF32("MainloopTimeoutDefault");
mMainloopTimeout = new LLWatchdogTimeout();
resumeMainloopTimeout(state, secs);
}
mMainloopTimeout->setTimeout(secs);
mMainloopTimeout->start();
}
void LLAppViewer::stopMainloopTimeout()
void LLAppViewer::destroyMainloopTimeout()
{
mMainloopTimeout->stop();
if(mMainloopTimeout)
{
delete mMainloopTimeout;
mMainloopTimeout = NULL;
}
}
void LLAppViewer::resumeMainloopTimeout(const std::string& state, F32 secs)
{
if(mMainloopTimeout)
{
if(secs < 0.0f)
{
secs = gSavedSettings.getF32("MainloopTimeoutDefault");
}
mMainloopTimeout->setTimeout(secs);
mMainloopTimeout->start(state);
}
}
void LLAppViewer::pauseMainloopTimeout()
{
if(mMainloopTimeout)
{
mMainloopTimeout->stop();
}
}
void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs)
{
if(mMainloopTimeout)
{
if(secs < 0.0f)
{
secs = gSavedSettings.getF32("MainloopTimeoutDefault");
}
mMainloopTimeout->setTimeout(secs);
mMainloopTimeout->ping(state);
}
}

View File

@ -77,8 +77,6 @@ public:
// Report true if under the control of a debugger. A null-op default.
virtual bool beingDebugged() { return false; }
S32 getCrashBehavior() const { return mCrashBehavior; }
void setCrashBehavior(S32 cb);
virtual void handleCrashReporting() = 0; // What to do with crash report?
virtual void handleSyncCrashTrace() = 0; // any low-level crash-prep that has to happen in the context of the crashing thread before the crash report is delivered.
static void handleViewerCrash(); // Hey! The viewer crashed. Do this, soon.
@ -96,13 +94,6 @@ public:
const LLString& getSecondLifeTitle() const; // The Second Life title.
const LLString& getWindowTitle() const; // The window display name.
// Helpers for URIs
void addLoginURI(const std::string& uri);
void setHelperURI(const std::string& uri);
const std::vector<std::string>& getLoginURIs() const;
const std::string& getHelperURI() const;
void resetURIs() const;
void forceDisconnect(const LLString& msg); // Force disconnection, with a message to the user.
void badNetworkHandler(); // Cause a crash state due to bad network packet.
@ -112,8 +103,6 @@ public:
void loadNameCache();
void saveNameCache();
bool isInProductionGrid();
void removeMarkerFile(bool leave_logout_marker = false);
// LLAppViewer testing helpers.
@ -138,10 +127,13 @@ public:
std::string getSettingsFileName(const std::string& file);
// For thread debugging.
// llstartup needs to control this.
// llworld, send_agent_pause() also controls this.
void startMainloopTimeout(F32 secs = -1.0f);
void stopMainloopTimeout();
// llstartup needs to control init.
// llworld, send_agent_pause() also controls pause/resume.
void initMainloopTimeout(const std::string& state, F32 secs = -1.0f);
void destroyMainloopTimeout();
void pauseMainloopTimeout();
void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f);
void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f);
protected:
virtual bool initWindow(); // Initialize the viewer's window.
@ -159,6 +151,7 @@ private:
bool initThreads(); // Initialize viewer threads, return false on failure.
bool initConfiguration(); // Initialize settings from the command line/config file.
void initGridChoice();
bool initCache(); // Initialize local client cache.
void purgeCache(); // Clear the local cache.
@ -192,7 +185,6 @@ private:
LLOSInfo mSysOSInfo;
S32 mCrashBehavior;
bool mReportedCrash;
// Thread objects.
@ -293,6 +285,7 @@ extern BOOL gUseWireframe;
extern LLVFS *gStaticVFS;
extern LLMemoryInfo gSysMemory;
extern U64 gMemoryAllocated;
extern LLString gLastVersionChannel;

View File

@ -333,13 +333,15 @@ void LLAppViewerLinux::handleSyncCrashTrace()
void LLAppViewerLinux::handleCrashReporting()
{
const S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING);
// Always generate the report, have the logger do the asking, and
// don't wait for the logger before exiting (-> total cleanup).
if (CRASH_BEHAVIOR_NEVER_SEND != LLAppViewer::instance()->getCrashBehavior())
if (CRASH_BEHAVIOR_NEVER_SEND != cb)
{
// launch the actual crash logger
const char* ask_dialog = "-dialog";
if (CRASH_BEHAVIOR_ASK != LLAppViewer::instance()->getCrashBehavior())
if (CRASH_BEHAVIOR_ASK != cb)
ask_dialog = ""; // omit '-dialog' option
std::string cmd =gDirUtilp->getAppRODataDir();
cmd += gDirUtilp->getDirDelimiter();
@ -348,7 +350,7 @@ void LLAppViewerLinux::handleCrashReporting()
{cmd.c_str(),
ask_dialog,
"-user",
(char*)gGridName.c_str(),
(char*)LLViewerLogin::getInstance()->getGridLabel().c_str(),
"-name",
LLAppViewer::instance()->getSecondLifeTitle().c_str(),
NULL};

View File

@ -71,7 +71,6 @@ extern "C" {
#endif
#endif
LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop)
{
// *NOTE:Mani - this code is stolen from LLApp, where its never actually used.
@ -421,9 +420,10 @@ void LLAppViewerWin32::handleCrashReporting()
exe_path += "win_crash_logger.exe";
std::string arg_string = "-user ";
arg_string += gGridName;
switch(getCrashBehavior())
arg_string += LLViewerLogin::getInstance()->getGridLabel();
S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING);
switch(cb)
{
case CRASH_BEHAVIOR_ASK:
default:

View File

@ -34,7 +34,7 @@
#include "llbox.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llglheaders.h"
LLBox gBox;

View File

@ -39,7 +39,7 @@
// Project includes
#include "llui.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "lluiconstants.h"
#include "llviewerwindow.h"
#include "llviewercontrol.h"

View File

@ -291,12 +291,15 @@ bool LLCommandLineParser::parseAndStoreResults(po::command_line_parser& clp)
}
catch(LLCLPLastOption&)
{
// Continue without parsing.
std::string msg = "Found tokens past last option. Ignoring.";
llwarns << msg << llendl;
mErrorMsg = msg;
// boost::po will have stored a mal-formed option.
// This exception means a token was read after an option
// that must be the last option was reached (see url and slurl options)
// boost::po will have stored a malformed option.
// All such options will be removed below.
// The last option read, the last_option option, and its value
// are put into the error message.
std::string last_option;
std::string last_value;
for(po::variables_map::iterator i = gVariableMap.begin(); i != gVariableMap.end();)
{
po::variables_map::iterator tempI = i++;
@ -304,7 +307,27 @@ bool LLCommandLineParser::parseAndStoreResults(po::command_line_parser& clp)
{
gVariableMap.erase(tempI);
}
else
{
last_option = tempI->first;
LLCommandLineParser::token_vector_t* tv =
boost::any_cast<LLCommandLineParser::token_vector_t>(&(tempI->second.value()));
if(!tv->empty())
{
last_value = (*tv)[tv->size()-1];
}
}
}
// Continue without parsing.
std::ostringstream msg;
msg << "Caught Error: Found options after last option: "
<< last_option << " "
<< last_value;
llwarns << msg.str() << llendl;
mErrorMsg = msg.str();
return false;
}
return true;
}

View File

@ -44,7 +44,7 @@
#include "lllineeditor.h"
#include "llviewchildren.h"
#include "llxmlrpctransaction.h"
#include "llappviewer.h"
#include "llviewernetwork.h"
const F64 CURRENCY_ESTIMATE_FREQUENCY = 2.0;
@ -239,7 +239,7 @@ void LLCurrencyUIManager::Impl::startTransaction(TransactionType type,
static std::string transactionURI;
if (transactionURI.empty())
{
transactionURI = LLAppViewer::instance()->getHelperURI() + "currency.php";
transactionURI = LLViewerLogin::getInstance()->getHelperURI() + "currency.php";
}
delete mTransaction;
@ -527,3 +527,4 @@ std::string LLCurrencyUIManager::errorURI()
}

View File

@ -122,6 +122,7 @@ void LLDrawable::destroy()
sNumZombieDrawables--;
}
LLFace::sDeleteLock = mFaces.size() ;
std::for_each(mFaces.begin(), mFaces.end(), DeletePointer());
mFaces.clear();
@ -184,6 +185,7 @@ void LLDrawable::cleanupReferences()
{
LLFastTimer t(LLFastTimer::FTM_PIPELINE);
LLFace::sDeleteLock = mFaces.size() ;
std::for_each(mFaces.begin(), mFaces.end(), DeletePointer());
mFaces.clear();
@ -277,6 +279,7 @@ void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerImag
}
else if (newFaces < (S32)mFaces.size())
{
LLFace::sDeleteLock = (S32)mFaces.size() - newFaces ;
std::for_each(mFaces.begin() + newFaces, mFaces.end(), DeletePointer());
mFaces.erase(mFaces.begin() + newFaces, mFaces.end());
}
@ -288,6 +291,8 @@ void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerImag
addFace(poolp, texturep);
}
}
llassert_always(mFaces.size() == newFaces);
}
void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewerImage *texturep)
@ -298,6 +303,7 @@ void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewer
}
else if (newFaces < (S32)mFaces.size())
{
LLFace::sDeleteLock = (S32)mFaces.size() - newFaces ;
std::for_each(mFaces.begin() + newFaces, mFaces.end(), DeletePointer());
mFaces.erase(mFaces.begin() + newFaces, mFaces.end());
}
@ -309,6 +315,8 @@ void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewer
addFace(poolp, texturep);
}
}
llassert_always(mFaces.size() == newFaces) ;
}
void LLDrawable::mergeFaces(LLDrawable* src)
@ -329,8 +337,13 @@ void LLDrawable::deleteFaces(S32 offset, S32 count)
{
face_list_t::iterator face_begin = mFaces.begin() + offset;
face_list_t::iterator face_end = face_begin + count;
S32 end = (S32)mFaces.size() ;
LLFace::sDeleteLock = count ;
std::for_each(face_begin, face_end, DeletePointer());
mFaces.erase(face_begin, face_end);
llassert_always(mFaces.size() == end - count) ;
}
void LLDrawable::update()

View File

@ -32,7 +32,7 @@
#include "llviewerprecompiledheaders.h"
#include "lldrawpool.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llfasttimer.h"
#include "llviewercontrol.h"

View File

@ -37,6 +37,7 @@
#include "llviewercontrol.h"
#include "llcriticaldamp.h"
#include "llfasttimer.h"
#include "llrender.h"
#include "llcubemap.h"
#include "llsky.h"
@ -93,7 +94,7 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
{
// Start out with no shaders.
current_shader = target_shader = NULL;
glUseProgramObjectARB(0);
LLGLSLShader::bindNoShader();
}
gPipeline.enableLightsDynamic();
}
@ -105,7 +106,7 @@ void LLDrawPoolAlpha::endRenderPass( S32 pass )
if(gPipeline.canUseWindLightShaders())
{
glUseProgramObjectARB(0);
LLGLSLShader::bindNoShader();
}
}
@ -123,7 +124,7 @@ void LLDrawPoolAlpha::render(S32 pass)
{
if(gPipeline.canUseWindLightShaders())
{
glUseProgramObjectARB(0);
LLGLSLShader::bindNoShader();
}
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
glColor4f(1,0,0,1);
@ -207,18 +208,17 @@ void LLDrawPoolAlpha::renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask
{
return;
}
// *TODO - Uhhh, we should always be doing some type of alpha rejection. These should probably both be 0.01f
glAlphaFunc(GL_GREATER, 0.f);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
else
{
if (LLPipeline::sImpostorRender)
{
glAlphaFunc(GL_GREATER, 0.5f);
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
}
else
{
glAlphaFunc(GL_GREATER, 0.01f);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
}
@ -230,7 +230,8 @@ void LLDrawPoolAlpha::renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask
if (texture && params.mTexture.notNull())
{
glActiveTextureARB(GL_TEXTURE0_ARB);
llassert_always(gGL.getTexUnit(0)) ;
gGL.getTexUnit(0)->activate();
params.mTexture->bind();
params.mTexture->addTextureStats(params.mVSize);
if (params.mTextureMatrix)
@ -283,7 +284,7 @@ void LLDrawPoolAlpha::renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask
}
else if (!use_shaders && current_shader != NULL)
{
glUseProgramObjectARB(0);
LLGLSLShader::bindNoShader();
current_shader = NULL;
}

View File

@ -32,7 +32,7 @@
#include "llviewerprecompiledheaders.h"
#include "lldrawpoolavatar.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llvoavatar.h"
#include "m3math.h"
@ -299,7 +299,7 @@ void LLDrawPoolAvatar::beginSkinned()
}
sVertexProgram->enableTexture(LLShaderMgr::BUMP_MAP);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
else
{
@ -319,7 +319,7 @@ void LLDrawPoolAvatar::endSkinned()
{
sRenderingSkinned = FALSE;
sVertexProgram->disableTexture(LLShaderMgr::BUMP_MAP);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
disable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]);
if (sShaderLevel >= SHADER_LEVEL_BUMP)
{
@ -343,7 +343,7 @@ void LLDrawPoolAvatar::endSkinned()
}
}
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
@ -395,7 +395,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
if (!avatarp->isFullyLoaded())
if (!single_avatar && !avatarp->isFullyLoaded())
{
/* // debug code to draw a cube in place of avatar
@ -599,22 +599,12 @@ void LLDrawPoolAvatar::renderForSelect()
BOOL impostor = avatarp->isImpostor();
if (impostor)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA);
avatarp->renderImpostor(color);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
return;
}
@ -623,8 +613,8 @@ void LLDrawPoolAvatar::renderForSelect()
{
gAvatarMatrixParam = sVertexProgram->mUniform[LLShaderMgr::AVATAR_MATRIX];
}
glAlphaFunc(GL_GEQUAL, 0.2f);
gGL.blendFunc(GL_ONE, GL_ZERO);
gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.2f);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
glColor4ubv(color.mV);
@ -645,11 +635,11 @@ void LLDrawPoolAvatar::renderForSelect()
disable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]);
}
glAlphaFunc(GL_GREATER, 0.01f);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
// restore texture mode
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
//-----------------------------------------------------------------------------

View File

@ -41,7 +41,7 @@
#include "m4math.h"
#include "v4math.h"
#include "llglheaders.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llagent.h"
#include "llcubemap.h"
@ -371,17 +371,8 @@ void LLDrawPoolBump::beginShiny(bool invisible)
cube_map->setMatrix(0);
cube_map->bind();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
//use RGB from texture
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
// use alpha from color
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA);
}
}
}
@ -443,15 +434,17 @@ void LLDrawPoolBump::endShiny(bool invisible)
}
shader->unbind();
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glEnable(GL_TEXTURE_2D);
}
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (cube_channel >= 0)
{
gGL.getTexUnit(cube_channel)->setTextureBlendType(LLTexUnit::TB_MULT);
}
}
LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
diffuse_channel = -1;
cube_channel = 0;
@ -540,16 +533,16 @@ void LLDrawPoolBump::endFullbrightShiny()
{
shader->disableTexture(LLShaderMgr::DIFFUSE_MAP);
}
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glEnable(GL_TEXTURE_2D);
shader->unbind();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
diffuse_channel = -1;
cube_channel = 0;
@ -614,6 +607,10 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params)
if( tex )
{
bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
//------------------------------------------
//error check to make sure bump is valid
llassert_always(!bump || bump->getNumRefs() == 1) ;
//------------------------------------------
}
break;
@ -628,6 +625,11 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params)
if (bump)
{
//------------------------------------------
//error check to make sure bump is valid
llassert_always(bump->getNumRefs() > 0 && bump->getNumRefs() < 100000) ;
//------------------------------------------
bump->bind(1);
bump->bind(0);
return TRUE;
@ -650,37 +652,18 @@ void LLDrawPoolBump::beginBump()
// TEXTURE UNIT 0
// Output.rgb = texture at texture coord 0
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_ALPHA);
// Don't care about alpha output
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
// TEXTURE UNIT 1
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 1
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_ADD_SIGNED_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_ONE_MINUS_SRC_ALPHA);
// Don't care about alpha output
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
// src = tex0 + (1 - tex1) - 0.5
// = (bump0/2 + 0.5) + (1 - (bump1/2 + 0.5)) - 0.5
@ -692,9 +675,8 @@ void LLDrawPoolBump::beginBump()
// = 2 * ((1 + bump0 - bump1) / 2) * dst [0 - 2 * dst]
// = (1 + bump0 - bump1) * dst.rgb
// = dst.rgb + dst.rgb * (bump0 - bump1)
gGL.blendFunc(GL_DST_COLOR, GL_SRC_COLOR);
// gGL.blendFunc(GL_ONE, GL_ZERO); // temp
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.setSceneBlendType(LLRender::BT_MULT_X2);
gGL.getTexUnit(0)->activate();
stop_glerror();
LLViewerImage::unbindTexture(1, GL_TEXTURE_2D);
@ -728,15 +710,15 @@ void LLDrawPoolBump::endBump()
}
// Disable texture unit 1
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glDisable(GL_TEXTURE_2D); // Texture unit 1
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT);
// Disable texture unit 0
glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
////////////////////////////////////////////////////////////////
@ -890,9 +872,15 @@ LLImageGL* LLBumpImageList::getBrightnessDarknessImage(LLViewerImage* src_image,
{
LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
raw->clear(0x77, 0x77, 0x77, 0xFF);
//------------------------------
bump = new LLImageGL( raw, TRUE);
bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
//immediately assign bump to a global smart pointer in case some local smart pointer
//accidently releases it.
(*entries_list)[src_image->getID()] = bump;
//------------------------------
bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
// Note: this may create an LLImageGL immediately
src_image->setLoadedCallback( callback_func, 0, TRUE, new LLUUID(src_image->getID()) );
@ -1047,10 +1035,15 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLIma
}
}
//---------------------------------------------------
LLImageGL* bump = new LLImageGL( TRUE);
bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
bump->createGLTexture(0, dst_image);
//immediately assign bump to a global smart pointer in case some local smart pointer
//accidently releases it.
iter->second = bump; // derefs (and deletes) old image
//---------------------------------------------------
bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
bump->createGLTexture(0, dst_image);
}
else
{
@ -1101,16 +1094,16 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
{
if (mShiny)
{
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glMatrixMode(GL_TEXTURE);
}
else
{
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glMatrixMode(GL_TEXTURE);
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
@ -1153,13 +1146,13 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
{
if (mShiny)
{
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
else
{
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glLoadIdentity();
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
@ -1172,9 +1165,9 @@ void LLDrawPoolInvisible::render(S32 pass)
U32 invisi_mask = LLVertexBuffer::MAP_VERTEX;
glStencilMask(0);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
gGL.setColorMask(false, false);
pushBatches(LLRenderPass::PASS_INVISIBLE, invisi_mask, FALSE);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
gGL.setColorMask(true, false);
glStencilMask(0xFFFFFFFF);
if (gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))

View File

@ -41,7 +41,7 @@
#include "pipeline.h"
#include "llspatialpartition.h"
#include "llglslshader.h"
#include "llglimmediate.h"
#include "llrender.h"
static LLGLSLShader* simple_shader = NULL;
@ -52,7 +52,7 @@ void LLDrawPoolGlow::render(S32 pass)
LLFastTimer t(LLFastTimer::FTM_RENDER_GLOW);
LLGLEnable blend(GL_BLEND);
LLGLDisable test(GL_ALPHA_TEST);
gGL.blendFunc(GL_ONE, GL_ONE);
gGL.setSceneBlendType(LLRender::BT_ADD);
U32 shader_level = LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_OBJECT);
@ -66,11 +66,11 @@ void LLDrawPoolGlow::render(S32 pass)
}
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
gGL.setColorMask(false, true);
renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask());
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setColorMask(true, false);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (shader_level > 0 && fullbright_shader)
{
@ -120,7 +120,7 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass)
// don't use shaders!
if (gGLManager.mHasShaderObjects)
{
glUseProgramObjectARB(0);
LLGLSLShader::bindNoShader();
}
}
}
@ -140,7 +140,7 @@ void LLDrawPoolSimple::render(S32 pass)
{
LLGLDisable blend(GL_BLEND);
LLGLState alpha_test(GL_ALPHA_TEST, gPipeline.canUseWindLightShadersOnObjects());
glAlphaFunc(GL_GREATER, 0.5f);
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
{ //render simple
LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE);
@ -152,7 +152,7 @@ void LLDrawPoolSimple::render(S32 pass)
LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS);
LLGLEnable test(GL_ALPHA_TEST);
LLGLEnable blend(GL_BLEND);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
//render grass
LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask());
}
@ -172,6 +172,6 @@ void LLDrawPoolSimple::render(S32 pass)
renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask);
}
glAlphaFunc(GL_GREATER, 0.01f);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}

View File

@ -90,7 +90,7 @@ void LLDrawPoolSky::render(S32 pass)
{
// Ironically, we must support shader objects to be
// able to use this call.
glUseProgramObjectARB(0);
LLGLSLShader::bindNoShader();
}
mShader = NULL;
}

View File

@ -52,7 +52,7 @@
#include "llworld.h"
#include "pipeline.h"
#include "llglslshader.h"
#include "llglimmediate.h"
#include "llrender.h"
const F32 DETAIL_SCALE = 1.f/16.f;
int DebugDetailMap = 0;
@ -69,14 +69,16 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) :
sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
mAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient.tga",
TRUE, TRUE, GL_ALPHA8, GL_ALPHA,
LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb"));
TRUE, TRUE, GL_ALPHA8, GL_ALPHA,
LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb"));
mAlphaRampImagep->bind(0);
mAlphaRampImagep->setClamp(TRUE, TRUE);
m2DAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient_2d.j2c",
TRUE, TRUE, GL_ALPHA8, GL_ALPHA,
LLUUID("38b86f85-2575-52a9-a531-23108d8da837"));
m2DAlphaRampImagep->bind(0);
m2DAlphaRampImagep->setClamp(TRUE, TRUE);
@ -239,7 +241,7 @@ void LLDrawPoolTerrain::renderFullShader()
//
S32 detail0 = sShader->enableTexture(LLShaderMgr::TERRAIN_DETAIL0);
LLViewerImage::bindTexture(detail_texture0p,detail0);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
@ -259,7 +261,7 @@ void LLDrawPoolTerrain::renderFullShader()
LLViewerImage::bindTexture(detail_texture1p,detail1);
/// ALPHA TEXTURE COORDS 0:
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
@ -271,7 +273,7 @@ void LLDrawPoolTerrain::renderFullShader()
glEnable(GL_TEXTURE_2D);
/// ALPHA TEXTURE COORDS 1:
glActiveTextureARB(GL_TEXTURE2_ARB);
gGL.getTexUnit(2)->activate();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(-2.f, 0.f, 0.f);
@ -284,7 +286,7 @@ void LLDrawPoolTerrain::renderFullShader()
LLViewerImage::bindTexture(detail_texture3p,detail3);
/// ALPHA TEXTURE COORDS 2:
glActiveTextureARB(GL_TEXTURE3_ARB);
gGL.getTexUnit(3)->activate();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(-1.f, 0.f, 0.f);
@ -307,7 +309,7 @@ void LLDrawPoolTerrain::renderFullShader()
sShader->disableTexture(LLShaderMgr::TERRAIN_DETAIL3);
LLImageGL::unbindTexture(alpha_ramp, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE4_ARB);
gGL.getTexUnit(4)->activate();
glDisable(GL_TEXTURE_2D); // Texture unit 4
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
@ -316,7 +318,7 @@ void LLDrawPoolTerrain::renderFullShader()
glMatrixMode(GL_MODELVIEW);
LLImageGL::unbindTexture(detail3, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE3_ARB);
gGL.getTexUnit(3)->activate();
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
@ -325,7 +327,7 @@ void LLDrawPoolTerrain::renderFullShader()
glMatrixMode(GL_MODELVIEW);
LLImageGL::unbindTexture(detail2, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE2_ARB);
gGL.getTexUnit(2)->activate();
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
@ -334,7 +336,7 @@ void LLDrawPoolTerrain::renderFullShader()
glMatrixMode(GL_MODELVIEW);
LLImageGL::unbindTexture(detail1, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
@ -346,7 +348,7 @@ void LLDrawPoolTerrain::renderFullShader()
// Restore Texture Unit 0 defaults
LLImageGL::unbindTexture(detail0, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glEnable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
@ -377,7 +379,7 @@ void LLDrawPoolTerrain::renderFull4TU()
tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
gGL.blendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA);
//----------------------------------------------------------------------------
// Pass 1/1
@ -385,7 +387,7 @@ void LLDrawPoolTerrain::renderFull4TU()
//
// Stage 0: detail texture 0
//
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
LLViewerImage::bindTexture(detail_texture0p,0);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
@ -397,36 +399,27 @@ void LLDrawPoolTerrain::renderFull4TU()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
//
// Stage 1: Generate alpha ramp for detail0/detail1 transition
//
LLViewerImage::bindTexture(m2DAlphaRampImagep,1);
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 1
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// Care about alpha only
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
//
// Stage 2: Interpolate detail1 with existing based on ramp
//
LLViewerImage::bindTexture(detail_texture1p,2);
glActiveTextureARB(GL_TEXTURE2_ARB);
gGL.getTexUnit(2)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 2
glClientActiveTextureARB(GL_TEXTURE2_ARB);
@ -438,34 +431,20 @@ void LLDrawPoolTerrain::renderFull4TU()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(2)->setTextureColorBlend(LLTexUnit::TBO_LERP_PREV_ALPHA, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_TEX_COLOR);
//
// Stage 3: Modulate with primary (vertex) color for lighting
//
LLViewerImage::bindTexture(detail_texture1p,3); // bind any texture
glActiveTextureARB(GL_TEXTURE3_ARB);
gGL.getTexUnit(3)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 3
glClientActiveTextureARB(GL_TEXTURE3_ARB);
// Set alpha texture and do lighting modulation
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glClientActiveTextureARB(GL_TEXTURE0_ARB);
// GL_BLEND disabled by default
@ -476,7 +455,7 @@ void LLDrawPoolTerrain::renderFull4TU()
// Stage 0: Write detail3 into base
//
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
LLViewerImage::bindTexture(detail_texture3p,0);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
@ -488,18 +467,13 @@ void LLDrawPoolTerrain::renderFull4TU()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
//
// Stage 1: Generate alpha ramp for detail2/detail3 transition
//
LLViewerImage::bindTexture(m2DAlphaRampImagep,1);
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 1
glClientActiveTextureARB(GL_TEXTURE1_ARB);
@ -511,25 +485,20 @@ void LLDrawPoolTerrain::renderFull4TU()
glTranslatef(-2.f, 0.f, 0.f);
// Care about alpha only
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
//
// Stage 2: Interpolate detail2 with existing based on ramp
//
LLViewerImage::bindTexture(detail_texture2p,2);
glActiveTextureARB(GL_TEXTURE2_ARB);
gGL.getTexUnit(2)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 2
glClientActiveTextureARB(GL_TEXTURE2_ARB);
glClientActiveTextureARB(GL_TEXTURE2_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@ -537,26 +506,16 @@ void LLDrawPoolTerrain::renderFull4TU()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_ONE_MINUS_SRC_ALPHA);
gGL.getTexUnit(2)->setTextureColorBlend(LLTexUnit::TBO_LERP_PREV_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
//
// Stage 3: Generate alpha ramp for detail1/detail2 transition
//
LLViewerImage::bindTexture(m2DAlphaRampImagep,3);
glActiveTextureARB(GL_TEXTURE3_ARB);
gGL.getTexUnit(3)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 3
glClientActiveTextureARB(GL_TEXTURE3_ARB);
glClientActiveTextureARB(GL_TEXTURE3_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// Set the texture matrix
@ -565,18 +524,10 @@ void LLDrawPoolTerrain::renderFull4TU()
glTranslatef(-1.f, 0.f, 0.f);
// Set alpha texture and do lighting modulation
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(3)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glClientActiveTextureARB(GL_TEXTURE0_ARB);
{
LLGLEnable blend(GL_BLEND);
@ -586,19 +537,21 @@ void LLDrawPoolTerrain::renderFull4TU()
LLVertexBuffer::unbind();
// Disable multitexture
LLImageGL::unbindTexture(3, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE3_ARB);
gGL.getTexUnit(3)->activate();
glClientActiveTextureARB(GL_TEXTURE3_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D); // Texture unit 3
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
LLImageGL::unbindTexture(2, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE2_ARB);
gGL.getTexUnit(2)->activate();
glClientActiveTextureARB(GL_TEXTURE2_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D); // Texture unit 2
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glMatrixMode(GL_TEXTURE);
@ -606,33 +559,34 @@ void LLDrawPoolTerrain::renderFull4TU()
glMatrixMode(GL_MODELVIEW);
LLImageGL::unbindTexture(1, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE1_ARB);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
gGL.getTexUnit(1)->activate();
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisable(GL_TEXTURE_2D); // Texture unit 1
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
// Restore blend state
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
//----------------------------------------------------------------------------
// Restore Texture Unit 0 defaults
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glDisableClientState(GL_NORMAL_ARRAY);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
// Restore non Texture Unit specific defaults
glDisableClientState(GL_NORMAL_ARRAY);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
void LLDrawPoolTerrain::renderFull2TU()
@ -654,7 +608,7 @@ void LLDrawPoolTerrain::renderFull2TU()
tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
gGL.blendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA);
//----------------------------------------------------------------------------
// Pass 1/4
@ -671,13 +625,7 @@ void LLDrawPoolTerrain::renderFull2TU()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
drawLoop();
@ -693,22 +641,17 @@ void LLDrawPoolTerrain::renderFull2TU()
glDisable(GL_TEXTURE_GEN_T);
// Care about alpha only
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
//
// Stage 1: Write detail1
//
LLViewerImage::bindTexture(detail_texture1p,1); // Texture unit 1
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 1
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@ -716,18 +659,10 @@ void LLDrawPoolTerrain::renderFull2TU()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
{
LLGLEnable blend(GL_BLEND);
drawLoop();
@ -739,26 +674,21 @@ void LLDrawPoolTerrain::renderFull2TU()
// Stage 0: Generate alpha ramp for detail1/detail2 transition
//
LLViewerImage::bindTexture(m2DAlphaRampImagep,0);
// Set the texture matrix
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(-1.f, 0.f, 0.f);
// Care about alpha only
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
//
// Stage 1: Write detail2
//
LLViewerImage::bindTexture(detail_texture2p,1);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 1
glEnable(GL_TEXTURE_GEN_S);
@ -768,16 +698,8 @@ void LLDrawPoolTerrain::renderFull2TU()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA);
{
LLGLEnable blend(GL_BLEND);
@ -790,27 +712,22 @@ void LLDrawPoolTerrain::renderFull2TU()
//
// Stage 0: Generate alpha ramp for detail2/detail3 transition
//
LLViewerImage::bindTexture(m2DAlphaRampImagep,0);
gGL.getTexUnit(0)->activate();
LLViewerImage::bindTexture(m2DAlphaRampImagep,0);
// Set the texture matrix
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(-2.f, 0.f, 0.f);
// Care about alpha only
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
// Stage 1: Write detail3
LLViewerImage::bindTexture(detail_texture3p,1);
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 1
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@ -818,30 +735,24 @@ void LLDrawPoolTerrain::renderFull2TU()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
{
LLGLEnable blend(GL_BLEND);
drawLoop();
}
// Restore blend state
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
// Disable multitexture
LLImageGL::unbindTexture(1, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glDisable(GL_TEXTURE_2D); // Texture unit 1
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glMatrixMode(GL_TEXTURE);
@ -851,18 +762,16 @@ void LLDrawPoolTerrain::renderFull2TU()
//----------------------------------------------------------------------------
// Restore Texture Unit 0 defaults
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
// Restore non Texture Unit specific defaults
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
@ -877,7 +786,7 @@ void LLDrawPoolTerrain::renderSimple()
mTexturep->addTextureStats(1024.f*1024.f);
mTexturep->bind(0);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 2
LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
@ -892,13 +801,7 @@ void LLDrawPoolTerrain::renderSimple()
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
drawLoop();
@ -906,15 +809,13 @@ void LLDrawPoolTerrain::renderSimple()
// Restore Texture Unit 0 defaults
LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
// Restore non Texture Unit specific defaults
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
//============================================================================

View File

@ -41,7 +41,7 @@
#include "pipeline.h"
#include "llviewercamera.h"
#include "llglslshader.h"
#include "llglimmediate.h"
#include "llrender.h"
S32 LLDrawPoolTree::sDiffTex = 0;
static LLGLSLShader* shader = NULL;
@ -67,7 +67,7 @@ void LLDrawPoolTree::prerender()
void LLDrawPoolTree::beginRenderPass(S32 pass)
{
LLFastTimer t(LLFastTimer::FTM_RENDER_TREES);
glAlphaFunc(GL_GREATER, 0.5f);
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
if (LLPipeline::sUnderWaterRender)
{
@ -106,7 +106,7 @@ void LLDrawPoolTree::render(S32 pass)
void LLDrawPoolTree::endRenderPass(S32 pass)
{
LLFastTimer t(LLFastTimer::FTM_RENDER_TREES);
glAlphaFunc(GL_GREATER, 0.01f);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
if (gPipeline.canUseWindLightShadersOnObjects())
{
@ -125,28 +125,18 @@ void LLDrawPoolTree::renderForSelect()
LLGLSObjectSelectAlpha gls_alpha;
gGL.blendFunc(GL_ONE, GL_ZERO);
glAlphaFunc(GL_GREATER, 0.5f);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PRIMARY_COLOR_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA);
renderTree(TRUE);
glAlphaFunc(GL_GREATER, 0.01f);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
void LLDrawPoolTree::renderTree(BOOL selecting)

View File

@ -37,6 +37,7 @@
#include "lldir.h"
#include "llerror.h"
#include "m3math.h"
#include "llrender.h"
#include "llagent.h" // for gAgent for getRegion for getWaterHeight
#include "llcubemap.h"
@ -166,7 +167,7 @@ void LLDrawPoolWater::render(S32 pass)
// Set up second pass first
mWaterImagep->addTextureStats(1024.f*1024.f);
mWaterImagep->bind(1);
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_2D); // Texture unit 1
@ -198,18 +199,10 @@ void LLDrawPoolWater::render(S32 pass)
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glClearStencil(1);
glClear(GL_STENCIL_BUFFER_BIT);
@ -230,14 +223,14 @@ void LLDrawPoolWater::render(S32 pass)
}
// Now, disable texture coord generation on texture state 1
glActiveTextureARB(GL_TEXTURE1_ARB);
gGL.getTexUnit(1)->activate();
glDisable(GL_TEXTURE_2D); // Texture unit 1
glDisable(GL_TEXTURE_GEN_S); //texture unit 1
glDisable(GL_TEXTURE_GEN_T); //texture unit 1
LLImageGL::unbindTexture(1, GL_TEXTURE_2D);
// Disable texture coordinate and color arrays
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
stop_glerror();
@ -258,7 +251,7 @@ void LLDrawPoolWater::render(S32 pass)
glMatrixMode(GL_MODELVIEW);
LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
@ -276,7 +269,7 @@ void LLDrawPoolWater::render(S32 pass)
}
}
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
if (gSky.mVOSkyp->getCubeMap())
{
@ -298,7 +291,7 @@ void LLDrawPoolWater::render(S32 pass)
renderReflection(refl_face);
}
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
void LLDrawPoolWater::renderReflection(LLFace* face)
@ -331,7 +324,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face)
void LLDrawPoolWater::shade()
{
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
gGL.setColorMask(true, true);
LLVOSky *voskyp = gSky.mVOSkyp;
@ -396,9 +389,9 @@ void LLDrawPoolWater::shade()
if (reftex > -1)
{
glActiveTextureARB(GL_TEXTURE0_ARB+reftex);
gGL.getTexUnit(reftex)->activate();
gPipeline.mWaterRef.bindTexture();
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
}
//bind normal map
@ -414,14 +407,8 @@ void LLDrawPoolWater::shade()
mWaterNormp->addTextureStats(1024.f*1024.f);
mWaterNormp->bind(bumpTex);
if (!gSavedSettings.getBOOL("RenderWaterMipNormal"))
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
}
mWaterNormp->setMipFilterNearest (mWaterNormp->getMipFilterNearest(),
!gSavedSettings.getBOOL("RenderWaterMipNormal"));
S32 screentex = shader->enableTexture(LLShaderMgr::WATER_SCREENTEX);
stop_glerror();
@ -548,9 +535,9 @@ void LLDrawPoolWater::shade()
shader->disableTexture(LLShaderMgr::WATER_SCREENDEPTH);
shader->unbind();
glActiveTextureARB(GL_TEXTURE0_ARB);
gGL.getTexUnit(0)->activate();
glEnable(GL_TEXTURE_2D);
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE);
gGL.setColorMask(true, false);
}

View File

@ -44,7 +44,7 @@
#include "llagent.h"
#include "llviewerregion.h"
#include "llface.h"
#include "llglimmediate.h"
#include "llrender.h"
LLPointer<LLImageGL> LLDrawPoolWLSky::sCloudNoiseTexture = NULL;
@ -153,7 +153,7 @@ void LLDrawPoolWLSky::renderStars(void) const
{
LLGLSPipelineSkyBox gls_sky;
LLGLEnable blend(GL_BLEND);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
// *NOTE: have to have bound the cloud noise texture already since register
// combiners blending below requires something to be bound
@ -176,16 +176,8 @@ void LLDrawPoolWLSky::renderStars(void) const
// gl_FragColor.rgb = gl_Color.rgb;
// gl_FragColor.a = gl_Color.a * star_alpha.a;
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_CONSTANT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, 2.0f);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_PREV_ALPHA, LLTexUnit::TBS_CONST_ALPHA);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, star_alpha.mV);
gSky.mVOWLSkyp->drawStars();
@ -193,8 +185,7 @@ void LLDrawPoolWLSky::renderStars(void) const
glPointSize(1.f);
// and disable the combiner states
glTexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1.0f);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
void LLDrawPoolWLSky::renderSkyClouds(F32 camHeightLocal) const
@ -208,7 +199,7 @@ void LLDrawPoolWLSky::renderSkyClouds(F32 camHeightLocal) const
LLGLEnable blend(GL_BLEND);
LLGLSBlendFunc blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glAlphaFunc(GL_GREATER, 0.01f);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
sCloudNoiseTexture->bind();
shader->bind();

View File

@ -40,9 +40,7 @@
#include "llviewerimage.h"
#include "llvertexbuffer.h"
#include "llviewerdisplay.h"
#include "llglimmediate.h"
void render_ui_and_swap_if_needed();
#include "llrender.h"
// static
LLDynamicTexture::instance_list_t LLDynamicTexture::sInstances[ LLDynamicTexture::ORDER_COUNT ];
@ -219,9 +217,8 @@ BOOL LLDynamicTexture::updateAllInstances()
LLDynamicTexture *dynamicTexture = *iter;
if (dynamicTexture->needsRender())
{
render_ui_and_swap_if_needed();
glClear(GL_DEPTH_BUFFER_BIT);
gDisplaySwapBuffers = FALSE;
gDepthDirty = TRUE;
gGL.color4f(1,1,1,1);

View File

@ -42,7 +42,7 @@
#include "lldrawpoolbump.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "lllightconstants.h"
#include "llsky.h"
#include "llviewercamera.h"
@ -57,6 +57,7 @@
extern BOOL gPickFaces;
BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE
S32 LLFace::sDeleteLock = 0 ;
#define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2])
@ -177,6 +178,9 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
void LLFace::destroy()
{
llassert_always(sDeleteLock >= 1);
--sDeleteLock;
mDrawablep = NULL;
mVObjp = NULL;
@ -468,6 +472,7 @@ void LLFace::renderSelectedUV(const S32 offset, const S32 count)
if (pass == 0)
{
LLViewerImage::bindTexture(red_blue_imagep);
red_blue_imagep->setMipFilterNearest (TRUE, TRUE);
}
else // pass == 1
{
@ -476,9 +481,8 @@ void LLFace::renderSelectedUV(const S32 offset, const S32 count)
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glScalef(256.f, 256.f, 1.f);
green_imagep->setMipFilterNearest (TRUE, TRUE);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
if (!isState(GLOBAL))

View File

@ -34,6 +34,7 @@
#include "llstrider.h"
#include "llrender.h"
#include "v2math.h"
#include "v3math.h"
#include "v4math.h"
@ -295,6 +296,9 @@ public:
lhs->getTexture() < rhs->getTexture();
}
};
public://paranoia check only
static S32 sDeleteLock ;
};
#endif // LL_LLFACE_H

View File

@ -37,7 +37,7 @@
#include "llrect.h"
#include "llerror.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llmath.h"
#include "llfontgl.h"

View File

@ -37,6 +37,7 @@
#include "indra_constants.h"
// viewer includes
#include "llagent.h" // for gAgent.inPrelude()
#include "llnotify.h"
#include "llviewercontrol.h"
#include "llui.h"
@ -107,12 +108,14 @@ void LLFirstUse::useBalanceDecrease(S32 delta)
// static
void LLFirstUse::useSit()
{
if (gSavedSettings.getWarning("FirstSit"))
{
gSavedSettings.setWarning("FirstSit", FALSE);
// Our orientation island uses sitting to teach vehicle driving
// so just never show this message. JC
//if (gSavedSettings.getWarning("FirstSit"))
//{
// gSavedSettings.setWarning("FirstSit", FALSE);
LLNotifyBox::showXml("FirstSit");
}
// LLNotifyBox::showXml("FirstSit");
//}
}
// static
@ -168,11 +171,16 @@ void LLFirstUse::useTeleport()
// static
void LLFirstUse::useOverrideKeys()
{
if (gSavedSettings.getWarning("FirstOverrideKeys"))
// Our orientation island uses key overrides to teach vehicle driving
// so don't show this message until you get off OI. JC
if (!gAgent.inPrelude())
{
gSavedSettings.setWarning("FirstOverrideKeys", FALSE);
if (gSavedSettings.getWarning("FirstOverrideKeys"))
{
gSavedSettings.setWarning("FirstOverrideKeys", FALSE);
LLNotifyBox::showXml("FirstOverrideKeys");
LLNotifyBox::showXml("FirstOverrideKeys");
}
}
}

View File

@ -305,7 +305,7 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6
new_res = mRenderRes;
}
if (!mInitialized)
if (!mInitialized || (mSimulateRes != new_res))
{
mSimulateRes = new_res;
setAttributesOfAllSections();

View File

@ -46,7 +46,7 @@
#include "llcombobox.h"
#include "lldrawable.h"
#include "lldrawpoolavatar.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llface.h"
#include "llkeyframemotion.h"
#include "lllineeditor.h"
@ -1037,7 +1037,7 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLDynamicTexture
mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion());
mDummyAvatar->createDrawable(&gPipeline);
mDummyAvatar->mIsDummy = TRUE;
mDummyAvatar->mSpecialRenderMode = 1;
mDummyAvatar->mSpecialRenderMode = 2;
mDummyAvatar->setPositionAgent(LLVector3::zero);
mDummyAvatar->slamPosition();
mDummyAvatar->updateJointLODs();
@ -1135,6 +1135,7 @@ BOOL LLPreviewAnimation::render()
if (avatarp->mDrawable.notNull())
{
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool();
avatarp->dirtyMesh();
avatarPoolp->renderAvatars(avatarp); // renders only one avatar
}

View File

@ -53,7 +53,7 @@
#include "llviewerdisplay.h"
#include "llviewercontrol.h"
#include "llui.h"
#include "llglimmediate.h"
#include "llrender.h"
///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs

View File

@ -375,7 +375,7 @@ void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price)
{
LLStringBase<char>::format_map_t args;
args["[NAME]"] = name.c_str();
args["[PRICE]"] = price;
args["[PRICE]"] = llformat("%d", price);
gViewerWindow->alertXml("NotEnoughCurrency", args);
return;
}

View File

@ -62,7 +62,7 @@
#include "llwindow.h"
#include "llworld.h"
#include "llxmlrpctransaction.h"
#include "llappviewer.h"
#include "llviewernetwork.h"
#include "roles_constants.h"
// NOTE: This is duplicated in lldatamoney.cpp ...
@ -841,7 +841,7 @@ void LLFloaterBuyLandUI::startTransaction(TransactionType type,
static std::string transaction_uri;
if (transaction_uri.empty())
{
transaction_uri = LLAppViewer::instance()->getHelperURI() + "landtool.php";
transaction_uri = LLViewerLogin::getInstance()->getHelperURI() + "landtool.php";
}
const char* method;
@ -1363,3 +1363,4 @@ void LLFloaterBuyLandUI::onClickErrorWeb(void* data)
}

View File

@ -207,7 +207,8 @@ void add_timestamped_line(LLViewerTextEditor* edit, const LLChat &chat, const LL
{
line = line.substr(chat.mFromName.length());
const LLStyleSP &sourceStyle = LLStyleMap::instance().lookup(chat.mFromID);
edit->appendStyledText(chat.mFromName, false, false, &sourceStyle);
edit->appendStyledText(chat.mFromName, false, prepend_newline, &sourceStyle);
prepend_newline = false;
}
edit->appendColoredText(line, false, prepend_newline, color);
}

View File

@ -39,7 +39,7 @@
#include "llfontgl.h"
#include "llsys.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "v3dmath.h"
#include "lldir.h"
#include "llui.h"

View File

@ -43,7 +43,7 @@
#include "llcombobox.h"
#include "lldrawable.h"
#include "lldrawpoolavatar.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llface.h"
#include "lltextbox.h"
#include "lltoolmgr.h"

View File

@ -1147,7 +1147,7 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes()
{
LLString::format_map_t args;
args["[TEXTURE_NUM]"] = i+1;
args["[TEXTURE_NUM]"] = llformat("%d",i+1);
args["[TEXTURE_SIZE_X]"] = llformat("%d",width);
args["[TEXTURE_SIZE_Y]"] = llformat("%d",height);
gViewerWindow->alertXml("InvalidTerrainSize", args);

View File

@ -81,7 +81,7 @@
#include "llselectmgr.h"
#include "llviewerbuild.h"
#include "lluictrlfactory.h"
#include "llappviewer.h"
#include "llviewernetwork.h"
#include "llassetuploadresponders.h"
@ -656,7 +656,7 @@ LLSD LLFloaterReporter::gatherReport()
mCopyrightWarningSeen = FALSE;
std::ostringstream summary;
if (!LLAppViewer::instance()->isInProductionGrid())
if (!LLViewerLogin::getInstance()->isInProductionGrid())
{
summary << "Preview ";
}
@ -898,7 +898,7 @@ void LLFloaterReporter::takeScreenshot()
mResourceDatap->mAssetInfo.mType);
// store in the image list so it doesn't try to fetch from the server
LLViewerImage* image_in_list = new LLViewerImage(mResourceDatap->mAssetInfo.mUuid, TRUE);
LLPointer<LLViewerImage> image_in_list = new LLViewerImage(mResourceDatap->mAssetInfo.mUuid, TRUE);
image_in_list->createGLTexture(0, raw);
gImageList.addImage(image_in_list);

View File

@ -36,7 +36,7 @@
#include "llfontgl.h"
#include "llsys.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "v3dmath.h"
#include "llmath.h"
#include "lldir.h"

View File

@ -215,7 +215,7 @@ LLFloaterTOS::~LLFloaterTOS()
LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html");
if ( web_browser )
{
web_browser->addObserver( this );
web_browser->remObserver( this );
};
// tell the responder we're not here anymore

View File

@ -871,6 +871,8 @@ void LLFloaterWorldMap::buildLandmarkIDLists()
{
list->selectItemRange(1, -1);
list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
llassert_always(list->getItemCount() == 1) ;
}
mLandmarkItemIDList.reset();

View File

@ -40,7 +40,7 @@
#include "llfocusmgr.h"
#include "llfontgl.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llinventory.h"
#include "llcallbacklist.h"
@ -349,10 +349,10 @@ void LLFolderViewItem::arrangeFromRoot()
// UI. If open is TRUE, then folders are opened up along the way to
// the selection.
void LLFolderViewItem::setSelectionFromRoot(LLFolderViewItem* selection,
BOOL open, /* Flawfinder: ignore */
BOOL openitem,
BOOL take_keyboard_focus)
{
getRoot()->setSelection(selection, open, take_keyboard_focus); /* Flawfinder: ignore */
getRoot()->setSelection(selection, openitem, take_keyboard_focus);
}
// helper function to change the selection from the root.
@ -368,7 +368,7 @@ void LLFolderViewItem::extendSelectionFromRoot(LLFolderViewItem* selection)
getRoot()->extendSelection(selection, NULL, selected_items);
}
EInventorySortGroup LLFolderViewItem::getSortGroup()
EInventorySortGroup LLFolderViewItem::getSortGroup() const
{
return SG_ITEM;
}
@ -442,7 +442,7 @@ void LLFolderViewItem::dirtyFilter()
// means 'deselect' for a leaf item. Do this optimization after
// multiple selection is implemented to make sure it all plays nice
// together.
BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL open, BOOL take_keyboard_focus)
BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus)
{
if( selection == this )
{
@ -548,7 +548,7 @@ void LLFolderViewItem::buildContextMenu(LLMenuGL& menu, U32 flags)
}
}
void LLFolderViewItem::open( void ) /* Flawfinder: ignore */
void LLFolderViewItem::openItem( void )
{
if( mListener )
{
@ -989,9 +989,6 @@ LLFolderViewFolder::LLFolderViewFolder( const LLString& name, LLUIImagePtr icon,
mMostFilteredDescendantGeneration(-1)
{
mType = "(folder)";
//mItems.setInsertBefore( &sort_item_name );
//mFolders.setInsertBefore( &folder_insert_before );
}
// Destroys the object
@ -1000,10 +997,6 @@ LLFolderViewFolder::~LLFolderViewFolder( void )
// The LLView base class takes care of object destruction. make sure that we
// don't have mouse or keyboard focus
gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit()
//mItems.reset();
//mItems.removeAllNodes();
//mFolders.removeAllNodes();
}
// addToFolder() returns TRUE if it succeeds. FALSE otherwise
@ -1048,9 +1041,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
// Add sizes of children
S32 parent_item_height = getRect().getHeight();
folders_t::iterator fit = mFolders.begin();
folders_t::iterator fend = mFolders.end();
for(; fit < fend; ++fit)
for(folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit)
{
LLFolderViewFolder* folderp = (*fit);
if (getRoot()->getDebugFilters())
@ -1076,9 +1067,8 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
folderp->setOrigin( 0, child_top - folderp->getRect().getHeight() );
}
}
items_t::iterator iit = mItems.begin();
items_t::iterator iend = mItems.end();
for(;iit < iend; ++iit)
for(items_t::iterator iit = mItems.begin();
iit != mItems.end(); ++iit)
{
LLFolderViewItem* itemp = (*iit);
if (getRoot()->getDebugFilters())
@ -1354,7 +1344,7 @@ BOOL LLFolderViewFolder::hasFilteredDescendants()
// Passes selection information on to children and record selection
// information if necessary.
BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL open, /* Flawfinder: ignore */
BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem,
BOOL take_keyboard_focus)
{
BOOL rv = FALSE;
@ -1378,7 +1368,7 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL open, /
iter != mFolders.end();)
{
folders_t::iterator fit = iter++;
if((*fit)->setSelection(selection, open, take_keyboard_focus)) /* Flawfinder: ignore */
if((*fit)->setSelection(selection, openitem, take_keyboard_focus))
{
rv = TRUE;
child_selected = TRUE;
@ -1389,14 +1379,14 @@ BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL open, /
iter != mItems.end();)
{
items_t::iterator iit = iter++;
if((*iit)->setSelection(selection, open, take_keyboard_focus)) /* Flawfinder: ignore */
if((*iit)->setSelection(selection, openitem, take_keyboard_focus))
{
rv = TRUE;
child_selected = TRUE;
mNumDescendantsSelected++;
}
}
if(open && child_selected) /* Flawfinder: ignore */
if(openitem && child_selected)
{
setOpenArrangeRecursively(TRUE);
}
@ -1636,11 +1626,9 @@ void LLFolderViewFolder::destroyView()
while (!mFolders.empty())
{
LLFolderViewFolder *folderp = mFolders.back();
folderp->destroyView();
folderp->destroyView(); // removes entry from mFolders
}
mFolders.clear();
deleteAllChildren();
if (mParentFolder)
@ -1711,11 +1699,11 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item )
// This is only called for renaming an object because it won't work for date
void LLFolderViewFolder::resort(LLFolderViewItem* item)
{
std::sort(mItems.begin(), mItems.end(), mSortFunction);
std::sort(mFolders.begin(), mFolders.end(), mSortFunction);
mItems.sort(mSortFunction);
mFolders.sort(mSortFunction);
}
bool LLFolderViewFolder::isTrash()
bool LLFolderViewFolder::isTrash() const
{
if (mAmTrash == LLFolderViewFolder::UNKNOWN)
{
@ -1740,8 +1728,8 @@ void LLFolderViewFolder::sortBy(U32 order)
(*fit)->sortBy(order);
}
std::sort(mFolders.begin(), mFolders.end(), mSortFunction);
std::sort(mItems.begin(), mItems.end(), mSortFunction);
mFolders.sort(mSortFunction);
mItems.sort(mSortFunction);
if (order & LLInventoryFilter::SO_DATE)
{
@ -1776,12 +1764,12 @@ void LLFolderViewFolder::setItemSortOrder(U32 ordering)
(*fit)->setItemSortOrder(ordering);
}
std::sort(mFolders.begin(), mFolders.end(), mSortFunction);
std::sort(mItems.begin(), mItems.end(), mSortFunction);
mFolders.sort(mSortFunction);
mItems.sort(mSortFunction);
}
}
EInventorySortGroup LLFolderViewFolder::getSortGroup()
EInventorySortGroup LLFolderViewFolder::getSortGroup() const
{
if (isTrash())
{
@ -1928,16 +1916,16 @@ void LLFolderViewFolder::toggleOpen()
}
// Force a folder open or closed
void LLFolderViewFolder::setOpen(BOOL open) /* Flawfinder: ignore */
void LLFolderViewFolder::setOpen(BOOL openitem)
{
setOpenArrangeRecursively(open); /* Flawfinder: ignore */
setOpenArrangeRecursively(openitem);
}
void LLFolderViewFolder::setOpenArrangeRecursively(BOOL open, ERecurseType recurse) /* Flawfinder: ignore */
void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse)
{
BOOL was_open = mIsOpen;
mIsOpen = open; /* Flawfinder: ignore */
if(!was_open && open) /* Flawfinder: ignore */
mIsOpen = openitem;
if(!was_open && openitem)
{
if(mListener)
{
@ -1951,12 +1939,12 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL open, ERecurseType recur
iter != mFolders.end();)
{
folders_t::iterator fit = iter++;
(*fit)->setOpenArrangeRecursively(open, RECURSE_DOWN); /* Flawfinder: ignore */
(*fit)->setOpenArrangeRecursively(openitem, RECURSE_DOWN); /* Flawfinder: ignore */
}
}
if (mParentFolder && (recurse == RECURSE_UP || recurse == RECURSE_UP_DOWN))
{
mParentFolder->setOpenArrangeRecursively(open, RECURSE_UP); /* Flawfinder: ignore */
mParentFolder->setOpenArrangeRecursively(openitem, RECURSE_UP);
}
if (was_open != mIsOpen)
@ -1989,7 +1977,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask,
return TRUE;
}
void LLFolderViewFolder::open( void ) /* Flawfinder: ignore */
void LLFolderViewFolder::openItem( void )
{
toggleOpen();
}
@ -2687,10 +2675,10 @@ void LLFolderView::openFolder(const LLString& foldername)
}
}
void LLFolderView::setOpenArrangeRecursively(BOOL open, ERecurseType recurse) /* Flawfinder: ignore */
void LLFolderView::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse)
{
// call base class to do proper recursion
LLFolderViewFolder::setOpenArrangeRecursively(open, recurse); /* Flawfinder: ignore */
LLFolderViewFolder::setOpenArrangeRecursively(openitem, recurse);
// make sure root folder is always open
mIsOpen = TRUE;
}
@ -2866,7 +2854,7 @@ LLFolderViewItem* LLFolderView::getCurSelectedItem( void )
// Record the selected item and pass it down the hierachy.
BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL open, /* Flawfinder: ignore */
BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
BOOL take_keyboard_focus)
{
if( selection == this )
@ -2888,8 +2876,8 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL open, /* Flaw
addToSelectionList(selection);
}
BOOL rv = LLFolderViewFolder::setSelection(selection, open, take_keyboard_focus);
if(open && selection)
BOOL rv = LLFolderViewFolder::setSelection(selection, openitem, take_keyboard_focus);
if(openitem && selection)
{
selection->getParentFolder()->requestArrange();
}
@ -3349,7 +3337,7 @@ void LLFolderView::openSelectedItems( void )
{
if (mSelectedItems.size() == 1)
{
mSelectedItems.front()->open(); /* Flawfinder: ignore */
mSelectedItems.front()->openItem();
}
else
{
@ -3371,7 +3359,7 @@ void LLFolderView::openSelectedItems( void )
LLFloater::setFloaterHost(multi_propertiesp);
else
LLFloater::setFloaterHost(multi_previewp);
(*item_it)->open();
(*item_it)->openItem();
}
LLFloater::setFloaterHost(NULL);
@ -4358,7 +4346,7 @@ bool LLInventorySort::updateSort(U32 order)
return false;
}
bool LLInventorySort::operator()(LLFolderViewItem* a, LLFolderViewItem* b)
bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolderViewItem* const& b)
{
// We sort by name if we aren't sorting by date
// OR if these are folders and we are sorting folders by name.

View File

@ -295,7 +295,7 @@ public:
bool updateSort(U32 order);
U32 getSort() { return mSortOrder; }
bool operator()(LLFolderViewItem* a, LLFolderViewItem* b);
bool operator()(const LLFolderViewItem* const& a, const LLFolderViewItem* const& b);
private:
U32 mSortOrder;
bool mByDate;
@ -361,7 +361,7 @@ protected:
// the specified selected item appropriately for display and use
// in the UI. If open is TRUE, then folders are opened up along
// the way to the selection.
void setSelectionFromRoot(LLFolderViewItem* selection, BOOL open, /* Flawfinder: ignore */
void setSelectionFromRoot(LLFolderViewItem* selection, BOOL openitem,
BOOL take_keyboard_focus = TRUE);
// helper function to change the selection from the root.
@ -390,7 +390,7 @@ public:
enum { ARRANGE = TRUE, DO_NOT_ARRANGE = FALSE };
virtual BOOL addToFolder(LLFolderViewFolder* folder, LLFolderView* root);
virtual EInventorySortGroup getSortGroup();
virtual EInventorySortGroup getSortGroup() const;
// Finds width and height of this object and it's children. Also
// makes sure that this view and it's children are the right size.
@ -409,7 +409,7 @@ public:
// ignore. Returns TRUE if this object was affected. If open is
// TRUE, then folders are opened up along the way to the
// selection.
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open, /* Flawfinder: ignore */
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem,
BOOL take_keyboard_focus);
// This method is used to toggle the selection of an item. If
@ -479,7 +479,7 @@ public:
void rename(const LLString& new_name);
// open
virtual void open( void ); /* Flawfinder: ignore */
virtual void openItem( void );
virtual void preview(void);
// Show children (unfortunate that this is called "open")
@ -544,8 +544,8 @@ public:
} ETrash;
protected:
typedef std::vector<LLFolderViewItem*> items_t;
typedef std::vector<LLFolderViewFolder*> folders_t;
typedef std::list<LLFolderViewItem*> items_t;
typedef std::list<LLFolderViewFolder*> folders_t;
items_t mItems;
folders_t mFolders;
LLInventorySort mSortFunction;
@ -556,7 +556,7 @@ protected:
F32 mTargetHeight;
F32 mAutoOpenCountdown;
time_t mSubtreeCreationDate;
ETrash mAmTrash;
mutable ETrash mAmTrash;
S32 mLastArrangeGeneration;
S32 mLastCalculatedWidth;
S32 mCompletedFilterGeneration;
@ -590,7 +590,7 @@ public:
BOOL needsArrange();
// Returns the sort group (system, trash, folder) for this folder.
virtual EInventorySortGroup getSortGroup();
virtual EInventorySortGroup getSortGroup() const;
virtual void setCompletedFilterGeneration(S32 generation, BOOL recurse_up);
virtual S32 getCompletedFilterGeneration() { return mCompletedFilterGeneration; }
@ -606,8 +606,8 @@ public:
// Passes selection information on to children and record
// selection information if necessary. Returns TRUE if this object
// (or a child) was affected.
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open, /* Flawfinder: ignore */
BOOL take_keyboard_focus);
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem,
BOOL take_keyboard_focus);
// This method is used to change the selection of an item. If
// selection is 'this', then note selection as true. Returns TRUE
@ -660,7 +660,7 @@ public:
virtual void toggleOpen();
// Force a folder open or closed
virtual void setOpen(BOOL open = TRUE); /* Flawfinder: ignore */
virtual void setOpen(BOOL openitem = TRUE);
// Called when a child is refreshed.
// don't rearrange child folder contents unless explicitly requested
@ -670,7 +670,7 @@ public:
// method was written because the list iterators destroy the state
// of other iterations, thus, we can't arrange while iterating
// through the children (such as when setting which is selected.
virtual void setOpenArrangeRecursively(BOOL open, ERecurseType recurse = RECURSE_NO); /* Flawfinder: ignore */
virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse = RECURSE_NO);
// Get the current state of the folder.
virtual BOOL isOpen() { return mIsOpen; }
@ -686,7 +686,7 @@ public:
void applyFunctorRecursively(LLFolderViewFunctor& functor);
virtual void applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor);
virtual void open( void ); /* Flawfinder: ignore */
virtual void openItem( void );
virtual BOOL addItem(LLFolderViewItem* item);
virtual BOOL addFolder( LLFolderViewFolder* folder);
@ -703,7 +703,7 @@ public:
virtual void draw();
time_t getCreationDate() const;
bool isTrash();
bool isTrash() const;
};
@ -752,7 +752,7 @@ public:
void openFolder(const LLString& foldername);
virtual void toggleOpen() {};
virtual void setOpenArrangeRecursively(BOOL open, ERecurseType recurse); /* Flawfinder: ignore */
virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse);
virtual BOOL addFolder( LLFolderViewFolder* folder);
// Finds width and height of this object and it's children. Also
@ -769,7 +769,7 @@ public:
virtual LLFolderViewItem* getCurSelectedItem( void );
// Record the selected item and pass it down the hierachy.
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL open, /* Flawfinder: ignore */
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem,
BOOL take_keyboard_focus);
// This method is used to toggle the selection of an item. Walks

View File

@ -39,7 +39,7 @@
#include "llviewercontrol.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llglheaders.h"
#include "llparcel.h"
#include "llui.h"

View File

@ -33,7 +33,7 @@
#include "llhudeffectlookat.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "message.h"
#include "llagent.h"

View File

@ -34,7 +34,7 @@
#include "llhudeffectpointat.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llagent.h"
#include "lldrawable.h"

View File

@ -34,7 +34,7 @@
#include "llhudicon.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llviewerobject.h"
#include "lldrawable.h"

View File

@ -33,7 +33,7 @@
#include "llhudtext.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llagent.h"
#include "llviewercontrol.h"
@ -308,7 +308,6 @@ void LLHUDText::renderText(BOOL for_select)
}
LLUI::popMatrix();
LLImageGL::unbindTexture(0);
LLGLDepthTest gls_depth(mZCompare ? GL_TRUE : GL_FALSE, GL_FALSE);
@ -375,7 +374,7 @@ void LLHUDText::renderText(BOOL for_select)
// Render label
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin();
segment_iter != mLabelSegments.end(); ++segment_iter )

View File

@ -1488,14 +1488,15 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4
// Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
if (!strcmp(name,SYSTEM_FROM))
{
mHistoryEditor->appendColoredText(name,false,false,color);
mHistoryEditor->appendColoredText(name,false,prepend_newline,color);
}
else
{
// Convert the name to a hotlink and add to message.
const LLStyleSP &source_style = LLStyleMap::instance().lookup(source);
mHistoryEditor->appendStyledText(name, false, false, &source_style);
mHistoryEditor->appendStyledText(name,false,prepend_newline,&source_style);
}
prepend_newline = false;
}
mHistoryEditor->appendColoredText(utf8msg, false, prepend_newline, color);

View File

@ -36,7 +36,7 @@
// Library includes
#include "llcoord.h"
#include "indra_constants.h"
#include "llglimmediate.h"
#include "llrender.h"
// Project includes
#include "llui.h"

View File

@ -36,7 +36,7 @@
#include "llmath.h"
#include "v3math.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llprimitive.h"
#include "llview.h"
#include "llviewerimagelist.h"

View File

@ -36,7 +36,7 @@
// library includes
#include "llmath.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "v4color.h"
#include "llprimitive.h"
#include "llview.h"

View File

@ -38,7 +38,7 @@
#include "v3math.h"
#include "llquaternion.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "v4color.h"
#include "llprimitive.h"

View File

@ -38,7 +38,7 @@
#include "llmaniptranslate.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llagent.h"
#include "llbbox.h"
@ -1535,10 +1535,10 @@ void LLManipTranslate::renderSnapGuides()
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER);
glBindTexture(GL_TEXTURE_2D, sGridTex);
gGL.flush();
gGL.blendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
renderGrid(u,v,tiles,0.9f, 0.9f, 0.9f,a*0.15f);
gGL.flush();
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
{
@ -1649,7 +1649,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
LLGLEnable stencil(GL_STENCIL_TEST);
LLGLDepthTest depth (GL_TRUE, GL_FALSE, GL_ALWAYS);
glStencilFunc(GL_ALWAYS, 0, stencil_mask);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
gGL.setColorMask(false, false);
LLImageGL::unbindTexture(0);
glColor4f(1,1,1,1);
@ -1700,7 +1700,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
LLPipeline::toggleRenderType(LLPipeline::RENDER_TYPE_CLOUDS);
}
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
gGL.setColorMask(true, false);
}
gGL.color4f(1,1,1,1);

View File

@ -38,7 +38,7 @@
#include "llui.h"
#include "llmath.h" // clampf()
#include "llfocusmgr.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llagent.h"
#include "llcallingcard.h"
@ -299,7 +299,7 @@ void LLNetMap::draw()
gGL.end();
// Draw water
glAlphaFunc(GL_GREATER, ABOVE_WATERLINE_ALPHA / 255.f );
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, ABOVE_WATERLINE_ALPHA / 255.f);
{
if (regionp->getLand().getWaterTexture())
{
@ -316,7 +316,7 @@ void LLNetMap::draw()
gGL.end();
}
}
glAlphaFunc(GL_GREATER,0.01f);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}

View File

@ -37,7 +37,7 @@
#include "lloverlaybar.h"
#include "audioengine.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llagent.h"
#include "llbutton.h"
#include "llchatbar.h"

View File

@ -133,83 +133,77 @@ void LLLoginHandler::parse(const LLSD& queryMap)
mFirstName = queryMap["first_name"].asString();
mLastName = queryMap["last_name"].asString();
EGridInfo grid_choice = GRID_INFO_NONE;
if (queryMap["grid"].asString() == "aditi")
{
gGridChoice = GRID_INFO_ADITI;
grid_choice = GRID_INFO_ADITI;
}
else if (queryMap["grid"].asString() == "agni")
{
gGridChoice = GRID_INFO_AGNI;
grid_choice = GRID_INFO_AGNI;
}
else if (queryMap["grid"].asString() == "siva")
{
gGridChoice = GRID_INFO_SIVA;
grid_choice = GRID_INFO_SIVA;
}
else if (queryMap["grid"].asString() == "durga")
{
gGridChoice = GRID_INFO_DURGA;
grid_choice = GRID_INFO_DURGA;
}
else if (queryMap["grid"].asString() == "shakti")
{
gGridChoice = GRID_INFO_SHAKTI;
grid_choice = GRID_INFO_SHAKTI;
}
else if (queryMap["grid"].asString() == "soma")
{
gGridChoice = GRID_INFO_SOMA;
grid_choice = GRID_INFO_SOMA;
}
else if (queryMap["grid"].asString() == "ganga")
{
gGridChoice = GRID_INFO_GANGA;
grid_choice = GRID_INFO_GANGA;
}
else if (queryMap["grid"].asString() == "vaak")
{
gGridChoice = GRID_INFO_VAAK;
grid_choice = GRID_INFO_VAAK;
}
else if (queryMap["grid"].asString() == "uma")
{
gGridChoice = GRID_INFO_UMA;
grid_choice = GRID_INFO_UMA;
}
else if (queryMap["grid"].asString() == "mohini")
{
gGridChoice = GRID_INFO_MOHINI;
grid_choice = GRID_INFO_MOHINI;
}
else if (queryMap["grid"].asString() == "yami")
{
gGridChoice = GRID_INFO_YAMI;
grid_choice = GRID_INFO_YAMI;
}
else if (queryMap["grid"].asString() == "nandi")
{
gGridChoice = GRID_INFO_NANDI;
grid_choice = GRID_INFO_NANDI;
}
else if (queryMap["grid"].asString() == "mitra")
{
gGridChoice = GRID_INFO_MITRA;
grid_choice = GRID_INFO_MITRA;
}
else if (queryMap["grid"].asString() == "radha")
{
gGridChoice = GRID_INFO_RADHA;
grid_choice = GRID_INFO_RADHA;
}
else if (queryMap["grid"].asString() == "ravi")
{
gGridChoice = GRID_INFO_RAVI;
grid_choice = GRID_INFO_RAVI;
}
else if (queryMap["grid"].asString() == "aruna")
{
gGridChoice = GRID_INFO_ARUNA;
grid_choice = GRID_INFO_ARUNA;
}
#if !LL_RELEASE_FOR_DOWNLOAD
if (gGridChoice > GRID_INFO_NONE && gGridChoice < GRID_INFO_LOCAL)
if(grid_choice != GRID_INFO_NONE)
{
gSavedSettings.setS32("ServerChoice", gGridChoice);
LLViewerLogin::getInstance()->setGridChoice(grid_choice);
}
#endif
if (LLAppViewer::instance()->getLoginURIs().size() == 0)
{
gGridName = gGridInfo[gGridChoice].mName; /* Flawfinder: ignore */
LLAppViewer::instance()->resetURIs();
}
LLString startLocation = queryMap["location"].asString();
if (startLocation == "specify")
@ -296,7 +290,15 @@ class LLIamHereLogin : public LLHTTPClient::Responder
{
mParent = parentIn;
};
// We don't actually expect LLSD back, so need to override completedRaw
virtual void completedRaw(U32 status, const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer)
{
completed(status, reason, LLSD()); // will call result() or error()
}
virtual void result( const LLSD& content )
{
if ( mParent )
@ -794,7 +796,7 @@ BOOL LLPanelLogin::getServer(LLString &server, S32 &domain_name)
if ((S32)GRID_INFO_OTHER == domain_name)
{
server = gGridName;
server = LLViewerLogin::getInstance()->getGridLabel();
}
}
else
@ -942,24 +944,16 @@ void LLPanelLogin::loadLoginPage()
LLString grid;
S32 grid_index;
getServer( grid, grid_index );
if( grid_index != (S32)GRID_INFO_OTHER )
{
grid = gGridInfo[grid_index].mLabel;
}
if(gGridChoice != (EGridInfo)grid_index)
gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
if (!grid.empty())
{
LLAppViewer::instance()->resetURIs();
gGridChoice = (EGridInfo)grid_index;
gSavedSettings.setString("GridChoice", gGridInfo[gGridChoice].mLabel);
gViewerWindow->setMenuBackgroundColor(false,
!LLAppViewer::instance()->isInProductionGrid());
gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
char* curl_grid = curl_escape(grid.c_str(), 0);
oStr << "&grid=" << curl_grid;
curl_free(curl_grid);
}
char* curl_grid = curl_escape(grid.c_str(), 0);
oStr << "&grid=" << curl_grid;
curl_free(curl_grid);
#if USE_VIEWER_AUTH
LLURLSimString::sInstance.parse();
@ -1087,15 +1081,6 @@ void LLPanelLogin::onClickConnect(void *)
if (!first.empty() && !last.empty())
{
// has both first and last name typed
// store off custom server entry, if currently selected
LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
S32 selected_server = combo->getValue();
if (selected_server == GRID_INFO_NONE)
{
LLString custom_server = combo->getValue().asString();
gSavedSettings.setString("CustomServer", custom_server);
}
sInstance->mCallback(0, sInstance->mCallbackData);
}
else
@ -1180,6 +1165,26 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
// static
void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
{
// The user twiddled with the grid choice ui.
// apply the selection to the grid setting.
LLString grid;
S32 grid_index;
getServer( grid, grid_index );
// This new seelction will override preset uris
// from the command line.
LLViewerLogin* vl = LLViewerLogin::getInstance();
vl->resetURIs();
if(grid_index != GRID_INFO_OTHER)
{
vl->setGridChoice((EGridInfo)grid_index);
grid = vl->getGridLabel();
}
else
{
vl->setGridChoice(grid);
}
// grid changed so show new splash screen (possibly)
loadLoginPage();
}

View File

@ -36,7 +36,7 @@
#include "indra_constants.h"
#include "llmath.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llui.h"
#include "llfontgl.h"
#include "llimagegl.h"

View File

@ -39,7 +39,7 @@
#include "lldbstrings.h"
#include "lleconomy.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llpermissions.h"
#include "llpermissionsflags.h"
#include "llundo.h"
@ -1038,19 +1038,21 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount())
{
LLViewerObject* root = getSelectedParentObject(mSelectedObjects->getFirstObject());
//LLViewerObject* root = getSelectedParentObject(mSelectedObjects->getFirstObject());
LLBBox bbox = mSavedSelectionBBox;
mGridOrigin = mSavedSelectionBBox.getCenterAgent();
mGridScale = mSavedSelectionBBox.getExtentLocal() * 0.5f;
if(mSelectedObjects->getObjectCount() < 2 || !root || root->mDrawable.isNull())
// DEV-12570 Just taking the saved selection box rotation prevents
// wild rotations of linked sets while in local grid mode
//if(mSelectedObjects->getObjectCount() < 2 || !root || root->mDrawable.isNull())
{
mGridRotation = mSavedSelectionBBox.getRotation();
}
else //set to the root object
/*else //set to the root object
{
mGridRotation = root->getRenderRotation();
}
}*/
}
else if (mGridMode == GRID_MODE_REF_OBJECT && first_grid_object && first_grid_object->mDrawable.notNull())
{
@ -4806,7 +4808,7 @@ void LLSelectMgr::updateSilhouettes()
objectp->clearChanged(LLXform::MOVED | LLXform::SILHOUETTE);
}
//glAlphaFunc(GL_GREATER, 0.01f);
//gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
void LLSelectMgr::renderSilhouettes(BOOL for_hud)
@ -4818,7 +4820,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
LLViewerImage::bindTexture(mSilhouetteImagep);
LLGLSPipelineSelection gls_select;
glAlphaFunc(GL_GREATER, 0.0f);
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f);
LLGLEnable blend(GL_BLEND);
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
@ -4846,11 +4848,21 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
if (mSelectedObjects->getNumNodes())
{
LLUUID inspect_item_id = LLFloaterInspect::getSelectedUUID();
for (S32 pass = 0; pass < 2; pass++)
{
LLObjectSelection::iterator end_ = mSelectedObjects->end();
S32 num_nodes = mSelectedObjects->getNumNodes() ;
LLObjectSelection::iterator prev_iter = mSelectedObjects->end();
for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
iter != mSelectedObjects->end(); iter++)
{
llassert_always(end_ == mSelectedObjects->end()) ;//mSelectedObjects should not grow
llassert_always(prev_iter != iter) ; //iter should move
llassert_always(num_nodes > 0) ; //iter should not circle inside mSelectedObjects.
num_nodes-- ;
prev_iter = iter ;
LLSelectNode* node = *iter;
LLViewerObject* objectp = node->getObject();
if (!objectp)
@ -4924,7 +4936,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
}
mSilhouetteImagep->unbindTexture(0, GL_TEXTURE_2D);
glAlphaFunc(GL_GREATER, 0.01f);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
void LLSelectMgr::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point)
@ -5289,7 +5301,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible())
{
gGL.flush();
gGL.blendFunc(GL_SRC_COLOR, GL_ONE);
gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE);
LLGLEnable fog(GL_FOG);
glFogi(GL_FOG_MODE, GL_LINEAR);
float d = (LLViewerCamera::getInstance()->getPointOfInterest()-LLViewerCamera::getInstance()->getOrigin()).magVec();
@ -5299,7 +5311,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
glFogfv(GL_FOG_COLOR, fogCol.mV);
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
glAlphaFunc(GL_GREATER, 0.01f);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
gGL.begin(LLVertexBuffer::LINES);
{
S32 i = 0;
@ -5320,7 +5332,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
}
gGL.flush();
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gGL.begin(LLVertexBuffer::TRIANGLES);
{
S32 i = 0;

View File

@ -43,7 +43,7 @@
#include "llviewerregion.h"
#include "llcamera.h"
#include "pipeline.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "lloctree.h"
const F32 SG_OCCLUSION_FUDGE = 1.01f;
@ -60,6 +60,7 @@ const F32 SG_OCCLUSION_FUDGE = 1.01f;
static U32 sZombieGroups = 0;
U32 LLSpatialGroup::sNodeCount = 0;
BOOL LLSpatialGroup::sNoDelete = FALSE;
static F32 sLastMaxTexPriority = 1.f;
static F32 sCurMaxTexPriority = 1.f;
@ -295,6 +296,11 @@ S32 LLSphereAABB(const LLVector3& center, const LLVector3& size, const LLVector3
LLSpatialGroup::~LLSpatialGroup()
{
if (sNoDelete)
{
llerrs << "Illegal deletion of LLSpatialGroup!" << llendl;
}
if (isState(DEAD))
{
sZombieGroups--;
@ -2006,7 +2012,7 @@ void renderOctree(LLSpatialGroup* group)
//render solid object bounding box, color
//coded by buffer usage and activity
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
LLVector4 col;
if (group->mBuilt > 0.f)
{
@ -2094,7 +2100,7 @@ void renderOctree(LLSpatialGroup* group)
drawBox(group->mObjectBounds[0], group->mObjectBounds[1]*1.01f+LLVector3(0.001f, 0.001f, 0.001f));
glDepthMask(GL_TRUE);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (group->mBuilt <= 0.f)
{
@ -2122,7 +2128,7 @@ void renderOctree(LLSpatialGroup* group)
void renderVisibility(LLSpatialGroup* group, LLCamera* camera)
{
LLGLEnable blend(GL_BLEND);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
LLGLEnable cull(GL_CULL_FACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@ -2498,7 +2504,7 @@ void LLSpatialPartition::renderDebug()
LLGLDisable cullface(GL_CULL_FACE);
LLGLEnable blend(GL_BLEND);
gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
LLImageGL::unbindTexture(0);
gPipeline.disableLights();
@ -2619,7 +2625,10 @@ LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
LLDrawInfo::~LLDrawInfo()
{
if (LLSpatialGroup::sNoDelete)
{
llerrs << "LLDrawInfo deleted illegally!" << llendl;
}
}
LLVertexBuffer* LLGeometryManager::createVertexBuffer(U32 type_mask, U32 usage)
@ -2813,7 +2822,16 @@ void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info)
}
void LLCullResult::assertDrawMapsEmpty()
{
for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
{
if (mRenderMapSize[i] != 0)
{
llerrs << "Stale LLDrawInfo's in LLCullResult!" << llendl;
}
}
}

View File

@ -127,6 +127,7 @@ class LLSpatialGroup : public LLOctreeListener<LLDrawable>
friend class LLSpatialPartition;
public:
static U32 sNodeCount;
static BOOL sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE
typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t;
typedef std::set<LLPointer<LLSpatialGroup> > sg_set_t;
@ -421,7 +422,7 @@ public:
void pushDrawable(LLDrawable* drawable);
void pushBridge(LLSpatialBridge* bridge);
void pushDrawInfo(U32 type, LLDrawInfo* draw_info);
U32 getVisibleGroupsSize() { return mVisibleGroupsSize; }
U32 getAlphaGroupsSize() { return mAlphaGroupsSize; }
U32 getDrawableGroupsSize() { return mDrawableGroupsSize; }
@ -429,6 +430,8 @@ public:
U32 getVisibleBridgeSize() { return mVisibleBridgeSize; }
U32 getRenderMapSize(U32 type) { return mRenderMapSize[type]; }
void assertDrawMapsEmpty();
private:
U32 mVisibleGroupsSize;
U32 mAlphaGroupsSize;

View File

@ -820,22 +820,28 @@ BOOL idle_startup()
LLString server_label;
S32 domain_name_index;
BOOL user_picked_server = LLPanelLogin::getServer( server_label, domain_name_index );
gGridChoice = (EGridInfo) domain_name_index;
gSavedSettings.setS32("ServerChoice", gGridChoice);
if (gGridChoice == GRID_INFO_OTHER)
if((EGridInfo)domain_name_index == GRID_INFO_OTHER)
{
gGridName = server_label;/* Flawfinder: ignore */
// Since the grid chosen was an 'other', set the choice by string.
LLViewerLogin::getInstance()->setGridChoice(server_label);
}
else
{
// Set the choice according to index.
LLViewerLogin::getInstance()->setGridChoice((EGridInfo)domain_name_index);
}
if ( user_picked_server )
{ // User picked a grid from the popup, so clear the stored urls and they will be re-generated from gGridChoice
{ // User picked a grid from the popup, so clear the
// stored uris and they will be re-generated from the GridChoice
sAuthUris.clear();
LLAppViewer::instance()->resetURIs();
LLViewerLogin::getInstance()->resetURIs();
}
LLString location;
LLPanelLogin::getLocation( location );
LLURLSimString::setString( location );
// END TODO
LLPanelLogin::close();
}
@ -915,7 +921,7 @@ BOOL idle_startup()
if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
{
//#define LL_MINIMIAL_REQUESTED_OPTIONS
gDebugInfo["GridName"] = gGridInfo[gGridChoice].mLabel;
gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
// *Note: this is where gUserAuth used to be created.
requested_options.clear();
@ -949,7 +955,8 @@ BOOL idle_startup()
gSavedSettings.setBOOL("UseDebugMenus", TRUE);
requested_options.push_back("god-connect");
}
const std::vector<std::string>& uris = LLAppViewer::instance()->getLoginURIs();
std::vector<std::string> uris;
LLViewerLogin::getInstance()->getLoginURIs(uris);
std::vector<std::string>::const_iterator iter, end;
for (iter = uris.begin(), end = uris.end(); iter != end; ++iter)
{
@ -1222,7 +1229,7 @@ BOOL idle_startup()
sAuthUriNum++;
std::ostringstream s;
LLString::format_map_t args;
args["[NUMBER]"] = sAuthUriNum + 1;
args["[NUMBER]"] = llformat("%d", sAuthUriNum + 1);
auth_desc = LLTrans::getString("LoginAttempt", args).c_str();
LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE );
return do_normal_idle;
@ -1276,7 +1283,6 @@ BOOL idle_startup()
save_password_to_disk(NULL);
}
gSavedSettings.setBOOL("RememberPassword", remember_password);
gSavedSettings.setBOOL("LoginLastLocation", gSavedSettings.getBOOL("LoginLastLocation"));
text = LLUserAuth::getInstance()->getResponse("agent_access");
if(text && (text[0] == 'M'))
@ -2331,7 +2337,7 @@ BOOL idle_startup()
gDebugView->mFastTimerView->setVisible(TRUE);
#endif
LLAppViewer::instance()->startMainloopTimeout();
LLAppViewer::instance()->initMainloopTimeout("Mainloop Init");
return do_normal_idle;
}
@ -2362,33 +2368,13 @@ void login_show()
LL_DEBUGS("AppInit") << "Setting Servers" << LL_ENDL;
if( GRID_INFO_OTHER == gGridChoice )
{
LLPanelLogin::addServer( gGridName.c_str(), GRID_INFO_OTHER );
}
else
{
LLPanelLogin::addServer( gGridInfo[gGridChoice].mLabel, gGridChoice );
}
LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel().c_str(), LLViewerLogin::getInstance()->getGridChoice());
// Arg! We hate loops!
LLPanelLogin::addServer( gGridInfo[GRID_INFO_ADITI].mLabel, GRID_INFO_ADITI );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_AGNI].mLabel, GRID_INFO_AGNI );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_ARUNA].mLabel, GRID_INFO_ARUNA );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_DURGA].mLabel, GRID_INFO_DURGA );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_GANGA].mLabel, GRID_INFO_GANGA );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_MITRA].mLabel, GRID_INFO_MITRA );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_MOHINI].mLabel, GRID_INFO_MOHINI );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_NANDI].mLabel, GRID_INFO_NANDI );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_RADHA].mLabel, GRID_INFO_RADHA );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_RAVI].mLabel, GRID_INFO_RAVI );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_SIVA].mLabel, GRID_INFO_SIVA );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_SHAKTI].mLabel, GRID_INFO_SHAKTI );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_SOMA].mLabel, GRID_INFO_SOMA );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_UMA].mLabel, GRID_INFO_UMA );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_VAAK].mLabel, GRID_INFO_VAAK );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_YAMI].mLabel, GRID_INFO_YAMI );
LLPanelLogin::addServer( gGridInfo[GRID_INFO_LOCAL].mLabel, GRID_INFO_LOCAL );
LLViewerLogin* vl = LLViewerLogin::getInstance();
for(int grid_index = GRID_INFO_ADITI; grid_index < GRID_INFO_OTHER; ++grid_index)
{
LLPanelLogin::addServer(vl->getKnownGridLabel((EGridInfo)grid_index).c_str(), grid_index);
}
}
// Callback for when login screen is closed. Option 0 = connect, option 1 = quit.
@ -2705,7 +2691,7 @@ void update_dialog_callback(S32 option, void *userdata)
#endif
// *TODO change userserver to be grid on both viewer and sim, since
// userserver no longer exists.
query_map["userserver"] = gGridName;
query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel();
query_map["channel"] = gSavedSettings.getString("VersionChannelName");
// *TODO constantize this guy
LLURI update_url = LLURI::buildHTTP("secondlife.com", 80, "update.php", query_map);
@ -2798,9 +2784,6 @@ void update_dialog_callback(S32 option, void *userdata)
LL_DEBUGS("AppInit") << "Calling updater: " << update_exe_path << LL_ENDL;
// *REMOVE:Mani The following call is handled through ~LLAppViewer.
// remove_marker_file(); // In case updater fails
// Run the auto-updater.
system(update_exe_path.c_str()); /* Flawfinder: ignore */
@ -2808,10 +2791,6 @@ void update_dialog_callback(S32 option, void *userdata)
OSMessageBox("Automatic updating is not yet implemented for Linux.\n"
"Please download the latest version from www.secondlife.com.",
NULL, OSMB_OK);
// *REMOVE:Mani The following call is handled through ~LLAppViewer.
// remove_marker_file();
#endif
LLAppViewer::instance()->forceQuit();
}

View File

@ -15,7 +15,7 @@
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* it is applied to this Source Code. View the full textof the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*

View File

@ -207,10 +207,11 @@ LLVector2 LLSurfacePatch::getTexCoords(const U32 x, const U32 y) const
void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3 *vertex, LLVector3 *normal,
LLVector2 *tex0, LLVector2 *tex1)
{
if (!mSurfacep || !mSurfacep->getRegion())
if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge())
{
return; // failsafe
}
llassert_always(vertex && normal && tex0 && tex1);
U32 surface_stride = mSurfacep->getGridsPerEdge();
U32 point_offset = x + y*surface_stride;

View File

@ -52,7 +52,7 @@
#include "llxmltree.h"
#include "pipeline.h"
#include "v4coloru.h"
#include "llglimmediate.h"
#include "llrender.h"
//#include "../tools/imdebug/imdebug.h"
@ -239,6 +239,9 @@ BOOL LLTexLayerSetBuffer::render()
{
U8* baked_bump_data = NULL;
// Default color mask for tex layer render
gGL.setColorMask(true, true);
// do we need to upload, and do we have sufficient data to create an uploadable composite?
// When do we upload the texture if gAgent.mNumPendingQueries is non-zero?
BOOL upload_now = (gAgent.mNumPendingQueries == 0 && mNeedsUpload && mTexLayerSet->isLocalTextureDataFinal());
@ -292,8 +295,8 @@ BOOL LLTexLayerSetBuffer::render()
}
// reset GL state
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
gGL.setColorMask(true, true);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
// we have valid texture data now
mInitialized = TRUE;
@ -756,6 +759,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
LLGLSUIDefault gls_ui;
LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE);
gGL.setColorMask(true, true);
// composite color layers
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
@ -774,8 +778,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
LLGLSNoAlphaTest gls_no_alpha_test;
gGL.flush();
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE );
gGL.blendFunc( GL_ONE, GL_ZERO );
gGL.setColorMask(false, true);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
{
LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticAlphaFileName, TRUE );
@ -793,8 +797,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
gGL.flush();
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
gGL.setColorMask(true, true);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
else
if( getInfo()->mClearAlpha )
@ -803,12 +807,12 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
LLGLSNoTextureNoAlphaTest gls_no_alpha;
gGL.color4f( 0.f, 0.f, 0.f, 1.f );
gGL.flush();
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE );
gGL.setColorMask(false, true);
gl_rect_2d_simple( width, height );
gGL.flush();
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
gGL.setColorMask(true, true);
}
stop_glerror();
@ -836,11 +840,11 @@ BOOL LLTexLayerSet::renderBump( S32 x, S32 y, S32 width, S32 height )
// Set the alpha channel to one (clean up after previous blending)
LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha;
gGL.color4f( 0.f, 0.f, 0.f, 1.f );
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE );
gGL.setColorMask(false, true);
gl_rect_2d_simple( width, height );
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
gGL.setColorMask(true, true);
stop_glerror();
return success;
@ -1330,7 +1334,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height )
renderAlphaMasks( x, y, width, height, &net_color );
alpha_mask_specified = TRUE;
gGL.flush();
gGL.blendFunc( GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA );
gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ONE_MINUS_DEST_ALPHA);
}
gGL.color4fv( net_color.mV);
@ -1338,7 +1342,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height )
if( getInfo()->mWriteAllChannels )
{
gGL.flush();
gGL.blendFunc( GL_ONE, GL_ZERO );
gGL.setSceneBlendType(LLRender::BT_REPLACE);
}
if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly )
@ -1401,7 +1405,7 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height )
{
// Restore standard blend func value
gGL.flush();
gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
gGL.setSceneBlendType(LLRender::BT_ALPHA);
stop_glerror();
}
@ -1506,7 +1510,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
llassert( !mParamAlphaList.empty() );
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE );
gGL.setColorMask(false, true);
alpha_list_t::iterator iter = mParamAlphaList.begin();
LLTexLayerParamAlpha* first_param = *iter;
@ -1518,7 +1522,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
// Clear the alpha
gGL.flush();
gGL.blendFunc( GL_ONE, GL_ZERO );
gGL.setSceneBlendType(LLRender::BT_REPLACE);
gGL.color4f( 0.f, 0.f, 0.f, 0.f );
gl_rect_2d_simple( width, height );
@ -1536,7 +1540,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
// Approximates a min() function
gGL.flush();
gGL.blendFunc( GL_DST_ALPHA, GL_ZERO );
gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO);
// Accumulate the alpha component of the texture
if( getInfo()->mLocalTexture != -1 )
@ -1601,7 +1605,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
LLGLSUIDefault gls_ui;
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
gGL.setColorMask(true, true);
if (!mMorphMasksValid && !mMaskedMorphs.empty())
{
@ -1963,11 +1967,11 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height )
gGL.flush();
if( getInfo()->mMultiplyBlend )
{
gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); // Multiplication: approximates a min() function
gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ZERO); // Multiplication: approximates a min() function
}
else
{
gGL.blendFunc( GL_ONE, GL_ONE ); // Addition: approximates a max() function
gGL.setSceneBlendType(LLRender::BT_ADD); // Addition: approximates a max() function
}
if( !getInfo()->mStaticImageFileName.empty() && !mStaticImageInvalid)

View File

@ -39,6 +39,9 @@
#include "lllfsthread.h"
#include "llviewercontrol.h"
// Included to allow LLTextureCache::purgeTextures() to pause watchdog timeout
#include "llappviewer.h"
#define USE_LFS_READ 0
#define USE_LFS_WRITE 0
@ -1153,6 +1156,9 @@ void LLTextureCache::purgeTextures(bool validate)
return;
}
// *FIX:Mani - watchdog off.
LLAppViewer::instance()->pauseMainloopTimeout();
LLMutexLock lock(&mHeaderMutex);
S32 filesize = ll_apr_file_size(mTexturesDirEntriesFileName, NULL);
@ -1273,6 +1279,9 @@ void LLTextureCache::purgeTextures(bool validate)
llassert(mTexturesSizeTotal == total_size);
delete[] entries;
// *FIX:Mani - watchdog back on.
LLAppViewer::instance()->resumeMainloopTimeout();
LL_INFOS("TextureCache") << "TEXTURE CACHE:"
<< " PURGED: " << purge_count

View File

@ -34,7 +34,7 @@
#include "lltexturectrl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llagent.h"
#include "llviewerimagelist.h"
#include "llcheckboxctrl.h"

View File

@ -1341,13 +1341,13 @@ bool LLTextureFetch::createRequest(const LLString& filename, const LLUUID& id, c
}
S32 desired_size;
if ((desired_discard == 0) && worker && worker->mFileSize)
if (desired_discard == 0)
{
// if we want the entire image, and we know its size, then get it all
// (calcDataSizeJ2C() below makes assumptions about how the image
// was compressed - this code ensures that when we request the entire image,
// we really do get it.)
desired_size = worker->mFileSize;
desired_size = MAX_IMAGE_DATA_SIZE;
}
else if (w*h*c > 0)
{
@ -1358,17 +1358,11 @@ bool LLTextureFetch::createRequest(const LLString& filename, const LLUUID& id, c
}
else
{
if (desired_discard == 0)
{
// If we want all of the image, request the maximum possible data
desired_size = MAX_IMAGE_DATA_SIZE;
}
else
{
desired_size = FIRST_PACKET_SIZE;
desired_discard = MAX_DISCARD_LEVEL;
}
desired_size = FIRST_PACKET_SIZE;
desired_discard = MAX_DISCARD_LEVEL;
}
if (worker)
{
if (worker->wasAborted())

View File

@ -40,7 +40,7 @@
#include "lllfsthread.h"
#include "llui.h"
#include "llimageworker.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "llhoverview.h"
#include "llselectmgr.h"

View File

@ -35,7 +35,7 @@
#include "lltoolselectland.h"
#include "llgl.h"
#include "llglimmediate.h"
#include "llrender.h"
#include "message.h"
@ -94,7 +94,6 @@ LLToolBrushLand::LLToolBrushLand()
mMouseX( 0 ),
mMouseY(0),
mGotHover(FALSE),
mLastShowParcelOwners(FALSE),
mBrushSelected(FALSE)
{
mBrushIndex = gSavedSettings.getS32("RadioLandBrushSize");
@ -104,7 +103,8 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
MASK mask)
{
S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
mLastAffectedRegions.clear();
determineAffectedRegions(mLastAffectedRegions, pos_global);
for(region_list_t::iterator iter = mLastAffectedRegions.begin();
iter != mLastAffectedRegions.end(); ++iter)
@ -418,8 +418,6 @@ void LLToolBrushLand::handleSelect()
gFloaterTools->setStatusText("modifyland");
// if (!mBrushSelected)
{
mLastShowParcelOwners = gSavedSettings.getBOOL("ShowParcelOwners");
gSavedSettings.setBOOL("ShowParcelOwners", mLastShowParcelOwners);
mBrushSelected = TRUE;
}
}
@ -431,8 +429,6 @@ void LLToolBrushLand::handleDeselect()
{
gEditMenuHandler = NULL;
}
mLastShowParcelOwners = gSavedSettings.getBOOL("ShowParcelOwners");
gSavedSettings.setBOOL("ShowParcelOwners", mLastShowParcelOwners);
LLViewerParcelMgr::getInstance()->setSelectionVisible(TRUE);
mBrushSelected = FALSE;
}

Some files were not shown because too many files have changed in this diff Show More