From ee60a9801b99ddedd520f6867f599c866d60bec7 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Tue, 27 May 2014 20:18:48 -0500 Subject: [PATCH 001/159] Appease some nVidia cards/driversets regarding skinned shaders. --- .../app_settings/shaders/class1/avatar/objectSkinV.glsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 6acbf0aaf..810e4dfd0 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -38,6 +38,10 @@ mat4 getObjectSkinnedTransform() index = max(index, vec4( 0.0)); float sum = (w.x+w.y+w.z+w.w); + if(sum > 0.0) + w*=1.0/sum; + else + w=vec4(FLT_MAX); int i1 = int(index.x); int i2 = int(index.y); @@ -59,7 +63,7 @@ mat4 getObjectSkinnedTransform() ret[0] = vec4(mat[0], 0); ret[1] = vec4(mat[1], 0); ret[2] = vec4(mat[2], 0); - ret[3] = vec4(trans, sum); + ret[3] = vec4(trans, 1.0); return ret; } From 24ca32f9f724d455ad7537d1b1c04ea557e02a78 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Fri, 6 Jun 2014 01:59:04 -0500 Subject: [PATCH 002/159] Replace gluProjectf/gluUnprojectf with own versions. Also changed gGLModelView/gGLProjection and other related matrices to LLMatrix4a. --- LICENSES/LEGAL-intel_matrixlib.txt | 29 ++++ indra/llmath/llmatrix4a.h | 160 ++++++++++++++++++- indra/llmath/llvolume.cpp | 1 - indra/llprimitive/llmodel.cpp | 1 + indra/llrender/llcubemap.cpp | 12 +- indra/llrender/llgl.h | 2 - indra/llrender/llpostprocess.cpp | 11 +- indra/llrender/llrender.cpp | 127 ++++++++++++++- indra/llrender/llrender.h | 15 +- indra/newview/awavefront.h | 3 + indra/newview/llappviewer.cpp | 1 + indra/newview/lldrawpool.cpp | 2 +- indra/newview/lldrawpoolavatar.cpp | 5 +- indra/newview/lldrawpoolbump.cpp | 12 +- indra/newview/lldrawpoolterrain.cpp | 2 +- indra/newview/lldrawpooltree.cpp | 6 +- indra/newview/llhudrender.cpp | 4 +- indra/newview/llselectmgr.cpp | 6 +- indra/newview/llspatialpartition.cpp | 4 +- indra/newview/llviewercamera.cpp | 174 ++++----------------- indra/newview/llviewerdisplay.cpp | 13 +- indra/newview/llviewerprecompiledheaders.h | 2 +- indra/newview/llviewerwindow.cpp | 19 ++- indra/newview/llwaterparammanager.cpp | 8 +- indra/newview/pipeline.cpp | 135 ++++++---------- indra/newview/pipeline.h | 5 +- 26 files changed, 451 insertions(+), 308 deletions(-) create mode 100644 LICENSES/LEGAL-intel_matrixlib.txt diff --git a/LICENSES/LEGAL-intel_matrixlib.txt b/LICENSES/LEGAL-intel_matrixlib.txt new file mode 100644 index 000000000..7ab64f595 --- /dev/null +++ b/LICENSES/LEGAL-intel_matrixlib.txt @@ -0,0 +1,29 @@ +INTEL LICENSE AGREEMENT + +IMPORTANT - READ BEFORE COPYING OR USING. +Do not use or load this library and any associated materials (collectively, +the "Software") until you have read the following terms and conditions. By +loading or using the Software, you agree to the terms of this Agreement. If +you do not wish to so agree, do not use the Software. + +LICENSE: Subject to the restrictions below, Intel Corporation ("Intel") +grants to you the permission to use, copy, distribute and prepare derivative +works of this Software for any purpose and without fee, provided, that +Intel's copyright notice appear in all copies of the Software files. +The distribution of derivative works of the Software is also subject to the +following limitations: you (i) are solely responsible to your customers for +any liability which may arise from the distribution, (ii) do not make any +statement that your product is "certified", or that its performance is +guaranteed, by Intel, and (iii) do not use Intel's name or trademarks to +market your product without written permission. + +EXCLUSION OF ALL WARRANTIES. The Software is provided "AS IS" without any +express or implies warranty of any kind including warranties of +merchantability, noninfringement, or fitness for a particular purpose. +Intel does not warrant or assume responsibility for the accuracy or +completeness of any information contained within the Software. +As this Software is given free of charge, in no event shall Intel be liable +for any damages whatsoever arising out of the use of or inability to use the +Software, even if Intel has been adviced of the possibility of such damages. +Intel does not assume any responsibility for any errors which may appear in +this Software nor any responsibility to update it. diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index 94e5e54af..4f0155498 100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h @@ -36,6 +36,11 @@ class LLMatrix4a public: LL_ALIGN_16(LLVector4a mMatrix[4]); + inline F32* getF32ptr() + { + return mMatrix[0].getF32ptr(); + } + inline void clear() { mMatrix[0].clear(); @@ -44,13 +49,21 @@ public: mMatrix[3].clear(); } + inline void setIdentity() + { + static __m128 ones = _mm_set_ps(1.f,0.f,0.f,1.f); + mMatrix[0] = _mm_movelh_ps(ones,_mm_setzero_ps()); + mMatrix[1] = _mm_movehl_ps(_mm_setzero_ps(),ones); + mMatrix[2] = _mm_movelh_ps(_mm_setzero_ps(),ones); + mMatrix[3] = _mm_movehl_ps(ones,_mm_setzero_ps()); + } + inline void loadu(const LLMatrix4& src) { mMatrix[0] = _mm_loadu_ps(src.mMatrix[0]); mMatrix[1] = _mm_loadu_ps(src.mMatrix[1]); mMatrix[2] = _mm_loadu_ps(src.mMatrix[2]); mMatrix[3] = _mm_loadu_ps(src.mMatrix[3]); - } inline void loadu(const LLMatrix3& src) @@ -61,6 +74,14 @@ public: mMatrix[3].set(0,0,0,1.f); } + inline void loadu(const F32* src) + { + mMatrix[0] = _mm_loadu_ps(src+0); + mMatrix[1] = _mm_loadu_ps(src+4); + mMatrix[2] = _mm_loadu_ps(src+8); + mMatrix[3] = _mm_loadu_ps(src+12); + } + inline void add(const LLMatrix4a& rhs) { mMatrix[0].add(rhs.mMatrix[0]); @@ -84,6 +105,14 @@ public: mMatrix[3].setMul(m.mMatrix[3], s); } + inline void setMul(const LLMatrix4a& m0, const LLMatrix4a& m1) + { + m0.rotate4(m1.mMatrix[0],mMatrix[0]); + m0.rotate4(m1.mMatrix[1],mMatrix[1]); + m0.rotate4(m1.mMatrix[2],mMatrix[2]); + m0.rotate4(m1.mMatrix[3],mMatrix[3]); + } + inline void setLerp(const LLMatrix4a& a, const LLMatrix4a& b, F32 w) { LLVector4a d0,d1,d2,d3; @@ -158,6 +187,135 @@ public: z.add(mMatrix[3]); res.setAdd(x,z); } + + inline void transpose() + { + __m128 q1 = _mm_unpackhi_ps(mMatrix[0],mMatrix[1]); + __m128 q2 = _mm_unpacklo_ps(mMatrix[0],mMatrix[1]); + __m128 q3 = _mm_unpacklo_ps(mMatrix[2],mMatrix[3]); + __m128 q4 = _mm_unpackhi_ps(mMatrix[2],mMatrix[3]); + + mMatrix[0] = _mm_movelh_ps(q2,q3); + mMatrix[1] = _mm_movehl_ps(q3,q2); + mMatrix[2] = _mm_movelh_ps(q1,q4); + mMatrix[3] = _mm_movehl_ps(q4,q1); + } + +// Following procedure adapted from: +// http://software.intel.com/en-us/articles/optimized-matrix-library-for-use-with-the-intel-pentiumr-4-processors-sse2-instructions/ +// +// License/Copyright Statement: +// +// Copyright (c) 2001 Intel Corporation. +// +// Permition is granted to use, copy, distribute and prepare derivative works +// of this library for any purpose and without fee, provided, that the above +// copyright notice and this statement appear in all copies. +// Intel makes no representations about the suitability of this library for +// any purpose, and specifically disclaims all warranties. +// See LEGAL-intel_matrixlib.TXT for all the legal information. + inline float invert() + { + LL_ALIGN_16(const unsigned int Sign_PNNP[4]) = { 0x00000000, 0x80000000, 0x80000000, 0x00000000 }; + + // The inverse is calculated using "Divide and Conquer" technique. The + // original matrix is divide into four 2x2 sub-matrices. Since each + // register holds four matrix element, the smaller matrices are + // represented as a registers. Hence we get a better locality of the + // calculations. + + LLVector4a A = _mm_movelh_ps(mMatrix[0], mMatrix[1]), // the four sub-matrices + B = _mm_movehl_ps(mMatrix[1], mMatrix[0]), + C = _mm_movelh_ps(mMatrix[2], mMatrix[3]), + D = _mm_movehl_ps(mMatrix[3], mMatrix[2]); + LLVector4a iA, iB, iC, iD, // partial inverse of the sub-matrices + DC, AB; + LLSimdScalar dA, dB, dC, dD; // determinant of the sub-matrices + LLSimdScalar det, d, d1, d2; + LLVector4a rd; + + // AB = A# * B + AB.setMul(_mm_shuffle_ps(A,A,0x0F), B); + AB.sub(_mm_mul_ps(_mm_shuffle_ps(A,A,0xA5), _mm_shuffle_ps(B,B,0x4E))); + // DC = D# * C + DC.setMul(_mm_shuffle_ps(D,D,0x0F), C); + DC.sub(_mm_mul_ps(_mm_shuffle_ps(D,D,0xA5), _mm_shuffle_ps(C,C,0x4E))); + + // dA = |A| + dA = _mm_mul_ps(_mm_shuffle_ps(A, A, 0x5F),A); + dA -= _mm_movehl_ps(dA,dA); + // dB = |B| + dB = _mm_mul_ps(_mm_shuffle_ps(B, B, 0x5F),B); + dB -= _mm_movehl_ps(dB,dB); + + // dC = |C| + dC = _mm_mul_ps(_mm_shuffle_ps(C, C, 0x5F),C); + dC -= _mm_movehl_ps(dC,dC); + // dD = |D| + dD = _mm_mul_ps(_mm_shuffle_ps(D, D, 0x5F),D); + dD -= _mm_movehl_ps(dD,dD); + + // d = trace(AB*DC) = trace(A#*B*D#*C) + d = _mm_mul_ps(_mm_shuffle_ps(DC,DC,0xD8),AB); + + // iD = C*A#*B + iD.setMul(_mm_shuffle_ps(C,C,0xA0), _mm_movelh_ps(AB,AB)); + iD.add(_mm_mul_ps(_mm_shuffle_ps(C,C,0xF5), _mm_movehl_ps(AB,AB))); + // iA = B*D#*C + iA.setMul(_mm_shuffle_ps(B,B,0xA0), _mm_movelh_ps(DC,DC)); + iA.add(_mm_mul_ps(_mm_shuffle_ps(B,B,0xF5), _mm_movehl_ps(DC,DC))); + + // d = trace(AB*DC) = trace(A#*B*D#*C) [continue] + d = _mm_add_ps(d, _mm_movehl_ps(d, d)); + d += _mm_shuffle_ps(d, d, 1); + d1 = dA*dD; + d2 = dB*dC; + + // iD = D*|A| - C*A#*B + iD.setSub(_mm_mul_ps(D,_mm_shuffle_ps(dA,dA,0)), iD); + + // iA = A*|D| - B*D#*C; + iA.setSub(_mm_mul_ps(A,_mm_shuffle_ps(dD,dD,0)), iA); + + // det = |A|*|D| + |B|*|C| - trace(A#*B*D#*C) + det = d1+d2-d; + + __m128 is_zero_mask = _mm_cmpeq_ps(det,_mm_setzero_ps()); + rd = _mm_div_ss(_mm_set_ss(1.f),_mm_or_ps(_mm_andnot_ps(is_zero_mask, det), _mm_and_ps(is_zero_mask, _mm_set_ss(1.f)))); +#ifdef ZERO_SINGULAR + rd = _mm_and_ps(_mm_cmpneq_ss(det,_mm_setzero_ps()), rd); +#endif + + // iB = D * (A#B)# = D*B#*A + iB.setMul(D, _mm_shuffle_ps(AB,AB,0x33)); + iB.sub(_mm_mul_ps(_mm_shuffle_ps(D,D,0xB1), _mm_shuffle_ps(AB,AB,0x66))); + // iC = A * (D#C)# = A*C#*D + iC.setMul(A, _mm_shuffle_ps(DC,DC,0x33)); + iC.sub(_mm_mul_ps(_mm_shuffle_ps(A,A,0xB1), _mm_shuffle_ps(DC,DC,0x66))); + + rd = _mm_shuffle_ps(rd,rd,0); + rd = _mm_xor_ps(rd, _mm_load_ps((const float*)Sign_PNNP)); + + // iB = C*|B| - D*B#*A + iB.setSub(_mm_mul_ps(C,_mm_shuffle_ps(dB,dB,0)), iB); + + // iC = B*|C| - A*C#*D; + iC.setSub(_mm_mul_ps(B,_mm_shuffle_ps(dC,dC,0)), iC); + + + // iX = iX / det + iA.mul(rd); + iB.mul(rd); + iC.mul(rd); + iD.mul(rd); + + mMatrix[0] = _mm_shuffle_ps(iA,iB,0x77); + mMatrix[1] = _mm_shuffle_ps(iA,iB,0x22); + mMatrix[2] = _mm_shuffle_ps(iC,iD,0x77); + mMatrix[3] = _mm_shuffle_ps(iC,iD,0x22); + + return *(float*)&det; + } }; #endif diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 82fb7ce34..cff813e03 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -50,7 +50,6 @@ #include "llstl.h" #include "llsdserialize.h" #include "llvector4a.h" -#include "llmatrix4a.h" #include "lltimer.h" #define DEBUG_SILHOUETTE_BINORMALS 0 diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 7312209da..7a103d453 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -31,6 +31,7 @@ #include "LLConvexDecomposition.h" #include "llsdserialize.h" #include "llvector4a.h" +#include "llmatrix4a.h" #if LL_MSVC #pragma warning (push) #pragma warning (disable : 4068) diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 45a3b1817..9a96ed698 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -34,6 +34,7 @@ #include "v3dmath.h" #include "m3math.h" #include "m4math.h" +#include "llmatrix4a.h" #include "llrender.h" #include "llglslshader.h" @@ -265,18 +266,19 @@ void LLCubeMap::setMatrix(S32 stage) gGL.getTexUnit(stage)->activate(); } - LLVector3 x(gGLModelView+0); - LLVector3 y(gGLModelView+4); - LLVector3 z(gGLModelView+8); + LLVector3 x(gGLModelView.mMatrix[0].getF32ptr()); + LLVector3 y(gGLModelView.mMatrix[1].getF32ptr()); + LLVector3 z(gGLModelView.mMatrix[2].getF32ptr()); LLMatrix3 mat3; mat3.setRows(x,y,z); - LLMatrix4 trans(mat3); + LLMatrix4a trans; + trans.loadu(mat3); trans.transpose(); gGL.matrixMode(LLRender::MM_TEXTURE); gGL.pushMatrix(); - gGL.loadMatrix((F32 *)trans.mMatrix); + gGL.loadMatrix(trans.getF32ptr()); gGL.matrixMode(LLRender::MM_MODELVIEW); /*if (stage > 0) diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 7b691e021..17fa03878 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -455,8 +455,6 @@ public: void wait(); }; -extern LLMatrix4 gGLObliqueProjectionInverse; - #include "llglstates.h" void init_glstates(); diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index ebdbc17ef..c2e8c34b0 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -43,6 +43,7 @@ #include "llsdutil_math.h" #include "llvertexbuffer.h" #include "llfasttimer.h" +#include "llmatrix4a.h" extern LLGLSLShader gPostColorFilterProgram; extern LLGLSLShader gPostNightVisionProgram; @@ -305,16 +306,16 @@ public: { addSetting(mStrength); } - /*virtual*/ bool isEnabled() const { return LLPostProcessShader::isEnabled() && llabs(gGLModelView[0] - gGLPreviousModelView[0]) > .0000001; } + /*virtual*/ bool isEnabled() const { return LLPostProcessShader::isEnabled() && llabs(gGLModelView.getF32ptr()[0] - gGLPreviousModelView.getF32ptr()[0]) > .0000001; } /*virtual*/ S32 getColorChannel() const { return 0; } /*virtual*/ S32 getDepthChannel() const { return 1; } /*virtual*/ QuadType preDraw() { - glh::matrix4f inv_proj(gGLModelView); - inv_proj.mult_left(gGLProjection); + glh::matrix4f inv_proj(gGLModelView.getF32ptr()); + inv_proj.mult_left(gGLProjection.getF32ptr()); inv_proj = inv_proj.inverse(); - glh::matrix4f prev_proj(gGLPreviousModelView); - prev_proj.mult_left(gGLProjection); + glh::matrix4f prev_proj(gGLPreviousModelView.getF32ptr()); + prev_proj.mult_left(gGLProjection.getF32ptr()); LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions(); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 2439c75e6..0d7b46d84 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -35,17 +35,18 @@ #include "llrendertarget.h" #include "lltexture.h" #include "llshadermgr.h" +#include "llmatrix4a.h" LLRender gGL; // Handy copies of last good GL matrices //Would be best to migrate these to LLMatrix4a and LLVector4a, but that's too divergent right now. -LL_ALIGN_16(F32 gGLModelView[16]); -LL_ALIGN_16(F32 gGLLastModelView[16]); -LL_ALIGN_16(F32 gGLPreviousModelView[16]); -LL_ALIGN_16(F32 gGLLastProjection[16]); -LL_ALIGN_16(F32 gGLProjection[16]); -LL_ALIGN_16(S32 gGLViewport[4]); +LLMatrix4a gGLModelView; +LLMatrix4a gGLLastModelView; +LLMatrix4a gGLPreviousModelView; +LLMatrix4a gGLLastProjection; +LLMatrix4a gGLProjection; +S32 gGLViewport[4]; U32 LLRender::sUICalls = 0; U32 LLRender::sUIVerts = 0; @@ -1400,6 +1401,120 @@ void LLRender::rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, con } } +//LLRender::projectf & LLRender::unprojectf adapted from gluProject & gluUnproject in Mesa's GLU 9.0 library. +// License/Copyright Statement: +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. + * + * 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +bool LLRender::projectf(const LLVector3& object, const LLMatrix4a& modelview, const LLMatrix4a& projection, const LLRect& viewport, LLVector3& windowCoordinate) +{ + //Begin SSE intrinsics + + // Declare locals + const LLVector4a obj_vector(object.mV[VX],object.mV[VY],object.mV[VZ]); + const LLVector4a one(1.f); + LLVector4a temp_vec; //Scratch vector + LLVector4a w; //Splatted W-component. + + modelview.affineTransform(obj_vector, temp_vec); //temp_vec = modelview * obj_vector; + + //Passing temp_matrix as v and res is safe. res not altered until after all other calculations + projection.rotate4(temp_vec, temp_vec); //temp_vec = projection * temp_vec + + w.splat<3>(temp_vec); //w = temp_vec.wwww + + //If w == 0.f, use 1.f instead. Defer return if temp_vec.w == 0.f until after all SSE intrinsics. + __m128 is_zero_mask = _mm_cmpeq_ps(w,LLVector4a::getZero()); //bool is_zero = (w == 0.f); + temp_vec.div(_mm_or_ps(_mm_andnot_ps(is_zero_mask, w), _mm_and_ps(is_zero_mask, one))); //temp_vec /= (!iszero ? w : 1.f); + + //Map x, y to range 0-1 + temp_vec.mul(.5f); + temp_vec.add(.5f); + + //End SSE intrinsics + + if(temp_vec[VW]==0.f) + return false; + + //Window coordinates + windowCoordinate[0]=temp_vec[VX]*viewport.getWidth()+viewport.mLeft; + windowCoordinate[1]=temp_vec[VY]*viewport.getHeight()+viewport.mBottom; + //This is only correct when glDepthRange(0.0, 1.0) + windowCoordinate[2]=temp_vec[VZ]; + + return true; +} + +bool LLRender::unprojectf(const LLVector3& windowCoordinate, const LLMatrix4a& modelview, const LLMatrix4a& projection, const LLRect& viewport, LLVector3& object) +{ + //Begin SSE intrinsics + + // Declare locals + static const LLVector4a one(1.f); + static const LLVector4a two(2.f); + LLVector4a norm_view( + ((windowCoordinate.mV[VX] - (F32)viewport.mLeft) / (F32)viewport.getWidth()), + ((windowCoordinate.mV[VY] - (F32)viewport.mBottom) / (F32)viewport.getHeight()), + windowCoordinate.mV[VZ], + 1.f); + + LLMatrix4a inv_mat; //Inverse transformation matrix + LLVector4a temp_vec; //Scratch vector + LLVector4a w; //Splatted W-component. + + inv_mat.setMul(projection,modelview); //inv_mat = projection*modelview + + float det = inv_mat.invert(); + + //Normalize. -1.0 : +1.0 + norm_view.mul(two); // norm_view *= vec4(.2f) + norm_view.sub(one); // norm_view -= vec4(1.f) + + inv_mat.rotate4(norm_view,temp_vec); //inv_mat * norm_view + + w.splat<3>(temp_vec); //w = temp_vec.wwww + + //If w == 0.f, use 1.f instead. Defer return if temp_vec.w == 0.f until after all SSE intrinsics. + __m128 is_zero_mask = _mm_cmpeq_ps(w,LLVector4a::getZero()); //bool is_zero = (w == 0.f); + temp_vec.div(_mm_or_ps(_mm_andnot_ps(is_zero_mask, w), _mm_and_ps(is_zero_mask, one))); //temp_vec /= (!iszero ? w : 1.f); + + //End SSE intrinsics + + if(det == 0.f || temp_vec[VW]==0.f) + return false; + + object.set(temp_vec.getF32ptr()); + + return true; +} + void LLRender::pushMatrix() { flush(); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 66786d6ee..7e2067207 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -42,14 +42,15 @@ #include "llstrider.h" #include "llpointer.h" #include "llglheaders.h" -#include "llmatrix4a.h" #include "glh/glh_linear.h" +#include "llrect.h" class LLVertexBuffer; class LLCubeMap; class LLImageGL; class LLRenderTarget; class LLTexture ; +class LLMatrix4a; #define LL_MATRIX_STACK_DEPTH 32 @@ -347,6 +348,8 @@ public: void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z); void rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z); void ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar); + bool projectf(const LLVector3& object, const LLMatrix4a& modelview, const LLMatrix4a& projection, const LLRect& viewport, LLVector3& windowCoordinate); + bool unprojectf(const LLVector3& windowCoordinate, const LLMatrix4a& modelview, const LLMatrix4a& projection, const LLRect& viewport, LLVector3& object); void pushMatrix(); void popMatrix(); @@ -480,11 +483,11 @@ private: LLAlignedArray mUIScale; }; -extern F32 gGLModelView[16]; -extern F32 gGLLastModelView[16]; -extern F32 gGLLastProjection[16]; -extern F32 gGLPreviousModelView[16]; -extern F32 gGLProjection[16]; +extern LLMatrix4a gGLModelView; +extern LLMatrix4a gGLLastModelView; +extern LLMatrix4a gGLLastProjection; +extern LLMatrix4a gGLPreviousModelView; +extern LLMatrix4a gGLProjection; extern S32 gGLViewport[4]; extern LLRender gGL; diff --git a/indra/newview/awavefront.h b/indra/newview/awavefront.h index 3f58ee4a0..09f0dc3b9 100644 --- a/indra/newview/awavefront.h +++ b/indra/newview/awavefront.h @@ -28,6 +28,9 @@ class LLFace; class LLPolyMesh; class LLViewerObject; class LLVOAvatar; +class LLVolume; +class LLVolumeFace; +class LLXform; typedef std::vector > vert_t; typedef std::vector vec3_t; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 45fa8dcd7..87407fe3c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -98,6 +98,7 @@ #include "llprimitive.h" #include "llurlaction.h" #include "llurlentry.h" +#include "llvolumemgr.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 90701c0f4..0d75d6d4d 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -445,7 +445,7 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params) if (params.mModelMatrix != gGLLastMatrix) { gGLLastMatrix = params.mModelMatrix; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); if (params.mModelMatrix) { llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index dacc26422..4c95f38a9 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -159,10 +159,7 @@ LLMatrix4& LLDrawPoolAvatar::getModelView() { static LLMatrix4 ret; - ret.initRows(LLVector4(gGLModelView+0), - LLVector4(gGLModelView+4), - LLVector4(gGLModelView+8), - LLVector4(gGLModelView+12)); + ret = LLMatrix4(gGLModelView.getF32ptr()); return ret; } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index f0d7b4241..811f24bf5 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -373,11 +373,7 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di { if (!invisible && shader ) { - LLMatrix4 mat; - mat.initRows(LLVector4(gGLModelView+0), - LLVector4(gGLModelView+4), - LLVector4(gGLModelView+8), - LLVector4(gGLModelView+12)); + LLMatrix4 mat(gGLModelView.getF32ptr()); LLVector3 vec = LLVector3(gShinyOrigin) * mat; LLVector4 vec4(vec, gShinyOrigin.mV[3]); shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV); @@ -521,11 +517,7 @@ void LLDrawPoolBump::beginFullbrightShiny() LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; if( cube_map ) { - LLMatrix4 mat; - mat.initRows(LLVector4(gGLModelView+0), - LLVector4(gGLModelView+4), - LLVector4(gGLModelView+8), - LLVector4(gGLModelView+12)); + LLMatrix4 mat(gGLModelView.getF32ptr()); shader->bind(); LLVector3 vec = LLVector3(gShinyOrigin) * mat; LLVector4 vec4(vec, gShinyOrigin.mV[3]); diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index eb2738078..a27f0b998 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -320,7 +320,7 @@ void LLDrawPoolTerrain::drawLoop() { llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW); gGLLastMatrix = model_matrix; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); if (model_matrix) { gGL.multMatrix((GLfloat*) model_matrix->mMatrix); diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index bb2fb09eb..2f61834a4 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -125,7 +125,7 @@ void LLDrawPoolTree::render(S32 pass) if (model_matrix != gGLLastMatrix) { gGLLastMatrix = model_matrix; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); if (model_matrix) { llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW); @@ -250,10 +250,10 @@ void LLDrawPoolTree::renderTree(BOOL selecting) } gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); //gGL.pushMatrix(); - LLMatrix4 matrix(gGLModelView); + LLMatrix4 matrix(gGLModelView.getF32ptr()); // Translate to tree base HACK - adjustment in Z plants tree underground const LLVector3 &pos_agent = treep->getPositionAgent(); diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index e9b720d24..4c4173705 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -56,8 +56,6 @@ void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, hud_render_text(wstr, pos_agent, font, style, shadow, x_offset, y_offset, color, orthographic); } -int glProjectf(const LLVector3& object, const F32* modelview, const F32* projection, const LLRect& viewport, LLVector3& windowCoordinate); - void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, const LLFontGL &font, const U8 style, @@ -115,7 +113,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, const LLRect& world_view_rect = gViewerWindow->getWorldViewRectRaw(); - glProjectf(render_pos, gGLModelView, gGLProjection, world_view_rect, window_coordinates); + gGL.projectf(render_pos, gGLModelView, gGLProjection, world_view_rect, window_coordinates); //fonts all render orthographically, set up projection`` gGL.matrixMode(LLRender::MM_PROJECTION); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 4881139df..f3fe75d4e 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6175,13 +6175,13 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) if (drawable->isActive()) { - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix); } else if (!is_hud_object) { gGL.loadIdentity(); - gGL.multMatrix(gGLModelView); + gGL.multMatrix(gGLModelView.getF32ptr()); LLVector3 trans = objectp->getRegion()->getOriginAgent(); gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); } @@ -6291,7 +6291,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) if (!is_hud_object) { gGL.loadIdentity(); - gGL.multMatrix(gGLModelView); + gGL.multMatrix(gGLModelView.getF32ptr()); } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 41890cdaa..3cd6a0d9f 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3748,7 +3748,7 @@ void renderRaycast(LLDrawable* drawablep) { // draw intersection point gGL.pushMatrix(); - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); LLVector3 translate(gDebugRaycastIntersection.getF32ptr()); gGL.translatef(translate.mV[0], translate.mV[1], translate.mV[2]); LLCoordFrame orient; @@ -3850,7 +3850,7 @@ public: gGL.flush(); gGL.pushMatrix(); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); renderVisibility(group, mCamera); stop_glerror(); gGLLastMatrix = NULL; diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index b70183fd4..bda230920 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -27,10 +27,9 @@ #include "llviewerprecompiledheaders.h" #include "llviewercamera.h" - #include "llagent.h" #include "llagentcamera.h" -#include "llmatrix4a.h" + #include "llviewercontrol.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" @@ -213,59 +212,33 @@ void LLViewerCamera::calcProjection(const F32 far_distance) const //static void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zflip, BOOL no_hacks) { - GLint* viewport = (GLint*) gGLViewport; - F64 model[16]; - F64 proj[16]; - - for (U32 i = 0; i < 16; i++) - { - model[i] = (F64) gGLModelView[i]; - proj[i] = (F64) gGLProjection[i]; - } - - GLdouble objX,objY,objZ; - LLVector3 frust[8]; + LLRect view_port(gGLViewport[0],gGLViewport[1]+gGLViewport[3],gGLViewport[0]+gGLViewport[2],gGLViewport[1]); + if (no_hacks) { - gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ); - frust[0].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ); - frust[1].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ); - frust[2].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ); - frust[3].setVec((F32)objX,(F32)objY,(F32)objZ); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mBottom,0.f),gGLModelView,gGLProjection,view_port,frust[0]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mBottom,0.f),gGLModelView,gGLProjection,view_port,frust[1]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mTop,0.f),gGLModelView,gGLProjection,view_port,frust[2]); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mTop,0.f),gGLModelView,gGLProjection,view_port,frust[3]); - gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ); - frust[4].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ); - frust[5].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ); - frust[6].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ); - frust[7].setVec((F32)objX,(F32)objY,(F32)objZ); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mBottom,1.f),gGLModelView,gGLProjection,view_port,frust[4]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mBottom,1.f),gGLModelView,gGLProjection,view_port,frust[5]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mTop,1.f),gGLModelView,gGLProjection,view_port,frust[6]); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mTop,1.f),gGLModelView,gGLProjection,view_port,frust[7]); } else if (zflip) { - gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ); - frust[0].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ); - frust[1].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ); - frust[2].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ); - frust[3].setVec((F32)objX,(F32)objY,(F32)objZ); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mTop,0.f),gGLModelView,gGLProjection,view_port,frust[0]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mTop,0.f),gGLModelView,gGLProjection,view_port,frust[1]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mBottom,0.f),gGLModelView,gGLProjection,view_port,frust[2]); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mBottom,0.f),gGLModelView,gGLProjection,view_port,frust[3]); - gluUnProject(viewport[0],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ); - frust[4].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],1,model,proj,viewport,&objX,&objY,&objZ); - frust[5].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ); - frust[6].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0],viewport[1],1,model,proj,viewport,&objX,&objY,&objZ); - frust[7].setVec((F32)objX,(F32)objY,(F32)objZ); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mTop,1.f),gGLModelView,gGLProjection,view_port,frust[4]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mTop,1.f),gGLModelView,gGLProjection,view_port,frust[5]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mBottom,1.f),gGLModelView,gGLProjection,view_port,frust[6]); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mBottom,1.f),gGLModelView,gGLProjection,view_port,frust[7]); for (U32 i = 0; i < 4; i++) { @@ -276,14 +249,10 @@ void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, BOOL ortho, BOOL zfli } else { - gluUnProject(viewport[0],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ); - frust[0].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1],0,model,proj,viewport,&objX,&objY,&objZ); - frust[1].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0]+viewport[2],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ); - frust[2].setVec((F32)objX,(F32)objY,(F32)objZ); - gluUnProject(viewport[0],viewport[1]+viewport[3],0,model,proj,viewport,&objX,&objY,&objZ); - frust[3].setVec((F32)objX,(F32)objY,(F32)objZ); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mBottom,0.f),gGLModelView,gGLProjection,view_port,frust[0]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mBottom,0.f),gGLModelView,gGLProjection,view_port,frust[1]); + gGL.unprojectf(LLVector3(view_port.mRight,view_port.mTop,0.f),gGLModelView,gGLProjection,view_port,frust[2]); + gGL.unprojectf(LLVector3(view_port.mLeft,view_port.mTop,0.f),gGLModelView,gGLProjection,view_port,frust[3]); if (ortho) { @@ -392,10 +361,7 @@ void LLViewerCamera::setPerspective(BOOL for_selection, gGL.loadMatrix(proj_mat.m); - for (U32 i = 0; i < 16; i++) - { - gGLProjection[i] = proj_mat.m[i]; - } + gGLProjection.loadu(proj_mat.m); gGL.matrixMode(LLRender::MM_MODELVIEW ); @@ -426,10 +392,7 @@ void LLViewerCamera::setPerspective(BOOL for_selection, { // Save GL matrices for access elsewhere in code, especially project_world_to_screen //glGetDoublev(GL_MODELVIEW_MATRIX, gGLModelView); - for (U32 i = 0; i < 16; i++) - { - gGLModelView[i] = modelview.m[i]; - } + gGLModelView.loadu(modelview.m); } updateFrustumPlanes(*this); @@ -443,89 +406,14 @@ void LLViewerCamera::setPerspective(BOOL for_selection, }*/ } - // Uses the last GL matrices set in set_perspective to project a point from // screen coordinates to the agent's region. void LLViewerCamera::projectScreenToPosAgent(const S32 screen_x, const S32 screen_y, LLVector3* pos_agent) const { - GLdouble x, y, z; - - F64 mdlv[16]; - F64 proj[16]; - - for (U32 i = 0; i < 16; i++) - { - mdlv[i] = (F64) gGLModelView[i]; - proj[i] = (F64) gGLProjection[i]; - } - - gluUnProject( - GLdouble(screen_x), GLdouble(screen_y), 0.0, - mdlv, proj, (GLint*)gGLViewport, - &x, - &y, - &z ); - pos_agent->setVec( (F32)x, (F32)y, (F32)z ); -} - -//Based off of http://www.opengl.org/wiki/GluProject_and_gluUnProject_code -int glProjectf(const LLVector3& object, const F32* modelview, const F32* projection, const LLRect& viewport, LLVector3& windowCoordinate) -{ - const LLVector4a obj_vector(object.mV[VX],object.mV[VY],object.mV[VZ]); - LLVector4a temp_matrix; - - const LLMatrix4a &view_matrix=*(LLMatrix4a*)modelview; - const LLMatrix4a &proj_matrix=*(LLMatrix4a*)projection; - - view_matrix.affineTransform(obj_vector, temp_matrix); - - //Passing temp_matrix as v and res is safe. res not altered until after all other calculations - proj_matrix.rotate4(temp_matrix, temp_matrix); - - if(temp_matrix[VW]==0.0) - return 0; - - temp_matrix.div(temp_matrix[VW]); - - //Map x, y to range 0-1 - temp_matrix.mul(.5f); - temp_matrix.add(.5f); - - //Window coordinates - windowCoordinate[0]=temp_matrix[VX]*viewport.getWidth()+viewport.mLeft; - windowCoordinate[1]=temp_matrix[VY]*viewport.getHeight()+viewport.mBottom; - //This is only correct when glDepthRange(0.0, 1.0) - windowCoordinate[2]=temp_matrix[VZ]; - - return 1; -} - -void MultiplyMatrices4by4OpenGL_FLOAT(LLMatrix4a& dest_matrix, const LLMatrix4a& input_matrix1, const LLMatrix4a& input_matrix2) -{ - input_matrix1.rotate4(input_matrix2.mMatrix[VX],dest_matrix.mMatrix[VX]); - input_matrix1.rotate4(input_matrix2.mMatrix[VY],dest_matrix.mMatrix[VY]); - input_matrix1.rotate4(input_matrix2.mMatrix[VZ],dest_matrix.mMatrix[VZ]); - input_matrix1.rotate4(input_matrix2.mMatrix[VW],dest_matrix.mMatrix[VW]); - - //Those four lines do this: - /* - result[0]=matrix1[0]*matrix2[0]+matrix1[4]*matrix2[1]+matrix1[8]*matrix2[2]+matrix1[12]*matrix2[3]; - result[1]=matrix1[1]*matrix2[0]+matrix1[5]*matrix2[1]+matrix1[9]*matrix2[2]+matrix1[13]*matrix2[3]; - result[2]=matrix1[2]*matrix2[0]+matrix1[6]*matrix2[1]+matrix1[10]*matrix2[2]+matrix1[14]*matrix2[3]; - result[3]=matrix1[3]*matrix2[0]+matrix1[7]*matrix2[1]+matrix1[11]*matrix2[2]+matrix1[15]*matrix2[3]; - result[4]=matrix1[0]*matrix2[4]+matrix1[4]*matrix2[5]+matrix1[8]*matrix2[6]+matrix1[12]*matrix2[7]; - result[5]=matrix1[1]*matrix2[4]+matrix1[5]*matrix2[5]+matrix1[9]*matrix2[6]+matrix1[13]*matrix2[7]; - result[6]=matrix1[2]*matrix2[4]+matrix1[6]*matrix2[5]+matrix1[10]*matrix2[6]+matrix1[14]*matrix2[7]; - result[7]=matrix1[3]*matrix2[4]+matrix1[7]*matrix2[5]+matrix1[11]*matrix2[6]+matrix1[15]*matrix2[7]; - result[8]=matrix1[0]*matrix2[8]+matrix1[4]*matrix2[9]+matrix1[8]*matrix2[10]+matrix1[12]*matrix2[11]; - result[9]=matrix1[1]*matrix2[8]+matrix1[5]*matrix2[9]+matrix1[9]*matrix2[10]+matrix1[13]*matrix2[11]; - result[10]=matrix1[2]*matrix2[8]+matrix1[6]*matrix2[9]+matrix1[10]*matrix2[10]+matrix1[14]*matrix2[11]; - result[11]=matrix1[3]*matrix2[8]+matrix1[7]*matrix2[9]+matrix1[11]*matrix2[10]+matrix1[15]*matrix2[11]; - result[12]=matrix1[0]*matrix2[12]+matrix1[4]*matrix2[13]+matrix1[8]*matrix2[14]+matrix1[12]*matrix2[15]; - result[13]=matrix1[1]*matrix2[12]+matrix1[5]*matrix2[13]+matrix1[9]*matrix2[14]+matrix1[13]*matrix2[15]; - result[14]=matrix1[2]*matrix2[12]+matrix1[6]*matrix2[13]+matrix1[10]*matrix2[14]+matrix1[14]*matrix2[15]; - result[15]=matrix1[3]*matrix2[12]+ matrix1[7]*matrix2[13]+matrix1[11]*matrix2[14]+matrix1[15]*matrix2[15]; - */ + gGL.unprojectf( + LLVector3(screen_x,screen_y,0.f), + gGLModelView, gGLProjection, LLRect(gGLViewport[0],gGLViewport[1]+gGLViewport[3],gGLViewport[0]+gGLViewport[2],gGLViewport[1]), + *pos_agent ); } // Uses the last GL matrices set in set_perspective to project a point from @@ -553,7 +441,7 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord const LLRect& world_view_rect = gViewerWindow->getWorldViewRectRaw(); - if (GL_TRUE == glProjectf(pos_agent, gGLModelView, gGLProjection, world_view_rect, window_coordinates)) + if (gGL.projectf(pos_agent, gGLModelView, gGLProjection, world_view_rect, window_coordinates)) { F32 &x = window_coordinates.mV[VX]; F32 &y = window_coordinates.mV[VY]; @@ -653,7 +541,7 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent, const LLRect& world_view_rect = gViewerWindow->getWorldViewRectRaw(); LLVector3 window_coordinates; - if (GL_TRUE == glProjectf(pos_agent, gGLModelView, gGLProjection, world_view_rect, window_coordinates)) + if (gGL.projectf(pos_agent, gGLModelView, gGLProjection, world_view_rect, window_coordinates)) { F32 &x = window_coordinates.mV[VX]; F32 &y = window_coordinates.mV[VY]; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 093f61d4f..53ab8589a 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1049,12 +1049,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo //store this frame's modelview matrix for use //when rendering next frame's occlusion queries - for (U32 i = 0; i < 16; i++) - { - gGLPreviousModelView[i] = gGLLastModelView[i]; - gGLLastModelView[i] = gGLModelView[i]; - gGLLastProjection[i] = gGLProjection[i]; - } + gGLPreviousModelView = gGLLastModelView; + gGLLastModelView = gGLModelView; + gGLLastProjection = gGLProjection; stop_glerror(); } @@ -1345,8 +1342,8 @@ void render_ui(F32 zoom_factor, int subfield, bool tiling) if (!gSnapshot) { gGL.pushMatrix(); - gGL.loadMatrix(gGLLastModelView); - glh_set_current_modelview(glh_copy_matrix(gGLLastModelView)); + gGL.loadMatrix(gGLLastModelView.getF32ptr()); + glh_set_current_modelview(glh::matrix4f(gGLLastModelView.getF32ptr())); } { diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index f98c6f10f..cce678081 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -187,7 +187,7 @@ //#include "lltextureentry.h" #include "lltreeparams.h" //#include "llvolume.h" -#include "llvolumemgr.h" +//#include "llvolumemgr.h" #include "material_codes.h" // Library includes from llxml diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1b9f340e8..4c857c50d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -696,32 +696,35 @@ public: static const LLCachedControl debug_show_render_matrices("DebugShowRenderMatrices"); if (debug_show_render_matrices) { - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); + F32* m = gGLProjection.getF32ptr(); + + addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", m[12], m[13], m[14], m[15])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); + addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", m[8], m[9], m[10], m[11])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); + addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", m[4], m[5], m[6], m[7])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); + addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", m[0], m[1], m[2], m[3])); ypos += y_inc; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; + m = gGLModelView.getF32ptr(); - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); + addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", m[12], m[13], m[14], m[15])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); + addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", m[8], m[9], m[10], m[11])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); + addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", m[4], m[5], m[6], m[7])); ypos += y_inc; - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); + addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", m[0], m[1], m[2], m[3])); ypos += y_inc; addText(xpos, ypos, "View Matrix"); diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 26303187d..344a7a3bf 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -393,13 +393,7 @@ void LLWaterParamManager::update(LLViewerCamera * cam) glh::vec3f norm(0.f, 0.f, 1.f); glh::vec3f p(0.f, 0.f, gAgent.getRegion()->getWaterHeight()+0.1f); - F32 modelView[16]; - for (U32 i = 0; i < 16; i++) - { - modelView[i] = (F32) gGLModelView[i]; - } - - glh::matrix4f mat(modelView); + glh::matrix4f mat(gGLModelView.getF32ptr()); glh::matrix4f invtrans = mat.inverse().transpose(); glh::vec3f enorm; glh::vec3f ep; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 4e40e2a89..d18cc9e8a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -249,49 +249,34 @@ void drawBoxOutline(const LLVector3& pos, const LLVector3& size); U32 nhpo2(U32 v); LLVertexBuffer* ll_create_cube_vb(U32 type_mask, U32 usage); -glh::matrix4f glh_copy_matrix(F32* src) -{ - glh::matrix4f ret; - ret.set_value(src); - return ret; -} - glh::matrix4f glh_get_current_modelview() { - return glh_copy_matrix(gGLModelView); + return glh::matrix4f(gGLModelView.getF32ptr()); } glh::matrix4f glh_get_current_projection() { - return glh_copy_matrix(gGLProjection); + return glh::matrix4f(gGLProjection.getF32ptr()); } glh::matrix4f glh_get_last_modelview() { - return glh_copy_matrix(gGLLastModelView); + return glh::matrix4f(gGLLastModelView.getF32ptr()); } glh::matrix4f glh_get_last_projection() { - return glh_copy_matrix(gGLLastProjection); -} - -void glh_copy_matrix(const glh::matrix4f& src, F32* dst) -{ - for (U32 i = 0; i < 16; i++) - { - dst[i] = src.m[i]; - } + return glh::matrix4f(gGLLastProjection.getF32ptr()); } void glh_set_current_modelview(const glh::matrix4f& mat) { - glh_copy_matrix(mat, gGLModelView); + gGLModelView.loadu(mat.m); } void glh_set_current_projection(glh::matrix4f& mat) { - glh_copy_matrix(mat, gGLProjection); + gGLProjection.loadu(mat.m); } glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat znear, GLfloat zfar) @@ -2339,11 +2324,11 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - gGL.loadMatrix(gGLLastProjection); + gGL.loadMatrix(gGLLastProjection.getF32ptr()); gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLLastModelView); + gGL.loadMatrix(gGLLastModelView.getF32ptr()); LLGLDisable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); @@ -4105,17 +4090,14 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) assertInitialized(); - F32 saved_modelview[16]; - F32 saved_projection[16]; + LLMatrix4a saved_modelview; + LLMatrix4a saved_projection; //HACK: preserve/restore matrices around HUD render if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) { - for (U32 i = 0; i < 16; i++) - { - saved_modelview[i] = gGLModelView[i]; - saved_projection[i] = gGLProjection[i]; - } + saved_modelview = gGLModelView; + saved_projection = gGLProjection; } /////////////////////////////////////////// @@ -4219,7 +4201,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) { occlude = FALSE; gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); LLGLSLShader::bindNoShader(); doOcclusion(camera); } @@ -4230,7 +4212,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) LLFastTimer t(FTM_POOLRENDER); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); for( S32 i = 0; i < poolp->getNumPasses(); i++ ) { @@ -4279,13 +4261,13 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) LLVertexBuffer::unbind(); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); if (occlude) { occlude = FALSE; gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); LLGLSLShader::bindNoShader(); doOcclusion(camera); } @@ -4348,11 +4330,8 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) //HACK: preserve/restore matrices around HUD render if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) { - for (U32 i = 0; i < 16; i++) - { - gGLModelView[i] = saved_modelview[i]; - gGLProjection[i] = saved_projection[i]; - } + gGLModelView = saved_modelview; + gGLProjection = saved_projection; } } @@ -4414,7 +4393,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) LLFastTimer t(FTM_DEFERRED_POOLRENDER); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ ) { @@ -4458,7 +4437,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) } gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); gGL.setColorMask(true, false); } @@ -4491,7 +4470,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion) { occlude = FALSE; gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); LLGLSLShader::bindNoShader(); doOcclusion(camera/*, mScreen, mOcclusionDepth, &mDeferredDepth*/); gGL.setColorMask(true, false); @@ -4503,7 +4482,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion) LLFastTimer t(FTM_POST_DEFERRED_POOLRENDER); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ ) { @@ -4545,17 +4524,17 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion) } gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); if (occlude) { occlude = FALSE; gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); LLGLSLShader::bindNoShader(); doOcclusion(camera); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); } } @@ -4581,7 +4560,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera) poolp->prerender() ; gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); for( S32 i = 0; i < poolp->getNumShadowPasses(); i++ ) { @@ -4620,7 +4599,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera) } gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); } @@ -4720,7 +4699,7 @@ void LLPipeline::renderDebug() gGL.color4f(1,1,1,1); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); gGL.setColorMask(true, false); bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD); @@ -4992,7 +4971,7 @@ void LLPipeline::renderDebug() gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep); gGL.pushMatrix(); - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); gGLLastMatrix = NULL; for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ2.begin(); iter != mGroupQ2.end(); ++iter) @@ -6858,20 +6837,20 @@ void LLPipeline::doResetVertexBuffers() void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture) { assertInitialized(); - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); gGLLastMatrix = NULL; mSimplePool->pushBatches(type, mask, texture, batch_texture); - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); gGLLastMatrix = NULL; } void LLPipeline::renderMaskedObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture) { assertInitialized(); - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); gGLLastMatrix = NULL; mAlphaMaskPool->pushMaskBatches(type, mask, texture, batch_texture); - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); gGLLastMatrix = NULL; } @@ -7858,7 +7837,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n { cube_map->enable(channel); cube_map->bind(); - F32* m = gGLModelView; + F32* m = gGLModelView.getF32ptr(); F32 mat[] = { m[0], m[1], m[2], m[4], m[5], m[6], @@ -7968,7 +7947,7 @@ void LLPipeline::renderDeferredLighting() LLGLEnable cull(GL_CULL_FACE); LLGLEnable blend(GL_BLEND); - glh::matrix4f mat = glh_copy_matrix(gGLModelView); + glh::matrix4f mat(gGLModelView.getF32ptr()); if(mDeferredVB.isNull()) { @@ -8643,7 +8622,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) LLGLEnable cull(GL_CULL_FACE); LLGLEnable blend(GL_BLEND); - glh::matrix4f mat = glh_copy_matrix(gGLModelView); + glh::matrix4f mat(gGLModelView.getF32ptr()); LLStrider vert; mDeferredVB->getVertexStrider(vert); @@ -9827,7 +9806,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gGL.loadMatrix(proj.m); gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); stop_glerror(); gGLLastMatrix = NULL; @@ -9906,7 +9885,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gDeferredShadowCubeProgram.bind(); gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); + gGL.loadMatrix(gGLModelView.getF32ptr()); //LLRenderTarget& occlusion_source = mShadow[LLViewerCamera::sCurCameraID-1]; @@ -10135,13 +10114,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON); } - F64 last_modelview[16]; - F64 last_projection[16]; - for (U32 i = 0; i < 16; i++) - { //store last_modelview of world camera - last_modelview[i] = gGLLastModelView[i]; - last_projection[i] = gGLLastProjection[i]; - } + LLMatrix4a last_modelview = gGLLastModelView; + LLMatrix4a last_projection = gGLLastProjection; pushRenderTypeMask(); andRenderTypeMask(LLPipeline::RENDER_TYPE_SIMPLE, @@ -10675,14 +10649,11 @@ void LLPipeline::generateSunShadow(LLCamera& camera) glh_set_current_modelview(view[j]); glh_set_current_projection(proj[j]); - for (U32 i = 0; i < 16; i++) - { - gGLLastModelView[i] = mShadowModelview[j].m[i]; - gGLLastProjection[i] = mShadowProjection[j].m[i]; - } + gGLLastModelView = mShadowModelview[j]; + gGLLastProjection = mShadowProjection[j]; - mShadowModelview[j] = view[j]; - mShadowProjection[j] = proj[j]; + mShadowModelview[j].loadu(view[j].m); + mShadowProjection[j].loadu(proj[j].m); mSunShadowMatrix[j] = trans*proj[j]*view[j]*inv_view; @@ -10817,14 +10788,11 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mSunShadowMatrix[i+4] = trans*proj[i+4]*view[i+4]*inv_view; - for (U32 j = 0; j < 16; j++) - { - gGLLastModelView[j] = mShadowModelview[i+4].m[j]; - gGLLastProjection[j] = mShadowProjection[i+4].m[j]; - } + gGLLastModelView = mShadowModelview[i+4]; + gGLLastProjection = mShadowProjection[i+4]; - mShadowModelview[i+4] = view[i+4]; - mShadowProjection[i+4] = proj[i+4]; + mShadowModelview[i+4].loadu(view[i+4].m); + mShadowProjection[i+4].loadu(proj[i+4].m); LLCamera shadow_cam = camera; shadow_cam.setFar(far_clip); @@ -10871,11 +10839,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } gGL.setColorMask(true, false); - for (U32 i = 0; i < 16; i++) - { - gGLLastModelView[i] = last_modelview[i]; - gGLLastProjection[i] = last_projection[i]; - } + gGLLastModelView = last_modelview; + gGLLastProjection = last_projection; popRenderTypeMask(); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index da5e6a6b3..01635cbc5 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -81,7 +81,6 @@ BOOL compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn bool LLRayAABB(const LLVector3 ¢er, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0); BOOL setup_hud_matrices(); // use whole screen to render hud BOOL setup_hud_matrices(const LLRect& screen_region); // specify portion of screen (in pixels) to render hud attachments from (for picking) -glh::matrix4f glh_copy_matrix(F32* src); glh::matrix4f glh_get_current_modelview(); void glh_set_current_modelview(const glh::matrix4f& mat); glh::matrix4f glh_get_current_projection(); @@ -639,8 +638,8 @@ public: LLCamera mShadowCamera[8]; LLVector3 mShadowExtents[4][2]; glh::matrix4f mSunShadowMatrix[6]; - glh::matrix4f mShadowModelview[6]; - glh::matrix4f mShadowProjection[6]; + LLMatrix4a mShadowModelview[6]; + LLMatrix4a mShadowProjection[6]; glh::matrix4f mGIMatrix; glh::matrix4f mGIMatrixProj; glh::matrix4f mGIModelview; From 8f6a578ec0a159228923c861240b875cccffd80c Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sun, 15 Jun 2014 22:42:32 -0500 Subject: [PATCH 003/159] Migration to LLMatrix4a instead of glh::matrix4f --- indra/llmath/llvolume.cpp | 14 ++++------ indra/llmath/llvolume.h | 7 +++-- indra/llrender/llcubemap.cpp | 6 ++-- indra/llrender/llgl.cpp | 40 +++++++++++++++------------ indra/llrender/llgl.h | 7 +++-- indra/llrender/llpostprocess.cpp | 17 +++++++----- indra/newview/lldrawpoolavatar.cpp | 17 ++++-------- indra/newview/llface.cpp | 18 ++++++------ indra/newview/llface.h | 4 +-- indra/newview/llflexibleobject.cpp | 41 +++++++++++++++------------- indra/newview/llselectmgr.cpp | 2 +- indra/newview/llspatialpartition.cpp | 6 ++-- indra/newview/llviewercamera.cpp | 4 +-- indra/newview/llviewerdisplay.cpp | 33 ++++++++++++---------- 14 files changed, 113 insertions(+), 103 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index cff813e03..503711e31 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2185,7 +2185,7 @@ BOOL LLVolume::generate() 0, 0, scale[2], 0, 0, 0, 0, 1 }; - LLMatrix4 rot((F32*) mPathp->mPath[s].mRot.mMatrix); + LLMatrix4 rot(mPathp->mPath[s].mRot.getF32ptr()); LLMatrix4 scale_mat(sc); scale_mat *= rot; @@ -3671,16 +3671,14 @@ S32 LLVolume::getNumTriangles(S32* vcount) const void LLVolume::generateSilhouetteVertices(std::vector &vertices, std::vector &normals, const LLVector3& obj_cam_vec_in, - const LLMatrix4& mat_in, - const LLMatrix3& norm_mat_in, + const LLMatrix4a& mat_in, + const LLMatrix4a& norm_mat_in, S32 face_mask) { - LLMatrix4a mat; - mat.loadu(mat_in); + const LLMatrix4a& mat = mat_in; + + const LLMatrix4a& norm_mat = norm_mat_in; - LLMatrix4a norm_mat; - norm_mat.loadu(norm_mat_in); - LLVector4a obj_cam_vec; obj_cam_vec.load3(obj_cam_vec_in.mV); diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 7a74d544c..9f84663d0 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -27,6 +27,9 @@ #ifndef LL_LLVOLUME_H #define LL_LLVOLUME_H +#ifdef IN_PCH +#error "llvolume.h should not be in pch include chain." +#endif #include class LLProfileParams; @@ -1017,8 +1020,8 @@ public: void generateSilhouetteVertices(std::vector &vertices, std::vector &normals, const LLVector3& view_vec, - const LLMatrix4& mat, - const LLMatrix3& norm_mat, + const LLMatrix4a& mat, + const LLMatrix4a& norm_mat, S32 face_index); //get the face index of the face that intersects with the given line segment at the point diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 9a96ed698..6f0aedfa1 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -266,9 +266,9 @@ void LLCubeMap::setMatrix(S32 stage) gGL.getTexUnit(stage)->activate(); } - LLVector3 x(gGLModelView.mMatrix[0].getF32ptr()); - LLVector3 y(gGLModelView.mMatrix[1].getF32ptr()); - LLVector3 z(gGLModelView.mMatrix[2].getF32ptr()); + LLVector3 x(gGLModelView.getRow<0>().getF32ptr()); + LLVector3 y(gGLModelView.getRow<1>().getF32ptr()); + LLVector3 z(gGLModelView.getRow<2>().getF32ptr()); LLMatrix3 mat3; mat3.setRows(x,y,z); diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 11d8fa557..81ca04a1d 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -2179,7 +2179,7 @@ void parse_glsl_version(S32& major, S32& minor) LLStringUtil::convertToS32(minor_str, minor); } -LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply) +LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const LLMatrix4a& modelview, const LLMatrix4a& projection, bool apply) { mApply = apply; @@ -2194,27 +2194,33 @@ LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& mode void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d) { - glh::matrix4f& P = mProjection; - glh::matrix4f& M = mModelview; - - glh::matrix4f invtrans_MVP = (P * M).inverse().transpose(); - glh::vec4f oplane(a,b,c,d); - glh::vec4f cplane; - invtrans_MVP.mult_matrix_vec(oplane, cplane); + LLMatrix4a& P = mProjection; + LLMatrix4a& M = mModelview; - cplane /= fabs(cplane[2]); // normalize such that depth is not scaled - cplane[3] -= 1; + LLMatrix4a invtrans_MVP; + invtrans_MVP.setMul(P,M); + invtrans_MVP.invert(); + invtrans_MVP.transpose(); - if(cplane[2] < 0) - cplane *= -1; + LLVector4a oplane(a,b,c,d); + LLVector4a cplane; + invtrans_MVP.rotate4(oplane,cplane); + + cplane.div(cplane.getScalarAt<2>().getAbs()); + cplane.sub(LLVector4a(0.f,0.f,0.f,1.f)); + + cplane.setSelectWithMask( LLVector4a(cplane.getScalarAt<2>().getQuad()).lessThan( _mm_setzero_ps() ), -(LLSimdScalar)cplane, cplane ); + + LLMatrix4a suffix; + suffix.setIdentity(); + suffix.setColumn<2>(cplane); + LLMatrix4a newP; + newP.setMul(suffix,P); - glh::matrix4f suffix; - suffix.set_row(2, cplane); - glh::matrix4f newP = suffix * P; gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - gGL.loadMatrix(newP.m); - gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m); + gGL.loadMatrix(newP.getF32ptr()); + //gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m); gGL.matrixMode(LLRender::MM_MODELVIEW); } diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 17fa03878..a12163f82 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -38,6 +38,7 @@ #include "llstring.h" #include "stdtypes.h" #include "v4math.h" +#include "llmatrix4a.h" #include "llplane.h" #include "llgltypes.h" #include "llinstancetracker.h" @@ -325,7 +326,7 @@ class LLGLUserClipPlane { public: - LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply = true); + LLGLUserClipPlane(const LLPlane& plane, const LLMatrix4a& modelview, const LLMatrix4a& projection, bool apply = true); ~LLGLUserClipPlane(); void setPlane(F32 a, F32 b, F32 c, F32 d); @@ -333,8 +334,8 @@ public: private: bool mApply; - glh::matrix4f mProjection; - glh::matrix4f mModelview; + LLMatrix4a mProjection; + LLMatrix4a mModelview; }; /* diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index c2e8c34b0..418130424 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -311,16 +311,19 @@ public: /*virtual*/ S32 getDepthChannel() const { return 1; } /*virtual*/ QuadType preDraw() { - glh::matrix4f inv_proj(gGLModelView.getF32ptr()); - inv_proj.mult_left(gGLProjection.getF32ptr()); - inv_proj = inv_proj.inverse(); - glh::matrix4f prev_proj(gGLPreviousModelView.getF32ptr()); - prev_proj.mult_left(gGLProjection.getF32ptr()); + const LLMatrix4a& M = gGLModelView; + const LLMatrix4a& P = gGLProjection; + LLMatrix4a inv_proj; + inv_proj.setMul(gGLProjection,gGLModelView); + inv_proj.invert(); + const LLMatrix4a& MPrev = gGLPreviousModelView; + LLMatrix4a prev_proj; + prev_proj.setMul(P,MPrev); LLVector2 screen_rect = LLPostProcess::getInstance()->getDimensions(); - getShader().uniformMatrix4fv(sPrevProj, 1, GL_FALSE, prev_proj.m); - getShader().uniformMatrix4fv(sInvProj, 1, GL_FALSE, inv_proj.m); + getShader().uniformMatrix4fv(sPrevProj, 1, GL_FALSE, prev_proj.getF32ptr()); + getShader().uniformMatrix4fv(sInvProj, 1, GL_FALSE, inv_proj.getF32ptr()); getShader().uniform2fv(sScreenRes, 1, screen_rect.mV); getShader().uniform1i(sBlurStrength, mStrength); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 4c95f38a9..14cbc2365 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1387,16 +1387,11 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer U16 offset = 0; - LLMatrix4 mat_vert = skin->mBindShapeMatrix; - glh::matrix4f m((F32*) mat_vert.mMatrix); - m = m.inverse().transpose(); - - F32 mat3[] = - { m.m[0], m.m[1], m.m[2], - m.m[4], m.m[5], m.m[6], - m.m[8], m.m[9], m.m[10] }; - - LLMatrix3 mat_normal(mat3); + LLMatrix4a mat_vert; + mat_vert.loadu(skin->mBindShapeMatrix); + LLMatrix4a mat_inv_trans = mat_vert; + mat_inv_trans.invert(); + mat_inv_trans.transpose(); //let getGeometryVolume know if alpha should override shiny U32 type = gPipeline.getPoolTypeFromTE(face->getTextureEntry(), face->getTexture()); @@ -1411,7 +1406,7 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer } //llinfos << "Rebuilt face " << face->getTEOffset() << " of " << face->getDrawable() << " at " << gFrameTimeSeconds << llendl; - face->getGeometryVolume(*volume, face->getTEOffset(), mat_vert, mat_normal, offset, true); + face->getGeometryVolume(*volume, face->getTEOffset(), mat_vert, mat_inv_trans, offset, true); buffer->flush(); } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 9263b63da..2e50400a6 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -540,7 +540,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) { LLGLEnable offset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.f, -1.f); - gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix); + gGL.multMatrix(volume->getRelativeXform().getF32ptr()); const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset()); // Singu Note: Implementation changed to utilize a VBO, avoiding fixed functions unless required @@ -808,14 +808,14 @@ bool less_than_max_mag(const LLVector4a& vec) } BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, - const LLMatrix4& mat_vert_in, BOOL global_volume) + const LLMatrix4a& mat_vert_in, BOOL global_volume) { //get bounding box if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION | LLDrawable::REBUILD_RIGGED)) { //VECTORIZE THIS - LLMatrix4a mat_vert; - mat_vert.loadu(mat_vert_in); + const LLMatrix4a& mat_vert = mat_vert_in; + //mat_vert.loadu(mat_vert_in); LLVector4a min,max; @@ -1202,7 +1202,7 @@ static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK_PLANAR("Quick Planar"); BOOL LLFace::getGeometryVolume(const LLVolume& volume, const S32 &f, - const LLMatrix4& mat_vert_in, const LLMatrix3& mat_norm_in, + const LLMatrix4a& mat_vert_in, const LLMatrix4a& mat_norm_in, const U16 &index_offset, bool force_rebuild) { @@ -1350,8 +1350,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } } - LLMatrix4a mat_normal; - mat_normal.loadu(mat_norm_in); + const LLMatrix4a& mat_normal = mat_norm_in; F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0; bool do_xform = false; @@ -1410,7 +1409,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLGLSLShader* cur_shader = LLGLSLShader::sCurBoundShaderPtr; gGL.pushMatrix(); - gGL.loadMatrix((GLfloat*) mat_vert_in.mMatrix); + gGL.loadMatrix(mat_vert_in.getF32ptr()); if (rebuild_pos) { @@ -1937,8 +1936,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount, map_range); - LLMatrix4a mat_vert; - mat_vert.loadu(mat_vert_in); + const LLMatrix4a& mat_vert = mat_vert_in; F32* dst = (F32*) vert.get(); F32* end_f32 = dst+mGeomCount*4; diff --git a/indra/newview/llface.h b/indra/newview/llface.h index feae55853..53cf74d94 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -173,7 +173,7 @@ public: bool canRenderAsMask(); // logic helper BOOL getGeometryVolume(const LLVolume& volume, const S32 &f, - const LLMatrix4& mat_vert, const LLMatrix3& mat_normal, + const LLMatrix4a& mat_vert, const LLMatrix4a& mat_normal, const U16 &index_offset, bool force_rebuild = false); @@ -196,7 +196,7 @@ public: void setSize(S32 numVertices, S32 num_indices = 0, bool align = false); - BOOL genVolumeBBoxes(const LLVolume &volume, S32 f,const LLMatrix4& mat, BOOL global_volume = FALSE); + BOOL genVolumeBBoxes(const LLVolume &volume, S32 f,const LLMatrix4a& mat, BOOL global_volume = FALSE); void init(LLDrawable* drawablep, LLViewerObject* objp); void destroy(); diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 3f34abc1d..6b067085d 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -883,32 +883,35 @@ LLQuaternion LLVolumeImplFlexible::getEndRotation() void LLVolumeImplFlexible::updateRelativeXform(bool force_identity) { - LLQuaternion delta_rot; - LLVector3 delta_pos, delta_scale; + LLVOVolume* vo = (LLVOVolume*) mVO; bool use_identity = vo->mDrawable->isSpatialRoot() || force_identity; + vo->mRelativeXform.setIdentity(); + //matrix from local space to parent relative/global space - delta_rot = use_identity ? LLQuaternion() : vo->mDrawable->getRotation(); - delta_pos = use_identity ? LLVector3(0,0,0) : vo->mDrawable->getPosition(); - delta_scale = LLVector3(1,1,1); + LLVector4a delta_pos; + LLQuaternion2 delta_rot; + if(use_identity) + { + delta_pos.set(0,0,0,1.f); + delta_rot.getVector4aRw() = delta_pos; + } + else + { + delta_pos.load3(vo->mDrawable->getPosition().mV,1.f); + delta_rot.getVector4aRw().loadua(vo->mDrawable->getRotation().mQ); + vo->mRelativeXform.getRow<0>().setRotated(delta_rot,vo->mRelativeXform.getRow<0>()); + vo->mRelativeXform.getRow<1>().setRotated(delta_rot,vo->mRelativeXform.getRow<1>()); + vo->mRelativeXform.getRow<2>().setRotated(delta_rot,vo->mRelativeXform.getRow<2>()); + } - // Vertex transform (4x4) - LLVector3 x_axis = LLVector3(delta_scale.mV[VX], 0.f, 0.f) * delta_rot; - LLVector3 y_axis = LLVector3(0.f, delta_scale.mV[VY], 0.f) * delta_rot; - LLVector3 z_axis = LLVector3(0.f, 0.f, delta_scale.mV[VZ]) * delta_rot; + vo->mRelativeXform.setRow<3>(delta_pos); - vo->mRelativeXform.initRows(LLVector4(x_axis, 0.f), - LLVector4(y_axis, 0.f), - LLVector4(z_axis, 0.f), - LLVector4(delta_pos, 1.f)); - - x_axis.normVec(); - y_axis.normVec(); - z_axis.normVec(); - - vo->mRelativeXformInvTrans.setRows(x_axis, y_axis, z_axis); + vo->mRelativeXformInvTrans = vo->mRelativeXform; + vo->mRelativeXformInvTrans.invert(); + vo->mRelativeXformInvTrans.transpose(); } const LLMatrix4& LLVolumeImplFlexible::getWorldMatrix(LLXformMatrix* xform) const diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index f3fe75d4e..f7e25671c 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6119,7 +6119,7 @@ void pushWireframe(LLDrawable* drawable) { LLVertexBuffer::unbind(); gGL.pushMatrix(); - gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix); + gGL.multMatrix(vobj->getRelativeXform().getF32ptr()); LLVolume* volume = NULL; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 3cd6a0d9f..d06406c4d 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2917,7 +2917,7 @@ void renderNormals(LLDrawable* drawablep) { LLVolume* volume = vol->getVolume(); gGL.pushMatrix(); - gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix); + gGL.multMatrix(vol->getRelativeXform().getF32ptr()); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -3071,7 +3071,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) LLVector3 size(0.25f,0.25f,0.25f); gGL.pushMatrix(); - gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix); + gGL.multMatrix(volume->getRelativeXform().getF32ptr()); if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_MESH) { @@ -3683,7 +3683,7 @@ void renderRaycast(LLDrawable* drawablep) gGL.pushMatrix(); gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); - gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix); + gGL.multMatrix(vobj->getRelativeXform().getF32ptr()); LLVector4a start, end; if (transform) diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index bda230920..03d18c351 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -736,14 +736,12 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) LLVOVolume* vo_volume = (LLVOVolume*) volumep; vo_volume->updateRelativeXform(); - LLMatrix4 mat = vo_volume->getRelativeXform(); LLMatrix4 render_mat(vo_volume->getRenderRotation(), LLVector4(vo_volume->getRenderPosition())); LLMatrix4a render_mata; render_mata.loadu(render_mat); - LLMatrix4a mata; - mata.loadu(mat); + const LLMatrix4a& mata = vo_volume->getRelativeXform();; num_faces = volume->getNumVolumeFaces(); for (i = 0; i < num_faces; i++) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 53ab8589a..930bf13d7 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -767,8 +767,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo LLGLState::checkTextureChannels(); LLGLState::checkClientArrays(); - glh::matrix4f proj = glh_get_current_projection(); - glh::matrix4f mod = glh_get_current_modelview(); + const LLMatrix4a& proj = glh_get_current_projection(); + const LLMatrix4a& mod = glh_get_current_modelview(); glViewport(0,0,512,512); LLVOAvatar::updateFreezeCounter() ; @@ -780,9 +780,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo glh_set_current_projection(proj); glh_set_current_modelview(mod); gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.loadMatrix(proj.m); + gGL.loadMatrix(proj.getF32ptr()); gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.loadMatrix(mod.m); + gGL.loadMatrix(mod.getF32ptr()); gViewerWindow->setup3DViewport(); LLGLState::checkStates(); @@ -1143,8 +1143,8 @@ void render_hud_attachments() gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - glh::matrix4f current_proj = glh_get_current_projection(); - glh::matrix4f current_mod = glh_get_current_modelview(); + const LLMatrix4a saved_proj = glh_get_current_projection(); + const LLMatrix4a saved_mod = glh_get_current_modelview(); // clamp target zoom level to reasonable values // gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f); @@ -1240,8 +1240,8 @@ void render_hud_attachments() gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); - glh_set_current_projection(current_proj); - glh_set_current_modelview(current_mod); + glh_set_current_projection(saved_proj); + glh_set_current_modelview(saved_mod); } LLRect get_whole_screen_region() @@ -1316,17 +1316,22 @@ BOOL setup_hud_matrices() BOOL setup_hud_matrices(const LLRect& screen_region) { - glh::matrix4f proj, model; - bool result = get_hud_matrices(screen_region, proj, model); + glh::matrix4f P, M; + bool result = get_hud_matrices(screen_region, P, M); if (!result) return result; + LLMatrix4a proj; + proj.loadu(P.m); + LLMatrix4a model; + model.loadu(M.m); + // set up transform to keep HUD objects in front of camera gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.loadMatrix(proj.m); + gGL.loadMatrix(proj.getF32ptr()); glh_set_current_projection(proj); gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.loadMatrix(model.m); + gGL.loadMatrix(model.getF32ptr()); glh_set_current_modelview(model); return TRUE; } @@ -1337,13 +1342,13 @@ void render_ui(F32 zoom_factor, int subfield, bool tiling) { LLGLState::checkStates(); - glh::matrix4f saved_view = glh_get_current_modelview(); + const LLMatrix4a saved_view = glh_get_current_modelview(); if (!gSnapshot) { gGL.pushMatrix(); gGL.loadMatrix(gGLLastModelView.getF32ptr()); - glh_set_current_modelview(glh::matrix4f(gGLLastModelView.getF32ptr())); + glh_set_current_modelview(gGLLastModelView); } { From cd36a1fe169be2e4fffad107bd3a83bf6276d68d Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 18 Jun 2014 20:32:28 -0400 Subject: [PATCH 004/159] Add MotioninJoy detection, along with a whole new control set for it.. plus bonus buttons! Tilt up to go up/jump, tilt down to go down/crouch (flying works nicely this way) Turn left to roll left, turn right to roll right, while in flycam only. Controls are mapped to the same buttons as with xbox controller. Bonus buttons: PS3 Logo button: Toggle Sit! L2 and R2... no idea what to make these, I'll come up with something --- indra/newview/llviewerjoystick.cpp | 163 ++++++++++++++++++----------- 1 file changed, 101 insertions(+), 62 deletions(-) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 3487ade1b..47e446869 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -59,7 +59,7 @@ F32 LLViewerJoystick::sLastDelta[] = {0,0,0,0,0,0,0}; F32 LLViewerJoystick::sDelta[] = {0,0,0,0,0,0,0}; // Note: Save the type of controller -enum EControllerType { NONE, SPACE_NAV, XBOX, UNKNOWN }; +enum EControllerType { NONE, SPACE_NAV, XBOX, DS3, UNKNOWN }; static EControllerType sType = NONE; // Control cursor instead of avatar? @@ -84,6 +84,28 @@ bool isXboxLike(const std::string& desc) return desc.find("Xbox") != std::string::npos || desc.find("OUYA") != std::string::npos; } + +bool isDS3Like(const std::string& desc) +{ + return desc.find("MotioninJoy") != std::string::npos; +} + +enum DS3Keys +{ + DS3_TRIANGLE_KEY = 0, + DS3_CIRCLE_KEY, + DS3_X_KEY, + DS3_SQUARE_KEY, + DS3_L1_KEY, + DS3_R1_KEY, + DS3_L2_KEY, + DS3_R2_KEY, + DS3_SELECT_KEY, + DS3_L_STICK_CLICK, + DS3_R_STICK_CLICK, + DS3_START_KEY, + DS3_LOGO_KEY +}; // // These constants specify the maximum absolute value coming in from the device. @@ -1168,11 +1190,12 @@ void LLViewerJoystick::scanJoystick() static bool toggle_cursor = false; // Xbox 360 support - if (sType == XBOX) + if (sType == XBOX || sType == DS3) { + bool ds3 = sType == DS3; // Special command keys ... // - Back = toggle flycam - if (mBtn[XBOX_BACK_KEY] == 1) + if (mBtn[ds3 ? DS3_SELECT_KEY : XBOX_BACK_KEY] == 1) { if (!toggle_flycam) toggle_flycam = toggleFlycam(); } @@ -1182,7 +1205,7 @@ void LLViewerJoystick::scanJoystick() } // - Start = toggle cursor/camera control - if (mBtn[XBOX_START_KEY] == 1) + if (mBtn[ds3 ? XBOX_START_KEY : DS3_START_KEY] == 1) { if (!toggle_cursor) toggle_cursor = toggleCursor(); } @@ -1193,40 +1216,40 @@ void LLViewerJoystick::scanJoystick() // Toggle mouselook ... static bool right_stick_click_down = false; - if (!!mBtn[XBOX_R_STICK_CLICK] != right_stick_click_down) + if (!!mBtn[ds3 ? DS3_R_STICK_CLICK : XBOX_R_STICK_CLICK] != right_stick_click_down) { - if (right_stick_click_down = mBtn[XBOX_R_STICK_CLICK]) // Note: Setting, not comparing. + if (right_stick_click_down = mBtn[ds3 ? DS3_R_STICK_CLICK : XBOX_R_STICK_CLICK]) // Note: Setting, not comparing. gAgentCamera.cameraMouselook() ? gAgentCamera.changeCameraToDefault() : gAgentCamera.changeCameraToMouselook(); } MASK mask = gKeyboard->currentMask(TRUE); // Esc static bool esc_down = false; - if (!!mBtn[XBOX_Y_KEY] != esc_down) + if (!!mBtn[ds3 ? DS3_TRIANGLE_KEY : XBOX_Y_KEY] != esc_down) { - esc_down = mBtn[XBOX_Y_KEY]; + esc_down = mBtn[ds3 ? DS3_TRIANGLE_KEY : XBOX_Y_KEY]; (gKeyboard->*(esc_down ? &LLKeyboard::handleTranslatedKeyDown : &LLKeyboard::handleTranslatedKeyDown))(KEY_ESCAPE, mask); } // Alt static bool alt_down = false; - if (!!mBtn[XBOX_A_KEY] != alt_down) + if (!!mBtn[ds3 ? DS3_X_KEY : XBOX_A_KEY] != alt_down) { - gKeyboard->setControllerKey(KEY_ALT, alt_down = mBtn[XBOX_A_KEY]); + gKeyboard->setControllerKey(KEY_ALT, alt_down = mBtn[ds3 ? DS3_X_KEY : XBOX_A_KEY]); } // Ctrl static bool ctrl_down = false; - if (!!mBtn[XBOX_X_KEY] != ctrl_down) + if (!!mBtn[ds3 ? DS3_SQUARE_KEY : XBOX_X_KEY] != ctrl_down) { - gKeyboard->setControllerKey(KEY_CONTROL, ctrl_down = mBtn[XBOX_X_KEY]); + gKeyboard->setControllerKey(KEY_CONTROL, ctrl_down = mBtn[ds3 ? DS3_SQUARE_KEY : XBOX_X_KEY]); } // Shift static bool shift_down = false; - if (!!mBtn[XBOX_B_KEY] != shift_down) + if (!!mBtn[ds3 ? DS3_CIRCLE_KEY : XBOX_B_KEY] != shift_down) { - gKeyboard->setControllerKey(KEY_SHIFT, shift_down = mBtn[XBOX_B_KEY]); + gKeyboard->setControllerKey(KEY_SHIFT, shift_down = mBtn[ds3 ? DS3_CIRCLE_KEY : XBOX_B_KEY]); } // Mouse clicks ... @@ -1234,20 +1257,34 @@ void LLViewerJoystick::scanJoystick() LLUI::getMousePositionScreen(&coord.mX, &coord.mY); static bool m1_down = false; static F32 last_m1 = 0; - if (!!mBtn[XBOX_L_BUMP_KEY] != m1_down) + if (!!mBtn[ds3 ? DS3_L1_KEY : XBOX_L_BUMP_KEY] != m1_down) { - m1_down = mBtn[XBOX_L_BUMP_KEY]; + m1_down = mBtn[ds3 ? DS3_L1_KEY : XBOX_L_BUMP_KEY]; (gViewerWindow->*(m1_down ? &LLViewerWindow::handleMouseDown : &LLViewerWindow::handleMouseUp))(gViewerWindow->getWindow(), coord, mask); if (m1_down && gFrameTimeSeconds-last_m1 == 0.5f) gViewerWindow->handleDoubleClick(gViewerWindow->getWindow(), coord, mask); last_m1 = gFrameTimeSeconds; } static bool m2_down = false; - if (!!mBtn[XBOX_R_BUMP_KEY] != m2_down) + if (!!mBtn[ds3 ? DS3_R1_KEY : XBOX_R_BUMP_KEY] != m2_down) { - m2_down = mBtn[XBOX_R_BUMP_KEY]; + m2_down = mBtn[ds3 ? DS3_R1_KEY : XBOX_R_BUMP_KEY]; (gViewerWindow->*(m2_down ? &LLViewerWindow::handleRightMouseDown : &LLViewerWindow::handleRightMouseUp))(gViewerWindow->getWindow(), coord, mask); } + + if (ds3) // Yay bonus keys~ + { + static bool sit_down = false; + if (!!mBtn[DS3_LOGO_BUTTON] != sit_down) + { + sit_down = mBtn[DS3_LOGO_BUTTON]; + (gAgentAvatarp && gAgentAvatarp->isSitting()) ? gAgent.standUp() : gAgent.sitDown(); + } + /* Singu TODO: What should these be? + DS3_L2_BUTTON + DS3_R2_BUTTON + */ + } } else // @@ -1318,7 +1355,8 @@ void LLViewerJoystick::setSNDefaults() //gViewerWindow->alertXml("CacheWillClear"); const bool xbox = sType == XBOX; - llinfos << "restoring " << (xbox ? "Xbox Controller" : "SpaceNavigator") << " defaults..." << llendl; + const bool ds3 = sType == DS3; + llinfos << "restoring " << (xbox ? "Xbox Controller" : ds3 ? "Dual Shock 3" : "SpaceNavigator") << " defaults..." << llendl; /* Axis 0: Left Thumbstick Horizontal @@ -1332,57 +1370,58 @@ void LLViewerJoystick::setSNDefaults() Debug setting InternalMapping,Jostick Axis (see above) */ gSavedSettings.setS32("JoystickAxis0", 1); // z (at) gSavedSettings.setS32("JoystickAxis1", 0); // x (slide) - gSavedSettings.setS32("JoystickAxis2", 2); // y (up) + gSavedSettings.setS32("JoystickAxis2", ds3 ? 3 : 2); // y (up) gSavedSettings.setS32("JoystickAxis3", xbox ? -1 : 4); // roll - gSavedSettings.setS32("JoystickAxis4", xbox ? 4 : 3); // pitch - gSavedSettings.setS32("JoystickAxis5", xbox ? 3 : 5); // yaw + gSavedSettings.setS32("JoystickAxis4", xbox ? 4 : ds3 ? 5 : 3); // pitch + gSavedSettings.setS32("JoystickAxis5", xbox ? 3 : ds3 ? 2 : 5); // yaw gSavedSettings.setS32("JoystickAxis6", -1); gSavedSettings.setBOOL("Cursor3D", !xbox && is_3d_cursor); gSavedSettings.setBOOL("AutoLeveling", true); gSavedSettings.setBOOL("ZoomDirect", false); - gSavedSettings.setF32("AvatarAxisScale0", (xbox ? 0.43f : 1.f) * platformScaleAvXZ); - gSavedSettings.setF32("AvatarAxisScale1", (xbox ? 0.43f : 1.f) * platformScaleAvXZ); - gSavedSettings.setF32("AvatarAxisScale2", xbox ? 0.43f : 1.f); - gSavedSettings.setF32("AvatarAxisScale4", (xbox ? 4.f : .1f) * platformScale); - gSavedSettings.setF32("AvatarAxisScale5", (xbox ? 4.f : .1f) * platformScale); - gSavedSettings.setF32("AvatarAxisScale3", (xbox ? 4.f : 0.f) * platformScale); - gSavedSettings.setF32("BuildAxisScale1", (xbox ? 0.8f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale2", (xbox ? 0.8f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale0", (xbox ? 1.6f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale4", (xbox ? 1.f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale5", (xbox ? 2.f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale3", (xbox ? 1.f : .3f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale1", (xbox ? 16.f : 2.f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale2", (xbox ? 16.f : 2.f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale0", (xbox ? 25.f : 2.1f) * platformScale); // Z Scale - gSavedSettings.setF32("FlycamAxisScale4", (xbox ? -4.f : .1f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale5", (xbox ? 4.f : .15f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale3", (xbox ? 4.f : 0.f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale6", (xbox ? 4.f : 0.f) * platformScale); + const bool game = xbox || ds3; // All game controllers are relatively the same + gSavedSettings.setF32("AvatarAxisScale0", (game ? 0.43f : 1.f) * platformScaleAvXZ); + gSavedSettings.setF32("AvatarAxisScale1", (game ? 0.43f : 1.f) * platformScaleAvXZ); + gSavedSettings.setF32("AvatarAxisScale2", xbox ? 0.43f : ds3 ? -0.43f : 1.f); + gSavedSettings.setF32("AvatarAxisScale4", (game ? 4.f : .1f) * platformScale); + gSavedSettings.setF32("AvatarAxisScale5", (game ? 4.f : .1f) * platformScale); + gSavedSettings.setF32("AvatarAxisScale3", (game ? 4.f : 0.f) * platformScale); + gSavedSettings.setF32("BuildAxisScale1", (game ? 0.8f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale2", (xbox ? 0.8f : ds3 ? -0.8f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale0", (game ? 1.6f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale4", (game ? 1.f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale5", (game ? 2.f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale3", (game ? 1.f : .3f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale1", (game ? 16.f : 2.f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale2", (game ? 16.f : ds3 ? -16.f : 2.f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale0", (game ? 25.f : 2.1f) * platformScale); // Z Scale + gSavedSettings.setF32("FlycamAxisScale4", (game ? -4.f : .1f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale5", (game ? 4.f : .15f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale3", (game ? 4.f : 0.f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale6", (game ? 4.f : 0.f) * platformScale); - gSavedSettings.setF32("AvatarAxisDeadZone0", xbox ? .2f : .1f); - gSavedSettings.setF32("AvatarAxisDeadZone1", xbox ? .2f : .1f); - gSavedSettings.setF32("AvatarAxisDeadZone2", xbox ? .2f : .1f); - gSavedSettings.setF32("AvatarAxisDeadZone3", xbox ? .2f : 1.f); - gSavedSettings.setF32("AvatarAxisDeadZone4", xbox ? .2f : .02f); - gSavedSettings.setF32("AvatarAxisDeadZone5", xbox ? .2f : .01f); - gSavedSettings.setF32("BuildAxisDeadZone0", xbox ? .02f : .01f); - gSavedSettings.setF32("BuildAxisDeadZone1", xbox ? .02f : .01f); - gSavedSettings.setF32("BuildAxisDeadZone2", xbox ? .02f : .01f); - gSavedSettings.setF32("BuildAxisDeadZone3", xbox ? .02f : .01f); - gSavedSettings.setF32("BuildAxisDeadZone4", xbox ? .02f : .01f); - gSavedSettings.setF32("BuildAxisDeadZone5", xbox ? .02f : .01f); - gSavedSettings.setF32("FlycamAxisDeadZone0", xbox ? .2f : .01f); - gSavedSettings.setF32("FlycamAxisDeadZone1", xbox ? .2f : .01f); - gSavedSettings.setF32("FlycamAxisDeadZone2", xbox ? .2f : .01f); - gSavedSettings.setF32("FlycamAxisDeadZone3", xbox ? .1f : .01f); - gSavedSettings.setF32("FlycamAxisDeadZone4", xbox ? .25f : .01f); - gSavedSettings.setF32("FlycamAxisDeadZone5", xbox ? .25f : .01f); - gSavedSettings.setF32("FlycamAxisDeadZone6", xbox ? .2f : 1.f); + gSavedSettings.setF32("AvatarAxisDeadZone0", game ? .2f : .1f); + gSavedSettings.setF32("AvatarAxisDeadZone1", game ? .2f : .1f); + gSavedSettings.setF32("AvatarAxisDeadZone2", game ? .2f : .1f); + gSavedSettings.setF32("AvatarAxisDeadZone3", game ? .2f : 1.f); + gSavedSettings.setF32("AvatarAxisDeadZone4", game ? .2f : .02f); + gSavedSettings.setF32("AvatarAxisDeadZone5", game ? .2f : .01f); + gSavedSettings.setF32("BuildAxisDeadZone0", game ? .02f : .01f); + gSavedSettings.setF32("BuildAxisDeadZone1", game ? .02f : .01f); + gSavedSettings.setF32("BuildAxisDeadZone2", game ? .02f : .01f); + gSavedSettings.setF32("BuildAxisDeadZone3", game ? .02f : .01f); + gSavedSettings.setF32("BuildAxisDeadZone4", game ? .02f : .01f); + gSavedSettings.setF32("BuildAxisDeadZone5", game ? .02f : .01f); + gSavedSettings.setF32("FlycamAxisDeadZone0", game ? .2f : .01f); + gSavedSettings.setF32("FlycamAxisDeadZone1", game ? .2f : .01f); + gSavedSettings.setF32("FlycamAxisDeadZone2", game ? .2f : .01f); + gSavedSettings.setF32("FlycamAxisDeadZone3", game ? .1f : .01f); + gSavedSettings.setF32("FlycamAxisDeadZone4", game ? .25f : .01f); + gSavedSettings.setF32("FlycamAxisDeadZone5", game ? .25f : .01f); + gSavedSettings.setF32("FlycamAxisDeadZone6", game ? .2f : 1.f); - gSavedSettings.setF32("AvatarFeathering", xbox ? 3.f : 6.f); + gSavedSettings.setF32("AvatarFeathering", game ? 3.f : 6.f); gSavedSettings.setF32("BuildFeathering", 12.f); - gSavedSettings.setF32("FlycamFeathering", xbox ? 1.f : 5.f); + gSavedSettings.setF32("FlycamFeathering", game ? 1.f : 5.f); } From b4ab9a4e57e784d65d0664f2dba2749f54cc67f8 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 18 Jun 2014 20:35:03 -0400 Subject: [PATCH 005/159] Fix cursorZoom being broken, my bad, forgot to add the increment line --- indra/newview/llviewerjoystick.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 47e446869..42482a30c 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -568,6 +568,7 @@ void LLViewerJoystick::cursorZoom(F32 inc) if (!is_approx_zero(inc)) { static U8 count = 0; + ++count; if (count == 3) // Slow down the zoom in/out. { gViewerWindow->handleScrollWheel(inc > F_APPROXIMATELY_ZERO ? 1 : -1); From b20943d49749006cd63b3aabdd97859fd0e8dfc8 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 18 Jun 2014 21:07:15 -0400 Subject: [PATCH 006/159] cd36a1fe169be2e4fffad107bd3a83bf6276d68d had some mistakes/missing pieces --- indra/newview/llviewerjoystick.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 42482a30c..173e81cf1 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -36,6 +36,7 @@ #include "lltoolmgr.h" #include "llselectmgr.h" #include "llviewermenu.h" +#include "llvoavatarself.h" // Singu Note: For toggle sit. #include "llagent.h" #include "llagentcamera.h" #include "llfocusmgr.h" @@ -753,7 +754,7 @@ void LLViewerJoystick::moveAvatar(bool reset) bool is_zero = true; static bool button_held = false; - if (mBtn[sType == XBOX ? XBOX_L_STICK_CLICK : 1] == 1) + if (mBtn[sType == XBOX ? XBOX_L_STICK_CLICK : sType == DS3 ? DS3_L_STICK_CLICK : 1] == 1) { // If AutomaticFly is enabled, then button1 merely causes a // jump (as the up/down axis already controls flying) if on the @@ -1276,9 +1277,9 @@ void LLViewerJoystick::scanJoystick() if (ds3) // Yay bonus keys~ { static bool sit_down = false; - if (!!mBtn[DS3_LOGO_BUTTON] != sit_down) + if (!!mBtn[DS3_LOGO_KEY] != sit_down) { - sit_down = mBtn[DS3_LOGO_BUTTON]; + sit_down = mBtn[DS3_LOGO_KEY]; (gAgentAvatarp && gAgentAvatarp->isSitting()) ? gAgent.standUp() : gAgent.sitDown(); } /* Singu TODO: What should these be? From 5d826b2b6224efa449a10af28b4c92fba2ab3ac6 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 18 Jun 2014 21:32:31 -0400 Subject: [PATCH 007/159] Use Nebadon's defaults for the Ouya game controller. --- indra/newview/llviewerjoystick.cpp | 31 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 173e81cf1..0b67992ab 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -1357,8 +1357,9 @@ void LLViewerJoystick::setSNDefaults() //gViewerWindow->alertXml("CacheWillClear"); const bool xbox = sType == XBOX; + const bool ouya = xbox && getDescription().find("OUYA") != std::string::npos; const bool ds3 = sType == DS3; - llinfos << "restoring " << (xbox ? "Xbox Controller" : ds3 ? "Dual Shock 3" : "SpaceNavigator") << " defaults..." << llendl; + llinfos << "restoring " << (xbox ? ouya ? "OUYA Game Controller" : "Xbox Controller" : ds3 ? "Dual Shock 3" : "SpaceNavigator") << " defaults..." << llendl; /* Axis 0: Left Thumbstick Horizontal @@ -1371,12 +1372,12 @@ void LLViewerJoystick::setSNDefaults() Syntax/Format: Debug setting InternalMapping,Jostick Axis (see above) */ gSavedSettings.setS32("JoystickAxis0", 1); // z (at) - gSavedSettings.setS32("JoystickAxis1", 0); // x (slide) - gSavedSettings.setS32("JoystickAxis2", ds3 ? 3 : 2); // y (up) - gSavedSettings.setS32("JoystickAxis3", xbox ? -1 : 4); // roll + gSavedSettings.setS32("JoystickAxis1", ouya ? 3 : 0); // x (slide) + gSavedSettings.setS32("JoystickAxis2", ouya ? 4 : ds3 ? 3 : 2); // y (up) + gSavedSettings.setS32("JoystickAxis3", xbox ? ouya ? 3 : -1 : 4); // roll gSavedSettings.setS32("JoystickAxis4", xbox ? 4 : ds3 ? 5 : 3); // pitch - gSavedSettings.setS32("JoystickAxis5", xbox ? 3 : ds3 ? 2 : 5); // yaw - gSavedSettings.setS32("JoystickAxis6", -1); + gSavedSettings.setS32("JoystickAxis5", xbox ? ouya ? 0 : 3 : ds3 ? 2 : 5); // yaw + gSavedSettings.setS32("JoystickAxis6", ouya ? 5 : -1); gSavedSettings.setBOOL("Cursor3D", !xbox && is_3d_cursor); gSavedSettings.setBOOL("AutoLeveling", true); @@ -1389,16 +1390,16 @@ void LLViewerJoystick::setSNDefaults() gSavedSettings.setF32("AvatarAxisScale4", (game ? 4.f : .1f) * platformScale); gSavedSettings.setF32("AvatarAxisScale5", (game ? 4.f : .1f) * platformScale); gSavedSettings.setF32("AvatarAxisScale3", (game ? 4.f : 0.f) * platformScale); - gSavedSettings.setF32("BuildAxisScale1", (game ? 0.8f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale2", (xbox ? 0.8f : ds3 ? -0.8f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale0", (game ? 1.6f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale4", (game ? 1.f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale1", (game ? ouya ? 20.f : 0.8f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale2", (xbox ? ouya ? 20.f : 0.8f : ds3 ? -0.8f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale0", (game ? ouya ? 50.f : 1.6f : .3f) * platformScale); + gSavedSettings.setF32("BuildAxisScale4", (game ? ouya ? 1.8f : 1.f : .3f) * platformScale); gSavedSettings.setF32("BuildAxisScale5", (game ? 2.f : .3f) * platformScale); - gSavedSettings.setF32("BuildAxisScale3", (game ? 1.f : .3f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale1", (game ? 16.f : 2.f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale2", (game ? 16.f : ds3 ? -16.f : 2.f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale0", (game ? 25.f : 2.1f) * platformScale); // Z Scale - gSavedSettings.setF32("FlycamAxisScale4", (game ? -4.f : .1f) * platformScale); + gSavedSettings.setF32("BuildAxisScale3", (game ? ouya ? -6.f : 1.f : .3f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale1", (game ? ouya ? 20.f : 16.f : 2.f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale2", (game ? ouya ? 20.f : 16.f : ds3 ? -16.f : 2.f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale0", (game ? ouya ? 50.f : 25.f : 2.1f) * platformScale); // Z Scale + gSavedSettings.setF32("FlycamAxisScale4", (game ? ouya ? 1.80 : -4.f : .1f) * platformScale); gSavedSettings.setF32("FlycamAxisScale5", (game ? 4.f : .15f) * platformScale); gSavedSettings.setF32("FlycamAxisScale3", (game ? 4.f : 0.f) * platformScale); gSavedSettings.setF32("FlycamAxisScale6", (game ? 4.f : 0.f) * platformScale); From 499cd487631f6ecd742872f27e77b560da930ab7 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 19 Jun 2014 11:29:18 -0400 Subject: [PATCH 008/159] More touches for DS3 support. --- indra/newview/llviewerjoystick.cpp | 76 +++++++++++++++++++----------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 0b67992ab..75e4c2c33 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -316,9 +316,20 @@ void LLViewerJoystick::init(bool autoenable) gSavedSettings.setString("JoystickInitialized", "XboxController"); } } + else if (isDS3Like(getDescription())) + { + sType = DS3; + // It's a DS3 controller, we have defaults for it. + if (gSavedSettings.getString("JoystickInitialized") != "DualShock3") + { + // Only set the defaults if we haven't already (in case they were overridden) + setSNDefaults(); + gSavedSettings.setString("JoystickInitialized", "DualShock3"); + } + } else { - // It's not a Space Navigator or 360 controller + // It's not a Space Navigator, 360 controller, or DualShock 3 sType = UNKNOWN; gSavedSettings.setString("JoystickInitialized", "UnknownDevice"); } @@ -1197,7 +1208,8 @@ void LLViewerJoystick::scanJoystick() bool ds3 = sType == DS3; // Special command keys ... // - Back = toggle flycam - if (mBtn[ds3 ? DS3_SELECT_KEY : XBOX_BACK_KEY] == 1) + U8 key = ds3 ? DS3_SELECT_KEY : XBOX_BACK_KEY; + if (mBtn[key] == 1) { if (!toggle_flycam) toggle_flycam = toggleFlycam(); } @@ -1207,7 +1219,8 @@ void LLViewerJoystick::scanJoystick() } // - Start = toggle cursor/camera control - if (mBtn[ds3 ? XBOX_START_KEY : DS3_START_KEY] == 1) + key = ds3 ? DS3_START_KEY : XBOX_START_KEY; + if (mBtn[key] == 1) { if (!toggle_cursor) toggle_cursor = toggleCursor(); } @@ -1218,40 +1231,45 @@ void LLViewerJoystick::scanJoystick() // Toggle mouselook ... static bool right_stick_click_down = false; - if (!!mBtn[ds3 ? DS3_R_STICK_CLICK : XBOX_R_STICK_CLICK] != right_stick_click_down) + key = ds3 ? DS3_R_STICK_CLICK : XBOX_R_STICK_CLICK; + if (!!mBtn[key] != right_stick_click_down) { - if (right_stick_click_down = mBtn[ds3 ? DS3_R_STICK_CLICK : XBOX_R_STICK_CLICK]) // Note: Setting, not comparing. + if (right_stick_click_down = mBtn[key]) // Note: Setting, not comparing. gAgentCamera.cameraMouselook() ? gAgentCamera.changeCameraToDefault() : gAgentCamera.changeCameraToMouselook(); } MASK mask = gKeyboard->currentMask(TRUE); // Esc static bool esc_down = false; - if (!!mBtn[ds3 ? DS3_TRIANGLE_KEY : XBOX_Y_KEY] != esc_down) + key = ds3 ? DS3_TRIANGLE_KEY : XBOX_Y_KEY; + if (!!mBtn[key] != esc_down) { - esc_down = mBtn[ds3 ? DS3_TRIANGLE_KEY : XBOX_Y_KEY]; + esc_down = mBtn[key]; (gKeyboard->*(esc_down ? &LLKeyboard::handleTranslatedKeyDown : &LLKeyboard::handleTranslatedKeyDown))(KEY_ESCAPE, mask); } // Alt static bool alt_down = false; - if (!!mBtn[ds3 ? DS3_X_KEY : XBOX_A_KEY] != alt_down) + key = ds3 ? DS3_X_KEY : XBOX_A_KEY; + if (!!mBtn[key] != alt_down) { - gKeyboard->setControllerKey(KEY_ALT, alt_down = mBtn[ds3 ? DS3_X_KEY : XBOX_A_KEY]); + gKeyboard->setControllerKey(KEY_ALT, alt_down = mBtn[key]); } // Ctrl static bool ctrl_down = false; - if (!!mBtn[ds3 ? DS3_SQUARE_KEY : XBOX_X_KEY] != ctrl_down) + key = ds3 ? DS3_SQUARE_KEY : XBOX_X_KEY; + if (!!mBtn[key] != ctrl_down) { - gKeyboard->setControllerKey(KEY_CONTROL, ctrl_down = mBtn[ds3 ? DS3_SQUARE_KEY : XBOX_X_KEY]); + gKeyboard->setControllerKey(KEY_CONTROL, ctrl_down = mBtn[key]); } // Shift static bool shift_down = false; - if (!!mBtn[ds3 ? DS3_CIRCLE_KEY : XBOX_B_KEY] != shift_down) + key = ds3 ? DS3_CIRCLE_KEY : XBOX_B_KEY; + if (!!mBtn[key] != shift_down) { - gKeyboard->setControllerKey(KEY_SHIFT, shift_down = mBtn[ds3 ? DS3_CIRCLE_KEY : XBOX_B_KEY]); + gKeyboard->setControllerKey(KEY_SHIFT, shift_down = mBtn[key]); } // Mouse clicks ... @@ -1259,18 +1277,20 @@ void LLViewerJoystick::scanJoystick() LLUI::getMousePositionScreen(&coord.mX, &coord.mY); static bool m1_down = false; static F32 last_m1 = 0; - if (!!mBtn[ds3 ? DS3_L1_KEY : XBOX_L_BUMP_KEY] != m1_down) + key = ds3 ? DS3_L1_KEY : XBOX_L_BUMP_KEY; + if (!!mBtn[key] != m1_down) { - m1_down = mBtn[ds3 ? DS3_L1_KEY : XBOX_L_BUMP_KEY]; + m1_down = mBtn[key]; (gViewerWindow->*(m1_down ? &LLViewerWindow::handleMouseDown : &LLViewerWindow::handleMouseUp))(gViewerWindow->getWindow(), coord, mask); if (m1_down && gFrameTimeSeconds-last_m1 == 0.5f) gViewerWindow->handleDoubleClick(gViewerWindow->getWindow(), coord, mask); last_m1 = gFrameTimeSeconds; } static bool m2_down = false; - if (!!mBtn[ds3 ? DS3_R1_KEY : XBOX_R_BUMP_KEY] != m2_down) + key = ds3 ? DS3_R1_KEY : XBOX_R_BUMP_KEY; + if (!!mBtn[key] != m2_down) { - m2_down = mBtn[ds3 ? DS3_R1_KEY : XBOX_R_BUMP_KEY]; + m2_down = mBtn[key]; (gViewerWindow->*(m2_down ? &LLViewerWindow::handleRightMouseDown : &LLViewerWindow::handleRightMouseUp))(gViewerWindow->getWindow(), coord, mask); } @@ -1279,12 +1299,12 @@ void LLViewerJoystick::scanJoystick() static bool sit_down = false; if (!!mBtn[DS3_LOGO_KEY] != sit_down) { - sit_down = mBtn[DS3_LOGO_KEY]; - (gAgentAvatarp && gAgentAvatarp->isSitting()) ? gAgent.standUp() : gAgent.sitDown(); + if (sit_down = mBtn[DS3_LOGO_KEY]) + (gAgentAvatarp && gAgentAvatarp->isSitting()) ? gAgent.standUp() : gAgent.sitDown(); } /* Singu TODO: What should these be? - DS3_L2_BUTTON - DS3_R2_BUTTON + DS3_L2_KEY + DS3_R2_KEY */ } } @@ -1379,16 +1399,16 @@ void LLViewerJoystick::setSNDefaults() gSavedSettings.setS32("JoystickAxis5", xbox ? ouya ? 0 : 3 : ds3 ? 2 : 5); // yaw gSavedSettings.setS32("JoystickAxis6", ouya ? 5 : -1); - gSavedSettings.setBOOL("Cursor3D", !xbox && is_3d_cursor); + const bool game = xbox || ds3; // All game controllers are relatively the same + gSavedSettings.setBOOL("Cursor3D", !game && is_3d_cursor); gSavedSettings.setBOOL("AutoLeveling", true); gSavedSettings.setBOOL("ZoomDirect", false); - const bool game = xbox || ds3; // All game controllers are relatively the same - gSavedSettings.setF32("AvatarAxisScale0", (game ? 0.43f : 1.f) * platformScaleAvXZ); - gSavedSettings.setF32("AvatarAxisScale1", (game ? 0.43f : 1.f) * platformScaleAvXZ); + gSavedSettings.setF32("AvatarAxisScale0", (xbox ? 0.43f : ds3 ? 0.215f : 1.f) * platformScaleAvXZ); + gSavedSettings.setF32("AvatarAxisScale1", (xbox ? 0.43f : ds3 ? 0.215f : 1.f) * platformScaleAvXZ); gSavedSettings.setF32("AvatarAxisScale2", xbox ? 0.43f : ds3 ? -0.43f : 1.f); - gSavedSettings.setF32("AvatarAxisScale4", (game ? 4.f : .1f) * platformScale); - gSavedSettings.setF32("AvatarAxisScale5", (game ? 4.f : .1f) * platformScale); + gSavedSettings.setF32("AvatarAxisScale4", ds3 ? 0.215f * platformScaleAvXZ : ((xbox ? 4.f : .1f) * platformScale)); + gSavedSettings.setF32("AvatarAxisScale5", ds3 ? 0.215f * platformScaleAvXZ : ((xbox ? 4.f : .1f) * platformScale)); gSavedSettings.setF32("AvatarAxisScale3", (game ? 4.f : 0.f) * platformScale); gSavedSettings.setF32("BuildAxisScale1", (game ? ouya ? 20.f : 0.8f : .3f) * platformScale); gSavedSettings.setF32("BuildAxisScale2", (xbox ? ouya ? 20.f : 0.8f : ds3 ? -0.8f : .3f) * platformScale); @@ -1401,7 +1421,7 @@ void LLViewerJoystick::setSNDefaults() gSavedSettings.setF32("FlycamAxisScale0", (game ? ouya ? 50.f : 25.f : 2.1f) * platformScale); // Z Scale gSavedSettings.setF32("FlycamAxisScale4", (game ? ouya ? 1.80 : -4.f : .1f) * platformScale); gSavedSettings.setF32("FlycamAxisScale5", (game ? 4.f : .15f) * platformScale); - gSavedSettings.setF32("FlycamAxisScale3", (game ? 4.f : 0.f) * platformScale); + gSavedSettings.setF32("FlycamAxisScale3", (xbox ? 4.f : ds3 ? 6.f : 0.f) * platformScale); gSavedSettings.setF32("FlycamAxisScale6", (game ? 4.f : 0.f) * platformScale); gSavedSettings.setF32("AvatarAxisDeadZone0", game ? .2f : .1f); From 2075042ba7001a8c651599b7a7c7382b566181cf Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 19 Jun 2014 12:48:00 -0400 Subject: [PATCH 009/159] Fix key2name not working on the first try. Also make it comply with the name system choice. --- indra/newview/chatbar_as_cmdline.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index e079cf4e5..5a3fab318 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -33,6 +33,7 @@ #include "chatbar_as_cmdline.h" +#include "llavatarnamecache.h" #include "llcalc.h" #include "llchatbar.h" @@ -215,6 +216,12 @@ struct ProfCtrlListAccum : public LLControlGroup::ApplyFunctor std::vector > mVariableList; }; #endif //PROF_CTRL_CALLS +void spew_key_to_name(const LLUUID& targetKey, const LLAvatarName& av_name) +{ + std::string object_name; + LLAvatarNameCache::getPNSName(av_name, object_name); + cmdline_printchat(llformat("%s: %s", targetKey.asString().c_str(), object_name.c_str())); +} bool cmd_line_chat(std::string revised_text, EChatType type) { static LLCachedControl sAscentCmdLine(gSavedSettings, "AscentCmdLine"); @@ -289,11 +296,13 @@ bool cmd_line_chat(std::string revised_text, EChatType type) LLUUID targetKey; if(i >> targetKey) { - std::string object_name; - gCacheName->getFullName(targetKey, object_name); - char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ - snprintf(buffer,sizeof(buffer),"%s: (%s)",targetKey.asString().c_str(), object_name.c_str()); - cmdline_printchat(std::string(buffer)); + LLAvatarName av_name; + if (!LLAvatarNameCache::get(targetKey, &av_name)) + { + LLAvatarNameCache::get(targetKey, boost::bind(spew_key_to_name, _1, _2)); + return false; + } + spew_key_to_name(targetKey, av_name); } return false; } From e0746fca12f4312c3b4bcb723105b64a688722f6 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 20 Jun 2014 15:53:54 -0400 Subject: [PATCH 010/159] Sync up llgroupactions with v-r/rlv. --- indra/newview/llgroupactions.cpp | 130 ++++++++++++++++-- indra/newview/llgroupactions.h | 9 +- .../skins/default/xui/en-us/notifications.xml | 11 ++ 3 files changed, 134 insertions(+), 16 deletions(-) diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index da27ac259..b3cd2fdec 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -90,7 +90,6 @@ public: // CP_TODO: get the value we pass in via the XUI name // of the tab instead of using a literal like this LLFloaterMyFriends::showInstance( 1 ); - return true; } return false; @@ -123,6 +122,80 @@ public: }; LLGroupHandler gGroupHandler; +// This object represents a pending request for specified group member information +// which is needed to check whether avatar can leave group +class LLFetchGroupMemberData : public LLGroupMgrObserver +{ +public: + LLFetchGroupMemberData(const LLUUID& group_id) : + mGroupId(group_id), + mRequestProcessed(false), + LLGroupMgrObserver(group_id) + { + llinfos << "Sending new group member request for group_id: "<< group_id << llendl; + LLGroupMgr* mgr = LLGroupMgr::getInstance(); + // register ourselves as an observer + mgr->addObserver(this); + // send a request + mgr->sendGroupPropertiesRequest(group_id); + mgr->sendCapGroupMembersRequest(group_id); + } + + ~LLFetchGroupMemberData() + { + if (!mRequestProcessed) + { + // Request is pending + llwarns << "Destroying pending group member request for group_id: " + << mGroupId << llendl; + } + // Remove ourselves as an observer + LLGroupMgr::getInstance()->removeObserver(this); + } + + void changed(LLGroupChange gc) + { + if (gc == GC_MEMBER_DATA && !mRequestProcessed) + { + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupId); + if (!gdatap) + { + llwarns << "LLGroupMgr::getInstance()->getGroupData() was NULL" << llendl; + } + else if (!gdatap->isMemberDataComplete()) + { + llwarns << "LLGroupMgr::getInstance()->getGroupData()->isMemberDataComplete() was FALSE" << llendl; + } + else + { + processGroupData(); + mRequestProcessed = true; + } + } + } + + LLUUID getGroupId() { return mGroupId; } + virtual void processGroupData() = 0; +protected: + LLUUID mGroupId; +private: + bool mRequestProcessed; +}; + +class LLFetchLeaveGroupData : public LLFetchGroupMemberData +{ +public: + LLFetchLeaveGroupData(const LLUUID& group_id) + : LLFetchGroupMemberData(group_id) + {} + void processGroupData() + { + LLGroupActions::processLeaveGroupDataResponse(mGroupId); + } +}; + +LLFetchLeaveGroupData* gFetchLeaveGroupData = NULL; + // static void LLGroupActions::search() { @@ -226,27 +299,55 @@ bool LLGroupActions::onJoinGroup(const LLSD& notification, const LLSD& response) void LLGroupActions::leave(const LLUUID& group_id) { // if (group_id.isNull()) -// return; // [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f if ( (group_id.isNull()) || ((gAgent.getGroupID() == group_id) && (gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP))) ) - return; // [/RLVa:KB] + { + return; + } - S32 count = gAgent.mGroups.count(); - S32 i; - for (i = 0; i < count; ++i) + LLGroupData group_data; + if (gAgent.getGroupData(group_id, group_data)) { - if(gAgent.mGroups.get(i).mID == group_id) - break; + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id); + if (!gdatap || !gdatap->isMemberDataComplete()) + { + if (gFetchLeaveGroupData != NULL) + { + delete gFetchLeaveGroupData; + gFetchLeaveGroupData = NULL; + } + gFetchLeaveGroupData = new LLFetchLeaveGroupData(group_id); } - if (i < count) + else + { + processLeaveGroupDataResponse(group_id); + } + } +} + +//static +void LLGroupActions::processLeaveGroupDataResponse(const LLUUID group_id) +{ + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id); + LLUUID agent_id = gAgent.getID(); + LLGroupMgrGroupData::member_list_t::iterator mit = gdatap->mMembers.find(agent_id); + //get the member data for the group + if ( mit != gdatap->mMembers.end() ) { - LLSD args; - args["GROUP"] = gAgent.mGroups.get(i).mName; - LLSD payload; - payload["group_id"] = group_id; - LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, onLeaveGroup); + LLGroupMemberData* member_data = (*mit).second; + + if ( member_data && member_data->isOwner() && gdatap->mMemberCount == 1) + { + LLNotificationsUtil::add("OwnerCannotLeaveGroup"); + return; + } } + LLSD args; + args["GROUP"] = gdatap->mName; + LLSD payload; + payload["group_id"] = group_id; + LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, onLeaveGroup); } // static @@ -287,7 +388,6 @@ void LLGroupActions::inspect(const LLUUID& group_id) openGroupProfile(group_id); } - // static void LLGroupActions::show(const LLUUID& group_id) { diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h index b59fbbe40..0cce7460b 100644 --- a/indra/newview/llgroupactions.h +++ b/indra/newview/llgroupactions.h @@ -124,8 +124,15 @@ public: private: static bool onJoinGroup(const LLSD& notification, const LLSD& response); static bool onLeaveGroup(const LLSD& notification, const LLSD& response); + + /** + * This function is called by LLFetchLeaveGroupData upon receiving a response to a group + * members data request. + */ + static void processLeaveGroupDataResponse(const LLUUID group_id); static LLFloaterGroupInfo* openGroupProfile(const LLUUID& group_id); + + friend class LLFetchLeaveGroupData; }; #endif // LL_LLGROUPACTIONS_H - diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index 3fb2d93fe..fa31d4d26 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -3313,6 +3313,17 @@ Leave Group? yestext="OK"/> + + Unable to leave group. You cannot leave the group because you are the last owner of the group. Please assign another member to the owner role first. + group + + + Date: Fri, 20 Jun 2014 18:01:59 -0400 Subject: [PATCH 011/159] Added Eject avatar from group notification from v-r. --- indra/newview/llpanelgrouproles.cpp | 19 +++++++++++++++++++ indra/newview/llpanelgrouproles.h | 1 + .../skins/default/xui/en-us/notifications.xml | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 9fccb989a..b7f09a725 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1083,10 +1083,29 @@ void LLPanelGroupMembersSubTab::handleEjectMembers() mMembersList->deleteSelectedItems(); + sendEjectNotifications(mGroupID, selected_members); + LLGroupMgr::getInstance()->sendGroupMemberEjects(mGroupID, selected_members); } +void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members) +{ + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id); + + if (group_data) + { + for (uuid_vec_t::const_iterator i = selected_members.begin(); i != selected_members.end(); ++i) + { + LLSD args; + args["AVATAR_NAME"] = LLSLURL("agent", *i, "displayname").getSLURLString(); + args["GROUP_NAME"] = group_data->mName; + + LLNotifications::instance().add(LLNotification::Params("EjectAvatarFromGroup").substitutions(args)); + } + } +} + void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id, LLRoleMemberChangeType type) { diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index b5c5b54a5..a289b9865 100644 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -176,6 +176,7 @@ public: static void onEjectMembers(void*); void handleEjectMembers(); + void sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members); static void onRoleCheck(LLUICtrl* check, void* user_data); void handleRoleCheck(const LLUUID& role_id, diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index fa31d4d26..abba09a3d 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -1572,6 +1572,15 @@ Eject [AVATAR_NAME] from your land? yestext="Eject"/> + +You ejected [AVATAR_NAME] from group [GROUP_NAME] + group + + Date: Sat, 21 Jun 2014 15:02:20 -0400 Subject: [PATCH 012/159] Right click menus in avatar picker lists and in group invite avatar list. --- .../skins/default/xui/en-us/floater_avatar_picker.xml | 6 +++--- .../newview/skins/default/xui/en-us/panel_group_invite.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en-us/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en-us/floater_avatar_picker.xml index 5a8c8c44b..4f66ebac2 100644 --- a/indra/newview/skins/default/xui/en-us/floater_avatar_picker.xml +++ b/indra/newview/skins/default/xui/en-us/floater_avatar_picker.xml @@ -46,7 +46,7 @@ height="20" label="Find" label_selected="Find" left_delta="20" right="-10" mouse_opaque="true" name="Find" scale_image="TRUE" width="95" /> @@ -68,7 +68,7 @@ function="Refresh.FriendList"/> @@ -96,7 +96,7 @@ Meters diff --git a/indra/newview/skins/default/xui/en-us/panel_group_invite.xml b/indra/newview/skins/default/xui/en-us/panel_group_invite.xml index 8bacbe93b..213f48242 100644 --- a/indra/newview/skins/default/xui/en-us/panel_group_invite.xml +++ b/indra/newview/skins/default/xui/en-us/panel_group_invite.xml @@ -13,7 +13,7 @@ Resident Chooser' to start. column_padding="0" draw_border="true" height="174" left="5" multi_select="true" name="invitee_list" tool_tip="Hold the Ctrl key and click resident names to multi-select." - width="200" /> + width="200" menu_num="0"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index b71f3505f..d352a063f 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -179,6 +179,26 @@ You may choose to allow or deny the corresponding domain or in-world scripted ob text="Whitelist"/> + + +Enter a domain name to be added to the [LIST]: + confirm +
+ +
@@ -112,8 +112,8 @@ mouse_opaque="false" name="remove_whitelist"> + function="MediaFilter.OnRemove" + parameter="1"/> @@ -176,8 +176,7 @@ mouse_opaque="false" name="add_blacklist"> + function="MediaFilter.OnAdd"/> @@ -203,8 +202,7 @@ mouse_opaque="false" name="remove_blacklist"> + function="MediaFilter.OnRemove"/> From bd7e291787291af46b550cd05850a7ebd5949bd8 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Jul 2014 19:05:24 -0400 Subject: [PATCH 071/159] Debug output that was once useful to me. --- indra/llmessage/llavatarnamecache.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index b16b086a0..01ea42727 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -794,6 +794,7 @@ void LLAvatarNameCache::setUseDisplayNames(bool use) if (use != sUseDisplayNames) { sUseDisplayNames = use; + LL_DEBUGS("AvNameCache") << "Display names are now: " << (use ? "on" : "off") << LL_ENDL; // flush our cache sCache.clear(); From bf9d3acf3368e889e2a40c5ee15125f68b43705b Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Jul 2014 19:07:16 -0400 Subject: [PATCH 072/159] Factor in mAvatarOffset(hover) when calculating the legacy offset, though I doubt this helps. --- indra/newview/llvoavatarself.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index c427ae014..885b525df 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -3258,7 +3258,7 @@ LLVector3 LLVOAvatarSelf::getLegacyAvatarOffset() const if(on_pose_stand) offset.mV[VZ] += 7.5f; - return offset; + return mAvatarOffset + offset; } // static From cd85afc9a5bebc2a2a7a4691d44fce12129c2b28 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Mon, 21 Jul 2014 20:28:23 -0500 Subject: [PATCH 073/159] Quick workaround to fix issue with simple geom not rendering in deferred 'underwater' pass. --- .../app_settings/shaders/class1/lighting/lightWaterF.glsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl index 3586652cb..248bff55f 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl @@ -39,10 +39,10 @@ void default_lighting_water() { vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; - if(color.a < .004) + /*if(color.a < .004) { discard; - } + }*/ color.rgb = atmosLighting(color.rgb); From 75e85701c6e916663955345f56215119a83011b5 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Jul 2014 22:56:18 -0400 Subject: [PATCH 074/159] Add Ban From Group option to right click menu of avatar lists. Also missed two touchups for the Responder API merge in llfloaterperms.cpp --- indra/newview/llavataractions.cpp | 19 +++++++++++++++++++ indra/newview/llfloaterperms.cpp | 4 ++-- indra/newview/llviewermenu.cpp | 11 +++++++++++ .../skins/default/xui/en-us/menu_avs_list.xml | 4 ++++ .../skins/default/xui/en-us/menu_radar.xml | 4 ++++ 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 35f731bff..fae1b7c3d 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -37,6 +37,7 @@ #include "llagent.h" #include "llcallingcard.h" // for LLAvatarTracker #include "llfloateravatarinfo.h" +#include "llfloatergroupbulkban.h" #include "llfloatergroupinvite.h" #include "llfloatergroups.h" #include "llfloaterwebprofile.h" @@ -747,6 +748,24 @@ bool LLAvatarActions::handlePay(const LLSD& notification, const LLSD& response, return false; } +// Ban from group functions +void callback_ban_from_group(const LLUUID& group, uuid_vec_t& ids) +{ + LLFloaterGroupBulkBan::showForGroup(group, &ids); +} + +void ban_from_group(const uuid_vec_t& ids) +{ + if (LLFloaterGroupPicker* widget = LLFloaterGroupPicker::showInstance(ids.front())) // It'd be cool if LLSD could be formed from uuid_vec_t + { + widget->center(); + widget->setPowersMask(GP_GROUP_BAN_ACCESS); + widget->removeNoneOption(); + widget->setSelectGroupCallback(boost::bind(callback_ban_from_group, _1, ids)); + } +} +// + // static void LLAvatarActions::callback_invite_to_group(LLUUID group_id, LLUUID id) { diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index bb0dbe934..aa6b76c87 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -234,8 +234,8 @@ private: void httpFailure(void) { // Prevent 404s from annoying the user all the tme - if (status == HTTP_NOT_FOUND) - LL_INFOS("FloaterPermsResponder") << "Failed to send default permissions to simulator. 404, reason: " << reason << LL_ENDL; + if (mStatus == HTTP_NOT_FOUND) + LL_INFOS("FloaterPermsResponder") << "Failed to send default permissions to simulator. 404, reason: " << mReason << LL_ENDL; else // // Do not display the same error more than once in a row diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d417b1d2d..bcc2f5ee5 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9012,6 +9012,16 @@ class ListVisibleWebProfile : public view_listener_t } }; +void ban_from_group(const uuid_vec_t& ids); +class ListBanFromGroup : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + ban_from_group(get_focused_list_ids_selected()); + return true; + } +}; + class ListCopySLURL : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -9528,6 +9538,7 @@ void initialize_menus() addMenu(new ListEnableMute(), "List.EnableMute"); addMenu(new ListEnableOfferTeleport(), "List.EnableOfferTeleport"); addMenu(new ListVisibleWebProfile(), "List.VisibleWebProfile"); + addMenu(new ListBanFromGroup(), "List.BanFromGroup"); addMenu(new ListCopySLURL(), "List.CopySLURL"); addMenu(new ListCopyUUIDs(), "List.CopyUUIDs"); addMenu(new ListInviteToGroup(), "List.InviteToGroup"); diff --git a/indra/newview/skins/default/xui/en-us/menu_avs_list.xml b/indra/newview/skins/default/xui/en-us/menu_avs_list.xml index 53fff36bd..2ba08eaaa 100644 --- a/indra/newview/skins/default/xui/en-us/menu_avs_list.xml +++ b/indra/newview/skins/default/xui/en-us/menu_avs_list.xml @@ -44,6 +44,10 @@ + + + + diff --git a/indra/newview/skins/default/xui/en-us/menu_radar.xml b/indra/newview/skins/default/xui/en-us/menu_radar.xml index 6104e9b1a..35cae2cd9 100644 --- a/indra/newview/skins/default/xui/en-us/menu_radar.xml +++ b/indra/newview/skins/default/xui/en-us/menu_radar.xml @@ -45,6 +45,10 @@ + + + + From f62fc8ab15a0dbb155e05ae023f6fae452d5582b Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Jul 2014 23:11:03 -0400 Subject: [PATCH 075/159] Fix right clicking on lists of avatars and selecting ban/invite not working for nonfriends who aren't nearby. Also touch up group invite floater to show names we can't get from voavatars in the user's global namesystem preference. --- indra/newview/llpanelgroupbulk.cpp | 2 +- indra/newview/llpanelgroupinvite.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp index 6e4a440da..c6e290963 100644 --- a/indra/newview/llpanelgroupbulk.cpp +++ b/indra/newview/llpanelgroupbulk.cpp @@ -397,7 +397,7 @@ void LLPanelGroupBulk::addUsers(uuid_vec_t& agent_ids) //looks like user try to invite offline friend //for offline avatar_id gObjectList.findObject() will return null //so we need to do this additional search in avatar tracker, see EXT-4732 - if (LLAvatarTracker::instance().isBuddy(agent_id)) + //if (LLAvatarTracker::instance().isBuddy(agent_id)) // Singu Note: We may be using this from another avatar list like group profile, disregard friendship status. { LLAvatarName av_name; if (!LLAvatarNameCache::get(agent_id, &av_name)) diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index e49c3387f..5ae135380 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -461,7 +461,7 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids) //looks like user try to invite offline friend //for offline avatar_id gObjectList.findObject() will return null //so we need to do this additional search in avatar tracker, see EXT-4732 - if (LLAvatarTracker::instance().isBuddy(agent_id)) + //if (LLAvatarTracker::instance().isBuddy(agent_id)) // Singu Note: We may be using this from another avatar list like group profile, disregard friendship status. { LLAvatarName av_name; if (!LLAvatarNameCache::get(agent_id, &av_name)) @@ -476,7 +476,9 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids) } else { - names.push_back(av_name.getLegacyName()); + std::string name; + LLAvatarNameCache::getPNSName(av_name, name); + names.push_back(name); } } } @@ -489,7 +491,9 @@ void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const LLAvatarName& a std::vector names; uuid_vec_t agent_ids; agent_ids.push_back(id); - names.push_back(av_name.getLegacyName()); + std::string name; + LLAvatarNameCache::getPNSName(av_name, name); + names.push_back(name); mImplementation->addUsers(names, agent_ids); } From c6eb3d790e792720f07ebc96d63546dcec0e700e Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Jul 2014 23:11:53 -0400 Subject: [PATCH 076/159] MAINT-4241 FIXED [Group Bans] Ban member(s) button is not greyed out for banning group owners. Viewer gives message that you ejected group owner. by Andrey Kleshchev 5598f66 --- indra/newview/llgroupmgr.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 7ad1a017a..1acafb160 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -2248,6 +2248,22 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) online_status, is_owner); + LLGroupMemberData* member_old = group_datap->mMembers[member_id]; + if (member_old && group_datap->mRoleMemberDataComplete) + { + LLGroupMemberData::role_list_t::iterator rit = member_old->roleBegin(); + LLGroupMemberData::role_list_t::iterator end = member_old->roleEnd(); + + for ( ; rit != end; ++rit) + { + data->addRole((*rit).first, (*rit).second); + } + } + else + { + group_datap->mRoleMemberDataComplete = false; + } + group_datap->mMembers[member_id] = data; } @@ -2265,7 +2281,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) group_datap->mMemberDataComplete = true; group_datap->mMemberRequestID.setNull(); // Make the role-member data request - if (group_datap->mPendingRoleMemberRequest) + if (group_datap->mPendingRoleMemberRequest || !group_datap->mRoleMemberDataComplete) { group_datap->mPendingRoleMemberRequest = false; LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_id); From 8159eff6646d8f0dd8673eefaa4c4473cdfa457b Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 21 Jul 2014 23:13:12 -0400 Subject: [PATCH 077/159] Ban From Group option belongs in the Moderation submenu on the radar. --- indra/newview/skins/default/xui/en-us/menu_radar.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en-us/menu_radar.xml b/indra/newview/skins/default/xui/en-us/menu_radar.xml index 35cae2cd9..0a9e734aa 100644 --- a/indra/newview/skins/default/xui/en-us/menu_radar.xml +++ b/indra/newview/skins/default/xui/en-us/menu_radar.xml @@ -45,10 +45,6 @@ - - - - @@ -141,6 +137,10 @@ + + + + From 41eb6872431ebaa79c98550d26c797415d79bb67 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Tue, 22 Jul 2014 03:39:01 -0400 Subject: [PATCH 078/159] Fix compile errors and warnings on linux after merging Shyotl. --- indra/llmath/llmatrix4a.h | 28 ++++++++++++++++----------- indra/llmath/lloctree.h | 4 ++-- indra/newview/lldrawpool.cpp | 3 ++- indra/newview/llflexibleobject.cpp | 6 ++++-- indra/newview/llviewercamera.h | 4 ++-- indra/newview/llviewerobjectlist.cpp | 3 ++- indra/newview/llviewerpartsim.cpp | 16 +++++++++------ indra/newview/llviewertextureanim.cpp | 3 ++- 8 files changed, 41 insertions(+), 26 deletions(-) diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index f322c087a..0af8105ec 100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h @@ -663,22 +663,28 @@ public: } //======================Logic==================== +private: + template inline void init_foos(LLMatrix4a& foos) const + { + static bool done(false); + if (done) return; + const LLVector4a delta(0.0001f); + foos.setIdentity(); + foos.getRow<0>().sub(delta); + foos.getRow<1>().sub(delta); + foos.getRow<2>().sub(delta); + foos.getRow<3>().sub(delta); + done = true; + } + +public: inline bool isIdentity() const { static LLMatrix4a mins; static LLMatrix4a maxs; - static LLVector4a delta(0.0001f); - static bool init_mins = ( mins.setIdentity(), - mins.getRow<0>().sub(delta), - mins.getRow<1>().sub(delta), - mins.getRow<2>().sub(delta), - mins.getRow<3>().sub(delta), true ); - static bool init_maxs = ( maxs.setIdentity(), - maxs.getRow<0>().add(delta), - maxs.getRow<1>().add(delta), - maxs.getRow<2>().add(delta), - maxs.getRow<3>().add(delta), true ); + init_foos(mins); + init_foos(maxs); LLVector4a mask1 = _mm_and_ps(_mm_cmpgt_ps(mMatrix[0],mins.getRow<0>()), _mm_cmplt_ps(mMatrix[0],maxs.getRow<0>())); LLVector4a mask2 = _mm_and_ps(_mm_cmpgt_ps(mMatrix[1],mins.getRow<1>()), _mm_cmplt_ps(mMatrix[1],maxs.getRow<1>())); diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 5189d852b..0be162f5c 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -968,11 +968,11 @@ public: #ifdef LL_OCTREE_POOLS void* operator new(size_t size) { - return getPool(size).malloc(); + return LLOctreeNode::getPool(size).malloc(); } void operator delete(void* ptr) { - getPool(sizeof(LLOctreeNode)).free(ptr); + LLOctreeNode::getPool(sizeof(LLOctreeNode)).free(ptr); } #else void* operator new(size_t size) diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 7a6ca0e24..3a936eaf8 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -301,7 +301,8 @@ void LLFacePool::removeFaceReference(LLFace *facep) if (idx != -1) { facep->setReferenceIndex(-1); - std::vector::iterator iter = vector_replace_with_last(mReferences, mReferences.begin() + idx); + std::vector::iterator face_it(mReferences.begin() + idx); + std::vector::iterator iter = vector_replace_with_last(mReferences, face_it); if(iter != mReferences.end()) (*iter)->setReferenceIndex(idx); } diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index e378c4458..cf97d4e82 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -80,10 +80,12 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD LLVolumeImplFlexible::~LLVolumeImplFlexible() { - std::vector::iterator iter = vector_replace_with_last(sInstanceList, sInstanceList.begin() + mInstanceIndex); + std::vector::iterator flex_it(sInstanceList.begin() + mInstanceIndex); + std::vector::iterator iter = vector_replace_with_last(sInstanceList, flex_it); if(iter != sInstanceList.end()) (*iter)->mInstanceIndex = mInstanceIndex; - vector_replace_with_last(sUpdateDelay,sUpdateDelay.begin() + mInstanceIndex); + std::vector::iterator update_it(sUpdateDelay.begin() + mInstanceIndex); + vector_replace_with_last(sUpdateDelay, update_it); } //static diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index 8d4e9ce97..0c465592b 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -39,10 +39,10 @@ class LLViewerObject; // This rotation matrix moves the default OpenGL reference frame // (-Z at, Y up) to Cory's favorite reference frame (X at, Z up) -static LL_ALIGN_16(const LLMatrix4a OGL_TO_CFR_ROTATION(LLVector4a( 0.f, 0.f, -1.f, 0.f), // -Z becomes X +static LL_ALIGN_16(const LLMatrix4a) OGL_TO_CFR_ROTATION(LLVector4a( 0.f, 0.f, -1.f, 0.f), // -Z becomes X LLVector4a(-1.f, 0.f, 0.f, 0.f), // -X becomes Y LLVector4a( 0.f, 1.f, 0.f, 0.f), // Y becomes Z - LLVector4a( 0.f, 0.f, 0.f, 1.f) )); + LLVector4a( 0.f, 0.f, 0.f, 1.f) ); const BOOL FOR_SELECTION = TRUE; const BOOL NOT_FOR_SELECTION = FALSE; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 4bb792f8b..b04c53af5 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1459,7 +1459,8 @@ void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) objectp->setListIndex(-1); - std::vector >::iterator iter = vector_replace_with_last(mActiveObjects,mActiveObjects.begin() + idx); + std::vector >::iterator it(mActiveObjects.begin() + idx); + std::vector >::iterator iter = vector_replace_with_last(mActiveObjects, it); if(iter != mActiveObjects.end()) (*iter)->setListIndex(idx); diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index a27e1ec4e..c3f49f69f 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -406,7 +406,8 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) // Kill dead particles (either flagged dead, or too old) if ((part->mLastUpdateTime > part->mMaxAge) || (LLViewerPart::LL_PART_DEAD_MASK == part->mFlags)) { - vector_replace_with_last(mParticles,mParticles.begin() + i); + part_list_t::iterator it(mParticles.begin() + i); + vector_replace_with_last(mParticles, it); delete part ; } else @@ -416,7 +417,8 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) { // Transfer particles between groups LLViewerPartSim::getInstance()->put(part) ; - vector_replace_with_last(mParticles,mParticles.begin() + i); + part_list_t::iterator it(mParticles.begin() + i); + vector_replace_with_last(mParticles, it); } else { @@ -721,8 +723,9 @@ void LLViewerPartSim::updateSimulation() if (mViewerPartSources[i]->isDead()) { - vector_replace_with_last(mViewerPartSources,mViewerPartSources.begin() + i); - //mViewerPartSources.erase(mViewerPartSources.begin() + i); + source_list_t::iterator it(mViewerPartSources.begin() + i); + vector_replace_with_last(mViewerPartSources, it); + //mViewerPartSources.erase(it); count--; } else @@ -758,8 +761,9 @@ void LLViewerPartSim::updateSimulation() if (!mViewerPartGroups[i]->getCount()) { delete mViewerPartGroups[i]; - vector_replace_with_last(mViewerPartGroups,mViewerPartGroups.begin() + i); - //mViewerPartGroups.erase(mViewerPartGroups.begin() + i); + group_list_t::iterator it(mViewerPartGroups.begin() + i); + vector_replace_with_last(mViewerPartGroups, it); + //mViewerPartGroups.erase(it); i--; count--; } diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp index 525de0ed2..1e6b7a343 100644 --- a/indra/newview/llviewertextureanim.cpp +++ b/indra/newview/llviewertextureanim.cpp @@ -49,7 +49,8 @@ LLViewerTextureAnim::LLViewerTextureAnim(LLVOVolume* vobj) : LLTextureAnim() LLViewerTextureAnim::~LLViewerTextureAnim() { - std::vector::iterator iter = vector_replace_with_last(sInstanceList, sInstanceList.begin() + mInstanceIndex); + std::vector::iterator it(sInstanceList.begin() + mInstanceIndex); + std::vector::iterator iter = vector_replace_with_last(sInstanceList, it); if(iter != sInstanceList.end()) (*iter)->mInstanceIndex = mInstanceIndex; } From 30e76a7c1180360b808933897d8f960e17861cb6 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Tue, 22 Jul 2014 04:24:26 -0400 Subject: [PATCH 079/159] Fix linker errors on linux after merging Shyotl --- indra/newview/pipeline.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 28950e8f3..7af2dc21e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -249,12 +249,12 @@ void drawBoxOutline(const LLVector3& pos, const LLVector3& size); U32 nhpo2(U32 v); LLVertexBuffer* ll_create_cube_vb(U32 type_mask, U32 usage); -inline const LLMatrix4a& glh_get_current_modelview() +const LLMatrix4a& glh_get_current_modelview() { return gGLModelView; } -inline const LLMatrix4a& glh_get_current_projection() +const LLMatrix4a& glh_get_current_projection() { return gGLProjection; } @@ -269,12 +269,12 @@ inline const LLMatrix4a& glh_get_last_projection() return gGLLastProjection; } -inline void glh_set_current_modelview(const LLMatrix4a& mat) +void glh_set_current_modelview(const LLMatrix4a& mat) { gGLModelView = mat; } -inline void glh_set_current_projection(const LLMatrix4a& mat) +void glh_set_current_projection(const LLMatrix4a& mat) { gGLProjection = mat; } From 88794d0288a9505fec43da2d5ecef2e15c7205b8 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Jul 2014 04:40:21 -0400 Subject: [PATCH 080/159] Add "Connect to neighboring regions" checkbox to Vanity->Main preferences. --- indra/newview/ascentprefsvan.cpp | 2 ++ indra/newview/ascentprefsvan.h | 1 + .../skins/default/xui/en-us/panel_preferences_ascent_vanity.xml | 1 + 3 files changed, 4 insertions(+) diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index c9f2b937c..6a51b580f 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -129,6 +129,7 @@ void LLPrefsAscentVan::refreshValues() mUnfocusedFloatersOpaque = gSavedSettings.getBOOL("FloaterUnfocusedBackgroundOpaque"); mCompleteNameProfiles = gSavedSettings.getBOOL("SinguCompleteNameProfiles"); mScriptErrorsStealFocus = gSavedSettings.getBOOL("LiruScriptErrorsStealFocus"); + mConnectToNeighbors = gSavedSettings.getBOOL("AlchemyConnectToNeighbors"); //Tags\Colors ---------------------------------------------------------------------------- mAscentBroadcastTag = gSavedSettings.getBOOL("AscentBroadcastTag"); @@ -199,6 +200,7 @@ void LLPrefsAscentVan::cancel() gSavedSettings.setBOOL("FloaterUnfocusedBackgroundOpaque", mUnfocusedFloatersOpaque); gSavedSettings.setBOOL("SinguCompleteNameProfiles", mCompleteNameProfiles); gSavedSettings.setBOOL("LiruScriptErrorsStealFocus", mScriptErrorsStealFocus); + gSavedSettings.setBOOL("AlchemyConnectToNeighbors", mConnectToNeighbors); //Tags\Colors ---------------------------------------------------------------------------- gSavedSettings.setBOOL("AscentBroadcastTag", mAscentBroadcastTag); diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index 2e7753d10..b45adf652 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -65,6 +65,7 @@ private: bool mUnfocusedFloatersOpaque; bool mCompleteNameProfiles; bool mScriptErrorsStealFocus; + bool mConnectToNeighbors; //Tags\Colors bool mAscentBroadcastTag; std::string mReportClientUUID; diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml index 0e1ce0f6d..d1ca9be5e 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml @@ -15,6 +15,7 @@ + From 5ca2a3b0f7bc3d75c35110d95124084ec9b74347 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Jul 2014 05:48:30 -0400 Subject: [PATCH 081/159] Feature request: Change status bar search to search in all (applicable) tabs Opens up to last tab selected now, but puts query text and triggers searches in all tabs. Singu TODO: Have it search marketplace? --- indra/newview/llfloaterdirectory.cpp | 17 +++++++++++++++++ indra/newview/llfloaterdirectory.h | 2 ++ indra/newview/llfloatersearch.cpp | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index a0244eb18..3bd2932d9 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -439,6 +439,17 @@ void LLFloaterDirectory::requestClassifieds() } } +void LLFloaterDirectory::searchInAll(const std::string& search_text) +{ + LLPanelDirFindAllInterface::search(sInstance->mFindAllPanel, search_text); + performQueryOn2("classified_panel", search_text); + performQueryOn2("events_panel", search_text); + performQueryOn2("groups_panel", search_text); + performQueryOn2("people_panel", search_text); + performQueryOn2("places_panel", search_text); + sInstance->open(); +} + void LLFloaterDirectory::showFindAll(const std::string& search_text) { showPanel("find_all_panel"); @@ -524,6 +535,12 @@ void LLFloaterDirectory::showPlaces(const std::string& search_text) void LLFloaterDirectory::performQueryOn(const std::string& name, const std::string& search_text) { showPanel(name); + performQueryOn2(name, search_text); +} + +//static +void LLFloaterDirectory::performQueryOn2(const std::string& name, const std::string& search_text) +{ if (search_text.empty()) return; // We're done here. LLPanelDirBrowser* panel = sInstance->getChild(name); panel->getChild("name")->setValue(search_text); diff --git a/indra/newview/llfloaterdirectory.h b/indra/newview/llfloaterdirectory.h index a1bce3efc..0f5f1b501 100644 --- a/indra/newview/llfloaterdirectory.h +++ b/indra/newview/llfloaterdirectory.h @@ -71,6 +71,7 @@ public: // Outside UI widgets can spawn this floater with various tabs // selected. + static void searchInAll(const std::string& search_text); static void showFindAll(const std::string& search_text); static void showClassified(const LLUUID& classified_id); static void showClassified(const std::string& search_text = ""); @@ -92,6 +93,7 @@ public: private: static void performQueryOn(const std::string& name, const std::string& search_text); + static void performQueryOn2(const std::string& name, const std::string& search_text); static void showPanel(const std::string& tabname); /*virtual*/ void onClose(bool app_quitting); void focusCurrentPanel(); diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index b9cf179d2..5d51959d3 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -160,7 +160,9 @@ void LLFloaterSearch::showInstance(const SearchQuery& search, bool web) else { const std::string category(search.category()); - if (category.empty() || category == "all") + if (category.empty()) + LLFloaterDirectory::searchInAll(search.query); + else if (category == "all") LLFloaterDirectory::showFindAll(search.query); else if (category == "people") LLFloaterDirectory::showPeople(search.query); From 6ef4dfb61f53cd7725fa21812b697805c997c7b5 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Jul 2014 05:49:41 -0400 Subject: [PATCH 082/159] Fix Media Filtering preferences UI to look proper. --- .../default/xui/en-us/panel_preferences_audio.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml index 720e4df81..82a40a9e2 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml @@ -2,12 +2,13 @@ Volume: Streaming Preferences: - Audio Preferences: + Audio Preferences: - - - - + Media Filtering + + Off + Blacklist Only + Prompt From 511811de3bb1e6a383ed08fb52382341306621a2 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Jul 2014 07:05:36 -0400 Subject: [PATCH 083/159] Fix Media Filtering preferences code to work right. --- indra/newview/llpanelaudioprefs.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/llpanelaudioprefs.cpp b/indra/newview/llpanelaudioprefs.cpp index e61028fa8..1929e693c 100644 --- a/indra/newview/llpanelaudioprefs.cpp +++ b/indra/newview/llpanelaudioprefs.cpp @@ -89,6 +89,7 @@ LLPanelAudioPrefs::~LLPanelAudioPrefs() BOOL LLPanelAudioPrefs::postBuild() { + getChildView("filter_group")->setValue(S32(gSavedSettings.getU32("MediaFilterEnable"))); refreshValues(); // initialize member data from saved settings childSetLabelArg("currency_change_threshold", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); @@ -115,6 +116,7 @@ void LLPanelAudioPrefs::refreshValues() mPreviousMuteAudio = gSavedSettings.getBOOL("MuteAudio"); mPreviousMuteWhenMinimized = gSavedSettings.getBOOL("MuteWhenMinimized"); + gSavedSettings.setU32("MediaFilterEnable", getChildView("filter_group")->getValue().asInteger()); } void LLPanelAudioPrefs::cancel() From 4ca6a5c52ca7398caa5f429c0d8560611c85d739 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Jul 2014 07:07:38 -0400 Subject: [PATCH 084/159] Sync up most of the realistic mouselook code with alchemy. This should fix the inverted mouselook when sitting problem Think the bug was in llvoavatar, but keeping in sync is always good for the future overall. --- indra/newview/llagent.cpp | 19 +++---------------- indra/newview/llagentcamera.cpp | 6 +++--- indra/newview/llvoavatar.cpp | 2 +- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 051a68fcd..7fb21ab0d 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1293,25 +1293,12 @@ F32 LLAgent::clampPitchToLimits(F32 angle) LLVector3 skyward = getReferenceUpVector(); - F32 look_down_limit; - F32 look_up_limit = 10.f * DEG_TO_RAD; + static const LLCachedControl useRealisticMouselook(gSavedSettings, "UseRealisticMouselook", false); + const F32 look_down_limit = (useRealisticMouselook ? 160.f : (isAgentAvatarValid() && gAgentAvatarp->isSitting() ? 130.f : 179.f)) * DEG_TO_RAD; + const F32 look_up_limit = (useRealisticMouselook ? 20.f : 1.f) * DEG_TO_RAD;; F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward ); - if (gAgentCamera.cameraMouselook() && gSavedSettings.getBOOL("UseRealisticMouselook")) - { - look_down_limit = 160.f * DEG_TO_RAD; - look_up_limit = 20.f * DEG_TO_RAD; - } - else if (isAgentAvatarValid() && gAgentAvatarp->isSitting()) - { - look_down_limit = 130.f * DEG_TO_RAD; - } - else - { - look_down_limit = 170.f * DEG_TO_RAD; - } - // clamp pitch to limits if ((angle >= 0.f) && (angle_from_skyward + angle > look_down_limit)) { diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 4dfe7bc4b..a8e0a5c2a 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1493,14 +1493,14 @@ void LLAgentCamera::updateCamera() if (realistic_ml) { LLQuaternion agent_rot(gAgent.getFrameAgent().getQuaternion()); - if (static_cast(gAgentAvatarp->getRoot())->flagCameraDecoupled()) - if (LLViewerObject* parent = static_cast(gAgentAvatarp->getParent())) + if (LLViewerObject* parent = static_cast(gAgentAvatarp->getParent())) + if (static_cast(gAgentAvatarp->getRoot())->flagCameraDecoupled()) agent_rot *= parent->getRenderRotation(); LLViewerCamera::getInstance()->updateCameraLocation(head_pos, mCameraUpVector, gAgentAvatarp->mHeadp->getWorldPosition() + LLVector3(1.0, 0.0, 0.0) * agent_rot); } else { - const LLVector3 diff = (mCameraPositionAgent - head_pos) * ~gAgentAvatarp->mRoot->getWorldRotation(); + const LLVector3 diff((mCameraPositionAgent - head_pos) * ~gAgentAvatarp->mRoot->getWorldRotation()); gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index bd0000846..802105235 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4149,7 +4149,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) static const LLCachedControl useRealisticMouselook("UseRealisticMouselook"); F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, useRealisticMouselook ? s_pelvis_rot_threshold_slow * 2 : s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast); - if (self_in_mouselook) + if (self_in_mouselook && !useRealisticMouselook) { pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR; } From 4163b8e40be854771cd1c3429d51b286e36a2add Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Tue, 22 Jul 2014 14:38:29 -0400 Subject: [PATCH 085/159] Well that's a strange bug... eh, not too important. --- .../skins/default/xui/en-us/panel_preferences_audio.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml index 82a40a9e2..9295232eb 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml @@ -6,9 +6,9 @@ Media Filtering - Off - Blacklist Only - Prompt + Off + Blacklist Only + Prompt From cf56659b18a7a0611704f92b8559ab01c82d741a Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 23 Jul 2014 16:51:14 -0400 Subject: [PATCH 086/159] Add xcode_fix.sh to scripts/ to avoid users needing to download it. --- scripts/xcode_fix.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 scripts/xcode_fix.sh diff --git a/scripts/xcode_fix.sh b/scripts/xcode_fix.sh new file mode 100644 index 000000000..608b390ad --- /dev/null +++ b/scripts/xcode_fix.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +echo 'Linden fix for Xcode 4.6 to have 10.6SDK so it can build older branches.' + +echo 'Be sure to have the xcode_4.3_for_lion.dmg mounted! This script pulls from that volume!' + +echo 'Creating temporary directory. . .' + +mkdir temp + +pushd temp + +echo 'Copying 10.6SDK. . .' + +cp -R /Volumes/Xcode/Xcode.app/Contents//Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk . + +echo 'Linking darwin10 folders as darwin11. . .' + +pushd MacOSX10.6.sdk/Developer/usr/llvm-gcc-4.2/lib/gcc/ + +ln -s i686-apple-darwin10 i686-apple-darwin11 + +popd + +pushd MacOSX10.6.sdk/usr/lib/gcc/ + +ln -s i686-apple-darwin10 i686-apple-darwin11 + +popd + +pushd MacOSX10.6.sdk/usr/lib/ + +ln -s i686-apple-darwin10 i686-apple-darwin11 + +popd + +echo 'Changing ownership and moving SDK to machine. . . Password required for sudo commands.' + +sudo chown -R root:wheel MacOSX10.6.sdk + +sudo mv MacOSX10.6.sdk/ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs + +popd + +rm -rf temp + +echo 'Xcode fix complete.' + From d7bbbd9d40b0f833a0301c8d7b96ee97718087d7 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 23 Jul 2014 16:58:41 -0400 Subject: [PATCH 087/159] Fix Group Role Data never loading since the group bans merge. --- indra/newview/llpanelgrouproles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 341c41054..e66bad4eb 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -387,7 +387,7 @@ void LLPanelGroupRoles::activate() // Mildly hackish - clear all pending changes cancel(); - LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID); + LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mGroupID); } // Check role-member mapping data. From d95e94fa0708083f85a9740c855c1eb31284a519 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 23 Jul 2014 16:55:46 -0500 Subject: [PATCH 088/159] Missed a cast to LLMatrix4. Was causing assorted wonkiness (most noticeably, mouselook oddities) --- indra/newview/llviewerobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 25b251dde..a66e20691 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3722,7 +3722,7 @@ const LLQuaternion LLViewerObject::getRenderRotation() const } else { - ret = LLQuaternion(mDrawable->getWorldMatrix().getF32ptr()); + ret = LLQuaternion(LLMatrix4(mDrawable->getWorldMatrix().getF32ptr())); } } From 1c5872da0c37a72a75099122de9e19f04a4be295 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 23 Jul 2014 18:12:18 -0400 Subject: [PATCH 089/159] Fix the grids combobox on the login panel not being scrollable because of constantly reordering grids Still select the current grid, just use its index number to select it, instead of hacking it to the top of the combo box. --- indra/newview/llpanellogin.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index e9a38ba79..74712a649 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -741,21 +741,24 @@ void LLPanelLogin::updateGridCombo() const HippoGridInfo *curGrid = gHippoGridManager->getCurrentGrid(); const HippoGridInfo *defGrid = gHippoGridManager->getGrid(defaultGrid); + S32 idx(-1); HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid(); for (it = gHippoGridManager->beginGrid(); it != end; ++it) { std::string grid = it->second->getGridName(); - if(grid.empty() || it->second == defGrid || it->second == curGrid) + if (grid.empty() || it->second == defGrid) continue; + if (it->second == curGrid) idx = grids->getItemCount(); grids->add(grid); } - if(curGrid || defGrid) + if (curGrid || defGrid) { - if(defGrid) + if (defGrid) + { grids->add(defGrid->getGridName(),ADD_TOP); - if(curGrid && defGrid != curGrid) - grids->add(curGrid->getGridName(),ADD_TOP); - grids->setCurrentByIndex(0); + ++idx; + } + grids->setCurrentByIndex(idx); } else { From c6ef099e187e5f26b99f77dd437985fd60d10a71 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 23 Jul 2014 18:15:14 -0400 Subject: [PATCH 090/159] When we setTextEntry on a combo box, move the cursor to the beginning of the new text. This fixes the login location combo box not displaying the location cleanly after appending coordinates and such. --- indra/llui/llcombobox.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index b3d1ee64d..08ddc3c96 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -937,6 +937,7 @@ void LLComboBox::setTextEntry(const LLStringExplicit& text) if (mTextEntry) { mTextEntry->setText(text); + mTextEntry->setCursor(0); // Singu Note: Move the cursor over to the beginning mHasAutocompletedText = FALSE; updateSelection(); } From f3a48bb0f08fce5403e8e580642939a76ab9fb19 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 30 Jul 2014 08:43:12 -0400 Subject: [PATCH 091/159] Silk Aeon wants greater precision on the Object Weights Floater. --- indra/newview/llfloaterobjectweights.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index f95d82f23..2f4d5954c 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -117,9 +117,9 @@ void LLFloaterObjectWeights::onOpen() // virtual void LLFloaterObjectWeights::onWeightsUpdate(const SelectionCost& selection_cost) { - mSelectedDownloadWeight->setText(llformat("%.1f", selection_cost.mNetworkCost)); - mSelectedPhysicsWeight->setText(llformat("%.1f", selection_cost.mPhysicsCost)); - mSelectedServerWeight->setText(llformat("%.1f", selection_cost.mSimulationCost)); + mSelectedDownloadWeight->setText(llformat("%.2f", selection_cost.mNetworkCost)); + mSelectedPhysicsWeight->setText(llformat("%.2f", selection_cost.mPhysicsCost)); + mSelectedServerWeight->setText(llformat("%.2f", selection_cost.mSimulationCost)); S32 render_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost(); mSelectedDisplayWeight->setText(llformat("%d", render_cost)); From 7fee70543d0b3b2c2b1bca5b2191d0364dc02f5b Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 31 Jul 2014 08:12:00 -0400 Subject: [PATCH 092/159] Login Response support for destination_guide_url, OpenSimExtras support (properly) search-server-url, and support the new destination-guide-url from OpenSimExtras Expands SignaledType's callback to accept const Type& as argument. typedefs Signal::slot_type to slot_t so that SignaledType can be altered without needing to update all lines setting slots. Merges floater_directory.xml with floater_directory(2|3).xml Condenses translations down to one xml(, finally the nightmare is over). Better ui code support for classic find all panel Not like anyone cares, but ShowcaseURLDefault no longer persists value changes between sessions. Moves SearchType and getSearchUrl(SearchType ty, bool is_web) from HippoGridInfo into a namespace in llpaneldirfind.cpp, the only place where it is used; so that it may wrap the sim feature lookup. Thanks to Shyotl for the help in dynamically maintaining tab positions for dynamic tabs. --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/hippogridmanager.cpp | 93 --- indra/newview/hippogridmanager.h | 6 - indra/newview/lfsimfeaturehandler.cpp | 18 +- indra/newview/lfsimfeaturehandler.h | 20 +- indra/newview/llfloaterdirectory.cpp | 78 +- indra/newview/llfloatersearch.cpp | 1 + indra/newview/llpaneldirfind.cpp | 162 +++- indra/newview/llpaneldirfind.h | 1 + indra/newview/llpaneldirpopular.cpp | 2 + indra/newview/llstartup.cpp | 30 +- .../default/xui/de/floater_directory.xml | 42 +- .../default/xui/de/floater_directory2.xml | 254 ------ .../default/xui/de/floater_directory3.xml | 297 ------- .../default/xui/en-us/floater_directory.xml | 72 +- .../default/xui/en-us/floater_directory2.xml | 652 --------------- .../default/xui/en-us/floater_directory3.xml | 775 ------------------ .../default/xui/es/floater_directory.xml | 48 +- .../default/xui/es/floater_directory2.xml | 411 ---------- .../default/xui/es/floater_directory3.xml | 507 ------------ 20 files changed, 359 insertions(+), 3112 deletions(-) delete mode 100644 indra/newview/skins/default/xui/de/floater_directory2.xml delete mode 100644 indra/newview/skins/default/xui/de/floater_directory3.xml delete mode 100644 indra/newview/skins/default/xui/en-us/floater_directory2.xml delete mode 100644 indra/newview/skins/default/xui/en-us/floater_directory3.xml delete mode 100644 indra/newview/skins/default/xui/es/floater_directory2.xml delete mode 100644 indra/newview/skins/default/xui/es/floater_directory3.xml diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c7d9d1615..3ba271f23 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -552,7 +552,7 @@ Comment URL to load for the Showcase tab in Second Life Persist - 1 + 0 Type String Value diff --git a/indra/newview/hippogridmanager.cpp b/indra/newview/hippogridmanager.cpp index b0fd2b254..6f01c2a86 100644 --- a/indra/newview/hippogridmanager.cpp +++ b/indra/newview/hippogridmanager.cpp @@ -260,99 +260,6 @@ void HippoGridInfo::setDirectoryFee(int fee) // ******************************************************************** // Grid Info -std::string HippoGridInfo::getSearchUrl(SearchType ty, bool is_web) const -{ - // Don't worry about whether or not mSearchUrl is empty here anymore -- MC - if (is_web) - { - if (mPlatform == PLATFORM_SECONDLIFE) - { - // Second Life defaults - if (ty == SEARCH_ALL_EMPTY) - { - return gSavedSettings.getString("SearchURLDefault"); - } - else if (ty == SEARCH_ALL_QUERY) - { - return gSavedSettings.getString("SearchURLQuery"); - } - else if (ty == SEARCH_ALL_TEMPLATE) - { - return gSavedSettings.getString("SearchURLSuffix2"); - } - else - { - llinfos << "Illegal search URL type " << ty << llendl; - return ""; - } - } - else if (!mSearchUrl.empty()) - { - // Search url sent to us in the login response - if (ty == SEARCH_ALL_EMPTY) - { - return (mSearchUrl); - } - else if (ty == SEARCH_ALL_QUERY) - { - return (mSearchUrl + "q=[QUERY]&s=[COLLECTION]&"); - } - else if (ty == SEARCH_ALL_TEMPLATE) - { - return "lang=[LANG]&mat=[MATURITY]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]&dice=[DICE]"; - } - else - { - llinfos << "Illegal search URL type " << ty << llendl; - return ""; - } - } - else - { - // OpenSim and other web search defaults - if (ty == SEARCH_ALL_EMPTY) - { - return gSavedSettings.getString("SearchURLDefaultOpenSim"); - } - else if (ty == SEARCH_ALL_QUERY) - { - return gSavedSettings.getString("SearchURLQueryOpenSim"); - } - else if (ty == SEARCH_ALL_TEMPLATE) - { - return gSavedSettings.getString("SearchURLSuffixOpenSim"); - } - else - { - llinfos << "Illegal search URL type " << ty << llendl; - return ""; - } - } - } - else - { - // Use the old search all - if (ty == SEARCH_ALL_EMPTY) - { - return (mSearchUrl + "panel=All&"); - } - else if (ty == SEARCH_ALL_QUERY) - { - return (mSearchUrl + "q=[QUERY]&s=[COLLECTION]&"); - } - else if (ty == SEARCH_ALL_TEMPLATE) - { - return "lang=[LANG]&m=[MATURITY]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]&dice=[DICE]"; - } - else - { - llinfos << "Illegal search URL type " << ty << llendl; - return ""; - } - } -} - - //static void HippoGridInfo::onXmlElementStart(void* userData, const XML_Char* name, const XML_Char** atts) { diff --git a/indra/newview/hippogridmanager.h b/indra/newview/hippogridmanager.h index 4416e8598..a33970e28 100644 --- a/indra/newview/hippogridmanager.h +++ b/indra/newview/hippogridmanager.h @@ -31,11 +31,6 @@ public: PLATFORM_SECONDLIFE, PLATFORM_LAST }; - enum SearchType { - SEARCH_ALL_EMPTY, - SEARCH_ALL_QUERY, - SEARCH_ALL_TEMPLATE - }; explicit HippoGridInfo(const std::string& gridName); @@ -58,7 +53,6 @@ public: const std::string& getSearchUrl() const { return mSearchUrl; } const std::string& getGridMessage() const { return mGridMessage; } const std::string& getVoiceConnector() const { return mVoiceConnector; } - std::string getSearchUrl(SearchType ty, bool is_web) const; bool isRenderCompat() const { return mRenderCompat; } std::string getGridNick() const; int getMaxAgentGroups() const { return mMaxAgentGroups; } diff --git a/indra/newview/lfsimfeaturehandler.cpp b/indra/newview/lfsimfeaturehandler.cpp index e4b6408e2..897dbe655 100644 --- a/indra/newview/lfsimfeaturehandler.cpp +++ b/indra/newview/lfsimfeaturehandler.cpp @@ -26,6 +26,8 @@ LFSimFeatureHandler::LFSimFeatureHandler() : mSupportsExport(false) +, mDestinationGuideURL(gSavedSettings.getString("ShowcaseURLDefault")) +, mSearchURL(gSavedSettings.getString("SearchURL")) , mSayRange(20) , mShoutRange(100) , mWhisperRange(10) @@ -66,6 +68,7 @@ void LFSimFeatureHandler::setSupportedFeatures() // http://opensimulator.org/wiki/SimulatorFeatures_Extras const LLSD& extras(info["OpenSimExtras"]); mSupportsExport = extras.has("ExportSupported") ? extras["ExportSupported"].asBoolean() : false; + mDestinationGuideURL = extras.has("destination-guide-url") ? extras["destination-guide-url"].asString() : ""; mMapServerURL = extras.has("map-server-url") ? extras["map-server-url"].asString() : ""; mSearchURL = extras.has("search-server-url") ? extras["search-server-url"].asString() : ""; mSayRange = extras.has("say-range") ? extras["say-range"].asInteger() : 20; @@ -84,27 +87,32 @@ void LFSimFeatureHandler::setSupportedFeatures() } } -boost::signals2::connection LFSimFeatureHandler::setSupportsExportCallback(const boost::signals2::signal::slot_type& slot) +boost::signals2::connection LFSimFeatureHandler::setSupportsExportCallback(const SignaledType::slot_t& slot) { return mSupportsExport.connect(slot); } -boost::signals2::connection LFSimFeatureHandler::setSearchURLCallback(const boost::signals2::signal::slot_type& slot) +boost::signals2::connection LFSimFeatureHandler::setDestinationGuideURLCallback(const SignaledType::slot_t& slot) +{ + return mDestinationGuideURL.connect(slot); +} + +boost::signals2::connection LFSimFeatureHandler::setSearchURLCallback(const SignaledType::slot_t& slot) { return mSearchURL.connect(slot); } -boost::signals2::connection LFSimFeatureHandler::setSayRangeCallback(const boost::signals2::signal::slot_type& slot) +boost::signals2::connection LFSimFeatureHandler::setSayRangeCallback(const SignaledType::slot_t& slot) { return mSayRange.connect(slot); } -boost::signals2::connection LFSimFeatureHandler::setShoutRangeCallback(const boost::signals2::signal::slot_type& slot) +boost::signals2::connection LFSimFeatureHandler::setShoutRangeCallback(const SignaledType::slot_t& slot) { return mShoutRange.connect(slot); } -boost::signals2::connection LFSimFeatureHandler::setWhisperRangeCallback(const boost::signals2::signal::slot_type& slot) +boost::signals2::connection LFSimFeatureHandler::setWhisperRangeCallback(const SignaledType::slot_t& slot) { return mWhisperRange.connect(slot); } diff --git a/indra/newview/lfsimfeaturehandler.h b/indra/newview/lfsimfeaturehandler.h index d26983fcd..371ec5e0c 100644 --- a/indra/newview/lfsimfeaturehandler.h +++ b/indra/newview/lfsimfeaturehandler.h @@ -21,21 +21,22 @@ #include "llsingleton.h" #include "llpermissions.h" // ExportPolicy -template > +template > class SignaledType { public: SignaledType() : mValue() {} SignaledType(Type b) : mValue(b) {} - boost::signals2::connection connect(const typename Signal::slot_type& slot) { return mSignal.connect(slot); } + typedef typename Signal::slot_type slot_t; + boost::signals2::connection connect(const slot_t& slot) { return mSignal.connect(slot); } SignaledType& operator =(Type val) { if (val != mValue) { mValue = val; - mSignal(); + mSignal(val); } return *this; } @@ -57,14 +58,16 @@ public: void setSupportedFeatures(); // Connection setters - boost::signals2::connection setSupportsExportCallback(const boost::signals2::signal::slot_type& slot); - boost::signals2::connection setSearchURLCallback(const boost::signals2::signal::slot_type& slot); - boost::signals2::connection setSayRangeCallback(const boost::signals2::signal::slot_type& slot); - boost::signals2::connection setShoutRangeCallback(const boost::signals2::signal::slot_type& slot); - boost::signals2::connection setWhisperRangeCallback(const boost::signals2::signal::slot_type& slot); + boost::signals2::connection setSupportsExportCallback(const SignaledType::slot_t& slot); + boost::signals2::connection setDestinationGuideURLCallback(const SignaledType::slot_t& slot); + boost::signals2::connection setSearchURLCallback(const SignaledType::slot_t& slot); + boost::signals2::connection setSayRangeCallback(const SignaledType::slot_t& slot); + boost::signals2::connection setShoutRangeCallback(const SignaledType::slot_t& slot); + boost::signals2::connection setWhisperRangeCallback(const SignaledType::slot_t& slot); // Accessors bool simSupportsExport() const { return mSupportsExport; } + std::string destinationGuideURL() const { return mDestinationGuideURL; } std::string mapServerURL() const { return mMapServerURL; } std::string searchURL() const { return mSearchURL; } U32 sayRange() const { return mSayRange; } @@ -75,6 +78,7 @@ public: private: // SignaledTypes SignaledType mSupportsExport; + SignaledType mDestinationGuideURL; std::string mMapServerURL; SignaledType mSearchURL; SignaledType mSayRange; diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index 3bd2932d9..ce2f71e16 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -53,12 +53,26 @@ #include "lluictrlfactory.h" #include "hippogridmanager.h" +#include "lfsimfeaturehandler.h" #include "llenvmanager.h" #include "llnotificationsutil.h" #include "llviewerregion.h" const char* market_panel = "market_panel"; +void set_tab_visible(LLTabContainer* container, LLPanel* tab, bool visible, LLPanel* prev_tab) +{ + if (visible) + { + if (prev_tab) + container->lockTabs(container->getIndexForPanel(prev_tab) + 1); + container->addTabPanel(tab, tab->getLabel(), false, 0, false, LLTabContainer::START); + if (prev_tab) + container->unlockTabs(); + } + else container->removeTabPanel(tab); +} + class LLPanelDirMarket : public LLPanelDirFind { public: @@ -205,10 +219,7 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) mPanelClassifiedp = NULL; // Build the floater with our tab panel classes - - bool enableWebSearch = gHippoGridManager->getConnectedGrid()->isSecondLife() || - !gHippoGridManager->getConnectedGrid()->getSearchUrl().empty(); - bool enableClassicAllSearch = !gHippoGridManager->getConnectedGrid()->isSecondLife(); + bool secondlife = gHippoGridManager->getConnectedGrid()->isSecondLife(); LLCallbackMap::map_t factory_map; factory_map["classified_panel"] = LLCallbackMap(createClassified, this); @@ -218,15 +229,13 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) factory_map["people_panel"] = LLCallbackMap(createPeople, this); factory_map["groups_panel"] = LLCallbackMap(createGroups, this); factory_map[market_panel] = LLCallbackMap(LLPanelDirMarket::create, this); - if (enableWebSearch) + factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this); + factory_map["showcase_panel"] = LLCallbackMap(createShowcase, this); + if (secondlife) { - // web search and showcase only for SecondLife - factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this); - factory_map["showcase_panel"] = LLCallbackMap(createShowcase, this); - if (!enableClassicAllSearch) factory_map["web_panel"] = LLCallbackMap(createWebPanel, this); + factory_map["web_panel"] = LLCallbackMap(createWebPanel, this); } - - if (enableClassicAllSearch) + else { factory_map["find_all_old_panel"] = LLCallbackMap(createFindAllOld, this); } @@ -240,28 +249,33 @@ LLFloaterDirectory::LLFloaterDirectory(const std::string& name) factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this); - if (enableWebSearch) - { - mCommitCallbackRegistrar.add("Search.WebFloater", boost::bind(&LLFloaterSearch::open, boost::bind(LLFloaterSearch::getInstance))); - if (enableClassicAllSearch) - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory3.xml", &factory_map); - else - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory.xml", &factory_map); - } - else - { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory2.xml", &factory_map); - } + mCommitCallbackRegistrar.add("Search.WebFloater", boost::bind(&LLFloaterSearch::open, boost::bind(LLFloaterSearch::getInstance))); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory.xml", &factory_map); moveResizeHandlesToFront(); - if(mPanelAvatarp) + if (mPanelAvatarp) { mPanelAvatarp->selectTab(0); } LLTabContainer* container = getChild("Directory Tabs"); - if (enableClassicAllSearch) + if (secondlife) { + container->removeTabPanel(getChild("find_all_old_panel")); // Not used + } + else + { + container->removeTabPanel(getChild("web_panel")); // Not needed + LLPanel* panel(getChild("find_all_panel")); + LLPanel* prev_tab(getChild("find_all_old_panel")); + LFSimFeatureHandler& inst(LFSimFeatureHandler::instance()); + set_tab_visible(container, panel, !inst.searchURL().empty(), prev_tab); + inst.setSearchURLCallback(boost::bind(set_tab_visible, container, panel, !boost::bind(&std::string::empty, _1), prev_tab)); + panel = getChild("showcase_panel"); + prev_tab = getChild("events_panel"); + set_tab_visible(container, panel, !inst.destinationGuideURL().empty(), prev_tab); + inst.setDestinationGuideURLCallback(boost::bind(set_tab_visible, container, panel, !boost::bind(&std::string::empty, _1), prev_tab)); + LLPanelDirMarket* marketp = static_cast(container->getPanelByName(market_panel)); container->removeTabPanel(marketp); // Until we get a MarketPlace URL, tab is removed. marketp->handleRegionChange(container); @@ -452,7 +466,7 @@ void LLFloaterDirectory::searchInAll(const std::string& search_text) void LLFloaterDirectory::showFindAll(const std::string& search_text) { - showPanel("find_all_panel"); + showPanel(LFSimFeatureHandler::instance().searchURL().empty() ? "find_all_old_panel" : "find_all_panel"); LLPanelDirFindAllInterface::search(sInstance->mFindAllPanel, search_text); } @@ -589,12 +603,16 @@ void LLFloaterDirectory::toggleFind(void*) if (!sInstance) { std::string panel = gSavedSettings.getString("LastFindPanel"); - bool hasWebSearch = gHippoGridManager->getConnectedGrid()->isSecondLife() || - !gHippoGridManager->getConnectedGrid()->getSearchUrl().empty(); - if (hasWebSearch && (panel == "find_all_panel" || panel == "showcase_panel")) + if (!gHippoGridManager->getConnectedGrid()->isSecondLife()) { - panel = "find_all_old_panel"; + LFSimFeatureHandler& inst(LFSimFeatureHandler::instance()); + if (panel == "web_panel" + || (inst.searchURL().empty() && panel == "find_all_panel") + || (inst.destinationGuideURL().empty() && panel == "showcase_panel")) + panel = "find_all_old_panel"; } + else if (panel == "find_all_old_panel") panel = "find_all_panel"; + showPanel(panel); // HACK: force query for today's events diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index 5d51959d3..67e9421a5 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -144,6 +144,7 @@ BOOL LLFloaterSearch::postBuild() setRectControl("FloaterSearchRect"); applyRectControl(); search(SearchQuery()); + gSavedSettings.getControl("SearchURL")->getSignal()->connect(boost::bind(&LLFloaterSearch::search, this, SearchQuery())); return TRUE; } diff --git a/indra/newview/llpaneldirfind.cpp b/indra/newview/llpaneldirfind.cpp index 2903355f5..9d862afd8 100644 --- a/indra/newview/llpaneldirfind.cpp +++ b/indra/newview/llpaneldirfind.cpp @@ -65,6 +65,7 @@ #include "llpaneldirbrowser.h" #include "hippogridmanager.h" +#include "lfsimfeaturehandler.h" #if LL_MSVC // disable boost::lexical_cast warning @@ -76,6 +77,92 @@ //--------------------------------------------------------------------------- // LLPanelDirFindAll - Google search appliance based search //--------------------------------------------------------------------------- +namespace +{ + std::string getSearchUrl() + { + return LFSimFeatureHandler::instance().searchURL(); + } + enum SearchType + { + SEARCH_ALL_EMPTY, + SEARCH_ALL_QUERY, + SEARCH_ALL_TEMPLATE + }; + std::string getSearchUrl(SearchType ty, bool is_web) + { + const std::string mSearchUrl(getSearchUrl()); + if (is_web) + { + if (gHippoGridManager->getConnectedGrid()->isSecondLife()) + { + // Second Life defaults + if (ty == SEARCH_ALL_EMPTY) + { + return gSavedSettings.getString("SearchURLDefault"); + } + else if (ty == SEARCH_ALL_QUERY) + { + return gSavedSettings.getString("SearchURLQuery"); + } + else if (ty == SEARCH_ALL_TEMPLATE) + { + return gSavedSettings.getString("SearchURLSuffix2"); + } + } + else if (!mSearchUrl.empty()) + { + // Search url sent to us in the login response + if (ty == SEARCH_ALL_EMPTY) + { + return mSearchUrl; + } + else if (ty == SEARCH_ALL_QUERY) + { + return mSearchUrl + "q=[QUERY]&s=[COLLECTION]&"; + } + else if (ty == SEARCH_ALL_TEMPLATE) + { + return "lang=[LANG]&mat=[MATURITY]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]&dice=[DICE]"; + } + } + else + { + // OpenSim and other web search defaults + if (ty == SEARCH_ALL_EMPTY) + { + return gSavedSettings.getString("SearchURLDefaultOpenSim"); + } + else if (ty == SEARCH_ALL_QUERY) + { + return gSavedSettings.getString("SearchURLQueryOpenSim"); + } + else if (ty == SEARCH_ALL_TEMPLATE) + { + return gSavedSettings.getString("SearchURLSuffixOpenSim"); + } + } + } + else + { + // Use the old search all + if (ty == SEARCH_ALL_EMPTY) + { + return mSearchUrl + "panel=All&"; + } + else if (ty == SEARCH_ALL_QUERY) + { + return mSearchUrl + "q=[QUERY]&s=[COLLECTION]&"; + } + else if (ty == SEARCH_ALL_TEMPLATE) + { + return "lang=[LANG]&m=[MATURITY]&t=[TEEN]®ion=[REGION]&x=[X]&y=[Y]&z=[Z]&session=[SESSION]&dice=[DICE]"; + } + } + llinfos << "Illegal search URL type " << ty << llendl; + return ""; + } +} class LLPanelDirFindAll : public LLPanelDirFind @@ -90,6 +177,7 @@ public: LLPanelDirFindAll::LLPanelDirFindAll(const std::string& name, LLFloaterDirectory* floater) : LLPanelDirFind(name, floater, "find_browser") { + LFSimFeatureHandler::getInstance()->setSearchURLCallback(boost::bind(&LLPanelDirFindAll::navigateToDefaultPage, this)); } //--------------------------------------------------------------------------- @@ -264,48 +352,38 @@ void LLPanelDirFind::focus() void LLPanelDirFind::navigateToDefaultPage() { - std::string start_url = ""; + bool showcase(mBrowserName == "showcase_browser"); + std::string start_url = showcase ? LFSimFeatureHandler::instance().destinationGuideURL() : getSearchUrl(); + bool secondlife(gHippoGridManager->getConnectedGrid()->isSecondLife()); // Note: we use the web panel in OpenSim as well as Second Life -- MC - if (gHippoGridManager->getConnectedGrid()->getSearchUrl().empty() && - !gHippoGridManager->getConnectedGrid()->isSecondLife()) + if (start_url.empty() && !secondlife) { // OS-based but doesn't have its own web search url -- MC start_url = gSavedSettings.getString("SearchURLDefaultOpenSim"); } else { - if (gHippoGridManager->getConnectedGrid()->isSecondLife()) + if (!showcase) { - if (mBrowserName == "showcase_browser") - { - // note that the showcase URL in floater_directory.xml is no longer used - start_url = gSavedSettings.getString("ShowcaseURLDefault"); - } - else - { + if (secondlife) // Legacy Web Search start_url = gSavedSettings.getString("SearchURLDefault"); - } - } - else - { - // OS-based but has its own web search url -- MC - start_url = gHippoGridManager->getConnectedGrid()->getSearchUrl(); - start_url += "panel=" + getName() + "&"; - } + else // OS-based but has its own web search url -- MC + start_url += "panel=" + getName() + "&"; - if (hasChild("incmature")) - { - bool inc_pg = childGetValue("incpg").asBoolean(); - bool inc_mature = childGetValue("incmature").asBoolean(); - bool inc_adult = childGetValue("incadult").asBoolean(); - if (!(inc_pg || inc_mature || inc_adult)) + if (hasChild("incmature")) { - // if nothing's checked, just go for pg; we don't notify in - // this case because it's a default page. - inc_pg = true; + bool inc_pg = getChildView("incpg")->getValue().asBoolean(); + bool inc_mature = getChildView("incmature")->getValue().asBoolean(); + bool inc_adult = getChildView("incadult")->getValue().asBoolean(); + if (!(inc_pg || inc_mature || inc_adult)) + { + // if nothing's checked, just go for pg; we don't notify in + // this case because it's a default page. + inc_pg = true; + } + + start_url += getSearchURLSuffix(inc_pg, inc_mature, inc_adult, true); } - - start_url += getSearchURLSuffix(inc_pg, inc_mature, inc_adult, true); } } @@ -323,7 +401,7 @@ const std::string LLPanelDirFind::buildSearchURL(const std::string& search_text, std::string url; if (search_text.empty()) { - url = gHippoGridManager->getConnectedGrid()->getSearchUrl(HippoGridInfo::SEARCH_ALL_EMPTY, is_web); + url = getSearchUrl(SEARCH_ALL_EMPTY, is_web); } else { @@ -348,7 +426,7 @@ const std::string LLPanelDirFind::buildSearchURL(const std::string& search_text, "-._~$+!*'()"; std::string query = LLURI::escape(search_text_with_plus, allowed); - url = gHippoGridManager->getConnectedGrid()->getSearchUrl(HippoGridInfo::SEARCH_ALL_QUERY, is_web); + url = getSearchUrl(SEARCH_ALL_QUERY, is_web); std::string substring = "[QUERY]"; std::string::size_type where = url.find(substring); if (where != std::string::npos) @@ -373,14 +451,13 @@ const std::string LLPanelDirFind::buildSearchURL(const std::string& search_text, const std::string LLPanelDirFind::getSearchURLSuffix(bool inc_pg, bool inc_mature, bool inc_adult, bool is_web) const { - std::string url = gHippoGridManager->getConnectedGrid()->getSearchUrl(HippoGridInfo::SEARCH_ALL_TEMPLATE, is_web); + std::string url = getSearchUrl(SEARCH_ALL_TEMPLATE, is_web); llinfos << "Suffix template " << url << llendl; if (!url.empty()) { // Note: opensim's default template (SearchURLSuffixOpenSim) is currently empty -- MC - if (gHippoGridManager->getConnectedGrid()->isSecondLife() || - !gHippoGridManager->getConnectedGrid()->getSearchUrl().empty()) + if (gHippoGridManager->getConnectedGrid()->isSecondLife() || !getSearchUrl().empty()) { // if the mature checkbox is unchecked, modify query to remove // terms with given phrase from the result set @@ -524,11 +601,14 @@ LLPanelDirFindAll* LLPanelDirFindAllInterface::create(LLFloaterDirectory* floate return new LLPanelDirFindAll("find_all_panel", floater); } +static LLPanelDirFindAllOld* sFindAllOld = NULL; // static void LLPanelDirFindAllInterface::search(LLPanelDirFindAll* panel, const std::string& search_text) { - panel->search(search_text); + bool secondlife(gHippoGridManager->getConnectedGrid()->isSecondLife()); + if (secondlife || !getSearchUrl().empty()) panel->search(search_text); + if (!secondlife && sFindAllOld) sFindAllOld->search(search_text); } // static @@ -544,6 +624,7 @@ void LLPanelDirFindAllInterface::focus(LLPanelDirFindAll* panel) LLPanelDirFindAllOld::LLPanelDirFindAllOld(const std::string& name, LLFloaterDirectory* floater) : LLPanelDirBrowser(name, floater) { + sFindAllOld = this; mMinSearchChars = 3; } @@ -565,6 +646,7 @@ BOOL LLPanelDirFindAllOld::postBuild() LLPanelDirFindAllOld::~LLPanelDirFindAllOld() { + sFindAllOld = NULL; // Children all cleaned up by default view destructor. } @@ -575,12 +657,18 @@ void LLPanelDirFindAllOld::draw() LLPanelDirBrowser::draw(); } +void LLPanelDirFindAllOld::search(const std::string& query) +{ + getChildView("name")->setValue(query); + onClickSearch(); +} + void LLPanelDirFindAllOld::onClickSearch() { if (childGetValue("name").asString().length() < mMinSearchChars) { return; - }; + } BOOL inc_pg = childGetValue("incpg").asBoolean(); BOOL inc_mature = childGetValue("incmature").asBoolean(); diff --git a/indra/newview/llpaneldirfind.h b/indra/newview/llpaneldirfind.h index 8ec0e51aa..866c330a8 100644 --- a/indra/newview/llpaneldirfind.h +++ b/indra/newview/llpaneldirfind.h @@ -99,6 +99,7 @@ public: /*virtual*/ void draw(); + void search(const std::string& query); void onClickSearch(); }; diff --git a/indra/newview/llpaneldirpopular.cpp b/indra/newview/llpaneldirpopular.cpp index ddb9d3aa5..fa678d416 100644 --- a/indra/newview/llpaneldirpopular.cpp +++ b/indra/newview/llpaneldirpopular.cpp @@ -33,11 +33,13 @@ #include "llviewerprecompiledheaders.h" #include "llpaneldirpopular.h" +#include "lfsimfeaturehandler.h" LLPanelDirPopular::LLPanelDirPopular(const std::string& name, LLFloaterDirectory* floater) : LLPanelDirFind(name, floater, "showcase_browser") { // *NOTE: This is now the "Showcase" section + LFSimFeatureHandler::instance().setSearchURLCallback(boost::bind(&LLPanelDirPopular::navigateToDefaultPage, this)); } // virtual diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index f76e3fa7d..df84f6917 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -60,6 +60,7 @@ #include "hippolimits.h" #include "floaterao.h" #include "statemachine/aifilepicker.h" +#include "lfsimfeaturehandler.h" #include "llares.h" #include "llavatarnamecache.h" @@ -326,6 +327,12 @@ void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is dialog_refresh_all(); } +void simfeature_debug_update(const std::string& val, const std::string& setting) +{ + //if (!val.empty()) // Singu Note: Should we only update the setting if not empty? + gSavedSettings.setString(setting, val); +} + // // exported functionality // @@ -1257,6 +1264,9 @@ bool idle_startup() requested_options.push_back("tutorial_setting"); requested_options.push_back("login-flags"); requested_options.push_back("global-textures"); + // Opensim requested options + requested_options.push_back("destination_guide_url"); + // if(gSavedSettings.getBOOL("ConnectAsGod")) { gSavedSettings.setBOOL("UseDebugMenus", TRUE); @@ -1575,7 +1585,8 @@ bool idle_startup() if (process_login_success_response(password, first_sim_size_x, first_sim_size_y)) { std::string name = firstname; - if (!gHippoGridManager->getCurrentGrid()->isSecondLife() || + bool secondlife(gHippoGridManager->getCurrentGrid()->isSecondLife()); + if (!secondlife || !boost::algorithm::iequals(lastname, "Resident")) { name += " " + lastname; @@ -1583,6 +1594,13 @@ bool idle_startup() if (gSavedSettings.getBOOL("LiruGridInTitle")) gWindowTitle += "- " + gHippoGridManager->getCurrentGrid()->getGridName() + " "; gViewerWindow->getWindow()->setTitle(gWindowTitle += "- " + name); + if (!secondlife) + { + LFSimFeatureHandler& inst(LFSimFeatureHandler::instance()); + inst.setDestinationGuideURLCallback(boost::bind(simfeature_debug_update, _1, "ShowcaseURLDefault")); + inst.setSearchURLCallback(boost::bind(simfeature_debug_update, _1, "SearchURL")); + } + // Pass the user information to the voice chat server interface. LLVoiceClient::getInstance()->userAuthorized(name, gAgentID); // create the default proximal channel @@ -4083,7 +4101,8 @@ bool process_login_success_response(std::string& password, U32& first_sim_size_x LLWorldMap::gotMapServerURL(true); } - if(gHippoGridManager->getConnectedGrid()->isOpenSimulator()) + bool opensim = gHippoGridManager->getConnectedGrid()->isOpenSimulator(); + if (opensim) { std::string web_profile_url = response["web_profile_url"]; //if(!web_profile_url.empty()) // Singu Note: We're using this to check if this grid supports web profiles at all, so set empty if empty. @@ -4176,7 +4195,12 @@ bool process_login_success_response(std::string& password, U32& first_sim_size_x if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setPasswordUrl(tmp); tmp = response["search"].asString(); if (!tmp.empty()) gHippoGridManager->getConnectedGrid()->setSearchUrl(tmp); - if (gHippoGridManager->getConnectedGrid()->isOpenSimulator()) gSavedSettings.setString("SearchURL", tmp); // Singu Note: For web search purposes, always set this setting + else if (opensim) tmp = gHippoGridManager->getConnectedGrid()->getSearchUrl(); // Fallback from grid info response for setting + if (opensim) + { + gSavedSettings.setString("SearchURL", tmp); // Singu Note: For web search purposes, always set this setting + gSavedSettings.setString("ShowcaseURLDefault", response["destination_guide_url"].asString()); + } tmp = response["currency"].asString(); if (!tmp.empty()) { diff --git a/indra/newview/skins/default/xui/de/floater_directory.xml b/indra/newview/skins/default/xui/de/floater_directory.xml index 4aaf3e691..7dfa569bd 100644 --- a/indra/newview/skins/default/xui/de/floater_directory.xml +++ b/indra/newview/skins/default/xui/de/floater_directory.xml @@ -1,6 +1,31 @@ + + Suchen... + Nicht gefunden. + + Loading... Done - http://search.secondlife.com/ + [APP_SITE]/404 http://search.secondlife.com/ diff --git a/indra/newview/skins/default/xui/en-us/floater_directory2.xml b/indra/newview/skins/default/xui/en-us/floater_directory2.xml deleted file mode 100644 index 21afeea9c..000000000 --- a/indra/newview/skins/default/xui/en-us/floater_directory2.xml +++ /dev/null @@ -1,652 +0,0 @@ - - - - - - Searching... - - - None Found. - - + + + + + + [RES_X] x [RES_Y] From 21d54edeb9a6bc4fbf147155e9d1024af8e78256 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 7 Aug 2014 20:29:12 -0400 Subject: [PATCH 119/159] Per-slider reset buttons? Sure. Adds callback to registrar: "Prefs.Reset", pass debug setting name as parameter. --- indra/newview/llfloaterpreference.cpp | 6 +++++ indra/newview/llpaneldisplay.cpp | 3 ++- .../xui/en-us/panel_preferences_graphics1.xml | 25 +++++++++++++++---- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index a452d1368..403b04099 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -341,9 +341,15 @@ void LLPreferenceCore::setPersonalInfo(const std::string& visibility, bool im_vi ////////////////////////////////////////////// // LLFloaterPreference +void reset_to_default(const std::string& control) +{ + LLUI::getControlControlGroup(control).getControl(control)->resetToDefault(true); +} + LLFloaterPreference::LLFloaterPreference() { mExitWithoutSaving = false; + mCommitCallbackRegistrar.add("Prefs.Reset", boost::bind(reset_to_default, _2)); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preferences.xml"); } diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index 93978162c..1d4e23ded 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -97,6 +97,7 @@ const F32 MIN_USER_FAR_CLIP = 64.f; const S32 ASPECT_RATIO_STR_LEN = 100; +void reset_to_default(const std::string& control); void reset_all_to_default(const LLView* panel) { LLView::child_list_const_iter_t end(panel->endChild()); @@ -105,7 +106,7 @@ void reset_all_to_default(const LLView* panel) const std::string& control_name((*i)->getControlName()); if (control_name.empty()) continue; if (control_name == "RenderDepthOfField") continue; // Don't touch render settings *sigh* hack - LLUI::getControlControlGroup(control_name).getControl(control_name)->resetToDefault(true); + reset_to_default(control_name); } } diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml index 04f20c2be..a0c5551d4 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml @@ -141,11 +141,26 @@ when the Atmospheric Shaders are enabled. - - - - - + + + + + + + + + From acb093c277d7c1e0771acab219a7c811159317a9 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 7 Aug 2014 20:37:03 -0400 Subject: [PATCH 120/159] Media Filter code cleanup --- indra/newview/llfloatermediafilter.cpp | 2 +- indra/newview/llmediafilter.cpp | 157 ++++++++++--------------- 2 files changed, 61 insertions(+), 98 deletions(-) diff --git a/indra/newview/llfloatermediafilter.cpp b/indra/newview/llfloatermediafilter.cpp index 3384b05a9..3b636484b 100644 --- a/indra/newview/llfloatermediafilter.cpp +++ b/indra/newview/llfloatermediafilter.cpp @@ -74,7 +74,7 @@ void LLFloaterMediaFilter::updateLists(LLMediaFilter::EMediaList list_type) { bool white(list_type == LLMediaFilter::WHITELIST); const LLMediaFilter& inst(LLMediaFilter::instance()); - LLMediaFilter::string_list_t list = white ? inst.getWhiteList() : inst.getBlackList(); + const LLMediaFilter::string_list_t& list = white ? inst.getWhiteList() : inst.getBlackList(); LLScrollListCtrl* scroll(white ? mWhitelist : mBlacklist); scroll->clearRows(); for (LLMediaFilter::string_list_t::const_iterator itr = list.begin(); itr != list.end(); ++itr) diff --git a/indra/newview/llmediafilter.cpp b/indra/newview/llmediafilter.cpp index 9d5dacf1c..5521711d4 100644 --- a/indra/newview/llmediafilter.cpp +++ b/indra/newview/llmediafilter.cpp @@ -56,7 +56,7 @@ void LLMediaFilter::filterMediaUrl(LLParcel* parcel) const std::string domain = extractDomain(url); mCurrentParcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - U32 enabled = gSavedSettings.getU32("MediaFilterEnable"); + U32 enabled = gSavedSettings.getU32("MediaFilterEnable"); if (enabled > 1 && (filter(domain, WHITELIST) || filter(url, WHITELIST))) { @@ -104,7 +104,7 @@ void LLMediaFilter::filterAudioUrl(const std::string& url) const std::string domain = extractDomain(url); mCurrentParcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - U32 enabled = gSavedSettings.getU32("MediaFilterEnable"); + U32 enabled = gSavedSettings.getU32("MediaFilterEnable"); if (enabled > 1 && (filter(domain, WHITELIST) || filter(url, WHITELIST))) { @@ -141,7 +141,7 @@ void LLMediaFilter::filterAudioUrl(const std::string& url) bool LLMediaFilter::filter(const std::string& url, EMediaList list) { - const string_list_t p_list = (list == WHITELIST) ? mWhiteList : mBlackList; + const string_list_t& p_list = (list == WHITELIST) ? mWhiteList : mBlackList; string_list_t::const_iterator find_itr = std::find(p_list.begin(), p_list.end(), url); return (find_itr != p_list.end()); } @@ -149,60 +149,34 @@ bool LLMediaFilter::filter(const std::string& url, EMediaList list) // List bizznizz void LLMediaFilter::addToMediaList(const std::string& in_url, EMediaList list, bool extract) { - std::string url = extract ? extractDomain(in_url) : in_url; + const std::string url = extract ? extractDomain(in_url) : in_url; if (url.empty()) { LL_INFOS("MediaFilter") << "No url found. Can't add to list." << LL_ENDL; return; } - switch (list) + string_list_t& p_list(list == WHITELIST ? mWhiteList : mBlackList); + // Check for duplicates + for (string_list_t::const_iterator itr = p_list.begin(); itr != p_list.end(); ++itr) { - case WHITELIST: - // Check for duplicates - for (string_list_t::const_iterator itr = mWhiteList.begin(); itr != mWhiteList.end(); ++itr) - { - if (url == *itr) - { - LL_INFOS("MediaFilter") << "URL " << url << " already in list!" << LL_ENDL; - return; - } - } - mWhiteList.push_back(url); - mMediaListUpdate(WHITELIST); - break; - case BLACKLIST: - for (string_list_t::const_iterator itr = mBlackList.begin(); itr != mBlackList.end(); ++itr) - { - if (url == *itr) - { - LL_INFOS("MediaFilter") << "URL " << url << "already in list!" << LL_ENDL; - return; - } - } - mBlackList.push_back(url); - mMediaListUpdate(BLACKLIST); - break; + if (url == *itr) + { + LL_INFOS("MediaFilter") << "URL " << url << " already in list!" << LL_ENDL; + return; + } } + p_list.push_back(url); + mMediaListUpdate(list); saveMediaFilterToDisk(); } void LLMediaFilter::removeFromMediaList(string_vec_t domains, EMediaList list) { if (domains.empty()) return; - switch (list) - { - case WHITELIST: - for (string_vec_t::const_iterator itr = domains.begin(); itr != domains.end(); ++itr) - mWhiteList.remove(*itr); - mMediaListUpdate(WHITELIST); - break; - case BLACKLIST: - for (string_vec_t::const_iterator itr = domains.begin(); itr != domains.end(); ++itr) - mBlackList.remove(*itr); - mMediaListUpdate(BLACKLIST); - break; - } + for (string_vec_t::const_iterator itr = domains.begin(); itr != domains.end(); ++itr) + (list == WHITELIST ? mWhiteList : mBlackList).remove(*itr); + mMediaListUpdate(list); saveMediaFilterToDisk(); } @@ -242,25 +216,24 @@ void LLMediaFilter::loadMediaFilterFromDisk() } } +void medialist_to_llsd(const LLMediaFilter::string_list_t& list, LLSD& list_llsd, const LLSD& action) +{ + for (LLMediaFilter::string_list_t::const_iterator itr = list.begin(); itr != list.end(); ++itr) + { + LLSD item; + item["domain"] = *itr; + item["action"] = action; + list_llsd.append(item); + } +} + void LLMediaFilter::saveMediaFilterToDisk() const { const std::string medialist_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, MEDIALIST_XML); LLSD medialist_llsd; - for (string_list_t::const_iterator itr = mWhiteList.begin(); itr != mWhiteList.end(); ++itr) - { - LLSD item; - item["domain"] = *itr; - item["action"] = "allow"; // <- $*#@()&%@ - medialist_llsd.append(item); - } - for (string_list_t::const_iterator itr = mBlackList.begin(); itr != mBlackList.end(); ++itr) - { - LLSD item; - item["domain"] = *itr; - item["action"] = "deny"; // sigh. - medialist_llsd.append(item); - } + medialist_to_llsd(mWhiteList, medialist_llsd, "allow"); // <- $*#@()&%@ + medialist_to_llsd(mBlackList, medialist_llsd, "deny"); // sigh. llofstream medialist; medialist.open(medialist_filename); @@ -268,6 +241,30 @@ void LLMediaFilter::saveMediaFilterToDisk() const medialist.close(); } +void perform_queued_command(LLMediaFilter& inst) +{ + if (U32 command = inst.getQueuedMediaCommand()) + { + if (command == PARCEL_MEDIA_COMMAND_STOP) + { + LLViewerParcelMedia::stop(); + } + else if (command == PARCEL_MEDIA_COMMAND_PAUSE) + { + LLViewerParcelMedia::pause(); + } + else if (command == PARCEL_MEDIA_COMMAND_UNLOAD) + { + LLViewerParcelMedia::stop(); + } + else if (command == PARCEL_MEDIA_COMMAND_TIME) + { + LLViewerParcelMedia::seek(LLViewerParcelMedia::sMediaCommandTime); + } + inst.setQueuedMediaCommand(0); + } +} + bool handle_audio_filter_callback(const LLSD& notification, const LLSD& response, const std::string& url) { LLMediaFilter& inst(LLMediaFilter::instance()); @@ -335,26 +332,9 @@ bool handle_audio_filter_callback(const LLSD& notification, const LLSD& response if (queued_media) inst.filterMediaUrl(queued_media); } - else if (inst.getQueuedMediaCommand()) + else { - U32 command = inst.getQueuedMediaCommand(); - if (command == PARCEL_MEDIA_COMMAND_STOP) - { - LLViewerParcelMedia::stop(); - } - else if (command == PARCEL_MEDIA_COMMAND_PAUSE) - { - LLViewerParcelMedia::pause(); - } - else if (command == PARCEL_MEDIA_COMMAND_UNLOAD) - { - LLViewerParcelMedia::stop(); - } - else if (command == PARCEL_MEDIA_COMMAND_TIME) - { - LLViewerParcelMedia::seek(LLViewerParcelMedia::sMediaCommandTime); - } - inst.setQueuedMediaCommand(0); + perform_queued_command(inst); } return false; @@ -365,7 +345,7 @@ bool handle_media_filter_callback(const LLSD& notification, const LLSD& response LLMediaFilter& inst(LLMediaFilter::instance()); inst.setAlertStatus(false); S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - const std::string url = notification["payload"].asString(); + const std::string& url = notification["payload"].asString(); LLParcel* queue = inst.getQueuedMedia(); switch(option) { @@ -403,26 +383,9 @@ bool handle_media_filter_callback(const LLSD& notification, const LLSD& response inst.clearQueuedAudio(); inst.filterAudioUrl(audio_queue); } - else if (inst.getQueuedMediaCommand()) + else { - U32 command = inst.getQueuedMediaCommand(); - if (command == PARCEL_MEDIA_COMMAND_STOP) - { - LLViewerParcelMedia::stop(); - } - else if (command == PARCEL_MEDIA_COMMAND_PAUSE) - { - LLViewerParcelMedia::pause(); - } - else if (command == PARCEL_MEDIA_COMMAND_UNLOAD) - { - LLViewerParcelMedia::stop(); - } - else if (command == PARCEL_MEDIA_COMMAND_TIME) - { - LLViewerParcelMedia::seek(LLViewerParcelMedia::sMediaCommandTime); - } - inst.setQueuedMediaCommand(0); + perform_queued_command(inst); } return false; @@ -471,6 +434,6 @@ std::string extractDomain(const std::string& in_url) // Now map the whole thing to lowercase, since domain names aren't // case sensitive. - std::transform(url.begin(), url.end(),url.begin(), ::tolower); + std::transform(url.begin(), url.end(), url.begin(), ::tolower); return url; } From 4754c1322d4d74d10121370a518f4afb44f4478a Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 7 Aug 2014 21:56:25 -0400 Subject: [PATCH 121/159] This should probably be a size_t, perhaps this fixes the win64 mediafilter bug. --- indra/newview/llmediafilter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llmediafilter.cpp b/indra/newview/llmediafilter.cpp index 5521711d4..f96bcb7da 100644 --- a/indra/newview/llmediafilter.cpp +++ b/indra/newview/llmediafilter.cpp @@ -418,7 +418,7 @@ std::string extractDomain(const std::string& in_url) if (pos != std::string::npos) { - S32 count = url.size()-pos+1; + size_t count = url.size()-pos+1; url = url.substr(pos+1, count); } From d7d06c823446404e1b5cd994b53983c20c759e39 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 8 Aug 2014 07:07:51 -0400 Subject: [PATCH 122/159] Oh, and this one too, maybe it is fixed now? --- indra/newview/llmediafilter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llmediafilter.cpp b/indra/newview/llmediafilter.cpp index f96bcb7da..4d39b78bb 100644 --- a/indra/newview/llmediafilter.cpp +++ b/indra/newview/llmediafilter.cpp @@ -400,7 +400,7 @@ std::string extractDomain(const std::string& in_url) if (pos != std::string::npos) { - S32 count = url.size()-pos+2; + size_t count = url.size()-pos+2; url = url.substr(pos+2, count); } From 669fe29173c63ff71a8d7f64904f8b36ec1d6c3c Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 8 Aug 2014 08:26:48 -0400 Subject: [PATCH 123/159] Initialize members of LLMediaFilter, fixes win64 filter being broken. --- indra/newview/llmediafilter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/newview/llmediafilter.cpp b/indra/newview/llmediafilter.cpp index 4d39b78bb..56d01e422 100644 --- a/indra/newview/llmediafilter.cpp +++ b/indra/newview/llmediafilter.cpp @@ -41,6 +41,10 @@ bool handle_media_filter_callback(const LLSD& notification, const LLSD& response std::string extractDomain(const std::string& in_url); LLMediaFilter::LLMediaFilter() +: mMediaCommandQueue(0) +, mCurrentParcel(NULL) +, mMediaQueue(NULL) +, mAlertActive(false) { loadMediaFilterFromDisk(); } From 90c5219be97c213d125e1bb08354b2dae51d5911 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 8 Aug 2014 08:43:24 -0400 Subject: [PATCH 124/159] Move Media Filter from the View menu to the Singularity menu. Moves Media Filter in all translations, no need for translators to worry~ Nomade, please translate the Singularity menu at your discretion.. in menu_viewer.xml --- indra/newview/skins/default/xui/de/menu_viewer.xml | 4 ++-- indra/newview/skins/default/xui/en-us/menu_viewer.xml | 9 ++++----- indra/newview/skins/default/xui/es/menu_viewer.xml | 6 +++--- indra/newview/skins/default/xui/fr/menu_viewer.xml | 4 +++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/indra/newview/skins/default/xui/de/menu_viewer.xml b/indra/newview/skins/default/xui/de/menu_viewer.xml index 4841e56e3..ff86604f5 100644 --- a/indra/newview/skins/default/xui/de/menu_viewer.xml +++ b/indra/newview/skins/default/xui/de/menu_viewer.xml @@ -95,7 +95,6 @@ - @@ -259,7 +258,7 @@ - + @@ -271,6 +270,7 @@ + diff --git a/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 458bb96c8..a9115f61c 100644 --- a/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -357,11 +357,6 @@ - - - - + + + + diff --git a/indra/newview/skins/default/xui/es/menu_viewer.xml b/indra/newview/skins/default/xui/es/menu_viewer.xml index 24589cfe9..d4b53e57b 100644 --- a/indra/newview/skins/default/xui/es/menu_viewer.xml +++ b/indra/newview/skins/default/xui/es/menu_viewer.xml @@ -75,7 +75,6 @@ - @@ -215,7 +214,7 @@ - + @@ -224,9 +223,10 @@ + - + diff --git a/indra/newview/skins/default/xui/fr/menu_viewer.xml b/indra/newview/skins/default/xui/fr/menu_viewer.xml index dce04a84e..91b4c1b34 100644 --- a/indra/newview/skins/default/xui/fr/menu_viewer.xml +++ b/indra/newview/skins/default/xui/fr/menu_viewer.xml @@ -83,7 +83,6 @@ - @@ -243,4 +242,7 @@ + + + From 3b31fe91a65add978f8cd95fe729bfc46f27eacd Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 8 Aug 2014 14:52:52 -0400 Subject: [PATCH 125/159] Address Deltek's concern that the Open Attachment button wasn't changing text to just say save when the object is not the openable type. --- indra/newview/llpanelgroupnotices.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 74c591f1e..40e450dd7 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -53,6 +53,7 @@ #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "lltextbox.h" +#include "lltrans.h" #include "roles_constants.h" #include "llviewerwindow.h" @@ -511,6 +512,7 @@ void LLPanelGroupNotices::onSelectNotice() lldebugs << "Item " << item->getUUID() << " selected." << llendl; } +bool is_openable(LLAssetType::EType type); void LLPanelGroupNotices::showNotice(const std::string& subject, const std::string& message, const bool& has_inventory, @@ -549,6 +551,7 @@ void LLPanelGroupNotices::showNotice(const std::string& subject, mViewInventoryName->setText(ss.str()); mBtnOpenAttachment->setEnabled(TRUE); + mBtnOpenAttachment->setLabel(LLTrans::getString(is_openable(inventory_offer->mType) ? "GroupNotifyOpenAttachment" : "GroupNotifySaveAttachment")); } else { From 54a6db146e5e736f7c77e7b7cbb85dfb576372a8 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 8 Aug 2014 14:57:14 -0400 Subject: [PATCH 126/159] Upon further consideration and a bit of feedback, the new matching common characters behavior of gesture autocomplete is probably bad, I've commented it out and brought back the old code. --- indra/newview/llgesturemgr.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 1cae093dc..517266097 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -1358,8 +1358,10 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { S32 in_len = in_str.length(); +#ifdef MATCH_COMMON_CHARS std::string rest_of_match = ""; std::string buf = ""; +#endif item_map_t::iterator it; for (it = mActive.begin(); it != mActive.end(); ++it) { @@ -1367,18 +1369,26 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) if (gesture) { const std::string& trigger = gesture->getTrigger(); +#ifdef MATCH_COMMON_CHARS //return whole trigger, if received text equals to it if (!LLStringUtil::compareInsensitive(in_str, trigger)) { *out_str = trigger; return TRUE; } +#else + if (in_len > (S32)trigger.length()) continue; // too short, bail out +#endif //return common chars, if more than one trigger matches the prefix std::string trigger_trunc = trigger; LLStringUtil::truncate(trigger_trunc, in_len); if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc)) { +#ifndef MATCH_COMMON_CHARS + *out_str = trigger; + return TRUE; +#else if (rest_of_match.compare("") == 0) { rest_of_match = trigger.substr(in_str.size()); @@ -1411,16 +1421,18 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str) { rest_of_match = buf; } - +#endif } } } +#ifdef MATCH_COMMON_CHARS if (!rest_of_match.empty()) { *out_str = in_str + rest_of_match; return TRUE; } +#endif return FALSE; } From 50d91d13be81ecde70e2e9d0432abb93a971be00 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Fri, 8 Aug 2014 16:26:40 -0400 Subject: [PATCH 127/159] Allow dragging and dropping to attached objects There's now a guard serverside that'll prevent the situation that would cause things to break in the past, so there's no reason not to have this. --- indra/newview/lltooldraganddrop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index c1ea44d7a..dfcee38e7 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1604,7 +1604,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL transfer = TRUE; } BOOL volume = (LL_PCODE_VOLUME == obj->getPCode()); - BOOL attached = obj->isAttachment(); + BOOL attached = false; // No longer necessary. BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE; // [RLVa:KB] - Checked: 2010-03-31 (RLVa-1.2.0c) | Modified: RLVa-1.0.0c From 69436a903230a2e0dd80f1dc38682b89882d25a2 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 9 Aug 2014 10:50:24 -0400 Subject: [PATCH 128/159] Add french translation for connect to neighboring regions from Nomade Zhao --- .../skins/default/xui/fr/panel_preferences_ascent_vanity.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/fr/panel_preferences_ascent_vanity.xml index b5891495b..a00161142 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_ascent_vanity.xml @@ -14,6 +14,7 @@ + From a6ac8e1f7123eef1fd510f21bbd821d32c41ebfb Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sat, 9 Aug 2014 04:15:40 +0200 Subject: [PATCH 129/159] Workaround for clang bugs --- indra/llrender/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 38adb7dd0..b03111f7e 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -74,6 +74,11 @@ set(llrender_HEADER_FILES set_source_files_properties(${llrender_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) +# Workaround hack for clang bugs +if (DARWIN) + set_property(SOURCE llgl.cpp PROPERTY COMPILE_FLAGS -O1) +endif (DARWIN) + list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES}) add_library (llrender ${llrender_SOURCE_FILES}) From 2deba06212864f1d75ee851f22192fc703ca1261 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Mon, 11 Aug 2014 14:36:37 -0400 Subject: [PATCH 130/159] Missed a spot with the date column for group bans I'm thinking of putting a setting here instead of hardcoding the date format, actually, but for now this is good enough. --- indra/newview/llpanelgrouproles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index e66bad4eb..d9afd5b04 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -3048,7 +3048,7 @@ void LLPanelGroupBanListSubTab::populateBanList() ban_entry.columns.add().column("name").font/*.name*/("SANSSERIF_SMALL").font_style("NORMAL"); // Singu Note: We have special date columns, so our code is unique here - ban_entry.columns.add().column("ban_date").value(bd.mBanDate).format("%Y/%m%d").font/*.name*/("SANSSERIF_SMALL").font_style("NORMAL"); + ban_entry.columns.add().column("ban_date").value(bd.mBanDate).type("date").format("%Y/%m%d").font/*.name*/("SANSSERIF_SMALL").font_style("NORMAL"); mBanList->addNameItemRow(ban_entry); } From 8e2da87b9775419d2074ef339fcef9f162f646ee Mon Sep 17 00:00:00 2001 From: Damian Zhaoying Date: Mon, 11 Aug 2014 18:22:34 -0300 Subject: [PATCH 131/159] Update spanish translations to reflect a lot of changes and adds in last Alphas builds. --- .../skins/default/xui/es/floater_about.xml | 2 +- .../default/xui/es/floater_autoreplace.xml | 2 +- .../skins/default/xui/es/floater_avatar.xml | 4 + .../default/xui/es/floater_buy_currency.xml | 4 +- .../default/xui/es/floater_destinations.xml | 4 + .../default/xui/es/floater_directory.xml | 7 +- .../xui/es/floater_instant_message_ad_hoc.xml | 2 + ..._instant_message_ad_hoc_concisebuttons.xml | 3 +- ...floater_instant_message_concisebuttons.xml | 1 + .../xui/es/floater_instant_message_group.xml | 3 +- ...r_instant_message_group_concisebuttons.xml | 1 + .../skins/default/xui/es/floater_joystick.xml | 6 + .../default/xui/es/floater_media_lists.xml | 41 +++++++ .../default/xui/es/floater_object_weights.xml | 2 +- .../default/xui/es/floater_perm_prefs.xml | 26 +++-- .../skins/default/xui/es/floater_radar.xml | 2 + .../skins/default/xui/es/floater_tools.xml | 14 ++- .../skins/default/xui/es/menu_avs_list.xml | 1 + .../skins/default/xui/es/menu_login.xml | 2 +- .../skins/default/xui/es/menu_pie_object.xml | 8 +- .../skins/default/xui/es/menu_radar.xml | 2 + .../skins/default/xui/es/menu_viewer.xml | 17 +-- .../skins/default/xui/es/notifications.xml | 103 +++++++++++++++++- .../default/xui/es/panel_group_bulk_ban.xml | 25 +++++ .../default/xui/es/panel_group_general.xml | 2 +- .../default/xui/es/panel_group_invite.xml | 14 +-- .../default/xui/es/panel_group_roles.xml | 55 +++++++++- .../skins/default/xui/es/panel_login.xml | 3 +- .../xui/es/panel_preferences_ascent_chat.xml | 1 + .../es/panel_preferences_ascent_system.xml | 43 ++++++-- .../es/panel_preferences_ascent_vanity.xml | 4 +- .../xui/es/panel_preferences_audio.xml | 7 +- .../xui/es/panel_preferences_general.xml | 3 + .../xui/es/panel_preferences_graphics1.xml | 89 ++++----------- .../default/xui/es/panel_preferences_im.xml | 5 +- .../xui/es/panel_preferences_input.xml | 5 +- .../default/xui/es/panel_region_general.xml | 1 + .../skins/default/xui/es/role_actions.xml | 1 + .../newview/skins/default/xui/es/strings.xml | 35 +++++- 39 files changed, 414 insertions(+), 136 deletions(-) create mode 100644 indra/newview/skins/default/xui/es/floater_avatar.xml create mode 100644 indra/newview/skins/default/xui/es/floater_destinations.xml create mode 100644 indra/newview/skins/default/xui/es/floater_media_lists.xml create mode 100644 indra/newview/skins/default/xui/es/panel_group_bulk_ban.xml diff --git a/indra/newview/skins/default/xui/es/floater_about.xml b/indra/newview/skins/default/xui/es/floater_about.xml index fd18946c2..b6349b59c 100644 --- a/indra/newview/skins/default/xui/es/floater_about.xml +++ b/indra/newview/skins/default/xui/es/floater_about.xml @@ -1,5 +1,5 @@ - +