From ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 30 Apr 2009 13:04:20 -0500 Subject: Second Life viewer sources 1.23.0-RC --- linden/indra/llmath/camera.h | 3 +- linden/indra/llmath/coordframe.h | 3 +- linden/indra/llmath/llbboxlocal.cpp | 3 +- linden/indra/llmath/llbboxlocal.h | 3 +- linden/indra/llmath/llcamera.cpp | 155 ++++++++++++++++++++++++---------- linden/indra/llmath/llcamera.h | 25 ++++-- linden/indra/llmath/llcoord.h | 3 +- linden/indra/llmath/llcoordframe.cpp | 3 +- linden/indra/llmath/llcoordframe.h | 3 +- linden/indra/llmath/llinterp.h | 3 +- linden/indra/llmath/llline.cpp | 27 ++++-- linden/indra/llmath/llline.h | 25 ++++-- linden/indra/llmath/llmath.h | 81 +++++++++--------- linden/indra/llmath/llmodularmath.h | 3 +- linden/indra/llmath/lloctree.h | 13 ++- linden/indra/llmath/llperlin.cpp | 3 +- linden/indra/llmath/llperlin.h | 3 +- linden/indra/llmath/llplane.h | 3 +- linden/indra/llmath/llquantize.h | 3 +- linden/indra/llmath/llquaternion.cpp | 3 +- linden/indra/llmath/llquaternion.h | 3 +- linden/indra/llmath/llrect.cpp | 3 +- linden/indra/llmath/llrect.h | 8 +- linden/indra/llmath/llsdutil_math.cpp | 3 +- linden/indra/llmath/llsphere.cpp | 27 ++++-- linden/indra/llmath/llsphere.h | 27 ++++-- linden/indra/llmath/lltreenode.h | 3 +- linden/indra/llmath/llv4math.h | 3 +- linden/indra/llmath/llv4matrix3.h | 3 +- linden/indra/llmath/llv4matrix4.h | 3 +- linden/indra/llmath/llv4vector3.h | 3 +- linden/indra/llmath/llvolume.cpp | 87 +++++++++++-------- linden/indra/llmath/llvolume.h | 5 +- linden/indra/llmath/llvolumemgr.cpp | 3 +- linden/indra/llmath/llvolumemgr.h | 3 +- linden/indra/llmath/m3math.cpp | 3 +- linden/indra/llmath/m3math.h | 3 +- linden/indra/llmath/m4math.cpp | 3 +- linden/indra/llmath/m4math.h | 3 +- linden/indra/llmath/raytrace.cpp | 3 +- linden/indra/llmath/raytrace.h | 3 +- linden/indra/llmath/v2math.cpp | 3 +- linden/indra/llmath/v2math.h | 7 +- linden/indra/llmath/v3color.cpp | 3 +- linden/indra/llmath/v3color.h | 11 +-- linden/indra/llmath/v3dmath.cpp | 3 +- linden/indra/llmath/v3dmath.h | 3 +- linden/indra/llmath/v3math.cpp | 4 +- linden/indra/llmath/v3math.h | 7 +- linden/indra/llmath/v4color.cpp | 3 +- linden/indra/llmath/v4color.h | 3 +- linden/indra/llmath/v4coloru.cpp | 3 +- linden/indra/llmath/v4coloru.h | 3 +- linden/indra/llmath/v4math.cpp | 3 +- linden/indra/llmath/v4math.h | 3 +- linden/indra/llmath/xform.cpp | 3 +- linden/indra/llmath/xform.h | 3 +- 57 files changed, 414 insertions(+), 221 deletions(-) (limited to 'linden/indra/llmath') diff --git a/linden/indra/llmath/camera.h b/linden/indra/llmath/camera.h index 19df760..ce41f87 100644 --- a/linden/indra/llmath/camera.h +++ b/linden/indra/llmath/camera.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/coordframe.h b/linden/indra/llmath/coordframe.h index 47cbad5..b8a1c14 100644 --- a/linden/indra/llmath/coordframe.h +++ b/linden/indra/llmath/coordframe.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llbboxlocal.cpp b/linden/indra/llmath/llbboxlocal.cpp index b348edd..3d0dbb0 100644 --- a/linden/indra/llmath/llbboxlocal.cpp +++ b/linden/indra/llmath/llbboxlocal.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llbboxlocal.h b/linden/indra/llmath/llbboxlocal.h index 6406ee3..d69028e 100644 --- a/linden/indra/llmath/llbboxlocal.h +++ b/linden/indra/llmath/llbboxlocal.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llcamera.cpp b/linden/indra/llmath/llcamera.cpp index cb9fae6..0f343bc 100644 --- a/linden/indra/llmath/llcamera.cpp +++ b/linden/indra/llmath/llcamera.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -50,33 +51,38 @@ LLCamera::LLCamera() : } -LLCamera::LLCamera(F32 z_field_of_view, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane) : +LLCamera::LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane) : LLCoordFrame(), - mView(z_field_of_view), - mAspect(aspect_ratio), mViewHeightInPixels(view_height_in_pixels), - mNearPlane(near_plane), - mFarPlane(far_plane), mFixedDistance(-1.f), mPlaneCount(6) { - if (mView < MIN_FIELD_OF_VIEW) { mView = MIN_FIELD_OF_VIEW; } - else if (mView > MAX_FIELD_OF_VIEW) { mView = MAX_FIELD_OF_VIEW; } + mAspect = llclamp(aspect_ratio, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO); + mNearPlane = llclamp(near_plane, MIN_NEAR_PLANE, MAX_NEAR_PLANE); + if(far_plane < 0) far_plane = DEFAULT_FAR_PLANE; + mFarPlane = llclamp(far_plane, MIN_FAR_PLANE, MAX_FAR_PLANE); - if (mAspect < MIN_ASPECT_RATIO) { mAspect = MIN_ASPECT_RATIO; } - else if (mAspect > MAX_ASPECT_RATIO) { mAspect = MAX_ASPECT_RATIO; } - - if (mNearPlane < MIN_NEAR_PLANE) { mNearPlane = MIN_NEAR_PLANE; } - else if (mNearPlane > MAX_NEAR_PLANE) { mNearPlane = MAX_NEAR_PLANE; } + setView(vertical_fov_rads); +} - if (mFarPlane < 0) { mFarPlane = DEFAULT_FAR_PLANE; } - else if (mFarPlane < MIN_FAR_PLANE) { mFarPlane = MIN_FAR_PLANE; } - else if (mFarPlane > MAX_FAR_PLANE) { mFarPlane = MAX_FAR_PLANE; } - calculateFrustumPlanes(); -} +// ---------------- LLCamera::getFoo() member functions ---------------- +F32 LLCamera::getMinView() const +{ + // minimum vertical fov needs to be constrained in narrow windows. + return mAspect > 1 + ? MIN_FIELD_OF_VIEW // wide views + : MIN_FIELD_OF_VIEW * 1/mAspect; // clamps minimum width in narrow views +} +F32 LLCamera::getMaxView() const +{ + // maximum vertical fov needs to be constrained in wide windows. + return mAspect > 1 + ? MAX_FIELD_OF_VIEW / mAspect // clamps maximum width in wide views + : MAX_FIELD_OF_VIEW; // narrow views +} // ---------------- LLCamera::setFoo() member functions ---------------- @@ -92,11 +98,9 @@ void LLCamera::disableUserClipPlane() mPlaneCount = 6; } -void LLCamera::setView(F32 field_of_view) +void LLCamera::setView(F32 vertical_fov_rads) { - mView = field_of_view; - if (mView < MIN_FIELD_OF_VIEW) { mView = MIN_FIELD_OF_VIEW; } - else if (mView > MAX_FIELD_OF_VIEW) { mView = MAX_FIELD_OF_VIEW; } + mView = llclamp(vertical_fov_rads, MIN_FIELD_OF_VIEW, MAX_FIELD_OF_VIEW); calculateFrustumPlanes(); } @@ -110,27 +114,21 @@ void LLCamera::setViewHeightInPixels(S32 height) void LLCamera::setAspect(F32 aspect_ratio) { - mAspect = aspect_ratio; - if (mAspect < MIN_ASPECT_RATIO) { mAspect = MIN_ASPECT_RATIO; } - else if (mAspect > MAX_ASPECT_RATIO) { mAspect = MAX_ASPECT_RATIO; } + mAspect = llclamp(aspect_ratio, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO); calculateFrustumPlanes(); } void LLCamera::setNear(F32 near_plane) { - mNearPlane = near_plane; - if (mNearPlane < MIN_NEAR_PLANE) { mNearPlane = MIN_NEAR_PLANE; } - else if (mNearPlane > MAX_NEAR_PLANE) { mNearPlane = MAX_NEAR_PLANE; } + mNearPlane = llclamp(near_plane, MIN_NEAR_PLANE, MAX_NEAR_PLANE); calculateFrustumPlanes(); } void LLCamera::setFar(F32 far_plane) { - mFarPlane = far_plane; - if (mFarPlane < MIN_FAR_PLANE) { mFarPlane = MIN_FAR_PLANE; } - else if (mFarPlane > MAX_FAR_PLANE) { mFarPlane = MAX_FAR_PLANE; } + mFarPlane = llclamp(far_plane, MIN_FAR_PLANE, MAX_FAR_PLANE); calculateFrustumPlanes(); } @@ -180,28 +178,95 @@ S32 LLCamera::AABBInFrustum(const LLVector3 ¢er, const LLVector3& radius) U8 mask = 0; S32 result = 2; - for (U32 i = 0; i < mPlaneCount; i++) - { - mask = mAgentPlanes[i].mask; - LLPlane p = mAgentPlanes[i].p; - LLVector3 n = LLVector3(p); - float d = p.mV[3]; - LLVector3 rscale = radius.scaledVec(scaler[mask]); - - LLVector3 minp = center - rscale; - LLVector3 maxp = center + rscale; + if (radius.magVecSquared() > mFrustumCornerDist * mFrustumCornerDist) + { //box is larger than frustum, check frustum quads against box planes - if (n * minp > -d) + static const LLVector3 dir[] = { - return 0; + LLVector3(1, 0, 0), + LLVector3(-1, 0, 0), + LLVector3(0, 1, 0), + LLVector3(0, -1, 0), + LLVector3(0, 0, 1), + LLVector3(0, 0, -1) + }; + + U32 quads[] = + { + 0, 1, 2, 3, + 0, 1, 5, 4, + 2, 3, 7, 6, + 3, 0, 7, 4, + 1, 2, 6, 4, + 4, 5, 6, 7 + }; + + result = 0; + + BOOL total_inside = TRUE; + for (U32 i = 0; i < 6; i++) + { + LLVector3 p = center + radius.scaledVec(dir[i]); + F32 d = -p*dir[i]; + + for (U32 j = 0; j < 6; j++) + { //for each quad + F32 dist = mAgentFrustum[quads[j*4+0]]*dir[i] + d; + if (dist > 0) + { //at least one frustum point is outside the AABB + total_inside = FALSE; + for (U32 k = 1; k < 4; k++) + { //for each other point on quad + if ( mAgentFrustum[quads[j*4+k]]*dir[i]+d <= 0.f) + { //quad is straddling some plane of AABB + return 1; + } + } + } + else + { + for (U32 k = 1; k < 4; k++) + { + if (mAgentFrustum[quads[j*4+k]]*dir[i]+d > 0.f) + { + return 1; + } + } + } + } } - - if (n * maxp > -d) + + if (total_inside) { result = 1; } } + else + { + for (U32 i = 0; i < mPlaneCount; i++) + { + mask = mAgentPlanes[i].mask; + LLPlane p = mAgentPlanes[i].p; + LLVector3 n = LLVector3(p); + float d = p.mV[3]; + LLVector3 rscale = radius.scaledVec(scaler[mask]); + + LLVector3 minp = center - rscale; + LLVector3 maxp = center + rscale; + + if (n * minp > -d) + { + return 0; + } + + if (n * maxp > -d) + { + result = 1; + } + } + } + return result; } diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h index bb9ae55..23ee115 100644 --- a/linden/indra/llmath/llcamera.h +++ b/linden/indra/llmath/llcamera.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -42,17 +43,19 @@ const F32 DEFAULT_ASPECT_RATIO = 640.f / 480.f; const F32 DEFAULT_NEAR_PLANE = 0.25f; const F32 DEFAULT_FAR_PLANE = 64.f; // far reaches across two horizontal, not diagonal, regions -const F32 MAX_FIELD_OF_VIEW = F_PI; const F32 MAX_ASPECT_RATIO = 50.0f; const F32 MAX_NEAR_PLANE = 10.f; const F32 MAX_FAR_PLANE = 100000.0f; //1000000.0f; // Max allowed. Not good Z precision though. const F32 MAX_FAR_CLIP = 512.0f; -const F32 MIN_FIELD_OF_VIEW = 0.1f; const F32 MIN_ASPECT_RATIO = 0.02f; const F32 MIN_NEAR_PLANE = 0.1f; const F32 MIN_FAR_PLANE = 0.2f; +// Min/Max FOV values for square views. Call getMin/MaxView to get extremes based on current aspect ratio. +static const F32 MIN_FIELD_OF_VIEW = 5.0f * DEG_TO_RAD; +static const F32 MAX_FIELD_OF_VIEW = 175.f * DEG_TO_RAD; + static const LLVector3 X_AXIS(1.f,0.f,0.f); static const LLVector3 Y_AXIS(0.f,1.f,0.f); static const LLVector3 Z_AXIS(0.f,0.f,1.f); @@ -101,7 +104,7 @@ public: HORIZ_PLANE_ALL_MASK = 0x3 }; -protected: +private: F32 mView; // angle between top and bottom frustum planes in radians. F32 mAspect; // width/height S32 mViewHeightInPixels; // for ViewHeightInPixels() only @@ -117,12 +120,12 @@ protected: struct frustum_plane { - frustum_plane() : mask(0) {} + frustum_plane() : mask(0) {} LLPlane p; U8 mask; }; frustum_plane mAgentPlanes[7]; //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP - + U32 mPlaneCount; //defaults to 6, if setUserClipPlane is called, uses user supplied clip plane in LLVector3 mWorldPlanePos; // Position of World Planes (may be offset from camera) @@ -132,12 +135,13 @@ public: public: LLCamera(); - LLCamera(F32 z_field_of_view, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); + LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); + virtual ~LLCamera(){} // no-op virtual destructor void setUserClipPlane(LLPlane plane); void disableUserClipPlane(); U8 calcPlaneMask(const LLPlane& plane); - void setView(F32 new_view); + virtual void setView(F32 vertical_fov_rads); void setViewHeightInPixels(S32 height); void setAspect(F32 new_aspect); void setNear(F32 new_near); @@ -148,6 +152,11 @@ public: F32 getAspect() const { return mAspect; } // width / height F32 getNear() const { return mNearPlane; } // meters F32 getFar() const { return mFarPlane; } // meters + + // The values returned by the min/max view getters depend upon the aspect ratio + // at the time they are called and therefore should not be cached. + F32 getMinView() const; + F32 getMaxView() const; F32 getYaw() const { diff --git a/linden/indra/llmath/llcoord.h b/linden/indra/llmath/llcoord.h index dbe6678..9d46a8b 100644 --- a/linden/indra/llmath/llcoord.h +++ b/linden/indra/llmath/llcoord.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llcoordframe.cpp b/linden/indra/llmath/llcoordframe.cpp index f1707c9..673a8f2 100644 --- a/linden/indra/llmath/llcoordframe.cpp +++ b/linden/indra/llmath/llcoordframe.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llcoordframe.h b/linden/indra/llmath/llcoordframe.h index 0ce56bf..89b5d8b 100644 --- a/linden/indra/llmath/llcoordframe.h +++ b/linden/indra/llmath/llcoordframe.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llinterp.h b/linden/indra/llmath/llinterp.h index 7438317..8beeef4 100644 --- a/linden/indra/llmath/llinterp.h +++ b/linden/indra/llmath/llinterp.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llline.cpp b/linden/indra/llmath/llline.cpp index 147918c..b198573 100644 --- a/linden/indra/llmath/llline.cpp +++ b/linden/indra/llmath/llline.cpp @@ -3,16 +3,27 @@ * @author Andrew Meadows * @brief Simple line class that can compute nearest approach between two lines * - * $LicenseInfo:firstyear=2001&license=internal$ + * $LicenseInfo:firstyear=2006&license=viewergpl$ * - * Copyright (c) 2001-2009, Linden Research, Inc. + * Copyright (c) 2006-2009, Linden Research, Inc. * - * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of - * this source code is governed by the Linden Lab Source Code Disclosure - * Agreement ("Agreement") previously entered between you and Linden - * Lab. By accessing, using, copying, modifying or distributing this - * software, you acknowledge that you have been informed of your - * obligations under the Agreement and agree to abide by those obligations. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, diff --git a/linden/indra/llmath/llline.h b/linden/indra/llmath/llline.h index e7827d5..9ab41b1 100644 --- a/linden/indra/llmath/llline.h +++ b/linden/indra/llmath/llline.h @@ -4,16 +4,27 @@ * @author Andrew Meadows * @brief Simple line for computing nearest approach between two infinite lines * - * $LicenseInfo:firstyear=2006&license=internal$ + * $LicenseInfo:firstyear=2006&license=viewergpl$ * * Copyright (c) 2006-2009, Linden Research, Inc. * - * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of - * this source code is governed by the Linden Lab Source Code Disclosure - * Agreement ("Agreement") previously entered between you and Linden - * Lab. By accessing, using, copying, modifying or distributing this - * software, you acknowledge that you have been informed of your - * obligations under the Agreement and agree to abide by those obligations. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h index b2d4d26..66451b1 100644 --- a/linden/indra/llmath/llmath.h +++ b/linden/indra/llmath/llmath.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -37,6 +38,10 @@ #include "lldefs.h" #include "llstl.h" // *TODO: Remove when LLString is gone #include "llstring.h" // *TODO: Remove when LLString is gone +// lltut.h uses is_approx_equal_fraction(). This was moved to its own header +// file in llcommon so we can use lltut.h for llcommon tests without making +// llcommon depend on llmath. +#include "is_approx_equal_fraction.h" // work around for Windows & older gcc non-standard function names. #if LL_WINDOWS @@ -85,6 +90,8 @@ const F32 GRAVITY = -9.8f; const F32 F_PI = 3.1415926535897932384626433832795f; const F32 F_TWO_PI = 6.283185307179586476925286766559f; const F32 F_PI_BY_TWO = 1.5707963267948966192313216916398f; +const F32 F_SQRT_TWO_PI = 2.506628274631000502415765284811f; +const F32 F_E = 2.71828182845904523536f; const F32 F_SQRT2 = 1.4142135623730950488016887242097f; const F32 F_SQRT3 = 1.73205080756888288657986402541f; const F32 OO_SQRT2 = 0.7071067811865475244008443621049f; @@ -103,6 +110,30 @@ const F32 FP_MAG_THRESHOLD = 0.0000001f; // TODO: Replace with logic like is_approx_equal inline BOOL is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < F_APPROXIMATELY_ZERO); } +// These functions work by interpreting sign+exp+mantissa as an unsigned +// integer. +// For example: +// x = 1 00000010 00000000000000000000000 +// y = 1 00000001 11111111111111111111111 +// +// interpreted as ints = +// x = 10000001000000000000000000000000 +// y = 10000000111111111111111111111111 +// which is clearly a different of 1 in the least significant bit +// Values with the same exponent can be trivially shown to work. +// +// WARNING: Denormals of opposite sign do not work +// x = 1 00000000 00000000000000000000001 +// y = 0 00000000 00000000000000000000001 +// Although these values differ by 2 in the LSB, the sign bit makes +// the int comparison fail. +// +// WARNING: NaNs can compare equal +// There is no special treatment of exceptional values like NaNs +// +// WARNING: Infinity is comparable with F32_MAX and negative +// infinity is comparable with F32_MIN + inline BOOL is_approx_equal(F32 x, F32 y) { const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; @@ -115,48 +146,6 @@ inline BOOL is_approx_equal(F64 x, F64 y) return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); } -inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) -{ - BOOL ret = TRUE; - F32 diff = (F32) fabs(x - y); - - S32 diffInt = (S32) diff; - S32 diffFracTolerance = (S32) ((diff - (F32) diffInt) * (1 << frac_bits)); - - // if integer portion is not equal, not enough bits were used for packing - // so error out since either the use case is not correct OR there is - // an issue with pack/unpack. should fail in either case. - // for decimal portion, make sure that the delta is no more than 1 - // based on the number of bits used for packing decimal portion. - if (diffInt != 0 || diffFracTolerance > 1) - { - ret = FALSE; - } - - return ret; -} - -inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) -{ - BOOL ret = TRUE; - F64 diff = (F64) fabs(x - y); - - S32 diffInt = (S32) diff; - S32 diffFracTolerance = (S32) ((diff - (F64) diffInt) * (1 << frac_bits)); - - // if integer portion is not equal, not enough bits were used for packing - // so error out since either the use case is not correct OR there is - // an issue with pack/unpack. should fail in either case. - // for decimal portion, make sure that the delta is no more than 1 - // based on the number of bits used for packing decimal portion. - if (diffInt != 0 || diffFracTolerance > 1) - { - ret = FALSE; - } - - return ret; -} - inline S32 llabs(const S32 a) { return S32(std::labs(a)); @@ -523,4 +512,10 @@ inline U32 get_next_power_two(U32 val, U32 max_power_two) return val; } +//get the gaussian value given the linear distance from axis x and guassian value o +inline F32 llgaussian(F32 x, F32 o) +{ + return 1.f/(F_SQRT_TWO_PI*o)*powf(F_E, -(x*x)/(2*o*o)); +} + #endif diff --git a/linden/indra/llmath/llmodularmath.h b/linden/indra/llmath/llmodularmath.h index 67083ea..6009529 100644 --- a/linden/indra/llmath/llmodularmath.h +++ b/linden/indra/llmath/llmodularmath.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/lloctree.h b/linden/indra/llmath/lloctree.h index 3c94aa3..bced84c 100644 --- a/linden/indra/llmath/lloctree.h +++ b/linden/indra/llmath/lloctree.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -330,6 +331,16 @@ public: //push center in direction of data LLOctreeNode::pushCenter(center, size, data); + // handle case where floating point number gets too small + if( llabs(center.mdV[0] - getCenter().mdV[0]) < F_APPROXIMATELY_ZERO && + llabs(center.mdV[1] - getCenter().mdV[1]) < F_APPROXIMATELY_ZERO && + llabs(center.mdV[2] - getCenter().mdV[2]) < F_APPROXIMATELY_ZERO) + { + mData.insert(data); + BaseType::insert(data); + return true; + } + #if LL_OCTREE_PARANOIA_CHECK if (getChildCount() == 8) { diff --git a/linden/indra/llmath/llperlin.cpp b/linden/indra/llmath/llperlin.cpp index 2c3ed90..9293d97 100644 --- a/linden/indra/llmath/llperlin.cpp +++ b/linden/indra/llmath/llperlin.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llperlin.h b/linden/indra/llmath/llperlin.h index d6cf823..e8815ec 100644 --- a/linden/indra/llmath/llperlin.h +++ b/linden/indra/llmath/llperlin.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llplane.h b/linden/indra/llmath/llplane.h index 558cc37..89c6a14 100644 --- a/linden/indra/llmath/llplane.h +++ b/linden/indra/llmath/llplane.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llquantize.h b/linden/indra/llmath/llquantize.h index 25be9c0..2192427 100644 --- a/linden/indra/llmath/llquantize.h +++ b/linden/indra/llmath/llquantize.h @@ -18,7 +18,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llquaternion.cpp b/linden/indra/llmath/llquaternion.cpp index 485d0cd..cfd6183 100644 --- a/linden/indra/llmath/llquaternion.cpp +++ b/linden/indra/llmath/llquaternion.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llquaternion.h b/linden/indra/llmath/llquaternion.h index 2289bc8..5db9c5b 100644 --- a/linden/indra/llmath/llquaternion.h +++ b/linden/indra/llmath/llquaternion.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llrect.cpp b/linden/indra/llmath/llrect.cpp index 025d476..cba76dd 100644 --- a/linden/indra/llmath/llrect.cpp +++ b/linden/indra/llmath/llrect.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llrect.h b/linden/indra/llmath/llrect.h index a9faa19..9eb58db 100644 --- a/linden/indra/llmath/llrect.h +++ b/linden/indra/llmath/llrect.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -223,6 +224,11 @@ public: return *this; } + bool isValid() const + { + return mLeft <= mRight && mBottom <= mTop; + } + bool isNull() const { return mLeft == mRight || mBottom == mTop; diff --git a/linden/indra/llmath/llsdutil_math.cpp b/linden/indra/llmath/llsdutil_math.cpp index c17c682..073cb2e 100644 --- a/linden/indra/llmath/llsdutil_math.cpp +++ b/linden/indra/llmath/llsdutil_math.cpp @@ -19,7 +19,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llsphere.cpp b/linden/indra/llmath/llsphere.cpp index 2923ffe..b260c13 100644 --- a/linden/indra/llmath/llsphere.cpp +++ b/linden/indra/llmath/llsphere.cpp @@ -3,16 +3,27 @@ * @author Andrew Meadows * @brief Simple line class that can compute nearest approach between two lines * - * $LicenseInfo:firstyear=2006&license=internal$ + * $LicenseInfo:firstyear=2007&license=viewergpl$ * - * Copyright (c) 2006-2009, Linden Research, Inc. + * Copyright (c) 2007-2009, Linden Research, Inc. * - * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of - * this source code is governed by the Linden Lab Source Code Disclosure - * Agreement ("Agreement") previously entered between you and Linden - * Lab. By accessing, using, copying, modifying or distributing this - * software, you acknowledge that you have been informed of your - * obligations under the Agreement and agree to abide by those obligations. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, diff --git a/linden/indra/llmath/llsphere.h b/linden/indra/llmath/llsphere.h index 2f905e6..58df07a 100644 --- a/linden/indra/llmath/llsphere.h +++ b/linden/indra/llmath/llsphere.h @@ -4,16 +4,27 @@ * @author Andrew Meadows * @brief Simple sphere implementation for basic geometric operations * - * $LicenseInfo:firstyear=2001&license=internal$ + * $LicenseInfo:firstyear=2007&license=viewergpl$ * - * Copyright (c) 2001-2009, Linden Research, Inc. + * Copyright (c) 2007-2009, Linden Research, Inc. * - * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of - * this source code is governed by the Linden Lab Source Code Disclosure - * Agreement ("Agreement") previously entered between you and Linden - * Lab. By accessing, using, copying, modifying or distributing this - * software, you acknowledge that you have been informed of your - * obligations under the Agreement and agree to abide by those obligations. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, diff --git a/linden/indra/llmath/lltreenode.h b/linden/indra/llmath/lltreenode.h index 6f5e701..ee98362 100644 --- a/linden/indra/llmath/lltreenode.h +++ b/linden/indra/llmath/lltreenode.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llv4math.h b/linden/indra/llmath/llv4math.h index 9c1737e..5b180b3 100644 --- a/linden/indra/llmath/llv4math.h +++ b/linden/indra/llmath/llv4math.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llv4matrix3.h b/linden/indra/llmath/llv4matrix3.h index 619c966..ed503e9 100644 --- a/linden/indra/llmath/llv4matrix3.h +++ b/linden/indra/llmath/llv4matrix3.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llv4matrix4.h b/linden/indra/llmath/llv4matrix4.h index 662d379..959fa34 100644 --- a/linden/indra/llmath/llv4matrix4.h +++ b/linden/indra/llmath/llv4matrix4.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llv4vector3.h b/linden/indra/llmath/llv4vector3.h index e45ba50..a41de47 100644 --- a/linden/indra/llmath/llv4vector3.h +++ b/linden/indra/llmath/llv4vector3.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp index 5603a9c..1250f53 100644 --- a/linden/indra/llmath/llvolume.cpp +++ b/linden/indra/llmath/llvolume.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -1972,34 +1973,29 @@ inline LLVector3 sculpt_xy_to_vector(U32 x, U32 y, U16 sculpt_width, U16 sculpt_ } -F32 LLVolume::sculptGetSurfaceArea(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data) +F32 LLVolume::sculptGetSurfaceArea() { // test to see if image has enough variation to create non-degenerate geometry + F32 area = 0; + S32 sizeS = mPathp->mPath.size(); S32 sizeT = mProfilep->mProfile.size(); - - F32 area = 0; - - if ((sculpt_width != 0) && - (sculpt_height != 0) && - (sculpt_components != 0) && - (sculpt_data != NULL)) + + for (S32 s = 0; s < sizeS-1; s++) { - for (S32 s = 0; s < sizeS - 1; s++) + for (S32 t = 0; t < sizeT-1; t++) { - for (S32 t = 0; t < sizeT - 1; t++) - { - // convert image data to vectors - LLVector3 p1 = sculpt_st_to_vector(s, t, sizeS, sizeT, sculpt_width, sculpt_height, sculpt_components, sculpt_data); - LLVector3 p2 = sculpt_st_to_vector(s+1, t, sizeS, sizeT, sculpt_width, sculpt_height, sculpt_components, sculpt_data); - LLVector3 p3 = sculpt_st_to_vector(s, t+1, sizeS, sizeT, sculpt_width, sculpt_height, sculpt_components, sculpt_data); - - // compute the area of the parallelogram by taking the length of the cross product: - // (parallegram is an approximation of two triangles) - LLVector3 cross = (p1 - p2) % (p1 - p3); - area += cross.magVec(); - } + // get four corners of quad + LLVector3 p1 = mMesh[(s )*sizeT + (t )].mPos; + LLVector3 p2 = mMesh[(s+1)*sizeT + (t )].mPos; + LLVector3 p3 = mMesh[(s )*sizeT + (t+1)].mPos; + LLVector3 p4 = mMesh[(s+1)*sizeT + (t+1)].mPos; + + // compute the area of the quad by taking the length of the cross product of the two triangles + LLVector3 cross1 = (p1 - p2) % (p1 - p3); + LLVector3 cross2 = (p4 - p2) % (p4 - p3); + area += (cross1.magVec() + cross2.magVec()) / 2.0; } } @@ -2163,7 +2159,21 @@ S32 sculpt_sides(F32 detail) // determine the number of vertices in both s and t direction for this sculpt void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32& s, S32& t) { - S32 vertices = sculpt_sides(detail); + // this code has the following properties: + // 1) the aspect ratio of the mesh is as close as possible to the ratio of the map + // while still using all available verts + // 2) the mesh cannot have more verts than is allowed by LOD + // 3) the mesh cannot have more verts than is allowed by the map + + S32 max_vertices_lod = (S32)pow((double)sculpt_sides(detail), 2.0); + S32 max_vertices_map = width * height / 4; + + S32 vertices; + if (max_vertices_map > 0) + vertices = llmin(max_vertices_lod, max_vertices_map); + else + vertices = max_vertices_lod; + F32 ratio; if ((width == 0) || (height == 0)) @@ -2172,13 +2182,13 @@ void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32 ratio = (F32) width / (F32) height; - s = (S32)(vertices / fsqrtf(ratio)); + s = (S32)fsqrtf(((F32)vertices / ratio)); - s = llmax(s, 3); // no degenerate sizes, please - t = vertices * vertices / s; + s = llmax(s, 4); // no degenerate sizes, please + t = vertices / s; - t = llmax(t, 3); // no degenerate sizes, please - s = vertices * vertices / t; + t = llmax(t, 4); // no degenerate sizes, please + s = vertices / t; } // sculpt replaces generate() for sculpted surfaces @@ -2215,20 +2225,25 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, sNumMeshPoints -= mMesh.size(); mMesh.resize(sizeS * sizeT); sNumMeshPoints += mMesh.size(); - - if (!data_is_empty && sculptGetSurfaceArea(sculpt_width, sculpt_height, sculpt_components, sculpt_data) < SCULPT_MIN_AREA) - data_is_empty = TRUE; //generate vertex positions - if (data_is_empty) // if empty, make a placeholder mesh - { - sculptGeneratePlaceholder(); - } - else + if (!data_is_empty) { sculptGenerateMapVertices(sculpt_width, sculpt_height, sculpt_components, sculpt_data, sculpt_type); + + if (sculptGetSurfaceArea() < SCULPT_MIN_AREA) + { + data_is_empty = TRUE; + } } + if (data_is_empty) + { + sculptGeneratePlaceholder(); + } + + + for (S32 i = 0; i < (S32)mProfilep->mFaces.size(); i++) { mFaceMask |= mProfilep->mFaces[i].mFaceID; diff --git a/linden/indra/llmath/llvolume.h b/linden/indra/llmath/llvolume.h index 48c48e4..e55fe52 100644 --- a/linden/indra/llmath/llvolume.h +++ b/linden/indra/llmath/llvolume.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -942,8 +943,8 @@ public: void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level); private: - F32 sculptGetSurfaceArea(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data); void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type); + F32 sculptGetSurfaceArea(); void sculptGeneratePlaceholder(); void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t); diff --git a/linden/indra/llmath/llvolumemgr.cpp b/linden/indra/llmath/llvolumemgr.cpp index edd7513..53641fc 100644 --- a/linden/indra/llmath/llvolumemgr.cpp +++ b/linden/indra/llmath/llvolumemgr.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/llvolumemgr.h b/linden/indra/llmath/llvolumemgr.h index 0348373..e10ad94 100644 --- a/linden/indra/llmath/llvolumemgr.h +++ b/linden/indra/llmath/llvolumemgr.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/m3math.cpp b/linden/indra/llmath/m3math.cpp index 578a4c6..1b878c8 100644 --- a/linden/indra/llmath/m3math.cpp +++ b/linden/indra/llmath/m3math.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/m3math.h b/linden/indra/llmath/m3math.h index 76ee1ea..3ac963e 100644 --- a/linden/indra/llmath/m3math.h +++ b/linden/indra/llmath/m3math.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/m4math.cpp b/linden/indra/llmath/m4math.cpp index dc6b0b5..59a0bc2 100644 --- a/linden/indra/llmath/m4math.cpp +++ b/linden/indra/llmath/m4math.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/m4math.h b/linden/indra/llmath/m4math.h index 1d30489..58c9c09 100644 --- a/linden/indra/llmath/m4math.h +++ b/linden/indra/llmath/m4math.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/raytrace.cpp b/linden/indra/llmath/raytrace.cpp index 0116502..a5eb0d2 100644 --- a/linden/indra/llmath/raytrace.cpp +++ b/linden/indra/llmath/raytrace.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/raytrace.h b/linden/indra/llmath/raytrace.h index 757181f..b433e17 100644 --- a/linden/indra/llmath/raytrace.h +++ b/linden/indra/llmath/raytrace.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v2math.cpp b/linden/indra/llmath/v2math.cpp index ee60143..555e1f9 100644 --- a/linden/indra/llmath/v2math.cpp +++ b/linden/indra/llmath/v2math.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v2math.h b/linden/indra/llmath/v2math.h index 6016c04..9fef885 100644 --- a/linden/indra/llmath/v2math.h +++ b/linden/indra/llmath/v2math.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -115,8 +116,8 @@ class LLVector2 F32 angle_between(const LLVector2 &a, const LLVector2 &b); // Returns angle (radians) between a and b BOOL are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel F32 dist_vec(const LLVector2 &a, const LLVector2 &b); // Returns distance between a and b -F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b);// Returns distance sqaured between a and b -F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b);// Returns distance sqaured between a and b ignoring Z component +F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b +F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b);// Returns distance squared between a and b ignoring Z component LLVector2 lerp(const LLVector2 &a, const LLVector2 &b, F32 u); // Returns a vector that is a linear interpolation between a and b // Constructors diff --git a/linden/indra/llmath/v3color.cpp b/linden/indra/llmath/v3color.cpp index b55b883..fa7b61c 100644 --- a/linden/indra/llmath/v3color.cpp +++ b/linden/indra/llmath/v3color.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v3color.h b/linden/indra/llmath/v3color.h index d530187..179687a 100644 --- a/linden/indra/llmath/v3color.h +++ b/linden/indra/llmath/v3color.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -56,7 +57,7 @@ public: LLColor3(); // Initializes LLColor3 to (0, 0, 0) LLColor3(F32 r, F32 g, F32 b); // Initializes LLColor3 to (r, g, b) LLColor3(const F32 *vec); // Initializes LLColor3 to (vec[0]. vec[1], vec[2]) - LLColor3(char *color_string); // html format color ie "#FFDDEE" + LLColor3(const char *color_string); // html format color ie "#FFDDEE" explicit LLColor3(const LLColor4& color4); // "explicit" to avoid automatic conversion explicit LLColor3(const LLVector4& vector4); // "explicit" to avoid automatic conversion LLColor3(const LLSD& sd); @@ -160,7 +161,7 @@ void LLColor3::clamp() // Non-member functions F32 distVec(const LLColor3 &a, const LLColor3 &b); // Returns distance between a and b -F32 distVec_squared(const LLColor3 &a, const LLColor3 &b);// Returns distance sqaured between a and b +F32 distVec_squared(const LLColor3 &a, const LLColor3 &b);// Returns distance squared between a and b inline LLColor3::LLColor3(void) { @@ -188,7 +189,7 @@ inline LLColor3::LLColor3(const F32 *vec) # pragma warning( disable : 4996 ) // strncpy teh sux0r #endif -inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF +inline LLColor3::LLColor3(const char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF { if (strlen(color_string) < 6) /* Flawfinder: ignore */ { @@ -198,7 +199,7 @@ inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGB return; } - static char tempstr[7]; /* Flawfinder: ignore */ + char tempstr[7]; strncpy(tempstr,color_string,6); /* Flawfinder: ignore */ tempstr[6] = '\0'; mV[VZ] = (F32)strtol(&tempstr[4],NULL,16)/255.f; diff --git a/linden/indra/llmath/v3dmath.cpp b/linden/indra/llmath/v3dmath.cpp index bd42830..2bcbf63 100644 --- a/linden/indra/llmath/v3dmath.cpp +++ b/linden/indra/llmath/v3dmath.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v3dmath.h b/linden/indra/llmath/v3dmath.h index 078fde8..a99bf5b 100644 --- a/linden/indra/llmath/v3dmath.h +++ b/linden/indra/llmath/v3dmath.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v3math.cpp b/linden/indra/llmath/v3math.cpp index b97b410..d403179 100644 --- a/linden/indra/llmath/v3math.cpp +++ b/linden/indra/llmath/v3math.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -133,6 +134,7 @@ BOOL LLVector3::clampLength( F32 length_limit ) mV[0] *= length_limit; mV[1] *= length_limit; mV[2] *= length_limit; + changed = TRUE; } } diff --git a/linden/indra/llmath/v3math.h b/linden/indra/llmath/v3math.h index 4935443..7f96800 100644 --- a/linden/indra/llmath/v3math.h +++ b/linden/indra/llmath/v3math.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -160,8 +161,8 @@ typedef LLVector3 LLSimLocalVec; F32 angle_between(const LLVector3 &a, const LLVector3 &b); // Returns angle (radians) between a and b BOOL are_parallel(const LLVector3 &a, const LLVector3 &b, F32 epsilon=F_APPROXIMATELY_ZERO); // Returns TRUE if a and b are very close to parallel F32 dist_vec(const LLVector3 &a, const LLVector3 &b); // Returns distance between a and b -F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b);// Returns distance sqaured between a and b -F32 dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b);// Returns distance sqaured between a and b ignoring Z component +F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b +F32 dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b ignoring Z component LLVector3 projected_vec(const LLVector3 &a, const LLVector3 &b); // Returns vector a projected on vector b LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u); // Returns a vector that is a linear interpolation between a and b diff --git a/linden/indra/llmath/v4color.cpp b/linden/indra/llmath/v4color.cpp index 32cfd5e..0cbfce0 100644 --- a/linden/indra/llmath/v4color.cpp +++ b/linden/indra/llmath/v4color.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v4color.h b/linden/indra/llmath/v4color.h index 57055c5..785b47d 100644 --- a/linden/indra/llmath/v4color.h +++ b/linden/indra/llmath/v4color.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v4coloru.cpp b/linden/indra/llmath/v4coloru.cpp index b127a53..061b497 100644 --- a/linden/indra/llmath/v4coloru.cpp +++ b/linden/indra/llmath/v4coloru.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v4coloru.h b/linden/indra/llmath/v4coloru.h index f3f1c57..082d0ef 100644 --- a/linden/indra/llmath/v4coloru.h +++ b/linden/indra/llmath/v4coloru.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v4math.cpp b/linden/indra/llmath/v4math.cpp index a183c78..b938480 100644 --- a/linden/indra/llmath/v4math.cpp +++ b/linden/indra/llmath/v4math.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/v4math.h b/linden/indra/llmath/v4math.h index 6234b17..4c82e6b 100644 --- a/linden/indra/llmath/v4math.h +++ b/linden/indra/llmath/v4math.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/xform.cpp b/linden/indra/llmath/xform.cpp index 9917880..ce6f756 100644 --- a/linden/indra/llmath/xform.cpp +++ b/linden/indra/llmath/xform.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llmath/xform.h b/linden/indra/llmath/xform.h index 6f880cb..d3be28f 100644 --- a/linden/indra/llmath/xform.h +++ b/linden/indra/llmath/xform.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, -- cgit v1.1