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 llstylemap.cpp
llsurface.cpp llsurface.cpp
llsurfacepatch.cpp llsurfacepatch.cpp
lltexglobalcolor.cpp
lltexlayer.cpp lltexlayer.cpp
lltexlayerparams.cpp
lltexturecache.cpp lltexturecache.cpp
lltexturectrl.cpp lltexturectrl.cpp
lltexturefetch.cpp lltexturefetch.cpp
@@ -869,7 +871,9 @@ set(viewer_HEADER_FILES
llsurface.h llsurface.h
llsurfacepatch.h llsurfacepatch.h
lltable.h lltable.h
lltexglobalcolor.h
lltexlayer.h lltexlayer.h
lltexlayerparams.h
lltexturecache.h lltexturecache.h
lltexturectrl.h lltexturectrl.h
lltexturefetch.h lltexturefetch.h

View File

@@ -98,13 +98,11 @@ void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl, void* userdata)
gSavedSettings.setString("AscentReportClientUUID", client_uuid); gSavedSettings.setString("AscentReportClientUUID", client_uuid);
gSavedSettings.setU32("AscentReportClientIndex", client_index); gSavedSettings.setU32("AscentReportClientIndex", client_index);
LLVOAvatar* avatar = gAgentAvatarp; if (isAgentAvatarValid())
if (avatar)
{ {
// Slam pending upload count to "unstick" things // Slam pending upload count to "unstick" things
bool slam_for_debug = true; 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() void LLCOFMgr::updateAttachments()
{ {
/*const*/ LLVOAvatar* pAvatar = gAgentAvatarp; if (!isAgentAvatarValid())
if (!pAvatar)
return; return;
const LLUUID idCOF = getCOF(); const LLUUID idCOF = getCOF();
@@ -375,7 +374,7 @@ void LLCOFMgr::updateAttachments()
while (itPendingAttachLink != m_PendingAttachLinks.end()) while (itPendingAttachLink != m_PendingAttachLinks.end())
{ {
const LLUUID& idItem = *itPendingAttachLink; const LLUUID& idItem = *itPendingAttachLink;
if ( (!pAvatar->isWearingAttachment(idItem)) || (isLinkInCOF(idItem)) ) if ( (!gAgentAvatarp->isWearingAttachment(idItem)) || (isLinkInCOF(idItem)) )
{ {
itPendingAttachLink = m_PendingAttachLinks.erase(itPendingAttachLink); itPendingAttachLink = m_PendingAttachLinks.erase(itPendingAttachLink);
continue; 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) // 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. // one of the layer bitmaps has been updated, we need to rebake.
if ( mLayerUpdated ) if ( mLayerUpdated )
{ {
LLVOAvatar* avatar = gAgentAvatarp; if (isAgentAvatarValid()) { gAgentAvatarp->forceBakeAllTextures(SLAM_FOR_DEBUG); }
if (avatar) { avatar->forceBakeAllTextures(SLAM_FOR_DEBUG); }
mLayerUpdated = false; mLayerUpdated = false;
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -1623,8 +1623,7 @@ BOOL LLFolderBridge::isItemRemovable()
return FALSE; return FALSE;
} }
LLVOAvatar* avatar = gAgentAvatarp; if( !isAgentAvatarValid() )
if( !avatar )
{ {
return FALSE; return FALSE;
} }
@@ -1667,7 +1666,7 @@ BOOL LLFolderBridge::isItemRemovable()
} }
else if (item->getType() == LLAssetType::AT_OBJECT && !item->getIsLinkType()) else if (item->getType() == LLAssetType::AT_OBJECT && !item->getIsLinkType())
{ {
if( avatar->isWearingAttachment( item->getUUID() ) ) if( gAgentAvatarp->isWearingAttachment( item->getUUID() ) )
{ {
return FALSE; return FALSE;
} }
@@ -4028,17 +4027,16 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
LLInventoryItem* item = gInventory.getItem(mUUID); LLInventoryItem* item = gInventory.getItem(mUUID);
if(item) if(item)
{ {
LLVOAvatar::detachAttachmentIntoInventory(item->getLinkedUUID()); LLVOAvatarSelf::detachAttachmentIntoInventory(item->getLinkedUUID());
} }
} }
else if ("edit" == action) else if ("edit" == action)
{ {
if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) if (gRlvHandler.hasBehaviour(RLV_BHVR_EDIT))
return; return;
LLVOAvatar* avatarp = gAgentAvatarp; if (!isAgentAvatarValid())
if (!avatarp)
return; return;
LLViewerObject* objectp = avatarp->getWornAttachment(mUUID); LLViewerObject* objectp = gAgentAvatarp->getWornAttachment(mUUID);
if (!objectp) if (!objectp)
return; return;
@@ -4085,12 +4083,11 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
void LLObjectBridge::openItem() void LLObjectBridge::openItem()
{ {
LLVOAvatar* avatar = gAgentAvatarp; if (!isAgentAvatarValid())
if (!avatar)
{ {
return; return;
} }
if (avatar->isWearingAttachment(mUUID)) if (gAgentAvatarp->isWearingAttachment(mUUID))
{ {
// [RLVa:KB] // [RLVa:KB]
if ( !(rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(getItem()))) if ( !(rlv_handler_t::isEnabled()) || (gRlvAttachmentLocks.canDetach(getItem())))
@@ -4105,12 +4102,11 @@ void LLObjectBridge::openItem()
std::string LLObjectBridge::getLabelSuffix() const std::string LLObjectBridge::getLabelSuffix() const
{ {
LLVOAvatar* avatar = gAgentAvatarp; if( isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment( mUUID ) )
if( avatar && avatar->isWearingAttachment( mUUID ) )
{ {
std::string attachment_point_name = avatar->getAttachedPointName(mUUID); std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID);
LLStringUtil::toLower(attachment_point_name); 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] // [RLVa:KB]
if ( pObj && (gRlvAttachmentLocks.isLockedAttachment(pObj) || if ( pObj && (gRlvAttachmentLocks.isLockedAttachment(pObj) ||
gRlvAttachmentLocks.isLockedAttachmentPoint(RlvAttachPtLookup::getAttachPointIndex(pObj),RLV_LOCK_REMOVE))) gRlvAttachmentLocks.isLockedAttachmentPoint(RlvAttachPtLookup::getAttachPointIndex(pObj),RLV_LOCK_REMOVE)))
@@ -4123,10 +4119,10 @@ std::string LLObjectBridge::getLabelSuffix() const
else else
{ {
// <edit> testzone attachpt // <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 iter = gAgentAvatarp->mUnsupportedAttachmentPoints.begin();
std::map<S32, std::pair<LLUUID,LLUUID> >::iterator end = avatar->mUnsupportedAttachmentPoints.end(); std::map<S32, std::pair<LLUUID,LLUUID> >::iterator end = gAgentAvatarp->mUnsupportedAttachmentPoints.end();
for( ; iter != end; ++iter) for( ; iter != end; ++iter)
if((*iter).second.first == mUUID) if((*iter).second.first == mUUID)
{ {
@@ -4155,9 +4151,20 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
attachment = RlvAttachPtLookup::getAttachPoint(item); attachment = RlvAttachPtLookup::getAttachPoint(item);
} }
// [/RLVa:KB] // [/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; S32 attach_pt = 0;
if (gAgentAvatarp && attachment) if (isAgentAvatarValid() && attachment)
{ {
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
@@ -4171,11 +4178,12 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
} }
LLSD payload; 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["attachment_point"] = attach_pt;
payload["is_add"] = !replace; 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 // [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 // 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(); LLInventoryItem* item = getItem();
if(item) if(item)
{ {
LLVOAvatar *avatarp = gAgentAvatarp; if( !isAgentAvatarValid() )
if( !avatarp )
{ {
return; return;
} }
@@ -4266,7 +4273,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
} }
else else
// <edit> testzone attachpt // <edit> testzone attachpt
if( avatarp->isWearingUnsupportedAttachment( mUUID ) ) if( gAgentAvatarp->isWearingUnsupportedAttachment( mUUID ) )
{ {
items.push_back(std::string("Detach From Yourself")); 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")); items.push_back(std::string("Object Wear"));
if (gHippoGridManager->getConnectedGrid()->supportsInvLinks()) if (gHippoGridManager->getConnectedGrid()->supportsInvLinks())
items.push_back(std::string("Object Add")); items.push_back(std::string("Object Add"));
if (!avatarp->canAttachMoreObjects()) if (!gAgentAvatarp->canAttachMoreObjects())
{ {
disabled_items.push_back(std::string("Object Add")); 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 // commented out for DEV-32347 - AND Commented back in for non-morons. -HgB
items.push_back(std::string("Restore to Last Position")); 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 Wear"));
disabled_items.push_back(std::string("Object Add")); disabled_items.push_back(std::string("Object Add"));
@@ -4310,11 +4317,10 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
if (attach_menu if (attach_menu
&& (attach_menu->getChildCount() == 0) && (attach_menu->getChildCount() == 0)
&& attach_hud_menu && attach_hud_menu
&& (attach_hud_menu->getChildCount() == 0) && (attach_hud_menu->getChildCount() == 0))
&& avatarp)
{ {
for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != avatarp->mAttachmentPoints.end(); ) iter != gAgentAvatarp->mAttachmentPoints.end(); )
{ {
LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second; LLViewerJointAttachment* attachment = curiter->second;
@@ -4374,10 +4380,9 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
model->updateItem(new_item); model->updateItem(new_item);
model->notifyObservers(); model->notifyObservers();
LLVOAvatar* avatar = gAgentAvatarp; if( isAgentAvatarValid() )
if( avatar )
{ {
LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
if( obj ) if( obj )
{ {
LLSelectMgr::getInstance()->deselectAll(); 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); LLViewerInventoryItem *obj_item = obj_item_array.get(i);
if (get_is_item_worn(obj_item->getUUID())) 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; return false;
bool allowed = false; bool allowed = false;
LLVOAvatar* my_avatar = NULL;
switch(item->getType()) switch(item->getType())
{ {
@@ -3656,8 +3655,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
break; break;
case LLAssetType::AT_OBJECT: case LLAssetType::AT_OBJECT:
my_avatar = gAgentAvatarp; if(isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
if(my_avatar && !my_avatar->isWearingAttachment(item->getUUID()))
{ {
allowed = true; allowed = true;
} }

View File

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

View File

@@ -231,10 +231,9 @@ void LLPreview::onCommit()
// update the object itself. // update the object itself.
if( item->getType() == LLAssetType::AT_OBJECT ) if( item->getType() == LLAssetType::AT_OBJECT )
{ {
LLVOAvatar* avatar = gAgentAvatarp; if( isAgentAvatarValid() )
if( avatar )
{ {
LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
if( obj ) if( obj )
{ {
LLSelectMgr::getInstance()->deselectAll(); 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_AvatarAnimation, process_avatar_animation);
msg->setHandlerFuncFast(_PREHASH_AvatarAppearance, process_avatar_appearance); msg->setHandlerFuncFast(_PREHASH_AvatarAppearance, process_avatar_appearance);
msg->setHandlerFunc("AgentCachedTextureResponse", LLAgent::processAgentCachedTextureResponse); 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_CameraConstraint, process_camera_constraint);
msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse, process_avatar_sit_response); msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse, process_avatar_sit_response);
msg->setHandlerFunc("SetFollowCamProperties", process_set_follow_cam_properties); 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 #define LL_LLTEXLAYER_H
#include <deque> #include <deque>
#include "llassetstorage.h"
#include "lldynamictexture.h" #include "lldynamictexture.h"
#include "llrect.h"
#include "llstring.h"
#include "lluuid.h"
#include "llviewertexture.h"
#include "llviewervisualparam.h"
#include "llvoavatardefines.h" #include "llvoavatardefines.h"
#include "llwearable.h" #include "lltexlayerparams.h"
#include "v4color.h"
#include "llfloater.h"
#include "llvoavatar.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 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: public:
LLTexLayerParamAlphaInfo(); enum ERenderPass
/*virtual*/ ~LLTexLayerParamAlphaInfo() {}; {
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: protected:
std::string mStaticImageFileName; const std::string& getGlobalColor() const;
BOOL mMultiplyBlend; LLViewerVisualParam* getVisualParamPtr(S32 index) const;
BOOL mSkipIfZeroWeight;
F32 mDomain;
};
//-----------------------------------------------------------------------------
// LLTexParamColorInfo
//-----------------------------------------------------------------------------
class LLTexParamColorInfo : public LLViewerVisualParamInfo
{
friend class LLTexParamColor;
public:
LLTexParamColorInfo();
virtual ~LLTexParamColorInfo() {};
BOOL parseXml( LLXmlTreeNode* node );
protected: protected:
enum { MAX_COLOR_VALUES = 20 }; LLTexLayerSet* const mTexLayerSet;
EColorOperation mOperation; const LLTexLayerInfo* mInfo;
LLColor4 mColors[MAX_COLOR_VALUES]; BOOL mMorphMasksValid;
S32 mNumColors; BOOL mHasMorph;
};
//----------------------------------------------------------------------------- // Layers can have either mParamColorList, mGlobalColor, or mFixedColor. They are looked for in that order.
// LLTexGlobalColorInfo param_color_list_t mParamColorList;
//----------------------------------------------------------------------------- param_alpha_list_t mParamAlphaList;
class LLTexGlobalColorInfo // mGlobalColor name stored in mInfo
{ // mFixedColor value stored in mInfo
friend class LLTexGlobalColor;
public:
LLTexGlobalColorInfo();
~LLTexGlobalColorInfo();
BOOL parseXml(LLXmlTreeNode* node);
protected: typedef std::deque<char *> morph_list_t; //Hack.
typedef std::vector<LLTexParamColorInfo *> color_info_list_t; morph_list_t mMaskedMorphs;
color_info_list_t mColorInfoList;
std::string mName;
}; };
//----------------------------------------------------------------------------- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 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 // LLTexLayerSetInfo
// Containes shared layer set data //
//----------------------------------------------------------------------------- // Contains shared layer set data.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSetInfo class LLTexLayerSetInfo
{ {
friend class LLTexLayerSet; friend class LLTexLayerSet;
public: public:
LLTexLayerSetInfo(); LLTexLayerSetInfo();
~LLTexLayerSetInfo(); ~LLTexLayerSetInfo();
BOOL parseXml(LLXmlTreeNode* node); BOOL parseXml(LLXmlTreeNode* node);
private:
protected:
std::string mBodyRegion; std::string mBodyRegion;
S32 mWidth; S32 mWidth;
S32 mHeight; S32 mHeight;
std::string mStaticAlphaFileName; 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; typedef std::vector<LLTexLayerInfo*> layer_info_list_t;
layer_info_list_t mLayerInfoList; 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 // LLTexLayerSetBuffer
//
// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one. // The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
//----------------------------------------------------------------------------- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerSetBuffer : public LLViewerDynamicTexture class LLTexLayerSetBuffer : public LLViewerDynamicTexture
{ {
public: public:
LLTexLayerSetBuffer(LLTexLayerSet* owner, S32 width, S32 height); LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
virtual ~LLTexLayerSetBuffer(); virtual ~LLTexLayerSetBuffer();
virtual void preRender(BOOL clear_depth); public:
virtual void postRender(BOOL success); /*virtual*/ S8 getType() const;
virtual BOOL render(); BOOL isInitialized(void) const;
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);
static void dumpTotalByteCount(); static void dumpTotalByteCount();
virtual void restoreGLTexture();
virtual S8 getType() const ; virtual void destroyGLTexture();
virtual void restoreGLTexture() ; protected:
virtual void destroyGLTexture() ;
private:
void pushProjection() const; void pushProjection() const;
void popProjection() const; void popProjection() const;
BOOL needsUploadNow() const;
private: private:
BOOL mNeedsUpdate; LLTexLayerSet* const mTexLayerSet;
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;
static S32 sGLByteCount; static S32 sGLByteCount;
};
//----------------------------------------------------------------------------- //--------------------------------------------------------------------
// LLTexLayerSet // Render
// An ordered set of texture layers that get composited into a single texture. //--------------------------------------------------------------------
//-----------------------------------------------------------------------------
class LLTexLayerSet
{
friend class LLTexLayerSetBuffer;
public: public:
LLTexLayerSet( LLVOAvatar* avatar ); /*virtual*/ BOOL needsRender();
~LLTexLayerSet(); protected:
BOOL render(S32 x, S32 y, S32 width, S32 height);
//BOOL parseData(LLXmlTreeNode* node); virtual void preRender(BOOL clear_depth);
LLTexLayerSetInfo* getInfo() const { return mInfo; } virtual void postRender(BOOL success);
// This sets mInfo and calls initialization functions virtual BOOL render();
BOOL setInfo(LLTexLayerSetInfo *info);
BOOL render( S32 x, S32 y, S32 width, S32 height ); //--------------------------------------------------------------------
void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false); // Uploads
BOOL isBodyRegion( const std::string& region ) { return mInfo->mBodyRegion == region; } //--------------------------------------------------------------------
LLTexLayerSetBuffer* getComposite(); public:
void requestUpdate();
void requestUpload(); void requestUpload();
void requestDelayedUpload(U64 delay_usec);
BOOL needsUploadNow() const;
void cancelUpload(); void cancelUpload();
LLVOAvatar* getAvatar() { return mAvatar; } BOOL uploadPending() const; // We are expecting a new texture to be uploaded at some point
void updateComposite(); static void onTextureUploadComplete(const LLUUID& uuid,
BOOL isLocalTextureDataAvailable(); void* userdata,
BOOL isLocalTextureDataFinal(); S32 result, LLExtStat ext_status);
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; }
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: 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(); void requestUpdate();
LLTexLayerSet* getTexLayerSet() { return mTexLayerSet; } BOOL requestUpdateImmediate();
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;
}; };
//----------------------------------------------------------------------------- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLTexLayerParamAlpha // LLTexLayerStaticImageList
//----------------------------------------------------------------------------- //
class LLTexLayerParamAlpha : public LLViewerVisualParam //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList>
{ {
public: public:
LLTexLayerParamAlpha( LLTexLayer* layer ); LLTexLayerStaticImageList();
/*virtual*/ ~LLTexLayerParamAlpha(); ~LLTexLayerStaticImageList();
LLViewerTexture* getTexture(const std::string& file_name, BOOL is_mask);
// Special: These functions are overridden by child classes LLImageTGA* getImageTGA(const std::string& file_name);
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 );
void deleteCachedImages(); void deleteCachedImages();
void dumpByteCount() const; void dumpByteCount() const;
protected: protected:
BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw); BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
private: private:
static LLStringTable sImageNames; LLStringTable mImageNames;
typedef std::map<const char*, LLPointer<LLViewerTexture> > texture_map_t; typedef std::map<const char*, LLPointer<LLViewerTexture> > texture_map_t;
texture_map_t mStaticImageList; texture_map_t mStaticImageList;
typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t; typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
image_tga_map_t mStaticImageListTGA; image_tga_map_t mStaticImageListTGA;
public:
S32 mGLBytes; S32 mGLBytes;
S32 mTGABytes; S32 mTGABytes;
}; };
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LLBakedUploadData
//
// Used by LLTexLayerSetBuffer for a callback. // Used by LLTexLayerSetBuffer for a callback.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// For DEV-DEV-31590, "Heap corruption and crash after outfit struct LLBakedUploadData
// 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
{ {
public: LLBakedUploadData(const LLVOAvatarSelf* avatar,
LLBakedUploadData( LLVOAvatar* avatar, LLTexLayerSet* layerset, LLTexLayerSetBuffer* layerset_buffer, const LLUUID & id); LLTexLayerSet* layerset,
const LLUUID& id);
~LLBakedUploadData() {} ~LLBakedUploadData() {}
const LLUUID mID;
const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer
LLTexLayerSet* mTexLayerSet;
LLUUID mID; const U64 mStartTime; // for measuring baked texture upload time
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
}; };
extern LLTexStaticImageList gTexStaticImageList;
#endif // LL_LLTEXLAYER_H #endif // LL_LLTEXLAYER_H

View File

@@ -145,13 +145,6 @@ LLTexLayerParamAlpha::~LLTexLayerParamAlpha()
sInstances.remove(this); 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() void LLTexLayerParamAlpha::deleteCaches()
{ {
mStaticImageTGA = NULL; // deletes image mStaticImageTGA = NULL; // deletes image
@@ -188,6 +181,7 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
} }
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake); mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
mTexLayer->invalidateMorphMasks(); 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. // Create the GL texture, and then hang onto it for future use.
if (mNeedsCreateTexture) if (mNeedsCreateTexture)
{ {
mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw); mCachedProcessedTexture->createGLTexture(0, mStaticImageRaw, 0, TRUE, LLViewerTexture::BOOST_AVATAR_SELF);
mNeedsCreateTexture = FALSE; mNeedsCreateTexture = FALSE;
gGL.getTexUnit(0)->bind(mCachedProcessedTexture); gGL.getTexUnit(0)->bind(mCachedProcessedTexture);
mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP); mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP);
} }
LLGLSNoAlphaTest gls_no_alpha_test; LLGLSNoAlphaTest gls_no_alpha_test;
gGL.getTexUnit(0)->bind(mCachedProcessedTexture); gGL.getTexUnit(0)->bind(mCachedProcessedTexture, TRUE);
gl_rect_2d_simple_tex(width, height); gl_rect_2d_simple_tex(width, height);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
stop_glerror(); 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 LLColor4 LLTexLayerParamColor::getNetColor() const
{ {
@@ -521,7 +509,7 @@ LLTexLayerParamColorInfo::LLTexLayerParamColorInfo() :
BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node) 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)) if (!LLViewerVisualParamInfo::parseXml(node))
return FALSE; 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()) // gAgent.getGroupID())
// && (obj->mPermModify || obj->mFlagAllowInventoryAdd)); // && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
BOOL worn = FALSE; BOOL worn = FALSE;
LLVOAvatar* my_avatar = NULL; LLVOAvatarSelf* my_avatar = NULL;
switch(item->getType()) switch(item->getType())
{ {
case LLAssetType::AT_OBJECT: case LLAssetType::AT_OBJECT:
@@ -2858,7 +2858,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
// cannot give away no-transfer objects // cannot give away no-transfer objects
return ACCEPT_NO; return ACCEPT_NO;
} }
LLVOAvatar* avatar = gAgentAvatarp; LLVOAvatarSelf* avatar = gAgentAvatarp;
if(avatar && avatar->isWearingAttachment( item->getUUID() ) ) if(avatar && avatar->isWearingAttachment( item->getUUID() ) )
{ {
// You can't give objects that are attached to you // 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) void LLVisualParamHint::preRender(BOOL clear_depth)
{ {
mLastParamWeight = mVisualParam->getWeight(); mLastParamWeight = gAgentAvatarp->getVisualParamWeight(mVisualParam);
//mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE); gAgentAvatarp->setVisualParamWeight(mVisualParam, mVisualParamWeight);
gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f); gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f);
gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f); gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f);
gAgentAvatarp->updateComposites(); gAgentAvatarp->updateComposites();
@@ -236,9 +235,9 @@ BOOL LLVisualParamHint::render()
LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / (F32)mFullHeight); LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / (F32)mFullHeight);
LLViewerCamera::getInstance()->setOriginAndLookAt( LLViewerCamera::getInstance()->setOriginAndLookAt(
camera_pos, // camera camera_pos, // camera
LLVector3::z_axis, // up 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); 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) static bool handleSetSelfInvisible( const LLSD& newvalue)
{ {
LLVOAvatar::onChangeSelfInvisible( newvalue.asBoolean() ); LLVOAvatarSelf::onChangeSelfInvisible( newvalue.asBoolean() );
return true; return true;
} }

View File

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

View File

@@ -587,8 +587,8 @@ void handle_mesh_load_obj(void*);
void handle_morph_save_obj(void*); void handle_morph_save_obj(void*);
void handle_morph_load_obj(void*); void handle_morph_load_obj(void*);
void handle_debug_avatar_textures(void*); void handle_debug_avatar_textures(void*);
void handle_grab_texture(void*); void handle_grab_baked_texture(void*);
BOOL enable_grab_texture(void*); BOOL enable_grab_baked_texture(void*);
void handle_dump_region_object_cache(void*); void handle_dump_region_object_cache(void*);
BOOL menu_ui_enabled(void *user_data); 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) 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("Iris", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_EYES));
menu->append(new LLMenuItemCallGL("Head", handle_grab_texture, enable_grab_texture, (void*) TEX_HEAD_BAKED)); menu->append(new LLMenuItemCallGL("Head", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_HEAD));
menu->append(new LLMenuItemCallGL("Upper Body", handle_grab_texture, enable_grab_texture, (void*) TEX_UPPER_BAKED)); 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_texture, enable_grab_texture, (void*) TEX_LOWER_BAKED)); menu->append(new LLMenuItemCallGL("Lower Body", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_LOWER));
menu->append(new LLMenuItemCallGL("Skirt", handle_grab_texture, enable_grab_texture, (void*) TEX_SKIRT_BAKED)); menu->append(new LLMenuItemCallGL("Skirt", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_SKIRT));
menu->append(new LLMenuItemCallGL("Hair", handle_grab_texture, enable_grab_texture, (void*) TEX_HAIR_BAKED)); menu->append(new LLMenuItemCallGL("Hair", handle_grab_baked_texture, enable_grab_baked_texture, (void*) BAKED_HAIR));
menu->createJumpKeys(); menu->createJumpKeys();
} }
@@ -3048,9 +3048,9 @@ class LLAvatarDebug : public view_listener_t
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{ {
LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); 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 // <edit> hell no don't tell them about that
/* /*
llinfos << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << llendl; 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*) void handle_dump_avatar_local_textures(void*)
{ {
LLVOAvatar* avatar = gAgentAvatarp; if( isAgentAvatarValid() )
if( avatar )
{ {
avatar->dumpLocalTextures(); gAgentAvatarp->dumpLocalTextures();
} }
} }
@@ -8697,106 +8696,79 @@ void handle_debug_avatar_textures(void*)
// </edit> // </edit>
} }
void handle_grab_texture(void* data) void handle_grab_baked_texture(void* data)
{ {
ETextureIndex index = (ETextureIndex)((intptr_t)data); EBakedTextureIndex baked_tex_index = (EBakedTextureIndex)((intptr_t)data);
LLVOAvatar* avatar = gAgentAvatarp; if (!isAgentAvatarValid()) return;
if ( avatar )
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); std::string name;
LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl; name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture";
LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE; LLUUID item_id;
LLUUID folder_id(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE)); item_id.generate();
if(folder_id.notNull()) LLPermissions perm;
{ perm.init(gAgentID,
std::string name = "Baked "; gAgentID,
switch (index) 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: LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
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");
LLUUID item_id; view->getPanel()->setSelection(item_id, TAKE_FOCUS_NO);
item_id.generate(); view->getPanel()->openSelected();
LLPermissions perm; //LLInventoryView::dumpSelectionInformation((void*)view);
perm.init(gAgentID, // restore keyboard focus
gAgentID, gFocusMgr.setKeyboardFocus(focus_ctrl);
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;
} }
} }
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); EBakedTextureIndex index = (EBakedTextureIndex)((intptr_t)data);
LLVOAvatar* avatar = gAgentAvatarp; if (isAgentAvatarValid())
if ( avatar )
{ {
return avatar->canGrabLocalTexture(index); return gAgentAvatarp->canGrabBakedTexture(index);
} }
return FALSE; return FALSE;
} }
@@ -9034,12 +9006,11 @@ void handle_buy_currency_test(void*)
void handle_rebake_textures(void*) void handle_rebake_textures(void*)
{ {
LLVOAvatar* avatar = gAgentAvatarp; if (!isAgentAvatarValid()) return;
if (!avatar) return;
// Slam pending upload count to "unstick" things // Slam pending upload count to "unstick" things
bool slam_for_debug = true; bool slam_for_debug = true;
avatar->forceBakeAllTextures(slam_for_debug); gAgentAvatarp->forceBakeAllTextures(slam_for_debug);
} }
void toggle_visibility(void* user_data) void toggle_visibility(void* user_data)

View File

@@ -45,6 +45,7 @@
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llviewertexturelist.h" #include "llviewertexturelist.h"
#include "lltexlayer.h" #include "lltexlayer.h"
#include "lltexlayerparams.h"
#include "llsurface.h" #include "llsurface.h"
#include "llvlmanager.h" #include "llvlmanager.h"
#include "llagent.h" #include "llagent.h"
@@ -55,7 +56,7 @@
#include "lldebugview.h" #include "lldebugview.h"
#include "llfasttimerview.h" #include "llfasttimerview.h"
#include "llviewerregion.h" #include "llviewerregion.h"
#include "llvoavatar.h" #include "llvoavatarself.h"
#include "llviewerwindow.h" // *TODO: remove, only used for width/height #include "llviewerwindow.h" // *TODO: remove, only used for width/height
#include "llworld.h" #include "llworld.h"
#include "llfeaturemanager.h" #include "llfeaturemanager.h"
@@ -525,12 +526,12 @@ void output_statistics(void*)
llinfos << "--------------------------------" << llendl; llinfos << "--------------------------------" << llendl;
llinfos << "Avatar Memory (partly overlaps with above stats):" << llendl; llinfos << "Avatar Memory (partly overlaps with above stats):" << llendl;
gTexStaticImageList.dumpByteCount(); LLTexLayerStaticImageList::getInstance()->dumpByteCount();
LLVOAvatar::dumpScratchTextureByteCount(); LLVOAvatarSelf::dumpScratchTextureByteCount();
LLTexLayerSetBuffer::dumpTotalByteCount(); LLTexLayerSetBuffer::dumpTotalByteCount();
LLVOAvatar::dumpTotalLocalTextureByteCount(); LLVOAvatarSelf::dumpTotalLocalTextureByteCount();
LLTexLayerParamAlpha::dumpCacheByteCount(); LLTexLayerParamAlpha::dumpCacheByteCount();
LLVOAvatar::dumpBakedStatus(); LLVOAvatarSelf::dumpBakedStatus();
llinfos << llendl; 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() // setInfo()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -139,7 +133,7 @@ BOOL LLViewerVisualParam::setInfo(LLViewerVisualParamInfo *info)
setWeight(getDefaultWeight(), FALSE ); setWeight(getDefaultWeight(), FALSE );
return TRUE; return TRUE;
} }
/*
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// parseData() // parseData()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -90,7 +90,7 @@ public:
virtual const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0; virtual const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0;
// interface methods // interface methods
F32 getDisplayOrder() { return getInfo()->mEditGroupDisplayOrder; } F32 getDisplayOrder() const { return getInfo()->mEditGroupDisplayOrder; }
S32 getWearableType() const { return getInfo()->mWearableType; } S32 getWearableType() const { return getInfo()->mWearableType; }
const std::string& getEditGroup() const { return getInfo()->mEditGroup; } 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 "llrendertarget.h"
#include "llwearable.h" #include "llwearable.h"
#include "llvoavatardefines.h" #include "llvoavatardefines.h"
#include "lltexglobalcolor.h"
#include "emeraldboobutils.h" #include "emeraldboobutils.h"
#include "llavatarname.h" #include "llavatarname.h"
@@ -231,6 +232,7 @@ public:
void idleUpdateLoadingEffect(); void idleUpdateLoadingEffect();
void idleUpdateWindEffect(); void idleUpdateWindEffect();
void idleUpdateNameTag(const LLVector3& root_pos_last); void idleUpdateNameTag(const LLVector3& root_pos_last);
LLVector3 idleUpdateNameTagPosition(const LLVector3& root_pos_last);
void clearNameTag(); void clearNameTag();
static void invalidateNameTag(const LLUUID& agent_id); static void invalidateNameTag(const LLUUID& agent_id);
// force all name tags to rebuild, useful when display names turned on/off // force all name tags to rebuild, useful when display names turned on/off
@@ -238,8 +240,6 @@ public:
void idleUpdateRenderCost(); void idleUpdateRenderCost();
void idleUpdateBelowWater(); void idleUpdateBelowWater();
void idleUpdateBoobEffect(); //Emerald void idleUpdateBoobEffect(); //Emerald
void updateAttachmentVisibility(U32 camera_mode); //Agent only
LLFrameTimer mIdleTimer; LLFrameTimer mIdleTimer;
std::string getIdleTime(); std::string getIdleTime();
@@ -276,8 +276,12 @@ public:
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
BOOL isFullyLoaded() const; BOOL isFullyLoaded() const;
bool visualParamWeightsAreDefault();
protected:
virtual BOOL getIsCloud();
//BOOL isReallyFullyLoaded(); //BOOL isReallyFullyLoaded();
BOOL updateIsFullyLoaded(); BOOL updateIsFullyLoaded();
BOOL processFullyLoadedChange(bool loading);
protected: protected:
bool sendAvatarTexturesRequest(); bool sendAvatarTexturesRequest();
void updateRuthTimer(bool loading); void updateRuthTimer(bool loading);
@@ -474,6 +478,15 @@ public:
private: private:
static S32 sFreezeCounter; 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 /** Rendering
** ** ** **
*******************************************************************************/ *******************************************************************************/
@@ -487,8 +500,8 @@ private:
// Loading status // Loading status
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
BOOL isTextureDefined(U8 te) const; BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type) const;
BOOL isTextureVisible(U8 te) const; BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type) const;
protected: protected:
BOOL isFullyBaked(); BOOL isFullyBaked();
@@ -523,8 +536,9 @@ protected:
// Local Textures // Local Textures
//-------------------------------------------------------------------- //--------------------------------------------------------------------
protected: protected:
void setLocalTexture(LLVOAvatarDefines::ETextureIndex i, LLViewerFetchedTexture* tex, BOOL baked_version_exits); virtual void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits);
void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked); virtual void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex type, LLViewerFetchedTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Layers // Layers
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@@ -538,6 +552,9 @@ protected:
public: public:
virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result); virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result);
virtual void invalidateAll(); 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 // Static texture/mesh/baked dictionary
@@ -562,71 +579,14 @@ private:
//Most this stuff is Agent only //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 // Other public functions
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public:
static void dumpTotalLocalTextureByteCount();
protected:
void getLocalTextureByteCount( S32* gl_byte_count );
public: 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 setNameFromChat(const std::string &text);
void clearNameFromChat(); 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 /** Textures
** ** ** **
*******************************************************************************/ *******************************************************************************/
@@ -673,7 +633,6 @@ public:
void processAvatarAppearance(LLMessageSystem* mesgsys); void processAvatarAppearance(LLMessageSystem* mesgsys);
void hideSkirt(); void hideSkirt();
void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound); void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound);
LLPolyMesh* getMesh(LLPolyMeshSharedData* shared_data);
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Appearance morphing // Appearance morphing
@@ -691,12 +650,12 @@ public:
typedef std::map<std::string, lod_mesh_map_t> mesh_info_t; typedef std::map<std::string, lod_mesh_map_t> mesh_info_t;
static void getMeshInfo(mesh_info_t* mesh_info); static void getMeshInfo(mesh_info_t* mesh_info);
LLPolyMesh* getMesh( LLPolyMeshSharedData *shared_data );
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Clothing colors (convenience functions to access visual parameters) // Clothing colors (convenience functions to access visual parameters)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: 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); LLColor4 getClothesColor(LLVOAvatarDefines::ETextureIndex te);
static BOOL teToColorParams( LLVOAvatarDefines::ETextureIndex te, const char* param_name[3] ); static BOOL teToColorParams( LLVOAvatarDefines::ETextureIndex te, const char* param_name[3] );
@@ -705,7 +664,7 @@ public:
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
LLColor4 getGlobalColor(const std::string& color_name ) const; 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: private:
LLTexGlobalColor* mTexSkinColor; LLTexGlobalColor* mTexSkinColor;
LLTexGlobalColor* mTexHairColor; LLTexGlobalColor* mTexHairColor;
@@ -720,13 +679,6 @@ public:
U32 getVisibilityRank() const { return mVisibilityRank; } // unused U32 getVisibilityRank() const { return mVisibilityRank; } // unused
static S32 sNumVisibleAvatars; // Number of instances of this class static S32 sNumVisibleAvatars; // Number of instances of this class
static LLColor4 getDummyColor(); static LLColor4 getDummyColor();
//--------------------------------------------------------------------
// Customize
//--------------------------------------------------------------------
public:
static void onCustomizeStart();
static void onCustomizeEnd();
/** Appearance /** Appearance
** ** ** **
*******************************************************************************/ *******************************************************************************/
@@ -737,17 +689,17 @@ public:
**/ **/
public: public:
BOOL isWearingWearableType( LLWearableType::EType type ) const; virtual BOOL isWearingWearableType(LLWearableType::EType type ) const;
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// Attachments // Attachments
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
void clampAttachmentPositions(); void clampAttachmentPositions();
BOOL attachObject(LLViewerObject *viewer_object); virtual const LLViewerJointAttachment* attachObject(LLViewerObject *viewer_object);
BOOL detachObject(LLViewerObject *viewer_object); virtual BOOL detachObject(LLViewerObject *viewer_object);
void cleanupAttachedMesh( LLViewerObject* pVO ); void cleanupAttachedMesh( LLViewerObject* pVO );
static LLVOAvatar* findAvatarFromAttachment( LLViewerObject* obj ); static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj);
protected: protected:
// [RLVa:KB] - Checked: 2009-12-18 (RLVa-1.1.0i) | Added: RLVa-1.1.0i // [RLVa:KB] - Checked: 2009-12-18 (RLVa-1.1.0i) | Added: RLVa-1.1.0i
LLViewerJointAttachment* getTargetAttachmentPoint(const LLViewerObject* viewer_object) const; 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 S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self
typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t; typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t;
attachment_map_t mAttachmentPoints; attachment_map_t mAttachmentPoints;
std::vector<LLPointer<LLViewerObject> > mPendingAttachment; std::vector<LLPointer<LLViewerObject> > mPendingAttachment;
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// HUD functions // HUD functions
@@ -776,25 +728,6 @@ public:
protected: protected:
U32 getNumAttachments() const; // O(N), not O(1) 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 /** Wearables
** ** ** **
*******************************************************************************/ *******************************************************************************/
@@ -1060,7 +993,6 @@ private:
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
static void dumpArchetypeXML(void*); static void dumpArchetypeXML(void*);
static void dumpScratchTextureByteCount(); //Agent only
static void dumpBakedStatus(); static void dumpBakedStatus();
const std::string getBakedStatusForPrintout() const; const std::string getBakedStatusForPrintout() const;
void dumpAvatarTEs(const std::string& context) const; void dumpAvatarTEs(const std::string& context) const;
@@ -1073,7 +1005,6 @@ protected:
S32 getUnbakedPixelAreaRank(); S32 getUnbakedPixelAreaRank();
BOOL mHasGrey; BOOL mHasGrey;
private: private:
LLUUID mSavedTE[ LLVOAvatarDefines::TEX_NUM_INDICES ];
BOOL mHasBakedHair; BOOL mHasBakedHair;
F32 mMinPixelArea; F32 mMinPixelArea;
F32 mMaxPixelArea; F32 mMaxPixelArea;
@@ -1235,15 +1166,15 @@ private:
//----------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------
// Inlines // 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()) return ((isTextureDefined(type) || isSelf())
&& (getTEImage(te)->getID() != IMG_INVISIBLE && (getTEImage(type)->getID() != IMG_INVISIBLE
|| LLDrawPoolAlpha::sShowDebugAlpha)); || LLDrawPoolAlpha::sShowDebugAlpha));
} }

