From 8c7edbef183e284186da583c4c9b55fe2bc972d1 Mon Sep 17 00:00:00 2001 From: Anchor Date: Wed, 6 Sep 2017 03:24:58 -0700 Subject: 1024*1024 baking viewer updates --- indra/newview/character/avatar_lad.xml | 20 ++++++++++---------- indra/newview/lldynamictexture.cpp | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index 90f06746c9..ee620b39b8 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -8923,8 +8923,8 @@ + width="1024" + height="1024"> + width="1024" + height="1024"> + width="1024" + height="1024"> Date: Wed, 13 Sep 2017 21:27:26 -0700 Subject: cleanup the commented out code --- indra/newview/lldynamictexture.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 800c36f911..87b56f33af 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -125,9 +125,9 @@ BOOL LLViewerDynamicTexture::render() //----------------------------------------------------------------------------- void LLViewerDynamicTexture::preRender(BOOL clear_depth) { - //only images up to 512x512 are supported - //llassert(mFullHeight <= 512); - //llassert(mFullWidth <= 512); + //only images up to 1024*1024 are supported + llassert(mFullHeight <= 1024); + llassert(mFullWidth <= 1024); if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI) { //using offscreen render target, just use the bottom left corner -- cgit v1.2.3 From bfbcd6d16931819c43eea8e83963c9f86c6892dd Mon Sep 17 00:00:00 2001 From: Anchor Linden Date: Wed, 28 Feb 2018 22:14:38 -0800 Subject: [MAINT-8081] - bakes on mesh. 1st pass. changed texture panel to select bakes on objects. handle magic bake ids in LLViewerObject. --- indra/newview/character/avatar_lad.xml | 20 ++-- indra/newview/lldynamictexture.cpp | 4 +- indra/newview/lltexturectrl.cpp | 82 +++++++++++-- indra/newview/lltexturectrl.h | 3 + indra/newview/llviewerobject.cpp | 130 +++++++++++++++++++-- indra/newview/llviewerobject.h | 4 + indra/newview/llviewertexture.h | 5 + indra/newview/llviewertexturelist.cpp | 7 +- indra/newview/llvoavatar.cpp | 44 +++++++ indra/newview/llvoavatar.h | 1 + .../skins/default/xui/en/floater_texture_ctrl.xml | 72 +++++++++++- 11 files changed, 331 insertions(+), 41 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index ee620b39b8..90f06746c9 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -8923,8 +8923,8 @@ + width="512" + height="512"> + width="512" + height="512"> + width="512" + height="512"> setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1)); + getChild("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this); + getChild("hide_base_mesh_region")->setCommitCallback(onHideBaseMeshRegionCheck, this); + + return TRUE; } @@ -760,22 +764,25 @@ void LLFloaterTexturePicker::onSelectionChange(const std::dequemModeSelector->getSelectedIndex() == 0); + int mode = self->mModeSelector->getSelectedIndex(); - self->getChild("Default")->setVisible(mode); - self->getChild("Blank")->setVisible(mode); - self->getChild("None")->setVisible(mode); - self->getChild("Pipette")->setVisible(mode); - self->getChild("inventory search editor")->setVisible(mode); - self->getChild("inventory panel")->setVisible(mode); + self->getChild("Default")->setVisible(mode == 0); + self->getChild("Blank")->setVisible(mode == 0); + self->getChild("None")->setVisible(mode == 0); + self->getChild("Pipette")->setVisible(mode == 0); + self->getChild("inventory search editor")->setVisible(mode == 0); + self->getChild("inventory panel")->setVisible(mode == 0); /*self->getChild("show_folders_check")->setVisible(mode); no idea under which conditions the above is even shown, needs testing. */ - self->getChild("l_add_btn")->setVisible(!mode); - self->getChild("l_rem_btn")->setVisible(!mode); - self->getChild("l_upl_btn")->setVisible(!mode); - self->getChild("l_name_list")->setVisible(!mode); + self->getChild("l_add_btn")->setVisible(mode == 1); + self->getChild("l_rem_btn")->setVisible(mode == 1); + self->getChild("l_upl_btn")->setVisible(mode == 1); + self->getChild("l_name_list")->setVisible(mode == 1); + + self->getChild("l_bake_use_texture_combo_box")->setVisible(mode == 2); + self->getChild("hide_base_mesh_region")->setVisible(false);// mode == 2); } // static @@ -896,6 +903,59 @@ void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_da picker->commitIfImmediateSet(); } +//static +void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data) +{ + LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)user_data; + LLComboBox* combo_box = (LLComboBox*)ctrl; + + S8 type = combo_box->getValue().asInteger(); + + LLUUID imageID = LLUUID::null; + if (type == 0) + { + imageID = IMG_USE_BAKED_HEAD; + } + else if (type == 1) + { + imageID = IMG_USE_BAKED_UPPER; + } + else if (type == 2) + { + imageID = IMG_USE_BAKED_LOWER; + } + else if (type == 3) + { + imageID = IMG_USE_BAKED_EYES; + } + else if (type == 4) + { + imageID = IMG_USE_BAKED_SKIRT; + } + else if (type == 5) + { + imageID = IMG_USE_BAKED_HAIR; + } + + if (imageID.notNull()) + { + self->setCanApply(true, true); + self->setImageID(imageID); + self->commitIfImmediateSet(); + } + else + { + onBtnCancel(self); + } +} + +//static +void LLFloaterTexturePicker::onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *user_data) +{ + //LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data; + //LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; +} + void LLFloaterTexturePicker::updateFilterPermMask() { //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 840feddfaf..e70849e5c9 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -322,6 +322,9 @@ public: static void onBtnUpload(void* userdata); static void onLocalScrollCommit(LLUICtrl* ctrl, void* userdata); + static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata); + static void onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *userdata); + void setLocalTextureEnabled(BOOL enabled); protected: diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 5de4029542..1bc3b3c726 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4358,31 +4358,119 @@ void LLViewerObject::sendTEUpdate() const // TODO send media type + + const U32 MAX_TES = 32; + + LLUUID texture_id[MAX_TES]; + S32 last_face_index = llmin((U32)getNumTEs(), MAX_TES) - 1; + + if (last_face_index > -1) + { + S8 face_index; + for (face_index = 0; face_index <= last_face_index; face_index++) + { + LLTextureEntry* entry = getTE((U8)face_index); + texture_id[face_index] = entry->getID(); + + LLViewerFetchedTexture* fetched_texture = gTextureList.findImage(entry->getID(), TEX_LIST_STANDARD); + if (fetched_texture && fetched_texture->getFTType() == FTT_SERVER_BAKE) + { + const LLUUID new_id = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::localTextureIndexToMagicId((LLAvatarAppearanceDefines::ETextureIndex)fetched_texture->getBakedTextureIndex()); + entry->setID(new_id.notNull() ? new_id : IMG_DEFAULT_AVATAR); + } + } + } + packTEMessage(msg); + if (last_face_index > -1) + { + S8 face_index; + for (face_index = 0; face_index <= last_face_index; face_index++) + { + LLTextureEntry* entry = getTE((U8)face_index); + entry->setID(texture_id[face_index]); + } + } + LLViewerRegion *regionp = getRegion(); msg->sendReliable( regionp->getHost() ); } +LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) +{ + if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) + { + return NULL; + } + + LLVOAvatar* avatar = getAvatar(); + if (avatar) + { + LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); + return avatar->getBakedTextureImage(texIndex, avatar->getTE(texIndex)->getID()); + } + + return NULL; +} + +LLTextureEntry* LLViewerObject::getBakedTextureEntryForMagicId(const LLUUID& id) +{ + if (!LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) + { + return NULL; + } + + LLVOAvatar* avatar = getAvatar(); + if (avatar) + { + LLAvatarAppearanceDefines::ETextureIndex texIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::assetIdToBakedTextureIndex(id)); + return avatar->getTE(texIndex); + } + + return NULL; +} + void LLViewerObject::setTE(const U8 te, const LLTextureEntry &texture_entry) { - LLPrimitive::setTE(te, texture_entry); + const LLTextureEntry* baked_entry = getBakedTextureEntryForMagicId(texture_entry.getID()); + if (baked_entry) + { + LLPrimitive::setTE(te, *baked_entry); + + const LLUUID& image_id = baked_entry->getID(); + mTEImages[te] = getBakedTextureForMagicId(image_id); + } + else + { + LLPrimitive::setTE(te, texture_entry); const LLUUID& image_id = getTE(te)->getID(); mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - - if (getTE(te)->getMaterialParams().notNull()) - { - const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID(); - mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - - const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID(); - mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + + if (getTE(te)->getMaterialParams().notNull()) + { + const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID(); + mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + + const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID(); + mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + } } + } void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) { + if (imagep) + { + LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); + if (baked_texture) + { + imagep = baked_texture; + } + } + if (mTEImages[te] != imagep) { mTEImages[te] = imagep; @@ -4397,6 +4485,15 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) { + if (image) + { + LLViewerTexture* baked_texture = getBakedTextureForMagicId(image->getID()); + if (baked_texture) + { + image = baked_texture; + } + } + const LLUUID& uuid = image->getID(); S32 retval = 0; if (uuid != getTE(te)->getID() || @@ -4492,9 +4589,18 @@ void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image) S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) { // Invalid host == get from the agent's sim - LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( - uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); - return setTETextureCore(te,image); + + LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid); + if (baked_texture) + { + return setTETextureCore(te, baked_texture); + } + else + { + LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( + uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); + return setTETextureCore(te, image); + } } S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 7a490f6957..bac96991fa 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -566,6 +566,10 @@ public: friend class LLViewerObjectList; friend class LLViewerMediaList; +private: + LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id); + LLTextureEntry* getBakedTextureEntryForMagicId(const LLUUID& id); + public: static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name); static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name); diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index c9dea17f63..2bd2f83e93 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -417,6 +417,9 @@ public: void setInFastCacheList(bool in_list) { mInFastCacheList = in_list; } bool isInFastCacheList() { return mInFastCacheList; } + U8 getBakedTextureIndex() { return mBakedTextureIndex; } + void setBakedTextureIndex(U8 index) { mBakedTextureIndex = index; } + /*virtual*/bool isActiveFetching(); //is actively in fetching by the fetching pipeline. protected: @@ -519,6 +522,8 @@ protected: BOOL mForSculpt ; //a flag if the texture is used as sculpt data. BOOL mIsFetched ; //is loaded from remote or from cache, not generated locally. + U8 mBakedTextureIndex; //for FTT_SERVER_BAKE fetched textures + public: static LLPointer sMissingAssetImagep; // Texture to show for an image asset that is not in the database static LLPointer sWhiteImagep; // Texture to show NOTHING (whiteness) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index d7080051da..ce32bb186f 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -61,6 +61,8 @@ #include "llviewerdisplay.h" #include "llviewerwindow.h" #include "llprogressview.h" + +#include "llvoavatarself.h" //////////////////////////////////////////////////////////////////////////// void (*LLViewerTextureList::sUUIDCallback)(void **, const LLUUID&) = NULL; @@ -503,12 +505,15 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, // If the image is not found, creates new image and // enqueues a request for transmission + LLPointer imagep = NULL; + if (image_id.isNull()) { return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI)); } - LLPointer imagep = findImage(image_id, get_element_type(boost_priority)); + imagep = imagep.isNull() ? findImage(image_id, get_element_type(boost_priority)) : imagep; + if (!imagep.isNull()) { LLViewerFetchedTexture *texture = imagep.get(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index eae8f2cc56..af98f78d0d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2224,6 +2224,8 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU { result->setIsMissingAsset(false); } + + result->setBakedTextureIndex(te); } return result; } @@ -7413,6 +7415,9 @@ void LLVOAvatar::updateMeshTextures() removeMissingBakedTextures(); // May call back into this function if anything is removed call_remove_missing = true; } + + + } // virtual @@ -8189,6 +8194,45 @@ void LLVOAvatar::applyParsedAppearanceMessage(LLAppearanceMessageContents& conte } updateMeshTextures(); + + //refresh bakes on any attached objects + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + + const U32 MAX_TES = 32; + + S32 last_face_index = llmin((U32)attached_object->getNumTEs(), MAX_TES) - 1; + + if (last_face_index > -1) + { + S8 face_index; + for (face_index = 0; face_index <= last_face_index; face_index++) + { + LLViewerTexture* viewer_texture = attached_object->getTEImage((U8)face_index); + + if (viewer_texture && ( (viewer_texture->getType() == LLViewerTexture::FETCHED_TEXTURE) || (viewer_texture->getType() == LLViewerTexture::LOD_TEXTURE) )) + { + LLViewerFetchedTexture* fetched_texture = dynamic_cast(viewer_texture); + if (fetched_texture->getFTType() == FTT_SERVER_BAKE) + { + const LLUUID new_id = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::localTextureIndexToMagicId((LLAvatarAppearanceDefines::ETextureIndex)fetched_texture->getBakedTextureIndex()); + attached_object->setTETexture(face_index, new_id); + } + + } + } + } + } + } } // static diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index bd89d4ef23..4f876533ee 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -569,6 +569,7 @@ public: public: /*virtual*/ LLTexLayerSet* createTexLayerSet(); // Return LLViewerTexLayerSet void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY ! + protected: static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); static void onInitialBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); diff --git a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml index 53618b684b..9bce037cba 100644 --- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml +++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml @@ -52,7 +52,7 @@ control_name="mode_selection" height="20" layout="topleft" - left="18" + left="0" top_pad="80" name="mode_selection" follows="left|top"> @@ -64,7 +64,7 @@ height="16" left="0" value="0" - width="80" /> + width="70" /> + width="50" /> + @@ -83,7 +92,7 @@ follows="left|top" height="14" layout="topleft" - left_delta="-12" + left_delta="12" name="unknown" top_pad="4"> Size: [DIMENSIONS] @@ -225,7 +234,60 @@ - + + + + + + + + + + + + - - - Comment (optional): - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_facebook_place.xml b/indra/newview/skins/default/xui/en/panel_facebook_place.xml deleted file mode 100644 index f87b008c4e..0000000000 --- a/indra/newview/skins/default/xui/en/panel_facebook_place.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - Say something about where you are: - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_facebook_status.xml b/indra/newview/skins/default/xui/en/panel_facebook_status.xml deleted file mode 100644 index fe0f3c9279..0000000000 --- a/indra/newview/skins/default/xui/en/panel_facebook_status.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - Not connected to Facebook. - - - - - - - - [http://community.secondlife.com/t5/English-Knowledge-Base/Second-Life-Share-Facebook/ta-p/2149711 Learn about posting to Facebook] - - - - - What's on your mind? - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 8fc0f6f642..a47121ae99 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -367,24 +367,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M show_permissions_granted="true" top="0" width="307" /> - - - - + -