Up the maximum field of view to 320, from 175, on request from Tazy Scientist

Better for reallllly wide screens and multiscreen setups, apparently.

Also, let's merge with v-r while we're at it, since llcamera.h requires a large-ish recompile
Nothing functional though.
And some license updates to some identical files in llmath.
This commit is contained in:
Inusaito Sayori
2014-06-11 03:24:46 -04:00
parent 908fc939b1
commit 8766335708
24 changed files with 428 additions and 451 deletions

View File

@@ -2,31 +2,25 @@
* @file camera.h * @file camera.h
* @brief Legacy wrapper header. * @brief Legacy wrapper header.
* *
* $LicenseInfo:firstyear=2000&license=viewergpl$ * $LicenseInfo:firstyear=2000&license=viewerlgpl$
*
* Copyright (c) 2000-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -2,31 +2,25 @@
* @file coordframe.h * @file coordframe.h
* @brief Legacy wrapper header. * @brief Legacy wrapper header.
* *
* $LicenseInfo:firstyear=2000&license=viewergpl$ * $LicenseInfo:firstyear=2000&license=viewerlgpl$
*
* Copyright (c) 2000-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -2,36 +2,28 @@
* @file llbbox.cpp * @file llbbox.cpp
* @brief General purpose bounding box class (Not axis aligned) * @brief General purpose bounding box class (Not axis aligned)
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlife.com/developers/opensource/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlife.com/developers/opensource/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*
*/ */
#include "linden_common.h" #include "linden_common.h"
// self include // self include

View File

@@ -2,36 +2,28 @@
* @file llbbox.h * @file llbbox.h
* @brief General purpose bounding box class * @brief General purpose bounding box class
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlife.com/developers/opensource/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlife.com/developers/opensource/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*
*/ */
#ifndef LL_BBOX_H #ifndef LL_BBOX_H
#define LL_BBOX_H #define LL_BBOX_H

View File

