Merge remote-tracking branch 'singu/master'

This commit is contained in:
Aleric Inglewood
2013-12-19 23:03:22 +01:00
52 changed files with 2655 additions and 1128 deletions

View File

@@ -127,7 +127,7 @@ if (LINUX)
-pthread
)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_FORTIFY_SOURCE=2 ")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 ")
# Don't catch SIGCHLD in our base application class for the viewer
# some of our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh!

View File

@@ -484,7 +484,9 @@ LLJoint* LLKeyframeMotion::getJoint(U32 index)
index = (S32)mJointStates.size() - 1;
// </edit>
LLJoint* joint = mJointStates[index]->getJoint();
llassert_always (joint);
if(!joint) {
LL_WARNS_ONCE("Animation") << "Missing joint index:"<< index << " ID:" << mID << " Name:" << mName << LL_ENDL;
}
return joint;
}

View File

@@ -554,7 +554,7 @@ bool LLApp::isQuitting()
// static
bool LLApp::isExiting()
{
return isQuitting() || isError();
return isQuitting() || isError() || isStopped();
}
void LLApp::disableCrashlogger()

View File

@@ -40,7 +40,9 @@ namespace LLInitParam
{
const U8* my_addr = reinterpret_cast<const U8*>(this);
const U8* block_addr = reinterpret_cast<const U8*>(enclosing_block);
mEnclosingBlockOffset = 0x7FFFffff & (U32)(my_addr - block_addr);
U32 enclosing_block_offset = 0x7FFFffff & (U32)(my_addr - block_addr);
mEnclosingBlockOffsetLow = enclosing_block_offset & 0x0000ffff;
mEnclosingBlockOffsetHigh = (enclosing_block_offset & 0x007f0000) >> 16;
}
//
@@ -112,6 +114,35 @@ namespace LLInitParam
std::copy(src_block_data.mAllParams.begin(), src_block_data.mAllParams.end(), std::back_inserter(mAllParams));
}
void BlockDescriptor::addParam(const ParamDescriptorPtr in_param, const char* char_name)
{
// create a copy of the param descriptor in mAllParams
// so other data structures can store a pointer to it
mAllParams.push_back(in_param);
ParamDescriptorPtr param(mAllParams.back());
std::string name(char_name);
if ((size_t)param->mParamHandle > mMaxParamOffset)
{
llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl;
}
if (name.empty())
{
mUnnamedParams.push_back(param);
}
else
{
// don't use insert, since we want to overwrite existing entries
mNamedParams[name] = param;
}
if (param->mValidationFunc)
{
mValidationList.push_back(std::make_pair(param->mParamHandle, param->mValidationFunc));
}
}
BlockDescriptor::BlockDescriptor()
: mMaxParamOffset(0),
mInitializationState(UNINITIALIZED),
@@ -150,7 +181,8 @@ namespace LLInitParam
bool BaseBlock::submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent)
{
if (!deserializeBlock(p, std::make_pair(name_stack.begin(), name_stack.end()), true))
Parser::name_stack_range_t range = std::make_pair(name_stack.begin(), name_stack.end());
if (!deserializeBlock(p, range, true))
{
if (!silent)
{
@@ -196,12 +228,7 @@ namespace LLInitParam
if (serialize_func)
{
const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL;
// each param descriptor remembers its serial number
// so we can inspect the same param under different names
// and see that it has the same number
name_stack.push_back(std::make_pair("", true));
serialize_func(*param, parser, name_stack, diff_param);
name_stack.pop_back();
}
}
@@ -295,7 +322,7 @@ namespace LLInitParam
return true;
}
bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool ignored)
bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack_range, bool ignored)
{
BlockDescriptor& block_data = mostDerivedBlockDescriptor();
bool names_left = name_stack_range.first != name_stack_range.second;
@@ -308,15 +335,12 @@ namespace LLInitParam
{
const std::string& top_name = name_stack_range.first->first;
ParamDescriptor::deserialize_func_t deserialize_func = NULL;
Param* paramp = NULL;
BlockDescriptor::param_map_t::iterator found_it = block_data.mNamedParams.find(top_name);
if (found_it != block_data.mNamedParams.end())
{
// find pointer to member parameter from offset table
paramp = getParamFromHandle(found_it->second->mParamHandle);
deserialize_func = found_it->second->mDeserializeFunc;
Param* paramp = getParamFromHandle(found_it->second->mParamHandle);
ParamDescriptor::deserialize_func_t deserialize_func = found_it->second->mDeserializeFunc;
Parser::name_stack_range_t new_name_stack(name_stack_range.first, name_stack_range.second);
++new_name_stack.first;
@@ -358,36 +382,6 @@ namespace LLInitParam
return false;
}
//static
void BaseBlock::addParam(BlockDescriptor& block_data, const ParamDescriptorPtr in_param, const char* char_name)
{
// create a copy of the param descriptor in mAllParams
// so other data structures can store a pointer to it
block_data.mAllParams.push_back(in_param);
ParamDescriptorPtr param(block_data.mAllParams.back());
std::string name(char_name);
if ((size_t)param->mParamHandle > block_data.mMaxParamOffset)
{
llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl;
}
if (name.empty())
{
block_data.mUnnamedParams.push_back(param);
}
else
{
// don't use insert, since we want to overwrite existing entries
block_data.mNamedParams[name] = param;
}
if (param->mValidationFunc)
{
block_data.mValidationList.push_back(std::make_pair(param->mParamHandle, param->mValidationFunc));
}
}
void BaseBlock::addSynonym(Param& param, const std::string& synonym)
{
BlockDescriptor& block_data = mostDerivedBlockDescriptor();
@@ -460,7 +454,7 @@ namespace LLInitParam
if (merge_func)
{
Param* paramp = getParamFromHandle((*it)->mParamHandle);
llassert(paramp->mEnclosingBlockOffset == (*it)->mParamHandle);
llassert(paramp->getEnclosingBlockOffset() == (*it)->mParamHandle);
some_param_changed |= merge_func(*paramp, *other_paramp, overwrite);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -223,10 +223,14 @@ LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser:
{
bool new_traversal = it->second;
LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first];
if (child_sd->isArray())
LLSD* child_sd;
if (it->first.empty())
{
child_sd = sd_to_write;
if (child_sd->isUndefined())
{
*child_sd = LLSD::emptyArray();
}
if (new_traversal)
{
// write to new element at end
@@ -240,22 +244,7 @@ LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser:
}
else
{
if (new_traversal
&& child_sd->isDefined()
&& !child_sd->isArray())
{
// copy child contents into first element of an array
LLSD new_array = LLSD::emptyArray();
new_array.append(*child_sd);
// assign array to slot that previously held the single value
*child_sd = new_array;
// return next element in that array
sd_to_write = &((*child_sd)[1]);
}
else
{
sd_to_write = child_sd;
}
sd_to_write = &(*sd_to_write)[it->first];
}
it->second = false;
}
@@ -283,8 +272,9 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
it != sd.endArray();
++it)
{
stack.back().second = true;
stack.push_back(make_pair(std::string(), true));
readSDValues(cb, *it, stack);
stack.pop_back();
}
}
else if (sd.isUndefined())
@@ -313,8 +303,14 @@ namespace LLInitParam
{
// LLSD specialization
// block param interface
bool ParamValue<LLSD, TypeValues<LLSD>, false>::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name)
bool ParamValue<LLSD, NOT_BLOCK>::deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack, bool new_name)
{
if (name_stack.first == name_stack.second
&& p.readValue<LLSD>(mValue))
{
return true;
}
LLSD& sd = LLParamSDParserUtilities::getSDWriteNode(mValue, name_stack);
LLSD::String string;
@@ -328,15 +324,18 @@ namespace LLInitParam
}
//static
void ParamValue<LLSD, TypeValues<LLSD>, false>::serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack)
void ParamValue<LLSD, NOT_BLOCK>::serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack)
{
p.writeValue<LLSD::String>(sd.asString(), name_stack);
}
void ParamValue<LLSD, TypeValues<LLSD>, false>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const
void ParamValue<LLSD, NOT_BLOCK>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const
{
// read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
Parser::name_stack_t stack;
LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, stack);
// attempt to write LLSD out directly
if (!p.writeValue<LLSD>(mValue, name_stack))
{
// otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack);
}
}
}

View File

@@ -1112,6 +1112,13 @@ std::string LLFontGL::nameFromFont(const LLFontGL* fontp)
return fontp->mFontDescriptor.getName();
}
// static
std::string LLFontGL::sizeFromFont(const LLFontGL* fontp)
{
return fontp->getFontDesc().getSize();
}
// static
std::string LLFontGL::nameFromHAlign(LLFontGL::HAlign align)
{
@@ -1228,6 +1235,41 @@ LLFontGL* LLFontGL::getFont(const LLFontDescriptor& desc)
return sFontRegistry->getFont(desc);
}
// static
LLFontGL* LLFontGL::getFontByName(const std::string& name)
{
// check for most common fonts first
if (name == "SANSSERIF")
{
return getFontSansSerif();
}
else if (name == "SANSSERIF_SMALL")
{
return getFontSansSerifSmall();
}
else if (name == "SANSSERIF_BIG")
{
return getFontSansSerifBig();
}
else if (name == "SMALL" || name == "OCRA")
{
// *BUG: Should this be "MONOSPACE"? Do we use "OCRA" anymore?
// Does "SMALL" mean "SERIF"?
return getFontMonospace();
}
else
{
return NULL;
}
}
//static
LLFontGL* LLFontGL::getFontDefault()
{
return getFontSansSerif(); // Fallback to sans serif as default font
}
// static
std::string LLFontGL::getFontPathSystem()
{

View File

@@ -171,7 +171,9 @@ public:
// Takes a string with potentially several flags, i.e. "NORMAL|BOLD|ITALIC"
static U8 getStyleFromString(const std::string &style);
static std::string getStringFromStyle(U8 style);
static std::string nameFromFont(const LLFontGL* fontp);
static std::string sizeFromFont(const LLFontGL* fontp);
static std::string nameFromHAlign(LLFontGL::HAlign align);
static LLFontGL::HAlign hAlignFromName(const std::string& name);
@@ -201,6 +203,9 @@ public:
static LLFontGL* getFontSansSerifBold();
static LLFontGL* getFontExtChar();
static LLFontGL* getFont(const LLFontDescriptor& desc);
// Use with legacy names like "SANSSERIF_SMALL" or "OCRA"
static LLFontGL* getFontByName(const std::string& name);
static LLFontGL* getFontDefault(); // default fallback font
static std::string getFontPathLocal();
static std::string getFontPathSystem();

View File

@@ -1177,6 +1177,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("depth_cutoff");
mReservedUniforms.push_back("norm_cutoff");
mReservedUniforms.push_back("shadow_target_width");
mReservedUniforms.push_back("downsampled_depth_scale");
llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH+1);
@@ -1195,6 +1196,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("dof_height");
mReservedUniforms.push_back("depthMap");
mReservedUniforms.push_back("depthMapDownsampled");
mReservedUniforms.push_back("shadowMap0");
mReservedUniforms.push_back("shadowMap1");
mReservedUniforms.push_back("shadowMap2");

View File

@@ -136,6 +136,7 @@ public:
DEFERRED_DEPTH_CUTOFF,
DEFERRED_NORM_CUTOFF,
DEFERRED_SHADOW_TARGET_WIDTH,
DEFERRED_DOWNSAMPLED_DEPTH_SCALE,
FXAA_TC_SCALE,
FXAA_RCP_SCREEN_RES,
@@ -152,6 +153,7 @@ public:
DOF_HEIGHT,
DEFERRED_DEPTH,
DEFERRED_DOWNSAMPLED_DEPTH,
DEFERRED_SHADOW0,
DEFERRED_SHADOW1,
DEFERRED_SHADOW2,

View File

