aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmath
diff options
context:
space:
mode:
authorRobin Cornelius2010-10-10 22:10:33 +0100
committerRobin Cornelius2010-10-10 22:10:33 +0100
commitb3b30285126289f54b57bd42569bb0721e40e088 (patch)
treef4aaccb98d1a835c4ea376ec2803fc410a704052 /linden/indra/llmath
parentMerge branch 'mccabe-plugins' into plugins_merge (diff)
downloadmeta-impy-b3b30285126289f54b57bd42569bb0721e40e088.zip
meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.gz
meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.bz2
meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.xz
Revert "port of LL renderpipeline/Kirstens S19 pipeline for bridging to Viewer 2 texture system"
This reverts commit 087e15e89930d51c3964329befb273ae3b2d330d. Conflicts: linden/indra/newview/llsurface.cpp linden/indra/newview/llviewerwindow.cpp linden/indra/newview/llvoavatar.cpp linden/indra/newview/pipeline.cpp linden/indra/newview/pipeline.h
Diffstat (limited to 'linden/indra/llmath')
-rw-r--r--linden/indra/llmath/llbbox.cpp162
-rw-r--r--linden/indra/llmath/llbbox.h103
-rw-r--r--linden/indra/llmath/llcamera.cpp24
-rw-r--r--linden/indra/llmath/llcamera.h16
-rw-r--r--linden/indra/llmath/llmath.h2
-rw-r--r--linden/indra/llmath/llmodularmath.cpp36
-rw-r--r--linden/indra/llmath/llvolume.cpp14
7 files changed, 12 insertions, 345 deletions
diff --git a/linden/indra/llmath/llbbox.cpp b/linden/indra/llmath/llbbox.cpp
deleted file mode 100644
index f0ec010..0000000
--- a/linden/indra/llmath/llbbox.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
1/**
2 * @file llbbox.cpp
3 * @brief General purpose bounding box class (Not axis aligned)
4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
7 * Copyright (c) 2001-2010, /linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by /linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and /linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL /linden LAB SOURCE CODE IS PROVIDED "AS IS." /linden LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "linden_common.h"
34
35// self include
36#include "llbbox.h"
37
38// library includes
39#include "m4math.h"
40
41void LLBBox::addPointLocal(const LLVector3& p)
42{
43 if (mEmpty)
44 {
45 mMinLocal = p;
46 mMaxLocal = p;
47 mEmpty = FALSE;
48 }
49 else
50 {
51 mMinLocal.mV[VX] = llmin( p.mV[VX], mMinLocal.mV[VX] );
52 mMinLocal.mV[VY] = llmin( p.mV[VY], mMinLocal.mV[VY] );
53 mMinLocal.mV[VZ] = llmin( p.mV[VZ], mMinLocal.mV[VZ] );
54 mMaxLocal.mV[VX] = llmax( p.mV[VX], mMaxLocal.mV[VX] );
55 mMaxLocal.mV[VY] = llmax( p.mV[VY], mMaxLocal.mV[VY] );
56 mMaxLocal.mV[VZ] = llmax( p.mV[VZ], mMaxLocal.mV[VZ] );
57 }
58}
59
60void LLBBox::addPointAgent( LLVector3 p)
61{
62 p -= mPosAgent;
63 p.rotVec( ~mRotation );
64 addPointLocal( p );
65}
66
67
68void LLBBox::addBBoxAgent(const LLBBox& b)
69{
70 if (mEmpty)
71 {
72 mPosAgent = b.mPosAgent;
73 mRotation = b.mRotation;
74 mMinLocal.clearVec();
75 mMaxLocal.clearVec();
76 }
77 LLVector3 vertex[8];
78 vertex[0].setVec( b.mMinLocal.mV[VX], b.mMinLocal.mV[VY], b.mMinLocal.mV[VZ] );
79 vertex[1].setVec( b.mMinLocal.mV[VX], b.mMinLocal.mV[VY], b.mMaxLocal.mV[VZ] );
80 vertex[2].setVec( b.mMinLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMinLocal.mV[VZ] );
81 vertex[3].setVec( b.mMinLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMaxLocal.mV[VZ] );
82 vertex[4].setVec( b.mMaxLocal.mV[VX], b.mMinLocal.mV[VY], b.mMinLocal.mV[VZ] );
83 vertex[5].setVec( b.mMaxLocal.mV[VX], b.mMinLocal.mV[VY], b.mMaxLocal.mV[VZ] );
84 vertex[6].setVec( b.mMaxLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMinLocal.mV[VZ] );
85 vertex[7].setVec( b.mMaxLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMaxLocal.mV[VZ] );
86
87 LLMatrix4 m( b.mRotation );
88 m.translate( b.mPosAgent );
89 m.translate( -mPosAgent );
90 m.rotate( ~mRotation );
91
92 for( S32 i=0; i<8; i++ )
93 {
94 addPointLocal( vertex[i] * m );
95 }
96}
97
98
99void LLBBox::expand( F32 delta )
100{
101 mMinLocal.mV[VX] -= delta;
102 mMinLocal.mV[VY] -= delta;
103 mMinLocal.mV[VZ] -= delta;
104 mMaxLocal.mV[VX] += delta;
105 mMaxLocal.mV[VY] += delta;
106 mMaxLocal.mV[VZ] += delta;
107}
108
109LLVector3 LLBBox::localToAgent(const LLVector3& v) const
110{
111 LLMatrix4 m( mRotation );
112 m.translate( mPosAgent );
113 return v * m;
114}
115
116LLVector3 LLBBox::agentToLocal(const LLVector3& v) const
117{
118 LLMatrix4 m;
119 m.translate( -mPosAgent );
120 m.rotate( ~mRotation ); // inverse rotation
121 return v * m;
122}
123
124LLVector3 LLBBox::localToAgentBasis(const LLVector3& v) const
125{
126 LLMatrix4 m( mRotation );
127 return v * m;
128}
129
130LLVector3 LLBBox::agentToLocalBasis(const LLVector3& v) const
131{
132 LLMatrix4 m( ~mRotation ); // inverse rotation
133 return v * m;
134}
135
136BOOL LLBBox::containsPointLocal(const LLVector3& p) const
137{
138 if ( (p.mV[VX] < mMinLocal.mV[VX])
139 ||(p.mV[VX] > mMaxLocal.mV[VX])
140 ||(p.mV[VY] < mMinLocal.mV[VY])
141 ||(p.mV[VY] > mMaxLocal.mV[VY])
142 ||(p.mV[VZ] < mMinLocal.mV[VZ])
143 ||(p.mV[VZ] > mMaxLocal.mV[VZ]))
144 {
145 return FALSE;
146 }
147 return TRUE;
148}
149
150BOOL LLBBox::containsPointAgent(const LLVector3& p) const
151{
152 LLVector3 point_local = agentToLocal(p);
153 return containsPointLocal(point_local);
154}
155
156
157/*
158LLBBox operator*(const LLBBox &a, const LLMatrix4 &b)
159{
160 return LLBBox( a.mMin * b, a.mMax * b );
161}
162*/
diff --git a/linden/indra/llmath/llbbox.h b/linden/indra/llmath/llbbox.h
deleted file mode 100644
index 3559284..0000000
--- a/linden/indra/llmath/llbbox.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/**
2 * @file llbbox.h
3 * @brief General purpose bounding box class
4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
7 * Copyright (c) 2001-2010, /linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by /linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and /linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL /linden LAB SOURCE CODE IS PROVIDED "AS IS." /linden LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LL_BBOX_H
34#define LL_BBOX_H
35
36#include "v3math.h"
37#include "llquaternion.h"
38
39// Note: "local space" for an LLBBox is defined relative to agent space in terms of
40// a translation followed by a rotation. There is no scale term since the LLBBox's min and
41// max are not necessarily symetrical and define their own extents.
42
43class LLBBox
44{
45public:
46 LLBBox() {mEmpty = TRUE;}
47 LLBBox( const LLVector3& pos_agent,
48 const LLQuaternion& rot,
49 const LLVector3& min_local,
50 const LLVector3& max_local )
51 :
52 mMinLocal( min_local ), mMaxLocal( max_local ), mPosAgent(pos_agent), mRotation( rot), mEmpty( TRUE )
53 {}
54
55 // Default copy constructor is OK.
56
57 const LLVector3& getPositionAgent() const { return mPosAgent; }
58 const LLQuaternion& getRotation() const { return mRotation; }
59
60 const LLVector3& getMinLocal() const { return mMinLocal; }
61 void setMinLocal( const LLVector3& min ) { mMinLocal = min; }
62
63 const LLVector3& getMaxLocal() const { return mMaxLocal; }
64 void setMaxLocal( const LLVector3& max ) { mMaxLocal = max; }
65
66 LLVector3 getCenterLocal() const { return (mMaxLocal - mMinLocal) * 0.5f + mMinLocal; }
67 LLVector3 getCenterAgent() const { return localToAgent( getCenterLocal() ); }
68
69 LLVector3 getExtentLocal() const { return mMaxLocal - mMinLocal; }
70
71 BOOL containsPointLocal(const LLVector3& p) const;
72 BOOL containsPointAgent(const LLVector3& p) const;
73
74 void addPointAgent(LLVector3 p);
75 void addBBoxAgent(const LLBBox& b);
76
77 void addPointLocal(const LLVector3& p);
78 void addBBoxLocal(const LLBBox& b) { addPointLocal( b.mMinLocal ); addPointLocal( b.mMaxLocal ); }
79
80 void expand( F32 delta );
81
82 LLVector3 localToAgent( const LLVector3& v ) const;
83 LLVector3 agentToLocal( const LLVector3& v ) const;
84
85 // Changes rotation but not position
86 LLVector3 localToAgentBasis(const LLVector3& v) const;
87 LLVector3 agentToLocalBasis(const LLVector3& v) const;
88
89
90// friend LLBBox operator*(const LLBBox& a, const LLMatrix4& b);
91
92private:
93 LLVector3 mMinLocal;
94 LLVector3 mMaxLocal;
95 LLVector3 mPosAgent; // Position relative to Agent's Region
96 LLQuaternion mRotation;
97 BOOL mEmpty; // Nothing has been added to this bbox yet
98};
99
100//LLBBox operator*(const LLBBox &a, const LLMatrix4 &b);
101
102
103#endif // LL_BBOX_H
diff --git a/linden/indra/llmath/llcamera.cpp b/linden/indra/llmath/llcamera.cpp
index 9c37fcf..e6b6797 100644
--- a/linden/indra/llmath/llcamera.cpp
+++ b/linden/indra/llmath/llcamera.cpp
@@ -246,10 +246,6 @@ S32 LLCamera::AABBInFrustum(const LLVector3 &center, const LLVector3& radius)
246 for (U32 i = 0; i < mPlaneCount; i++) 246 for (U32 i = 0; i < mPlaneCount; i++)
247 { 247 {
248 mask = mAgentPlanes[i].mask; 248 mask = mAgentPlanes[i].mask;
249 if (mask == 0xff)
250 {
251 continue;
252 }
253 LLPlane p = mAgentPlanes[i].p; 249 LLPlane p = mAgentPlanes[i].p;
254 LLVector3 n = LLVector3(p); 250 LLVector3 n = LLVector3(p);
255 float d = p.mV[3]; 251 float d = p.mV[3];
@@ -298,10 +294,6 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector3 &center, const LLVector3& r
298 } 294 }
299 295
300 mask = mAgentPlanes[i].mask; 296 mask = mAgentPlanes[i].mask;
301 if (mask == 0xff)
302 {
303 continue;
304 }
305 LLPlane p = mAgentPlanes[i].p; 297 LLPlane p = mAgentPlanes[i].p;
306 LLVector3 n = LLVector3(p); 298 LLVector3 n = LLVector3(p);
307 float d = p.mV[3]; 299 float d = p.mV[3];
@@ -445,11 +437,6 @@ int LLCamera::sphereInFrustum(const LLVector3 &sphere_center, const F32 radius)
445 int res = 2; 437 int res = 2;
446 for (int i = 0; i < 6; i++) 438 for (int i = 0; i < 6; i++)
447 { 439 {
448 if (mAgentPlanes[i].mask == 0xff)
449 {
450 continue;
451 }
452
453 float d = mAgentPlanes[i].p.dist(sphere_center); 440 float d = mAgentPlanes[i].p.dist(sphere_center);
454 441
455 if (d > radius) 442 if (d > radius)
@@ -635,17 +622,6 @@ U8 LLCamera::calcPlaneMask(const LLPlane& plane)
635 return mask; 622 return mask;
636} 623}
637 624
638void LLCamera::ignoreAgentFrustumPlane(S32 idx)
639{
640 if (idx < 0 || idx > (S32) mPlaneCount)
641 {
642 return;
643 }
644
645 mAgentPlanes[idx].mask = 0xff;
646 mAgentPlanes[idx].p.clearVec();
647}
648
649void LLCamera::calcAgentFrustumPlanes(LLVector3* frust) 625void LLCamera::calcAgentFrustumPlanes(LLVector3* frust)
650{ 626{
651 627
diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h
index 8d3ad08..85b93df 100644
--- a/linden/indra/llmath/llcamera.h
+++ b/linden/indra/llmath/llcamera.h
@@ -84,17 +84,6 @@ public:
84 PLANE_TOP_MASK = (1<<PLANE_TOP), 84 PLANE_TOP_MASK = (1<<PLANE_TOP),
85 PLANE_ALL_MASK = 0xf 85 PLANE_ALL_MASK = 0xf
86 }; 86 };
87
88 enum
89 {
90 AGENT_PLANE_LEFT = 0,
91 AGENT_PLANE_RIGHT,
92 AGENT_PLANE_NEAR,
93 AGENT_PLANE_BOTTOM,
94 AGENT_PLANE_TOP,
95 AGENT_PLANE_FAR,
96 };
97
98 enum { 87 enum {
99 HORIZ_PLANE_LEFT = 0, 88 HORIZ_PLANE_LEFT = 0,
100 HORIZ_PLANE_RIGHT = 1, 89 HORIZ_PLANE_RIGHT = 1,
@@ -134,8 +123,7 @@ private:
134public: 123public:
135 LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum 124 LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum
136 F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane 125 F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane
137 LLPlane getAgentPlane(U32 idx) { return mAgentPlanes[idx].p; } 126
138
139public: 127public:
140 LLCamera(); 128 LLCamera();
141 LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); 129 LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane);
@@ -182,8 +170,6 @@ public:
182 // Return number of bytes copied. 170 // Return number of bytes copied.
183 size_t readFrustumFromBuffer(const char *buffer); 171 size_t readFrustumFromBuffer(const char *buffer);
184 void calcAgentFrustumPlanes(LLVector3* frust); 172 void calcAgentFrustumPlanes(LLVector3* frust);
185 void ignoreAgentFrustumPlane(S32 idx);
186
187 // Returns 1 if partly in, 2 if fully in. 173 // Returns 1 if partly in, 2 if fully in.
188 // NOTE: 'center' is in absolute frame. 174 // NOTE: 'center' is in absolute frame.
189 S32 sphereInFrustumOld(const LLVector3 &center, const F32 radius) const; 175 S32 sphereInFrustumOld(const LLVector3 &center, const F32 radius) const;
diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h
index ec1076d..0de568c 100644
--- a/linden/indra/llmath/llmath.h
+++ b/linden/indra/llmath/llmath.h
@@ -203,7 +203,7 @@ inline S32 llfloor( F32 f )
203 } 203 }
204 return result; 204 return result;
205#else 205#else
206 return (S32)floorf(f); 206 return (S32)floor(f);
207#endif 207#endif
208} 208}
209 209
diff --git a/linden/indra/llmath/llmodularmath.cpp b/linden/indra/llmath/llmodularmath.cpp
deleted file mode 100644
index f0afeb7..0000000
--- a/linden/indra/llmath/llmodularmath.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
1/**
2 * @file llmodularmath.cpp
3 * @brief LLModularMath class implementation
4 *
5 * $LicenseInfo:firstyear=2001&license=viewergpl$
6 *
7 * Copyright (c) 2001-2010, /linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by /linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and /linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL /linden LAB SOURCE CODE IS PROVIDED "AS IS." /linden LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "linden_common.h"
34
35// implementation is all in the header, this include dep ensures the unit test is rerun if the implementation changes.
36#include "llmodularmath.h"
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp
index a1d891a..b0b8a94 100644
--- a/linden/indra/llmath/llvolume.cpp
+++ b/linden/indra/llmath/llvolume.cpp
@@ -2208,10 +2208,16 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
2208 S32 requested_sizeS = 0; 2208 S32 requested_sizeS = 0;
2209 S32 requested_sizeT = 0; 2209 S32 requested_sizeT = 0;
2210 2210
2211 sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, mDetail, requested_sizeS, requested_sizeT); 2211 // create oblong sculpties with high LOD always
2212 F32 sculpt_detail = mDetail;
2213 if (sculpt_width != sculpt_height && sculpt_detail < 4.0)
2214 {
2215 sculpt_detail = 4.0;
2216 }
2217 sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, sculpt_detail, requested_sizeS, requested_sizeT);
2212 2218
2213 mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE, requested_sizeS); 2219 mPathp->generate(mParams.getPathParams(), sculpt_detail, 0, TRUE, requested_sizeS);
2214 mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE, requested_sizeT); 2220 mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), sculpt_detail, 0, TRUE, requested_sizeT);
2215 2221
2216 S32 sizeS = mPathp->mPath.size(); // we requested a specific size, now see what we really got 2222 S32 sizeS = mPathp->mPath.size(); // we requested a specific size, now see what we really got
2217 S32 sizeT = mProfilep->mProfile.size(); // we requested a specific size, now see what we really got 2223 S32 sizeT = mProfilep->mProfile.size(); // we requested a specific size, now see what we really got
@@ -4268,7 +4274,7 @@ LLFaceID LLVolume::generateFaceMask()
4268 } 4274 }
4269 break; 4275 break;
4270 default: 4276 default:
4271 llerrs << "Unknown profile!" << llendl; 4277 llerrs << "Unknown profile!" << llendl
4272 break; 4278 break;
4273 } 4279 }
4274 4280