Merge branch 'master' of git://github.com/Shyotl/SingularityViewer into Release
Fixed pipeline conflict over Mika/Shyotl variable naming differences.
This commit is contained in:
@@ -53,8 +53,6 @@
|
||||
#pragma warning (disable:4702)
|
||||
#endif
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
using namespace LLAvatarAppearanceDefines;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -212,8 +210,9 @@ void LLAvatarAppearance::initInstance()
|
||||
mRoot = createAvatarJoint();
|
||||
mRoot->setName( "mRoot" );
|
||||
|
||||
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().begin();
|
||||
iter != LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().end();
|
||||
const auto& mesh_entries = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries();
|
||||
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = mesh_entries.begin();
|
||||
iter != mesh_entries.end();
|
||||
++iter)
|
||||
{
|
||||
const EMeshIndex mesh_index = iter->first;
|
||||
@@ -230,7 +229,7 @@ void LLAvatarAppearance::initInstance()
|
||||
for (U32 lod = 0; lod < mesh_dict->mLOD; lod++)
|
||||
{
|
||||
LLAvatarJointMesh* mesh = createAvatarJointMesh();
|
||||
std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast<std::string>(lod);
|
||||
std::string mesh_name = "m" + mesh_dict->mName + std::to_string(lod);
|
||||
// We pre-pended an m - need to capitalize first character for camelCase
|
||||
mesh_name[1] = toupper(mesh_name[1]);
|
||||
mesh->setName(mesh_name);
|
||||
@@ -258,8 +257,8 @@ void LLAvatarAppearance::initInstance()
|
||||
//-------------------------------------------------------------------------
|
||||
// associate baked textures with meshes
|
||||
//-------------------------------------------------------------------------
|
||||
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().begin();
|
||||
iter != LLAvatarAppearanceDictionary::getInstance()->getMeshEntries().end();
|
||||
for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = mesh_entries.begin();
|
||||
iter != mesh_entries.end();
|
||||
++iter)
|
||||
{
|
||||
const EMeshIndex mesh_index = iter->first;
|
||||
@@ -298,7 +297,7 @@ LLAvatarAppearance::~LLAvatarAppearance()
|
||||
mBakedTextureDatas[i].mJointMeshes.clear();
|
||||
|
||||
for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin();
|
||||
iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++)
|
||||
iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); ++iter2)
|
||||
{
|
||||
LLMaskedMorph* masked_morph = (*iter2);
|
||||
delete masked_morph;
|
||||
@@ -383,8 +382,6 @@ void LLAvatarAppearance::initClass(const std::string& avatar_file_name_arg, cons
|
||||
root->getFastAttributeS32( wearable_definition_version_string, wearable_def_version );
|
||||
LLWearable::setCurrentDefinitionVersion( wearable_def_version );
|
||||
|
||||
std::string mesh_file_name;
|
||||
|
||||
LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" );
|
||||
if (!skeleton_node)
|
||||
{
|
||||
@@ -573,7 +570,8 @@ void LLAvatarAppearance::computeBodySize()
|
||||
{
|
||||
mBodySize = new_body_size;
|
||||
|
||||
compareJointStateMaps(mLastBodySizeState, mCurrBodySizeState);
|
||||
compareJointStateMaps(mLastBodySizeState, mCurrBodySizeState);
|
||||
bodySizeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -927,11 +925,11 @@ void LLAvatarAppearance::buildCharacter()
|
||||
//-----------------------------------------------------------------------------
|
||||
// loadAvatar()
|
||||
//-----------------------------------------------------------------------------
|
||||
//static LLFastTimer::DeclareTimer FTM_LOAD_AVATAR("Load Avatar");
|
||||
//static LLTrace::BlockTimerStatHandle FTM_LOAD_AVATAR("Load Avatar");
|
||||
|
||||
BOOL LLAvatarAppearance::loadAvatar()
|
||||
{
|
||||
// LLFastTimer t(FTM_LOAD_AVATAR);
|
||||
// LL_RECORD_BLOCK_TIME(FTM_LOAD_AVATAR);
|
||||
|
||||
// avatar_skeleton.xml
|
||||
if( !buildSkeleton(sAvatarSkeletonInfo) )
|
||||
@@ -1047,7 +1045,7 @@ BOOL LLAvatarAppearance::loadAvatar()
|
||||
addVisualParam( driver_param );
|
||||
driver_param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
|
||||
LLVisualParam*(LLAvatarAppearance::*avatar_function)(S32)const = &LLAvatarAppearance::getVisualParam;
|
||||
if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLAvatarAppearance*)this,_1 ), false))
|
||||
if( !driver_param->linkDrivenParams(std::bind(avatar_function,(LLAvatarAppearance*)this, std::placeholders::_1 ), false))
|
||||
{
|
||||
LL_WARNS() << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << LL_ENDL;
|
||||
continue;
|
||||
@@ -1222,7 +1220,7 @@ BOOL LLAvatarAppearance::loadMeshNodes()
|
||||
}
|
||||
|
||||
// Multimap insert
|
||||
mPolyMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh));
|
||||
mPolyMeshes.emplace(info->mMeshFileName, poly_mesh);
|
||||
|
||||
mesh->setMesh( poly_mesh );
|
||||
mesh->setLOD( info->mMinPixelArea );
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "llviewervisualparam.h"
|
||||
#include "llxmltree.h"
|
||||
|
||||
#include <boost/container/flat_map.hpp> // <alchemy/>
|
||||
class LLTexLayerSet;
|
||||
class LLTexGlobalColor;
|
||||
class LLTexGlobalColorInfo;
|
||||
@@ -141,7 +142,7 @@ public:
|
||||
LLVector3 mHeadOffset; // current head position
|
||||
LLAvatarJoint *mRoot;
|
||||
|
||||
typedef std::vector<std::pair<char[64], LLJoint*>> joint_map_t;
|
||||
typedef std::vector<std::pair<char[64], LLJoint*> > joint_map_t;
|
||||
joint_map_t mJointMap;
|
||||
|
||||
typedef std::map<std::string, LLVector3> joint_state_map_t;
|
||||
@@ -162,6 +163,7 @@ protected:
|
||||
static BOOL parseSkeletonFile(const std::string& filename);
|
||||
virtual void buildCharacter();
|
||||
virtual BOOL loadAvatar();
|
||||
virtual void bodySizeChanged() = 0;
|
||||
|
||||
BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num);
|
||||
BOOL allocateCharacterJoints(U32 num);
|
||||
|
||||
@@ -140,7 +140,7 @@ LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary()
|
||||
// map it to the baked texture.
|
||||
void LLAvatarAppearanceDictionary::createAssociations()
|
||||
{
|
||||
for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++)
|
||||
for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); ++iter)
|
||||
{
|
||||
const EBakedTextureIndex baked_index = (iter->first);
|
||||
const BakedEntry *dict = (iter->second);
|
||||
@@ -149,7 +149,7 @@ void LLAvatarAppearanceDictionary::createAssociations()
|
||||
// with this baked texture index.
|
||||
for (texture_vec_t::const_iterator local_texture_iter = dict->mLocalTextures.begin();
|
||||
local_texture_iter != dict->mLocalTextures.end();
|
||||
local_texture_iter++)
|
||||
++local_texture_iter)
|
||||
{
|
||||
const ETextureIndex local_texture_index = (ETextureIndex) *local_texture_iter;
|
||||
mTextures[local_texture_index]->mIsUsedByBakedTexture = true;
|
||||
@@ -222,7 +222,7 @@ ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextu
|
||||
}
|
||||
|
||||
// static
|
||||
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::string name)
|
||||
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(const std::string& name)
|
||||
{
|
||||
U8 index = 0;
|
||||
while (index < BAKED_NUM_INDICES)
|
||||
@@ -240,7 +240,7 @@ EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::stri
|
||||
}
|
||||
|
||||
// static
|
||||
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(std::string name)
|
||||
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(const std::string& name)
|
||||
{
|
||||
U8 index = 0;
|
||||
while (index < BAKED_NUM_INDICES)
|
||||
|
||||
@@ -218,8 +218,8 @@ public:
|
||||
static ETextureIndex bakedToLocalTextureIndex(EBakedTextureIndex t);
|
||||
|
||||
// find a baked texture index based on its name
|
||||
static EBakedTextureIndex findBakedByRegionName(std::string name);
|
||||
static EBakedTextureIndex findBakedByImageName(std::string name);
|
||||
static EBakedTextureIndex findBakedByRegionName(const std::string& name);
|
||||
static EBakedTextureIndex findBakedByImageName(const std::string& name);
|
||||
|
||||
// Given a texture entry, determine which wearable type owns it.
|
||||
static LLWearableType::EType getTEWearableType(ETextureIndex index);
|
||||
|
||||
@@ -189,26 +189,26 @@ BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
|
||||
iter != mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
if (!joint)
|
||||
continue;
|
||||
if (joint)
|
||||
{
|
||||
F32 jointLOD = joint->getLOD();
|
||||
|
||||
F32 jointLOD = joint->getLOD();
|
||||
|
||||
if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD)
|
||||
{
|
||||
// we've already found a joint to enable, so enable the rest as alternatives
|
||||
lod_changed |= joint->updateLOD(pixel_area, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pixel_area >= jointLOD || sDisableLOD)
|
||||
if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD)
|
||||
{
|
||||
// we've already found a joint to enable, so enable the rest as alternatives
|
||||
lod_changed |= joint->updateLOD(pixel_area, TRUE);
|
||||
found_lod = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
lod_changed |= joint->updateLOD(pixel_area, FALSE);
|
||||
if (pixel_area >= jointLOD || sDisableLOD)
|
||||
{
|
||||
lod_changed |= joint->updateLOD(pixel_area, TRUE);
|
||||
found_lod = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
lod_changed |= joint->updateLOD(pixel_area, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ void LLAvatarJoint::setMeshesToChildren()
|
||||
{
|
||||
removeAllChildren();
|
||||
for (avatar_joint_mesh_list_t::iterator iter = mMeshParts.begin();
|
||||
iter != mMeshParts.end(); iter++)
|
||||
iter != mMeshParts.end(); ++iter)
|
||||
{
|
||||
addChild((*iter));
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
||||
LLViewerVisualParamInfo::toStream(out);
|
||||
out << "driver" << "\t";
|
||||
out << mDrivenInfoList.size() << "\t";
|
||||
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
|
||||
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); ++iter)
|
||||
{
|
||||
LLDrivenEntryInfo driven = *iter;
|
||||
out << driven.mDrivenID << "\t";
|
||||
@@ -118,14 +118,18 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
||||
// used anywhere, so it's not an urgent problem.
|
||||
LL_WARNS_ONCE() << "Invalid usage of mDriverParam." << LL_ENDL;
|
||||
|
||||
if(mDriverParam && mDriverParam->getAvatarAppearance()->isSelf() &&
|
||||
mDriverParam->getAvatarAppearance()->isValid())
|
||||
if (!mDriverParam)
|
||||
return;
|
||||
const auto& avatar_appearance = mDriverParam->getAvatarAppearance();
|
||||
|
||||
if(avatar_appearance->isSelf() &&
|
||||
avatar_appearance->isValid())
|
||||
{
|
||||
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
|
||||
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); ++iter)
|
||||
{
|
||||
LLDrivenEntryInfo driven = *iter;
|
||||
LLViewerVisualParam *param =
|
||||
(LLViewerVisualParam*)mDriverParam->getAvatarAppearance()->getVisualParam(driven.mDrivenID);
|
||||
(LLViewerVisualParam*) avatar_appearance->getVisualParam(driven.mDrivenID);
|
||||
if (param)
|
||||
{
|
||||
param->getInfo()->toStream(out);
|
||||
@@ -148,7 +152,7 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "could not get parameter " << driven.mDrivenID << " from avatar "
|
||||
<< mDriverParam->getAvatarAppearance()
|
||||
<< avatar_appearance
|
||||
<< " for driver parameter " << getID() << LL_ENDL;
|
||||
}
|
||||
out << std::endl;
|
||||
@@ -232,7 +236,7 @@ void LLDriverParam::setWeight(F32 weight, bool upload_bake)
|
||||
//-------|----|-------|----|-------> driver
|
||||
// | min1 max1 max2 min2
|
||||
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
LLDrivenEntryInfo* info = driven->mInfo;
|
||||
@@ -305,7 +309,7 @@ void LLDriverParam::setWeight(F32 weight, bool upload_bake)
|
||||
F32 LLDriverParam::getTotalDistortion()
|
||||
{
|
||||
F32 sum = 0.f;
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
sum += driven->mParam->getTotalDistortion();
|
||||
@@ -320,7 +324,7 @@ const LLVector4a &LLDriverParam::getAvgDistortion()
|
||||
LLVector4a sum;
|
||||
sum.clear();
|
||||
S32 count = 0;
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
sum.add(driven->mParam->getAvgDistortion());
|
||||
@@ -335,7 +339,7 @@ const LLVector4a &LLDriverParam::getAvgDistortion()
|
||||
F32 LLDriverParam::getMaxDistortion()
|
||||
{
|
||||
F32 max = 0.f;
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
F32 param_max = driven->mParam->getMaxDistortion();
|
||||
@@ -353,7 +357,7 @@ LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)
|
||||
{
|
||||
LLVector4a sum;
|
||||
sum.clear();
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
sum.add(driven->mParam->getVertexDistortion( index, poly_mesh ));
|
||||
@@ -365,7 +369,7 @@ const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **pol
|
||||
{
|
||||
mCurrentDistortionParam = NULL;
|
||||
const LLVector4a* v = NULL;
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
v = driven->mParam->getFirstDistortion( index, poly_mesh );
|
||||
@@ -391,7 +395,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly
|
||||
entry_list_t::iterator iter;
|
||||
|
||||
// Set mDriven iteration to the right point
|
||||
for( iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
driven = &(*iter);
|
||||
if( driven->mParam == mCurrentDistortionParam )
|
||||
@@ -412,7 +416,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly
|
||||
{
|
||||
// This param is finished, so start the next param. It might not have any
|
||||
// distortions, though, so we have to loop to find the next param that does.
|
||||
for( iter++; iter != mDriven.end(); iter++ )
|
||||
for( ++iter; iter != mDriven.end(); ++iter )
|
||||
{
|
||||
driven = &(*iter);
|
||||
v = driven->mParam->getFirstDistortion( index, poly_mesh );
|
||||
@@ -448,7 +452,7 @@ void LLDriverParam::setAnimationTarget( F32 target_value, bool upload_bake )
|
||||
{
|
||||
LLVisualParam::setAnimationTarget(target_value, upload_bake);
|
||||
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
F32 driven_weight = getDrivenWeight(driven, mTargetWeight);
|
||||
@@ -466,7 +470,7 @@ void LLDriverParam::stopAnimating(bool upload_bake)
|
||||
{
|
||||
LLVisualParam::stopAnimating(upload_bake);
|
||||
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
driven->mParam->setAnimating(FALSE);
|
||||
@@ -523,7 +527,7 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
|
||||
bool needs_update = (getWearableType()==driven_type);
|
||||
|
||||
// if the driver has a driven entry for the passed-in wearable type, we need to refresh the value
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
|
||||
for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); ++iter )
|
||||
{
|
||||
LLDrivenEntry* driven = &(*iter);
|
||||
if (driven && driven->mParam && driven->mParam->getCrossWearable() && driven->mParam->getWearableType() == driven_type)
|
||||
|
||||
@@ -76,6 +76,7 @@ LLLocalTextureObject::LLLocalTextureObject(const LLLocalTextureObject& lto) :
|
||||
|
||||
LLLocalTextureObject::~LLLocalTextureObject()
|
||||
{
|
||||
delete_and_clear(mTexLayers);
|
||||
}
|
||||
|
||||
LLGLTexture* LLLocalTextureObject::getImage() const
|
||||
@@ -95,7 +96,7 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const
|
||||
|
||||
LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name)
|
||||
{
|
||||
for( tex_layer_vec_t::iterator iter = mTexLayers.begin(); iter != mTexLayers.end(); iter++)
|
||||
for( tex_layer_vec_t::iterator iter = mTexLayers.begin(); iter != mTexLayers.end(); ++iter)
|
||||
{
|
||||
LLTexLayer *layer = *iter;
|
||||
if (layer->getName().compare(name) == 0)
|
||||
@@ -196,7 +197,7 @@ BOOL LLLocalTextureObject::removeTexLayer(U32 index)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLLocalTextureObject::setID(LLUUID new_id)
|
||||
void LLLocalTextureObject::setID(const LLUUID& new_id)
|
||||
{
|
||||
mID = new_id;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable);
|
||||
BOOL removeTexLayer(U32 index);
|
||||
|
||||
void setID(LLUUID new_id);
|
||||
void setID(const LLUUID& new_id);
|
||||
void setDiscard(S32 new_discard);
|
||||
void setBakedReady(BOOL ready);
|
||||
|
||||
|
||||
@@ -307,7 +307,11 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
|
||||
//----------------------------------------------------------------
|
||||
// File Header (seek past it)
|
||||
//----------------------------------------------------------------
|
||||
fseek(fp, 24, SEEK_SET);
|
||||
if (fseek(fp, 24, SEEK_SET) != 0)
|
||||
{
|
||||
LL_ERRS() << "can't seek past header from " << fileName << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// HasWeights
|
||||
@@ -605,7 +609,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
|
||||
//-------------------------------------------------------------------------
|
||||
char morphName[64+1];
|
||||
morphName[sizeof(morphName)-1] = '\0'; // ensure nul-termination
|
||||
while(fread(&morphName, sizeof(char), 64, fp) == 64)
|
||||
while(fread(morphName, sizeof(char), 64, fp) == 64)
|
||||
{
|
||||
if (!strcmp(morphName, "End Morphs"))
|
||||
{
|
||||
@@ -629,10 +633,6 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
|
||||
mMorphData.insert(clone_morph_param_cleavage(morph_data,
|
||||
.75f,
|
||||
"Breast_Physics_LeftRight_Driven"));
|
||||
}
|
||||
|
||||
if (!strcmp(morphName, "Breast_Female_Cleavage"))
|
||||
{
|
||||
mMorphData.insert(clone_morph_param_duplicate(morph_data,
|
||||
"Breast_Physics_InOut_Driven"));
|
||||
}
|
||||
@@ -668,9 +668,6 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
|
||||
mMorphData.insert(clone_morph_param_direction(morph_data,
|
||||
LLVector3(0,0,0.05f),
|
||||
"Butt_Physics_UpDown_Driven"));
|
||||
}
|
||||
if (!strcmp(morphName, "Small_Butt"))
|
||||
{
|
||||
mMorphData.insert(clone_morph_param_direction(morph_data,
|
||||
LLVector3(0,0.03f,0),
|
||||
"Butt_Physics_LeftRight_Driven"));
|
||||
|
||||
@@ -109,7 +109,7 @@ LLPolyMorphData::~LLPolyMorphData()
|
||||
BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
|
||||
{
|
||||
S32 numVertices;
|
||||
S32 numRead;
|
||||
size_t numRead; // <alchemy/>
|
||||
|
||||
numRead = fread(&numVertices, sizeof(S32), 1, fp);
|
||||
llendianswizzle(&numVertices, sizeof(S32), 1);
|
||||
@@ -680,8 +680,8 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
|
||||
if (!mMorphData)
|
||||
{
|
||||
const std::string driven_tag = "_Driven";
|
||||
U32 pos = morph_param_name.find(driven_tag);
|
||||
if (pos > 0)
|
||||
size_t pos = morph_param_name.find(driven_tag);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
morph_param_name = morph_param_name.substr(0,pos);
|
||||
mMorphData = mMesh->getMorphData(morph_param_name);
|
||||
@@ -835,7 +835,7 @@ F32 LLPolyMorphTarget::getMaxDistortion()
|
||||
//-----------------------------------------------------------------------------
|
||||
// apply()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_APPLY_MORPH_TARGET("Apply Morph");
|
||||
static LLTrace::BlockTimerStatHandle FTM_APPLY_MORPH_TARGET("Apply Morph");
|
||||
|
||||
void LLPolyMorphTarget::apply( ESex avatar_sex )
|
||||
{
|
||||
@@ -844,7 +844,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
|
||||
return;
|
||||
}
|
||||
|
||||
LLFastTimer t(FTM_APPLY_MORPH_TARGET);
|
||||
LL_RECORD_BLOCK_TIME(FTM_APPLY_MORPH_TARGET);
|
||||
|
||||
mLastSex = avatar_sex;
|
||||
|
||||
@@ -937,7 +937,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
|
||||
}
|
||||
|
||||
// now apply volume changes
|
||||
for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ )
|
||||
for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); ++iter )
|
||||
{
|
||||
LLPolyVolumeMorph* volume_morph = &(*iter);
|
||||
LLVector3 scale_delta = volume_morph->mScale * delta_weight;
|
||||
@@ -1030,7 +1030,7 @@ void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S3
|
||||
void LLPolyMorphTarget::applyVolumeChanges(F32 delta_weight)
|
||||
{
|
||||
// now apply volume changes
|
||||
for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ )
|
||||
for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); ++iter )
|
||||
{
|
||||
LLPolyVolumeMorph* volume_morph = &(*iter);
|
||||
LLVector3 scale_delta = volume_morph->mScale * delta_weight;
|
||||
|
||||
@@ -141,54 +141,58 @@ LLPolySkeletalDistortion::~LLPolySkeletalDistortion()
|
||||
BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
|
||||
{
|
||||
llassert(mInfo == NULL);
|
||||
if (info->mID < 0)
|
||||
return FALSE;
|
||||
mInfo = info;
|
||||
mID = info->mID;
|
||||
setWeight(getDefaultWeight());
|
||||
if (info->mID < 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
mInfo = info;
|
||||
mID = info->mID;
|
||||
setWeight(getDefaultWeight());
|
||||
|
||||
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
|
||||
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
|
||||
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
|
||||
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); ++iter)
|
||||
{
|
||||
LLPolySkeletalBoneInfo *bone_info = &(*iter);
|
||||
LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
|
||||
if (!joint)
|
||||
{
|
||||
LLPolySkeletalBoneInfo *bone_info = &(*iter);
|
||||
LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
|
||||
if (!joint)
|
||||
{
|
||||
LL_WARNS() << "Joint " << bone_info->mBoneName << " not found." << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (mJointScales.find(joint) != mJointScales.end())
|
||||
{
|
||||
LL_WARNS() << "Scale deformation already supplied for joint " << joint->getName() << "." << LL_ENDL;
|
||||
}
|
||||
|
||||
// store it
|
||||
mJointScales[joint] = bone_info->mScaleDeformation;
|
||||
|
||||
// apply to children that need to inherit it
|
||||
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
|
||||
iter != joint->mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* child_joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
if (child_joint && child_joint->inheritScale())
|
||||
{
|
||||
LLVector3 childDeformation = LLVector3(child_joint->getScale());
|
||||
childDeformation.scaleVec(bone_info->mScaleDeformation);
|
||||
mJointScales[child_joint] = childDeformation;
|
||||
}
|
||||
}
|
||||
|
||||
if (bone_info->mHasPositionDeformation)
|
||||
{
|
||||
if (mJointOffsets.find(joint) != mJointOffsets.end())
|
||||
{
|
||||
LL_WARNS() << "Offset deformation already supplied for joint " << joint->getName() << "." << LL_ENDL;
|
||||
}
|
||||
mJointOffsets[joint] = bone_info->mPositionDeformation;
|
||||
}
|
||||
// There's no point continuing after this error - means
|
||||
// that either the skeleton or lad file is broken.
|
||||
LL_WARNS() << "Joint " << bone_info->mBoneName << " not found." << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
if (mJointScales.find(joint) != mJointScales.end())
|
||||
{
|
||||
LL_WARNS() << "Scale deformation already supplied for joint " << joint->getName() << "." << LL_ENDL;
|
||||
}
|
||||
|
||||
// store it
|
||||
mJointScales[joint] = bone_info->mScaleDeformation;
|
||||
|
||||
// apply to children that need to inherit it
|
||||
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
|
||||
iter != joint->mChildren.end(); ++iter)
|
||||
{
|
||||
LLAvatarJoint* child_joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||
if (child_joint && child_joint->inheritScale())
|
||||
{
|
||||
LLVector3 childDeformation = LLVector3(child_joint->getScale());
|
||||
childDeformation.scaleVec(bone_info->mScaleDeformation);
|
||||
mJointScales[child_joint] = childDeformation;
|
||||
}
|
||||
}
|
||||
|
||||
if (bone_info->mHasPositionDeformation)
|
||||
{
|
||||
if (mJointOffsets.find(joint) != mJointOffsets.end())
|
||||
{
|
||||
LL_WARNS() << "Offset deformation already supplied for joint " << joint->getName() << "." << LL_ENDL;
|
||||
}
|
||||
mJointOffsets[joint] = bone_info->mPositionDeformation;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const
|
||||
@@ -199,11 +203,11 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
|
||||
//-----------------------------------------------------------------------------
|
||||
// apply()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion");
|
||||
static LLTrace::BlockTimerStatHandle FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion");
|
||||
|
||||
void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
||||
{
|
||||
LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY);
|
||||
LL_RECORD_BLOCK_TIME(FTM_POLYSKELETAL_DISTORTION_APPLY);
|
||||
|
||||
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
|
||||
|
||||
@@ -212,7 +216,7 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
||||
|
||||
for (iter = mJointScales.begin();
|
||||
iter != mJointScales.end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
joint = iter->first;
|
||||
LLVector3 newScale = joint->getScale();
|
||||
@@ -230,13 +234,13 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
||||
joint->setScale(newScale, true);
|
||||
}
|
||||
|
||||
for (iter = mJointOffsets.begin();
|
||||
iter != mJointOffsets.end();
|
||||
iter++)
|
||||
{
|
||||
joint = iter->first;
|
||||
LLVector3 newPosition = joint->getPosition();
|
||||
LLVector3 positionDelta = iter->second;
|
||||
for (iter = mJointOffsets.begin();
|
||||
iter != mJointOffsets.end();
|
||||
++iter)
|
||||
{
|
||||
joint = iter->first;
|
||||
LLVector3 newPosition = joint->getPosition();
|
||||
LLVector3 positionDelta = iter->second;
|
||||
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
|
||||
// SL-315
|
||||
bool allow_attachment_pos_overrides = true;
|
||||
|
||||
@@ -57,7 +57,7 @@ BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info)
|
||||
mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size());
|
||||
for (param_color_info_list_t::iterator iter = mInfo->mParamColorInfoList.begin();
|
||||
iter != mInfo->mParamColorInfoList.end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this);
|
||||
if (!param_color->setInfo(*iter, TRUE))
|
||||
|
||||
@@ -256,7 +256,7 @@ void LLTexLayerSetInfo::createVisualParams(LLAvatarAppearance *appearance)
|
||||
//layer_info_list_t mLayerInfoList;
|
||||
for (layer_info_list_t::iterator layer_iter = mLayerInfoList.begin();
|
||||
layer_iter != mLayerInfoList.end();
|
||||
layer_iter++)
|
||||
++layer_iter)
|
||||
{
|
||||
LLTexLayerInfo *layer_info = *layer_iter;
|
||||
layer_info->createVisualParams(appearance);
|
||||
@@ -299,7 +299,7 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info)
|
||||
mLayerList.reserve(info->mLayerInfoList.size());
|
||||
for (LLTexLayerSetInfo::layer_info_list_t::const_iterator iter = info->mLayerInfoList.begin();
|
||||
iter != info->mLayerInfoList.end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
LLTexLayerInterface *layer = NULL;
|
||||
if ( (*iter)->isUserSettable() )
|
||||
@@ -358,12 +358,12 @@ BOOL LLTexLayerSet::parseData(LLXmlTreeNode* node)
|
||||
|
||||
void LLTexLayerSet::deleteCaches()
|
||||
{
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
layer->deleteCaches();
|
||||
}
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); ++iter)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
layer->deleteCaches();
|
||||
@@ -378,7 +378,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
|
||||
|
||||
if (mMaskLayerList.size() > 0)
|
||||
{
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); ++iter)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer->isInvisibleAlphaMask())
|
||||
@@ -417,7 +417,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
|
||||
if (mIsVisible)
|
||||
{
|
||||
// composite color layers
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer->getRenderPass() == LLTexLayer::RP_COLOR)
|
||||
@@ -521,13 +521,13 @@ const LLTexLayerSetBuffer* LLTexLayerSet::getComposite() const
|
||||
return mComposite;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_GATHER_MORPH_MASK_ALPHA("gatherMorphMaskAlpha");
|
||||
static LLTrace::BlockTimerStatHandle FTM_GATHER_MORPH_MASK_ALPHA("gatherMorphMaskAlpha");
|
||||
void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height)
|
||||
{
|
||||
LLFastTimer t(FTM_GATHER_MORPH_MASK_ALPHA);
|
||||
LL_RECORD_BLOCK_TIME(FTM_GATHER_MORPH_MASK_ALPHA);
|
||||
memset(data, 255, width * height);
|
||||
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
layer->gatherAlphaMasks(data, origin_x, origin_y, width, height);
|
||||
@@ -537,10 +537,10 @@ void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S
|
||||
renderAlphaMaskTextures(origin_x, origin_y, width, height, true);
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_MASK_TEXTURES("renderAlphaMaskTextures");
|
||||
static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK_TEXTURES("renderAlphaMaskTextures");
|
||||
void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear)
|
||||
{
|
||||
LLFastTimer t(FTM_RENDER_ALPHA_MASK_TEXTURES);
|
||||
LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK_TEXTURES);
|
||||
const LLTexLayerSetInfo *info = getInfo();
|
||||
|
||||
bool use_shaders = LLGLSLShader::sNoFixedFunction;
|
||||
@@ -591,7 +591,7 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
|
||||
{
|
||||
gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA);
|
||||
gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE );
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); ++iter)
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
gGL.flush();
|
||||
@@ -615,7 +615,7 @@ void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_
|
||||
|
||||
BOOL LLTexLayerSet::isMorphValid() const
|
||||
{
|
||||
for(layer_list_t::const_iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for(layer_list_t::const_iterator iter = mLayerList.begin(); iter != mLayerList.end(); ++iter )
|
||||
{
|
||||
const LLTexLayerInterface* layer = *iter;
|
||||
if (layer && !layer->isMorphValid())
|
||||
@@ -628,7 +628,7 @@ BOOL LLTexLayerSet::isMorphValid() const
|
||||
|
||||
void LLTexLayerSet::invalidateMorphMasks()
|
||||
{
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer)
|
||||
@@ -727,7 +727,7 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
|
||||
mLocalTexture = TEX_NUM_INDICES;
|
||||
for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
|
||||
iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
|
||||
if (local_texture_name == texture_dict->mName)
|
||||
@@ -801,7 +801,7 @@ BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance)
|
||||
BOOL success = TRUE;
|
||||
for (param_color_info_list_t::iterator color_info_iter = mParamColorInfoList.begin();
|
||||
color_info_iter != mParamColorInfoList.end();
|
||||
color_info_iter++)
|
||||
++color_info_iter)
|
||||
{
|
||||
LLTexLayerParamColorInfo * color_info = *color_info_iter;
|
||||
LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance);
|
||||
@@ -815,7 +815,7 @@ BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance)
|
||||
|
||||
for (param_alpha_info_list_t::iterator alpha_info_iter = mParamAlphaInfoList.begin();
|
||||
alpha_info_iter != mParamAlphaInfoList.end();
|
||||
alpha_info_iter++)
|
||||
++alpha_info_iter)
|
||||
{
|
||||
LLTexLayerParamAlphaInfo * alpha_info = *alpha_info_iter;
|
||||
LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance);
|
||||
@@ -862,7 +862,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
|
||||
mParamColorList.reserve(mInfo->mParamColorInfoList.size());
|
||||
for (param_color_info_list_t::const_iterator iter = mInfo->mParamColorInfoList.begin();
|
||||
iter != mInfo->mParamColorInfoList.end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
LLTexLayerParamColor* param_color;
|
||||
if (!wearable)
|
||||
@@ -889,7 +889,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
|
||||
mParamAlphaList.reserve(mInfo->mParamAlphaInfoList.size());
|
||||
for (param_alpha_info_list_t::const_iterator iter = mInfo->mParamAlphaInfoList.begin();
|
||||
iter != mInfo->mParamAlphaInfoList.end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
LLTexLayerParamAlpha* param_alpha;
|
||||
if (!wearable)
|
||||
@@ -940,7 +940,7 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const
|
||||
param_color_list_t::const_iterator color_iter = mParamColorList.begin();
|
||||
param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin();
|
||||
|
||||
for (; color_iter != mParamColorList.end(); color_iter++)
|
||||
for (; color_iter != mParamColorList.end(); ++color_iter)
|
||||
{
|
||||
LLTexLayerParamColor* param = *color_iter;
|
||||
if (param)
|
||||
@@ -957,7 +957,7 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const
|
||||
}
|
||||
}
|
||||
|
||||
for (; alpha_iter != mParamAlphaList.end(); alpha_iter++)
|
||||
for (; alpha_iter != mParamAlphaList.end(); ++alpha_iter)
|
||||
{
|
||||
LLTexLayerParamAlpha* param = *alpha_iter;
|
||||
if (param)
|
||||
@@ -1059,7 +1059,7 @@ LLTexLayer::~LLTexLayer()
|
||||
//std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
|
||||
|
||||
for( alpha_cache_t::iterator iter = mAlphaCache.begin();
|
||||
iter != mAlphaCache.end(); iter++ )
|
||||
iter != mAlphaCache.end(); ++iter )
|
||||
{
|
||||
U8* alpha_data = iter->second;
|
||||
delete [] alpha_data;
|
||||
@@ -1086,7 +1086,7 @@ BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable )
|
||||
void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color)
|
||||
{
|
||||
for (param_color_list_t::const_iterator iter = param_list.begin();
|
||||
iter != param_list.end(); iter++)
|
||||
iter != param_list.end(); ++iter)
|
||||
{
|
||||
const LLTexLayerParamColor* param = *iter;
|
||||
LLColor4 param_net = param->getNetColor();
|
||||
@@ -1114,7 +1114,7 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LL
|
||||
{
|
||||
// Only need to delete caches for alpha params. Color params don't hold extra memory
|
||||
for (param_alpha_list_t::iterator iter = mParamAlphaList.begin();
|
||||
iter != mParamAlphaList.end(); iter++ )
|
||||
iter != mParamAlphaList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerParamAlpha* param = *iter;
|
||||
param->deleteCaches();
|
||||
@@ -1309,7 +1309,7 @@ const U8* LLTexLayer::getAlphaData() const
|
||||
const LLUUID& uuid = getUUID();
|
||||
alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
|
||||
|
||||
for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
|
||||
for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); ++iter)
|
||||
{
|
||||
const LLTexLayerParamAlpha* param = *iter;
|
||||
// MULTI-WEARABLE: verify visual parameters used here
|
||||
@@ -1430,7 +1430,7 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
|
||||
addAlphaMask(data, originX, originY, width, height);
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_RENDER_MORPH_MASKS("renderMorphMasks");
|
||||
static LLTrace::BlockTimerStatHandle FTM_RENDER_MORPH_MASKS("renderMorphMasks");
|
||||
void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, bool force_render)
|
||||
{
|
||||
if (!force_render && !hasMorph())
|
||||
@@ -1438,7 +1438,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
|
||||
LL_DEBUGS() << "skipping renderMorphMasks for " << getUUID() << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
LLFastTimer t(FTM_RENDER_MORPH_MASKS);
|
||||
LL_RECORD_BLOCK_TIME(FTM_RENDER_MORPH_MASKS);
|
||||
BOOL success = TRUE;
|
||||
|
||||
llassert( !mParamAlphaList.empty() );
|
||||
@@ -1470,7 +1470,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
|
||||
// Accumulate alphas
|
||||
LLGLSNoAlphaTest gls_no_alpha_test;
|
||||
gGL.color4f( 1.f, 1.f, 1.f, 1.f );
|
||||
for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
|
||||
for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); ++iter)
|
||||
{
|
||||
LLTexLayerParamAlpha* param = *iter;
|
||||
success &= param->render( x, y, width, height );
|
||||
@@ -1549,7 +1549,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
|
||||
const LLUUID& uuid = getUUID();
|
||||
alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
|
||||
|
||||
for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
|
||||
for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); ++iter)
|
||||
{
|
||||
const LLTexLayerParamAlpha* param = *iter;
|
||||
F32 param_weight = param->getWeight();
|
||||
@@ -1588,10 +1588,10 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
|
||||
}
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_ADD_ALPHA_MASK("addAlphaMask");
|
||||
static LLTrace::BlockTimerStatHandle FTM_ADD_ALPHA_MASK("addAlphaMask");
|
||||
void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height)
|
||||
{
|
||||
LLFastTimer t(FTM_ADD_ALPHA_MASK);
|
||||
LL_RECORD_BLOCK_TIME(FTM_ADD_ALPHA_MASK);
|
||||
S32 size = width * height;
|
||||
const U8* alphaData = getAlphaData();
|
||||
if (!alphaData && hasAlphaParams())
|
||||
@@ -1744,7 +1744,7 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
|
||||
|
||||
BOOL success = TRUE;
|
||||
updateWearableCache();
|
||||
for (wearable_cache_t::const_iterator iter = mWearableCache.begin(); iter!= mWearableCache.end(); iter++)
|
||||
for (wearable_cache_t::const_iterator iter = mWearableCache.begin(); iter!= mWearableCache.end(); ++iter)
|
||||
{
|
||||
LLWearable* wearable = NULL;
|
||||
LLLocalTextureObject *lto = NULL;
|
||||
@@ -1846,7 +1846,7 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
|
||||
//-----------------------------------------------------------------------------
|
||||
LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
|
||||
{
|
||||
for (layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for (layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer->getName() == name)
|
||||
@@ -1854,7 +1854,7 @@ LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ )
|
||||
for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerInterface* layer = *iter;
|
||||
if (layer->getName() == name)
|
||||
@@ -1868,7 +1868,7 @@ LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
|
||||
void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable *wearable)
|
||||
{
|
||||
// initialize all texlayers with this texture type for this LTO
|
||||
for( LLTexLayerSet::layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
|
||||
for( LLTexLayerSet::layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter;
|
||||
if (layer->getInfo()->getLocalTexture() == (S32) tex_index)
|
||||
@@ -1876,7 +1876,7 @@ void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearance
|
||||
lto->addTexLayer(layer, wearable);
|
||||
}
|
||||
}
|
||||
for( LLTexLayerSet::layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ )
|
||||
for( LLTexLayerSet::layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); ++iter )
|
||||
{
|
||||
LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter;
|
||||
if (layer->getInfo()->getLocalTexture() == (S32) tex_index)
|
||||
@@ -1932,10 +1932,10 @@ void LLTexLayerStaticImageList::deleteCachedImages()
|
||||
|
||||
// Returns an LLImageTGA that contains the encoded data from a tga file named file_name.
|
||||
// Caches the result to speed identical subsequent requests.
|
||||
static LLFastTimer::DeclareTimer FTM_LOAD_STATIC_TGA("getImageTGA");
|
||||
static LLTrace::BlockTimerStatHandle FTM_LOAD_STATIC_TGA("getImageTGA");
|
||||
LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name)
|
||||
{
|
||||
LLFastTimer t(FTM_LOAD_STATIC_TGA);
|
||||
LL_RECORD_BLOCK_TIME(FTM_LOAD_STATIC_TGA);
|
||||
const char *namekey = mImageNames.addString(file_name);
|
||||
image_tga_map_t::const_iterator iter = mStaticImageListTGA.find(namekey);
|
||||
if( iter != mStaticImageListTGA.end() )
|
||||
@@ -1962,10 +1962,10 @@ LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name)
|
||||
|
||||
// Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name.
|
||||
// Caches the result to speed identical subsequent requests.
|
||||
static LLFastTimer::DeclareTimer FTM_LOAD_STATIC_TEXTURE("getTexture");
|
||||
static LLTrace::BlockTimerStatHandle FTM_LOAD_STATIC_TEXTURE("getTexture");
|
||||
LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, BOOL is_mask)
|
||||
{
|
||||
LLFastTimer t(FTM_LOAD_STATIC_TEXTURE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_LOAD_STATIC_TEXTURE);
|
||||
LLPointer<LLGLTexture> tex;
|
||||
const char *namekey = mImageNames.addString(file_name);
|
||||
|
||||
@@ -2012,10 +2012,10 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name,
|
||||
|
||||
// Reads a .tga file, decodes it, and puts the decoded data in image_raw.
|
||||
// Returns TRUE if successful.
|
||||
static LLFastTimer::DeclareTimer FTM_LOAD_IMAGE_RAW("loadImageRaw");
|
||||
static LLTrace::BlockTimerStatHandle FTM_LOAD_IMAGE_RAW("loadImageRaw");
|
||||
BOOL LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLImageRaw* image_raw)
|
||||
{
|
||||
LLFastTimer t(FTM_LOAD_IMAGE_RAW);
|
||||
LL_RECORD_BLOCK_TIME(FTM_LOAD_IMAGE_RAW);
|
||||
BOOL success = FALSE;
|
||||
std::string path;
|
||||
path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name);
|
||||
|
||||
@@ -103,7 +103,7 @@ void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes)
|
||||
*gl_bytes = 0;
|
||||
|
||||
for (param_alpha_ptr_list_t::iterator iter = sInstances.begin();
|
||||
iter != sInstances.end(); iter++)
|
||||
iter != sInstances.end(); ++iter)
|
||||
{
|
||||
LLTexLayerParamAlpha* instance = *iter;
|
||||
LLGLTexture* tex = instance->mCachedProcessedTexture;
|
||||
@@ -260,10 +260,10 @@ BOOL LLTexLayerParamAlpha::getSkip() const
|
||||
}
|
||||
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_TEX_LAYER_PARAM_ALPHA("alpha render");
|
||||
static LLTrace::BlockTimerStatHandle FTM_TEX_LAYER_PARAM_ALPHA("alpha render");
|
||||
BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
||||
{
|
||||
LLFastTimer t(FTM_TEX_LAYER_PARAM_ALPHA);
|
||||
LL_RECORD_BLOCK_TIME(FTM_TEX_LAYER_PARAM_ALPHA);
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (!mTexLayer)
|
||||
|
||||
@@ -76,7 +76,7 @@ BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node)
|
||||
static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group");
|
||||
if (!node->getFastAttributeString( edit_group_string, mEditGroup))
|
||||
{
|
||||
mEditGroup = "";
|
||||
mEditGroup.clear();
|
||||
}
|
||||
|
||||
static LLStdStringHandle cross_wearable_string = LLXmlTree::addAttributeString("cross_wearable");
|
||||
|
||||
@@ -169,9 +169,9 @@ void LLWearable::createVisualParams(LLAvatarAppearance *avatarp)
|
||||
// need this line to disambiguate between versions of LLCharacter::getVisualParam()
|
||||
LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
|
||||
param->resetDrivenParams();
|
||||
if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
|
||||
if (!param->linkDrivenParams(std::bind(wearable_function,(LLWearable*)this, std::placeholders::_1), false))
|
||||
{
|
||||
if( !param->linkDrivenParams(boost::bind(param_function,avatarp,_1 ), true))
|
||||
if (!param->linkDrivenParams(std::bind(param_function,avatarp, std::placeholders::_1 ), true))
|
||||
{
|
||||
LL_WARNS() << "could not link driven params for wearable " << getName() << " id: " << param->getID() << LL_ENDL;
|
||||
continue;
|
||||
|
||||
@@ -105,7 +105,7 @@ protected:
|
||||
|
||||
//Why this weird structure? LLWearableType::WT_COUNT small and known, therefore it's more efficient to make an array of vectors, indexed
|
||||
//by wearable type. This allows O(1) lookups. This structure simply lets us plug in this optimization without touching any code elsewhere.
|
||||
typedef boost::array<std::pair<LLWearableType::EType,wearableentry_vec_t>,LLWearableType::WT_COUNT> wearable_array_t;
|
||||
typedef std::array<std::pair<LLWearableType::EType, wearableentry_vec_t>, LLWearableType::WT_COUNT> wearable_array_t;
|
||||
struct wearableentry_map_t : public wearable_array_t
|
||||
{
|
||||
wearableentry_map_t()
|
||||
|
||||
@@ -176,9 +176,9 @@ void LLCharacter::requestStopMotion( LLMotion* motion)
|
||||
//-----------------------------------------------------------------------------
|
||||
// updateMotions()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation");
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim");
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS("Update Motions");
|
||||
static LLTrace::BlockTimerStatHandle FTM_UPDATE_ANIMATION("Update Animation");
|
||||
static LLTrace::BlockTimerStatHandle FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim");
|
||||
static LLTrace::BlockTimerStatHandle FTM_UPDATE_MOTIONS("Update Motions");
|
||||
|
||||
void LLCharacter::updateMotions(e_update_t update_type)
|
||||
{
|
||||
@@ -194,7 +194,7 @@ void LLCharacter::updateMotions(e_update_t update_type)
|
||||
return;
|
||||
}
|
||||
//</singu>
|
||||
LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION);
|
||||
LL_RECORD_BLOCK_TIME(FTM_UPDATE_HIDDEN_ANIMATION);
|
||||
mMotionController.updateMotionsMinimal();
|
||||
}
|
||||
else
|
||||
@@ -204,7 +204,7 @@ void LLCharacter::updateMotions(e_update_t update_type)
|
||||
// to keep updating if they are synchronized with us, even if they are hidden.
|
||||
mMotionController.hidden(false);
|
||||
//</singu>
|
||||
LLFastTimer t(FTM_UPDATE_ANIMATION);
|
||||
LL_RECORD_BLOCK_TIME(FTM_UPDATE_ANIMATION);
|
||||
// unpause if the number of outstanding pause requests has dropped to the initial one
|
||||
if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1)
|
||||
{
|
||||
@@ -212,7 +212,7 @@ void LLCharacter::updateMotions(e_update_t update_type)
|
||||
}
|
||||
bool force_update = (update_type == FORCE_UPDATE);
|
||||
{
|
||||
LLFastTimer t(FTM_UPDATE_MOTIONS);
|
||||
LL_RECORD_BLOCK_TIME(FTM_UPDATE_MOTIONS);
|
||||
mMotionController.updateMotions(force_update);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
mIKSolver.solve();
|
||||
|
||||
// use blending...
|
||||
F32 slerp_amt = LLCriticalDamp::getInterpolant(TARGET_LAG_HALF_LIFE);
|
||||
F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TARGET_LAG_HALF_LIFE);
|
||||
shoulderRot = slerp(slerp_amt, mShoulderJoint.getRotation(), shoulderRot);
|
||||
elbowRot = slerp(slerp_amt, mElbowJoint.getRotation(), elbowRot);
|
||||
|
||||
|
||||
@@ -181,8 +181,8 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
LLQuaternion currentRootRotWorld = mRootJoint->getWorldRotation();
|
||||
LLQuaternion currentInvRootRotWorld = ~currentRootRotWorld;
|
||||
|
||||
F32 head_slerp_amt = LLCriticalDamp::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE);
|
||||
F32 torso_slerp_amt = LLCriticalDamp::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE);
|
||||
F32 head_slerp_amt = LLSmoothInterpolation::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE);
|
||||
F32 torso_slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE);
|
||||
|
||||
LLVector3* targetPos = (LLVector3*)mCharacter->getAnimationData("LookAtPoint");
|
||||
|
||||
|
||||
@@ -1101,11 +1101,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
|
||||
if (constraint->mSharedData->mChainLength != 0 &&
|
||||
dist_vec_squared(root_pos, target_pos) * 0.95f > constraint->mTotalLength * constraint->mTotalLength)
|
||||
{
|
||||
constraint->mWeight = lerp(constraint->mWeight, 0.f, LLCriticalDamp::getInterpolant(0.1f));
|
||||
constraint->mWeight = lerp(constraint->mWeight, 0.f, LLSmoothInterpolation::getInterpolant(0.1f));
|
||||
}
|
||||
else
|
||||
{
|
||||
constraint->mWeight = lerp(constraint->mWeight, 1.f, LLCriticalDamp::getInterpolant(0.3f));
|
||||
constraint->mWeight = lerp(constraint->mWeight, 1.f, LLSmoothInterpolation::getInterpolant(0.3f));
|
||||
}
|
||||
|
||||
F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f :
|
||||
@@ -1152,9 +1152,9 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
|
||||
// convert intermediate joint positions to world coordinates
|
||||
positions[joint_num] = ( constraint->mPositions[joint_num] * mPelvisp->getWorldRotation()) + mPelvisp->getWorldPosition();
|
||||
F32 time_constant = 1.f / clamp_rescale(constraint->mFixupDistanceRMS, 0.f, 0.5f, 0.2f, 8.f);
|
||||
// LL_INFOS() << "Interpolant " << LLCriticalDamp::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL;
|
||||
// LL_INFOS() << "Interpolant " << LLSmoothInterpolation::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL;
|
||||
positions[joint_num] = lerp(positions[joint_num], kinematic_position,
|
||||
LLCriticalDamp::getInterpolant(time_constant, FALSE));
|
||||
LLSmoothInterpolation::getInterpolant(time_constant, FALSE));
|
||||
}
|
||||
|
||||
S32 iteration_count;
|
||||
|
||||
@@ -258,7 +258,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
// but this will cause the animation playback rate calculation below to
|
||||
// kick in too slowly and sometimes start playing the animation in reverse.
|
||||
|
||||
//mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLCriticalDamp::getInterpolant(0.1f));
|
||||
//mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLSmoothInterpolation::getInterpolant(0.1f));
|
||||
|
||||
////F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL * (llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED);
|
||||
//F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL;
|
||||
@@ -287,7 +287,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX);
|
||||
|
||||
// blend towards new speed adjustment value
|
||||
F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(SPEED_ADJUST_TIME_CONSTANT));
|
||||
F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLSmoothInterpolation::getInterpolant(SPEED_ADJUST_TIME_CONSTANT));
|
||||
|
||||
// limit that rate at which the speed adjustment changes
|
||||
F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time);
|
||||
@@ -305,8 +305,8 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
{ // standing/turning
|
||||
|
||||
// damp out speed adjustment to 0
|
||||
mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(0.2f));
|
||||
//mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(0.2f));
|
||||
mAnimSpeed = lerp(mAnimSpeed, 1.f, LLSmoothInterpolation::getInterpolant(0.2f));
|
||||
//mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.2f));
|
||||
}
|
||||
|
||||
// broadcast walk speed change
|
||||
@@ -384,7 +384,7 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor;
|
||||
|
||||
// roll is critically damped interpolation between current roll and angular velocity-derived target roll
|
||||
mRoll = lerp(mRoll, target_roll, LLCriticalDamp::getInterpolant(0.1f));
|
||||
mRoll = lerp(mRoll, target_roll, LLSmoothInterpolation::getInterpolant(0.1f));
|
||||
|
||||
LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f));
|
||||
mPelvisState->setRotation(roll);
|
||||
|
||||
@@ -199,7 +199,7 @@ void LLMotion::fadeOut()
|
||||
{
|
||||
if (mFadeWeight > 0.01f)
|
||||
{
|
||||
mFadeWeight = lerp(mFadeWeight, 0.f, LLCriticalDamp::getInterpolant(0.15f));
|
||||
mFadeWeight = lerp(mFadeWeight, 0.f, LLSmoothInterpolation::getInterpolant(0.15f));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -214,7 +214,7 @@ void LLMotion::fadeIn()
|
||||
{
|
||||
if (mFadeWeight < 0.99f)
|
||||
{
|
||||
mFadeWeight = lerp(mFadeWeight, 1.f, LLCriticalDamp::getInterpolant(0.15f));
|
||||
mFadeWeight = lerp(mFadeWeight, 1.f, LLSmoothInterpolation::getInterpolant(0.15f));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -577,7 +577,7 @@ void LLMotionController::updateIdleActiveMotions()
|
||||
//-----------------------------------------------------------------------------
|
||||
// updateMotionsByType()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_MOTION_ON_UPDATE("Motion onUpdate");
|
||||
static LLTrace::BlockTimerStatHandle FTM_MOTION_ON_UPDATE("Motion onUpdate");
|
||||
|
||||
void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type)
|
||||
{
|
||||
@@ -737,7 +737,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty
|
||||
|
||||
// perform motion update
|
||||
{
|
||||
LLFastTimer t(FTM_MOTION_ON_UPDATE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOTION_ON_UPDATE);
|
||||
update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ LLMotion::LLMotionInitStatus LLTargetingMotion::onInitialize(LLCharacter *charac
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
{
|
||||
F32 slerp_amt = LLCriticalDamp::getInterpolant(TORSO_TARGET_HALF_LIFE);
|
||||
F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_TARGET_HALF_LIFE);
|
||||
|
||||
LLVector3 target;
|
||||
LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint");
|
||||
|
||||
@@ -30,10 +30,6 @@
|
||||
#include "v3math.h"
|
||||
#include "llstring.h"
|
||||
#include "llxmltree.h"
|
||||
#ifndef BOOST_FUNCTION_HPP_INCLUDED
|
||||
#include <boost/function.hpp>
|
||||
#define BOOST_FUNCTION_HPP_INCLUDED
|
||||
#endif
|
||||
|
||||
class LLPolyMesh;
|
||||
class LLXmlTreeNode;
|
||||
@@ -107,11 +103,23 @@ LL_ALIGN_PREFIX(16)
|
||||
class LLVisualParam
|
||||
{
|
||||
public:
|
||||
typedef boost::function<LLVisualParam*(S32)> visual_param_mapper;
|
||||
typedef std::function<LLVisualParam*(S32)> visual_param_mapper;
|
||||
|
||||
LLVisualParam();
|
||||
virtual ~LLVisualParam();
|
||||
|
||||
// <alchemy>
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
return ll_aligned_malloc_16(size);
|
||||
}
|
||||
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
ll_aligned_free_16(ptr);
|
||||
}
|
||||
// </alchemy>
|
||||
|
||||
// Special: These functions are overridden by child classes
|
||||
// (They can not be virtual because they use specific derived Info classes)
|
||||
LLVisualParamInfo* getInfo() const { return mInfo; }
|
||||
|
||||
@@ -33,63 +33,105 @@
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llcriticaldamp.h"
|
||||
#include <algorithm>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// static members
|
||||
//-----------------------------------------------------------------------------
|
||||
LLFrameTimer LLCriticalDamp::sInternalTimer;
|
||||
std::map<F32, F32> LLCriticalDamp::sInterpolants;
|
||||
F32 LLCriticalDamp::sTimeDelta;
|
||||
LLFrameTimer LLSmoothInterpolation::sInternalTimer;
|
||||
std::vector<LLSmoothInterpolation::Interpolant> LLSmoothInterpolation::sInterpolants;
|
||||
F32 LLSmoothInterpolation::sTimeDelta;
|
||||
std::pair<F32, F32> sCachedEntry;
|
||||
|
||||
// helper functors
|
||||
struct LLSmoothInterpolation::CompareTimeConstants
|
||||
{
|
||||
bool operator()(const F32& a, const LLSmoothInterpolation::Interpolant& b) const
|
||||
{
|
||||
return a < b.mTimeScale;
|
||||
}
|
||||
|
||||
bool operator()(const LLSmoothInterpolation::Interpolant& a, const F32& b) const
|
||||
{
|
||||
return a.mTimeScale < b; // bottom of a is higher than bottom of b
|
||||
}
|
||||
|
||||
bool operator()(const LLSmoothInterpolation::Interpolant& a, const LLSmoothInterpolation::Interpolant& b) const
|
||||
{
|
||||
return a.mTimeScale < b.mTimeScale; // bottom of a is higher than bottom of b
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLCriticalDamp()
|
||||
// LLSmoothInterpolation()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLCriticalDamp::LLCriticalDamp()
|
||||
LLSmoothInterpolation::LLSmoothInterpolation()
|
||||
{
|
||||
sTimeDelta = 0.f;
|
||||
sCachedEntry = std::pair<F32, F32>(-1.f, -1.f);
|
||||
}
|
||||
|
||||
// static
|
||||
//-----------------------------------------------------------------------------
|
||||
// updateInterpolants()
|
||||
//-----------------------------------------------------------------------------
|
||||
void LLCriticalDamp::updateInterpolants()
|
||||
void LLSmoothInterpolation::updateInterpolants()
|
||||
{
|
||||
sTimeDelta = sInternalTimer.getElapsedTimeAndResetF32();
|
||||
|
||||
F32 time_constant;
|
||||
|
||||
for (std::map<F32, F32>::iterator iter = sInterpolants.begin();
|
||||
iter != sInterpolants.end(); iter++)
|
||||
for (size_t i = 0; i < sInterpolants.size(); i++)
|
||||
{
|
||||
time_constant = iter->first;
|
||||
F32 new_interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant);
|
||||
new_interpolant = llclamp(new_interpolant, 0.f, 1.f);
|
||||
sInterpolants[time_constant] = new_interpolant;
|
||||
Interpolant& interp = sInterpolants[i];
|
||||
interp.mInterpolant = calcInterpolant(interp.mTimeScale);
|
||||
if (sCachedEntry.first == interp.mTimeScale)
|
||||
{
|
||||
sCachedEntry.second = interp.mInterpolant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// getInterpolant()
|
||||
//-----------------------------------------------------------------------------
|
||||
F32 LLCriticalDamp::getInterpolant(const F32 time_constant, BOOL use_cache)
|
||||
F32 LLSmoothInterpolation::getInterpolant(F32SecondsImplicit time_constant, bool use_cache)
|
||||
{
|
||||
if (time_constant == 0.f)
|
||||
{
|
||||
return 1.f;
|
||||
}
|
||||
|
||||
if (use_cache && sInterpolants.count(time_constant))
|
||||
{
|
||||
return sInterpolants[time_constant];
|
||||
}
|
||||
|
||||
F32 interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant);
|
||||
interpolant = llclamp(interpolant, 0.f, 1.f);
|
||||
if (use_cache)
|
||||
{
|
||||
sInterpolants[time_constant] = interpolant;
|
||||
if (sCachedEntry.first == time_constant)
|
||||
{
|
||||
return sCachedEntry.second;
|
||||
}
|
||||
interpolant_vec_t::iterator find_it = std::lower_bound(sInterpolants.begin(), sInterpolants.end(), time_constant.value(), CompareTimeConstants());
|
||||
if (find_it != sInterpolants.end() && find_it->mTimeScale == time_constant)
|
||||
{
|
||||
sCachedEntry = std::make_pair(time_constant.value(), find_it->mInterpolant);
|
||||
return find_it->mInterpolant;
|
||||
}
|
||||
else
|
||||
{
|
||||
Interpolant interp;
|
||||
interp.mTimeScale = time_constant.value();
|
||||
interp.mInterpolant = calcInterpolant(time_constant.value());
|
||||
sInterpolants.insert(find_it, interp);
|
||||
sCachedEntry = std::make_pair(time_constant.value(), interp.mInterpolant);
|
||||
return interp.mInterpolant;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return calcInterpolant(time_constant.value());
|
||||
}
|
||||
|
||||
return interpolant;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// calcInterpolant()
|
||||
//-----------------------------------------------------------------------------
|
||||
F32 LLSmoothInterpolation::calcInterpolant(F32 time_constant)
|
||||
{
|
||||
return llclamp(1.f - powf(2.f, -sTimeDelta / time_constant), 0.f, 1.f);
|
||||
}
|
||||
|
||||
@@ -34,26 +34,46 @@
|
||||
#ifndef LL_LLCRITICALDAMP_H
|
||||
#define LL_LLCRITICALDAMP_H
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "llframetimer.h"
|
||||
#include "llunits.h"
|
||||
|
||||
class LL_COMMON_API LLCriticalDamp
|
||||
class LL_COMMON_API LLSmoothInterpolation
|
||||
{
|
||||
public:
|
||||
LLCriticalDamp();
|
||||
LLSmoothInterpolation();
|
||||
|
||||
// MANIPULATORS
|
||||
static void updateInterpolants();
|
||||
|
||||
// ACCESSORS
|
||||
static F32 getInterpolant(const F32 time_constant, BOOL use_cache = TRUE);
|
||||
static F32 getInterpolant(F32SecondsImplicit time_constant, bool use_cache = true);
|
||||
|
||||
protected:
|
||||
template<typename T>
|
||||
static T lerp(T a, T b, F32SecondsImplicit time_constant, bool use_cache = true)
|
||||
{
|
||||
F32 interpolant = getInterpolant(time_constant, use_cache);
|
||||
return ((a * (1.f - interpolant))
|
||||
+ (b * interpolant));
|
||||
}
|
||||
|
||||
protected:
|
||||
static F32 calcInterpolant(F32 time_constant);
|
||||
|
||||
struct CompareTimeConstants;
|
||||
static LLFrameTimer sInternalTimer; // frame timer for calculating deltas
|
||||
|
||||
static std::map<F32, F32> sInterpolants;
|
||||
struct Interpolant
|
||||
{
|
||||
F32 mTimeScale;
|
||||
F32 mInterpolant;
|
||||
};
|
||||
typedef std::vector<Interpolant> interpolant_vec_t;
|
||||
static interpolant_vec_t sInterpolants;
|
||||
static F32 sTimeDelta;
|
||||
};
|
||||
|
||||
typedef LLSmoothInterpolation LLCriticalDamp;
|
||||
|
||||
#endif // LL_LLCRITICALDAMP_H
|
||||
|
||||
@@ -86,11 +86,11 @@ std::string LLDate::asRFC1123() const
|
||||
return toHTTPDateString (std::string ("%A, %d %b %Y %H:%M:%S GMT"));
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer FT_DATE_FORMAT("Date Format");
|
||||
LLTrace::BlockTimerStatHandle FT_DATE_FORMAT("Date Format");
|
||||
|
||||
std::string LLDate::toHTTPDateString(std::string fmt) const
|
||||
{
|
||||
LLFastTimer ft1(FT_DATE_FORMAT);
|
||||
LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT);
|
||||
|
||||
std::time_t locSeconds = (std::time_t) mSecondsSinceEpoch;
|
||||
std::tm * gmt = gmtime (&locSeconds);
|
||||
@@ -104,7 +104,7 @@ std::string LLDate::toHTTPDateString(std::string fmt) const
|
||||
|
||||
std::string LLDate::toHTTPDateString(tm * gmt, std::string fmt)
|
||||
{
|
||||
LLFastTimer ft1(FT_DATE_FORMAT);
|
||||
LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT);
|
||||
|
||||
// avoid calling setlocale() unnecessarily - it's expensive.
|
||||
std::string this_locale = LLStringUtil::getLocale();
|
||||
|
||||
@@ -38,6 +38,8 @@ class LLMutex;
|
||||
#include <queue>
|
||||
#include "llsd.h"
|
||||
|
||||
#define LL_RECORD_BLOCK_TIME(timer_stat) LLFastTimer LL_GLUE_TOKENS(block_time_recorder, __LINE__)(timer_stat);
|
||||
|
||||
LL_COMMON_API void assert_main_thread();
|
||||
|
||||
class LL_COMMON_API LLFastTimer
|
||||
@@ -273,4 +275,9 @@ private:
|
||||
|
||||
};
|
||||
|
||||
namespace LLTrace
|
||||
{
|
||||
typedef LLFastTimer::DeclareTimer BlockTimerStatHandle;
|
||||
}
|
||||
|
||||
#endif // LL_LLFASTTIMER_H
|
||||
|
||||
@@ -37,7 +37,7 @@ static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs;
|
||||
static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs;
|
||||
static const LLSD NO_VALUE_MARKER;
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversion");
|
||||
LLTrace::BlockTimerStatHandle FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversion");
|
||||
|
||||
//
|
||||
// LLParamSDParser
|
||||
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
extern LL_COMMON_API LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR;
|
||||
extern LL_COMMON_API LLTrace::BlockTimerStatHandle FTM_SD_PARAM_ADAPTOR;
|
||||
template<typename T>
|
||||
class LLSDParamAdapter : public T
|
||||
{
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
LLSDParamAdapter() {}
|
||||
LLSDParamAdapter(const LLSD& sd)
|
||||
{
|
||||
LLFastTimer _(FTM_SD_PARAM_ADAPTOR);
|
||||
LL_RECORD_BLOCK_TIME(FTM_SD_PARAM_ADAPTOR);
|
||||
LLParamSDParser parser;
|
||||
// don't spam for implicit parsing of LLSD, as we want to allow arbitrary freeform data and ignore most of it
|
||||
bool parse_silently = true;
|
||||
|
||||
@@ -467,24 +467,24 @@ void LLConditionVariableImpl::wait(LLMutex& lock)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
LLFastTimer::DeclareTimer FT_WAIT_FOR_MUTEX("LLMutex::lock()");
|
||||
void LLMutex::lock_main(LLFastTimer::DeclareTimer* timer)
|
||||
LLTrace::BlockTimerStatHandle FT_WAIT_FOR_MUTEX("LLMutex::lock()");
|
||||
void LLMutex::lock_main(LLTrace::BlockTimerStatHandle* timer)
|
||||
{
|
||||
llassert(!isSelfLocked());
|
||||
LLFastTimer ft1(timer ? *timer : FT_WAIT_FOR_MUTEX);
|
||||
LL_RECORD_BLOCK_TIME(timer ? *timer : FT_WAIT_FOR_MUTEX);
|
||||
LLMutexImpl::lock();
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer FT_WAIT_FOR_CONDITION("LLCondition::wait()");
|
||||
LLTrace::BlockTimerStatHandle FT_WAIT_FOR_CONDITION("LLCondition::wait()");
|
||||
void LLCondition::wait_main()
|
||||
{
|
||||
llassert(isSelfLocked());
|
||||
LLFastTimer ft1(FT_WAIT_FOR_CONDITION);
|
||||
LL_RECORD_BLOCK_TIME(FT_WAIT_FOR_CONDITION);
|
||||
LLConditionVariableImpl::wait(*this);
|
||||
llassert(isSelfLocked());
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer FT_WAIT_FOR_MUTEXLOCK("LLMutexLock::lock()");
|
||||
LLTrace::BlockTimerStatHandle FT_WAIT_FOR_MUTEXLOCK("LLMutexLock::lock()");
|
||||
void LLMutexLock::lock()
|
||||
{
|
||||
if (mMutex)
|
||||
|
||||
@@ -269,7 +269,7 @@ public:
|
||||
~LLMutex()
|
||||
{}
|
||||
|
||||
void lock(LLFastTimer::DeclareTimer* timer = NULL) // blocks
|
||||
void lock(LLTrace::BlockTimerStatHandle* timer = NULL) // blocks
|
||||
{
|
||||
if (inc_lock_if_recursive())
|
||||
return;
|
||||
@@ -384,7 +384,7 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
void lock_main(LLFastTimer::DeclareTimer* timer);
|
||||
void lock_main(LLTrace::BlockTimerStatHandle* timer);
|
||||
|
||||
bool inc_lock_if_recursive()
|
||||
{
|
||||
|
||||
@@ -1046,12 +1046,12 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const
|
||||
sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate;
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_INVENTORY_SD_DESERIALIZE("Inventory SD Deserialize");
|
||||
LLTrace::BlockTimerStatHandle FTM_INVENTORY_SD_DESERIALIZE("Inventory SD Deserialize");
|
||||
|
||||
bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new)
|
||||
{
|
||||
|
||||
LLFastTimer _(FTM_INVENTORY_SD_DESERIALIZE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_INVENTORY_SD_DESERIALIZE);
|
||||
if (is_new)
|
||||
{
|
||||
// If we're adding LLSD to an existing object, need avoid
|
||||
|
||||
@@ -308,7 +308,7 @@ LLFilterSD2XMLRPCResponse::~LLFilterSD2XMLRPCResponse()
|
||||
}
|
||||
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_SD2XMLRPC_RESPONSE("SD2XMLRPC Response");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_SD2XMLRPC_RESPONSE("SD2XMLRPC Response");
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
@@ -317,7 +317,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_SD2XMLRPC_RESPONSE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_RESPONSE);
|
||||
|
||||
PUMP_DEBUG;
|
||||
// This pipe does not work if it does not have everyting. This
|
||||
@@ -385,7 +385,7 @@ LLFilterSD2XMLRPCRequest::~LLFilterSD2XMLRPCRequest()
|
||||
{
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_SD2XMLRPC_REQUEST("S22XMLRPC Request");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_SD2XMLRPC_REQUEST("S22XMLRPC Request");
|
||||
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(
|
||||
@@ -395,7 +395,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_SD2XMLRPC_REQUEST);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_REQUEST);
|
||||
// This pipe does not work if it does not have everyting. This
|
||||
// could be addressed by making a stream parser for llsd which
|
||||
// handled partial information.
|
||||
@@ -592,7 +592,7 @@ LLFilterXMLRPCResponse2LLSD::~LLFilterXMLRPCResponse2LLSD()
|
||||
{
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_XMLRPC2LLSD_RESPONSE("XMLRPC2LLSD Response");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_XMLRPC2LLSD_RESPONSE("XMLRPC2LLSD Response");
|
||||
|
||||
LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
@@ -601,7 +601,7 @@ LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_XMLRPC2LLSD_RESPONSE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_XMLRPC2LLSD_RESPONSE);
|
||||
|
||||
PUMP_DEBUG;
|
||||
if(!eos) return STATUS_BREAK;
|
||||
@@ -678,7 +678,7 @@ LLFilterXMLRPCRequest2LLSD::~LLFilterXMLRPCRequest2LLSD()
|
||||
{
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_XMLRPC2LLSD_REQUEST("XMLRPC2LLSD Request");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_XMLRPC2LLSD_REQUEST("XMLRPC2LLSD Request");
|
||||
LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
buffer_ptr_t& buffer,
|
||||
@@ -686,7 +686,7 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_XMLRPC2LLSD_REQUEST);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_XMLRPC2LLSD_REQUEST);
|
||||
PUMP_DEBUG;
|
||||
if(!eos) return STATUS_BREAK;
|
||||
if(!buffer) return STATUS_ERROR;
|
||||
|
||||
@@ -139,11 +139,11 @@ private:
|
||||
LLSD mHeaders;
|
||||
};
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_PIPE("HTTP Pipe");
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_GET("HTTP Get");
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_PUT("HTTP Put");
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_POST("HTTP Post");
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_DELETE("HTTP Delete");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_PIPE("HTTP Pipe");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_GET("HTTP Get");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_PUT("HTTP Put");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_POST("HTTP Post");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_DELETE("HTTP Delete");
|
||||
|
||||
LLIOPipe::EStatus LLHTTPPipe::process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
@@ -152,7 +152,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_HTTP_PIPE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_PIPE);
|
||||
PUMP_DEBUG;
|
||||
LL_DEBUGS() << "LLSDHTTPServer::process_impl" << LL_ENDL;
|
||||
|
||||
@@ -181,12 +181,12 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
|
||||
std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB];
|
||||
if(verb == HTTP_VERB_GET)
|
||||
{
|
||||
LLFastTimer _(FTM_PROCESS_HTTP_GET);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_GET);
|
||||
mNode.get(LLHTTPNode::ResponsePtr(mResponse), context);
|
||||
}
|
||||
else if(verb == HTTP_VERB_PUT)
|
||||
{
|
||||
LLFastTimer _(FTM_PROCESS_HTTP_PUT);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_PUT);
|
||||
LLSD input;
|
||||
if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD)
|
||||
{
|
||||
@@ -202,7 +202,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
|
||||
}
|
||||
else if(verb == HTTP_VERB_POST)
|
||||
{
|
||||
LLFastTimer _(FTM_PROCESS_HTTP_POST);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_POST);
|
||||
LLSD input;
|
||||
if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
|
||||
}
|
||||
else if(verb == HTTP_VERB_DELETE)
|
||||
{
|
||||
LLFastTimer _(FTM_PROCESS_HTTP_DELETE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_DELETE);
|
||||
mNode.del(LLHTTPNode::ResponsePtr(mResponse), context);
|
||||
}
|
||||
else if(verb == HTTP_VERB_OPTIONS)
|
||||
@@ -436,7 +436,7 @@ protected:
|
||||
* LLHTTPResponseHeader
|
||||
*/
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_HEADER("HTTP Header");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_HEADER("HTTP Header");
|
||||
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
|
||||
@@ -446,7 +446,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_HTTP_HEADER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_HEADER);
|
||||
PUMP_DEBUG;
|
||||
if(eos)
|
||||
{
|
||||
@@ -636,7 +636,7 @@ void LLHTTPResponder::markBad(
|
||||
<< "</body>\n</html>\n" << std::flush;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_RESPONDER("HTTP Responder");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_RESPONDER("HTTP Responder");
|
||||
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLHTTPResponder::process_impl(
|
||||
@@ -646,7 +646,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_HTTP_RESPONDER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_RESPONDER);
|
||||
PUMP_DEBUG;
|
||||
LLIOPipe::EStatus status = STATUS_OK;
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ LLIOSocketReader::~LLIOSocketReader()
|
||||
//LL_DEBUGS() << "Destroying LLIOSocketReader" << LL_ENDL;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_SOCKET_READER("Socket Reader");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_SOCKET_READER("Socket Reader");
|
||||
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLIOSocketReader::process_impl(
|
||||
@@ -287,7 +287,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_SOCKET_READER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_SOCKET_READER);
|
||||
PUMP_DEBUG;
|
||||
if(!mSource) return STATUS_PRECONDITION_NOT_MET;
|
||||
if(!mInitialized)
|
||||
@@ -377,7 +377,7 @@ LLIOSocketWriter::~LLIOSocketWriter()
|
||||
//LL_DEBUGS() << "Destroying LLIOSocketWriter" << LL_ENDL;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_SOCKET_WRITER("Socket Writer");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_SOCKET_WRITER("Socket Writer");
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLIOSocketWriter::process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
@@ -386,7 +386,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_SOCKET_WRITER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_SOCKET_WRITER);
|
||||
PUMP_DEBUG;
|
||||
if(!mDestination) return STATUS_PRECONDITION_NOT_MET;
|
||||
if(!mInitialized)
|
||||
@@ -531,7 +531,7 @@ void LLIOServerSocket::setResponseTimeout(F32 timeout_secs)
|
||||
mResponseTimeout = timeout_secs;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_SERVER_SOCKET("Server Socket");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_SERVER_SOCKET("Server Socket");
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLIOServerSocket::process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
@@ -540,7 +540,7 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_SERVER_SOCKET);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_SERVER_SOCKET);
|
||||
PUMP_DEBUG;
|
||||
if(!pump)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ LLIOPipe::EStatus LLIOFlush::process_impl(
|
||||
}
|
||||
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_SLEEP("IO Sleep");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_SLEEP("IO Sleep");
|
||||
/**
|
||||
* @class LLIOSleep
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ LLIOPipe::EStatus LLIOSleep::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_SLEEP);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_SLEEP);
|
||||
if(mSeconds > 0.0)
|
||||
{
|
||||
if(pump) pump->sleepChain(mSeconds);
|
||||
@@ -66,7 +66,7 @@ LLIOPipe::EStatus LLIOSleep::process_impl(
|
||||
return STATUS_DONE;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_ADD_CHAIN("Add Chain");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_ADD_CHAIN("Add Chain");
|
||||
/**
|
||||
* @class LLIOAddChain
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ LLIOPipe::EStatus LLIOAddChain::process_impl(
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_ADD_CHAIN);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_ADD_CHAIN);
|
||||
pump->addChain(mChain, mTimeout);
|
||||
return STATUS_DONE;
|
||||
}
|
||||
|
||||
@@ -440,8 +440,8 @@ void LLPumpIO::pump()
|
||||
pump(DEFAULT_POLL_TIMEOUT);
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO");
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP_POLL("Pump Poll");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PUMP_IO("Pump IO");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PUMP_POLL("Pump Poll");
|
||||
|
||||
LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t& run_chain)
|
||||
{
|
||||
@@ -455,7 +455,7 @@ LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t
|
||||
//timeout is in microseconds
|
||||
void LLPumpIO::pump(const S32& poll_timeout)
|
||||
{
|
||||
LLFastTimer t1(FTM_PUMP_IO);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PUMP_IO);
|
||||
//LL_INFOS() << "LLPumpIO::pump()" << LL_ENDL;
|
||||
|
||||
// Run any pending runners.
|
||||
@@ -536,7 +536,7 @@ void LLPumpIO::pump(const S32& poll_timeout)
|
||||
S32 count = 0;
|
||||
S32 client_id = 0;
|
||||
{
|
||||
LLFastTimer _(FTM_PUMP_POLL);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PUMP_POLL);
|
||||
apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd);
|
||||
}
|
||||
PUMP_DEBUG;
|
||||
@@ -783,7 +783,7 @@ bool LLPumpIO::respond(
|
||||
return true;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PUMP_CALLBACK_CHAIN("Chain");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PUMP_CALLBACK_CHAIN("Chain");
|
||||
|
||||
void LLPumpIO::callback()
|
||||
{
|
||||
@@ -805,7 +805,7 @@ void LLPumpIO::callback()
|
||||
callbacks_t::iterator end = mCallbacks.end();
|
||||
for(; it != end; ++it)
|
||||
{
|
||||
LLFastTimer t(FTM_PUMP_CALLBACK_CHAIN);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PUMP_CALLBACK_CHAIN);
|
||||
// it's always the first and last time for respone chains
|
||||
(*it).mHead = (*it).mChainLinks.begin();
|
||||
(*it).mInit = true;
|
||||
|
||||
@@ -530,7 +530,7 @@ void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S3
|
||||
gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET);
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages");
|
||||
static LLTrace::BlockTimerStatHandle FTM_PROCESS_MESSAGES("Process Messages");
|
||||
|
||||
// decode a given message
|
||||
BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender, bool custom)
|
||||
@@ -714,7 +714,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender,
|
||||
}
|
||||
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_MESSAGES);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PROCESS_MESSAGES);
|
||||
if( !mCurrentRMessageTemplate->callHandlerFunc(gMessageSystem) )
|
||||
{
|
||||
LL_WARNS() << "Message from " << sender << " with no handler function received: " << mCurrentRMessageTemplate->mName << LL_ENDL;
|
||||
|
||||
@@ -487,10 +487,20 @@ void LLFontFreetype::renderGlyph(const U32 glyph_index) const
|
||||
if (mFTFace == NULL)
|
||||
return;
|
||||
|
||||
llassert_always(! FT_Load_Glyph(mFTFace, glyph_index, FT_LOAD_DEFAULT));
|
||||
|
||||
llassert_always(! FT_Render_Glyph(mFTFace->glyph, gFontRenderMode) );
|
||||
|
||||
FT_Error error = FT_Load_Glyph(mFTFace, glyph_index, FT_LOAD_DEFAULT);
|
||||
#ifdef SHOW_ASSERT
|
||||
if (error)
|
||||
{
|
||||
LL_ERRS() << "FT_Load_Glyph returned " << error << LL_ENDL;
|
||||
}
|
||||
#endif
|
||||
error = FT_Render_Glyph(mFTFace->glyph, gFontRenderMode);
|
||||
#ifdef SHOW_ASSERT
|
||||
if (error)
|
||||
{
|
||||
LL_ERRS() << "FT_Render_Glyph returned " << error << LL_ENDL;
|
||||
}
|
||||
#endif
|
||||
mRenderGlyphCount++;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ const F32 PIXEL_CORRECTION_DISTANCE = 0.01f;
|
||||
const F32 PAD_UVY = 0.5f; // half of vertical padding between glyphs in the glyph texture
|
||||
const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f;
|
||||
|
||||
const U32 GLYPH_VERTICES = 6;
|
||||
|
||||
LLFontGL::LLFontGL()
|
||||
{
|
||||
clearEmbeddedChars();
|
||||
@@ -100,7 +102,7 @@ BOOL LLFontGL::loadFace(const std::string& filename, const F32 point_size, const
|
||||
return mFontFreetype->loadFace(filename, point_size, vert_dpi, horz_dpi, components, is_fallback);
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts");
|
||||
static LLTrace::BlockTimerStatHandle FTM_RENDER_FONTS("Fonts");
|
||||
|
||||
S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style,
|
||||
ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_embedded, BOOL use_ellipses) const
|
||||
@@ -130,7 +132,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect
|
||||
S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style,
|
||||
ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_embedded, BOOL use_ellipses) const
|
||||
{
|
||||
LLFastTimer _(FTM_RENDER_FONTS);
|
||||
LL_RECORD_BLOCK_TIME(FTM_RENDER_FONTS);
|
||||
|
||||
if(!sDisplayFont) //do not display texts
|
||||
{
|
||||
@@ -255,9 +257,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
|
||||
const LLFontGlyphInfo* next_glyph = NULL;
|
||||
|
||||
const S32 GLYPH_BATCH_SIZE = 30;
|
||||
static LL_ALIGN_16(LLVector4a vertices[GLYPH_BATCH_SIZE * 4]);
|
||||
static LLVector2 uvs[GLYPH_BATCH_SIZE * 4];
|
||||
static LLColor4U colors[GLYPH_BATCH_SIZE * 4];
|
||||
static LL_ALIGN_16(LLVector4a vertices[GLYPH_BATCH_SIZE * GLYPH_VERTICES]);
|
||||
static LLVector2 uvs[GLYPH_BATCH_SIZE * GLYPH_VERTICES];
|
||||
static LLColor4U colors[GLYPH_BATCH_SIZE * GLYPH_VERTICES];
|
||||
|
||||
LLColor4U text_color(color);
|
||||
|
||||
@@ -302,18 +304,18 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
|
||||
|
||||
if (glyph_count > 0)
|
||||
{
|
||||
gGL.begin(LLRender::QUADS);
|
||||
gGL.begin(LLRender::TRIANGLES);
|
||||
{
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * GLYPH_VERTICES);
|
||||
}
|
||||
gGL.end();
|
||||
glyph_count = 0;
|
||||
}
|
||||
renderQuad(vertices, uvs, colors, screen_rect, uv_rect, LLColor4U::white, 0);
|
||||
//No batching here. It will never happen.
|
||||
gGL.begin(LLRender::QUADS);
|
||||
gGL.begin(LLRender::TRIANGLES);
|
||||
{
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, 4);
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, GLYPH_VERTICES);
|
||||
}
|
||||
gGL.end();
|
||||
|
||||
@@ -358,9 +360,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
|
||||
// otherwise the queued glyphs will be taken from wrong textures.
|
||||
if (glyph_count > 0)
|
||||
{
|
||||
gGL.begin(LLRender::QUADS);
|
||||
gGL.begin(LLRender::TRIANGLES);
|
||||
{
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * GLYPH_VERTICES);
|
||||
}
|
||||
gGL.end();
|
||||
glyph_count = 0;
|
||||
@@ -391,9 +393,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
|
||||
|
||||
if (glyph_count >= GLYPH_BATCH_SIZE)
|
||||
{
|
||||
gGL.begin(LLRender::QUADS);
|
||||
gGL.begin(LLRender::TRIANGLES);
|
||||
{
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * GLYPH_VERTICES);
|
||||
}
|
||||
gGL.end();
|
||||
|
||||
@@ -428,9 +430,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
|
||||
|
||||
if(glyph_count)
|
||||
{
|
||||
gGL.begin(LLRender::QUADS);
|
||||
gGL.begin(LLRender::TRIANGLES);
|
||||
{
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
|
||||
gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * GLYPH_VERTICES);
|
||||
}
|
||||
gGL.end();
|
||||
}
|
||||
@@ -1271,13 +1273,23 @@ void LLFontGL::renderQuad(LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U*
|
||||
{
|
||||
S32 index = 0;
|
||||
|
||||
vertex_out[index].set(screen_rect.mLeft, screen_rect.mTop, 0.f);
|
||||
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
|
||||
colors_out[index] = color;
|
||||
index++;
|
||||
|
||||
vertex_out[index].set(screen_rect.mLeft + slant_amt, screen_rect.mBottom, 0.f);
|
||||
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
|
||||
colors_out[index] = color;
|
||||
index++;
|
||||
|
||||
vertex_out[index].set(screen_rect.mRight, screen_rect.mTop, 0.f);
|
||||
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
|
||||
colors_out[index] = color;
|
||||
index++;
|
||||
|
||||
vertex_out[index].set(screen_rect.mLeft, screen_rect.mTop, 0.f);
|
||||
uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
|
||||
vertex_out[index].set(screen_rect.mRight, screen_rect.mTop, 0.f);
|
||||
uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
|
||||
colors_out[index] = color;
|
||||
index++;
|
||||
|
||||
@@ -1305,7 +1317,8 @@ void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv
|
||||
LLRectf screen_rect_offset = screen_rect;
|
||||
|
||||
screen_rect_offset.translate((F32)(pass * BOLD_OFFSET), 0.f);
|
||||
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_offset, uv_rect, color, slant_offset);
|
||||
const U32 idx = glyph_count * GLYPH_VERTICES;
|
||||
renderQuad(&vertex_out[idx], &uv_out[idx], &colors_out[idx], screen_rect_offset, uv_rect, color, slant_offset);
|
||||
glyph_count++;
|
||||
}
|
||||
}
|
||||
@@ -1336,10 +1349,12 @@ void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv
|
||||
break;
|
||||
}
|
||||
|
||||
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_offset, uv_rect, shadow_color, slant_offset);
|
||||
const U32 idx = glyph_count * GLYPH_VERTICES;
|
||||
renderQuad(&vertex_out[idx], &uv_out[idx], &colors_out[idx], screen_rect_offset, uv_rect, shadow_color, slant_offset);
|
||||
glyph_count++;
|
||||
}
|
||||
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
|
||||
const U32 idx = glyph_count * GLYPH_VERTICES;
|
||||
renderQuad(&vertex_out[idx], &uv_out[idx], &colors_out[idx], screen_rect, uv_rect, color, slant_offset);
|
||||
glyph_count++;
|
||||
}
|
||||
else if (shadow == DROP_SHADOW)
|
||||
@@ -1348,14 +1363,17 @@ void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv
|
||||
shadow_color.mV[VALPHA] = U8(color.mV[VALPHA] * drop_shadow_strength);
|
||||
LLRectf screen_rect_shadow = screen_rect;
|
||||
screen_rect_shadow.translate(1.f, -1.f);
|
||||
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_shadow, uv_rect, shadow_color, slant_offset);
|
||||
U32 idx = glyph_count * GLYPH_VERTICES;
|
||||
renderQuad(&vertex_out[idx], &uv_out[idx], &colors_out[idx], screen_rect_shadow, uv_rect, shadow_color, slant_offset);
|
||||
glyph_count++;
|
||||
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
|
||||
idx = glyph_count * GLYPH_VERTICES;
|
||||
renderQuad(&vertex_out[idx], &uv_out[idx], &colors_out[idx], screen_rect, uv_rect, color, slant_offset);
|
||||
glyph_count++;
|
||||
}
|
||||
else // normal rendering
|
||||
{
|
||||
renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
|
||||
const U32 idx = glyph_count * GLYPH_VERTICES;
|
||||
renderQuad(&vertex_out[idx], &uv_out[idx], &colors_out[idx], screen_rect, uv_rect, color, slant_offset);
|
||||
glyph_count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,6 +313,7 @@ LLGLSLShader::LLGLSLShader(S32 shader_class)
|
||||
mShaderGroup(SG_DEFAULT),
|
||||
mUniformsDirty(FALSE),
|
||||
mTimerQuery(0),
|
||||
mLightHash(0),
|
||||
mSamplesQuery(0)
|
||||
|
||||
{
|
||||
|
||||
@@ -286,11 +286,11 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_STATS("Image Stats");
|
||||
static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_STATS("Image Stats");
|
||||
// static
|
||||
void LLImageGL::updateStats(F32 current_time)
|
||||
{
|
||||
LLFastTimer t(FTM_IMAGE_UPDATE_STATS);
|
||||
LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_STATS);
|
||||
sLastFrameTime = current_time;
|
||||
sBoundTextureMemory = sCurBoundTextureMemory;
|
||||
sCurBoundTextureMemory = S32Bytes(0);
|
||||
@@ -697,10 +697,10 @@ void LLImageGL::setImage(const LLImageRaw* imageraw)
|
||||
setImage(rawdata, FALSE);
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_SET_IMAGE("setImage");
|
||||
static LLTrace::BlockTimerStatHandle FTM_SET_IMAGE("setImage");
|
||||
void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
|
||||
{
|
||||
LLFastTimer t(FTM_SET_IMAGE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_SET_IMAGE);
|
||||
bool is_compressed = false;
|
||||
if (mFormatPrimary >= GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && mFormatPrimary <= GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)
|
||||
{
|
||||
@@ -752,7 +752,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
|
||||
}
|
||||
else
|
||||
{
|
||||
// LLFastTimer t2(FTM_TEMP4);
|
||||
// LL_RECORD_BLOCK_TIME(FTM_TEMP4);
|
||||
|
||||
if(mFormatSwapBytes)
|
||||
{
|
||||
@@ -784,7 +784,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
|
||||
{
|
||||
stop_glerror();
|
||||
{
|
||||
// LLFastTimer t2(FTM_TEMP4);
|
||||
// LL_RECORD_BLOCK_TIME(FTM_TEMP4);
|
||||
|
||||
if(mFormatSwapBytes)
|
||||
{
|
||||
@@ -869,7 +869,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
|
||||
}
|
||||
llassert(w > 0 && h > 0 && cur_mip_data);
|
||||
{
|
||||
// LLFastTimer t1(FTM_TEMP4);
|
||||
// LL_RECORD_BLOCK_TIME(FTM_TEMP4);
|
||||
if(mFormatSwapBytes)
|
||||
{
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
|
||||
@@ -1071,10 +1071,10 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_
|
||||
}
|
||||
|
||||
// static
|
||||
static LLFastTimer::DeclareTimer FTM_GENERATE_TEXTURES("generate textures");
|
||||
static LLTrace::BlockTimerStatHandle FTM_GENERATE_TEXTURES("generate textures");
|
||||
void LLImageGL::generateTextures(S32 numTextures, U32 *textures)
|
||||
{
|
||||
LLFastTimer t(FTM_GENERATE_TEXTURES);
|
||||
LL_RECORD_BLOCK_TIME(FTM_GENERATE_TEXTURES);
|
||||
glGenTextures(numTextures, textures);
|
||||
}
|
||||
|
||||
@@ -1297,10 +1297,10 @@ typedef struct {
|
||||
} DDS_HEADER_DXT10;
|
||||
|
||||
// static
|
||||
static LLFastTimer::DeclareTimer FTM_SET_MANUAL_IMAGE("setManualImage");
|
||||
static LLTrace::BlockTimerStatHandle FTM_SET_MANUAL_IMAGE("setManualImage");
|
||||
void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels, bool allow_compression)
|
||||
{
|
||||
LLFastTimer t(FTM_SET_MANUAL_IMAGE);
|
||||
LL_RECORD_BLOCK_TIME(FTM_SET_MANUAL_IMAGE);
|
||||
std::vector<U32> scratch;
|
||||
if (LLRender::sGLCoreProfile)
|
||||
{
|
||||
@@ -1496,10 +1496,10 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
|
||||
|
||||
//create an empty GL texture: just create a texture name
|
||||
//the texture is assiciate with some image by calling glTexImage outside LLImageGL
|
||||
static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE1("createGLTexture()");
|
||||
static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE1("createGLTexture()");
|
||||
BOOL LLImageGL::createGLTexture()
|
||||
{
|
||||
LLFastTimer t(FTM_CREATE_GL_TEXTURE1);
|
||||
LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE1);
|
||||
if (gGLManager.mIsDisabled)
|
||||
{
|
||||
LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL;
|
||||
@@ -1527,10 +1527,10 @@ BOOL LLImageGL::createGLTexture()
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)");
|
||||
static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)");
|
||||
BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category)
|
||||
{
|
||||
LLFastTimer t(FTM_CREATE_GL_TEXTURE2);
|
||||
LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE2);
|
||||
if (gGLManager.mIsDisabled)
|
||||
{
|
||||
LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL;
|
||||
@@ -1604,10 +1604,10 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
|
||||
return createGLTexture(discard_level, rawdata, FALSE, usename);
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)");
|
||||
static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)");
|
||||
BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename)
|
||||
{
|
||||
LLFastTimer t(FTM_CREATE_GL_TEXTURE3);
|
||||
LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE3);
|
||||
llassert(data_in);
|
||||
stop_glerror();
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ static LLStaticHashedString sVignettRadius("vignette_radius");
|
||||
static LLStaticHashedString sVignetteDarkness("vignette_darkness");
|
||||
static LLStaticHashedString sVignetteDesaturation("vignette_desaturation");
|
||||
static LLStaticHashedString sVignetteChromaticAberration("vignette_chromatic_aberration");
|
||||
static LLStaticHashedString sScreenRes("screen_res");
|
||||
|
||||
static LLStaticHashedString sHorizontalPass("horizontalPass");
|
||||
static LLStaticHashedString sKern("kern");
|
||||
|
||||
static LLStaticHashedString sPrevProj("prev_proj");
|
||||
static LLStaticHashedString sInvProj("inv_proj");
|
||||
@@ -262,7 +262,6 @@ public:
|
||||
getShader().uniform1f(sVignetteDarkness, mDarkness);
|
||||
getShader().uniform1f(sVignetteDesaturation, mDesaturation);
|
||||
getShader().uniform1f(sVignetteChromaticAberration, mChromaticAberration);
|
||||
getShader().uniform2fv(sScreenRes, 1, screen_rect.mV);
|
||||
return QUAD_NORMAL;
|
||||
}
|
||||
};
|
||||
@@ -284,7 +283,11 @@ public:
|
||||
/*virtual*/ S32 getDepthChannel() const { return -1; }
|
||||
/*virtual*/ QuadType preDraw()
|
||||
{
|
||||
LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions();
|
||||
|
||||
mPassLoc = getShader().getUniformLocation(sHorizontalPass);
|
||||
LLVector4 vec[] = { LLVector4(1.3846153846, 3.2307692308, 0, 0) / screen_rect.mV[VX], LLVector4( 0,0, 1.3846153846, 3.2307692308 ) / screen_rect.mV[VY] };
|
||||
getShader().uniform4fv(sKern, LL_ARRAY_SIZE(vec), (GLfloat*)vec);
|
||||
return QUAD_NORMAL;
|
||||
}
|
||||
/*virtual*/ bool draw(U32 pass)
|
||||
@@ -322,7 +325,6 @@ public:
|
||||
|
||||
getShader().uniformMatrix4fv(sPrevProj, 1, GL_FALSE, prev_proj.getF32ptr());
|
||||
getShader().uniformMatrix4fv(sInvProj, 1, GL_FALSE, inv_proj.getF32ptr());
|
||||
getShader().uniform2fv(sScreenRes, 1, screen_rect.mV);
|
||||
getShader().uniform1i(sBlurStrength, mStrength);
|
||||
|
||||
return QUAD_NORMAL;
|
||||
@@ -411,11 +413,22 @@ void LLPostProcess::initialize(unsigned int width, unsigned int height)
|
||||
mVBO->getVertexStrider(v);
|
||||
mVBO->getTexCoord0Strider(uv1);
|
||||
mVBO->getTexCoord1Strider(uv2);
|
||||
|
||||
v[0] = LLVector3( uv2[0] = uv1[0] = LLVector2(0, 0) );
|
||||
v[1] = LLVector3( uv2[1] = uv1[1] = LLVector2(0, mScreenHeight) );
|
||||
v[2] = LLVector3( uv2[2] = uv1[2] = LLVector2(mScreenWidth, 0) );
|
||||
v[3] = LLVector3( uv2[3] = uv1[3] = LLVector2(mScreenWidth, mScreenHeight) );
|
||||
|
||||
uv2[0] = uv1[0] = LLVector2(0, 0);
|
||||
uv2[1] = uv1[1] = LLVector2(0, 1);
|
||||
uv2[2] = uv1[2] = LLVector2(1, 0);
|
||||
uv2[3] = uv1[3] = LLVector2(1, 1);
|
||||
|
||||
LLVector3 vec1[4] = {
|
||||
LLVector3(0, 0, 0),
|
||||
LLVector3(0, mScreenHeight, 0),
|
||||
LLVector3(mScreenWidth, 0, 0),
|
||||
LLVector3(mScreenWidth, mScreenHeight, 0) };
|
||||
|
||||
v[0] = vec1[0];
|
||||
v[1] = vec1[1];
|
||||
v[2] = vec1[2];
|
||||
v[3] = vec1[3];
|
||||
|
||||
mVBO->flush();
|
||||
}
|
||||
@@ -424,7 +437,7 @@ void LLPostProcess::initialize(unsigned int width, unsigned int height)
|
||||
|
||||
void LLPostProcess::createScreenTextures()
|
||||
{
|
||||
const LLTexUnit::eTextureType type = LLTexUnit::TT_RECT_TEXTURE;
|
||||
const LLTexUnit::eTextureType type = LLTexUnit::TT_TEXTURE;
|
||||
|
||||
mRenderTarget[0].allocate(mScreenWidth,mScreenHeight,GL_RGBA,FALSE,FALSE,type,FALSE);
|
||||
if(mRenderTarget[0].getFBO())//Only need pingpong between two rendertargets if FBOs are supported.
|
||||
@@ -504,7 +517,7 @@ void LLPostProcess::destroyGL()
|
||||
void LLPostProcess::copyFrameBuffer()
|
||||
{
|
||||
mRenderTarget[!!mRenderTarget[0].getFBO()].bindTexture(0,0);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
||||
stop_glerror();
|
||||
|
||||
if(mDepthTexture)
|
||||
@@ -513,8 +526,8 @@ void LLPostProcess::copyFrameBuffer()
|
||||
{
|
||||
if((*it)->isEnabled() && (*it)->getDepthChannel()>=0)
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mDepthTexture);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,mScreenWidth, mScreenHeight);
|
||||
stop_glerror();
|
||||
break;
|
||||
}
|
||||
@@ -594,7 +607,7 @@ void LLPostProcess::applyShaders(void)
|
||||
S32 color_channel = (*it)->getColorChannel();
|
||||
S32 depth_channel = (*it)->getDepthChannel();
|
||||
if(depth_channel >= 0)
|
||||
gGL.getTexUnit(depth_channel)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mDepthTexture);
|
||||
gGL.getTexUnit(depth_channel)->bindManual(LLTexUnit::TT_TEXTURE, mDepthTexture);
|
||||
U32 pass = 1;
|
||||
|
||||
(*it)->bindShader();
|
||||
@@ -639,11 +652,11 @@ void LLPostProcess::drawOrthoQuad(QuadType type)
|
||||
mVBO->getTexCoord1Strider(uv2);
|
||||
|
||||
float offs[2] = {
|
||||
/*ll_round*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE),
|
||||
/*ll_round*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE) };
|
||||
/*ll_round*/((float) rand() / (float) RAND_MAX),
|
||||
/*ll_round*/((float) rand() / (float) RAND_MAX) };
|
||||
float scale[2] = {
|
||||
(float)mScreenWidth * mNoiseTextureScale,
|
||||
(float)mScreenHeight * mNoiseTextureScale };
|
||||
((float)mScreenWidth * mNoiseTextureScale),
|
||||
((float)mScreenHeight * mNoiseTextureScale) };
|
||||
|
||||
uv2[0] = LLVector2(offs[0],offs[1]);
|
||||
uv2[1] = LLVector2(offs[0],offs[1]+scale[1]);
|
||||
|
||||
@@ -59,9 +59,7 @@ static const U32 LL_NUM_LIGHT_UNITS = 8;
|
||||
static const GLenum sGLTextureType[] =
|
||||
{
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE_RECTANGLE_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_ARB
|
||||
//,GL_TEXTURE_2D_MULTISAMPLE Don't use.
|
||||
};
|
||||
|
||||
static const GLint sGLAddressMode[] =
|
||||
@@ -171,7 +169,7 @@ void LLTexUnit::activate(void)
|
||||
|
||||
if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty)
|
||||
{
|
||||
gGL.flush();
|
||||
//gGL.flush();
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
|
||||
gGL.mCurrTextureUnitIndex = mIndex;
|
||||
}
|
||||
@@ -230,7 +228,7 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind)
|
||||
stop_glerror();
|
||||
if (mIndex >= 0)
|
||||
{
|
||||
gGL.flush();
|
||||
//gGL.flush();
|
||||
|
||||
LLImageGL* gl_tex = NULL ;
|
||||
|
||||
@@ -344,8 +342,6 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap)
|
||||
{
|
||||
if (mIndex < 0) return false;
|
||||
|
||||
gGL.flush();
|
||||
|
||||
if (cubeMap == NULL)
|
||||
{
|
||||
LL_WARNS() << "NULL LLTexUnit::bind cubemap" << LL_ENDL;
|
||||
@@ -361,6 +357,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap)
|
||||
{
|
||||
if (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps)
|
||||
{
|
||||
gGL.flush();
|
||||
activate();
|
||||
enable(LLTexUnit::TT_CUBE_MAP);
|
||||
mCurrTexture = cubeMap->mImages[0]->getTexName();
|
||||
@@ -390,7 +387,7 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth)
|
||||
{
|
||||
if (mIndex < 0) return false;
|
||||
|
||||
gGL.flush();
|
||||
//gGL.flush();
|
||||
|
||||
if (bindDepth)
|
||||
{
|
||||
@@ -438,12 +435,16 @@ void LLTexUnit::unbind(eTextureType type)
|
||||
|
||||
//always flush and activate for consistency
|
||||
// some code paths assume unbind always flushes and sets the active texture
|
||||
gGL.flush();
|
||||
activate();
|
||||
if (gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty)
|
||||
{
|
||||
gGL.flush();
|
||||
activate();
|
||||
}
|
||||
|
||||
// Disabled caching of binding state.
|
||||
if (mCurrTexType == type)
|
||||
if (mCurrTexType == type && mCurrTexture != 0)
|
||||
{
|
||||
gGL.flush();
|
||||
mCurrTexture = 0;
|
||||
if (LLGLSLShader::sNoFixedFunction && type == LLTexUnit::TT_TEXTURE)
|
||||
{
|
||||
@@ -1041,10 +1042,11 @@ LLRender::eBlendFactor blendfunc_debug[4]={LLRender::BF_UNDEF};
|
||||
LLRender::LLRender()
|
||||
: mDirty(false),
|
||||
mCount(0),
|
||||
mQuadCycle(0),
|
||||
mMode(LLRender::TRIANGLES),
|
||||
mCurrTextureUnitIndex(0),
|
||||
mMaxAnisotropy(0.f)
|
||||
mMaxAnisotropy(0.f),
|
||||
mLineWidth(1.f),
|
||||
mPrimitiveReset(false)
|
||||
{
|
||||
mTexUnits.reserve(LL_NUM_TEXTURE_LAYERS);
|
||||
for (U32 i = 0; i < LL_NUM_TEXTURE_LAYERS; i++)
|
||||
@@ -1212,7 +1214,7 @@ void LLRender::syncMatrices()
|
||||
{
|
||||
stop_glerror();
|
||||
|
||||
U32 name[] =
|
||||
static const U32 name[] =
|
||||
{
|
||||
LLShaderMgr::MODELVIEW_MATRIX,
|
||||
LLShaderMgr::PROJECTION_MATRIX,
|
||||
@@ -1663,8 +1665,6 @@ bool LLRender::unprojectf(const LLVector3& windowCoordinate, const LLMatrix4a& m
|
||||
|
||||
void LLRender::pushMatrix()
|
||||
{
|
||||
flush();
|
||||
|
||||
{
|
||||
if (mMatIdx[mMatrixMode] < LL_MATRIX_STACK_DEPTH-1)
|
||||
{
|
||||
@@ -1680,15 +1680,19 @@ void LLRender::pushMatrix()
|
||||
|
||||
void LLRender::popMatrix()
|
||||
{
|
||||
flush();
|
||||
{
|
||||
if (mMatIdx[mMatrixMode] > 0)
|
||||
{
|
||||
if ( memcmp(mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].getF32ptr(), mMatrix[mMatrixMode][mMatIdx[mMatrixMode] - 1].getF32ptr(), sizeof(LLMatrix4a)) )
|
||||
{
|
||||
flush();
|
||||
}
|
||||
--mMatIdx[mMatrixMode];
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
flush();
|
||||
LL_WARNS() << "Matrix stack underflow." << LL_ENDL;
|
||||
}
|
||||
}
|
||||
@@ -1697,6 +1701,7 @@ void LLRender::popMatrix()
|
||||
void LLRender::loadMatrix(const LLMatrix4a& mat)
|
||||
{
|
||||
flush();
|
||||
|
||||
mMatrix[mMatrixMode][mMatIdx[mMatrixMode]] = mat;
|
||||
mMatHash[mMatrixMode]++;
|
||||
}
|
||||
@@ -1772,6 +1777,18 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z)
|
||||
mUIScale.back().mul(scale);
|
||||
}
|
||||
|
||||
void LLRender::rotateUI(LLQuaternion& rot)
|
||||
{
|
||||
if (mUIRotation.empty())
|
||||
{
|
||||
mUIRotation.push_back(rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
mUIRotation.push_back(mUIRotation.back()*rot);
|
||||
}
|
||||
}
|
||||
|
||||
void LLRender::pushUIMatrix()
|
||||
{
|
||||
if (mUIOffset.empty())
|
||||
@@ -1791,6 +1808,10 @@ void LLRender::pushUIMatrix()
|
||||
{
|
||||
mUIScale.push_back(mUIScale.back());
|
||||
}
|
||||
if (!mUIRotation.empty())
|
||||
{
|
||||
mUIRotation.push_back(mUIRotation.back());
|
||||
}
|
||||
}
|
||||
|
||||
void LLRender::popUIMatrix()
|
||||
@@ -1801,6 +1822,10 @@ void LLRender::popUIMatrix()
|
||||
}
|
||||
mUIOffset.pop_back();
|
||||
mUIScale.pop_back();
|
||||
if (!mUIRotation.empty())
|
||||
{
|
||||
mUIRotation.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
LLVector3 LLRender::getUITranslation()
|
||||
@@ -1830,6 +1855,8 @@ void LLRender::loadUIIdentity()
|
||||
}
|
||||
mUIOffset.back().splat(0.f);
|
||||
mUIScale.back().splat(1.f);
|
||||
if (!mUIRotation.empty())
|
||||
mUIRotation.push_back(LLQuaternion());
|
||||
}
|
||||
|
||||
void LLRender::setColorMask(bool writeColor, bool writeAlpha)
|
||||
@@ -1839,8 +1866,6 @@ void LLRender::setColorMask(bool writeColor, bool writeAlpha)
|
||||
|
||||
void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha)
|
||||
{
|
||||
flush();
|
||||
|
||||
if (mCurrColorMask[0] != writeColorR ||
|
||||
mCurrColorMask[1] != writeColorG ||
|
||||
mCurrColorMask[2] != writeColorB ||
|
||||
@@ -1851,6 +1876,7 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
|
||||
mCurrColorMask[2] = writeColorB;
|
||||
mCurrColorMask[3] = writeAlpha;
|
||||
|
||||
flush();
|
||||
glColorMask(writeColorR ? GL_TRUE : GL_FALSE,
|
||||
writeColorG ? GL_TRUE : GL_FALSE,
|
||||
writeColorB ? GL_TRUE : GL_FALSE,
|
||||
@@ -1891,8 +1917,6 @@ void LLRender::setSceneBlendType(eBlendType type)
|
||||
|
||||
void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
|
||||
{
|
||||
flush();
|
||||
|
||||
if (LLGLSLShader::sNoFixedFunction)
|
||||
{ //glAlphaFunc is deprecated in OpenGL 3.3
|
||||
return;
|
||||
@@ -1901,6 +1925,7 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
|
||||
if (mCurrAlphaFunc != func ||
|
||||
mCurrAlphaFuncVal != value || mDirty)
|
||||
{
|
||||
flush();
|
||||
mCurrAlphaFunc = func;
|
||||
mCurrAlphaFuncVal = value;
|
||||
if (func == CF_DEFAULT)
|
||||
@@ -2030,6 +2055,23 @@ void LLRender::setAmbientLightColor(const LLColor4& color)
|
||||
}
|
||||
}
|
||||
|
||||
void LLRender::setLineWidth(F32 line_width)
|
||||
{
|
||||
if (LLRender::sGLCoreProfile)
|
||||
{
|
||||
line_width = 1.f;
|
||||
}
|
||||
if (mLineWidth != line_width)
|
||||
{
|
||||
if (mMode == LLRender::LINES || LLRender::LINE_STRIP)
|
||||
{
|
||||
flush();
|
||||
}
|
||||
mLineWidth = line_width;
|
||||
glLineWidth(line_width);
|
||||
}
|
||||
}
|
||||
|
||||
bool LLRender::verifyTexUnitActive(U32 unitToVerify)
|
||||
{
|
||||
if (mCurrTextureUnitIndex == unitToVerify)
|
||||
@@ -2055,15 +2097,10 @@ void LLRender::begin(const GLuint& mode)
|
||||
{
|
||||
if (mode != mMode)
|
||||
{
|
||||
if (mode == LLRender::QUADS)
|
||||
{
|
||||
mQuadCycle = 1;
|
||||
}
|
||||
|
||||
if (mMode == LLRender::QUADS ||
|
||||
mMode == LLRender::LINES ||
|
||||
if (mMode == LLRender::LINES ||
|
||||
mMode == LLRender::TRIANGLES ||
|
||||
mMode == LLRender::POINTS)
|
||||
mMode == LLRender::POINTS ||
|
||||
mMode == LLRender::TRIANGLE_STRIP )
|
||||
{
|
||||
flush();
|
||||
}
|
||||
@@ -2084,15 +2121,20 @@ void LLRender::end()
|
||||
//IMM_ERRS << "GL begin and end called with no vertices specified." << LL_ENDL;
|
||||
}
|
||||
|
||||
if ((mMode != LLRender::QUADS &&
|
||||
mMode != LLRender::LINES &&
|
||||
if ((mMode != LLRender::LINES &&
|
||||
mMode != LLRender::TRIANGLES &&
|
||||
mMode != LLRender::POINTS) ||
|
||||
mMode != LLRender::POINTS &&
|
||||
mMode != LLRender::TRIANGLE_STRIP) ||
|
||||
mCount > 2048)
|
||||
{
|
||||
flush();
|
||||
}
|
||||
else if (mMode == LLRender::TRIANGLE_STRIP)
|
||||
{
|
||||
mPrimitiveReset = true;
|
||||
}
|
||||
}
|
||||
|
||||
void LLRender::flush()
|
||||
{
|
||||
if (mCount > 0)
|
||||
@@ -2147,14 +2189,6 @@ void LLRender::flush()
|
||||
|
||||
if (gDebugGL)
|
||||
{
|
||||
if (mMode == LLRender::QUADS && !sGLCoreProfile)
|
||||
{
|
||||
if (mCount%4 != 0)
|
||||
{
|
||||
LL_ERRS() << "Incomplete quad rendered." << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
if (mMode == LLRender::TRIANGLES)
|
||||
{
|
||||
if (mCount%3 != 0)
|
||||
@@ -2186,21 +2220,14 @@ void LLRender::flush()
|
||||
mBuffer->flush();
|
||||
mBuffer->setBuffer(immediate_mask);
|
||||
|
||||
if (mMode == LLRender::QUADS && sGLCoreProfile)
|
||||
{
|
||||
mBuffer->drawArrays(LLRender::TRIANGLES, 0, count);
|
||||
mQuadCycle = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mBuffer->drawArrays(mMode, 0, count);
|
||||
}
|
||||
mBuffer->drawArrays(mMode, 0, count);
|
||||
|
||||
mVerticesp[0] = mVerticesp[count];
|
||||
mTexcoordsp[0] = mTexcoordsp[count];
|
||||
mColorsp[0] = mColorsp[count];
|
||||
|
||||
mCount = 0;
|
||||
mPrimitiveReset = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2213,8 +2240,22 @@ void LLRender::vertex4a(const LLVector4a& vertex)
|
||||
{
|
||||
case LLRender::POINTS: flush(); break;
|
||||
case LLRender::TRIANGLES: if (mCount%3==0) flush(); break;
|
||||
case LLRender::QUADS: if(mCount%4 == 0) flush(); break;
|
||||
case LLRender::LINES: if (mCount%2 == 0) flush(); break;
|
||||
case LLRender::TRIANGLE_STRIP:
|
||||
{
|
||||
LLVector4a vert[] = { mVerticesp[mCount - 2], mVerticesp[mCount - 1], mVerticesp[mCount] };
|
||||
LLColor4U col[] = { mColorsp[mCount - 2], mColorsp[mCount - 1], mColorsp[mCount] };
|
||||
LLVector2 tc[] = { mTexcoordsp[mCount - 2], mTexcoordsp[mCount - 1], mTexcoordsp[mCount] };
|
||||
flush();
|
||||
for (int i = 0; i < LL_ARRAY_SIZE(vert); ++i)
|
||||
{
|
||||
mVerticesp[i] = vert[i];
|
||||
mColorsp[i] = col[i];
|
||||
mTexcoordsp[i] = tc[i];
|
||||
}
|
||||
mCount = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2224,40 +2265,63 @@ void LLRender::vertex4a(const LLVector4a& vertex)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPrimitiveReset && mCount)
|
||||
{
|
||||
// Insert degenerate
|
||||
++mCount;
|
||||
mVerticesp[mCount] = mVerticesp[mCount - 1];
|
||||
mColorsp[mCount] = mColorsp[mCount - 1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
|
||||
mVerticesp[mCount - 1] = mVerticesp[mCount - 2];
|
||||
mColorsp[mCount - 1] = mColorsp[mCount - 2];
|
||||
mTexcoordsp[mCount - 1] = mTexcoordsp[mCount - 2];
|
||||
}
|
||||
|
||||
if (mUIOffset.empty())
|
||||
{
|
||||
mVerticesp[mCount]=vertex;
|
||||
if (!mUIRotation.empty() && mUIRotation.back().isNotIdentity())
|
||||
{
|
||||
LLVector4 vert(vertex.getF32ptr());
|
||||
mVerticesp[mCount].loadua((vert*mUIRotation.back()).mV);
|
||||
}
|
||||
else
|
||||
{
|
||||
mVerticesp[mCount] = vertex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
|
||||
mVerticesp[mCount].setAdd(vertex,mUIOffset.back());
|
||||
mVerticesp[mCount].mul(mUIScale.back());
|
||||
}
|
||||
|
||||
if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
|
||||
{
|
||||
mQuadCycle++;
|
||||
if (mQuadCycle == 4)
|
||||
{ //copy two vertices so fourth quad element will add a triangle
|
||||
mQuadCycle = 0;
|
||||
|
||||
mCount++;
|
||||
mVerticesp[mCount] = mVerticesp[mCount-3];
|
||||
mColorsp[mCount] = mColorsp[mCount-3];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-3];
|
||||
|
||||
mCount++;
|
||||
mVerticesp[mCount] = mVerticesp[mCount-2];
|
||||
mColorsp[mCount] = mColorsp[mCount-2];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-2];
|
||||
if (!mUIRotation.empty() && mUIRotation.back().isNotIdentity())
|
||||
{
|
||||
LLVector4 vert(vertex.getF32ptr());
|
||||
vert = vert * mUIRotation.back();
|
||||
LLVector4a postrot_vert;
|
||||
postrot_vert.loadua(vert.mV);
|
||||
mVerticesp[mCount].setAdd(postrot_vert, mUIOffset.back());
|
||||
mVerticesp[mCount].mul(mUIScale.back());
|
||||
}
|
||||
else
|
||||
{
|
||||
//LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
|
||||
mVerticesp[mCount].setAdd(vertex, mUIOffset.back());
|
||||
mVerticesp[mCount].mul(mUIScale.back());
|
||||
}
|
||||
}
|
||||
|
||||
mCount++;
|
||||
mVerticesp[mCount] = mVerticesp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
|
||||
if (mPrimitiveReset && mCount)
|
||||
{
|
||||
mCount++;
|
||||
mVerticesp[mCount] = mVerticesp[mCount - 1];
|
||||
mColorsp[mCount] = mColorsp[mCount - 1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
|
||||
}
|
||||
|
||||
mPrimitiveReset = false;
|
||||
}
|
||||
|
||||
void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count)
|
||||
@@ -2268,53 +2332,33 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count)
|
||||
return;
|
||||
}
|
||||
|
||||
if (sGLCoreProfile && mMode == LLRender::QUADS)
|
||||
{ //quads are deprecated, convert to triangle list
|
||||
S32 i = 0;
|
||||
|
||||
while (i < vert_count)
|
||||
{
|
||||
//read first three
|
||||
mVerticesp[mCount++] = verts[i++];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
mVerticesp[mCount++] = verts[i++];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
mVerticesp[mCount++] = verts[i++];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
//copy two
|
||||
mVerticesp[mCount++] = verts[i-3];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
mVerticesp[mCount++] = verts[i-1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
//copy last one
|
||||
mVerticesp[mCount++] = verts[i++];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
}
|
||||
}
|
||||
else
|
||||
if (mPrimitiveReset && mCount)
|
||||
{
|
||||
for (S32 i = 0; i < vert_count; i++)
|
||||
{
|
||||
mVerticesp[mCount] = verts[i];
|
||||
// Insert degenerate
|
||||
++mCount;
|
||||
mVerticesp[mCount] = verts[0];
|
||||
mColorsp[mCount] = mColorsp[mCount - 1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
|
||||
mVerticesp[mCount - 1] = mVerticesp[mCount - 2];
|
||||
mColorsp[mCount - 1] = mColorsp[mCount - 2];
|
||||
mTexcoordsp[mCount - 1] = mTexcoordsp[mCount - 2];
|
||||
++mCount;
|
||||
mColorsp[mCount] = mColorsp[mCount - 1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
|
||||
}
|
||||
|
||||
mCount++;
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
}
|
||||
for (S32 i = 0; i < vert_count; i++)
|
||||
{
|
||||
mVerticesp[mCount] = verts[i];
|
||||
|
||||
mCount++;
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
}
|
||||
|
||||
mVerticesp[mCount] = mVerticesp[mCount-1];
|
||||
|
||||
mPrimitiveReset = false;
|
||||
}
|
||||
|
||||
void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count)
|
||||
@@ -2325,54 +2369,34 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32
|
||||
return;
|
||||
}
|
||||
|
||||
if (sGLCoreProfile && mMode == LLRender::QUADS)
|
||||
{ //quads are deprecated, convert to triangle list
|
||||
S32 i = 0;
|
||||
|
||||
while (i < vert_count)
|
||||
{
|
||||
//read first three
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount++] = uvs[i++];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount++] = uvs[i++];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount++] = uvs[i++];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
//copy last two
|
||||
mVerticesp[mCount] = verts[i-3];
|
||||
mTexcoordsp[mCount++] = uvs[i-3];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
mVerticesp[mCount] = verts[i-1];
|
||||
mTexcoordsp[mCount++] = uvs[i-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
//copy last one
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount++] = uvs[i++];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
}
|
||||
}
|
||||
else
|
||||
if (mPrimitiveReset && mCount)
|
||||
{
|
||||
for (S32 i = 0; i < vert_count; i++)
|
||||
{
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount] = uvs[i];
|
||||
|
||||
mCount++;
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
}
|
||||
// Insert degenerate
|
||||
++mCount;
|
||||
mVerticesp[mCount] = verts[0];
|
||||
mColorsp[mCount] = mColorsp[mCount - 1];
|
||||
mTexcoordsp[mCount] = uvs[0];
|
||||
mVerticesp[mCount - 1] = mVerticesp[mCount - 2];
|
||||
mColorsp[mCount - 1] = mColorsp[mCount - 2];
|
||||
mTexcoordsp[mCount - 1] = mTexcoordsp[mCount - 2];
|
||||
++mCount;
|
||||
mColorsp[mCount] = mColorsp[mCount - 1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
|
||||
}
|
||||
|
||||
for (S32 i = 0; i < vert_count; i++)
|
||||
{
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount] = uvs[i];
|
||||
|
||||
mCount++;
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
}
|
||||
|
||||
mVerticesp[mCount] = mVerticesp[mCount-1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
|
||||
mPrimitiveReset = false;
|
||||
}
|
||||
|
||||
void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count)
|
||||
@@ -2383,56 +2407,35 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLCo
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (sGLCoreProfile && mMode == LLRender::QUADS)
|
||||
{ //quads are deprecated, convert to triangle list
|
||||
S32 i = 0;
|
||||
|
||||
while (i < vert_count)
|
||||
{
|
||||
//read first three
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount] = uvs[i];
|
||||
mColorsp[mCount++] = colors[i++];
|
||||
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount] = uvs[i];
|
||||
mColorsp[mCount++] = colors[i++];
|
||||
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount] = uvs[i];
|
||||
mColorsp[mCount++] = colors[i++];
|
||||
|
||||
//copy last two
|
||||
mVerticesp[mCount] = verts[i-3];
|
||||
mTexcoordsp[mCount] = uvs[i-3];
|
||||
mColorsp[mCount++] = colors[i-3];
|
||||
|
||||
mVerticesp[mCount] = verts[i-1];
|
||||
mTexcoordsp[mCount] = uvs[i-1];
|
||||
mColorsp[mCount++] = colors[i-1];
|
||||
|
||||
//copy last one
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount] = uvs[i];
|
||||
mColorsp[mCount++] = colors[i++];
|
||||
}
|
||||
}
|
||||
else
|
||||
if (mPrimitiveReset && mCount)
|
||||
{
|
||||
for (S32 i = 0; i < vert_count; i++)
|
||||
{
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount] = uvs[i];
|
||||
mColorsp[mCount] = colors[i];
|
||||
// Insert degenerate
|
||||
++mCount;
|
||||
mVerticesp[mCount] = verts[0];
|
||||
mColorsp[mCount] = colors[mCount - 1];
|
||||
mTexcoordsp[mCount] = uvs[0];
|
||||
mVerticesp[mCount - 1] = mVerticesp[mCount - 2];
|
||||
mColorsp[mCount - 1] = mColorsp[mCount - 2];
|
||||
mTexcoordsp[mCount - 1] = mTexcoordsp[mCount - 2];
|
||||
++mCount;
|
||||
mColorsp[mCount] = mColorsp[mCount - 1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
|
||||
}
|
||||
|
||||
mCount++;
|
||||
}
|
||||
for (S32 i = 0; i < vert_count; i++)
|
||||
{
|
||||
mVerticesp[mCount] = verts[i];
|
||||
mTexcoordsp[mCount] = uvs[i];
|
||||
mColorsp[mCount] = colors[i];
|
||||
|
||||
mCount++;
|
||||
}
|
||||
|
||||
mVerticesp[mCount] = mVerticesp[mCount-1];
|
||||
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
|
||||
mColorsp[mCount] = mColorsp[mCount-1];
|
||||
|
||||
mPrimitiveReset = false;
|
||||
}
|
||||
|
||||
void LLRender::texCoord2f(const GLfloat& x, const GLfloat& y)
|
||||
@@ -2597,9 +2600,6 @@ void LLRender::debugTexUnits(void)
|
||||
case LLTexUnit::TT_TEXTURE:
|
||||
LL_CONT << "Texture 2D";
|
||||
break;
|
||||
case LLTexUnit::TT_RECT_TEXTURE:
|
||||
LL_CONT << "Texture Rectangle";
|
||||
break;
|
||||
case LLTexUnit::TT_CUBE_MAP:
|
||||
LL_CONT << "Cube Map";
|
||||
break;
|
||||
|
||||
@@ -64,9 +64,7 @@ public:
|
||||
typedef enum
|
||||
{
|
||||
TT_TEXTURE = 0, // Standard 2D Texture
|
||||
TT_RECT_TEXTURE, // Non power of 2 texture
|
||||
TT_CUBE_MAP, // 6-sided cube map texture
|
||||
//TT_MULTISAMPLE_TEXTURE, // see GL_ARB_texture_multisample Do not use
|
||||
TT_NONE // No texture type is currently enabled
|
||||
} eTextureType;
|
||||
|
||||
@@ -281,7 +279,6 @@ public:
|
||||
POINTS,
|
||||
LINES,
|
||||
LINE_STRIP,
|
||||
QUADS,
|
||||
LINE_LOOP,
|
||||
NUM_MODES
|
||||
} eGeomModes;
|
||||
@@ -382,6 +379,8 @@ public:
|
||||
|
||||
void translateUI(F32 x, F32 y, F32 z);
|
||||
void scaleUI(F32 x, F32 y, F32 z);
|
||||
// Rotates vertices, pre-translation/scale
|
||||
void rotateUI(LLQuaternion& rot);
|
||||
void pushUIMatrix();
|
||||
void popUIMatrix();
|
||||
void loadUIIdentity();
|
||||
@@ -437,6 +436,8 @@ public:
|
||||
LLLightState* getLight(U32 index);
|
||||
void setAmbientLightColor(const LLColor4& color);
|
||||
|
||||
void setLineWidth(F32 line_width);
|
||||
|
||||
LLTexUnit* getTexUnit(U32 index);
|
||||
|
||||
U32 getCurrentTexUnitIndex(void) const { return mCurrTextureUnitIndex; }
|
||||
@@ -471,13 +472,13 @@ private:
|
||||
LLColor4 mAmbientLightColor;
|
||||
|
||||
bool mDirty;
|
||||
U32 mQuadCycle;
|
||||
U32 mCount;
|
||||
U32 mMode;
|
||||
U32 mCurrTextureUnitIndex;
|
||||
bool mCurrColorMask[4];
|
||||
eCompareFunc mCurrAlphaFunc;
|
||||
F32 mCurrAlphaFuncVal;
|
||||
F32 mLineWidth;
|
||||
|
||||
LLPointer<LLVertexBuffer> mBuffer;
|
||||
LLStrider<LLVector4a> mVerticesp;
|
||||
@@ -496,6 +497,9 @@ private:
|
||||
|
||||
std::vector<LLVector4a, boost::alignment::aligned_allocator<LLVector4a, 64> > mUIOffset;
|
||||
std::vector<LLVector4a, boost::alignment::aligned_allocator<LLVector4a, 64> > mUIScale;
|
||||
std::vector<LLQuaternion> mUIRotation;
|
||||
|
||||
bool mPrimitiveReset;
|
||||
} LL_ALIGN_POSTFIX(16);
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -228,17 +228,8 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
if (mUsage != LLTexUnit::TT_RECT_TEXTURE)
|
||||
{
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
{
|
||||
// ATI doesn't support mirrored repeat for rectangular textures.
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
stop_glerror();
|
||||
}
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_MIRROR);
|
||||
stop_glerror();
|
||||
|
||||
if (mFBO)
|
||||
{
|
||||
|
||||
@@ -538,7 +538,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
range = mShaderObjects.equal_range(filename);
|
||||
for (std::multimap<std::string, CachedObjectInfo>::iterator it = range.first; it != range.second;++it)
|
||||
{
|
||||
if((*it).second.mLevel == shader_level && (*it).second.mType == type && (*it).second.mDefinitions == (defines ? *defines : std::map<std::string, std::string>()))
|
||||
if((*it).second.mLevel == shader_level && (*it).second.mType == type && (*it).second.mIndexChannels == texture_index_channels && (*it).second.mDefinitions == (defines ? *defines : std::map<std::string, std::string>()))
|
||||
{
|
||||
//LL_INFOS("ShaderLoading") << "Loading cached shader for " << filename << LL_ENDL;
|
||||
return (*it).second.mHandle;
|
||||
@@ -935,7 +935,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
if (ret)
|
||||
{
|
||||
// Add shader file to map
|
||||
mShaderObjects.insert(make_pair(filename,CachedObjectInfo(ret,try_gpu_class,type,defines)));
|
||||
mShaderObjects.insert(make_pair(filename,CachedObjectInfo(ret,try_gpu_class,type, texture_index_channels,defines)));
|
||||
shader_level = try_gpu_class;
|
||||
}
|
||||
else
|
||||
@@ -1124,8 +1124,6 @@ void LLShaderMgr::initAttribsAndUniforms()
|
||||
mReservedUniforms.push_back("object_plane_t");
|
||||
llassert(mReservedUniforms.size() == LLShaderMgr::OBJECT_PLANE_T+1);
|
||||
|
||||
mReservedUniforms.push_back("viewport");
|
||||
|
||||
mReservedUniforms.push_back("light_position");
|
||||
mReservedUniforms.push_back("light_direction");
|
||||
mReservedUniforms.push_back("light_attenuation");
|
||||
@@ -1216,7 +1214,7 @@ void LLShaderMgr::initAttribsAndUniforms()
|
||||
mReservedUniforms.push_back("ssao_factor");
|
||||
mReservedUniforms.push_back("ssao_factor_inv");
|
||||
mReservedUniforms.push_back("ssao_effect");
|
||||
mReservedUniforms.push_back("screen_res");
|
||||
mReservedUniforms.push_back("kern_scale");
|
||||
mReservedUniforms.push_back("near_clip");
|
||||
mReservedUniforms.push_back("shadow_offset");
|
||||
mReservedUniforms.push_back("shadow_bias");
|
||||
@@ -1232,7 +1230,6 @@ void LLShaderMgr::initAttribsAndUniforms()
|
||||
|
||||
llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_DOWNSAMPLED_DEPTH_SCALE+1);
|
||||
|
||||
mReservedUniforms.push_back("tc_scale");
|
||||
mReservedUniforms.push_back("rcp_screen_res");
|
||||
mReservedUniforms.push_back("rcp_frame_opt");
|
||||
mReservedUniforms.push_back("rcp_frame_opt2");
|
||||
|
||||
@@ -49,7 +49,6 @@ public:
|
||||
TEXTURE_MATRIX3,
|
||||
OBJECT_PLANE_S,
|
||||
OBJECT_PLANE_T,
|
||||
VIEWPORT,
|
||||
LIGHT_POSITION,
|
||||
LIGHT_DIRECTION,
|
||||
LIGHT_ATTENUATION,
|
||||
@@ -124,7 +123,7 @@ public:
|
||||
DEFERRED_SSAO_FACTOR,
|
||||
DEFERRED_SSAO_FACTOR_INV,
|
||||
DEFERRED_SSAO_EFFECT,
|
||||
DEFERRED_SCREEN_RES,
|
||||
DEFERRED_KERN_SCALE,
|
||||
DEFERRED_NEAR_CLIP,
|
||||
DEFERRED_SHADOW_OFFSET,
|
||||
DEFERRED_SHADOW_BIAS,
|
||||
@@ -138,7 +137,6 @@ public:
|
||||
DEFERRED_SHADOW_TARGET_WIDTH,
|
||||
DEFERRED_DOWNSAMPLED_DEPTH_SCALE,
|
||||
|
||||
FXAA_TC_SCALE,
|
||||
FXAA_RCP_SCREEN_RES,
|
||||
FXAA_RCP_FRAME_OPT,
|
||||
FXAA_RCP_FRAME_OPT2,
|
||||
@@ -244,11 +242,12 @@ DISPLAY_GAMMA,
|
||||
public:
|
||||
struct CachedObjectInfo
|
||||
{
|
||||
CachedObjectInfo(GLhandleARB handle, U32 level, GLenum type, std::map<std::string,std::string> *definitions) :
|
||||
mHandle(handle), mLevel(level), mType(type), mDefinitions(definitions ? *definitions : std::map<std::string,std::string>()){}
|
||||
CachedObjectInfo(GLhandleARB handle, U32 level, GLenum type, U32 texture_index_channels, std::map<std::string,std::string> *definitions) :
|
||||
mHandle(handle), mLevel(level), mType(type), mIndexChannels(texture_index_channels), mDefinitions(definitions ? *definitions : std::map<std::string,std::string>()){}
|
||||
GLhandleARB mHandle; //Actual handle of the opengl shader object.
|
||||
U32 mLevel; //Level /might/ not be needed, but it's stored to ensure there's no change in behavior.
|
||||
GLenum mType; //GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB. Tracked because some utility shaders can be loaded as both types (carefully).
|
||||
U32 mIndexChannels; //LLShaderFeatures::mIndexedTextureChannels
|
||||
std::map<std::string,std::string> mDefinitions;
|
||||
};
|
||||
// Map of shader names to compiled
|
||||
|
||||
@@ -371,7 +371,6 @@ U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] =
|
||||
GL_POINTS,
|
||||
GL_LINES,
|
||||
GL_LINE_STRIP,
|
||||
GL_QUADS,
|
||||
GL_LINE_LOOP,
|
||||
};
|
||||
|
||||
@@ -787,7 +786,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
|
||||
placeFence();
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_GL_DRAW_ARRAYS("GL draw arrays");
|
||||
static LLTrace::BlockTimerStatHandle FTM_GL_DRAW_ARRAYS("GL draw arrays");
|
||||
void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
|
||||
{
|
||||
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
|
||||
@@ -823,7 +822,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
|
||||
}
|
||||
|
||||
{
|
||||
LLFastTimer t2(FTM_GL_DRAW_ARRAYS);
|
||||
LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS);
|
||||
stop_glerror();
|
||||
glDrawArrays(sGLMode[mode], first, count);
|
||||
}
|
||||
@@ -1301,7 +1300,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
|
||||
}
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_SETUP_VERTEX_ARRAY("Setup VAO");
|
||||
static LLTrace::BlockTimerStatHandle FTM_SETUP_VERTEX_ARRAY("Setup VAO");
|
||||
|
||||
void LLVertexBuffer::setupVertexArray()
|
||||
{
|
||||
@@ -1310,7 +1309,7 @@ void LLVertexBuffer::setupVertexArray()
|
||||
return;
|
||||
}
|
||||
|
||||
LLFastTimer t(FTM_SETUP_VERTEX_ARRAY);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_SETUP_VERTEX_ARRAY);
|
||||
#if GL_ARB_vertex_array_object
|
||||
glBindVertexArray(mGLArray);
|
||||
#endif
|
||||
@@ -1465,8 +1464,8 @@ bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count)
|
||||
return true;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range");
|
||||
static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER("VBO Map");
|
||||
static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range");
|
||||
static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER("VBO Map");
|
||||
|
||||
// Map for data access
|
||||
volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range)
|
||||
@@ -1537,7 +1536,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
|
||||
if (map_range)
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
LLFastTimer t(FTM_VBO_MAP_BUFFER_RANGE);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_BUFFER_RANGE);
|
||||
S32 offset = mOffsets[type] + sTypeSize[type]*index;
|
||||
S32 length = (sTypeSize[type]*count+0xF) & ~0xF;
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length,
|
||||
@@ -1561,7 +1560,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
|
||||
}
|
||||
}
|
||||
|
||||
LLFastTimer t(FTM_VBO_MAP_BUFFER);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_BUFFER);
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
@@ -1645,8 +1644,8 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
|
||||
}
|
||||
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX_RANGE("IBO Map Range");
|
||||
static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX("IBO Map");
|
||||
static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX_RANGE("IBO Map Range");
|
||||
static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX("IBO Map");
|
||||
|
||||
volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
|
||||
{
|
||||
@@ -1724,7 +1723,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
|
||||
if (map_range)
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
LLFastTimer t(FTM_VBO_MAP_INDEX_RANGE);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX_RANGE);
|
||||
S32 offset = sizeof(U16)*index;
|
||||
S32 length = sizeof(U16)*count;
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length,
|
||||
@@ -1736,7 +1735,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
|
||||
else
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
LLFastTimer t(FTM_VBO_MAP_INDEX);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX);
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
@@ -1758,7 +1757,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFastTimer t(FTM_VBO_MAP_INDEX);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX);
|
||||
map_range = false;
|
||||
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
}
|
||||
@@ -1809,12 +1808,12 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
|
||||
}
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_VBO_UNMAP("VBO Unmap");
|
||||
static LLFastTimer::DeclareTimer FTM_VBO_FLUSH_RANGE("Flush VBO Range");
|
||||
static LLTrace::BlockTimerStatHandle FTM_VBO_UNMAP("VBO Unmap");
|
||||
static LLTrace::BlockTimerStatHandle FTM_VBO_FLUSH_RANGE("Flush VBO Range");
|
||||
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_IBO_UNMAP("IBO Unmap");
|
||||
static LLFastTimer::DeclareTimer FTM_IBO_FLUSH_RANGE("Flush IBO Range");
|
||||
static LLTrace::BlockTimerStatHandle FTM_IBO_UNMAP("IBO Unmap");
|
||||
static LLTrace::BlockTimerStatHandle FTM_IBO_FLUSH_RANGE("Flush IBO Range");
|
||||
|
||||
void LLVertexBuffer::unmapBuffer()
|
||||
{
|
||||
@@ -1827,7 +1826,7 @@ void LLVertexBuffer::unmapBuffer()
|
||||
|
||||
if (mMappedData && mVertexLocked)
|
||||
{
|
||||
LLFastTimer t(FTM_VBO_UNMAP);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VBO_UNMAP);
|
||||
bindGLBuffer(true);
|
||||
updated_all = mIndexLocked; //both vertex and index buffers done updating
|
||||
|
||||
@@ -1869,7 +1868,7 @@ void LLVertexBuffer::unmapBuffer()
|
||||
S32 length = sTypeSize[region.mType]*region.mCount;
|
||||
if (gGLManager.mHasMapBufferRange)
|
||||
{
|
||||
LLFastTimer t(FTM_VBO_FLUSH_RANGE);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VBO_FLUSH_RANGE);
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
@@ -1897,7 +1896,7 @@ void LLVertexBuffer::unmapBuffer()
|
||||
|
||||
if (mMappedIndexData && mIndexLocked)
|
||||
{
|
||||
LLFastTimer t(FTM_IBO_UNMAP);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_IBO_UNMAP);
|
||||
bindGLIndices();
|
||||
if(!mMappable)
|
||||
{
|
||||
@@ -1935,7 +1934,7 @@ void LLVertexBuffer::unmapBuffer()
|
||||
S32 length = sizeof(U16)*region.mCount;
|
||||
if (gGLManager.mHasMapBufferRange)
|
||||
{
|
||||
LLFastTimer t(FTM_IBO_FLUSH_RANGE);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_IBO_FLUSH_RANGE);
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
@@ -1978,21 +1977,7 @@ template <class T,S32 type> struct VertexBufferStrider
|
||||
strider_t& strider,
|
||||
S32 index, S32 count, bool map_range)
|
||||
{
|
||||
if (type == LLVertexBuffer::TYPE_INDEX)
|
||||
{
|
||||
volatile U8* ptr = vbo.mapIndexBuffer(index, count, map_range);
|
||||
|
||||
if (ptr == NULL)
|
||||
{
|
||||
LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
strider = (T*)ptr;
|
||||
strider.setStride(0);
|
||||
return true;
|
||||
}
|
||||
else if (vbo.hasDataType(type))
|
||||
if (vbo.hasDataType(type))
|
||||
{
|
||||
S32 stride = LLVertexBuffer::sTypeSize[type];
|
||||
|
||||
@@ -2016,6 +2001,28 @@ template <class T,S32 type> struct VertexBufferStrider
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct VertexBufferStrider<T, LLVertexBuffer::TYPE_INDEX>
|
||||
{
|
||||
typedef LLStrider<T> strider_t;
|
||||
static bool get(LLVertexBuffer& vbo,
|
||||
strider_t& strider,
|
||||
S32 index, S32 count, bool map_range)
|
||||
{
|
||||
volatile U8* ptr = vbo.mapIndexBuffer(index, count, map_range);
|
||||
|
||||
if (ptr == NULL)
|
||||
{
|
||||
LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
|
||||
strider = (T*) ptr;
|
||||
strider.setStride(0);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
bool LLVertexBuffer::getVertexStrider(LLStrider<LLVector3>& strider, S32 index, S32 count, bool map_range)
|
||||
{
|
||||
return VertexBufferStrider<LLVector3,TYPE_VERTEX>::get(*this, strider, index, count, map_range);
|
||||
@@ -2081,13 +2088,13 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4a>& strider, S32 i
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_BIND_GL_ARRAY("Bind Array");
|
||||
static LLTrace::BlockTimerStatHandle FTM_BIND_GL_ARRAY("Bind Array");
|
||||
bool LLVertexBuffer::bindGLArray()
|
||||
{
|
||||
if (mGLArray && sGLRenderArray != mGLArray)
|
||||
{
|
||||
{
|
||||
LLFastTimer t(FTM_BIND_GL_ARRAY);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_BIND_GL_ARRAY);
|
||||
#if GL_ARB_vertex_array_object
|
||||
glBindVertexArray(mGLArray);
|
||||
#endif
|
||||
@@ -2104,7 +2111,7 @@ bool LLVertexBuffer::bindGLArray()
|
||||
return false;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_BIND_GL_BUFFER("Bind Buffer");
|
||||
static LLTrace::BlockTimerStatHandle FTM_BIND_GL_BUFFER("Bind Buffer");
|
||||
|
||||
bool LLVertexBuffer::bindGLBuffer(bool force_bind)
|
||||
{
|
||||
@@ -2114,7 +2121,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)
|
||||
|
||||
if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive))))
|
||||
{
|
||||
//LLFastTimer t(FTM_BIND_GL_BUFFER);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_BIND_GL_BUFFER);
|
||||
/*if (sMapped)
|
||||
{
|
||||
LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL;
|
||||
@@ -2136,7 +2143,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_BIND_GL_INDICES("Bind Indices");
|
||||
static LLTrace::BlockTimerStatHandle FTM_BIND_GL_INDICES("Bind Indices");
|
||||
|
||||
bool LLVertexBuffer::bindGLIndices(bool force_bind)
|
||||
{
|
||||
@@ -2145,7 +2152,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind)
|
||||
bool ret = false;
|
||||
if (useVBOs() && (force_bind || (mGLIndices && (mGLIndices != sGLRenderIndices || !sIBOActive))))
|
||||
{
|
||||
LLFastTimer t(FTM_BIND_GL_INDICES);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_BIND_GL_INDICES);
|
||||
/*if (sMapped)
|
||||
{
|
||||
LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL;
|
||||
|
||||
@@ -704,11 +704,11 @@ void LLButton::draw()
|
||||
mCurGlowStrength = lerp(mCurGlowStrength,
|
||||
mFlashing ? (flash? 1.0 : 0.0)
|
||||
: mHoverGlowStrength,
|
||||
LLCriticalDamp::getInterpolant(0.05f));
|
||||
LLSmoothInterpolation::getInterpolant(0.05f));
|
||||
}
|
||||
else
|
||||
{
|
||||
mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
|
||||
mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
|
||||
}
|
||||
|
||||
// Draw button image, if available.
|
||||
|
||||
@@ -2501,7 +2501,7 @@ LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
|
||||
return floaterp;
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
|
||||
LLTrace::BlockTimerStatHandle POST_BUILD("Floater Post Build");
|
||||
void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) /* Flawfinder: ignore */
|
||||
{
|
||||
std::string name(getName());
|
||||
@@ -2573,7 +2573,7 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
|
||||
|
||||
BOOL result;
|
||||
{
|
||||
LLFastTimer ft(POST_BUILD);
|
||||
LL_RECORD_BLOCK_TIME(POST_BUILD);
|
||||
|
||||
result = postBuild();
|
||||
}
|
||||
|
||||
@@ -353,13 +353,13 @@ LLColor3 LLKeywords::readColor( const std::string& s )
|
||||
return LLColor3( r, g, b );
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_SYNTAX_COLORING("Syntax Coloring");
|
||||
LLTrace::BlockTimerStatHandle FTM_SYNTAX_COLORING("Syntax Coloring");
|
||||
|
||||
// Walk through a string, applying the rules specified by the keyword token list and
|
||||
// create a list of color segments.
|
||||
void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLWString& wtext, const LLColor4 &defaultColor)
|
||||
{
|
||||
LLFastTimer ft(FTM_SYNTAX_COLORING);
|
||||
LL_RECORD_BLOCK_TIME(FTM_SYNTAX_COLORING);
|
||||
seg_list->clear();
|
||||
|
||||
if( wtext.empty() )
|
||||
|
||||
@@ -353,11 +353,11 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed)
|
||||
mNeedsLayout = true;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks");
|
||||
static LLTrace::BlockTimerStatHandle FTM_UPDATE_LAYOUT("Update LayoutStacks");
|
||||
|
||||
void LLLayoutStack::updateLayout()
|
||||
{
|
||||
LLFastTimer ft(FTM_UPDATE_LAYOUT);
|
||||
LL_RECORD_BLOCK_TIME(FTM_UPDATE_LAYOUT);
|
||||
|
||||
if (!mNeedsLayout) return;
|
||||
|
||||
@@ -621,7 +621,7 @@ bool LLLayoutStack::animatePanels()
|
||||
{
|
||||
if (!mAnimatedThisFrame)
|
||||
{
|
||||
panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
|
||||
panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLSmoothInterpolation::getInterpolant(mOpenTimeConstant));
|
||||
if (panelp->mVisibleAmt > 0.99f)
|
||||
{
|
||||
panelp->mVisibleAmt = 1.f;
|
||||
@@ -646,7 +646,7 @@ bool LLLayoutStack::animatePanels()
|
||||
{
|
||||
if (!mAnimatedThisFrame)
|
||||
{
|
||||
panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
|
||||
panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
|
||||
if (panelp->mVisibleAmt < 0.001f)
|
||||
{
|
||||
panelp->mVisibleAmt = 0.f;
|
||||
@@ -673,7 +673,7 @@ bool LLLayoutStack::animatePanels()
|
||||
{
|
||||
if (!mAnimatedThisFrame)
|
||||
{
|
||||
panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
|
||||
panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
|
||||
}
|
||||
|
||||
if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
|
||||
|
||||
@@ -4509,7 +4509,7 @@ void LLTearOffMenu::draw()
|
||||
if (getRect().getHeight() != mTargetHeight)
|
||||
{
|
||||
// animate towards target height
|
||||
reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f))));
|
||||
reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f))));
|
||||
}
|
||||
LLFloater::draw();
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ void LLPanel::setBorderVisible(BOOL b)
|
||||
}
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_PANEL_CONSTRUCTION("Panel Construction");
|
||||
LLTrace::BlockTimerStatHandle FTM_PANEL_CONSTRUCTION("Panel Construction");
|
||||
// virtual
|
||||
LLXMLNodePtr LLPanel::getXML(bool save_children) const
|
||||
{
|
||||
@@ -440,7 +440,7 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *fac
|
||||
node->getAttributeString("name", name);
|
||||
|
||||
LLPanel* panelp = factory->createFactoryPanel(name);
|
||||
LLFastTimer _(FTM_PANEL_CONSTRUCTION);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION);
|
||||
// Fall back on a default panel, if there was no special factory.
|
||||
if (!panelp)
|
||||
{
|
||||
|
||||
@@ -502,11 +502,11 @@ void LLScrollbar::draw()
|
||||
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
|
||||
if (hovered)
|
||||
{
|
||||
mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f));
|
||||
mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f));
|
||||
}
|
||||
else
|
||||
{
|
||||
mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
|
||||
mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3020,10 +3020,10 @@ void LLScrollListCtrl::setColumnHeadings(const LLSD& headings)
|
||||
"width"
|
||||
"dynamic_width"
|
||||
*/
|
||||
LLFastTimer::DeclareTimer FTM_ADD_SCROLLLIST_ELEMENT("Add Scroll List Item");
|
||||
LLTrace::BlockTimerStatHandle FTM_ADD_SCROLLLIST_ELEMENT("Add Scroll List Item");
|
||||
LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata)
|
||||
{
|
||||
LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT);
|
||||
LL_RECORD_BLOCK_TIME(FTM_ADD_SCROLLLIST_ELEMENT);
|
||||
LLScrollListItem::Params item_params;
|
||||
LLParamSDParser parser;
|
||||
parser.readSD(element, item_params);
|
||||
@@ -3033,14 +3033,14 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition
|
||||
|
||||
LLScrollListItem* LLScrollListCtrl::addRow(const LLScrollListItem::Params& item_p, EAddPosition pos)
|
||||
{
|
||||
LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT);
|
||||
LL_RECORD_BLOCK_TIME(FTM_ADD_SCROLLLIST_ELEMENT);
|
||||
LLScrollListItem *new_item = new LLScrollListItem(item_p);
|
||||
return addRow(new_item, item_p, pos);
|
||||
}
|
||||
|
||||
LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLScrollListItem::Params& item_p, EAddPosition pos)
|
||||
{
|
||||
LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT);
|
||||
LL_RECORD_BLOCK_TIME(FTM_ADD_SCROLLLIST_ELEMENT);
|
||||
if (!item_p.validateBlock() || !new_item) return NULL;
|
||||
new_item->setNumColumns(mColumns.size());
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ void LLTabContainer::draw()
|
||||
}
|
||||
}
|
||||
|
||||
setScrollPosPixels(mIsVertical ? target_pixel_scroll : lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
|
||||
setScrollPosPixels(mIsVertical ? target_pixel_scroll : lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f)));
|
||||
|
||||
BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0));
|
||||
if (!mIsVertical)
|
||||
|
||||
@@ -4406,13 +4406,13 @@ void LLTextEditor::loadKeywords(const std::string& filename,
|
||||
}
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting");
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_TEXT_SEGMENTS("Update Text Segments");
|
||||
static LLTrace::BlockTimerStatHandle FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting");
|
||||
static LLTrace::BlockTimerStatHandle FTM_UPDATE_TEXT_SEGMENTS("Update Text Segments");
|
||||
|
||||
void LLTextEditor::updateSegments()
|
||||
{
|
||||
{
|
||||
LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING);
|
||||
LL_RECORD_BLOCK_TIME(FTM_SYNTAX_HIGHLIGHTING);
|
||||
if (mKeywords.isLoaded())
|
||||
{
|
||||
// HACK: No non-ascii keywords for now
|
||||
@@ -4424,7 +4424,7 @@ void LLTextEditor::updateSegments()
|
||||
}
|
||||
}
|
||||
|
||||
LLFastTimer ft(FTM_UPDATE_TEXT_SEGMENTS);
|
||||
LL_RECORD_BLOCK_TIME(FTM_UPDATE_TEXT_SEGMENTS);
|
||||
// Make sure we have at least one segment
|
||||
if (mSegments.size() == 1 && mSegments[0]->getIsDefault())
|
||||
{
|
||||
|
||||
@@ -712,11 +712,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_FOCUS_FIRST_ITEM("Focus First Item");
|
||||
LLTrace::BlockTimerStatHandle FTM_FOCUS_FIRST_ITEM("Focus First Item");
|
||||
|
||||
BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
|
||||
{
|
||||
LLFastTimer _(FTM_FOCUS_FIRST_ITEM);
|
||||
LL_RECORD_BLOCK_TIME(FTM_FOCUS_FIRST_ITEM);
|
||||
// try to select default tab group child
|
||||
LLCtrlQuery query = getTabOrderQuery();
|
||||
// sort things such that the default tab group is at the front
|
||||
|
||||
@@ -71,9 +71,9 @@
|
||||
#include "lluiimage.h"
|
||||
#include "llviewborder.h"
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION("Widget Construction");
|
||||
LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS("Widget InitFromParams");
|
||||
LLFastTimer::DeclareTimer FTM_WIDGET_SETUP("Widget Setup");
|
||||
LLTrace::BlockTimerStatHandle FTM_WIDGET_CONSTRUCTION("Widget Construction");
|
||||
LLTrace::BlockTimerStatHandle FTM_INIT_FROM_PARAMS("Widget InitFromParams");
|
||||
LLTrace::BlockTimerStatHandle FTM_WIDGET_SETUP("Widget Setup");
|
||||
|
||||
const char XML_HEADER[] = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n";
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
class LLView;
|
||||
|
||||
|
||||
extern LLFastTimer::DeclareTimer FTM_WIDGET_SETUP;
|
||||
extern LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION;
|
||||
extern LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS;
|
||||
extern LLTrace::BlockTimerStatHandle FTM_WIDGET_SETUP;
|
||||
extern LLTrace::BlockTimerStatHandle FTM_WIDGET_CONSTRUCTION;
|
||||
extern LLTrace::BlockTimerStatHandle FTM_INIT_FROM_PARAMS;
|
||||
|
||||
// Build time optimization, generate this once in .cpp file
|
||||
#ifndef LLUICTRLFACTORY_CPP
|
||||
@@ -161,10 +161,10 @@ private:
|
||||
//return NULL;
|
||||
}
|
||||
|
||||
{ LLFastTimer _(FTM_WIDGET_CONSTRUCTION);
|
||||
{ LL_RECORD_BLOCK_TIME(FTM_WIDGET_CONSTRUCTION);
|
||||
widget = new T(params);
|
||||
}
|
||||
{ LLFastTimer _(FTM_INIT_FROM_PARAMS);
|
||||
{ LL_RECORD_BLOCK_TIME(FTM_INIT_FROM_PARAMS);
|
||||
widget->initFromParams(params);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "llsd.h"
|
||||
#include "lltrans.h"
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_UI_STRING("UI String");
|
||||
LLTrace::BlockTimerStatHandle FTM_UI_STRING("UI String");
|
||||
|
||||
|
||||
LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args)
|
||||
@@ -60,7 +60,7 @@ void LLUIString::setArgList(const LLStringUtil::format_map_t& args)
|
||||
|
||||
void LLUIString::setArgs(const LLSD& sd)
|
||||
{
|
||||
LLFastTimer timer(FTM_UI_STRING);
|
||||
LL_RECORD_BLOCK_TIME(FTM_UI_STRING);
|
||||
|
||||
if (!sd.isMap()) return;
|
||||
for(LLSD::map_const_iterator sd_it = sd.beginMap();
|
||||
@@ -123,7 +123,7 @@ void LLUIString::updateResult() const
|
||||
{
|
||||
mNeedsResult = false;
|
||||
|
||||
LLFastTimer timer(FTM_UI_STRING);
|
||||
LL_RECORD_BLOCK_TIME(FTM_UI_STRING);
|
||||
|
||||
// optimize for empty strings (don't attempt string replacement)
|
||||
if (mOrig.empty())
|
||||
|
||||
@@ -1601,11 +1601,11 @@ BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const
|
||||
//-----------------------------------------------------------------------------
|
||||
// getChildView()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_FIND_VIEWS("Find Widgets");
|
||||
static LLTrace::BlockTimerStatHandle FTM_FIND_VIEWS("Find Widgets");
|
||||
|
||||
LLView* LLView::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const
|
||||
{
|
||||
LLFastTimer ft(FTM_FIND_VIEWS);
|
||||
LL_RECORD_BLOCK_TIME(FTM_FIND_VIEWS);
|
||||
//richard: should we allow empty names?
|
||||
//if(name.empty())
|
||||
// return NULL;
|
||||
|
||||
@@ -679,12 +679,12 @@ LLXUIParser::LLXUIParser()
|
||||
}
|
||||
}
|
||||
|
||||
LLFastTimer::DeclareTimer FTM_PARSE_XUI("XUI Parsing");
|
||||
LLTrace::BlockTimerStatHandle FTM_PARSE_XUI("XUI Parsing");
|
||||
const LLXMLNodePtr DUMMY_NODE = new LLXMLNode();
|
||||
|
||||
void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename, bool silent)
|
||||
{
|
||||
LLFastTimer ft(FTM_PARSE_XUI);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PARSE_XUI);
|
||||
mNameStack.clear();
|
||||
mRootNodeName = node->getName()->mString;
|
||||
mCurFileName = filename;
|
||||
@@ -1396,7 +1396,7 @@ LLSimpleXUIParser::~LLSimpleXUIParser()
|
||||
|
||||
bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent)
|
||||
{
|
||||
LLFastTimer ft(FTM_PARSE_XUI);
|
||||
LL_RECORD_BLOCK_TIME(FTM_PARSE_XUI);
|
||||
|
||||
mParser = XML_ParserCreate(NULL);
|
||||
XML_SetUserData(mParser, this);
|
||||
|
||||
@@ -39,7 +39,7 @@ const S32 LLVFile::WRITE = 0x00000002;
|
||||
const S32 LLVFile::READ_WRITE = 0x00000003; // LLVFile::READ & LLVFile::WRITE
|
||||
const S32 LLVFile::APPEND = 0x00000006; // 0x00000004 & LLVFile::WRITE
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_VFILE_WAIT("VFile Wait");
|
||||
static LLTrace::BlockTimerStatHandle FTM_VFILE_WAIT("VFile Wait");
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
LLVFSThread* LLVFile::sVFSThread = NULL;
|
||||
@@ -315,7 +315,7 @@ BOOL LLVFile::setMaxSize(S32 size)
|
||||
|
||||
if (!mVFS->checkAvailable(size))
|
||||
{
|
||||
//LLFastTimer t(FTM_VFILE_WAIT);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VFILE_WAIT);
|
||||
S32 count = 0;
|
||||
while (sVFSThread->getPending() > 1000)
|
||||
{
|
||||
@@ -423,7 +423,7 @@ bool LLVFile::isLocked(EVFSLock lock)
|
||||
|
||||
void LLVFile::waitForLock(EVFSLock lock)
|
||||
{
|
||||
//LLFastTimer t(FTM_VFILE_WAIT);
|
||||
//LL_RECORD_BLOCK_TIME(FTM_VFILE_WAIT);
|
||||
// spin until the lock clears
|
||||
while (isLocked(lock))
|
||||
{
|
||||
|
||||
@@ -1874,8 +1874,8 @@ void LLWindowWin32::gatherInput()
|
||||
mMousePositionModified = FALSE;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_KEYHANDLER("Handle Keyboard");
|
||||
static LLFastTimer::DeclareTimer FTM_MOUSEHANDLER("Handle Mouse");
|
||||
static LLTrace::BlockTimerStatHandle FTM_KEYHANDLER("Handle Keyboard");
|
||||
static LLTrace::BlockTimerStatHandle FTM_MOUSEHANDLER("Handle Mouse");
|
||||
|
||||
LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param)
|
||||
{
|
||||
@@ -2136,7 +2136,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
window_imp->mRawLParam = l_param;
|
||||
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYUP");
|
||||
LLFastTimer t2(FTM_KEYHANDLER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_KEYHANDLER);
|
||||
|
||||
if (gDebugWindowProc)
|
||||
{
|
||||
@@ -2259,7 +2259,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDOWN");
|
||||
LLFastTimer t2(FTM_MOUSEHANDLER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
|
||||
sHandleLeftMouseUp = true;
|
||||
|
||||
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
|
||||
@@ -2332,7 +2332,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONUP");
|
||||
LLFastTimer t2(FTM_MOUSEHANDLER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
|
||||
|
||||
if (!sHandleLeftMouseUp)
|
||||
{
|
||||
@@ -2373,7 +2373,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_RBUTTONDOWN");
|
||||
LLFastTimer t2(FTM_MOUSEHANDLER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
|
||||
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
|
||||
{
|
||||
window_imp->interruptLanguageTextInput();
|
||||
@@ -2407,7 +2407,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
case WM_RBUTTONUP:
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_RBUTTONUP");
|
||||
LLFastTimer t2(FTM_MOUSEHANDLER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
|
||||
// Because we move the cursor position in the app, we need to query
|
||||
// to find out where the cursor at the time the event is handled.
|
||||
// If we don't do this, many clicks could get buffered up, and if the
|
||||
@@ -2437,7 +2437,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
// case WM_MBUTTONDBLCLK:
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONDOWN");
|
||||
LLFastTimer t2(FTM_MOUSEHANDLER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
|
||||
if (LLWinImm::isAvailable() && window_imp->mPreeditor)
|
||||
{
|
||||
window_imp->interruptLanguageTextInput();
|
||||
@@ -2471,7 +2471,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
case WM_MBUTTONUP:
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP");
|
||||
LLFastTimer t2(FTM_MOUSEHANDLER);
|
||||
LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER);
|
||||
// Because we move the cursor position in the llviewer app, we need to query
|
||||
// to find out where the cursor at the time the event is handled.
|
||||
// If we don't do this, many clicks could get buffered up, and if the
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -33,18 +33,16 @@ out vec4 frag_color;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform sampler2DRect depthMapDownsampled;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D depthMapDownsampled;
|
||||
uniform sampler2D 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;
|
||||
uniform vec2 kern_scale;
|
||||
|
||||
vec3 decode_normal (vec2 enc)
|
||||
{
|
||||
@@ -59,9 +57,8 @@ vec3 decode_normal (vec2 enc)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMapDownsampled, pos_screen.xy*downsampled_depth_scale).r;
|
||||
float depth = texture2D(depthMapDownsampled, 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;
|
||||
@@ -90,7 +87,7 @@ vec2 getKern(int i)
|
||||
float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
{
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy / kern_scale / 128).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;
|
||||
@@ -98,13 +95,13 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
|
||||
// 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));
|
||||
vec2 scale = max(32.0, min(ssao_radius / -pos.z, ssao_max_radius)) * kern_scale;
|
||||
|
||||
// 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 samppos_world = getPosition(samppos_screen).xyz;
|
||||
|
||||
vec3 diff = samppos_world - pos.xyz;
|
||||
|
||||
@@ -119,8 +116,9 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
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.
|
||||
}
|
||||
@@ -133,7 +131,7 @@ void main()
|
||||
|
||||
vec4 pos = getPosition(pos_screen);
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
|
||||
vec3 norm = texture2D(normalMap, pos_screen).xyz;
|
||||
norm = decode_normal(norm.xy);
|
||||
|
||||
frag_color = vec4(calcAmbientOcclusion(pos,norm),0,0,0);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#define INDEXED 1
|
||||
#define NON_INDEXED 2
|
||||
@@ -93,7 +93,6 @@ vec3 vary_AdditiveColor;
|
||||
vec3 vary_AtmosAttenuation;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform vec4 light_position[8];
|
||||
uniform vec3 light_direction[8];
|
||||
@@ -486,7 +485,6 @@ void main()
|
||||
|
||||
#if HAS_SHADOW
|
||||
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
|
||||
frag *= screen_res;
|
||||
vec4 spos = pos;
|
||||
|
||||
if (spos.z > -shadow_clip.w)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,20 +31,18 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D lightMap;
|
||||
|
||||
uniform float dist_factor;
|
||||
uniform float blur_size;
|
||||
uniform vec2 delta;
|
||||
//uniform vec3 kern[4];
|
||||
uniform float kern_scale;
|
||||
uniform vec2 kern_scale;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
vec2 getKern(int i)
|
||||
{
|
||||
@@ -59,9 +57,8 @@ vec2 getKern(int i)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(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;
|
||||
@@ -89,14 +86,14 @@ vec3 decode_normal (vec2 enc)
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
vec3 norm = texture2DRect(normalMap, tc).xyz;
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
vec3 norm = texture2D(normalMap, tc).xyz;
|
||||
norm = decode_normal(norm.xy); // unpack norm
|
||||
|
||||
vec3 pos = getPosition(tc).xyz;
|
||||
vec4 ccol = texture2DRect(lightMap, tc).rgba;
|
||||
|
||||
vec2 dlt = kern_scale * delta / (vec2(1.0)+norm.xy*norm.xy);
|
||||
vec4 ccol = texture2D(lightMap, tc).rgba;
|
||||
|
||||
vec2 dlt = delta / (vec2(1.0)+norm.xy*norm.xy);
|
||||
dlt /= max(-pos.z*dist_factor, 1.0);
|
||||
|
||||
vec2 defined_weight = getKern(0).xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
|
||||
@@ -106,20 +103,20 @@ void main()
|
||||
float pointplanedist_tolerance_pow2 = pos.z*-0.001;
|
||||
|
||||
// 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
|
||||
vec2 tc_v = fract(0.5 * tc.xy / kern_scale); // 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) * dlt * 0.5 );
|
||||
tc += ( (tc_mod - 0.5) * dlt * 0.5 ) * kern_scale;
|
||||
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
vec2 samptc = (tc + i * dlt);
|
||||
vec3 samppos = getPosition(samptc).xyz;
|
||||
vec3 samppos = getPosition(samptc).xyz;
|
||||
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
|
||||
|
||||
if (d*d <= pointplanedist_tolerance_pow2)
|
||||
{
|
||||
vec4 weight = getKern(i).xyxx;
|
||||
col += texture2DRect(lightMap, samptc)*weight;
|
||||
col += texture2D(lightMap, samptc)*weight;
|
||||
defined_weight += weight.xy;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +129,7 @@ void main()
|
||||
if (d*d <= pointplanedist_tolerance_pow2)
|
||||
{
|
||||
vec4 weight = getKern(i).xyxx;
|
||||
col += texture2DRect(lightMap, samptc)*weight;
|
||||
col += texture2D(lightMap, samptc)*weight;
|
||||
defined_weight += weight.xy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file blurLightF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,8 +31,8 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D bloomMap;
|
||||
|
||||
uniform float depth_cutoff;
|
||||
@@ -44,13 +44,12 @@ uniform float magnification;
|
||||
uniform float max_cof;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
float getDepth(vec2 pos_screen)
|
||||
{
|
||||
float z = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float z = texture2D(depthMap, pos_screen.xy).r;
|
||||
z = z*2.0-1.0;
|
||||
vec4 ndc = vec4(0.0, 0.0, z, 1.0);
|
||||
vec4 p = inv_proj*ndc;
|
||||
@@ -78,13 +77,13 @@ void main()
|
||||
|
||||
float depth = getDepth(tc);
|
||||
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
|
||||
vec4 diff = texture2D(diffuseRect, vary_fragcoord.xy);
|
||||
|
||||
float sc = calc_cof(depth);
|
||||
sc = min(sc, max_cof);
|
||||
sc = max(sc, -max_cof);
|
||||
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy);
|
||||
frag_color.rgb = diff.rgb + bloom.rgb;
|
||||
frag_color.a = sc/max_cof*0.5+0.5;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,34 +31,34 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D lightMap;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform float max_cof;
|
||||
uniform float res_scale;
|
||||
uniform float dof_width;
|
||||
uniform float dof_height;
|
||||
uniform float kern_scale;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
vec4 dofSample(sampler2DRect tex, vec2 tc)
|
||||
vec4 dofSample(sampler2D tex, vec2 tc)
|
||||
{
|
||||
tc.x = min(tc.x, dof_width);
|
||||
tc.y = min(tc.y, dof_height);
|
||||
|
||||
return texture2DRect(tex, tc);
|
||||
return texture2D(tex, tc);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
vec2 tc = vary_fragcoord.xy * res_scale;
|
||||
|
||||
vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale);
|
||||
vec4 dof = dofSample(diffuseRect, tc);
|
||||
|
||||
vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy);
|
||||
vec4 diff = texture2D(lightMap, vary_fragcoord.xy);
|
||||
|
||||
float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0);
|
||||
|
||||
@@ -67,10 +67,10 @@ void main()
|
||||
float sc = a/res_scale;
|
||||
|
||||
vec4 col;
|
||||
col = texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,-sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,-sc));
|
||||
col = texture2D(lightMap, vary_fragcoord.xy+vec2(sc,sc)*kern_scale);
|
||||
col += texture2D(lightMap, vary_fragcoord.xy+vec2(-sc,sc)*kern_scale);
|
||||
col += texture2D(lightMap, vary_fragcoord.xy+vec2(sc,-sc)*kern_scale);
|
||||
col += texture2D(lightMap, vary_fragcoord.xy+vec2(-sc,-sc)*kern_scale);
|
||||
|
||||
diff = mix(diff, col*0.25, a);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,11 +31,11 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D depthMap;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragDepth = texture2DRect(depthMap, vary_fragcoord.xy).r;
|
||||
gl_FragDepth = texture2D(depthMap, vary_fragcoord.xy).r;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
//#extension GL_ARB_shader_texture_lod : enable
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -34,7 +31,9 @@ out vec4 frag_color;
|
||||
|
||||
#define FXAA_PC 1
|
||||
//#define FXAA_GLSL_130 1
|
||||
#ifndef FXAA_QUALITY_M_PRESET
|
||||
#define FXAA_QUALITY_M_PRESET 12
|
||||
#endif
|
||||
|
||||
/*============================================================================
|
||||
|
||||
@@ -2109,11 +2108,10 @@ uniform vec2 rcp_screen_res;
|
||||
uniform vec4 rcp_frame_opt;
|
||||
uniform vec4 rcp_frame_opt2;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
VARYING vec2 vary_tc;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = FxaaPixelShader(vary_tc, //pos
|
||||
vec4 diff = FxaaPixelShader(vary_fragcoord, //pos
|
||||
vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos
|
||||
diffuseMap, //tex
|
||||
diffuseMap,
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file luminanceF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform sampler2DRect diffuseMap;
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
#else
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = texture2DRect(diffuseMap, vary_fragcoord.xy);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* @file giV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
VARYING vec4 vertex_color;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
|
||||
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
|
||||
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
@@ -29,7 +29,6 @@
|
||||
#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
|
||||
|
||||
uniform float emissive_brightness;
|
||||
//uniform float display_gamma;
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs)
|
||||
{
|
||||
@@ -147,7 +146,6 @@ vec3 vary_AdditiveColor;
|
||||
vec3 vary_AtmosAttenuation;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform vec4 light_position[8];
|
||||
uniform vec3 light_direction[8];
|
||||
@@ -276,7 +274,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
|
||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||
{
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= 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;
|
||||
|
||||
@@ -46,7 +46,6 @@ uniform mat4 modelview_matrix;
|
||||
VARYING vec3 vary_position;
|
||||
#if HAS_SUN_SHADOW
|
||||
VARYING vec2 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -144,7 +143,7 @@ vary_normal = n;
|
||||
vary_position = pos;
|
||||
#endif
|
||||
#if HAS_SUN_SHADOW
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,10 +31,10 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D normalMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D lightFunc;
|
||||
@@ -49,7 +49,6 @@ uniform vec4 light[LIGHT_COUNT];
|
||||
uniform vec4 light_col[LIGHT_COUNT];
|
||||
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform float far_z;
|
||||
|
||||
@@ -74,9 +73,8 @@ vec3 decode_normal (vec2 enc)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(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;
|
||||
@@ -87,18 +85,18 @@ vec4 getPosition(vec2 pos_screen)
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
|
||||
vec2 frag = (vary_fragcoord.xy*0.5+0.5);
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
if (pos.z < far_z)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
norm = decode_normal(norm.xy); // unpack norm
|
||||
norm = normalize(norm);
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
vec3 diff = texture2D(diffuseRect, frag.xy).rgb;
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
vec3 out_col = vec3(0,0,0);
|
||||
|
||||
@@ -31,13 +31,11 @@ out vec4 frag_color;
|
||||
|
||||
//class 1 -- no shadows
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
//#extension GL_ARB_shader_texture_lod : enable
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D projectionMap;
|
||||
@@ -64,7 +62,6 @@ uniform float falloff;
|
||||
uniform float size;
|
||||
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
@@ -153,9 +150,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(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;
|
||||
@@ -169,7 +165,6 @@ void main()
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
frag.xy *= screen_res;
|
||||
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
vec3 lv = center.xyz-pos.xyz;
|
||||
@@ -180,7 +175,7 @@ void main()
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
float envIntensity = norm.z;
|
||||
|
||||
norm = decode_normal(norm.xy);
|
||||
@@ -212,7 +207,7 @@ void main()
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
@@ -251,7 +246,7 @@ void main()
|
||||
}
|
||||
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
@@ -289,11 +284,12 @@ void main()
|
||||
if (ds < 0.0)
|
||||
{
|
||||
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
|
||||
|
||||
|
||||
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
|
||||
stc /= stc.w;
|
||||
|
||||
if (stc.z > 0.0)
|
||||
{
|
||||
stc /= stc.w;
|
||||
float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0);
|
||||
|
||||
stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,13 +31,13 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D normalMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D lightFunc;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D depthMap;
|
||||
|
||||
uniform vec3 env_mat[3];
|
||||
uniform float sun_wash;
|
||||
@@ -49,8 +49,6 @@ uniform float size;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
VARYING vec3 trans_center;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec4 viewport;
|
||||
|
||||
@@ -73,9 +71,8 @@ vec3 decode_normal (vec2 enc)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
vec2 sc = (pos_screen.xy-viewport.xy)*2.0;
|
||||
sc /= viewport.zw;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc -= vec2(1.0,1.0);
|
||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||
vec4 pos = inv_proj * ndc;
|
||||
@@ -89,7 +86,6 @@ void main()
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
frag.xy *= screen_res;
|
||||
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
vec3 lv = trans_center.xyz-pos;
|
||||
@@ -100,7 +96,7 @@ void main()
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
norm = decode_normal(norm.xy); // unpack norm
|
||||
float da = dot(norm, lv);
|
||||
if (da < 0.0)
|
||||
@@ -114,7 +110,7 @@ void main()
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
|
||||
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
vec3 col = texture2D(diffuseRect, frag.xy).rgb;
|
||||
float fa = falloff+1.0;
|
||||
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
@@ -124,7 +120,7 @@ void main()
|
||||
|
||||
col = color.rgb*lit*col;
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
lit = min(da*6.0, 1.0) * dist_atten;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,18 +31,18 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2D diffuseRect;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
uniform float max_cof;
|
||||
uniform float res_scale;
|
||||
uniform vec2 kern_scale;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc)
|
||||
{
|
||||
vec4 s = texture2DRect(diffuseRect, tc);
|
||||
vec4 s = texture2D(diffuseRect, tc);
|
||||
|
||||
float sc = abs(s.a*2.0-1.0)*max_cof;
|
||||
|
||||
@@ -61,7 +61,7 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc)
|
||||
|
||||
void dofSampleNear(inout vec4 diff, inout float w, float min_sc, vec2 tc)
|
||||
{
|
||||
vec4 s = texture2DRect(diffuseRect, tc);
|
||||
vec4 s = texture2D(diffuseRect, tc);
|
||||
|
||||
float wg = 0.25;
|
||||
|
||||
@@ -77,7 +77,7 @@ void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
|
||||
vec4 diff = texture2D(diffuseRect, tc);
|
||||
|
||||
{
|
||||
float w = 1.0;
|
||||
@@ -98,7 +98,7 @@ void main()
|
||||
float samp_x = sc*sin(ang);
|
||||
float samp_y = sc*cos(ang);
|
||||
// you could test sample coords against an interesting non-circular aperture shape here, if desired.
|
||||
dofSampleNear(diff, w, sc, vary_fragcoord.xy + vec2(samp_x,samp_y));
|
||||
dofSampleNear(diff, w, sc, tc + vec2(samp_x,samp_y) * kern_scale);
|
||||
}
|
||||
sc -= 1.0;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ void main()
|
||||
float samp_x = sc*sin(ang);
|
||||
float samp_y = sc*cos(ang);
|
||||
// you could test sample coords against an interesting non-circular aperture shape here, if desired.
|
||||
dofSample(diff, w, sc, vary_fragcoord.xy + vec2(samp_x,samp_y));
|
||||
dofSample(diff, w, sc, tc + vec2(samp_x,samp_y) * kern_scale);
|
||||
}
|
||||
sc -= 1.0;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,9 +31,8 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2D diffuseRect;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
//uniform float display_gamma;
|
||||
@@ -60,7 +59,7 @@ vec3 linear_to_srgb(vec3 cl)
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
|
||||
vec4 diff = texture2D(diffuseRect, vary_fragcoord);
|
||||
diff.rgb = linear_to_srgb(diff.rgb);
|
||||
frag_color = diff;
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -31,17 +31,16 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D bloomMap;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
|
||||
vec4 diff = texture2D(diffuseRect, vary_fragcoord.xy);
|
||||
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy);
|
||||
frag_color = diff + bloom;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,10 @@ ATTRIBUTE vec3 position;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5);
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* @file postDeferredV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
VARYING vec2 vary_tc;
|
||||
|
||||
uniform vec2 tc_scale;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
vary_tc = (pos.xy*0.5+0.5)*tc_scale;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
}
|
||||
@@ -23,8 +23,6 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
//#extension GL_ARB_shader_texture_lod : enable
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -32,12 +30,11 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect positionMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D lightMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
@@ -76,7 +73,6 @@ vec3 vary_AdditiveColor;
|
||||
vec3 vary_AtmosAttenuation;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs)
|
||||
{
|
||||
@@ -129,7 +125,6 @@ vec3 decode_normal (vec2 enc)
|
||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||
{
|
||||
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;
|
||||
@@ -140,7 +135,7 @@ vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{ //get position in screen space (world units) given window coordinate and depth map
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).a;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).a;
|
||||
return getPosition_d(pos_screen, depth);
|
||||
}
|
||||
|
||||
@@ -381,13 +376,13 @@ float luminance(vec3 color)
|
||||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
float depth = texture2DRect(depthMap, tc.xy).r;
|
||||
float depth = texture2D(depthMap, tc.xy).r;
|
||||
vec3 pos = getPosition_d(tc, depth).xyz;
|
||||
vec4 norm = texture2DRect(normalMap, tc);
|
||||
vec4 norm = texture2D(normalMap, tc);
|
||||
float envIntensity = norm.z;
|
||||
norm.xyz = decode_normal(norm.xy); // unpack norm
|
||||
|
||||
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
||||
vec4 diffuse = texture2D(diffuseRect, tc);
|
||||
|
||||
//convert to gamma space
|
||||
diffuse.rgb = linear_to_srgb(diffuse.rgb);
|
||||
@@ -395,7 +390,7 @@ void main()
|
||||
vec3 col;
|
||||
float bloom = 0.0;
|
||||
{
|
||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||
vec4 spec = texture2D(specularRect, vary_fragcoord.xy);
|
||||
bloom = spec.r*norm.w;
|
||||
if (norm.w < 0.5)
|
||||
{
|
||||
@@ -470,7 +465,7 @@ void main()
|
||||
//col.g = envIntensity;
|
||||
}
|
||||
|
||||
frag_color.rgb = col.rgb;
|
||||
frag_color.rgb = col;
|
||||
|
||||
frag_color.a = bloom;
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* @file softenLightF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
}
|
||||
@@ -23,8 +23,6 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
//#extension GL_ARB_shader_texture_lod : enable
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -34,10 +32,10 @@ out vec4 frag_color;
|
||||
|
||||
//class 1 -- no shadows
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D projectionMap;
|
||||
@@ -64,7 +62,6 @@ uniform float falloff;
|
||||
|
||||
VARYING vec3 trans_center;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
@@ -159,9 +156,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(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;
|
||||
@@ -175,7 +171,6 @@ void main()
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
frag.xy *= screen_res;
|
||||
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
vec3 lv = trans_center.xyz-pos.xyz;
|
||||
@@ -187,7 +182,7 @@ void main()
|
||||
}
|
||||
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
float envIntensity = norm.z;
|
||||
norm = decode_normal(norm.xy);
|
||||
|
||||
@@ -218,9 +213,9 @@ void main()
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
//class 1, no shadow, no SSAO, should never be called
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
|
||||
@@ -27,8 +27,6 @@ uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
@@ -33,17 +33,16 @@ out vec4 frag_color;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform sampler2DRect depthMapDownsampled;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D depthMap;
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform float downsampled_depth_scale;
|
||||
uniform vec2 screen_res;
|
||||
uniform sampler2D diffuseRect;
|
||||
|
||||
uniform vec2 kern_scale;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color[0] = 1.0;
|
||||
frag_color[1] = texture2DRect(diffuseRect,vary_fragcoord.xy*downsampled_depth_scale).r;
|
||||
frag_color[1] = texture2D(diffuseRect,vary_fragcoord.xy * kern_scale).r;
|
||||
frag_color[2] = 1.0;
|
||||
frag_color[3] = 1.0;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user