@@ -40,68 +40,56 @@
#include "llcontrol.h"
#include "llui.h"
#include "lluictrlfactory.h"
const F32 RESOLUTION_BUMP = 1.f;
#include "lluiimage.h"
static LLRegisterWidget<LLIconCtrl> r("icon");
LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID &image_id)
: LLUICtrl(name,
rect,
FALSE, // mouse opaque
NULL,
FOLLOWS_LEFT | FOLLOWS_TOP),
mColor( LLColor4::white )
LLIconCtrl::Params::Params()
: image("image_name"),
color("color"),
// use_draw_context_alpha("use_draw_context_alpha", true),
scale_image("scale_image"),
min_width("min_width", 0),
min_height("min_height", 0)
{}
LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p)
: LLUICtrl(p),
mColor(p.color()),
mImagep(p.image),
// mUseDrawContextAlpha(p.use_draw_context_alpha),
mPriority(0),
mMinWidth(p.min_width),
mMinHeight(p.min_height)
{
setImage( image_id );
setTabStop(FALSE);
if (mImagep.notNull())
{
LLUICtrl::setValue(mImagep->getName());
}
setTabStop(false);
}
LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name)
LLIconCtrl::LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name, const S32& min_width, const S32& min_height)
: LLUICtrl(name,
rect,
FALSE, // mouse opaque
NULL,
FOLLOWS_LEFT | FOLLOWS_TOP),
mColor( LLColor4::white ),
mImageName(image_name)
mPriority(0),
mMinWidth(min_width),
mMinHeight(min_height)
{
setImage( image_name );
setValue( image_name );
setTabStop(FALSE);
}
LLIconCtrl::~LLIconCtrl()
{
mImagep = NULL;
}
void LLIconCtrl::setImage(const std::string& image_name)
{
//RN: support UUIDs masquerading as strings
if (LLUUID::validate(image_name))
{
mImageID = LLUUID(image_name);
setImage(mImageID);
}
else
{
mImageName = image_name;
mImagep = LLUI::getUIImage(image_name);
mImageID.setNull();
}
}
void LLIconCtrl::setImage(const LLUUID& image_id)
{
mImageName.clear();
mImagep = LLUI::getUIImageByID(image_id);
mImageID = image_id;
}
void LLIconCtrl::draw()
{
if( mImagep.notNull() )
@@ -120,23 +108,40 @@ void LLIconCtrl::setAlpha(F32 alpha)
}
// virtual
// value might be a string or a UUID
void LLIconCtrl::setValue(const LLSD& value )
{
if (value.isUUID())
LLSD tvalue(value);
if (value.isString() && LLUUID::validate(value.asString()))
{
setImage(value.asUUID());
//RN: support UUIDs masquerading as strings
tvalue = LLSD(LLUUID(value.asString()));
}
LLUICtrl::setValue(tvalue);
if (tvalue.isUUID())
{
mImagep = LLUI::getUIImageByID(tvalue.asUUID(), mPriority);
}
else
{
setImage(value.asString());
mImagep = LLUI::getUIImage(tvalue.asString(), mPriority);
}
if (mImagep.notNull()
&& mImagep->getImage().notNull()
&& mMinWidth
&& mMinHeight)
{
mImagep->getImage()->setKnownDrawSize(llmax(mMinWidth, mImagep->getWidth()), llmax(mMinHeight, mImagep->getHeight()));
}
}
// virtual
LLSD LLIconCtrl::getValue() const
std::string LLIconCtrl::getImageName() const
{
LLSD ret = getImage();
return ret;
if (getValue().isString())
return getValue().asString();
else
return std::string();
}
// virtual
@@ -146,11 +151,14 @@ LLXMLNodePtr LLIconCtrl::getXML(bool save_children) const
node->setName(LL_ICON_CTRL_TAG);
if (mImageName != "")
if (!getImageName().empty())
{
node->createChild("image_name", TRUE)->setStringValue(mImageName);
node->createChild("image_name", TRUE)->setStringValue(getImageName());
}
if (mMinWidth) node->createChild("min_width", true)->setIntValue(mMinWidth);
if (mMinHeight) node->createChild("min_height", true)->setIntValue(mMinHeight);
node->createChild("color", TRUE)->setFloatValue(4, mColor.mV);
return node;
@@ -170,7 +178,18 @@ LLView* LLIconCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
LLColor4 color(LLColor4::white);
LLUICtrlFactory::getAttributeColor(node,"color", color);
LLIconCtrl* icon = new LLIconCtrl("icon", rect, image_name);
S32 min_width = 0, min_height = 0;
if (node->hasAttribute("min_width"))
{
node->getAttributeS32("min_width", min_width);
}
if (node->hasAttribute("min_height"))
{
node->getAttributeS32("min_height", min_height);
}
LLIconCtrl* icon = new LLIconCtrl("icon", rect, image_name, min_width, min_height);
icon->setColor(color);

View File

@@ -49,33 +49,55 @@ class LLIconCtrl
: public LLUICtrl
{
public:
LLIconCtrl(const std::string& name, const LLRect &rect, const LLUUID &image_id);
LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name);
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<LLUIImage*> image;
Optional<LLUIColor> color;
// Optional<bool> use_draw_context_alpha;
Optional<S32> min_width,
min_height;
Ignored scale_image;
Params();
};
protected:
LLIconCtrl(const Params&);
friend class LLUICtrlFactory;
public:
LLIconCtrl(const std::string& name, const LLRect &rect, const std::string &image_name, const S32& min_width = 0, const S32& min_height = 0);
virtual ~LLIconCtrl();
// llview overrides
virtual void draw();
void setImage(const std::string& image_name);
void setImage(const LLUUID& image_name);
const LLUUID &getImage() const { return mImageID; }
std::string getImageName() const { return mImageName; }
// Takes a UUID, wraps get/setImage
// lluictrl overrides
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
/*virtual*/ void setAlpha(F32 alpha);
std::string getImageName() const;
void setColor(const LLColor4& color) { mColor = color; }
void setImage(LLPointer<LLUIImage> image) { mImagep = image; }
const LLPointer<LLUIImage> getImage() { return mImagep; }
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
protected:
S32 mPriority;
//the output size of the icon image if set.
S32 mMinWidth,
mMinHeight;
// If set to true (default), use the draw context transparency.
// If false, will use transparency returned by getCurrentTransparency(). See STORM-698.
//bool mUseDrawContextAlpha;
private:
LLColor4 mColor;
std::string mImageName;
LLUUID mImageID;
LLPointer<LLUIImage> mImagep;
};

View File

