From e4a0dda457039b1a04c74024d9fbcf02e071b13d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 28 Jun 2012 14:24:04 -0400 Subject: SH-3228 WIP - always respond to processAppearance for self, convert baked textures to checkerboards --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b5d173346e..4999f680df 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -370,7 +370,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, // Unpack texture entry data // - S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, block_num); + S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num); if (result & teDirtyBits) { updateTEData(); -- cgit v1.2.3 From 4a5ad357930f0bede4d84b9810978e9d0c5d268b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 20 Jul 2012 11:42:15 -0500 Subject: MAINT-570 Remove unused memory tracking system LLMemType --- indra/newview/llvovolume.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c46ccd8ad5..c2318f9cf4 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3941,7 +3941,6 @@ static LLFastTimer::DeclareTimer FTM_REGISTER_FACE("Register Face"); void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type) { LLFastTimer t(FTM_REGISTER_FACE); - LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); if (facep->getViewerObject()->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) { -- cgit v1.2.3 From 49879c254cfc58b34a003d34be102c3e51eb0037 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 25 Jul 2012 14:46:23 -0500 Subject: MAINT-615 Fix for texture animation freezing under certain situations. --- indra/newview/llvovolume.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c2318f9cf4..59166df9f6 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4867,11 +4867,19 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: facep->setTextureIndex(cur_tex); texture_list.push_back(tex); - //if (can_batch_texture(facep)) - { + if (can_batch_texture(facep)) + { //populate texture_list with any textures that can be batched + //move i to the next unbatchable face while (i != faces.end()) { facep = *i; + + if (!can_batch_texture(facep)) + { //face is bump mapped or has an animated texture matrix -- can't + //batch more than 1 texture at a time + break; + } + if (facep->getTexture() != tex) { if (distance_sort) @@ -4897,12 +4905,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: cur_tex++; } - if (!can_batch_texture(facep)) - { //face is bump mapped or has an animated texture matrix -- can't - //batch more than 1 texture at a time - break; - } - if (cur_tex >= texture_index_channels) { //cut batches when index channels are depleted break; -- cgit v1.2.3 From 1f6e20c5bbfd4495e6493facd2363fd133fe7fcd Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 4 Sep 2012 17:43:08 +0000 Subject: Split gl-specific LLViewerTexture implementation into llrender/LLGLViewerTexture --- indra/newview/llvovolume.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b43bdb69f8..7fab1cf9b7 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -747,7 +747,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) { F32 area = (F32) camera->getScreenPixelArea(); vsize = area; - imagep->setBoostLevel(LLViewerTexture::BOOST_HUD); + imagep->setBoostLevel(LLGLTexture::BOOST_HUD); face->setPixelArea(area); // treat as full screen face->setVirtualSize(vsize); } @@ -803,7 +803,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) if (mSculptTexture.notNull()) { mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), - (S32)LLViewerTexture::BOOST_SCULPTED)); + (S32)LLGLTexture::BOOST_SCULPTED)); mSculptTexture->setForSculpt() ; if(!mSculptTexture->isCachedRawImageReady()) @@ -1006,7 +1006,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo if (is404) { - setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", TRUE, LLViewerTexture::BOOST_UI)); + setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", TRUE, LLGLTexture::BOOST_UI)); //render prim proxy when mesh loading attempts give up volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE); @@ -1090,7 +1090,7 @@ void LLVOVolume::updateSculptTexture() LLUUID id = sculpt_params->getSculptTexture(); if (id.notNull()) { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } } else @@ -2698,7 +2698,7 @@ void LLVOVolume::updateSpotLightPriority() if (mLightTexture.notNull()) { mLightTexture->addTextureStats(mSpotLightPriority); - mLightTexture->setBoostLevel(LLViewerTexture::BOOST_CLOUDS); + mLightTexture->setBoostLevel(LLGLTexture::BOOST_CLOUDS); } } -- cgit v1.2.3 From 01563600b6db616914315a31b3fc901c999d0165 Mon Sep 17 00:00:00 2001 From: "simon@Simon-PC.lindenlab.com" Date: Mon, 1 Oct 2012 14:19:30 -0700 Subject: MAINT-1452 : Viewer floods the log file with hundreds of exactly the same lines. Reviewed by Kelly --- indra/newview/llvovolume.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 813fa72cc3..eb3bbb15bf 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1138,17 +1138,29 @@ void LLVOVolume::sculpt() S32 current_discard = getVolume()->getSculptLevel() ; if(current_discard < -2) { - llwarns << "WARNING!!: Current discard of sculpty at " << current_discard - << " is less than -2." << llendl; + static S32 low_sculpty_discard_warning_count = 100; + if (++low_sculpty_discard_warning_count >= 100) + { // Log first time, then every 100 afterwards otherwise this can flood the logs + llwarns << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID() + << " at " << current_discard + << " is less than -2." << llendl; + low_sculpty_discard_warning_count = 0; + } // corrupted volume... don't update the sculpty return; } else if (current_discard > MAX_DISCARD_LEVEL) { - llwarns << "WARNING!!: Current discard of sculpty at " << current_discard - << " is more than than allowed max of " << MAX_DISCARD_LEVEL << llendl; - + static S32 high_sculpty_discard_warning_count = 100; + if (++high_sculpty_discard_warning_count >= 100) + { // Log first time, then every 100 afterwards otherwise this can flood the logs + llwarns << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID() + << " at " << current_discard + << " is more than than allowed max of " << MAX_DISCARD_LEVEL << llendl; + high_sculpty_discard_warning_count = 0; + } + // corrupted volume... don't update the sculpty return; } -- cgit v1.2.3 From 38a565f71a54aaa66300a0ab593e366731aac769 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 9 Oct 2012 12:30:38 -0700 Subject: Initial pass at getting a list of viewer objects with non-null material IDs. --- indra/newview/llvovolume.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e99898a83c..fb53e5c677 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -36,6 +36,7 @@ #include "lldir.h" #include "llflexibleobject.h" #include "llfloatertools.h" +#include "llmaterialid.h" #include "llmaterialtable.h" #include "llprimitive.h" #include "llvolume.h" @@ -1960,6 +1961,17 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) return res; } +S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) +{ + S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); + if (res) + { + gPipeline.markTextured(mDrawable); + mFaceMappingChanged = TRUE; + } + return res; +} + S32 LLVOVolume::setTEScale(const U8 te, const F32 s, const F32 t) { S32 res = LLViewerObject::setTEScale(te, s, t); -- cgit v1.2.3 From 6c989a692d9b1efd0b76fae9776d8bbe876c2900 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 9 Oct 2012 18:27:42 -0500 Subject: MAINT-1138 Fix for crash when picking rigged attachments. --- indra/newview/llvovolume.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index eb3bbb15bf..51edba5916 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1484,7 +1484,7 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global) updateRadius(); mDrawable->movePartition(); - + return res; } @@ -3574,7 +3574,6 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (LLFloater::isVisible(gFloaterTools) && getAvatar()->isSelf()) { updateRiggedVolume(); - genBBoxes(FALSE); volume = mRiggedVolume; transform = false; } -- cgit v1.2.3 From b8f88a535c1441bd76482e5c42d99adcb5371ca6 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 12 Oct 2012 13:18:47 -0500 Subject: MAINT-1649 Fix for objects disappearing on region crossing. --- indra/newview/llvovolume.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 51edba5916..4f1c89a632 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4014,10 +4014,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, else { model_mat = &(drawable->getRegion()->mRenderMatrix); - if (model_mat->isIdentity()) - { - model_mat = NULL; - } } //drawable->getVObj()->setDebugText(llformat("%d", drawable->isState(LLDrawable::ANIMATED_CHILD))); -- cgit v1.2.3 From 0f753a530b914370c7c89c198ee335833ac3e6a1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 11 Jan 2013 11:36:11 -0500 Subject: SH-3639 WIP - cleaned up some diagnostics and added fault injection ability. Disabled inventory retries for now. --- indra/newview/llvovolume.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9078cce932..3831a13f41 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1146,9 +1146,10 @@ void LLVOVolume::sculpt() } else if (current_discard > MAX_DISCARD_LEVEL) { +#if 0 llwarns << "WARNING!!: Current discard of sculpty at " << current_discard << " is more than than allowed max of " << MAX_DISCARD_LEVEL << llendl; - +#endif // corrupted volume... don't update the sculpty return; } -- cgit v1.2.3 From 5f03e197f4cfb43de93dc42b16b54beafccd376a Mon Sep 17 00:00:00 2001 From: Geenz Date: Fri, 25 Jan 2013 17:54:38 -0500 Subject: Trying to set materials up for rendering! Yay! --- indra/newview/llvovolume.cpp | 64 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a37dea4a60..c90ca48b01 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -77,6 +77,7 @@ #include "llviewershadermgr.h" #include "llvoavatar.h" #include "llvocache.h" +#include "llmaterialmgr.h" const S32 MIN_QUIET_FRAMES_COALESCE = 30; const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; @@ -919,6 +920,12 @@ LLFace* LLVOVolume::addFace(S32 f) { const LLTextureEntry* te = getTE(f); LLViewerTexture* imagep = getTEImage(f); + if (te->getMaterialParams() != NULL) + { + LLViewerTexture* normalp = getTENormalMap(f); + LLViewerTexture* specularp = getTESpecularMap(f); + return mDrawable->addFace(te, imagep, normalp, specularp); + } return mDrawable->addFace(te, imagep); } @@ -1404,6 +1411,11 @@ void LLVOVolume::regenFaces() facep->setTEOffset(i); facep->setTexture(getTEImage(i)); + if (facep->getTextureEntry()->getMaterialParams() != NULL) + { + facep->setNormalMap(getTENormalMap(i)); + facep->setSpecularMap(getTESpecularMap(i)); + } facep->setViewerObject(this); // If the face had media on it, this will have broken the link between the LLViewerMediaTexture and the face. @@ -1979,13 +1991,33 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { - S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); + if (!pMaterialID.isNull()) + { + LL_INFOS("Materials") << "Oh god it's a material! " << pMaterialID.asString() << LL_ENDL; + S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); + if (res) + { + LL_INFOS("Materials") << "We have a material!" << LL_ENDL; + LLMaterialPtr pMatParam = LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID); + setTEMaterialParams(te, pMatParam); + gPipeline.markTextured(mDrawable); + mFaceMappingChanged = TRUE; + } + return res; + } + return 0; +} + +S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) +{ + S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); if (res) { gPipeline.markTextured(mDrawable); mFaceMappingChanged = TRUE; } - return res; + + return res; } S32 LLVOVolume::setTEScale(const U8 te, const F32 s, const F32 t) @@ -4050,6 +4082,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLViewerTexture* tex = facep->getTexture(); U8 index = facep->getTextureIndex(); + + LLMaterialID matid = facep->getTextureEntry()->getMaterialID(); bool batchable = false; @@ -4106,12 +4140,30 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 offset = facep->getIndicesStart(); U32 count = facep->getIndicesCount(); LLPointer draw_info = new LLDrawInfo(start,end,count,offset, tex, - facep->getVertexBuffer(), fullbright, bump); + facep->getVertexBuffer(), fullbright, bump); draw_info->mGroup = group; draw_info->mVSize = facep->getVirtualSize(); draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; + + if (!facep->getTextureEntry()->getMaterialID().isNull() && facep->getTextureEntry()->getMaterialParams() != NULL) + { + // We have a material. Update our draw info accordingly. + //draw_info->mMaterialID = facep->getTextureEntry()->getMaterialID(); + LLVector4 specColor; + specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.0 / 255); + specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.0 / 255); + specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.0 / 255); + specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.0 / 255); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.0 / 255); + draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.0 / 255); + draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); + draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTextureIndex()); + draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTextureIndex()); + } + if (type == LLRenderPass::PASS_ALPHA) { //for alpha sorting facep->setDrawInfo(draw_info); @@ -4267,7 +4319,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } if (vobj->isMesh() && - (vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded() || !gMeshRepo.meshRezEnabled())) + ((vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded()) || !gMeshRepo.meshRezEnabled())) { continue; } @@ -5134,7 +5186,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: registerFace(group, facep, LLRenderPass::PASS_POST_BUMP); } } - else if (te->getBumpmap()) + else if (te->getBumpmap() || te->getMaterialParams() != NULL) { //register in deferred bump pass registerFace(group, facep, LLRenderPass::PASS_BUMP); } @@ -5169,7 +5221,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else { - if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && te->getBumpmap()) + if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() || te->getMaterialParams() != NULL)) { //non-shiny or fullbright deferred bump registerFace(group, facep, LLRenderPass::PASS_BUMP); } -- cgit v1.2.3 From 66a01ba4c581d79227b0e67f5f75dc248fcaf7ab Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 28 Jan 2013 19:56:18 -0500 Subject: Basic normal mapping support. --- indra/newview/llvovolume.cpp | 56 ++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c90ca48b01..8cf22d9808 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1989,6 +1989,18 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) return res; } +void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams) +{ + for (U8 i = 0; i < getNumTEs(); i++) + { + if (getTE(i)->getMaterialID() == pMaterialID) + { + LL_INFOS("Materials") << "Material params callback triggered!" << LL_ENDL; + setTEMaterialParams(i, pMaterialParams); + } + } +} + S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { if (!pMaterialID.isNull()) @@ -1998,8 +2010,8 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) if (res) { LL_INFOS("Materials") << "We have a material!" << LL_ENDL; - LLMaterialPtr pMatParam = LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID); - setTEMaterialParams(te, pMatParam); + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); + //setTEMaterialParams(te, pMatParam); gPipeline.markTextured(mDrawable); mFaceMappingChanged = TRUE; } @@ -4083,7 +4095,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); - LLMaterialID matid = facep->getTextureEntry()->getMaterialID(); + const LLMaterialID* matid = &facep->getTextureEntry()->getMaterialID(); bool batchable = false; @@ -4118,7 +4130,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mFullbright == fullbright && draw_vec[idx]->mBump == bump && draw_vec[idx]->mTextureMatrix == tex_mat && - draw_vec[idx]->mModelMatrix == model_mat) + draw_vec[idx]->mModelMatrix == model_mat && + draw_vec[idx]->mMaterialID == matid) { draw_vec[idx]->mCount += facep->getIndicesCount(); draw_vec[idx]->mEnd += facep->getGeomCount(); @@ -4146,22 +4159,25 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - - if (!facep->getTextureEntry()->getMaterialID().isNull() && facep->getTextureEntry()->getMaterialParams() != NULL) - { - // We have a material. Update our draw info accordingly. - //draw_info->mMaterialID = facep->getTextureEntry()->getMaterialID(); - LLVector4 specColor; - specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.0 / 255); - specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.0 / 255); - specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.0 / 255); - specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.0 / 255); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.0 / 255); - draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.0 / 255); - draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); - draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTextureIndex()); - draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTextureIndex()); + if (!facep->getTextureEntry()->getMaterialID().isNull()) + { + + if (facep->getTextureEntry()->getMaterialParams() != NULL) + { + // We have a material. Update our draw info accordingly. + draw_info->mMaterialID = &facep->getTextureEntry()->getMaterialID(); + LLVector4 specColor; + specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.0 / 255); + specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.0 / 255); + specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.0 / 255); + specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.0 / 255); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.0 / 255); + draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.0 / 255); + draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); + draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTextureIndex()); + draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTextureIndex()); + } } if (type == LLRenderPass::PASS_ALPHA) -- cgit v1.2.3 From aa1befd689703d9fea50399201911e0f8fca6ac6 Mon Sep 17 00:00:00 2001 From: Geenz Date: Wed, 30 Jan 2013 12:17:04 -0500 Subject: Specular map support. This is the vast majority of the material parameters implemented at this point for opaque geometry. --- indra/newview/llvovolume.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8cf22d9808..c9d6a34b8a 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4172,12 +4172,26 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.0 / 255); specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.0 / 255); draw_info->mSpecColor = specColor; + LL_INFOS("Materials") << "Specular Color: " << specColor << LL_ENDL; draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.0 / 255); draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.0 / 255); draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTextureIndex()); draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTextureIndex()); } + } else { + U8 shiny = facep->getTextureEntry()->getShiny(); + float alpha[4] = + { + 0.00f, + 0.25f, + 0.5f, + 0.75f + }; + float spec = alpha[shiny]; + LLVector4 specColor(spec, spec, spec, spec); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = spec; } if (type == LLRenderPass::PASS_ALPHA) @@ -4631,7 +4645,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (gPipeline.canUseWindLightShadersOnObjects() && LLPipeline::sRenderBump) { - if (te->getBumpmap()) + if (te->getBumpmap() || te->getMaterialParams() != NULL) { //needs normal + binormal bump_faces.push_back(facep); } @@ -5237,7 +5251,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else { - if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() || te->getMaterialParams() != NULL)) + if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() || te->getMaterialParams())) { //non-shiny or fullbright deferred bump registerFace(group, facep, LLRenderPass::PASS_BUMP); } -- cgit v1.2.3 From 7cc7ae873c5aeca9b5939176fb70677365e25395 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 4 Feb 2013 09:35:12 -0500 Subject: improve and clarify logging --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 6c073a8e20..94799f8bbd 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2005,7 +2005,7 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { if (!pMaterialID.isNull()) { - LL_INFOS("Materials") << "Oh god it's a material! " << pMaterialID.asString() << LL_ENDL; + LL_INFOS("Materials") << " " << pMaterialID.asString() << LL_ENDL; S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); if (res) { -- cgit v1.2.3 From 2ae4b6976baf0556066d5a3b43b8f6148f18c1d8 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 4 Feb 2013 11:32:05 -0500 Subject: Added a new draw pool specifically for faces with materials applied to them. Removed materials rendering from the bump draw pool, and reverted it to its previous state. --- indra/newview/llvovolume.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 6c073a8e20..324d3de499 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1995,7 +1995,6 @@ void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, co { if (getTE(i)->getMaterialID() == pMaterialID) { - LL_INFOS("Materials") << "Material params callback triggered!" << LL_ENDL; setTEMaterialParams(i, pMaterialParams); } } @@ -2005,13 +2004,10 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { if (!pMaterialID.isNull()) { - LL_INFOS("Materials") << "Oh god it's a material! " << pMaterialID.asString() << LL_ENDL; S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); if (res) { - LL_INFOS("Materials") << "We have a material!" << LL_ENDL; LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); - //setTEMaterialParams(te, pMatParam); gPipeline.markTextured(mDrawable); mFaceMappingChanged = TRUE; } @@ -5215,10 +5211,14 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: registerFace(group, facep, LLRenderPass::PASS_POST_BUMP); } } - else if (te->getBumpmap() || te->getMaterialParams() != NULL) + else if (te->getBumpmap() && !te->getMaterialParams()) { //register in deferred bump pass registerFace(group, facep, LLRenderPass::PASS_BUMP); } + else if (te->getMaterialParams()) + { + registerFace(group, facep, LLRenderPass::PASS_MATERIALS); + } else { //register in deferred simple pass (deferred simple includes shiny) llassert(mask & LLVertexBuffer::MAP_NORMAL); @@ -5250,10 +5250,14 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else { - if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() || te->getMaterialParams())) + if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() && !te->getMaterialParams())) { //non-shiny or fullbright deferred bump registerFace(group, facep, LLRenderPass::PASS_BUMP); } + else if (te->getMaterialParams()) + { + registerFace(group, facep, LLRenderPass::PASS_MATERIALS); + } else { //all around simple llassert(mask & LLVertexBuffer::MAP_NORMAL); -- cgit v1.2.3 From 64a4a13397ea7b895ebbeb707bdba72e2d97ff6b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 15 Feb 2013 15:40:43 -0500 Subject: fix crasher in setNumTEs --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 45814a1aa3..f2ede46cfc 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2016,10 +2016,10 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { if (!pMaterialID.isNull()) { - LL_INFOS("Materials") << " " << pMaterialID.asString() << LL_ENDL; S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); if (res) { + LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); gPipeline.markTextured(mDrawable); mFaceMappingChanged = TRUE; -- cgit v1.2.3 From 5a436e46f6893719fc91a1cb70813671cb2a6d44 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 8 Mar 2013 17:07:17 -0500 Subject: SH-3959 WIP - pass information about type of fetched image - server bake, host bake, map tile, etc - down the chain so LLTextureFetchWorker can adjust behavior as needed --- indra/newview/llvovolume.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 0e65df939a..8730ef66bb 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1006,7 +1006,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo if (is404) { - setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", TRUE, LLGLTexture::BOOST_UI)); + setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI)); //render prim proxy when mesh loading attempts give up volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE); @@ -1090,7 +1090,7 @@ void LLVOVolume::updateSculptTexture() LLUUID id = sculpt_params->getSculptTexture(); if (id.notNull()) { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } } else -- cgit v1.2.3 From 41ca92c67c75d86e8053ae45725d36ca3ac7e742 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 25 Mar 2013 18:27:07 -0500 Subject: NORSPEC-54 Potential fix for crashing on all sorts of random operations. --- indra/newview/llvovolume.cpp | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f2ede46cfc..44eefd3c4a 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -556,37 +556,9 @@ void LLVOVolume::animateTextures() tex_mat.setIdentity(); LLVector3 trans ; - if(facep->isAtlasInUse()) - { - // - //if use atlas for animated texture - //apply the following transform to the animation matrix. - // - - F32 tcoord_xoffset = 0.f ; - F32 tcoord_yoffset = 0.f ; - F32 tcoord_xscale = 1.f ; - F32 tcoord_yscale = 1.f ; - if(facep->isAtlasInUse()) - { - const LLVector2* tmp = facep->getTexCoordOffset() ; - tcoord_xoffset = tmp->mV[0] ; - tcoord_yoffset = tmp->mV[1] ; - - tmp = facep->getTexCoordScale() ; - tcoord_xscale = tmp->mV[0] ; - tcoord_yscale = tmp->mV[1] ; - } - trans.set(LLVector3(tcoord_xoffset + tcoord_xscale * (off_s+0.5f), tcoord_yoffset + tcoord_yscale * (off_t+0.5f), 0.f)); - - tex_mat.translate(LLVector3(-(tcoord_xoffset + tcoord_xscale * 0.5f), -(tcoord_yoffset + tcoord_yscale * 0.5f), 0.f)); - } - else //non atlas - { - trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f)); - tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); - } - + trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f)); + tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); + LLVector3 scale(scale_s, scale_t, 1.f); LLQuaternion quat; quat.setQuat(rot, 0, 0, -1.f); -- cgit v1.2.3 From 6300f4f768de13823a754831797cb34022f87b60 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 27 Mar 2013 21:59:14 -0500 Subject: NORSPEC-61 Hook up material parameters to shaders. --- indra/newview/llvovolume.cpp | 58 +++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 17 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 44eefd3c4a..f149c50884 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4143,16 +4143,16 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, // We have a material. Update our draw info accordingly. draw_info->mMaterialID = &facep->getTextureEntry()->getMaterialID(); LLVector4 specColor; - specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.0 / 255); - specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.0 / 255); - specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.0 / 255); - specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.0 / 255); + specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); + specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); + specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f); + specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f); draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.0 / 255); - draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.0 / 255); + draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f); + draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f); draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); - draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTextureIndex()); - draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTextureIndex()); + draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); + draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); } } else { U8 shiny = facep->getTextureEntry()->getShiny(); @@ -5151,7 +5151,39 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE; - if (is_alpha) + LLMaterial* mat = te->getMaterialParams().get(); + + if (mat && LLPipeline::sRenderDeferred && !hud_group) + { + U32 pass[] = + { + LLRenderPass::PASS_MATERIAL, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_MATERIAL_ALPHA, + LLRenderPass::PASS_MATERIAL_ALPHA_MASK, + LLRenderPass::PASS_MATERIAL_ALPHA_GLOW, + LLRenderPass::PASS_SPECMAP, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_SPECMAP_BLEND, + LLRenderPass::PASS_SPECMAP_MASK, + LLRenderPass::PASS_SPECMAP_GLOW, + LLRenderPass::PASS_NORMMAP, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMMAP_BLEND, + LLRenderPass::PASS_NORMMAP_MASK, + LLRenderPass::PASS_NORMMAP_GLOW, + LLRenderPass::PASS_NORMSPEC, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMSPEC_BLEND, + LLRenderPass::PASS_NORMSPEC_MASK, + LLRenderPass::PASS_NORMSPEC_GLOW, + }; + + U32 mask = mat->getShaderMask(); + + llassert(mask < sizeof(pass)/sizeof(U32)); + + mask = llmin(mask, sizeof(pass)/sizeof(U32)-1); + + registerFace(group, facep, pass[mask]); + } + else if (is_alpha) { // can we safely treat this as an alpha mask? if (facep->getFaceColor().mV[3] <= 0.f) @@ -5197,10 +5229,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { //register in deferred bump pass registerFace(group, facep, LLRenderPass::PASS_BUMP); } - else if (te->getMaterialParams()) - { - registerFace(group, facep, LLRenderPass::PASS_MATERIALS); - } else { //register in deferred simple pass (deferred simple includes shiny) llassert(mask & LLVertexBuffer::MAP_NORMAL); @@ -5236,10 +5264,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { //non-shiny or fullbright deferred bump registerFace(group, facep, LLRenderPass::PASS_BUMP); } - else if (te->getMaterialParams()) - { - registerFace(group, facep, LLRenderPass::PASS_MATERIALS); - } else { //all around simple llassert(mask & LLVertexBuffer::MAP_NORMAL); -- cgit v1.2.3 From 5121dd1a533b1d589cf259e96fa6d0ba22b383ea Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 28 Mar 2013 12:15:32 -0500 Subject: NORSPEC-62 Fix for fullbright checkbox not working with materials --- indra/newview/llvovolume.cpp | 79 +++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 26 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f149c50884..becbbbc3a4 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4167,6 +4167,15 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLVector4 specColor(spec, spec, spec, spec); draw_info->mSpecColor = specColor; draw_info->mEnvIntensity = spec; + + if (type == LLRenderPass::PASS_GRASS) + { + draw_info->mAlphaMaskCutoff = 0.5f; + } + else + { + draw_info->mAlphaMaskCutoff = 0.33f; + } } if (type == LLRenderPass::PASS_ALPHA) @@ -5155,33 +5164,51 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (mat && LLPipeline::sRenderDeferred && !hud_group) { - U32 pass[] = + if (fullbright) { - LLRenderPass::PASS_MATERIAL, - LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_MATERIAL_ALPHA, - LLRenderPass::PASS_MATERIAL_ALPHA_MASK, - LLRenderPass::PASS_MATERIAL_ALPHA_GLOW, - LLRenderPass::PASS_SPECMAP, - LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_SPECMAP_BLEND, - LLRenderPass::PASS_SPECMAP_MASK, - LLRenderPass::PASS_SPECMAP_GLOW, - LLRenderPass::PASS_NORMMAP, - LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMMAP_BLEND, - LLRenderPass::PASS_NORMMAP_MASK, - LLRenderPass::PASS_NORMMAP_GLOW, - LLRenderPass::PASS_NORMSPEC, - LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMSPEC_BLEND, - LLRenderPass::PASS_NORMSPEC_MASK, - LLRenderPass::PASS_NORMSPEC_GLOW, - }; - - U32 mask = mat->getShaderMask(); - - llassert(mask < sizeof(pass)/sizeof(U32)); - - mask = llmin(mask, sizeof(pass)/sizeof(U32)-1); - - registerFace(group, facep, pass[mask]); + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); + } + else if (is_alpha) + { + registerFace(group, facep, LLRenderPass::PASS_ALPHA); + } + else + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + } + } + else + { + U32 pass[] = + { + LLRenderPass::PASS_MATERIAL, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_MATERIAL_ALPHA, + LLRenderPass::PASS_MATERIAL_ALPHA_MASK, + LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, + LLRenderPass::PASS_SPECMAP, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_SPECMAP_BLEND, + LLRenderPass::PASS_SPECMAP_MASK, + LLRenderPass::PASS_SPECMAP_EMISSIVE, + LLRenderPass::PASS_NORMMAP, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMMAP_BLEND, + LLRenderPass::PASS_NORMMAP_MASK, + LLRenderPass::PASS_NORMMAP_EMISSIVE, + LLRenderPass::PASS_NORMSPEC, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMSPEC_BLEND, + LLRenderPass::PASS_NORMSPEC_MASK, + LLRenderPass::PASS_NORMSPEC_EMISSIVE, + }; + + U32 mask = mat->getShaderMask(); + + llassert(mask < sizeof(pass)/sizeof(U32)); + + mask = llmin(mask, sizeof(pass)/sizeof(U32)-1); + + registerFace(group, facep, pass[mask]); + } } else if (is_alpha) { -- cgit v1.2.3 From bf6182daa8b4d7cea79310547f71d7a3155e17b0 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 29 Mar 2013 07:50:08 -0700 Subject: Update Mac and Windows breakpad builds to latest --- indra/newview/llvovolume.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 indra/newview/llvovolume.cpp (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp old mode 100644 new mode 100755 -- cgit v1.2.3 From d81fde49f7927c94488c1eca24c07f4e52cbf54a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 29 Mar 2013 12:02:53 -0500 Subject: NORSPEC-64 Fix for batches breaking on every single face when materials are in play. --- indra/newview/llvovolume.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index becbbbc3a4..750d6bd2ac 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4071,7 +4071,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); - const LLMaterialID* matid = &facep->getTextureEntry()->getMaterialID(); + const LLMaterialID& matid = facep->getTextureEntry()->getMaterialID(); bool batchable = false; @@ -4141,7 +4141,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (facep->getTextureEntry()->getMaterialParams() != NULL) { // We have a material. Update our draw info accordingly. - draw_info->mMaterialID = &facep->getTextureEntry()->getMaterialID(); + draw_info->mMaterialID = matid; LLVector4 specColor; specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); @@ -4702,14 +4702,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) bump_mask |= LLVertexBuffer::MAP_BINORMAL; genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, TRUE); genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, TRUE); - genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, TRUE); + genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE); genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, TRUE); } else { genDrawInfo(group, simple_mask, simple_faces); genDrawInfo(group, fullbright_mask, fullbright_faces); - genDrawInfo(group, bump_mask, bump_faces, FALSE, TRUE); + genDrawInfo(group, bump_mask, bump_faces, FALSE, FALSE); genDrawInfo(group, alpha_mask, alpha_faces, TRUE); } @@ -4864,11 +4864,14 @@ struct CompareBatchBreakerModified { return lte->getFullbright() < rte->getFullbright(); } - else + else if (lhs->getTexture() != rhs->getTexture()) { return lhs->getTexture() < rhs->getTexture(); } - + else + { + return lte->getMaterialParams() < rte->getMaterialParams(); + } } }; @@ -4952,6 +4955,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: //pull off next face LLFace* facep = *face_iter; LLViewerTexture* tex = facep->getTexture(); + LLMaterialPtr mat = facep->getTextureEntry()->getMaterialParams(); if (distance_sort) { @@ -5053,7 +5057,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: else { while (i != faces.end() && - (LLPipeline::sTextureBindTest || (distance_sort || (*i)->getTexture() == tex))) + (LLPipeline::sTextureBindTest || + (distance_sort || + ((*i)->getTexture() == tex && + ((*i)->getTextureEntry()->getMaterialParams() == mat))))) { facep = *i; -- cgit v1.2.3 From fc4869fb7871632b95dd293157b9965fb2edcb73 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 29 Mar 2013 16:13:36 -0500 Subject: NORSPEC-65 Hook up texture offset/scale/rotation for normal and specular maps. --- indra/newview/llvovolume.cpp | 62 +++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 15 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 750d6bd2ac..df462e5013 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4294,6 +4294,9 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) std::vector fullbright_faces; std::vector bump_faces; + std::vector norm_faces; + std::vector spec_faces; + std::vector normspec_faces; std::vector simple_faces; std::vector alpha_faces; @@ -4629,7 +4632,30 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (gPipeline.canUseWindLightShadersOnObjects() && LLPipeline::sRenderBump) { - if (te->getBumpmap() || te->getMaterialParams() != NULL) + if (LLPipeline::sRenderDeferred && te->getMaterialParams() != NULL) + { + LLMaterial* mat = te->getMaterialParams().get(); + if (mat->getNormalID().notNull()) + { + if (mat->getSpecularID().notNull()) + { //has normal and specular maps (needs texcoord1, texcoord2, and binormal) + normspec_faces.push_back(facep); + } + else + { //has normal map (needs texcoord1 and binormal) + norm_faces.push_back(facep); + } + } + else if (mat->getSpecularID().notNull()) + { //has specular map but no normal map, needs texcoord2 + spec_faces.push_back(facep); + } + else + { //has neither specular map nor normal map, only needs texcoord0 + simple_faces.push_back(facep); + } + } + else if (te->getBumpmap()) { //needs normal + binormal bump_faces.push_back(facep); } @@ -4687,32 +4713,38 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR; U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR; + U32 norm_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_BINORMAL; + U32 normspec_mask = norm_mask | LLVertexBuffer::MAP_TEXCOORD2; + U32 spec_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD2; + if (emissive) { //emissive faces are present, include emissive byte to preserve batching simple_mask = simple_mask | LLVertexBuffer::MAP_EMISSIVE; alpha_mask = alpha_mask | LLVertexBuffer::MAP_EMISSIVE; bump_mask = bump_mask | LLVertexBuffer::MAP_EMISSIVE; fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_EMISSIVE; + norm_mask = norm_mask | LLVertexBuffer::MAP_EMISSIVE; + normspec_mask = normspec_mask | LLVertexBuffer::MAP_EMISSIVE; + spec_mask = spec_mask | LLVertexBuffer::MAP_EMISSIVE; } - bool batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1; + BOOL batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1; if (batch_textures) { - bump_mask |= LLVertexBuffer::MAP_BINORMAL; - genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, TRUE); - genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, TRUE); - genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE); - genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, TRUE); + bump_mask = bump_mask | LLVertexBuffer::MAP_BINORMAL; + simple_mask = simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; + alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; + fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; } - else - { - genDrawInfo(group, simple_mask, simple_faces); - genDrawInfo(group, fullbright_mask, fullbright_faces); - genDrawInfo(group, bump_mask, bump_faces, FALSE, FALSE); - genDrawInfo(group, alpha_mask, alpha_faces, TRUE); - } - + + genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, batch_textures); + genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, batch_textures); + genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, batch_textures); + genDrawInfo(group, bump_mask, bump_faces, FALSE, FALSE); + genDrawInfo(group, norm_mask, norm_faces, FALSE, FALSE); + genDrawInfo(group, spec_mask, spec_faces, FALSE, FALSE); + genDrawInfo(group, normspec_mask, normspec_faces, FALSE, FALSE); if (!LLPipeline::sDelayVBUpdate) { -- cgit v1.2.3 From 14f02e48b877569539c96ef5f261ac8b3943579f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 29 Mar 2013 20:12:27 -0500 Subject: NORSPEC-66 Hook up material parameters to rigged attachments. --- indra/newview/llvovolume.cpp | 98 +++++++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 34 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index df462e5013..9d5f2f9233 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4463,66 +4463,96 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLViewerTexture* tex = facep->getTexture(); U32 type = gPipeline.getPoolTypeFromTE(te, tex); - if (type == LLDrawPool::POOL_ALPHA) + + if (te->getGlow()) { - if (te->getColor().mV[3] > 0.f) + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_GLOW); + } + + LLMaterial* mat = te->getMaterialParams().get(); + + if (mat) + { + if (te->getFullbright()) { - if (te->getFullbright()) + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); } - else + else if (type == LLDrawPool::POOL_ALPHA) { pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); + } + } + else + { + U32 mask = mat->getShaderMask(); + pool->addRiggedFace(facep, mask); } } - else if (te->getShiny()) + else { - if (te->getFullbright()) + if (type == LLDrawPool::POOL_ALPHA) { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY); + if (te->getColor().mV[3] > 0.f) + { + if (te->getFullbright()) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); + } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); + } + } } - else + else if (te->getShiny()) { - if (LLPipeline::sRenderDeferred) + if (te->getFullbright()) { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY); } else { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SHINY); + if (LLPipeline::sRenderDeferred) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); + } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SHINY); + } } } - } - else - { - if (te->getFullbright()) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); - } else { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); - } - } - - if (te->getGlow()) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_GLOW); - } - - if (LLPipeline::sRenderDeferred) - { - if (type != LLDrawPool::POOL_ALPHA && !te->getFullbright()) - { - if (te->getBumpmap()) + if (te->getFullbright()) { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_BUMP); + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); } else { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_SIMPLE); + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); + } + } + + + if (LLPipeline::sRenderDeferred) + { + if (type != LLDrawPool::POOL_ALPHA && !te->getFullbright()) + { + if (te->getBumpmap()) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_BUMP); + } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_SIMPLE); + } } } } -- cgit v1.2.3 From e42142005585f580d39036fba02ec060d739cc5f Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Sun, 31 Mar 2013 07:31:41 -0700 Subject: Re-apply llmin fix for Mac --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9d5f2f9233..fd9f3dc486 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5274,7 +5274,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: llassert(mask < sizeof(pass)/sizeof(U32)); - mask = llmin(mask, sizeof(pass)/sizeof(U32)-1); + mask = llmin(mask, (U32)(sizeof(pass)/sizeof(U32)-1)); registerFace(group, facep, pass[mask]); } -- cgit v1.2.3 From 679a095aa04234f48c10139138ca54939099defa Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Apr 2013 15:45:17 -0500 Subject: NORSPEC-74 Fix for assert when Debug GL enabled when rendering materials. --- indra/newview/llvovolume.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index fd9f3dc486..8a1f00aa0e 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4771,10 +4771,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, batch_textures); genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, batch_textures); genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, batch_textures); - genDrawInfo(group, bump_mask, bump_faces, FALSE, FALSE); - genDrawInfo(group, norm_mask, norm_faces, FALSE, FALSE); - genDrawInfo(group, spec_mask, spec_faces, FALSE, FALSE); - genDrawInfo(group, normspec_mask, normspec_faces, FALSE, FALSE); + genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE); + genDrawInfo(group, norm_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, norm_faces, FALSE, FALSE); + genDrawInfo(group, spec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, spec_faces, FALSE, FALSE); + genDrawInfo(group, normspec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, normspec_faces, FALSE, FALSE); if (!LLPipeline::sDelayVBUpdate) { -- cgit v1.2.3 From 53d7db98ffadce190995833b9f785d5ebfa7cf4d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Apr 2013 15:45:17 -0500 Subject: NORSPEC-74 Fix for assert when Debug GL enabled when rendering materials. --- indra/newview/llvovolume.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index fd9f3dc486..8a1f00aa0e 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4771,10 +4771,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, batch_textures); genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, batch_textures); genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, batch_textures); - genDrawInfo(group, bump_mask, bump_faces, FALSE, FALSE); - genDrawInfo(group, norm_mask, norm_faces, FALSE, FALSE); - genDrawInfo(group, spec_mask, spec_faces, FALSE, FALSE); - genDrawInfo(group, normspec_mask, normspec_faces, FALSE, FALSE); + genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE); + genDrawInfo(group, norm_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, norm_faces, FALSE, FALSE); + genDrawInfo(group, spec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, spec_faces, FALSE, FALSE); + genDrawInfo(group, normspec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, normspec_faces, FALSE, FALSE); if (!LLPipeline::sDelayVBUpdate) { -- cgit v1.2.3 From f189ba4a3d927fe0ecfb83b36b60a47c88525fdd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Apr 2013 16:56:59 -0500 Subject: NORSPEC-71 Lots more UI hookups Written with and Reviewed By Graham --- indra/newview/llvovolume.cpp | 60 ++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 33 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8a1f00aa0e..43c57602f5 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -892,7 +892,7 @@ LLFace* LLVOVolume::addFace(S32 f) { const LLTextureEntry* te = getTE(f); LLViewerTexture* imagep = getTEImage(f); - if (te->getMaterialParams() != NULL) + if (te->getMaterialParams().notNull()) { LLViewerTexture* normalp = getTENormalMap(f); LLViewerTexture* specularp = getTESpecularMap(f); @@ -1395,7 +1395,7 @@ void LLVOVolume::regenFaces() facep->setTEOffset(i); facep->setTexture(getTEImage(i)); - if (facep->getTextureEntry()->getMaterialParams() != NULL) + if (facep->getTextureEntry()->getMaterialParams().notNull()) { facep->setNormalMap(getTENormalMap(i)); facep->setSpecularMap(getTESpecularMap(i)); @@ -1986,19 +1986,15 @@ void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, co S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { - if (!pMaterialID.isNull()) + S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); + if (res) { - S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); - if (res) - { - LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; - LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); - gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; - } - return res; + LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); + gPipeline.markTextured(mDrawable); + mFaceMappingChanged = TRUE; } - return 0; + return res; } S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) @@ -4135,26 +4131,24 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - if (!facep->getTextureEntry()->getMaterialID().isNull()) + if (facep->getTextureEntry()->getMaterialParams().notNull()) + { + // We have a material. Update our draw info accordingly. + draw_info->mMaterialID = matid; + LLVector4 specColor; + specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); + specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); + specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f); + specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f); + draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f); + draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); + draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); + draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); + } + else { - - if (facep->getTextureEntry()->getMaterialParams() != NULL) - { - // We have a material. Update our draw info accordingly. - draw_info->mMaterialID = matid; - LLVector4 specColor; - specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); - specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); - specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f); - specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f); - draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f); - draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); - draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); - draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); - } - } else { U8 shiny = facep->getTextureEntry()->getShiny(); float alpha[4] = { @@ -4662,7 +4656,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (gPipeline.canUseWindLightShadersOnObjects() && LLPipeline::sRenderBump) { - if (LLPipeline::sRenderDeferred && te->getMaterialParams() != NULL) + if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull()) { LLMaterial* mat = te->getMaterialParams().get(); if (mat->getNormalID().notNull()) -- cgit v1.2.3 From 7a820b88fc45a4a16573387782e1c3f7e412da68 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 3 Apr 2013 16:56:59 -0500 Subject: NORSPEC-71 Lots more UI hookups Written with and Reviewed By Graham --- indra/newview/llvovolume.cpp | 60 ++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 33 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8a1f00aa0e..43c57602f5 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -892,7 +892,7 @@ LLFace* LLVOVolume::addFace(S32 f) { const LLTextureEntry* te = getTE(f); LLViewerTexture* imagep = getTEImage(f); - if (te->getMaterialParams() != NULL) + if (te->getMaterialParams().notNull()) { LLViewerTexture* normalp = getTENormalMap(f); LLViewerTexture* specularp = getTESpecularMap(f); @@ -1395,7 +1395,7 @@ void LLVOVolume::regenFaces() facep->setTEOffset(i); facep->setTexture(getTEImage(i)); - if (facep->getTextureEntry()->getMaterialParams() != NULL) + if (facep->getTextureEntry()->getMaterialParams().notNull()) { facep->setNormalMap(getTENormalMap(i)); facep->setSpecularMap(getTESpecularMap(i)); @@ -1986,19 +1986,15 @@ void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, co S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { - if (!pMaterialID.isNull()) + S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); + if (res) { - S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); - if (res) - { - LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; - LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); - gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; - } - return res; + LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); + gPipeline.markTextured(mDrawable); + mFaceMappingChanged = TRUE; } - return 0; + return res; } S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) @@ -4135,26 +4131,24 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - if (!facep->getTextureEntry()->getMaterialID().isNull()) + if (facep->getTextureEntry()->getMaterialParams().notNull()) + { + // We have a material. Update our draw info accordingly. + draw_info->mMaterialID = matid; + LLVector4 specColor; + specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); + specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); + specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f); + specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f); + draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f); + draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); + draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); + draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); + } + else { - - if (facep->getTextureEntry()->getMaterialParams() != NULL) - { - // We have a material. Update our draw info accordingly. - draw_info->mMaterialID = matid; - LLVector4 specColor; - specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); - specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); - specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f); - specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f); - draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f); - draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); - draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); - draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); - } - } else { U8 shiny = facep->getTextureEntry()->getShiny(); float alpha[4] = { @@ -4662,7 +4656,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (gPipeline.canUseWindLightShadersOnObjects() && LLPipeline::sRenderBump) { - if (LLPipeline::sRenderDeferred && te->getMaterialParams() != NULL) + if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull()) { LLMaterial* mat = te->getMaterialParams().get(); if (mat->getNormalID().notNull()) -- cgit v1.2.3 From 7bd15e59175fcb11ea620459db600ca018707d38 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 3 Apr 2013 20:49:26 -0700 Subject: NORSPEC-23 NORSPEC-76 NORSPEC-37 and other stability improvements --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 43c57602f5..b65663140d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1977,7 +1977,7 @@ void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, co { for (U8 i = 0; i < getNumTEs(); i++) { - if (getTE(i)->getMaterialID() == pMaterialID) + if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID))) { setTEMaterialParams(i, pMaterialParams); } -- cgit v1.2.3 From 78d23e66425265e43584c6c4fd4fce9c675f4771 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Apr 2013 00:27:32 -0500 Subject: NORSPEC-75 Add appropriate draw calls to underwater render passes so objects with material data don't disappear in water. --- indra/newview/llvovolume.cpp | 55 +++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b46f4d7351..23192e61bc 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3997,6 +3997,11 @@ bool can_batch_texture(LLFace* facep) return false; } + if (facep->getTextureEntry()->getMaterialParams().notNull()) + { //materials don't work with texture batching yet + return false; + } + if (facep->getTexture() && facep->getTexture()->getPrimaryFormat() == GL_ALPHA) { //can't batch invisiprims return false; @@ -4067,13 +4072,17 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); - const LLMaterialID& matid = facep->getTextureEntry()->getMaterialID(); + LLMaterial* mat = LLPipeline::sRenderDeferred ? facep->getTextureEntry()->getMaterialParams() : NULL; bool batchable = false; if (index < 255 && idx >= 0) { - if (index < draw_vec[idx]->mTextureList.size()) + if (mat || draw_vec[idx]->mMaterial) + { //can't batch textures when materials are present (yet) + batchable = false; + } + else if (index < draw_vec[idx]->mTextureList.size()) { if (draw_vec[idx]->mTextureList[index].isNull()) { @@ -4103,13 +4112,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mBump == bump && draw_vec[idx]->mTextureMatrix == tex_mat && draw_vec[idx]->mModelMatrix == model_mat && - draw_vec[idx]->mMaterialID == matid) + draw_vec[idx]->mMaterial == mat) { draw_vec[idx]->mCount += facep->getIndicesCount(); draw_vec[idx]->mEnd += facep->getGeomCount(); draw_vec[idx]->mVSize = llmax(draw_vec[idx]->mVSize, facep->getVirtualSize()); - if (index >= draw_vec[idx]->mTextureList.size()) + if (index < 255 && index >= draw_vec[idx]->mTextureList.size()) { draw_vec[idx]->mTextureList.resize(index+1); draw_vec[idx]->mTextureList[index] = tex; @@ -4131,22 +4140,22 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - if (facep->getTextureEntry()->getMaterialParams().notNull()) - { + if (mat) + { // We have a material. Update our draw info accordingly. - draw_info->mMaterialID = matid; + draw_info->mMaterial = mat; LLVector4 specColor; - specColor.mV[0] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[0] * (1.f / 255.f); - specColor.mV[1] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[1] * (1.f / 255.f); - specColor.mV[2] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightColor().mV[2] * (1.f / 255.f); - specColor.mV[3] = facep->getTextureEntry()->getMaterialParams()->getSpecularLightExponent() * (1.f / 255.f); + specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f); + specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f); + specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f); + specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f); draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = facep->getTextureEntry()->getMaterialParams()->getEnvironmentIntensity() * (1.f / 255.f); - draw_info->mAlphaMaskCutoff = facep->getTextureEntry()->getMaterialParams()->getAlphaMaskCutoff() * (1.f / 255.f); - draw_info->mDiffuseAlphaMode = facep->getTextureEntry()->getMaterialParams()->getDiffuseAlphaMode(); + draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f); + draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f); + draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode(); draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); - } + } else { U8 shiny = facep->getTextureEntry()->getShiny(); @@ -4463,7 +4472,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_GLOW); } - LLMaterial* mat = te->getMaterialParams().get(); + LLMaterial* mat = LLPipeline::sRenderDeferred ? te->getMaterialParams().get() : NULL; if (mat) { @@ -4920,13 +4929,13 @@ struct CompareBatchBreakerModified { return lte->getFullbright() < rte->getFullbright(); } - else if (lhs->getTexture() != rhs->getTexture()) + else if (LLPipeline::sRenderDeferred && lte->getMaterialParams() != rte->getMaterialParams()) { - return lhs->getTexture() < rhs->getTexture(); + return lte->getMaterialParams() < rte->getMaterialParams(); } else { - return lte->getMaterialParams() < rte->getMaterialParams(); + return lhs->getTexture() < rhs->getTexture(); } } }; @@ -5057,6 +5066,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (!can_batch_texture(facep)) { //face is bump mapped or has an animated texture matrix -- can't //batch more than 1 texture at a time + facep->setTextureIndex(0); break; } @@ -5107,6 +5117,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: facep->setTextureIndex(cur_tex); } } + else + { + facep->setTextureIndex(0); + } tex = texture_list[0]; } @@ -5202,8 +5216,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: index_offset += facep->getGeomCount(); indices_index += facep->getIndicesCount(); - - + //append face to appropriate render batch BOOL force_simple = facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA; -- cgit v1.2.3 From f86fd87437963a4e4eeffa58f4a7fb5ba30ce193 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Apr 2013 01:12:18 -0500 Subject: Fix for mac build? --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 23192e61bc..bc1daa8b10 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4072,7 +4072,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); - LLMaterial* mat = LLPipeline::sRenderDeferred ? facep->getTextureEntry()->getMaterialParams() : NULL; + LLMaterial* mat = LLPipeline::sRenderDeferred ? facep->getTextureEntry()->getMaterialParams().get() : NULL; bool batchable = false; -- cgit v1.2.3 From cfc375777871ec3d04b9969793379d0cd78a012e Mon Sep 17 00:00:00 2001 From: Geenz Date: Thu, 11 Apr 2013 14:57:11 -0400 Subject: First pass on alpha blended materials --- indra/newview/llvovolume.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b46f4d7351..34bed6a7f3 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4015,7 +4015,11 @@ static LLFastTimer::DeclareTimer FTM_REGISTER_FACE("Register Face"); void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type) { LLFastTimer t(FTM_REGISTER_FACE); - + if (type == LLRenderPass::PASS_ALPHA && facep->getTextureEntry()->getMaterialParams().notNull() && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_BINORMAL)) + { + LL_WARNS("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL; + } + if (facep->getViewerObject()->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) { return; @@ -4758,7 +4762,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { bump_mask = bump_mask | LLVertexBuffer::MAP_BINORMAL; simple_mask = simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; - alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; + alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL; fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; } -- cgit v1.2.3 From 66b4900e70db9bf6244faee0bcde63060302f9fe Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 11 Apr 2013 15:17:55 -0500 Subject: Pass binormal masks in on particles and in lldrawpoolalpha --- indra/newview/llvovolume.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 34bed6a7f3..139f3d2c2a 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4095,6 +4095,15 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, } } + //DEBUG + LLVertexBuffer* buff = facep->getVertexBuffer(); + + if (type == LLRenderPass::PASS_ALPHA && !buff->hasDataType(LLVertexBuffer::TYPE_BINORMAL)) + { + llerrs << "WTF?" << llendl; + } + + if (idx >= 0 && draw_vec[idx]->mVertexBuffer == facep->getVertexBuffer() && draw_vec[idx]->mEnd == facep->getGeomIndex()-1 && -- cgit v1.2.3 From 39544a3b06e3221602444eb81c7df8c1030c6bb5 Mon Sep 17 00:00:00 2001 From: Geenz Date: Mon, 15 Apr 2013 02:29:03 -0400 Subject: Hooked up normal and specular texture coordinates. --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 139f3d2c2a..88c9deb7a6 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4771,7 +4771,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { bump_mask = bump_mask | LLVertexBuffer::MAP_BINORMAL; simple_mask = simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; - alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL; + alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2; fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; } -- cgit v1.2.3 From 70dbb7a59c69c6482c451b4c75aba85f0f0a647a Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 16 Apr 2013 17:24:51 -0700 Subject: NORSPEC-127 work-around crasher by forcing simple faces into simple pass --- indra/newview/llvovolume.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f77869ee91..27565a8d17 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4775,7 +4775,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; } - genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, batch_textures); + genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, batch_textures, TRUE); genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, batch_textures); genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, batch_textures); genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE); @@ -4954,7 +4954,7 @@ static LLFastTimer::DeclareTimer FTM_GEN_DRAW_INFO_RESIZE_VB("Resize VB"); -void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& faces, BOOL distance_sort, BOOL batch_textures) +void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector& faces, BOOL distance_sort, BOOL batch_textures, BOOL no_materials) { LLFastTimer t(FTM_REBUILD_VOLUME_GEN_DRAW_INFO); @@ -5259,6 +5259,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); } } + else if (no_materials) + { + registerFace(group, facep, LLRenderPass::PASS_SIMPLE); + } else { U32 pass[] = -- cgit v1.2.3 From 454ae4cf613f1e4c409d8017cd97548b757ded70 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 24 Apr 2013 20:35:16 -0500 Subject: NORSPEC-146 Fix for objects with alpha mode set to none or mask being shiny --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 27565a8d17..45eac0e211 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4775,7 +4775,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; } - genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, batch_textures, TRUE); + genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, FALSE, batch_textures, FALSE); genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, FALSE, batch_textures); genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, TRUE, batch_textures); genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, FALSE, FALSE); -- cgit v1.2.3 From 3a2576cefa97f50640adb596a5d01fa287f7033f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 25 Apr 2013 13:29:40 -0500 Subject: NORSPEC-118 Compatibility pass against advanced lighting disabled. --- indra/newview/llvovolume.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 45eac0e211..53e6f44760 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4037,6 +4037,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, BOOL fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) || (type == LLRenderPass::PASS_INVISIBLE) || + (type == LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK) || (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)); if (!fullbright && type != LLRenderPass::PASS_GLOW && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_NORMAL)) @@ -4076,7 +4077,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); - LLMaterial* mat = LLPipeline::sRenderDeferred ? facep->getTextureEntry()->getMaterialParams().get() : NULL; + LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get(); bool batchable = false; @@ -5242,6 +5243,14 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: LLMaterial* mat = te->getMaterialParams().get(); + bool can_be_shiny = true; + if (mat) + { + U8 mode = mat->getDiffuseAlphaMode(); + can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || + mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; + } + if (mat && LLPipeline::sRenderDeferred && !hud_group) { if (fullbright) @@ -5319,7 +5328,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else if (gPipeline.canUseVertexShaders() && LLPipeline::sRenderBump - && te->getShiny()) + && te->getShiny() + && can_be_shiny) { //shiny if (tex->getPrimaryFormat() == GL_ALPHA) { //invisiprim+shiny @@ -5363,7 +5373,14 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else if (fullbright || bake_sunlight) { //fullbright - registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); + } + else + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + } if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && te->getBumpmap()) { //if this is the deferred render and a bump map is present, register in post deferred bump registerFace(group, facep, LLRenderPass::PASS_POST_BUMP); @@ -5378,7 +5395,14 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: else { //all around simple llassert(mask & LLVertexBuffer::MAP_NORMAL); - registerFace(group, facep, LLRenderPass::PASS_SIMPLE); + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + { //material alpha mask can be respected in non-deferred + registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK); + } + else + { + registerFace(group, facep, LLRenderPass::PASS_SIMPLE); + } } } -- cgit v1.2.3 From d7136bac52dc36cca1f5b89fdc26fd323be468c5 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 25 Apr 2013 16:50:02 -0400 Subject: NORSPEC-67: fix update problem by not updating texture pickers when they are open --- indra/newview/llvovolume.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 27565a8d17..1e32e7628f 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1861,7 +1861,7 @@ S32 LLVOVolume::setTEColor(const U8 te, const LLColor4& color) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS("MaterialTEs") << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (color != tep->getColor()) { @@ -1975,6 +1975,7 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams) { + LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << LL_ENDL; for (U8 i = 0; i < getNumTEs(); i++) { if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID))) @@ -1987,9 +1988,11 @@ void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, co S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); + LL_DEBUGS("MaterialTEs") << "te "<< (S32)te << " materialid " << pMaterialID.asString() << " res " << res + << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) + << LL_ENDL; if (res) { - LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); gPipeline.markTextured(mDrawable); mFaceMappingChanged = TRUE; @@ -2000,6 +2003,9 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << pMaterialParams->asLLSD() << " res " << res + << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) + << LL_ENDL; if (res) { gPipeline.markTextured(mDrawable); -- cgit v1.2.3 From 806d09b1143894ad66cea2c228f467e8c39a8adf Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 30 Apr 2013 19:50:05 -0700 Subject: Merge 3.5.1 into Materials --- indra/newview/llvovolume.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index edd47b68c3..a08a8a9676 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -372,7 +372,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, // Unpack texture entry data // - S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, block_num); + S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num); if (result & teDirtyBits) { updateTEData(); @@ -721,7 +721,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) { F32 area = (F32) camera->getScreenPixelArea(); vsize = area; - imagep->setBoostLevel(LLViewerTexture::BOOST_HUD); + imagep->setBoostLevel(LLGLTexture::BOOST_HUD); face->setPixelArea(area); // treat as full screen face->setVirtualSize(vsize); } @@ -777,7 +777,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) if (mSculptTexture.notNull()) { mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), - (S32)LLViewerTexture::BOOST_SCULPTED)); + (S32)LLGLTexture::BOOST_SCULPTED)); mSculptTexture->setForSculpt() ; if(!mSculptTexture->isCachedRawImageReady()) @@ -986,7 +986,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo if (is404) { - setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", TRUE, LLViewerTexture::BOOST_UI)); + setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_UI)); //render prim proxy when mesh loading attempts give up volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE); @@ -1070,7 +1070,7 @@ void LLVOVolume::updateSculptTexture() LLUUID id = sculpt_params->getSculptTexture(); if (id.notNull()) { - mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } } else @@ -1993,6 +1993,7 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) << LL_ENDL; if (res) { + LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); gPipeline.markTextured(mDrawable); mFaceMappingChanged = TRUE; @@ -2770,7 +2771,7 @@ void LLVOVolume::updateSpotLightPriority() if (mLightTexture.notNull()) { mLightTexture->addTextureStats(mSpotLightPriority); - mLightTexture->setBoostLevel(LLViewerTexture::BOOST_CLOUDS); + mLightTexture->setBoostLevel(LLGLTexture::BOOST_CLOUDS); } } -- cgit v1.2.3 From 9187a06d0bc70ea7670192a5fe53f75ef6f36259 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 3 May 2013 09:16:15 -0700 Subject: NORSPEC-151 make disabling bumpyshiny disable adv lighting model as well --- indra/newview/llvovolume.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a08a8a9676..9b940300f5 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4152,7 +4152,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - if (mat) + if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; @@ -4178,6 +4178,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, 0.5f, 0.75f }; + llassert(shiny <= 3); float spec = alpha[shiny]; LLVector4 specColor(spec, spec, spec, spec); draw_info->mSpecColor = specColor; -- cgit v1.2.3 From 04fceb5f006d6f3b9b36996382e4c1483a599dde Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 3 May 2013 09:16:15 -0700 Subject: NORSPEC-151 make disabling bumpyshiny disable adv lighting model as well --- indra/newview/llvovolume.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a08a8a9676..9b940300f5 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4152,7 +4152,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - if (mat) + if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; @@ -4178,6 +4178,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, 0.5f, 0.75f }; + llassert(shiny <= 3); float spec = alpha[shiny]; LLVector4 specColor(spec, spec, spec, spec); draw_info->mSpecColor = specColor; -- cgit v1.2.3 From a9ede989158ceaa4914ea48ff6a2027e89fdbda2 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 08:56:32 -0700 Subject: NORSPEC-126 Make objects with normal maps applied obey legacy shiny settings --- indra/newview/llvovolume.cpp | 51 +++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9b940300f5..6cfdc1e9c6 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4152,38 +4152,45 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; + + U8 shiny = facep->getTextureEntry()->getShiny(); + float alpha[4] = + { + 0.00f, + 0.25f, + 0.5f, + 0.75f + }; + float spec = alpha[shiny & TEM_SHINY_MASK]; + LLVector4 specColor(spec, spec, spec, spec); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = spec; + draw_info->mSpecularMap = NULL; + if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; - LLVector4 specColor; - specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f); - specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f); - specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f); - specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f); + + if (!mat->getSpecularID().isNull()) + { + LLVector4 specColor; + specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f); + specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f); + specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f); + specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f); + draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); + } + draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f); draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode(); draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); - draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); + } else { - U8 shiny = facep->getTextureEntry()->getShiny(); - float alpha[4] = - { - 0.00f, - 0.25f, - 0.5f, - 0.75f - }; - llassert(shiny <= 3); - float spec = alpha[shiny]; - LLVector4 specColor(spec, spec, spec, spec); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = spec; - if (type == LLRenderPass::PASS_GRASS) { draw_info->mAlphaMaskCutoff = 0.5f; -- cgit v1.2.3 From d42a0e4e80d2b2cd51e43f7d340a6043b55635ec Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 08:56:32 -0700 Subject: NORSPEC-126 Make objects with normal maps applied obey legacy shiny settings --- indra/newview/llvovolume.cpp | 51 +++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9b940300f5..6cfdc1e9c6 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4152,38 +4152,45 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; + + U8 shiny = facep->getTextureEntry()->getShiny(); + float alpha[4] = + { + 0.00f, + 0.25f, + 0.5f, + 0.75f + }; + float spec = alpha[shiny & TEM_SHINY_MASK]; + LLVector4 specColor(spec, spec, spec, spec); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = spec; + draw_info->mSpecularMap = NULL; + if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; - LLVector4 specColor; - specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f); - specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f); - specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f); - specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f); + + if (!mat->getSpecularID().isNull()) + { + LLVector4 specColor; + specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f); + specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f); + specColor.mV[2] = mat->getSpecularLightColor().mV[2] * (1.f / 255.f); + specColor.mV[3] = mat->getSpecularLightExponent() * (1.f / 255.f); + draw_info->mSpecColor = specColor; + draw_info->mEnvIntensity = mat->getEnvironmentIntensity() * (1.f / 255.f); + draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); + } + draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f); draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode(); draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); - draw_info->mSpecularMap = facep->getViewerObject()->getTESpecularMap(facep->getTEOffset()); + } else { - U8 shiny = facep->getTextureEntry()->getShiny(); - float alpha[4] = - { - 0.00f, - 0.25f, - 0.5f, - 0.75f - }; - llassert(shiny <= 3); - float spec = alpha[shiny]; - LLVector4 specColor(spec, spec, spec, spec); - draw_info->mSpecColor = specColor; - draw_info->mEnvIntensity = spec; - if (type == LLRenderPass::PASS_GRASS) { draw_info->mAlphaMaskCutoff = 0.5f; -- cgit v1.2.3 From 18e3985120d53acdf07d43dce79312b78629e57a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 May 2013 15:44:44 -0500 Subject: NORSPEC-162 Fix for objects with materials set ignoring "tranparency %" value. --- indra/newview/llvovolume.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9b940300f5..637d40c5b5 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4088,6 +4088,21 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, bool batchable = false; + U32 shader_mask = 0xFFFFFFFF; //no shader + + if (mat) + { + if (type == LLRenderPass::PASS_ALPHA) + { + shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND); + } + else + { + shader_mask = mat->getShaderMask(); + } + } + + if (index < 255 && idx >= 0) { if (mat || draw_vec[idx]->mMaterial) @@ -4124,7 +4139,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mBump == bump && draw_vec[idx]->mTextureMatrix == tex_mat && draw_vec[idx]->mModelMatrix == model_mat && - draw_vec[idx]->mMaterial == mat) + draw_vec[idx]->mMaterial == mat && + draw_vec[idx]->mShaderMask == shader_mask) { draw_vec[idx]->mCount += facep->getIndicesCount(); draw_vec[idx]->mEnd += facep->getGeomCount(); @@ -4152,10 +4168,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec.push_back(draw_info); draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) + if (mat) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; + draw_info->mShaderMask = shader_mask; LLVector4 specColor; specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f); specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f); @@ -5280,6 +5297,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { registerFace(group, facep, LLRenderPass::PASS_SIMPLE); } + else if (te->getColor().mV[3] < 0.999f) + { + registerFace(group, facep, LLRenderPass::PASS_ALPHA); + } else { U32 pass[] = -- cgit v1.2.3 From 85a123a3e3b07de57bba18e46bdad615174428da Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 13:45:49 -0700 Subject: NORSPEC-118 fix regression of 118 from extra conditions added for 151 --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 6cfdc1e9c6..50228476d8 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4167,7 +4167,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->mEnvIntensity = spec; draw_info->mSpecularMap = NULL; - if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) + if (mat) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; -- cgit v1.2.3 From 792f606093daf89873342d3465eda296e329d407 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 13:45:49 -0700 Subject: NORSPEC-118 fix regression of 118 from extra conditions added for 151 --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 6cfdc1e9c6..50228476d8 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4167,7 +4167,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->mEnvIntensity = spec; draw_info->mSpecularMap = NULL; - if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred) + if (mat) { // We have a material. Update our draw info accordingly. draw_info->mMaterial = mat; -- cgit v1.2.3 From f356d7eb9fd730f5f6f5a29fb0706e20876ad3bd Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 11 May 2013 19:58:56 -0700 Subject: Fix many issues with selection misapplication and rendering not matching applied materials --- indra/newview/llvovolume.cpp | 47 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 941892a597..df014513ad 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1973,33 +1973,34 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) return res; } -void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams) +void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te) { - LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << LL_ENDL; - for (U8 i = 0; i < getNumTEs(); i++) + LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL; + LLTextureEntry* texture_entry = getTE(te); + if (texture_entry && (texture_entry->getMaterialID().isNull() || (texture_entry->getMaterialID() == pMaterialID))) { - if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID))) - { - setTEMaterialParams(i, pMaterialParams); - } + setTEMaterialParams(te, pMaterialParams); } } S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { - S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); - LL_DEBUGS("MaterialTEs") << "te "<< (S32)te << " materialid " << pMaterialID.asString() << " res " << res - << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) - << LL_ENDL; - if (res) - { - LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; - LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); - gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; - } - return res; + S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); + LL_DEBUGS("MaterialTEs") << "te "<< (S32)te << " materialid " << pMaterialID.asString() << " res " << res + << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) + << 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)); + setChanged(TEXTURE); + if (!mDrawable.isNull()) + { + gPipeline.markTextured(mDrawable); } + mFaceMappingChanged = TRUE; + return TEM_CHANGE_TEXTURE; +} S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { @@ -2007,13 +2008,13 @@ S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialPa LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << pMaterialParams->asLLSD() << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) << LL_ENDL; - if (res) + setChanged(TEXTURE); + if (!mDrawable.isNull()) { gPipeline.markTextured(mDrawable); - mFaceMappingChanged = TRUE; } - - return res; + mFaceMappingChanged = TRUE; + return TEM_CHANGE_TEXTURE; } S32 LLVOVolume::setTEScale(const U8 te, const F32 s, const F32 t) -- cgit v1.2.3 From c2c9380fe135fd8b191ebe3c9a38129af4994ed8 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 12 May 2013 13:02:54 +0200 Subject: Avoid code duplication in LLMaterialMgr --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index df014513ad..734ac2afc8 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1992,7 +1992,7 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) 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)); + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te)); setChanged(TEXTURE); if (!mDrawable.isNull()) { -- cgit v1.2.3 From 5ac9d9cb05f22099bea8c9312f5e0b234430022a Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 12 May 2013 16:10:31 +0200 Subject: LLMaterialMgr::get() doesn't handle a callback request for LLMaterialID::null --- indra/newview/llvovolume.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 734ac2afc8..8e811527eb 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1991,21 +1991,23 @@ 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().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te)); - setChanged(TEXTURE); - if (!mDrawable.isNull()) + if (res) { - gPipeline.markTextured(mDrawable); + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te)); + setChanged(TEXTURE); + if (!mDrawable.isNull()) + { + gPipeline.markTextured(mDrawable); + } + mFaceMappingChanged = TRUE; } - mFaceMappingChanged = TRUE; - return TEM_CHANGE_TEXTURE; + return res; } S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); - LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << pMaterialParams->asLLSD() << " res " << res + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) << LL_ENDL; setChanged(TEXTURE); -- cgit v1.2.3 From d9e8ee7cfd323872145c23e4032989f9b7770f55 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 13 May 2013 13:02:53 -0700 Subject: NORSPEC-178 NORSPEC-179 NORSPEC-180 made enable/disable handling more consistent and increased max range on repeats per meter --- indra/newview/llvovolume.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8e811527eb..1021615255 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1991,17 +1991,15 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) << LL_ENDL; LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; - if (res) - { - LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te)); + // 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)); setChanged(TEXTURE); if (!mDrawable.isNull()) { gPipeline.markTextured(mDrawable); } mFaceMappingChanged = TRUE; - } - return res; + return TEM_CHANGE_TEXTURE; } S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) -- 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/newview/llvovolume.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvovolume.cpp') 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 46eface63c94ca7e047b731f140aeaacfc4860e4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 14 May 2013 16:20:54 -0500 Subject: NORSPEC-181 Fix for performance regression. --- indra/newview/llvovolume.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 1021615255..52d05c8030 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4183,13 +4183,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->mSpecColor = specColor; draw_info->mEnvIntensity = spec; draw_info->mSpecularMap = NULL; + draw_info->mMaterial = mat; + draw_info->mShaderMask = shader_mask; if (mat) { // We have a material. Update our draw info accordingly. - draw_info->mMaterial = mat; - draw_info->mShaderMask = shader_mask; - + if (!mat->getSpecularID().isNull()) { LLVector4 specColor; -- 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/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') 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 From 2dddf959bd4b430510ceb441550cc304c80150c2 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 16 May 2013 12:45:19 -0700 Subject: NORSPEC-189 return to inefficient material update reg to avoid crashes from brundlefly solution with old reg and new callback --- indra/newview/llvovolume.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a9b540507f..92ee36d205 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1973,14 +1973,16 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) return res; } -void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te) -{ - LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL; - LLTextureEntry* texture_entry = getTE(te); - if (texture_entry && (texture_entry->getMaterialID().isNull() || (texture_entry->getMaterialID() == pMaterialID))) - { - setTEMaterialParams(te, pMaterialParams); - } +void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams) +{ + LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << LL_ENDL; + for (U8 i = 0; i < getNumTEs(); i++) + { + if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID))) + { + setTEMaterialParams(i, pMaterialParams); + } + } } S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) @@ -1993,7 +1995,7 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; if (res) { - LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3)); + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); setChanged(TEXTURE); if (!mDrawable.isNull()) { -- cgit v1.2.3 From 69e680a37ca9353cd33c058b8984cfc13e7b4ff4 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 16 May 2013 13:42:20 -0700 Subject: Merge beta fixes --- indra/newview/llvovolume.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 92ee36d205..c3c6747e99 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1973,16 +1973,17 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) return res; } -void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams) -{ - LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << LL_ENDL; - for (U8 i = 0; i < getNumTEs(); i++) - { - if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID))) - { - setTEMaterialParams(i, pMaterialParams); - } - } +void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te) +{ + LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL; + if (te >= getNumTEs()) + return; + + LLTextureEntry* texture_entry = getTE(te); + if (texture_entry) + { + setTEMaterialParams(te, pMaterialParams); + } } S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) @@ -1995,7 +1996,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)); + LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3)); setChanged(TEXTURE); if (!mDrawable.isNull()) { -- cgit v1.2.3 From 74c1bc29e7dc566c7bb1a654b1dbf632d39dcb17 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Fri, 17 May 2013 14:02:31 -0700 Subject: NORSPEC-189 restore old mat param update registration --- indra/newview/llvovolume.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c3c6747e99..d8f1896654 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1973,7 +1973,7 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) return res; } -void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te) +void LLVOVolume::setTEMaterialParamsCallbackTE(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te) { LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL; if (te >= getNumTEs()) @@ -1986,6 +1986,18 @@ void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, co } } +void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams) +{ + LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << LL_ENDL; + for (U8 i = 0; i < getNumTEs(); i++) + { + if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID))) + { + setTEMaterialParams(i, pMaterialParams); + } + } +} + S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { S32 res = LLViewerObject::setTEMaterialID(te, pMaterialID); @@ -1996,7 +2008,11 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; if (res) { +#if USE_TE_SPECIFIC_REGISTRATION LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3)); +#else + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); +#endif setChanged(TEXTURE); if (!mDrawable.isNull()) { @@ -5553,4 +5569,3 @@ void LLHUDPartition::shift(const LLVector4a &offset) //HUD objects don't shift with region crossing. That would be silly. } - -- cgit v1.2.3 From a1a8048d3e1494d50f23bc1b6c66a238128fe82b Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 20 May 2013 16:24:58 -0700 Subject: NORSPEC-188 avoid removing 'Use Texture' item when cancelling from picker back to having prev texture --- indra/newview/llvovolume.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index d8f1896654..0a25a57f1b 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1980,7 +1980,7 @@ void LLVOVolume::setTEMaterialParamsCallbackTE(const LLMaterialID &pMaterialID, return; LLTextureEntry* texture_entry = getTE(te); - if (texture_entry) + if (texture_entry && (texture_entry->getMaterialID() == pMaterialID)) { setTEMaterialParams(te, pMaterialParams); } @@ -2009,7 +2009,7 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) if (res) { #if USE_TE_SPECIFIC_REGISTRATION - LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3)); + LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, this, _1, _2, _3)); #else LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); #endif -- cgit v1.2.3 From 756c3d30eee4700c3edb1cb55c03bf5f51d648a7 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 20 May 2013 17:35:16 -0700 Subject: NORSPEC-191 make alpha masked rigged faces appear with deferred rendering on and off --- indra/newview/llvovolume.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 0a25a57f1b..caf4fe9383 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4531,7 +4531,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_GLOW); } - LLMaterial* mat = LLPipeline::sRenderDeferred ? te->getMaterialParams().get() : NULL; + LLMaterial* mat = te->getMaterialParams().get(); if (mat) { @@ -4550,6 +4550,13 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); } } + else if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + { + // This feels unclean, but is the only way to get alpha masked rigged stuff to show up + // with masking correctly in both deferred and non-deferred paths. NORSPEC-191 + // + pool->addRiggedFace(facep, LLPipeline::sRenderDeferred ? LLDrawPoolAvatar::RIGGED_MATERIAL_ALPHA_MASK : LLDrawPoolAvatar::RIGGED_ALPHA); + } else { U32 mask = mat->getShaderMask(); -- cgit v1.2.3 From 03eb406d05e6d53c202c26e564c104bcf4bef4d1 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 22 May 2013 07:06:22 -0700 Subject: NORSPEC-203 fix handling of objs with materials due to alpha mode in non-deferred --- indra/newview/llvovolume.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index caf4fe9383..ca7849fdad 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5368,6 +5368,28 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: registerFace(group, facep, pass[mask]); } } + else if (mat) + { + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + { + registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK); + } + else if (is_alpha || (te->getColor().mV[3] < 0.999f)) + { + registerFace(group, facep, LLRenderPass::PASS_ALPHA); + } + else if (gPipeline.canUseVertexShaders() + && LLPipeline::sRenderBump + && te->getShiny() + && can_be_shiny) + { + registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_SHINY : LLRenderPass::PASS_SHINY); + } + else + { + registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT : LLRenderPass::PASS_SIMPLE); + } + } else if (is_alpha) { // can we safely treat this as an alpha mask? -- cgit v1.2.3 From 9ef98bece29b6740e4f779ab6a3534b5b1e7f974 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 23 May 2013 10:42:32 -0700 Subject: NORSPEC-193 NORSPEC-161 make legacy shiny a batch breaker when materials are in play --- indra/newview/llvovolume.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index ca7849fdad..24275c57e0 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4102,6 +4102,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 bump = (type == LLRenderPass::PASS_BUMP || type == LLRenderPass::PASS_POST_BUMP) ? facep->getTextureEntry()->getBumpmap() : 0; + U8 shiny = facep->getTextureEntry()->getShiny(); + LLViewerTexture* tex = facep->getTexture(); U8 index = facep->getTextureIndex(); @@ -4162,6 +4164,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mTextureMatrix == tex_mat && draw_vec[idx]->mModelMatrix == model_mat && draw_vec[idx]->mMaterial == mat && + (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy shiny is different draw_vec[idx]->mShaderMask == shader_mask) { draw_vec[idx]->mCount += facep->getIndicesCount(); @@ -4191,7 +4194,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; - U8 shiny = facep->getTextureEntry()->getShiny(); + draw_info->mShiny = shiny; + float alpha[4] = { 0.00f, -- cgit v1.2.3 From 933d4c40f42babf74320dca70ac08009b8577fa1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 23 May 2013 12:47:52 -0500 Subject: NORSPEC-198, NORSPEC-176, NORSPEC-106 WIP Fix for various fullbright/shiny descrepencies. --- indra/newview/llvovolume.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index caf4fe9383..7fa3865675 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4067,7 +4067,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, BOOL fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) || (type == LLRenderPass::PASS_INVISIBLE) || (type == LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK) || - (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)); + (type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)) || + (facep->getTextureEntry()->getFullbright()); if (!fullbright && type != LLRenderPass::PASS_GLOW && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_NORMAL)) { @@ -5314,11 +5315,21 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (mat && LLPipeline::sRenderDeferred && !hud_group) { + bool material_pass = false; + if (fullbright) { if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { - registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); + if (mat->getEnvironmentIntensity() > 0 || + te->getShiny() > 0) + { + material_pass = true; + } + else + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); + } } else if (is_alpha) { @@ -5326,7 +5337,15 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else { - registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + if (mat->getEnvironmentIntensity() > 0 || + te->getShiny() > 0) + { + material_pass = true; + } + else + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + } } } else if (no_materials) @@ -5338,6 +5357,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: registerFace(group, facep, LLRenderPass::PASS_ALPHA); } else + { + material_pass = true; + } + + if (material_pass) { U32 pass[] = { -- cgit v1.2.3 From 9030ecec062cd31ffa6eeffc409eeccb0ad4baa5 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 23 May 2013 10:55:41 -0700 Subject: NORSPEC-193 NORSPEC-161 add new batch break criterion to CompareBatchBreakerModified and add shortcut for materials info dump --- indra/newview/llvovolume.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 24275c57e0..91a5a082c1 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5003,6 +5003,10 @@ struct CompareBatchBreakerModified { return lte->getMaterialParams() < rte->getMaterialParams(); } + else if (LLPipeline::sRenderDeferred && (lte->getMaterialParams() == rte->getMaterialParams()) && (lte->getShiny() != rte->getShiny())) + { + return lte->getShiny() < rte->getShiny(); + } else { return lhs->getTexture() < rhs->getTexture(); -- cgit v1.2.3 From 260afbcece7db436af411abcba28495bf99fa08b Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 23 May 2013 16:24:34 -0700 Subject: NORSPEC-192 fix more incorrect batching, fix bug in reflecting normal map state in build tool, and protect against callback crashes when switching regions --- indra/newview/llvovolume.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 91a5a082c1..5663d474bd 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4109,6 +4109,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 index = facep->getTextureIndex(); LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get(); + LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID(); bool batchable = false; @@ -4159,12 +4160,13 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mEnd - draw_vec[idx]->mStart + facep->getGeomCount() <= (U32) gGLManager.mGLMaxVertexRange && draw_vec[idx]->mCount + facep->getIndicesCount() <= (U32) gGLManager.mGLMaxIndexRange && #endif + draw_vec[idx]->mMaterial == mat && + draw_vec[idx]->mMaterialID == mat_id && draw_vec[idx]->mFullbright == fullbright && - draw_vec[idx]->mBump == bump && + draw_vec[idx]->mBump == bump && + (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different draw_vec[idx]->mTextureMatrix == tex_mat && draw_vec[idx]->mModelMatrix == model_mat && - draw_vec[idx]->mMaterial == mat && - (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy shiny is different draw_vec[idx]->mShaderMask == shader_mask) { draw_vec[idx]->mCount += facep->getIndicesCount(); @@ -4213,6 +4215,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (mat) { + draw_info->mMaterialID = mat_id; + // We have a material. Update our draw info accordingly. if (!mat->getSpecularID().isNull()) -- cgit v1.2.3 From 66e53759679910e2c3720cda92ba6e917c66d12c Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 24 May 2013 15:07:23 -0700 Subject: NORSPEC-96 NORSPEC-189 another attempt at planar stretch across all 3 channels and make the materials CB use a UUID instead of this pointer for safety --- indra/newview/llvovolume.cpp | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 5663d474bd..7ce0343022 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1973,27 +1973,19 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) return res; } -void LLVOVolume::setTEMaterialParamsCallbackTE(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te) +void LLVOVolume::setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te) { - LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL; - if (te >= getNumTEs()) - return; - - LLTextureEntry* texture_entry = getTE(te); - if (texture_entry && (texture_entry->getMaterialID() == pMaterialID)) + LLVOVolume* pVol = (LLVOVolume*)gObjectList.findObject(objectID); + if (pVol && pVol->getVolume()) { - setTEMaterialParams(te, pMaterialParams); - } -} + LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL; + if (te >= pVol->getNumTEs()) + return; -void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams) -{ - LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << LL_ENDL; - for (U8 i = 0; i < getNumTEs(); i++) - { - if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID))) + LLTextureEntry* texture_entry = pVol->getTE(te); + if (texture_entry && (texture_entry->getMaterialID() == pMaterialID)) { - setTEMaterialParams(i, pMaterialParams); + pVol->setTEMaterialParams(te, pMaterialParams); } } } @@ -2008,11 +2000,8 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; if (res) { -#if USE_TE_SPECIFIC_REGISTRATION - LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, this, _1, _2, _3)); -#else - LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2)); -#endif + LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, getID(), _1, _2, _3)); + setChanged(TEXTURE); if (!mDrawable.isNull()) { -- cgit v1.2.3 From 43bb0349554dc82a47ad109725da66eac843389f Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 24 May 2013 15:15:55 -0700 Subject: NORSPEC-189 throw caution to the wind and avoid using getVolume() check which has deleterious effects on materials rendering --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 7ce0343022..5b69f80dc1 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1976,7 +1976,7 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow) void LLVOVolume::setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te) { LLVOVolume* pVol = (LLVOVolume*)gObjectList.findObject(objectID); - if (pVol && pVol->getVolume()) + if (pVol) { LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL; if (te >= pVol->getNumTEs()) -- cgit v1.2.3 From 743d1a777e5c2827d50051c3f5e0942a870a6ff9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 29 May 2013 18:48:09 -0500 Subject: NORSPEC-198, NORSPEC-176, NORSPEC-106, NORSPEC-202 et al -- Material matrix testing based overhaul WIP Reviewed by Graham --- indra/newview/llvovolume.cpp | 69 +++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 26 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 3aef88ed94..367edd21c6 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4534,34 +4534,46 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLMaterial* mat = te->getMaterialParams().get(); - if (mat) + if (mat && LLPipeline::sRenderDeferred) { - if (te->getFullbright()) + U8 alpha_mode = mat->getDiffuseAlphaMode(); + bool is_alpha = type == LLDrawPool::POOL_ALPHA && + (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND || + te->getColor().mV[3] < 0.999f); + + if (is_alpha) + { //this face needs alpha blending, override alpha mode + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + U32 mask = mat->getShaderMask(alpha_mode); + pool->addRiggedFace(facep, mask); + } + else if (mat) + { + bool fullbright = te->getFullbright(); + bool is_alpha = type == LLDrawPool::POOL_ALPHA; + U8 mode = mat->getDiffuseAlphaMode(); + bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || + mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; + + if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && te->getColor().mV[3] >= 0.999f) { - if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); - } - else if (type == LLDrawPool::POOL_ALPHA) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); - } - else - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); - } + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE); + } + else if (is_alpha || (te->getColor().mV[3] < 0.999f)) + { + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA : LLDrawPoolAvatar::RIGGED_ALPHA); } - else if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + else if (gPipeline.canUseVertexShaders() + && LLPipeline::sRenderBump + && te->getShiny() + && can_be_shiny) { - // This feels unclean, but is the only way to get alpha masked rigged stuff to show up - // with masking correctly in both deferred and non-deferred paths. NORSPEC-191 - // - pool->addRiggedFace(facep, LLPipeline::sRenderDeferred ? LLDrawPoolAvatar::RIGGED_MATERIAL_ALPHA_MASK : LLDrawPoolAvatar::RIGGED_ALPHA); + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY : LLDrawPoolAvatar::RIGGED_SHINY); } else { - U32 mask = mat->getShaderMask(); - pool->addRiggedFace(facep, mask); + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE); } } else @@ -5321,14 +5333,13 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { - if (mat->getEnvironmentIntensity() > 0 || - te->getShiny() > 0) + if (te->getColor().mV[3] >= 0.999f) { material_pass = true; } else { - registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); + registerFace(group, facep, LLRenderPass::PASS_ALPHA); } } else if (is_alpha) @@ -5394,7 +5405,13 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else if (mat) { - if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + U8 mode = mat->getDiffuseAlphaMode(); + if (te->getColor().mV[3] < 0.999f) + { + mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + + if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK); } @@ -5533,7 +5550,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright); facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE); - if (!force_simple && te->getBumpmap() && LLPipeline::sRenderBump) + if (!force_simple && te->getBumpmap() && !mat && LLPipeline::sRenderBump) { registerFace(group, facep, LLRenderPass::PASS_BUMP); } -- cgit v1.2.3 From c3f14b915c38a4978745f12f1f816572cce4b5a0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 3 Jun 2013 12:50:48 -0500 Subject: NORSPEC-229 Fix for bad binormals on mirrored surfaces (use tangent calculator instead of binormal calculator, convert binormal centric code to tangent centric) --- indra/newview/llvovolume.cpp | 86 +++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 36 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b107f43e4c..677d79d601 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1046,7 +1046,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo { //already cached break; } - volume->genBinormals(i); + volume->genTangents(i); LLFace::cacheFaceInVRAM(face); } } @@ -3612,8 +3612,8 @@ LLVector3 LLVOVolume::volumeDirectionToAgent(const LLVector3& dir) const } -BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face, BOOL pick_transparent, S32 *face_hitp, - LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) +BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, S32 *face_hitp, + LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent) { if (!mbCanSelect @@ -3645,23 +3645,25 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (volume) { - LLVector3 v_start, v_end, v_dir; - + LLVector4a local_start = start; + LLVector4a local_end = end; + if (transform) { - v_start = agentPositionToVolume(start); - v_end = agentPositionToVolume(end); - } - else - { - v_start = start; - v_end = end; - } + LLVector3 v_start(start.getF32ptr()); + LLVector3 v_end(end.getF32ptr()); - LLVector3 p; - LLVector3 n; + v_start = agentPositionToVolume(v_start); + v_end = agentPositionToVolume(v_end); + + local_start.load3(v_start.mV); + local_end.load3(v_end.mV); + } + + LLVector4a p; + LLVector4a n; LLVector2 tc; - LLVector3 bn; + LLVector4a tn; if (intersection != NULL) { @@ -3678,9 +3680,9 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e n = *normal; } - if (bi_normal != NULL) + if (tangent != NULL) { - bn = *bi_normal; + tn = *tangent; } S32 face_hit = -1; @@ -3706,8 +3708,8 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e continue; } - face_hit = volume->lineSegmentIntersect(v_start, v_end, i, - &p, &tc, &n, &bn); + face_hit = volume->lineSegmentIntersect(local_start, local_end, i, + &p, &tc, &n, &tn); if (face_hit >= 0 && mDrawable->getNumFaces() > face_hit) { @@ -3716,7 +3718,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (face && (pick_transparent || !face->getTexture() || !face->getTexture()->hasGLTexture() || face->getTexture()->getMask(face->surfaceToTexture(tc, p, n)))) { - v_end = p; + local_end = p; if (face_hitp != NULL) { *face_hitp = face_hit; @@ -3726,7 +3728,9 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e { if (transform) { - *intersection = volumePositionToAgent(p); // must map back to agent space + LLVector3 v_p(p.getF32ptr()); + + intersection->load3(volumePositionToAgent(v_p).mV); // must map back to agent space } else { @@ -3738,27 +3742,37 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e { if (transform) { - *normal = volumeDirectionToAgent(n); + LLVector3 v_n(n.getF32ptr()); + normal->load3(volumeDirectionToAgent(v_n).mV); } else { *normal = n; } - (*normal).normVec(); + (*normal).normalize3fast(); } - if (bi_normal != NULL) + if (tangent != NULL) { if (transform) { - *bi_normal = volumeDirectionToAgent(bn); + LLVector3 v_tn(tn.getF32ptr()); + + LLVector4a trans_tangent; + trans_tangent.load3(volumeDirectionToAgent(v_tn).mV); + + LLVector4Logical mask; + mask.clear(); + mask.setElement<3>(); + + tangent->setSelectWithMask(mask, tn, trans_tangent); } else { - *bi_normal = bn; + *tangent = tn; } - (*bi_normal).normVec(); + (*tangent).normalize3fast(); } if (tex_coord != NULL) @@ -4038,7 +4052,7 @@ static LLFastTimer::DeclareTimer FTM_REGISTER_FACE("Register Face"); void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type) { LLFastTimer t(FTM_REGISTER_FACE); - if (type == LLRenderPass::PASS_ALPHA && facep->getTextureEntry()->getMaterialParams().notNull() && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_BINORMAL)) + if (type == LLRenderPass::PASS_ALPHA && facep->getTextureEntry()->getMaterialParams().notNull() && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_TANGENT)) { LL_WARNS("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL; } @@ -4747,11 +4761,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (mat->getNormalID().notNull()) { if (mat->getSpecularID().notNull()) - { //has normal and specular maps (needs texcoord1, texcoord2, and binormal) + { //has normal and specular maps (needs texcoord1, texcoord2, and tangent) normspec_faces.push_back(facep); } else - { //has normal map (needs texcoord1 and binormal) + { //has normal map (needs texcoord1 and tangent) norm_faces.push_back(facep); } } @@ -4765,7 +4779,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } } else if (te->getBumpmap()) - { //needs normal + binormal + { //needs normal + tangent bump_faces.push_back(facep); } else if (te->getShiny() || !te->getFullbright()) @@ -4781,7 +4795,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) else { if (te->getBumpmap() && LLPipeline::sRenderBump) - { //needs normal + binormal + { //needs normal + tangent bump_faces.push_back(facep); } else if ((te->getShiny() && LLPipeline::sRenderBump) || @@ -4822,7 +4836,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) U32 bump_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR; U32 fullbright_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR; - U32 norm_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_BINORMAL; + U32 norm_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TANGENT; U32 normspec_mask = norm_mask | LLVertexBuffer::MAP_TEXCOORD2; U32 spec_mask = simple_mask | LLVertexBuffer::MAP_TEXCOORD2; @@ -4841,9 +4855,9 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (batch_textures) { - bump_mask = bump_mask | LLVertexBuffer::MAP_BINORMAL; + bump_mask = bump_mask | LLVertexBuffer::MAP_TANGENT; simple_mask = simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; - alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2; + alpha_mask = alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2; fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX; } -- cgit v1.2.3 From 0073884f837d1049499f85007e3cc5a3e4beafe0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 10 Jun 2013 13:00:47 -0500 Subject: NORSPEC-247 Fix for rigged attachments with alpha masking on occluding alpha object when 100% transparent. --- indra/newview/llvovolume.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 677d79d601..f24ee435c0 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4548,6 +4548,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (mat && LLPipeline::sRenderDeferred) { U8 alpha_mode = mat->getDiffuseAlphaMode(); + bool is_alpha = type == LLDrawPool::POOL_ALPHA && (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND || te->getColor().mV[3] < 0.999f); @@ -4556,8 +4557,12 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { //this face needs alpha blending, override alpha mode alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; } - U32 mask = mat->getShaderMask(alpha_mode); - pool->addRiggedFace(facep, mask); + + if (!is_alpha || te->getColor().mV[3] > 0.f) // //only add the face if it will actually be visible + { + U32 mask = mat->getShaderMask(alpha_mode); + pool->addRiggedFace(facep, mask); + } } else if (mat) { @@ -4573,7 +4578,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } else if (is_alpha || (te->getColor().mV[3] < 0.999f)) { - pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA : LLDrawPoolAvatar::RIGGED_ALPHA); + if (te->getColor().mV[3] > 0.f) + { + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA : LLDrawPoolAvatar::RIGGED_ALPHA); + } } else if (gPipeline.canUseVertexShaders() && LLPipeline::sRenderBump -- cgit v1.2.3 From a4676adebbfb35a0d126c5ae78cd38edb816f6da Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 15:49:09 -0700 Subject: NORSPEC-251 fix issues with not binning objects changed from having a material to using legacy bumps causing incorrect rendering --- indra/newview/llvovolume.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 677d79d601..19754774db 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4105,7 +4105,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, //drawable->getVObj()->setDebugText(llformat("%d", drawable->isState(LLDrawable::ANIMATED_CHILD))); U8 bump = (type == LLRenderPass::PASS_BUMP || type == LLRenderPass::PASS_POST_BUMP) ? facep->getTextureEntry()->getBumpmap() : 0; - U8 shiny = facep->getTextureEntry()->getShiny(); LLViewerTexture* tex = facep->getTexture(); @@ -4115,6 +4114,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get(); LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID(); + mat = mat_id.isNull() ? NULL : mat; + bool batchable = false; U32 shader_mask = 0xFFFFFFFF; //no shader @@ -4200,6 +4201,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; + draw_info->mBump = bump; draw_info->mShiny = shiny; float alpha[4] = @@ -4544,6 +4546,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } LLMaterial* mat = te->getMaterialParams().get(); + mat = te->getMaterialID().isNull() ? NULL : mat; if (mat && LLPipeline::sRenderDeferred) { @@ -4755,7 +4758,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (gPipeline.canUseWindLightShadersOnObjects() && LLPipeline::sRenderBump) { - if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull()) + if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull() && !te->getMaterialID().isNull()) { LLMaterial* mat = te->getMaterialParams().get(); if (mat->getNormalID().notNull()) @@ -5332,6 +5335,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: LLMaterial* mat = te->getMaterialParams().get(); + mat = te->getMaterialID().isNull() ? NULL : mat; + bool can_be_shiny = true; if (mat) { @@ -5489,7 +5494,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: registerFace(group, facep, LLRenderPass::PASS_POST_BUMP); } } - else if (te->getBumpmap() && !te->getMaterialParams()) + else if (te->getBumpmap() && !mat) { //register in deferred bump pass registerFace(group, facep, LLRenderPass::PASS_BUMP); } @@ -5531,7 +5536,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else { - if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() && !te->getMaterialParams())) + if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() && !mat)) { //non-shiny or fullbright deferred bump registerFace(group, facep, LLRenderPass::PASS_BUMP); } -- cgit v1.2.3 From 96f7f6d01bb652fb049cd64b55b2933aa436f9d2 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 11 Jun 2013 17:18:20 -0700 Subject: NORSPEC-258 and NORSPEC-226 make tex picker close refresh build tool UI correctly and fix issues with transition from no-bumps to normal maps --- indra/newview/llvovolume.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index bd3be5b9cf..0aa56fcc0f 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2002,10 +2002,11 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) { LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, getID(), _1, _2, _3)); - setChanged(TEXTURE); + setChanged(ALL_CHANGED); if (!mDrawable.isNull()) { gPipeline.markTextured(mDrawable); + gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL); } mFaceMappingChanged = TRUE; } @@ -2018,10 +2019,11 @@ S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialPa LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) << LL_ENDL; - setChanged(TEXTURE); + setChanged(ALL_CHANGED); if (!mDrawable.isNull()) { gPipeline.markTextured(mDrawable); + gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL); } mFaceMappingChanged = TRUE; return TEM_CHANGE_TEXTURE; @@ -4114,8 +4116,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get(); LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID(); - mat = mat_id.isNull() ? NULL : mat; - bool batchable = false; U32 shader_mask = 0xFFFFFFFF; //no shader @@ -4546,7 +4546,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } LLMaterial* mat = te->getMaterialParams().get(); - mat = te->getMaterialID().isNull() ? NULL : mat; if (mat && LLPipeline::sRenderDeferred) { @@ -4766,7 +4765,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (gPipeline.canUseWindLightShadersOnObjects() && LLPipeline::sRenderBump) { - if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull() && !te->getMaterialID().isNull()) + if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull()) { LLMaterial* mat = te->getMaterialParams().get(); if (mat->getNormalID().notNull()) @@ -5343,8 +5342,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: LLMaterial* mat = te->getMaterialParams().get(); - mat = te->getMaterialID().isNull() ? NULL : mat; - bool can_be_shiny = true; if (mat) { -- cgit v1.2.3 From d2b253f1f6072beead770519849ad3b18a1a4359 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 12 Jun 2013 09:16:19 -0700 Subject: Changes to protect against use of normalize3fast on degenerate vectors --- indra/newview/llvovolume.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 0aa56fcc0f..8962d7cadf 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3751,7 +3751,8 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& { *normal = n; } - + // guard against NaNs in normalize below + llassert(normal->dot3(*normal).getF32() > F_APPROXIMATELY_ZERO); (*normal).normalize3fast(); } @@ -3774,6 +3775,8 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& { *tangent = tn; } + // guard against NaNs in normalize below + llassert(tangent->dot3(*tangent).getF32() > F_APPROXIMATELY_ZERO); (*tangent).normalize3fast(); } -- cgit v1.2.3 From 3eb460f772e8a1cf45d53ed1d06206bfd74a780a Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 12 Jun 2013 12:25:30 -0700 Subject: Remove NaN guards from vopartgroup and volume code --- indra/newview/llvovolume.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8962d7cadf..e74d2d4b98 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3751,8 +3751,6 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& { *normal = n; } - // guard against NaNs in normalize below - llassert(normal->dot3(*normal).getF32() > F_APPROXIMATELY_ZERO); (*normal).normalize3fast(); } @@ -3775,8 +3773,6 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& { *tangent = tn; } - // guard against NaNs in normalize below - llassert(tangent->dot3(*tangent).getF32() > F_APPROXIMATELY_ZERO); (*tangent).normalize3fast(); } -- cgit v1.2.3 From b60ea52902c86302bc39bb3812b4d0711eaa9bef Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 12 Jun 2013 14:08:16 -0700 Subject: NORSPEC-251 fixed and 258 not regressed --- indra/newview/llvovolume.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e74d2d4b98..83ffd3e695 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4115,6 +4115,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get(); LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID(); + mat = mat_id.isNull() ? NULL : mat; + bool batchable = false; U32 shader_mask = 0xFFFFFFFF; //no shader @@ -4545,6 +4547,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } LLMaterial* mat = te->getMaterialParams().get(); + mat = te->getMaterialID().isNull() ? NULL : mat; if (mat && LLPipeline::sRenderDeferred) { @@ -4764,7 +4767,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (gPipeline.canUseWindLightShadersOnObjects() && LLPipeline::sRenderBump) { - if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull()) + if (LLPipeline::sRenderDeferred && te->getMaterialParams().notNull() && !te->getMaterialID().isNull()) { LLMaterial* mat = te->getMaterialParams().get(); if (mat->getNormalID().notNull()) @@ -5340,6 +5343,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE; LLMaterial* mat = te->getMaterialParams().get(); + mat = te->getMaterialID().isNull() ? NULL : mat; bool can_be_shiny = true; if (mat) -- cgit v1.2.3 From f04e9363b9daca52c1fd2e675c2646f7e1d05054 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 14 Jun 2013 09:41:33 -0700 Subject: NORSPEC-266 fix issues with observer feedback on edits of material map parameters --- indra/newview/llvovolume.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 83ffd3e695..007c2b9003 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4115,8 +4115,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get(); LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID(); - mat = mat_id.isNull() ? NULL : mat; - bool batchable = false; U32 shader_mask = 0xFFFFFFFF; //no shader @@ -4547,7 +4545,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } LLMaterial* mat = te->getMaterialParams().get(); - mat = te->getMaterialID().isNull() ? NULL : mat; if (mat && LLPipeline::sRenderDeferred) { @@ -5343,7 +5340,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: BOOL is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? TRUE : FALSE; LLMaterial* mat = te->getMaterialParams().get(); - mat = te->getMaterialID().isNull() ? NULL : mat; bool can_be_shiny = true; if (mat) @@ -5353,6 +5349,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; } + bool use_legacy_bump = te->getBumpmap() && (!mat || mat->getNormalID().isNull()); + if (mat && LLPipeline::sRenderDeferred && !hud_group) { bool material_pass = false; @@ -5395,6 +5393,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { registerFace(group, facep, LLRenderPass::PASS_ALPHA); } + else if (use_legacy_bump) + { + // we have a material AND legacy bump settings, but no normal map + registerFace(group, facep, LLRenderPass::PASS_BUMP); + } else { material_pass = true; @@ -5502,7 +5505,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: registerFace(group, facep, LLRenderPass::PASS_POST_BUMP); } } - else if (te->getBumpmap() && !mat) + else if (use_legacy_bump) { //register in deferred bump pass registerFace(group, facep, LLRenderPass::PASS_BUMP); } @@ -5537,14 +5540,14 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); } - if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && te->getBumpmap()) + if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && use_legacy_bump) { //if this is the deferred render and a bump map is present, register in post deferred bump registerFace(group, facep, LLRenderPass::PASS_POST_BUMP); } } else { - if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && (te->getBumpmap() && !mat)) + if (LLPipeline::sRenderDeferred && LLPipeline::sRenderBump && use_legacy_bump) { //non-shiny or fullbright deferred bump registerFace(group, facep, LLRenderPass::PASS_BUMP); } @@ -5578,7 +5581,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright); facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE); - if (!force_simple && te->getBumpmap() && !mat && LLPipeline::sRenderBump) + if (!force_simple && LLPipeline::sRenderBump && use_legacy_bump) { registerFace(group, facep, LLRenderPass::PASS_BUMP); } -- cgit v1.2.3