Compare commits

...

9 Commits

Author SHA1 Message Date
Siana Gearz
8e19372adf Merge branch 'V2Baking' of git://github.com/Shyotl/SingularityViewer into V2Baking
Conflicts:
	indra/llrender/llshadermgr.cpp
	indra/newview/llmorphview.cpp
	indra/newview/lltexlayer.cpp
	indra/newview/lltexlayer.h
	indra/newview/lltoolmorph.cpp
	indra/newview/llvoavatar.cpp
	indra/newview/llvoavatar.h
2012-01-06 14:18:46 +01:00
Shyotl
6381e4d9a4 Merge branch 'future' into V2Baking 2011-10-31 20:41:58 -05:00
Shyotl
d9f674218f Lineending fixup 2011-10-31 20:38:41 -05:00
Shyotl
693e3a0555 vary_texture_index only needed in shaders when batching. 2011-10-31 20:38:29 -05:00
Shyotl
8376e890b2 Hide the mouse cursor a bit better when grabbing items in mouselook. 2011-10-31 20:37:11 -05:00
Shyotl
33827bf8b0 Added a bit of debug output for viewer tool states. 2011-10-31 20:36:47 -05:00
Shyotl
06349951d2 Added tracking of requested(and pending) attachments. Moved Ascent code out of attach/detach functions and into their own for better manageability. 2011-10-27 21:41:19 -05:00
Shyotl
4d68dc7c57 LLTexLayer refactored. Tried to keep behavior changes as minimal as possible. Consider as base slate for changes required for multi-wearables. 2011-10-25 16:50:39 -05:00
Shyotl
722e7d09ff Innitial commit. Majority of texture baking moved into LLVOAvatarSelf. Very WIP. Not advisable to build off of this, although it does compile and mostly work. 2011-10-22 20:36:04 -05:00
35 changed files with 3377 additions and 3609 deletions

View File

@@ -396,7 +396,9 @@ set(viewer_SOURCE_FILES
llstylemap.cpp
llsurface.cpp
llsurfacepatch.cpp
lltexglobalcolor.cpp
lltexlayer.cpp
lltexlayerparams.cpp
lltexturecache.cpp
lltexturectrl.cpp
lltexturefetch.cpp
@@ -869,7 +871,9 @@ set(viewer_HEADER_FILES
llsurface.h
llsurfacepatch.h
lltable.h
lltexglobalcolor.h
lltexlayer.h
lltexlayerparams.h
lltexturecache.h
lltexturectrl.h
lltexturefetch.h

View File

@@ -98,13 +98,11 @@ void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl, void* userdata)
gSavedSettings.setString("AscentReportClientUUID", client_uuid);
gSavedSettings.setU32("AscentReportClientIndex", client_index);
LLVOAvatar* avatar = gAgentAvatarp;
if (avatar)
if (isAgentAvatarValid())
{
// Slam pending upload count to "unstick" things
bool slam_for_debug = true;
avatar->forceBakeAllTextures(slam_for_debug);
gAgentAvatarp->forceBakeAllTextures(slam_for_debug);
}
}
}

View File

@@ -360,8 +360,7 @@ void LLCOFMgr::onLinkAttachmentComplete(const LLUUID& idItem)
void LLCOFMgr::updateAttachments()
{
/*const*/ LLVOAvatar* pAvatar = gAgentAvatarp;
if (!pAvatar)
if (!isAgentAvatarValid())
return;
const LLUUID idCOF = getCOF();
@@ -375,7 +374,7 @@ void LLCOFMgr::updateAttachments()
while (itPendingAttachLink != m_PendingAttachLinks.end())
{
const LLUUID& idItem = *itPendingAttachLink;
if ( (!pAvatar->isWearingAttachment(idItem)) || (isLinkInCOF(idItem)) )
if ( (!gAgentAvatarp->isWearingAttachment(idItem)) || (isLinkInCOF(idItem)) )
{
itPendingAttachLink = m_PendingAttachLinks.erase(itPendingAttachLink);
continue;
@@ -389,7 +388,7 @@ void LLCOFMgr::updateAttachments()
}
// Don't remove attachments until avatar is fully loaded (should reduce random attaching/detaching/reattaching at log-on)
LLAgentWearables::userUpdateAttachments(items, !pAvatar->isFullyLoaded());
LLAgentWearables::userUpdateAttachments(items, !gAgentAvatarp->isFullyLoaded());
}
// ============================================================================

View File

@@ -670,8 +670,7 @@ void LocalAssetBrowser::PerformTimedActions(void)
// one of the layer bitmaps has been updated, we need to rebake.
if ( mLayerUpdated )
{
LLVOAvatar* avatar = gAgentAvatarp;
if (avatar) { avatar->forceBakeAllTextures(SLAM_FOR_DEBUG); }
if (isAgentAvatarValid()) { gAgentAvatarp->forceBakeAllTextures(SLAM_FOR_DEBUG); }
mLayerUpdated = false;
}

View File

@@ -2392,7 +2392,7 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came
gFocusMgr.setKeyboardFocus( NULL );
gFocusMgr.setMouseCapture( NULL );
LLVOAvatar::onCustomizeStart();
LLVOAvatarSelf::onCustomizeStart();
if (isAgentAvatarValid())
{

View File

@@ -918,8 +918,7 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void
LLUUID item_id = wearable_data->second;
delete wearable_data;
LLVOAvatar* avatar = gAgentAvatarp;
if( !avatar )
if( !isAgentAvatarValid() )
{
return;
}
@@ -931,11 +930,11 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void
gAgentWearables.setWearable(type,wearable);
// disable composites if initial textures are baked
avatar->setupComposites();
gAgentAvatarp->setupComposites();
gAgentWearables.queryWearableCache();
wearable->writeToAvatar( FALSE );
avatar->setCompositeUpdatesEnabled(TRUE);
gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
gInventory.addChangedMask( LLInventoryObserver::LABEL, item_id );
}
else
@@ -969,7 +968,7 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void
// If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive.
if( !gAgentCamera.cameraCustomizeAvatar() )
{
avatar->requestLayerSetUploads();
gAgentAvatarp->requestLayerSetUploads();
}
}
}

View File