@@ -1508,8 +1508,9 @@ LLNotificationPtr LLNotifications::add(AIAlert::Error const& error, int type, un
// Allow LLNotifications::add, LLNotifications::cancel and LLNotifications::update
// to be called from any thread.
struct UpdateItem
class UpdateItem
{
public:
char const* sigtype;
LLNotificationPtr pNotif;
UpdateItem(char const* st, LLNotificationPtr const& np) : sigtype(st), pNotif(np) { }

View File

@@ -96,7 +96,7 @@ int const access_increment = 1000;
static void log_sStringTemplates_accesses(void)
{
llinfos << "LLTrans::getString/findString called " << sStringTemplates_accesses << " in total." << llendl;
lldebugs << "LLTrans::getString/findString called " << sStringTemplates_accesses << " in total." << llendl;
}
//static

View File

@@ -313,3 +313,227 @@ void LLUI::setQAMode(BOOL b)
LLUI::sQAMode = b;
}
namespace LLInitParam
{
ParamValue<LLUIColor>::ParamValue(const LLUIColor& color)
: super_t(color),
red("red"),
green("green"),
blue("blue"),
alpha("alpha"),
control("")
{
updateBlockFromValue(false);
}
void ParamValue<LLUIColor>::updateValueFromBlock()
{
if (control.isProvided() && !control().empty())
{
updateValue(LLUI::sColorsGroup->controlExists(control) ? LLUI::sColorsGroup->getColor(control) : LLUI::sConfigGroup->getColor(control)); // Singu Note: Most of our colors will be in sColorsGroup (skin), but some may be moved to settings for users.
}
else
{
updateValue(LLColor4(red, green, blue, alpha));
}
}
void ParamValue<LLUIColor>::updateBlockFromValue(bool make_block_authoritative)
{
LLColor4 color = getValue();
red.set(color.mV[VRED], make_block_authoritative);
green.set(color.mV[VGREEN], make_block_authoritative);
blue.set(color.mV[VBLUE], make_block_authoritative);
alpha.set(color.mV[VALPHA], make_block_authoritative);
control.set("", make_block_authoritative);
}
bool ParamCompare<const LLFontGL*, false>::equals(const LLFontGL* a, const LLFontGL* b)
{
return !(a->getFontDesc() < b->getFontDesc())
&& !(b->getFontDesc() < a->getFontDesc());
}
ParamValue<const LLFontGL*>::ParamValue(const LLFontGL* fontp)
: super_t(fontp),
name("name"),
size("size"),
style("style")
{
if (!fontp)
{
updateValue(LLFontGL::getFontDefault());
}
addSynonym(name, "");
updateBlockFromValue(false);
}
void ParamValue<const LLFontGL*>::updateValueFromBlock()
{
const LLFontGL* res_fontp = LLFontGL::getFontByName(name);
if (res_fontp)
{
updateValue(res_fontp);
return;
}
U8 fontstyle = 0;
fontstyle = LLFontGL::getStyleFromString(style());
LLFontDescriptor desc(name(), size(), fontstyle);
const LLFontGL* fontp = LLFontGL::getFont(desc);
if (fontp)
{
updateValue(fontp);
}
else
{
updateValue(LLFontGL::getFontDefault());
}
}
void ParamValue<const LLFontGL*>::updateBlockFromValue(bool make_block_authoritative)
{
if (getValue())
{
name.set(LLFontGL::nameFromFont(getValue()), make_block_authoritative);
size.set(LLFontGL::sizeFromFont(getValue()), make_block_authoritative);
style.set(LLFontGL::getStringFromStyle(getValue()->getFontDesc().getStyle()), make_block_authoritative);
}
}
ParamValue<LLRect>::ParamValue(const LLRect& rect)
: super_t(rect),
left("left"),
top("top"),
right("right"),
bottom("bottom"),
width("width"),
height("height")
{
updateBlockFromValue(false);
}
void ParamValue<LLRect>::updateValueFromBlock()
{
LLRect rect;
//calculate from params
// prefer explicit left and right
if (left.isProvided() && right.isProvided())
{
rect.mLeft = left;
rect.mRight = right;
}
// otherwise use width along with specified side, if any
else if (width.isProvided())
{
// only right + width provided
if (right.isProvided())
{
rect.mRight = right;
rect.mLeft = right - width;
}
else // left + width, or just width
{
rect.mLeft = left;
rect.mRight = left + width;
}
}
// just left, just right, or none
else
{
rect.mLeft = left;
rect.mRight = right;
}
// prefer explicit bottom and top
if (bottom.isProvided() && top.isProvided())
{
rect.mBottom = bottom;
rect.mTop = top;
}
// otherwise height along with specified side, if any
else if (height.isProvided())
{
// top + height provided
if (top.isProvided())
{
rect.mTop = top;
rect.mBottom = top - height;
}
// bottom + height or just height
else
{
rect.mBottom = bottom;
rect.mTop = bottom + height;
}
}
// just bottom, just top, or none
else
{
rect.mBottom = bottom;
rect.mTop = top;
}
updateValue(rect);
}
void ParamValue<LLRect>::updateBlockFromValue(bool make_block_authoritative)
{
// because of the ambiguity in specifying a rect by position and/or dimensions
// we use the lowest priority pairing so that any valid pairing in xui
// will override those calculated from the rect object
// in this case, that is left+width and bottom+height
LLRect& value = getValue();
right.set(value.mRight, false);
left.set(value.mLeft, make_block_authoritative);
width.set(value.getWidth(), make_block_authoritative);
top.set(value.mTop, false);
bottom.set(value.mBottom, make_block_authoritative);
height.set(value.getHeight(), make_block_authoritative);
}
ParamValue<LLCoordGL>::ParamValue(const LLCoordGL& coord)
: super_t(coord),
x("x"),
y("y")
{
updateBlockFromValue(false);
}
void ParamValue<LLCoordGL>::updateValueFromBlock()
{
updateValue(LLCoordGL(x, y));
}
void ParamValue<LLCoordGL>::updateBlockFromValue(bool make_block_authoritative)
{
x.set(getValue().mX, make_block_authoritative);
y.set(getValue().mY, make_block_authoritative);
}
void TypeValues<LLFontGL::HAlign>::declareValues()
{
declare("left", LLFontGL::LEFT);
declare("right", LLFontGL::RIGHT);
declare("center", LLFontGL::HCENTER);
}
void TypeValues<LLFontGL::VAlign>::declareValues()
{
declare("top", LLFontGL::TOP);
declare("center", LLFontGL::VCENTER);
declare("baseline", LLFontGL::BASELINE);
declare("bottom", LLFontGL::BOTTOM);
}
void TypeValues<LLFontGL::ShadowType>::declareValues()
{
declare("none", LLFontGL::NO_SHADOW);
declare("hard", LLFontGL::DROP_SHADOW);
declare("soft", LLFontGL::DROP_SHADOW_SOFT);
}
}

View File

@@ -32,12 +32,18 @@
#include "llcontrol.h"
#include "llcoord.h"
#include "v2math.h"
#include "llinitparam.h"
#include "llregistry.h"
#include "llrender2dutils.h"
#include "llpointer.h"
#include "lluicolor.h"
#include "lluiimage.h"
#include <boost/signals2.hpp>
// for initparam specialization
#include "llfontgl.h"
// LLUIFactory
#include "llsd.h"
@@ -504,4 +510,99 @@ protected:
template <typename T> T* LLParamBlock<T>::sBlock = NULL;
namespace LLInitParam
{
template<>
class ParamValue<LLRect>
: public CustomParamValue<LLRect>
{
typedef CustomParamValue<LLRect> super_t;
public:
Optional<S32> left,
top,
right,
bottom,
width,
height;
ParamValue(const LLRect& value);
void updateValueFromBlock();
void updateBlockFromValue(bool make_block_authoritative);
};
template<>
class ParamValue<LLUIColor>
: public CustomParamValue<LLUIColor>
{
typedef CustomParamValue<LLUIColor> super_t;
public:
Optional<F32> red,
green,
blue,
alpha;
Optional<std::string> control;
ParamValue(const LLUIColor& color);
void updateValueFromBlock();
void updateBlockFromValue(bool make_block_authoritative);
};
template<>
class ParamValue<const LLFontGL*>
: public CustomParamValue<const LLFontGL* >
{
typedef CustomParamValue<const LLFontGL*> super_t;
public:
Optional<std::string> name,
size,
style;
ParamValue(const LLFontGL* value);
void updateValueFromBlock();
void updateBlockFromValue(bool make_block_authoritative);
};
template<>
struct TypeValues<LLFontGL::HAlign> : public TypeValuesHelper<LLFontGL::HAlign>
{
static void declareValues();
};
template<>
struct TypeValues<LLFontGL::VAlign> : public TypeValuesHelper<LLFontGL::VAlign>
{
static void declareValues();
};
template<>
struct TypeValues<LLFontGL::ShadowType> : public TypeValuesHelper<LLFontGL::ShadowType>
{
static void declareValues();
};
template<>
struct ParamCompare<const LLFontGL*, false>
{
static bool equals(const LLFontGL* a, const LLFontGL* b);
};
template<>
class ParamValue<LLCoordGL>
: public CustomParamValue<LLCoordGL>
{
typedef CustomParamValue<LLCoordGL> super_t;
public:
Optional<S32> x,
y;
ParamValue(const LLCoordGL& val);
void updateValueFromBlock();
void updateBlockFromValue(bool make_block_authoritative);
};
}
#endif

View File

@@ -31,7 +31,6 @@
* $/LicenseInfo$
*/
//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include "lluictrl.h"
#include "llfocusmgr.h"
@@ -39,10 +38,69 @@
static LLRegisterWidget<LLUICtrl> r("ui_ctrl");
// NOTE: the LLFocusableElement implementation has been moved to llfocusmgr.cpp, to mirror the header where the class is defined.
LLUICtrl::CallbackParam::CallbackParam()
: name("name"),
function_name("function"),
parameter("parameter"),
control_name("control") // Shortcut to control -> "control_name" for backwards compatability
{
addSynonym(parameter, "userdata");
}
LLUICtrl::LLUICtrl() :
mViewModel(LLViewModelPtr(new LLViewModel)),
LLUICtrl::EnableControls::EnableControls()
: enabled("enabled_control"),
disabled("disabled_control")
{}
LLUICtrl::ControlVisibility::ControlVisibility()
: visible("visibility_control"),
invisible("invisibility_control")
{
addSynonym(visible, "visiblity_control");
addSynonym(invisible, "invisiblity_control");
}
LLUICtrl::Params::Params()
: tab_stop("tab_stop", true),
chrome("chrome", false),
requests_front("requests_front", false),
label("label"),
initial_value("value"),
init_callback("init_callback"),
commit_callback("commit_callback"),
validate_callback("validate_callback"),
mouseenter_callback("mouseenter_callback"),
mouseleave_callback("mouseleave_callback"),
control_name("control_name"),
font("font", LLFontGL::getFontSansSerif()),
font_halign("halign"),
font_valign("valign"),
length("length"), // ignore LLXMLNode cruft
type("type") // ignore LLXMLNode cruft
{
addSynonym(initial_value, "initial_value");
}
// NOTE: the LLFocusableElement implementation has been moved from here to llfocusmgr.cpp.
//static
const LLUICtrl::Params& LLUICtrl::getDefaultParams()
{
// Singu Note: We diverge here, not using LLUICtrlFactory::getDefaultParams
static const Params p;
return p;
}
LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
: LLView(p),
mIsChrome(FALSE),
mRequestsFront(p.requests_front),
mTabStop(TRUE),
mTentative(FALSE),
mViewModel(viewmodel),
mEnabledControlVariable(NULL),
mDisabledControlVariable(NULL),
mMakeVisibleControlVariable(NULL),
mMakeInvisibleControlVariable(NULL),
mCommitSignal(NULL),
@@ -54,22 +112,110 @@ LLUICtrl::LLUICtrl() :
mRightMouseDownSignal(NULL),
mRightMouseUpSignal(NULL),
mDoubleClickSignal(NULL),
mTentative(FALSE),
mTabStop(TRUE),
mIsChrome(FALSE),
mCommitOnReturn(FALSE)
{
}
void LLUICtrl::initFromParams(const Params& p)
{
LLView::initFromParams(p);
mRequestsFront = p.requests_front;
setIsChrome(p.chrome);
if(p.enabled_controls.isProvided())
{
if (p.enabled_controls.enabled.isChosen())
{
LLControlVariable* control = findControl(p.enabled_controls.enabled);
if (control)
setEnabledControlVariable(control);
}
else if(p.enabled_controls.disabled.isChosen())
{
LLControlVariable* control = findControl(p.enabled_controls.disabled);
if (control)
setDisabledControlVariable(control);
}
}
if(p.controls_visibility.isProvided())
{
if (p.controls_visibility.visible.isChosen())
{
LLControlVariable* control = findControl(p.controls_visibility.visible);
if (control)
setMakeVisibleControlVariable(control);
}
else if (p.controls_visibility.invisible.isChosen())
{
LLControlVariable* control = findControl(p.controls_visibility.invisible);
if (control)
setMakeInvisibleControlVariable(control);
}
}
setTabStop(p.tab_stop);
if (p.initial_value.isProvided()
&& !p.control_name.isProvided())
{
setValue(p.initial_value);
}
if (p.commit_callback.isProvided())
{
setCommitCallback(initCommitCallback(p.commit_callback));
}
if (p.validate_callback.isProvided())
{
setValidateCallback(initEnableCallback(p.validate_callback));
}
if (p.init_callback.isProvided())
{
if (p.init_callback.function.isProvided())
{
p.init_callback.function()(this, p.init_callback.parameter);
}
else
{
commit_callback_t* initfunc = (CommitCallbackRegistry::getValue(p.init_callback.function_name));
if (initfunc)
{
(*initfunc)(this, p.init_callback.parameter);
}
}
}
if(p.mouseenter_callback.isProvided())
{
setMouseEnterCallback(initCommitCallback(p.mouseenter_callback));
}
if(p.mouseleave_callback.isProvided())
{
setMouseLeaveCallback(initCommitCallback(p.mouseleave_callback));
}
}
LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque,
commit_callback_t commit_callback,
U32 reshape)
: // can't make this automatically follow top and left, breaks lots
// of buttons in the UI. JC 7/20/2002
LLView( name, rect, mouse_opaque, reshape ),
mIsChrome(FALSE),
mRequestsFront(false),
mTabStop( TRUE ),
mTentative( FALSE ),
mViewModel(LLViewModelPtr(new LLViewModel)),
mEnabledControlVariable(NULL),
mDisabledControlVariable(NULL),
mMakeVisibleControlVariable(NULL),
mMakeInvisibleControlVariable(NULL),
mCommitSignal(NULL),
mValidateSignal(NULL),
mViewModel(LLViewModelPtr(new LLViewModel)),
mMouseEnterSignal(NULL),
mMouseLeaveSignal(NULL),
mMouseDownSignal(NULL),
@@ -77,9 +223,6 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque
mRightMouseDownSignal(NULL),
mRightMouseUpSignal(NULL),
mDoubleClickSignal(NULL),
mTentative( FALSE ),
mTabStop( TRUE ),
mIsChrome(FALSE),
mCommitOnReturn(FALSE)
{
if(commit_callback)
@@ -107,6 +250,66 @@ LLUICtrl::~LLUICtrl()
delete mDoubleClickSignal;
}
void default_commit_handler(LLUICtrl* ctrl, const LLSD& param)
{}
bool default_enable_handler(LLUICtrl* ctrl, const LLSD& param)
{
return true;
}
LLUICtrl::commit_signal_t::slot_type LLUICtrl::initCommitCallback(const CommitCallbackParam& cb)
{
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
return boost::bind(cb.function(), _1, cb.parameter);
else
return cb.function();
}
else
{
std::string function_name = cb.function_name;
commit_callback_t* func = (CommitCallbackRegistry::getValue(function_name));
if (func)
{
if (cb.parameter.isProvided())
return boost::bind((*func), _1, cb.parameter);
else
return commit_signal_t::slot_type(*func);
}
else if (!function_name.empty())
{
llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl;
}
}
return default_commit_handler;
}
LLUICtrl::enable_signal_t::slot_type LLUICtrl::initEnableCallback(const EnableCallbackParam& cb)
{
// Set the callback function
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
return boost::bind(cb.function(), this, cb.parameter);
else
return cb.function();
}
else
{
enable_callback_t* func = (EnableCallbackRegistry::getValue(cb.function_name));
if (func)
{
if (cb.parameter.isProvided())
return boost::bind((*func), this, cb.parameter);
else
return enable_signal_t::slot_type(*func);
}
}
return default_enable_handler;
}
// virtual
void LLUICtrl::onMouseEnter(S32 x, S32 y, MASK mask)
@@ -130,6 +333,7 @@ void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask)
BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleMouseDown(x,y,mask);
if (mMouseDownSignal)
{
(*mMouseDownSignal)(this,x,y,mask);
@@ -227,6 +431,66 @@ LLViewModel* LLUICtrl::getViewModel() const
return mViewModel;
}
//virtual
BOOL LLUICtrl::postBuild()
{
//
// Find all of the children that want to be in front and move them to the front
//
if (getChildCount() > 0)
{
std::vector<LLUICtrl*> childrenToMoveToFront;
for (LLView::child_list_const_iter_t child_it = beginChild(); child_it != endChild(); ++child_it)
{
LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(*child_it);
if (uictrl && uictrl->mRequestsFront)
{
childrenToMoveToFront.push_back(uictrl);
}
}
for (std::vector<LLUICtrl*>::iterator it = childrenToMoveToFront.begin(); it != childrenToMoveToFront.end(); ++it)
{
sendChildToFront(*it);
}
}
return LLView::postBuild();
}
void LLUICtrl::setEnabledControlVariable(LLControlVariable* control)
{
if (mEnabledControlVariable)
{
mEnabledControlConnection.disconnect(); // disconnect current signal
mEnabledControlVariable = NULL;
}
if (control)
{
mEnabledControlVariable = control;
mEnabledControlConnection = mEnabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("enabled")));
setEnabled(mEnabledControlVariable->getValue().asBoolean());
}
}
void LLUICtrl::setDisabledControlVariable(LLControlVariable* control)
{
if (mDisabledControlVariable)
{
mDisabledControlConnection.disconnect(); // disconnect current signal
mDisabledControlVariable = NULL;
}
if (control)
{
mDisabledControlVariable = control;
mDisabledControlConnection = mDisabledControlVariable->getSignal()->connect(boost::bind(&controlListener, _2, getHandle(), std::string("disabled")));
setEnabled(!(mDisabledControlVariable->getValue().asBoolean()));
}
}
void LLUICtrl::setMakeVisibleControlVariable(LLControlVariable* control)
{
if (mMakeVisibleControlVariable)
@@ -262,7 +526,17 @@ bool LLUICtrl::controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle,
LLUICtrl* ctrl = handle.get();
if (ctrl)
{
if (type == "visible")
if (type == "enabled")
{
ctrl->setEnabled(newvalue.asBoolean());
return true;
}
else if(type =="disabled")
{
ctrl->setEnabled(!newvalue.asBoolean());
return true;
}
else if (type == "visible")
{
ctrl->setVisible(newvalue.asBoolean());
return true;
@@ -383,7 +657,6 @@ void LLUICtrl::setIsChrome(BOOL is_chrome)
// virtual
BOOL LLUICtrl::getIsChrome() const
{
LLView* parent_ctrl = getParent();
while(parent_ctrl)
{
@@ -533,6 +806,7 @@ BOOL LLUICtrl::focusLastItem(BOOL prefer_text_fields)
return FALSE;
}
BOOL LLUICtrl::focusNextItem(BOOL text_fields_only)
{
// this assumes that this method is called on the focus root.
@@ -618,6 +892,8 @@ void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent)
setTabStop(has_tab_stop);
node->getAttributeBOOL("requests_front", mRequestsFront);
std::string str = node->getName()->mString;
std::string attrib_str;
LLXMLNodePtr child_node;
@@ -667,6 +943,20 @@ void LLUICtrl::initFromXML(LLXMLNodePtr node, LLView* parent)
}
LLView::initFromXML(node, parent);
if (node->getAttributeString("enabled_control", attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
if (control)
setEnabledControlVariable(control);
}
if (node->getAttributeString("disabled_control", attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
if (control)
setDisabledControlVariable(control);
}
if(node->getAttributeString("visibility_control",attrib_str) || node->getAttributeString("visiblity_control",attrib_str))
{
LLControlVariable* control = findControl(attrib_str);
@@ -727,6 +1017,7 @@ boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<b
if (!mValidateSignal) mValidateSignal = new enable_signal_t();
return mValidateSignal->connect(boost::bind(cb, _2));
}
// virtual
void LLUICtrl::setTentative(BOOL b)
{
@@ -756,6 +1047,16 @@ void LLUICtrl::setMinValue(LLSD min_value)
void LLUICtrl::setMaxValue(LLSD max_value)
{ }
boost::signals2::connection LLUICtrl::setCommitCallback(const CommitCallbackParam& cb)
{
return setCommitCallback(initCommitCallback(cb));
}
boost::signals2::connection LLUICtrl::setValidateCallback(const EnableCallbackParam& cb)
{
return setValidateCallback(initEnableCallback(cb));
}
boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb )
{
if (!mCommitSignal) mCommitSignal = new commit_signal_t();

View File

@@ -34,13 +34,13 @@
#ifndef LL_LLUICTRL_H
#define LL_LLUICTRL_H
#include "llview.h"
#include "llrect.h"
#include "llsd.h"
#include <boost/function.hpp>
#include <boost/signals2.hpp>
#include "llinitparam.h"
#include "llview.h"
#include "llviewmodel.h" // *TODO move dependency to .cpp file
class LLUICtrl
@@ -49,20 +49,102 @@ class LLUICtrl
public:
typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> commit_callback_t;
typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> commit_signal_t;
// *TODO: add xml support for this type of signal in the future
typedef boost::signals2::signal<void (LLUICtrl* ctrl, S32 x, S32 y, MASK mask)> mouse_signal_t;
typedef boost::function<bool (LLUICtrl* ctrl, const LLSD& param)> enable_callback_t;
typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> enable_signal_t;
LLUICtrl();
struct CallbackParam : public LLInitParam::Block<CallbackParam>
{
Ignored name;
Optional<std::string> function_name;
Optional<LLSD> parameter;
Optional<std::string> control_name;
CallbackParam();
};
struct CommitCallbackParam : public LLInitParam::Block<CommitCallbackParam, CallbackParam >
{
Optional<commit_callback_t> function;
};
// also used for visible callbacks
struct EnableCallbackParam : public LLInitParam::Block<EnableCallbackParam, CallbackParam >
{
Optional<enable_callback_t> function;
};
struct EnableControls : public LLInitParam::ChoiceBlock<EnableControls>
{
Alternative<std::string> enabled;
Alternative<std::string> disabled;
EnableControls();
};
struct ControlVisibility : public LLInitParam::ChoiceBlock<ControlVisibility>
{
Alternative<std::string> visible;
Alternative<std::string> invisible;
ControlVisibility();
};
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Optional<std::string> label;
Optional<bool> tab_stop,
chrome,
requests_front;
Optional<LLSD> initial_value;
Optional<CommitCallbackParam> init_callback,
commit_callback;
Optional<EnableCallbackParam> validate_callback;
Optional<CommitCallbackParam> mouseenter_callback,
mouseleave_callback;
Optional<std::string> control_name;
Optional<EnableControls> enabled_controls;
Optional<ControlVisibility> controls_visibility;
// font params
Optional<const LLFontGL*> font;
Optional<LLFontGL::HAlign> font_halign;
Optional<LLFontGL::VAlign> font_valign;
// cruft from LLXMLNode implementation
Ignored type,
length;
Params();
};
/*virtual*/ ~LLUICtrl();
void initFromParams(const Params& p);
static const Params& getDefaultParams();
LLUICtrl(const Params& p = getDefaultParams(),
const LLViewModelPtr& viewmodel=LLViewModelPtr(new LLViewModel));
// Singu Note: This constructor is deprecated:
LLUICtrl( const std::string& name, const LLRect rect = LLRect(), BOOL mouse_opaque = TRUE,
commit_callback_t commit_callback = NULL,
U32 reshape=FOLLOWS_NONE);
/*virtual*/ ~LLUICtrl();
commit_signal_t::slot_type initCommitCallback(const CommitCallbackParam& cb);
enable_signal_t::slot_type initEnableCallback(const EnableCallbackParam& cb);
// We need this virtual so we can override it with derived versions
virtual LLViewModel* getViewModel() const;
// We shouldn't ever need to set this directly
//virtual void setViewModel(const LLViewModelPtr&);
virtual BOOL postBuild();
public:
// LLView interface
/*virtual*/ void initFromXML(LLXMLNodePtr node, LLView* parent);
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
@@ -87,6 +169,9 @@ public:
virtual class LLCtrlSelectionInterface* getSelectionInterface();
virtual class LLCtrlListInterface* getListInterface();
virtual class LLCtrlScrollInterface* getScrollInterface();
void setEnabledControlVariable(LLControlVariable* control);
void setDisabledControlVariable(LLControlVariable* control);
void setMakeVisibleControlVariable(LLControlVariable* control);
void setMakeInvisibleControlVariable(LLControlVariable* control);
@@ -113,6 +198,9 @@ public:
// Default to no-op:
virtual void onTabInto();
// Clear any user-provided input (text in a text editor, checked checkbox,
// selected radio button, etc.). Defaults to no-op.
virtual void clear();
virtual void setColor(const LLColor4& color);
virtual void setAlpha(F32 alpha);
@@ -121,7 +209,7 @@ public:
BOOL focusNextItem(BOOL text_entry_only);
BOOL focusPrevItem(BOOL text_entry_only);
virtual BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
BOOL focusLastItem(BOOL prefer_text_fields = FALSE);
// Non Virtuals
@@ -136,10 +224,13 @@ public:
void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
BOOL getCommitOnReturn() const { return mCommitOnReturn; }
boost::signals2::connection setCommitCallback(const CommitCallbackParam& cb);
boost::signals2::connection setValidateCallback(const EnableCallbackParam& cb);
//Start using these!
boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb );
boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb );
@@ -192,14 +283,19 @@ protected:
LLViewModelPtr mViewModel;
LLControlVariable* mEnabledControlVariable;
boost::signals2::connection mEnabledControlConnection;
LLControlVariable* mDisabledControlVariable;
boost::signals2::connection mDisabledControlConnection;
LLControlVariable* mMakeVisibleControlVariable;
boost::signals2::connection mMakeVisibleControlConnection;
LLControlVariable* mMakeInvisibleControlVariable;
boost::signals2::connection mMakeInvisibleControlConnection;
private:
BOOL mTabStop;
BOOL mIsChrome;
BOOL mRequestsFront;
BOOL mTabStop;
BOOL mTentative;
bool mCommitOnReturn;

View File

@@ -17,7 +17,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
<integer>0</integer>
</map>
<key>PhoenixIMAnnounceStealFocus</key>
<map>
@@ -223,13 +223,13 @@
<key>zmm_mlfov</key>
<map>
<key>Comment</key>
<string>1=Normal, Under 1 Zoom Out, Over 1 Zoom in </string>
<string>Adjusted when scrolling back and forth while holding rightclick in mouselook (Zoomed in &lt; 1.037 &lt; Zoomed out)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1</real>
<real>0.5</real>
</map>
<key>AllowLargeSounds</key>
@@ -763,6 +763,39 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>LiruMouselookHidesFloaters</key>
<map>
<key>Comment</key>
<string>Whether or not floaters open during third person will be hidden while in mouselook</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>1</boolean>
</map>
<key>LiruMouselookHidesMenubar</key>
<map>
<key>Comment</key>
<string>Whether or not the main menu bar will be hidden in mouselook</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>1</boolean>
</map>
<key>LiruMouselookHidesNotices</key>
<map>
<key>Comment</key>
<string>Whether or not notices will be hidden in mouselook</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>0</boolean>
</map>
<key>LiruMouselookMenu</key>
<map>
<key>Comment</key>
@@ -6153,6 +6186,28 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>EnableNongestureSounds</key>
<map>
<key>Comment</key>
<string>Play sounds from non-gestures</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>EnableNongestureSoundsSelf</key>
<map>
<key>Comment</key>
<string>Play sounds from your non-gestures when EnableNongestureSounds is false. (Useless otherwise)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>EnableMouselook</key>
<map>
<key>Comment</key>

View File

@@ -229,5 +229,16 @@
<key>Value</key>
<real>1</real>
</map>
<key>SHRenderSSAOResolutionScale</key>
<map>
<key>Comment</key>
<string>SSAO resolution scale. Valid values: 0.01-1.0</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>.5</real>
</map>
</map>
</llsd>

View File

@@ -0,0 +1,140 @@
/**
* @file sunLightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
VARYING vec2 vary_fragcoord;
uniform sampler2DRect depthMapDownsampled;
uniform sampler2DRect normalMap;
uniform sampler2D noiseMap;
uniform vec2 screen_res;
uniform mat4 inv_proj;
uniform float downsampled_depth_scale;
uniform float ssao_radius;
uniform float ssao_max_radius;
uniform float ssao_factor;
vec3 decode_normal (vec2 enc)
{
vec2 fenc = enc*4-2;
float f = dot(fenc,fenc);
float g = sqrt(1-f/4);
vec3 n;
n.xy = fenc*g;
n.z = 1-f/2;
return n;
}
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMapDownsampled, pos_screen.xy*downsampled_depth_scale).r;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
vec4 pos = inv_proj * ndc;
pos /= pos.w;
pos.w = 1.0;
return pos;
}
vec2 getKern(int i)
{
vec2 kern[8];
// exponentially (^2) distant occlusion samples spread around origin
kern[0] = vec2(-1.0, 0.0) * (0.125*0.125*.9+.1);
kern[1] = vec2(1.0, 0.0) * (0.250*0.250*.9+.1);
kern[2] = vec2(0.0, 1.0) * (0.375*0.375*.9+.1);
kern[3] = vec2(0.0, -1.0) * (0.500*0.500*.9+.1);
kern[4] = vec2(0.7071, 0.7071) * (0.625*0.625*.9+.1);
kern[5] = vec2(-0.7071, -0.7071) * (0.750*0.750*.9+.1);
kern[6] = vec2(-0.7071, 0.7071) * (0.875*0.875*.9+.1);
kern[7] = vec2(0.7071, -0.7071) * (1.000*1.000*.9+.1);
return kern[i];
}
//calculate decreases in ambient lighting when crowded out (SSAO)
float calcAmbientOcclusion(vec4 pos, vec3 norm)
{
vec2 pos_screen = vary_fragcoord.xy;
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
// We treat the first sample as the origin, which definitely doesn't obscure itself thanks to being visible for sampling in the first place.
float points = 1.0;
float angle_hidden = 0.0;
// use a kernel scale that diminishes with distance.
// a scale of less than 32 is just wasting good samples, though.
float scale = max(32.0, min(ssao_radius / -pos.z, ssao_max_radius));
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
for (int i = 0; i < 8; i++)
{
vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect);
vec3 samppos_world = getPosition(samppos_screen).xyz;
vec3 diff = samppos_world - pos.xyz;
if (diff.z < ssao_factor && diff.z != 0.0)
{
float dist = length(diff);
float angrel = max(0.0, dot(norm.xyz, diff/dist));
float distrel = 1.0/(1.0+dist*dist);
float samplehidden = min(angrel, distrel);
angle_hidden += (samplehidden);
points += 1.0;
}
}
angle_hidden /= points;
float rtn = (1.0 - angle_hidden);
return (rtn * rtn) * (rtn * rtn); //Pow2 to increase darkness to match previous behavior.
}
void main()
{
vec2 pos_screen = vary_fragcoord.xy;
//try doing an unproject here
vec4 pos = getPosition(pos_screen);
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
norm = decode_normal(norm.xy);
frag_color = vec4(calcAmbientOcclusion(pos,norm),0,0,0);
}

View File

@@ -51,7 +51,6 @@ uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
@@ -312,7 +311,7 @@ void setAtmosAttenuation(vec3 v)
vary_AtmosAttenuation = v;
}
void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
void calcAtmospherics(vec3 inPositionEye) {
vec3 P = inPositionEye;
setPositionEye(P);
@@ -373,16 +372,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
//increase ambient when there are more clouds
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
/* decrease value and saturation (that in HSV, not HSL) for occluded areas
* // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
* // The following line of code performs the equivalent of:
* float ambAlpha = tmpAmbient.a;
* float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
* vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
* tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
*/
tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
//haze color
setAdditiveColor(
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
@@ -568,7 +557,7 @@ void main()
vec3 norm = vary_norm;
calcAtmospherics(pos.xyz, 1.0);
calcAtmospherics(pos.xyz);
vec2 abnormal = encode_normal(norm.xyz);
norm.xyz = decode_normal(abnormal.xy);

View File

@@ -38,7 +38,7 @@ uniform sampler2DRect lightMap;
uniform float dist_factor;
uniform float blur_size;
uniform vec2 delta;
uniform vec3 kern[4];
//uniform vec3 kern[4];
uniform float kern_scale;
VARYING vec2 vary_fragcoord;
@@ -46,8 +46,14 @@ VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
uniform vec2 screen_res;
vec3 getKern(int i)
vec2 getKern(int i)
{
vec2 kern[4];
kern[0] = vec2(0.3989422804,0.1994711402);
kern[1] = vec2(0.2419707245,0.1760326634);
kern[2] = vec2(0.0539909665,0.1209853623);
kern[3] = vec2(0.0044318484,0.0647587978);
return kern[i];
}
@@ -102,33 +108,37 @@ void main()
// perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large
vec2 tc_v = fract(0.5 * tc.xy); // we now have floor(mod(tc,2.0))*0.5
float tc_mod = 2.0 * abs(tc_v.x - tc_v.y); // diff of x,y makes checkerboard
tc += ( (tc_mod - 0.5) * getKern(1).z * dlt * 0.5 );
tc += ( (tc_mod - 0.5) * dlt * 0.5 );
for (int i = 1; i < 4; i++)
{
vec2 samptc = (tc + getKern(i).z * dlt);
vec3 samppos = getPosition(samptc).xyz;
vec2 samptc = (tc + i * dlt);
vec3 samppos = getPosition(samptc).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
if (d*d <= pointplanedist_tolerance_pow2)
{
col += texture2DRect(lightMap, samptc)*getKern(i).xyxx;
defined_weight += getKern(i).xy;
vec4 weight = getKern(i).xyxx;
col += texture2DRect(lightMap, samptc)*weight;
defined_weight += weight.xy;
}
}
for (int i = 1; i < 4; i++)
{
vec2 samptc = (tc - getKern(i).z * dlt);
vec3 samppos = getPosition(samptc).xyz;
vec2 samptc = (tc - i * dlt);
vec3 samppos = getPosition(samptc).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
if (d*d <= pointplanedist_tolerance_pow2)
{
col += texture2DRect(lightMap, samptc)*getKern(i).xyxx;
defined_weight += getKern(i).xy;
vec4 weight = getKern(i).xyxx;
col += texture2DRect(lightMap, samptc)*weight;
defined_weight += weight.xy;
}
}
col /= defined_weight.xyxx;
col.y *= col.y; // delinearize SSAO effect post-blur
//col.y *= col.y; // delinearize SSAO effect post-blur // Singu note: Performed pre-blur as to remove blur requirement
frag_color = col;
}

View File

@@ -0,0 +1,41 @@
/**
* @file sunLightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2007, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
//#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
#define frag_color gl_FragColor
#endif
uniform sampler2DRect depthMap;
VARYING vec2 vary_fragcoord;
void main()
{
gl_FragDepth = texture2DRect(depthMap, vary_fragcoord.xy).r;
}

View File

@@ -134,7 +134,6 @@ uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
@@ -335,7 +334,7 @@ void setAtmosAttenuation(vec3 v)
vary_AtmosAttenuation = v;
}
void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
void calcAtmospherics(vec3 inPositionEye) {
vec3 P = inPositionEye;
setPositionEye(P);
@@ -396,16 +395,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
//increase ambient when there are more clouds
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
/* decrease value and saturation (that in HSV, not HSL) for occluded areas
* // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html
* // The following line of code performs the equivalent of:
* float ambAlpha = tmpAmbient.a;
* float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis
* vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue);
* tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha);
*/
tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
//haze color
setAdditiveColor(
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
@@ -677,7 +666,7 @@ void main()
vec3 col = vec3(0.0f,0.0f,0.0f);
float bloom = 0.0;
calcAtmospherics(pos.xyz, 1.0);
calcAtmospherics(pos.xyz);
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));

View File

@@ -64,7 +64,6 @@ uniform vec4 glow;
uniform float global_gamma;
uniform float scene_light_strength;
uniform mat3 env_mat;
uniform float ssao_effect;
uniform vec3 sun_dir;
VARYING vec2 vary_fragcoord;
@@ -238,7 +237,7 @@ vec4 applyWaterFogDeferred(vec3 pos, vec4 color)
}
#endif
void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
void calcAtmospherics(vec3 inPositionEye) {
vec3 P = inPositionEye;
setPositionEye(P);
@@ -305,9 +304,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
+ (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
+ tmpAmbient)));
// decrease value for occluded areas
tmpAmbient = vec4(mix(ssao_effect * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a);
//brightness of surface both sunlight and ambient
setSunlitColor(vec3(sunlight * .5));
setAmblitColor(vec3(tmpAmbient * .25));
@@ -408,7 +404,7 @@ void main()
float final_da = max(0.0,da);
final_da = min(final_da, 1.0f);
final_da = pow(final_da, 1.0/1.3);
calcAtmospherics(pos.xyz, 1.0);
calcAtmospherics(pos.xyz);
col = atmosAmbient(vec3(0));
float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);

