diff options
Diffstat (limited to 'indra')
21 files changed, 290 insertions, 381 deletions
diff --git a/indra/lib/python/indra/util/llversion.py b/indra/lib/python/indra/util/llversion.py deleted file mode 100755 index ba6f567b60..0000000000 --- a/indra/lib/python/indra/util/llversion.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python -"""\ -@file llversion.py -@brief Parses llcommon/llversionserver.h and llcommon/llversionviewer.h - for the version string and channel string. - Parses hg info for branch and revision. - -$LicenseInfo:firstyear=2006&license=mit$ - -Copyright (c) 2006-2009, Linden Research, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -$/LicenseInfo$ -""" - -import re, sys, os, subprocess - -# Methods for gathering version information from -# llversionviewer.h and llversionserver.h - -def get_src_root(): - indra_lib_python_indra_path = os.path.dirname(__file__) - return os.path.abspath(os.path.realpath(indra_lib_python_indra_path + "/../../../../../")) - -def get_version_file_contents(version_type): - filepath = get_src_root() + '/indra/llcommon/llversion%s.h' % version_type - file = open(filepath,"r") - file_str = file.read() - file.close() - return file_str - -def get_version(version_type): - file_str = get_version_file_contents(version_type) - m = re.search('const S32 LL_VERSION_MAJOR = (\d+);', file_str) - VER_MAJOR = m.group(1) - m = re.search('const S32 LL_VERSION_MINOR = (\d+);', file_str) - VER_MINOR = m.group(1) - m = re.search('const S32 LL_VERSION_PATCH = (\d+);', file_str) - VER_PATCH = m.group(1) - m = re.search('const S32 LL_VERSION_BUILD = (\d+);', file_str) - VER_BUILD = m.group(1) - version = "%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s" % locals() - return version - -def get_channel(version_type): - file_str = get_version_file_contents(version_type) - m = re.search('const char \* const LL_CHANNEL = "(.+)";', file_str) - return m.group(1) - -def get_viewer_version(): - return get_version('viewer') - -def get_server_version(): - return get_version('server') - -def get_viewer_channel(): - return get_channel('viewer') - -def get_server_channel(): - return get_channel('server') - -# Methods for gathering hg information -def get_hg_repo(): - child = subprocess.Popen(["hg","showconfig","paths.default"], stdout=subprocess.PIPE) - output, error = child.communicate() - status = child.returncode - if status: - print >> sys.stderr, error - sys.exit(1) - if not output: - print >> sys.stderr, 'ERROR: cannot find repo we cloned from' - sys.exit(1) - return output - -def get_hg_changeset(): - # The right thing to do would be to use the *global* revision id: - # "hg id -i" - # For the moment though, we use the parent revision: - child = subprocess.Popen(["hg","parents","--template","{rev}"], stdout=subprocess.PIPE) - output, error = child.communicate() - status = child.returncode - if status: - print >> sys.stderr, error - sys.exit(1) - lines = output.splitlines() - if len(lines) > 1: - print >> sys.stderr, 'ERROR: working directory has %d parents' % len(lines) - return lines[0] - -def using_hg(): - return os.path.isdir(os.path.join(get_src_root(), '.hg')) diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index 8a17819083..93c2f15a53 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -597,19 +597,31 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) norm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); scaled_normals[vert_index_mesh].add(norm); norm = scaled_normals[vert_index_mesh]; + + // guard against degenerate input data before we create NaNs below! + // norm.normalize3fast(); normals[vert_index_mesh] = norm; // calculate new binormals LLVector4a binorm = mMorphData->mBinormals[vert_index_morph]; + + // guard against degenerate input data before we create NaNs below! + // + if (!binorm.isFinite3() || (binorm.dot3(binorm).getF32() <= F_APPROXIMATELY_ZERO)) + { + binorm.set(1,0,0,1); + } + binorm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); scaled_binormals[vert_index_mesh].add(binorm); LLVector4a tangent; tangent.setCross3(scaled_binormals[vert_index_mesh], norm); LLVector4a& normalized_binormal = binormals[vert_index_mesh]; - normalized_binormal.setCross3(norm, tangent); + + normalized_binormal.setCross3(norm, tangent); normalized_binormal.normalize3fast(); - + tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight; } diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h deleted file mode 100755 index 0ea130e86b..0000000000 --- a/indra/llcommon/llversionviewer.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file llversionviewer.h - * @brief - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLVERSIONVIEWER_H -#define LL_LLVERSIONVIEWER_H - -const S32 LL_VERSION_MAJOR = 3; -const S32 LL_VERSION_MINOR = 5; -const S32 LL_VERSION_PATCH = 2; -const S32 LL_VERSION_BUILD = 264760; - -const char * const LL_CHANNEL = "Second Life Developer"; - -#if LL_DARWIN -const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.indra.viewer"; -#endif - -#endif diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 0526793d3a..79d0a44551 100755 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h @@ -46,6 +46,7 @@ class LLRotation; // of this writing, July 08, 2010) about getting it implemented before you resort to // LLVector3/LLVector4. ///////////////////////////////// +class LLVector4a; LL_ALIGN_PREFIX(16) class LLVector4a @@ -236,6 +237,11 @@ public: // Note that this does not consider zero length vectors! inline void normalize3fast(); + // Normalize this vector with respect to the x, y, and z components only. Accurate only to 10-12 bits of precision. W component is destroyed + // Same as above except substitutes default vector contents if the vector is non-finite or degenerate due to zero length. + // + inline void normalize3fast_checked(LLVector4a* d = 0); + // Return true if this vector is normalized with respect to x,y,z up to tolerance inline LLBool32 isNormalized3( F32 tolerance = 1e-3 ) const; diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 40c341bdcd..9575d51bad 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -3.6.0 +3.6.1 diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index d4803f9aed..6f2cfae6d2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -1,46 +1,46 @@ -/**
- * @file postDeferredGammaCorrect.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#extension GL_ARB_texture_rectangle : enable
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-uniform sampler2DRect diffuseRect;
-
-uniform vec2 screen_res;
-VARYING vec2 vary_fragcoord;
-
-uniform float texture_gamma;
-
-void main()
-{
- vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
- frag_color = pow(diff, vec4(texture_gamma, texture_gamma, texture_gamma, 1.0f));
-}
-
+/** + * @file postDeferredGammaCorrect.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#extension GL_ARB_texture_rectangle : enable + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +uniform sampler2DRect diffuseRect; + +uniform vec2 screen_res; +VARYING vec2 vary_fragcoord; + +uniform float texture_gamma; + +void main() +{ + vec4 diff = texture2DRect(diffuseRect, vary_fragcoord); + frag_color = pow(diff, vec4(texture_gamma, texture_gamma, texture_gamma, 1.0f)); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index 14d35d1f0f..6653f57ee1 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -49,38 +49,38 @@ VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; -#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
-vec2 encode_normal(vec3 n)
-{
- float f = sqrt(8 * n.z + 8);
- return n.xy / f + 0.5;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec2 fenc = enc*4-2;
- float f = dot(fenc,fenc);
- float g = sqrt(1-f/4);
- vec3 n;
- n.xy = fenc*g;
- n.z = 1-f/2;
- return n;
-}
+#ifdef SINGLE_FP_ONLY +vec2 encode_normal(vec3 n) +{ + vec2 sn; + sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); + return sn; +} + +vec3 decode_normal (vec2 enc) +{ + vec3 n; + n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); + n.z = sqrt(1.0f - dot(n.xy,n.xy)); + return n; +} +#else +vec2 encode_normal(vec3 n) +{ + float f = sqrt(8 * n.z + 8); + return n.xy / f + 0.5; +} + +vec3 decode_normal (vec2 enc) +{ + vec2 fenc = enc*4-2; + float f = dot(fenc,fenc); + float g = sqrt(1-f/4); + vec3 n; + n.xy = fenc*g; + n.z = 1-f/2; + return n; +} #endif vec4 getPosition(vec2 pos_screen) diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index cfce215faf..01e34ed792 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -66,38 +66,38 @@ uniform float shadow_offset; uniform float spot_shadow_bias; uniform float spot_shadow_offset; -#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
-vec2 encode_normal(vec3 n)
-{
- float f = sqrt(8 * n.z + 8);
- return n.xy / f + 0.5;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec2 fenc = enc*4-2;
- float f = dot(fenc,fenc);
- float g = sqrt(1-f/4);
- vec3 n;
- n.xy = fenc*g;
- n.z = 1-f/2;
- return n;
-}
+#ifdef SINGLE_FP_ONLY +vec2 encode_normal(vec3 n) +{ + vec2 sn; + sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); + return sn; +} + +vec3 decode_normal (vec2 enc) +{ + vec3 n; + n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); + n.z = sqrt(1.0f - dot(n.xy,n.xy)); + return n; +} +#else +vec2 encode_normal(vec3 n) +{ + float f = sqrt(8 * n.z + 8); + return n.xy / f + 0.5; +} + +vec3 decode_normal (vec2 enc) +{ + vec2 fenc = enc*4-2; + float f = dot(fenc,fenc); + float g = sqrt(1-f/4); + vec3 n; + n.xy = fenc*g; + n.z = 1-f/2; + return n; +} #endif vec4 getPosition(vec2 pos_screen) diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 7152a34094..155e289c9d 100755 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -153,7 +153,7 @@ void LLStandardBumpmap::addstandard() gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id)); - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::BOOST_BUMP) ; + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::LOCAL) ; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ; LLStandardBumpmap::sStandardBumpmapCount++; 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/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index fdc1dfd749..16871adc4d 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -335,36 +335,29 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL itMaterial = ret.first; } - // we may have cleared our queues on leaving a region before we recv'd our - // update for this material...too late now! - // - if (isGetPending(region_id, material_id)) - { - - TEMaterialPair te_mat_pair; - te_mat_pair.materialID = material_id; + TEMaterialPair te_mat_pair; + te_mat_pair.materialID = material_id; - U32 i = 0; - while (i < LLTEContents::MAX_TES) + U32 i = 0; + while (i < LLTEContents::MAX_TES) + { + te_mat_pair.te = i++; + get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); + if (itCallbackTE != mGetTECallbacks.end()) { - te_mat_pair.te = i++; - get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); - if (itCallbackTE != mGetTECallbacks.end()) - { - (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); - delete itCallbackTE->second; - mGetTECallbacks.erase(itCallbackTE); - } + (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); + delete itCallbackTE->second; + mGetTECallbacks.erase(itCallbackTE); } + } - get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); - if (itCallback != mGetCallbacks.end()) - { - (*itCallback->second)(material_id, itMaterial->second); + get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id); + if (itCallback != mGetCallbacks.end()) + { + (*itCallback->second)(material_id, itMaterial->second); - delete itCallback->second; - mGetCallbacks.erase(itCallback); - } + delete itCallback->second; + mGetCallbacks.erase(itCallback); } mGetPending.erase(pending_material_t(region_id, material_id)); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c446132289..911af9df04 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -171,6 +171,8 @@ BOOL LLPanelFace::postBuild() mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) ); mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); + mTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); + mTextureCtrl->setFollowsTop(); mTextureCtrl->setFollowsLeft(); mTextureCtrl->setImmediateFilterPermMask(PERM_NONE); @@ -184,6 +186,8 @@ BOOL LLPanelFace::postBuild() mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); + mShinyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); + mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mShinyTextureCtrl->setFollowsTop(); @@ -200,6 +204,8 @@ BOOL LLPanelFace::postBuild() mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) ); mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) ); mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) ); + mBumpyTextureCtrl->setOnCloseCallback( boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2) ); + mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mBumpyTextureCtrl->setFollowsTop(); @@ -321,16 +327,25 @@ void LLPanelFace::sendBump(U32 bumpiness) { LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; bumpytexture_ctrl->clear(); - bumpytexture_ctrl->setImageAssetID(LLUUID()); + bumpytexture_ctrl->setImageAssetID(LLUUID()); } - U8 bump = (U8) bumpiness & TEM_BUMP_MASK; - LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); - updateBumpyControls(bumpiness == BUMPY_TEXTURE, true); LLUUID current_normal_map = bumpytexture_ctrl->getImageAssetID(); + + U8 bump = (U8) bumpiness & TEM_BUMP_MASK; + + // Clear legacy bump to None when using an actual normal map + // + if (!current_normal_map.isNull()) + bump = 0; + + // Set the normal map or reset it to null as appropriate + // LLSelectedTEMaterial::setNormalID(this, current_normal_map); + + LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); } void LLPanelFace::sendTexGen() @@ -348,13 +363,21 @@ void LLPanelFace::sendShiny(U32 shininess) if (shininess < SHINY_TEXTURE) { texture_ctrl->clear(); - texture_ctrl->setImageAssetID(LLUUID()); - - U8 shiny = (U8) shininess & TEM_SHINY_MASK; - LLSelectMgr::getInstance()->selectionSetShiny( shiny ); + texture_ctrl->setImageAssetID(LLUUID()); } - updateShinyControls(!texture_ctrl->getImageAssetID().isNull(), true); - LLSelectedTEMaterial::setSpecularID(this, texture_ctrl->getImageAssetID()); + + LLUUID specmap = getCurrentSpecularMap(); + + U8 shiny = (U8) shininess & TEM_SHINY_MASK; + if (!specmap.isNull()) + shiny = 0; + + LLSelectedTEMaterial::setSpecularID(this, specmap); + + LLSelectMgr::getInstance()->selectionSetShiny( shiny ); + + updateShinyControls(!specmap.isNull(), true); + } void LLPanelFace::sendFullbright() @@ -746,21 +769,18 @@ void LLPanelFace::updateUI() LLUUID norm_map_id = getCurrentNormalMap(); LLCtrlSelectionInterface* combobox_bumpiness = childGetSelectionInterface("combobox bumpiness"); + + bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE; + if (combobox_bumpiness) { - if ((bumpy == BUMPY_TEXTURE) && !norm_map_id.isNull()) - { - combobox_bumpiness->selectNthItem((S32)BUMPY_TEXTURE); - } - else - { - combobox_bumpiness->selectNthItem((S32)((bumpy < BUMPY_TEXTURE) ? bumpy : 0)); - } + combobox_bumpiness->selectNthItem((S32)bumpy); } else { llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; } + getChildView("combobox bumpiness")->setEnabled(editable); getChild<LLUICtrl>("combobox bumpiness")->setTentative(!identical_bumpy); getChildView("label bumpiness")->setEnabled(editable); @@ -832,7 +852,7 @@ void LLPanelFace::updateUI() updateAlphaControls(); - if(texture_ctrl && !texture_ctrl->isPickerShown()) + if(texture_ctrl) { if (identical_diffuse) { @@ -870,8 +890,6 @@ void LLPanelFace::updateUI() if (shinytexture_ctrl) { - // Can't use this test as we can't actually store SHINY_TEXTURE in the TEs *sigh* - // if (identical_spec && (shiny == SHINY_TEXTURE)) { shinytexture_ctrl->setTentative( FALSE ); @@ -892,7 +910,7 @@ void LLPanelFace::updateUI() } } - if (bumpytexture_ctrl && !bumpytexture_ctrl->isPickerShown()) + if (bumpytexture_ctrl) { if (identical_norm && (bumpy == BUMPY_TEXTURE)) { @@ -1796,6 +1814,12 @@ void LLPanelFace::onSelectTexture(const LLSD& data) LLSelectedTEMaterial::setDiffuseAlphaMode(this, getCurrentDiffuseAlphaMode()); } +void LLPanelFace::onCloseTexturePicker(const LLSD& data) +{ + LL_DEBUGS("Materials") << data << LL_ENDL; + updateUI(); +} + void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; @@ -1805,7 +1829,8 @@ void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) void LLPanelFace::onCommitNormalTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - sendBump(getCurrentNormalMap().isNull() ? 0 : BUMPY_TEXTURE); + LLUUID nmap_id = getCurrentNormalMap(); + sendBump(nmap_id.isNull() ? 0 : BUMPY_TEXTURE); } void LLPanelFace::onCancelSpecularTexture(const LLSD& data) @@ -1835,7 +1860,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 @@ -1927,7 +1953,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 @@ -1935,7 +1961,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 @@ -2300,7 +2326,6 @@ void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_a if (tep) { LLMaterial* mat = tep->getMaterialParams().get(); - mat = (tep->getMaterialID().isNull() ? NULL : mat); if (mat) { diffuse_mode = mat->getDiffuseAlphaMode(); diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index c6a53b6aef..42c1f6bd48 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -132,6 +132,8 @@ protected: void onCancelColor(const LLSD& data); void onSelectColor(const LLSD& data); + void onCloseTexturePicker(const LLSD& data); + // Make UI reflect state of currently selected material (refresh) // and UI mode (e.g. editing normal map v diffuse map) // @@ -259,7 +261,7 @@ private: { LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; LLMaterialMgr::getInstance()->remove(object->getID(),face); - object->setTEMaterialID(face, LLMaterialID::null); + new_material = NULL; } else { @@ -298,7 +300,7 @@ private: if (tep) { material_ptr = tep->getMaterialParams(); - if (!material_ptr.isNull() && !tep->getMaterialID().isNull()) + if (!material_ptr.isNull()) { ret = (material_ptr->*(MaterialGetFunc))(); } diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 9badba4143..4676f7b251 100755 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1040,6 +1040,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p) mDragCallback(NULL), mDropCallback(NULL), mOnCancelCallback(NULL), + mOnCloseCallback(NULL), mOnSelectCallback(NULL), mBorderColor( p.border_color() ), mAllowNoTexture( FALSE ), @@ -1296,6 +1297,10 @@ void LLTextureCtrl::onFloaterClose() if (floaterp) { + if (mOnCloseCallback) + { + mOnCloseCallback(this,LLSD()); + } floaterp->setOwner(NULL); } diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index a7ef1b3f78..ad79042ef1 100755 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -178,7 +178,7 @@ public: void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; } void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; } - + void setOnCloseCallback(commit_callback_t cb) { mOnCloseCallback = cb; } void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; } /* @@ -199,6 +199,7 @@ private: drag_n_drop_callback mDropCallback; commit_callback_t mOnCancelCallback; commit_callback_t mOnSelectCallback; + commit_callback_t mOnCloseCallback; texture_selected_callback mOnTextureSelectedCallback; LLPointer<LLViewerFetchedTexture> mTexturep; LLUIColor mBorderColor; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 23038e529b..f90b35a7bd 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,14 @@ void display_startup() // Update images? //gImageList.updateImages(0.01f); - LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); + + // Written as branch to appease GCC which doesn't like different + // pointer types across ternary ops + // + if (!LLViewerFetchedTexture::sWhiteImagep.isNull()) + { + LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); + } LLGLSDefault gls_default; @@ -148,10 +156,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 +170,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/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 198b13ee06..6f7b2f40e6 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4168,12 +4168,8 @@ void LLViewerObject::changeTENormalMap(S32 index, LLViewerTexture* new_image) { return ; } - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } mTENormalMaps[index] = new_image ; + refreshMaterials(); } void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image) @@ -4182,12 +4178,8 @@ void LLViewerObject::changeTESpecularMap(S32 index, LLViewerTexture* new_image) { return ; } - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } mTESpecularMaps[index] = new_image ; + refreshMaterials(); } S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) @@ -4389,17 +4381,7 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID << ", material " << pMaterialID << LL_ENDL; retval = LLPrimitive::setTEMaterialID(te, pMaterialID); - if (retval) - { - // Kitty would like to know if this is necessary? - // Since we should get a setTEMaterialParams that does it anyway? - // - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } - } + refreshMaterials(); } return retval; } @@ -4414,23 +4396,28 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return 0; } - retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams); - LL_DEBUGS("Material") << "Changing material params for te " << (S32)te - << ", object " << mID - << " (" << retval << ")" - << LL_ENDL; - setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null); - setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null); - - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } + retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams); + LL_DEBUGS("Material") << "Changing material params for te " << (S32)te + << ", object " << mID + << " (" << retval << ")" + << LL_ENDL; + setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null); + setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null); + refreshMaterials(); return retval; } +void LLViewerObject::refreshMaterials() +{ + setChanged(ALL_CHANGED); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + gPipeline.markRebuild(mDrawable,LLDrawable::REBUILD_ALL); + dirtySpatialGroup(TRUE); + } +} S32 LLViewerObject::setTEScale(const U8 te, const F32 s, const F32 t) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 932846c211..ea0d55cda5 100755 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -324,6 +324,12 @@ public: /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow); /*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID); /*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams); + + // Used by Materials update functions to properly kick off rebuilds + // of VBs etc when materials updates require changes. + // + void refreshMaterials(); + /*virtual*/ BOOL setMaterial(const U8 material); virtual void setTEImage(const U8 te, LLViewerTexture *imagep); // Not derived from LLPrimitive virtual void changeTEImage(S32 index, LLViewerTexture* new_image) ; 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 f41057fd1f..3be1f52352 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<LLVOVolume*>(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; @@ -3754,7 +3756,6 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& { *normal = n; } - (*normal).normalize3fast(); } @@ -4119,8 +4120,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 @@ -4551,7 +4550,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } LLMaterial* mat = te->getMaterialParams().get(); - mat = te->getMaterialID().isNull() ? NULL : mat; if (mat && LLPipeline::sRenderDeferred) { @@ -4771,7 +4769,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() && !te->getMaterialID().isNull()) { LLMaterial* mat = te->getMaterialParams().get(); if (mat->getNormalID().notNull()) @@ -5348,8 +5346,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) { @@ -5358,6 +5354,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; @@ -5400,6 +5398,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; @@ -5507,7 +5510,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); } @@ -5542,14 +5545,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); } @@ -5583,7 +5586,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); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1e66c40e87..4801c52209 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1067,12 +1067,6 @@ void LLPipeline::updateRenderDeferred() { //must render glow when rendering deferred since post effect pass is needed to present any lighting at all sRenderGlow = TRUE; } - - if (LLRenderTarget::sUseFBO && !sRenderDeferred) - { //this case should never happen, but some odd startup state can cause it to - LLRenderTarget::sUseFBO = FALSE; - } - } //static @@ -1205,7 +1199,7 @@ void LLPipeline::releaseLUTBuffers() { if (mLightFunc) { - LLImageGL::deleteTextures(LLTexUnit::TT_TEXTURE, GL_R8, 0, 1, &mLightFunc); + LLImageGL::deleteTextures(LLTexUnit::TT_TEXTURE, GL_R16F, 0, 1, &mLightFunc); mLightFunc = 0; } } @@ -1712,6 +1706,8 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima return 0; } + LLMaterial* mat = te->getMaterialParams().get(); + bool color_alpha = te->getColor().mV[3] < 0.999f; bool alpha = color_alpha; if (imagep) @@ -1719,9 +1715,9 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2); } - if (alpha && te->getMaterialParams()) + if (alpha && mat) { - switch (te->getMaterialParams()->getDiffuseAlphaMode()) + switch (mat->getDiffuseAlphaMode()) { case 1: alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool. @@ -1740,10 +1736,11 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima { return LLDrawPool::POOL_ALPHA; } - else if ((te->getBumpmap() || te->getShiny()) && te->getMaterialID().isNull()) + else if ((te->getBumpmap() || te->getShiny()) && (!mat || mat->getNormalID().isNull())) { return LLDrawPool::POOL_BUMP; - } else if (!te->getMaterialID().isNull() && !alpha) + } + else if (mat && !alpha) { return LLDrawPool::POOL_MATERIALS; } @@ -8806,7 +8803,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); @@ -10693,11 +10690,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()); |