@@ -2,31 +2,25 @@
* @file llbboxlocal.cpp * @file llbboxlocal.cpp
* @brief General purpose bounding box class (Not axis aligned). * @brief General purpose bounding box class (Not axis aligned).
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -2,31 +2,25 @@
* @file llbboxlocal.h * @file llbboxlocal.h
* @brief General purpose bounding box class. * @brief General purpose bounding box class.
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -2,31 +2,25 @@
* @file llcamera.cpp * @file llcamera.cpp
* @brief Implementation of the LLCamera class. * @brief Implementation of the LLCamera class.
* *
* $LicenseInfo:firstyear=2000&license=viewergpl$ * $LicenseInfo:firstyear=2000&license=viewerlgpl$
*
* Copyright (c) 2000-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -189,8 +183,30 @@ static const LLVector4a sFrustumScaler[] =
LLVector4a( 1, 1, 1) // 8 entries LLVector4a( 1, 1, 1) // 8 entries
}; };
S32 LLCamera::AABBInFrustum(const LLVector4a &center, const LLVector4a& radius) bool LLCamera::isChanged()
{ {
bool changed = false;
for (U32 i = 0; i < mPlaneCount; i++)
{
U8 mask = mPlaneMask[i];
if (mask != 0xff && !changed)
{
changed = !mAgentPlanes[i].equal(mLastAgentPlanes[i]);
}
mLastAgentPlanes[i].set(mAgentPlanes[i]);
}
return changed;
}
S32 LLCamera::AABBInFrustum(const LLVector4a &center, const LLVector4a& radius, const LLPlane* planes)
{
if(!planes)
{
//use agent space
planes = mAgentPlanes;
}
U8 mask = 0; U8 mask = 0;
bool result = false; bool result = false;
LLVector4a rscale, maxp, minp; LLVector4a rscale, maxp, minp;
@@ -201,7 +217,7 @@ S32 LLCamera::AABBInFrustum(const LLVector4a &center, const LLVector4a& radius)
mask = mPlaneMask[i]; mask = mPlaneMask[i];
if (mask < PLANE_MASK_NUM) if (mask < PLANE_MASK_NUM)
{ {
const LLPlane& p(mAgentPlanes[i]); const LLPlane& p(planes[i]);
p.getAt<3>(d); p.getAt<3>(d);
rscale.setMul(radius, sFrustumScaler[mask]); rscale.setMul(radius, sFrustumScaler[mask]);
minp.setSub(center, rscale); minp.setSub(center, rscale);
@@ -222,9 +238,21 @@ S32 LLCamera::AABBInFrustum(const LLVector4a &center, const LLVector4a& radius)
return result?1:2; return result?1:2;
} }
//exactly same as the function AABBInFrustum(...)
S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius) //except uses mRegionPlanes instead of mAgentPlanes.
S32 LLCamera::AABBInRegionFrustum(const LLVector4a& center, const LLVector4a& radius)
{ {
return AABBInFrustum(center, radius, mRegionPlanes);
}
S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes)
{
if(!planes)
{
//use agent space
planes = mAgentPlanes;
}
U8 mask = 0; U8 mask = 0;
bool result = false; bool result = false;
LLVector4a rscale, maxp, minp; LLVector4a rscale, maxp, minp;
@@ -235,7 +263,7 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a&
mask = mPlaneMask[i]; mask = mPlaneMask[i];
if ((i != 5) && (mask < PLANE_MASK_NUM)) if ((i != 5) && (mask < PLANE_MASK_NUM))
{ {
const LLPlane& p(mAgentPlanes[i]); const LLPlane& p(planes[i]);
p.getAt<3>(d); p.getAt<3>(d);
rscale.setMul(radius, sFrustumScaler[mask]); rscale.setMul(radius, sFrustumScaler[mask]);
minp.setSub(center, rscale); minp.setSub(center, rscale);
@@ -256,6 +284,13 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a&
return result?1:2; return result?1:2;
} }
//exactly same as the function AABBInFrustumNoFarClip(...)
//except uses mRegionPlanes instead of mAgentPlanes.
S32 LLCamera::AABBInRegionFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius)
{
return AABBInFrustumNoFarClip(center, radius, mRegionPlanes);
}
int LLCamera::sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius) int LLCamera::sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius)
{ {
LLVector3 dist = sphere_center-mFrustCenter; LLVector3 dist = sphere_center-mFrustCenter;
@@ -592,6 +627,47 @@ void LLCamera::calcAgentFrustumPlanes(LLVector3* frust)
} }
} }
//calculate regional planes from mAgentPlanes.
//vector "shift" is the vector of the region origin in the agent space.
void LLCamera::calcRegionFrustumPlanes(const LLVector3& shift, F32 far_clip_distance)
{
F32 far_w;
{
LLVector3 p = getOrigin();
LLVector3 n(mAgentPlanes[5][0], mAgentPlanes[5][1], mAgentPlanes[5][2]);
F32 dd = n * p;
if(dd + mAgentPlanes[5][3] < 0) //signed distance
{
far_w = -far_clip_distance - dd;
}
else
{
far_w = far_clip_distance - dd;
}
far_w += n * shift;
}
F32 d;
LLVector3 n;
for(S32 i = 0 ; i < 7; i++)
{
if (mPlaneMask[i] != 0xff)
{
n.setVec(mAgentPlanes[i][0], mAgentPlanes[i][1], mAgentPlanes[i][2]);
if(i != 5)
{
d = mAgentPlanes[i][3] + n * shift;
}
else
{
d = far_w;
}
mRegionPlanes[i].setVec(n, d);
}
}
}
void LLCamera::calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom) void LLCamera::calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom)
{ {
LLVector3 a, b, c; LLVector3 a, b, c;

View File

@@ -2,31 +2,25 @@
* @file llcamera.h * @file llcamera.h
* @brief Header file for the LLCamera class. * @brief Header file for the LLCamera class.
* *
* $LicenseInfo:firstyear=2000&license=viewergpl$ * $LicenseInfo:firstyear=2000&license=viewerlgpl$
*
* Copyright (c) 2000-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -55,7 +49,7 @@ 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. // 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 MIN_FIELD_OF_VIEW = 5.0f * DEG_TO_RAD;
static const F32 MAX_FIELD_OF_VIEW = 175.f * DEG_TO_RAD; static const F32 MAX_FIELD_OF_VIEW = 320.f * DEG_TO_RAD;
// An LLCamera is an LLCoorFrame with a view frustum. // An LLCamera is an LLCoorFrame with a view frustum.
// This means that it has several methods for moving it around // This means that it has several methods for moving it around
@@ -128,6 +122,8 @@ public:
private: private:
LL_ALIGN_16(LLPlane mAgentPlanes[AGENT_PLANE_USER_CLIP_NUM]); //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP LL_ALIGN_16(LLPlane mAgentPlanes[AGENT_PLANE_USER_CLIP_NUM]); //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP
LL_ALIGN_16(LLPlane mRegionPlanes[AGENT_PLANE_USER_CLIP_NUM]); //frustum planes in a local region space, derived from mAgentPlanes
LL_ALIGN_16(LLPlane mLastAgentPlanes[AGENT_PLANE_USER_CLIP_NUM]);
U8 mPlaneMask[PLANE_MASK_NUM]; // 8 for alignment U8 mPlaneMask[PLANE_MASK_NUM]; // 8 for alignment
F32 mView; // angle between top and bottom frustum planes in radians. F32 mView; // angle between top and bottom frustum planes in radians.
@@ -156,6 +152,7 @@ public:
LLCamera(F32 vertical_fov_rads, 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(); virtual ~LLCamera();
bool isChanged(); //check if mAgentPlanes changed since last frame.
void setUserClipPlane(const LLPlane& plane); void setUserClipPlane(const LLPlane& plane);
void disableUserClipPlane(); void disableUserClipPlane();
@@ -197,6 +194,7 @@ public:
// Return number of bytes copied. // Return number of bytes copied.
size_t readFrustumFromBuffer(const char *buffer); size_t readFrustumFromBuffer(const char *buffer);
void calcAgentFrustumPlanes(LLVector3* frust); void calcAgentFrustumPlanes(LLVector3* frust);
void calcRegionFrustumPlanes(const LLVector3& shift, F32 far_clip_distance); //calculate regional planes from mAgentPlanes.
void ignoreAgentFrustumPlane(S32 idx); void ignoreAgentFrustumPlane(S32 idx);
// Returns 1 if partly in, 2 if fully in. // Returns 1 if partly in, 2 if fully in.
@@ -205,8 +203,10 @@ public:
S32 sphereInFrustum(const LLVector3 &center, const F32 radius) const; S32 sphereInFrustum(const LLVector3 &center, const F32 radius) const;
S32 pointInFrustum(const LLVector3 &point) const { return sphereInFrustum(point, 0.0f); } S32 pointInFrustum(const LLVector3 &point) const { return sphereInFrustum(point, 0.0f); }
S32 sphereInFrustumFull(const LLVector3 &center, const F32 radius) const { return sphereInFrustum(center, radius); } S32 sphereInFrustumFull(const LLVector3 &center, const F32 radius) const { return sphereInFrustum(center, radius); }
S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius); S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL);
S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius); S32 AABBInRegionFrustum(const LLVector4a& center, const LLVector4a& radius);
S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL);
S32 AABBInRegionFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius);
//does a quick 'n dirty sphere-sphere check //does a quick 'n dirty sphere-sphere check
S32 sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius); S32 sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius);