View File

@@ -31,120 +31,19 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
//class 1 -- no shadow, SSAO only
uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
uniform sampler2D noiseMap;
// Inputs
uniform float ssao_radius;
uniform float ssao_max_radius;
uniform float ssao_factor;
uniform float ssao_factor_inv;
VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
uniform sampler2DRect depthMapDownsampled;
uniform sampler2DRect depthMap;
uniform sampler2DRect diffuseRect;
uniform float downsampled_depth_scale;
uniform vec2 screen_res;
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
return n.xy / f + 0.5;
}
vec3 decode_normal (vec2 enc)
{
vec2 fenc = enc*4-2;
float f = dot(fenc,fenc);
float g = sqrt(1-f/4);
vec3 n;
n.xy = fenc*g;
n.z = 1-f/2;
return n;
}
vec4 getPosition(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen.xy).r;
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
vec4 pos = inv_proj * ndc;
pos /= pos.w;
pos.w = 1.0;
return pos;
}
//calculate decreases in ambient lighting when crowded out (SSAO)
float calcAmbientOcclusion(vec4 pos, vec3 norm)
{
vec2 kern[8];
// exponentially (^2) distant occlusion samples spread around origin
kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
vec2 pos_screen = vary_fragcoord.xy;
vec3 pos_world = pos.xyz;
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
// We treat the first sample as the origin, which definitely doesn't obscure itself thanks to being visible for sampling in the first place.
float points = 1.0;
float angle_hidden = 0.0;
// use a kernel scale that diminishes with distance.
// a scale of less than 32 is just wasting good samples, though.
float scale = max(32.0, min(ssao_radius / -pos.z, ssao_max_radius));
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
for (int i = 0; i < 8; i++)
{
vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect);
vec3 samppos_world = getPosition(samppos_screen).xyz;
vec3 diff = samppos_world - pos.xyz;
if (diff.z < ssao_factor && diff.z != 0.0)
{
float dist = length(diff);
float angrel = max(0.0, dot(norm.xyz, diff/dist));
float distrel = 1.0/(1.0+dist*dist);
float samplehidden = min(angrel, distrel);
angle_hidden += (samplehidden);
points += 1.0;
}
}
angle_hidden /= points;
float rtn = (1.0 - angle_hidden);
return (rtn * rtn);
}
void main()
{
vec2 pos_screen = vary_fragcoord.xy;
//try doing an unproject here
vec4 pos = getPosition(pos_screen);
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
norm = decode_normal(norm.xy);
{
frag_color[0] = 1.0;
frag_color[1] = calcAmbientOcclusion(pos, norm);
frag_color[2] = 1.0;
frag_color[1] = texture2DRect(diffuseRect,vary_fragcoord.xy*downsampled_depth_scale).r;
frag_color[2] = 1.0;
frag_color[3] = 1.0;
}

View File

@@ -32,6 +32,7 @@ out vec4 frag_color;
//class 2 -- shadows and SSAO
uniform sampler2DRect diffuseRect;
uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
uniform sampler2DShadow shadowMap0;
@@ -40,16 +41,12 @@ uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
uniform sampler2DShadow shadowMap4;
uniform sampler2DShadow shadowMap5;
uniform sampler2D noiseMap;
//uniform sampler2D noiseMap;
// Inputs
uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform float ssao_radius;
uniform float ssao_max_radius;
uniform float ssao_factor;
uniform float ssao_factor_inv;
VARYING vec2 vary_fragcoord;
@@ -66,6 +63,8 @@ uniform float shadow_offset;
uniform float spot_shadow_bias;
uniform float spot_shadow_offset;
uniform float downsampled_depth_scale;
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -96,61 +95,6 @@ vec4 getPosition(vec2 pos_screen)
return pos;
}
vec2 getKern(int i)
{
vec2 kern[8];
// exponentially (^2) distant occlusion samples spread around origin
kern[0] = vec2(-1.0, 0.0) * 0.125*0.125;
kern[1] = vec2(1.0, 0.0) * 0.250*0.250;
kern[2] = vec2(0.0, 1.0) * 0.375*0.375;
kern[3] = vec2(0.0, -1.0) * 0.500*0.500;
kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625;
kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750;
kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875;
kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000;
return kern[i];
}
//calculate decreases in ambient lighting when crowded out (SSAO)
float calcAmbientOcclusion(vec4 pos, vec3 norm)
{
vec2 pos_screen = vary_fragcoord.xy;
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
// We treat the first sample as the origin, which definitely doesn't obscure itself thanks to being visible for sampling in the first place.
float points = 1.0;
float angle_hidden = 0.0;
// use a kernel scale that diminishes with distance.
// a scale of less than 32 is just wasting good samples, though.
float scale = max(32.0, min(ssao_radius / -pos.z, ssao_max_radius));
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
for (int i = 0; i < 8; i++)
{
vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect);
vec3 samppos_world = getPosition(samppos_screen).xyz;
vec3 diff = samppos_world - pos.xyz;
if (diff.z < ssao_factor && diff.z != 0.0)
{
float dist = length(diff);
float angrel = max(0.0, dot(norm.xyz, diff/dist));
float distrel = 1.0/(1.0+dist*dist);
float samplehidden = min(angrel, distrel);
angle_hidden += (samplehidden);
points += 1.0;
}
}
angle_hidden /= points;
float rtn = (1.0 - angle_hidden);
return (rtn * rtn);
}
float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl, vec2 pos_screen)
{
stc.xyz /= stc.w;
@@ -301,7 +245,7 @@ void main()
}
frag_color[0] = shadow;
frag_color[1] = calcAmbientOcclusion(pos, norm);
frag_color[1] = texture2DRect(diffuseRect,vary_fragcoord*downsampled_depth_scale);
spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0);