File diff suppressed because it is too large Load Diff

View File

@@ -83,6 +83,15 @@ public:
void resetJointPositions( void ); 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 /** Initialization
@@ -104,6 +113,11 @@ public:
/*virtual*/ BOOL updateCharacter(LLAgent &agent); /*virtual*/ BOOL updateCharacter(LLAgent &agent);
/*virtual*/ void idleUpdateTractorBeam(); /*virtual*/ void idleUpdateTractorBeam();
//--------------------------------------------------------------------
// Loading state
//--------------------------------------------------------------------
public:
/*virtual*/ BOOL getIsCloud();
private: private:
@@ -129,12 +143,102 @@ private:
LLPointer<LLHUDEffectSpiral> mBeam; LLPointer<LLHUDEffectSpiral> mBeam;
LLFrameTimer mBeamTimer; 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 /** 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: protected:
/*virtual*/ void removeMissingBakedTextures(); /*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 ** 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: 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 LLViewerJoint* mScreenp; // special purpose joint for HUD attachments
/** 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; 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 ) ); const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te ) );
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id ); 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 ) 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()); const LLViewerObject* pAttachObj = gObjectList.findObject(rlvCmd.getObjectID());
if ( (pAttachObj) && (pAttachObj->isAttachment()) ) if ( (pAttachObj) && (pAttachObj->isAttachment()) )
{ {
LLVOAvatar::detachAttachmentIntoInventory(pAttachObj->getAttachmentItemID()); LLVOAvatarSelf::detachAttachmentIntoInventory(pAttachObj->getAttachmentItemID());
} }
} }
break; break;

View File

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

View File

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