diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llmath | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
37 files changed, 909 insertions, 1636 deletions
diff --git a/linden/indra/llmath/llcrc.cpp b/linden/indra/llcommon/llcrc.cpp index 447521a..beb76d1 100644 --- a/linden/indra/llmath/llcrc.cpp +++ b/linden/indra/llcommon/llcrc.cpp | |||
@@ -163,15 +163,15 @@ void LLCRC::update(const U8* buffer, size_t buffer_size) | |||
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | void LLCRC::update(const char* filename) | 166 | void LLCRC::update(const std::string& filename) |
167 | { | 167 | { |
168 | if (!filename) | 168 | if (filename.empty()) |
169 | { | 169 | { |
170 | llerrs << "No filename specified" << llendl; | 170 | llerrs << "No filename specified" << llendl; |
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | 173 | ||
174 | LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ | 174 | FILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ |
175 | 175 | ||
176 | if (fp) | 176 | if (fp) |
177 | { | 177 | { |
diff --git a/linden/indra/llmath/llcrc.h b/linden/indra/llcommon/llcrc.h index 59f58ce..20f214e 100644 --- a/linden/indra/llmath/llcrc.h +++ b/linden/indra/llcommon/llcrc.h | |||
@@ -41,7 +41,7 @@ | |||
41 | // example (don't try this at work kids): | 41 | // example (don't try this at work kids): |
42 | // | 42 | // |
43 | // LLCRC crc; | 43 | // LLCRC crc; |
44 | // LLFILE* fp = LLFile::fopen(filename,"rb"); | 44 | // FILE* fp = LLFile::fopen(filename,"rb"); |
45 | // while(!feof(fp)) { | 45 | // while(!feof(fp)) { |
46 | // crc.update(fgetc(fp)); | 46 | // crc.update(fgetc(fp)); |
47 | // } | 47 | // } |
@@ -60,7 +60,7 @@ public: | |||
60 | U32 getCRC() const; | 60 | U32 getCRC() const; |
61 | void update(U8 next_byte); | 61 | void update(U8 next_byte); |
62 | void update(const U8* buffer, size_t buffer_size); | 62 | void update(const U8* buffer, size_t buffer_size); |
63 | void update(const char *filename); | 63 | void update(const std::string& filename); |
64 | 64 | ||
65 | #ifdef _DEBUG | 65 | #ifdef _DEBUG |
66 | // This function runs tests to make sure the crc is | 66 | // This function runs tests to make sure the crc is |
diff --git a/linden/indra/llmath/llmd5.cpp b/linden/indra/llcommon/llmd5.cpp index ea69002..a0ac92f 100644 --- a/linden/indra/llmath/llmd5.cpp +++ b/linden/indra/llcommon/llmd5.cpp | |||
@@ -157,7 +157,7 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) { | |||
157 | // MD5 update for files. | 157 | // MD5 update for files. |
158 | // Like above, except that it works on files (and uses above as a primitive.) | 158 | // Like above, except that it works on files (and uses above as a primitive.) |
159 | 159 | ||
160 | void LLMD5::update(LLFILE* file){ | 160 | void LLMD5::update(FILE* file){ |
161 | 161 | ||
162 | unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ | 162 | unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ |
163 | int len; | 163 | int len; |
@@ -237,7 +237,7 @@ void LLMD5::finalize (){ | |||
237 | 237 | ||
238 | 238 | ||
239 | 239 | ||
240 | LLMD5::LLMD5(LLFILE *file){ | 240 | LLMD5::LLMD5(FILE *file){ |
241 | 241 | ||
242 | init(); // must be called be all constructors | 242 | init(); // must be called be all constructors |
243 | update(file); | 243 | update(file); |
diff --git a/linden/indra/llmath/llmd5.h b/linden/indra/llcommon/llmd5.h index 9ba0a9f..6d21b31 100644 --- a/linden/indra/llmath/llmd5.h +++ b/linden/indra/llcommon/llmd5.h | |||
@@ -93,14 +93,14 @@ public: | |||
93 | LLMD5 (); // simple initializer | 93 | LLMD5 (); // simple initializer |
94 | void update (const uint1 *input, const uint4 input_length); | 94 | void update (const uint1 *input, const uint4 input_length); |
95 | void update (std::istream& stream); | 95 | void update (std::istream& stream); |
96 | void update (LLFILE *file); | 96 | void update (FILE *file); |
97 | void finalize (); | 97 | void finalize (); |
98 | 98 | ||
99 | // constructors for special circumstances. All these constructors finalize | 99 | // constructors for special circumstances. All these constructors finalize |
100 | // the MD5 context. | 100 | // the MD5 context. |
101 | LLMD5 (const unsigned char *string); // digest string, finalize | 101 | LLMD5 (const unsigned char *string); // digest string, finalize |
102 | LLMD5 (std::istream& stream); // digest stream, finalize | 102 | LLMD5 (std::istream& stream); // digest stream, finalize |
103 | LLMD5 (LLFILE *file); // digest file, close, finalize | 103 | LLMD5 (FILE *file); // digest file, close, finalize |
104 | LLMD5 (const unsigned char *string, const unsigned int number); | 104 | LLMD5 (const unsigned char *string, const unsigned int number); |
105 | 105 | ||
106 | // methods to acquire finalized result | 106 | // methods to acquire finalized result |
diff --git a/linden/indra/llmath/llrand.cpp b/linden/indra/llcommon/llrand.cpp index bc8c867..bc8c867 100644 --- a/linden/indra/llmath/llrand.cpp +++ b/linden/indra/llcommon/llrand.cpp | |||
diff --git a/linden/indra/llmath/llrand.h b/linden/indra/llcommon/llrand.h index 0a28213..0a28213 100644 --- a/linden/indra/llmath/llrand.h +++ b/linden/indra/llcommon/llrand.h | |||
diff --git a/linden/indra/llmath/lluuid.cpp b/linden/indra/llcommon/lluuid.cpp index d835cbc..7e4eb50 100644 --- a/linden/indra/llmath/lluuid.cpp +++ b/linden/indra/llcommon/lluuid.cpp | |||
@@ -149,9 +149,9 @@ U32 janky_fast_random_seeded_bytes(U32 seed, U32 val) | |||
149 | #endif | 149 | #endif |
150 | 150 | ||
151 | // Common to all UUID implementations | 151 | // Common to all UUID implementations |
152 | void LLUUID::toString(char *out) const | 152 | void LLUUID::toString(std::string& out) const |
153 | { | 153 | { |
154 | sprintf(out, | 154 | out = llformat( |
155 | "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", | 155 | "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", |
156 | (U8)(mData[0]), | 156 | (U8)(mData[0]), |
157 | (U8)(mData[1]), | 157 | (U8)(mData[1]), |
@@ -171,6 +171,23 @@ void LLUUID::toString(char *out) const | |||
171 | (U8)(mData[15])); | 171 | (U8)(mData[15])); |
172 | } | 172 | } |
173 | 173 | ||
174 | // *TODO: deprecate | ||
175 | void LLUUID::toString(char *out) const | ||
176 | { | ||
177 | std::string buffer; | ||
178 | toString(buffer); | ||
179 | strcpy(out,buffer.c_str()); /* Flawfinder: ignore */ | ||
180 | } | ||
181 | |||
182 | void LLUUID::toCompressedString(std::string& out) const | ||
183 | { | ||
184 | char bytes[UUID_BYTES+1]; | ||
185 | memcpy(bytes, mData, UUID_BYTES); /* Flawfinder: ignore */ | ||
186 | bytes[UUID_BYTES] = '\0'; | ||
187 | out.assign(bytes, UUID_BYTES); | ||
188 | } | ||
189 | |||
190 | // *TODO: deprecate | ||
174 | void LLUUID::toCompressedString(char *out) const | 191 | void LLUUID::toCompressedString(char *out) const |
175 | { | 192 | { |
176 | memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ | 193 | memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ |
@@ -184,38 +201,32 @@ std::string LLUUID::getString() const | |||
184 | 201 | ||
185 | std::string LLUUID::asString() const | 202 | std::string LLUUID::asString() const |
186 | { | 203 | { |
187 | char str[UUID_STR_SIZE]; /* Flawfinder: ignore */ | 204 | std::string str; |
188 | toString(str); | 205 | toString(str); |
189 | return std::string(str); | 206 | return str; |
190 | } | 207 | } |
191 | 208 | ||
192 | BOOL LLUUID::set(const std::string& in_string, BOOL emit) | 209 | BOOL LLUUID::set(const char* in_string, BOOL emit) |
193 | { | 210 | { |
194 | return set(in_string.c_str(), emit); | 211 | return set(ll_safe_string(in_string)); |
195 | } | 212 | } |
196 | 213 | ||
197 | BOOL LLUUID::set(const char *in_string, BOOL emit) | 214 | BOOL LLUUID::set(const std::string& in_string, BOOL emit) |
198 | { | 215 | { |
199 | BOOL broken_format = FALSE; | 216 | BOOL broken_format = FALSE; |
200 | if (!in_string) | ||
201 | { | ||
202 | llerrs << "No string pointer in LLUUID::set!" << llendl; | ||
203 | setNull(); | ||
204 | return FALSE; | ||
205 | } | ||
206 | 217 | ||
207 | // empty strings should make NULL uuid | 218 | // empty strings should make NULL uuid |
208 | if (!in_string[0]) | 219 | if (in_string.empty()) |
209 | { | 220 | { |
210 | setNull(); | 221 | setNull(); |
211 | return TRUE; | 222 | return TRUE; |
212 | } | 223 | } |
213 | 224 | ||
214 | if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ | 225 | if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ |
215 | { | 226 | { |
216 | // I'm a moron. First implementation didn't have the right UUID format. | 227 | // I'm a moron. First implementation didn't have the right UUID format. |
217 | // Shouldn't see any of these any more | 228 | // Shouldn't see any of these any more |
218 | if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ | 229 | if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ |
219 | { | 230 | { |
220 | if(emit) | 231 | if(emit) |
221 | { | 232 | { |
@@ -251,17 +262,17 @@ BOOL LLUUID::set(const char *in_string, BOOL emit) | |||
251 | 262 | ||
252 | mData[i] = 0; | 263 | mData[i] = 0; |
253 | 264 | ||
254 | if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) | 265 | if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) |
255 | { | 266 | { |
256 | mData[i] += (U8)(*(in_string + cur_pos) - '0'); | 267 | mData[i] += (U8)(in_string[cur_pos] - '0'); |
257 | } | 268 | } |
258 | else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) | 269 | else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) |
259 | { | 270 | { |
260 | mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); | 271 | mData[i] += (U8)(10 + in_string[cur_pos] - 'a'); |
261 | } | 272 | } |
262 | else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) | 273 | else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) |
263 | { | 274 | { |
264 | mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); | 275 | mData[i] += (U8)(10 + in_string[cur_pos] - 'A'); |
265 | } | 276 | } |
266 | else | 277 | else |
267 | { | 278 | { |
@@ -276,17 +287,17 @@ BOOL LLUUID::set(const char *in_string, BOOL emit) | |||
276 | mData[i] = mData[i] << 4; | 287 | mData[i] = mData[i] << 4; |
277 | cur_pos++; | 288 | cur_pos++; |
278 | 289 | ||
279 | if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) | 290 | if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) |
280 | { | 291 | { |
281 | mData[i] += (U8)(*(in_string + cur_pos) - '0'); | 292 | mData[i] += (U8)(in_string[cur_pos] - '0'); |
282 | } | 293 | } |
283 | else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) | 294 | else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) |
284 | { | 295 | { |
285 | mData[i] += (U8)(10 + *(in_string + cur_pos) - 'a'); | 296 | mData[i] += (U8)(10 + in_string[cur_pos] - 'a'); |
286 | } | 297 | } |
287 | else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) | 298 | else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) |
288 | { | 299 | { |
289 | mData[i] += (U8)(10 + *(in_string + cur_pos) - 'A'); | 300 | mData[i] += (U8)(10 + in_string[cur_pos] - 'A'); |
290 | } | 301 | } |
291 | else | 302 | else |
292 | { | 303 | { |
@@ -305,20 +316,11 @@ BOOL LLUUID::set(const char *in_string, BOOL emit) | |||
305 | 316 | ||
306 | BOOL LLUUID::validate(const std::string& in_string) | 317 | BOOL LLUUID::validate(const std::string& in_string) |
307 | { | 318 | { |
308 | return validate(in_string.c_str()); | ||
309 | } | ||
310 | |||
311 | BOOL LLUUID::validate(const char *in_string) | ||
312 | { | ||
313 | BOOL broken_format = FALSE; | 319 | BOOL broken_format = FALSE; |
314 | if (!in_string) | 320 | if (in_string.length() != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ |
315 | { | ||
316 | return FALSE; | ||
317 | } | ||
318 | if (strlen(in_string) != (UUID_STR_LENGTH - 1)) /* Flawfinder: ignore */ | ||
319 | { | 321 | { |
320 | // I'm a moron. First implementation didn't have the right UUID format. | 322 | // I'm a moron. First implementation didn't have the right UUID format. |
321 | if (strlen(in_string) == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ | 323 | if (in_string.length() == (UUID_STR_LENGTH - 2)) /* Flawfinder: ignore */ |
322 | { | 324 | { |
323 | broken_format = TRUE; | 325 | broken_format = TRUE; |
324 | } | 326 | } |
@@ -329,8 +331,7 @@ BOOL LLUUID::validate(const char *in_string) | |||
329 | } | 331 | } |
330 | 332 | ||
331 | U8 cur_pos = 0; | 333 | U8 cur_pos = 0; |
332 | U32 i; | 334 | for (U32 i = 0; i < 16; i++) |
333 | for (i = 0; i < 16; i++) | ||
334 | { | 335 | { |
335 | if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) | 336 | if ((i == 4) || (i == 6) || (i == 8) || (i == 10)) |
336 | { | 337 | { |
@@ -342,13 +343,13 @@ BOOL LLUUID::validate(const char *in_string) | |||
342 | } | 343 | } |
343 | } | 344 | } |
344 | 345 | ||
345 | if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) | 346 | if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) |
346 | { | 347 | { |
347 | } | 348 | } |
348 | else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) | 349 | else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) |
349 | { | 350 | { |
350 | } | 351 | } |
351 | else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) | 352 | else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) |
352 | { | 353 | { |
353 | } | 354 | } |
354 | else | 355 | else |
@@ -358,13 +359,13 @@ BOOL LLUUID::validate(const char *in_string) | |||
358 | 359 | ||
359 | cur_pos++; | 360 | cur_pos++; |
360 | 361 | ||
361 | if ((*(in_string + cur_pos) >= '0') && (*(in_string+cur_pos) <= '9')) | 362 | if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9')) |
362 | { | 363 | { |
363 | } | 364 | } |
364 | else if ((*(in_string + cur_pos) >= 'a') && (*(in_string+cur_pos) <='f')) | 365 | else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f')) |
365 | { | 366 | { |
366 | } | 367 | } |
367 | else if ((*(in_string + cur_pos) >= 'A') && (*(in_string+cur_pos) <='F')) | 368 | else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F')) |
368 | { | 369 | { |
369 | } | 370 | } |
370 | else | 371 | else |
@@ -412,8 +413,7 @@ LLUUID LLUUID::combine(const LLUUID &other) const | |||
412 | 413 | ||
413 | std::ostream& operator<<(std::ostream& s, const LLUUID &uuid) | 414 | std::ostream& operator<<(std::ostream& s, const LLUUID &uuid) |
414 | { | 415 | { |
415 | char uuid_str[UUID_STR_LENGTH]; | 416 | std::string uuid_str; |
416 | |||
417 | uuid.toString(uuid_str); | 417 | uuid.toString(uuid_str); |
418 | s << uuid_str; | 418 | s << uuid_str; |
419 | return s; | 419 | return s; |
@@ -428,7 +428,7 @@ std::istream& operator>>(std::istream &s, LLUUID &uuid) | |||
428 | s >> uuid_str[i]; | 428 | s >> uuid_str[i]; |
429 | } | 429 | } |
430 | uuid_str[i] = '\0'; | 430 | uuid_str[i] = '\0'; |
431 | uuid.set(uuid_str); | 431 | uuid.set(std::string(uuid_str)); |
432 | return s; | 432 | return s; |
433 | } | 433 | } |
434 | 434 | ||
@@ -867,7 +867,7 @@ void LLUUID::generate() | |||
867 | time_last = timestamp; | 867 | time_last = timestamp; |
868 | } | 868 | } |
869 | 869 | ||
870 | void LLUUID::generate(std::string hash_string) | 870 | void LLUUID::generate(const std::string& hash_string) |
871 | { | 871 | { |
872 | LLMD5 md5_uuid((U8*)hash_string.c_str()); | 872 | LLMD5 md5_uuid((U8*)hash_string.c_str()); |
873 | md5_uuid.raw_digest(mData); | 873 | md5_uuid.raw_digest(mData); |
@@ -891,15 +891,15 @@ U32 LLUUID::getRandomSeed() | |||
891 | return(*(U32 *)seed); | 891 | return(*(U32 *)seed); |
892 | } | 892 | } |
893 | 893 | ||
894 | BOOL LLUUID::parseUUID(const char* buf, LLUUID* value) | 894 | BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value) |
895 | { | 895 | { |
896 | if( buf == NULL || buf[0] == '\0' || value == NULL) | 896 | if( buf.empty() || value == NULL) |
897 | { | 897 | { |
898 | return FALSE; | 898 | return FALSE; |
899 | } | 899 | } |
900 | 900 | ||
901 | LLString temp( buf ); | 901 | std::string temp( buf ); |
902 | LLString::trim(temp); | 902 | LLStringUtil::trim(temp); |
903 | if( LLUUID::validate( temp ) ) | 903 | if( LLUUID::validate( temp ) ) |
904 | { | 904 | { |
905 | value->set( temp ); | 905 | value->set( temp ); |
diff --git a/linden/indra/llmath/lluuid.h b/linden/indra/llcommon/lluuid.h index 48308f2..3b057fb 100644 --- a/linden/indra/llmath/lluuid.h +++ b/linden/indra/llcommon/lluuid.h | |||
@@ -64,7 +64,7 @@ public: | |||
64 | // MANIPULATORS | 64 | // MANIPULATORS |
65 | // | 65 | // |
66 | void generate(); // Generate a new UUID | 66 | void generate(); // Generate a new UUID |
67 | void generate(std::string stream); //Generate a new UUID based on hash of input stream | 67 | void generate(const std::string& stream); //Generate a new UUID based on hash of input stream |
68 | BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings | 68 | BOOL set(const char *in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings |
69 | BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings | 69 | BOOL set(const std::string& in_string, BOOL emit = TRUE); // Convert from string, if emit is FALSE, do not emit warnings |
70 | void setNull(); // Faster than setting to LLUUID::null. | 70 | void setNull(); // Faster than setting to LLUUID::null. |
@@ -106,7 +106,9 @@ public: | |||
106 | friend std::istream& operator>>(std::istream& s, LLUUID &uuid); | 106 | friend std::istream& operator>>(std::istream& s, LLUUID &uuid); |
107 | 107 | ||
108 | void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) | 108 | void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) |
109 | void toString(std::string& out) const; | ||
109 | void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) | 110 | void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) |
111 | void toCompressedString(std::string& out) const; | ||
110 | 112 | ||
111 | std::string asString() const; | 113 | std::string asString() const; |
112 | std::string getString() const; | 114 | std::string getString() const; |
@@ -115,14 +117,13 @@ public: | |||
115 | U32 getCRC32() const; | 117 | U32 getCRC32() const; |
116 | 118 | ||
117 | static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. | 119 | static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. |
118 | static BOOL validate(const char *in_string); // Validate that the UUID string is legal. | ||
119 | 120 | ||
120 | static const LLUUID null; | 121 | static const LLUUID null; |
121 | 122 | ||
122 | static U32 getRandomSeed(); | 123 | static U32 getRandomSeed(); |
123 | static S32 getNodeID(unsigned char * node_id); | 124 | static S32 getNodeID(unsigned char * node_id); |
124 | 125 | ||
125 | static BOOL parseUUID(const char* buf, LLUUID* value); | 126 | static BOOL parseUUID(const std::string& buf, LLUUID* value); |
126 | 127 | ||
127 | U8 mData[UUID_BYTES]; | 128 | U8 mData[UUID_BYTES]; |
128 | }; | 129 | }; |
diff --git a/linden/indra/llmath/CMakeLists.txt b/linden/indra/llmath/CMakeLists.txt new file mode 100644 index 0000000..6a329fa --- /dev/null +++ b/linden/indra/llmath/CMakeLists.txt | |||
@@ -0,0 +1,81 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | project(llmath) | ||
4 | |||
5 | include(00-Common) | ||
6 | include(LLCommon) | ||
7 | |||
8 | include_directories( | ||
9 | ${LLCOMMON_INCLUDE_DIRS} | ||
10 | ) | ||
11 | |||
12 | set(llmath_SOURCE_FILES | ||
13 | llbboxlocal.cpp | ||
14 | llcamera.cpp | ||
15 | llcoordframe.cpp | ||
16 | llline.cpp | ||
17 | llperlin.cpp | ||
18 | llquaternion.cpp | ||
19 | llrect.cpp | ||
20 | llsphere.cpp | ||
21 | llvolume.cpp | ||
22 | llvolumemgr.cpp | ||
23 | llsdutil_math.cpp | ||
24 | m3math.cpp | ||
25 | m4math.cpp | ||
26 | raytrace.cpp | ||
27 | v2math.cpp | ||
28 | v3color.cpp | ||
29 | v3dmath.cpp | ||
30 | v3math.cpp | ||
31 | v4color.cpp | ||
32 | v4coloru.cpp | ||
33 | v4math.cpp | ||
34 | xform.cpp | ||
35 | ) | ||
36 | |||
37 | set(llmath_HEADER_FILES | ||
38 | CMakeLists.txt | ||
39 | |||
40 | camera.h | ||
41 | coordframe.h | ||
42 | llbboxlocal.h | ||
43 | llcamera.h | ||
44 | llcoord.h | ||
45 | llcoordframe.h | ||
46 | llinterp.h | ||
47 | llline.h | ||
48 | llmath.h | ||
49 | lloctree.h | ||
50 | llperlin.h | ||
51 | llplane.h | ||
52 | llquantize.h | ||
53 | llquaternion.h | ||
54 | llrect.h | ||
55 | llsphere.h | ||
56 | lltreenode.h | ||
57 | llv4math.h | ||
58 | llv4matrix3.h | ||
59 | llv4matrix4.h | ||
60 | llv4vector3.h | ||
61 | llvolume.h | ||
62 | llvolumemgr.h | ||
63 | m3math.h | ||
64 | m4math.h | ||
65 | raytrace.h | ||
66 | v2math.h | ||
67 | v3color.h | ||
68 | v3dmath.h | ||
69 | v3math.h | ||
70 | v4color.h | ||
71 | v4coloru.h | ||
72 | v4math.h | ||
73 | xform.h | ||
74 | ) | ||
75 | |||
76 | set_source_files_properties(${llmath_HEADER_FILES} | ||
77 | PROPERTIES HEADER_FILE_ONLY TRUE) | ||
78 | |||
79 | list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES}) | ||
80 | |||
81 | add_library (llmath ${llmath_SOURCE_FILES}) | ||
diff --git a/linden/indra/llmath/files.lst b/linden/indra/llmath/files.lst deleted file mode 100644 index 1001a6d..0000000 --- a/linden/indra/llmath/files.lst +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | llmath/llbboxlocal.cpp | ||
2 | llmath/llcamera.cpp | ||
3 | llmath/llcoordframe.cpp | ||
4 | llmath/llcrc.cpp | ||
5 | llmath/llline.cpp | ||
6 | llmath/llmd5.cpp | ||
7 | llmath/llperlin.cpp | ||
8 | llmath/llquaternion.cpp | ||
9 | llmath/llrand.cpp | ||
10 | llmath/llrect.cpp | ||
11 | llmath/llsphere.cpp | ||
12 | llmath/lluuid.cpp | ||
13 | llmath/llvolume.cpp | ||
14 | llmath/llvolumemgr.cpp | ||
15 | llmath/m3math.cpp | ||
16 | llmath/m4math.cpp | ||
17 | llmath/raytrace.cpp | ||
18 | llmath/v2math.cpp | ||
19 | llmath/v3color.cpp | ||
20 | llmath/v3dmath.cpp | ||
21 | llmath/v3math.cpp | ||
22 | llmath/v4color.cpp | ||
23 | llmath/v4coloru.cpp | ||
24 | llmath/v4math.cpp | ||
25 | llmath/xform.cpp | ||
diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h index 7066b9f..2884338 100644 --- a/linden/indra/llmath/llcamera.h +++ b/linden/indra/llmath/llcamera.h | |||
@@ -115,11 +115,12 @@ protected: | |||
115 | LLPlane mWorldPlanes[PLANE_NUM]; | 115 | LLPlane mWorldPlanes[PLANE_NUM]; |
116 | LLPlane mHorizPlanes[HORIZ_PLANE_NUM]; | 116 | LLPlane mHorizPlanes[HORIZ_PLANE_NUM]; |
117 | 117 | ||
118 | typedef struct | 118 | struct frustum_plane |
119 | { | 119 | { |
120 | frustum_plane() : mask(0) {} | ||
120 | LLPlane p; | 121 | LLPlane p; |
121 | U8 mask; | 122 | U8 mask; |
122 | } frustum_plane; | 123 | }; |
123 | frustum_plane mAgentPlanes[7]; //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP | 124 | frustum_plane mAgentPlanes[7]; //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP |
124 | 125 | ||
125 | U32 mPlaneCount; //defaults to 6, if setUserClipPlane is called, uses user supplied clip plane in | 126 | U32 mPlaneCount; //defaults to 6, if setUserClipPlane is called, uses user supplied clip plane in |
diff --git a/linden/indra/llmath/llline.cpp b/linden/indra/llmath/llline.cpp index 9c41efb..cfd3f56 100644 --- a/linden/indra/llmath/llline.cpp +++ b/linden/indra/llmath/llline.cpp | |||
@@ -20,6 +20,8 @@ | |||
20 | * $/LicenseInfo$ | 20 | * $/LicenseInfo$ |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "linden_common.h" | ||
24 | |||
23 | #include "llline.h" | 25 | #include "llline.h" |
24 | #include "llrand.h" | 26 | #include "llrand.h" |
25 | 27 | ||
diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h index 4a6358d..82ab197 100644 --- a/linden/indra/llmath/llmath.h +++ b/linden/indra/llmath/llmath.h | |||
@@ -33,9 +33,10 @@ | |||
33 | #define LLMATH_H | 33 | #define LLMATH_H |
34 | 34 | ||
35 | #include <cmath> | 35 | #include <cmath> |
36 | //#include <math.h> | 36 | #include <cstdlib> |
37 | //#include <stdlib.h> | ||
38 | #include "lldefs.h" | 37 | #include "lldefs.h" |
38 | #include "llstl.h" // *TODO: Remove when LLString is gone | ||
39 | #include "llstring.h" // *TODO: Remove when LLString is gone | ||
39 | 40 | ||
40 | // work around for Windows & older gcc non-standard function names. | 41 | // work around for Windows & older gcc non-standard function names. |
41 | #if LL_WINDOWS | 42 | #if LL_WINDOWS |
@@ -93,6 +94,9 @@ const F32 F_APPROXIMATELY_ZERO = 0.00001f; | |||
93 | const F32 F_LN2 = 0.69314718056f; | 94 | const F32 F_LN2 = 0.69314718056f; |
94 | const F32 OO_LN2 = 1.4426950408889634073599246810019f; | 95 | const F32 OO_LN2 = 1.4426950408889634073599246810019f; |
95 | 96 | ||
97 | const F32 F_ALMOST_ZERO = 0.0001f; | ||
98 | const F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO; | ||
99 | |||
96 | // BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above? | 100 | // BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above? |
97 | const F32 FP_MAG_THRESHOLD = 0.0000001f; | 101 | const F32 FP_MAG_THRESHOLD = 0.0000001f; |
98 | 102 | ||
@@ -102,13 +106,13 @@ inline BOOL is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < | |||
102 | inline BOOL is_approx_equal(F32 x, F32 y) | 106 | inline BOOL is_approx_equal(F32 x, F32 y) |
103 | { | 107 | { |
104 | const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; | 108 | const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; |
105 | return (abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); | 109 | return (std::abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); |
106 | } | 110 | } |
107 | 111 | ||
108 | inline BOOL is_approx_equal(F64 x, F64 y) | 112 | inline BOOL is_approx_equal(F64 x, F64 y) |
109 | { | 113 | { |
110 | const S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; | 114 | const S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02; |
111 | return (abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); | 115 | return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT); |
112 | } | 116 | } |
113 | 117 | ||
114 | inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) | 118 | inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits) |
@@ -155,17 +159,17 @@ inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits) | |||
155 | 159 | ||
156 | inline S32 llabs(const S32 a) | 160 | inline S32 llabs(const S32 a) |
157 | { | 161 | { |
158 | return S32(labs(a)); | 162 | return S32(std::labs(a)); |
159 | } | 163 | } |
160 | 164 | ||
161 | inline F32 llabs(const F32 a) | 165 | inline F32 llabs(const F32 a) |
162 | { | 166 | { |
163 | return F32(fabs(a)); | 167 | return F32(std::fabs(a)); |
164 | } | 168 | } |
165 | 169 | ||
166 | inline F64 llabs(const F64 a) | 170 | inline F64 llabs(const F64 a) |
167 | { | 171 | { |
168 | return F64(fabs(a)); | 172 | return F64(std::fabs(a)); |
169 | } | 173 | } |
170 | 174 | ||
171 | inline S32 lltrunc( F32 f ) | 175 | inline S32 lltrunc( F32 f ) |
@@ -473,8 +477,8 @@ inline F32 llsimple_angle(F32 angle) | |||
473 | return angle; | 477 | return angle; |
474 | } | 478 | } |
475 | 479 | ||
476 | //calculate the nearesr power of two number for val, bounded by max_power_two | 480 | //SDK - Renamed this to get_lower_power_two, since this is what this actually does. |
477 | inline U32 get_nearest_power_two(U32 val, U32 max_power_two) | 481 | inline U32 get_lower_power_two(U32 val, U32 max_power_two) |
478 | { | 482 | { |
479 | if(!max_power_two) | 483 | if(!max_power_two) |
480 | { | 484 | { |
@@ -489,4 +493,34 @@ inline U32 get_nearest_power_two(U32 val, U32 max_power_two) | |||
489 | 493 | ||
490 | return max_power_two ; | 494 | return max_power_two ; |
491 | } | 495 | } |
496 | |||
497 | // calculate next highest power of two, limited by max_power_two | ||
498 | // This is taken from a brilliant little code snipped on http://acius2.blogspot.com/2007/11/calculating-next-power-of-2.html | ||
499 | // Basically we convert the binary to a solid string of 1's with the same | ||
500 | // number of digits, then add one. We subtract 1 initially to handle | ||
501 | // the case where the number passed in is actually a power of two. | ||
502 | // WARNING: this only works with 32 bit ints. | ||
503 | inline U32 get_next_power_two(U32 val, U32 max_power_two) | ||
504 | { | ||
505 | if(!max_power_two) | ||
506 | { | ||
507 | max_power_two = 1 << 31 ; | ||
508 | } | ||
509 | |||
510 | if(val >= max_power_two) | ||
511 | { | ||
512 | return max_power_two; | ||
513 | } | ||
514 | |||
515 | val--; | ||
516 | val = (val >> 1) | val; | ||
517 | val = (val >> 2) | val; | ||
518 | val = (val >> 4) | val; | ||
519 | val = (val >> 8) | val; | ||
520 | val = (val >> 16) | val; | ||
521 | val++; | ||
522 | |||
523 | return val; | ||
524 | } | ||
525 | |||
492 | #endif | 526 | #endif |
diff --git a/linden/indra/llmath/llmath.vcproj b/linden/indra/llmath/llmath.vcproj deleted file mode 100644 index d05505e..0000000 --- a/linden/indra/llmath/llmath.vcproj +++ /dev/null | |||
@@ -1,348 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="7.10" | ||
5 | Name="llmath" | ||
6 | ProjectGUID="{E87FD9BE-BE42-4EA3-BF4D-D992223046D9}" | ||
7 | Keyword="Win32Proj"> | ||
8 | <Platforms> | ||
9 | <Platform | ||
10 | Name="Win32"/> | ||
11 | </Platforms> | ||
12 | <Configurations> | ||
13 | <Configuration | ||
14 | Name="Debug|Win32" | ||
15 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
16 | IntermediateDirectory="$(ConfigurationName)" | ||
17 | ConfigurationType="4" | ||
18 | CharacterSet="1"> | ||
19 | <Tool | ||
20 | Name="VCCLCompilerTool" | ||
21 | Optimization="0" | ||
22 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
23 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG" | ||
24 | MinimalRebuild="TRUE" | ||
25 | BasicRuntimeChecks="3" | ||
26 | RuntimeLibrary="1" | ||
27 | StructMemberAlignment="4" | ||
28 | ForceConformanceInForLoopScope="TRUE" | ||
29 | UsePrecompiledHeader="0" | ||
30 | WarningLevel="3" | ||
31 | WarnAsError="TRUE" | ||
32 | Detect64BitPortabilityProblems="FALSE" | ||
33 | DebugInformationFormat="4"/> | ||
34 | <Tool | ||
35 | Name="VCCustomBuildTool"/> | ||
36 | <Tool | ||
37 | Name="VCLibrarianTool" | ||
38 | OutputFile="$(OutDir)/llmath.lib"/> | ||
39 | <Tool | ||
40 | Name="VCMIDLTool"/> | ||
41 | <Tool | ||
42 | Name="VCPostBuildEventTool"/> | ||
43 | <Tool | ||
44 | Name="VCPreBuildEventTool"/> | ||
45 | <Tool | ||
46 | Name="VCPreLinkEventTool"/> | ||
47 | <Tool | ||
48 | Name="VCResourceCompilerTool"/> | ||
49 | <Tool | ||
50 | Name="VCWebServiceProxyGeneratorTool"/> | ||
51 | <Tool | ||
52 | Name="VCXMLDataGeneratorTool"/> | ||
53 | <Tool | ||
54 | Name="VCManagedWrapperGeneratorTool"/> | ||
55 | <Tool | ||
56 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
57 | </Configuration> | ||
58 | <Configuration | ||
59 | Name="Release|Win32" | ||
60 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
61 | IntermediateDirectory="$(ConfigurationName)" | ||
62 | ConfigurationType="4" | ||
63 | CharacterSet="1"> | ||
64 | <Tool | ||
65 | Name="VCCLCompilerTool" | ||
66 | AdditionalOptions="/Oy-" | ||
67 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
68 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" | ||
69 | RuntimeLibrary="0" | ||
70 | StructMemberAlignment="0" | ||
71 | ForceConformanceInForLoopScope="TRUE" | ||
72 | UsePrecompiledHeader="0" | ||
73 | WarningLevel="3" | ||
74 | WarnAsError="TRUE" | ||
75 | Detect64BitPortabilityProblems="FALSE" | ||
76 | DebugInformationFormat="3"/> | ||
77 | <Tool | ||
78 | Name="VCCustomBuildTool"/> | ||
79 | <Tool | ||
80 | Name="VCLibrarianTool" | ||
81 | OutputFile="$(OutDir)/llmath.lib"/> | ||
82 | <Tool | ||
83 | Name="VCMIDLTool"/> | ||
84 | <Tool | ||
85 | Name="VCPostBuildEventTool"/> | ||
86 | <Tool | ||
87 | Name="VCPreBuildEventTool"/> | ||
88 | <Tool | ||
89 | Name="VCPreLinkEventTool"/> | ||
90 | <Tool | ||
91 | Name="VCResourceCompilerTool"/> | ||
92 | <Tool | ||
93 | Name="VCWebServiceProxyGeneratorTool"/> | ||
94 | <Tool | ||
95 | Name="VCXMLDataGeneratorTool"/> | ||
96 | <Tool | ||
97 | Name="VCManagedWrapperGeneratorTool"/> | ||
98 | <Tool | ||
99 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
100 | </Configuration> | ||
101 | <Configuration | ||
102 | Name="ReleaseNoOpt|Win32" | ||
103 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
104 | IntermediateDirectory="$(ConfigurationName)" | ||
105 | ConfigurationType="4" | ||
106 | CharacterSet="1"> | ||
107 | <Tool | ||
108 | Name="VCCLCompilerTool" | ||
109 | AdditionalOptions="/Oy-" | ||
110 | Optimization="0" | ||
111 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
112 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" | ||
113 | RuntimeLibrary="0" | ||
114 | StructMemberAlignment="0" | ||
115 | ForceConformanceInForLoopScope="TRUE" | ||
116 | UsePrecompiledHeader="0" | ||
117 | BrowseInformation="0" | ||
118 | WarningLevel="3" | ||
119 | WarnAsError="TRUE" | ||
120 | Detect64BitPortabilityProblems="FALSE" | ||
121 | DebugInformationFormat="3"/> | ||
122 | <Tool | ||
123 | Name="VCCustomBuildTool"/> | ||
124 | <Tool | ||
125 | Name="VCLibrarianTool" | ||
126 | OutputFile="$(OutDir)/llmath.lib"/> | ||
127 | <Tool | ||
128 | Name="VCMIDLTool"/> | ||
129 | <Tool | ||
130 | Name="VCPostBuildEventTool"/> | ||
131 | <Tool | ||
132 | Name="VCPreBuildEventTool"/> | ||
133 | <Tool | ||
134 | Name="VCPreLinkEventTool"/> | ||
135 | <Tool | ||
136 | Name="VCResourceCompilerTool"/> | ||
137 | <Tool | ||
138 | Name="VCWebServiceProxyGeneratorTool"/> | ||
139 | <Tool | ||
140 | Name="VCXMLDataGeneratorTool"/> | ||
141 | <Tool | ||
142 | Name="VCManagedWrapperGeneratorTool"/> | ||
143 | <Tool | ||
144 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
145 | </Configuration> | ||
146 | </Configurations> | ||
147 | <References> | ||
148 | </References> | ||
149 | <Files> | ||
150 | <Filter | ||
151 | Name="Source Files" | ||
152 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
153 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> | ||
154 | <File | ||
155 | RelativePath=".\llbboxlocal.cpp"> | ||
156 | </File> | ||
157 | <File | ||
158 | RelativePath=".\llcamera.cpp"> | ||
159 | </File> | ||
160 | <File | ||
161 | RelativePath=".\llcoordframe.cpp"> | ||
162 | </File> | ||
163 | <File | ||
164 | RelativePath=".\llcrc.cpp"> | ||
165 | </File> | ||
166 | <File | ||
167 | RelativePath=".\llline.cpp"> | ||
168 | </File> | ||
169 | <File | ||
170 | RelativePath=".\llmd5.cpp"> | ||
171 | </File> | ||
172 | <File | ||
173 | RelativePath=".\llperlin.cpp"> | ||
174 | </File> | ||
175 | <File | ||
176 | RelativePath=".\llquaternion.cpp"> | ||
177 | </File> | ||
178 | <File | ||
179 | RelativePath=".\llrand.cpp"> | ||
180 | </File> | ||
181 | <File | ||
182 | RelativePath=".\llrect.cpp"> | ||
183 | </File> | ||
184 | <File | ||
185 | RelativePath=".\llsphere.cpp"> | ||
186 | </File> | ||
187 | <File | ||
188 | RelativePath=".\lluuid.cpp"> | ||
189 | </File> | ||
190 | <File | ||
191 | RelativePath=".\llvolume.cpp"> | ||
192 | </File> | ||
193 | <File | ||
194 | RelativePath=".\llvolumemgr.cpp"> | ||
195 | </File> | ||
196 | <File | ||
197 | RelativePath=".\m3math.cpp"> | ||
198 | </File> | ||
199 | <File | ||
200 | RelativePath=".\m4math.cpp"> | ||
201 | </File> | ||
202 | <File | ||
203 | RelativePath=".\raytrace.cpp"> | ||
204 | </File> | ||
205 | <File | ||
206 | RelativePath=".\v2math.cpp"> | ||
207 | </File> | ||
208 | <File | ||
209 | RelativePath=".\v3color.cpp"> | ||
210 | </File> | ||
211 | <File | ||
212 | RelativePath=".\v3dmath.cpp"> | ||
213 | </File> | ||
214 | <File | ||
215 | RelativePath=".\v3math.cpp"> | ||
216 | </File> | ||
217 | <File | ||
218 | RelativePath=".\v4color.cpp"> | ||
219 | </File> | ||
220 | <File | ||
221 | RelativePath=".\v4coloru.cpp"> | ||
222 | </File> | ||
223 | <File | ||
224 | RelativePath=".\v4math.cpp"> | ||
225 | </File> | ||
226 | <File | ||
227 | RelativePath=".\xform.cpp"> | ||
228 | </File> | ||
229 | </Filter> | ||
230 | <Filter | ||
231 | Name="Header Files" | ||
232 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
233 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> | ||
234 | <File | ||
235 | RelativePath=".\llbboxlocal.h"> | ||
236 | </File> | ||
237 | <File | ||
238 | RelativePath=".\llcamera.h"> | ||
239 | </File> | ||
240 | <File | ||
241 | RelativePath=".\llcoord.h"> | ||
242 | </File> | ||
243 | <File | ||
244 | RelativePath=".\llcoordframe.h"> | ||
245 | </File> | ||
246 | <File | ||
247 | RelativePath=".\llcrc.h"> | ||
248 | </File> | ||
249 | <File | ||
250 | RelativePath=".\llinterp.h"> | ||
251 | </File> | ||
252 | <File | ||
253 | RelativePath=".\llline.h"> | ||
254 | </File> | ||
255 | <File | ||
256 | RelativePath=".\llmath.h"> | ||
257 | </File> | ||
258 | <File | ||
259 | RelativePath=".\llmd5.h"> | ||
260 | </File> | ||
261 | <File | ||
262 | RelativePath=".\lloctree.h"> | ||
263 | </File> | ||
264 | <File | ||
265 | RelativePath=".\llperlin.h"> | ||
266 | </File> | ||
267 | <File | ||
268 | RelativePath=".\llquantize.h"> | ||
269 | </File> | ||
270 | <File | ||
271 | RelativePath=".\llquaternion.h"> | ||
272 | </File> | ||
273 | <File | ||
274 | RelativePath=".\llrand.h"> | ||
275 | </File> | ||
276 | <File | ||
277 | RelativePath=".\llrect.h"> | ||
278 | </File> | ||
279 | <File | ||
280 | RelativePath=".\llsphere.h"> | ||
281 | </File> | ||
282 | <File | ||
283 | RelativePath=".\lltreenode.h"> | ||
284 | </File> | ||
285 | <File | ||
286 | RelativePath=".\lluuid.h"> | ||
287 | </File> | ||
288 | <File | ||
289 | RelativePath=".\llv4math.h"> | ||
290 | </File> | ||
291 | <File | ||
292 | RelativePath=".\llv4matrix3.h"> | ||
293 | </File> | ||
294 | <File | ||
295 | RelativePath=".\llv4matrix4.h"> | ||
296 | </File> | ||
297 | <File | ||
298 | RelativePath=".\llv4vector3.h"> | ||
299 | </File> | ||
300 | <File | ||
301 | RelativePath=".\llvolume.h"> | ||
302 | </File> | ||
303 | <File | ||
304 | RelativePath=".\llvolumemgr.h"> | ||
305 | </File> | ||
306 | <File | ||
307 | RelativePath=".\m3math.h"> | ||
308 | </File> | ||
309 | <File | ||
310 | RelativePath=".\m4math.h"> | ||
311 | </File> | ||
312 | <File | ||
313 | RelativePath=".\raytrace.h"> | ||
314 | </File> | ||
315 | <File | ||
316 | RelativePath=".\v2math.h"> | ||
317 | </File> | ||
318 | <File | ||
319 | RelativePath=".\v3color.h"> | ||
320 | </File> | ||
321 | <File | ||
322 | RelativePath=".\v3dmath.h"> | ||
323 | </File> | ||
324 | <File | ||
325 | RelativePath=".\v3math.h"> | ||
326 | </File> | ||
327 | <File | ||
328 | RelativePath=".\v4color.h"> | ||
329 | </File> | ||
330 | <File | ||
331 | RelativePath=".\v4coloru.h"> | ||
332 | </File> | ||
333 | <File | ||
334 | RelativePath=".\v4math.h"> | ||
335 | </File> | ||
336 | <File | ||
337 | RelativePath=".\xform.h"> | ||
338 | </File> | ||
339 | </Filter> | ||
340 | <Filter | ||
341 | Name="Resource Files" | ||
342 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
343 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> | ||
344 | </Filter> | ||
345 | </Files> | ||
346 | <Globals> | ||
347 | </Globals> | ||
348 | </VisualStudioProject> | ||
diff --git a/linden/indra/llmath/llmath_vc8.vcproj b/linden/indra/llmath/llmath_vc8.vcproj deleted file mode 100644 index 3b4413a..0000000 --- a/linden/indra/llmath/llmath_vc8.vcproj +++ /dev/null | |||
@@ -1,488 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="8.00" | ||
5 | Name="llmath" | ||
6 | ProjectGUID="{E87FD9BE-BE42-4EA3-BF4D-D992223046D9}" | ||
7 | RootNamespace="llmath" | ||
8 | Keyword="Win32Proj" | ||
9 | > | ||
10 | <Platforms> | ||
11 | <Platform | ||
12 | Name="Win32" | ||
13 | /> | ||
14 | </Platforms> | ||
15 | <ToolFiles> | ||
16 | </ToolFiles> | ||
17 | <Configurations> | ||
18 | <Configuration | ||
19 | Name="Debug|Win32" | ||
20 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
21 | IntermediateDirectory="$(ConfigurationName)" | ||
22 | ConfigurationType="4" | ||
23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
24 | CharacterSet="1" | ||
25 | > | ||
26 | <Tool | ||
27 | Name="VCPreBuildEventTool" | ||
28 | /> | ||
29 | <Tool | ||
30 | Name="VCCustomBuildTool" | ||
31 | /> | ||
32 | <Tool | ||
33 | Name="VCXMLDataGeneratorTool" | ||
34 | /> | ||
35 | <Tool | ||
36 | Name="VCWebServiceProxyGeneratorTool" | ||
37 | /> | ||
38 | <Tool | ||
39 | Name="VCMIDLTool" | ||
40 | /> | ||
41 | <Tool | ||
42 | Name="VCCLCompilerTool" | ||
43 | Optimization="0" | ||
44 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
45 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG" | ||
46 | MinimalRebuild="true" | ||
47 | BasicRuntimeChecks="3" | ||
48 | RuntimeLibrary="1" | ||
49 | StructMemberAlignment="4" | ||
50 | TreatWChar_tAsBuiltInType="false" | ||
51 | ForceConformanceInForLoopScope="true" | ||
52 | UsePrecompiledHeader="0" | ||
53 | WarningLevel="3" | ||
54 | WarnAsError="true" | ||
55 | Detect64BitPortabilityProblems="false" | ||
56 | DebugInformationFormat="4" | ||
57 | /> | ||
58 | <Tool | ||
59 | Name="VCManagedResourceCompilerTool" | ||
60 | /> | ||
61 | <Tool | ||
62 | Name="VCResourceCompilerTool" | ||
63 | /> | ||
64 | <Tool | ||
65 | Name="VCPreLinkEventTool" | ||
66 | /> | ||
67 | <Tool | ||
68 | Name="VCLibrarianTool" | ||
69 | OutputFile="$(OutDir)/llmath.lib" | ||
70 | /> | ||
71 | <Tool | ||
72 | Name="VCALinkTool" | ||
73 | /> | ||
74 | <Tool | ||
75 | Name="VCXDCMakeTool" | ||
76 | /> | ||
77 | <Tool | ||
78 | Name="VCBscMakeTool" | ||
79 | /> | ||
80 | <Tool | ||
81 | Name="VCFxCopTool" | ||
82 | /> | ||
83 | <Tool | ||
84 | Name="VCPostBuildEventTool" | ||
85 | /> | ||
86 | </Configuration> | ||
87 | <Configuration | ||
88 | Name="Release|Win32" | ||
89 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
90 | IntermediateDirectory="$(ConfigurationName)" | ||
91 | ConfigurationType="4" | ||
92 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
93 | CharacterSet="1" | ||
94 | > | ||
95 | <Tool | ||
96 | Name="VCPreBuildEventTool" | ||
97 | /> | ||
98 | <Tool | ||
99 | Name="VCCustomBuildTool" | ||
100 | /> | ||
101 | <Tool | ||
102 | Name="VCXMLDataGeneratorTool" | ||
103 | /> | ||
104 | <Tool | ||
105 | Name="VCWebServiceProxyGeneratorTool" | ||
106 | /> | ||
107 | <Tool | ||
108 | Name="VCMIDLTool" | ||
109 | /> | ||
110 | <Tool | ||
111 | Name="VCCLCompilerTool" | ||
112 | AdditionalOptions="/Oy-" | ||
113 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
114 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
115 | RuntimeLibrary="0" | ||
116 | StructMemberAlignment="0" | ||
117 | TreatWChar_tAsBuiltInType="false" | ||
118 | ForceConformanceInForLoopScope="true" | ||
119 | UsePrecompiledHeader="0" | ||
120 | WarningLevel="3" | ||
121 | WarnAsError="true" | ||
122 | Detect64BitPortabilityProblems="false" | ||
123 | DebugInformationFormat="3" | ||
124 | /> | ||
125 | <Tool | ||
126 | Name="VCManagedResourceCompilerTool" | ||
127 | /> | ||
128 | <Tool | ||
129 | Name="VCResourceCompilerTool" | ||
130 | /> | ||
131 | <Tool | ||
132 | Name="VCPreLinkEventTool" | ||
133 | /> | ||
134 | <Tool | ||
135 | Name="VCLibrarianTool" | ||
136 | OutputFile="$(OutDir)/llmath.lib" | ||
137 | /> | ||
138 | <Tool | ||
139 | Name="VCALinkTool" | ||
140 | /> | ||
141 | <Tool | ||
142 | Name="VCXDCMakeTool" | ||
143 | /> | ||
144 | <Tool | ||
145 | Name="VCBscMakeTool" | ||
146 | /> | ||
147 | <Tool | ||
148 | Name="VCFxCopTool" | ||
149 | /> | ||
150 | <Tool | ||
151 | Name="VCPostBuildEventTool" | ||
152 | /> | ||
153 | </Configuration> | ||
154 | <Configuration | ||
155 | Name="ReleaseNoOpt|Win32" | ||
156 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
157 | IntermediateDirectory="$(ConfigurationName)" | ||
158 | ConfigurationType="4" | ||
159 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
160 | CharacterSet="1" | ||
161 | > | ||
162 | <Tool | ||
163 | Name="VCPreBuildEventTool" | ||
164 | /> | ||
165 | <Tool | ||
166 | Name="VCCustomBuildTool" | ||
167 | /> | ||
168 | <Tool | ||
169 | Name="VCXMLDataGeneratorTool" | ||
170 | /> | ||
171 | <Tool | ||
172 | Name="VCWebServiceProxyGeneratorTool" | ||
173 | /> | ||
174 | <Tool | ||
175 | Name="VCMIDLTool" | ||
176 | /> | ||
177 | <Tool | ||
178 | Name="VCCLCompilerTool" | ||
179 | AdditionalOptions="/Oy-" | ||
180 | Optimization="0" | ||
181 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
182 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
183 | RuntimeLibrary="0" | ||
184 | StructMemberAlignment="0" | ||
185 | TreatWChar_tAsBuiltInType="false" | ||
186 | ForceConformanceInForLoopScope="true" | ||
187 | UsePrecompiledHeader="0" | ||
188 | BrowseInformation="0" | ||
189 | WarningLevel="3" | ||
190 | WarnAsError="true" | ||
191 | Detect64BitPortabilityProblems="false" | ||
192 | DebugInformationFormat="3" | ||
193 | /> | ||
194 | <Tool | ||
195 | Name="VCManagedResourceCompilerTool" | ||
196 | /> | ||
197 | <Tool | ||
198 | Name="VCResourceCompilerTool" | ||
199 | /> | ||
200 | <Tool | ||
201 | Name="VCPreLinkEventTool" | ||
202 | /> | ||
203 | <Tool | ||
204 | Name="VCLibrarianTool" | ||
205 | OutputFile="$(OutDir)/llmath.lib" | ||
206 | /> | ||
207 | <Tool | ||
208 | Name="VCALinkTool" | ||
209 | /> | ||
210 | <Tool | ||
211 | Name="VCXDCMakeTool" | ||
212 | /> | ||
213 | <Tool | ||
214 | Name="VCBscMakeTool" | ||
215 | /> | ||
216 | <Tool | ||
217 | Name="VCFxCopTool" | ||
218 | /> | ||
219 | <Tool | ||
220 | Name="VCPostBuildEventTool" | ||
221 | /> | ||
222 | </Configuration> | ||
223 | </Configurations> | ||
224 | <References> | ||
225 | </References> | ||
226 | <Files> | ||
227 | <Filter | ||
228 | Name="Source Files" | ||
229 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
230 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
231 | > | ||
232 | <File | ||
233 | RelativePath=".\llbboxlocal.cpp" | ||
234 | > | ||
235 | </File> | ||
236 | <File | ||
237 | RelativePath=".\llcamera.cpp" | ||
238 | > | ||
239 | </File> | ||
240 | <File | ||
241 | RelativePath=".\llcoordframe.cpp" | ||
242 | > | ||
243 | </File> | ||
244 | <File | ||
245 | RelativePath=".\llcrc.cpp" | ||
246 | > | ||
247 | </File> | ||
248 | <File | ||
249 | RelativePath=".\llline.cpp" | ||
250 | > | ||
251 | </File> | ||
252 | <File | ||
253 | RelativePath=".\llmd5.cpp" | ||
254 | > | ||
255 | </File> | ||
256 | <File | ||
257 | RelativePath=".\llperlin.cpp" | ||
258 | > | ||
259 | </File> | ||
260 | <File | ||
261 | RelativePath=".\llquaternion.cpp" | ||
262 | > | ||
263 | </File> | ||
264 | <File | ||
265 | RelativePath=".\llrand.cpp" | ||
266 | > | ||
267 | </File> | ||
268 | <File | ||
269 | RelativePath=".\llrect.cpp" | ||
270 | > | ||
271 | </File> | ||
272 | <File | ||
273 | RelativePath=".\llsphere.cpp" | ||
274 | > | ||
275 | </File> | ||
276 | <File | ||
277 | RelativePath=".\lluuid.cpp" | ||
278 | > | ||
279 | </File> | ||
280 | <File | ||
281 | RelativePath=".\llvolume.cpp" | ||
282 | > | ||
283 | </File> | ||
284 | <File | ||
285 | RelativePath=".\llvolumemgr.cpp" | ||
286 | > | ||
287 | </File> | ||
288 | <File | ||
289 | RelativePath=".\m3math.cpp" | ||
290 | > | ||
291 | </File> | ||
292 | <File | ||
293 | RelativePath=".\m4math.cpp" | ||
294 | > | ||
295 | </File> | ||
296 | <File | ||
297 | RelativePath=".\raytrace.cpp" | ||
298 | > | ||
299 | </File> | ||
300 | <File | ||
301 | RelativePath=".\v2math.cpp" | ||
302 | > | ||
303 | </File> | ||
304 | <File | ||
305 | RelativePath=".\v3color.cpp" | ||
306 | > | ||
307 | </File> | ||
308 | <File | ||
309 | RelativePath=".\v3dmath.cpp" | ||
310 | > | ||
311 | </File> | ||
312 | <File | ||
313 | RelativePath=".\v3math.cpp" | ||
314 | > | ||
315 | </File> | ||
316 | <File | ||
317 | RelativePath=".\v4color.cpp" | ||
318 | > | ||
319 | </File> | ||
320 | <File | ||
321 | RelativePath=".\v4coloru.cpp" | ||
322 | > | ||
323 | </File> | ||
324 | <File | ||
325 | RelativePath=".\v4math.cpp" | ||
326 | > | ||
327 | </File> | ||
328 | <File | ||
329 | RelativePath=".\xform.cpp" | ||
330 | > | ||
331 | </File> | ||
332 | </Filter> | ||
333 | <Filter | ||
334 | Name="Header Files" | ||
335 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
336 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
337 | > | ||
338 | <File | ||
339 | RelativePath=".\llbboxlocal.h" | ||
340 | > | ||
341 | </File> | ||
342 | <File | ||
343 | RelativePath=".\llcamera.h" | ||
344 | > | ||
345 | </File> | ||
346 | <File | ||
347 | RelativePath=".\llcoord.h" | ||
348 | > | ||
349 | </File> | ||
350 | <File | ||
351 | RelativePath=".\llcoordframe.h" | ||
352 | > | ||
353 | </File> | ||
354 | <File | ||
355 | RelativePath=".\llcrc.h" | ||
356 | > | ||
357 | </File> | ||
358 | <File | ||
359 | RelativePath=".\llinterp.h" | ||
360 | > | ||
361 | </File> | ||
362 | <File | ||
363 | RelativePath=".\llline.h" | ||
364 | > | ||
365 | </File> | ||
366 | <File | ||
367 | RelativePath=".\llmath.h" | ||
368 | > | ||
369 | </File> | ||
370 | <File | ||
371 | RelativePath=".\llmd5.h" | ||
372 | > | ||
373 | </File> | ||
374 | <File | ||
375 | RelativePath=".\lloctree.h" | ||
376 | > | ||
377 | </File> | ||
378 | <File | ||
379 | RelativePath=".\llperlin.h" | ||
380 | > | ||
381 | </File> | ||
382 | <File | ||
383 | RelativePath=".\llquantize.h" | ||
384 | > | ||
385 | </File> | ||
386 | <File | ||
387 | RelativePath=".\llquaternion.h" | ||
388 | > | ||
389 | </File> | ||
390 | <File | ||
391 | RelativePath=".\llrand.h" | ||
392 | > | ||
393 | </File> | ||
394 | <File | ||
395 | RelativePath=".\llrect.h" | ||
396 | > | ||
397 | </File> | ||
398 | <File | ||
399 | RelativePath=".\llsphere.h" | ||
400 | > | ||
401 | </File> | ||
402 | <File | ||
403 | RelativePath=".\lltreenode.h" | ||
404 | > | ||
405 | </File> | ||
406 | <File | ||
407 | RelativePath=".\lluuid.h" | ||
408 | > | ||
409 | </File> | ||
410 | <File | ||
411 | RelativePath=".\llv4math.h" | ||
412 | > | ||
413 | </File> | ||
414 | <File | ||
415 | RelativePath=".\llv4matrix3.h" | ||
416 | > | ||
417 | </File> | ||
418 | <File | ||
419 | RelativePath=".\llv4matrix4.h" | ||
420 | > | ||
421 | </File> | ||
422 | <File | ||
423 | RelativePath=".\llv4vector3.h" | ||
424 | > | ||
425 | </File> | ||
426 | <File | ||
427 | RelativePath=".\llvolume.h" | ||
428 | > | ||
429 | </File> | ||
430 | <File | ||
431 | RelativePath=".\llvolumemgr.h" | ||
432 | > | ||
433 | </File> | ||
434 | <File | ||
435 | RelativePath=".\m3math.h" | ||
436 | > | ||
437 | </File> | ||
438 | <File | ||
439 | RelativePath=".\m4math.h" | ||
440 | > | ||
441 | </File> | ||
442 | <File | ||
443 | RelativePath=".\raytrace.h" | ||
444 | > | ||
445 | </File> | ||
446 | <File | ||
447 | RelativePath=".\v2math.h" | ||
448 | > | ||
449 | </File> | ||
450 | <File | ||
451 | RelativePath=".\v3color.h" | ||
452 | > | ||
453 | </File> | ||
454 | <File | ||
455 | RelativePath=".\v3dmath.h" | ||
456 | > | ||
457 | </File> | ||
458 | <File | ||
459 | RelativePath=".\v3math.h" | ||
460 | > | ||
461 | </File> | ||
462 | <File | ||
463 | RelativePath=".\v4color.h" | ||
464 | > | ||
465 | </File> | ||
466 | <File | ||
467 | RelativePath=".\v4coloru.h" | ||
468 | > | ||
469 | </File> | ||
470 | <File | ||
471 | RelativePath=".\v4math.h" | ||
472 | > | ||
473 | </File> | ||
474 | <File | ||
475 | RelativePath=".\xform.h" | ||
476 | > | ||
477 | </File> | ||
478 | </Filter> | ||
479 | <Filter | ||
480 | Name="Resource Files" | ||
481 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
482 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
483 | > | ||
484 | </Filter> | ||
485 | </Files> | ||
486 | <Globals> | ||
487 | </Globals> | ||
488 | </VisualStudioProject> | ||
diff --git a/linden/indra/llmath/llmath_vc9.vcproj b/linden/indra/llmath/llmath_vc9.vcproj deleted file mode 100644 index 03bc780..0000000 --- a/linden/indra/llmath/llmath_vc9.vcproj +++ /dev/null | |||
@@ -1,489 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="9.00" | ||
5 | Name="llmath" | ||
6 | ProjectGUID="{E87FD9BE-BE42-4EA3-BF4D-D992223046D9}" | ||
7 | RootNamespace="llmath" | ||
8 | Keyword="Win32Proj" | ||
9 | TargetFrameworkVersion="131072" | ||
10 | > | ||
11 | <Platforms> | ||
12 | <Platform | ||
13 | Name="Win32" | ||
14 | /> | ||
15 | </Platforms> | ||
16 | <ToolFiles> | ||
17 | </ToolFiles> | ||
18 | <Configurations> | ||
19 | <Configuration | ||
20 | Name="Debug|Win32" | ||
21 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
22 | IntermediateDirectory="$(ConfigurationName)" | ||
23 | ConfigurationType="4" | ||
24 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
25 | CharacterSet="1" | ||
26 | > | ||
27 | <Tool | ||
28 | Name="VCPreBuildEventTool" | ||
29 | /> | ||
30 | <Tool | ||
31 | Name="VCCustomBuildTool" | ||
32 | /> | ||
33 | <Tool | ||
34 | Name="VCXMLDataGeneratorTool" | ||
35 | /> | ||
36 | <Tool | ||
37 | Name="VCWebServiceProxyGeneratorTool" | ||
38 | /> | ||
39 | <Tool | ||
40 | Name="VCMIDLTool" | ||
41 | /> | ||
42 | <Tool | ||
43 | Name="VCCLCompilerTool" | ||
44 | Optimization="0" | ||
45 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
46 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG" | ||
47 | MinimalRebuild="true" | ||
48 | BasicRuntimeChecks="3" | ||
49 | RuntimeLibrary="1" | ||
50 | StructMemberAlignment="4" | ||
51 | TreatWChar_tAsBuiltInType="false" | ||
52 | ForceConformanceInForLoopScope="true" | ||
53 | UsePrecompiledHeader="0" | ||
54 | WarningLevel="3" | ||
55 | WarnAsError="true" | ||
56 | Detect64BitPortabilityProblems="false" | ||
57 | DebugInformationFormat="4" | ||
58 | /> | ||
59 | <Tool | ||
60 | Name="VCManagedResourceCompilerTool" | ||
61 | /> | ||
62 | <Tool | ||
63 | Name="VCResourceCompilerTool" | ||
64 | /> | ||
65 | <Tool | ||
66 | Name="VCPreLinkEventTool" | ||
67 | /> | ||
68 | <Tool | ||
69 | Name="VCLibrarianTool" | ||
70 | OutputFile="$(OutDir)/llmath.lib" | ||
71 | /> | ||
72 | <Tool | ||
73 | Name="VCALinkTool" | ||
74 | /> | ||
75 | <Tool | ||
76 | Name="VCXDCMakeTool" | ||
77 | /> | ||
78 | <Tool | ||
79 | Name="VCBscMakeTool" | ||
80 | /> | ||
81 | <Tool | ||
82 | Name="VCFxCopTool" | ||
83 | /> | ||
84 | <Tool | ||
85 | Name="VCPostBuildEventTool" | ||
86 | /> | ||
87 | </Configuration> | ||
88 | <Configuration | ||
89 | Name="Release|Win32" | ||
90 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
91 | IntermediateDirectory="$(ConfigurationName)" | ||
92 | ConfigurationType="4" | ||
93 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
94 | CharacterSet="1" | ||
95 | > | ||
96 | <Tool | ||
97 | Name="VCPreBuildEventTool" | ||
98 | /> | ||
99 | <Tool | ||
100 | Name="VCCustomBuildTool" | ||
101 | /> | ||
102 | <Tool | ||
103 | Name="VCXMLDataGeneratorTool" | ||
104 | /> | ||
105 | <Tool | ||
106 | Name="VCWebServiceProxyGeneratorTool" | ||
107 | /> | ||
108 | <Tool | ||
109 | Name="VCMIDLTool" | ||
110 | /> | ||
111 | <Tool | ||
112 | Name="VCCLCompilerTool" | ||
113 | AdditionalOptions="/Oy-" | ||
114 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
115 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
116 | RuntimeLibrary="0" | ||
117 | StructMemberAlignment="0" | ||
118 | TreatWChar_tAsBuiltInType="false" | ||
119 | ForceConformanceInForLoopScope="true" | ||
120 | UsePrecompiledHeader="0" | ||
121 | WarningLevel="3" | ||
122 | WarnAsError="true" | ||
123 | Detect64BitPortabilityProblems="false" | ||
124 | DebugInformationFormat="3" | ||
125 | /> | ||
126 | <Tool | ||
127 | Name="VCManagedResourceCompilerTool" | ||
128 | /> | ||
129 | <Tool | ||
130 | Name="VCResourceCompilerTool" | ||
131 | /> | ||
132 | <Tool | ||
133 | Name="VCPreLinkEventTool" | ||
134 | /> | ||
135 | <Tool | ||
136 | Name="VCLibrarianTool" | ||
137 | OutputFile="$(OutDir)/llmath.lib" | ||
138 | /> | ||
139 | <Tool | ||
140 | Name="VCALinkTool" | ||
141 | /> | ||
142 | <Tool | ||
143 | Name="VCXDCMakeTool" | ||
144 | /> | ||
145 | <Tool | ||
146 | Name="VCBscMakeTool" | ||
147 | /> | ||
148 | <Tool | ||
149 | Name="VCFxCopTool" | ||
150 | /> | ||
151 | <Tool | ||
152 | Name="VCPostBuildEventTool" | ||
153 | /> | ||
154 | </Configuration> | ||
155 | <Configuration | ||
156 | Name="ReleaseNoOpt|Win32" | ||
157 | OutputDirectory="../lib_$(ConfigurationName)/i686-win32" | ||
158 | IntermediateDirectory="$(ConfigurationName)" | ||
159 | ConfigurationType="4" | ||
160 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
161 | CharacterSet="1" | ||
162 | > | ||
163 | <Tool | ||
164 | Name="VCPreBuildEventTool" | ||
165 | /> | ||
166 | <Tool | ||
167 | Name="VCCustomBuildTool" | ||
168 | /> | ||
169 | <Tool | ||
170 | Name="VCXMLDataGeneratorTool" | ||
171 | /> | ||
172 | <Tool | ||
173 | Name="VCWebServiceProxyGeneratorTool" | ||
174 | /> | ||
175 | <Tool | ||
176 | Name="VCMIDLTool" | ||
177 | /> | ||
178 | <Tool | ||
179 | Name="VCCLCompilerTool" | ||
180 | AdditionalOptions="/Oy-" | ||
181 | Optimization="0" | ||
182 | AdditionalIncludeDirectories="..\llcommon;..\..\libraries\i686-win32\include;..\..\libraries\include\" | ||
183 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
184 | RuntimeLibrary="0" | ||
185 | StructMemberAlignment="0" | ||
186 | TreatWChar_tAsBuiltInType="false" | ||
187 | ForceConformanceInForLoopScope="true" | ||
188 | UsePrecompiledHeader="0" | ||
189 | BrowseInformation="0" | ||
190 | WarningLevel="3" | ||
191 | WarnAsError="true" | ||
192 | Detect64BitPortabilityProblems="false" | ||
193 | DebugInformationFormat="3" | ||
194 | /> | ||
195 | <Tool | ||
196 | Name="VCManagedResourceCompilerTool" | ||
197 | /> | ||
198 | <Tool | ||
199 | Name="VCResourceCompilerTool" | ||
200 | /> | ||
201 | <Tool | ||
202 | Name="VCPreLinkEventTool" | ||
203 | /> | ||
204 | <Tool | ||
205 | Name="VCLibrarianTool" | ||
206 | OutputFile="$(OutDir)/llmath.lib" | ||
207 | /> | ||
208 | <Tool | ||
209 | Name="VCALinkTool" | ||
210 | /> | ||
211 | <Tool | ||
212 | Name="VCXDCMakeTool" | ||
213 | /> | ||
214 | <Tool | ||
215 | Name="VCBscMakeTool" | ||
216 | /> | ||
217 | <Tool | ||
218 | Name="VCFxCopTool" | ||
219 | /> | ||
220 | <Tool | ||
221 | Name="VCPostBuildEventTool" | ||
222 | /> | ||
223 | </Configuration> | ||
224 | </Configurations> | ||
225 | <References> | ||
226 | </References> | ||
227 | <Files> | ||
228 | <Filter | ||
229 | Name="Source Files" | ||
230 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
231 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
232 | > | ||
233 | <File | ||
234 | RelativePath=".\llbboxlocal.cpp" | ||
235 | > | ||
236 | </File> | ||
237 | <File | ||
238 | RelativePath=".\llcamera.cpp" | ||
239 | > | ||
240 | </File> | ||
241 | <File | ||
242 | RelativePath=".\llcoordframe.cpp" | ||
243 | > | ||
244 | </File> | ||
245 | <File | ||
246 | RelativePath=".\llcrc.cpp" | ||
247 | > | ||
248 | </File> | ||
249 | <File | ||
250 | RelativePath=".\llline.cpp" | ||
251 | > | ||
252 | </File> | ||
253 | <File | ||
254 | RelativePath=".\llmd5.cpp" | ||
255 | > | ||
256 | </File> | ||
257 | <File | ||
258 | RelativePath=".\llperlin.cpp" | ||
259 | > | ||
260 | </File> | ||
261 | <File | ||
262 | RelativePath=".\llquaternion.cpp" | ||
263 | > | ||
264 | </File> | ||
265 | <File | ||
266 | RelativePath=".\llrand.cpp" | ||
267 | > | ||
268 | </File> | ||
269 | <File | ||
270 | RelativePath=".\llrect.cpp" | ||
271 | > | ||
272 | </File> | ||
273 | <File | ||
274 | RelativePath=".\llsphere.cpp" | ||
275 | > | ||
276 | </File> | ||
277 | <File | ||
278 | RelativePath=".\lluuid.cpp" | ||
279 | > | ||
280 | </File> | ||
281 | <File | ||
282 | RelativePath=".\llvolume.cpp" | ||
283 | > | ||
284 | </File> | ||
285 | <File | ||
286 | RelativePath=".\llvolumemgr.cpp" | ||
287 | > | ||
288 | </File> | ||
289 | <File | ||
290 | RelativePath=".\m3math.cpp" | ||
291 | > | ||
292 | </File> | ||
293 | <File | ||
294 | RelativePath=".\m4math.cpp" | ||
295 | > | ||
296 | </File> | ||
297 | <File | ||
298 | RelativePath=".\raytrace.cpp" | ||
299 | > | ||
300 | </File> | ||
301 | <File | ||
302 | RelativePath=".\v2math.cpp" | ||
303 | > | ||
304 | </File> | ||
305 | <File | ||
306 | RelativePath=".\v3color.cpp" | ||
307 | > | ||
308 | </File> | ||
309 | <File | ||
310 | RelativePath=".\v3dmath.cpp" | ||
311 | > | ||
312 | </File> | ||
313 | <File | ||
314 | RelativePath=".\v3math.cpp" | ||
315 | > | ||
316 | </File> | ||
317 | <File | ||
318 | RelativePath=".\v4color.cpp" | ||
319 | > | ||
320 | </File> | ||
321 | <File | ||
322 | RelativePath=".\v4coloru.cpp" | ||
323 | > | ||
324 | </File> | ||
325 | <File | ||
326 | RelativePath=".\v4math.cpp" | ||
327 | > | ||
328 | </File> | ||
329 | <File | ||
330 | RelativePath=".\xform.cpp" | ||
331 | > | ||
332 | </File> | ||
333 | </Filter> | ||
334 | <Filter | ||
335 | Name="Header Files" | ||
336 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
337 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
338 | > | ||
339 | <File | ||
340 | RelativePath=".\llbboxlocal.h" | ||
341 | > | ||
342 | </File> | ||
343 | <File | ||
344 | RelativePath=".\llcamera.h" | ||
345 | > | ||
346 | </File> | ||
347 | <File | ||
348 | RelativePath=".\llcoord.h" | ||
349 | > | ||
350 | </File> | ||
351 | <File | ||
352 | RelativePath=".\llcoordframe.h" | ||
353 | > | ||
354 | </File> | ||
355 | <File | ||
356 | RelativePath=".\llcrc.h" | ||
357 | > | ||
358 | </File> | ||
359 | <File | ||
360 | RelativePath=".\llinterp.h" | ||
361 | > | ||
362 | </File> | ||
363 | <File | ||
364 | RelativePath=".\llline.h" | ||
365 | > | ||
366 | </File> | ||
367 | <File | ||
368 | RelativePath=".\llmath.h" | ||
369 | > | ||
370 | </File> | ||
371 | <File | ||
372 | RelativePath=".\llmd5.h" | ||
373 | > | ||
374 | </File> | ||
375 | <File | ||
376 | RelativePath=".\lloctree.h" | ||
377 | > | ||
378 | </File> | ||
379 | <File | ||
380 | RelativePath=".\llperlin.h" | ||
381 | > | ||
382 | </File> | ||
383 | <File | ||
384 | RelativePath=".\llquantize.h" | ||
385 | > | ||
386 | </File> | ||
387 | <File | ||
388 | RelativePath=".\llquaternion.h" | ||
389 | > | ||
390 | </File> | ||
391 | <File | ||
392 | RelativePath=".\llrand.h" | ||
393 | > | ||
394 | </File> | ||
395 | <File | ||
396 | RelativePath=".\llrect.h" | ||
397 | > | ||
398 | </File> | ||
399 | <File | ||
400 | RelativePath=".\llsphere.h" | ||
401 | > | ||
402 | </File> | ||
403 | <File | ||
404 | RelativePath=".\lltreenode.h" | ||
405 | > | ||
406 | </File> | ||
407 | <File | ||
408 | RelativePath=".\lluuid.h" | ||
409 | > | ||
410 | </File> | ||
411 | <File | ||
412 | RelativePath=".\llv4math.h" | ||
413 | > | ||
414 | </File> | ||
415 | <File | ||
416 | RelativePath=".\llv4matrix3.h" | ||
417 | > | ||
418 | </File> | ||
419 | <File | ||
420 | RelativePath=".\llv4matrix4.h" | ||
421 | > | ||
422 | </File> | ||
423 | <File | ||
424 | RelativePath=".\llv4vector3.h" | ||
425 | > | ||
426 | </File> | ||
427 | <File | ||
428 | RelativePath=".\llvolume.h" | ||
429 | > | ||
430 | </File> | ||
431 | <File | ||
432 | RelativePath=".\llvolumemgr.h" | ||
433 | > | ||
434 | </File> | ||
435 | <File | ||
436 | RelativePath=".\m3math.h" | ||
437 | > | ||
438 | </File> | ||
439 | <File | ||
440 | RelativePath=".\m4math.h" | ||
441 | > | ||
442 | </File> | ||
443 | <File | ||
444 | RelativePath=".\raytrace.h" | ||
445 | > | ||
446 | </File> | ||
447 | <File | ||
448 | RelativePath=".\v2math.h" | ||
449 | > | ||
450 | </File> | ||
451 | <File | ||
452 | RelativePath=".\v3color.h" | ||
453 | > | ||
454 | </File> | ||
455 | <File | ||
456 | RelativePath=".\v3dmath.h" | ||
457 | > | ||
458 | </File> | ||
459 | <File | ||
460 | RelativePath=".\v3math.h" | ||
461 | > | ||
462 | </File> | ||
463 | <File | ||
464 | RelativePath=".\v4color.h" | ||
465 | > | ||
466 | </File> | ||
467 | <File | ||
468 | RelativePath=".\v4coloru.h" | ||
469 | > | ||
470 | </File> | ||
471 | <File | ||
472 | RelativePath=".\v4math.h" | ||
473 | > | ||
474 | </File> | ||
475 | <File | ||
476 | RelativePath=".\xform.h" | ||
477 | > | ||
478 | </File> | ||
479 | </Filter> | ||
480 | <Filter | ||
481 | Name="Resource Files" | ||
482 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
483 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
484 | > | ||
485 | </Filter> | ||
486 | </Files> | ||
487 | <Globals> | ||
488 | </Globals> | ||
489 | </VisualStudioProject> | ||
diff --git a/linden/indra/llmath/lloctree.h b/linden/indra/llmath/lloctree.h index e26bae5..57b359f 100644 --- a/linden/indra/llmath/lloctree.h +++ b/linden/indra/llmath/lloctree.h | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <vector> | 37 | #include <vector> |
38 | #include <set> | 38 | #include <set> |
39 | 39 | ||
40 | #ifdef LL_RELEASE_FOR_DOWNLOAD | 40 | #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG |
41 | #define OCT_ERRS LL_WARNS("OctreeErrors") | 41 | #define OCT_ERRS LL_WARNS("OctreeErrors") |
42 | #else | 42 | #else |
43 | #define OCT_ERRS LL_ERRS("OctreeErrors") | 43 | #define OCT_ERRS LL_ERRS("OctreeErrors") |
diff --git a/linden/indra/llmath/llquaternion.cpp b/linden/indra/llmath/llquaternion.cpp index ab4855b..9eab8ed 100644 --- a/linden/indra/llmath/llquaternion.cpp +++ b/linden/indra/llmath/llquaternion.cpp | |||
@@ -791,7 +791,7 @@ LLQuaternion mayaQ(F32 xRot, F32 yRot, F32 zRot, LLQuaternion::Order order) | |||
791 | 791 | ||
792 | const char *OrderToString( const LLQuaternion::Order order ) | 792 | const char *OrderToString( const LLQuaternion::Order order ) |
793 | { | 793 | { |
794 | char *p = NULL; | 794 | const char *p = NULL; |
795 | switch( order ) | 795 | switch( order ) |
796 | { | 796 | { |
797 | default: | 797 | default: |
@@ -937,15 +937,15 @@ void LLQuaternion::unpackFromVector3( const LLVector3& vec ) | |||
937 | } | 937 | } |
938 | } | 938 | } |
939 | 939 | ||
940 | BOOL LLQuaternion::parseQuat(const char* buf, LLQuaternion* value) | 940 | BOOL LLQuaternion::parseQuat(const std::string& buf, LLQuaternion* value) |
941 | { | 941 | { |
942 | if( buf == NULL || buf[0] == '\0' || value == NULL) | 942 | if( buf.empty() || value == NULL) |
943 | { | 943 | { |
944 | return FALSE; | 944 | return FALSE; |
945 | } | 945 | } |
946 | 946 | ||
947 | LLQuaternion quat; | 947 | LLQuaternion quat; |
948 | S32 count = sscanf( buf, "%f %f %f %f", quat.mQ + 0, quat.mQ + 1, quat.mQ + 2, quat.mQ + 3 ); | 948 | S32 count = sscanf( buf.c_str(), "%f %f %f %f", quat.mQ + 0, quat.mQ + 1, quat.mQ + 2, quat.mQ + 3 ); |
949 | if( 4 == count ) | 949 | if( 4 == count ) |
950 | { | 950 | { |
951 | value->set( quat ); | 951 | value->set( quat ); |
diff --git a/linden/indra/llmath/llquaternion.h b/linden/indra/llmath/llquaternion.h index 048db2d..1eb982e 100644 --- a/linden/indra/llmath/llquaternion.h +++ b/linden/indra/llmath/llquaternion.h | |||
@@ -158,7 +158,7 @@ public: | |||
158 | friend const char *OrderToString( const Order order ); | 158 | friend const char *OrderToString( const Order order ); |
159 | friend Order StringToOrder( const char *str ); | 159 | friend Order StringToOrder( const char *str ); |
160 | 160 | ||
161 | static BOOL parseQuat(const char* buf, LLQuaternion* value); | 161 | static BOOL parseQuat(const std::string& buf, LLQuaternion* value); |
162 | 162 | ||
163 | // For debugging, only | 163 | // For debugging, only |
164 | //static U32 mMultCount; | 164 | //static U32 mMultCount; |
diff --git a/linden/indra/llmath/llrect.h b/linden/indra/llmath/llrect.h index f2a5d75..ebe5d83 100644 --- a/linden/indra/llmath/llrect.h +++ b/linden/indra/llmath/llrect.h | |||
@@ -183,10 +183,11 @@ public: | |||
183 | 183 | ||
184 | LLRectBase& setCenterAndSize(Type x, Type y, Type width, Type height) | 184 | LLRectBase& setCenterAndSize(Type x, Type y, Type width, Type height) |
185 | { | 185 | { |
186 | // width and height could be odd, so favor top, right with extra pixel | ||
186 | mLeft = x - width/2; | 187 | mLeft = x - width/2; |
187 | mTop = y + height/2; | ||
188 | mRight = x + width/2; | ||
189 | mBottom = y - height/2; | 188 | mBottom = y - height/2; |
189 | mTop = mBottom + height; | ||
190 | mRight = mLeft + width; | ||
190 | return *this; | 191 | return *this; |
191 | } | 192 | } |
192 | 193 | ||
diff --git a/linden/indra/llmath/llsdutil_math.cpp b/linden/indra/llmath/llsdutil_math.cpp new file mode 100644 index 0000000..5b72875 --- /dev/null +++ b/linden/indra/llmath/llsdutil_math.cpp | |||
@@ -0,0 +1,172 @@ | |||
1 | /** | ||
2 | * @file llsdutil_math.cpp | ||
3 | * @author Phoenix | ||
4 | * @date 2006-05-24 | ||
5 | * @brief Implementation of classes, functions, etc, for using structured data. | ||
6 | * | ||
7 | * $LicenseInfo:firstyear=2006&license=viewergpl$ | ||
8 | * | ||
9 | * Copyright (c) 2006-2008, 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 http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
23 | * | ||
24 | * By copying, modifying or distributing this software, you acknowledge | ||
25 | * that you have read and understood your obligations described above, | ||
26 | * and agree to abide by those obligations. | ||
27 | * | ||
28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
30 | * COMPLETENESS OR PERFORMANCE. | ||
31 | * $/LicenseInfo$ | ||
32 | */ | ||
33 | |||
34 | #include "linden_common.h" | ||
35 | |||
36 | #include "llsdutil.h" | ||
37 | |||
38 | #include "v3math.h" | ||
39 | #include "v4math.h" | ||
40 | #include "v3dmath.h" | ||
41 | #include "v2math.h" | ||
42 | #include "llquaternion.h" | ||
43 | #include "v4color.h" | ||
44 | |||
45 | #if LL_WINDOWS | ||
46 | # define WIN32_LEAN_AND_MEAN | ||
47 | # include <winsock2.h> // for htonl | ||
48 | #elif LL_LINUX || LL_SOLARIS | ||
49 | # include <netinet/in.h> | ||
50 | #elif LL_DARWIN | ||
51 | # include <arpa/inet.h> | ||
52 | #endif | ||
53 | |||
54 | #include "llsdserialize.h" | ||
55 | |||
56 | // vector3 | ||
57 | LLSD ll_sd_from_vector3(const LLVector3& vec) | ||
58 | { | ||
59 | LLSD rv; | ||
60 | rv.append((F64)vec.mV[VX]); | ||
61 | rv.append((F64)vec.mV[VY]); | ||
62 | rv.append((F64)vec.mV[VZ]); | ||
63 | return rv; | ||
64 | } | ||
65 | |||
66 | LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index) | ||
67 | { | ||
68 | LLVector3 rv; | ||
69 | rv.mV[VX] = (F32)sd[start_index].asReal(); | ||
70 | rv.mV[VY] = (F32)sd[++start_index].asReal(); | ||
71 | rv.mV[VZ] = (F32)sd[++start_index].asReal(); | ||
72 | return rv; | ||
73 | } | ||
74 | |||
75 | // vector4 | ||
76 | LLSD ll_sd_from_vector4(const LLVector4& vec) | ||
77 | { | ||
78 | LLSD rv; | ||
79 | rv.append((F64)vec.mV[VX]); | ||
80 | rv.append((F64)vec.mV[VY]); | ||
81 | rv.append((F64)vec.mV[VZ]); | ||
82 | rv.append((F64)vec.mV[VW]); | ||
83 | return rv; | ||
84 | } | ||
85 | |||
86 | LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index) | ||
87 | { | ||
88 | LLVector4 rv; | ||
89 | rv.mV[VX] = (F32)sd[start_index].asReal(); | ||
90 | rv.mV[VY] = (F32)sd[++start_index].asReal(); | ||
91 | rv.mV[VZ] = (F32)sd[++start_index].asReal(); | ||
92 | rv.mV[VW] = (F32)sd[++start_index].asReal(); | ||
93 | return rv; | ||
94 | } | ||
95 | |||
96 | // vector3d | ||
97 | LLSD ll_sd_from_vector3d(const LLVector3d& vec) | ||
98 | { | ||
99 | LLSD rv; | ||
100 | rv.append(vec.mdV[VX]); | ||
101 | rv.append(vec.mdV[VY]); | ||
102 | rv.append(vec.mdV[VZ]); | ||
103 | return rv; | ||
104 | } | ||
105 | |||
106 | LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index) | ||
107 | { | ||
108 | LLVector3d rv; | ||
109 | rv.mdV[VX] = sd[start_index].asReal(); | ||
110 | rv.mdV[VY] = sd[++start_index].asReal(); | ||
111 | rv.mdV[VZ] = sd[++start_index].asReal(); | ||
112 | return rv; | ||
113 | } | ||
114 | |||
115 | //vector2 | ||
116 | LLSD ll_sd_from_vector2(const LLVector2& vec) | ||
117 | { | ||
118 | LLSD rv; | ||
119 | rv.append((F64)vec.mV[VX]); | ||
120 | rv.append((F64)vec.mV[VY]); | ||
121 | return rv; | ||
122 | } | ||
123 | |||
124 | LLVector2 ll_vector2_from_sd(const LLSD& sd) | ||
125 | { | ||
126 | LLVector2 rv; | ||
127 | rv.mV[VX] = (F32)sd[0].asReal(); | ||
128 | rv.mV[VY] = (F32)sd[1].asReal(); | ||
129 | return rv; | ||
130 | } | ||
131 | |||
132 | // Quaternion | ||
133 | LLSD ll_sd_from_quaternion(const LLQuaternion& quat) | ||
134 | { | ||
135 | LLSD rv; | ||
136 | rv.append((F64)quat.mQ[VX]); | ||
137 | rv.append((F64)quat.mQ[VY]); | ||
138 | rv.append((F64)quat.mQ[VZ]); | ||
139 | rv.append((F64)quat.mQ[VW]); | ||
140 | return rv; | ||
141 | } | ||
142 | |||
143 | LLQuaternion ll_quaternion_from_sd(const LLSD& sd) | ||
144 | { | ||
145 | LLQuaternion quat; | ||
146 | quat.mQ[VX] = (F32)sd[0].asReal(); | ||
147 | quat.mQ[VY] = (F32)sd[1].asReal(); | ||
148 | quat.mQ[VZ] = (F32)sd[2].asReal(); | ||
149 | quat.mQ[VW] = (F32)sd[3].asReal(); | ||
150 | return quat; | ||
151 | } | ||
152 | |||
153 | // color4 | ||
154 | LLSD ll_sd_from_color4(const LLColor4& c) | ||
155 | { | ||
156 | LLSD rv; | ||
157 | rv.append(c.mV[0]); | ||
158 | rv.append(c.mV[1]); | ||
159 | rv.append(c.mV[2]); | ||
160 | rv.append(c.mV[3]); | ||
161 | return rv; | ||
162 | } | ||
163 | |||
164 | LLColor4 ll_color4_from_sd(const LLSD& sd) | ||
165 | { | ||
166 | LLColor4 c; | ||
167 | c.mV[0] = (F32)sd[0].asReal(); | ||
168 | c.mV[1] = (F32)sd[1].asReal(); | ||
169 | c.mV[2] = (F32)sd[2].asReal(); | ||
170 | c.mV[3] = (F32)sd[3].asReal(); | ||
171 | return c; | ||
172 | } | ||
diff --git a/linden/indra/llmath/llsphere.cpp b/linden/indra/llmath/llsphere.cpp index 62f6e27..f253b6c 100644 --- a/linden/indra/llmath/llsphere.cpp +++ b/linden/indra/llmath/llsphere.cpp | |||
@@ -20,6 +20,8 @@ | |||
20 | * $/LicenseInfo$ | 20 | * $/LicenseInfo$ |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "linden_common.h" | ||
24 | |||
23 | #include "llsphere.h" | 25 | #include "llsphere.h" |
24 | 26 | ||
25 | LLSphere::LLSphere() | 27 | LLSphere::LLSphere() |
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp index f7c9286..7b6c6a9 100644 --- a/linden/indra/llmath/llvolume.cpp +++ b/linden/indra/llmath/llvolume.cpp | |||
@@ -82,11 +82,6 @@ const F32 TAPER_MAX = 1.f; | |||
82 | const F32 SKEW_MIN = -0.95f; | 82 | const F32 SKEW_MIN = -0.95f; |
83 | const F32 SKEW_MAX = 0.95f; | 83 | const F32 SKEW_MAX = 0.95f; |
84 | 84 | ||
85 | const S32 SCULPT_REZ_1 = 6; // changed from 4 to 6 - 6 looks round whereas 4 looks square | ||
86 | const S32 SCULPT_REZ_2 = 8; | ||
87 | const S32 SCULPT_REZ_3 = 16; | ||
88 | const S32 SCULPT_REZ_4 = 32; | ||
89 | |||
90 | const F32 SCULPT_MIN_AREA = 0.002f; | 85 | const F32 SCULPT_MIN_AREA = 0.002f; |
91 | 86 | ||
92 | BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) | 87 | BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) |
@@ -104,46 +99,128 @@ BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLV | |||
104 | } | 99 | } |
105 | } | 100 | } |
106 | 101 | ||
107 | // intersect test between triangle pt1,pt2,pt3 and line from linept to linept+vect | 102 | BOOL LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size) |
108 | //returns TRUE if intersecting and moves linept to the point of intersection | 103 | { |
109 | BOOL LLTriangleLineSegmentIntersect( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, LLVector3& linept, const LLVector3& vect) | 104 | float fAWdU[3]; |
105 | LLVector3 dir; | ||
106 | LLVector3 diff; | ||
107 | |||
108 | for (U32 i = 0; i < 3; i++) | ||
109 | { | ||
110 | dir.mV[i] = 0.5f * (end.mV[i] - start.mV[i]); | ||
111 | diff.mV[i] = (0.5f * (end.mV[i] + start.mV[i])) - center.mV[i]; | ||
112 | fAWdU[i] = fabsf(dir.mV[i]); | ||
113 | if(fabsf(diff.mV[i])>size.mV[i] + fAWdU[i]) return false; | ||
114 | } | ||
115 | |||
116 | float f; | ||
117 | f = dir.mV[1] * diff.mV[2] - dir.mV[2] * diff.mV[1]; if(fabsf(f)>size.mV[1]*fAWdU[2] + size.mV[2]*fAWdU[1]) return false; | ||
118 | f = dir.mV[2] * diff.mV[0] - dir.mV[0] * diff.mV[2]; if(fabsf(f)>size.mV[0]*fAWdU[2] + size.mV[2]*fAWdU[0]) return false; | ||
119 | f = dir.mV[0] * diff.mV[1] - dir.mV[1] * diff.mV[0]; if(fabsf(f)>size.mV[0]*fAWdU[1] + size.mV[1]*fAWdU[0]) return false; | ||
120 | |||
121 | return true; | ||
122 | } | ||
123 | |||
124 | |||
125 | // intersect test between triangle vert0, vert1, vert2 and a ray from orig in direction dir. | ||
126 | // returns TRUE if intersecting and returns barycentric coordinates in intersection_a, intersection_b, | ||
127 | // and returns the intersection point along dir in intersection_t. | ||
128 | |||
129 | // Moller-Trumbore algorithm | ||
130 | BOOL LLTriangleRayIntersect(const LLVector3& vert0, const LLVector3& vert1, const LLVector3& vert2, const LLVector3& orig, const LLVector3& dir, | ||
131 | F32* intersection_a, F32* intersection_b, F32* intersection_t, BOOL two_sided) | ||
110 | { | 132 | { |
111 | LLVector3 V1 = pt2-pt1; | 133 | F32 u, v, t; |
112 | LLVector3 V2 = pt3-pt2; | ||
113 | 134 | ||
114 | LLVector3 norm = V1 % V2; | 135 | /* find vectors for two edges sharing vert0 */ |
136 | LLVector3 edge1 = vert1 - vert0; | ||
115 | 137 | ||
116 | F32 dotprod = norm * vect; | 138 | LLVector3 edge2 = vert2 - vert0;; |
117 | 139 | ||
118 | if(dotprod < 0) | 140 | /* begin calculating determinant - also used to calculate U parameter */ |
141 | LLVector3 pvec = dir % edge2; | ||
142 | |||
143 | /* if determinant is near zero, ray lies in plane of triangle */ | ||
144 | F32 det = edge1 * pvec; | ||
145 | |||
146 | if (!two_sided) | ||
119 | { | 147 | { |
120 | //Find point of intersect to triangle plane. | 148 | if (det < F_APPROXIMATELY_ZERO) |
121 | //find t to intersect point | 149 | { |
122 | F32 t = -(norm * (linept-pt1))/dotprod; | 150 | return FALSE; |
151 | } | ||
152 | |||
153 | /* calculate distance from vert0 to ray origin */ | ||
154 | LLVector3 tvec = orig - vert0; | ||
123 | 155 | ||
124 | // if ds is neg line started past triangle so can't hit triangle. | 156 | /* calculate U parameter and test bounds */ |
125 | if (t > 0) | 157 | u = tvec * pvec; |
158 | |||
159 | if (u < 0.f || u > det) | ||
126 | { | 160 | { |
127 | return FALSE; | 161 | return FALSE; |
128 | } | 162 | } |
129 | 163 | ||
130 | LLVector3 pt_int = linept + (vect*t); | 164 | /* prepare to test V parameter */ |
165 | LLVector3 qvec = tvec % edge1; | ||
131 | 166 | ||
132 | if(check_same_clock_dir(pt1, pt2, pt_int, norm)) | 167 | /* calculate V parameter and test bounds */ |
168 | v = dir * qvec; | ||
169 | if (v < 0.f || u + v > det) | ||
133 | { | 170 | { |
134 | if(check_same_clock_dir(pt2, pt3, pt_int, norm)) | 171 | return FALSE; |
172 | } | ||
173 | |||
174 | /* calculate t, scale parameters, ray intersects triangle */ | ||
175 | t = edge2 * qvec; | ||
176 | F32 inv_det = 1.0 / det; | ||
177 | t *= inv_det; | ||
178 | u *= inv_det; | ||
179 | v *= inv_det; | ||
180 | } | ||
181 | |||
182 | else // two sided | ||
135 | { | 183 | { |
136 | if(check_same_clock_dir(pt3, pt1, pt_int, norm)) | 184 | if (det > -F_APPROXIMATELY_ZERO && det < F_APPROXIMATELY_ZERO) |
137 | { | 185 | { |
138 | // answer in pt_int is insde triangle | 186 | return FALSE; |
139 | linept.setVec(pt_int); | ||
140 | return TRUE; | ||
141 | } | 187 | } |
188 | F32 inv_det = 1.0 / det; | ||
189 | |||
190 | /* calculate distance from vert0 to ray origin */ | ||
191 | LLVector3 tvec = orig - vert0; | ||
192 | |||
193 | /* calculate U parameter and test bounds */ | ||
194 | u = (tvec * pvec) * inv_det; | ||
195 | if (u < 0.f || u > 1.f) | ||
196 | { | ||
197 | return FALSE; | ||
142 | } | 198 | } |
199 | |||
200 | /* prepare to test V parameter */ | ||
201 | LLVector3 qvec = tvec - edge1; | ||
202 | |||
203 | /* calculate V parameter and test bounds */ | ||
204 | v = (dir * qvec) * inv_det; | ||
205 | |||
206 | if (v < 0.f || u + v > 1.f) | ||
207 | { | ||
208 | return FALSE; | ||
143 | } | 209 | } |
210 | |||
211 | /* calculate t, ray intersects triangle */ | ||
212 | t = (edge2 * qvec) * inv_det; | ||
144 | } | 213 | } |
145 | 214 | ||
146 | return FALSE; | 215 | if (intersection_a != NULL) |
216 | *intersection_a = u; | ||
217 | if (intersection_b != NULL) | ||
218 | *intersection_b = v; | ||
219 | if (intersection_t != NULL) | ||
220 | *intersection_t = t; | ||
221 | |||
222 | |||
223 | return TRUE; | ||
147 | } | 224 | } |
148 | 225 | ||
149 | 226 | ||
@@ -198,9 +275,6 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 | |||
198 | F32 t, t_step, t_first, t_fraction, ang, ang_step; | 275 | F32 t, t_step, t_first, t_fraction, ang, ang_step; |
199 | LLVector3 pt1,pt2; | 276 | LLVector3 pt1,pt2; |
200 | 277 | ||
201 | mMaxX = 0.f; | ||
202 | mMinX = 0.f; | ||
203 | |||
204 | F32 begin = params.getBegin(); | 278 | F32 begin = params.getBegin(); |
205 | F32 end = params.getEnd(); | 279 | F32 end = params.getEnd(); |
206 | 280 | ||
@@ -236,15 +310,6 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 | |||
236 | if (t_fraction < 0.9999f) | 310 | if (t_fraction < 0.9999f) |
237 | { | 311 | { |
238 | LLVector3 new_pt = lerp(pt1, pt2, t_fraction); | 312 | LLVector3 new_pt = lerp(pt1, pt2, t_fraction); |
239 | F32 pt_x = new_pt.mV[VX]; | ||
240 | if (pt_x < mMinX) | ||
241 | { | ||
242 | mMinX = pt_x; | ||
243 | } | ||
244 | else if (pt_x > mMaxX) | ||
245 | { | ||
246 | mMaxX = pt_x; | ||
247 | } | ||
248 | mProfile.push_back(new_pt); | 313 | mProfile.push_back(new_pt); |
249 | } | 314 | } |
250 | 315 | ||
@@ -254,16 +319,6 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 | |||
254 | // Iterate through all the integer steps of t. | 319 | // Iterate through all the integer steps of t. |
255 | pt1.setVec(cos(ang)*scale,sin(ang)*scale,t); | 320 | pt1.setVec(cos(ang)*scale,sin(ang)*scale,t); |
256 | 321 | ||
257 | F32 pt_x = pt1.mV[VX]; | ||
258 | if (pt_x < mMinX) | ||
259 | { | ||
260 | mMinX = pt_x; | ||
261 | } | ||
262 | else if (pt_x > mMaxX) | ||
263 | { | ||
264 | mMaxX = pt_x; | ||
265 | } | ||
266 | |||
267 | if (mProfile.size() > 0) { | 322 | if (mProfile.size() > 0) { |
268 | LLVector3 p = mProfile[mProfile.size()-1]; | 323 | LLVector3 p = mProfile[mProfile.size()-1]; |
269 | for (S32 i = 0; i < split && mProfile.size() > 0; i++) { | 324 | for (S32 i = 0; i < split && mProfile.size() > 0; i++) { |
@@ -287,15 +342,6 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 | |||
287 | if (t_fraction > 0.0001f) | 342 | if (t_fraction > 0.0001f) |
288 | { | 343 | { |
289 | LLVector3 new_pt = lerp(pt1, pt2, t_fraction); | 344 | LLVector3 new_pt = lerp(pt1, pt2, t_fraction); |
290 | F32 pt_x = new_pt.mV[VX]; | ||
291 | if (pt_x < mMinX) | ||
292 | { | ||
293 | mMinX = pt_x; | ||
294 | } | ||
295 | else if (pt_x > mMaxX) | ||
296 | { | ||
297 | mMaxX = pt_x; | ||
298 | } | ||
299 | 345 | ||
300 | if (mProfile.size() > 0) { | 346 | if (mProfile.size() > 0) { |
301 | LLVector3 p = mProfile[mProfile.size()-1]; | 347 | LLVector3 p = mProfile[mProfile.size()-1]; |
@@ -472,31 +518,9 @@ LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, BOOL flat, F3 | |||
472 | } | 518 | } |
473 | 519 | ||
474 | 520 | ||
475 | S32 sculpt_sides(F32 detail) | ||
476 | { | ||
477 | |||
478 | // detail is usually one of: 1, 1.5, 2.5, 4.0. | ||
479 | |||
480 | if (detail <= 1.0) | ||
481 | { | ||
482 | return SCULPT_REZ_1; | ||
483 | } | ||
484 | if (detail <= 2.0) | ||
485 | { | ||
486 | return SCULPT_REZ_2; | ||
487 | } | ||
488 | if (detail <= 3.0) | ||
489 | { | ||
490 | return SCULPT_REZ_3; | ||
491 | } | ||
492 | else | ||
493 | { | ||
494 | return SCULPT_REZ_4; | ||
495 | } | ||
496 | } | ||
497 | |||
498 | 521 | ||
499 | BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, BOOL is_sculpted) | 522 | BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, |
523 | BOOL is_sculpted, S32 sculpt_size) | ||
500 | { | 524 | { |
501 | LLMemType m1(LLMemType::MTYPE_VOLUME); | 525 | LLMemType m1(LLMemType::MTYPE_VOLUME); |
502 | 526 | ||
@@ -640,7 +664,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai | |||
640 | S32 sides = (S32)circle_detail; | 664 | S32 sides = (S32)circle_detail; |
641 | 665 | ||
642 | if (is_sculpted) | 666 | if (is_sculpted) |
643 | sides = sculpt_sides(detail); | 667 | sides = sculpt_size; |
644 | 668 | ||
645 | genNGon(params, sides); | 669 | genNGon(params, sides); |
646 | 670 | ||
@@ -1131,7 +1155,8 @@ const LLVector2 LLPathParams::getEndScale() const | |||
1131 | return end_scale; | 1155 | return end_scale; |
1132 | } | 1156 | } |
1133 | 1157 | ||
1134 | BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is_sculpted) | 1158 | BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, |
1159 | BOOL is_sculpted, S32 sculpt_size) | ||
1135 | { | 1160 | { |
1136 | LLMemType m1(LLMemType::MTYPE_VOLUME); | 1161 | LLMemType m1(LLMemType::MTYPE_VOLUME); |
1137 | 1162 | ||
@@ -1194,7 +1219,7 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is | |||
1194 | S32 sides = (S32)llfloor(llfloor((MIN_DETAIL_FACES * detail + twist_mag * 3.5f * (detail-0.5f))) * params.getRevolutions()); | 1219 | S32 sides = (S32)llfloor(llfloor((MIN_DETAIL_FACES * detail + twist_mag * 3.5f * (detail-0.5f))) * params.getRevolutions()); |
1195 | 1220 | ||
1196 | if (is_sculpted) | 1221 | if (is_sculpted) |
1197 | sides = sculpt_sides(detail); | 1222 | sides = sculpt_size; |
1198 | 1223 | ||
1199 | genNGon(params, sides); | 1224 | genNGon(params, sides); |
1200 | } | 1225 | } |
@@ -1259,7 +1284,8 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is | |||
1259 | return TRUE; | 1284 | return TRUE; |
1260 | } | 1285 | } |
1261 | 1286 | ||
1262 | BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is_sculpted) | 1287 | BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, |
1288 | BOOL is_sculpted, S32 sculpt_size) | ||
1263 | { | 1289 | { |
1264 | LLMemType m1(LLMemType::MTYPE_VOLUME); | 1290 | LLMemType m1(LLMemType::MTYPE_VOLUME); |
1265 | 1291 | ||
@@ -1979,6 +2005,12 @@ void LLVolume::sculptGeneratePlaceholder() | |||
1979 | // create the vertices from the map | 2005 | // create the vertices from the map |
1980 | void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type) | 2006 | void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type) |
1981 | { | 2007 | { |
2008 | U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; | ||
2009 | BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; | ||
2010 | BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; | ||
2011 | BOOL reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror); // XOR | ||
2012 | |||
2013 | |||
1982 | LLMemType m1(LLMemType::MTYPE_VOLUME); | 2014 | LLMemType m1(LLMemType::MTYPE_VOLUME); |
1983 | 2015 | ||
1984 | S32 sizeS = mPathp->mPath.size(); | 2016 | S32 sizeS = mPathp->mPath.size(); |
@@ -1993,13 +2025,21 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 | |||
1993 | S32 i = t + line; | 2025 | S32 i = t + line; |
1994 | Point& pt = mMesh[i]; | 2026 | Point& pt = mMesh[i]; |
1995 | 2027 | ||
1996 | U32 x = (U32) ((F32)t/(sizeT-1) * (F32) sculpt_width); | 2028 | S32 reversed_t = t; |
2029 | |||
2030 | if (reverse_horizontal) | ||
2031 | { | ||
2032 | reversed_t = sizeT - t - 1; | ||
2033 | } | ||
2034 | |||
2035 | U32 x = (U32) ((F32)reversed_t/(sizeT-1) * (F32) sculpt_width); | ||
1997 | U32 y = (U32) ((F32)s/(sizeS-1) * (F32) sculpt_height); | 2036 | U32 y = (U32) ((F32)s/(sizeS-1) * (F32) sculpt_height); |
1998 | 2037 | ||
2038 | |||
1999 | if (y == 0) // top row stitching | 2039 | if (y == 0) // top row stitching |
2000 | { | 2040 | { |
2001 | // pinch? | 2041 | // pinch? |
2002 | if (sculpt_type == LL_SCULPT_TYPE_SPHERE) | 2042 | if (sculpt_stitching == LL_SCULPT_TYPE_SPHERE) |
2003 | { | 2043 | { |
2004 | x = sculpt_width / 2; | 2044 | x = sculpt_width / 2; |
2005 | } | 2045 | } |
@@ -2008,7 +2048,7 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 | |||
2008 | if (y == sculpt_height) // bottom row stitching | 2048 | if (y == sculpt_height) // bottom row stitching |
2009 | { | 2049 | { |
2010 | // wrap? | 2050 | // wrap? |
2011 | if (sculpt_type == LL_SCULPT_TYPE_TORUS) | 2051 | if (sculpt_stitching == LL_SCULPT_TYPE_TORUS) |
2012 | { | 2052 | { |
2013 | y = 0; | 2053 | y = 0; |
2014 | } | 2054 | } |
@@ -2018,7 +2058,7 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 | |||
2018 | } | 2058 | } |
2019 | 2059 | ||
2020 | // pinch? | 2060 | // pinch? |
2021 | if (sculpt_type == LL_SCULPT_TYPE_SPHERE) | 2061 | if (sculpt_stitching == LL_SCULPT_TYPE_SPHERE) |
2022 | { | 2062 | { |
2023 | x = sculpt_width / 2; | 2063 | x = sculpt_width / 2; |
2024 | } | 2064 | } |
@@ -2027,9 +2067,9 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 | |||
2027 | if (x == sculpt_width) // side stitching | 2067 | if (x == sculpt_width) // side stitching |
2028 | { | 2068 | { |
2029 | // wrap? | 2069 | // wrap? |
2030 | if ((sculpt_type == LL_SCULPT_TYPE_SPHERE) || | 2070 | if ((sculpt_stitching == LL_SCULPT_TYPE_SPHERE) || |
2031 | (sculpt_type == LL_SCULPT_TYPE_TORUS) || | 2071 | (sculpt_stitching == LL_SCULPT_TYPE_TORUS) || |
2032 | (sculpt_type == LL_SCULPT_TYPE_CYLINDER)) | 2072 | (sculpt_stitching == LL_SCULPT_TYPE_CYLINDER)) |
2033 | { | 2073 | { |
2034 | x = 0; | 2074 | x = 0; |
2035 | } | 2075 | } |
@@ -2041,12 +2081,69 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 | |||
2041 | } | 2081 | } |
2042 | 2082 | ||
2043 | pt.mPos = sculpt_xy_to_vector(x, y, sculpt_width, sculpt_height, sculpt_components, sculpt_data); | 2083 | pt.mPos = sculpt_xy_to_vector(x, y, sculpt_width, sculpt_height, sculpt_components, sculpt_data); |
2084 | |||
2085 | if (sculpt_mirror) | ||
2086 | { | ||
2087 | pt.mPos.mV[VX] *= -1.f; | ||
2088 | } | ||
2044 | } | 2089 | } |
2090 | |||
2045 | line += sizeT; | 2091 | line += sizeT; |
2046 | } | 2092 | } |
2047 | } | 2093 | } |
2048 | 2094 | ||
2049 | 2095 | ||
2096 | const S32 SCULPT_REZ_1 = 6; // changed from 4 to 6 - 6 looks round whereas 4 looks square | ||
2097 | const S32 SCULPT_REZ_2 = 8; | ||
2098 | const S32 SCULPT_REZ_3 = 16; | ||
2099 | const S32 SCULPT_REZ_4 = 32; | ||
2100 | |||
2101 | S32 sculpt_sides(F32 detail) | ||
2102 | { | ||
2103 | |||
2104 | // detail is usually one of: 1, 1.5, 2.5, 4.0. | ||
2105 | |||
2106 | if (detail <= 1.0) | ||
2107 | { | ||
2108 | return SCULPT_REZ_1; | ||
2109 | } | ||
2110 | if (detail <= 2.0) | ||
2111 | { | ||
2112 | return SCULPT_REZ_2; | ||
2113 | } | ||
2114 | if (detail <= 3.0) | ||
2115 | { | ||
2116 | return SCULPT_REZ_3; | ||
2117 | } | ||
2118 | else | ||
2119 | { | ||
2120 | return SCULPT_REZ_4; | ||
2121 | } | ||
2122 | } | ||
2123 | |||
2124 | |||
2125 | |||
2126 | // determine the number of vertices in both s and t direction for this sculpt | ||
2127 | void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 detail, S32& s, S32& t) | ||
2128 | { | ||
2129 | S32 vertices = sculpt_sides(detail); | ||
2130 | |||
2131 | F32 ratio; | ||
2132 | if ((width == 0) || (height == 0)) | ||
2133 | ratio = 1.f; | ||
2134 | else | ||
2135 | ratio = (F32) width / (F32) height; | ||
2136 | |||
2137 | |||
2138 | s = (S32)(vertices / fsqrtf(ratio)); | ||
2139 | |||
2140 | s = llmax(s, 3); // no degenerate sizes, please | ||
2141 | t = vertices * vertices / s; | ||
2142 | |||
2143 | t = llmax(t, 3); // no degenerate sizes, please | ||
2144 | s = vertices * vertices / t; | ||
2145 | } | ||
2146 | |||
2050 | // sculpt replaces generate() for sculpted surfaces | 2147 | // sculpt replaces generate() for sculpted surfaces |
2051 | void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level) | 2148 | void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level) |
2052 | { | 2149 | { |
@@ -2061,11 +2158,16 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, | |||
2061 | data_is_empty = TRUE; | 2158 | data_is_empty = TRUE; |
2062 | } | 2159 | } |
2063 | 2160 | ||
2064 | mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE); | 2161 | S32 requested_sizeS = 0; |
2065 | mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE); | 2162 | S32 requested_sizeT = 0; |
2066 | 2163 | ||
2067 | S32 sizeS = mPathp->mPath.size(); | 2164 | sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, mDetail, requested_sizeS, requested_sizeT); |
2068 | S32 sizeT = mProfilep->mProfile.size(); | 2165 | |
2166 | mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE, requested_sizeS); | ||
2167 | mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE, requested_sizeT); | ||
2168 | |||
2169 | S32 sizeS = mPathp->mPath.size(); // we requested a specific size, now see what we really got | ||
2170 | S32 sizeT = mProfilep->mProfile.size(); // we requested a specific size, now see what we really got | ||
2069 | 2171 | ||
2070 | // weird crash bug - DEV-11158 - trying to collect more data: | 2172 | // weird crash bug - DEV-11158 - trying to collect more data: |
2071 | if ((sizeS == 0) || (sizeT == 0)) | 2173 | if ((sizeS == 0) || (sizeT == 0)) |
@@ -3405,47 +3507,99 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices, | |||
3405 | } | 3507 | } |
3406 | } | 3508 | } |
3407 | 3509 | ||
3408 | S32 LLVolume::lineSegmentIntersect(const LLVector3& start, LLVector3& end) const | 3510 | S32 LLVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, |
3511 | S32 face, | ||
3512 | LLVector3* intersection,LLVector2* tex_coord, LLVector3* normal, LLVector3* bi_normal) | ||
3409 | { | 3513 | { |
3410 | S32 ret = -1; | 3514 | S32 hit_face = -1; |
3411 | 3515 | ||
3412 | LLVector3 vec = end - start; | 3516 | S32 start_face; |
3517 | S32 end_face; | ||
3413 | 3518 | ||
3414 | for (S32 i = 0; i < getNumFaces(); i++) | 3519 | if (face == -1) // ALL_SIDES |
3415 | { | 3520 | { |
3416 | const LLVolumeFace& face = getVolumeFace(i); | 3521 | start_face = 0; |
3522 | end_face = getNumFaces() - 1; | ||
3523 | } | ||
3524 | else | ||
3525 | { | ||
3526 | start_face = face; | ||
3527 | end_face = face; | ||
3528 | } | ||
3529 | |||
3530 | LLVector3 dir = end - start; | ||
3531 | |||
3532 | F32 closest_t = 2.f; // must be larger than 1 | ||
3533 | |||
3534 | for (S32 i = start_face; i <= end_face; i++) | ||
3535 | { | ||
3536 | const LLVolumeFace &face = getVolumeFace((U32)i); | ||
3537 | |||
3538 | LLVector3 box_center = (face.mExtents[0] + face.mExtents[1]) / 2.f; | ||
3539 | LLVector3 box_size = face.mExtents[1] - face.mExtents[0]; | ||
3540 | |||
3541 | if (LLLineSegmentBoxIntersect(start, end, box_center, box_size)) | ||
3542 | { | ||
3543 | if (bi_normal != NULL) // if the caller wants binormals, we may need to generate them | ||
3544 | { | ||
3545 | genBinormals(i); | ||
3546 | } | ||
3547 | |||
3548 | for (U32 tri = 0; tri < face.mIndices.size()/3; tri++) | ||
3549 | { | ||
3550 | S32 index1 = face.mIndices[tri*3+0]; | ||
3551 | S32 index2 = face.mIndices[tri*3+1]; | ||
3552 | S32 index3 = face.mIndices[tri*3+2]; | ||
3417 | 3553 | ||
3418 | for (U32 j = 0; j < face.mIndices.size()/3; j++) | 3554 | F32 a, b, t; |
3555 | |||
3556 | if (LLTriangleRayIntersect(face.mVertices[index1].mPosition, | ||
3557 | face.mVertices[index2].mPosition, | ||
3558 | face.mVertices[index3].mPosition, | ||
3559 | start, dir, &a, &b, &t, FALSE)) | ||
3560 | { | ||
3561 | if ((t >= 0.f) && // if hit is after start | ||
3562 | (t <= 1.f) && // and before end | ||
3563 | (t < closest_t)) // and this hit is closer | ||
3419 | { | 3564 | { |
3420 | //approximate normal | 3565 | closest_t = t; |
3421 | S32 v1 = face.mIndices[j*3+0]; | 3566 | hit_face = i; |
3422 | S32 v2 = face.mIndices[j*3+1]; | ||
3423 | S32 v3 = face.mIndices[j*3+2]; | ||
3424 | 3567 | ||
3425 | LLVector3 norm = (face.mVertices[v2].mPosition - face.mVertices[v1].mPosition) % | 3568 | if (intersection != NULL) |
3426 | (face.mVertices[v3].mPosition - face.mVertices[v2].mPosition); | 3569 | { |
3570 | *intersection = start + dir * closest_t; | ||
3571 | } | ||
3427 | 3572 | ||
3428 | if (norm.magVecSquared() >= 0.00000001f) | 3573 | if (tex_coord != NULL) |
3429 | { | 3574 | { |
3430 | //get view vector | 3575 | *tex_coord = ((1.f - a - b) * face.mVertices[index1].mTexCoord + |
3431 | //LLVector3 view = (start-face.mVertices[v1].mPosition); | 3576 | a * face.mVertices[index2].mTexCoord + |
3432 | //if (view * norm < 0.0f) | 3577 | b * face.mVertices[index3].mTexCoord); |
3578 | |||
3579 | } | ||
3580 | |||
3581 | if (normal != NULL) | ||
3433 | { | 3582 | { |
3434 | if (LLTriangleLineSegmentIntersect( face.mVertices[v1].mPosition, | 3583 | *normal = ((1.f - a - b) * face.mVertices[index1].mNormal + |
3435 | face.mVertices[v2].mPosition, | 3584 | a * face.mVertices[index2].mNormal + |
3436 | face.mVertices[v3].mPosition, | 3585 | b * face.mVertices[index3].mNormal); |
3437 | end, | 3586 | } |
3438 | vec)) | 3587 | |
3588 | if (bi_normal != NULL) | ||
3439 | { | 3589 | { |
3440 | vec = end-start; | 3590 | *bi_normal = ((1.f - a - b) * face.mVertices[index1].mBinormal + |
3441 | ret = (S32) i; | 3591 | a * face.mVertices[index2].mBinormal + |
3592 | b * face.mVertices[index3].mBinormal); | ||
3593 | } | ||
3594 | |||
3442 | } | 3595 | } |
3443 | } | 3596 | } |
3444 | } | 3597 | } |
3445 | } | 3598 | } |
3446 | } | 3599 | } |
3447 | 3600 | ||
3448 | return ret; | 3601 | |
3602 | return hit_face; | ||
3449 | } | 3603 | } |
3450 | 3604 | ||
3451 | class LLVertexIndexPair | 3605 | class LLVertexIndexPair |
@@ -4768,6 +4922,13 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) | |||
4768 | LLMemType m1(LLMemType::MTYPE_VOLUME); | 4922 | LLMemType m1(LLMemType::MTYPE_VOLUME); |
4769 | 4923 | ||
4770 | BOOL flat = mTypeMask & FLAT_MASK; | 4924 | BOOL flat = mTypeMask & FLAT_MASK; |
4925 | |||
4926 | U8 sculpt_type = volume->getParams().getSculptType(); | ||
4927 | U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; | ||
4928 | BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; | ||
4929 | BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; | ||
4930 | BOOL sculpt_reverse_horizontal = (sculpt_invert ? !sculpt_mirror : sculpt_mirror); // XOR | ||
4931 | |||
4771 | S32 num_vertices, num_indices; | 4932 | S32 num_vertices, num_indices; |
4772 | 4933 | ||
4773 | const std::vector<LLVolume::Point>& mesh = volume->getMesh(); | 4934 | const std::vector<LLVolume::Point>& mesh = volume->getMesh(); |
@@ -4834,6 +4995,11 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) | |||
4834 | } | 4995 | } |
4835 | } | 4996 | } |
4836 | 4997 | ||
4998 | if (sculpt_reverse_horizontal) | ||
4999 | { | ||
5000 | ss = 1.f - ss; | ||
5001 | } | ||
5002 | |||
4837 | // Check to see if this triangle wraps around the array. | 5003 | // Check to see if this triangle wraps around the array. |
4838 | if (mBeginS + s >= max_s) | 5004 | if (mBeginS + s >= max_s) |
4839 | { | 5005 | { |
@@ -4995,9 +5161,7 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) | |||
4995 | 5161 | ||
4996 | BOOL s_bottom_converges = ((mVertices[0].mPosition - mVertices[mNumS*(mNumT-2)].mPosition).magVecSquared() < 0.000001f); | 5162 | BOOL s_bottom_converges = ((mVertices[0].mPosition - mVertices[mNumS*(mNumT-2)].mPosition).magVecSquared() < 0.000001f); |
4997 | BOOL s_top_converges = ((mVertices[mNumS-1].mPosition - mVertices[mNumS*(mNumT-2)+mNumS-1].mPosition).magVecSquared() < 0.000001f); | 5163 | BOOL s_top_converges = ((mVertices[mNumS-1].mPosition - mVertices[mNumS*(mNumT-2)+mNumS-1].mPosition).magVecSquared() < 0.000001f); |
4998 | U8 sculpt_type = volume->getParams().getSculptType(); | 5164 | if (sculpt_stitching == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes |
4999 | |||
5000 | if (sculpt_type == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes | ||
5001 | { | 5165 | { |
5002 | if (volume->getPath().isOpen() == FALSE) | 5166 | if (volume->getPath().isOpen() == FALSE) |
5003 | { //wrap normals on T | 5167 | { //wrap normals on T |
@@ -5046,15 +5210,15 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build) | |||
5046 | BOOL wrap_s = FALSE; | 5210 | BOOL wrap_s = FALSE; |
5047 | BOOL wrap_t = FALSE; | 5211 | BOOL wrap_t = FALSE; |
5048 | 5212 | ||
5049 | if (sculpt_type == LL_SCULPT_TYPE_SPHERE) | 5213 | if (sculpt_stitching == LL_SCULPT_TYPE_SPHERE) |
5050 | average_poles = TRUE; | 5214 | average_poles = TRUE; |
5051 | 5215 | ||
5052 | if ((sculpt_type == LL_SCULPT_TYPE_SPHERE) || | 5216 | if ((sculpt_stitching == LL_SCULPT_TYPE_SPHERE) || |
5053 | (sculpt_type == LL_SCULPT_TYPE_TORUS) || | 5217 | (sculpt_stitching == LL_SCULPT_TYPE_TORUS) || |
5054 | (sculpt_type == LL_SCULPT_TYPE_CYLINDER)) | 5218 | (sculpt_stitching == LL_SCULPT_TYPE_CYLINDER)) |
5055 | wrap_s = TRUE; | 5219 | wrap_s = TRUE; |
5056 | 5220 | ||
5057 | if (sculpt_type == LL_SCULPT_TYPE_TORUS) | 5221 | if (sculpt_stitching == LL_SCULPT_TYPE_TORUS) |
5058 | wrap_t = TRUE; | 5222 | wrap_t = TRUE; |
5059 | 5223 | ||
5060 | 5224 | ||
diff --git a/linden/indra/llmath/llvolume.h b/linden/indra/llmath/llvolume.h index 5b48cfc..8ac0e71 100644 --- a/linden/indra/llmath/llvolume.h +++ b/linden/indra/llmath/llvolume.h | |||
@@ -175,7 +175,7 @@ const LLFaceID LL_FACE_OUTER_SIDE_3 = 0x1 << 8; | |||
175 | 175 | ||
176 | //============================================================================ | 176 | //============================================================================ |
177 | 177 | ||
178 | // sculpt types | 178 | // sculpt types + flags |
179 | 179 | ||
180 | const U8 LL_SCULPT_TYPE_NONE = 0; | 180 | const U8 LL_SCULPT_TYPE_NONE = 0; |
181 | const U8 LL_SCULPT_TYPE_SPHERE = 1; | 181 | const U8 LL_SCULPT_TYPE_SPHERE = 1; |
@@ -183,21 +183,30 @@ const U8 LL_SCULPT_TYPE_TORUS = 2; | |||
183 | const U8 LL_SCULPT_TYPE_PLANE = 3; | 183 | const U8 LL_SCULPT_TYPE_PLANE = 3; |
184 | const U8 LL_SCULPT_TYPE_CYLINDER = 4; | 184 | const U8 LL_SCULPT_TYPE_CYLINDER = 4; |
185 | 185 | ||
186 | const U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE | LL_SCULPT_TYPE_CYLINDER; | ||
187 | |||
188 | const U8 LL_SCULPT_FLAG_INVERT = 64; | ||
189 | const U8 LL_SCULPT_FLAG_MIRROR = 128; | ||
186 | 190 | ||
187 | 191 | ||
188 | class LLProfileParams | 192 | class LLProfileParams |
189 | { | 193 | { |
190 | public: | 194 | public: |
191 | LLProfileParams() | 195 | LLProfileParams() |
196 | : mCurveType(LL_PCODE_PROFILE_SQUARE), | ||
197 | mBegin(0.f), | ||
198 | mEnd(1.f), | ||
199 | mHollow(0.f), | ||
200 | mCRC(0) | ||
192 | { | 201 | { |
193 | mCurveType = LL_PCODE_PROFILE_SQUARE; | ||
194 | mBegin = 0.f; | ||
195 | mEnd = 1.f; | ||
196 | mHollow = 0.f; | ||
197 | } | 202 | } |
198 | 203 | ||
199 | LLProfileParams(U8 curve, F32 begin, F32 end, F32 hollow) | 204 | LLProfileParams(U8 curve, F32 begin, F32 end, F32 hollow) |
200 | : mCurveType(curve), mBegin(begin), mEnd(end), mHollow(hollow) | 205 | : mCurveType(curve), |
206 | mBegin(begin), | ||
207 | mEnd(end), | ||
208 | mHollow(hollow), | ||
209 | mCRC(0) | ||
201 | { | 210 | { |
202 | } | 211 | } |
203 | 212 | ||
@@ -222,6 +231,7 @@ public: | |||
222 | temp_f32 = 1.f; | 231 | temp_f32 = 1.f; |
223 | } | 232 | } |
224 | mHollow = temp_f32; | 233 | mHollow = temp_f32; |
234 | mCRC = 0; | ||
225 | } | 235 | } |
226 | 236 | ||
227 | bool operator==(const LLProfileParams ¶ms) const; | 237 | bool operator==(const LLProfileParams ¶ms) const; |
@@ -309,27 +319,36 @@ class LLPathParams | |||
309 | { | 319 | { |
310 | public: | 320 | public: |
311 | LLPathParams() | 321 | LLPathParams() |
322 | : | ||
323 | mCurveType(LL_PCODE_PATH_LINE), | ||
324 | mBegin(0.f), | ||
325 | mEnd(1.f), | ||
326 | mScale(1.f,1.f), | ||
327 | mShear(0.f,0.f), | ||
328 | mTwistBegin(0.f), | ||
329 | mTwistEnd(0.f), | ||
330 | mRadiusOffset(0.f), | ||
331 | mTaper(0.f,0.f), | ||
332 | mRevolutions(1.f), | ||
333 | mSkew(0.f), | ||
334 | mCRC(0) | ||
312 | { | 335 | { |
313 | mBegin = 0.f; | ||
314 | mEnd = 1.f; | ||
315 | mScale.setVec(1.f,1.f); | ||
316 | mShear.setVec(0.f,0.f); | ||
317 | mCurveType = LL_PCODE_PATH_LINE; | ||
318 | mTwistBegin = 0.f; | ||
319 | mTwistEnd = 0.f; | ||
320 | mRadiusOffset = 0.f; | ||
321 | mTaper.setVec(0.f,0.f); | ||
322 | mRevolutions = 1.f; | ||
323 | mSkew = 0.f; | ||
324 | } | 336 | } |
325 | 337 | ||
326 | LLPathParams(U8 curve, F32 begin, F32 end, F32 scx, F32 scy, F32 shx, F32 shy, F32 twistend, F32 twistbegin, F32 radiusoffset, F32 tx, F32 ty, F32 revolutions, F32 skew) | 338 | LLPathParams(U8 curve, F32 begin, F32 end, F32 scx, F32 scy, F32 shx, F32 shy, F32 twistend, F32 twistbegin, F32 radiusoffset, F32 tx, F32 ty, F32 revolutions, F32 skew) |
327 | : mCurveType(curve), mBegin(begin), mEnd(end), mTwistBegin(twistbegin), mTwistEnd(twistend), | 339 | : mCurveType(curve), |
328 | mRadiusOffset(radiusoffset), mRevolutions(revolutions), mSkew(skew) | 340 | mBegin(begin), |
341 | mEnd(end), | ||
342 | mScale(scx,scy), | ||
343 | mShear(shx,shy), | ||
344 | mTwistBegin(twistbegin), | ||
345 | mTwistEnd(twistend), | ||
346 | mRadiusOffset(radiusoffset), | ||
347 | mTaper(tx,ty), | ||
348 | mRevolutions(revolutions), | ||
349 | mSkew(skew), | ||
350 | mCRC(0) | ||
329 | { | 351 | { |
330 | mScale.setVec(scx,scy); | ||
331 | mShear.setVec(shx,shy); | ||
332 | mTaper.setVec(tx,ty); | ||
333 | } | 352 | } |
334 | 353 | ||
335 | LLPathParams(U8 curve, U16 begin, U16 end, U8 scx, U8 scy, U8 shx, U8 shy, U8 twistend, U8 twistbegin, U8 radiusoffset, U8 tx, U8 ty, U8 revolutions, U8 skew) | 354 | LLPathParams(U8 curve, U16 begin, U16 end, U8 scx, U8 scy, U8 shx, U8 shy, U8 twistend, U8 twistbegin, U8 radiusoffset, U8 tx, U8 ty, U8 revolutions, U8 skew) |
@@ -347,6 +366,8 @@ public: | |||
347 | mTaper.setVec(U8_TO_F32(tx) * TAPER_QUANTA,U8_TO_F32(ty) * TAPER_QUANTA); | 366 | mTaper.setVec(U8_TO_F32(tx) * TAPER_QUANTA,U8_TO_F32(ty) * TAPER_QUANTA); |
348 | mRevolutions = ((F32)revolutions) * REV_QUANTA + 1.0f; | 367 | mRevolutions = ((F32)revolutions) * REV_QUANTA + 1.0f; |
349 | mSkew = U8_TO_F32(skew) * SCALE_QUANTA; | 368 | mSkew = U8_TO_F32(skew) * SCALE_QUANTA; |
369 | |||
370 | mCRC = 0; | ||
350 | } | 371 | } |
351 | 372 | ||
352 | bool operator==(const LLPathParams ¶ms) const; | 373 | bool operator==(const LLPathParams ¶ms) const; |
@@ -525,6 +546,7 @@ class LLVolumeParams | |||
525 | { | 546 | { |
526 | public: | 547 | public: |
527 | LLVolumeParams() | 548 | LLVolumeParams() |
549 | : mSculptType(LL_SCULPT_TYPE_NONE) | ||
528 | { | 550 | { |
529 | } | 551 | } |
530 | 552 | ||
@@ -649,7 +671,9 @@ public: | |||
649 | mConcave(FALSE), | 671 | mConcave(FALSE), |
650 | mDirty(TRUE), | 672 | mDirty(TRUE), |
651 | mTotalOut(0), | 673 | mTotalOut(0), |
652 | mTotal(2) | 674 | mTotal(2), |
675 | mMinX(0.f), | ||
676 | mMaxX(0.f) | ||
653 | { | 677 | { |
654 | } | 678 | } |
655 | 679 | ||
@@ -660,7 +684,8 @@ public: | |||
660 | BOOL isFlat(S32 face) const { return (mFaces[face].mCount == 2); } | 684 | BOOL isFlat(S32 face) const { return (mFaces[face].mCount == 2); } |
661 | BOOL isOpen() const { return mOpen; } | 685 | BOOL isOpen() const { return mOpen; } |
662 | void setDirty() { mDirty = TRUE; } | 686 | void setDirty() { mDirty = TRUE; } |
663 | BOOL generate(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, BOOL is_sculpted = FALSE); | 687 | BOOL generate(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, |
688 | BOOL is_sculpted = FALSE, S32 sculpt_size = 0); | ||
664 | BOOL isConcave() const { return mConcave; } | 689 | BOOL isConcave() const { return mConcave; } |
665 | public: | 690 | public: |
666 | struct Face | 691 | struct Face |
@@ -678,8 +703,6 @@ public: | |||
678 | std::vector<Face> mFaces; | 703 | std::vector<Face> mFaces; |
679 | std::vector<LLVector3> mEdgeNormals; | 704 | std::vector<LLVector3> mEdgeNormals; |
680 | std::vector<LLVector3> mEdgeCenters; | 705 | std::vector<LLVector3> mEdgeCenters; |
681 | F32 mMaxX; | ||
682 | F32 mMinX; | ||
683 | 706 | ||
684 | friend std::ostream& operator<<(std::ostream &s, const LLProfile &profile); | 707 | friend std::ostream& operator<<(std::ostream &s, const LLProfile &profile); |
685 | 708 | ||
@@ -698,6 +721,9 @@ protected: | |||
698 | 721 | ||
699 | S32 mTotalOut; | 722 | S32 mTotalOut; |
700 | S32 mTotal; | 723 | S32 mTotal; |
724 | |||
725 | F32 mMaxX; | ||
726 | F32 mMinX; | ||
701 | }; | 727 | }; |
702 | 728 | ||
703 | //------------------------------------------------------------------- | 729 | //------------------------------------------------------------------- |
@@ -728,7 +754,8 @@ public: | |||
728 | virtual ~LLPath(); | 754 | virtual ~LLPath(); |
729 | 755 | ||
730 | void genNGon(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); | 756 | void genNGon(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); |
731 | virtual BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE); | 757 | virtual BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, |
758 | BOOL is_sculpted = FALSE, S32 sculpt_size = 0); | ||
732 | 759 | ||
733 | BOOL isOpen() const { return mOpen; } | 760 | BOOL isOpen() const { return mOpen; } |
734 | F32 getStep() const { return mStep; } | 761 | F32 getStep() const { return mStep; } |
@@ -754,7 +781,8 @@ class LLDynamicPath : public LLPath | |||
754 | { | 781 | { |
755 | public: | 782 | public: |
756 | LLDynamicPath() : LLPath() { } | 783 | LLDynamicPath() : LLPath() { } |
757 | /*virtual*/ BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE); | 784 | /*virtual*/ BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, |
785 | BOOL is_sculpted = FALSE, S32 sculpt_size = 0); | ||
758 | }; | 786 | }; |
759 | 787 | ||
760 | // Yet another "face" class - caches volume-specific, but not instance-specific data for faces) | 788 | // Yet another "face" class - caches volume-specific, but not instance-specific data for faces) |
@@ -885,7 +913,13 @@ public: | |||
885 | //get the face index of the face that intersects with the given line segment at the point | 913 | //get the face index of the face that intersects with the given line segment at the point |
886 | //closest to start. Moves end to the point of intersection. Returns -1 if no intersection. | 914 | //closest to start. Moves end to the point of intersection. Returns -1 if no intersection. |
887 | //Line segment must be in volume space. | 915 | //Line segment must be in volume space. |
888 | S32 lineSegmentIntersect(const LLVector3& start, LLVector3& end) const; | 916 | S32 lineSegmentIntersect(const LLVector3& start, const LLVector3& end, |
917 | S32 face = -1, // which face to check, -1 = ALL_SIDES | ||
918 | LLVector3* intersection = NULL, // return the intersection point | ||
919 | LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point | ||
920 | LLVector3* normal = NULL, // return the surface normal at the intersection point | ||
921 | LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point | ||
922 | ); | ||
889 | 923 | ||
890 | // The following cleans up vertices and triangles, | 924 | // The following cleans up vertices and triangles, |
891 | // getting rid of degenerate triangles and duplicate vertices, | 925 | // getting rid of degenerate triangles and duplicate vertices, |
@@ -916,6 +950,8 @@ private: | |||
916 | F32 sculptGetSurfaceArea(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data); | 950 | F32 sculptGetSurfaceArea(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data); |
917 | void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type); | 951 | void sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type); |
918 | void sculptGeneratePlaceholder(); | 952 | void sculptGeneratePlaceholder(); |
953 | void sculptCalcMeshResolution(U16 width, U16 height, U8 type, S32& s, S32& t); | ||
954 | |||
919 | 955 | ||
920 | protected: | 956 | protected: |
921 | BOOL generate(); | 957 | BOOL generate(); |
@@ -946,4 +982,10 @@ LLVector3 calc_binormal_from_triangle( | |||
946 | const LLVector3& pos2, | 982 | const LLVector3& pos2, |
947 | const LLVector2& tex2); | 983 | const LLVector2& tex2); |
948 | 984 | ||
985 | BOOL LLLineSegmentBoxIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); | ||
986 | BOOL LLTriangleRayIntersect(const LLVector3& vert0, const LLVector3& vert1, const LLVector3& vert2, const LLVector3& orig, const LLVector3& dir, | ||
987 | F32* intersection_a, F32* intersection_b, F32* intersection_t, BOOL two_sided); | ||
988 | |||
989 | |||
990 | |||
949 | #endif | 991 | #endif |
diff --git a/linden/indra/llmath/llvolumemgr.cpp b/linden/indra/llmath/llvolumemgr.cpp index 0b5464c..a3cd6b5 100644 --- a/linden/indra/llmath/llvolumemgr.cpp +++ b/linden/indra/llmath/llvolumemgr.cpp | |||
@@ -115,7 +115,7 @@ LLVolume* LLVolumeMgr::refVolume(const LLVolumeParams &volume_params, const S32 | |||
115 | { | 115 | { |
116 | mDataMutex->unlock(); | 116 | mDataMutex->unlock(); |
117 | } | 117 | } |
118 | return volgroupp->getLODVolume(detail); | 118 | return volgroupp->refLOD(detail); |
119 | } | 119 | } |
120 | 120 | ||
121 | // virtual | 121 | // virtual |
@@ -294,7 +294,7 @@ bool LLVolumeLODGroup::cleanupRefs() | |||
294 | return res; | 294 | return res; |
295 | } | 295 | } |
296 | 296 | ||
297 | LLVolume* LLVolumeLODGroup::getLODVolume(const S32 detail) | 297 | LLVolume* LLVolumeLODGroup::refLOD(const S32 detail) |
298 | { | 298 | { |
299 | llassert(detail >=0 && detail < NUM_LODS); | 299 | llassert(detail >=0 && detail < NUM_LODS); |
300 | mAccessCount[detail]++; | 300 | mAccessCount[detail]++; |
@@ -376,7 +376,6 @@ F32 LLVolumeLODGroup::getVolumeScaleFromDetail(const S32 detail) | |||
376 | 376 | ||
377 | F32 LLVolumeLODGroup::dump() | 377 | F32 LLVolumeLODGroup::dump() |
378 | { | 378 | { |
379 | char dump_str[255]; /* Flawfinder: ignore */ | ||
380 | F32 usage = 0.f; | 379 | F32 usage = 0.f; |
381 | for (S32 i = 0; i < NUM_LODS; i++) | 380 | for (S32 i = 0; i < NUM_LODS; i++) |
382 | { | 381 | { |
@@ -387,7 +386,7 @@ F32 LLVolumeLODGroup::dump() | |||
387 | } | 386 | } |
388 | usage = usage / (F32)NUM_LODS; | 387 | usage = usage / (F32)NUM_LODS; |
389 | 388 | ||
390 | snprintf(dump_str, sizeof(dump_str), "%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); /* Flawfinder: ignore */ | 389 | std::string dump_str = llformat("%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); |
391 | 390 | ||
392 | llinfos << dump_str << llendl; | 391 | llinfos << dump_str << llendl; |
393 | return usage; | 392 | return usage; |
diff --git a/linden/indra/llmath/llvolumemgr.h b/linden/indra/llmath/llvolumemgr.h index dcaca01..d579fed 100644 --- a/linden/indra/llmath/llvolumemgr.h +++ b/linden/indra/llmath/llvolumemgr.h | |||
@@ -59,7 +59,7 @@ public: | |||
59 | static void getDetailProximity(const F32 tan_angle, F32 &to_lower, F32& to_higher); | 59 | static void getDetailProximity(const F32 tan_angle, F32 &to_lower, F32& to_higher); |
60 | static F32 getVolumeScaleFromDetail(const S32 detail); | 60 | static F32 getVolumeScaleFromDetail(const S32 detail); |
61 | 61 | ||
62 | LLVolume* getLODVolume(const S32 detail); | 62 | LLVolume* refLOD(const S32 detail); |
63 | BOOL derefLOD(LLVolume *volumep); | 63 | BOOL derefLOD(LLVolume *volumep); |
64 | S32 getNumRefs() const { return mRefs; } | 64 | S32 getNumRefs() const { return mRefs; } |
65 | 65 | ||
diff --git a/linden/indra/llmath/v2math.cpp b/linden/indra/llmath/v2math.cpp index 76fa60f..c3bb093 100644 --- a/linden/indra/llmath/v2math.cpp +++ b/linden/indra/llmath/v2math.cpp | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | //#include "vmath.h" | 34 | //#include "vmath.h" |
35 | #include "v2math.h" | 35 | #include "v2math.h" |
36 | #include "v3math.h" | ||
36 | #include "v4math.h" | 37 | #include "v4math.h" |
37 | #include "m4math.h" | 38 | #include "m4math.h" |
38 | #include "m3math.h" | 39 | #include "m3math.h" |
diff --git a/linden/indra/llmath/v2math.h b/linden/indra/llmath/v2math.h index 5a520d2..350079d 100644 --- a/linden/indra/llmath/v2math.h +++ b/linden/indra/llmath/v2math.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #define LL_V2MATH_H | 33 | #define LL_V2MATH_H |
34 | 34 | ||
35 | #include "llmath.h" | 35 | #include "llmath.h" |
36 | #include "v3math.h" | ||
36 | 37 | ||
37 | class LLVector4; | 38 | class LLVector4; |
38 | class LLMatrix3; | 39 | class LLMatrix3; |
@@ -49,9 +50,10 @@ class LLVector2 | |||
49 | 50 | ||
50 | static LLVector2 zero; | 51 | static LLVector2 zero; |
51 | 52 | ||
52 | LLVector2(); // Initializes LLVector2 to (0, 0) | 53 | LLVector2(); // Initializes LLVector2 to (0, 0) |
53 | LLVector2(F32 x, F32 y); // Initializes LLVector2 to (x. y) | 54 | LLVector2(F32 x, F32 y); // Initializes LLVector2 to (x. y) |
54 | LLVector2(const F32 *vec); // Initializes LLVector2 to (vec[0]. vec[1]) | 55 | LLVector2(const F32 *vec); // Initializes LLVector2 to (vec[0]. vec[1]) |
56 | explicit LLVector2(const LLVector3 &vec); // Initializes LLVector2 to (vec[0]. vec[1]) | ||
55 | 57 | ||
56 | // Clears LLVector2 to (0, 0). DEPRECATED - prefer zeroVec. | 58 | // Clears LLVector2 to (0, 0). DEPRECATED - prefer zeroVec. |
57 | void clear(); | 59 | void clear(); |
@@ -137,6 +139,12 @@ inline LLVector2::LLVector2(const F32 *vec) | |||
137 | mV[VY] = vec[VY]; | 139 | mV[VY] = vec[VY]; |
138 | } | 140 | } |
139 | 141 | ||
142 | inline LLVector2::LLVector2(const LLVector3 &vec) | ||
143 | { | ||
144 | mV[VX] = vec.mV[VX]; | ||
145 | mV[VY] = vec.mV[VY]; | ||
146 | } | ||
147 | |||
140 | 148 | ||
141 | // Clear and Assignment Functions | 149 | // Clear and Assignment Functions |
142 | 150 | ||
diff --git a/linden/indra/llmath/v3color.h b/linden/indra/llmath/v3color.h index a3bf385..b9bc641 100644 --- a/linden/indra/llmath/v3color.h +++ b/linden/indra/llmath/v3color.h | |||
@@ -174,6 +174,10 @@ inline LLColor3::LLColor3(const F32 *vec) | |||
174 | mV[VZ] = vec[VZ]; | 174 | mV[VZ] = vec[VZ]; |
175 | } | 175 | } |
176 | 176 | ||
177 | #if LL_WINDOWS | ||
178 | # pragma warning( disable : 4996 ) // strncpy teh sux0r | ||
179 | #endif | ||
180 | |||
177 | inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF | 181 | inline LLColor3::LLColor3(char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF |
178 | { | 182 | { |
179 | if (strlen(color_string) < 6) /* Flawfinder: ignore */ | 183 | if (strlen(color_string) < 6) /* Flawfinder: ignore */ |
diff --git a/linden/indra/llmath/v3dmath.cpp b/linden/indra/llmath/v3dmath.cpp index b59f519..5a3246c 100644 --- a/linden/indra/llmath/v3dmath.cpp +++ b/linden/indra/llmath/v3dmath.cpp | |||
@@ -132,15 +132,15 @@ const LLVector3d& LLVector3d::rotVec(F64 angle, F64 x, F64 y, F64 z) | |||
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | BOOL LLVector3d::parseVector3d(const char* buf, LLVector3d* value) | 135 | BOOL LLVector3d::parseVector3d(const std::string& buf, LLVector3d* value) |
136 | { | 136 | { |
137 | if( buf == NULL || buf[0] == '\0' || value == NULL) | 137 | if( buf.empty() || value == NULL) |
138 | { | 138 | { |
139 | return FALSE; | 139 | return FALSE; |
140 | } | 140 | } |
141 | 141 | ||
142 | LLVector3d v; | 142 | LLVector3d v; |
143 | S32 count = sscanf( buf, "%lf %lf %lf", v.mdV + 0, v.mdV + 1, v.mdV + 2 ); | 143 | S32 count = sscanf( buf.c_str(), "%lf %lf %lf", v.mdV + 0, v.mdV + 1, v.mdV + 2 ); |
144 | if( 3 == count ) | 144 | if( 3 == count ) |
145 | { | 145 | { |
146 | value->setVec( v ); | 146 | value->setVec( v ); |
diff --git a/linden/indra/llmath/v3dmath.h b/linden/indra/llmath/v3dmath.h index 9bd80b8..ecb333a 100644 --- a/linden/indra/llmath/v3dmath.h +++ b/linden/indra/llmath/v3dmath.h | |||
@@ -95,6 +95,10 @@ class LLVector3d | |||
95 | F64 magVecSquared() const; // Returns magnitude squared of LLVector3d | 95 | F64 magVecSquared() const; // Returns magnitude squared of LLVector3d |
96 | inline F64 normVec(); // Normalizes and returns the magnitude of LLVector3d | 96 | inline F64 normVec(); // Normalizes and returns the magnitude of LLVector3d |
97 | 97 | ||
98 | F64 length() const; // Returns magnitude of LLVector3d | ||
99 | F64 lengthSquared() const; // Returns magnitude squared of LLVector3d | ||
100 | inline F64 normalize(); // Normalizes and returns the magnitude of LLVector3d | ||
101 | |||
98 | const LLVector3d& rotVec(const F64 angle, const LLVector3d &vec); // Rotates about vec by angle radians | 102 | const LLVector3d& rotVec(const F64 angle, const LLVector3d &vec); // Rotates about vec by angle radians |
99 | const LLVector3d& rotVec(const F64 angle, const F64 x, const F64 y, const F64 z); // Rotates about x,y,z by angle radians | 103 | const LLVector3d& rotVec(const F64 angle, const F64 x, const F64 y, const F64 z); // Rotates about x,y,z by angle radians |
100 | const LLVector3d& rotVec(const LLMatrix3 &mat); // Rotates by LLMatrix4 mat | 104 | const LLVector3d& rotVec(const LLMatrix3 &mat); // Rotates by LLMatrix4 mat |
@@ -128,7 +132,7 @@ class LLVector3d | |||
128 | 132 | ||
129 | friend std::ostream& operator<<(std::ostream& s, const LLVector3d &a); // Stream a | 133 | friend std::ostream& operator<<(std::ostream& s, const LLVector3d &a); // Stream a |
130 | 134 | ||
131 | static BOOL parseVector3d(const char* buf, LLVector3d* value); | 135 | static BOOL parseVector3d(const std::string& buf, LLVector3d* value); |
132 | 136 | ||
133 | }; | 137 | }; |
134 | 138 | ||
@@ -261,6 +265,28 @@ inline F64 LLVector3d::normVec(void) | |||
261 | return (mag); | 265 | return (mag); |
262 | } | 266 | } |
263 | 267 | ||
268 | inline F64 LLVector3d::normalize(void) | ||
269 | { | ||
270 | F64 mag = fsqrtf(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]); | ||
271 | F64 oomag; | ||
272 | |||
273 | if (mag > FP_MAG_THRESHOLD) | ||
274 | { | ||
275 | oomag = 1.f/mag; | ||
276 | mdV[0] *= oomag; | ||
277 | mdV[1] *= oomag; | ||
278 | mdV[2] *= oomag; | ||
279 | } | ||
280 | else | ||
281 | { | ||
282 | mdV[0] = 0.f; | ||
283 | mdV[1] = 0.f; | ||
284 | mdV[2] = 0.f; | ||
285 | mag = 0; | ||
286 | } | ||
287 | return (mag); | ||
288 | } | ||
289 | |||
264 | // LLVector3d Magnitude and Normalization Functions | 290 | // LLVector3d Magnitude and Normalization Functions |
265 | 291 | ||
266 | inline F64 LLVector3d::magVec(void) const | 292 | inline F64 LLVector3d::magVec(void) const |
@@ -273,6 +299,16 @@ inline F64 LLVector3d::magVecSquared(void) const | |||
273 | return mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]; | 299 | return mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]; |
274 | } | 300 | } |
275 | 301 | ||
302 | inline F64 LLVector3d::length(void) const | ||
303 | { | ||
304 | return fsqrtf(mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]); | ||
305 | } | ||
306 | |||
307 | inline F64 LLVector3d::lengthSquared(void) const | ||
308 | { | ||
309 | return mdV[0]*mdV[0] + mdV[1]*mdV[1] + mdV[2]*mdV[2]; | ||
310 | } | ||
311 | |||
276 | inline LLVector3d operator+(const LLVector3d &a, const LLVector3d &b) | 312 | inline LLVector3d operator+(const LLVector3d &a, const LLVector3d &b) |
277 | { | 313 | { |
278 | LLVector3d c(a); | 314 | LLVector3d c(a); |
@@ -416,8 +452,8 @@ inline F64 angle_between(const LLVector3d& a, const LLVector3d& b) | |||
416 | { | 452 | { |
417 | LLVector3d an = a; | 453 | LLVector3d an = a; |
418 | LLVector3d bn = b; | 454 | LLVector3d bn = b; |
419 | an.normVec(); | 455 | an.normalize(); |
420 | bn.normVec(); | 456 | bn.normalize(); |
421 | F64 cosine = an * bn; | 457 | F64 cosine = an * bn; |
422 | F64 angle = (cosine >= 1.0f) ? 0.0f : | 458 | F64 angle = (cosine >= 1.0f) ? 0.0f : |
423 | (cosine <= -1.0f) ? F_PI : | 459 | (cosine <= -1.0f) ? F_PI : |
@@ -429,8 +465,8 @@ inline BOOL are_parallel(const LLVector3d &a, const LLVector3d &b, const F64 eps | |||
429 | { | 465 | { |
430 | LLVector3d an = a; | 466 | LLVector3d an = a; |
431 | LLVector3d bn = b; | 467 | LLVector3d bn = b; |
432 | an.normVec(); | 468 | an.normalize(); |
433 | bn.normVec(); | 469 | bn.normalize(); |
434 | F64 dot = an * bn; | 470 | F64 dot = an * bn; |
435 | if ( (1.0f - fabs(dot)) < epsilon) | 471 | if ( (1.0f - fabs(dot)) < epsilon) |
436 | { | 472 | { |
@@ -443,7 +479,7 @@ inline BOOL are_parallel(const LLVector3d &a, const LLVector3d &b, const F64 eps | |||
443 | inline LLVector3d projected_vec(const LLVector3d &a, const LLVector3d &b) | 479 | inline LLVector3d projected_vec(const LLVector3d &a, const LLVector3d &b) |
444 | { | 480 | { |
445 | LLVector3d project_axis = b; | 481 | LLVector3d project_axis = b; |
446 | project_axis.normVec(); | 482 | project_axis.normalize(); |
447 | return project_axis * (a * project_axis); | 483 | return project_axis * (a * project_axis); |
448 | } | 484 | } |
449 | 485 | ||
diff --git a/linden/indra/llmath/v3math.cpp b/linden/indra/llmath/v3math.cpp index bbe460f..cb87836 100644 --- a/linden/indra/llmath/v3math.cpp +++ b/linden/indra/llmath/v3math.cpp | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "v3math.h" | 34 | #include "v3math.h" |
35 | 35 | ||
36 | //#include "vmath.h" | 36 | //#include "vmath.h" |
37 | #include "v2math.h" | ||
37 | #include "v4math.h" | 38 | #include "v4math.h" |
38 | #include "m4math.h" | 39 | #include "m4math.h" |
39 | #include "m3math.h" | 40 | #include "m3math.h" |
@@ -73,6 +74,72 @@ BOOL LLVector3::clamp(F32 min, F32 max) | |||
73 | return ret; | 74 | return ret; |
74 | } | 75 | } |
75 | 76 | ||
77 | // Clamps length to an upper limit. | ||
78 | // Returns TRUE if the data changed | ||
79 | BOOL LLVector3::clampLength( F32 length_limit ) | ||
80 | { | ||
81 | BOOL changed = FALSE; | ||
82 | |||
83 | F32 len = length(); | ||
84 | if (llfinite(len)) | ||
85 | { | ||
86 | if ( len > length_limit) | ||
87 | { | ||
88 | normalize(); | ||
89 | if (length_limit < 0.f) | ||
90 | { | ||
91 | length_limit = 0.f; | ||
92 | } | ||
93 | mV[0] *= length_limit; | ||
94 | mV[1] *= length_limit; | ||
95 | mV[2] *= length_limit; | ||
96 | changed = TRUE; | ||
97 | } | ||
98 | } | ||
99 | else | ||
100 | { // this vector may still be salvagable | ||
101 | F32 max_abs_component = 0.f; | ||
102 | for (S32 i = 0; i < 3; ++i) | ||
103 | { | ||
104 | F32 abs_component = fabs(mV[i]); | ||
105 | if (llfinite(abs_component)) | ||
106 | { | ||
107 | if (abs_component > max_abs_component) | ||
108 | { | ||
109 | max_abs_component = abs_component; | ||
110 | } | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | // no it can't be salvaged --> clear it | ||
115 | clear(); | ||
116 | changed = TRUE; | ||
117 | break; | ||
118 | } | ||
119 | } | ||
120 | if (!changed) | ||
121 | { | ||
122 | // yes it can be salvaged --> | ||
123 | // bring the components down before we normalize | ||
124 | mV[0] /= max_abs_component; | ||
125 | mV[1] /= max_abs_component; | ||
126 | mV[2] /= max_abs_component; | ||
127 | normalize(); | ||
128 | |||
129 | if (length_limit < 0.f) | ||
130 | { | ||
131 | length_limit = 0.f; | ||
132 | } | ||
133 | mV[0] *= length_limit; | ||
134 | mV[1] *= length_limit; | ||
135 | mV[2] *= length_limit; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | return changed; | ||
140 | } | ||
141 | |||
142 | |||
76 | // Sets all values to absolute value of their original values | 143 | // Sets all values to absolute value of their original values |
77 | // Returns TRUE if data changed | 144 | // Returns TRUE if data changed |
78 | BOOL LLVector3::abs() | 145 | BOOL LLVector3::abs() |
@@ -204,6 +271,13 @@ const LLVector3& LLVector3::setVec(const LLVector4 &vec) | |||
204 | return (*this); | 271 | return (*this); |
205 | } | 272 | } |
206 | 273 | ||
274 | LLVector3::LLVector3(const LLVector2 &vec) | ||
275 | { | ||
276 | mV[VX] = (F32)vec.mV[VX]; | ||
277 | mV[VY] = (F32)vec.mV[VY]; | ||
278 | mV[VZ] = 0; | ||
279 | } | ||
280 | |||
207 | LLVector3::LLVector3(const LLVector3d &vec) | 281 | LLVector3::LLVector3(const LLVector3d &vec) |
208 | { | 282 | { |
209 | mV[VX] = (F32)vec.mdV[VX]; | 283 | mV[VX] = (F32)vec.mdV[VX]; |
@@ -260,15 +334,15 @@ const LLVector3& operator*=(LLVector3 &a, const LLQuaternion &rot) | |||
260 | } | 334 | } |
261 | 335 | ||
262 | // static | 336 | // static |
263 | BOOL LLVector3::parseVector3(const char* buf, LLVector3* value) | 337 | BOOL LLVector3::parseVector3(const std::string& buf, LLVector3* value) |
264 | { | 338 | { |
265 | if( buf == NULL || buf[0] == '\0' || value == NULL) | 339 | if( buf.empty() || value == NULL) |
266 | { | 340 | { |
267 | return FALSE; | 341 | return FALSE; |
268 | } | 342 | } |
269 | 343 | ||
270 | LLVector3 v; | 344 | LLVector3 v; |
271 | S32 count = sscanf( buf, "%f %f %f", v.mV + 0, v.mV + 1, v.mV + 2 ); | 345 | S32 count = sscanf( buf.c_str(), "%f %f %f", v.mV + 0, v.mV + 1, v.mV + 2 ); |
272 | if( 3 == count ) | 346 | if( 3 == count ) |
273 | { | 347 | { |
274 | value->setVec( v ); | 348 | value->setVec( v ); |
diff --git a/linden/indra/llmath/v3math.h b/linden/indra/llmath/v3math.h index ddb5e1f..65932cd 100644 --- a/linden/indra/llmath/v3math.h +++ b/linden/indra/llmath/v3math.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "llmath.h" | 36 | #include "llmath.h" |
37 | 37 | ||
38 | #include "llsd.h" | 38 | #include "llsd.h" |
39 | class LLVector2; | ||
39 | class LLVector4; | 40 | class LLVector4; |
40 | class LLMatrix3; | 41 | class LLMatrix3; |
41 | class LLVector3d; | 42 | class LLVector3d; |
@@ -62,6 +63,7 @@ class LLVector3 | |||
62 | inline LLVector3(); // Initializes LLVector3 to (0, 0, 0) | 63 | inline LLVector3(); // Initializes LLVector3 to (0, 0, 0) |
63 | inline LLVector3(const F32 x, const F32 y, const F32 z); // Initializes LLVector3 to (x. y, z) | 64 | inline LLVector3(const F32 x, const F32 y, const F32 z); // Initializes LLVector3 to (x. y, z) |
64 | inline explicit LLVector3(const F32 *vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2]) | 65 | inline explicit LLVector3(const F32 *vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2]) |
66 | explicit LLVector3(const LLVector2 &vec); // Initializes LLVector3 to (vec[0]. vec[1], 0) | ||
65 | explicit LLVector3(const LLVector3d &vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2]) | 67 | explicit LLVector3(const LLVector3d &vec); // Initializes LLVector3 to (vec[0]. vec[1], vec[2]) |
66 | explicit LLVector3(const LLVector4 &vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2]) | 68 | explicit LLVector3(const LLVector4 &vec); // Initializes LLVector4 to (vec[0]. vec[1], vec[2]) |
67 | LLVector3(const LLSD& sd); | 69 | LLVector3(const LLSD& sd); |
@@ -74,6 +76,7 @@ class LLVector3 | |||
74 | 76 | ||
75 | inline BOOL isFinite() const; // checks to see if all values of LLVector3 are finite | 77 | inline BOOL isFinite() const; // checks to see if all values of LLVector3 are finite |
76 | BOOL clamp(F32 min, F32 max); // Clamps all values to (min,max), returns TRUE if data changed | 78 | BOOL clamp(F32 min, F32 max); // Clamps all values to (min,max), returns TRUE if data changed |
79 | BOOL clampLength( F32 length_limit ); // Scales vector to limit length to a value | ||
77 | 80 | ||
78 | void quantize16(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization | 81 | void quantize16(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization |
79 | void quantize8(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization | 82 | void quantize8(F32 lowerxy, F32 upperxy, F32 lowerz, F32 upperz); // changes the vector to reflect quatization |
@@ -147,7 +150,7 @@ class LLVector3 | |||
147 | 150 | ||
148 | friend std::ostream& operator<<(std::ostream& s, const LLVector3 &a); // Stream a | 151 | friend std::ostream& operator<<(std::ostream& s, const LLVector3 &a); // Stream a |
149 | 152 | ||
150 | static BOOL parseVector3(const char* buf, LLVector3* value); | 153 | static BOOL parseVector3(const std::string& buf, LLVector3* value); |
151 | }; | 154 | }; |
152 | 155 | ||
153 | typedef LLVector3 LLSimLocalVec; | 156 | typedef LLVector3 LLSimLocalVec; |
diff --git a/linden/indra/llmath/v4color.cpp b/linden/indra/llmath/v4color.cpp index 8e6907e..88237a0 100644 --- a/linden/indra/llmath/v4color.cpp +++ b/linden/indra/llmath/v4color.cpp | |||
@@ -286,16 +286,14 @@ void LLColor4::calcHSL(F32* hue, F32* saturation, F32* luminance) const | |||
286 | } | 286 | } |
287 | 287 | ||
288 | // static | 288 | // static |
289 | BOOL LLColor4::parseColor(const char* buf, LLColor4* color) | 289 | BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) |
290 | { | 290 | { |
291 | if( buf == NULL || buf[0] == '\0' || color == NULL) | 291 | if( buf.empty() || color == NULL) |
292 | { | 292 | { |
293 | return FALSE; | 293 | return FALSE; |
294 | } | 294 | } |
295 | 295 | ||
296 | LLString full_string(buf); | 296 | boost_tokenizer tokens(buf, boost::char_separator<char>(", ")); |
297 | |||
298 | boost_tokenizer tokens(full_string, boost::char_separator<char>(", ")); | ||
299 | boost_tokenizer::iterator token_iter = tokens.begin(); | 297 | boost_tokenizer::iterator token_iter = tokens.begin(); |
300 | if (token_iter == tokens.end()) | 298 | if (token_iter == tokens.end()) |
301 | { | 299 | { |
@@ -304,15 +302,15 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) | |||
304 | 302 | ||
305 | // Grab the first token into a string, since we don't know | 303 | // Grab the first token into a string, since we don't know |
306 | // if this is a float or a color name. | 304 | // if this is a float or a color name. |
307 | LLString color_name( (*token_iter) ); | 305 | std::string color_name( (*token_iter) ); |
308 | ++token_iter; | 306 | ++token_iter; |
309 | 307 | ||
310 | if (token_iter != tokens.end()) | 308 | if (token_iter != tokens.end()) |
311 | { | 309 | { |
312 | // There are more tokens to read. This must be a vector. | 310 | // There are more tokens to read. This must be a vector. |
313 | LLColor4 v; | 311 | LLColor4 v; |
314 | LLString::convertToF32( color_name, v.mV[VX] ); | 312 | LLStringUtil::convertToF32( color_name, v.mV[VX] ); |
315 | LLString::convertToF32( *token_iter, v.mV[VY] ); | 313 | LLStringUtil::convertToF32( *token_iter, v.mV[VY] ); |
316 | v.mV[VZ] = 0.0f; | 314 | v.mV[VZ] = 0.0f; |
317 | v.mV[VW] = 1.0f; | 315 | v.mV[VW] = 1.0f; |
318 | 316 | ||
@@ -320,18 +318,18 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) | |||
320 | if (token_iter == tokens.end()) | 318 | if (token_iter == tokens.end()) |
321 | { | 319 | { |
322 | // This is a malformed vector. | 320 | // This is a malformed vector. |
323 | llwarns << "LLColor4::parseColor() malformed color " << full_string << llendl; | 321 | llwarns << "LLColor4::parseColor() malformed color " << buf << llendl; |
324 | } | 322 | } |
325 | else | 323 | else |
326 | { | 324 | { |
327 | // There is a z-component. | 325 | // There is a z-component. |
328 | LLString::convertToF32( *token_iter, v.mV[VZ] ); | 326 | LLStringUtil::convertToF32( *token_iter, v.mV[VZ] ); |
329 | 327 | ||
330 | ++token_iter; | 328 | ++token_iter; |
331 | if (token_iter != tokens.end()) | 329 | if (token_iter != tokens.end()) |
332 | { | 330 | { |
333 | // There is an alpha component. | 331 | // There is an alpha component. |
334 | LLString::convertToF32( *token_iter, v.mV[VW] ); | 332 | LLStringUtil::convertToF32( *token_iter, v.mV[VW] ); |
335 | } | 333 | } |
336 | } | 334 | } |
337 | 335 | ||
@@ -615,19 +613,19 @@ BOOL LLColor4::parseColor(const char* buf, LLColor4* color) | |||
615 | } | 613 | } |
616 | 614 | ||
617 | // static | 615 | // static |
618 | BOOL LLColor4::parseColor4(const char* buf, LLColor4* value) | 616 | BOOL LLColor4::parseColor4(const std::string& buf, LLColor4* value) |
619 | { | 617 | { |
620 | if( buf == NULL || buf[0] == '\0' || value == NULL) | 618 | if( buf.empty() || value == NULL) |
621 | { | 619 | { |
622 | return FALSE; | 620 | return FALSE; |
623 | } | 621 | } |
624 | 622 | ||
625 | LLColor4 v; | 623 | LLColor4 v; |
626 | S32 count = sscanf( buf, "%f, %f, %f, %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); | 624 | S32 count = sscanf( buf.c_str(), "%f, %f, %f, %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); |
627 | if (1 == count ) | 625 | if (1 == count ) |
628 | { | 626 | { |
629 | // try this format | 627 | // try this format |
630 | count = sscanf( buf, "%f %f %f %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); | 628 | count = sscanf( buf.c_str(), "%f %f %f %f", v.mV + 0, v.mV + 1, v.mV + 2, v.mV + 3 ); |
631 | } | 629 | } |
632 | if( 4 == count ) | 630 | if( 4 == count ) |
633 | { | 631 | { |
diff --git a/linden/indra/llmath/v4color.h b/linden/indra/llmath/v4color.h index a2c0fb6..53e4407 100644 --- a/linden/indra/llmath/v4color.h +++ b/linden/indra/llmath/v4color.h | |||
@@ -211,8 +211,8 @@ class LLColor4 | |||
211 | static LLColor4 cyan5; | 211 | static LLColor4 cyan5; |
212 | static LLColor4 cyan6; | 212 | static LLColor4 cyan6; |
213 | 213 | ||
214 | static BOOL parseColor(const char* buf, LLColor4* color); | 214 | static BOOL parseColor(const std::string& buf, LLColor4* color); |
215 | static BOOL parseColor4(const char* buf, LLColor4* color); | 215 | static BOOL parseColor4(const std::string& buf, LLColor4* color); |
216 | 216 | ||
217 | inline void clamp(); | 217 | inline void clamp(); |
218 | }; | 218 | }; |
diff --git a/linden/indra/llmath/v4coloru.cpp b/linden/indra/llmath/v4coloru.cpp index 56a8413..7ad7eb2 100644 --- a/linden/indra/llmath/v4coloru.cpp +++ b/linden/indra/llmath/v4coloru.cpp | |||
@@ -93,19 +93,19 @@ std::ostream& operator<<(std::ostream& s, const LLColor4U &a) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | // static | 95 | // static |
96 | BOOL LLColor4U::parseColor4U(const char* buf, LLColor4U* value) | 96 | BOOL LLColor4U::parseColor4U(const std::string& buf, LLColor4U* value) |
97 | { | 97 | { |
98 | if( buf == NULL || buf[0] == '\0' || value == NULL) | 98 | if( buf.empty() || value == NULL) |
99 | { | 99 | { |
100 | return FALSE; | 100 | return FALSE; |
101 | } | 101 | } |
102 | 102 | ||
103 | U32 v[4]; | 103 | U32 v[4]; |
104 | S32 count = sscanf( buf, "%u, %u, %u, %u", v + 0, v + 1, v + 2, v + 3 ); | 104 | S32 count = sscanf( buf.c_str(), "%u, %u, %u, %u", v + 0, v + 1, v + 2, v + 3 ); |
105 | if (1 == count ) | 105 | if (1 == count ) |
106 | { | 106 | { |
107 | // try this format | 107 | // try this format |
108 | count = sscanf( buf, "%u %u %u %u", v + 0, v + 1, v + 2, v + 3 ); | 108 | count = sscanf( buf.c_str(), "%u %u %u %u", v + 0, v + 1, v + 2, v + 3 ); |
109 | } | 109 | } |
110 | if( 4 != count ) | 110 | if( 4 != count ) |
111 | { | 111 | { |
diff --git a/linden/indra/llmath/v4coloru.h b/linden/indra/llmath/v4coloru.h index c9c5418..910a081 100644 --- a/linden/indra/llmath/v4coloru.h +++ b/linden/indra/llmath/v4coloru.h | |||
@@ -127,7 +127,7 @@ public: | |||
127 | inline void setVecScaleClamp(const LLColor3 &color); | 127 | inline void setVecScaleClamp(const LLColor3 &color); |
128 | inline void setVecScaleClamp(const LLColor4 &color); | 128 | inline void setVecScaleClamp(const LLColor4 &color); |
129 | 129 | ||
130 | static BOOL parseColor4U(const char* buf, LLColor4U* value); | 130 | static BOOL parseColor4U(const std::string& buf, LLColor4U* value); |
131 | 131 | ||
132 | static LLColor4U white; | 132 | static LLColor4U white; |
133 | static LLColor4U black; | 133 | static LLColor4U black; |