View File

@@ -52,6 +52,7 @@
#include "llmoveview.h"
#include "llchatbar.h"
#include "llnotificationsutil.h"
#include "llnotify.h" // For hiding notices(gNotifyBoxView) in mouselook
#include "llparcel.h"
#include "llrendersphere.h"
#include "llsdmessage.h"
@@ -2043,6 +2044,8 @@ void LLAgent::endAnimationUpdateUI()
gMenuBarView->setVisible(TRUE);
gStatusBar->setVisibleForMouselook(true);
// Show notices
gNotifyBoxView->setVisible(true);
LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
@@ -2053,7 +2056,7 @@ void LLAgent::endAnimationUpdateUI()
}
// Only pop if we have pushed...
if (TRUE == mViewsPushed)
if (mViewsPushed)
{
LLFloaterView::skip_list_t skip_list;
skip_list.insert(LLFloaterMap::getInstance());
@@ -2134,9 +2137,11 @@ void LLAgent::endAnimationUpdateUI()
if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
{
// hide menus
gMenuBarView->setVisible(FALSE);
gMenuBarView->setVisible(!gSavedSettings.getBOOL("LiruMouselookHidesMenubar"));
gStatusBar->setVisibleForMouselook(false);
if (gSavedSettings.getBOOL("LiruMouselookHidesNotices"))
gNotifyBoxView->setVisible(false);
// clear out camera lag effect
gAgentCamera.clearCameraLag();
@@ -2146,7 +2151,7 @@ void LLAgent::endAnimationUpdateUI()
LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
mViewsPushed = TRUE;
mViewsPushed = gSavedSettings.getBOOL("LiruMouselookHidesFloaters");
if (mMouselookModeInSignal)
{
@@ -2155,9 +2160,12 @@ void LLAgent::endAnimationUpdateUI()
// hide all floaters except the mini map
LLFloaterView::skip_list_t skip_list;
skip_list.insert(LLFloaterMap::getInstance());
gFloaterView->pushVisibleAll(FALSE, skip_list);
if (mViewsPushed) // Singu Note: Only hide if the setting is true.
{
LLFloaterView::skip_list_t skip_list;
skip_list.insert(LLFloaterMap::getInstance());
gFloaterView->pushVisibleAll(FALSE, skip_list);
}
if( gMorphView )
{

View File

@@ -2972,14 +2972,17 @@ void LLAppViewer::removeMarkerFile(bool leave_logout_marker)
mMarkerFile.close() ;
LLAPRFile::remove( mMarkerFileName );
}
if (mLogoutMarkerFile != NULL && !leave_logout_marker)
if (mLogoutMarkerFile != NULL)
{
LLAPRFile::remove( mLogoutMarkerFileName );
mLogoutMarkerFile = NULL;
}
else
{
LL_WARNS("MarkerFile") << "leaving markers because this is a second instance" << LL_ENDL;
if(!leave_logout_marker)
{
LLAPRFile::remove( mLogoutMarkerFileName );
mLogoutMarkerFile = NULL;
}
else
{
LL_WARNS("MarkerFile") << "leaving markers because this is a second instance" << LL_ENDL;
}
}
}

View File

@@ -221,7 +221,7 @@ void LLDrawPoolAlpha::endRenderPass( S32 pass )
LLFastTimer t(FTM_RENDER_ALPHA);
LLRenderPass::endRenderPass(pass);
if(gPipeline.canUseWindLightShaders())
if(mVertexShaderLevel > 0) //Singu Note: Unbind if shaders are enabled at all, not just windlight atmospherics..
{
LLGLSLShader::bindNoShader();
}

View File

@@ -1252,26 +1252,35 @@ void LLFloaterAvatarList::setFocusAvatar(const LLUUID& id)
}
}
// Simple function to decrement iterators, wrapping back if needed
template<typename T>
T prev_iter(const T& cur, const T& begin, const T& end)
{
return ((cur == begin) ? end : cur) - 1;
}
template<typename T>
void decrement_focus_target(T begin, T end, BOOL marked_only)
{
T iter = begin;
while(iter != end && !(*iter)->isFocused()) ++iter;
if(iter == end)
return;
T prev_iter = iter;
while(prev_iter != begin)
for (T iter = begin; iter != end; ++iter)
{
const LLAvatarListEntry& entry = *((--prev_iter)->get());
if(entry.isInList() && (entry.isMarked() || !marked_only) && gAgentCamera.lookAtObject(entry.getID(), false))
LLAvatarListEntry& old = *(iter->get());
if (!old.isFocused()) continue;
for (T prev = prev_iter(iter, begin, end); prev != iter; prev = prev_iter(prev, begin, end))
{
(*iter)->setFocus(FALSE);
(*prev_iter)->setFocus(TRUE);
gAgentCamera.lookAtObject((*prev_iter)->getID(), false);
return;
LLAvatarListEntry& entry = *(prev->get());
if (!entry.isInList()) continue;
if (marked_only && !entry.isMarked()) continue;
if (gAgentCamera.lookAtObject(entry.getID(), false))
{
old.setFocus(false);
entry.setFocus(true);
return;
}
}
// Nothing else to focus
break;
}
gAgentCamera.lookAtObject((*iter)->getID(), false);
}
void LLFloaterAvatarList::focusOnPrev(BOOL marked_only)

