From 8b6be5c667230c61d0de590de122fdef956150b7 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 14 May 2013 08:25:42 -0700 Subject: NORSPEC-85 fix default normal vert offset --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c9029bfcb0..9d0b9d0cac 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1177,7 +1177,7 @@ void LLPanelFace::updateUI() { F32 get(LLViewerObject* object, S32 face) { - F32 s = 1.f, t = 1.f; + F32 s = 0.f, t = 0.f; LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); if (mat) @@ -1199,7 +1199,7 @@ void LLPanelFace::updateUI() { F32 get(LLViewerObject* object, S32 face) { - F32 s = 1.f, t = 1.f; + F32 s = 0.f, t = 0.f; LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); if (mat) -- cgit v1.2.3 From ad09e2111cd980117ae937b79155ef6c24e4567c Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Tue, 14 May 2013 21:14:46 +0200 Subject: NORSPEC-102 & Co Reloaded --- indra/llprimitive/lltextureentry.cpp | 21 ++++++++----- indra/newview/llmaterialmgr.cpp | 61 ------------------------------------ indra/newview/llmaterialmgr.h | 22 ------------- indra/newview/llselectmgr.cpp | 2 +- indra/newview/llviewerobject.cpp | 17 +++++----- indra/newview/llvovolume.cpp | 8 +++-- 6 files changed, 30 insertions(+), 101 deletions(-) diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index ca57f1edbd..597f078490 100755 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -539,21 +539,28 @@ S32 LLTextureEntry::setGlow(F32 glow) S32 LLTextureEntry::setMaterialID(const LLMaterialID& pMaterialID) { - if (mMaterialID != pMaterialID) + if ( (mMaterialID != pMaterialID) || (mMaterialUpdatePending && !mSelected) ) { - mMaterialID = pMaterialID; - - } - if (mMaterialID.isNull()) + if (mSelected) { - setMaterialParams(NULL); + mMaterialUpdatePending = true; + mMaterialID = pMaterialID; + return TEM_CHANGE_NONE; } + + mMaterialUpdatePending = false; + mMaterialID = pMaterialID; return TEM_CHANGE_TEXTURE; } + return TEM_CHANGE_NONE; +} S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams) { - + if (mSelected) + { + mMaterialUpdatePending = true; + } mMaterial = pMaterialParams; return TEM_CHANGE_TEXTURE; } diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 59e5d05736..f217ff160e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -217,51 +217,6 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } -boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) -{ - boost::signals2::connection connection; - - material_map_t::const_iterator itMaterial = mMaterials.find(material_id); - if (itMaterial != mMaterials.end()) - { - LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; - get_callback_te_t signal; - signal.connect(cb); - signal(material_id, itMaterial->second, te); - connection = boost::signals2::connection(); - } - else - { - if (!isGetPending(region_id, material_id)) - { - get_queue_t::iterator itQueue = mGetQueue.find(region_id); - if (mGetQueue.end() == itQueue) - { - LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); - itQueue = ret.first; - } - LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; - itQueue->second.insert(material_id); - markGetPending(region_id, material_id); - } - - TEMaterialPair te_mat_pair; - te_mat_pair.te = te; - te_mat_pair.materialID = material_id; - - get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair); - if (itCallback == mGetTECallbacks.end()) - { - std::pair ret = mGetTECallbacks.insert(std::pair(te_mat_pair, new get_callback_te_t())); - itCallback = ret.first; - } - connection = itCallback->second->connect(cb); - } - - return connection; -} - bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); @@ -346,22 +301,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } - TEMaterialPair te_mat_pair; - te_mat_pair.materialID = material_id; - - U32 i = 0; - while (i < LLTEContents::MAX_TES) - { - te_mat_pair.te = i++; - get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); - if (itCallbackTE != mGetTECallbacks.end()) - { - (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); - delete itCallbackTE->second; - mGetTECallbacks.erase(itCallbackTE); - } - } - return itMaterial->second; } diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 922b16f1cf..a6a7a5d1d7 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -44,11 +44,9 @@ public: typedef std::map material_map_t; typedef boost::signals2::signal get_callback_t; - typedef boost::signals2::signal get_callback_te_t; const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id); boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb); - boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb); typedef boost::signals2::signal getall_callback_t; void getAll(const LLUUID& region_id); @@ -82,26 +80,6 @@ protected: typedef std::map get_callback_map_t; get_callback_map_t mGetCallbacks; - // struct for TE-specific material ID query - struct TEMaterialPair - { - U32 te; - LLMaterialID materialID; - }; - - // needed for std::map compliance only - // - friend inline bool operator<( - const struct LLMaterialMgr::TEMaterialPair& lhs, - const struct LLMaterialMgr::TEMaterialPair& rhs) - { - return (lhs.materialID < rhs.materialID) ? TRUE : - (lhs.te < rhs.te) ? TRUE : FALSE; - } - - typedef std::map get_callback_te_map_t; - get_callback_te_map_t mGetTECallbacks; - typedef std::set getall_queue_t; getall_queue_t mGetAllQueue; getall_queue_t mGetAllRequested; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 3f60b5f642..e80ad6976e 100755 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2052,7 +2052,7 @@ void LLSelectMgr::selectionRemoveMaterial() { LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; LLMaterialMgr::getInstance()->remove(object->getID(),face); - object->setTEMaterialID(face,LLMaterialID::null); + object->setTEMaterialParams(face, NULL); } return true; } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f8bc6ef4d3..4e233d479a 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4393,15 +4393,18 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID << ", material " << pMaterialID << LL_ENDL; retval = LLPrimitive::setTEMaterialID(te, pMaterialID); - } - // Kitty would like to know if this is necessary? - // Since we should get a setTEMaterialParams that does it anyway? - // - setChanged(TEXTURE); - if (mDrawable.notNull()) + if (retval) { - gPipeline.markTextured(mDrawable); + // Kitty would like to know if this is necessary? + // Since we should get a setTEMaterialParams that does it anyway? + // + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } } + } return retval; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 1021615255..8e811527eb 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1991,15 +1991,17 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) << LL_ENDL; LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; - // Use TE-specific version of boost CB hook-up to avoid cross-contaminatin' - LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3)); + if (res) + { + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te)); setChanged(TEXTURE); if (!mDrawable.isNull()) { gPipeline.markTextured(mDrawable); } mFaceMappingChanged = TRUE; - return TEM_CHANGE_TEXTURE; + } + return res; } S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) -- cgit v1.2.3 From a37bff8bf1add5afe154b25156d7ebe38ff9af31 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 14 May 2013 15:26:43 -0700 Subject: NORSPEC-103 reflect normal/spec UVs in face edit overlay display --- indra/newview/llface.cpp | 4 +- indra/newview/llpanelface.cpp | 19 ++++++++- indra/newview/llselectmgr.cpp | 77 ++++++++++++++++++++++++++++----- indra/newview/llselectmgr.h | 8 +++- indra/newview/llviewershadermgr.cpp | 25 +++++++++++ indra/newview/llviewershadermgr.h | 3 ++ indra/newview/pipeline.cpp | 85 ++++++++++++++++++++++++++++++++++--- indra/newview/pipeline.h | 7 +++ 8 files changed, 207 insertions(+), 21 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 007ad1f8d9..eb78d42c35 100755 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -582,7 +582,9 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) } else { - mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); + // cheaters sometimes prosper... + // + mVertexBuffer->setBuffer(mVertexBuffer->getTypeMask()); mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); } diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9d0b9d0cac..f8c05bd007 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1646,6 +1646,18 @@ void LLPanelFace::updateUI() getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); } + // Update sel manager as to which channel we're editing so it can reflect the correct overlay UI + // NORSPEC-103 + LLRender::eTexIndex channel_to_edit = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? (LLRender::eTexIndex)combobox_mattype->getCurrentIndex() : LLRender::DIFFUSE_MAP; + + if ( ((channel_to_edit == LLRender::NORMAL_MAP) && material->getNormalID().isNull()) + ||((channel_to_edit == LLRender::SPECULAR_MAP) && material->getSpecularID().isNull())) + { + channel_to_edit = LLRender::DIFFUSE_MAP; + } + + LLSelectMgr::getInstance()->setTextureChannel(channel_to_edit); + // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); @@ -1670,7 +1682,10 @@ void LLPanelFace::updateUI() } updateBumpyControls(!material->getNormalID().isNull(), true); } - + else + { + LLSelectMgr::getInstance()->setTextureChannel(LLRender::DIFFUSE_MAP); + } } // Set variable values for numeric expressions @@ -1856,7 +1871,7 @@ void LLPanelFace::updateMaterial() } LL_DEBUGS("Materials") << "Updating material: " << material->asLLSD() << LL_ENDL; - + LLSelectMgr::getInstance()->selectionSetMaterial( material ); } else diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 3f60b5f642..7c9c935a1b 100755 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -188,6 +188,7 @@ LLSelectMgr::LLSelectMgr() mDebugSelectMgr(LLCachedControl(gSavedSettings, "DebugSelectMgr", FALSE)) { mTEMode = FALSE; + mTextureChannel = LLRender::DIFFUSE_MAP; mLastCameraPos.clearVec(); sHighlightThickness = gSavedSettings.getF32("SelectionHighlightThickness"); @@ -236,6 +237,8 @@ void LLSelectMgr::clearSelections() mHighlightedObjects->deleteAllNodes(); mRectSelectedObjects.clear(); mGridObjects.deleteAllNodes(); + + LLPipeline::setRenderHighlightTextureChannel(LLRender::DIFFUSE_MAP); } void LLSelectMgr::update() @@ -844,6 +847,10 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab // check to see if object is already in list LLSelectNode *nodep = mSelectedObjects->findNode(objectp); + // Reset (in anticipation of being set to an appropriate value by panel refresh, if they're up) + // + setTextureChannel(LLRender::DIFFUSE_MAP); + // if not in list, add it if (!nodep) { @@ -4467,7 +4474,8 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type) struct f : public LLSelectedNodeFunctor { EActionType mActionType; - f(EActionType a) : mActionType(a) {} + LLSelectMgr* mManager; + f(EActionType a, LLSelectMgr* p) : mActionType(a), mManager(p) {} virtual bool apply(LLSelectNode* selectNode) { LLViewerObject* object = selectNode->getObject(); @@ -4514,10 +4522,10 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type) } selectNode->mSavedScale = object->getScale(); - selectNode->saveTextureScaleRatios(); + selectNode->saveTextureScaleRatios(mManager->mTextureChannel); return true; } - } func(action_type); + } func(action_type, this); getSelection()->applyToNodes(&func); mSavedSelectionBBox = getBBoxOfSelection(); @@ -5828,23 +5836,72 @@ void LLSelectNode::saveTextures(const uuid_vec_t& textures) } } -void LLSelectNode::saveTextureScaleRatios() +void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) { mTextureScaleRatios.clear(); if (mObject.notNull()) { + + LLVector3 scale = mObject->getScale(); + for (U8 i = 0; i < mObject->getNumTEs(); i++) { - F32 s,t; + F32 s = 1.0f; + F32 t = 1.0f; + + LLVector3 v; + const LLTextureEntry* tep = mObject->getTE(i); - tep->getScale(&s,&t); - U32 s_axis = 0; - U32 t_axis = 0; + if (!tep) + continue; + + LLMaterialPtr mat = tep->getMaterialParams(); + U32 s_axis = VX; + U32 t_axis = VY; LLPrimitive::getTESTAxes(i, &s_axis, &t_axis); - LLVector3 v; - LLVector3 scale = mObject->getScale(); + switch(index_to_query) + { + case LLRender::DIFFUSE_MAP: + { + tep->getScale(&s,&t); + } + break; + + case LLRender::NORMAL_MAP: + { + if (mat) + { + mat->getNormalRepeat(s, t); + } + else + { + tep->getScale(&s,&t); + } + + } + break; + + case LLRender::SPECULAR_MAP: + { + if (mat) + { + mat->getSpecularRepeat(s, t); + } + else + { + tep->getScale(&s,&t); + } + } + break; + + default: + // should never be. + // + llassert_always(false); + break; + } if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR) { diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 1991b5581b..f9b97cebdd 100755 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -147,7 +147,7 @@ public: // *NOTE: invalidate stored textures and colors when # faces change void saveColors(); void saveTextures(const uuid_vec_t& textures); - void saveTextureScaleRatios(); + void saveTextureScaleRatios(LLRender::eTexIndex index_to_query); BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const; @@ -514,6 +514,11 @@ public: void saveSelectedObjectColors(); void saveSelectedObjectTextures(); + // Sets which texture channel to query for scale and rot of display + // and depends on UI state of LLPanelFace when editing + void setTextureChannel(LLRender::eTexIndex texIndex) { mTextureChannel = texIndex; } + LLRender::eTexIndex getTextureChannel() { return mTextureChannel; } + void selectionUpdatePhysics(BOOL use_physics); void selectionUpdateTemporary(BOOL is_temporary); void selectionUpdatePhantom(BOOL is_ghost); @@ -777,6 +782,7 @@ private: EGridMode mGridMode; BOOL mTEMode; // render te + LLRender::eTexIndex mTextureChannel; // diff, norm, or spec, depending on UI editing mode LLVector3d mSelectionCenterGlobal; LLBBox mSelectionBBox; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index fce06b9e13..022ddb69ce 100755 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -143,6 +143,9 @@ LLGLSLShader gUnderWaterProgram; //interface shaders LLGLSLShader gHighlightProgram; +LLGLSLShader gHighlightNormalProgram; +LLGLSLShader gHighlightSpecularProgram; + LLGLSLShader gPathfindingProgram; LLGLSLShader gPathfindingNoNormalsProgram; @@ -752,6 +755,8 @@ void LLViewerShaderMgr::unloadShaders() gAvatarEyeballProgram.unload(); gAvatarPickProgram.unload(); gHighlightProgram.unload(); + gHighlightNormalProgram.unload(); + gHighlightSpecularProgram.unload(); gWLSkyProgram.unload(); gWLCloudProgram.unload(); @@ -2703,6 +2708,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface() success = gHighlightProgram.createShader(NULL, NULL); } + if (success) + { + gHighlightNormalProgram.mName = "Highlight Normals Shader"; + gHighlightNormalProgram.mShaderFiles.clear(); + gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightNormV.glsl", GL_VERTEX_SHADER_ARB)); + gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gHighlightNormalProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gHighlightNormalProgram.createShader(NULL, NULL); + } + + if (success) + { + gHighlightSpecularProgram.mName = "Highlight Spec Shader"; + gHighlightSpecularProgram.mShaderFiles.clear(); + gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightSpecV.glsl", GL_VERTEX_SHADER_ARB)); + gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gHighlightSpecularProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gHighlightSpecularProgram.createShader(NULL, NULL); + } + if (success) { gUIProgram.mName = "UI Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 5ef5d2234c..a24427a7bb 100755 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -301,6 +301,9 @@ extern LLGLSLShader gGlowExtractProgram; //interface shaders extern LLGLSLShader gHighlightProgram; +extern LLGLSLShader gHighlightNormalProgram; +extern LLGLSLShader gHighlightSpecularProgram; + extern LLGLSLShader gPathfindingProgram; extern LLGLSLShader gPathfindingNoNormalsProgram; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f4b445c2eb..bcbd752550 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -354,6 +354,7 @@ BOOL LLPipeline::sRenderParticleBeacons = FALSE; BOOL LLPipeline::sRenderSoundBeacons = FALSE; BOOL LLPipeline::sRenderBeacons = FALSE; BOOL LLPipeline::sRenderHighlight = TRUE; +LLRender::eTexIndex LLPipeline::sRenderHighlightTextureChannel = LLRender::DIFFUSE_MAP; BOOL LLPipeline::sForceOldBakedUpload = FALSE; S32 LLPipeline::sUseOcclusion = 0; BOOL LLPipeline::sDelayVBUpdate = TRUE; @@ -3843,7 +3844,9 @@ void LLPipeline::postSort(LLCamera& camera) if (!sShadowRender) { mSelectedFaces.clear(); - + + LLPipeline::setRenderHighlightTextureChannel(LLSelectMgr::getInstance()->getTextureChannel()); + // Draw face highlights for selected faces. if (LLSelectMgr::getInstance()->getTEMode()) { @@ -4066,13 +4069,14 @@ void LLPipeline::renderHighlights() gGL.diffuseColor4f(1,1,1,0.5f); } - if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) + if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && !mFaceSelectImagep) + { + mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT); + } + + if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::DIFFUSE_MAP)) { // Make sure the selection image gets downloaded and decoded - if (!mFaceSelectImagep) - { - mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT); - } mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); U32 count = mSelectedFaces.size(); @@ -4088,7 +4092,7 @@ void LLPipeline::renderHighlights() facep->renderSelected(mFaceSelectImagep, color); } } - + if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) { // Paint 'em red! @@ -4110,6 +4114,67 @@ void LLPipeline::renderHighlights() { gHighlightProgram.unbind(); } + + + if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::NORMAL_MAP)) + { + color.setVec(1.0f, 0.5f, 0.5f, 0.5f); + if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) + { + gHighlightNormalProgram.bind(); + gGL.diffuseColor4f(1,1,1,0.5f); + } + + mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); + + U32 count = mSelectedFaces.size(); + for (U32 i = 0; i < count; i++) + { + LLFace *facep = mSelectedFaces[i]; + if (!facep || facep->getDrawable()->isDead()) + { + llerrs << "Bad face on selection" << llendl; + return; + } + + facep->renderSelected(mFaceSelectImagep, color); + } + + if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) + { + gHighlightNormalProgram.unbind(); + } + } + + if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::SPECULAR_MAP)) + { + color.setVec(0.0f, 0.3f, 1.0f, 0.8f); + if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) + { + gHighlightSpecularProgram.bind(); + gGL.diffuseColor4f(1,1,1,0.5f); + } + + mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA); + + U32 count = mSelectedFaces.size(); + for (U32 i = 0; i < count; i++) + { + LLFace *facep = mSelectedFaces[i]; + if (!facep || facep->getDrawable()->isDead()) + { + llerrs << "Bad face on selection" << llendl; + return; + } + + facep->renderSelected(mFaceSelectImagep, color); + } + + if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) + { + gHighlightSpecularProgram.unbind(); + } + } } //debug use @@ -6727,6 +6792,12 @@ BOOL LLPipeline::getRenderHighlights(void*) return sRenderHighlight; } +// static +void LLPipeline::setRenderHighlightTextureChannel(LLRender::eTexIndex channel) +{ + sRenderHighlightTextureChannel = channel; +} + LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, const LLVector3& end, BOOL pick_transparent, S32* face_hit, diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 9b7d1d642c..4aee8f14d6 100755 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -394,6 +394,7 @@ public: static void setRenderHighlights(BOOL val); static void toggleRenderHighlights(void* data); static BOOL getRenderHighlights(void* data); + static void setRenderHighlightTextureChannel(LLRender::eTexIndex channel); // sets which UV setup to display in highlight overlay static void updateRenderBump(); static void updateRenderDeferred(); @@ -401,6 +402,8 @@ public: static void throttleNewMemoryAllocation(BOOL disable); + + void addDebugBlip(const LLVector3& position, const LLColor4& color); void hidePermanentObjects( std::vector& restoreList ); @@ -847,6 +850,10 @@ public: static BOOL sRenderBeacons; static BOOL sRenderHighlight; + // Determines which set of UVs to use in highlight display + // + static LLRender::eTexIndex sRenderHighlightTextureChannel; + //debug use static U32 sCurRenderPoolType ; -- cgit v1.2.3 From 1d5a85366928d4765f33406e58f66c294ea285cd Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 14 May 2013 16:12:53 -0700 Subject: NORSPEC-103 added new shaders for using norm/spec TCs in overlay --- .../shaders/class1/interface/highlightNormV.glsl | 42 ++++++++++++++++++++++ .../shaders/class1/interface/highlightSpecV.glsl | 42 ++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl create mode 100644 indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl new file mode 100644 index 0000000000..947c2b0065 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/highlightNormV.glsl @@ -0,0 +1,42 @@ +/** + * @file highlightV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; +ATTRIBUTE vec2 texcoord2; + +VARYING vec2 vary_texcoord0; + +void main() +{ + //transform vertex + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord1,0,1)).xy; +} + diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl new file mode 100644 index 0000000000..c5d102b739 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/interface/highlightSpecV.glsl @@ -0,0 +1,42 @@ +/** + * @file highlightV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; +ATTRIBUTE vec2 texcoord2; + +VARYING vec2 vary_texcoord0; + +void main() +{ + //transform vertex + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord2,0,1)).xy; +} + -- cgit v1.2.3 From 3c594c5d572a3aa998732c8a98fd0f8f5a4f4bcc Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 15 May 2013 10:38:10 -0700 Subject: NORSPEC-183 fix regression in diff map blank texture from NSPEC 152 fix by forcing new BlankImageID to the old default --- indra/newview/lltexturectrl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 5be342e3d0..9badba4143 100755 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -165,7 +165,6 @@ protected: LLUUID mImageAssetID; // Currently selected texture LLUIImagePtr mFallbackImage; // What to show if currently selected texture is null. - LLUUID mWhiteImageAssetID; LLUUID mSpecialCurrentImageAssetID; // Used when the asset id has no corresponding texture in the user's inventory. LLUUID mOriginalImageAssetID; @@ -208,8 +207,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( : LLFloater(LLSD()), mOwner( owner ), mImageAssetID( owner->getImageAssetID() ), - mFallbackImage( fallback_image ), - mWhiteImageAssetID( gSavedSettings.getString( "UIImgWhiteUUID" ) ), + mFallbackImage( fallback_image ), mOriginalImageAssetID(owner->getImageAssetID()), mLabel(label), mTentativeLabel(NULL), @@ -1056,6 +1054,12 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) mDefaultImageName(p.default_image_name), mFallbackImage(p.fallback_image) { + + // Default of defaults is white image for diff tex + // + LLUUID whiteImage( gSavedSettings.getString( "UIImgWhiteUUID" ) ); + setBlankImageAssetID( whiteImage ); + setAllowNoTexture(p.allow_no_texture); setCanApplyImmediately(p.can_apply_immediately); mCommitOnSelection = !p.no_commit_on_selection; -- cgit v1.2.3 From 20fc4bf1867b5165ebc140bd5f7a557874689681 Mon Sep 17 00:00:00 2001 From: callum_linden Date: Wed, 15 May 2013 12:55:01 -0700 Subject: NORSPEC-132 Fix (again) Rotation degree has range -9999.00..9999.00 --- indra/newview/skins/default/xui/en/panel_tools_texture.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index 5be3ca9d9f..626115bd5d 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -644,8 +644,8 @@ layout="topleft" label_width="205" left="10" - max_val="180" - min_val="-180" + max_val="9999" + min_val="-9999" name="bumpyRot" width="265" /> @@ -707,8 +707,8 @@ layout="topleft" label_width="205" left="10" - max_val="180" - min_val="-180" + max_val="9999" + min_val="-9999" name="shinyRot" width="265" /> -- cgit v1.2.3 From f58b17cb29ec85ef15465e3ede27cae9ae3b203f Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 15 May 2013 15:03:39 -0700 Subject: NORSPEC-152 better default norm/spec textures which read better in the UI and provide better default spec feedback --- indra/newview/app_settings/settings.xml | 15 ++------------- indra/newview/llpanelface.cpp | 1 - 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b82da4c5ab..e9b36ee5b1 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2872,17 +2872,6 @@ String Value 5b53359e-59dd-d8a2-04c3-9e65134da47a - - DefaultBlankSpecularTexture - - Comment - Texture used as 'Blank' in texture picker for specular maps. (UUID texture reference) - Persist - 1 - Type - String - Value - cd35472f-71fa-9b9c-8e73-a2c324f5751a DefaultFemaleAvatar @@ -2915,7 +2904,7 @@ Type String Value - 2d9dd1d8-9d57-3cfb-f965-f7613e702d8e + 85f28839-7a1c-b4e3-d71d-967792970a7b DefaultObjectSpecularTexture @@ -2926,7 +2915,7 @@ Type String Value - e0491381-964c-0d68-1caa-91ab2f4c6d6a + 87e0e8f7-8729-1ea8-cfc9-8915773009db DefaultObjectTexture diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f8c05bd007..302a4294e4 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -158,7 +158,6 @@ BOOL LLPanelFace::postBuild() if(mShinyTextureCtrl) { mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectSpecularTexture" ))); - mShinyTextureCtrl->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankSpecularTexture" ))); mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); -- cgit v1.2.3 From 666896ac4efa0575c82cd58c9fe041f354ccbbfc Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 15 May 2013 17:00:13 -0700 Subject: NORSPEC-119 put back TE-specific get registration in material manager stomped during 'reloading'. --- indra/newview/llmaterialmgr.cpp | 61 +++++++++++++++++++++++++++++++++++++++++ indra/newview/llmaterialmgr.h | 22 +++++++++++++++ indra/newview/llvovolume.cpp | 2 +- 3 files changed, 84 insertions(+), 1 deletion(-) diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index f217ff160e..59e5d05736 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -217,6 +217,51 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } +boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) +{ + boost::signals2::connection connection; + + material_map_t::const_iterator itMaterial = mMaterials.find(material_id); + if (itMaterial != mMaterials.end()) + { + LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; + get_callback_te_t signal; + signal.connect(cb); + signal(material_id, itMaterial->second, te); + connection = boost::signals2::connection(); + } + else + { + if (!isGetPending(region_id, material_id)) + { + get_queue_t::iterator itQueue = mGetQueue.find(region_id); + if (mGetQueue.end() == itQueue) + { + LL_DEBUGS("Materials") << "mGetQueue inserting region "< ret = mGetQueue.insert(std::pair(region_id, material_queue_t())); + itQueue = ret.first; + } + LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; + itQueue->second.insert(material_id); + markGetPending(region_id, material_id); + } + + TEMaterialPair te_mat_pair; + te_mat_pair.te = te; + te_mat_pair.materialID = material_id; + + get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair); + if (itCallback == mGetTECallbacks.end()) + { + std::pair ret = mGetTECallbacks.insert(std::pair(te_mat_pair, new get_callback_te_t())); + itCallback = ret.first; + } + connection = itCallback->second->connect(cb); + } + + return connection; +} + bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); @@ -301,6 +346,22 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } + TEMaterialPair te_mat_pair; + te_mat_pair.materialID = material_id; + + U32 i = 0; + while (i < LLTEContents::MAX_TES) + { + te_mat_pair.te = i++; + get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); + if (itCallbackTE != mGetTECallbacks.end()) + { + (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); + delete itCallbackTE->second; + mGetTECallbacks.erase(itCallbackTE); + } + } + return itMaterial->second; } diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index a6a7a5d1d7..b5ba8ab680 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -44,9 +44,11 @@ public: typedef std::map material_map_t; typedef boost::signals2::signal get_callback_t; + typedef boost::signals2::signal get_callback_te_t; const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id); boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb); + boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb); typedef boost::signals2::signal getall_callback_t; void getAll(const LLUUID& region_id); @@ -80,6 +82,26 @@ protected: typedef std::map get_callback_map_t; get_callback_map_t mGetCallbacks; + // struct for TE-specific material ID query + struct TEMaterialPair + { + U32 te; + LLMaterialID materialID; + }; + + // needed for std::map compliance only + // + friend inline bool operator<( + const struct LLMaterialMgr::TEMaterialPair& lhs, + const struct LLMaterialMgr::TEMaterialPair& rhs) + { + return (lhs.materialID < rhs.materialID) ? TRUE : + (lhs.te < rhs.te) ? TRUE : FALSE; + } + + typedef std::map get_callback_te_map_t; + get_callback_te_map_t mGetTECallbacks; + typedef std::set getall_queue_t; getall_queue_t mGetAllQueue; getall_queue_t mGetAllRequested; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 694ad82914..a9b540507f 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1993,7 +1993,7 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; if (res) { - LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te)); + LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3)); setChanged(TEXTURE); if (!mDrawable.isNull()) { -- cgit v1.2.3