summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llface.cpp11
-rwxr-xr-xindra/newview/llpanelface.cpp10
-rwxr-xr-xindra/newview/llviewerdisplay.cpp9
-rwxr-xr-xindra/newview/llvopartgroup.cpp1
-rwxr-xr-xindra/newview/llvovolume.cpp7
-rwxr-xr-xindra/newview/pipeline.cpp6
6 files changed, 31 insertions, 13 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 3e503cb750..f021f4ed0f 100755
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -817,6 +817,12 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
size.mul(scale);
}
+ // Catch potential badness from normalization before it happens
+ //
+ llassert(mat_normal.mMatrix[0].isFinite3() && (mat_normal.mMatrix[0].dot3(mat_normal.mMatrix[0]).getF32() > F_APPROXIMATELY_ZERO));
+ llassert(mat_normal.mMatrix[1].isFinite3() && (mat_normal.mMatrix[1].dot3(mat_normal.mMatrix[1]).getF32() > F_APPROXIMATELY_ZERO));
+ llassert(mat_normal.mMatrix[2].isFinite3() && (mat_normal.mMatrix[2].dot3(mat_normal.mMatrix[2]).getF32() > F_APPROXIMATELY_ZERO));
+
mat_normal.mMatrix[0].normalize3fast();
mat_normal.mMatrix[1].normalize3fast();
mat_normal.mMatrix[2].normalize3fast();
@@ -1910,6 +1916,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
}
binormal.normalize3fast();
+
LLVector2 tc = bump_tc[i];
tc += LLVector2( bump_s_primary_light_ray.dot3(tangent).getF32(), bump_t_primary_light_ray.dot3(binormal).getF32() );
@@ -1996,7 +2003,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
LLFastTimer t(FTM_FACE_GEOM_NORMAL);
mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount, map_range);
F32* normals = (F32*) norm.get();
-
for (S32 i = 0; i < num_vertices; i++)
{
LLVector4a normal;
@@ -2029,7 +2035,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
LLVector4a tangent_out;
mat_normal.rotate(vf.mTangents[i], tangent_out);
tangent_out.normalize3fast();
-
tangent_out.setSelectWithMask(mask, vf.mTangents[i], tangent_out);
tangent_out.store4a(tangents);
@@ -2244,7 +2249,7 @@ BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
dist *= 16.f;
}
- lookAt.normalize3fast() ;
+ lookAt.normalize3fast();
//get area of circle around node
F32 app_angle = atanf((F32) sqrt(size_squared) / dist);
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index b5bb11b90c..f4226c0a7f 100755
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -1817,7 +1817,8 @@ void LLPanelFace::onCommitSpecularTexture( const LLSD& data )
void LLPanelFace::onCommitNormalTexture( const LLSD& data )
{
LL_DEBUGS("Materials") << data << LL_ENDL;
- sendBump(BUMPY_TEXTURE);
+ LLUUID nmap_id = getCurrentNormalMap();
+ sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
}
void LLPanelFace::onCancelSpecularTexture(const LLSD& data)
@@ -1847,7 +1848,8 @@ void LLPanelFace::onSelectSpecularTexture(const LLSD& data)
void LLPanelFace::onSelectNormalTexture(const LLSD& data)
{
LL_DEBUGS("Materials") << data << LL_ENDL;
- sendBump(BUMPY_TEXTURE);
+ LLUUID nmap_id = getCurrentNormalMap();
+ sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE);
}
//static
@@ -1939,7 +1941,7 @@ void LLPanelFace::onCommitMaterialBumpyRot(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
llassert_always(self);
- LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot());
+ LLSelectedTEMaterial::setNormalRotation(self,self->getCurrentBumpyRot() * DEG_TO_RAD);
}
//static
@@ -1947,7 +1949,7 @@ void LLPanelFace::onCommitMaterialShinyRot(LLUICtrl* ctrl, void* userdata)
{
LLPanelFace* self = (LLPanelFace*) userdata;
llassert_always(self);
- LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot());
+ LLSelectedTEMaterial::setSpecularRotation(self,self->getCurrentShinyRot() * DEG_TO_RAD);
}
//static
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 9117bf1c01..d0f24b26a9 100755
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -115,7 +115,8 @@ void render_disconnected_background();
void display_startup()
{
- if ( !gViewerWindow->getActive()
+ if ( !gViewerWindow
+ || !gViewerWindow->getActive()
|| !gViewerWindow->getWindow()->getVisible()
|| gViewerWindow->getWindow()->getMinimized() )
{
@@ -126,7 +127,7 @@ void display_startup()
// Update images?
//gImageList.updateImages(0.01f);
- LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName();
+ LLTexUnit::sWhiteTexture = !LLViewerFetchedTexture::sWhiteImagep.isNull() ? LLViewerFetchedTexture::sWhiteImagep->getTexName() : NULL;
LLGLSDefault gls_default;
@@ -148,10 +149,12 @@ void display_startup()
LLGLSUIDefault gls_ui;
gPipeline.disableLights();
+ if (gViewerWindow)
gViewerWindow->setup2DRender();
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
gGL.color4f(1,1,1,1);
+ if (gViewerWindow)
gViewerWindow->draw();
gGL.flush();
@@ -160,7 +163,9 @@ void display_startup()
LLGLState::checkStates();
LLGLState::checkTextureChannels();
+ if (gViewerWindow && gViewerWindow->getWindow())
gViewerWindow->getWindow()->swapBuffers();
+
glClear(GL_DEPTH_BUFFER_BIT);
}
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index 6a7f26bdb5..43a5ddba42 100755
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -412,6 +412,7 @@ void LLVOPartGroup::getGeometry(S32 idx,
right.setCross3(at, up);
right.normalize3fast();
+
up.setCross3(right, at);
up.normalize3fast();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 0aa56fcc0f..83ffd3e695 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3751,7 +3751,6 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a&
{
*normal = n;
}
-
(*normal).normalize3fast();
}
@@ -4116,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
@@ -4546,6 +4547,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
LLMaterial* mat = te->getMaterialParams().get();
+ mat = te->getMaterialID().isNull() ? NULL : mat;
if (mat && LLPipeline::sRenderDeferred)
{
@@ -4765,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())
@@ -5341,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)
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 05ef8060d4..94152e4afe 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1395,7 +1395,7 @@ void LLPipeline::createLUTBuffers()
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_R16F, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false);
//LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_UNSIGNED_BYTE, lightResX, lightResY, GL_RED, GL_UNSIGNED_BYTE, ls, false);
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
delete [] ls;
}
@@ -8691,7 +8691,7 @@ void LLPipeline::renderDeferredLighting()
gDeferredPostGammaCorrectProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mScreen.getWidth(), mScreen.getHeight());
F32 gamma = 1.0/2.2;
-
+
gDeferredPostGammaCorrectProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, gamma);
gGL.begin(LLRender::TRIANGLE_STRIP);
@@ -10569,11 +10569,13 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
LLVector4a left;
left.load3(camera.getLeftAxis().mV);
left.mul(left);
+ llassert(left.dot3(left).getF32() > F_APPROXIMATELY_ZERO);
left.normalize3fast();
LLVector4a up;
up.load3(camera.getUpAxis().mV);
up.mul(up);
+ llassert(up.dot3(up).getF32() > F_APPROXIMATELY_ZERO);
up.normalize3fast();
tdim.mV[0] = fabsf(half_height.dot3(left).getF32());