View File

@@ -418,6 +418,7 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id)
std::string fullname;
BOOL have_name = LLAvatarNameCache::getPNSName(agent_id, fullname);
if (!have_name) gCacheName->getFullName(agent_id, fullname);
LLSD element;
element["id"] = agent_id;
@@ -426,9 +427,11 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id)
friend_column["value"] = fullname;
friend_column["font"] = "SANSSERIF";
friend_column["font-style"] = "NORMAL";
/* Singu TODO: Liru will fix this up to actually work later
static const LLCachedControl<LLColor4> sDefaultColor(gColors, "DefaultListText");
static const LLCachedControl<LLColor4> sMutedColor("AscentMutedColor");
friend_column["color"] = ll_sd_from_color4(LLAvatarActions::isBlocked(agent_id) ? sMutedColor : sDefaultColor);
friend_column["color"] = LLAvatarActions::isBlocked(agent_id) ? sMutedColor : sDefaultColor;
*/
LLSD& online_status_column = element["columns"][LIST_ONLINE_STATUS];
online_status_column["column"] = "icon_online_status";
@@ -503,6 +506,7 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh
std::string fullname;
BOOL have_name = LLAvatarNameCache::getPNSName(agent_id, fullname);
if (!have_name) gCacheName->getFullName(agent_id, fullname);
// Name of the status icon to use
std::string statusIcon;

View File

@@ -4275,7 +4275,7 @@ void LLModelPreview::updateStatusMessages()
std::string img = lod_status_image[upload_status[lod]];
LLIconCtrl* icon = mFMP->getChild<LLIconCtrl>(lod_icon_name[lod]);
icon->setVisible(true);
icon->setImage(img);
icon->setValue(img);
if (upload_status[lod] >= 2)
{
@@ -4286,7 +4286,7 @@ void LLModelPreview::updateStatusMessages()
{
mFMP->childSetText("lod_status_message_text", mFMP->getString(message));
icon = mFMP->getChild<LLIconCtrl>("lod_status_message_icon");
icon->setImage(img);
icon->setValue(img);
}
updateLodControls(lod);

View File

@@ -163,7 +163,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
{
icon = new LLIconCtrl(std::string("icon"),
LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH),
group_insignia);
group_insignia.asString());
}
else
{

View File

@@ -1390,7 +1390,7 @@ void LLFloaterIMPanel::sendTypingState(bool typing)
return;
// Don't want to send typing indicators to multiple people, potentially too
// much network traffic. Only send in person-to-person IMs.
if (mSessionType == P2P_SESSION) return;
if (mSessionType != P2P_SESSION) return;
std::string name;
gAgent.buildFullname(name);

View File

@@ -293,7 +293,7 @@ void LLMediaRemoteCtrl::enableMediaButtons()
mMusicIcon->setColor(music_icon_color);
if(!media_icon_name.empty())
{
media_icon->setImage(media_icon_name);
media_icon->setValue(media_icon_name);
}
media_play_btn->setEnabled(play_media_enabled);

View File

@@ -266,7 +266,7 @@ public:
~LLMeshLODResponder()
{
if (!LLApp::isQuitting())
if (!LLApp::isExiting())
{
if (!mProcessed)
{

View File

@@ -310,7 +310,7 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
inv_item->getFlags(),
item_is_multi );
mCreateInventoryIcon->setImage(icon_name);
mCreateInventoryIcon->setValue(icon_name);
mCreateInventoryIcon->setVisible(TRUE);
std::stringstream ss;
@@ -541,7 +541,7 @@ void LLPanelGroupNotices::showNotice(const std::string& subject,
std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType,
LLInventoryType::IT_TEXTURE);
mViewInventoryIcon->setImage(icon_name);
mViewInventoryIcon->setValue(icon_name);
mViewInventoryIcon->setVisible(TRUE);
std::stringstream ss;

View File

@@ -118,12 +118,7 @@ LLPanelNetwork::~LLPanelNetwork()
void LLPanelNetwork::apply()
{
U32 cache_size = (U32)childGetValue("cache_size").asInteger();
if (gSavedSettings.getU32("CacheSize") != cache_size)
{
onClickClearCache(this);
gSavedSettings.setU32("CacheSize", cache_size);
}
gSavedSettings.setU32("CacheSize", childGetValue("cache_size").asInteger());
gSavedSettings.setF32("ThrottleBandwidthKBPS", childGetValue("max_bandwidth").asReal());
gSavedSettings.setF32("HTTPThrottleBandwidth", childGetValue("tex_bandwidth").asReal());
gSavedSettings.setBOOL("ImagePipelineUseHTTP", childGetValue("http_textures"));

View File

@@ -51,6 +51,8 @@ const S32 TEXTURE_CACHE_ENTRY_SIZE = FIRST_PACKET_SIZE;//1024;
const F32 TEXTURE_CACHE_PURGE_AMOUNT = .20f; // % amount to reduce the cache by when it exceeds its limit
const F32 TEXTURE_CACHE_LRU_SIZE = .10f; // % amount for LRU list (low overhead to regenerate)
static std::queue<LLUUID> sgDelayedPurgeQueue;
class LLTextureCacheWorker : public LLWorkerClass
{
friend class LLTextureCache;
@@ -1541,6 +1543,20 @@ void LLTextureCache::purgeAllTextures(bool purge_directories)
llinfos << "The entire texture cache is cleared." << llendl;
}
void LLTextureCache::performDelayedPurge()
{
LLMutexLock lock(&mHeaderMutex);
while(!sgDelayedPurgeQueue.empty())
{
removeFromCache(sgDelayedPurgeQueue.front());
sgDelayedPurgeQueue.pop();
if (mTexturesSizeTotal < sCacheMaxTexturesSize)
{
break;
}
}
}
void LLTextureCache::purgeTextures(bool validate)
{
if (mReadOnly)
@@ -1558,6 +1574,9 @@ void LLTextureCache::purgeTextures(bool validate)
llinfos << "TEXTURE CACHE: Purging." << llendl;
std::queue<LLUUID> empty;
std::swap(sgDelayedPurgeQueue, empty);
// Read the entries list
std::vector<Entry> entries;
U32 num_entries = openAndReadEntries(entries);
@@ -1567,8 +1586,8 @@ void LLTextureCache::purgeTextures(bool validate)
}
// Use mTexturesSizeMap to collect UUIDs of textures with bodies
typedef std::set<std::pair<U32,S32> > time_idx_set_t;
std::set<std::pair<U32,S32> > time_idx_set;
typedef std::vector<std::pair<U32,S32> > time_idx_set_t;
time_idx_set_t time_idx_set;
for (size_map_t::iterator iter1 = mTexturesSizeMap.begin();
iter1 != mTexturesSizeMap.end(); ++iter1)
{
@@ -1578,7 +1597,7 @@ void LLTextureCache::purgeTextures(bool validate)
if (iter2 != mHeaderIDMap.end())
{
S32 idx = iter2->second;
time_idx_set.insert(std::make_pair(entries[idx].mTime, idx));
time_idx_set.push_back(std::make_pair(entries[idx].mTime, idx));
// llinfos << "TIME: " << entries[idx].mTime << " TEX: " << entries[idx].mID << " IDX: " << idx << " Size: " << entries[idx].mImageSize << llendl;
}
else
@@ -1587,6 +1606,8 @@ void LLTextureCache::purgeTextures(bool validate)
}
}
}
std::sort(time_idx_set.begin(), time_idx_set.end());
// Validate 1/256th of the files on startup
U32 validate_idx = 0;
@@ -1637,7 +1658,14 @@ void LLTextureCache::purgeTextures(bool validate)
purge_count++;
LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL;
cache_size -= entries[idx].mBodySize;
removeEntry(idx, entries[idx], filename) ;
if(validate)
{
removeEntry(idx, entries[idx], filename);
}
else
{
sgDelayedPurgeQueue.push(entries[idx].mID);
}
}
}
@@ -1791,7 +1819,7 @@ LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 prio
delete responder;
return LLWorkerThread::nullHandle();
}
if (mDoPurge)
if (sgDelayedPurgeQueue.empty() && mDoPurge)
{
// NOTE: This may cause an occasional hiccup,
// but it really needs to be done on the control thread
@@ -1799,6 +1827,7 @@ LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 prio
purgeTextures(false);
mDoPurge = FALSE;
}
performDelayedPurge();
LLMutexLock lock(&mWorkersMutex);
LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, priority, id,
data, datasize, 0,