View File

@@ -1,31 +1,25 @@
/** /**
* @file llplane.h * @file llplane.h
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -100,6 +94,12 @@ public:
return mV.greaterEqual(LLVector4a::getZero()).getGatheredBits() & LLVector4Logical::MASK_XYZ; return mV.greaterEqual(LLVector4a::getZero()).getGatheredBits() & LLVector4Logical::MASK_XYZ;
} }
//check if two planes are nearly same
bool equal(const LLPlane& p) const
{
return mV.equals4(p.mV);
}
private: private:
LLVector4a mV; LLVector4a mV;
} LL_ALIGN_POSTFIX(16); } LL_ALIGN_POSTFIX(16);

View File

@@ -3,31 +3,25 @@
* @brief useful routines for quantizing floats to various length ints * @brief useful routines for quantizing floats to various length ints
* and back out again * and back out again
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -2,31 +2,25 @@
* @file llquaternion.cpp * @file llquaternion.cpp
* @brief LLQuaternion class implementation. * @brief LLQuaternion class implementation.
* *
* $LicenseInfo:firstyear=2000&license=viewergpl$ * $LicenseInfo:firstyear=2000&license=viewerlgpl$
*
* Copyright (c) 2000-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -2,31 +2,25 @@
* @file llquaternion.h * @file llquaternion.h
* @brief LLQuaternion class header file. * @brief LLQuaternion class header file.
* *
* $LicenseInfo:firstyear=2000&license=viewergpl$ * $LicenseInfo:firstyear=2000&license=viewerlgpl$
*
* Copyright (c) 2000-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -1,31 +1,26 @@
/** /**
* @file llrect.cpp * @file llrect.cpp
* @brief LLRect class implementation
* *
* $LicenseInfo:firstyear=2001&license=viewergpl$ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -4,31 +4,25 @@
* @date 2006-05-24 * @date 2006-05-24
* @brief Implementation of classes, functions, etc, for using structured data. * @brief Implementation of classes, functions, etc, for using structured data.
* *
* $LicenseInfo:firstyear=2006&license=viewergpl$ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
*
* Copyright (c) 2006-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -4,36 +4,28 @@
* @date 2009-05-19 * @date 2009-05-19
* @brief Utility classes, functions, etc, for using structured data with math classes. * @brief Utility classes, functions, etc, for using structured data with math classes.
* *
* $LicenseInfo:firstyear=2009&license=viewergpl$ * $LicenseInfo:firstyear=2009&license=viewerlgpl$
*
* Copyright (c) 2009-2010, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlife.com/developers/opensource/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlife.com/developers/opensource/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*
*/ */
#ifndef LL_LLSDUTIL_MATH_H #ifndef LL_LLSDUTIL_MATH_H
#define LL_LLSDUTIL_MATH_H #define LL_LLSDUTIL_MATH_H