@@ -116,7 +116,7 @@ private:
Impl* mImpl;
};
class LLBakedUploadData;
struct LLBakedUploadData;
class LLSendTexLayerResponder : public LLAssetUploadResponder
{
LOG_CLASS(LLSendTexLayerResponder);

View File

@@ -763,8 +763,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLUICtrl* ctrl, void* userdata)
{
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
LLCheckBoxCtrl* checkbox_ctrl = (LLCheckBoxCtrl*) ctrl;
LLVOAvatar *avatar = gAgentAvatarp;
if (!avatar)
if (!isAgentAvatarValid())
{
return;
}
@@ -775,13 +774,13 @@ void LLPanelEditWearable::onInvisibilityCommit(LLUICtrl* ctrl, void* userdata)
if (new_invis_state)
{
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(IMG_INVISIBLE);
const LLTextureEntry* current_te = avatar->getTE(te);
const LLTextureEntry* current_te = gAgentAvatarp->getTE(te);
if (current_te)
{
self->mPreviousTextureList[(S32)te] = current_te->getID();
}
avatar->setLocTexTE(te, image, TRUE);
avatar->wearableUpdated(self->mType, FALSE);
gAgentAvatarp->setLocalTextureTE(te, image, TRUE);
gAgentAvatarp->wearableUpdated(self->mType, FALSE);
}
else
{
@@ -794,8 +793,8 @@ void LLPanelEditWearable::onInvisibilityCommit(LLUICtrl* ctrl, void* userdata)
if (prev_id.notNull())
{
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(prev_id);
avatar->setLocTexTE(te, image, TRUE);
avatar->wearableUpdated(self->mType, FALSE);
gAgentAvatarp->setLocalTextureTE(te, image, TRUE);
gAgentAvatarp->wearableUpdated(self->mType, FALSE);
}
}
@@ -813,23 +812,24 @@ void LLPanelEditWearable::onColorCommit( LLUICtrl* ctrl, void* userdata )
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
LLColorSwatchCtrl* color_ctrl = (LLColorSwatchCtrl*) ctrl;
LLVOAvatar* avatar = gAgentAvatarp;
if( self && color_ctrl && avatar )
if(!isAgentAvatarValid())
return;
if( self && color_ctrl)
{
std::map<std::string, S32>::const_iterator cl_itr = self->mColorList.find(ctrl->getName());
if(cl_itr != self->mColorList.end())
{
ETextureIndex te = (ETextureIndex)cl_itr->second;
LLColor4 old_color = avatar->getClothesColor( te );
LLColor4 old_color = gAgentAvatarp->getClothesColor( te );
const LLColor4& new_color = color_ctrl->get();
if( old_color != new_color )
{
// Set the new version
avatar->setClothesColor( te, new_color, TRUE );
gAgentAvatarp->setClothesColor( te, new_color, TRUE );
LLVisualParamHint::requestHintUpdates();
avatar->wearableUpdated(self->mType, FALSE);
gAgentAvatarp->wearableUpdated(self->mType, FALSE);
}
}
}
@@ -893,8 +893,7 @@ void LLPanelEditWearable::onTextureCommit( LLUICtrl* ctrl, void* userdata )
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
LLTextureCtrl* texture_ctrl = (LLTextureCtrl*) ctrl;
LLVOAvatar* avatar = gAgentAvatarp;
if( avatar )
if( isAgentAvatarValid() )
{
ETextureIndex te = (ETextureIndex)(self->mTextureList[ctrl->getName()]);
@@ -907,8 +906,8 @@ void LLPanelEditWearable::onTextureCommit( LLUICtrl* ctrl, void* userdata )
self->mTextureList[ctrl->getName()] = te;
if (gAgentWearables.getWearable(self->mType))
{
avatar->setLocTexTE(te, image, TRUE);
avatar->wearableUpdated(self->mType, FALSE);
gAgentAvatarp->setLocalTextureTE(te, image, TRUE);
gAgentAvatarp->wearableUpdated(self->mType, FALSE);
}
if (self->mType == LLWearableType::WT_ALPHA && image->getID() != IMG_INVISIBLE)
{
@@ -1989,12 +1988,11 @@ void LLFloaterCustomize::onBtnOk( void* userdata )
LLFloaterCustomize* floater = (LLFloaterCustomize*) userdata;
gAgentWearables.saveAllWearables();
LLVOAvatar* avatar = gAgentAvatarp;
if ( avatar )
if ( isAgentAvatarValid() )
{
avatar->invalidateAll();
gAgentAvatarp->invalidateAll();
avatar->requestLayerSetUploads();
gAgentAvatarp->requestLayerSetUploads();
gAgent.sendAgentSetAppearance();
}

View File

@@ -1623,8 +1623,7 @@ BOOL LLFolderBridge::isItemRemovable()
return FALSE;
}
LLVOAvatar* avatar = gAgentAvatarp;
if( !avatar )
if( !isAgentAvatarValid() )
{
return FALSE;
}
@@ -1667,7 +1666,7 @@ BOOL LLFolderBridge::isItemRemovable()
}
else if (item->getType() == LLAssetType::AT_OBJECT && !item->getIsLinkType())
{
if( avatar->isWearingAttachment( item->getUUID() ) )
if( gAgentAvatarp->isWearingAttachment( item->getUUID() ) )
{
return FALSE;
}
@@ -4028,17 +4027,16 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
LLInventoryItem* item = gInventory.getItem(mUUID);
if(item)
{
LLVOAvatar::detachAttachmentIntoInventory(item->getLinkedUUID());
LLVOAvatarSelf::detachAttachmentIntoInventory(item->getLinkedUUID());
}
}
else if ("edit" == action)
{
if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT))
return;
LLVOAvatar* avatarp = gAgentAvatarp;
if (!avatarp)
if (!isAgentAvatarValid())
return;
LLViewerObject* objectp = avatarp->getWornAttachment(mUUID);
LLViewerObject* objectp = gAgentAvatarp->getWornAttachment(mUUID);
if (!objectp)
return;
@@ -4085,12 +4083,11 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
void LLObjectBridge::openItem()
{
LLVOAvatar* avatar = gAgentAvatarp;
if (!avatar)
if (!isAgentAvatarValid())
{
return;
}
if (avatar->isWearingAttachment(mUUID))
if (gAgentAvatarp->isWearingAttachment(mUUID))
{
// [RLVa:KB]
if ( !(rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(getItem())))
@@ -4105,12 +4102,11 @@ void LLObjectBridge::openItem()
std::string LLObjectBridge::getLabelSuffix() const
{
LLVOAvatar* avatar = gAgentAvatarp;
if( avatar && avatar->isWearingAttachment( mUUID ) )
if( isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment( mUUID ) )
{
std::string attachment_point_name = avatar->getAttachedPointName(mUUID);
std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID);
LLStringUtil::toLower(attachment_point_name);
LLViewerObject* pObj = (rlv_handler_t::isEnabled()) ? avatar->getWornAttachment( mUUID ) : NULL;
LLViewerObject* pObj = (rlv_handler_t::isEnabled()) ? gAgentAvatarp->getWornAttachment( mUUID ) : NULL;
// [RLVa:KB]
if ( pObj && (gRlvAttachmentLocks.isLockedAttachment(pObj) ||
gRlvAttachmentLocks.isLockedAttachmentPoint(RlvAttachPtLookup::getAttachPointIndex(pObj),RLV_LOCK_REMOVE)))
@@ -4123,10 +4119,10 @@ std::string LLObjectBridge::getLabelSuffix() const
else
{
// <edit> testzone attachpt
if(avatar)
if(isAgentAvatarValid())
{
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator iter = avatar->mUnsupportedAttachmentPoints.begin();
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator end = avatar->mUnsupportedAttachmentPoints.end();
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator iter = gAgentAvatarp->mUnsupportedAttachmentPoints.begin();
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator end = gAgentAvatarp->mUnsupportedAttachmentPoints.end();
for( ; iter != end; ++iter)
if((*iter).second.first == mUUID)
{
@@ -4155,9 +4151,20 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
attachment = RlvAttachPtLookup::getAttachPoint(item);
}
// [/RLVa:KB]
const LLUUID& item_id = item->getLinkedUUID();
// Check for duplicate request.
if (isAgentAvatarValid() &&
(gAgentAvatarp->attachmentWasRequested(item_id) ||
gAgentAvatarp->isWearingAttachment(item_id)))
{
llwarns << "duplicate attachment request, ignoring" << llendl;
return;
}
gAgentAvatarp->addAttachmentRequest(item_id);
S32 attach_pt = 0;
if (gAgentAvatarp && attachment)
if (isAgentAvatarValid() && attachment)
{
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
@@ -4171,11 +4178,12 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
}
LLSD payload;
payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link.
payload["item_id"] = item_id; // Wear the base object in case this is a link.
payload["attachment_point"] = attach_pt;
payload["is_add"] = !replace;
if (replace && attachment && attachment->getNumObjects() > 0)
if (replace &&
(attachment && attachment->getNumObjects() > 0))
{
// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
// Block if we can't "replace wear" what's currently there
@@ -4247,8 +4255,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
LLInventoryItem* item = getItem();
if(item)
{
LLVOAvatar *avatarp = gAgentAvatarp;
if( !avatarp )
if( !isAgentAvatarValid() )
{
return;
}
@@ -4266,7 +4273,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
else
// <edit> testzone attachpt
if( avatarp->isWearingUnsupportedAttachment( mUUID ) )
if( gAgentAvatarp->isWearingUnsupportedAttachment( mUUID ) )
{
items.push_back(std::string("Detach From Yourself"));
}
@@ -4278,7 +4285,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
items.push_back(std::string("Object Wear"));
if (gHippoGridManager->getConnectedGrid()->supportsInvLinks())
items.push_back(std::string("Object Add"));
if (!avatarp->canAttachMoreObjects())
if (!gAgentAvatarp->canAttachMoreObjects())
{
disabled_items.push_back(std::string("Object Add"));
}
@@ -4287,7 +4294,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
// commented out for DEV-32347 - AND Commented back in for non-morons. -HgB
items.push_back(std::string("Restore to Last Position"));
if (!avatarp->canAttachMoreObjects())
if (!gAgentAvatarp->canAttachMoreObjects())
{
disabled_items.push_back(std::string("Object Wear"));
disabled_items.push_back(std::string("Object Add"));
@@ -4310,11 +4317,10 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
if (attach_menu
&& (attach_menu->getChildCount() == 0)
&& attach_hud_menu
&& (attach_hud_menu->getChildCount() == 0)
&& avatarp)
&& (attach_hud_menu->getChildCount() == 0))
{
for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
iter != avatarp->mAttachmentPoints.end(); )
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
@@ -4374,10 +4380,9 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
model->updateItem(new_item);
model->notifyObservers();
LLVOAvatar* avatar = gAgentAvatarp;
if( avatar )
if( isAgentAvatarValid() )
{
LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() );
LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
if( obj )
{
LLSelectMgr::getInstance()->deselectAll();
@@ -5148,7 +5153,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata)
LLViewerInventoryItem *obj_item = obj_item_array.get(i);
if (get_is_item_worn(obj_item->getUUID()))
{
LLVOAvatar::detachAttachmentIntoInventory(obj_item->getLinkedUUID());
LLVOAvatarSelf::detachAttachmentIntoInventory(obj_item->getLinkedUUID());
}
}
}

View File

@@ -3647,7 +3647,6 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
return false;
bool allowed = false;
LLVOAvatar* my_avatar = NULL;
switch(item->getType())
{
@@ -3656,8 +3655,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
break;
case LLAssetType::AT_OBJECT:
my_avatar = gAgentAvatarp;
if(my_avatar && !my_avatar->isWearingAttachment(item->getUUID()))
if(isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
{
allowed = true;
}

View File

@@ -110,7 +110,7 @@ void LLMorphView::initialize()
//-----------------------------------------------------------------------------
void LLMorphView::shutdown()
{
LLVOAvatar::onCustomizeEnd();
LLVOAvatarSelf::onCustomizeEnd();
if (isAgentAvatarValid())
{

View File

@@ -231,10 +231,9 @@ void LLPreview::onCommit()
// update the object itself.
if( item->getType() == LLAssetType::AT_OBJECT )
{
LLVOAvatar* avatar = gAgentAvatarp;
if( avatar )
if( isAgentAvatarValid() )
{
LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() );
LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
if( obj )
{
LLSelectMgr::getInstance()->deselectAll();

View File

@@ -3462,7 +3462,7 @@ void register_viewer_callbacks(LLMessageSystem* msg)
msg->setHandlerFuncFast(_PREHASH_AvatarAnimation, process_avatar_animation);
msg->setHandlerFuncFast(_PREHASH_AvatarAppearance, process_avatar_appearance);
msg->setHandlerFunc("AgentCachedTextureResponse", LLAgent::processAgentCachedTextureResponse);
msg->setHandlerFunc("RebakeAvatarTextures", LLVOAvatar::processRebakeAvatarTextures);
msg->setHandlerFunc("RebakeAvatarTextures", LLVOAvatarSelf::processRebakeAvatarTextures);
msg->setHandlerFuncFast(_PREHASH_CameraConstraint, process_camera_constraint);
msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse, process_avatar_sit_response);
msg->setHandlerFunc("SetFollowCamProperties", process_set_follow_cam_properties);

View File

@@ -0,0 +1,145 @@
/**
* @file lltexlayerglobalcolor.cpp
* @brief Color for texture layers.
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llagent.h"
#include "lltexlayer.h"
#include "llvoavatar.h"
#include "llwearable.h"
#include "lltexglobalcolor.h"
//-----------------------------------------------------------------------------
// LLTexGlobalColor
//-----------------------------------------------------------------------------
LLTexGlobalColor::LLTexGlobalColor(LLVOAvatar* avatar)
:
mAvatar(avatar),
mInfo(NULL)
{
}
LLTexGlobalColor::~LLTexGlobalColor()
{
// mParamColorList are LLViewerVisualParam's and get deleted with ~LLCharacter()
//std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
}
BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info)
{
llassert(mInfo == NULL);
mInfo = info;
//mID = info->mID; // No ID
mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size());
for (param_color_info_list_t::iterator iter = mInfo->mParamColorInfoList.begin();
iter != mInfo->mParamColorInfoList.end();
iter++)
{
LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this);
if (!param_color->setInfo(*iter, TRUE))
{
mInfo = NULL;
return FALSE;
}
mParamGlobalColorList.push_back(param_color);
}
return TRUE;
}
LLColor4 LLTexGlobalColor::getColor() const
{
// Sum of color params
if (mParamGlobalColorList.empty())
return LLColor4(1.f, 1.f, 1.f, 1.f);
LLColor4 net_color(0.f, 0.f, 0.f, 0.f);
LLTexLayer::calculateTexLayerColor(mParamGlobalColorList, net_color);
return net_color;
}
const std::string& LLTexGlobalColor::getName() const
{
return mInfo->mName;
}
//-----------------------------------------------------------------------------
// LLTexParamGlobalColor
//-----------------------------------------------------------------------------
LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) :
LLTexLayerParamColor(tex_global_color->getAvatar()),
mTexGlobalColor(tex_global_color)
{
}
void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake)
{
mAvatar->onGlobalColorChanged(mTexGlobalColor, upload_bake);
}
//-----------------------------------------------------------------------------
// LLTexGlobalColorInfo
//-----------------------------------------------------------------------------
LLTexGlobalColorInfo::LLTexGlobalColorInfo()
{
}
LLTexGlobalColorInfo::~LLTexGlobalColorInfo()
{
for_each(mParamColorInfoList.begin(), mParamColorInfoList.end(), DeletePointer());
}
BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node)
{
// name attribute
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
if (!node->getFastAttributeString(name_string, mName))
{
llwarns << "<global_color> element is missing name attribute." << llendl;
return FALSE;
}
// <param> sub-element
for (LLXmlTreeNode* child = node->getChildByName("param");
child;
child = node->getNextNamedChild())
{
if (child->getChildByName("param_color"))
{
// <param><param_color/></param>
LLTexLayerParamColorInfo* info = new LLTexLayerParamColorInfo();
if (!info->parseXml(child))
{
delete info;
return FALSE;
}
mParamColorInfoList.push_back(info);
}
}
return TRUE;
}

View File

@@ -0,0 +1,83 @@
/**
* @file lltexglobalcolor.h
* @brief This is global texture color info used by llvoavatar.
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLTEXGLOBALCOLOR_H
#define LL_LLTEXGLOBALCOLOR_H
#include "lltexlayer.h"
#include "lltexlayerparams.h"
class LLVOAvatar;
class LLWearable;
class LLTexGlobalColorInfo;
class LLTexGlobalColor
{
public:
LLTexGlobalColor( LLVOAvatar* avatar );
~LLTexGlobalColor();
LLTexGlobalColorInfo* getInfo() const { return mInfo; }
// This sets mInfo and calls initialization functions
BOOL setInfo(LLTexGlobalColorInfo *info);
LLVOAvatar* getAvatar() const { return mAvatar; }
LLColor4 getColor() const;
const std::string& getName() const;
private:
param_color_list_t mParamGlobalColorList;
LLVOAvatar* mAvatar; // just backlink, don't LLPointer
LLTexGlobalColorInfo *mInfo;
};
// Used by llvoavatar to determine skin/eye/hair color.
class LLTexGlobalColorInfo
{
friend class LLTexGlobalColor;
public:
LLTexGlobalColorInfo();
~LLTexGlobalColorInfo();
BOOL parseXml(LLXmlTreeNode* node);
private:
param_color_info_list_t mParamColorInfoList;
std::string mName;
};
class LLTexParamGlobalColor : public LLTexLayerParamColor
{
public:
LLTexParamGlobalColor(LLTexGlobalColor *tex_color);
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
protected:
/*virtual*/ void onGlobalColorChanged(bool upload_bake);
private:
LLTexGlobalColor* mTexGlobalColor;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -34,524 +34,311 @@
#define LL_LLTEXLAYER_H
#include <deque>
#include "llassetstorage.h"
#include "lldynamictexture.h"
#include "llrect.h"
#include "llstring.h"
#include "lluuid.h"
#include "llviewertexture.h"
#include "llviewervisualparam.h"
#include "llvoavatardefines.h"
#include "llwearable.h"
#include "v4color.h"
#include "llfloater.h"
#include "llvoavatar.h"
#include "lltexlayerparams.h"
class LLTexLayerSetInfo;
class LLTexLayerSet;
class LLTexLayerInfo;
class LLTexLayer;
class LLViewerTexture;
class LLImageTGA;
class LLTexGlobalColorInfo;
class LLTexLayerParamAlphaInfo;
class LLTexLayerParamAlpha;
class LLTexParamColorInfo;
class LLTexParamColor;
class LLPolyMesh;
class LLXmlTreeNode;
class LLImageRaw;
class LLPolyMorphTarget;
class LLViewerTexture;
class LLTextureCtrl;
class LLVOAvatar;
class LLVOAvatarSelf;
class LLImageTGA;
class LLImageRaw;
class LLXmlTreeNode;
class LLTexLayerSet;
class LLTexLayerSetInfo;
class LLTexLayerInfo;
class LLTexLayerSetBuffer;
class LLWearable;
class LLViewerVisualParam;
class LLPolyMorphTarget;
enum EColorOperation
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerInterface
//
// Interface class to generalize functionality shared by LLTexLayer
// and LLTexLayerTemplate.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerInterface
{
OP_ADD = 0,
OP_MULTIPLY = 1,
OP_BLEND = 2,
OP_COUNT = 3 // Number of operations
};
//-----------------------------------------------------------------------------
// LLTexLayerParamAlphaInfo
//-----------------------------------------------------------------------------
class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo
{
friend class LLTexLayerParamAlpha;
public:
LLTexLayerParamAlphaInfo();
/*virtual*/ ~LLTexLayerParamAlphaInfo() {};
enum ERenderPass
{
RP_COLOR,
RP_BUMP,
RP_SHINE
};
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
LLTexLayerInterface(LLTexLayerSet* const layer_set);
virtual ~LLTexLayerInterface() {}
virtual BOOL render(S32 x, S32 y, S32 width, S32 height) = 0;
virtual void deleteCaches() = 0;
virtual BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) = 0;
virtual BOOL isInvisibleAlphaMask() const = 0;
const LLTexLayerInfo* getInfo() const { return mInfo; }
virtual BOOL setInfo(const LLTexLayerInfo *info); // sets mInfo, calls initialization functions
const std::string& getName() const;
const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
LLTexLayerSet* const getTexLayerSet() { return mTexLayerSet; }
void invalidateMorphMasks();
virtual void setHasMorph(BOOL newval) { mHasMorph = newval; }
BOOL hasMorph() const { return mHasMorph; }
BOOL isMorphValid() const { return mMorphMasksValid; }
void addMaskedMorph(LLPolyMorphTarget* morph_target, BOOL invert);
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
void requestUpdate();
virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height) = 0;
BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); }
ERenderPass getRenderPass() const;
BOOL isVisibilityMask() const;
protected:
std::string mStaticImageFileName;
BOOL mMultiplyBlend;
BOOL mSkipIfZeroWeight;
F32 mDomain;
};
const std::string& getGlobalColor() const;
LLViewerVisualParam* getVisualParamPtr(S32 index) const;
//-----------------------------------------------------------------------------
// LLTexParamColorInfo
//-----------------------------------------------------------------------------
class LLTexParamColorInfo : public LLViewerVisualParamInfo
{
friend class LLTexParamColor;
public:
LLTexParamColorInfo();
virtual ~LLTexParamColorInfo() {};
BOOL parseXml( LLXmlTreeNode* node );
protected:
enum { MAX_COLOR_VALUES = 20 };
EColorOperation mOperation;
LLColor4 mColors[MAX_COLOR_VALUES];
S32 mNumColors;
};
LLTexLayerSet* const mTexLayerSet;
const LLTexLayerInfo* mInfo;
BOOL mMorphMasksValid;
BOOL mHasMorph;
//-----------------------------------------------------------------------------
// LLTexGlobalColorInfo
//-----------------------------------------------------------------------------
class LLTexGlobalColorInfo
{
friend class LLTexGlobalColor;
public:
LLTexGlobalColorInfo();
~LLTexGlobalColorInfo();
BOOL parseXml(LLXmlTreeNode* node);
// Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order.
param_color_list_t mParamColorList;
param_alpha_list_t mParamAlphaList;
// mGlobalColor name stored in mInfo
// mFixedColor value stored in mInfo
protected:
typedef std::vector<LLTexParamColorInfo *> color_info_list_t;
color_info_list_t mColorInfoList;
std::string mName;
typedef std::deque<char *> morph_list_t; //Hack.
morph_list_t mMaskedMorphs;
};
//-----------------------------------------------------------------------------
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayer
//
// A single texture layer. Only exists for llvoavatarself.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayer : public LLTexLayerInterface
{
public:
LLTexLayer(LLTexLayerSet* const layer_set);
/*virtual*/ ~LLTexLayer();
/*virtual*/ BOOL setInfo(const LLTexLayerInfo *info); // This sets mInfo and calls initialization functions
/*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height);
/*virtual*/ void deleteCaches();
const U8* getAlphaData() const;
BOOL findNetColor(LLColor4* color) const;
/*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer
/*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
BOOL renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color);
void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height);
/*virtual*/ BOOL isInvisibleAlphaMask() const;
static void calculateTexLayerColor(const param_color_list_t &param_list, LLColor4 &net_color);
protected:
LLUUID getUUID() const;
LLPointer<LLImageRaw> mStaticImageRaw;
private:
typedef std::map<U32, U8*> alpha_cache_t;
alpha_cache_t mAlphaCache;
BOOL mStaticImageInvalid;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerSet
//
// An ordered set of texture layers that gets composited into a single texture.
// Only exists for llvoavatarself.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSet
{
friend class LLTexLayerSetBuffer;
public:
LLTexLayerSet(LLVOAvatarSelf* const avatar);
~LLTexLayerSet();
const LLTexLayerSetInfo* getInfo() const { return mInfo; }
BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
BOOL render(S32 x, S32 y, S32 width, S32 height);
void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
BOOL isBodyRegion(const std::string& region) const;
LLTexLayerSetBuffer* getComposite();
const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
void requestUpdate();
void requestUpload();
void cancelUpload();
void updateComposite();
BOOL isLocalTextureDataAvailable() const;
BOOL isLocalTextureDataFinal() const;
void createComposite();
void destroyComposite();
void setUpdatesEnabled(BOOL b);
BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
void deleteCaches();
void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height);
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
BOOL isMorphValid() const;
void invalidateMorphMasks();
LLTexLayerInterface* findLayerByName(const std::string& name);
LLVOAvatarSelf* getAvatar() const { return mAvatar; }
const std::string getBodyRegionName() const;
BOOL hasComposite() const { return (mComposite.notNull()); }
LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
BOOL isVisible() const { return mIsVisible; }
static BOOL sHasCaches;
private:
typedef std::vector<LLTexLayerInterface *> layer_list_t;
layer_list_t mLayerList;
layer_list_t mMaskLayerList;
LLPointer<LLTexLayerSetBuffer> mComposite;
LLVOAvatarSelf* const mAvatar; // note: backlink only; don't make this an LLPointer.
BOOL mUpdatesEnabled;
BOOL mIsVisible;
LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex;
const LLTexLayerSetInfo* mInfo;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerSetInfo
// Containes shared layer set data
//-----------------------------------------------------------------------------
//
// Contains shared layer set data.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSetInfo
{
friend class LLTexLayerSet;
public:
LLTexLayerSetInfo();
~LLTexLayerSetInfo();
BOOL parseXml(LLXmlTreeNode* node);
protected:
private:
std::string mBodyRegion;
S32 mWidth;
S32 mHeight;
std::string mStaticAlphaFileName;
BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName)
BOOL mClearAlpha; // Set alpha to 1 for this layerset (if there is no mStaticAlphaFileName)
typedef std::vector<LLTexLayerInfo*> layer_info_list_t;
layer_info_list_t mLayerInfoList;
};
//-----------------------------------------------------------------------------
// LLTexLayerInfo
//-----------------------------------------------------------------------------
enum ERenderPass
{
RP_COLOR,
RP_BUMP,
RP_SHINE
};
class LLTexLayerInfo
{
friend class LLTexLayer;
public:
LLTexLayerInfo();
~LLTexLayerInfo();
BOOL parseXml(LLXmlTreeNode* node);
protected:
std::string mName;
BOOL mWriteAllChannels; // Don't use masking. Just write RGBA into buffer,
ERenderPass mRenderPass;
std::string mGlobalColor;
LLColor4 mFixedColor;
S32 mLocalTexture;
std::string mStaticImageFileName;
BOOL mStaticImageIsMask;
BOOL mUseLocalTextureAlphaOnly; // Ignore RGB channels from the input texture. Use alpha as a mask
BOOL mIsVisibilityMask;
typedef std::vector<std::pair<std::string,BOOL> > morph_name_list_t;
morph_name_list_t mMorphNameList;
typedef std::vector<LLTexParamColorInfo*> color_info_list_t;
color_info_list_t mColorInfoList;
typedef std::vector<LLTexLayerParamAlphaInfo*> alpha_info_list_t;
alpha_info_list_t mAlphaInfoList;
};
//-----------------------------------------------------------------------------
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerSetBuffer
//
// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
//-----------------------------------------------------------------------------
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSetBuffer : public LLViewerDynamicTexture
{
public:
LLTexLayerSetBuffer(LLTexLayerSet* owner, S32 width, S32 height);
LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
virtual ~LLTexLayerSetBuffer();
virtual void preRender(BOOL clear_depth);
virtual void postRender(BOOL success);
virtual BOOL render();
BOOL updateImmediate();
bool isInitialized(void) const;
BOOL needsRender();
void requestUpdate();
void requestUpload();
void requestDelayedUpload(U64 delay_usec);
void cancelUpload();
BOOL uploadPending() { return mUploadPending; }
BOOL render( S32 x, S32 y, S32 width, S32 height );
void readBackAndUpload();
static void onTextureUploadComplete( const LLUUID& uuid,
void* userdata,
S32 result, LLExtStat ext_status);
public:
/*virtual*/ S8 getType() const;
BOOL isInitialized(void) const;
static void dumpTotalByteCount();
virtual S8 getType() const ;
virtual void restoreGLTexture() ;
virtual void destroyGLTexture() ;
private:
virtual void restoreGLTexture();
virtual void destroyGLTexture();
protected:
void pushProjection() const;
void popProjection() const;
BOOL needsUploadNow() const;
private:
BOOL mNeedsUpdate;
BOOL mNeedsUpload;
BOOL mUploadPending;
LLUUID mUploadID; // Identifys the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit)
S32 mUploadFailCount;
U64 mUploadAfter; // delay upload until after this time (in microseconds)
LLTexLayerSet* mTexLayerSet;
LLTexLayerSet* const mTexLayerSet;
static S32 sGLByteCount;
};
//-----------------------------------------------------------------------------
// LLTexLayerSet
// An ordered set of texture layers that get composited into a single texture.
//-----------------------------------------------------------------------------
class LLTexLayerSet
{
friend class LLTexLayerSetBuffer;
//--------------------------------------------------------------------
// Render
//--------------------------------------------------------------------
public:
LLTexLayerSet( LLVOAvatar* avatar );
~LLTexLayerSet();
//BOOL parseData(LLXmlTreeNode* node);
LLTexLayerSetInfo* getInfo() const { return mInfo; }
// This sets mInfo and calls initialization functions
BOOL setInfo(LLTexLayerSetInfo *info);
/*virtual*/ BOOL needsRender();
protected:
BOOL render(S32 x, S32 y, S32 width, S32 height);
virtual void preRender(BOOL clear_depth);
virtual void postRender(BOOL success);
virtual BOOL render();
BOOL render( S32 x, S32 y, S32 width, S32 height );
void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
BOOL isBodyRegion( const std::string& region ) { return mInfo->mBodyRegion == region; }
LLTexLayerSetBuffer* getComposite();
void requestUpdate();
//--------------------------------------------------------------------
// Uploads
//--------------------------------------------------------------------
public:
void requestUpload();
void requestDelayedUpload(U64 delay_usec);
BOOL needsUploadNow() const;
void cancelUpload();
LLVOAvatar* getAvatar() { return mAvatar; }
void updateComposite();
BOOL isLocalTextureDataAvailable();
BOOL isLocalTextureDataFinal();
void createComposite();
void destroyComposite();
void setUpdatesEnabled( BOOL b );
BOOL getUpdatesEnabled() { return mUpdatesEnabled; }
void deleteCaches();
void gatherAlphaMasks(U8 *data, S32 width, S32 height);
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
const std::string getBodyRegion() { return mInfo->mBodyRegion; }
BOOL hasComposite() { return (mComposite.notNull()); }
LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
BOOL isVisible() const { return mIsVisible; }
BOOL uploadPending() const; // We are expecting a new texture to be uploaded at some point
static void onTextureUploadComplete(const LLUUID& uuid,
void* userdata,
S32 result, LLExtStat ext_status);
void doUpload(); // Does a read back and upload.
private:
BOOL mNeedsUpload; // Whether we need to send our baked textures to the server
BOOL mUploadPending; // Whether we have received back the new baked textures
LLUUID mUploadID; // The current upload process (null if none).
S32 mUploadFailCount; // Number of consecutive upload failures
BOOL mNeedsUpdate;
U64 mUploadAfter; // delay upload until after this time (in microseconds)
//--------------------------------------------------------------------
// Updates
//--------------------------------------------------------------------
public:
static BOOL sHasCaches;
protected:
typedef std::vector<LLTexLayer *> layer_list_t;
layer_list_t mLayerList;
layer_list_t mMaskLayerList;
LLPointer<LLTexLayerSetBuffer> mComposite;
// Backlink only; don't make this an LLPointer.
LLVOAvatar* mAvatar;
BOOL mUpdatesEnabled;
BOOL mIsVisible;
LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex;
LLTexLayerSetInfo *mInfo;
};
//-----------------------------------------------------------------------------
// LLTexLayer
// A single texture layer
//-----------------------------------------------------------------------------
class LLTexLayer
{
public:
LLTexLayer( LLTexLayerSet* layer_set );
~LLTexLayer();
//BOOL parseData(LLXmlTreeNode* node);
LLTexLayerInfo* getInfo() const { return mInfo; }
// This sets mInfo and calls initialization functions
BOOL setInfo(LLTexLayerInfo *info);
BOOL render( S32 x, S32 y, S32 width, S32 height );
void requestUpdate();
LLTexLayerSet* getTexLayerSet() { return mTexLayerSet; }
const std::string& getName() { return mInfo->mName; }
void addMaskedMorph(LLPolyMorphTarget* morph_target, BOOL invert);
void deleteCaches();
U8* getAlphaData();
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
void invalidateMorphMasks();
ERenderPass getRenderPass() { return mInfo->mRenderPass; }
const std::string& getGlobalColor() { return mInfo->mGlobalColor; }
BOOL findNetColor( LLColor4* color );
BOOL renderImageRaw( U8* in_data, S32 in_width, S32 in_height, S32 in_components, S32 width, S32 height, BOOL is_mask );
BOOL renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4* colorp );
BOOL hasAlphaParams() { return (!mParamAlphaList.empty());}
BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height);
BOOL isVisibilityMask() const;
BOOL isInvisibleAlphaMask();
protected:
LLTexLayerSet* mTexLayerSet;
LLPointer<LLImageRaw> mStaticImageRaw;
// Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order.
typedef std::vector<LLTexParamColor *> color_list_t;
color_list_t mParamColorList;
// mGlobalColor name stored in mInfo
// mFixedColor value stored in mInfo
typedef std::vector<LLTexLayerParamAlpha *> alpha_list_t;
alpha_list_t mParamAlphaList;
typedef std::deque<LLVOAvatar::LLMaskedMorph> morph_list_t;
morph_list_t mMaskedMorphs;
typedef std::map<U32, U8*> alpha_cache_t;
alpha_cache_t mAlphaCache;
BOOL mMorphMasksValid;
BOOL mStaticImageInvalid;
LLTexLayerInfo *mInfo;
BOOL requestUpdateImmediate();
};
//-----------------------------------------------------------------------------
// LLTexLayerParamAlpha
//-----------------------------------------------------------------------------
class LLTexLayerParamAlpha : public LLViewerVisualParam
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerStaticImageList
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList>
{
public:
LLTexLayerParamAlpha( LLTexLayer* layer );
/*virtual*/ ~LLTexLayerParamAlpha();
// Special: These functions are overridden by child classes
LLTexLayerParamAlphaInfo* getInfo() const { return (LLTexLayerParamAlphaInfo*)mInfo; }
// This sets mInfo and calls initialization functions
BOOL setInfo(LLTexLayerParamAlphaInfo *info);
// LLVisualParam Virtual functions
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
/*virtual*/ void apply( ESex avatar_sex ) {}
/*virtual*/ void setWeight(F32 weight, BOOL set_by_user);
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user);
/*virtual*/ void animate(F32 delta, BOOL set_by_user);
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
/*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; }
/*virtual*/ F32 getMaxDistortion() { return 3.f; }
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f);}
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
// New functions
BOOL render( S32 x, S32 y, S32 width, S32 height );
BOOL getSkip();
void deleteCaches();
LLTexLayer* getTexLayer() { return mTexLayer; }
BOOL getMultiplyBlend() { return getInfo()->mMultiplyBlend; }
protected:
LLPointer<LLViewerTexture> mCachedProcessedTexture;
LLTexLayer* mTexLayer;
LLPointer<LLImageTGA> mStaticImageTGA;
LLPointer<LLImageRaw> mStaticImageRaw;
BOOL mNeedsCreateTexture;
BOOL mStaticImageInvalid;
LLVector3 mAvgDistortionVec;
F32 mCachedEffectiveWeight;
public:
// Global list of instances for gathering statistics
static void dumpCacheByteCount();
static void getCacheByteCount( S32* gl_bytes );
typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t;
static param_alpha_ptr_list_t sInstances;
};
//-----------------------------------------------------------------------------
// LLTexGlobalColor
//-----------------------------------------------------------------------------
class LLTexGlobalColor
{
public:
LLTexGlobalColor( LLVOAvatar* avatar );
~LLTexGlobalColor();
//BOOL parseData(LLXmlTreeNode* node);
LLTexGlobalColorInfo* getInfo() const { return mInfo; }
// This sets mInfo and calls initialization functions
BOOL setInfo(LLTexGlobalColorInfo *info);
void requstUpdate();
LLVOAvatar* getAvatar() { return mAvatar; }
LLColor4 getColor();
const std::string& getName() { return mInfo->mName; }
protected:
typedef std::vector<LLTexParamColor *> param_list_t;
param_list_t mParamList;
LLVOAvatar* mAvatar; // just backlink, don't LLPointer
LLTexGlobalColorInfo *mInfo;
};
//-----------------------------------------------------------------------------
// LLTexParamColor
//-----------------------------------------------------------------------------
class LLTexParamColor : public LLViewerVisualParam
{
public:
LLTexParamColor( LLTexGlobalColor* tex_color );
LLTexParamColor( LLTexLayer* layer );
/* virtual */ ~LLTexParamColor();
// Special: These functions are overridden by child classes
LLTexParamColorInfo* getInfo() const { return (LLTexParamColorInfo*)mInfo; }
// This sets mInfo and calls initialization functions
BOOL setInfo(LLTexParamColorInfo *info);
// LLVisualParam Virtual functions
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
/*virtual*/ void apply( ESex avatar_sex ) {}
/*virtual*/ void setWeight(F32 weight, BOOL set_by_user);
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL set_by_user);
/*virtual*/ void animate(F32 delta, BOOL set_by_user);
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
/*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; }
/*virtual*/ F32 getMaxDistortion() { return 3.f; }
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f); }
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
// New functions
LLColor4 getNetColor();
EColorOperation getOperation() const { return getInfo()->mOperation; }
protected:
LLVector3 mAvgDistortionVec;
LLTexGlobalColor* mTexGlobalColor; // either has mTexGlobalColor or mTexLayer as its parent
LLTexLayer* mTexLayer;
LLVOAvatar* mAvatar; // redundant, but simplifies the code (don't LLPointer)
};
//-----------------------------------------------------------------------------
// LLTexStaticImageList
//-----------------------------------------------------------------------------
class LLTexStaticImageList
{
public:
LLTexStaticImageList();
~LLTexStaticImageList();
LLImageRaw* getImageRaw( const std::string& file_name );
LLViewerTexture* getTexture( const std::string& file_name, BOOL is_mask );
LLImageTGA* getImageTGA( const std::string& file_name );
LLTexLayerStaticImageList();
~LLTexLayerStaticImageList();
LLViewerTexture* getTexture(const std::string& file_name, BOOL is_mask);
LLImageTGA* getImageTGA(const std::string& file_name);
void deleteCachedImages();
void dumpByteCount() const;
protected:
BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
private:
static LLStringTable sImageNames;
LLStringTable mImageNames;
typedef std::map<const char*, LLPointer<LLViewerTexture> > texture_map_t;
texture_map_t mStaticImageList;
typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
image_tga_map_t mStaticImageListTGA;
public:
S32 mGLBytes;
S32 mTGABytes;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLBakedUploadData
//
// Used by LLTexLayerSetBuffer for a callback.
// For DEV-DEV-31590, "Heap corruption and crash after outfit
// changes", added the mLayerSet member. The current
// LLTexLayerSetBuffer can be found by querying mLayerSet->mComposite,
// but we still store the original mLayerSetBuffer here so we can
// detect when an upload is out of date. This prevents a memory
// stomp. See LLTexLayerSetBuffer::onTextureUploadComplete() for usage.
class LLBakedUploadData
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct LLBakedUploadData
{
public:
LLBakedUploadData( LLVOAvatar* avatar, LLTexLayerSet* layerset, LLTexLayerSetBuffer* layerset_buffer, const LLUUID & id);
LLBakedUploadData(const LLVOAvatarSelf* avatar,
LLTexLayerSet* layerset,
const LLUUID& id);
~LLBakedUploadData() {}
const LLUUID mID;
const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer
LLTexLayerSet* mTexLayerSet;
LLUUID mID;
LLVOAvatar* mAvatar; // just backlink, don't LLPointer
LLTexLayerSet* mTexLayerSet;
LLTexLayerSetBuffer* mLayerSetBuffer;
LLUUID mWearableAssets[LLWearableType::WT_COUNT];
U64 mStartTime; // Used to measure time baked texture upload requires
const U64 mStartTime; // for measuring baked texture upload time
};
extern LLTexStaticImageList gTexStaticImageList;
#endif // LL_LLTEXLAYER_H

View File

@@ -145,13 +145,6 @@ LLTexLayerParamAlpha::~LLTexLayerParamAlpha()
sInstances.remove(this);
}
/*virtual*/ LLViewerVisualParam* LLTexLayerParamAlpha::cloneParam(LLWearable* wearable) const
{
LLTexLayerParamAlpha *new_param = new LLTexLayerParamAlpha(mTexLayer);
*new_param = *this;
return new_param;
}
void LLTexLayerParamAlpha::deleteCaches()
{
mStaticImageTGA = NULL; // deletes image
@@ -188,6 +181,7 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
}
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
mTexLayer->invalidateMorphMasks();
mAvatar->updateMeshTextures();
}
}
}
@@ -323,14 +317,14 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
// Create the GL texture, and then hang onto it for future use.
if (mNeedsCreateTexture)
{
mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw);
mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw, 0, TRUE, LLViewerTexture::BOOST_AVATAR_SELF);
mNeedsCreateTexture = FALSE;
gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
}
LLGLSNoAlphaTest gls_no_alpha_test;
gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
gGL.getTexUnit(0)->bind(mCachedProcessedTexture, TRUE);
gl_rect_2d_simple_tex(width, height);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
stop_glerror();
@@ -419,12 +413,6 @@ LLTexLayerParamColor::~LLTexLayerParamColor()
{
}
/*virtual*/ LLViewerVisualParam* LLTexLayerParamColor::cloneParam(LLWearable* wearable) const
{
LLTexLayerParamColor *new_param = new LLTexLayerParamColor(mTexLayer);
*new_param = *this;
return new_param;
}
LLColor4 LLTexLayerParamColor::getNetColor() const
{
@@ -521,7 +509,7 @@ LLTexLayerParamColorInfo::LLTexLayerParamColorInfo() :
BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node)
{
llassert(node->hasName("param") && node->getChildByName("param_color"));
llassert( node->hasName( "param" ) && node->getChildByName( "param_color" ) );
if (!LLViewerVisualParamInfo::parseXml(node))
return FALSE;

View File

@@ -0,0 +1,187 @@
/**
* @file lltexlayerparams.h
* @brief Texture layer parameters, used by lltexlayer.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLTEXLAYERPARAMS_H
#define LL_LLTEXLAYERPARAMS_H
#include "llviewervisualparam.h"
class LLImageRaw;
class LLImageTGA;
class LLTexLayer;
class LLTexLayerInterface;
class LLViewerTexture;
class LLVOAvatar;
class LLWearable;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerParam
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerParam : public LLViewerVisualParam
{
public:
LLTexLayerParam(LLTexLayerInterface *layer);
LLTexLayerParam(LLVOAvatar *avatar);
/*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar );
protected:
LLTexLayerInterface* mTexLayer;
LLVOAvatar* mAvatar;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerParamAlpha
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerParamAlpha : public LLTexLayerParam
{
public:
LLTexLayerParamAlpha( LLTexLayerInterface* layer );
LLTexLayerParamAlpha( LLVOAvatar* avatar );
/*virtual*/ ~LLTexLayerParamAlpha();
// LLVisualParam Virtual functions
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
/*virtual*/ void apply( ESex avatar_sex ) {}
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake);
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake);
/*virtual*/ void animate(F32 delta, BOOL upload_bake);
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
/*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; }
/*virtual*/ F32 getMaxDistortion() { return 3.f; }
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f);}
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
// New functions
BOOL render( S32 x, S32 y, S32 width, S32 height );
BOOL getSkip() const;
void deleteCaches();
BOOL getMultiplyBlend() const;
private:
LLPointer<LLViewerTexture> mCachedProcessedTexture;
LLPointer<LLImageTGA> mStaticImageTGA;
LLPointer<LLImageRaw> mStaticImageRaw;
BOOL mNeedsCreateTexture;
BOOL mStaticImageInvalid;
LLVector3 mAvgDistortionVec;
F32 mCachedEffectiveWeight;
public:
// Global list of instances for gathering statistics
static void dumpCacheByteCount();
static void getCacheByteCount( S32* gl_bytes );
typedef std::list< LLTexLayerParamAlpha* > param_alpha_ptr_list_t;
static param_alpha_ptr_list_t sInstances;
};
class LLTexLayerParamAlphaInfo : public LLViewerVisualParamInfo
{
friend class LLTexLayerParamAlpha;
public:
LLTexLayerParamAlphaInfo();
/*virtual*/ ~LLTexLayerParamAlphaInfo() {};
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
private:
std::string mStaticImageFileName;
BOOL mMultiplyBlend;
BOOL mSkipIfZeroWeight;
F32 mDomain;
};
//
// LLTexLayerParamAlpha
//-----------------------------------------------------------------------------
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerParamColor
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerParamColor : public LLTexLayerParam
{
public:
enum EColorOperation
{
OP_ADD = 0,
OP_MULTIPLY = 1,
OP_BLEND = 2,
OP_COUNT = 3 // Number of operations
};
LLTexLayerParamColor( LLTexLayerInterface* layer );
LLTexLayerParamColor( LLVOAvatar* avatar );
/* virtual */ ~LLTexLayerParamColor();
// LLVisualParam Virtual functions
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
/*virtual*/ void apply( ESex avatar_sex ) {}
/*virtual*/ void setWeight(F32 weight, BOOL upload_bake);
/*virtual*/ void setAnimationTarget(F32 target_value, BOOL upload_bake);
/*virtual*/ void animate(F32 delta, BOOL upload_bake);
// LLViewerVisualParam Virtual functions
/*virtual*/ F32 getTotalDistortion() { return 1.f; }
/*virtual*/ const LLVector3& getAvgDistortion() { return mAvgDistortionVec; }
/*virtual*/ F32 getMaxDistortion() { return 3.f; }
/*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { return LLVector3(1.f, 1.f, 1.f); }
/*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return &mAvgDistortionVec;};
/*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { index = 0; poly_mesh = NULL; return NULL;};
// New functions
LLColor4 getNetColor() const;
protected:
virtual void onGlobalColorChanged(bool upload_bake) {}
private:
LLVector3 mAvgDistortionVec;
};
class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo
{
friend class LLTexLayerParamColor;
public:
LLTexLayerParamColorInfo();
virtual ~LLTexLayerParamColorInfo() {};
BOOL parseXml( LLXmlTreeNode* node );
LLTexLayerParamColor::EColorOperation getOperation() const { return mOperation; }
private:
enum { MAX_COLOR_VALUES = 20 };
LLTexLayerParamColor::EColorOperation mOperation;
LLColor4 mColors[MAX_COLOR_VALUES];
S32 mNumColors;
};
typedef std::vector<LLTexLayerParamColor *> param_color_list_t;
typedef std::vector<LLTexLayerParamAlpha *> param_alpha_list_t;
typedef std::vector<LLTexLayerParamColorInfo *> param_color_info_list_t;
typedef std::vector<LLTexLayerParamAlphaInfo *> param_alpha_info_list_t;
#endif

View File

@@ -2029,7 +2029,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
// gAgent.getGroupID())
// && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
BOOL worn = FALSE;
LLVOAvatar* my_avatar = NULL;
LLVOAvatarSelf* my_avatar = NULL;
switch(item->getType())
{
case LLAssetType::AT_OBJECT:
@@ -2858,7 +2858,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
// cannot give away no-transfer objects
return ACCEPT_NO;
}
LLVOAvatar* avatar = gAgentAvatarp;
LLVOAvatarSelf* avatar = gAgentAvatarp;
if(avatar && avatar->isWearingAttachment( item->getUUID() ) )
{
// You can't give objects that are attached to you

View File

@@ -151,9 +151,8 @@ BOOL LLVisualParamHint::needsRender()
void LLVisualParamHint::preRender(BOOL clear_depth)
{
mLastParamWeight = mVisualParam->getWeight();
//mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
mLastParamWeight = gAgentAvatarp->getVisualParamWeight(mVisualParam);
gAgentAvatarp->setVisualParamWeight(mVisualParam, mVisualParamWeight);
gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f);
gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f);
gAgentAvatarp->updateComposites();
@@ -236,9 +235,9 @@ BOOL LLVisualParamHint::render()
LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / (F32)mFullHeight);
LLViewerCamera::getInstance()->setOriginAndLookAt(
camera_pos, // camera
camera_pos, // camera
LLVector3::z_axis, // up
target_pos ); // point of interest
target_pos ); // point of interest
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);

View File

@@ -190,7 +190,7 @@ static bool handleAvatarBoobXYInfluence(const LLSD& newvalue)
static bool handleSetSelfInvisible( const LLSD& newvalue)
{
LLVOAvatar::onChangeSelfInvisible( newvalue.asBoolean() );
LLVOAvatarSelf::onChangeSelfInvisible( newvalue.asBoolean() );
return true;
}

View File

@@ -40,7 +40,7 @@
#include "lldrawable.h"
#include "llgl.h"
#include "llrender.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llvolume.h"
#include "pipeline.h"
#include "llspatialpartition.h"
@@ -182,7 +182,7 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object)
object->markDead();
// If this happens to be attached to self, then detach.
LLVOAvatar::detachAttachmentIntoInventory(object->getAttachmentItemID());
LLVOAvatarSelf::detachAttachmentIntoInventory(object->getAttachmentItemID());
return FALSE;
}

View File

@@ -587,8 +587,8 @@ void handle_mesh_load_obj(void*);
void handle_morph_save_obj(void*);
void handle_morph_load_obj(void*);
void handle_debug_avatar_textures(void*);
void handle_grab_texture(void*);
BOOL enable_grab_texture(void*);
void handle_grab_baked_texture(void*);
BOOL enable_grab_baked_texture(void*);
void handle_dump_region_object_cache(void*);
BOOL menu_ui_enabled(void *user_data);
@@ -1650,12 +1650,12 @@ void init_debug_avatar_menu(LLMenuGL* menu)
void init_debug_baked_texture_menu(LLMenuGL* menu)
{
menu->append(new LLMenuItemCallGL("Iris", handle_grab_texture, enable_grab_texture, (void*) TEX_EYES_BAKED));
menu->append(new LLMenuItemCallGL("Head", handle_grab_texture, enable_grab_texture, (void*) TEX_HEAD_BAKED));
menu->append(new LLMenuItemCallGL("Upper Body", handle_grab_texture, enable_grab_texture, (void*) TEX_UPPER_BAKED));
menu->append(new LLMenuItemCallGL("Lower Body", handle_grab_texture, enable_grab_texture, (void*) TEX_LOWER_BAKED));
menu->append(new LLMenuItemCallGL("Skirt", handle_grab_texture, enable_grab_texture, (void*) TEX_SKIRT_BAKED));
menu->append(new LLMenuItemCallGL("Hair", handle_grab_texture, enable_grab_texture, (void*) TEX_HAIR_BAKED));
menu->append(new LLMenuItemCallGL("Iris", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_EYES));
menu->append(new LLMenuItemCallGL("Head", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_HEAD));
menu->append(new LLMenuItemCallGL("Upper Body", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_UPPER));
menu->append(new LLMenuItemCallGL("Lower Body", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_LOWER));
menu->append(new LLMenuItemCallGL("Skirt", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_SKIRT));
menu->append(new LLMenuItemCallGL("Hair", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_HAIR));
menu->createJumpKeys();
}
@@ -3048,9 +3048,9 @@ class LLAvatarDebug : public view_listener_t
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
if( avatar )
if( avatar == gAgentAvatarp )
{
avatar->dumpLocalTextures();
gAgentAvatarp->dumpLocalTextures();
// <edit> hell no don't tell them about that
/*
llinfos << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << llendl;
@@ -8270,10 +8270,9 @@ void slow_mo_animations(void*)
void handle_dump_avatar_local_textures(void*)
{
LLVOAvatar* avatar = gAgentAvatarp;
if( avatar )
if( isAgentAvatarValid() )
{
avatar->dumpLocalTextures();
gAgentAvatarp->dumpLocalTextures();
}
}
@@ -8697,106 +8696,79 @@ void handle_debug_avatar_textures(void*)
// </edit>
}
void handle_grab_texture(void* data)
void handle_grab_baked_texture(void* data)
{
ETextureIndex index = (ETextureIndex)((intptr_t)data);
LLVOAvatar* avatar = gAgentAvatarp;
if ( avatar )
EBakedTextureIndex baked_tex_index = (EBakedTextureIndex)((intptr_t)data);
if (!isAgentAvatarValid()) return;
const LLUUID& asset_id = gAgentAvatarp->grabBakedTexture(baked_tex_index);
LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
if(folder_id.notNull())
{
const LLUUID& asset_id = avatar->grabLocalTexture(index);
LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
LLUUID folder_id(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE));
if(folder_id.notNull())
{
std::string name = "Baked ";
switch (index)
std::string name;
name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture";
LLUUID item_id;
item_id.generate();
LLPermissions perm;
perm.init(gAgentID,
gAgentID,
LLUUID::null,
LLUUID::null);
U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
perm.initMasks(PERM_ALL,
PERM_ALL,
PERM_NONE,
PERM_NONE,
next_owner_perm);
time_t creation_date_now = time_corrected();
LLPointer<LLViewerInventoryItem> item
= new LLViewerInventoryItem(item_id,
folder_id,
perm,
asset_id,
asset_type,
inv_type,
name,
LLStringUtil::null,
LLSaleInfo::DEFAULT,
LLInventoryItemFlags::II_FLAGS_NONE,
creation_date_now);
item->updateServer(TRUE);
gInventory.updateItem(item);
gInventory.notifyObservers();
LLInventoryView* view = LLInventoryView::getActiveInventory();
// Show the preview panel for textures to let
// user know that the image is now in inventory.
if(view)
{
case TEX_EYES_BAKED:
name.append("Iris");
break;
case TEX_HEAD_BAKED:
name.append("Head");
break;
case TEX_UPPER_BAKED:
name.append("Upper Body");
break;
case TEX_LOWER_BAKED:
name.append("Lower Body");
break;
case TEX_SKIRT_BAKED:
name.append("Skirt");
break;
case TEX_HAIR_BAKED:
name.append("Hair");
break;
default:
name.append("Unknown");
break;
}
name.append(" Texture");
LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
LLUUID item_id;
item_id.generate();
LLPermissions perm;
perm.init(gAgentID,
gAgentID,
LLUUID::null,
LLUUID::null);
U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
perm.initMasks(PERM_ALL,
PERM_ALL,
PERM_NONE,
PERM_NONE,
next_owner_perm);
time_t creation_date_now = time_corrected();
LLPointer<LLViewerInventoryItem> item
= new LLViewerInventoryItem(item_id,
folder_id,
perm,
asset_id,
asset_type,
inv_type,
name,
LLStringUtil::null,
LLSaleInfo::DEFAULT,
LLInventoryItemFlags::II_FLAGS_NONE,
creation_date_now);
item->updateServer(TRUE);
gInventory.updateItem(item);
gInventory.notifyObservers();
LLInventoryView* view = LLInventoryView::getActiveInventory();
// Show the preview panel for textures to let
// user know that the image is now in inventory.
if(view)
{
LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
view->getPanel()->setSelection(item_id, TAKE_FOCUS_NO);
view->getPanel()->openSelected();
//LLInventoryView::dumpSelectionInformation((void*)view);
// restore keyboard focus
gFocusMgr.setKeyboardFocus(focus_ctrl);
}
}
else
{
llwarns << "Can't find a folder to put it in" << llendl;
view->getPanel()->setSelection(item_id, TAKE_FOCUS_NO);
view->getPanel()->openSelected();
//LLInventoryView::dumpSelectionInformation((void*)view);
// restore keyboard focus
gFocusMgr.setKeyboardFocus(focus_ctrl);
}
}
else
{
llwarns << "Can't find a folder to put it in" << llendl;
}
}
BOOL enable_grab_texture(void* data)
BOOL enable_grab_baked_texture(void* data)
{
ETextureIndex index = (ETextureIndex)((intptr_t)data);
LLVOAvatar* avatar = gAgentAvatarp;
if ( avatar )
EBakedTextureIndex index = (EBakedTextureIndex)((intptr_t)data);
if (isAgentAvatarValid())
{
return avatar->canGrabLocalTexture(index);
return gAgentAvatarp->canGrabBakedTexture(index);
}
return FALSE;
}
@@ -9034,12 +9006,11 @@ void handle_buy_currency_test(void*)
void handle_rebake_textures(void*)
{
LLVOAvatar* avatar = gAgentAvatarp;
if (!avatar) return;
if (!isAgentAvatarValid()) return;
// Slam pending upload count to "unstick" things
bool slam_for_debug = true;
avatar->forceBakeAllTextures(slam_for_debug);
gAgentAvatarp->forceBakeAllTextures(slam_for_debug);
}
void toggle_visibility(void* user_data)

View File

@@ -45,6 +45,7 @@
#include "llviewerobjectlist.h"
#include "llviewertexturelist.h"
#include "lltexlayer.h"
#include "lltexlayerparams.h"
#include "llsurface.h"
#include "llvlmanager.h"
#include "llagent.h"
@@ -55,7 +56,7 @@
#include "lldebugview.h"
#include "llfasttimerview.h"
#include "llviewerregion.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llviewerwindow.h" // *TODO: remove, only used for width/height
#include "llworld.h"
#include "llfeaturemanager.h"
@@ -525,12 +526,12 @@ void output_statistics(void*)
llinfos << "--------------------------------" << llendl;
llinfos << "Avatar Memory (partly overlaps with above stats):" << llendl;
gTexStaticImageList.dumpByteCount();
LLVOAvatar::dumpScratchTextureByteCount();
LLTexLayerStaticImageList::getInstance()->dumpByteCount();
LLVOAvatarSelf::dumpScratchTextureByteCount();
LLTexLayerSetBuffer::dumpTotalByteCount();
LLVOAvatar::dumpTotalLocalTextureByteCount();
LLVOAvatarSelf::dumpTotalLocalTextureByteCount();
LLTexLayerParamAlpha::dumpCacheByteCount();
LLVOAvatar::dumpBakedStatus();
LLVOAvatarSelf::dumpBakedStatus();
llinfos << llendl;

View File

@@ -119,12 +119,6 @@ LLViewerVisualParam::LLViewerVisualParam()
{
}
/*
//=============================================================================
// These virtual functions should always be overridden,
// but are included here for use as templates
//=============================================================================
//-----------------------------------------------------------------------------
// setInfo()
//-----------------------------------------------------------------------------
@@ -139,7 +133,7 @@ BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info)
setWeight(getDefaultWeight(), FALSE );
return TRUE;
}
/*
//-----------------------------------------------------------------------------
// parseData()
//-----------------------------------------------------------------------------

View File

@@ -90,7 +90,7 @@ public:
virtual const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0;
// interface methods
F32 getDisplayOrder() { return getInfo()->mEditGroupDisplayOrder; }
F32 getDisplayOrder() const { return getInfo()->mEditGroupDisplayOrder; }
S32 getWearableType() const { return getInfo()->mWearableType; }
const std::string& getEditGroup() const { return getInfo()->mEditGroup; }

File diff suppressed because it is too large Load Diff

View File

@@ -49,6 +49,7 @@
#include "llrendertarget.h"
#include "llwearable.h"
#include "llvoavatardefines.h"
#include "lltexglobalcolor.h"
#include "emeraldboobutils.h"
#include "llavatarname.h"
@@ -231,6 +232,7 @@ public:
void idleUpdateLoadingEffect();
void idleUpdateWindEffect();
void idleUpdateNameTag(const LLVector3& root_pos_last);
LLVector3 idleUpdateNameTagPosition(const LLVector3& root_pos_last);
void clearNameTag();
static void invalidateNameTag(const LLUUID& agent_id);
// force all name tags to rebuild, useful when display names turned on/off
@@ -238,8 +240,6 @@ public:
void idleUpdateRenderCost();
void idleUpdateBelowWater();
void idleUpdateBoobEffect(); //Emerald
void updateAttachmentVisibility(U32 camera_mode); //Agent only
LLFrameTimer mIdleTimer;
std::string getIdleTime();
@@ -276,8 +276,12 @@ public:
//--------------------------------------------------------------------
public:
BOOL isFullyLoaded() const;
bool visualParamWeightsAreDefault();
protected:
virtual BOOL getIsCloud();
//BOOL isReallyFullyLoaded();
BOOL updateIsFullyLoaded();
BOOL processFullyLoadedChange(bool loading);
protected:
bool sendAvatarTexturesRequest();
void updateRuthTimer(bool loading);
@@ -474,6 +478,15 @@ public:
private:
static S32 sFreezeCounter;
//--------------------------------------------------------------------
// Constants
//--------------------------------------------------------------------
public:
virtual LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLViewerTexture::BOOST_AVATAR; }
virtual LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLViewerTexture::BOOST_AVATAR_BAKED; }
virtual S32 getTexImageSize() const;
virtual S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); }
/** Rendering
** **
*******************************************************************************/
@@ -487,8 +500,8 @@ private:
// Loading status
//--------------------------------------------------------------------
public:
BOOL isTextureDefined(U8 te) const;
BOOL isTextureVisible(U8 te) const;
BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type) const;
BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type) const;
protected:
BOOL isFullyBaked();
@@ -523,8 +536,9 @@ protected:
// Local Textures
//--------------------------------------------------------------------
protected:
void setLocalTexture(LLVOAvatarDefines::ETextureIndex i, LLViewerFetchedTexture* tex, BOOL baked_version_exits);
void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
virtual void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits);
virtual void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
//--------------------------------------------------------------------
// Layers
//--------------------------------------------------------------------
@@ -538,6 +552,9 @@ protected:
public:
virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result);
virtual void invalidateAll();
virtual void setCompositeUpdatesEnabled(bool b) {}
virtual void setCompositeUpdatesEnabled(U32 index, bool b) {}
virtual bool isCompositeUpdateEnabled(U32 index) { return false; }
//--------------------------------------------------------------------
// Static texture/mesh/baked dictionary
@@ -562,71 +579,14 @@ private:
//Most this stuff is Agent only
//--------------------------------------------------------------------
// Textures and Layers
//--------------------------------------------------------------------
protected:
void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i);
LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const;
S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex index);
//--------------------------------------------------------------------
// Other public functions
//--------------------------------------------------------------------
public:
static void dumpTotalLocalTextureByteCount();
protected:
void getLocalTextureByteCount( S32* gl_byte_count );
public:
void dumpLocalTextures();
const LLUUID& grabLocalTexture(LLVOAvatarDefines::ETextureIndex index);
BOOL canGrabLocalTexture(LLVOAvatarDefines::ETextureIndex index);
void setCompositeUpdatesEnabled(BOOL b);
void setNameFromChat(const std::string &text);
void clearNameFromChat();
public:
//--------------------------------------------------------------------
// texture compositing (used only by the LLTexLayer series of classes)
//--------------------------------------------------------------------
public:
BOOL isLocalTextureDataAvailable( const LLTexLayerSet* layerset );
BOOL isLocalTextureDataFinal( const LLTexLayerSet* layerset );
LLVOAvatarDefines::ETextureIndex getBakedTE( LLTexLayerSet* layerset );
void updateComposites();
//BOOL getLocalTextureRaw( LLVOAvatarDefines::ETextureIndex index, LLImageRaw* image_raw_pp );
BOOL getLocalTextureGL( LLVOAvatarDefines::ETextureIndex index, LLViewerTexture** image_gl_pp );
const LLUUID& getLocalTextureID( LLVOAvatarDefines::ETextureIndex index );
LLGLuint getScratchTexName( LLGLenum format, U32* texture_bytes );
BOOL bindScratchTexture( LLGLenum format );
void forceBakeAllTextures(bool slam_for_debug = false);
static void processRebakeAvatarTextures(LLMessageSystem* msg, void**);
void setNewBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid );
void setCachedBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid );
void requestLayerSetUploads();
void requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i);
bool hasPendingBakedUploads();
static void onLocalTextureLoaded( BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
static void onChangeSelfInvisible(BOOL newvalue);
void setInvisible(BOOL newvalue);
void wearableUpdated(LLWearableType::EType type, BOOL upload_result = TRUE);
//--------------------------------------------------------------------
// texture compositing
//--------------------------------------------------------------------
public:
void setLocTexTE( U8 te, LLViewerTexture* image, BOOL set_by_user );
void setupComposites();
/** Textures
** **
*******************************************************************************/
@@ -673,7 +633,6 @@ public:
void processAvatarAppearance(LLMessageSystem* mesgsys);
void hideSkirt();
void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound);
LLPolyMesh* getMesh(LLPolyMeshSharedData* shared_data);
//--------------------------------------------------------------------
// Appearance morphing
@@ -691,12 +650,12 @@ public:
typedef std::map<std::string, lod_mesh_map_t> mesh_info_t;
static void getMeshInfo(mesh_info_t* mesh_info);
LLPolyMesh* getMesh( LLPolyMeshSharedData *shared_data );
//--------------------------------------------------------------------
// Clothing colors (convenience functions to access visual parameters)
//--------------------------------------------------------------------
public:
void setClothesColor( LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL set_by_user );
void setClothesColor(LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL upload_bake);
LLColor4 getClothesColor(LLVOAvatarDefines::ETextureIndex te);
static BOOL teToColorParams( LLVOAvatarDefines::ETextureIndex te, const char* param_name[3] );
@@ -705,7 +664,7 @@ public:
//--------------------------------------------------------------------
public:
LLColor4 getGlobalColor(const std::string& color_name ) const;
void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user );
void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake);
private:
LLTexGlobalColor* mTexSkinColor;
LLTexGlobalColor* mTexHairColor;
@@ -720,13 +679,6 @@ public:
U32 getVisibilityRank() const { return mVisibilityRank; } // unused
static S32 sNumVisibleAvatars; // Number of instances of this class
static LLColor4 getDummyColor();
//--------------------------------------------------------------------
// Customize
//--------------------------------------------------------------------
public:
static void onCustomizeStart();
static void onCustomizeEnd();
/** Appearance
** **
*******************************************************************************/
@@ -737,17 +689,17 @@ public:
**/
public:
BOOL isWearingWearableType( LLWearableType::EType type ) const;
virtual BOOL isWearingWearableType(LLWearableType::EType type ) const;
//--------------------------------------------------------------------
// Attachments
//--------------------------------------------------------------------
public:
void clampAttachmentPositions();
BOOL attachObject(LLViewerObject *viewer_object);
BOOL detachObject(LLViewerObject *viewer_object);
virtual const LLViewerJointAttachment* attachObject(LLViewerObject *viewer_object);
virtual BOOL detachObject(LLViewerObject *viewer_object);
void cleanupAttachedMesh( LLViewerObject* pVO );
static LLVOAvatar* findAvatarFromAttachment( LLViewerObject* obj );
static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj);
protected:
// [RLVa:KB] - Checked: 2009-12-18 (RLVa-1.1.0i) | Added: RLVa-1.1.0i
LLViewerJointAttachment* getTargetAttachmentPoint(const LLViewerObject* viewer_object) const;
@@ -762,7 +714,7 @@ public:
S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self
typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t;
attachment_map_t mAttachmentPoints;
std::vector<LLPointer<LLViewerObject> > mPendingAttachment;
std::vector<LLPointer<LLViewerObject> > mPendingAttachment;
//--------------------------------------------------------------------
// HUD functions
@@ -776,25 +728,6 @@ public:
protected:
U32 getNumAttachments() const; // O(N), not O(1)
//--------------------------------------------------------------------
// Old/nonstandard/Agent-only functions
//--------------------------------------------------------------------
public:
static BOOL detachAttachmentIntoInventory(const LLUUID& item_id);
BOOL isWearingAttachment( const LLUUID& inv_item_id );
// <edit> testzone attachpt
BOOL isWearingUnsupportedAttachment( const LLUUID& inv_item_id );
// </edit>
LLViewerObject* getWornAttachment( const LLUUID& inv_item_id );
// [RLVa:KB] - Checked: 2010-03-14 (RLVa-1.2.0a) | Added: RLVa-1.1.0i
LLViewerJointAttachment* getWornAttachmentPoint(const LLUUID& inv_item_id) const;
// [/RLVa:KB]
const std::string getAttachedPointName(const LLUUID& inv_item_id);
// <edit>
std::map<S32, std::pair<LLUUID/*inv*/,LLUUID/*object*/> > mUnsupportedAttachmentPoints;
// </edit>
/** Wearables
** **
*******************************************************************************/
@@ -1060,7 +993,6 @@ private:
//--------------------------------------------------------------------
public:
static void dumpArchetypeXML(void*);
static void dumpScratchTextureByteCount(); //Agent only
static void dumpBakedStatus();
const std::string getBakedStatusForPrintout() const;
void dumpAvatarTEs(const std::string& context) const;
@@ -1073,7 +1005,6 @@ protected:
S32 getUnbakedPixelAreaRank();
BOOL mHasGrey;
private:
LLUUID mSavedTE[ LLVOAvatarDefines::TEX_NUM_INDICES ];
BOOL mHasBakedHair;
F32 mMinPixelArea;
F32 mMaxPixelArea;
@@ -1235,15 +1166,15 @@ private:
//-----------------------------------------------------------------------------------------------
// Inlines
//-----------------------------------------------------------------------------------------------
inline BOOL LLVOAvatar::isTextureDefined(U8 te) const
inline BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex type) const
{
return (getTEImage(te)->getID() != IMG_DEFAULT_AVATAR && getTEImage(te)->getID() != IMG_DEFAULT);
return (getTEImage(type)->getID() != IMG_DEFAULT_AVATAR && getTEImage(type)->getID() != IMG_DEFAULT);
}
inline BOOL LLVOAvatar::isTextureVisible(U8 te) const
inline BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type) const
{
return ((isTextureDefined(te) || isSelf())
&& (getTEImage(te)->getID() != IMG_INVISIBLE
return ((isTextureDefined(type) || isSelf())
&& (getTEImage(type)->getID() != IMG_INVISIBLE
|| LLDrawPoolAlpha::sShowDebugAlpha));
}

File diff suppressed because it is too large Load Diff

View File

@@ -83,6 +83,15 @@ public:
void resetJointPositions( void );
/*virtual*/ BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
/*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE );
/*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE );
/*virtual*/ void updateVisualParams();
/*virtual*/ void idleUpdateAppearanceAnimation();
private:
// helper function. Passed in param is assumed to be in avatar's parameter list.
BOOL setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL upload_bake = FALSE );
/** Initialization
@@ -104,6 +113,11 @@ public:
/*virtual*/ BOOL updateCharacter(LLAgent &agent);
/*virtual*/ void idleUpdateTractorBeam();
//--------------------------------------------------------------------
// Loading state
//--------------------------------------------------------------------
public:
/*virtual*/ BOOL getIsCloud();
private:
@@ -129,12 +143,102 @@ private:
LLPointer<LLHUDEffectSpiral> mBeam;
LLFrameTimer mBeamTimer;
//--------------------------------------------------------------------
// LLVOAvatar Constants
//--------------------------------------------------------------------
public:
/*virtual*/ LLViewerTexture::EBoostLevel getAvatarBoostLevel() const { return LLViewerTexture::BOOST_AVATAR_SELF; }
/*virtual*/ LLViewerTexture::EBoostLevel getAvatarBakedBoostLevel() const { return LLViewerTexture::BOOST_AVATAR_BAKED_SELF; }
/*virtual*/ S32 getTexImageSize() const { return LLVOAvatar::getTexImageSize()*4; }
/** Rendering
** **
*******************************************************************************/
/********************************************************************************
** **
** TEXTURES
**/
//--------------------------------------------------------------------
// Loading status
//--------------------------------------------------------------------
public:
/*virtual*/ bool hasPendingBakedUploads() const;
S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex type) const;
bool areTexturesCurrent() const;
BOOL isLocalTextureDataAvailable(const LLTexLayerSet* layerset) const;
BOOL isLocalTextureDataFinal(const LLTexLayerSet* layerset) const;
//--------------------------------------------------------------------
// Local Textures
//--------------------------------------------------------------------
public:
BOOL getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture** image_gl_pp) const;
const LLUUID& getLocalTextureID(LLVOAvatarDefines::ETextureIndex type) const;
void setLocalTextureTE( U8 te, LLViewerTexture* image, BOOL set_by_user );
void setLocalTexture( LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits );
protected:
void localTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
void getLocalTextureByteCount(S32* gl_byte_count) const;
/*virtual*/ void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
private:
static void onLocalTextureLoaded(BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
//--------------------------------------------------------------------
// Baked textures
//--------------------------------------------------------------------
public:
LLVOAvatarDefines::ETextureIndex getBakedTE(const LLTexLayerSet* layerset ) const;
void setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid);
void setNewBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid);
void setCachedBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid);
void forceBakeAllTextures(bool slam_for_debug = false);
static void processRebakeAvatarTextures(LLMessageSystem* msg, void**);
BOOL isUsingBakedTextures() const; // e.g. false if in appearance edit mode
protected:
/*virtual*/ void removeMissingBakedTextures();
//--------------------------------------------------------------------
// Layers
//--------------------------------------------------------------------
public:
void requestLayerSetUploads();
void requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i);
void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i);
LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const;
//--------------------------------------------------------------------
// Composites
//--------------------------------------------------------------------
public:
/* virtual */ void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result);
/* virtual */ void invalidateAll();
/* virtual */ void setCompositeUpdatesEnabled(bool b); // only works for self
/* virtual */ void setCompositeUpdatesEnabled(U32 index, bool b);
/* virtual */ bool isCompositeUpdateEnabled(U32 index);
void setupComposites();
void updateComposites();
const LLUUID& grabBakedTexture(LLVOAvatarDefines::EBakedTextureIndex baked_index) const;
BOOL canGrabBakedTexture(LLVOAvatarDefines::EBakedTextureIndex baked_index) const;
//--------------------------------------------------------------------
// Scratch textures (used for compositing)
//--------------------------------------------------------------------
public:
BOOL bindScratchTexture(LLGLenum format);
static void deleteScratchTextures();
protected:
LLGLuint getScratchTexName(LLGLenum format, S32& components, U32* texture_bytes);
private:
static S32 sScratchTexBytes;
static LLMap< LLGLenum, LLGLuint*> sScratchTexNames;
static LLMap< LLGLenum, F32*> sScratchTexLastBindTime;
/** Textures
** **
*******************************************************************************/
/********************************************************************************
** **
** MESHES
@@ -146,15 +250,88 @@ protected:
** **
*******************************************************************************/
/********************************************************************************
** **
** WEARABLES
**/
public:
/*virtual*/ BOOL isWearingWearableType(LLWearableType::EType type) const;
void wearableUpdated(LLWearableType::EType type, BOOL upload_result);
protected:
U32 getNumWearables(LLVOAvatarDefines::ETextureIndex i) const;
//--------------------------------------------------------------------
// HUDs
// Attachments
//--------------------------------------------------------------------
public:
void updateAttachmentVisibility(U32 camera_mode);
BOOL isWearingAttachment(const LLUUID& inv_item_id) const;
BOOL attachmentWasRequested(const LLUUID& inv_item_id) const;
void addAttachmentRequest(const LLUUID& inv_item_id);
void removeAttachmentRequest(const LLUUID& inv_item_id);
LLViewerObject* getWornAttachment(const LLUUID& inv_item_id);
const std::string getAttachedPointName(const LLUUID& inv_item_id) const;
/*virtual*/ const LLViewerJointAttachment *attachObject(LLViewerObject *viewer_object);
/*virtual*/ BOOL detachObject(LLViewerObject *viewer_object);
static BOOL detachAttachmentIntoInventory(const LLUUID& item_id);
private:
// Track attachments that have been requested but have not arrived yet.
mutable std::map<LLUUID,LLTimer> mAttachmentRequests;
// <edit> testzone attachpt
public:
void addUnsupportedAttachment( LLViewerObject *viewer_object );
bool removeUnsupportedAttachment( LLViewerObject *viewer_object );
BOOL isWearingUnsupportedAttachment( const LLUUID& inv_item_id );
std::map<S32, std::pair<LLUUID/*inv*/,LLUUID/*object*/> > mUnsupportedAttachmentPoints;
// </edit>
// [RLVa:KB] - Checked: 2010-03-14 (RLVa-1.2.0a) | Added: RLVa-1.1.0i
LLViewerJointAttachment* getWornAttachmentPoint(const LLUUID& inv_item_id) const;
// [/RLVa:KB]
private:
LLViewerJoint* mScreenp; // special purpose joint for HUD attachments
/** Attachments
** **
*******************************************************************************/
/********************************************************************************
** **
** APPEARANCE
**/
public:
static void onCustomizeStart();
static void onCustomizeEnd();
/** Appearance
** **
*******************************************************************************/
// General
//--------------------------------------------------------------------
public:
static void dumpTotalLocalTextureByteCount();
void dumpLocalTextures() const;
static void dumpScratchTextureByteCount();
public:
struct LLAvatarTexData
{
LLAvatarTexData(const LLUUID& id, LLVOAvatarDefines::ETextureIndex index) :
mAvatarID(id),
mIndex(index)
{}
LLUUID mAvatarID;
LLVOAvatarDefines::ETextureIndex mIndex;
};
//Spechul schtuff.
static void onChangeSelfInvisible(BOOL newvalue);
void setInvisible(BOOL newvalue);
};
extern LLVOAvatarSelf *gAgentAvatarp;