View File

@@ -146,6 +146,7 @@ private:
void setDirNames(ELLPath location);
void readHeaderCache();
void clearCorruptedCache();
void performDelayedPurge();
void purgeAllTextures(bool purge_directories);
void purgeTextures(bool validate);
LLAPRFile* openHeaderEntriesFile(bool readonly, S32 offset);

View File

@@ -94,10 +94,10 @@ void LLViewChildren::setBadge(const std::string& id, Badge badge, bool visible)
switch (badge)
{
default:
case BADGE_OK: child->setImage(std::string("badge_ok.j2c")); break;
case BADGE_NOTE: child->setImage(std::string("badge_note.j2c")); break;
case BADGE_WARN: child->setImage(std::string("badge_warn.j2c")); break;
case BADGE_ERROR: child->setImage(std::string("badge_error.j2c")); break;
case BADGE_OK: child->setValue(std::string("badge_ok.j2c")); break;
case BADGE_NOTE: child->setValue(std::string("badge_note.j2c")); break;
case BADGE_WARN: child->setValue(std::string("badge_warn.j2c")); break;
case BADGE_ERROR: child->setValue(std::string("badge_error.j2c")); break;
}
}
}

View File

@@ -693,6 +693,7 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleRenderDeferredChanged, _2));
gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderDeferredSSAO")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("SHRenderSSAOResolutionScale")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));
gSavedSettings.getControl("RenderDepthOfField")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderPerformanceTest")->getSignal()->connect(boost::bind(&handleRenderPerfTestChanged, _2));
gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _2));

View File

@@ -5287,10 +5287,19 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
}
// Don't play sounds from gestures if they are not enabled.
if (object_id == owner_id && !gSavedSettings.getBOOL("EnableGestureSounds"))
if (object_id == owner_id)
{
// Don't mute own gestures, if they're not muted.
if (owner_id != gAgentID || !gSavedSettings.getBOOL("EnableGestureSoundsSelf"))
if (!gSavedSettings.getBOOL("EnableGestureSounds"))
{
// Don't mute own gestures, if they're not muted.
if (owner_id != gAgentID || !gSavedSettings.getBOOL("EnableGestureSoundsSelf"))
return;
}
}
else if (!gSavedSettings.getBOOL("EnableNongestureSounds"))
{
// Don't mute own non-gestures, if they're not muted.
if (owner_id != gAgentID || !gSavedSettings.getBOOL("EnableNongestureSoundsSelf"))
return;
}

View File

@@ -206,6 +206,8 @@ LLGLSLShader gDeferredLightProgram(LLViewerShaderMgr::SHADER_DEFERRED);
LLGLSLShaderArray<LLViewerShaderMgr::SHADER_DEFERRED> gDeferredMultiLightProgram[16];
LLGLSLShader gDeferredSpotLightProgram(LLViewerShaderMgr::SHADER_DEFERRED); //Not in mShaderList
LLGLSLShader gDeferredMultiSpotLightProgram(LLViewerShaderMgr::SHADER_DEFERRED); //Not in mShaderList
LLGLSLShader gDeferredSSAOProgram(LLViewerShaderMgr::SHADER_DEFERRED);
LLGLSLShader gDeferredDownsampleDepthNearestProgram(LLViewerShaderMgr::SHADER_DEFERRED);
LLGLSLShader gDeferredSunProgram(LLViewerShaderMgr::SHADER_DEFERRED);
LLGLSLShader gDeferredBlurLightProgram(LLViewerShaderMgr::SHADER_DEFERRED);
LLGLSLShader gDeferredSoftenProgram(LLViewerShaderMgr::SHADER_DEFERRED);
@@ -1336,6 +1338,29 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
success = gDeferredSunProgram.createShader(NULL, NULL);
}
if(gSavedSettings.getBOOL("RenderDeferredSSAO"))
{
if (success)
{
gDeferredSSAOProgram.mName = "Deferred Ambient Occlusion Shader";
gDeferredSSAOProgram.mShaderFiles.clear();
gDeferredSSAOProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredSSAOProgram.mShaderFiles.push_back(make_pair("deferred/SSAOF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSSAOProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredSSAOProgram.createShader(NULL, NULL);
}
if (success)
{
gDeferredDownsampleDepthNearestProgram.mName = "Deferred Nearest Downsample Depth Shader";
gDeferredDownsampleDepthNearestProgram.mShaderFiles.clear();
gDeferredDownsampleDepthNearestProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredDownsampleDepthNearestProgram.mShaderFiles.push_back(make_pair("deferred/downsampleDepthNearestF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredDownsampleDepthNearestProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredDownsampleDepthNearestProgram.createShader(NULL, NULL);
}
}
if (success)
{
gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader";

View File

@@ -313,6 +313,8 @@ extern LLGLSLShaderArray<LLViewerShaderMgr::SHADER_DEFERRED> gDeferredMultiLig
extern LLGLSLShader gDeferredSpotLightProgram;
extern LLGLSLShader gDeferredMultiSpotLightProgram;
extern LLGLSLShader gDeferredSunProgram;
extern LLGLSLShader gDeferredSSAOProgram;
extern LLGLSLShader gDeferredDownsampleDepthNearestProgram;
extern LLGLSLShader gDeferredBlurLightProgram;
extern LLGLSLShader gDeferredAvatarProgram;
extern LLGLSLShader gDeferredSoftenProgram;

View File

@@ -1270,7 +1270,7 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
mNeedsCreateTexture = FALSE;
if (mRawImage.isNull())
{
llerrs << "LLViewerTexture trying to create texture with no Raw Image" << llendl;
llwarns << "LLViewerTexture trying to create texture with no Raw Image" << llendl;
}
// llinfos << llformat("IMAGE Creating (%d) [%d x %d] Bytes: %d ",
// mRawDiscardLevel,
@@ -1712,7 +1712,7 @@ bool LLViewerFetchedTexture::updateFetch()
}
if (mIsMissingAsset)
{
llassert_always(!mHasFetcher);
llassert(!mHasFetcher);
return false; // skip
}
if (!mLoadedCallbackList.empty() && mRawImage.notNull())
@@ -1942,8 +1942,8 @@ bool LLViewerFetchedTexture::updateFetch()
mHasFetcher = FALSE;
}
}
llassert_always(mRawImage.notNull() || (!mNeedsCreateTexture && !mIsRawImageValid));
llassert(mRawImage.notNull() || (!mNeedsCreateTexture && !mIsRawImageValid));
return mIsFetching ? true : false;
}

View File

@@ -154,7 +154,7 @@ void LLVoiceRemoteCtrl::draw()
LLIconCtrl* icon = mVoiceVolIcon;
if (icon)
{
icon->setImage(talk_blip_image);
icon->setValue(talk_blip_image);
}
LLFloater* voice_floater = LLFloaterChatterBox::getInstance()->getCurrentVoiceFloater();
@@ -185,7 +185,7 @@ void LLVoiceRemoteCtrl::draw()
LLIconCtrl* voice_channel_icon = findChild<LLIconCtrl>("voice_channel_icon");
if (voice_channel_icon && voice_floater)
{
voice_channel_icon->setImage(voice_floater->getString("voice_icon"));
voice_channel_icon->setValue(voice_floater->getString("voice_icon"));
}
if (voice_channel_bg)

View File

@@ -207,11 +207,11 @@ LLFastTimer::DeclareTimer FTM_RENDER_DEFERRED("Deferred Shading");
static LLFastTimer::DeclareTimer FTM_STATESORT_DRAWABLE("Sort Drawables");
static LLFastTimer::DeclareTimer FTM_STATESORT_POSTSORT("Post Sort");
static LLStaticHashedString sTint("tint");
static LLStaticHashedString sAmbiance("ambiance");
static LLStaticHashedString sAlphaScale("alpha_scale");
//static LLStaticHashedString sTint("tint");
//static LLStaticHashedString sAmbiance("ambiance");
//static LLStaticHashedString sAlphaScale("alpha_scale");
static LLStaticHashedString sNormMat("norm_mat");
static LLStaticHashedString sOffset("offset");
//static LLStaticHashedString sOffset("offset");
static LLStaticHashedString sScreenRes("screenRes");
static LLStaticHashedString sDelta("delta");
static LLStaticHashedString sDistFactor("dist_factor");
@@ -796,12 +796,15 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
mSampleBuffer.release();
mScreen.release();
mDeferredDownsampledDepth.release();
if (LLPipeline::sRenderDeferred)
{
S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail");
BOOL ssao = gSavedSettings.getBOOL("RenderDeferredSSAO");
BOOL RenderDepthOfField = gSavedSettings.getBOOL("RenderDepthOfField");
static const LLCachedControl<S32> shadow_detail("RenderShadowDetail",0);
static const LLCachedControl<bool> ssao ("RenderDeferredSSAO",false);
static const LLCachedControl<bool> RenderDepthOfField("RenderDepthOfField",false);
static const LLCachedControl<F32> RenderShadowResolutionScale("RenderShadowResolutionScale",1.0f);
static const LLCachedControl<F32> RenderSSAOResolutionScale("SHRenderSSAOResolutionScale",.5f);
const U32 occlusion_divisor = 3;
@@ -835,6 +838,11 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
if (shadow_detail > 0 || ssao || RenderDepthOfField || samples > 0)
{ //only need mDeferredLight for shadows OR ssao OR dof OR fxaa
if (!mDeferredLight.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
if(ssao)
{
F32 scale = llclamp(RenderSSAOResolutionScale.get(),.01f,1.f);
if( scale < 1.f && !mDeferredDownsampledDepth.allocate(llceil(F32(resX)*scale), llceil(F32(resY)*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE) ) return false;
}
}
else
{
@@ -901,6 +909,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
mScreen.release();
mDeferredScreen.release(); //make sure to release any render targets that share a depth buffer with mDeferredScreen first
mDeferredDepth.release();
mDeferredDownsampledDepth.release();
mOcclusionDepth.release();
if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
@@ -1022,6 +1031,7 @@ void LLPipeline::releaseScreenBuffers()
mPhysicsDisplay.release();
mDeferredScreen.release();
mDeferredDepth.release();
mDeferredDownsampledDepth.release();
mDeferredLight.release();
mOcclusionDepth.release();
@@ -7648,6 +7658,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n
static const LLCachedControl<F32> RenderSpotShadowBias("RenderSpotShadowBias",0.f);
static const LLCachedControl<F32> RenderEdgeDepthCutoff("RenderEdgeDepthCutoff",.01f);
static const LLCachedControl<F32> RenderEdgeNormCutoff("RenderEdgeNormCutoff",.25f);
static const LLCachedControl<F32> RenderSSAOResolutionScale("SHRenderSSAOResolutionScale",.5f);
if (noise_map == 0xFFFFFFFF)
{
@@ -7677,10 +7688,21 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
}
S32 channel2 = shader.enableTexture(LLShaderMgr::DEFERRED_DOWNSAMPLED_DEPTH, mDeferredDepth.getUsage());
channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, mDeferredDepth.getUsage());
if (channel > -1)
if (channel > -1 || channel2 >= -1)
{
gGL.getTexUnit(channel)->bind(&mDeferredDepth, TRUE);
if(channel > -1)
gGL.getTexUnit(channel)->bind(&mDeferredDepth, TRUE);
if(channel2 > -1)
{
F32 scale = llclamp(RenderSSAOResolutionScale.get(),.01f,1.f);
if(scale < 1.f)
gGL.getTexUnit(channel2)->bind(&mDeferredDownsampledDepth, TRUE);
else
gGL.getTexUnit(channel2)->bind(&mDeferredDepth, TRUE); //Bind full res depth instead, as downsampling is disabled if scale == 1.f
}
//gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
stop_glerror();
@@ -7774,21 +7796,24 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n
stop_glerror();
F32 mat[16*6];
for (U32 i = 0; i < 16; i++)
if(shader.getUniformLocation(LLShaderMgr::DEFERRED_SHADOW_MATRIX) >= 0)
{
mat[i] = mSunShadowMatrix[0].m[i];
mat[i+16] = mSunShadowMatrix[1].m[i];
mat[i+32] = mSunShadowMatrix[2].m[i];
mat[i+48] = mSunShadowMatrix[3].m[i];
mat[i+64] = mSunShadowMatrix[4].m[i];
mat[i+80] = mSunShadowMatrix[5].m[i];
F32 mat[16*6];
for (U32 i = 0; i < 16; i++)
{
mat[i] = mSunShadowMatrix[0].m[i];
mat[i+16] = mSunShadowMatrix[1].m[i];
mat[i+32] = mSunShadowMatrix[2].m[i];
mat[i+48] = mSunShadowMatrix[3].m[i];
mat[i+64] = mSunShadowMatrix[4].m[i];
mat[i+80] = mSunShadowMatrix[5].m[i];
}
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, FALSE, mat);
stop_glerror();
}
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_SHADOW_MATRIX, 6, FALSE, mat);
stop_glerror();
channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
if (channel > -1)
{
@@ -7844,6 +7869,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n
glh::matrix4f norm_mat = glh_get_current_modelview().inverse().transpose();
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m);
}
shader.uniform1f(LLShaderMgr::DEFERRED_DOWNSAMPLED_DEPTH_SCALE, llclamp(RenderSSAOResolutionScale.get(),.01f,1.f));
}
static LLFastTimer::DeclareTimer FTM_GI_TRACE("Trace");
@@ -7867,6 +7894,7 @@ void LLPipeline::renderDeferredLighting()
static const LLCachedControl<U32> RenderFSAASamples("RenderFSAASamples",0);
static const LLCachedControl<bool> RenderDeferredSSAO("RenderDeferredSSAO",false);
static const LLCachedControl<F32> RenderSSAOResolutionScale("SHRenderSSAOResolutionScale",.5f);
static const LLCachedControl<S32> RenderShadowDetail("RenderShadowDetail",0);
static const LLCachedControl<LLVector3> RenderShadowGaussian("RenderShadowGaussian",LLVector3(3.f,2.f,0.f));
static const LLCachedControl<F32> RenderShadowBlurSize("RenderShadowBlurSize",1.4f);
@@ -7933,6 +7961,54 @@ void LLPipeline::renderDeferredLighting()
gGL.pushMatrix();
gGL.loadIdentity();
if (RenderDeferredSSAO)
{
F32 ssao_scale = llclamp(RenderSSAOResolutionScale.get(),.01f,1.f);
LLGLDisable blend(GL_BLEND);
//Downsample with fullscreen quad. GL_NEAREST
if(ssao_scale < 1.f)
{
mDeferredDownsampledDepth.bindTarget();
mDeferredDownsampledDepth.clear(GL_DEPTH_BUFFER_BIT);
bindDeferredShader(gDeferredDownsampleDepthNearestProgram, 0);
gDeferredDownsampleDepthNearestProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredDownsampledDepth.getWidth()/ssao_scale, mDeferredDownsampledDepth.getHeight()/ssao_scale);
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
{
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
stop_glerror();
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
mDeferredDownsampledDepth.flush();
unbindDeferredShader(gDeferredDownsampleDepthNearestProgram);
}
//Run SSAO
{
mScreen.bindTarget();
glClearColor(1,1,1,1);
mScreen.clear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
bindDeferredShader(gDeferredSSAOProgram, 0);
if(ssao_scale < 1.f)
{
glViewport(0,0,mDeferredDownsampledDepth.getWidth(),mDeferredDownsampledDepth.getHeight());
gDeferredSSAOProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredDownsampledDepth.getWidth()/ssao_scale, mDeferredDownsampledDepth.getHeight()/ssao_scale);
}
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
{
LLGLDepthTest depth(GL_FALSE);
stop_glerror();
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
mScreen.flush();
unbindDeferredShader(gDeferredSSAOProgram);
}
}
if (RenderDeferredSSAO || RenderShadowDetail > 0)
{
mDeferredLight.bindTarget();
@@ -7944,7 +8020,7 @@ void LLPipeline::renderDeferredLighting()
mDeferredLight.clear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose();
/*glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose();
const U32 slice = 32;
F32 offset[slice*3];
@@ -7978,8 +8054,18 @@ void LLPipeline::renderDeferredLighting()
}
}
gDeferredSunProgram.uniform3fv(sOffset, slice, offset);
gDeferredSunProgram.uniform3fv(sOffset, slice, offset);*/
gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight());
//Enable bilinear filtering, as the screen tex resolution may not match current framebuffer resolution. Eg, half-res SSAO
// diffuse map should only be found if the sun shader is the SSAO variant.
S32 channel = gDeferredSunProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
if (channel > -1)
{
mScreen.bindTexture(0,channel);
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
}
{
LLGLDisable blend(GL_BLEND);
@@ -7988,6 +8074,11 @@ void LLPipeline::renderDeferredLighting()
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
if (channel > -1)
{
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
}
unbindDeferredShader(gDeferredSunProgram);
}
@@ -8106,6 +8197,9 @@ void LLPipeline::renderDeferredLighting()
gPipeline.pushRenderTypeMask();
gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY,
#if ENABLE_CLASSIC_CLOUDS
LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS,
#endif
LLPipeline::RENDER_TYPE_WL_CLOUDS,
LLPipeline::RENDER_TYPE_WL_SKY,
LLPipeline::END_RENDER_TYPES);
@@ -8500,6 +8594,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
static const LLCachedControl<U32> RenderFSAASamples("RenderFSAASamples",0);
static const LLCachedControl<bool> RenderDeferredSSAO("RenderDeferredSSAO",false);
static const LLCachedControl<F32> RenderSSAOResolutionScale("SHRenderSSAOResolutionScale",.5f);
static const LLCachedControl<S32> RenderShadowDetail("RenderShadowDetail",0);
static const LLCachedControl<LLVector3> RenderShadowGaussian("RenderShadowGaussian",LLVector3(3.f,2.f,0.f));
static const LLCachedControl<F32> RenderShadowBlurSize("RenderShadowBlurSize",1.4f);
@@ -8560,6 +8655,54 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
gGL.pushMatrix();
gGL.loadIdentity();
if (RenderDeferredSSAO)
{
F32 ssao_scale = llclamp(RenderSSAOResolutionScale.get(),.01f,1.f);
LLGLDisable blend(GL_BLEND);
//Downsample with fullscreen quad. GL_NEAREST
if(ssao_scale < 1.f)
{
mDeferredDownsampledDepth.bindTarget();
mDeferredDownsampledDepth.clear(GL_DEPTH_BUFFER_BIT);
bindDeferredShader(gDeferredDownsampleDepthNearestProgram, 0);
gDeferredDownsampleDepthNearestProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredDownsampledDepth.getWidth()/ssao_scale, mDeferredDownsampledDepth.getHeight()/ssao_scale);
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
{
LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
stop_glerror();
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
mDeferredDownsampledDepth.flush();
unbindDeferredShader(gDeferredDownsampleDepthNearestProgram);
}
//Run SSAO
{
mScreen.bindTarget();
glClearColor(1,1,1,1);
mScreen.clear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
bindDeferredShader(gDeferredSSAOProgram, 0);
if(ssao_scale < 1.f)
{
glViewport(0,0,mDeferredDownsampledDepth.getWidth(),mDeferredDownsampledDepth.getHeight());
gDeferredSSAOProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredDownsampledDepth.getWidth()/ssao_scale, mDeferredDownsampledDepth.getHeight()/ssao_scale);
}
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
{
LLGLDepthTest depth(GL_FALSE);
stop_glerror();
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
mScreen.flush();
unbindDeferredShader(gDeferredSSAOProgram);
}
}
if (RenderDeferredSSAO || RenderShadowDetail > 0)
{
mDeferredLight.bindTarget();
@@ -8571,7 +8714,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
mDeferredLight.clear(GL_COLOR_BUFFER_BIT);
glClearColor(0,0,0,0);
glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose();
/*glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose();
const U32 slice = 32;
F32 offset[slice*3];
@@ -8590,9 +8733,18 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
}
}
gDeferredSunProgram.uniform3fv(LLShaderMgr::DEFERRED_SHADOW_OFFSET, slice, offset);
gDeferredSunProgram.uniform3fv(LLShaderMgr::DEFERRED_SHADOW_OFFSET, slice, offset);*/
gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight());
//Enable bilinear filtering, as the screen tex resolution may not match current framebuffer resolution. Eg, half-res SSAO
// diffuse map should only be found if the sun shader is the SSAO variant.
S32 channel = gDeferredSunProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
if (channel > -1)
{
mScreen.bindTexture(0,channel);
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
}
{
LLGLDisable blend(GL_BLEND);
LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
@@ -8600,6 +8752,11 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
stop_glerror();
}
if (channel > -1)
{
gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
}
unbindDeferredShader(gDeferredSunProgram);
}
@@ -8656,7 +8813,10 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
gPipeline.pushRenderTypeMask();
gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY,
#if ENABLE_CLASSIC_CLOUDS
LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS,
#endif
LLPipeline::RENDER_TYPE_WL_CLOUDS,
LLPipeline::RENDER_TYPE_WL_SKY,
LLPipeline::END_RENDER_TYPES);

