aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmath/v4color.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmath/v4color.cpp')
-rw-r--r--linden/indra/llmath/v4color.cpp166
1 files changed, 100 insertions, 66 deletions
diff --git a/linden/indra/llmath/v4color.cpp b/linden/indra/llmath/v4color.cpp
index 88237a0..b105769 100644
--- a/linden/indra/llmath/v4color.cpp
+++ b/linden/indra/llmath/v4color.cpp
@@ -161,6 +161,38 @@ LLColor4::LLColor4(const LLVector4& vector4)
161 mV[VW] = vector4.mV[VW]; 161 mV[VW] = vector4.mV[VW];
162} 162}
163 163
164const LLColor4& LLColor4::set(const LLColor4U& color4u)
165{
166 const F32 SCALE = 1.f/255.f;
167 mV[VX] = color4u.mV[VX] * SCALE;
168 mV[VY] = color4u.mV[VY] * SCALE;
169 mV[VZ] = color4u.mV[VZ] * SCALE;
170 mV[VW] = color4u.mV[VW] * SCALE;
171 return (*this);
172}
173
174const LLColor4& LLColor4::set(const LLColor3 &vec)
175{
176 mV[VX] = vec.mV[VX];
177 mV[VY] = vec.mV[VY];
178 mV[VZ] = vec.mV[VZ];
179
180// no change to alpha!
181// mV[VW] = 1.f;
182
183 return (*this);
184}
185
186const LLColor4& LLColor4::set(const LLColor3 &vec, F32 a)
187{
188 mV[VX] = vec.mV[VX];
189 mV[VY] = vec.mV[VY];
190 mV[VZ] = vec.mV[VZ];
191 mV[VW] = a;
192 return (*this);
193}
194
195// deprecated -- use set()
164const LLColor4& LLColor4::setVec(const LLColor4U& color4u) 196const LLColor4& LLColor4::setVec(const LLColor4U& color4u)
165{ 197{
166 const F32 SCALE = 1.f/255.f; 198 const F32 SCALE = 1.f/255.f;
@@ -171,6 +203,7 @@ const LLColor4& LLColor4::setVec(const LLColor4U& color4u)
171 return (*this); 203 return (*this);
172} 204}
173 205
206// deprecated -- use set()
174const LLColor4& LLColor4::setVec(const LLColor3 &vec) 207const LLColor4& LLColor4::setVec(const LLColor3 &vec)
175{ 208{
176 mV[VX] = vec.mV[VX]; 209 mV[VX] = vec.mV[VX];
@@ -183,6 +216,7 @@ const LLColor4& LLColor4::setVec(const LLColor3 &vec)
183 return (*this); 216 return (*this);
184} 217}
185 218
219// deprecated -- use set()
186const LLColor4& LLColor4::setVec(const LLColor3 &vec, F32 a) 220const LLColor4& LLColor4::setVec(const LLColor3 &vec, F32 a)
187{ 221{
188 mV[VX] = vec.mV[VX]; 222 mV[VX] = vec.mV[VX];
@@ -338,270 +372,270 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color)
338 { 372 {
339 v = v * (1.f / 255.f); 373 v = v * (1.f / 255.f);
340 } 374 }
341 color->setVec( v ); 375 color->set( v );
342 } 376 }
343 else // Single value. Read as a named color. 377 else // Single value. Read as a named color.
344 { 378 {
345 // We have a color name 379 // We have a color name
346 if ( "red" == color_name ) 380 if ( "red" == color_name )
347 { 381 {
348 color->setVec(LLColor4::red); 382 color->set(LLColor4::red);
349 } 383 }
350 else if ( "red1" == color_name ) 384 else if ( "red1" == color_name )
351 { 385 {
352 color->setVec(LLColor4::red1); 386 color->set(LLColor4::red1);
353 } 387 }
354 else if ( "red2" == color_name ) 388 else if ( "red2" == color_name )
355 { 389 {
356 color->setVec(LLColor4::red2); 390 color->set(LLColor4::red2);
357 } 391 }
358 else if ( "red3" == color_name ) 392 else if ( "red3" == color_name )
359 { 393 {
360 color->setVec(LLColor4::red3); 394 color->set(LLColor4::red3);
361 } 395 }
362 else if ( "red4" == color_name ) 396 else if ( "red4" == color_name )
363 { 397 {
364 color->setVec(LLColor4::red4); 398 color->set(LLColor4::red4);
365 } 399 }
366 else if ( "red5" == color_name ) 400 else if ( "red5" == color_name )
367 { 401 {
368 color->setVec(LLColor4::red5); 402 color->set(LLColor4::red5);
369 } 403 }
370 else if( "green" == color_name ) 404 else if( "green" == color_name )
371 { 405 {
372 color->setVec(LLColor4::green); 406 color->set(LLColor4::green);
373 } 407 }
374 else if( "green1" == color_name ) 408 else if( "green1" == color_name )
375 { 409 {
376 color->setVec(LLColor4::green1); 410 color->set(LLColor4::green1);
377 } 411 }
378 else if( "green2" == color_name ) 412 else if( "green2" == color_name )
379 { 413 {
380 color->setVec(LLColor4::green2); 414 color->set(LLColor4::green2);
381 } 415 }
382 else if( "green3" == color_name ) 416 else if( "green3" == color_name )
383 { 417 {
384 color->setVec(LLColor4::green3); 418 color->set(LLColor4::green3);
385 } 419 }
386 else if( "green4" == color_name ) 420 else if( "green4" == color_name )
387 { 421 {
388 color->setVec(LLColor4::green4); 422 color->set(LLColor4::green4);
389 } 423 }
390 else if( "green5" == color_name ) 424 else if( "green5" == color_name )
391 { 425 {
392 color->setVec(LLColor4::green5); 426 color->set(LLColor4::green5);
393 } 427 }
394 else if( "green6" == color_name ) 428 else if( "green6" == color_name )
395 { 429 {
396 color->setVec(LLColor4::green6); 430 color->set(LLColor4::green6);
397 } 431 }
398 else if( "blue" == color_name ) 432 else if( "blue" == color_name )
399 { 433 {
400 color->setVec(LLColor4::blue); 434 color->set(LLColor4::blue);
401 } 435 }
402 else if( "blue1" == color_name ) 436 else if( "blue1" == color_name )
403 { 437 {
404 color->setVec(LLColor4::blue1); 438 color->set(LLColor4::blue1);
405 } 439 }
406 else if( "blue2" == color_name ) 440 else if( "blue2" == color_name )
407 { 441 {
408 color->setVec(LLColor4::blue2); 442 color->set(LLColor4::blue2);
409 } 443 }
410 else if( "blue3" == color_name ) 444 else if( "blue3" == color_name )
411 { 445 {
412 color->setVec(LLColor4::blue3); 446 color->set(LLColor4::blue3);
413 } 447 }
414 else if( "blue4" == color_name ) 448 else if( "blue4" == color_name )
415 { 449 {
416 color->setVec(LLColor4::blue4); 450 color->set(LLColor4::blue4);
417 } 451 }
418 else if( "blue5" == color_name ) 452 else if( "blue5" == color_name )
419 { 453 {
420 color->setVec(LLColor4::blue5); 454 color->set(LLColor4::blue5);
421 } 455 }
422 else if( "blue6" == color_name ) 456 else if( "blue6" == color_name )
423 { 457 {
424 color->setVec(LLColor4::blue6); 458 color->set(LLColor4::blue6);
425 } 459 }
426 else if( "black" == color_name ) 460 else if( "black" == color_name )
427 { 461 {
428 color->setVec(LLColor4::black); 462 color->set(LLColor4::black);
429 } 463 }
430 else if( "white" == color_name ) 464 else if( "white" == color_name )
431 { 465 {
432 color->setVec(LLColor4::white); 466 color->set(LLColor4::white);
433 } 467 }
434 else if( "yellow" == color_name ) 468 else if( "yellow" == color_name )
435 { 469 {
436 color->setVec(LLColor4::yellow); 470 color->set(LLColor4::yellow);
437 } 471 }
438 else if( "yellow1" == color_name ) 472 else if( "yellow1" == color_name )
439 { 473 {
440 color->setVec(LLColor4::yellow1); 474 color->set(LLColor4::yellow1);
441 } 475 }
442 else if( "yellow2" == color_name ) 476 else if( "yellow2" == color_name )
443 { 477 {
444 color->setVec(LLColor4::yellow2); 478 color->set(LLColor4::yellow2);
445 } 479 }
446 else if( "yellow3" == color_name ) 480 else if( "yellow3" == color_name )
447 { 481 {
448 color->setVec(LLColor4::yellow3); 482 color->set(LLColor4::yellow3);
449 } 483 }
450 else if( "yellow4" == color_name ) 484 else if( "yellow4" == color_name )
451 { 485 {
452 color->setVec(LLColor4::yellow4); 486 color->set(LLColor4::yellow4);
453 } 487 }
454 else if( "yellow5" == color_name ) 488 else if( "yellow5" == color_name )
455 { 489 {
456 color->setVec(LLColor4::yellow5); 490 color->set(LLColor4::yellow5);
457 } 491 }
458 else if( "yellow6" == color_name ) 492 else if( "yellow6" == color_name )
459 { 493 {
460 color->setVec(LLColor4::yellow6); 494 color->set(LLColor4::yellow6);
461 } 495 }
462 else if( "magenta" == color_name ) 496 else if( "magenta" == color_name )
463 { 497 {
464 color->setVec(LLColor4::magenta); 498 color->set(LLColor4::magenta);
465 } 499 }
466 else if( "magenta1" == color_name ) 500 else if( "magenta1" == color_name )
467 { 501 {
468 color->setVec(LLColor4::magenta1); 502 color->set(LLColor4::magenta1);
469 } 503 }
470 else if( "magenta2" == color_name ) 504 else if( "magenta2" == color_name )
471 { 505 {
472 color->setVec(LLColor4::magenta2); 506 color->set(LLColor4::magenta2);
473 } 507 }
474 else if( "magenta3" == color_name ) 508 else if( "magenta3" == color_name )
475 { 509 {
476 color->setVec(LLColor4::magenta3); 510 color->set(LLColor4::magenta3);
477 } 511 }
478 else if( "magenta4" == color_name ) 512 else if( "magenta4" == color_name )
479 { 513 {
480 color->setVec(LLColor4::magenta4); 514 color->set(LLColor4::magenta4);
481 } 515 }
482 else if( "purple" == color_name ) 516 else if( "purple" == color_name )
483 { 517 {
484 color->setVec(LLColor4::purple); 518 color->set(LLColor4::purple);
485 } 519 }
486 else if( "purple1" == color_name ) 520 else if( "purple1" == color_name )
487 { 521 {
488 color->setVec(LLColor4::purple1); 522 color->set(LLColor4::purple1);
489 } 523 }
490 else if( "purple2" == color_name ) 524 else if( "purple2" == color_name )
491 { 525 {
492 color->setVec(LLColor4::purple2); 526 color->set(LLColor4::purple2);
493 } 527 }
494 else if( "purple3" == color_name ) 528 else if( "purple3" == color_name )
495 { 529 {
496 color->setVec(LLColor4::purple3); 530 color->set(LLColor4::purple3);
497 } 531 }
498 else if( "purple4" == color_name ) 532 else if( "purple4" == color_name )
499 { 533 {
500 color->setVec(LLColor4::purple4); 534 color->set(LLColor4::purple4);
501 } 535 }
502 else if( "purple5" == color_name ) 536 else if( "purple5" == color_name )
503 { 537 {
504 color->setVec(LLColor4::purple5); 538 color->set(LLColor4::purple5);
505 } 539 }
506 else if( "purple6" == color_name ) 540 else if( "purple6" == color_name )
507 { 541 {
508 color->setVec(LLColor4::purple6); 542 color->set(LLColor4::purple6);
509 } 543 }
510 else if( "pink" == color_name ) 544 else if( "pink" == color_name )
511 { 545 {
512 color->setVec(LLColor4::pink); 546 color->set(LLColor4::pink);
513 } 547 }
514 else if( "pink1" == color_name ) 548 else if( "pink1" == color_name )
515 { 549 {
516 color->setVec(LLColor4::pink1); 550 color->set(LLColor4::pink1);
517 } 551 }
518 else if( "pink2" == color_name ) 552 else if( "pink2" == color_name )
519 { 553 {
520 color->setVec(LLColor4::pink2); 554 color->set(LLColor4::pink2);
521 } 555 }
522 else if( "cyan" == color_name ) 556 else if( "cyan" == color_name )
523 { 557 {
524 color->setVec(LLColor4::cyan); 558 color->set(LLColor4::cyan);
525 } 559 }
526 else if( "cyan1" == color_name ) 560 else if( "cyan1" == color_name )
527 { 561 {
528 color->setVec(LLColor4::cyan1); 562 color->set(LLColor4::cyan1);
529 } 563 }
530 else if( "cyan2" == color_name ) 564 else if( "cyan2" == color_name )
531 { 565 {
532 color->setVec(LLColor4::cyan2); 566 color->set(LLColor4::cyan2);
533 } 567 }
534 else if( "cyan3" == color_name ) 568 else if( "cyan3" == color_name )
535 { 569 {
536 color->setVec(LLColor4::cyan3); 570 color->set(LLColor4::cyan3);
537 } 571 }
538 else if( "cyan4" == color_name ) 572 else if( "cyan4" == color_name )
539 { 573 {
540 color->setVec(LLColor4::cyan4); 574 color->set(LLColor4::cyan4);
541 } 575 }
542 else if( "cyan5" == color_name ) 576 else if( "cyan5" == color_name )
543 { 577 {
544 color->setVec(LLColor4::cyan5); 578 color->set(LLColor4::cyan5);
545 } 579 }
546 else if( "cyan6" == color_name ) 580 else if( "cyan6" == color_name )
547 { 581 {
548 color->setVec(LLColor4::cyan6); 582 color->set(LLColor4::cyan6);
549 } 583 }
550 else if( "smoke" == color_name ) 584 else if( "smoke" == color_name )
551 { 585 {
552 color->setVec(LLColor4::smoke); 586 color->set(LLColor4::smoke);
553 } 587 }
554 else if( "grey" == color_name ) 588 else if( "grey" == color_name )
555 { 589 {
556 color->setVec(LLColor4::grey); 590 color->set(LLColor4::grey);
557 } 591 }
558 else if( "grey1" == color_name ) 592 else if( "grey1" == color_name )
559 { 593 {
560 color->setVec(LLColor4::grey1); 594 color->set(LLColor4::grey1);
561 } 595 }
562 else if( "grey2" == color_name ) 596 else if( "grey2" == color_name )
563 { 597 {
564 color->setVec(LLColor4::grey2); 598 color->set(LLColor4::grey2);
565 } 599 }
566 else if( "grey3" == color_name ) 600 else if( "grey3" == color_name )
567 { 601 {
568 color->setVec(LLColor4::grey3); 602 color->set(LLColor4::grey3);
569 } 603 }
570 else if( "grey4" == color_name ) 604 else if( "grey4" == color_name )
571 { 605 {
572 color->setVec(LLColor4::grey4); 606 color->set(LLColor4::grey4);
573 } 607 }
574 else if( "orange" == color_name ) 608 else if( "orange" == color_name )
575 { 609 {
576 color->setVec(LLColor4::orange); 610 color->set(LLColor4::orange);
577 } 611 }
578 else if( "orange1" == color_name ) 612 else if( "orange1" == color_name )
579 { 613 {
580 color->setVec(LLColor4::orange1); 614 color->set(LLColor4::orange1);
581 } 615 }
582 else if( "orange2" == color_name ) 616 else if( "orange2" == color_name )
583 { 617 {
584 color->setVec(LLColor4::orange2); 618 color->set(LLColor4::orange2);
585 } 619 }
586 else if( "orange3" == color_name ) 620 else if( "orange3" == color_name )
587 { 621 {
588 color->setVec(LLColor4::orange3); 622 color->set(LLColor4::orange3);
589 } 623 }
590 else if( "orange4" == color_name ) 624 else if( "orange4" == color_name )
591 { 625 {
592 color->setVec(LLColor4::orange4); 626 color->set(LLColor4::orange4);
593 } 627 }
594 else if( "orange5" == color_name ) 628 else if( "orange5" == color_name )
595 { 629 {
596 color->setVec(LLColor4::orange5); 630 color->set(LLColor4::orange5);
597 } 631 }
598 else if( "orange6" == color_name ) 632 else if( "orange6" == color_name )
599 { 633 {
600 color->setVec(LLColor4::orange6); 634 color->set(LLColor4::orange6);
601 } 635 }
602 else if ( "clear" == color_name ) 636 else if ( "clear" == color_name )
603 { 637 {
604 color->setVec(0.f, 0.f, 0.f, 0.f); 638 color->set(0.f, 0.f, 0.f, 0.f);
605 } 639 }
606 else 640 else
607 { 641 {