View File

@@ -650,7 +650,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
{
const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te ) );
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id );
gAgentAvatarp->setLocTexTE( te, image, set_by_user );
gAgentAvatarp->setLocalTextureTE( te, image, set_by_user );
}
}
@@ -720,7 +720,7 @@ void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake
{
if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == type )
{
gAgentAvatarp->setLocTexTE( te, image, upload_bake );
gAgentAvatarp->setLocalTextureTE( te, image, upload_bake );
}
}

View File

@@ -1502,7 +1502,7 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const
const LLViewerObject* pAttachObj = gObjectList.findObject(rlvCmd.getObjectID());
if ( (pAttachObj) && (pAttachObj->isAttachment()) )
{
LLVOAvatar::detachAttachmentIntoInventory(pAttachObj->getAttachmentItemID());
LLVOAvatarSelf::detachAttachmentIntoInventory(pAttachObj->getAttachmentItemID());
}
}
break;

View File

@@ -355,8 +355,7 @@ void RlvForceWear::forceFolder(const LLViewerInventoryCategory* pFolder, EWearAc
LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
return;
}
LLVOAvatar* pAvatar = gAgentAvatarp;
if (!pAvatar)
if (!isAgentAvatarValid())
return;
// Grab a list of all the items we'll be wearing/attaching
@@ -439,7 +438,7 @@ void RlvForceWear::forceFolder(const LLViewerInventoryCategory* pFolder, EWearAc
}
else
{
const LLViewerObject* pAttachObj = pAvatar->getWornAttachment(pItem->getUUID());
const LLViewerObject* pAttachObj = gAgentAvatarp->getWornAttachment(pItem->getUUID());
if ( (pAttachObj) && (isForceDetachable(pAttachObj, false)) )
remAttachment(pAttachObj);
}

