aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmath
diff options
context:
space:
mode:
authorRobin Cornelius2010-10-10 21:53:54 +0100
committerRobin Cornelius2010-10-10 21:53:54 +0100
commitc0034c520c6e61b64822e276316651ec6912bd98 (patch)
tree910442027b6a2c1406d80ca93949755b54badf5c /linden/indra/llmath
parentUse all those cores for compile (diff)
parentThickbrick Sleaford, Soft Linden: STORM-164 make gcc-4.4 happy about llvosky.h (diff)
downloadmeta-impy-c0034c520c6e61b64822e276316651ec6912bd98.zip
meta-impy-c0034c520c6e61b64822e276316651ec6912bd98.tar.gz
meta-impy-c0034c520c6e61b64822e276316651ec6912bd98.tar.bz2
meta-impy-c0034c520c6e61b64822e276316651ec6912bd98.tar.xz
Merge branch 'mccabe-plugins' into plugins_merge
Conflicts: linden/doc/contributions.txt linden/indra/cmake/GStreamer.cmake linden/indra/cmake/LLMedia.cmake linden/indra/cmake/OPENAL.cmake linden/indra/llmedia/CMakeLists.txt linden/indra/llprimitive/material_codes.h linden/indra/newview/chatbar_as_cmdline.cpp linden/indra/newview/llappviewer.cpp linden/indra/newview/llfloatertos.cpp linden/indra/newview/llstartup.cpp linden/indra/newview/llviewerwindow.cpp linden/indra/newview/llvoavatar.cpp linden/indra/newview/pipeline.cpp linden/indra/newview/pipeline.h linden/indra/newview/viewer_manifest.py linden/install.xml
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.h12
-rw-r--r--linden/indra/llmath/llmodularmath.cpp36
-rwxr-xr-xlinden/indra/llmath/llsdutil_math.h70
-rw-r--r--linden/indra/llmath/llvolume.cpp20
-rw-r--r--linden/indra/llmath/llvolume.h10
-rw-r--r--linden/indra/llmath/v3math.h4
10 files changed, 434 insertions, 23 deletions
diff --git a/linden/indra/llmath/llbbox.cpp b/linden/indra/llmath/llbbox.cpp
new file mode 100644
index 0000000..f0ec010
--- /dev/null
+++ b/linden/indra/llmath/llbbox.cpp
@@ -0,0 +1,162 @@
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
new file mode 100644
index 0000000..3559284
--- /dev/null
+++ b/linden/indra/llmath/llbbox.h
@@ -0,0 +1,103 @@
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 e6b6797..9c37fcf 100644
--- a/linden/indra/llmath/llcamera.cpp
+++ b/linden/indra/llmath/llcamera.cpp
@@ -246,6 +246,10 @@ 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 }
249 LLPlane p = mAgentPlanes[i].p; 253 LLPlane p = mAgentPlanes[i].p;
250 LLVector3 n = LLVector3(p); 254 LLVector3 n = LLVector3(p);
251 float d = p.mV[3]; 255 float d = p.mV[3];
@@ -294,6 +298,10 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector3 &center, const LLVector3& r
294 } 298 }
295 299
296 mask = mAgentPlanes[i].mask; 300 mask = mAgentPlanes[i].mask;
301 if (mask == 0xff)
302 {
303 continue;
304 }
297 LLPlane p = mAgentPlanes[i].p; 305 LLPlane p = mAgentPlanes[i].p;
298 LLVector3 n = LLVector3(p); 306 LLVector3 n = LLVector3(p);
299 float d = p.mV[3]; 307 float d = p.mV[3];
@@ -437,6 +445,11 @@ int LLCamera::sphereInFrustum(const LLVector3 &sphere_center, const F32 radius)
437 int res = 2; 445 int res = 2;
438 for (int i = 0; i < 6; i++) 446 for (int i = 0; i < 6; i++)
439 { 447 {
448 if (mAgentPlanes[i].mask == 0xff)
449 {
450 continue;
451 }
452
440 float d = mAgentPlanes[i].p.dist(sphere_center); 453 float d = mAgentPlanes[i].p.dist(sphere_center);
441 454
442 if (d > radius) 455 if (d > radius)
@@ -622,6 +635,17 @@ U8 LLCamera::calcPlaneMask(const LLPlane& plane)
622 return mask; 635 return mask;
623} 636}
624 637
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
625void LLCamera::calcAgentFrustumPlanes(LLVector3* frust) 649void LLCamera::calcAgentFrustumPlanes(LLVector3* frust)
626{ 650{
627 651
diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h
index 85b93df..8d3ad08 100644
--- a/linden/indra/llmath/llcamera.h
+++ b/linden/indra/llmath/llcamera.h
@@ -84,6 +84,17 @@ 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
87 enum { 98 enum {
88 HORIZ_PLANE_LEFT = 0, 99 HORIZ_PLANE_LEFT = 0,
89 HORIZ_PLANE_RIGHT = 1, 100 HORIZ_PLANE_RIGHT = 1,
@@ -123,7 +134,8 @@ private:
123public: 134public:
124 LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum 135 LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum
125 F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane 136 F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane
126 137 LLPlane getAgentPlane(U32 idx) { return mAgentPlanes[idx].p; }
138
127public: 139public:
128 LLCamera(); 140 LLCamera();
129 LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); 141 LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane);
@@ -170,6 +182,8 @@ public:
170 // Return number of bytes copied. 182 // Return number of bytes copied.
171 size_t readFrustumFromBuffer(const char *buffer); 183 size_t readFrustumFromBuffer(const char *buffer);
172 void calcAgentFrustumPlanes(LLVector3* frust); 184 void calcAgentFrustumPlanes(LLVector3* frust);
185 void ignoreAgentFrustumPlane(S32 idx);
186
173 // Returns 1 if partly in, 2 if fully in. 187 // Returns 1 if partly in, 2 if fully in.
174 // NOTE: 'center' is in absolute frame. 188 // NOTE: 'center' is in absolute frame.
175 S32 sphereInFrustumOld(const LLVector3 &center, const F32 radius) const; 189 S32 sphereInFrustumOld(const LLVector3 &center, const F32 radius) const;
diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h
index 9f8e539..ec1076d 100644
--- a/linden/indra/llmath/llmath.h
+++ b/linden/indra/llmath/llmath.h
@@ -35,6 +35,7 @@
35 35
36#include <cmath> 36#include <cmath>
37#include <cstdlib> 37#include <cstdlib>
38#include <complex>
38#include "lldefs.h" 39#include "lldefs.h"
39#include "llstl.h" // *TODO: Remove when LLString is gone 40#include "llstl.h" // *TODO: Remove when LLString is gone
40#include "llstring.h" // *TODO: Remove when LLString is gone 41#include "llstring.h" // *TODO: Remove when LLString is gone
@@ -60,7 +61,9 @@
60#endif 61#endif
61 62
62// Single Precision Floating Point Routines 63// Single Precision Floating Point Routines
63#if _MSC_VER < 1400 64#ifndef fsqrtf
65#define fsqrtf(x) ((F32)sqrt((F64)(x)))
66#endif
64#ifndef sqrtf 67#ifndef sqrtf
65#define sqrtf(x) ((F32)sqrt((F64)(x))) 68#define sqrtf(x) ((F32)sqrt((F64)(x)))
66#endif 69#endif
@@ -81,11 +84,6 @@
81#ifndef powf 84#ifndef powf
82#define powf(x,y) ((F32)pow((F64)(x),(F64)(y))) 85#define powf(x,y) ((F32)pow((F64)(x),(F64)(y)))
83#endif 86#endif
84#endif
85
86#ifndef fsqrtf
87#define fsqrtf(x) sqrtf(x)
88#endif
89 87
90const F32 GRAVITY = -9.8f; 88const F32 GRAVITY = -9.8f;
91 89
@@ -205,7 +203,7 @@ inline S32 llfloor( F32 f )
205 } 203 }
206 return result; 204 return result;
207#else 205#else
208 return (S32)floor(f); 206 return (S32)floorf(f);
209#endif 207#endif
210} 208}
211 209
diff --git a/linden/indra/llmath/llmodularmath.cpp b/linden/indra/llmath/llmodularmath.cpp
new file mode 100644
index 0000000..f0afeb7
--- /dev/null
+++ b/linden/indra/llmath/llmodularmath.cpp
@@ -0,0 +1,36 @@
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/llsdutil_math.h b/linden/indra/llmath/llsdutil_math.h
new file mode 100755
index 0000000..5b64942
--- /dev/null
+++ b/linden/indra/llmath/llsdutil_math.h
@@ -0,0 +1,70 @@
1/**
2 * @file llsdutil_math.h
3 * @author Brad
4 * @date 2009-05-19
5 * @brief Utility classes, functions, etc, for using structured data with math classes.
6 *
7 * $LicenseInfo:firstyear=2009&license=viewergpl$
8 *
9 * Copyright (c) 2009-2010, Linden Research, Inc.
10 *
11 * Second Life Viewer Source Code
12 * The source code in this file ("Source Code") is provided by Linden Lab
13 * to you under the terms of the GNU General Public License, version 2.0
14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 *
19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 *
25 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above,
27 * and agree to abide by those obligations.
28 *
29 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
30 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
31 * COMPLETENESS OR PERFORMANCE.
32 * $/LicenseInfo$
33 */
34
35#ifndef LL_LLSDUTIL_MATH_H
36#define LL_LLSDUTIL_MATH_H
37
38class LL_COMMON_API LLSD;
39
40// vector3
41class LLVector3;
42LLSD ll_sd_from_vector3(const LLVector3& vec);
43LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0);
44
45// vector4
46class LLVector4;
47LLSD ll_sd_from_vector4(const LLVector4& vec);
48LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0);
49
50// vector3d (double)
51class LLVector3d;
52LLSD ll_sd_from_vector3d(const LLVector3d& vec);
53LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0);
54
55// vector2
56class LLVector2;
57LLSD ll_sd_from_vector2(const LLVector2& vec);
58LLVector2 ll_vector2_from_sd(const LLSD& sd);
59
60// Quaternion
61class LLQuaternion;
62LLSD ll_sd_from_quaternion(const LLQuaternion& quat);
63LLQuaternion ll_quaternion_from_sd(const LLSD& sd);
64
65// color4
66class LLColor4;
67LLSD ll_sd_from_color4(const LLColor4& c);
68LLColor4 ll_color4_from_sd(const LLSD& sd);
69
70#endif // LL_LLSDUTIL_MATH_H
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp
index b9b9e0b..a1d891a 100644
--- a/linden/indra/llmath/llvolume.cpp
+++ b/linden/indra/llmath/llvolume.cpp
@@ -2208,16 +2208,10 @@ 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 // create oblong sculpties with high LOD always 2211 sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, mDetail, requested_sizeS, requested_sizeT);
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);
2218 2212
2219 mPathp->generate(mParams.getPathParams(), sculpt_detail, 0, TRUE, requested_sizeS); 2213 mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE, requested_sizeS);
2220 mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), sculpt_detail, 0, TRUE, requested_sizeT); 2214 mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE, requested_sizeT);
2221 2215
2222 S32 sizeS = mPathp->mPath.size(); // we requested a specific size, now see what we really got 2216 S32 sizeS = mPathp->mPath.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 2217 S32 sizeT = mProfilep->mProfile.size(); // we requested a specific size, now see what we really got
@@ -3376,7 +3370,8 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
3376 std::vector<S32> &segments, 3370 std::vector<S32> &segments,
3377 const LLVector3& obj_cam_vec, 3371 const LLVector3& obj_cam_vec,
3378 const LLMatrix4& mat, 3372 const LLMatrix4& mat,
3379 const LLMatrix3& norm_mat) 3373 const LLMatrix3& norm_mat,
3374 S32 face_mask)
3380{ 3375{
3381 LLMemType m1(LLMemType::MTYPE_VOLUME); 3376 LLMemType m1(LLMemType::MTYPE_VOLUME);
3382 3377
@@ -3384,12 +3379,17 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
3384 normals.clear(); 3379 normals.clear();
3385 segments.clear(); 3380 segments.clear();
3386 3381
3382 S32 cur_index = 0;
3387 //for each face 3383 //for each face
3388 for (face_list_t::iterator iter = mVolumeFaces.begin(); 3384 for (face_list_t::iterator iter = mVolumeFaces.begin();
3389 iter != mVolumeFaces.end(); ++iter) 3385 iter != mVolumeFaces.end(); ++iter)
3390 { 3386 {
3391 const LLVolumeFace& face = *iter; 3387 const LLVolumeFace& face = *iter;
3392 3388
3389 if (!(face_mask & (0x1 << cur_index++)))
3390 {
3391 continue;
3392 }
3393 if (face.mTypeMask & (LLVolumeFace::CAP_MASK)) { 3393 if (face.mTypeMask & (LLVolumeFace::CAP_MASK)) {
3394 3394
3395 } 3395 }
diff --git a/linden/indra/llmath/llvolume.h b/linden/indra/llmath/llvolume.h
index 2b1c60d..0b9002f 100644
--- a/linden/indra/llmath/llvolume.h
+++ b/linden/indra/llmath/llvolume.h
@@ -905,9 +905,13 @@ public:
905 // returns number of triangle indeces required for path/profile mesh 905 // returns number of triangle indeces required for path/profile mesh
906 S32 getNumTriangleIndices() const; 906 S32 getNumTriangleIndices() const;
907 907
908 void generateSilhouetteVertices(std::vector<LLVector3> &vertices, std::vector<LLVector3> &normals, std::vector<S32> &segments, const LLVector3& view_vec, 908 void generateSilhouetteVertices(std::vector<LLVector3> &vertices,
909 const LLMatrix4& mat, 909 std::vector<LLVector3> &normals,
910 const LLMatrix3& norm_mat); 910 std::vector<S32> &segments,
911 const LLVector3& view_vec,
912 const LLMatrix4& mat,
913 const LLMatrix3& norm_mat,
914 S32 face_index);
911 915
912 //get the face index of the face that intersects with the given line segment at the point 916 //get the face index of the face that intersects with the given line segment at the point
913 //closest to start. Moves end to the point of intersection. Returns -1 if no intersection. 917 //closest to start. Moves end to the point of intersection. Returns -1 if no intersection.
diff --git a/linden/indra/llmath/v3math.h b/linden/indra/llmath/v3math.h
index 7f96800..8c65d93 100644
--- a/linden/indra/llmath/v3math.h
+++ b/linden/indra/llmath/v3math.h
@@ -411,8 +411,8 @@ inline bool operator<(const LLVector3 &a, const LLVector3 &b)
411 return (a.mV[0] < b.mV[0] 411 return (a.mV[0] < b.mV[0]
412 || (a.mV[0] == b.mV[0] 412 || (a.mV[0] == b.mV[0]
413 && (a.mV[1] < b.mV[1] 413 && (a.mV[1] < b.mV[1]
414 || (a.mV[1] == b.mV[1]) 414 || ((a.mV[1] == b.mV[1])
415 && a.mV[2] < b.mV[2]))); 415 && a.mV[2] < b.mV[2]))));
416} 416}
417 417
418inline const LLVector3& operator+=(LLVector3 &a, const LLVector3 &b) 418inline const LLVector3& operator+=(LLVector3 &a, const LLVector3 &b)