View File

@@ -3,31 +3,25 @@
* @author Andrew Meadows * @author Andrew Meadows
* @brief Simple line class that can compute nearest approach between two lines * @brief Simple line class that can compute nearest approach between two lines
* *
* $LicenseInfo:firstyear=2007&license=viewergpl$ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
*
* Copyright (c) 2007-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -4,31 +4,25 @@
* @author Andrew Meadows * @author Andrew Meadows
* @brief Simple sphere implementation for basic geometric operations * @brief Simple sphere implementation for basic geometric operations
* *
* $LicenseInfo:firstyear=2007&license=viewergpl$ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
*
* Copyright (c) 2007-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */

View File

@@ -1,31 +1,25 @@
/** /**
* @file lltreenode.h * @file lltreenode.h
* *
* $LicenseInfo:firstyear=2005&license=viewergpl$ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
*
* Copyright (c) 2005-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0 *
* ("GPL"), unless you have obtained a separate licensing agreement * This library is free software; you can redistribute it and/or
* ("Other License"), formally executed by you and Linden Lab. Terms of * modify it under the terms of the GNU Lesser General Public
* the GPL can be found in doc/GPL-license.txt in this distribution, or * License as published by the Free Software Foundation;
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * version 2.1 of the License only.
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is distributed in the hope that it will be useful,
* it is applied to this Source Code. View the full text of the exception * but WITHOUT ANY WARRANTY; without even the implied warranty of
* in the file doc/FLOSS-exception.txt in this software distribution, or * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* online at * Lesser General Public License for more details.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * You should have received a copy of the GNU Lesser General Public
* that you have read and understood your obligations described above, * License along with this library; if not, write to the Free Software
* and agree to abide by those obligations. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -36,6 +30,7 @@
#include "xform.h" #include "xform.h"
#include "llpointer.h" #include "llpointer.h"
#include "llrefcount.h" #include "llrefcount.h"
#include <vector> #include <vector>
template <class T> class LLTreeNode; template <class T> class LLTreeNode;
@@ -62,7 +57,14 @@ public:
virtual bool remove(T* data); virtual bool remove(T* data);
virtual void notifyRemoval(T* data); virtual void notifyRemoval(T* data);
virtual U32 getListenerCount() { return mListeners.size(); } virtual U32 getListenerCount() { return mListeners.size(); }
virtual LLTreeListener<T>* getListener(U32 index) const { return mListeners[index]; } virtual LLTreeListener<T>* getListener(U32 index) const
{
if(index < mListeners.size())
{
return mListeners[index];
}
return NULL;
}
virtual void addListener(LLTreeListener<T>* listener) { mListeners.push_back(listener); } virtual void addListener(LLTreeListener<T>* listener) { mListeners.push_back(listener); }
protected: protected:

View File

@@ -85,6 +85,7 @@ public:
} }
// Copy words 16-byte blocks from src to dst. Source and destination must not overlap. // Copy words 16-byte blocks from src to dst. Source and destination must not overlap.
// Source and dest must be 16-byte aligned and size must be multiple of 16.
static void memcpyNonAliased16(F32* __restrict dst, const F32* __restrict src, size_t bytes); static void memcpyNonAliased16(F32* __restrict dst, const F32* __restrict src, size_t bytes);
//////////////////////////////////// ////////////////////////////////////

View File

@@ -1094,8 +1094,6 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai
} }
} }
//genNormals(params);
return TRUE; return TRUE;
} }
@@ -2374,7 +2372,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
LLSD mdl; LLSD mdl;
if (!unzip_llsd(mdl, is, size)) if (!unzip_llsd(mdl, is, size))
{ {
LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD, will probably fetch from sim again." << llendl; LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD, will probably fetch from sim again." << LL_ENDL;
return false; return false;
} }
@@ -5617,7 +5615,6 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
else else
{ {
resizeVertices(num_vertices); resizeVertices(num_vertices);
if (!partial_build) if (!partial_build)
{ {
resizeIndices(num_indices); resizeIndices(num_indices);
@@ -5722,6 +5719,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
cuv = (min_uv + max_uv)*0.5f; cuv = (min_uv + max_uv)*0.5f;
VertexData vd; VertexData vd;
vd.setPosition(*mCenter); vd.setPosition(*mCenter);
vd.mTexCoord = cuv; vd.mTexCoord = cuv;
@@ -6770,7 +6768,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
return TRUE; return TRUE;
} }
//adapted from Lengyel, Eric. <EFBFBD>Computing Tangent Space Basis Vectors for an Arbitrary Mesh<EFBFBD>. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html //adapted from Lengyel, Eric. "Computing Tangent Space Basis Vectors for an Arbitrary Mesh". Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html
void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVector4a *normal, void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVector4a *normal,
const LLVector2 *texcoord, U32 triangleCount, const U16* index_array, LLVector4a *tangent) const LLVector2 *texcoord, U32 triangleCount, const U16* index_array, LLVector4a *tangent)
{ {

View File

@@ -565,6 +565,7 @@ F32 LLDrawable::updateXform(BOOL undamped)
dist_squared = dist_vec_squared(new_pos, target_pos); dist_squared = dist_vec_squared(new_pos, target_pos);
LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot); LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot);
// FIXME: This can be negative! It is be possible for some rots to 'cancel out' pos or size changes.
dist_squared += (1.f - dot(new_rot, target_rot)) * 10.f; dist_squared += (1.f - dot(new_rot, target_rot)) * 10.f;
LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt); LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt);
@@ -588,6 +589,15 @@ F32 LLDrawable::updateXform(BOOL undamped)
} }
} }
} }
else
{
// The following fixes MAINT-1742 but breaks vehicles similar to MAINT-2275
// dist_squared = dist_vec_squared(old_pos, target_pos);
// The following fixes MAINT-2247 but causes MAINT-2275
//dist_squared += (1.f - dot(old_rot, target_rot)) * 10.f;
//dist_squared += dist_vec_squared(old_scale, target_scale);
}
LLVector3 vec = mCurrentScale-target_scale; LLVector3 vec = mCurrentScale-target_scale;
@@ -682,17 +692,7 @@ BOOL LLDrawable::updateMove()
makeActive(); makeActive();
BOOL done; return isState(MOVE_UNDAMPED) ? updateMoveUndamped() : updateMoveDamped();
if (isState(MOVE_UNDAMPED))
{
done = updateMoveUndamped();
}
else
{
done = updateMoveDamped();
}
return done;
} }
BOOL LLDrawable::updateMoveUndamped() BOOL LLDrawable::updateMoveUndamped()
@@ -709,7 +709,6 @@ BOOL LLDrawable::updateMoveUndamped()
} }
mVObjp->clearChanged(LLXform::MOVED); mVObjp->clearChanged(LLXform::MOVED);
return TRUE; return TRUE;
} }
@@ -833,7 +832,6 @@ void LLDrawable::updateTexture()
if (getVOVolume()) if (getVOVolume())
{ {
//getVOVolume()->mFaceMappingChanged = TRUE;
gPipeline.markRebuild(this, LLDrawable::REBUILD_MATERIAL, TRUE); gPipeline.markRebuild(this, LLDrawable::REBUILD_MATERIAL, TRUE);
} }
} }
@@ -1153,8 +1151,8 @@ BOOL LLDrawable::isVisible() const
// Spatial Partition Bridging Drawable // Spatial Partition Bridging Drawable
//======================================= //=======================================
LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) :
: LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB) LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB)
{ {
mBridge = this; mBridge = this;
mDrawable = root; mDrawable = root;
@@ -1242,12 +1240,9 @@ void LLSpatialBridge::updateSpatialExtents()
scale.mul(size); scale.mul(size);
mat.rotate(scale, v[3]); mat.rotate(scale, v[3]);
LLVector4a& newMin = mExtents[0]; LLVector4a& newMin = mExtents[0];
LLVector4a& newMax = mExtents[1]; LLVector4a& newMax = mExtents[1];
newMin = newMax = center; newMin = newMax = center;
for (U32 i = 0; i < 4; i++) for (U32 i = 0; i < 4; i++)
{ {
LLVector4a delta; LLVector4a delta;
@@ -1419,16 +1414,17 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>*
group->rebound(); group->rebound();
LLVector4a center; LLVector4a center;
center.setAdd(mExtents[0], mExtents[1]); const LLVector4a* exts = getSpatialExtents();
center.setAdd(exts[0], exts[1]);
center.mul(0.5f); center.mul(0.5f);
LLVector4a size; LLVector4a size;
size.setSub(mExtents[1], mExtents[0]); size.setSub(exts[1], exts[0]);
size.mul(0.5f); size.mul(0.5f);
if ((LLPipeline::sShadowRender && camera_in.AABBInFrustum(center, size)) || if ((LLPipeline::sShadowRender && camera_in.AABBInFrustum(center, size)) ||
LLPipeline::sImpostorRender || LLPipeline::sImpostorRender ||
(camera_in.AABBInFrustumNoFarClip(center, size) && (camera_in.AABBInFrustumNoFarClip(center, size) &&
AABBSphereIntersect(mExtents[0], mExtents[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist))) AABBSphereIntersect(exts[0], exts[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist)))
{ {
if (!LLPipeline::sImpostorRender && if (!LLPipeline::sImpostorRender &&
!LLPipeline::sShadowRender && !LLPipeline::sShadowRender &&

View File

@@ -69,7 +69,6 @@ BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE
#define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2]) #define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2])
/* /*
For each vertex, given: For each vertex, given:
B - binormal B - binormal
@@ -398,6 +397,7 @@ void LLFace::setSize(S32 num_vertices, const S32 num_indices, bool align)
//allocate vertices in blocks of 4 for alignment //allocate vertices in blocks of 4 for alignment
num_vertices = (num_vertices + 0x3) & ~0x3; num_vertices = (num_vertices + 0x3) & ~0x3;
} }
if (mGeomCount != num_vertices || if (mGeomCount != num_vertices ||
mIndicesCount != num_indices) mIndicesCount != num_indices)
{ {
@@ -1311,7 +1311,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
}; };
llassert(tep->getShiny() <= 3); llassert(tep->getShiny() <= 3);
color.mV[3] = U8 (alpha[tep->getShiny()] * 255); color.mV[3] = U8 (alpha[tep->getShiny()] * 255);
} }
} }
@@ -1525,7 +1524,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
} }
glBindBufferARB(GL_TRANSFORM_FEEDBACK_BUFFER, 0); glBindBufferARB(GL_TRANSFORM_FEEDBACK_BUFFER, 0);
gGL.popMatrix(); gGL.popMatrix();
if (cur_shader) if (cur_shader)
@@ -2385,8 +2383,6 @@ F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist)
return 0.f ; return 0.f ;
} }
//F32 camera_relative_speed = camera_moving_speed * (lookAt * LLViewerCamera::getInstance()->getVelocityDir()) ;
S32 i = 0 ; S32 i = 0 ;
for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0]; ++i); for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0]; ++i);
i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ; i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ;
@@ -2427,16 +2423,7 @@ BOOL LLFace::verify(const U32* indices_array) const
BOOL ok = TRUE; BOOL ok = TRUE;
if( mVertexBuffer.isNull() ) if( mVertexBuffer.isNull() )
{ { //no vertex buffer, face is implicitly valid
if( mGeomCount )
{
// This happens before teleports as faces are torn down.
// Stop the crash in DEV-31893 with a null pointer check,
// but present this info.
// To clean up the log, the geometry could be cleared, or the
// face could otherwise be marked for no ::verify.
//AIFIXME: llinfos << "Face with no vertex buffer and " << mGeomCount << " mGeomCount" << llendl;
}
return TRUE; return TRUE;
} }

View File

@@ -47,8 +47,8 @@ extern bool gShiftFrame;
extern U64 gFrameTime; extern U64 gFrameTime;
extern LLPipeline gPipeline; extern LLPipeline gPipeline;
LLSurfacePatch::LLSurfacePatch() : LLSurfacePatch::LLSurfacePatch()
mHasReceivedData(FALSE), : mHasReceivedData(FALSE),
mSTexUpdate(FALSE), mSTexUpdate(FALSE),
mDirty(FALSE), mDirty(FALSE),
mDirtyZStats(TRUE), mDirtyZStats(TRUE),

View File

@@ -68,6 +68,7 @@
#include <map> #include <map>
#include <cstring> #include <cstring>
// //
// Globals // Globals
// //
@@ -160,18 +161,19 @@ void LLWorld::setRegionSize(const U32& width, const U32& length)
mWidthInMeters = mWidth * mScale; mWidthInMeters = mWidth * mScale;
} }
LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host) LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
{ {
llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl;
LLViewerRegion *regionp = getRegionFromHandle(region_handle); LLViewerRegion *regionp = getRegionFromHandle(region_handle);
if (regionp) if (regionp)
{ {
llinfos << "Region exists, removing it " << llendl;
LLHost old_host = regionp->getHost(); LLHost old_host = regionp->getHost();
// region already exists! // region already exists!
if (host == old_host && regionp->isAlive()) if (host == old_host && regionp->isAlive())
{ {
// This is a duplicate for the same host and it's alive, don't bother. // This is a duplicate for the same host and it's alive, don't bother.
llinfos << "Region already exists and is alive, using existing region" << llendl;
return regionp; return regionp;
} }
@@ -189,6 +191,10 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
// matches, because all the agent state for the new camera is completely different. // matches, because all the agent state for the new camera is completely different.
removeRegion(old_host); removeRegion(old_host);
} }
else
{
llinfos << "Region does not exist, creating new one" << llendl;
}
U32 iindex = 0; U32 iindex = 0;
U32 jindex = 0; U32 jindex = 0;
@@ -199,8 +205,8 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
S32 x = (S32)(iindex/256); //MegaRegion S32 x = (S32)(iindex/256); //MegaRegion
S32 y = (S32)(jindex/256); //MegaRegion S32 y = (S32)(jindex/256); //MegaRegion
// </FS:CR> Aurora Sim // </FS:CR> Aurora Sim
llinfos << "Adding new region (" << x << ":" << y << ")" << llendl; llinfos << "Adding new region (" << x << ":" << y << ")"
llinfos << "Host: " << host << llendl; << " on host: " << host << llendl;
LLVector3d origin_global; LLVector3d origin_global;
@@ -272,7 +278,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
if (neighborp && last_neighborp != neighborp) if (neighborp && last_neighborp != neighborp)
{ {
//llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl; //LL_INFOS() << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << LL_ENDL;
regionp->connectNeighbor(neighborp, dir); regionp->connectNeighbor(neighborp, dir);
last_neighborp = neighborp; last_neighborp = neighborp;
} }
@@ -341,6 +347,7 @@ void LLWorld::removeRegion(const LLHost &host)
mVisibleRegionList.remove(regionp); mVisibleRegionList.remove(regionp);
mRegionRemovedSignal(regionp); mRegionRemovedSignal(regionp);
//double check all objects of this region are removed. //double check all objects of this region are removed.
gObjectList.clearAllMapObjectsInRegion(regionp) ; gObjectList.clearAllMapObjectsInRegion(regionp) ;
//llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ; //llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ;
@@ -1540,20 +1547,19 @@ void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d
if (!pVOAvatar->isDead() && !pVOAvatar->isSelf() && !pVOAvatar->mIsDummy) if (!pVOAvatar->isDead() && !pVOAvatar->isSelf() && !pVOAvatar->mIsDummy)
{ {
LLVector3d pos_global = pVOAvatar->getPositionGlobal();
LLUUID uuid = pVOAvatar->getID(); LLUUID uuid = pVOAvatar->getID();
if(!uuid.isNull())
if (!uuid.isNull()
&& dist_vec_squared(pos_global, relative_to) <= radius_squared)
{ {
LLVector3d pos_global = pVOAvatar->getPositionGlobal(); if(positions != NULL)
if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
{ {
if(positions != NULL) positions->push_back(pos_global);
{ }
positions->push_back(pos_global); if(avatar_ids !=NULL)
} {
if(avatar_ids !=NULL) avatar_ids->push_back(uuid);
{
avatar_ids->push_back(uuid);
}
} }
} }
} }