View File

@@ -364,9 +364,14 @@ void RlvRenameOnWearObserver::done()
// Checked: 2010-03-14 (RLVa-1.1.3a) | Added: RLVa-1.2.0a
void RlvRenameOnWearObserver::doneIdle()
{
const LLViewerInventoryCategory* pRlvRoot = NULL; LLVOAvatar* pAvatar = gAgentAvatarp;
const LLViewerInventoryCategory* pRlvRoot = NULL;
if(!isAgentAvatarValid())
{
delete this;
return;
}
if ( (RlvSettings::getEnableSharedWear()) || (!RlvSettings::getSharedInvAutoRename()) || (LLStartUp::getStartupState() < STATE_STARTED) ||
(!pAvatar) || ((pRlvRoot = RlvInventory::instance().getSharedRoot()) == NULL) )
((pRlvRoot = RlvInventory::instance().getSharedRoot()) == NULL) )
{
delete this;
return;
@@ -387,7 +392,7 @@ void RlvRenameOnWearObserver::doneIdle()
if (items.empty())
continue;
if ( ((pAttachPt = pAvatar->getWornAttachmentPoint(idAttachItem)) == NULL) ||
if ( ((pAttachPt = gAgentAvatarp->getWornAttachmentPoint(idAttachItem)) == NULL) ||
((idxAttachPt = RlvAttachPtLookup::getAttachPointIndex(pAttachPt)) == 0) )
{
// RLV_ASSERT(false);