diff options
Diffstat (limited to 'linden/indra/llmath')
-rw-r--r-- | linden/indra/llmath/llbbox.cpp | 162 | ||||
-rw-r--r-- | linden/indra/llmath/llbbox.h | 103 | ||||
-rw-r--r-- | linden/indra/llmath/llcamera.cpp | 24 | ||||
-rw-r--r-- | linden/indra/llmath/llcamera.h | 16 | ||||
-rw-r--r-- | linden/indra/llmath/llmath.h | 2 | ||||
-rw-r--r-- | linden/indra/llmath/llmodularmath.cpp | 36 | ||||
-rw-r--r-- | linden/indra/llmath/llvolume.cpp | 14 |
7 files changed, 345 insertions, 12 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 | |||
41 | void 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 | |||
60 | void LLBBox::addPointAgent( LLVector3 p) | ||
61 | { | ||
62 | p -= mPosAgent; | ||
63 | p.rotVec( ~mRotation ); | ||
64 | addPointLocal( p ); | ||
65 | } | ||
66 | |||
67 | |||
68 | void 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 | |||
99 | void 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 | |||
109 | LLVector3 LLBBox::localToAgent(const LLVector3& v) const | ||
110 | { | ||
111 | LLMatrix4 m( mRotation ); | ||
112 | m.translate( mPosAgent ); | ||
113 | return v * m; | ||
114 | } | ||
115 | |||
116 | LLVector3 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 | |||
124 | LLVector3 LLBBox::localToAgentBasis(const LLVector3& v) const | ||
125 | { | ||
126 | LLMatrix4 m( mRotation ); | ||
127 | return v * m; | ||
128 | } | ||
129 | |||
130 | LLVector3 LLBBox::agentToLocalBasis(const LLVector3& v) const | ||
131 | { | ||
132 | LLMatrix4 m( ~mRotation ); // inverse rotation | ||
133 | return v * m; | ||
134 | } | ||
135 | |||
136 | BOOL 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 | |||
150 | BOOL LLBBox::containsPointAgent(const LLVector3& p) const | ||
151 | { | ||
152 | LLVector3 point_local = agentToLocal(p); | ||
153 | return containsPointLocal(point_local); | ||
154 | } | ||
155 | |||
156 | |||
157 | /* | ||
158 | LLBBox 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 | |||
43 | class LLBBox | ||
44 | { | ||
45 | public: | ||
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 | |||
92 | private: | ||
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 0f343bc..0609e2f 100644 --- a/linden/indra/llmath/llcamera.cpp +++ b/linden/indra/llmath/llcamera.cpp | |||
@@ -246,6 +246,10 @@ S32 LLCamera::AABBInFrustum(const LLVector3 ¢er, 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 ¢er, 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 | ||
638 | void 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 | |||
625 | void LLCamera::calcAgentFrustumPlanes(LLVector3* frust) | 649 | void LLCamera::calcAgentFrustumPlanes(LLVector3* frust) |
626 | { | 650 | { |
627 | 651 | ||
diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h index 23ee115..0c81067 100644 --- a/linden/indra/llmath/llcamera.h +++ b/linden/indra/llmath/llcamera.h | |||
@@ -93,6 +93,17 @@ public: | |||
93 | PLANE_TOP_MASK = (1<<PLANE_TOP), | 93 | PLANE_TOP_MASK = (1<<PLANE_TOP), |
94 | PLANE_ALL_MASK = 0xf | 94 | PLANE_ALL_MASK = 0xf |
95 | }; | 95 | }; |
96 | |||
97 | enum | ||
98 | { | ||
99 | AGENT_PLANE_LEFT = 0, | ||
100 | AGENT_PLANE_RIGHT, | ||
101 | AGENT_PLANE_NEAR, | ||
102 | AGENT_PLANE_BOTTOM, | ||
103 | AGENT_PLANE_TOP, | ||
104 | AGENT_PLANE_FAR, | ||
105 | }; | ||
106 | |||
96 | enum { | 107 | enum { |
97 | HORIZ_PLANE_LEFT = 0, | 108 | HORIZ_PLANE_LEFT = 0, |
98 | HORIZ_PLANE_RIGHT = 1, | 109 | HORIZ_PLANE_RIGHT = 1, |
@@ -132,7 +143,8 @@ private: | |||
132 | public: | 143 | public: |
133 | LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum | 144 | LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum |
134 | F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane | 145 | F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane |
135 | 146 | LLPlane getAgentPlane(U32 idx) { return mAgentPlanes[idx].p; } | |
147 | |||
136 | public: | 148 | public: |
137 | LLCamera(); | 149 | LLCamera(); |
138 | LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); | 150 | LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); |
@@ -179,6 +191,8 @@ public: | |||
179 | // Return number of bytes copied. | 191 | // Return number of bytes copied. |
180 | size_t readFrustumFromBuffer(const char *buffer); | 192 | size_t readFrustumFromBuffer(const char *buffer); |
181 | void calcAgentFrustumPlanes(LLVector3* frust); | 193 | void calcAgentFrustumPlanes(LLVector3* frust); |
194 | void ignoreAgentFrustumPlane(S32 idx); | ||
195 | |||
182 | // Returns 1 if partly in, 2 if fully in. | 196 | // Returns 1 if partly in, 2 if fully in. |
183 | // NOTE: 'center' is in absolute frame. | 197 | // NOTE: 'center' is in absolute frame. |
184 | S32 sphereInFrustumOld(const LLVector3 ¢er, const F32 radius) const; | 198 | S32 sphereInFrustumOld(const LLVector3 ¢er, const F32 radius) const; |
diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h index 0de568c..ec1076d 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)floor(f); | 206 | return (S32)floorf(f); |
207 | #endif | 207 | #endif |
208 | } | 208 | } |
209 | 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/llvolume.cpp b/linden/indra/llmath/llvolume.cpp index b0b8a94..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 |
@@ -4274,7 +4268,7 @@ LLFaceID LLVolume::generateFaceMask() | |||
4274 | } | 4268 | } |
4275 | break; | 4269 | break; |
4276 | default: | 4270 | default: |
4277 | llerrs << "Unknown profile!" << llendl | 4271 | llerrs << "Unknown profile!" << llendl; |
4278 | break; | 4272 | break; |
4279 | } | 4273 | } |
4280 | 4274 | ||