summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-03-21 10:51:28 -0500
committerDave Parks <davep@lindenlab.com>2011-03-21 10:51:28 -0500
commitbf3fb2566329a461ebf022a1a05a1fa95faff9aa (patch)
tree364336f1011226e677989463d656155b667ee88e /indra/newview
parent0b4a0f8e234087ae4d6a614c00db9eeea3bec190 (diff)
SH-1069 Fix for bump maps not loading fully -- don't clear bump image list on toggling deferred rendering, but do make sure a loaded callback exists when bump resolution or desired number of components is lacking. Also, subtract radius of prim from distance to face for virtual size calculations (makes heavily tiled textures on largish spheres fully res when appropriate).
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lldrawpoolbump.cpp51
-rw-r--r--indra/newview/llface.cpp1
-rwxr-xr-xindra/newview/pipeline.cpp3
3 files changed, 29 insertions, 26 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 38ff3083ce..bbce847fdc 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -646,6 +646,8 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsi
break;
}
+ llassert(bump);
+
if (bump)
{
if (channel == -2)
@@ -660,7 +662,7 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsi
return TRUE;
}
-
+
return FALSE;
}
@@ -1000,25 +1002,28 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText
}
bump_image_map_t::iterator iter = entries_list->find(src_image->getID());
- if (iter != entries_list->end())
+ if (iter != entries_list->end() && iter->second.notNull())
{
bump = iter->second;
}
else
{
LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
- raw->clear(0x77, 0x77, 0x77, 0xFF);
+ raw->clear(0x77, 0x77, 0xFF, 0xFF);
(*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE);
- (*entries_list)[src_image->getID()]->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
-
- // Note: this may create an LLImageGL immediately
- src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
- src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image
+ }
-// bump_total++;
-// llinfos << "*** Creating " << (void*)bump << " " << bump_total << llendl;
+ if (!src_image->hasCallbacks())
+ { //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again
+ if (src_image->getWidth() != bump->getWidth() ||
+ src_image->getHeight() != bump->getHeight() ||
+ (LLPipeline::sRenderDeferred && bump->getComponents() != 4))
+ {
+ src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
+ src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
+ }
}
}
@@ -1122,10 +1127,18 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries );
bump_image_map_t::iterator iter = entries_list.find(source_asset_id);
- if (iter != entries_list.end() ||
- iter->second.isNull() ||
- iter->second->getWidth() != src->getWidth() ||
- iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
+ if (iter == entries_list.end() ||
+ iter->second.isNull())
+ { //make sure an entry exists for this image
+ LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,1);
+ raw->clear(0x77, 0x77, 0xFF, 0xFF);
+
+ entries_list[src_vi->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE);
+ iter = entries_list.find(src_vi->getID());
+ }
+
+ //if (iter->second->getWidth() != src->getWidth() ||
+ // iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution
{
LLPointer<LLImageRaw> dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1);
U8* dst_data = dst_image->getData();
@@ -1251,18 +1264,10 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
bump->setExplicitFormat(GL_RGBA, GL_RGBA);
bump->createGLTexture(0, nrm_image);
}
-
-
+
iter->second = bump; // derefs (and deletes) old image
//---------------------------------------------------
}
- else
- {
- // entry should have been added in LLBumpImageList::getImage().
-
- // Not a legit assertion - the bump texture could have been flushed by the bump image manager
- //llassert(0);
- }
}
}
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 290115417f..ae455a8287 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1729,6 +1729,7 @@ BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
t.load3(camera->getOrigin().mV);
lookAt.setSub(center, t);
F32 dist = lookAt.getLength3().getF32();
+ dist = llmax(dist-size.getLength3().getF32(), 0.f);
lookAt.normalize3fast() ;
//get area of circle around node
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 24486a7411..6a376554b9 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -825,7 +825,6 @@ void LLPipeline::releaseGLBuffers()
mGlow[i].release();
}
- gBumpImageList.destroyGL();
LLVOAvatar::resetImpostors();
}
@@ -948,8 +947,6 @@ void LLPipeline::createGLBuffers()
addDeferredAttachments(mGIMap);
}
}
-
- gBumpImageList.restoreGL();
}
void LLPipeline::restoreGL()