summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2013-09-19 13:59:20 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2013-09-19 13:59:20 -0400
commitd58e7cfbfcec163345e87c0c5e5f74d01075246b (patch)
tree2b627c02aa822cd46be0a2e87a4b8f9aedda63c4 /indra/newview/llagent.cpp
parent82f147367fb5e4ee4bbe53db01856ea375058825 (diff)
SH-3455 WIP - removing bake upload code
Diffstat (limited to 'indra/newview/llagent.cpp')
-rwxr-xr-xindra/newview/llagent.cpp268
1 files changed, 1 insertions, 267 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index fe608d657b..845ef6e9a5 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3613,83 +3613,6 @@ void LLAgent::processControlRelease(LLMessageSystem *msg, void **)
}
*/
-// SUNSHINE CLEANUP dead code?
-//static
-void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void **user_data)
-{
- gAgentQueryManager.mNumPendingQueries--;
- if (gAgentQueryManager.mNumPendingQueries == 0)
- {
- selfStopPhase("fetch_texture_cache_entries");
- }
-
- if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
- {
- llwarns << "No avatar for user in cached texture update!" << llendl;
- return;
- }
-
- if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance())
- {
- // ignore baked textures when in customize mode
- return;
- }
-
- S32 query_id;
- mesgsys->getS32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, query_id);
-
- S32 num_texture_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_WearableData);
-
-
- S32 num_results = 0;
- for (S32 texture_block = 0; texture_block < num_texture_blocks; texture_block++)
- {
- LLUUID texture_id;
- U8 texture_index;
-
- mesgsys->getUUIDFast(_PREHASH_WearableData, _PREHASH_TextureID, texture_id, texture_block);
- mesgsys->getU8Fast(_PREHASH_WearableData, _PREHASH_TextureIndex, texture_index, texture_block);
-
-
- if ((S32)texture_index < TEX_NUM_INDICES )
- {
- const LLAvatarAppearanceDictionary::TextureEntry *texture_entry = LLAvatarAppearanceDictionary::instance().getTexture((ETextureIndex)texture_index);
- if (texture_entry)
- {
- EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
-
- if (gAgentQueryManager.mActiveCacheQueries[baked_index] == query_id)
- {
- if (texture_id.notNull())
- {
- //llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
- gAgentAvatarp->setCachedBakedTexture((ETextureIndex)texture_index, texture_id);
- //gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
- gAgentQueryManager.mActiveCacheQueries[baked_index] = 0;
- num_results++;
- }
- else
- {
- // no cache of this bake. request upload.
- gAgentAvatarp->invalidateComposite(gAgentAvatarp->getLayerSet(baked_index));
- }
- }
- }
- }
- }
- llinfos << "Received cached texture response for " << num_results << " textures." << llendl;
- gAgentAvatarp->outputRezTiming("Fetched agent wearables textures from cache. Will now load them");
-
- gAgentAvatarp->updateMeshTextures();
-
- if (gAgentQueryManager.mNumPendingQueries == 0)
- {
- // RN: not sure why composites are disabled at this point
- gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
- gAgent.sendAgentSetAppearance();
- }
-}
-
BOOL LLAgent::anyControlGrabbed() const
{
for (U32 i = 0; i < TOTAL_CONTROLS; i++)
@@ -4260,196 +4183,6 @@ void LLAgent::requestLeaveGodMode()
sendReliableMessage();
}
-// For debugging, trace agent state at times appearance message are sent out.
-void LLAgent::dumpSentAppearance(const std::string& dump_prefix)
-{
- std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml");
-
- LLAPRFile outfile;
- std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename);
- outfile.open(fullpath, LL_APR_WB );
- apr_file_t* file = outfile.getFileHandle();
- if (!file)
- {
- return;
- }
- else
- {
- LL_DEBUGS("Avatar") << "dumping sent appearance message to " << fullpath << llendl;
- }
-
- LLVisualParam* appearance_version_param = gAgentAvatarp->getVisualParam(11000);
- if (appearance_version_param)
- {
- F32 value = appearance_version_param->getWeight();
- dump_visual_param(file, appearance_version_param, value);
- }
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin();
- iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end();
- ++iter)
- {
- const ETextureIndex index = iter->first;
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
- if (texture_dict->mIsBakedTexture)
- {
- LLTextureEntry* entry = gAgentAvatarp->getTE((U8) index);
- const LLUUID& uuid = entry->getID();
- apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", index, uuid.asString().c_str());
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-// sendAgentSetAppearance()
-//-----------------------------------------------------------------------------
-// SUNSHINE CLEANUP dead
-void LLAgent::sendAgentSetAppearance()
-{
- if (gAgentQueryManager.mNumPendingQueries > 0)
- {
- return;
- }
-
- if (!isAgentAvatarValid() || gAgentAvatarp->isEditingAppearance() || (getRegion() && getRegion()->getCentralBakeVersion())) return;
-
- // At this point we have a complete appearance to send and are in a non-baking region.
- // DRANO FIXME
- //gAgentAvatarp->setIsUsingServerBakes(FALSE);
- S32 sb_count, host_count, both_count, neither_count;
- gAgentAvatarp->bakedTextureOriginCounts(sb_count, host_count, both_count, neither_count);
- if (both_count != 0 || neither_count != 0)
- {
- llwarns << "bad bake texture state " << sb_count << "," << host_count << "," << both_count << "," << neither_count << llendl;
- }
- if (sb_count != 0 && host_count == 0)
- {
- gAgentAvatarp->setIsUsingServerBakes(true);
- }
- else if (sb_count == 0 && host_count != 0)
- {
- gAgentAvatarp->setIsUsingServerBakes(false);
- }
- else if (sb_count + host_count > 0)
- {
- llwarns << "unclear baked texture state, not sending appearance" << llendl;
- return;
- }
-
-
- LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << LL_ENDL;
- //dumpAvatarTEs( "sendAgentSetAppearance()" );
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_AgentSetAppearance);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, getID());
- msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
-
- // correct for the collision tolerance (to make it look like the
- // agent is actually walking on the ground/object)
- // NOTE -- when we start correcting all of the other Havok geometry
- // to compensate for the COLLISION_TOLERANCE ugliness we will have
- // to tweak this number again
- const LLVector3 body_size = gAgentAvatarp->mBodySize + gAgentAvatarp->mAvatarOffset;
- msg->addVector3Fast(_PREHASH_Size, body_size);
-
- LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Sent AgentSetAppearance with height: " << body_size.mV[VZ] << " base: " << gAgentAvatarp->mBodySize.mV[VZ] << " hover: " << gAgentAvatarp->mAvatarOffset.mV[VZ] << LL_ENDL;
-
- // To guard against out of order packets
- // Note: always start by sending 1. This resets the server's count. 0 on the server means "uninitialized"
- mAppearanceSerialNum++;
- msg->addU32Fast(_PREHASH_SerialNum, mAppearanceSerialNum );
-
- // is texture data current relative to wearables?
- // KLW - TAT this will probably need to check the local queue.
- BOOL textures_current = gAgentAvatarp->areTexturesCurrent();
-
- for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
- {
- const ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
-
- // if we're not wearing a skirt, we don't need the texture to be baked
- if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
- {
- continue;
- }
-
- // IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures
- if (!gAgentAvatarp->isTextureDefined(texture_index, 0))
- {
- LL_DEBUGS("Avatar") << "texture not current for baked " << (S32)baked_index << " local " << (S32)texture_index << llendl;
- textures_current = FALSE;
- break;
- }
- }
-
- // only update cache entries if we have all our baked textures
-
- // FIXME DRANO need additional check for not in appearance editing
- // mode, if still using local composites need to set using local
- // composites to false, and update mesh textures.
- if (textures_current)
- {
- bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage");
- std::string dump_prefix = gAgentAvatarp->getFullname() + "_sent_appearance";
- if (enable_verbose_dumps)
- {
- dumpSentAppearance(dump_prefix);
- }
- LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "TAT: Sending cached texture data" << LL_ENDL;
- for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
- {
- BOOL generate_valid_hash = TRUE;
- if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLAvatarAppearanceDefines::EBakedTextureIndex)baked_index))
- {
- generate_valid_hash = FALSE;
- LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Not caching baked texture upload for " << (U32)baked_index << " due to being uploaded at low resolution." << LL_ENDL;
- }
-
- const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash);
- if (hash.notNull())
- {
- ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
- msg->nextBlockFast(_PREHASH_WearableData);
- msg->addUUIDFast(_PREHASH_CacheID, hash);
- msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
- }
- }
- msg->nextBlockFast(_PREHASH_ObjectData);
- gAgentAvatarp->sendAppearanceMessage( gMessageSystem );
- }
- else
- {
- // If the textures aren't baked, send NULL for texture IDs
- // This means the baked texture IDs on the server will be untouched.
- // Once all textures are baked, another AvatarAppearance message will be sent to update the TEs
- msg->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addBinaryDataFast(_PREHASH_TextureEntry, NULL, 0);
- }
-
-
- S32 transmitted_params = 0;
- for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam();
- param;
- param = (LLViewerVisualParam*)gAgentAvatarp->getNextVisualParam())
- {
- if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ||
- param->getGroup() == VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE) // do not transmit params of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT
- {
- msg->nextBlockFast(_PREHASH_VisualParam );
-
- // We don't send the param ids. Instead, we assume that the receiver has the same params in the same sequence.
- const F32 param_value = param->getWeight();
- const U8 new_weight = F32_to_U8(param_value, param->getMinWeight(), param->getMaxWeight());
- msg->addU8Fast(_PREHASH_ParamValue, new_weight );
- transmitted_params++;
- }
- }
-
-// llinfos << "Avatar XML num VisualParams transmitted = " << transmitted_params << llendl;
- sendReliableMessage();
-}
-
void LLAgent::sendAgentDataUpdateRequest()
{
gMessageSystem->newMessageFast(_PREHASH_AgentDataUpdateRequest);
@@ -4601,6 +4334,7 @@ LLAgentQueryManager::LLAgentQueryManager() :
{
for (U32 i = 0; i < BAKED_NUM_INDICES; i++)
{
+ // SUNSHINE CLEANUP
mActiveCacheQueries[i] = 0;
}
}