View File

@@ -615,6 +615,7 @@ public:
LLRenderTarget mFXAABuffer;
LLRenderTarget mEdgeMap;
LLRenderTarget mDeferredDepth;
LLRenderTarget mDeferredDownsampledDepth;
LLRenderTarget mOcclusionDepth;
LLRenderTarget mDeferredLight;
LLMultisampleBuffer mSampleBuffer;

View File

@@ -5,6 +5,10 @@
<slider_bar bottom="-26" follows="top" height="16" increment="0.25" initial_val="2" left="276" max_val="15" min_val="0" name="mouse_sensitivity" width="128"/>
<check_box bottom_delta="-18" follows="top" height="16" label="Invert Mouse" left="148" name="invert_mouse"/>
<check_box bottom_delta="-18" follows="top" height="16" initial_value="false" label="Show Avatar in Mouselook" name="first_person_avatar_visible"/>
<text bottom_delta="-18" follows="top" height="16" name="UI Hidden in mouselook:">UI Hidden in mouselook:</text>
<check_box bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesFloaters" name="mouselook_hides_floaters" label="Floaters"/>
<check_box left_delta="80" bottom_delta="0" follows="top" height="16" control_name="LiruMouselookHidesNotices" name="mouselook_hides_notices" label="Notices"/>
<check_box left="148" bottom_delta="-18" follows="top" height="16" control_name="LiruMouselookHidesMenubar" name="mouselook_hides_menubar" label="Menubar"/>
<text bottom_delta="-30" follows="top" height="10" left="10" name=" Movement Options:">Movement Options:</text>
<check_box bottom_delta="-6" follows="top" height="16" label="Fly/land on holding up/down" left="148" name="automatic_fly"/>
<check_box bottom_delta="-18" follows="top" height="16" label="Allow crouch toggle by holding shift" name="crouch_toggle" control_name="SGShiftCrouchToggle"/>
@@ -13,7 +17,8 @@
<slider bottom_delta="-6" can_edit_text="true" decimal_digits="2" follows="top" width="128" height="16" increment=".025" initial_val="1.57" left="276" max_val="2.97" min_val=".17" name="camera_fov" value="60"/>
<text bottom_delta="-14" follows="top" height="10" left="148" name="Camera Follow Distance:" width="128">Camera Follow Distance:</text>
<slider bottom_delta="-6" can_edit_text="true" control_name="CameraOffsetScale" decimal_digits="2" follows="top" height="16" increment=".025" initial_val="1" left="276" min_val=".5" max_val="3" name="camera_offset_scale" value="1" width="128"/>
<check_box bottom_delta="-24" follows="top" initial_value="false" label="Automatic Edit Camera Movement" left="148" name="edit_camera_movement" tool_tip="Use automatic camera positioning when entering and exiting edit mode"/>
<check_box bottom_delta="-20" follows="top" left="148" control_name="SinguOffsetScrollKeys" label="Scrolling with control and/or shift held adjusts camera position" name="scroll_keys"/>
<check_box bottom_delta="-18" follows="top" label="Automatic Edit Camera Movement" name="edit_camera_movement" tool_tip="Use automatic camera positioning when entering and exiting edit mode"/>
<check_box bottom_delta="-18" follows="top" height="16" initial_value="false" label="Automatic Appearance Camera Movement" left="148" name="appearance_camera_movement" tool_tip="Use automatic camera positioning while in edit mode"/>
<check_box bottom_delta="-18" follows="top" height="16" initial_value="false" label="Unsit Avatar on Camera Reset" left="148" name="unsit_on_camera_reset" tool_tip="Stand up automatically when you press Esc and the camera switches to third person mode"/>
<check_box bottom_delta="-18" follows="top" height="16" label="Disable Camera Constraints" left="148" control_name="DisableCameraConstraints" name="DisableCameraConstraints" tool_tip="Prevent the camera from automatically zooming when you approach walls, objects, etc., too closely."/>