aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:44 -0500
committerJacek Antonelli2008-08-15 23:45:44 -0500
commitacfdcf2b1deeb04698174c78e8cb22b093445bb1 (patch)
tree811293650bcf81d01ea7c54d7c2cf263110aa329 /linden/indra
parentSecond Life viewer sources 1.20.2 (diff)
downloadmeta-impy-acfdcf2b1deeb04698174c78e8cb22b093445bb1.zip
meta-impy-acfdcf2b1deeb04698174c78e8cb22b093445bb1.tar.gz
meta-impy-acfdcf2b1deeb04698174c78e8cb22b093445bb1.tar.bz2
meta-impy-acfdcf2b1deeb04698174c78e8cb22b093445bb1.tar.xz
Second Life viewer sources 1.20.3
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/llcommon/llmemtype.h3
-rw-r--r--linden/indra/llcommon/llversionviewer.h2
-rw-r--r--linden/indra/llmath/llvolume.cpp467
-rw-r--r--linden/indra/llmath/llvolume.h59
-rw-r--r--linden/indra/llmath/llvolumemgr.cpp132
-rw-r--r--linden/indra/llmath/llvolumemgr.h46
-rw-r--r--linden/indra/llprimitive/llprimitive.cpp13
-rw-r--r--linden/indra/llrender/llglimmediate.cpp7
-rw-r--r--linden/indra/llrender/llglimmediate.h5
-rw-r--r--linden/indra/llrender/llimagegl.cpp79
-rw-r--r--linden/indra/llrender/llimagegl.h2
-rw-r--r--linden/indra/llrender/llrendertarget.h2
-rw-r--r--linden/indra/llrender/llvertexbuffer.cpp176
-rw-r--r--linden/indra/llrender/llvertexbuffer.h14
-rw-r--r--linden/indra/llui/llfloater.cpp7
-rw-r--r--linden/indra/llui/llfloater.h1
-rw-r--r--linden/indra/llui/llscrollbar.cpp7
-rw-r--r--linden/indra/llui/llscrollcontainer.cpp2
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp2
-rw-r--r--linden/indra/llwindow/llgl.cpp19
-rw-r--r--linden/indra/llwindow/llwindowwin32.cpp25
-rw-r--r--linden/indra/newview/app_settings/colors_base.xml2
-rw-r--r--linden/indra/newview/app_settings/settings.xml11
-rw-r--r--linden/indra/newview/llappviewer.cpp102
-rw-r--r--linden/indra/newview/llcubemap.cpp70
-rw-r--r--linden/indra/newview/llcylinder.cpp1
-rw-r--r--linden/indra/newview/lldrawable.cpp7
-rw-r--r--linden/indra/newview/lldrawpool.cpp29
-rw-r--r--linden/indra/newview/lldrawpool.h5
-rw-r--r--linden/indra/newview/lldrawpoolalpha.cpp17
-rw-r--r--linden/indra/newview/lldrawpoolavatar.cpp32
-rw-r--r--linden/indra/newview/lldrawpoolbump.cpp40
-rw-r--r--linden/indra/newview/lldrawpoolground.cpp3
-rw-r--r--linden/indra/newview/lldrawpoolsimple.cpp11
-rw-r--r--linden/indra/newview/lldrawpoolsky.cpp10
-rw-r--r--linden/indra/newview/lldrawpoolterrain.cpp108
-rw-r--r--linden/indra/newview/lldrawpooltree.cpp13
-rw-r--r--linden/indra/newview/lldrawpoolwater.cpp33
-rw-r--r--linden/indra/newview/lldrawpoolwlsky.cpp11
-rw-r--r--linden/indra/newview/llface.cpp67
-rw-r--r--linden/indra/newview/llface.h2
-rw-r--r--linden/indra/newview/llflexibleobject.cpp18
-rw-r--r--linden/indra/newview/llflexibleobject.h2
-rw-r--r--linden/indra/newview/llfloateranimpreview.cpp1
-rw-r--r--linden/indra/newview/llfloaterauction.cpp3
-rw-r--r--linden/indra/newview/llfloaterhud.cpp26
-rw-r--r--linden/indra/newview/llfloaterhud.h2
-rw-r--r--linden/indra/newview/llmemoryview.cpp2
-rw-r--r--linden/indra/newview/llpanellogin.cpp1
-rw-r--r--linden/indra/newview/llpostprocess.cpp3
-rw-r--r--linden/indra/newview/llspatialpartition.cpp21
-rw-r--r--linden/indra/newview/llviewerdisplay.cpp13
-rw-r--r--linden/indra/newview/llviewerjointmesh.cpp29
-rw-r--r--linden/indra/newview/llviewerkeyboard.cpp22
-rw-r--r--linden/indra/newview/llvotree.cpp6
-rw-r--r--linden/indra/newview/llvovolume.cpp12
-rw-r--r--linden/indra/newview/llvowlsky.cpp33
-rw-r--r--linden/indra/newview/llwebbrowserctrl.cpp30
-rw-r--r--linden/indra/newview/llwebbrowserctrl.h8
-rw-r--r--linden/indra/newview/mozilla-theme/classic.jarbin281793 -> 190670 bytes
-rw-r--r--linden/indra/newview/pipeline.cpp58
-rw-r--r--linden/indra/newview/pipeline.h3
-rw-r--r--linden/indra/newview/releasenotes.txt24
-rw-r--r--linden/indra/newview/skins/xui/de/floater_active_speakers.xml2
-rw-r--r--linden/indra/newview/skins/xui/de/menu_viewer.xml2
-rw-r--r--linden/indra/newview/skins/xui/de/panel_preferences_general.xml10
-rw-r--r--linden/indra/newview/skins/xui/en-us/alerts.xml17
-rw-r--r--linden/indra/newview/skins/xui/en-us/floater_world_map.xml8
-rw-r--r--linden/indra/newview/skins/xui/es/panel_preferences_general.xml14
-rw-r--r--linden/indra/newview/skins/xui/fr/panel_preferences_general.xml8
-rw-r--r--linden/indra/newview/skins/xui/ja/panel_preferences_general.xml10
-rw-r--r--linden/indra/newview/skins/xui/ko/panel_preferences_general.xml10
-rw-r--r--linden/indra/newview/skins/xui/ko/panel_toolbar.xml7
-rw-r--r--linden/indra/newview/skins/xui/zh/panel_preferences_general.xml8
74 files changed, 1031 insertions, 1026 deletions
diff --git a/linden/indra/llcommon/llmemtype.h b/linden/indra/llcommon/llmemtype.h
index df228a6..4a4702b 100644
--- a/linden/indra/llcommon/llmemtype.h
+++ b/linden/indra/llcommon/llmemtype.h
@@ -84,6 +84,9 @@ public:
84 MTYPE_REGIONS, 84 MTYPE_REGIONS,
85 MTYPE_INVENTORY, 85 MTYPE_INVENTORY,
86 MTYPE_ANIMATION, 86 MTYPE_ANIMATION,
87 MTYPE_VOLUME,
88 MTYPE_PRIMITIVE,
89
87 MTYPE_NETWORK, 90 MTYPE_NETWORK,
88 MTYPE_PHYSICS, 91 MTYPE_PHYSICS,
89 MTYPE_INTERESTLIST, 92 MTYPE_INTERESTLIST,
diff --git a/linden/indra/llcommon/llversionviewer.h b/linden/indra/llcommon/llversionviewer.h
index 06f6a82..747526f 100644
--- a/linden/indra/llcommon/llversionviewer.h
+++ b/linden/indra/llcommon/llversionviewer.h
@@ -34,7 +34,7 @@
34 34
35const S32 LL_VERSION_MAJOR = 1; 35const S32 LL_VERSION_MAJOR = 1;
36const S32 LL_VERSION_MINOR = 20; 36const S32 LL_VERSION_MINOR = 20;
37const S32 LL_VERSION_PATCH = 2; 37const S32 LL_VERSION_PATCH = 3;
38const S32 LL_VERSION_BUILD = 0; 38const S32 LL_VERSION_BUILD = 0;
39 39
40const char * const LL_CHANNEL = "Second Life Release"; 40const char * const LL_CHANNEL = "Second Life Release";
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp
index 9c19220..527100a 100644
--- a/linden/indra/llmath/llvolume.cpp
+++ b/linden/indra/llmath/llvolume.cpp
@@ -34,6 +34,7 @@
34#include <set> 34#include <set>
35 35
36#include "llerror.h" 36#include "llerror.h"
37#include "llmemtype.h"
37 38
38#include "llvolumemgr.h" 39#include "llvolumemgr.h"
39#include "v2math.h" 40#include "v2math.h"
@@ -155,6 +156,8 @@ BOOL LLTriangleLineSegmentIntersect( const LLVector3& pt1, const LLVector3& pt2,
155 156
156LLProfile::Face* LLProfile::addCap(S16 faceID) 157LLProfile::Face* LLProfile::addCap(S16 faceID)
157{ 158{
159 LLMemType m1(LLMemType::MTYPE_VOLUME);
160
158 Face *face = vector_append(mFaces, 1); 161 Face *face = vector_append(mFaces, 1);
159 162
160 face->mIndex = 0; 163 face->mIndex = 0;
@@ -167,6 +170,8 @@ LLProfile::Face* LLProfile::addCap(S16 faceID)
167 170
168LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, BOOL flat) 171LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, BOOL flat)
169{ 172{
173 LLMemType m1(LLMemType::MTYPE_VOLUME);
174
170 Face *face = vector_append(mFaces, 1); 175 Face *face = vector_append(mFaces, 1);
171 176
172 face->mIndex = i; 177 face->mIndex = i;
@@ -182,8 +187,10 @@ LLProfile::Face* LLProfile::addFace(S32 i, S32 count, F32 scaleU, S16 faceID, BO
182// What is the bevel parameter used for? - DJS 04/05/02 187// What is the bevel parameter used for? - DJS 04/05/02
183// Bevel parameter is currently unused but presumedly would support 188// Bevel parameter is currently unused but presumedly would support
184// filleted and chamfered corners 189// filleted and chamfered corners
185void LLProfile::genNGon(S32 sides, F32 offset, F32 bevel, F32 ang_scale, S32 split) 190void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F32 bevel, F32 ang_scale, S32 split)
186{ 191{
192 LLMemType m1(LLMemType::MTYPE_VOLUME);
193
187 // Generate an n-sided "circular" path. 194 // Generate an n-sided "circular" path.
188 // 0 is (1,0), and we go counter-clockwise along a circular path from there. 195 // 0 is (1,0), and we go counter-clockwise along a circular path from there.
189 const F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f }; 196 const F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f };
@@ -194,8 +201,8 @@ void LLProfile::genNGon(S32 sides, F32 offset, F32 bevel, F32 ang_scale, S32 spl
194 mMaxX = 0.f; 201 mMaxX = 0.f;
195 mMinX = 0.f; 202 mMinX = 0.f;
196 203
197 F32 begin = mParams.getBegin(); 204 F32 begin = params.getBegin();
198 F32 end = mParams.getEnd(); 205 F32 end = params.getEnd();
199 206
200 t_step = 1.0f / sides; 207 t_step = 1.0f / sides;
201 ang_step = 2.0f*F_PI*t_step*ang_scale; 208 ang_step = 2.0f*F_PI*t_step*ang_scale;
@@ -311,7 +318,7 @@ void LLProfile::genNGon(S32 sides, F32 offset, F32 bevel, F32 ang_scale, S32 spl
311 mConcave = FALSE; 318 mConcave = FALSE;
312 } 319 }
313 mOpen = TRUE; 320 mOpen = TRUE;
314 if (!isHollow()) 321 if (params.getHollow() <= 0)
315 { 322 {
316 // put center point if not hollow. 323 // put center point if not hollow.
317 mProfile.push_back(LLVector3(0,0,0)); 324 mProfile.push_back(LLVector3(0,0,0));
@@ -327,7 +334,7 @@ void LLProfile::genNGon(S32 sides, F32 offset, F32 bevel, F32 ang_scale, S32 spl
327 mTotal = mProfile.size(); 334 mTotal = mProfile.size();
328} 335}
329 336
330void LLProfile::genNormals() 337void LLProfile::genNormals(const LLProfileParams& params)
331{ 338{
332 S32 count = mProfile.size(); 339 S32 count = mProfile.size();
333 340
@@ -347,8 +354,7 @@ void LLProfile::genNormals()
347 354
348 LLVector2 pt0,pt1; 355 LLVector2 pt0,pt1;
349 356
350 BOOL hollow; 357 BOOL hollow = (params.getHollow() > 0);
351 hollow = isHollow();
352 358
353 S32 i0, i1, i2, i3, i4; 359 S32 i0, i1, i2, i3, i4;
354 360
@@ -428,7 +434,7 @@ void LLProfile::genNormals()
428// Hollow is percent of the original bounding box, not of this particular 434// Hollow is percent of the original bounding box, not of this particular
429// profile's geometry. Thus, a swept triangle needs lower hollow values than 435// profile's geometry. Thus, a swept triangle needs lower hollow values than
430// a swept square. 436// a swept square.
431LLProfile::Face* LLProfile::addHole(BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split) 437LLProfile::Face* LLProfile::addHole(const LLProfileParams& params, BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split)
432{ 438{
433 // Note that addHole will NOT work for non-"circular" profiles, if we ever decide to use them. 439 // Note that addHole will NOT work for non-"circular" profiles, if we ever decide to use them.
434 440
@@ -436,11 +442,12 @@ LLProfile::Face* LLProfile::addHole(BOOL flat, F32 sides, F32 offset, F32 box_ho
436 mTotalOut = mTotal; 442 mTotalOut = mTotal;
437 443
438 // Why is the "bevel" parameter -1? DJS 04/05/02 444 // Why is the "bevel" parameter -1? DJS 04/05/02
439 genNGon(llfloor(sides),offset,-1, ang_scale, split); 445 genNGon(params, llfloor(sides),offset,-1, ang_scale, split);
440 446
441 Face *face = addFace(mTotalOut, mTotal-mTotalOut,0,LL_FACE_INNER_SIDE, flat); 447 Face *face = addFace(mTotalOut, mTotal-mTotalOut,0,LL_FACE_INNER_SIDE, flat);
442 448
443 LLVector3 pt[128]; 449 std::vector<LLVector3> pt;
450 pt.resize(mTotal) ;
444 451
445 for (S32 i=mTotalOut;i<mTotal;i++) 452 for (S32 i=mTotalOut;i<mTotal;i++)
446 { 453 {
@@ -489,8 +496,10 @@ S32 sculpt_sides(F32 detail)
489} 496}
490 497
491 498
492BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted) 499BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
493{ 500{
501 LLMemType m1(LLMemType::MTYPE_VOLUME);
502
494 if ((!mDirty) && (!is_sculpted)) 503 if ((!mDirty) && (!is_sculpted))
495 { 504 {
496 return FALSE; 505 return FALSE;
@@ -508,9 +517,9 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
508 517
509 // Generate the face data 518 // Generate the face data
510 S32 i; 519 S32 i;
511 F32 begin = mParams.getBegin(); 520 F32 begin = params.getBegin();
512 F32 end = mParams.getEnd(); 521 F32 end = params.getEnd();
513 F32 hollow = mParams.getHollow(); 522 F32 hollow = params.getHollow();
514 523
515 // Quick validation to eliminate some server crashes. 524 // Quick validation to eliminate some server crashes.
516 if (begin > end - 0.01f) 525 if (begin > end - 0.01f)
@@ -521,11 +530,11 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
521 530
522 S32 face_num = 0; 531 S32 face_num = 0;
523 532
524 switch (mParams.getCurveType() & LL_PCODE_PROFILE_MASK) 533 switch (params.getCurveType() & LL_PCODE_PROFILE_MASK)
525 { 534 {
526 case LL_PCODE_PROFILE_SQUARE: 535 case LL_PCODE_PROFILE_SQUARE:
527 { 536 {
528 genNGon(4,-0.375, 0, 1, split); 537 genNGon(params, 4,-0.375, 0, 1, split);
529 if (path_open) 538 if (path_open)
530 { 539 {
531 addCap (LL_FACE_PATH_BEGIN); 540 addCap (LL_FACE_PATH_BEGIN);
@@ -544,20 +553,20 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
544 553
545 if (hollow) 554 if (hollow)
546 { 555 {
547 switch (mParams.getCurveType() & LL_PCODE_HOLE_MASK) 556 switch (params.getCurveType() & LL_PCODE_HOLE_MASK)
548 { 557 {
549 case LL_PCODE_HOLE_TRIANGLE: 558 case LL_PCODE_HOLE_TRIANGLE:
550 // This offset is not correct, but we can't change it now... DK 11/17/04 559 // This offset is not correct, but we can't change it now... DK 11/17/04
551 addHole(TRUE, 3, -0.375f, hollow, 1.f, split); 560 addHole(params, TRUE, 3, -0.375f, hollow, 1.f, split);
552 break; 561 break;
553 case LL_PCODE_HOLE_CIRCLE: 562 case LL_PCODE_HOLE_CIRCLE:
554 // TODO: Compute actual detail levels for cubes 563 // TODO: Compute actual detail levels for cubes
555 addHole(FALSE, MIN_DETAIL_FACES * detail, -0.375f, hollow, 1.f); 564 addHole(params, FALSE, MIN_DETAIL_FACES * detail, -0.375f, hollow, 1.f);
556 break; 565 break;
557 case LL_PCODE_HOLE_SAME: 566 case LL_PCODE_HOLE_SAME:
558 case LL_PCODE_HOLE_SQUARE: 567 case LL_PCODE_HOLE_SQUARE:
559 default: 568 default:
560 addHole(TRUE, 4, -0.375f, hollow, 1.f, split); 569 addHole(params, TRUE, 4, -0.375f, hollow, 1.f, split);
561 break; 570 break;
562 } 571 }
563 } 572 }
@@ -571,7 +580,7 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
571 case LL_PCODE_PROFILE_RIGHTTRI: 580 case LL_PCODE_PROFILE_RIGHTTRI:
572 case LL_PCODE_PROFILE_EQUALTRI: 581 case LL_PCODE_PROFILE_EQUALTRI:
573 { 582 {
574 genNGon(3,0, 0, 1, split); 583 genNGon(params, 3,0, 0, 1, split);
575 for (i = 0; i <(S32) mProfile.size(); i++) 584 for (i = 0; i <(S32) mProfile.size(); i++)
576 { 585 {
577 // Scale by 3 to generate proper tex coords. 586 // Scale by 3 to generate proper tex coords.
@@ -593,19 +602,19 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
593 // because the triangle doesn't fill the bounding box. 602 // because the triangle doesn't fill the bounding box.
594 F32 triangle_hollow = hollow / 2.f; 603 F32 triangle_hollow = hollow / 2.f;
595 604
596 switch (mParams.getCurveType() & LL_PCODE_HOLE_MASK) 605 switch (params.getCurveType() & LL_PCODE_HOLE_MASK)
597 { 606 {
598 case LL_PCODE_HOLE_CIRCLE: 607 case LL_PCODE_HOLE_CIRCLE:
599 // TODO: Actually generate level of detail for triangles 608 // TODO: Actually generate level of detail for triangles
600 addHole(FALSE, MIN_DETAIL_FACES * detail, 0, triangle_hollow, 1.f); 609 addHole(params, FALSE, MIN_DETAIL_FACES * detail, 0, triangle_hollow, 1.f);
601 break; 610 break;
602 case LL_PCODE_HOLE_SQUARE: 611 case LL_PCODE_HOLE_SQUARE:
603 addHole(TRUE, 4, 0, triangle_hollow, 1.f, split); 612 addHole(params, TRUE, 4, 0, triangle_hollow, 1.f, split);
604 break; 613 break;
605 case LL_PCODE_HOLE_SAME: 614 case LL_PCODE_HOLE_SAME:
606 case LL_PCODE_HOLE_TRIANGLE: 615 case LL_PCODE_HOLE_TRIANGLE:
607 default: 616 default:
608 addHole(TRUE, 3, 0, triangle_hollow, 1.f, split); 617 addHole(params, TRUE, 3, 0, triangle_hollow, 1.f, split);
609 break; 618 break;
610 } 619 }
611 } 620 }
@@ -619,7 +628,7 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
619 F32 circle_detail = MIN_DETAIL_FACES * detail; 628 F32 circle_detail = MIN_DETAIL_FACES * detail;
620 if (hollow) 629 if (hollow)
621 { 630 {
622 hole_type = mParams.getCurveType() & LL_PCODE_HOLE_MASK; 631 hole_type = params.getCurveType() & LL_PCODE_HOLE_MASK;
623 if (hole_type == LL_PCODE_HOLE_SQUARE) 632 if (hole_type == LL_PCODE_HOLE_SQUARE)
624 { 633 {
625 // Snap to the next multiple of four sides, 634 // Snap to the next multiple of four sides,
@@ -633,7 +642,7 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
633 if (is_sculpted) 642 if (is_sculpted)
634 sides = sculpt_sides(detail); 643 sides = sculpt_sides(detail);
635 644
636 genNGon(sides); 645 genNGon(params, sides);
637 646
638 if (path_open) 647 if (path_open)
639 { 648 {
@@ -654,15 +663,15 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
654 switch (hole_type) 663 switch (hole_type)
655 { 664 {
656 case LL_PCODE_HOLE_SQUARE: 665 case LL_PCODE_HOLE_SQUARE:
657 addHole(TRUE, 4, 0, hollow, 1.f, split); 666 addHole(params, TRUE, 4, 0, hollow, 1.f, split);
658 break; 667 break;
659 case LL_PCODE_HOLE_TRIANGLE: 668 case LL_PCODE_HOLE_TRIANGLE:
660 addHole(TRUE, 3, 0, hollow, 1.f, split); 669 addHole(params, TRUE, 3, 0, hollow, 1.f, split);
661 break; 670 break;
662 case LL_PCODE_HOLE_CIRCLE: 671 case LL_PCODE_HOLE_CIRCLE:
663 case LL_PCODE_HOLE_SAME: 672 case LL_PCODE_HOLE_SAME:
664 default: 673 default:
665 addHole(FALSE, circle_detail, 0, hollow, 1.f); 674 addHole(params, FALSE, circle_detail, 0, hollow, 1.f);
666 break; 675 break;
667 } 676 }
668 } 677 }
@@ -677,7 +686,7 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
677 F32 circle_detail = MIN_DETAIL_FACES * detail * 0.5f; 686 F32 circle_detail = MIN_DETAIL_FACES * detail * 0.5f;
678 if (hollow) 687 if (hollow)
679 { 688 {
680 hole_type = mParams.getCurveType() & LL_PCODE_HOLE_MASK; 689 hole_type = params.getCurveType() & LL_PCODE_HOLE_MASK;
681 if (hole_type == LL_PCODE_HOLE_SQUARE) 690 if (hole_type == LL_PCODE_HOLE_SQUARE)
682 { 691 {
683 // Snap to the next multiple of four sides (div 2), 692 // Snap to the next multiple of four sides (div 2),
@@ -685,12 +694,12 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
685 circle_detail = llceil(circle_detail / 2.0f) * 2.0f; 694 circle_detail = llceil(circle_detail / 2.0f) * 2.0f;
686 } 695 }
687 } 696 }
688 genNGon(llfloor(circle_detail), 0.5f, 0.f, 0.5f); 697 genNGon(params, llfloor(circle_detail), 0.5f, 0.f, 0.5f);
689 if (path_open) 698 if (path_open)
690 { 699 {
691 addCap(LL_FACE_PATH_BEGIN); 700 addCap(LL_FACE_PATH_BEGIN);
692 } 701 }
693 if (mOpen && !mParams.getHollow()) 702 if (mOpen && !params.getHollow())
694 { 703 {
695 addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, FALSE); 704 addFace(0,mTotal-1,0,LL_FACE_OUTER_SIDE_0, FALSE);
696 } 705 }
@@ -704,21 +713,21 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
704 switch (hole_type) 713 switch (hole_type)
705 { 714 {
706 case LL_PCODE_HOLE_SQUARE: 715 case LL_PCODE_HOLE_SQUARE:
707 addHole(TRUE, 2, 0.5f, hollow, 0.5f, split); 716 addHole(params, TRUE, 2, 0.5f, hollow, 0.5f, split);
708 break; 717 break;
709 case LL_PCODE_HOLE_TRIANGLE: 718 case LL_PCODE_HOLE_TRIANGLE:
710 addHole(TRUE, 3, 0.5f, hollow, 0.5f, split); 719 addHole(params, TRUE, 3, 0.5f, hollow, 0.5f, split);
711 break; 720 break;
712 case LL_PCODE_HOLE_CIRCLE: 721 case LL_PCODE_HOLE_CIRCLE:
713 case LL_PCODE_HOLE_SAME: 722 case LL_PCODE_HOLE_SAME:
714 default: 723 default:
715 addHole(FALSE, circle_detail, 0.5f, hollow, 0.5f); 724 addHole(params, FALSE, circle_detail, 0.5f, hollow, 0.5f);
716 break; 725 break;
717 } 726 }
718 } 727 }
719 728
720 // Special case for openness of sphere 729 // Special case for openness of sphere
721 if ((mParams.getEnd() - mParams.getBegin()) < 1.f) 730 if ((params.getEnd() - params.getBegin()) < 1.f)
722 { 731 {
723 mOpen = TRUE; 732 mOpen = TRUE;
724 } 733 }
@@ -731,7 +740,7 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
731 } 740 }
732 break; 741 break;
733 default: 742 default:
734 llerrs << "Unknown profile: getCurveType()=" << mParams.getCurveType() << llendl; 743 llerrs << "Unknown profile: getCurveType()=" << params.getCurveType() << llendl;
735 break; 744 break;
736 }; 745 };
737 746
@@ -754,7 +763,7 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
754 } 763 }
755 } 764 }
756 765
757 //genNormals(); 766 //genNormals(params);
758 767
759 return TRUE; 768 return TRUE;
760} 769}
@@ -763,6 +772,8 @@ BOOL LLProfile::generate(BOOL path_open,F32 detail, S32 split, BOOL is_sculpted)
763 772
764BOOL LLProfileParams::importFile(FILE *fp) 773BOOL LLProfileParams::importFile(FILE *fp)
765{ 774{
775 LLMemType m1(LLMemType::MTYPE_VOLUME);
776
766 const S32 BUFSIZE = 16384; 777 const S32 BUFSIZE = 16384;
767 char buffer[BUFSIZE]; /* Flawfinder: ignore */ 778 char buffer[BUFSIZE]; /* Flawfinder: ignore */
768 // *NOTE: changing the size or type of these buffers will require 779 // *NOTE: changing the size or type of these buffers will require
@@ -838,6 +849,8 @@ BOOL LLProfileParams::exportFile(FILE *fp) const
838 849
839BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) 850BOOL LLProfileParams::importLegacyStream(std::istream& input_stream)
840{ 851{
852 LLMemType m1(LLMemType::MTYPE_VOLUME);
853
841 const S32 BUFSIZE = 16384; 854 const S32 BUFSIZE = 16384;
842 char buffer[BUFSIZE]; /* Flawfinder: ignore */ 855 char buffer[BUFSIZE]; /* Flawfinder: ignore */
843 // *NOTE: changing the size or type of these buffers will require 856 // *NOTE: changing the size or type of these buffers will require
@@ -929,6 +942,7 @@ bool LLProfileParams::fromLLSD(LLSD& sd)
929 942
930void LLProfileParams::copyParams(const LLProfileParams &params) 943void LLProfileParams::copyParams(const LLProfileParams &params)
931{ 944{
945 LLMemType m1(LLMemType::MTYPE_VOLUME);
932 setCurveType(params.getCurveType()); 946 setCurveType(params.getCurveType());
933 setBegin(params.getBegin()); 947 setBegin(params.getBegin());
934 setEnd(params.getEnd()); 948 setEnd(params.getEnd());
@@ -940,22 +954,22 @@ LLPath::~LLPath()
940{ 954{
941} 955}
942 956
943void LLPath::genNGon(S32 sides, F32 startOff, F32 end_scale, F32 twist_scale) 957void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
944{ 958{
945 // Generates a circular path, starting at (1, 0, 0), counterclockwise along the xz plane. 959 // Generates a circular path, starting at (1, 0, 0), counterclockwise along the xz plane.
946 const F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f }; 960 const F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f };
947 961
948 F32 revolutions = mParams.getRevolutions(); 962 F32 revolutions = params.getRevolutions();
949 F32 skew = mParams.getSkew(); 963 F32 skew = params.getSkew();
950 F32 skew_mag = fabs(skew); 964 F32 skew_mag = fabs(skew);
951 F32 hole_x = mParams.getScaleX() * (1.0f - skew_mag); 965 F32 hole_x = params.getScaleX() * (1.0f - skew_mag);
952 F32 hole_y = mParams.getScaleY(); 966 F32 hole_y = params.getScaleY();
953 967
954 // Calculate taper begin/end for x,y (Negative means taper the beginning) 968 // Calculate taper begin/end for x,y (Negative means taper the beginning)
955 F32 taper_x_begin = 1.0f; 969 F32 taper_x_begin = 1.0f;
956 F32 taper_x_end = 1.0f - mParams.getTaperX(); 970 F32 taper_x_end = 1.0f - params.getTaperX();
957 F32 taper_y_begin = 1.0f; 971 F32 taper_y_begin = 1.0f;
958 F32 taper_y_end = 1.0f - mParams.getTaperY(); 972 F32 taper_y_end = 1.0f - params.getTaperY();
959 973
960 if ( taper_x_end > 1.0f ) 974 if ( taper_x_end > 1.0f )
961 { 975 {
@@ -983,7 +997,7 @@ void LLPath::genNGon(S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
983 // Now check the radius offset to calculate the start,end radius. (Negative means 997 // Now check the radius offset to calculate the start,end radius. (Negative means
984 // decrease the start radius instead). 998 // decrease the start radius instead).
985 F32 radius_end = radius_start; 999 F32 radius_end = radius_start;
986 F32 radius_offset = mParams.getRadiusOffset(); 1000 F32 radius_offset = params.getRadiusOffset();
987 if (radius_offset < 0.f) 1001 if (radius_offset < 0.f)
988 { 1002 {
989 radius_start *= 1.f + radius_offset; 1003 radius_start *= 1.f + radius_offset;
@@ -994,7 +1008,7 @@ void LLPath::genNGon(S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
994 } 1008 }
995 1009
996 // Is the path NOT a closed loop? 1010 // Is the path NOT a closed loop?
997 mOpen = ( (mParams.getEnd()*end_scale - mParams.getBegin() < 1.0f) || 1011 mOpen = ( (params.getEnd()*end_scale - params.getBegin() < 1.0f) ||
998 (skew_mag > 0.001f) || 1012 (skew_mag > 0.001f) ||
999 (fabs(taper_x_end - taper_x_begin) > 0.001f) || 1013 (fabs(taper_x_end - taper_x_begin) > 0.001f) ||
1000 (fabs(taper_y_end - taper_y_begin) > 0.001f) || 1014 (fabs(taper_y_end - taper_y_begin) > 0.001f) ||
@@ -1005,22 +1019,22 @@ void LLPath::genNGon(S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
1005 PathPt *pt; 1019 PathPt *pt;
1006 LLVector3 path_axis (1.f, 0.f, 0.f); 1020 LLVector3 path_axis (1.f, 0.f, 0.f);
1007 //LLVector3 twist_axis(0.f, 0.f, 1.f); 1021 //LLVector3 twist_axis(0.f, 0.f, 1.f);
1008 F32 twist_begin = mParams.getTwistBegin() * twist_scale; 1022 F32 twist_begin = params.getTwistBegin() * twist_scale;
1009 F32 twist_end = mParams.getTwist() * twist_scale; 1023 F32 twist_end = params.getTwist() * twist_scale;
1010 1024
1011 // We run through this once before the main loop, to make sure 1025 // We run through this once before the main loop, to make sure
1012 // the path begins at the correct cut. 1026 // the path begins at the correct cut.
1013 F32 step= 1.0f / sides; 1027 F32 step= 1.0f / sides;
1014 F32 t = mParams.getBegin(); 1028 F32 t = params.getBegin();
1015 pt = vector_append(mPath, 1); 1029 pt = vector_append(mPath, 1);
1016 ang = 2.0f*F_PI*revolutions * t; 1030 ang = 2.0f*F_PI*revolutions * t;
1017 s = sin(ang)*lerp(radius_start, radius_end, t); 1031 s = sin(ang)*lerp(radius_start, radius_end, t);
1018 c = cos(ang)*lerp(radius_start, radius_end, t); 1032 c = cos(ang)*lerp(radius_start, radius_end, t);
1019 1033
1020 1034
1021 pt->mPos.setVec(0 + lerp(0,mParams.getShear().mV[0],s) 1035 pt->mPos.setVec(0 + lerp(0,params.getShear().mV[0],s)
1022 + lerp(-skew ,skew, t) * 0.5f, 1036 + lerp(-skew ,skew, t) * 0.5f,
1023 c + lerp(0,mParams.getShear().mV[1],s), 1037 c + lerp(0,params.getShear().mV[1],s),
1024 s); 1038 s);
1025 pt->mScale.mV[VX] = hole_x * lerp(taper_x_begin, taper_x_end, t); 1039 pt->mScale.mV[VX] = hole_x * lerp(taper_x_begin, taper_x_end, t);
1026 pt->mScale.mV[VY] = hole_y * lerp(taper_y_begin, taper_y_end, t); 1040 pt->mScale.mV[VY] = hole_y * lerp(taper_y_begin, taper_y_end, t);
@@ -1039,7 +1053,7 @@ void LLPath::genNGon(S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
1039 t = ((S32)(t * sides)) / (F32)sides; 1053 t = ((S32)(t * sides)) / (F32)sides;
1040 1054
1041 // Run through the non-cut dependent points. 1055 // Run through the non-cut dependent points.
1042 while (t < mParams.getEnd()) 1056 while (t < params.getEnd())
1043 { 1057 {
1044 pt = vector_append(mPath, 1); 1058 pt = vector_append(mPath, 1);
1045 1059
@@ -1047,9 +1061,9 @@ void LLPath::genNGon(S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
1047 c = cos(ang)*lerp(radius_start, radius_end, t); 1061 c = cos(ang)*lerp(radius_start, radius_end, t);
1048 s = sin(ang)*lerp(radius_start, radius_end, t); 1062 s = sin(ang)*lerp(radius_start, radius_end, t);
1049 1063
1050 pt->mPos.setVec(0 + lerp(0,mParams.getShear().mV[0],s) 1064 pt->mPos.setVec(0 + lerp(0,params.getShear().mV[0],s)
1051 + lerp(-skew ,skew, t) * 0.5f, 1065 + lerp(-skew ,skew, t) * 0.5f,
1052 c + lerp(0,mParams.getShear().mV[1],s), 1066 c + lerp(0,params.getShear().mV[1],s),
1053 s); 1067 s);
1054 1068
1055 pt->mScale.mV[VX] = hole_x * lerp(taper_x_begin, taper_x_end, t); 1069 pt->mScale.mV[VX] = hole_x * lerp(taper_x_begin, taper_x_end, t);
@@ -1066,15 +1080,15 @@ void LLPath::genNGon(S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
1066 } 1080 }
1067 1081
1068 // Make one final pass for the end cut. 1082 // Make one final pass for the end cut.
1069 t = mParams.getEnd(); 1083 t = params.getEnd();
1070 pt = vector_append(mPath, 1); 1084 pt = vector_append(mPath, 1);
1071 ang = 2.0f*F_PI*revolutions * t; 1085 ang = 2.0f*F_PI*revolutions * t;
1072 c = cos(ang)*lerp(radius_start, radius_end, t); 1086 c = cos(ang)*lerp(radius_start, radius_end, t);
1073 s = sin(ang)*lerp(radius_start, radius_end, t); 1087 s = sin(ang)*lerp(radius_start, radius_end, t);
1074 1088
1075 pt->mPos.setVec(0 + lerp(0,mParams.getShear().mV[0],s) 1089 pt->mPos.setVec(0 + lerp(0,params.getShear().mV[0],s)
1076 + lerp(-skew ,skew, t) * 0.5f, 1090 + lerp(-skew ,skew, t) * 0.5f,
1077 c + lerp(0,mParams.getShear().mV[1],s), 1091 c + lerp(0,params.getShear().mV[1],s),
1078 s); 1092 s);
1079 pt->mScale.mV[VX] = hole_x * lerp(taper_x_begin, taper_x_end, t); 1093 pt->mScale.mV[VX] = hole_x * lerp(taper_x_begin, taper_x_end, t);
1080 pt->mScale.mV[VY] = hole_y * lerp(taper_y_begin, taper_y_end, t); 1094 pt->mScale.mV[VY] = hole_y * lerp(taper_y_begin, taper_y_end, t);
@@ -1117,8 +1131,10 @@ const LLVector2 LLPathParams::getEndScale() const
1117 return end_scale; 1131 return end_scale;
1118} 1132}
1119 1133
1120BOOL LLPath::generate(F32 detail, S32 split, BOOL is_sculpted) 1134BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is_sculpted)
1121{ 1135{
1136 LLMemType m1(LLMemType::MTYPE_VOLUME);
1137
1122 if ((!mDirty) && (!is_sculpted)) 1138 if ((!mDirty) && (!is_sculpted))
1123 { 1139 {
1124 return FALSE; 1140 return FALSE;
@@ -1137,13 +1153,13 @@ BOOL LLPath::generate(F32 detail, S32 split, BOOL is_sculpted)
1137 mOpen = TRUE; 1153 mOpen = TRUE;
1138 1154
1139 // Is this 0xf0 mask really necessary? DK 03/02/05 1155 // Is this 0xf0 mask really necessary? DK 03/02/05
1140 switch (mParams.getCurveType() & 0xf0) 1156 switch (params.getCurveType() & 0xf0)
1141 { 1157 {
1142 default: 1158 default:
1143 case LL_PCODE_PATH_LINE: 1159 case LL_PCODE_PATH_LINE:
1144 { 1160 {
1145 // Take the begin/end twist into account for detail. 1161 // Take the begin/end twist into account for detail.
1146 np = llfloor(fabs(mParams.getTwistBegin() - mParams.getTwist()) * 3.5f * (detail-0.5f)) + 2; 1162 np = llfloor(fabs(params.getTwistBegin() - params.getTwist()) * 3.5f * (detail-0.5f)) + 2;
1147 if (np < split+2) 1163 if (np < split+2)
1148 { 1164 {
1149 np = split+2; 1165 np = split+2;
@@ -1153,16 +1169,16 @@ BOOL LLPath::generate(F32 detail, S32 split, BOOL is_sculpted)
1153 1169
1154 mPath.resize(np); 1170 mPath.resize(np);
1155 1171
1156 LLVector2 start_scale = mParams.getBeginScale(); 1172 LLVector2 start_scale = params.getBeginScale();
1157 LLVector2 end_scale = mParams.getEndScale(); 1173 LLVector2 end_scale = params.getEndScale();
1158 1174
1159 for (S32 i=0;i<np;i++) 1175 for (S32 i=0;i<np;i++)
1160 { 1176 {
1161 F32 t = lerp(mParams.getBegin(),mParams.getEnd(),(F32)i * mStep); 1177 F32 t = lerp(params.getBegin(),params.getEnd(),(F32)i * mStep);
1162 mPath[i].mPos.setVec(lerp(0,mParams.getShear().mV[0],t), 1178 mPath[i].mPos.setVec(lerp(0,params.getShear().mV[0],t),
1163 lerp(0,mParams.getShear().mV[1],t), 1179 lerp(0,params.getShear().mV[1],t),
1164 t - 0.5f); 1180 t - 0.5f);
1165 mPath[i].mRot.setQuat(lerp(F_PI * mParams.getTwistBegin(),F_PI * mParams.getTwist(),t),0,0,1); 1181 mPath[i].mRot.setQuat(lerp(F_PI * params.getTwistBegin(),F_PI * params.getTwist(),t),0,0,1);
1166 mPath[i].mScale.mV[0] = lerp(start_scale.mV[0],end_scale.mV[0],t); 1182 mPath[i].mScale.mV[0] = lerp(start_scale.mV[0],end_scale.mV[0],t);
1167 mPath[i].mScale.mV[1] = lerp(start_scale.mV[1],end_scale.mV[1],t); 1183 mPath[i].mScale.mV[1] = lerp(start_scale.mV[1],end_scale.mV[1],t);
1168 mPath[i].mTexT = t; 1184 mPath[i].mTexT = t;
@@ -1173,27 +1189,27 @@ BOOL LLPath::generate(F32 detail, S32 split, BOOL is_sculpted)
1173 case LL_PCODE_PATH_CIRCLE: 1189 case LL_PCODE_PATH_CIRCLE:
1174 { 1190 {
1175 // Increase the detail as the revolutions and twist increase. 1191 // Increase the detail as the revolutions and twist increase.
1176 F32 twist_mag = fabs(mParams.getTwistBegin() - mParams.getTwist()); 1192 F32 twist_mag = fabs(params.getTwistBegin() - params.getTwist());
1177 1193
1178 S32 sides = (S32)llfloor(llfloor((MIN_DETAIL_FACES * detail + twist_mag * 3.5f * (detail-0.5f))) * mParams.getRevolutions()); 1194 S32 sides = (S32)llfloor(llfloor((MIN_DETAIL_FACES * detail + twist_mag * 3.5f * (detail-0.5f))) * params.getRevolutions());
1179 1195
1180 if (is_sculpted) 1196 if (is_sculpted)
1181 sides = sculpt_sides(detail); 1197 sides = sculpt_sides(detail);
1182 1198
1183 genNGon(sides); 1199 genNGon(params, sides);
1184 } 1200 }
1185 break; 1201 break;
1186 1202
1187 case LL_PCODE_PATH_CIRCLE2: 1203 case LL_PCODE_PATH_CIRCLE2:
1188 { 1204 {
1189 if (mParams.getEnd() - mParams.getBegin() >= 0.99f && 1205 if (params.getEnd() - params.getBegin() >= 0.99f &&
1190 mParams.getScaleX() >= .99f) 1206 params.getScaleX() >= .99f)
1191 { 1207 {
1192 mOpen = FALSE; 1208 mOpen = FALSE;
1193 } 1209 }
1194 1210
1195 //genNGon(llfloor(MIN_DETAIL_FACES * detail), 4.f, 0.f); 1211 //genNGon(params, llfloor(MIN_DETAIL_FACES * detail), 4.f, 0.f);
1196 genNGon(llfloor(MIN_DETAIL_FACES * detail)); 1212 genNGon(params, llfloor(MIN_DETAIL_FACES * detail));
1197 1213
1198 F32 t = 0.f; 1214 F32 t = 0.f;
1199 F32 tStep = 1.0f / mPath.size(); 1215 F32 tStep = 1.0f / mPath.size();
@@ -1223,28 +1239,30 @@ BOOL LLPath::generate(F32 detail, S32 split, BOOL is_sculpted)
1223 { 1239 {
1224 F32 t = (F32)i * mStep; 1240 F32 t = (F32)i * mStep;
1225 mPath[i].mPos.setVec(0, 1241 mPath[i].mPos.setVec(0,
1226 lerp(0, -sin(F_PI*mParams.getTwist()*t)*0.5f,t), 1242 lerp(0, -sin(F_PI*params.getTwist()*t)*0.5f,t),
1227 lerp(-0.5, cos(F_PI*mParams.getTwist()*t)*0.5f,t)); 1243 lerp(-0.5, cos(F_PI*params.getTwist()*t)*0.5f,t));
1228 mPath[i].mScale.mV[0] = lerp(1,mParams.getScale().mV[0],t); 1244 mPath[i].mScale.mV[0] = lerp(1,params.getScale().mV[0],t);
1229 mPath[i].mScale.mV[1] = lerp(1,mParams.getScale().mV[1],t); 1245 mPath[i].mScale.mV[1] = lerp(1,params.getScale().mV[1],t);
1230 mPath[i].mTexT = t; 1246 mPath[i].mTexT = t;
1231 mPath[i].mRot.setQuat(F_PI * mParams.getTwist() * t,1,0,0); 1247 mPath[i].mRot.setQuat(F_PI * params.getTwist() * t,1,0,0);
1232 } 1248 }
1233 1249
1234 break; 1250 break;
1235 }; 1251 };
1236 1252
1237 if (mParams.getTwist() != mParams.getTwistBegin()) mOpen = TRUE; 1253 if (params.getTwist() != params.getTwistBegin()) mOpen = TRUE;
1238 1254
1239 //if ((int(fabsf(mParams.getTwist() - mParams.getTwistBegin())*100))%100 != 0) { 1255 //if ((int(fabsf(params.getTwist() - params.getTwistBegin())*100))%100 != 0) {
1240 // mOpen = TRUE; 1256 // mOpen = TRUE;
1241 //} 1257 //}
1242 1258
1243 return TRUE; 1259 return TRUE;
1244} 1260}
1245 1261
1246BOOL LLDynamicPath::generate(F32 detail, S32 split, BOOL is_sculpted) 1262BOOL LLDynamicPath::generate(const LLPathParams& params, F32 detail, S32 split, BOOL is_sculpted)
1247{ 1263{
1264 LLMemType m1(LLMemType::MTYPE_VOLUME);
1265
1248 mOpen = TRUE; // Draw end caps 1266 mOpen = TRUE; // Draw end caps
1249 if (getPathLength() == 0) 1267 if (getPathLength() == 0)
1250 { 1268 {
@@ -1266,6 +1284,8 @@ BOOL LLDynamicPath::generate(F32 detail, S32 split, BOOL is_sculpted)
1266 1284
1267BOOL LLPathParams::importFile(FILE *fp) 1285BOOL LLPathParams::importFile(FILE *fp)
1268{ 1286{
1287 LLMemType m1(LLMemType::MTYPE_VOLUME);
1288
1269 const S32 BUFSIZE = 16384; 1289 const S32 BUFSIZE = 16384;
1270 char buffer[BUFSIZE]; /* Flawfinder: ignore */ 1290 char buffer[BUFSIZE]; /* Flawfinder: ignore */
1271 // *NOTE: changing the size or type of these buffers will require 1291 // *NOTE: changing the size or type of these buffers will require
@@ -1410,6 +1430,8 @@ BOOL LLPathParams::exportFile(FILE *fp) const
1410 1430
1411BOOL LLPathParams::importLegacyStream(std::istream& input_stream) 1431BOOL LLPathParams::importLegacyStream(std::istream& input_stream)
1412{ 1432{
1433 LLMemType m1(LLMemType::MTYPE_VOLUME);
1434
1413 const S32 BUFSIZE = 16384; 1435 const S32 BUFSIZE = 16384;
1414 char buffer[BUFSIZE]; /* Flawfinder: ignore */ 1436 char buffer[BUFSIZE]; /* Flawfinder: ignore */
1415 // *NOTE: changing the size or type of these buffers will require 1437 // *NOTE: changing the size or type of these buffers will require
@@ -1610,8 +1632,11 @@ LLProfile::~LLProfile()
1610 1632
1611S32 LLVolume::sNumMeshPoints = 0; 1633S32 LLVolume::sNumMeshPoints = 0;
1612 1634
1613LLVolume::LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL generate_single_face, const BOOL is_unique) : mParams(params) 1635LLVolume::LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL generate_single_face, const BOOL is_unique)
1636 : mParams(params)
1614{ 1637{
1638 LLMemType m1(LLMemType::MTYPE_VOLUME);
1639
1615 mUnique = is_unique; 1640 mUnique = is_unique;
1616 mFaceMask = 0x0; 1641 mFaceMask = 0x0;
1617 mDetail = detail; 1642 mDetail = detail;
@@ -1620,16 +1645,14 @@ LLVolume::LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL ge
1620 // set defaults 1645 // set defaults
1621 if (mParams.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE) 1646 if (mParams.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE)
1622 { 1647 {
1623 mPathp = new LLDynamicPath(mParams.getPathParams()); 1648 mPathp = new LLDynamicPath();
1624 } 1649 }
1625 else 1650 else
1626 { 1651 {
1627 mPathp = new LLPath(mParams.getPathParams()); 1652 mPathp = new LLPath();
1628 } 1653 }
1629 mProfilep = new LLProfile(mParams.getProfileParams()); 1654 mProfilep = new LLProfile();
1630 1655
1631 mNumVolumeFaces = 0;
1632 mVolumeFaces = NULL;
1633 mGenerateSingleFace = generate_single_face; 1656 mGenerateSingleFace = generate_single_face;
1634 1657
1635 generate(); 1658 generate();
@@ -1642,11 +1665,7 @@ LLVolume::LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL ge
1642void LLVolume::resizePath(S32 length) 1665void LLVolume::resizePath(S32 length)
1643{ 1666{
1644 mPathp->resizePath(length); 1667 mPathp->resizePath(length);
1645 if (mVolumeFaces != NULL) 1668 mVolumeFaces.clear();
1646 {
1647 delete[] mVolumeFaces;
1648 mVolumeFaces = NULL;
1649 }
1650} 1669}
1651 1670
1652void LLVolume::regen() 1671void LLVolume::regen()
@@ -1665,15 +1684,14 @@ LLVolume::~LLVolume()
1665 sNumMeshPoints -= mMesh.size(); 1684 sNumMeshPoints -= mMesh.size();
1666 delete mPathp; 1685 delete mPathp;
1667 delete mProfilep; 1686 delete mProfilep;
1668 delete[] mVolumeFaces;
1669
1670 mPathp = NULL; 1687 mPathp = NULL;
1671 mProfilep = NULL; 1688 mProfilep = NULL;
1672 mVolumeFaces = NULL; 1689 mVolumeFaces.clear();
1673} 1690}
1674 1691
1675BOOL LLVolume::generate() 1692BOOL LLVolume::generate()
1676{ 1693{
1694 LLMemType m1(LLMemType::MTYPE_VOLUME);
1677 llassert_always(mProfilep); 1695 llassert_always(mProfilep);
1678 1696
1679 //Added 10.03.05 Dave Parks 1697 //Added 10.03.05 Dave Parks
@@ -1682,13 +1700,13 @@ BOOL LLVolume::generate()
1682 // stretched due to twisting or scaling on the path. 1700 // stretched due to twisting or scaling on the path.
1683 S32 split = (S32) ((mDetail)*0.66f); 1701 S32 split = (S32) ((mDetail)*0.66f);
1684 1702
1685 if (mPathp->mParams.getCurveType() == LL_PCODE_PATH_LINE && 1703 if (mParams.getPathParams().getCurveType() == LL_PCODE_PATH_LINE &&
1686 (mPathp->mParams.getScale().mV[0] != 1.0f || 1704 (mParams.getPathParams().getScale().mV[0] != 1.0f ||
1687 mPathp->mParams.getScale().mV[1] != 1.0f) && 1705 mParams.getPathParams().getScale().mV[1] != 1.0f) &&
1688 (mProfilep->mParams.getCurveType() == LL_PCODE_PROFILE_SQUARE || 1706 (mParams.getProfileParams().getCurveType() == LL_PCODE_PROFILE_SQUARE ||
1689 mProfilep->mParams.getCurveType() == LL_PCODE_PROFILE_ISOTRI || 1707 mParams.getProfileParams().getCurveType() == LL_PCODE_PROFILE_ISOTRI ||
1690 mProfilep->mParams.getCurveType() == LL_PCODE_PROFILE_EQUALTRI || 1708 mParams.getProfileParams().getCurveType() == LL_PCODE_PROFILE_EQUALTRI ||
1691 mProfilep->mParams.getCurveType() == LL_PCODE_PROFILE_RIGHTTRI)) 1709 mParams.getProfileParams().getCurveType() == LL_PCODE_PROFILE_RIGHTTRI))
1692 { 1710 {
1693 split = 0; 1711 split = 0;
1694 } 1712 }
@@ -1698,8 +1716,8 @@ BOOL LLVolume::generate()
1698 F32 profile_detail = mDetail; 1716 F32 profile_detail = mDetail;
1699 F32 path_detail = mDetail; 1717 F32 path_detail = mDetail;
1700 1718
1701 U8 path_type = mPathp->mParams.getCurveType(); 1719 U8 path_type = mParams.getPathParams().getCurveType();
1702 U8 profile_type = mProfilep->mParams.getCurveType(); 1720 U8 profile_type = mParams.getProfileParams().getCurveType();
1703 1721
1704 if (path_type == LL_PCODE_PATH_LINE && profile_type == LL_PCODE_PROFILE_CIRCLE) 1722 if (path_type == LL_PCODE_PATH_LINE && profile_type == LL_PCODE_PROFILE_CIRCLE)
1705 { //cylinders don't care about Z-Axis 1723 { //cylinders don't care about Z-Axis
@@ -1710,8 +1728,8 @@ BOOL LLVolume::generate()
1710 mLODScaleBias.setVec(0.6f, 0.6f, 0.6f); 1728 mLODScaleBias.setVec(0.6f, 0.6f, 0.6f);
1711 } 1729 }
1712 1730
1713 BOOL regenPath = mPathp->generate(path_detail, split); 1731 BOOL regenPath = mPathp->generate(mParams.getPathParams(), path_detail, split);
1714 BOOL regenProf = mProfilep->generate(mPathp->isOpen(),profile_detail, split); 1732 BOOL regenProf = mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(),profile_detail, split);
1715 1733
1716 if (regenPath || regenProf ) 1734 if (regenPath || regenProf )
1717 { 1735 {
@@ -1759,28 +1777,26 @@ BOOL LLVolume::generate()
1759 1777
1760void LLVolume::createVolumeFaces() 1778void LLVolume::createVolumeFaces()
1761{ 1779{
1762 S32 i; 1780 LLMemType m1(LLMemType::MTYPE_VOLUME);
1763 1781
1764 if (mGenerateSingleFace) 1782 if (mGenerateSingleFace)
1765 { 1783 {
1766 mNumVolumeFaces = 0; 1784 // do nothing
1767 } 1785 }
1768 else 1786 else
1769 { 1787 {
1770 S32 num_faces = getNumFaces(); 1788 S32 num_faces = getNumFaces();
1771 mNumVolumeFaces = num_faces;
1772 BOOL partial_build = TRUE; 1789 BOOL partial_build = TRUE;
1773 if (!mVolumeFaces) 1790 if (num_faces != mVolumeFaces.size())
1774 { 1791 {
1775 partial_build = FALSE; 1792 partial_build = FALSE;
1776 mVolumeFaces = new LLVolumeFace[num_faces]; 1793 mVolumeFaces.resize(num_faces);
1777 } 1794 }
1778 // Initialize volume faces with parameter data 1795 // Initialize volume faces with parameter data
1779 for (i = 0; i < num_faces; i++) 1796 for (S32 i = 0; i < (S32)mVolumeFaces.size(); i++)
1780 { 1797 {
1781 LLVolumeFace &vf = mVolumeFaces[i]; 1798 LLVolumeFace& vf = mVolumeFaces[i];
1782 LLProfile::Face &face = mProfilep->mFaces[i]; 1799 LLProfile::Face& face = mProfilep->mFaces[i];
1783 vf.mVolumep = this;
1784 vf.mBeginS = face.mIndex; 1800 vf.mBeginS = face.mIndex;
1785 vf.mNumS = face.mCount; 1801 vf.mNumS = face.mCount;
1786 vf.mBeginT = 0; 1802 vf.mBeginT = 0;
@@ -1788,7 +1804,7 @@ void LLVolume::createVolumeFaces()
1788 vf.mID = i; 1804 vf.mID = i;
1789 1805
1790 // Set the type mask bits correctly 1806 // Set the type mask bits correctly
1791 if (mProfilep->isHollow()) 1807 if (mParams.getProfileParams().getHollow() > 0)
1792 { 1808 {
1793 vf.mTypeMask |= LLVolumeFace::HOLLOW_MASK; 1809 vf.mTypeMask |= LLVolumeFace::HOLLOW_MASK;
1794 } 1810 }
@@ -1835,9 +1851,10 @@ void LLVolume::createVolumeFaces()
1835 } 1851 }
1836 } 1852 }
1837 1853
1838 for (i = 0; i < mNumVolumeFaces; i++) 1854 for (face_list_t::iterator iter = mVolumeFaces.begin();
1855 iter != mVolumeFaces.end(); ++iter)
1839 { 1856 {
1840 mVolumeFaces[i].create(partial_build); 1857 (*iter).create(this, partial_build);
1841 } 1858 }
1842 } 1859 }
1843} 1860}
@@ -1930,6 +1947,8 @@ F32 LLVolume::sculptGetSurfaceArea(U16 sculpt_width, U16 sculpt_height, S8 sculp
1930// create placeholder shape 1947// create placeholder shape
1931void LLVolume::sculptGeneratePlaceholder() 1948void LLVolume::sculptGeneratePlaceholder()
1932{ 1949{
1950 LLMemType m1(LLMemType::MTYPE_VOLUME);
1951
1933 S32 sizeS = mPathp->mPath.size(); 1952 S32 sizeS = mPathp->mPath.size();
1934 S32 sizeT = mProfilep->mProfile.size(); 1953 S32 sizeT = mProfilep->mProfile.size();
1935 1954
@@ -1961,6 +1980,8 @@ void LLVolume::sculptGeneratePlaceholder()
1961// create the vertices from the map 1980// create the vertices from the map
1962void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type) 1981void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, U8 sculpt_type)
1963{ 1982{
1983 LLMemType m1(LLMemType::MTYPE_VOLUME);
1984
1964 S32 sizeS = mPathp->mPath.size(); 1985 S32 sizeS = mPathp->mPath.size();
1965 S32 sizeT = mProfilep->mProfile.size(); 1986 S32 sizeT = mProfilep->mProfile.size();
1966 1987
@@ -2030,18 +2051,19 @@ void LLVolume::sculptGenerateMapVertices(U16 sculpt_width, U16 sculpt_height, S8
2030// sculpt replaces generate() for sculpted surfaces 2051// sculpt replaces generate() for sculpted surfaces
2031void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level) 2052void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level)
2032{ 2053{
2054 LLMemType m1(LLMemType::MTYPE_VOLUME);
2033 U8 sculpt_type = mParams.getSculptType(); 2055 U8 sculpt_type = mParams.getSculptType();
2034 2056
2035 BOOL data_is_empty = FALSE; 2057 BOOL data_is_empty = FALSE;
2036 2058
2037 if (sculpt_width == 0 || sculpt_height == 0 || sculpt_components == 0 || sculpt_data == NULL) 2059 if (sculpt_width == 0 || sculpt_height == 0 || sculpt_components < 3 || sculpt_data == NULL)
2038 { 2060 {
2039 sculpt_level = -1; 2061 sculpt_level = -1;
2040 data_is_empty = TRUE; 2062 data_is_empty = TRUE;
2041 } 2063 }
2042 2064
2043 mPathp->generate(mDetail, 0, TRUE); 2065 mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE);
2044 mProfilep->generate(mPathp->isOpen(), mDetail, 0, TRUE); 2066 mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE);
2045 2067
2046 S32 sizeS = mPathp->mPath.size(); 2068 S32 sizeS = mPathp->mPath.size();
2047 S32 sizeT = mProfilep->mProfile.size(); 2069 S32 sizeT = mProfilep->mProfile.size();
@@ -2056,7 +2078,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
2056 mMesh.resize(sizeS * sizeT); 2078 mMesh.resize(sizeS * sizeT);
2057 sNumMeshPoints += mMesh.size(); 2079 sNumMeshPoints += mMesh.size();
2058 2080
2059 if (sculptGetSurfaceArea(sculpt_width, sculpt_height, sculpt_components, sculpt_data) < SCULPT_MIN_AREA) 2081 if (!data_is_empty && sculptGetSurfaceArea(sculpt_width, sculpt_height, sculpt_components, sculpt_data) < SCULPT_MIN_AREA)
2060 data_is_empty = TRUE; 2082 data_is_empty = TRUE;
2061 2083
2062 //generate vertex positions 2084 //generate vertex positions
@@ -2077,11 +2099,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
2077 mSculptLevel = sculpt_level; 2099 mSculptLevel = sculpt_level;
2078 2100
2079 // Delete any existing faces so that they get regenerated 2101 // Delete any existing faces so that they get regenerated
2080 if (mVolumeFaces) 2102 mVolumeFaces.clear();
2081 {
2082 delete[] mVolumeFaces;
2083 mVolumeFaces = NULL;
2084 }
2085 2103
2086 createVolumeFaces(); 2104 createVolumeFaces();
2087} 2105}
@@ -2141,6 +2159,7 @@ bool LLVolumeParams::operator<(const LLVolumeParams &params) const
2141 2159
2142void LLVolumeParams::copyParams(const LLVolumeParams &params) 2160void LLVolumeParams::copyParams(const LLVolumeParams &params)
2143{ 2161{
2162 LLMemType m1(LLMemType::MTYPE_VOLUME);
2144 mProfileParams.copyParams(params.mProfileParams); 2163 mProfileParams.copyParams(params.mProfileParams);
2145 mPathParams.copyParams(params.mPathParams); 2164 mPathParams.copyParams(params.mPathParams);
2146 mSculptID = params.getSculptID(); 2165 mSculptID = params.getSculptID();
@@ -2512,6 +2531,8 @@ bool LLVolumeParams::validate(U8 prof_curve, F32 prof_begin, F32 prof_end, F32 h
2512 2531
2513S32 *LLVolume::getTriangleIndices(U32 &num_indices) const 2532S32 *LLVolume::getTriangleIndices(U32 &num_indices) const
2514{ 2533{
2534 LLMemType m1(LLMemType::MTYPE_VOLUME);
2535
2515 S32 expected_num_triangle_indices = getNumTriangleIndices(); 2536 S32 expected_num_triangle_indices = getNumTriangleIndices();
2516 if (expected_num_triangle_indices > MAX_VOLUME_TRIANGLE_INDICES) 2537 if (expected_num_triangle_indices > MAX_VOLUME_TRIANGLE_INDICES)
2517 { 2538 {
@@ -2528,7 +2549,7 @@ S32 *LLVolume::getTriangleIndices(U32 &num_indices) const
2528 // Counter-clockwise triangles are forward facing... 2549 // Counter-clockwise triangles are forward facing...
2529 2550
2530 BOOL open = getProfile().isOpen(); 2551 BOOL open = getProfile().isOpen();
2531 BOOL hollow = getProfile().isHollow(); 2552 BOOL hollow = (mParams.getProfileParams().getHollow() > 0);
2532 BOOL path_open = getPath().isOpen(); 2553 BOOL path_open = getPath().isOpen();
2533 S32 size_s, size_s_out, size_t; 2554 S32 size_s, size_s_out, size_t;
2534 S32 s, t, i; 2555 S32 s, t, i;
@@ -3134,7 +3155,7 @@ S32 *LLVolume::getTriangleIndices(U32 &num_indices) const
3134S32 LLVolume::getNumTriangleIndices() const 3155S32 LLVolume::getNumTriangleIndices() const
3135{ 3156{
3136 BOOL profile_open = getProfile().isOpen(); 3157 BOOL profile_open = getProfile().isOpen();
3137 BOOL hollow = getProfile().isHollow(); 3158 BOOL hollow = (mParams.getProfileParams().getHollow() > 0);
3138 BOOL path_open = getPath().isOpen(); 3159 BOOL path_open = getPath().isOpen();
3139 3160
3140 S32 size_s, size_s_out, size_t; 3161 S32 size_s, size_s_out, size_t;
@@ -3198,13 +3219,17 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
3198 const LLMatrix4& mat, 3219 const LLMatrix4& mat,
3199 const LLMatrix3& norm_mat) 3220 const LLMatrix3& norm_mat)
3200{ 3221{
3222 LLMemType m1(LLMemType::MTYPE_VOLUME);
3223
3201 vertices.clear(); 3224 vertices.clear();
3202 normals.clear(); 3225 normals.clear();
3203 segments.clear(); 3226 segments.clear();
3204 3227
3205 //for each face 3228 //for each face
3206 for (S32 i = 0; i < getNumVolumeFaces(); i++) { 3229 for (face_list_t::iterator iter = mVolumeFaces.begin();
3207 LLVolumeFace face = this->getVolumeFace(i); 3230 iter != mVolumeFaces.end(); ++iter)
3231 {
3232 const LLVolumeFace& face = *iter;
3208 3233
3209 if (face.mTypeMask & (LLVolumeFace::CAP_MASK)) { 3234 if (face.mTypeMask & (LLVolumeFace::CAP_MASK)) {
3210 3235
@@ -3387,9 +3412,9 @@ S32 LLVolume::lineSegmentIntersect(const LLVector3& start, LLVector3& end) const
3387 3412
3388 LLVector3 vec = end - start; 3413 LLVector3 vec = end - start;
3389 3414
3390 for (U32 i = 0; i < (U32)getNumFaces(); i++) 3415 for (S32 i = 0; i < getNumFaces(); i++)
3391 { 3416 {
3392 LLVolumeFace face = getVolumeFace(i); 3417 const LLVolumeFace& face = getVolumeFace(i);
3393 3418
3394 for (U32 j = 0; j < face.mIndices.size()/3; j++) 3419 for (U32 j = 0; j < face.mIndices.size()/3; j++)
3395 { 3420 {
@@ -3532,6 +3557,8 @@ BOOL LLVolume::cleanupTriangleData( const S32 num_input_vertices,
3532 S32 &num_output_triangles, 3557 S32 &num_output_triangles,
3533 S32 **output_triangles) 3558 S32 **output_triangles)
3534{ 3559{
3560 LLMemType m1(LLMemType::MTYPE_VOLUME);
3561
3535 /* Testing: avoid any cleanup 3562 /* Testing: avoid any cleanup
3536 num_output_vertices = num_input_vertices; 3563 num_output_vertices = num_input_vertices;
3537 num_output_triangles = num_input_triangles; 3564 num_output_triangles = num_input_triangles;
@@ -3749,6 +3776,8 @@ BOOL LLVolume::cleanupTriangleData( const S32 num_input_vertices,
3749 3776
3750BOOL LLVolumeParams::importFile(FILE *fp) 3777BOOL LLVolumeParams::importFile(FILE *fp)
3751{ 3778{
3779 LLMemType m1(LLMemType::MTYPE_VOLUME);
3780
3752 //llinfos << "importing volume" << llendl; 3781 //llinfos << "importing volume" << llendl;
3753 const S32 BUFSIZE = 16384; 3782 const S32 BUFSIZE = 16384;
3754 char buffer[BUFSIZE]; /* Flawfinder: ignore */ 3783 char buffer[BUFSIZE]; /* Flawfinder: ignore */
@@ -3803,6 +3832,8 @@ BOOL LLVolumeParams::exportFile(FILE *fp) const
3803 3832
3804BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) 3833BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream)
3805{ 3834{
3835 LLMemType m1(LLMemType::MTYPE_VOLUME);
3836
3806 //llinfos << "importing volume" << llendl; 3837 //llinfos << "importing volume" << llendl;
3807 const S32 BUFSIZE = 16384; 3838 const S32 BUFSIZE = 16384;
3808 // *NOTE: changing the size or type of this buffer will require 3839 // *NOTE: changing the size or type of this buffer will require
@@ -3842,6 +3873,8 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream)
3842 3873
3843BOOL LLVolumeParams::exportLegacyStream(std::ostream& output_stream) const 3874BOOL LLVolumeParams::exportLegacyStream(std::ostream& output_stream) const
3844{ 3875{
3876 LLMemType m1(LLMemType::MTYPE_VOLUME);
3877
3845 output_stream <<"\tshape 0\n"; 3878 output_stream <<"\tshape 0\n";
3846 output_stream <<"\t{\n"; 3879 output_stream <<"\t{\n";
3847 mPathParams.exportLegacyStream(output_stream); 3880 mPathParams.exportLegacyStream(output_stream);
@@ -3993,7 +4026,7 @@ LLFaceID LLVolume::generateFaceMask()
3993{ 4026{
3994 LLFaceID new_mask = 0x0000; 4027 LLFaceID new_mask = 0x0000;
3995 4028
3996 switch(mProfilep->mParams.getCurveType() & LL_PCODE_PROFILE_MASK) 4029 switch(mParams.getProfileParams().getCurveType() & LL_PCODE_PROFILE_MASK)
3997 { 4030 {
3998 case LL_PCODE_PROFILE_CIRCLE: 4031 case LL_PCODE_PROFILE_CIRCLE:
3999 case LL_PCODE_PROFILE_CIRCLE_HALF: 4032 case LL_PCODE_PROFILE_CIRCLE_HALF:
@@ -4001,7 +4034,7 @@ LLFaceID LLVolume::generateFaceMask()
4001 break; 4034 break;
4002 case LL_PCODE_PROFILE_SQUARE: 4035 case LL_PCODE_PROFILE_SQUARE:
4003 { 4036 {
4004 for(S32 side = (S32)(mProfilep->mParams.getBegin() * 4.f); side < llceil(mProfilep->mParams.getEnd() * 4.f); side++) 4037 for(S32 side = (S32)(mParams.getProfileParams().getBegin() * 4.f); side < llceil(mParams.getProfileParams().getEnd() * 4.f); side++)
4005 { 4038 {
4006 new_mask |= LL_FACE_OUTER_SIDE_0 << side; 4039 new_mask |= LL_FACE_OUTER_SIDE_0 << side;
4007 } 4040 }
@@ -4011,7 +4044,7 @@ LLFaceID LLVolume::generateFaceMask()
4011 case LL_PCODE_PROFILE_EQUALTRI: 4044 case LL_PCODE_PROFILE_EQUALTRI:
4012 case LL_PCODE_PROFILE_RIGHTTRI: 4045 case LL_PCODE_PROFILE_RIGHTTRI:
4013 { 4046 {
4014 for(S32 side = (S32)(mProfilep->mParams.getBegin() * 3.f); side < llceil(mProfilep->mParams.getEnd() * 3.f); side++) 4047 for(S32 side = (S32)(mParams.getProfileParams().getBegin() * 3.f); side < llceil(mParams.getProfileParams().getEnd() * 3.f); side++)
4015 { 4048 {
4016 new_mask |= LL_FACE_OUTER_SIDE_0 << side; 4049 new_mask |= LL_FACE_OUTER_SIDE_0 << side;
4017 } 4050 }
@@ -4023,7 +4056,7 @@ LLFaceID LLVolume::generateFaceMask()
4023 } 4056 }
4024 4057
4025 // handle hollow objects 4058 // handle hollow objects
4026 if (mProfilep->isHollow()) 4059 if (mParams.getProfileParams().getHollow() > 0)
4027 { 4060 {
4028 new_mask |= LL_FACE_INNER_SIDE; 4061 new_mask |= LL_FACE_INNER_SIDE;
4029 } 4062 }
@@ -4125,7 +4158,7 @@ std::ostream& operator<<(std::ostream &s, const LLPath &path)
4125 4158
4126std::ostream& operator<<(std::ostream &s, const LLVolume &volume) 4159std::ostream& operator<<(std::ostream &s, const LLVolume &volume)
4127{ 4160{
4128 s << "{params = " << volume.mParams; 4161 s << "{params = " << volume.getParams();
4129 s << ", path = " << *volume.mPathp; 4162 s << ", path = " << *volume.mPathp;
4130 s << ", profile = " << *volume.mProfilep; 4163 s << ", profile = " << *volume.mProfilep;
4131 s << "}"; 4164 s << "}";
@@ -4135,7 +4168,7 @@ std::ostream& operator<<(std::ostream &s, const LLVolume &volume)
4135 4168
4136std::ostream& operator<<(std::ostream &s, const LLVolume *volumep) 4169std::ostream& operator<<(std::ostream &s, const LLVolume *volumep)
4137{ 4170{
4138 s << "{params = " << volumep->mParams; 4171 s << "{params = " << volumep->getParams();
4139 s << ", path = " << *(volumep->mPathp); 4172 s << ", path = " << *(volumep->mPathp);
4140 s << ", profile = " << *(volumep->mProfilep); 4173 s << ", profile = " << *(volumep->mProfilep);
4141 s << "}"; 4174 s << "}";
@@ -4155,15 +4188,15 @@ LLVolumeFace::LLVolumeFace()
4155} 4188}
4156 4189
4157 4190
4158BOOL LLVolumeFace::create(BOOL partial_build) 4191BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build)
4159{ 4192{
4160 if (mTypeMask & CAP_MASK) 4193 if (mTypeMask & CAP_MASK)
4161 { 4194 {
4162 return createCap(partial_build); 4195 return createCap(volume, partial_build);
4163 } 4196 }
4164 else if ((mTypeMask & END_MASK) || (mTypeMask & SIDE_MASK)) 4197 else if ((mTypeMask & END_MASK) || (mTypeMask & SIDE_MASK))
4165 { 4198 {
4166 return createSide(partial_build); 4199 return createSide(volume, partial_build);
4167 } 4200 }
4168 else 4201 else
4169 { 4202 {
@@ -4185,12 +4218,14 @@ void LerpPlanarVertex(LLVolumeFace::VertexData& v0,
4185 vout.mBinormal = v0.mBinormal; 4218 vout.mBinormal = v0.mBinormal;
4186} 4219}
4187 4220
4188BOOL LLVolumeFace::createUnCutCubeCap(BOOL partial_build) 4221BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
4189{ 4222{
4190 const std::vector<LLVolume::Point>& mesh = mVolumep->getMesh(); 4223 LLMemType m1(LLMemType::MTYPE_VOLUME);
4191 const std::vector<LLVector3>& profile = mVolumep->getProfile().mProfile; 4224
4192 S32 max_s = mVolumep->getProfile().getTotal(); 4225 const std::vector<LLVolume::Point>& mesh = volume->getMesh();
4193 S32 max_t = mVolumep->getPath().mPath.size(); 4226 const std::vector<LLVector3>& profile = volume->getProfile().mProfile;
4227 S32 max_s = volume->getProfile().getTotal();
4228 S32 max_t = volume->getPath().mPath.size();
4194 4229
4195 // S32 i; 4230 // S32 i;
4196 S32 num_vertices = 0, num_indices = 0; 4231 S32 num_vertices = 0, num_indices = 0;
@@ -4291,23 +4326,24 @@ BOOL LLVolumeFace::createUnCutCubeCap(BOOL partial_build)
4291} 4326}
4292 4327
4293 4328
4294BOOL LLVolumeFace::createCap(BOOL partial_build) 4329BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build)
4295{ 4330{
4331 LLMemType m1(LLMemType::MTYPE_VOLUME);
4332
4296 if (!(mTypeMask & HOLLOW_MASK) && 4333 if (!(mTypeMask & HOLLOW_MASK) &&
4297 !(mTypeMask & OPEN_MASK) && 4334 !(mTypeMask & OPEN_MASK) &&
4298 ((this->mVolumep->getParams().getPathParams().getBegin()==0.0f)&& 4335 ((volume->getParams().getPathParams().getBegin()==0.0f)&&
4299 (this->mVolumep->getParams().getPathParams().getEnd()==1.0f))&& 4336 (volume->getParams().getPathParams().getEnd()==1.0f))&&
4300 (mVolumep->getProfile().mParams.getCurveType()==LL_PCODE_PROFILE_SQUARE && 4337 (volume->getParams().getProfileParams().getCurveType()==LL_PCODE_PROFILE_SQUARE &&
4301 mVolumep->getPath().mParams.getCurveType()==LL_PCODE_PATH_LINE) 4338 volume->getParams().getPathParams().getCurveType()==LL_PCODE_PATH_LINE)
4302 ){ 4339 ){
4303 return createUnCutCubeCap(partial_build); 4340 return createUnCutCubeCap(volume, partial_build);
4304 } 4341 }
4305 4342
4306 S32 i;
4307 S32 num_vertices = 0, num_indices = 0; 4343 S32 num_vertices = 0, num_indices = 0;
4308 4344
4309 const std::vector<LLVolume::Point>& mesh = mVolumep->getMesh(); 4345 const std::vector<LLVolume::Point>& mesh = volume->getMesh();
4310 const std::vector<LLVector3>& profile = mVolumep->getProfile().mProfile; 4346 const std::vector<LLVector3>& profile = volume->getProfile().mProfile;
4311 4347
4312 // All types of caps have the same number of vertices and indices 4348 // All types of caps have the same number of vertices and indices
4313 num_vertices = profile.size(); 4349 num_vertices = profile.size();
@@ -4320,8 +4356,8 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4320 mIndices.resize(num_indices); 4356 mIndices.resize(num_indices);
4321 } 4357 }
4322 4358
4323 S32 max_s = mVolumep->getProfile().getTotal(); 4359 S32 max_s = volume->getProfile().getTotal();
4324 S32 max_t = mVolumep->getPath().mPath.size(); 4360 S32 max_t = volume->getPath().mPath.size();
4325 4361
4326 mCenter.clearVec(); 4362 mCenter.clearVec();
4327 4363
@@ -4345,7 +4381,7 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4345 LLVector3& max = mExtents[1]; 4381 LLVector3& max = mExtents[1];
4346 4382
4347 // Copy the vertices into the array 4383 // Copy the vertices into the array
4348 for (i = 0; i < num_vertices; i++) 4384 for (S32 i = 0; i < num_vertices; i++)
4349 { 4385 {
4350 if (mTypeMask & TOP_MASK) 4386 if (mTypeMask & TOP_MASK)
4351 { 4387 {
@@ -4409,7 +4445,7 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4409 } 4445 }
4410 4446
4411 4447
4412 for (i = 0; i < num_vertices; i++) 4448 for (S32 i = 0; i < num_vertices; i++)
4413 { 4449 {
4414 mVertices[i].mBinormal = binormal; 4450 mVertices[i].mBinormal = binormal;
4415 mVertices[i].mNormal = normal; 4451 mVertices[i].mNormal = normal;
@@ -4430,7 +4466,7 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4430 // Does it matter if it's open or closed? - djs 4466 // Does it matter if it's open or closed? - djs
4431 4467
4432 S32 pt1 = 0, pt2 = num_vertices - 1; 4468 S32 pt1 = 0, pt2 = num_vertices - 1;
4433 i = 0; 4469 S32 i = 0;
4434 while (pt2 - pt1 > 1) 4470 while (pt2 - pt1 > 1)
4435 { 4471 {
4436 // Use the profile points instead of the mesh, since you want 4472 // Use the profile points instead of the mesh, since you want
@@ -4533,7 +4569,7 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4533 llassert(mTypeMask & BOTTOM_MASK); 4569 llassert(mTypeMask & BOTTOM_MASK);
4534 S32 pt1 = 0, pt2 = num_vertices - 1; 4570 S32 pt1 = 0, pt2 = num_vertices - 1;
4535 4571
4536 i = 0; 4572 S32 i = 0;
4537 while (pt2 - pt1 > 1) 4573 while (pt2 - pt1 > 1)
4538 { 4574 {
4539 // Use the profile points instead of the mesh, since you want 4575 // Use the profile points instead of the mesh, since you want
@@ -4640,7 +4676,7 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4640 // SOLID OPEN TOP 4676 // SOLID OPEN TOP
4641 // Generate indices 4677 // Generate indices
4642 // This is a tri-fan, so we reuse the same first point for all triangles. 4678 // This is a tri-fan, so we reuse the same first point for all triangles.
4643 for (i = 0; i < (num_vertices - 2); i++) 4679 for (S32 i = 0; i < (num_vertices - 2); i++)
4644 { 4680 {
4645 mIndices[3*i] = num_vertices - 1; 4681 mIndices[3*i] = num_vertices - 1;
4646 mIndices[3*i+1] = i; 4682 mIndices[3*i+1] = i;
@@ -4650,7 +4686,7 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4650 else 4686 else
4651 { 4687 {
4652 // SOLID CLOSED TOP 4688 // SOLID CLOSED TOP
4653 for (i = 0; i < (num_vertices - 2); i++) 4689 for (S32 i = 0; i < (num_vertices - 2); i++)
4654 { 4690 {
4655 //MSMSM fix these caps but only for the un-cut case 4691 //MSMSM fix these caps but only for the un-cut case
4656 mIndices[3*i] = num_vertices - 1; 4692 mIndices[3*i] = num_vertices - 1;
@@ -4666,7 +4702,7 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4666 // SOLID OPEN BOTTOM 4702 // SOLID OPEN BOTTOM
4667 // Generate indices 4703 // Generate indices
4668 // This is a tri-fan, so we reuse the same first point for all triangles. 4704 // This is a tri-fan, so we reuse the same first point for all triangles.
4669 for (i = 0; i < (num_vertices - 2); i++) 4705 for (S32 i = 0; i < (num_vertices - 2); i++)
4670 { 4706 {
4671 mIndices[3*i] = num_vertices - 1; 4707 mIndices[3*i] = num_vertices - 1;
4672 mIndices[3*i+1] = i + 1; 4708 mIndices[3*i+1] = i + 1;
@@ -4676,7 +4712,7 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4676 else 4712 else
4677 { 4713 {
4678 // SOLID CLOSED BOTTOM 4714 // SOLID CLOSED BOTTOM
4679 for (i = 0; i < (num_vertices - 2); i++) 4715 for (S32 i = 0; i < (num_vertices - 2); i++)
4680 { 4716 {
4681 //MSMSM fix these caps but only for the un-cut case 4717 //MSMSM fix these caps but only for the un-cut case
4682 mIndices[3*i] = num_vertices - 1; 4718 mIndices[3*i] = num_vertices - 1;
@@ -4691,6 +4727,8 @@ BOOL LLVolumeFace::createCap(BOOL partial_build)
4691 4727
4692void LLVolumeFace::createBinormals() 4728void LLVolumeFace::createBinormals()
4693{ 4729{
4730 LLMemType m1(LLMemType::MTYPE_VOLUME);
4731
4694 if (!mHasBinormals) 4732 if (!mHasBinormals)
4695 { 4733 {
4696 //generate binormals 4734 //generate binormals
@@ -4732,16 +4770,18 @@ void LLVolumeFace::createBinormals()
4732 } 4770 }
4733} 4771}
4734 4772
4735BOOL LLVolumeFace::createSide(BOOL partial_build) 4773BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
4736{ 4774{
4775 LLMemType m1(LLMemType::MTYPE_VOLUME);
4776
4737 BOOL flat = mTypeMask & FLAT_MASK; 4777 BOOL flat = mTypeMask & FLAT_MASK;
4738 S32 num_vertices, num_indices; 4778 S32 num_vertices, num_indices;
4739 4779
4740 const std::vector<LLVolume::Point>& mesh = mVolumep->getMesh(); 4780 const std::vector<LLVolume::Point>& mesh = volume->getMesh();
4741 const std::vector<LLVector3>& profile = mVolumep->getProfile().mProfile; 4781 const std::vector<LLVector3>& profile = volume->getProfile().mProfile;
4742 const std::vector<LLPath::PathPt>& path_data = mVolumep->getPath().mPath; 4782 const std::vector<LLPath::PathPt>& path_data = volume->getPath().mPath;
4743 4783
4744 S32 max_s = mVolumep->getProfile().getTotal(); 4784 S32 max_s = volume->getProfile().getTotal();
4745 4785
4746 S32 s, t, i; 4786 S32 s, t, i;
4747 F32 ss, tt; 4787 F32 ss, tt;
@@ -4884,7 +4924,7 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
4884 if (t < mNumT-2) { //top right/top left neighbor face 4924 if (t < mNumT-2) { //top right/top left neighbor face
4885 mEdge[cur_edge++] = (mNumS-1)*2*(t+1)+s*2+1; 4925 mEdge[cur_edge++] = (mNumS-1)*2*(t+1)+s*2+1;
4886 } 4926 }
4887 else if (mNumT <= 3 || mVolumep->getPath().isOpen() == TRUE) { //no neighbor 4927 else if (mNumT <= 3 || volume->getPath().isOpen() == TRUE) { //no neighbor
4888 mEdge[cur_edge++] = -1; 4928 mEdge[cur_edge++] = -1;
4889 } 4929 }
4890 else { //wrap on T 4930 else { //wrap on T
@@ -4893,7 +4933,7 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
4893 if (s > 0) { //top left/bottom left neighbor face 4933 if (s > 0) { //top left/bottom left neighbor face
4894 mEdge[cur_edge++] = (mNumS-1)*2*t+s*2-1; 4934 mEdge[cur_edge++] = (mNumS-1)*2*t+s*2-1;
4895 } 4935 }
4896 else if (flat_face || mVolumep->getProfile().isOpen() == TRUE) { //no neighbor 4936 else if (flat_face || volume->getProfile().isOpen() == TRUE) { //no neighbor
4897 mEdge[cur_edge++] = -1; 4937 mEdge[cur_edge++] = -1;
4898 } 4938 }
4899 else { //wrap on S 4939 else { //wrap on S
@@ -4903,7 +4943,7 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
4903 if (t > 0) { //bottom left/bottom right neighbor face 4943 if (t > 0) { //bottom left/bottom right neighbor face
4904 mEdge[cur_edge++] = (mNumS-1)*2*(t-1)+s*2; 4944 mEdge[cur_edge++] = (mNumS-1)*2*(t-1)+s*2;
4905 } 4945 }
4906 else if (mNumT <= 3 || mVolumep->getPath().isOpen() == TRUE) { //no neighbor 4946 else if (mNumT <= 3 || volume->getPath().isOpen() == TRUE) { //no neighbor
4907 mEdge[cur_edge++] = -1; 4947 mEdge[cur_edge++] = -1;
4908 } 4948 }
4909 else { //wrap on T 4949 else { //wrap on T
@@ -4912,7 +4952,7 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
4912 if (s < mNumS-2) { //bottom right/top right neighbor face 4952 if (s < mNumS-2) { //bottom right/top right neighbor face
4913 mEdge[cur_edge++] = (mNumS-1)*2*t+(s+1)*2; 4953 mEdge[cur_edge++] = (mNumS-1)*2*t+(s+1)*2;
4914 } 4954 }
4915 else if (flat_face || mVolumep->getProfile().isOpen() == TRUE) { //no neighbor 4955 else if (flat_face || volume->getProfile().isOpen() == TRUE) { //no neighbor
4916 mEdge[cur_edge++] = -1; 4956 mEdge[cur_edge++] = -1;
4917 } 4957 }
4918 else { //wrap on S 4958 else { //wrap on S
@@ -4957,11 +4997,11 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
4957 4997
4958 BOOL s_bottom_converges = ((mVertices[0].mPosition - mVertices[mNumS*(mNumT-2)].mPosition).magVecSquared() < 0.000001f); 4998 BOOL s_bottom_converges = ((mVertices[0].mPosition - mVertices[mNumS*(mNumT-2)].mPosition).magVecSquared() < 0.000001f);
4959 BOOL s_top_converges = ((mVertices[mNumS-1].mPosition - mVertices[mNumS*(mNumT-2)+mNumS-1].mPosition).magVecSquared() < 0.000001f); 4999 BOOL s_top_converges = ((mVertices[mNumS-1].mPosition - mVertices[mNumS*(mNumT-2)+mNumS-1].mPosition).magVecSquared() < 0.000001f);
4960 U8 sculpt_type = mVolumep->getParams().getSculptType(); 5000 U8 sculpt_type = volume->getParams().getSculptType();
4961 5001
4962 if (sculpt_type == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes 5002 if (sculpt_type == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes
4963 { 5003 {
4964 if (mVolumep->getPath().isOpen() == FALSE) 5004 if (volume->getPath().isOpen() == FALSE)
4965 { //wrap normals on T 5005 { //wrap normals on T
4966 for (S32 i = 0; i < mNumS; i++) 5006 for (S32 i = 0; i < mNumS; i++)
4967 { 5007 {
@@ -4971,7 +5011,7 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
4971 } 5011 }
4972 } 5012 }
4973 5013
4974 if ((mVolumep->getProfile().isOpen() == FALSE) && !(s_bottom_converges)) 5014 if ((volume->getProfile().isOpen() == FALSE) && !(s_bottom_converges))
4975 { //wrap normals on S 5015 { //wrap normals on S
4976 for (S32 i = 0; i < mNumT; i++) 5016 for (S32 i = 0; i < mNumT; i++)
4977 { 5017 {
@@ -4981,8 +5021,8 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
4981 } 5021 }
4982 } 5022 }
4983 5023
4984 if (mVolumep->getPathType() == LL_PCODE_PATH_CIRCLE && 5024 if (volume->getPathType() == LL_PCODE_PATH_CIRCLE &&
4985 ((mVolumep->getProfileType() & LL_PCODE_PROFILE_MASK) == LL_PCODE_PROFILE_CIRCLE_HALF)) 5025 ((volume->getProfileType() & LL_PCODE_PROFILE_MASK) == LL_PCODE_PROFILE_CIRCLE_HALF))
4986 { 5026 {
4987 if (s_bottom_converges) 5027 if (s_bottom_converges)
4988 { //all lower S have same normal 5028 { //all lower S have same normal
@@ -5081,69 +5121,6 @@ BOOL LLVolumeFace::createSide(BOOL partial_build)
5081 return TRUE; 5121 return TRUE;
5082} 5122}
5083 5123
5084// Static
5085BOOL LLVolumeFace::updateColors(LLColor4U *old_colors, const S32 num_old, const LLVolumeFace &old_vf,
5086 LLStrider<LLColor4U> &new_colors, const S32 num_new, const LLVolumeFace &new_vf)
5087{
5088 if (new_vf.mTypeMask & CAP_MASK)
5089 {
5090 // These aren't interpolated correctly. Need to fix when shadows go in...
5091 F32 ratio = (F32)num_old / (F32)num_new;
5092 S32 v = 0;
5093 for (v = 0; v < num_new; v++)
5094 {
5095 new_colors[v] = old_colors[(S32)(v*ratio)];
5096 }
5097 return FALSE;
5098 }
5099 else if (new_vf.mTypeMask & END_MASK)
5100 {
5101 // These aren't interpolated correctly. Need to fix when shadows go in...
5102 F32 ratio = (F32)num_old / (F32)num_new;
5103 S32 v = 0;
5104 for (v = 0; v < num_new; v++)
5105 {
5106 new_colors[v] = old_colors[(S32)(v*ratio)];
5107 }
5108 return FALSE;
5109 }
5110 else if (new_vf.mTypeMask & SIDE_MASK)
5111 {
5112 S32 s, t;
5113 F32 s_ratio = (F32)old_vf.mNumS / (F32)new_vf.mNumS;
5114 F32 t_ratio = (F32)old_vf.mNumT / (F32)new_vf.mNumT;
5115
5116 S32 v = 0;
5117 for (t = 0; t < new_vf.mNumT; t++)
5118 {
5119 F32 t_frac = t * t_ratio;
5120 S32 old_t = (S32)t_frac;
5121 S32 t_target = llmin(old_t + 1, (old_vf.mNumT - 1));
5122 t_frac -= old_t;
5123 for (s = 0; s < new_vf.mNumS; s++)
5124 {
5125 F32 s_frac = s * s_ratio;
5126 S32 old_s = (S32)s_frac;
5127 S32 s_target = llmin(old_s + 1, (old_vf.mNumS - 1));
5128 s_frac -= old_s;
5129
5130 // Interpolate along s, then along t.
5131 LLColor4U s_interp0 = old_colors[old_t * old_vf.mNumS + old_s].multAll(1.f - s_frac).addClampMax(old_colors[old_t * old_vf.mNumS + s_target].multAll(s_frac));
5132 LLColor4U s_interp1 = old_colors[t_target * old_vf.mNumS + old_s].multAll(1.f - s_frac).addClampMax(old_colors[t_target * old_vf.mNumS + s_target].multAll(s_frac));
5133 new_colors[v] = s_interp0.multAll(1.f - t_frac).addClampMax(s_interp1.multAll(t_frac));
5134 v++;
5135 }
5136 }
5137 }
5138 else
5139 {
5140 llerrs << "Unknown/uninitialized face type!" << llendl;
5141 return FALSE;
5142 }
5143 return TRUE;
5144}
5145
5146
5147// Finds binormal based on three vertices with texture coordinates. 5124// Finds binormal based on three vertices with texture coordinates.
5148// Fills in dummy values if the triangle has degenerate texture coordinates. 5125// Fills in dummy values if the triangle has degenerate texture coordinates.
5149LLVector3 calc_binormal_from_triangle( 5126LLVector3 calc_binormal_from_triangle(
diff --git a/linden/indra/llmath/llvolume.h b/linden/indra/llmath/llvolume.h
index 9dbea7a..c239685 100644
--- a/linden/indra/llmath/llvolume.h
+++ b/linden/indra/llmath/llvolume.h
@@ -643,9 +643,8 @@ protected:
643class LLProfile 643class LLProfile
644{ 644{
645public: 645public:
646 LLProfile(const LLProfileParams &params) 646 LLProfile()
647 : mParams(params), 647 : mOpen(FALSE),
648 mOpen(FALSE),
649 mConcave(FALSE), 648 mConcave(FALSE),
650 mDirty(TRUE), 649 mDirty(TRUE),
651 mTotalOut(0), 650 mTotalOut(0),
@@ -657,15 +656,12 @@ public:
657 656
658 S32 getTotal() const { return mTotal; } 657 S32 getTotal() const { return mTotal; }
659 S32 getTotalOut() const { return mTotalOut; } // Total number of outside points 658 S32 getTotalOut() const { return mTotalOut; } // Total number of outside points
660 BOOL isHollow() const { return (mParams.getHollow() > 0); }
661 BOOL isFlat(S32 face) const { return (mFaces[face].mCount == 2); } 659 BOOL isFlat(S32 face) const { return (mFaces[face].mCount == 2); }
662 BOOL isOpen() const { return mOpen; } 660 BOOL isOpen() const { return mOpen; }
663 void setDirty() { mDirty = TRUE; } 661 void setDirty() { mDirty = TRUE; }
664 BOOL generate(BOOL path_open, F32 detail = 1.0f, S32 split = 0, BOOL is_sculpted = FALSE); 662 BOOL generate(const LLProfileParams& params, BOOL path_open, F32 detail = 1.0f, S32 split = 0, BOOL is_sculpted = FALSE);
665 BOOL isConcave() const { return mConcave; } 663 BOOL isConcave() const { return mConcave; }
666public: 664public:
667 const LLProfileParams &mParams;
668
669 struct Face 665 struct Face
670 { 666 {
671 S32 mIndex; 667 S32 mIndex;
@@ -687,10 +683,10 @@ public:
687 friend std::ostream& operator<<(std::ostream &s, const LLProfile &profile); 683 friend std::ostream& operator<<(std::ostream &s, const LLProfile &profile);
688 684
689protected: 685protected:
690 void genNormals(); 686 void genNormals(const LLProfileParams& params);
691 void genNGon(S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0); 687 void genNGon(const LLProfileParams& params, S32 sides, F32 offset=0.0f, F32 bevel = 0.0f, F32 ang_scale = 1.f, S32 split = 0);
692 688
693 Face* addHole(BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split = 0); 689 Face* addHole(const LLProfileParams& params, BOOL flat, F32 sides, F32 offset, F32 box_hollow, F32 ang_scale, S32 split = 0);
694 Face* addCap (S16 faceID); 690 Face* addCap (S16 faceID);
695 Face* addFace(S32 index, S32 count, F32 scaleU, S16 faceID, BOOL flat); 691 Face* addFace(S32 index, S32 count, F32 scaleU, S16 faceID, BOOL flat);
696 692
@@ -720,9 +716,8 @@ public:
720 }; 716 };
721 717
722public: 718public:
723 LLPath(const LLPathParams &params) 719 LLPath()
724 : mParams(params), 720 : mOpen(FALSE),
725 mOpen(FALSE),
726 mTotal(0), 721 mTotal(0),
727 mDirty(TRUE), 722 mDirty(TRUE),
728 mStep(1) 723 mStep(1)
@@ -731,8 +726,8 @@ public:
731 726
732 virtual ~LLPath(); 727 virtual ~LLPath();
733 728
734 void genNGon(S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f); 729 void genNGon(const LLPathParams& params, S32 sides, F32 offset=0.0f, F32 end_scale = 1.f, F32 twist_scale = 1.f);
735 virtual BOOL generate(F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE); 730 virtual BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE);
736 731
737 BOOL isOpen() const { return mOpen; } 732 BOOL isOpen() const { return mOpen; }
738 F32 getStep() const { return mStep; } 733 F32 getStep() const { return mStep; }
@@ -745,7 +740,6 @@ public:
745 friend std::ostream& operator<<(std::ostream &s, const LLPath &path); 740 friend std::ostream& operator<<(std::ostream &s, const LLPath &path);
746 741
747public: 742public:
748 const LLPathParams &mParams;
749 std::vector<PathPt> mPath; 743 std::vector<PathPt> mPath;
750 744
751protected: 745protected:
@@ -758,8 +752,8 @@ protected:
758class LLDynamicPath : public LLPath 752class LLDynamicPath : public LLPath
759{ 753{
760public: 754public:
761 LLDynamicPath(const LLPathParams &params) : LLPath(params) { } 755 LLDynamicPath() : LLPath() { }
762 BOOL generate(F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE); 756 /*virtual*/ BOOL generate(const LLPathParams& params, F32 detail=1.0f, S32 split = 0, BOOL is_sculpted = FALSE);
763}; 757};
764 758
765// Yet another "face" class - caches volume-specific, but not instance-specific data for faces) 759// Yet another "face" class - caches volume-specific, but not instance-specific data for faces)
@@ -767,7 +761,7 @@ class LLVolumeFace
767{ 761{
768public: 762public:
769 LLVolumeFace(); 763 LLVolumeFace();
770 BOOL create(BOOL partial_build = FALSE); 764 BOOL create(LLVolume* volume, BOOL partial_build = FALSE);
771 void createBinormals(); 765 void createBinormals();
772 766
773 class VertexData 767 class VertexData
@@ -811,16 +805,11 @@ public:
811 std::vector<VertexData> mVertices; 805 std::vector<VertexData> mVertices;
812 std::vector<U16> mIndices; 806 std::vector<U16> mIndices;
813 std::vector<S32> mEdge; 807 std::vector<S32> mEdge;
814 LLVolume *mVolumep; // Deliberately NOT reference counted - djs 11/20/03 - otherwise would make an annoying circular reference
815 808
816 // Shouldn't need num_old and num_new, really - djs 809private:
817 static BOOL updateColors(LLColor4U *old_colors, const S32 num_old, const LLVolumeFace &old_face, 810 BOOL createUnCutCubeCap(LLVolume* volume, BOOL partial_build = FALSE);
818 LLStrider<LLColor4U> &new_colors, const S32 num_new, const LLVolumeFace &new_face); 811 BOOL createCap(LLVolume* volume, BOOL partial_build = FALSE);
819 812 BOOL createSide(LLVolume* volume, BOOL partial_build = FALSE);
820protected:
821 BOOL createUnCutCubeCap(BOOL partial_build = FALSE);
822 BOOL createCap(BOOL partial_build = FALSE);
823 BOOL createSide(BOOL partial_build = FALSE);
824}; 813};
825 814
826class LLVolume : public LLRefCount 815class LLVolume : public LLRefCount
@@ -848,12 +837,12 @@ public:
848 837
849 LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL generate_single_face = FALSE, const BOOL is_unique = FALSE); 838 LLVolume(const LLVolumeParams &params, const F32 detail, const BOOL generate_single_face = FALSE, const BOOL is_unique = FALSE);
850 839
851 U8 getProfileType() const { return mProfilep->mParams.getCurveType(); } 840 U8 getProfileType() const { return mParams.getProfileParams().getCurveType(); }
852 U8 getPathType() const { return mPathp->mParams.getCurveType(); } 841 U8 getPathType() const { return mParams.getPathParams().getCurveType(); }
853 S32 getNumFaces() const { return (S32)mProfilep->mFaces.size(); } 842 S32 getNumFaces() const { return (S32)mProfilep->mFaces.size(); }
854 S32 getNumVolumeFaces() const { return mNumVolumeFaces; } 843 S32 getNumVolumeFaces() const { return mVolumeFaces.size(); }
855 F32 getDetail() const { return mDetail; } 844 F32 getDetail() const { return mDetail; }
856 const LLVolumeParams & getParams() const { return mParams; } 845 const LLVolumeParams& getParams() const { return mParams; }
857 LLVolumeParams getCopyOfParams() const { return mParams; } 846 LLVolumeParams getCopyOfParams() const { return mParams; }
858 const LLProfile& getProfile() const { return *mProfilep; } 847 const LLProfile& getProfile() const { return *mProfilep; }
859 LLPath& getPath() const { return *mPathp; } 848 LLPath& getPath() const { return *mPathp; }
@@ -932,8 +921,8 @@ protected:
932 std::vector<Point> mMesh; 921 std::vector<Point> mMesh;
933 922
934 BOOL mGenerateSingleFace; 923 BOOL mGenerateSingleFace;
935 S32 mNumVolumeFaces; 924 typedef std::vector<LLVolumeFace> face_list_t;
936 LLVolumeFace *mVolumeFaces; 925 face_list_t mVolumeFaces;
937}; 926};
938 927
939std::ostream& operator<<(std::ostream &s, const LLVolumeParams &volume_params); 928std::ostream& operator<<(std::ostream &s, const LLVolumeParams &volume_params);
diff --git a/linden/indra/llmath/llvolumemgr.cpp b/linden/indra/llmath/llvolumemgr.cpp
index d9bca70..0b49bb3 100644
--- a/linden/indra/llmath/llvolumemgr.cpp
+++ b/linden/indra/llmath/llvolumemgr.cpp
@@ -31,13 +31,10 @@
31#include "linden_common.h" 31#include "linden_common.h"
32 32
33#include "llvolumemgr.h" 33#include "llvolumemgr.h"
34#include "llmemtype.h"
34#include "llvolume.h" 35#include "llvolume.h"
35 36
36 37
37//#define DEBUG_VOLUME
38
39//LLVolumeMgr* gVolumeMgr = 0;
40
41const F32 BASE_THRESHOLD = 0.03f; 38const F32 BASE_THRESHOLD = 0.03f;
42 39
43//static 40//static
@@ -70,11 +67,6 @@ LLVolumeMgr::~LLVolumeMgr()
70 67
71BOOL LLVolumeMgr::cleanup() 68BOOL LLVolumeMgr::cleanup()
72{ 69{
73 #ifdef DEBUG_VOLUME
74 {
75 lldebugs << "LLVolumeMgr::cleanup()" << llendl;
76 }
77 #endif
78 BOOL no_refs = TRUE; 70 BOOL no_refs = TRUE;
79 if (mDataMutex) 71 if (mDataMutex)
80 { 72 {
@@ -85,14 +77,14 @@ BOOL LLVolumeMgr::cleanup()
85 iter != end; iter++) 77 iter != end; iter++)
86 { 78 {
87 LLVolumeLODGroup *volgroupp = iter->second; 79 LLVolumeLODGroup *volgroupp = iter->second;
88 if (volgroupp->getNumRefs() != 1) 80 if (volgroupp->getNumRefs() != 0)
89 { 81 {
90 llwarns << "Volume group " << volgroupp << " has " 82 llwarns << "Volume group " << volgroupp << " has "
91 << volgroupp->getNumRefs() << " remaining refs" << llendl; 83 << volgroupp->getNumRefs() << " remaining refs" << llendl;
92 llwarns << volgroupp->getParams() << llendl; 84 llwarns << *volgroupp->getVolumeParams() << llendl;
93 no_refs = FALSE; 85 no_refs = FALSE;
94 } 86 }
95 volgroupp->unref();// this ); 87 delete volgroupp;
96 } 88 }
97 mVolumeLODGroups.clear(); 89 mVolumeLODGroups.clear();
98 if (mDataMutex) 90 if (mDataMutex)
@@ -102,10 +94,11 @@ BOOL LLVolumeMgr::cleanup()
102 return no_refs; 94 return no_refs;
103} 95}
104 96
105// whatever calls getVolume() never owns the LLVolume* and 97// Always only ever store the results of refVolume in a LLPointer
106// cannot keep references for long since it may be deleted 98// Note however that LLVolumeLODGroup that contains the volume
107// later. For best results hold it in an LLPointer<LLVolume>. 99// also holds a LLPointer so the volume will only go away after
108LLVolume *LLVolumeMgr::getVolume(const LLVolumeParams &volume_params, const S32 detail) 100// anything holding the volume and the LODGroup are destroyed
101LLVolume* LLVolumeMgr::refVolume(const LLVolumeParams &volume_params, const S32 detail)
109{ 102{
110 LLVolumeLODGroup* volgroupp; 103 LLVolumeLODGroup* volgroupp;
111 if (mDataMutex) 104 if (mDataMutex)
@@ -121,17 +114,11 @@ LLVolume *LLVolumeMgr::getVolume(const LLVolumeParams &volume_params, const S32
121 { 114 {
122 volgroupp = iter->second; 115 volgroupp = iter->second;
123 } 116 }
124 volgroupp->ref();
125 if (mDataMutex) 117 if (mDataMutex)
126 { 118 {
127 mDataMutex->unlock(); 119 mDataMutex->unlock();
128 } 120 }
129 #ifdef DEBUG_VOLUME 121 return volgroupp->getLODVolume(detail);
130 {
131 lldebugs << "LLVolumeMgr::getVolume() " << (*this) << llendl;
132 }
133 #endif
134 return volgroupp->getLOD(detail);
135} 122}
136 123
137// virtual 124// virtual
@@ -154,15 +141,14 @@ LLVolumeLODGroup* LLVolumeMgr::getGroup( const LLVolumeParams& volume_params ) c
154 return volgroupp; 141 return volgroupp;
155} 142}
156 143
157// virtual 144void LLVolumeMgr::unrefVolume(LLVolume *volumep)
158void LLVolumeMgr::cleanupVolume(LLVolume *volumep)
159{ 145{
160 if (volumep->isUnique()) 146 if (volumep->isUnique())
161 { 147 {
162 // TomY: Don't need to manage this volume. It is a unique instance. 148 // TomY: Don't need to manage this volume. It is a unique instance.
163 return; 149 return;
164 } 150 }
165 LLVolumeParams* params = (LLVolumeParams*) &(volumep->getParams()); 151 const LLVolumeParams* params = &(volumep->getParams());
166 if (mDataMutex) 152 if (mDataMutex)
167 { 153 {
168 mDataMutex->lock(); 154 mDataMutex->lock();
@@ -182,11 +168,10 @@ void LLVolumeMgr::cleanupVolume(LLVolume *volumep)
182 LLVolumeLODGroup* volgroupp = iter->second; 168 LLVolumeLODGroup* volgroupp = iter->second;
183 169
184 volgroupp->derefLOD(volumep); 170 volgroupp->derefLOD(volumep);
185 volgroupp->unref();// this ); 171 if (volgroupp->getNumRefs() == 0)
186 if (volgroupp->getNumRefs() == 1)
187 { 172 {
188 mVolumeLODGroups.erase(params); 173 mVolumeLODGroups.erase(params);
189 volgroupp->unref();// this ); 174 delete volgroupp;
190 } 175 }
191 } 176 }
192 if (mDataMutex) 177 if (mDataMutex)
@@ -194,40 +179,21 @@ void LLVolumeMgr::cleanupVolume(LLVolume *volumep)
194 mDataMutex->unlock(); 179 mDataMutex->unlock();
195 } 180 }
196 181
197 #ifdef DEBUG_VOLUME
198 {
199 lldebugs << "LLVolumeMgr::cleanupVolume() " << (*this) << llendl;
200 }
201 #endif
202} 182}
203 183
204#ifdef DEBUG_VOLUME 184// protected
205S32 LLVolumeMgr::getTotalRefCount() const 185void LLVolumeMgr::insertGroup(LLVolumeLODGroup* volgroup)
206{
207 S32 total_ref_count = 0;
208 for ( volume_lod_group_map_t::const_iterator iter = mVolumeLODGroups.begin(),
209 end = mVolumeLODGroups.end();
210 iter != end; iter++)
211 {
212 total_ref_count += iter->second->getTotalVolumeRefCount();
213 }
214 return total_ref_count;
215}
216
217S32 LLVolumeMgr::getGroupCount() const
218{ 186{
219 return mVolumeLODGroups.size(); 187 mVolumeLODGroups[volgroup->getVolumeParams()] = volgroup;
220} 188}
221#endif
222 189
223// protected 190// protected
224LLVolumeLODGroup* LLVolumeMgr::createNewGroup(const LLVolumeParams& volume_params) 191LLVolumeLODGroup* LLVolumeMgr::createNewGroup(const LLVolumeParams& volume_params)
225{ 192{
226 LLVolumeLODGroup* group = new LLVolumeLODGroup(volume_params); 193 LLMemType m1(LLMemType::MTYPE_VOLUME);
227 const LLVolumeParams* params = &(group->getParams()); 194 LLVolumeLODGroup* volgroup = new LLVolumeLODGroup(volume_params);
228 mVolumeLODGroups[params] = group; 195 insertGroup(volgroup);
229 group->ref(); // initial reference 196 return volgroup;
230 return group;
231} 197}
232 198
233// virtual 199// virtual
@@ -272,9 +238,8 @@ std::ostream& operator<<(std::ostream& s, const LLVolumeMgr& volume_mgr)
272 volume_mgr.mDataMutex->lock(); 238 volume_mgr.mDataMutex->lock();
273 } 239 }
274 240
275 LLVolumeMgr::volume_lod_group_map_iter iter = volume_mgr.mVolumeLODGroups.begin(); 241 for (LLVolumeMgr::volume_lod_group_map_t::const_iterator iter = volume_mgr.mVolumeLODGroups.begin();
276 LLVolumeMgr::volume_lod_group_map_iter end = volume_mgr.mVolumeLODGroups.end(); 242 iter != volume_mgr.mVolumeLODGroups.end(); ++iter)
277 for ( ; iter != end; ++iter)
278 { 243 {
279 LLVolumeLODGroup *volgroupp = iter->second; 244 LLVolumeLODGroup *volgroupp = iter->second;
280 total_refs += volgroupp->getNumRefs(); 245 total_refs += volgroupp->getNumRefs();
@@ -291,72 +256,55 @@ std::ostream& operator<<(std::ostream& s, const LLVolumeMgr& volume_mgr)
291} 256}
292 257
293LLVolumeLODGroup::LLVolumeLODGroup(const LLVolumeParams &params) 258LLVolumeLODGroup::LLVolumeLODGroup(const LLVolumeParams &params)
259 : mVolumeParams(params),
260 mRefs(0)
294{ 261{
295 S32 i; 262 for (S32 i = 0; i < NUM_LODS; i++)
296 mParams = params;
297
298 for (i = 0; i < NUM_LODS; i++)
299 { 263 {
300 mLODRefs[i] = 0; 264 mLODRefs[i] = 0;
301 // no need to initialize mVolumeLODs, they are smart pointers
302 //mVolumeLODs[i] = NULL;
303 mAccessCount[i] = 0; 265 mAccessCount[i] = 0;
304 } 266 }
305} 267}
306 268
307#ifdef DEBUG_VOLUME
308S32 LLVolumeLODGroup::getTotalVolumeRefCount() const
309{
310 S32 total_ref_count = 0;
311 for (S32 i = 0; i < NUM_LODS; i++)
312 {
313 total_ref_count += mLODRefs[i];
314 }
315 return total_ref_count;
316}
317#endif
318
319// protected
320LLVolumeLODGroup::~LLVolumeLODGroup() 269LLVolumeLODGroup::~LLVolumeLODGroup()
321{ 270{
322 destroy();
323}
324
325// protected
326void LLVolumeLODGroup::destroy()
327{
328 for (S32 i = 0; i < NUM_LODS; i++) 271 for (S32 i = 0; i < NUM_LODS; i++)
329 { 272 {
330 // remember that mVolumeLODs are smart pointers! 273 llassert_always(mLODRefs[i] == 0);
331 mVolumeLODs[i] = NULL;
332 } 274 }
333} 275}
334 276
335LLVolume * LLVolumeLODGroup::getLOD(const S32 detail) 277LLVolume* LLVolumeLODGroup::getLODVolume(const S32 detail)
336{ 278{
337 llassert(detail >=0 && detail < NUM_LODS); 279 llassert(detail >=0 && detail < NUM_LODS);
338 mAccessCount[detail]++; 280 mAccessCount[detail]++;
339 281
340 if (!mLODRefs[detail]) 282 mRefs++;
283 if (mVolumeLODs[detail].isNull())
341 { 284 {
342 mVolumeLODs[detail] = new LLVolume(mParams, mDetailScales[detail]); 285 LLMemType m1(LLMemType::MTYPE_VOLUME);
286 mVolumeLODs[detail] = new LLVolume(mVolumeParams, mDetailScales[detail]);
343 } 287 }
344 mLODRefs[detail]++; 288 mLODRefs[detail]++;
345 return mVolumeLODs[detail].get(); 289 return mVolumeLODs[detail];
346} 290}
347 291
348BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep) 292BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep)
349{ 293{
350 S32 i; 294 llassert_always(mRefs > 0);
351 for (i = 0; i < NUM_LODS; i++) 295 mRefs--;
296 for (S32 i = 0; i < NUM_LODS; i++)
352 { 297 {
353 if (mVolumeLODs[i] == volumep) 298 if (mVolumeLODs[i] == volumep)
354 { 299 {
300 llassert_always(mLODRefs[i] > 0);
355 mLODRefs[i]--; 301 mLODRefs[i]--;
302#if 1 // SJB: Possible opt: keep other lods around
356 if (!mLODRefs[i]) 303 if (!mLODRefs[i])
357 { 304 {
358 mVolumeLODs[i] = NULL; 305 mVolumeLODs[i] = NULL;
359 } 306 }
307#endif
360 return TRUE; 308 return TRUE;
361 } 309 }
362 } 310 }
@@ -428,7 +376,7 @@ F32 LLVolumeLODGroup::dump()
428std::ostream& operator<<(std::ostream& s, const LLVolumeLODGroup& volgroup) 376std::ostream& operator<<(std::ostream& s, const LLVolumeLODGroup& volgroup)
429{ 377{
430 s << "{ numRefs=" << volgroup.getNumRefs(); 378 s << "{ numRefs=" << volgroup.getNumRefs();
431 s << ", mParams=" << volgroup.mParams; 379 s << ", mParams=" << volgroup.getVolumeParams();
432 s << " }"; 380 s << " }";
433 381
434 return s; 382 return s;
diff --git a/linden/indra/llmath/llvolumemgr.h b/linden/indra/llmath/llvolumemgr.h
index 0a2249e..8f107f6 100644
--- a/linden/indra/llmath/llvolumemgr.h
+++ b/linden/indra/llmath/llvolumemgr.h
@@ -41,8 +41,10 @@
41class LLVolumeParams; 41class LLVolumeParams;
42class LLVolumeLODGroup; 42class LLVolumeLODGroup;
43 43
44class LLVolumeLODGroup : public LLThreadSafeRefCount 44class LLVolumeLODGroup
45{ 45{
46 LOG_CLASS(LLVolumeLODGroup);
47
46public: 48public:
47 enum 49 enum
48 { 50 {
@@ -50,29 +52,25 @@ public:
50 }; 52 };
51 53
52 LLVolumeLODGroup(const LLVolumeParams &params); 54 LLVolumeLODGroup(const LLVolumeParams &params);
55 ~LLVolumeLODGroup();
53 56
54 BOOL derefLOD(LLVolume *volumep);
55 static S32 getDetailFromTan(const F32 tan_angle); 57 static S32 getDetailFromTan(const F32 tan_angle);
56 static void getDetailProximity(const F32 tan_angle, F32 &to_lower, F32& to_higher); 58 static void getDetailProximity(const F32 tan_angle, F32 &to_lower, F32& to_higher);
57 static F32 getVolumeScaleFromDetail(const S32 detail); 59 static F32 getVolumeScaleFromDetail(const S32 detail);
58 60
59 LLVolume *getLOD(const S32 detail); 61 LLVolume* getLODVolume(const S32 detail);
60 const LLVolumeParams& getParams() const { return mParams; }; 62 BOOL derefLOD(LLVolume *volumep);
63 S32 getNumRefs() const { return mRefs; }
64
65 const LLVolumeParams* getVolumeParams() const { return &mVolumeParams; };
61 66
62 F32 dump(); 67 F32 dump();
63 friend std::ostream& operator<<(std::ostream& s, const LLVolumeLODGroup& volgroup); 68 friend std::ostream& operator<<(std::ostream& s, const LLVolumeLODGroup& volgroup);
64 69
65#ifdef DEBUG_VOLUME
66 S32 getTotalVolumeRefCount() const;
67#endif
68
69protected: 70protected:
70 virtual ~LLVolumeLODGroup(); 71 LLVolumeParams mVolumeParams;
71 void destroy();
72
73protected:
74 LLVolumeParams mParams;
75 72
73 S32 mRefs;
76 S32 mLODRefs[NUM_LODS]; 74 S32 mLODRefs[NUM_LODS];
77 LLPointer<LLVolume> mVolumeLODs[NUM_LODS]; 75 LLPointer<LLVolume> mVolumeLODs[NUM_LODS];
78 static F32 mDetailThresholds[NUM_LODS]; 76 static F32 mDetailThresholds[NUM_LODS];
@@ -82,10 +80,6 @@ protected:
82 80
83class LLVolumeMgr 81class LLVolumeMgr
84{ 82{
85//public:
86// static void initClass();
87// static BOOL cleanupClass();
88
89public: 83public:
90 LLVolumeMgr(); 84 LLVolumeMgr();
91 virtual ~LLVolumeMgr(); 85 virtual ~LLVolumeMgr();
@@ -96,36 +90,26 @@ public:
96 // whatever calls getVolume() never owns the LLVolume* and 90 // whatever calls getVolume() never owns the LLVolume* and
97 // cannot keep references for long since it may be deleted 91 // cannot keep references for long since it may be deleted
98 // later. For best results hold it in an LLPointer<LLVolume>. 92 // later. For best results hold it in an LLPointer<LLVolume>.
99 LLVolume *getVolume(const LLVolumeParams &volume_params, const S32 detail); 93 LLVolume *refVolume(const LLVolumeParams &volume_params, const S32 detail);
100 94 void unrefVolume(LLVolume *volumep);
101 void cleanupVolume(LLVolume *volumep);
102 95
103 void dump(); 96 void dump();
104 97
105 // manually call this for mutex magic 98 // manually call this for mutex magic
106 void useMutex(); 99 void useMutex();
107 100
108#ifdef DEBUG_VOLUME
109 S32 getTotalRefCount() const;
110 S32 getGroupCount() const;
111#endif
112 friend std::ostream& operator<<(std::ostream& s, const LLVolumeMgr& volume_mgr); 101 friend std::ostream& operator<<(std::ostream& s, const LLVolumeMgr& volume_mgr);
113 102
114protected: 103protected:
104 void insertGroup(LLVolumeLODGroup* volgroup);
105 // Overridden in llphysics/abstract/utils/llphysicsvolumemanager.h
115 virtual LLVolumeLODGroup* createNewGroup(const LLVolumeParams& volume_params); 106 virtual LLVolumeLODGroup* createNewGroup(const LLVolumeParams& volume_params);
116 107
117protected: 108protected:
118 typedef std::map<const LLVolumeParams*, LLVolumeLODGroup*, LLVolumeParams::compare> volume_lod_group_map_t; 109 typedef std::map<const LLVolumeParams*, LLVolumeLODGroup*, LLVolumeParams::compare> volume_lod_group_map_t;
119 typedef volume_lod_group_map_t::const_iterator volume_lod_group_map_iter;
120 volume_lod_group_map_t mVolumeLODGroups; 110 volume_lod_group_map_t mVolumeLODGroups;
121 111
122 LLMutex* mDataMutex; 112 LLMutex* mDataMutex;
123
124 // We need to be able to disable threadsafe checks to prevent
125 // some unit_tests from blocking on failure
126 bool mThreadSafe;
127}; 113};
128 114
129//extern LLVolumeMgr* gVolumeMgr;
130
131#endif // LL_LLVOLUMEMGR_H 115#endif // LL_LLVOLUMEMGR_H
diff --git a/linden/indra/llprimitive/llprimitive.cpp b/linden/indra/llprimitive/llprimitive.cpp
index a906926..3ddf92e 100644
--- a/linden/indra/llprimitive/llprimitive.cpp
+++ b/linden/indra/llprimitive/llprimitive.cpp
@@ -32,6 +32,7 @@
32#include "linden_common.h" 32#include "linden_common.h"
33 33
34#include "material_codes.h" 34#include "material_codes.h"
35#include "llmemtype.h"
35#include "llerror.h" 36#include "llerror.h"
36#include "message.h" 37#include "message.h"
37#include "llprimitive.h" 38#include "llprimitive.h"
@@ -178,7 +179,7 @@ LLPrimitive::~LLPrimitive()
178 // Cleanup handled by volume manager 179 // Cleanup handled by volume manager
179 if (mVolumep) 180 if (mVolumep)
180 { 181 {
181 sVolumeManager->cleanupVolume(mVolumep); 182 sVolumeManager->unrefVolume(mVolumep);
182 } 183 }
183 mVolumep = NULL; 184 mVolumep = NULL;
184} 185}
@@ -187,6 +188,7 @@ LLPrimitive::~LLPrimitive()
187// static 188// static
188LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code) 189LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code)
189{ 190{
191 LLMemType m1(LLMemType::MTYPE_PRIMITIVE);
190 LLPrimitive *retval = new LLPrimitive(); 192 LLPrimitive *retval = new LLPrimitive();
191 193
192 if (retval) 194 if (retval)
@@ -204,6 +206,7 @@ LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code)
204//=============================================================== 206//===============================================================
205void LLPrimitive::init_primitive(LLPCode p_code) 207void LLPrimitive::init_primitive(LLPCode p_code)
206{ 208{
209 LLMemType m1(LLMemType::MTYPE_PRIMITIVE);
207 if (mNumTEs) 210 if (mNumTEs)
208 { 211 {
209 if (mTextureList) 212 if (mTextureList)
@@ -246,6 +249,7 @@ void LLPrimitive::setNumTEs(const U8 num_tes)
246 // Right now, we don't try and preserve entries when the number of faces 249 // Right now, we don't try and preserve entries when the number of faces
247 // changes. 250 // changes.
248 251
252 LLMemType m1(LLMemType::MTYPE_PRIMITIVE);
249 if (num_tes) 253 if (num_tes)
250 { 254 {
251 LLTextureEntry *new_tes; 255 LLTextureEntry *new_tes;
@@ -914,6 +918,7 @@ S32 face_index_from_id(LLFaceID face_ID, const std::vector<LLProfile::Face>& fac
914 918
915BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume) 919BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume)
916{ 920{
921 LLMemType m1(LLMemType::MTYPE_VOLUME);
917 LLVolume *volumep; 922 LLVolume *volumep;
918 if (unique_volume) 923 if (unique_volume)
919 { 924 {
@@ -935,10 +940,10 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai
935 } 940 }
936 } 941 }
937 942
938 volumep = sVolumeManager->getVolume(volume_params, detail); 943 volumep = sVolumeManager->refVolume(volume_params, detail);
939 if (volumep == mVolumep) 944 if (volumep == mVolumep)
940 { 945 {
941 sVolumeManager->cleanupVolume( volumep ); // LLVolumeMgr::getVolume() creates a reference, but we don't need a second one. 946 sVolumeManager->unrefVolume( volumep ); // LLVolumeMgr::refVolume() creates a reference, but we don't need a second one.
942 return TRUE; 947 return TRUE;
943 } 948 }
944 } 949 }
@@ -981,7 +986,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai
981 986
982 987
983 // build the new object 988 // build the new object
984 sVolumeManager->cleanupVolume(mVolumep); 989 sVolumeManager->unrefVolume(mVolumep);
985 mVolumep = volumep; 990 mVolumep = volumep;
986 991
987 U32 new_face_mask = mVolumep->mFaceMask; 992 U32 new_face_mask = mVolumep->mFaceMask;
diff --git a/linden/indra/llrender/llglimmediate.cpp b/linden/indra/llrender/llglimmediate.cpp
index db62f3d..da9239d 100644
--- a/linden/indra/llrender/llglimmediate.cpp
+++ b/linden/indra/llrender/llglimmediate.cpp
@@ -43,8 +43,7 @@ LLGLImmediate gGL;
43#endif 43#endif
44 44
45bool LLGLImmediate::sClever = false; 45bool LLGLImmediate::sClever = false;
46 46BOOL LLGLImmediate::sStarted = FALSE;
47static BOOL sStarted = FALSE;
48 47
49LLGLImmediate::LLGLImmediate() 48LLGLImmediate::LLGLImmediate()
50{ 49{
@@ -62,9 +61,9 @@ void LLGLImmediate::start()
62 llerrs << "Redundant start." << llendl; 61 llerrs << "Redundant start." << llendl;
63 } 62 }
64 63
65 sStarted = TRUE;
66 LLVertexBuffer::unbind(); 64 LLVertexBuffer::unbind();
67 65 sStarted = TRUE;
66
68 glEnableClientState(GL_VERTEX_ARRAY); 67 glEnableClientState(GL_VERTEX_ARRAY);
69 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 68 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
70 glEnableClientState(GL_COLOR_ARRAY); 69 glEnableClientState(GL_COLOR_ARRAY);
diff --git a/linden/indra/llrender/llglimmediate.h b/linden/indra/llrender/llglimmediate.h
index bf2f9ab..cf4dc4f 100644
--- a/linden/indra/llrender/llglimmediate.h
+++ b/linden/indra/llrender/llglimmediate.h
@@ -91,9 +91,12 @@ public:
91 GLfloat uv[2]; 91 GLfloat uv[2];
92 }; 92 };
93 93
94public:
95 static BOOL sStarted;
96
94private: 97private:
95 static bool sClever; 98 static bool sClever;
96 99
97 U32 mCount; 100 U32 mCount;
98 U32 mMode; 101 U32 mMode;
99 Vertex mBuffer[4096]; 102 Vertex mBuffer[4096];
diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp
index 76c8252..c4b90a7 100644
--- a/linden/indra/llrender/llimagegl.cpp
+++ b/linden/indra/llrender/llimagegl.cpp
@@ -128,10 +128,16 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat)
128void LLImageGL::bindExternalTexture(LLGLuint gl_name, S32 stage, LLGLenum bind_target ) 128void LLImageGL::bindExternalTexture(LLGLuint gl_name, S32 stage, LLGLenum bind_target )
129{ 129{
130 gGL.flush(); 130 gGL.flush();
131 glActiveTextureARB(GL_TEXTURE0_ARB + stage); 131 if (stage > 0)
132 glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); 132 {
133 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
134 }
133 glBindTexture(bind_target, gl_name); 135 glBindTexture(bind_target, gl_name);
134 sCurrentBoundTextures[stage] = gl_name; 136 sCurrentBoundTextures[stage] = gl_name;
137 if (stage > 0)
138 {
139 glActiveTextureARB(GL_TEXTURE0_ARB);
140 }
135} 141}
136 142
137// static 143// static
@@ -141,9 +147,16 @@ void LLImageGL::unbindTexture(S32 stage, LLGLenum bind_target)
141 if (stage >= 0) 147 if (stage >= 0)
142 { 148 {
143 gGL.flush(); 149 gGL.flush();
144 glActiveTextureARB(GL_TEXTURE0_ARB + stage); 150 if (stage > 0)
145 glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); 151 {
146 glBindTexture(bind_target, 0); 152 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
153 glBindTexture(GL_TEXTURE_2D, 0);
154 glActiveTextureARB(GL_TEXTURE0_ARB);
155 }
156 else
157 {
158 glBindTexture(GL_TEXTURE_2D, 0);
159 }
147 sCurrentBoundTextures[stage] = 0; 160 sCurrentBoundTextures[stage] = 0;
148 } 161 }
149} 162}
@@ -151,15 +164,7 @@ void LLImageGL::unbindTexture(S32 stage, LLGLenum bind_target)
151// static (duplicated for speed and to avoid GL_TEXTURE_2D default argument which requires GL header dependency) 164// static (duplicated for speed and to avoid GL_TEXTURE_2D default argument which requires GL header dependency)
152void LLImageGL::unbindTexture(S32 stage) 165void LLImageGL::unbindTexture(S32 stage)
153{ 166{
154 // LLGLSLShader can return -1 167 unbindTexture(stage, GL_TEXTURE_2D);
155 if (stage >= 0)
156 {
157 gGL.flush();
158 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
159 glClientActiveTextureARB(GL_TEXTURE0_ARB + stage);
160 glBindTexture(GL_TEXTURE_2D, 0);
161 sCurrentBoundTextures[stage] = 0;
162 }
163} 168}
164 169
165// static 170// static
@@ -419,8 +424,6 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const
419 } 424 }
420 425
421 426
422 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
423
424 if (sCurrentBoundTextures[stage] && sCurrentBoundTextures[stage] == mTexName) 427 if (sCurrentBoundTextures[stage] && sCurrentBoundTextures[stage] == mTexName)
425 { 428 {
426 // already set! 429 // already set!
@@ -434,10 +437,20 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const
434#endif 437#endif
435 438
436 gGL.flush(); 439 gGL.flush();
440 if (stage > 0)
441 {
442 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
443 }
444
437 glBindTexture(mBindTarget, mTexName); 445 glBindTexture(mBindTarget, mTexName);
438 sCurrentBoundTextures[stage] = mTexName; 446 sCurrentBoundTextures[stage] = mTexName;
439 sBindCount++; 447 sBindCount++;
440 448
449 if (stage > 0)
450 {
451 glActiveTextureARB(GL_TEXTURE0_ARB);
452 }
453
441 if (mLastBindTime != sLastFrameTime) 454 if (mLastBindTime != sLastFrameTime)
442 { 455 {
443 // we haven't accounted for this texture yet this frame 456 // we haven't accounted for this texture yet this frame
@@ -451,7 +464,15 @@ BOOL LLImageGL::bindTextureInternal(const S32 stage) const
451 else 464 else
452 { 465 {
453 gGL.flush(); 466 gGL.flush();
467 if (stage > 0)
468 {
469 glActiveTextureARB(GL_TEXTURE0_ARB+stage);
470 }
454 glBindTexture(mBindTarget, 0); 471 glBindTexture(mBindTarget, 0);
472 if (stage > 0)
473 {
474 glActiveTextureARB(GL_TEXTURE0_ARB+stage);
475 }
455 sCurrentBoundTextures[stage] = 0; 476 sCurrentBoundTextures[stage] = 0;
456 return FALSE; 477 return FALSE;
457 } 478 }
@@ -985,6 +1006,21 @@ BOOL LLImageGL::setDiscardLevel(S32 discard_level)
985 } 1006 }
986} 1007}
987 1008
1009BOOL LLImageGL::isValidForSculpt(S32 discard_level, S32 image_width, S32 image_height, S32 ncomponents)
1010{
1011 assert_glerror();
1012 S32 gl_discard = discard_level - mCurrentDiscardLevel;
1013 LLGLint glwidth = 0;
1014 glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_WIDTH, (GLint*)&glwidth);
1015 LLGLint glheight = 0;
1016 glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_HEIGHT, (GLint*)&glheight);
1017 LLGLint glcomponents = 0 ;
1018 glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_INTERNAL_FORMAT, (GLint*)&glcomponents);
1019 assert_glerror();
1020
1021 return glwidth >= image_width && glheight >= image_height && (GL_RGB8 == glcomponents || GL_RGBA8 == glcomponents) ;
1022}
1023
988BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) 1024BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok)
989{ 1025{
990 if (discard_level < 0) 1026 if (discard_level < 0)
@@ -1033,12 +1069,22 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
1033 glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, (GLint*)&glbytes); 1069 glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, (GLint*)&glbytes);
1034 imageraw->allocateDataSize(width, height, ncomponents, glbytes); 1070 imageraw->allocateDataSize(width, height, ncomponents, glbytes);
1035 glGetCompressedTexImageARB(mTarget, gl_discard, (GLvoid*)(imageraw->getData())); 1071 glGetCompressedTexImageARB(mTarget, gl_discard, (GLvoid*)(imageraw->getData()));
1072 if(glGetError() != GL_NO_ERROR)
1073 {
1074 llwarns << "Error happens when reading back the compressed texture image." << llendl ;
1075 imageraw->deleteData() ;
1076 }
1036 stop_glerror(); 1077 stop_glerror();
1037 } 1078 }
1038 else 1079 else
1039 { 1080 {
1040 imageraw->allocateDataSize(width, height, ncomponents); 1081 imageraw->allocateDataSize(width, height, ncomponents);
1041 glGetTexImage(GL_TEXTURE_2D, gl_discard, mFormatPrimary, mFormatType, (GLvoid*)(imageraw->getData())); 1082 glGetTexImage(GL_TEXTURE_2D, gl_discard, mFormatPrimary, mFormatType, (GLvoid*)(imageraw->getData()));
1083 if(glGetError() != GL_NO_ERROR)
1084 {
1085 llwarns << "Error happens when reading back the texture image." << llendl ;
1086 imageraw->deleteData() ;
1087 }
1042 stop_glerror(); 1088 stop_glerror();
1043 } 1089 }
1044 1090
@@ -1057,7 +1103,6 @@ void LLImageGL::destroyGLTexture()
1057 { 1103 {
1058 unbindTexture(i, GL_TEXTURE_2D); 1104 unbindTexture(i, GL_TEXTURE_2D);
1059 stop_glerror(); 1105 stop_glerror();
1060 glActiveTextureARB(GL_TEXTURE0_ARB);
1061 } 1106 }
1062 } 1107 }
1063 1108
diff --git a/linden/indra/llrender/llimagegl.h b/linden/indra/llrender/llimagegl.h
index efe94c2..b386294 100644
--- a/linden/indra/llrender/llimagegl.h
+++ b/linden/indra/llrender/llimagegl.h
@@ -131,6 +131,8 @@ public:
131 BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; } 131 BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; }
132 BOOL getDontDiscard() const { return mDontDiscard; } 132 BOOL getDontDiscard() const { return mDontDiscard; }
133 133
134 BOOL isValidForSculpt(S32 discard_level, S32 image_width, S32 image_height, S32 ncomponents) ;
135
134protected: 136protected:
135 void init(BOOL usemipmaps); 137 void init(BOOL usemipmaps);
136 virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors 138 virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors
diff --git a/linden/indra/llrender/llrendertarget.h b/linden/indra/llrender/llrendertarget.h
index 918a604..d16d986 100644
--- a/linden/indra/llrender/llrendertarget.h
+++ b/linden/indra/llrender/llrendertarget.h
@@ -71,7 +71,7 @@ public:
71 //allocate resources for rendering 71 //allocate resources for rendering
72 //must be called before use 72 //must be called before use
73 //multiple calls will release previously allocated resources 73 //multiple calls will release previously allocated resources
74 void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, U32 usage = GL_TEXTURE_2D, BOOL use_fbo = TRUE); 74 void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, U32 usage = GL_TEXTURE_2D, BOOL use_fbo = FALSE);
75 75
76 //allocate a depth texture 76 //allocate a depth texture
77 void allocateDepth(); 77 void allocateDepth();
diff --git a/linden/indra/llrender/llvertexbuffer.cpp b/linden/indra/llrender/llvertexbuffer.cpp
index f3c6997..d165c01 100644
--- a/linden/indra/llrender/llvertexbuffer.cpp
+++ b/linden/indra/llrender/llvertexbuffer.cpp
@@ -38,6 +38,7 @@
38#include "llglheaders.h" 38#include "llglheaders.h"
39#include "llmemory.h" 39#include "llmemory.h"
40#include "llmemtype.h" 40#include "llmemtype.h"
41#include "llglimmediate.h"
41 42
42//============================================================================ 43//============================================================================
43 44
@@ -76,6 +77,141 @@ S32 LLVertexBuffer::sTypeOffsets[LLVertexBuffer::TYPE_MAX] =
76 sizeof(LLVector4), // TYPE_CLOTHWEIGHT, 77 sizeof(LLVector4), // TYPE_CLOTHWEIGHT,
77}; 78};
78 79
80U32 LLVertexBuffer::sGLMode[LLVertexBuffer::NUM_MODES] =
81{
82 GL_TRIANGLES,
83 GL_TRIANGLE_STRIP,
84 GL_TRIANGLE_FAN,
85 GL_POINTS,
86 GL_LINES,
87 GL_LINE_STRIP
88};
89
90//static
91void LLVertexBuffer::setupClientArrays(U32 data_mask)
92{
93 if (LLGLImmediate::sStarted)
94 {
95 llerrs << "Cannot use LLGLImmediate and LLVertexBuffer simultaneously!" << llendl;
96 }
97
98 if (sLastMask != data_mask)
99 {
100 U32 mask[] =
101 {
102 MAP_VERTEX,
103 MAP_NORMAL,
104 MAP_TEXCOORD,
105 MAP_COLOR
106 };
107
108 GLenum array[] =
109 {
110 GL_VERTEX_ARRAY,
111 GL_NORMAL_ARRAY,
112 GL_TEXTURE_COORD_ARRAY,
113 GL_COLOR_ARRAY
114 };
115
116 for (U32 i = 0; i < 4; ++i)
117 {
118 if (sLastMask & mask[i])
119 { //was enabled
120 if (!(data_mask & mask[i]) && i > 0)
121 { //needs to be disabled
122 glDisableClientState(array[i]);
123 }
124 else
125 { //needs to be enabled, make sure it was (DEBUG TEMPORARY)
126 if (i > 0 && !glIsEnabled(array[i]))
127 {
128 llerrs << "Bad client state! " << array[i] << " disabled." << llendl;
129 }
130 }
131 }
132 else
133 { //was disabled
134 if (data_mask & mask[i])
135 { //needs to be enabled
136 glEnableClientState(array[i]);
137 }
138 else if (glIsEnabled(array[i]))
139 { //needs to be disabled, make sure it was (DEBUG TEMPORARY)
140 llerrs << "Bad client state! " << array[i] << " enabled." << llendl;
141 }
142 }
143 }
144
145 if (sLastMask & MAP_TEXCOORD2)
146 {
147 if (!(data_mask & MAP_TEXCOORD2))
148 {
149 glClientActiveTextureARB(GL_TEXTURE1_ARB);
150 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
151 glClientActiveTextureARB(GL_TEXTURE0_ARB);
152 }
153 }
154 else if (data_mask & MAP_TEXCOORD2)
155 {
156 glClientActiveTextureARB(GL_TEXTURE1_ARB);
157 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
158 glClientActiveTextureARB(GL_TEXTURE0_ARB);
159 }
160
161 sLastMask = data_mask;
162 }
163}
164
165void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const
166{
167 if (start >= (U32) mRequestedNumVerts ||
168 end >= (U32) mRequestedNumVerts)
169 {
170 llerrs << "Bad vertex buffer draw range: [" << start << ", " << end << "]" << llendl;
171 }
172
173 if (indices_offset >= (U32) mRequestedNumIndices ||
174 indices_offset + count > (U32) mRequestedNumIndices)
175 {
176 llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl;
177 }
178
179 if (mGLIndices != sGLRenderIndices)
180 {
181 llerrs << "Wrong index buffer bound." << llendl;
182 }
183
184 if (mGLBuffer != sGLRenderBuffer)
185 {
186 llerrs << "Wrong vertex buffer bound." << llendl;
187 }
188
189 glDrawRangeElements(sGLMode[mode], start, end, count, GL_UNSIGNED_SHORT,
190 ((U16*) getIndicesPointer()) + indices_offset);
191}
192
193void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
194{
195 if (indices_offset >= (U32) mRequestedNumIndices ||
196 indices_offset + count > (U32) mRequestedNumIndices)
197 {
198 llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl;
199 }
200
201 if (mGLIndices != sGLRenderIndices)
202 {
203 llerrs << "Wrong index buffer bound." << llendl;
204 }
205
206 if (mGLBuffer != sGLRenderBuffer)
207 {
208 llerrs << "Wrong vertex buffer bound." << llendl;
209 }
210
211 glDrawElements(sGLMode[mode], count, GL_UNSIGNED_SHORT,
212 ((U16*) getIndicesPointer()) + indices_offset);
213}
214
79//static 215//static
80void LLVertexBuffer::initClass(bool use_vbo) 216void LLVertexBuffer::initClass(bool use_vbo)
81{ 217{
@@ -102,7 +238,8 @@ void LLVertexBuffer::unbind()
102 238
103 sGLRenderBuffer = 0; 239 sGLRenderBuffer = 0;
104 sGLRenderIndices = 0; 240 sGLRenderIndices = 0;
105 sLastMask = 0; 241
242 setupClientArrays(0);
106} 243}
107 244
108//static 245//static
@@ -118,22 +255,14 @@ void LLVertexBuffer::cleanupClass()
118void LLVertexBuffer::startRender() 255void LLVertexBuffer::startRender()
119{ 256{
120 LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); 257 LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
121 if (sEnableVBOs) 258
122 { 259 unbind();
123 glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
124 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
125 sVBOActive = FALSE;
126 sIBOActive = FALSE;
127 }
128
129 sRenderActive = TRUE; 260 sRenderActive = TRUE;
130 sGLRenderBuffer = 0;
131 sGLRenderIndices = 0;
132 sLastMask = 0;
133} 261}
134 262
135void LLVertexBuffer::stopRender() 263void LLVertexBuffer::stopRender()
136{ 264{
265 unbind();
137 sRenderActive = FALSE; 266 sRenderActive = FALSE;
138} 267}
139 268
@@ -615,6 +744,16 @@ U8* LLVertexBuffer::mapBuffer(S32 access)
615 llerrs << "Mapped two VBOs at the same time!" << llendl; 744 llerrs << "Mapped two VBOs at the same time!" << llendl;
616 } 745 }
617 sMapped = TRUE;*/ 746 sMapped = TRUE;*/
747 if (!mMappedData)
748 {
749 llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl;
750 }
751
752 if (!mMappedIndexData)
753 {
754 llerrs << "glMapBuffer returned NULL (no index data)" << llendl;
755 }
756
618 sMappedCount++; 757 sMappedCount++;
619 } 758 }
620 759
@@ -666,7 +805,12 @@ template <class T,S32 type> struct VertexBufferStrider
666 strider_t& strider, 805 strider_t& strider,
667 S32 index) 806 S32 index)
668 { 807 {
669 vbo.mapBuffer(); 808 if (vbo.mapBuffer() == NULL)
809 {
810 llwarns << "mapBuffer failed!" << llendl;
811 return FALSE;
812 }
813
670 if (type == LLVertexBuffer::TYPE_INDEX) 814 if (type == LLVertexBuffer::TYPE_INDEX)
671 { 815 {
672 S32 stride = sizeof(T); 816 S32 stride = sizeof(T);
@@ -828,6 +972,8 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
828 sIBOActive = FALSE; 972 sIBOActive = FALSE;
829 } 973 }
830 } 974 }
975
976 setupClientArrays(data_mask);
831 977
832 if (mGLIndices) 978 if (mGLIndices)
833 { 979 {
@@ -846,8 +992,6 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
846 sSetCount++; 992 sSetCount++;
847 } 993 }
848 } 994 }
849
850 sLastMask = data_mask;
851} 995}
852 996
853// virtual (default) 997// virtual (default)
@@ -871,10 +1015,10 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const
871 { 1015 {
872 glClientActiveTextureARB(GL_TEXTURE1_ARB); 1016 glClientActiveTextureARB(GL_TEXTURE1_ARB);
873 glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD2])); 1017 glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD2]));
1018 glClientActiveTextureARB(GL_TEXTURE0_ARB);
874 } 1019 }
875 if (data_mask & MAP_TEXCOORD) 1020 if (data_mask & MAP_TEXCOORD)
876 { 1021 {
877 glClientActiveTextureARB(GL_TEXTURE0_ARB);
878 glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD])); 1022 glTexCoordPointer(2,GL_FLOAT, stride, (void*)(base + mOffsets[TYPE_TEXCOORD]));
879 } 1023 }
880 if (data_mask & MAP_COLOR) 1024 if (data_mask & MAP_COLOR)
diff --git a/linden/indra/llrender/llvertexbuffer.h b/linden/indra/llrender/llvertexbuffer.h
index 3031b2d..453f3ac 100644
--- a/linden/indra/llrender/llvertexbuffer.h
+++ b/linden/indra/llrender/llvertexbuffer.h
@@ -84,6 +84,7 @@ public:
84 84
85 static void initClass(bool use_vbo); 85 static void initClass(bool use_vbo);
86 static void cleanupClass(); 86 static void cleanupClass();
87 static void setupClientArrays(U32 data_mask);
87 static void startRender(); //between start and stop render, no client copies will occur 88 static void startRender(); //between start and stop render, no client copies will occur
88 static void stopRender(); //any buffer not copied to GL will be rendered from client memory 89 static void stopRender(); //any buffer not copied to GL will be rendered from client memory
89 static void clientCopy(F64 max_time = 0.005); //copy data from client to GL 90 static void clientCopy(F64 max_time = 0.005); //copy data from client to GL
@@ -123,6 +124,15 @@ public:
123 MAP_UNMAPPED = 0x8000 // Indicates that buffer has been logically un-mapped 124 MAP_UNMAPPED = 0x8000 // Indicates that buffer has been logically un-mapped
124 }; 125 };
125 126
127 enum {
128 TRIANGLES = 0,
129 TRIANGLE_STRIP,
130 TRIANGLE_FAN,
131 POINTS,
132 LINES,
133 LINE_STRIP,
134 NUM_MODES
135 };
126protected: 136protected:
127 friend class LLGLImmediate; 137 friend class LLGLImmediate;
128 138
@@ -194,6 +204,9 @@ public:
194 204
195 void markDirty(U32 vert_index, U32 vert_count, U32 indices_index, U32 indices_count); 205 void markDirty(U32 vert_index, U32 vert_count, U32 indices_index, U32 indices_count);
196 206
207 void draw(U32 mode, U32 count, U32 indices_offset) const;
208 void drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const;
209
197protected: 210protected:
198 S32 mNumVerts; // Number of vertices allocated 211 S32 mNumVerts; // Number of vertices allocated
199 S32 mNumIndices; // Number of indices allocated 212 S32 mNumIndices; // Number of indices allocated
@@ -241,6 +254,7 @@ public:
241 254
242 static BOOL sEnableVBOs; 255 static BOOL sEnableVBOs;
243 static S32 sTypeOffsets[TYPE_MAX]; 256 static S32 sTypeOffsets[TYPE_MAX];
257 static U32 sGLMode[NUM_MODES];
244 static U32 sGLRenderBuffer; 258 static U32 sGLRenderBuffer;
245 static U32 sGLRenderIndices; 259 static U32 sGLRenderIndices;
246 static BOOL sVBOActive; 260 static BOOL sVBOActive;
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp
index 5142bf4..03914e2 100644
--- a/linden/indra/llui/llfloater.cpp
+++ b/linden/indra/llui/llfloater.cpp
@@ -923,6 +923,7 @@ void LLFloater::setFocus( BOOL b )
923 } 923 }
924} 924}
925 925
926// virtual
926void LLFloater::setIsChrome(BOOL is_chrome) 927void LLFloater::setIsChrome(BOOL is_chrome)
927{ 928{
928 // chrome floaters don't take focus at all 929 // chrome floaters don't take focus at all
@@ -941,6 +942,12 @@ void LLFloater::setIsChrome(BOOL is_chrome)
941 LLPanel::setIsChrome(is_chrome); 942 LLPanel::setIsChrome(is_chrome);
942} 943}
943 944
945void LLFloater::setTitleVisible(bool visible)
946{
947 if (mDragHandle)
948 mDragHandle->setTitleVisible(visible);
949}
950
944// Change the draw style to account for the foreground state. 951// Change the draw style to account for the foreground state.
945void LLFloater::setForeground(BOOL front) 952void LLFloater::setForeground(BOOL front)
946{ 953{
diff --git a/linden/indra/llui/llfloater.h b/linden/indra/llui/llfloater.h
index 8068741..7b4e003 100644
--- a/linden/indra/llui/llfloater.h
+++ b/linden/indra/llui/llfloater.h
@@ -146,6 +146,7 @@ public:
146 const LLString& getTitle() const; 146 const LLString& getTitle() const;
147 void setShortTitle( const LLString& short_title ); 147 void setShortTitle( const LLString& short_title );
148 LLString getShortTitle(); 148 LLString getShortTitle();
149 void setTitleVisible(bool visible);
149 virtual void setMinimized(BOOL b); 150 virtual void setMinimized(BOOL b);
150 void moveResizeHandlesToFront(); 151 void moveResizeHandlesToFront();
151 void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE); 152 void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE);
diff --git a/linden/indra/llui/llscrollbar.cpp b/linden/indra/llui/llscrollbar.cpp
index cdabda0..8940b80 100644
--- a/linden/indra/llui/llscrollbar.cpp
+++ b/linden/indra/llui/llscrollbar.cpp
@@ -501,6 +501,13 @@ void LLScrollbar::draw()
501 } 501 }
502 else 502 else
503 { 503 {
504 // Background
505 rounded_rect_imagep->drawSolid(mOrientation == HORIZONTAL ? SCROLLBAR_SIZE : 0,
506 mOrientation == VERTICAL ? SCROLLBAR_SIZE : 0,
507 mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * SCROLLBAR_SIZE : getRect().getWidth(),
508 mOrientation == VERTICAL ? getRect().getHeight() - 2 * SCROLLBAR_SIZE : getRect().getHeight(),
509 mTrackColor);
510
504 // Thumb 511 // Thumb
505 LLRect outline_rect = mThumbRect; 512 LLRect outline_rect = mThumbRect;
506 outline_rect.stretch(2); 513 outline_rect.stretch(2);
diff --git a/linden/indra/llui/llscrollcontainer.cpp b/linden/indra/llui/llscrollcontainer.cpp
index a6c1c6d..f0b0b81 100644
--- a/linden/indra/llui/llscrollcontainer.cpp
+++ b/linden/indra/llui/llscrollcontainer.cpp
@@ -430,7 +430,7 @@ void LLScrollableContainerView::draw()
430 if( mIsOpaque ) 430 if( mIsOpaque )
431 { 431 {
432 LLGLSNoTexture no_texture; 432 LLGLSNoTexture no_texture;
433 glColor4fv( mBackgroundColor.mV ); 433 gGL.color4fv( mBackgroundColor.mV );
434 gl_rect_2d( mInnerRect ); 434 gl_rect_2d( mInnerRect );
435 } 435 }
436 436
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp
index 2066819..32c4e82 100644
--- a/linden/indra/llui/llscrolllistctrl.cpp
+++ b/linden/indra/llui/llscrolllistctrl.cpp
@@ -1759,7 +1759,7 @@ void LLScrollListCtrl::draw()
1759 if (mBackgroundVisible) 1759 if (mBackgroundVisible)
1760 { 1760 {
1761 LLGLSNoTexture no_texture; 1761 LLGLSNoTexture no_texture;
1762 glColor4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV ); 1762 gGL.color4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV );
1763 gl_rect_2d(background); 1763 gl_rect_2d(background);
1764 } 1764 }
1765 1765
diff --git a/linden/indra/llwindow/llgl.cpp b/linden/indra/llwindow/llgl.cpp
index a059cd4..229fdf2 100644
--- a/linden/indra/llwindow/llgl.cpp
+++ b/linden/indra/llwindow/llgl.cpp
@@ -1152,7 +1152,7 @@ void LLGLState::checkTextureChannels()
1152 llwarns << "Texture matrix in channel " << i << " corrupt." << llendl; 1152 llwarns << "Texture matrix in channel " << i << " corrupt." << llendl;
1153 } 1153 }
1154 1154
1155 for (S32 j = (i == 0 ? 2 : 0); j < 8; j++) 1155 for (S32 j = (i == 0 ? 1 : 0); j < 8; j++)
1156 { 1156 {
1157 if (glIsEnabled(value[j])) 1157 if (glIsEnabled(value[j]))
1158 { 1158 {
@@ -1177,6 +1177,23 @@ void LLGLState::checkClientArrays(U32 data_mask)
1177#if LL_DEBUG_GL 1177#if LL_DEBUG_GL
1178 stop_glerror(); 1178 stop_glerror();
1179 BOOL error = FALSE; 1179 BOOL error = FALSE;
1180
1181 GLint active_texture;
1182 glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE_ARB, &active_texture);
1183
1184 if (active_texture != GL_TEXTURE0_ARB)
1185 {
1186 llwarns << "Client active texture corrupted: " << active_texture << llendl;
1187 error = TRUE;
1188 }
1189
1190 glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
1191 if (active_texture != GL_TEXTURE0_ARB)
1192 {
1193 llwarns << "Active texture corrupted: " << active_texture << llendl;
1194 error = TRUE;
1195 }
1196
1180 static const char* label[] = 1197 static const char* label[] =
1181 { 1198 {
1182 "GL_VERTEX_ARRAY", 1199 "GL_VERTEX_ARRAY",
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp
index b14df5e..9963493 100644
--- a/linden/indra/llwindow/llwindowwin32.cpp
+++ b/linden/indra/llwindow/llwindowwin32.cpp
@@ -1326,8 +1326,9 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
1326 close(); 1326 close();
1327 OSMessageBox( 1327 OSMessageBox(
1328 "Second Life is unable to run because your video card drivers\n" 1328 "Second Life is unable to run because your video card drivers\n"
1329 "are out of date or unsupported. Please make sure you have\n" 1329 "did not install properly, are out of date, or are for unsupported\n"
1330 "the latest video card drivers installed.\n\n" 1330 "hardware. Please make sure you have the latest video card drivers\n"
1331 "and even if you do have the latest, try reinstalling them.\n\n"
1331 "If you continue to receive this message, contact customer service.", 1332 "If you continue to receive this message, contact customer service.",
1332 "Error", 1333 "Error",
1333 OSMB_OK); 1334 OSMB_OK);
@@ -1836,6 +1837,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
1836 break; 1837 break;
1837 } 1838 }
1838 case WM_IME_SETCONTEXT: 1839 case WM_IME_SETCONTEXT:
1840 if (gDebugWindowProc)
1841 {
1842 llinfos << "WM_IME_SETCONTEXT" << llendl;
1843 }
1839 if (LLWinImm::isAvailable() && window_imp->mPreeditor) 1844 if (LLWinImm::isAvailable() && window_imp->mPreeditor)
1840 { 1845 {
1841 l_param &= ~ISC_SHOWUICOMPOSITIONWINDOW; 1846 l_param &= ~ISC_SHOWUICOMPOSITIONWINDOW;
@@ -1844,6 +1849,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
1844 break; 1849 break;
1845 1850
1846 case WM_IME_STARTCOMPOSITION: 1851 case WM_IME_STARTCOMPOSITION:
1852 if (gDebugWindowProc)
1853 {
1854 llinfos << "WM_IME_STARTCOMPOSITION" << llendl;
1855 }
1847 if (LLWinImm::isAvailable() && window_imp->mPreeditor) 1856 if (LLWinImm::isAvailable() && window_imp->mPreeditor)
1848 { 1857 {
1849 window_imp->handleStartCompositionMessage(); 1858 window_imp->handleStartCompositionMessage();
@@ -1852,6 +1861,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
1852 break; 1861 break;
1853 1862
1854 case WM_IME_ENDCOMPOSITION: 1863 case WM_IME_ENDCOMPOSITION:
1864 if (gDebugWindowProc)
1865 {
1866 llinfos << "WM_IME_ENDCOMPOSITION" << llendl;
1867 }
1855 if (LLWinImm::isAvailable() && window_imp->mPreeditor) 1868 if (LLWinImm::isAvailable() && window_imp->mPreeditor)
1856 { 1869 {
1857 return 0; 1870 return 0;
@@ -1859,6 +1872,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
1859 break; 1872 break;
1860 1873
1861 case WM_IME_COMPOSITION: 1874 case WM_IME_COMPOSITION:
1875 if (gDebugWindowProc)
1876 {
1877 llinfos << "WM_IME_COMPOSITION" << llendl;
1878 }
1862 if (LLWinImm::isAvailable() && window_imp->mPreeditor) 1879 if (LLWinImm::isAvailable() && window_imp->mPreeditor)
1863 { 1880 {
1864 window_imp->handleCompositionMessage(l_param); 1881 window_imp->handleCompositionMessage(l_param);
@@ -1867,6 +1884,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
1867 break; 1884 break;
1868 1885
1869 case WM_IME_REQUEST: 1886 case WM_IME_REQUEST:
1887 if (gDebugWindowProc)
1888 {
1889 llinfos << "WM_IME_REQUEST" << llendl;
1890 }
1870 if (LLWinImm::isAvailable() && window_imp->mPreeditor) 1891 if (LLWinImm::isAvailable() && window_imp->mPreeditor)
1871 { 1892 {
1872 LRESULT result = 0; 1893 LRESULT result = 0;
diff --git a/linden/indra/newview/app_settings/colors_base.xml b/linden/indra/newview/app_settings/colors_base.xml
index d793116..42b119c 100644
--- a/linden/indra/newview/app_settings/colors_base.xml
+++ b/linden/indra/newview/app_settings/colors_base.xml
@@ -48,7 +48,7 @@
48 48
49<!-- TEXTFIELDS --> 49<!-- TEXTFIELDS -->
50<TextBgFocusColor value="255, 255, 255, 255" /> <!-- Text field background when receiving input (focused) --> 50<TextBgFocusColor value="255, 255, 255, 255" /> <!-- Text field background when receiving input (focused) -->
51<TextBgReadOnlyColor value="210, 220, 230, 255" /> <!-- Text field background when read-only --> 51<TextBgReadOnlyColor value="255, 255, 255, 140" /> <!-- Text field background when read-only -->
52<TextBgWriteableColor value="255, 255, 255, 255" /> <!-- Text field background when not receiving input (unfocused) --> 52<TextBgWriteableColor value="255, 255, 255, 255" /> <!-- Text field background when not receiving input (unfocused) -->
53<TextCursorColor value="0, 0, 0, 255" /> 53<TextCursorColor value="0, 0, 0, 255" />
54<TextFgColor value="45, 48, 45, 255" /> 54<TextFgColor value="45, 48, 45, 255" />
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 63d429f..7be1db3 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -9759,17 +9759,6 @@
9759 <integer>0</integer> 9759 <integer>0</integer>
9760 </array> 9760 </array>
9761 </map> 9761 </map>
9762 <key>AlertedUnsupportedHardware</key>
9763 <map>
9764 <key>Comment</key>
9765 <string>Toggle that lets us tell the user he's on old hardware only once</string>
9766 <key>Persist</key>
9767 <integer>1</integer>
9768 <key>Type</key>
9769 <string>Boolean</string>
9770 <key>Value</key>
9771 <integer>0</integer>
9772 </map>
9773 <key>RenderFastAlpha</key> 9762 <key>RenderFastAlpha</key>
9774 <map> 9763 <map>
9775 <key>Comment</key> 9764 <key>Comment</key>
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp
index 7c71e46..4a9a158 100644
--- a/linden/indra/newview/llappviewer.cpp
+++ b/linden/indra/newview/llappviewer.cpp
@@ -64,6 +64,7 @@
64#include "llurldispatcher.h" 64#include "llurldispatcher.h"
65#include "llurlhistory.h" 65#include "llurlhistory.h"
66#include "llfirstuse.h" 66#include "llfirstuse.h"
67#include "llglimmediate.h"
67 68
68#include "llweb.h" 69#include "llweb.h"
69#include "llsecondlifeurls.h" 70#include "llsecondlifeurls.h"
@@ -409,10 +410,11 @@ static void settings_to_globals()
409static void settings_modify() 410static void settings_modify()
410{ 411{
411 LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); 412 LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO");
412 LLVOAvatar::sUseImpostors = FALSE; //gSavedSettings.getBOOL("RenderUseImpostors"); 413 LLVOAvatar::sUseImpostors = gSavedSettings.getBOOL("RenderUseImpostors");
413 LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); 414 LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor");
414 LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //sqaure lod factor to get exponential range of [1,4] 415 LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //sqaure lod factor to get exponential range of [1,4]
415 416 gGL.setClever(gSavedSettings.getBOOL("RenderUseCleverUI"));
417
416#if LL_VECTORIZE 418#if LL_VECTORIZE
417 if (gSysCPU.hasAltivec()) 419 if (gSysCPU.hasAltivec())
418 { 420 {
@@ -767,15 +769,6 @@ bool LLAppViewer::init()
767 return 1; 769 return 1;
768 } 770 }
769 771
770#if LL_DARWIN
771 // Display the release notes for the current version
772 if(!gHideLinks && gCurrentVersion != gLastRunVersion)
773 {
774 // Current version and last run version don't match exactly. Display the release notes.
775 DisplayReleaseNotes();
776 }
777#endif
778
779 // 772 //
780 // Initialize the window 773 // Initialize the window
781 // 774 //
@@ -814,51 +807,55 @@ bool LLAppViewer::init()
814 return 0; 807 return 0;
815 } 808 }
816 809
817 // alert the user if they are using unsupported hardware 810
818 if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware")) 811 bool unsupported = false;
819 { 812 LLString::format_map_t args;
820 bool unsupported = false; 813 LLString minSpecs;
821 LLString::format_map_t args;
822 LLString minSpecs;
823 814
824 // get cpu data from xml 815 // get cpu data from xml
825 std::stringstream minCPUString(LLAlertDialog::getTemplateMessage("UnsupportedCPUAmount")); 816 std::stringstream minCPUString(LLAlertDialog::getTemplateMessage("UnsupportedCPUAmount"));
826 S32 minCPU = 0; 817 S32 minCPU = 0;
827 minCPUString >> minCPU; 818 minCPUString >> minCPU;
828 819
829 // get RAM data from XML 820 // get RAM data from XML
830 std::stringstream minRAMString(LLAlertDialog::getTemplateMessage("UnsupportedRAMAmount")); 821 std::stringstream minRAMString(LLAlertDialog::getTemplateMessage("UnsupportedRAMAmount"));
831 U64 minRAM = 0; 822 U64 minRAM = 0;
832 minRAMString >> minRAM; 823 minRAMString >> minRAM;
833 minRAM = minRAM * 1024 * 1024; 824 minRAM = minRAM * 1024 * 1024;
834 825
835 if(!LLFeatureManager::getInstance()->isGPUSupported()) 826 if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN)
836 { 827 {
837 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedGPU"); 828 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedGPU");
838 minSpecs += "\n"; 829 minSpecs += "\n";
839 unsupported = true; 830 unsupported = true;
840 } 831 }
841 if(gSysCPU.getMhz() < minCPU) 832 if(gSysCPU.getMhz() < minCPU)
842 { 833 {
843 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedCPU"); 834 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedCPU");
844 minSpecs += "\n"; 835 minSpecs += "\n";
845 unsupported = true; 836 unsupported = true;
846 } 837 }
847 if(gSysMemory.getPhysicalMemoryClamped() < minRAM) 838 if(gSysMemory.getPhysicalMemoryClamped() < minRAM)
848 { 839 {
849 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedRAM"); 840 minSpecs += LLAlertDialog::getTemplateMessage("UnsupportedRAM");
850 minSpecs += "\n"; 841 minSpecs += "\n";
851 unsupported = true; 842 unsupported = true;
852 } 843 }
853 844
854 if(unsupported) 845 if (LLFeatureManager::getInstance()->getGPUClass() == GPU_CLASS_UNKNOWN)
846 {
847 gViewerWindow->alertXml("UnknownGPU");
848 }
849
850 if(unsupported)
851 {
852 if(!gSavedSettings.controlExists("WarnUnsupportedHardware")
853 || gSavedSettings.getBOOL("WarnUnsupportedHardware"))
855 { 854 {
856 args["MINSPECS"] = minSpecs; 855 args["MINSPECS"] = minSpecs;
857 gViewerWindow->alertXml("UnsupportedHardware", args ); 856 gViewerWindow->alertXml("UnsupportedHardware", args );
858
859 // turn off flag
860 gSavedSettings.setBOOL("AlertedUnsupportedHardware", TRUE);
861 } 857 }
858
862 } 859 }
863 860
864 // Save the current version to the prefs file 861 // Save the current version to the prefs file
@@ -1445,10 +1442,13 @@ void LLAppViewer::loadSettingsFromDirectory(ELLPath path_index)
1445 1442
1446 LLString full_settings_path = gDirUtilp->getExpandedFilename(path_index, settings_file); 1443 LLString full_settings_path = gDirUtilp->getExpandedFilename(path_index, settings_file);
1447 1444
1448 if(settings_name == sGlobalSettingsName) 1445 if(settings_name == sGlobalSettingsName
1446 && path_index == LL_PATH_USER_SETTINGS)
1449 { 1447 {
1450 // The non-persistent setting, ClientSettingsFile, specifies a 1448 // The non-persistent setting, ClientSettingsFile, specifies a
1451 // custom name to use for the global settings file. 1449 // custom name to use for the global settings file.
1450 // Only apply this setting if this method is setting the 'Global'
1451 // settings from the user_settings path.
1452 std::string custom_path; 1452 std::string custom_path;
1453 if(gSettings[sGlobalSettingsName]->controlExists("ClientSettingsFile")) 1453 if(gSettings[sGlobalSettingsName]->controlExists("ClientSettingsFile"))
1454 { 1454 {
diff --git a/linden/indra/newview/llcubemap.cpp b/linden/indra/newview/llcubemap.cpp
index e11f058..31937ba 100644
--- a/linden/indra/newview/llcubemap.cpp
+++ b/linden/indra/newview/llcubemap.cpp
@@ -185,12 +185,19 @@ void LLCubeMap::bind()
185 ) 185 )
186 { 186 {
187 // We assume that if they have cube mapping, they have multitexturing. 187 // We assume that if they have cube mapping, they have multitexturing.
188 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage); 188 if (mTextureStage > 0)
189 {
190 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage);
191 }
189 glEnable(GL_TEXTURE_CUBE_MAP_ARB); 192 glEnable(GL_TEXTURE_CUBE_MAP_ARB);
190 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mImages[0]->getTexName()); 193 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mImages[0]->getTexName());
191 194
192 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 195 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
193 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, (use_cube_mipmaps? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR)); 196 glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, (use_cube_mipmaps? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR));
197 if (mTextureStage > 0)
198 {
199 glActiveTextureARB(GL_TEXTURE0_ARB);
200 }
194 } 201 }
195 else 202 else
196 { 203 {
@@ -212,9 +219,17 @@ void LLCubeMap::enableTexture(S32 stage)
212 //&& LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap") 219 //&& LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap")
213 ) 220 )
214 { 221 {
215 glActiveTextureARB(GL_TEXTURE0_ARB + stage); // NOTE: leaves texture stage set 222 if (stage > 0)
223 {
224 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
225 }
216 226
217 glEnable(GL_TEXTURE_CUBE_MAP_ARB); 227 glEnable(GL_TEXTURE_CUBE_MAP_ARB);
228
229 if (stage > 0)
230 {
231 glActiveTextureARB(GL_TEXTURE0_ARB);
232 }
218 } 233 }
219} 234}
220 235
@@ -223,7 +238,10 @@ void LLCubeMap::enableTextureCoords(S32 stage)
223 mTextureCoordStage = stage; 238 mTextureCoordStage = stage;
224 if (gGLManager.mHasCubeMap && stage >= 0) 239 if (gGLManager.mHasCubeMap && stage >= 0)
225 { 240 {
226 glActiveTextureARB(GL_TEXTURE0_ARB + stage); // NOTE: leaves texture stage set 241 if (stage > 0)
242 {
243 glActiveTextureARB(GL_TEXTURE0_ARB + stage);
244 }
227 245
228 glEnable(GL_TEXTURE_GEN_R); 246 glEnable(GL_TEXTURE_GEN_R);
229 glEnable(GL_TEXTURE_GEN_S); 247 glEnable(GL_TEXTURE_GEN_S);
@@ -233,7 +251,10 @@ void LLCubeMap::enableTextureCoords(S32 stage)
233 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); 251 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
234 glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); 252 glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
235 253
236 glActiveTextureARB(GL_TEXTURE0_ARB); 254 if (stage > 0)
255 {
256 glActiveTextureARB(GL_TEXTURE0_ARB);
257 }
237 } 258 }
238} 259}
239 260
@@ -249,9 +270,16 @@ void LLCubeMap::disableTexture(void)
249 //&& LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap") 270 //&& LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap")
250 ) 271 )
251 { 272 {
252 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage); 273 if (mTextureStage > 0)
274 {
275 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureStage);
276 }
253 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0); 277 glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);
254 glDisable(GL_TEXTURE_CUBE_MAP_ARB); 278 glDisable(GL_TEXTURE_CUBE_MAP_ARB);
279 if (mTextureStage > 0)
280 {
281 glActiveTextureARB(GL_TEXTURE0_ARB);
282 }
255 } 283 }
256} 284}
257 285
@@ -259,17 +287,28 @@ void LLCubeMap::disableTextureCoords(void)
259{ 287{
260 if (gGLManager.mHasCubeMap && mTextureCoordStage >= 0) 288 if (gGLManager.mHasCubeMap && mTextureCoordStage >= 0)
261 { 289 {
262 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureCoordStage); 290 if (mTextureCoordStage > 0)
291 {
292 glActiveTextureARB(GL_TEXTURE0_ARB + mTextureCoordStage);
293 }
263 glDisable(GL_TEXTURE_GEN_S); 294 glDisable(GL_TEXTURE_GEN_S);
264 glDisable(GL_TEXTURE_GEN_T); 295 glDisable(GL_TEXTURE_GEN_T);
265 glDisable(GL_TEXTURE_GEN_R); 296 glDisable(GL_TEXTURE_GEN_R);
297 if (mTextureCoordStage > 0)
298 {
299 glActiveTextureARB(GL_TEXTURE0_ARB);
300 }
266 } 301 }
267} 302}
268 303
269void LLCubeMap::setMatrix(S32 stage) 304void LLCubeMap::setMatrix(S32 stage)
270{ 305{
271 mMatrixStage = stage; 306 mMatrixStage = stage;
272 glActiveTextureARB(GL_TEXTURE0_ARB+stage); 307
308 if (stage > 0)
309 {
310 glActiveTextureARB(GL_TEXTURE0_ARB+stage);
311 }
273 312
274 LLVector3 x(LLVector3d(gGLModelView+0)); 313 LLVector3 x(LLVector3d(gGLModelView+0));
275 LLVector3 y(LLVector3d(gGLModelView+4)); 314 LLVector3 y(LLVector3d(gGLModelView+4));
@@ -284,16 +323,27 @@ void LLCubeMap::setMatrix(S32 stage)
284 glPushMatrix(); 323 glPushMatrix();
285 glLoadMatrixf((F32 *)trans.mMatrix); 324 glLoadMatrixf((F32 *)trans.mMatrix);
286 glMatrixMode(GL_MODELVIEW); 325 glMatrixMode(GL_MODELVIEW);
287 glActiveTextureARB(GL_TEXTURE0_ARB); 326
327 if (stage > 0)
328 {
329 glActiveTextureARB(GL_TEXTURE0_ARB);
330 }
288} 331}
289 332
290void LLCubeMap::restoreMatrix() 333void LLCubeMap::restoreMatrix()
291{ 334{
292 glActiveTextureARB(GL_TEXTURE0_ARB+mMatrixStage); 335 if (mMatrixStage > 0)
336 {
337 glActiveTextureARB(GL_TEXTURE0_ARB+mMatrixStage);
338 }
293 glMatrixMode(GL_TEXTURE); 339 glMatrixMode(GL_TEXTURE);
294 glPopMatrix(); 340 glPopMatrix();
295 glMatrixMode(GL_MODELVIEW); 341 glMatrixMode(GL_MODELVIEW);
296 glActiveTextureARB(GL_TEXTURE0_ARB); 342
343 if (mMatrixStage > 0)
344 {
345 glActiveTextureARB(GL_TEXTURE0_ARB);
346 }
297} 347}
298 348
299LLVector3 LLCubeMap::map(U8 side, U16 v_val, U16 h_val) const 349LLVector3 LLCubeMap::map(U8 side, U16 v_val, U16 h_val) const
diff --git a/linden/indra/newview/llcylinder.cpp b/linden/indra/newview/llcylinder.cpp
index 9b146a3..c05a380 100644
--- a/linden/indra/newview/llcylinder.cpp
+++ b/linden/indra/newview/llcylinder.cpp
@@ -255,7 +255,6 @@ void LLCone::render(S32 level_of_detail)
255 // center object at 0 255 // center object at 0
256 glTranslatef(0.f, 0.f, - height / 2.0f); 256 glTranslatef(0.f, 0.f, - height / 2.0f);
257 257
258 LLVertexBuffer::unbind();
259 drawSide(level_of_detail); 258 drawSide(level_of_detail);
260 drawBottom(level_of_detail); 259 drawBottom(level_of_detail);
261 260
diff --git a/linden/indra/newview/lldrawable.cpp b/linden/indra/newview/lldrawable.cpp
index 3a2841d..d2b2a99 100644
--- a/linden/indra/newview/lldrawable.cpp
+++ b/linden/indra/newview/lldrawable.cpp
@@ -1188,10 +1188,11 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>*
1188 LLVector3 center = (mExtents[0] + mExtents[1]) * 0.5f; 1188 LLVector3 center = (mExtents[0] + mExtents[1]) * 0.5f;
1189 LLVector3 size = (mExtents[1]-mExtents[0]) * 0.5f; 1189 LLVector3 size = (mExtents[1]-mExtents[0]) * 0.5f;
1190 1190
1191 if (camera_in.AABBInFrustumNoFarClip(center, size) && 1191 if (LLPipeline::sImpostorRender ||
1192 AABBSphereIntersect(mExtents[0], mExtents[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist)) 1192 (camera_in.AABBInFrustumNoFarClip(center, size) &&
1193 AABBSphereIntersect(mExtents[0], mExtents[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist)))
1193 { 1194 {
1194 if (LLPipeline::calcPixelArea(center, size, camera_in) < FORCE_INVISIBLE_AREA) 1195 if (!LLPipeline::sImpostorRender && LLPipeline::calcPixelArea(center, size, camera_in) < FORCE_INVISIBLE_AREA)
1195 { 1196 {
1196 return; 1197 return;
1197 } 1198 }
diff --git a/linden/indra/newview/lldrawpool.cpp b/linden/indra/newview/lldrawpool.cpp
index 409439a..c579c68 100644
--- a/linden/indra/newview/lldrawpool.cpp
+++ b/linden/indra/newview/lldrawpool.cpp
@@ -115,7 +115,6 @@ LLDrawPool::LLDrawPool(const U32 type)
115 sNumDrawPools++; 115 sNumDrawPools++;
116 mId = sNumDrawPools; 116 mId = sNumDrawPools;
117 mVertexShaderLevel = 0; 117 mVertexShaderLevel = 0;
118 mIndicesDrawn = 0;
119} 118}
120 119
121LLDrawPool::~LLDrawPool() 120LLDrawPool::~LLDrawPool()
@@ -136,24 +135,6 @@ void LLDrawPool::beginRenderPass( S32 pass )
136//virtual 135//virtual
137void LLDrawPool::endRenderPass( S32 pass ) 136void LLDrawPool::endRenderPass( S32 pass )
138{ 137{
139 glDisableClientState ( GL_TEXTURE_COORD_ARRAY );
140 glDisableClientState ( GL_COLOR_ARRAY );
141 glDisableClientState ( GL_NORMAL_ARRAY );
142}
143
144U32 LLDrawPool::getTrianglesDrawn() const
145{
146 return mIndicesDrawn / 3;
147}
148
149void LLDrawPool::resetTrianglesDrawn()
150{
151 mIndicesDrawn = 0;
152}
153
154void LLDrawPool::addIndicesDrawn(const U32 indices)
155{
156 mIndicesDrawn += indices;
157} 138}
158 139
159//============================= 140//=============================
@@ -224,7 +205,7 @@ void LLFacePool::drawLoop()
224{ 205{
225 if (!mDrawFace.empty()) 206 if (!mDrawFace.empty())
226 { 207 {
227 mIndicesDrawn += drawLoop(mDrawFace); 208 drawLoop(mDrawFace);
228 } 209 }
229} 210}
230 211
@@ -382,10 +363,6 @@ void LLRenderPass::renderTexture(U32 type, U32 mask)
382 363
383void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture) 364void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture)
384{ 365{
385#if !LL_RELEASE_FOR_DOWNLOAD
386 LLGLState::checkClientArrays(mask);
387#endif
388
389 for (LLCullResult::drawinfo_list_t::iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) 366 for (LLCullResult::drawinfo_list_t::iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i)
390 { 367 {
391 LLDrawInfo* pparams = *i; 368 LLDrawInfo* pparams = *i;
@@ -436,9 +413,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
436 if (params.mVertexBuffer.notNull()) 413 if (params.mVertexBuffer.notNull())
437 { 414 {
438 params.mVertexBuffer->setBuffer(mask); 415 params.mVertexBuffer->setBuffer(mask);
439 U16* indices_pointer = (U16*) params.mVertexBuffer->getIndicesPointer(); 416 params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
440 glDrawRangeElements(GL_TRIANGLES, params.mStart, params.mEnd, params.mCount,
441 GL_UNSIGNED_SHORT, indices_pointer+params.mOffset);
442 gPipeline.addTrianglesDrawn(params.mCount/3); 417 gPipeline.addTrianglesDrawn(params.mCount/3);
443 } 418 }
444 419
diff --git a/linden/indra/newview/lldrawpool.h b/linden/indra/newview/lldrawpool.h
index bb354e3..3c80aef 100644
--- a/linden/indra/newview/lldrawpool.h
+++ b/linden/indra/newview/lldrawpool.h
@@ -90,15 +90,10 @@ public:
90 virtual BOOL isFacePool() { return FALSE; } 90 virtual BOOL isFacePool() { return FALSE; }
91 virtual void resetDrawOrders() = 0; 91 virtual void resetDrawOrders() = 0;
92 92
93 U32 getTrianglesDrawn() const;
94 void resetTrianglesDrawn();
95 void addIndicesDrawn(const U32 indices);
96
97protected: 93protected:
98 S32 mVertexShaderLevel; 94 S32 mVertexShaderLevel;
99 S32 mId; 95 S32 mId;
100 U32 mType; // Type of draw pool 96 U32 mType; // Type of draw pool
101 S32 mIndicesDrawn;
102}; 97};
103 98
104class LLRenderPass : public LLDrawPool 99class LLRenderPass : public LLDrawPool
diff --git a/linden/indra/newview/lldrawpoolalpha.cpp b/linden/indra/newview/lldrawpoolalpha.cpp
index cc2600e..ddde578 100644
--- a/linden/indra/newview/lldrawpoolalpha.cpp
+++ b/linden/indra/newview/lldrawpoolalpha.cpp
@@ -77,9 +77,6 @@ void LLDrawPoolAlpha::prerender()
77void LLDrawPoolAlpha::beginRenderPass(S32 pass) 77void LLDrawPoolAlpha::beginRenderPass(S32 pass)
78{ 78{
79 LLFastTimer t(LLFastTimer::FTM_RENDER_ALPHA); 79 LLFastTimer t(LLFastTimer::FTM_RENDER_ALPHA);
80 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
81 glEnableClientState(GL_NORMAL_ARRAY);
82 glEnableClientState(GL_COLOR_ARRAY);
83 80
84 if (LLPipeline::sUnderWaterRender) 81 if (LLPipeline::sUnderWaterRender)
85 { 82 {
@@ -128,8 +125,6 @@ void LLDrawPoolAlpha::render(S32 pass)
128 { 125 {
129 glUseProgramObjectARB(0); 126 glUseProgramObjectARB(0);
130 } 127 }
131 glDisableClientState(GL_NORMAL_ARRAY);
132 glDisableClientState(GL_COLOR_ARRAY);
133 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); 128 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
134 glColor4f(1,0,0,1); 129 glColor4f(1,0,0,1);
135 LLViewerImage::sSmokeImagep->addTextureStats(1024.f*1024.f); 130 LLViewerImage::sSmokeImagep->addTextureStats(1024.f*1024.f);
@@ -141,10 +136,6 @@ void LLDrawPoolAlpha::render(S32 pass)
141 136
142void LLDrawPoolAlpha::renderAlpha(U32 mask) 137void LLDrawPoolAlpha::renderAlpha(U32 mask)
143{ 138{
144#if !LL_RELEASE_FOR_DOWNLOAD
145 LLGLState::checkClientArrays(mask);
146#endif
147
148 for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) 139 for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
149 { 140 {
150 LLSpatialGroup* group = *i; 141 LLSpatialGroup* group = *i;
@@ -182,9 +173,7 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
182 LLRenderPass::applyModelMatrix(params); 173 LLRenderPass::applyModelMatrix(params);
183 174
184 params.mVertexBuffer->setBuffer(mask); 175 params.mVertexBuffer->setBuffer(mask);
185 U16* indices_pointer = (U16*) params.mVertexBuffer->getIndicesPointer(); 176 params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
186 glDrawRangeElements(GL_TRIANGLES, params.mStart, params.mEnd, params.mCount,
187 GL_UNSIGNED_SHORT, indices_pointer+params.mOffset);
188 gPipeline.addTrianglesDrawn(params.mCount/3); 177 gPipeline.addTrianglesDrawn(params.mCount/3);
189 } 178 }
190 } 179 }
@@ -303,9 +292,7 @@ void LLDrawPoolAlpha::renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask
303 } 292 }
304 293
305 params.mVertexBuffer->setBuffer(mask); 294 params.mVertexBuffer->setBuffer(mask);
306 U16* indices_pointer = (U16*) params.mVertexBuffer->getIndicesPointer(); 295 params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
307 glDrawRangeElements(GL_TRIANGLES, params.mStart, params.mEnd, params.mCount,
308 GL_UNSIGNED_SHORT, indices_pointer+params.mOffset);
309 gPipeline.addTrianglesDrawn(params.mCount/3); 296 gPipeline.addTrianglesDrawn(params.mCount/3);
310 297
311 if (params.mTextureMatrix && texture && params.mTexture.notNull()) 298 if (params.mTextureMatrix && texture && params.mTexture.notNull())
diff --git a/linden/indra/newview/lldrawpoolavatar.cpp b/linden/indra/newview/lldrawpoolavatar.cpp
index b461757..8e3341a 100644
--- a/linden/indra/newview/lldrawpoolavatar.cpp
+++ b/linden/indra/newview/lldrawpoolavatar.cpp
@@ -216,13 +216,11 @@ void LLDrawPoolAvatar::beginFootShadow()
216 } 216 }
217 217
218 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); 218 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
219 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
220} 219}
221 220
222void LLDrawPoolAvatar::endFootShadow() 221void LLDrawPoolAvatar::endFootShadow()
223{ 222{
224 gPipeline.enableLightsDynamic(); 223 gPipeline.enableLightsDynamic();
225 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
226} 224}
227 225
228void LLDrawPoolAvatar::beginRigid() 226void LLDrawPoolAvatar::beginRigid()
@@ -247,16 +245,11 @@ void LLDrawPoolAvatar::beginRigid()
247 { 245 {
248 sVertexProgram = NULL; 246 sVertexProgram = NULL;
249 } 247 }
250
251 glEnableClientState(GL_NORMAL_ARRAY);
252 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
253} 248}
254 249
255void LLDrawPoolAvatar::endRigid() 250void LLDrawPoolAvatar::endRigid()
256{ 251{
257 sShaderLevel = mVertexShaderLevel; 252 sShaderLevel = mVertexShaderLevel;
258 glDisableClientState(GL_NORMAL_ARRAY);
259 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
260 if (sVertexProgram != NULL) 253 if (sVertexProgram != NULL)
261 { 254 {
262 sVertexProgram->unbind(); 255 sVertexProgram->unbind();
@@ -265,9 +258,6 @@ void LLDrawPoolAvatar::endRigid()
265 258
266void LLDrawPoolAvatar::beginSkinned() 259void LLDrawPoolAvatar::beginSkinned()
267{ 260{
268 glEnableClientState(GL_NORMAL_ARRAY);
269 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
270
271 if (sShaderLevel > 0) 261 if (sShaderLevel > 0)
272 { 262 {
273 if (LLPipeline::sUnderWaterRender) 263 if (LLPipeline::sUnderWaterRender)
@@ -295,8 +285,7 @@ void LLDrawPoolAvatar::beginSkinned()
295 if (sShaderLevel > 0) // for hardware blending 285 if (sShaderLevel > 0) // for hardware blending
296 { 286 {
297 sRenderingSkinned = TRUE; 287 sRenderingSkinned = TRUE;
298 glClientActiveTextureARB(GL_TEXTURE1_ARB); 288
299
300 sVertexProgram->bind(); 289 sVertexProgram->bind();
301 if (sShaderLevel >= SHADER_LEVEL_CLOTH) 290 if (sShaderLevel >= SHADER_LEVEL_CLOTH)
302 { 291 {
@@ -331,7 +320,6 @@ void LLDrawPoolAvatar::endSkinned()
331 sRenderingSkinned = FALSE; 320 sRenderingSkinned = FALSE;
332 sVertexProgram->disableTexture(LLShaderMgr::BUMP_MAP); 321 sVertexProgram->disableTexture(LLShaderMgr::BUMP_MAP);
333 glActiveTextureARB(GL_TEXTURE0_ARB); 322 glActiveTextureARB(GL_TEXTURE0_ARB);
334 glClientActiveTextureARB(GL_TEXTURE0_ARB);
335 disable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]); 323 disable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]);
336 if (sShaderLevel >= SHADER_LEVEL_BUMP) 324 if (sShaderLevel >= SHADER_LEVEL_BUMP)
337 { 325 {
@@ -356,10 +344,6 @@ void LLDrawPoolAvatar::endSkinned()
356 } 344 }
357 345
358 glActiveTextureARB(GL_TEXTURE0_ARB); 346 glActiveTextureARB(GL_TEXTURE0_ARB);
359 glClientActiveTextureARB(GL_TEXTURE0_ARB);
360
361 glDisableClientState(GL_NORMAL_ARRAY);
362 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
363} 347}
364 348
365 349
@@ -438,7 +422,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
438 } 422 }
439 else if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS)) 423 else if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS))
440 { 424 {
441 mIndicesDrawn += avatarp->renderFootShadows(); 425 avatarp->renderFootShadows();
442 } 426 }
443 return; 427 return;
444 } 428 }
@@ -451,7 +435,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
451 if (pass == 1) 435 if (pass == 1)
452 { 436 {
453 // render rigid meshes (eyeballs) first 437 // render rigid meshes (eyeballs) first
454 mIndicesDrawn += avatarp->renderRigid(); 438 avatarp->renderRigid();
455 return; 439 return;
456 } 440 }
457 441
@@ -548,7 +532,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
548 color.setColor(1.0f, 1.0f, 1.0f, 1.0f); 532 color.setColor(1.0f, 1.0f, 1.0f, 1.0f);
549 } 533 }
550 534
551 mIndicesDrawn += avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); 535 avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE);
552 } 536 }
553} 537}
554 538
@@ -609,9 +593,6 @@ void LLDrawPoolAvatar::renderForSelect()
609 return; 593 return;
610 } 594 }
611 595
612 glEnableClientState(GL_VERTEX_ARRAY);
613 glEnableClientState(GL_NORMAL_ARRAY);
614 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
615 sVertexProgram = &gAvatarPickProgram; 596 sVertexProgram = &gAvatarPickProgram;
616 if (sShaderLevel > 0) 597 if (sShaderLevel > 0)
617 { 598 {
@@ -624,13 +605,12 @@ void LLDrawPoolAvatar::renderForSelect()
624 605
625 if ((sShaderLevel > 0) && !gUseGLPick) // for hardware blending 606 if ((sShaderLevel > 0) && !gUseGLPick) // for hardware blending
626 { 607 {
627 glClientActiveTextureARB(GL_TEXTURE0_ARB);
628 sRenderingSkinned = TRUE; 608 sRenderingSkinned = TRUE;
629 sVertexProgram->bind(); 609 sVertexProgram->bind();
630 enable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]); 610 enable_vertex_weighting(sVertexProgram->mAttribute[LLShaderMgr::AVATAR_WEIGHT]);
631 } 611 }
632 612
633 mIndicesDrawn += avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); 613 avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE);
634 614
635 // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done 615 // if we're in software-blending, remember to set the fence _after_ we draw so we wait till this rendering is done
636 if ((sShaderLevel > 0) && !gUseGLPick) 616 if ((sShaderLevel > 0) && !gUseGLPick)
@@ -645,8 +625,6 @@ void LLDrawPoolAvatar::renderForSelect()
645 625
646 // restore texture mode 626 // restore texture mode
647 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 627 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
648 glDisableClientState(GL_NORMAL_ARRAY);
649 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
650} 628}
651 629
652//----------------------------------------------------------------------------- 630//-----------------------------------------------------------------------------
diff --git a/linden/indra/newview/lldrawpoolbump.cpp b/linden/indra/newview/lldrawpoolbump.cpp
index 2345406..7e8b9d6 100644
--- a/linden/indra/newview/lldrawpoolbump.cpp
+++ b/linden/indra/newview/lldrawpoolbump.cpp
@@ -316,12 +316,8 @@ void LLDrawPoolBump::beginShiny(bool invisible)
316 mShiny = TRUE; 316 mShiny = TRUE;
317 sVertexMask = VERTEX_MASK_SHINY; 317 sVertexMask = VERTEX_MASK_SHINY;
318 // Second pass: environment map 318 // Second pass: environment map
319 glEnableClientState(GL_VERTEX_ARRAY);
320 glEnableClientState(GL_NORMAL_ARRAY);
321 glEnableClientState(GL_COLOR_ARRAY);
322 if (!invisible && mVertexShaderLevel > 1) 319 if (!invisible && mVertexShaderLevel > 1)
323 { 320 {
324 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
325 sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD; 321 sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD;
326 } 322 }
327 323
@@ -456,13 +452,7 @@ void LLDrawPoolBump::endShiny(bool invisible)
456 452
457 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 453 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
458 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 454 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
459 glDisableClientState(GL_NORMAL_ARRAY); 455
460 glDisableClientState(GL_COLOR_ARRAY);
461 if (!invisible && mVertexShaderLevel > 1)
462 {
463 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
464 }
465
466 diffuse_channel = -1; 456 diffuse_channel = -1;
467 cube_channel = 0; 457 cube_channel = 0;
468 mShiny = FALSE; 458 mShiny = FALSE;
@@ -479,10 +469,6 @@ void LLDrawPoolBump::beginFullbrightShiny()
479 sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD; 469 sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD;
480 470
481 // Second pass: environment map 471 // Second pass: environment map
482 glEnableClientState(GL_VERTEX_ARRAY);
483 glEnableClientState(GL_NORMAL_ARRAY);
484 glEnableClientState(GL_COLOR_ARRAY);
485 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
486 472
487 if (LLPipeline::sUnderWaterRender) 473 if (LLPipeline::sUnderWaterRender)
488 { 474 {
@@ -564,9 +550,6 @@ void LLDrawPoolBump::endFullbrightShiny()
564 550
565 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 551 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
566 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 552 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
567 glDisableClientState(GL_NORMAL_ARRAY);
568 glDisableClientState(GL_COLOR_ARRAY);
569 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
570 553
571 diffuse_channel = -1; 554 diffuse_channel = -1;
572 cube_channel = 0; 555 cube_channel = 0;
@@ -607,9 +590,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL
607 applyModelMatrix(params); 590 applyModelMatrix(params);
608 591
609 params.mVertexBuffer->setBuffer(mask); 592 params.mVertexBuffer->setBuffer(mask);
610 U16* indices_pointer = (U16*) params.mVertexBuffer->getIndicesPointer(); 593 params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
611 glDrawRangeElements(GL_TRIANGLES, params.mStart, params.mEnd, params.mCount,
612 GL_UNSIGNED_SHORT, indices_pointer+params.mOffset);
613 gPipeline.addTrianglesDrawn(params.mCount/3); 594 gPipeline.addTrianglesDrawn(params.mCount/3);
614 } 595 }
615} 596}
@@ -670,8 +651,6 @@ void LLDrawPoolBump::beginBump()
670 // TEXTURE UNIT 0 651 // TEXTURE UNIT 0
671 // Output.rgb = texture at texture coord 0 652 // Output.rgb = texture at texture coord 0
672 glActiveTextureARB(GL_TEXTURE0_ARB); 653 glActiveTextureARB(GL_TEXTURE0_ARB);
673 glClientActiveTextureARB(GL_TEXTURE0_ARB);
674 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
675 654
676 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 655 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
677 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE); 656 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
@@ -686,8 +665,6 @@ void LLDrawPoolBump::beginBump()
686 665
687 // TEXTURE UNIT 1 666 // TEXTURE UNIT 1
688 glActiveTextureARB(GL_TEXTURE1_ARB); 667 glActiveTextureARB(GL_TEXTURE1_ARB);
689 glClientActiveTextureARB(GL_TEXTURE1_ARB);
690 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
691 668
692 glEnable(GL_TEXTURE_2D); // Texture unit 1 669 glEnable(GL_TEXTURE_2D); // Texture unit 1
693 670
@@ -752,15 +729,11 @@ void LLDrawPoolBump::endBump()
752 729
753 // Disable texture unit 1 730 // Disable texture unit 1
754 glActiveTextureARB(GL_TEXTURE1_ARB); 731 glActiveTextureARB(GL_TEXTURE1_ARB);
755 glClientActiveTextureARB(GL_TEXTURE1_ARB);
756 glDisable(GL_TEXTURE_2D); // Texture unit 1 732 glDisable(GL_TEXTURE_2D); // Texture unit 1
757 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
758 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 733 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
759 734
760 // Disable texture unit 0 735 // Disable texture unit 0
761 glActiveTextureARB(GL_TEXTURE0_ARB); 736 glActiveTextureARB(GL_TEXTURE0_ARB);
762 glClientActiveTextureARB(GL_TEXTURE0_ARB);
763 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
764 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 737 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
765 738
766 gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 739 gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
@@ -1091,10 +1064,6 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLIma
1091 1064
1092void LLDrawPoolBump::renderBump(U32 type, U32 mask) 1065void LLDrawPoolBump::renderBump(U32 type, U32 mask)
1093{ 1066{
1094#if !LL_RELEASE_FOR_DOWNLOAD
1095 LLGLState::checkClientArrays(mask);
1096#endif
1097
1098 LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type); 1067 LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type);
1099 LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type); 1068 LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type);
1100 1069
@@ -1178,11 +1147,8 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
1178 } 1147 }
1179 1148
1180 params.mVertexBuffer->setBuffer(mask); 1149 params.mVertexBuffer->setBuffer(mask);
1181 U16* indices_pointer = (U16*) params.mVertexBuffer->getIndicesPointer(); 1150 params.mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
1182 glDrawRangeElements(GL_TRIANGLES, params.mStart, params.mEnd, params.mCount,
1183 GL_UNSIGNED_SHORT, indices_pointer+params.mOffset);
1184 gPipeline.addTrianglesDrawn(params.mCount/3); 1151 gPipeline.addTrianglesDrawn(params.mCount/3);
1185
1186 if (params.mTextureMatrix) 1152 if (params.mTextureMatrix)
1187 { 1153 {
1188 if (mShiny) 1154 if (mShiny)
diff --git a/linden/indra/newview/lldrawpoolground.cpp b/linden/indra/newview/lldrawpoolground.cpp
index a1c5a99..03b8a0c 100644
--- a/linden/indra/newview/lldrawpoolground.cpp
+++ b/linden/indra/newview/lldrawpoolground.cpp
@@ -68,9 +68,6 @@ void LLDrawPoolGround::render(S32 pass)
68 return; 68 return;
69 } 69 }
70 70
71 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
72 glEnableClientState(GL_VERTEX_ARRAY);
73
74 LLGLSPipelineSkyBox gls_skybox; 71 LLGLSPipelineSkyBox gls_skybox;
75 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 72 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
76 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); 73 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
diff --git a/linden/indra/newview/lldrawpoolsimple.cpp b/linden/indra/newview/lldrawpoolsimple.cpp
index cdb22bf..330ac57 100644
--- a/linden/indra/newview/lldrawpoolsimple.cpp
+++ b/linden/indra/newview/lldrawpoolsimple.cpp
@@ -65,13 +65,10 @@ void LLDrawPoolGlow::render(S32 pass)
65 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); 65 gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
66 } 66 }
67 67
68 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
69 LLGLDepthTest depth(GL_TRUE, GL_FALSE); 68 LLGLDepthTest depth(GL_TRUE, GL_FALSE);
70 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); 69 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
71 renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask()); 70 renderTexture(LLRenderPass::PASS_GLOW, getVertexDataMask());
72 71
73 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
74
75 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); 72 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
76 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 73 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
77 74
@@ -101,10 +98,6 @@ void LLDrawPoolSimple::prerender()
101void LLDrawPoolSimple::beginRenderPass(S32 pass) 98void LLDrawPoolSimple::beginRenderPass(S32 pass)
102{ 99{
103 LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE); 100 LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE);
104 glEnableClientState(GL_VERTEX_ARRAY);
105 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
106 glEnableClientState(GL_NORMAL_ARRAY);
107 glEnableClientState(GL_COLOR_ARRAY);
108 101
109 if (LLPipeline::sUnderWaterRender) 102 if (LLPipeline::sUnderWaterRender)
110 { 103 {
@@ -136,7 +129,6 @@ void LLDrawPoolSimple::endRenderPass(S32 pass)
136{ 129{
137 LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE); 130 LLFastTimer t(LLFastTimer::FTM_RENDER_SIMPLE);
138 LLRenderPass::endRenderPass(pass); 131 LLRenderPass::endRenderPass(pass);
139 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
140 132
141 if (mVertexShaderLevel > 0){ 133 if (mVertexShaderLevel > 0){
142 134
@@ -177,7 +169,6 @@ void LLDrawPoolSimple::render(S32 pass)
177 } 169 }
178 LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT); 170 LLFastTimer t(LLFastTimer::FTM_RENDER_FULLBRIGHT);
179 U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR; 171 U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR;
180 glDisableClientState(GL_NORMAL_ARRAY);
181 renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask); 172 renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask);
182 } 173 }
183 174
diff --git a/linden/indra/newview/lldrawpoolsky.cpp b/linden/indra/newview/lldrawpoolsky.cpp
index ac5c389..e06bb6d 100644
--- a/linden/indra/newview/lldrawpoolsky.cpp
+++ b/linden/indra/newview/lldrawpoolsky.cpp
@@ -113,10 +113,6 @@ void LLDrawPoolSky::render(S32 pass)
113 LLVector3 origin = LLViewerCamera::getInstance()->getOrigin(); 113 LLVector3 origin = LLViewerCamera::getInstance()->getOrigin();
114 glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); 114 glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]);
115 115
116 glEnableClientState(GL_VERTEX_ARRAY);
117 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
118 glDisableClientState(GL_NORMAL_ARRAY);
119
120 S32 face_count = (S32)mDrawFace.size(); 116 S32 face_count = (S32)mDrawFace.size();
121 117
122 for (S32 i = 0; i < llmin(6, face_count); ++i) 118 for (S32 i = 0; i < llmin(6, face_count); ++i)
@@ -160,8 +156,6 @@ void LLDrawPoolSky::render(S32 pass)
160 // renderHeavenlyBody(1, hbfaces[1]); 156 // renderHeavenlyBody(1, hbfaces[1]);
161 } 157 }
162 158
163 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
164
165 glPopMatrix(); 159 glPopMatrix();
166} 160}
167 161
@@ -184,8 +178,6 @@ void LLDrawPoolSky::renderSkyCubeFace(U8 side)
184 glColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled 178 glColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled
185 face.renderIndexed(); 179 face.renderIndexed();
186 } 180 }
187
188 mIndicesDrawn += face.getIndicesCount();
189} 181}
190 182
191void LLDrawPoolSky::renderHeavenlyBody(U8 hb, LLFace* face) 183void LLDrawPoolSky::renderHeavenlyBody(U8 hb, LLFace* face)
@@ -198,7 +190,6 @@ void LLDrawPoolSky::renderHeavenlyBody(U8 hb, LLFace* face)
198 LLColor4 color(mHB[hb]->getInterpColor()); 190 LLColor4 color(mHB[hb]->getInterpColor());
199 LLOverrideFaceColor override(this, color); 191 LLOverrideFaceColor override(this, color);
200 face->renderIndexed(); 192 face->renderIndexed();
201 mIndicesDrawn += face->getIndicesCount();
202} 193}
203 194
204 195
@@ -215,7 +206,6 @@ void LLDrawPoolSky::renderSunHalo(LLFace* face)
215 206
216 LLOverrideFaceColor override(this, color); 207 LLOverrideFaceColor override(this, color);
217 face->renderIndexed(); 208 face->renderIndexed();
218 mIndicesDrawn += face->getIndicesCount();
219} 209}
220 210
221 211
diff --git a/linden/indra/newview/lldrawpoolterrain.cpp b/linden/indra/newview/lldrawpoolterrain.cpp
index 1d43698..fdb27f9 100644
--- a/linden/indra/newview/lldrawpoolterrain.cpp
+++ b/linden/indra/newview/lldrawpoolterrain.cpp
@@ -217,14 +217,6 @@ void LLDrawPoolTerrain::render(S32 pass)
217 217
218void LLDrawPoolTerrain::renderFullShader() 218void LLDrawPoolTerrain::renderFullShader()
219{ 219{
220 glEnableClientState(GL_VERTEX_ARRAY);
221 glEnableClientState(GL_NORMAL_ARRAY);
222
223 if (gPipeline.getLightingDetail() >= 2)
224 {
225 glEnableClientState(GL_COLOR_ARRAY);
226 }
227
228 // Hack! Get the region that this draw pool is rendering from! 220 // Hack! Get the region that this draw pool is rendering from!
229 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); 221 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
230 LLVLComposition *compp = regionp->getComposition(); 222 LLVLComposition *compp = regionp->getComposition();
@@ -247,10 +239,8 @@ void LLDrawPoolTerrain::renderFullShader()
247 // 239 //
248 S32 detail0 = sShader->enableTexture(LLShaderMgr::TERRAIN_DETAIL0); 240 S32 detail0 = sShader->enableTexture(LLShaderMgr::TERRAIN_DETAIL0);
249 LLViewerImage::bindTexture(detail_texture0p,detail0); 241 LLViewerImage::bindTexture(detail_texture0p,detail0);
250 glClientActiveTextureARB(GL_TEXTURE0_ARB);
251 glActiveTextureARB(GL_TEXTURE0_ARB); 242 glActiveTextureARB(GL_TEXTURE0_ARB);
252 243
253 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
254 glEnable(GL_TEXTURE_GEN_S); 244 glEnable(GL_TEXTURE_GEN_S);
255 glEnable(GL_TEXTURE_GEN_T); 245 glEnable(GL_TEXTURE_GEN_T);
256 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); 246 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@@ -269,9 +259,7 @@ void LLDrawPoolTerrain::renderFullShader()
269 LLViewerImage::bindTexture(detail_texture1p,detail1); 259 LLViewerImage::bindTexture(detail_texture1p,detail1);
270 260
271 /// ALPHA TEXTURE COORDS 0: 261 /// ALPHA TEXTURE COORDS 0:
272 glClientActiveTextureARB(GL_TEXTURE1_ARB);
273 glActiveTextureARB(GL_TEXTURE1_ARB); 262 glActiveTextureARB(GL_TEXTURE1_ARB);
274 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
275 glMatrixMode(GL_TEXTURE); 263 glMatrixMode(GL_TEXTURE);
276 glLoadIdentity(); 264 glLoadIdentity();
277 glMatrixMode(GL_MODELVIEW); 265 glMatrixMode(GL_MODELVIEW);
@@ -283,9 +271,7 @@ void LLDrawPoolTerrain::renderFullShader()
283 glEnable(GL_TEXTURE_2D); 271 glEnable(GL_TEXTURE_2D);
284 272
285 /// ALPHA TEXTURE COORDS 1: 273 /// ALPHA TEXTURE COORDS 1:
286 glClientActiveTextureARB(GL_TEXTURE2_ARB);
287 glActiveTextureARB(GL_TEXTURE2_ARB); 274 glActiveTextureARB(GL_TEXTURE2_ARB);
288 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
289 glMatrixMode(GL_TEXTURE); 275 glMatrixMode(GL_TEXTURE);
290 glLoadIdentity(); 276 glLoadIdentity();
291 glTranslatef(-2.f, 0.f, 0.f); 277 glTranslatef(-2.f, 0.f, 0.f);
@@ -298,9 +284,7 @@ void LLDrawPoolTerrain::renderFullShader()
298 LLViewerImage::bindTexture(detail_texture3p,detail3); 284 LLViewerImage::bindTexture(detail_texture3p,detail3);
299 285
300 /// ALPHA TEXTURE COORDS 2: 286 /// ALPHA TEXTURE COORDS 2:
301 glClientActiveTextureARB(GL_TEXTURE3_ARB);
302 glActiveTextureARB(GL_TEXTURE3_ARB); 287 glActiveTextureARB(GL_TEXTURE3_ARB);
303 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
304 glMatrixMode(GL_TEXTURE); 288 glMatrixMode(GL_TEXTURE);
305 glLoadIdentity(); 289 glLoadIdentity();
306 glTranslatef(-1.f, 0.f, 0.f); 290 glTranslatef(-1.f, 0.f, 0.f);
@@ -323,7 +307,6 @@ void LLDrawPoolTerrain::renderFullShader()
323 sShader->disableTexture(LLShaderMgr::TERRAIN_DETAIL3); 307 sShader->disableTexture(LLShaderMgr::TERRAIN_DETAIL3);
324 308
325 LLImageGL::unbindTexture(alpha_ramp, GL_TEXTURE_2D); 309 LLImageGL::unbindTexture(alpha_ramp, GL_TEXTURE_2D);
326 glClientActiveTextureARB(GL_TEXTURE4_ARB);
327 glActiveTextureARB(GL_TEXTURE4_ARB); 310 glActiveTextureARB(GL_TEXTURE4_ARB);
328 glDisable(GL_TEXTURE_2D); // Texture unit 4 311 glDisable(GL_TEXTURE_2D); // Texture unit 4
329 glDisable(GL_TEXTURE_GEN_S); 312 glDisable(GL_TEXTURE_GEN_S);
@@ -333,10 +316,8 @@ void LLDrawPoolTerrain::renderFullShader()
333 glMatrixMode(GL_MODELVIEW); 316 glMatrixMode(GL_MODELVIEW);
334 317
335 LLImageGL::unbindTexture(detail3, GL_TEXTURE_2D); 318 LLImageGL::unbindTexture(detail3, GL_TEXTURE_2D);
336 glClientActiveTextureARB(GL_TEXTURE3_ARB);
337 glActiveTextureARB(GL_TEXTURE3_ARB); 319 glActiveTextureARB(GL_TEXTURE3_ARB);
338 glDisable(GL_TEXTURE_2D); 320 glDisable(GL_TEXTURE_2D);
339 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
340 glDisable(GL_TEXTURE_GEN_S); 321 glDisable(GL_TEXTURE_GEN_S);
341 glDisable(GL_TEXTURE_GEN_T); 322 glDisable(GL_TEXTURE_GEN_T);
342 glMatrixMode(GL_TEXTURE); 323 glMatrixMode(GL_TEXTURE);
@@ -344,10 +325,8 @@ void LLDrawPoolTerrain::renderFullShader()
344 glMatrixMode(GL_MODELVIEW); 325 glMatrixMode(GL_MODELVIEW);
345 326
346 LLImageGL::unbindTexture(detail2, GL_TEXTURE_2D); 327 LLImageGL::unbindTexture(detail2, GL_TEXTURE_2D);
347 glClientActiveTextureARB(GL_TEXTURE2_ARB);
348 glActiveTextureARB(GL_TEXTURE2_ARB); 328 glActiveTextureARB(GL_TEXTURE2_ARB);
349 glDisable(GL_TEXTURE_2D); 329 glDisable(GL_TEXTURE_2D);
350 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
351 glDisable(GL_TEXTURE_GEN_S); 330 glDisable(GL_TEXTURE_GEN_S);
352 glDisable(GL_TEXTURE_GEN_T); 331 glDisable(GL_TEXTURE_GEN_T);
353 glMatrixMode(GL_TEXTURE); 332 glMatrixMode(GL_TEXTURE);
@@ -355,10 +334,8 @@ void LLDrawPoolTerrain::renderFullShader()
355 glMatrixMode(GL_MODELVIEW); 334 glMatrixMode(GL_MODELVIEW);
356 335
357 LLImageGL::unbindTexture(detail1, GL_TEXTURE_2D); 336 LLImageGL::unbindTexture(detail1, GL_TEXTURE_2D);
358 glClientActiveTextureARB(GL_TEXTURE1_ARB);
359 glActiveTextureARB(GL_TEXTURE1_ARB); 337 glActiveTextureARB(GL_TEXTURE1_ARB);
360 glDisable(GL_TEXTURE_2D); 338 glDisable(GL_TEXTURE_2D);
361 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
362 glDisable(GL_TEXTURE_GEN_S); 339 glDisable(GL_TEXTURE_GEN_S);
363 glDisable(GL_TEXTURE_GEN_T); 340 glDisable(GL_TEXTURE_GEN_T);
364 glMatrixMode(GL_TEXTURE); 341 glMatrixMode(GL_TEXTURE);
@@ -369,7 +346,6 @@ void LLDrawPoolTerrain::renderFullShader()
369 // Restore Texture Unit 0 defaults 346 // Restore Texture Unit 0 defaults
370 347
371 LLImageGL::unbindTexture(detail0, GL_TEXTURE_2D); 348 LLImageGL::unbindTexture(detail0, GL_TEXTURE_2D);
372 glClientActiveTextureARB(GL_TEXTURE0_ARB);
373 glActiveTextureARB(GL_TEXTURE0_ARB); 349 glActiveTextureARB(GL_TEXTURE0_ARB);
374 glEnable(GL_TEXTURE_2D); 350 glEnable(GL_TEXTURE_2D);
375 glDisable(GL_TEXTURE_GEN_S); 351 glDisable(GL_TEXTURE_GEN_S);
@@ -377,14 +353,11 @@ void LLDrawPoolTerrain::renderFullShader()
377 glMatrixMode(GL_TEXTURE); 353 glMatrixMode(GL_TEXTURE);
378 glLoadIdentity(); 354 glLoadIdentity();
379 glMatrixMode(GL_MODELVIEW); 355 glMatrixMode(GL_MODELVIEW);
380
381 // Restore non Texture Unit specific defaults
382 glDisableClientState(GL_NORMAL_ARRAY);
383} 356}
384 357
385void LLDrawPoolTerrain::renderFull4TU() 358void LLDrawPoolTerrain::renderFull4TU()
386{ 359{
387 glEnableClientState(GL_VERTEX_ARRAY); 360 glEnableClientState(GL_VERTEX_ARRAY);
388 glEnableClientState(GL_NORMAL_ARRAY); 361 glEnableClientState(GL_NORMAL_ARRAY);
389 362
390 // Hack! Get the region that this draw pool is rendering from! 363 // Hack! Get the region that this draw pool is rendering from!
@@ -434,9 +407,8 @@ void LLDrawPoolTerrain::renderFull4TU()
434 // 407 //
435 // Stage 1: Generate alpha ramp for detail0/detail1 transition 408 // Stage 1: Generate alpha ramp for detail0/detail1 transition
436 // 409 //
437 glActiveTextureARB(GL_TEXTURE1_ARB);
438 LLViewerImage::bindTexture(m2DAlphaRampImagep,1); 410 LLViewerImage::bindTexture(m2DAlphaRampImagep,1);
439 411 glActiveTextureARB(GL_TEXTURE1_ARB);
440 glEnable(GL_TEXTURE_2D); // Texture unit 1 412 glEnable(GL_TEXTURE_2D); // Texture unit 1
441 glClientActiveTextureARB(GL_TEXTURE1_ARB); 413 glClientActiveTextureARB(GL_TEXTURE1_ARB);
442 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 414 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
@@ -454,8 +426,8 @@ void LLDrawPoolTerrain::renderFull4TU()
454 // 426 //
455 // Stage 2: Interpolate detail1 with existing based on ramp 427 // Stage 2: Interpolate detail1 with existing based on ramp
456 // 428 //
457 glActiveTextureARB(GL_TEXTURE2_ARB);
458 LLViewerImage::bindTexture(detail_texture1p,2); 429 LLViewerImage::bindTexture(detail_texture1p,2);
430 glActiveTextureARB(GL_TEXTURE2_ARB);
459 glEnable(GL_TEXTURE_2D); // Texture unit 2 431 glEnable(GL_TEXTURE_2D); // Texture unit 2
460 glClientActiveTextureARB(GL_TEXTURE2_ARB); 432 glClientActiveTextureARB(GL_TEXTURE2_ARB);
461 433
@@ -480,8 +452,8 @@ void LLDrawPoolTerrain::renderFull4TU()
480 // 452 //
481 // Stage 3: Modulate with primary (vertex) color for lighting 453 // Stage 3: Modulate with primary (vertex) color for lighting
482 // 454 //
483 glActiveTextureARB(GL_TEXTURE3_ARB);
484 LLViewerImage::bindTexture(detail_texture1p,3); // bind any texture 455 LLViewerImage::bindTexture(detail_texture1p,3); // bind any texture
456 glActiveTextureARB(GL_TEXTURE3_ARB);
485 glEnable(GL_TEXTURE_2D); // Texture unit 3 457 glEnable(GL_TEXTURE_2D); // Texture unit 3
486 glClientActiveTextureARB(GL_TEXTURE3_ARB); 458 glClientActiveTextureARB(GL_TEXTURE3_ARB);
487 459
@@ -494,6 +466,7 @@ void LLDrawPoolTerrain::renderFull4TU()
494 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB); 466 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB);
495 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR); 467 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR);
496 468
469 glActiveTextureARB(GL_TEXTURE0_ARB);
497 // GL_BLEND disabled by default 470 // GL_BLEND disabled by default
498 drawLoop(); 471 drawLoop();
499 472
@@ -524,9 +497,8 @@ void LLDrawPoolTerrain::renderFull4TU()
524 // 497 //
525 // Stage 1: Generate alpha ramp for detail2/detail3 transition 498 // Stage 1: Generate alpha ramp for detail2/detail3 transition
526 // 499 //
527 glActiveTextureARB(GL_TEXTURE1_ARB);
528 LLViewerImage::bindTexture(m2DAlphaRampImagep,1); 500 LLViewerImage::bindTexture(m2DAlphaRampImagep,1);
529 501 glActiveTextureARB(GL_TEXTURE1_ARB);
530 glEnable(GL_TEXTURE_2D); // Texture unit 1 502 glEnable(GL_TEXTURE_2D); // Texture unit 1
531 glClientActiveTextureARB(GL_TEXTURE1_ARB); 503 glClientActiveTextureARB(GL_TEXTURE1_ARB);
532 504
@@ -551,8 +523,8 @@ void LLDrawPoolTerrain::renderFull4TU()
551 // 523 //
552 // Stage 2: Interpolate detail2 with existing based on ramp 524 // Stage 2: Interpolate detail2 with existing based on ramp
553 // 525 //
554 glActiveTextureARB(GL_TEXTURE2_ARB);
555 LLViewerImage::bindTexture(detail_texture2p,2); 526 LLViewerImage::bindTexture(detail_texture2p,2);
527 glActiveTextureARB(GL_TEXTURE2_ARB);
556 glEnable(GL_TEXTURE_2D); // Texture unit 2 528 glEnable(GL_TEXTURE_2D); // Texture unit 2
557 glClientActiveTextureARB(GL_TEXTURE2_ARB); 529 glClientActiveTextureARB(GL_TEXTURE2_ARB);
558 530
@@ -578,9 +550,9 @@ void LLDrawPoolTerrain::renderFull4TU()
578 // 550 //
579 // Stage 3: Generate alpha ramp for detail1/detail2 transition 551 // Stage 3: Generate alpha ramp for detail1/detail2 transition
580 // 552 //
581 glActiveTextureARB(GL_TEXTURE3_ARB);
582 LLViewerImage::bindTexture(m2DAlphaRampImagep,3); 553 LLViewerImage::bindTexture(m2DAlphaRampImagep,3);
583 554 glActiveTextureARB(GL_TEXTURE3_ARB);
555
584 glEnable(GL_TEXTURE_2D); // Texture unit 3 556 glEnable(GL_TEXTURE_2D); // Texture unit 3
585 glClientActiveTextureARB(GL_TEXTURE3_ARB); 557 glClientActiveTextureARB(GL_TEXTURE3_ARB);
586 558
@@ -603,7 +575,7 @@ void LLDrawPoolTerrain::renderFull4TU()
603 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE); 575 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
604 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); 576 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
605 577
606 578 glActiveTextureARB(GL_TEXTURE0_ARB);
607 { 579 {
608 LLGLEnable blend(GL_BLEND); 580 LLGLEnable blend(GL_BLEND);
609 drawLoop(); 581 drawLoop();
@@ -611,6 +583,7 @@ void LLDrawPoolTerrain::renderFull4TU()
611 583
612 // Disable multitexture 584 // Disable multitexture
613 LLImageGL::unbindTexture(3, GL_TEXTURE_2D); 585 LLImageGL::unbindTexture(3, GL_TEXTURE_2D);
586 glActiveTextureARB(GL_TEXTURE3_ARB);
614 glClientActiveTextureARB(GL_TEXTURE3_ARB); 587 glClientActiveTextureARB(GL_TEXTURE3_ARB);
615 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 588 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
616 glDisable(GL_TEXTURE_2D); // Texture unit 3 589 glDisable(GL_TEXTURE_2D); // Texture unit 3
@@ -619,6 +592,7 @@ void LLDrawPoolTerrain::renderFull4TU()
619 glMatrixMode(GL_MODELVIEW); 592 glMatrixMode(GL_MODELVIEW);
620 593
621 LLImageGL::unbindTexture(2, GL_TEXTURE_2D); 594 LLImageGL::unbindTexture(2, GL_TEXTURE_2D);
595 glActiveTextureARB(GL_TEXTURE2_ARB);
622 glClientActiveTextureARB(GL_TEXTURE2_ARB); 596 glClientActiveTextureARB(GL_TEXTURE2_ARB);
623 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 597 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
624 glDisable(GL_TEXTURE_2D); // Texture unit 2 598 glDisable(GL_TEXTURE_2D); // Texture unit 2
@@ -629,6 +603,7 @@ void LLDrawPoolTerrain::renderFull4TU()
629 glMatrixMode(GL_MODELVIEW); 603 glMatrixMode(GL_MODELVIEW);
630 604
631 LLImageGL::unbindTexture(1, GL_TEXTURE_2D); 605 LLImageGL::unbindTexture(1, GL_TEXTURE_2D);
606 glActiveTextureARB(GL_TEXTURE1_ARB);
632 glClientActiveTextureARB(GL_TEXTURE1_ARB); 607 glClientActiveTextureARB(GL_TEXTURE1_ARB);
633 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 608 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
634 glDisable(GL_TEXTURE_2D); // Texture unit 1 609 glDisable(GL_TEXTURE_2D); // Texture unit 1
@@ -642,6 +617,7 @@ void LLDrawPoolTerrain::renderFull4TU()
642 //---------------------------------------------------------------------------- 617 //----------------------------------------------------------------------------
643 // Restore Texture Unit 0 defaults 618 // Restore Texture Unit 0 defaults
644 619
620 glActiveTextureARB(GL_TEXTURE0_ARB);
645 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 621 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
646 glClientActiveTextureARB(GL_TEXTURE0_ARB); 622 glClientActiveTextureARB(GL_TEXTURE0_ARB);
647 glActiveTextureARB(GL_TEXTURE0_ARB); 623 glActiveTextureARB(GL_TEXTURE0_ARB);
@@ -658,9 +634,6 @@ void LLDrawPoolTerrain::renderFull4TU()
658 634
659void LLDrawPoolTerrain::renderFull2TU() 635void LLDrawPoolTerrain::renderFull2TU()
660{ 636{
661 glEnableClientState(GL_VERTEX_ARRAY);
662 glEnableClientState(GL_NORMAL_ARRAY);
663
664 // Hack! Get the region that this draw pool is rendering from! 637 // Hack! Get the region that this draw pool is rendering from!
665 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); 638 LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
666 LLVLComposition *compp = regionp->getComposition(); 639 LLVLComposition *compp = regionp->getComposition();
@@ -687,9 +660,6 @@ void LLDrawPoolTerrain::renderFull2TU()
687 // Stage 0: Render detail 0 into base 660 // Stage 0: Render detail 0 into base
688 // 661 //
689 LLViewerImage::bindTexture(detail_texture0p,0); 662 LLViewerImage::bindTexture(detail_texture0p,0);
690 glClientActiveTextureARB(GL_TEXTURE0_ARB);
691
692 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
693 glEnable(GL_TEXTURE_GEN_S); 663 glEnable(GL_TEXTURE_GEN_S);
694 glEnable(GL_TEXTURE_GEN_T); 664 glEnable(GL_TEXTURE_GEN_T);
695 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); 665 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@@ -715,12 +685,10 @@ void LLDrawPoolTerrain::renderFull2TU()
715 // Stage 0: Generate alpha ramp for detail0/detail1 transition 685 // Stage 0: Generate alpha ramp for detail0/detail1 transition
716 // 686 //
717 LLViewerImage::bindTexture(m2DAlphaRampImagep,0); 687 LLViewerImage::bindTexture(m2DAlphaRampImagep,0);
718 glClientActiveTextureARB(GL_TEXTURE0_ARB); 688
719
720 glDisable(GL_TEXTURE_GEN_S); 689 glDisable(GL_TEXTURE_GEN_S);
721 glDisable(GL_TEXTURE_GEN_T); 690 glDisable(GL_TEXTURE_GEN_T);
722 glEnableClientState(GL_TEXTURE_COORD_ARRAY); 691
723
724 // Care about alpha only 692 // Care about alpha only
725 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 693 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
726 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE); 694 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
@@ -736,10 +704,8 @@ void LLDrawPoolTerrain::renderFull2TU()
736 // Stage 1: Write detail1 704 // Stage 1: Write detail1
737 // 705 //
738 LLViewerImage::bindTexture(detail_texture1p,1); // Texture unit 1 706 LLViewerImage::bindTexture(detail_texture1p,1); // Texture unit 1
707 glActiveTextureARB(GL_TEXTURE1_ARB);
739 glEnable(GL_TEXTURE_2D); // Texture unit 1 708 glEnable(GL_TEXTURE_2D); // Texture unit 1
740 glClientActiveTextureARB(GL_TEXTURE1_ARB);
741
742 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
743 glEnable(GL_TEXTURE_GEN_S); 709 glEnable(GL_TEXTURE_GEN_S);
744 glEnable(GL_TEXTURE_GEN_T); 710 glEnable(GL_TEXTURE_GEN_T);
745 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); 711 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@@ -758,6 +724,7 @@ void LLDrawPoolTerrain::renderFull2TU()
758 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS); 724 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS);
759 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); 725 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
760 726
727 glActiveTextureARB(GL_TEXTURE0_ARB);
761 { 728 {
762 LLGLEnable blend(GL_BLEND); 729 LLGLEnable blend(GL_BLEND);
763 drawLoop(); 730 drawLoop();
@@ -769,14 +736,11 @@ void LLDrawPoolTerrain::renderFull2TU()
769 // Stage 0: Generate alpha ramp for detail1/detail2 transition 736 // Stage 0: Generate alpha ramp for detail1/detail2 transition
770 // 737 //
771 LLViewerImage::bindTexture(m2DAlphaRampImagep,0); 738 LLViewerImage::bindTexture(m2DAlphaRampImagep,0);
772 glClientActiveTextureARB(GL_TEXTURE0_ARB);
773 // Set the texture matrix 739 // Set the texture matrix
774 glMatrixMode(GL_TEXTURE); 740 glMatrixMode(GL_TEXTURE);
775 glLoadIdentity(); 741 glLoadIdentity();
776 glTranslatef(-1.f, 0.f, 0.f); 742 glTranslatef(-1.f, 0.f, 0.f);
777 743
778 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
779
780 // Care about alpha only 744 // Care about alpha only
781 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 745 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
782 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE); 746 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
@@ -793,9 +757,7 @@ void LLDrawPoolTerrain::renderFull2TU()
793 757
794 LLViewerImage::bindTexture(detail_texture2p,1); 758 LLViewerImage::bindTexture(detail_texture2p,1);
795 glEnable(GL_TEXTURE_2D); // Texture unit 1 759 glEnable(GL_TEXTURE_2D); // Texture unit 1
796 glClientActiveTextureARB(GL_TEXTURE1_ARB); 760
797
798 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
799 glEnable(GL_TEXTURE_GEN_S); 761 glEnable(GL_TEXTURE_GEN_S);
800 glEnable(GL_TEXTURE_GEN_T); 762 glEnable(GL_TEXTURE_GEN_T);
801 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); 763 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@@ -826,14 +788,11 @@ void LLDrawPoolTerrain::renderFull2TU()
826 // Stage 0: Generate alpha ramp for detail2/detail3 transition 788 // Stage 0: Generate alpha ramp for detail2/detail3 transition
827 // 789 //
828 LLViewerImage::bindTexture(m2DAlphaRampImagep,0); 790 LLViewerImage::bindTexture(m2DAlphaRampImagep,0);
829 glClientActiveTextureARB(GL_TEXTURE0_ARB);
830 // Set the texture matrix 791 // Set the texture matrix
831 glMatrixMode(GL_TEXTURE); 792 glMatrixMode(GL_TEXTURE);
832 glLoadIdentity(); 793 glLoadIdentity();
833 glTranslatef(-2.f, 0.f, 0.f); 794 glTranslatef(-2.f, 0.f, 0.f);
834 795
835 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
836
837 // Care about alpha only 796 // Care about alpha only
838 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); 797 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
839 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE); 798 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
@@ -847,10 +806,8 @@ void LLDrawPoolTerrain::renderFull2TU()
847 // Stage 1: Write detail3 806 // Stage 1: Write detail3
848 807
849 LLViewerImage::bindTexture(detail_texture3p,1); 808 LLViewerImage::bindTexture(detail_texture3p,1);
809 glActiveTextureARB(GL_TEXTURE1_ARB);
850 glEnable(GL_TEXTURE_2D); // Texture unit 1 810 glEnable(GL_TEXTURE_2D); // Texture unit 1
851 glClientActiveTextureARB(GL_TEXTURE1_ARB);
852
853 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
854 glEnable(GL_TEXTURE_GEN_S); 811 glEnable(GL_TEXTURE_GEN_S);
855 glEnable(GL_TEXTURE_GEN_T); 812 glEnable(GL_TEXTURE_GEN_T);
856 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); 813 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@@ -869,6 +826,7 @@ void LLDrawPoolTerrain::renderFull2TU()
869 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS); 826 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS);
870 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); 827 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
871 828
829 glActiveTextureARB(GL_TEXTURE0_ARB);
872 { 830 {
873 LLGLEnable blend(GL_BLEND); 831 LLGLEnable blend(GL_BLEND);
874 drawLoop(); 832 drawLoop();
@@ -879,8 +837,7 @@ void LLDrawPoolTerrain::renderFull2TU()
879 837
880 // Disable multitexture 838 // Disable multitexture
881 LLImageGL::unbindTexture(1, GL_TEXTURE_2D); 839 LLImageGL::unbindTexture(1, GL_TEXTURE_2D);
882 glClientActiveTextureARB(GL_TEXTURE1_ARB); 840 glActiveTextureARB(GL_TEXTURE1_ARB);
883 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
884 glDisable(GL_TEXTURE_2D); // Texture unit 1 841 glDisable(GL_TEXTURE_2D); // Texture unit 1
885 glDisable(GL_TEXTURE_GEN_S); 842 glDisable(GL_TEXTURE_GEN_S);
886 glDisable(GL_TEXTURE_GEN_T); 843 glDisable(GL_TEXTURE_GEN_T);
@@ -891,9 +848,9 @@ void LLDrawPoolTerrain::renderFull2TU()
891 //---------------------------------------------------------------------------- 848 //----------------------------------------------------------------------------
892 // Restore Texture Unit 0 defaults 849 // Restore Texture Unit 0 defaults
893 850
851 glActiveTextureARB(GL_TEXTURE0_ARB);
894 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 852 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
895 853
896 glClientActiveTextureARB(GL_TEXTURE0_ARB);
897 glActiveTextureARB(GL_TEXTURE0_ARB); 854 glActiveTextureARB(GL_TEXTURE0_ARB);
898 glDisable(GL_TEXTURE_GEN_S); 855 glDisable(GL_TEXTURE_GEN_S);
899 glDisable(GL_TEXTURE_GEN_T); 856 glDisable(GL_TEXTURE_GEN_T);
@@ -902,16 +859,12 @@ void LLDrawPoolTerrain::renderFull2TU()
902 glMatrixMode(GL_MODELVIEW); 859 glMatrixMode(GL_MODELVIEW);
903 860
904 // Restore non Texture Unit specific defaults 861 // Restore non Texture Unit specific defaults
905 glDisableClientState(GL_NORMAL_ARRAY);
906 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 862 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
907} 863}
908 864
909 865
910void LLDrawPoolTerrain::renderSimple() 866void LLDrawPoolTerrain::renderSimple()
911{ 867{
912 glEnableClientState(GL_VERTEX_ARRAY);
913 glEnableClientState(GL_NORMAL_ARRAY);
914
915 LLVector4 tp0, tp1; 868 LLVector4 tp0, tp1;
916 869
917 //---------------------------------------------------------------------------- 870 //----------------------------------------------------------------------------
@@ -923,14 +876,12 @@ void LLDrawPoolTerrain::renderSimple()
923 876
924 glActiveTextureARB(GL_TEXTURE0_ARB); 877 glActiveTextureARB(GL_TEXTURE0_ARB);
925 glEnable(GL_TEXTURE_2D); // Texture unit 2 878 glEnable(GL_TEXTURE_2D); // Texture unit 2
926 glClientActiveTextureARB(GL_TEXTURE0_ARB); 879
927
928 LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent(); 880 LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
929 F32 tscale = 1.f/256.f; 881 F32 tscale = 1.f/256.f;
930 tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f)); 882 tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f));
931 tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f)); 883 tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f));
932 884
933 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
934 glEnable(GL_TEXTURE_GEN_S); 885 glEnable(GL_TEXTURE_GEN_S);
935 glEnable(GL_TEXTURE_GEN_T); 886 glEnable(GL_TEXTURE_GEN_T);
936 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); 887 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
@@ -952,7 +903,6 @@ void LLDrawPoolTerrain::renderSimple()
952 // Restore Texture Unit 0 defaults 903 // Restore Texture Unit 0 defaults
953 904
954 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 905 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
955 glClientActiveTextureARB(GL_TEXTURE0_ARB);
956 glActiveTextureARB(GL_TEXTURE0_ARB); 906 glActiveTextureARB(GL_TEXTURE0_ARB);
957 glDisable(GL_TEXTURE_GEN_S); 907 glDisable(GL_TEXTURE_GEN_S);
958 glDisable(GL_TEXTURE_GEN_T); 908 glDisable(GL_TEXTURE_GEN_T);
@@ -961,7 +911,6 @@ void LLDrawPoolTerrain::renderSimple()
961 glMatrixMode(GL_MODELVIEW); 911 glMatrixMode(GL_MODELVIEW);
962 912
963 // Restore non Texture Unit specific defaults 913 // Restore non Texture Unit specific defaults
964 glDisableClientState(GL_NORMAL_ARRAY);
965 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 914 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
966} 915}
967 916
@@ -986,14 +935,8 @@ void LLDrawPoolTerrain::renderOwnership()
986 LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay(); 935 LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay();
987 LLImageGL *texturep = overlayp->getTexture(); 936 LLImageGL *texturep = overlayp->getTexture();
988 937
989 glEnableClientState(GL_VERTEX_ARRAY);
990 glDisableClientState(GL_NORMAL_ARRAY);
991
992 LLViewerImage::bindTexture(texturep); 938 LLViewerImage::bindTexture(texturep);
993 939
994 glClientActiveTextureARB(GL_TEXTURE0_ARB);
995 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
996
997 // *NOTE: Because the region is 256 meters wide, but has 257 pixels, the 940 // *NOTE: Because the region is 256 meters wide, but has 257 pixels, the
998 // texture coordinates for pixel 256x256 is not 1,1. This makes the 941 // texture coordinates for pixel 256x256 is not 1,1. This makes the
999 // ownership map not line up with the selection. We address this with 942 // ownership map not line up with the selection. We address this with
@@ -1014,9 +957,6 @@ void LLDrawPoolTerrain::renderOwnership()
1014 glMatrixMode(GL_TEXTURE); 957 glMatrixMode(GL_TEXTURE);
1015 glPopMatrix(); 958 glPopMatrix();
1016 glMatrixMode(GL_MODELVIEW); 959 glMatrixMode(GL_MODELVIEW);
1017
1018 // Restore non Texture Unit specific defaults
1019 glDisableClientState(GL_NORMAL_ARRAY);
1020} 960}
1021 961
1022 962
diff --git a/linden/indra/newview/lldrawpooltree.cpp b/linden/indra/newview/lldrawpooltree.cpp
index fd1ca8e..fd0a83c 100644
--- a/linden/indra/newview/lldrawpooltree.cpp
+++ b/linden/indra/newview/lldrawpooltree.cpp
@@ -67,9 +67,6 @@ void LLDrawPoolTree::prerender()
67void LLDrawPoolTree::beginRenderPass(S32 pass) 67void LLDrawPoolTree::beginRenderPass(S32 pass)
68{ 68{
69 LLFastTimer t(LLFastTimer::FTM_RENDER_TREES); 69 LLFastTimer t(LLFastTimer::FTM_RENDER_TREES);
70 glEnableClientState(GL_VERTEX_ARRAY);
71 glEnableClientState(GL_NORMAL_ARRAY);
72 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
73 glAlphaFunc(GL_GREATER, 0.5f); 70 glAlphaFunc(GL_GREATER, 0.5f);
74 71
75 if (LLPipeline::sUnderWaterRender) 72 if (LLPipeline::sUnderWaterRender)
@@ -110,9 +107,7 @@ void LLDrawPoolTree::endRenderPass(S32 pass)
110{ 107{
111 LLFastTimer t(LLFastTimer::FTM_RENDER_TREES); 108 LLFastTimer t(LLFastTimer::FTM_RENDER_TREES);
112 glAlphaFunc(GL_GREATER, 0.01f); 109 glAlphaFunc(GL_GREATER, 0.01f);
113 glDisableClientState(GL_NORMAL_ARRAY); 110
114 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
115
116 if (gPipeline.canUseWindLightShadersOnObjects()) 111 if (gPipeline.canUseWindLightShadersOnObjects())
117 { 112 {
118 shader->unbind(); 113 shader->unbind();
@@ -126,9 +121,6 @@ void LLDrawPoolTree::renderForSelect()
126 return; 121 return;
127 } 122 }
128 123
129 glEnableClientState (GL_VERTEX_ARRAY);
130 glEnableClientState (GL_TEXTURE_COORD_ARRAY);
131
132 LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f); 124 LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
133 125
134 LLGLSObjectSelectAlpha gls_alpha; 126 LLGLSObjectSelectAlpha gls_alpha;
@@ -155,7 +147,6 @@ void LLDrawPoolTree::renderForSelect()
155 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 147 gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
156 148
157 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 149 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
158 glDisableClientState (GL_TEXTURE_COORD_ARRAY);
159} 150}
160 151
161void LLDrawPoolTree::renderTree(BOOL selecting) 152void LLDrawPoolTree::renderTree(BOOL selecting)
@@ -278,8 +269,6 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
278 //glPopMatrix(); 269 //glPopMatrix();
279 } 270 }
280 } 271 }
281
282 addIndicesDrawn(indices_drawn);
283} 272}
284 273
285BOOL LLDrawPoolTree::verify() const 274BOOL LLDrawPoolTree::verify() const
diff --git a/linden/indra/newview/lldrawpoolwater.cpp b/linden/indra/newview/lldrawpoolwater.cpp
index 922a5d8..231d0e1 100644
--- a/linden/indra/newview/lldrawpoolwater.cpp
+++ b/linden/indra/newview/lldrawpoolwater.cpp
@@ -163,17 +163,11 @@ void LLDrawPoolWater::render(S32 pass)
163 163
164 LLGLDisable cullFace(GL_CULL_FACE); 164 LLGLDisable cullFace(GL_CULL_FACE);
165 165
166 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
167 glEnableClientState(GL_VERTEX_ARRAY);
168 glEnableClientState(GL_NORMAL_ARRAY);
169
170 // Set up second pass first 166 // Set up second pass first
171 glActiveTextureARB(GL_TEXTURE1_ARB);
172 mWaterImagep->addTextureStats(1024.f*1024.f); 167 mWaterImagep->addTextureStats(1024.f*1024.f);
173 mWaterImagep->bind(1); 168 mWaterImagep->bind(1);
174 169 glActiveTextureARB(GL_TEXTURE1_ARB);
175 glClientActiveTextureARB(GL_TEXTURE1_ARB); 170
176 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
177 glEnable(GL_TEXTURE_2D); // Texture unit 1 171 glEnable(GL_TEXTURE_2D); // Texture unit 1
178 172
179 LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); 173 LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
@@ -215,7 +209,6 @@ void LLDrawPoolWater::render(S32 pass)
215 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB); 209 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB);
216 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA); 210 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
217 211
218 glClientActiveTextureARB(GL_TEXTURE0_ARB);
219 glActiveTextureARB(GL_TEXTURE0_ARB); 212 glActiveTextureARB(GL_TEXTURE0_ARB);
220 213
221 glClearStencil(1); 214 glClearStencil(1);
@@ -234,11 +227,9 @@ void LLDrawPoolWater::render(S32 pass)
234 } 227 }
235 face->bindTexture(); 228 face->bindTexture();
236 face->renderIndexed(); 229 face->renderIndexed();
237 mIndicesDrawn += face->getIndicesCount();
238 } 230 }
239 231
240 // Now, disable texture coord generation on texture state 1 232 // Now, disable texture coord generation on texture state 1
241 glClientActiveTextureARB(GL_TEXTURE1_ARB);
242 glActiveTextureARB(GL_TEXTURE1_ARB); 233 glActiveTextureARB(GL_TEXTURE1_ARB);
243 glDisable(GL_TEXTURE_2D); // Texture unit 1 234 glDisable(GL_TEXTURE_2D); // Texture unit 1
244 glDisable(GL_TEXTURE_GEN_S); //texture unit 1 235 glDisable(GL_TEXTURE_GEN_S); //texture unit 1
@@ -246,11 +237,9 @@ void LLDrawPoolWater::render(S32 pass)
246 LLImageGL::unbindTexture(1, GL_TEXTURE_2D); 237 LLImageGL::unbindTexture(1, GL_TEXTURE_2D);
247 238
248 // Disable texture coordinate and color arrays 239 // Disable texture coordinate and color arrays
249 glClientActiveTextureARB(GL_TEXTURE0_ARB);
250 glActiveTextureARB(GL_TEXTURE0_ARB); 240 glActiveTextureARB(GL_TEXTURE0_ARB);
251 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 241 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
252 242
253 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
254 stop_glerror(); 243 stop_glerror();
255 244
256 if (gSky.mVOSkyp->getCubeMap()) 245 if (gSky.mVOSkyp->getCubeMap())
@@ -284,7 +273,6 @@ void LLDrawPoolWater::render(S32 pass)
284 if (face->getGeomCount() > 0) 273 if (face->getGeomCount() > 0)
285 { 274 {
286 face->renderIndexed(); 275 face->renderIndexed();
287 mIndicesDrawn += face->getIndicesCount();
288 } 276 }
289 } 277 }
290 278
@@ -310,9 +298,6 @@ void LLDrawPoolWater::render(S32 pass)
310 renderReflection(refl_face); 298 renderReflection(refl_face);
311 } 299 }
312 300
313 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
314 glDisableClientState(GL_NORMAL_ARRAY);
315
316 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 301 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
317} 302}
318 303
@@ -338,16 +323,10 @@ void LLDrawPoolWater::renderReflection(LLFace* face)
338 323
339 LLGLSNoFog noFog; 324 LLGLSNoFog noFog;
340 325
341 glEnableClientState(GL_VERTEX_ARRAY);
342 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
343
344 LLViewerImage::bindTexture(mHBTex[dr]); 326 LLViewerImage::bindTexture(mHBTex[dr]);
345 327
346 LLOverrideFaceColor override(this, face->getFaceColor().mV); 328 LLOverrideFaceColor override(this, face->getFaceColor().mV);
347 face->renderIndexed(); 329 face->renderIndexed();
348 mIndicesDrawn += face->getIndicesCount();
349
350 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
351} 330}
352 331
353void LLDrawPoolWater::shade() 332void LLDrawPoolWater::shade()
@@ -361,10 +340,6 @@ void LLDrawPoolWater::shade()
361 return; 340 return;
362 } 341 }
363 342
364 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
365 glEnableClientState(GL_VERTEX_ARRAY);
366 glEnableClientState(GL_NORMAL_ARRAY);
367
368 LLGLDisable blend(GL_BLEND); 343 LLGLDisable blend(GL_BLEND);
369 344
370 LLColor3 light_diffuse(0,0,0); 345 LLColor3 light_diffuse(0,0,0);
@@ -562,8 +537,6 @@ void LLDrawPoolWater::shade()
562 face->renderIndexed(); 537 face->renderIndexed();
563 } 538 }
564 } 539 }
565
566 mIndicesDrawn += face->getIndicesCount();
567 } 540 }
568 } 541 }
569 542
@@ -576,8 +549,6 @@ void LLDrawPoolWater::shade()
576 shader->unbind(); 549 shader->unbind();
577 550
578 glActiveTextureARB(GL_TEXTURE0_ARB); 551 glActiveTextureARB(GL_TEXTURE0_ARB);
579 glClientActiveTextureARB(GL_TEXTURE0_ARB);
580 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
581 glEnable(GL_TEXTURE_2D); 552 glEnable(GL_TEXTURE_2D);
582 glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE); 553 glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE);
583 554
diff --git a/linden/indra/newview/lldrawpoolwlsky.cpp b/linden/indra/newview/lldrawpoolwlsky.cpp
index d18f0de..e10cd0a 100644
--- a/linden/indra/newview/lldrawpoolwlsky.cpp
+++ b/linden/indra/newview/lldrawpoolwlsky.cpp
@@ -159,9 +159,7 @@ void LLDrawPoolWLSky::renderStars(void) const
159 // combiners blending below requires something to be bound 159 // combiners blending below requires something to be bound
160 // and we might as well only bind once. 160 // and we might as well only bind once.
161 //LLGLEnable gl_texture_2d(GL_TEXTURE_2D); 161 //LLGLEnable gl_texture_2d(GL_TEXTURE_2D);
162 glDisableClientState(GL_TEXTURE_COORD_ARRAY); 162
163 glDisableClientState(GL_NORMAL_ARRAY);
164
165 gPipeline.disableLights(); 163 gPipeline.disableLights();
166 164
167 if (!LLPipeline::sReflectionRender) 165 if (!LLPipeline::sReflectionRender)
@@ -224,9 +222,6 @@ void LLDrawPoolWLSky::renderSkyClouds(F32 camHeightLocal) const
224 222
225void LLDrawPoolWLSky::renderHeavenlyBodies() 223void LLDrawPoolWLSky::renderHeavenlyBodies()
226{ 224{
227 glEnableClientState(GL_VERTEX_ARRAY);
228 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
229 glDisableClientState(GL_NORMAL_ARRAY);
230 LLGLSPipelineSkyBox gls_skybox; 225 LLGLSPipelineSkyBox gls_skybox;
231 LLGLEnable blend_on(GL_BLEND); 226 LLGLEnable blend_on(GL_BLEND);
232 gPipeline.disableLights(); 227 gPipeline.disableLights();
@@ -240,7 +235,6 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
240 LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); 235 LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor());
241 LLFacePool::LLOverrideFaceColor color_override(this, color); 236 LLFacePool::LLOverrideFaceColor color_override(this, color);
242 face->renderIndexed(); 237 face->renderIndexed();
243 mIndicesDrawn += face->getIndicesCount();
244 } 238 }
245#endif 239#endif
246 240
@@ -264,10 +258,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
264 258
265 LLFacePool::LLOverrideFaceColor color_override(this, color); 259 LLFacePool::LLOverrideFaceColor color_override(this, color);
266 face->renderIndexed(); 260 face->renderIndexed();
267 mIndicesDrawn += face->getIndicesCount();
268 } 261 }
269
270 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
271} 262}
272 263
273void LLDrawPoolWLSky::render(S32 pass) 264void LLDrawPoolWLSky::render(S32 pass)
diff --git a/linden/indra/newview/llface.cpp b/linden/indra/newview/llface.cpp
index 0c8de14..f480d8d 100644
--- a/linden/indra/newview/llface.cpp
+++ b/linden/indra/newview/llface.cpp
@@ -263,8 +263,14 @@ void LLFace::setDrawable(LLDrawable *drawable)
263 263
264void LLFace::setSize(const S32 num_vertices, const S32 num_indices) 264void LLFace::setSize(const S32 num_vertices, const S32 num_indices)
265{ 265{
266 mGeomCount = num_vertices; 266 if (mGeomCount != num_vertices ||
267 mIndicesCount = num_indices; 267 mIndicesCount != num_indices)
268 {
269 mGeomCount = num_vertices;
270 mIndicesCount = num_indices;
271 mVertexBuffer = NULL;
272 mLastVertexBuffer = NULL;
273 }
268} 274}
269 275
270//============================================================================ 276//============================================================================
@@ -368,8 +374,6 @@ void LLFace::renderForSelect(U32 data_mask)
368#if !LL_RELEASE_FOR_DOWNLOAD 374#if !LL_RELEASE_FOR_DOWNLOAD
369 LLGLState::checkClientArrays(data_mask); 375 LLGLState::checkClientArrays(data_mask);
370#endif 376#endif
371 U16* indicesp = (U16*) mVertexBuffer->getIndicesPointer() + mIndicesIndex;
372
373 if (gPickFaces && mTEOffset != -1) 377 if (gPickFaces && mTEOffset != -1)
374 { 378 {
375 // mask off high 4 bits (16 total possible faces) 379 // mask off high 4 bits (16 total possible faces)
@@ -386,40 +390,26 @@ void LLFace::renderForSelect(U32 data_mask)
386 { 390 {
387 glPushMatrix(); 391 glPushMatrix();
388 glMultMatrixf((float*) mDrawablep->getRegion()->mRenderMatrix.mMatrix); 392 glMultMatrixf((float*) mDrawablep->getRegion()->mRenderMatrix.mMatrix);
389 glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, indicesp); 393 mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex);
390 glPopMatrix(); 394 glPopMatrix();
391 } 395 }
392 else 396 else
393 { 397 {
394 glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, indicesp); 398 mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex);
395 } 399 }
396 } 400 }
397 else 401 else
398 { 402 {
399 glPushMatrix(); 403 glPushMatrix();
400 glMultMatrixf((float*)getRenderMatrix().mMatrix); 404 glMultMatrixf((float*)getRenderMatrix().mMatrix);
401 glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, indicesp); 405 mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex);
402 glPopMatrix();
403 }
404 }
405 else if (mGeomCount > 0)
406 {
407 if (isState(GLOBAL))
408 {
409 glDrawArrays(GL_TRIANGLES, mGeomIndex, mGeomCount);
410 }
411 else
412 {
413 glPushMatrix();
414 glMultMatrixf((float*)getRenderMatrix().mMatrix);
415 glDrawArrays(GL_TRIANGLES, mGeomIndex, mGeomCount);
416 glPopMatrix(); 406 glPopMatrix();
417 } 407 }
418 } 408 }
419 } 409 }
420} 410}
421 411
422void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color, const S32 offset, const S32 count) 412void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color)
423{ 413{
424 if(mDrawablep.isNull() || mVertexBuffer.isNull()) 414 if(mDrawablep.isNull() || mVertexBuffer.isNull())
425 { 415 {
@@ -443,27 +433,12 @@ void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color, const S32
443 glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); 433 glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix);
444 } 434 }
445 435
446 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
447 glEnableClientState(GL_VERTEX_ARRAY);
448 glEnableClientState(GL_NORMAL_ARRAY);
449
450 mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD); 436 mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD);
451#if !LL_RELEASE_FOR_DOWNLOAD 437#if !LL_RELEASE_FOR_DOWNLOAD
452 LLGLState::checkClientArrays(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD); 438 LLGLState::checkClientArrays(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD);
453#endif 439#endif
454 U16* indicesp = ((U16*) mVertexBuffer->getIndicesPointer()) + mIndicesIndex; 440 mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, mIndicesCount, mIndicesIndex);
455 441
456 if (count)
457 {
458 glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, indicesp + offset);
459 }
460 else
461 {
462 glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, indicesp);
463 }
464 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
465 glDisableClientState(GL_NORMAL_ARRAY);
466
467 glPopMatrix(); 442 glPopMatrix();
468 } 443 }
469} 444}
@@ -542,8 +517,6 @@ void LLFace::renderSelectedUV(const S32 offset, const S32 count)
542 } 517 }
543 else 518 else
544 { 519 {
545 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
546 glEnableClientState(GL_VERTEX_ARRAY);
547 llassert(mGeomIndex >= 0); 520 llassert(mGeomIndex >= 0);
548 if (count) 521 if (count)
549 { 522 {
@@ -568,7 +541,6 @@ void LLFace::renderSelectedUV(const S32 offset, const S32 count)
568 glDrawArrays(GL_TRIANGLES, mGeomIndex, mGeomCount); 541 glDrawArrays(GL_TRIANGLES, mGeomIndex, mGeomCount);
569 } 542 }
570 } 543 }
571 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
572 } 544 }
573 545
574 glDisable(GL_POLYGON_OFFSET_FILL); 546 glDisable(GL_POLYGON_OFFSET_FILL);
@@ -1251,16 +1223,7 @@ S32 LLFace::pushVertices(const U16* index_array) const
1251{ 1223{
1252 if (mIndicesCount) 1224 if (mIndicesCount)
1253 { 1225 {
1254 if (mGeomCount <= gGLManager.mGLMaxVertexRange && 1226 mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex);
1255 mIndicesCount <= (U32) gGLManager.mGLMaxIndexRange)
1256 {
1257 glDrawRangeElements(GL_TRIANGLES, mGeomIndex, mGeomIndex + mGeomCount-1, mIndicesCount,
1258 GL_UNSIGNED_SHORT, index_array + mIndicesIndex);
1259 }
1260 else
1261 {
1262 glDrawElements(GL_TRIANGLES, mIndicesCount, GL_UNSIGNED_SHORT, index_array+mIndicesIndex);
1263 }
1264 gPipeline.addTrianglesDrawn(mIndicesCount/3); 1227 gPipeline.addTrianglesDrawn(mIndicesCount/3);
1265 } 1228 }
1266 1229
diff --git a/linden/indra/newview/llface.h b/linden/indra/newview/llface.h
index 4454bd6..f04d221 100644
--- a/linden/indra/newview/llface.h
+++ b/linden/indra/newview/llface.h
@@ -167,7 +167,7 @@ public:
167 void renderSelectedUV(const S32 offset = 0, const S32 count = 0); 167 void renderSelectedUV(const S32 offset = 0, const S32 count = 0);
168 168
169 void renderForSelect(U32 data_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD); 169 void renderForSelect(U32 data_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD);
170 void renderSelected(LLImageGL *image, const LLColor4 &color, const S32 offset = 0, const S32 count = 0); 170 void renderSelected(LLImageGL *image, const LLColor4 &color);
171 171
172 F32 getKey() const { return mDistance; } 172 F32 getKey() const { return mDistance; }
173 173
diff --git a/linden/indra/newview/llflexibleobject.cpp b/linden/indra/newview/llflexibleobject.cpp
index fe7fafa..ec49c1a 100644
--- a/linden/indra/newview/llflexibleobject.cpp
+++ b/linden/indra/newview/llflexibleobject.cpp
@@ -195,7 +195,7 @@ void LLVolumeImplFlexible::remapSections(LLFlexibleObjectSection *source, S32 so
195 195
196 196
197//----------------------------------------------------------------------------- 197//-----------------------------------------------------------------------------
198void LLVolumeImplFlexible::setAttributesOfAllSections() 198void LLVolumeImplFlexible::setAttributesOfAllSections(LLVector3* inScale)
199{ 199{
200 LLVector2 bottom_scale, top_scale; 200 LLVector2 bottom_scale, top_scale;
201 F32 begin_rot = 0, end_rot = 0; 201 F32 begin_rot = 0, end_rot = 0;
@@ -215,8 +215,16 @@ void LLVolumeImplFlexible::setAttributesOfAllSections()
215 215
216 S32 num_sections = 1 << mSimulateRes; 216 S32 num_sections = 1 << mSimulateRes;
217 217
218 LLVector3 scale = mVO->mDrawable->getScale(); 218 LLVector3 scale;
219 219 if (inScale == (LLVector3*)NULL)
220 {
221 scale = mVO->mDrawable->getScale();
222 }
223 else
224 {
225 scale = *inScale;
226 }
227
220 mSection[0].mPosition = getAnchorPosition(); 228 mSection[0].mPosition = getAnchorPosition();
221 mSection[0].mDirection = LLVector3::z_axis * getFrameRotation(); 229 mSection[0].mDirection = LLVector3::z_axis * getFrameRotation();
222 mSection[0].mdPosition = mSection[0].mDirection; 230 mSection[0].mdPosition = mSection[0].mDirection;
@@ -297,7 +305,7 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6
297 new_res = mRenderRes; 305 new_res = mRenderRes;
298 } 306 }
299 307
300 if (!mInitialized || (mSimulateRes != new_res)) 308 if (!mInitialized)
301 { 309 {
302 mSimulateRes = new_res; 310 mSimulateRes = new_res;
303 setAttributesOfAllSections(); 311 setAttributesOfAllSections();
@@ -644,7 +652,7 @@ void LLVolumeImplFlexible::doFlexibleRebuild()
644 652
645void LLVolumeImplFlexible::onSetScale(const LLVector3& scale, BOOL damped) 653void LLVolumeImplFlexible::onSetScale(const LLVector3& scale, BOOL damped)
646{ 654{
647 setAttributesOfAllSections(); 655 setAttributesOfAllSections((LLVector3*) &scale);
648} 656}
649 657
650BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) 658BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
diff --git a/linden/indra/newview/llflexibleobject.h b/linden/indra/newview/llflexibleobject.h
index f6e68fc..843a8f8 100644
--- a/linden/indra/newview/llflexibleobject.h
+++ b/linden/indra/newview/llflexibleobject.h
@@ -138,7 +138,7 @@ class LLVolumeImplFlexible : public LLVolumeInterface
138 //-------------------------------------- 138 //--------------------------------------
139 // private methods 139 // private methods
140 //-------------------------------------- 140 //--------------------------------------
141 void setAttributesOfAllSections (); 141 void setAttributesOfAllSections (LLVector3* inScale = NULL);
142 142
143 void remapSections(LLFlexibleObjectSection *source, S32 source_sections, 143 void remapSections(LLFlexibleObjectSection *source, S32 source_sections,
144 LLFlexibleObjectSection *dest, S32 dest_sections); 144 LLFlexibleObjectSection *dest, S32 dest_sections);
diff --git a/linden/indra/newview/llfloateranimpreview.cpp b/linden/indra/newview/llfloateranimpreview.cpp
index 6892b8d..1ea0495 100644
--- a/linden/indra/newview/llfloateranimpreview.cpp
+++ b/linden/indra/newview/llfloateranimpreview.cpp
@@ -293,7 +293,6 @@ BOOL LLFloaterAnimPreview::postBuild()
293 mAnimPreview = NULL; 293 mAnimPreview = NULL;
294 mMotionID.setNull(); 294 mMotionID.setNull();
295 childSetValue("bad_animation_text", getString("failed_to_initialize")); 295 childSetValue("bad_animation_text", getString("failed_to_initialize"));
296 setEnabled(FALSE);
297 } 296 }
298 } 297 }
299 else 298 else
diff --git a/linden/indra/newview/llfloaterauction.cpp b/linden/indra/newview/llfloaterauction.cpp
index 6b1c3e0..7affff6 100644
--- a/linden/indra/newview/llfloaterauction.cpp
+++ b/linden/indra/newview/llfloaterauction.cpp
@@ -53,6 +53,7 @@
53#include "llviewerdisplay.h" 53#include "llviewerdisplay.h"
54#include "llviewercontrol.h" 54#include "llviewercontrol.h"
55#include "llui.h" 55#include "llui.h"
56#include "llglimmediate.h"
56 57
57///---------------------------------------------------------------------------- 58///----------------------------------------------------------------------------
58/// Local function declarations, constants, enums, and typedefs 59/// Local function declarations, constants, enums, and typedefs
@@ -153,7 +154,7 @@ void LLFloaterAuction::draw()
153 } 154 }
154 { 155 {
155 LLGLSUIDefault gls_ui; 156 LLGLSUIDefault gls_ui;
156 glColor3f(1.f, 1.f, 1.f); 157 gGL.color3f(1.f, 1.f, 1.f);
157 gl_draw_scaled_image(rect.mLeft, 158 gl_draw_scaled_image(rect.mLeft,
158 rect.mBottom, 159 rect.mBottom,
159 rect.getWidth(), 160 rect.getWidth(),
diff --git a/linden/indra/newview/llfloaterhud.cpp b/linden/indra/newview/llfloaterhud.cpp
index 2f192f7..d93e36a 100644
--- a/linden/indra/newview/llfloaterhud.cpp
+++ b/linden/indra/newview/llfloaterhud.cpp
@@ -51,16 +51,20 @@ LLFloaterHUD::LLFloaterHUD()
51: LLFloater("floater_hud"), 51: LLFloater("floater_hud"),
52 mWebBrowser(0) 52 mWebBrowser(0)
53{ 53{
54 // Create floater from its XML definition
55 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hud.xml");
56
54 // Don't grab the focus as it will impede performing in-world actions 57 // Don't grab the focus as it will impede performing in-world actions
55 // while using the HUD 58 // while using the HUD
56 setAutoFocus(FALSE); 59 setIsChrome(TRUE);
60
61 // Chrome doesn't show the window title by default, but here we
62 // want to show it.
63 setTitleVisible(true);
57 64
58 // Opaque background since we never get the focus 65 // Opaque background since we never get the focus
59 setBackgroundOpaque(TRUE); 66 setBackgroundOpaque(TRUE);
60 67
61 // Create floater from its XML definition
62 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hud.xml");
63
64 // Position floater based on saved location 68 // Position floater based on saved location
65 LLRect saved_position_rect = gSavedSettings.getRect("FloaterHUDRect"); 69 LLRect saved_position_rect = gSavedSettings.getRect("FloaterHUDRect");
66 reshape(saved_position_rect.getWidth(), saved_position_rect.getHeight(), FALSE); 70 reshape(saved_position_rect.getWidth(), saved_position_rect.getHeight(), FALSE);
@@ -69,12 +73,14 @@ LLFloaterHUD::LLFloaterHUD()
69 mWebBrowser = getChild<LLWebBrowserCtrl>("floater_hud_browser" ); 73 mWebBrowser = getChild<LLWebBrowserCtrl>("floater_hud_browser" );
70 if (mWebBrowser) 74 if (mWebBrowser)
71 { 75 {
72 // Always refresh the browser
73 mWebBrowser->setAlwaysRefresh(true);
74
75 // Open links in internal browser 76 // Open links in internal browser
76 mWebBrowser->setOpenInExternalBrowser(false); 77 mWebBrowser->setOpenInExternalBrowser(false);
77 78
79 // This is a "chrome" floater, so we don't want anything to
80 // take focus (as the user needs to be able to walk with
81 // arrow keys during tutorial).
82 mWebBrowser->setTakeFocusOnClick(false);
83
78 LLString language(gSavedSettings.getString("Language")); 84 LLString language(gSavedSettings.getString("Language"));
79 if(language == "default") 85 if(language == "default")
80 { 86 {
@@ -132,9 +138,3 @@ void LLFloaterHUD::close()
132{ 138{
133 if (sInstance) sInstance->close(); 139 if (sInstance) sInstance->close();
134} 140}
135
136void LLFloaterHUD::onFocusReceived()
137{
138 // Never get the focus
139 setFocus(FALSE);
140}
diff --git a/linden/indra/newview/llfloaterhud.h b/linden/indra/newview/llfloaterhud.h
index bd60d7b..95c0f8d 100644
--- a/linden/indra/newview/llfloaterhud.h
+++ b/linden/indra/newview/llfloaterhud.h
@@ -58,7 +58,7 @@ protected:
58 LLWebBrowserCtrl* mWebBrowser; ///< the actual web browser control 58 LLWebBrowserCtrl* mWebBrowser; ///< the actual web browser control
59 59
60 LLFloaterHUD(); ///< default constructor 60 LLFloaterHUD(); ///< default constructor
61 virtual void onFocusReceived(); ///< called when we get the focus 61
62private: 62private:
63 static LLFloaterHUD* sInstance; 63 static LLFloaterHUD* sInstance;
64}; 64};
diff --git a/linden/indra/newview/llmemoryview.cpp b/linden/indra/newview/llmemoryview.cpp
index c7a929d..a19328a 100644
--- a/linden/indra/newview/llmemoryview.cpp
+++ b/linden/indra/newview/llmemoryview.cpp
@@ -121,6 +121,8 @@ static const struct mtv_display_info mtv_display_table[] =
121 { LLMemType::MTYPE_VERTEX_DATA, "Vertex Buffer", &LLColor4::blue3 }, 121 { LLMemType::MTYPE_VERTEX_DATA, "Vertex Buffer", &LLColor4::blue3 },
122 { LLMemType::MTYPE_AVATAR, "Avatar", &LLColor4::purple1 }, 122 { LLMemType::MTYPE_AVATAR, "Avatar", &LLColor4::purple1 },
123 { LLMemType::MTYPE_REGIONS, "Regions", &LLColor4::blue1 }, 123 { LLMemType::MTYPE_REGIONS, "Regions", &LLColor4::blue1 },
124 { LLMemType::MTYPE_VOLUME, "Volume", &LLColor4::pink1 },
125 { LLMemType::MTYPE_PRIMITIVE, "Profile", &LLColor4::pink2 },
124 { LLMemType::MTYPE_TEMP1, "Temp1", &LLColor4::red1 }, 126 { LLMemType::MTYPE_TEMP1, "Temp1", &LLColor4::red1 },
125 { LLMemType::MTYPE_TEMP2, "Temp2", &LLColor4::magenta1 }, 127 { LLMemType::MTYPE_TEMP2, "Temp2", &LLColor4::magenta1 },
126 { LLMemType::MTYPE_TEMP3, "Temp3", &LLColor4::red2 }, 128 { LLMemType::MTYPE_TEMP3, "Temp3", &LLColor4::red2 },
diff --git a/linden/indra/newview/llpanellogin.cpp b/linden/indra/newview/llpanellogin.cpp
index f403271..9fcd73d 100644
--- a/linden/indra/newview/llpanellogin.cpp
+++ b/linden/indra/newview/llpanellogin.cpp
@@ -951,6 +951,7 @@ void LLPanelLogin::loadLoginPage()
951 { 951 {
952 LLAppViewer::instance()->resetURIs(); 952 LLAppViewer::instance()->resetURIs();
953 gGridChoice = (EGridInfo)grid_index; 953 gGridChoice = (EGridInfo)grid_index;
954 gSavedSettings.setString("GridChoice", gGridInfo[gGridChoice].mLabel);
954 gViewerWindow->setMenuBackgroundColor(false, 955 gViewerWindow->setMenuBackgroundColor(false,
955 !LLAppViewer::instance()->isInProductionGrid()); 956 !LLAppViewer::instance()->isInProductionGrid());
956 gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor()); 957 gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
diff --git a/linden/indra/newview/llpostprocess.cpp b/linden/indra/newview/llpostprocess.cpp
index 11a211a..c72b8ae 100644
--- a/linden/indra/newview/llpostprocess.cpp
+++ b/linden/indra/newview/llpostprocess.cpp
@@ -215,7 +215,6 @@ void LLPostProcess::applyColorFilterShader(void)
215{ 215{
216 gPostColorFilterProgram.bind(); 216 gPostColorFilterProgram.bind();
217 217
218 glClientActiveTextureARB(GL_TEXTURE0_ARB);
219 glActiveTextureARB(GL_TEXTURE0_ARB); 218 glActiveTextureARB(GL_TEXTURE0_ARB);
220 glEnable(GL_TEXTURE_RECTANGLE_ARB); 219 glEnable(GL_TEXTURE_RECTANGLE_ARB);
221 220
@@ -258,7 +257,6 @@ void LLPostProcess::applyNightVisionShader(void)
258{ 257{
259 gPostNightVisionProgram.bind(); 258 gPostNightVisionProgram.bind();
260 259
261 glClientActiveTextureARB(GL_TEXTURE0_ARB);
262 glActiveTextureARB(GL_TEXTURE0_ARB); 260 glActiveTextureARB(GL_TEXTURE0_ARB);
263 glEnable(GL_TEXTURE_RECTANGLE_ARB); 261 glEnable(GL_TEXTURE_RECTANGLE_ARB);
264 262
@@ -266,7 +264,6 @@ void LLPostProcess::applyNightVisionShader(void)
266 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, sceneRenderTexture); 264 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, sceneRenderTexture);
267 glUniform1iARB(nightVisionUniforms["RenderTexture"], 0); 265 glUniform1iARB(nightVisionUniforms["RenderTexture"], 0);
268 266
269 glClientActiveTextureARB(GL_TEXTURE1_ARB);
270 glActiveTextureARB(GL_TEXTURE1_ARB); 267 glActiveTextureARB(GL_TEXTURE1_ARB);
271 glEnable(GL_TEXTURE_2D); 268 glEnable(GL_TEXTURE_2D);
272 269
diff --git a/linden/indra/newview/llspatialpartition.cpp b/linden/indra/newview/llspatialpartition.cpp
index 7d715be..c378aad 100644
--- a/linden/indra/newview/llspatialpartition.cpp
+++ b/linden/indra/newview/llspatialpartition.cpp
@@ -1906,9 +1906,8 @@ void pushVerts(LLDrawInfo* params, U32 mask)
1906{ 1906{
1907 LLRenderPass::applyModelMatrix(*params); 1907 LLRenderPass::applyModelMatrix(*params);
1908 params->mVertexBuffer->setBuffer(mask); 1908 params->mVertexBuffer->setBuffer(mask);
1909 U16* indicesp = (U16*) params->mVertexBuffer->getIndicesPointer(); 1909 params->mVertexBuffer->drawRange(params->mParticle ? LLVertexBuffer::POINTS : LLVertexBuffer::TRIANGLES,
1910 glDrawRangeElements(params->mParticle ? GL_POINTS : GL_TRIANGLES, params->mStart, params->mEnd, params->mCount, 1910 params->mStart, params->mEnd, params->mCount, params->mOffset);
1911 GL_UNSIGNED_SHORT, indicesp+params->mOffset);
1912} 1911}
1913 1912
1914void pushVerts(LLSpatialGroup* group, U32 mask) 1913void pushVerts(LLSpatialGroup* group, U32 mask)
@@ -1932,13 +1931,11 @@ void pushVerts(LLFace* face, U32 mask)
1932 if (buffer) 1931 if (buffer)
1933 { 1932 {
1934 buffer->setBuffer(mask); 1933 buffer->setBuffer(mask);
1935 U16* indicesp = (U16*) buffer->getIndicesPointer();
1936 U16 start = face->getGeomStart(); 1934 U16 start = face->getGeomStart();
1937 U16 end = start + face->getGeomCount()-1; 1935 U16 end = start + face->getGeomCount()-1;
1938 U32 count = face->getIndicesCount(); 1936 U32 count = face->getIndicesCount();
1939 U16 offset = face->getIndicesStart(); 1937 U16 offset = face->getIndicesStart();
1940 1938 buffer->drawRange(LLVertexBuffer::TRIANGLES, start, end, count, offset);
1941 glDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_SHORT, indicesp + offset);
1942 } 1939 }
1943 1940
1944} 1941}
@@ -1948,9 +1945,7 @@ void pushBufferVerts(LLVertexBuffer* buffer, U32 mask)
1948 if (buffer) 1945 if (buffer)
1949 { 1946 {
1950 buffer->setBuffer(mask); 1947 buffer->setBuffer(mask);
1951 U16* indicesp = (U16*) buffer->getIndicesPointer(); 1948 buffer->drawRange(LLVertexBuffer::TRIANGLES, 0, buffer->getRequestedVerts()-1, buffer->getRequestedIndices(), 0);
1952 glDrawRangeElements(GL_TRIANGLES, 0, buffer->getRequestedVerts(), buffer->getRequestedIndices(),
1953 GL_UNSIGNED_SHORT, indicesp);
1954 } 1949 }
1955} 1950}
1956 1951
@@ -1999,9 +1994,8 @@ void pushVertsColorCoded(LLSpatialGroup* group, U32 mask)
1999 LLRenderPass::applyModelMatrix(*params); 1994 LLRenderPass::applyModelMatrix(*params);
2000 glColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f); 1995 glColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
2001 params->mVertexBuffer->setBuffer(mask); 1996 params->mVertexBuffer->setBuffer(mask);
2002 U16* indicesp = (U16*) params->mVertexBuffer->getIndicesPointer(); 1997 params->mVertexBuffer->drawRange(params->mParticle ? LLVertexBuffer::POINTS : LLVertexBuffer::TRIANGLES,
2003 glDrawRangeElements(params->mParticle ? GL_POINTS : GL_TRIANGLES, params->mStart, params->mEnd, params->mCount, 1998 params->mStart, params->mEnd, params->mCount, params->mOffset);
2004 GL_UNSIGNED_SHORT, indicesp+params->mOffset);
2005 col = (col+1)%col_count; 1999 col = (col+1)%col_count;
2006 } 2000 }
2007 } 2001 }
@@ -2070,8 +2064,7 @@ void renderOctree(LLSpatialGroup* group)
2070 face->mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX); 2064 face->mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX);
2071 //drawBox((face->mExtents[0] + face->mExtents[1])*0.5f, 2065 //drawBox((face->mExtents[0] + face->mExtents[1])*0.5f,
2072 // (face->mExtents[1]-face->mExtents[0])*0.5f); 2066 // (face->mExtents[1]-face->mExtents[0])*0.5f);
2073 glDrawElements(GL_TRIANGLES, face->getIndicesCount(), GL_UNSIGNED_SHORT, 2067 face->mVertexBuffer->draw(LLVertexBuffer::TRIANGLES, face->getIndicesCount(), face->getIndicesStart());
2074 ((U16*) face->mVertexBuffer->getIndicesPointer())+face->getIndicesStart());
2075 } 2068 }
2076 } 2069 }
2077 2070
diff --git a/linden/indra/newview/llviewerdisplay.cpp b/linden/indra/newview/llviewerdisplay.cpp
index b4d6f27..72e3d5c 100644
--- a/linden/indra/newview/llviewerdisplay.cpp
+++ b/linden/indra/newview/llviewerdisplay.cpp
@@ -886,6 +886,11 @@ void render_ui_and_swap()
886 LLGLState::checkStates(); 886 LLGLState::checkStates();
887#endif 887#endif
888 888
889 glPushMatrix();
890 glLoadMatrixd(gGLLastModelView);
891 glh::matrix4f saved_view = glh_get_current_modelview();
892 glh_set_current_modelview(glh_copy_matrix(gGLLastModelView));
893
889 { 894 {
890 BOOL to_texture = gPipeline.canUseVertexShaders() && 895 BOOL to_texture = gPipeline.canUseVertexShaders() &&
891 LLPipeline::sRenderGlow && 896 LLPipeline::sRenderGlow &&
@@ -936,6 +941,9 @@ void render_ui_and_swap()
936 941
937 LLVertexBuffer::stopRender(); 942 LLVertexBuffer::stopRender();
938 } 943 }
944
945 glh_set_current_modelview(saved_view);
946 glPopMatrix();
939} 947}
940 948
941void render_ui_and_swap_if_needed() 949void render_ui_and_swap_if_needed()
@@ -1030,11 +1038,6 @@ void render_ui_3d()
1030 // so 3d elements requiring Z buffer are moved to LLDrawPoolHUD 1038 // so 3d elements requiring Z buffer are moved to LLDrawPoolHUD
1031 // 1039 //
1032 1040
1033 // Render selections
1034 //glDisableClientState(GL_COLOR_ARRAY);
1035 //glDisableClientState(GL_TEXTURE_COORD_ARRAY);
1036 //glDisableClientState(GL_NORMAL_ARRAY);
1037
1038 ///////////////////////////////////////////////////////////// 1041 /////////////////////////////////////////////////////////////
1039 // 1042 //
1040 // Render 2.5D elements (2D elements in the world) 1043 // Render 2.5D elements (2D elements in the world)
diff --git a/linden/indra/newview/llviewerjointmesh.cpp b/linden/indra/newview/llviewerjointmesh.cpp
index b87d564..4a0f0b8 100644
--- a/linden/indra/newview/llviewerjointmesh.cpp
+++ b/linden/indra/newview/llviewerjointmesh.cpp
@@ -501,21 +501,6 @@ int compare_int(const void *a, const void *b)
501 else return 0; 501 else return 0;
502} 502}
503 503
504void llDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
505{
506 if (end-start+1 > (U32) gGLManager.mGLMaxVertexRange ||
507 count > gGLManager.mGLMaxIndexRange)
508 {
509 glDrawElements(mode,count,type,indices);
510 }
511 else
512 {
513 glDrawRangeElements(mode,start,end,count,type,indices);
514 }
515
516 gPipeline.addTrianglesDrawn(count/3);
517}
518
519//-------------------------------------------------------------------- 504//--------------------------------------------------------------------
520// LLViewerJointMesh::drawShape() 505// LLViewerJointMesh::drawShape()
521//-------------------------------------------------------------------- 506//--------------------------------------------------------------------
@@ -626,7 +611,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass)
626 U32 start = mMesh->mFaceVertexOffset; 611 U32 start = mMesh->mFaceVertexOffset;
627 U32 end = start + mMesh->mFaceVertexCount - 1; 612 U32 end = start + mMesh->mFaceVertexCount - 1;
628 U32 count = mMesh->mFaceIndexCount; 613 U32 count = mMesh->mFaceIndexCount;
629 U16* indicesp = ((U16*) mFace->mVertexBuffer->getIndicesPointer()) + mMesh->mFaceIndexOffset; 614 U32 offset = mMesh->mFaceIndexOffset;
630 615
631 if (mMesh->hasWeights()) 616 if (mMesh->hasWeights())
632 { 617 {
@@ -636,23 +621,21 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass)
636 { 621 {
637 uploadJointMatrices(); 622 uploadJointMatrices();
638 } 623 }
639 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_SHORT, indicesp);
640 }
641 else
642 {
643 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_SHORT, indicesp);
644 } 624 }
625
626 mFace->mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, start, end, count, offset);
645 } 627 }
646 else 628 else
647 { 629 {
648 glPushMatrix(); 630 glPushMatrix();
649 LLMatrix4 jointToWorld = getWorldMatrix(); 631 LLMatrix4 jointToWorld = getWorldMatrix();
650 glMultMatrixf((GLfloat*)jointToWorld.mMatrix); 632 glMultMatrixf((GLfloat*)jointToWorld.mMatrix);
651 llDrawRangeElements(GL_TRIANGLES, start, end, count, GL_UNSIGNED_SHORT, indicesp); 633 mFace->mVertexBuffer->drawRange(LLVertexBuffer::TRIANGLES, start, end, count, offset);
652 glPopMatrix(); 634 glPopMatrix();
653 } 635 }
636 gPipeline.addTrianglesDrawn(count/3);
654 637
655 triangle_count += mMesh->mFaceIndexCount; 638 triangle_count += count;
656 639
657 if (mTestImageName) 640 if (mTestImageName)
658 { 641 {
diff --git a/linden/indra/newview/llviewerkeyboard.cpp b/linden/indra/newview/llviewerkeyboard.cpp
index 1c5d870..0d927ae 100644
--- a/linden/indra/newview/llviewerkeyboard.cpp
+++ b/linden/indra/newview/llviewerkeyboard.cpp
@@ -88,8 +88,6 @@ static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode m
88{ 88{
89 if (KEYSTATE_UP == s) 89 if (KEYSTATE_UP == s)
90 { 90 {
91 // Releasing a walk-key resets the double-tap timer
92 gAgent.mDoubleTapRunTimer.reset();
93 if (gAgent.mDoubleTapRunMode == mode && 91 if (gAgent.mDoubleTapRunMode == mode &&
94 gAgent.getRunning() && 92 gAgent.getRunning() &&
95 !gAgent.getAlwaysRun()) 93 !gAgent.getAlwaysRun())
@@ -98,17 +96,23 @@ static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode m
98 gAgent.clearRunning(); 96 gAgent.clearRunning();
99 gAgent.sendWalkRun(gAgent.getRunning()); 97 gAgent.sendWalkRun(gAgent.getRunning());
100 } 98 }
101 gAgent.mDoubleTapRunMode = mode;
102 } 99 }
103 else if (gAllowTapTapHoldRun && 100 else if (gAllowTapTapHoldRun &&
104 KEYSTATE_DOWN == s && 101 KEYSTATE_DOWN == s &&
105 gAgent.mDoubleTapRunMode == mode && 102 !gAgent.getRunning())
106 gAgent.mDoubleTapRunTimer.getElapsedTimeF32() < NUDGE_TIME)
107 { 103 {
108 // Same walk-key was pushed again quickly; this is a double-tap 104 if (gAgent.mDoubleTapRunMode == mode &&
109 // so engage temporary running. 105 gAgent.mDoubleTapRunTimer.getElapsedTimeF32() < NUDGE_TIME)
110 gAgent.setRunning(); 106 {
111 gAgent.sendWalkRun(gAgent.getRunning()); 107 // Same walk-key was pushed again quickly; this is a
108 // double-tap so engage temporary running.
109 gAgent.setRunning();
110 gAgent.sendWalkRun(gAgent.getRunning());
111 }
112
113 // Pressing any walk-key resets the double-tap timer
114 gAgent.mDoubleTapRunTimer.reset();
115 gAgent.mDoubleTapRunMode = mode;
112 } 116 }
113} 117}
114 118
diff --git a/linden/indra/newview/llvotree.cpp b/linden/indra/newview/llvotree.cpp
index a55afe1..993c2a0 100644
--- a/linden/indra/newview/llvotree.cpp
+++ b/linden/indra/newview/llvotree.cpp
@@ -821,7 +821,7 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
821 821
822 glLoadMatrixf((F32*) scale_mat.mMatrix); 822 glLoadMatrixf((F32*) scale_mat.mMatrix);
823 glDrawElements(GL_TRIANGLES, sLODIndexCount[trunk_LOD], GL_UNSIGNED_SHORT, indicesp + sLODIndexOffset[trunk_LOD]); 823 glDrawElements(GL_TRIANGLES, sLODIndexCount[trunk_LOD], GL_UNSIGNED_SHORT, indicesp + sLODIndexOffset[trunk_LOD]);
824 824 gPipeline.addTrianglesDrawn(LEAF_INDICES/3);
825 stop_glerror(); 825 stop_glerror();
826 ret += sLODIndexCount[trunk_LOD]; 826 ret += sLODIndexCount[trunk_LOD];
827 } 827 }
@@ -871,7 +871,7 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
871 871
872 glLoadMatrixf((F32*) scale_mat.mMatrix); 872 glLoadMatrixf((F32*) scale_mat.mMatrix);
873 glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp); 873 glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp);
874 874 gPipeline.addTrianglesDrawn(LEAF_INDICES/3);
875 stop_glerror(); 875 stop_glerror();
876 ret += LEAF_INDICES; 876 ret += LEAF_INDICES;
877 } 877 }
@@ -896,7 +896,7 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD
896 896
897 glLoadMatrixf((F32*) scale_mat.mMatrix); 897 glLoadMatrixf((F32*) scale_mat.mMatrix);
898 glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp); 898 glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp);
899 899 gPipeline.addTrianglesDrawn(LEAF_INDICES/3);
900 stop_glerror(); 900 stop_glerror();
901 ret += LEAF_INDICES; 901 ret += LEAF_INDICES;
902 902
diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp
index 4b357e2..188c277 100644
--- a/linden/indra/newview/llvovolume.cpp
+++ b/linden/indra/newview/llvovolume.cpp
@@ -762,7 +762,7 @@ void LLVOVolume::sculpt()
762 return; 762 return;
763 763
764 LLPointer<LLImageRaw> raw_image = new LLImageRaw(); 764 LLPointer<LLImageRaw> raw_image = new LLImageRaw();
765 mSculptTexture->readBackRaw(discard_level, raw_image, FALSE); 765 BOOL is_valid = mSculptTexture->readBackRaw(discard_level, raw_image, FALSE);
766 766
767 sculpt_height = raw_image->getHeight(); 767 sculpt_height = raw_image->getHeight();
768 sculpt_width = raw_image->getWidth(); 768 sculpt_width = raw_image->getWidth();
@@ -770,6 +770,16 @@ void LLVOVolume::sculpt()
770 sculpt_components = raw_image->getComponents(); 770 sculpt_components = raw_image->getComponents();
771 sculpt_data = raw_image->getData(); 771 sculpt_data = raw_image->getData();
772 772
773 if(is_valid)
774 {
775 is_valid = mSculptTexture->isValidForSculpt(discard_level, sculpt_width, sculpt_height, sculpt_components) ;
776 }
777 if(!is_valid)
778 {
779 sculpt_width = 0 ;
780 sculpt_height = 0 ;
781 }
782
773 llassert_always(raw_image->getDataSize() >= sculpt_height * sculpt_width * sculpt_components); 783 llassert_always(raw_image->getDataSize() >= sculpt_height * sculpt_width * sculpt_components);
774 784
775 getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level); 785 getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level);
diff --git a/linden/indra/newview/llvowlsky.cpp b/linden/indra/newview/llvowlsky.cpp
index 30d1397..159603e 100644
--- a/linden/indra/newview/llvowlsky.cpp
+++ b/linden/indra/newview/llvowlsky.cpp
@@ -484,17 +484,12 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
484 484
485void LLVOWLSky::drawStars(void) 485void LLVOWLSky::drawStars(void)
486{ 486{
487 glEnableClientState(GL_COLOR_ARRAY);
488
489 // render the stars as a sphere centered at viewer camera 487 // render the stars as a sphere centered at viewer camera
490 if (mStarsVerts.notNull()) 488 if (mStarsVerts.notNull())
491 { 489 {
492 mStarsVerts->setBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK); 490 mStarsVerts->setBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK);
493 U16* indicesp = (U16*) mStarsVerts->getIndicesPointer(); 491 mStarsVerts->draw(LLVertexBuffer::POINTS, getStarsNumIndices(), 0);
494 glDrawElements(GL_POINTS, getStarsNumIndices(), GL_UNSIGNED_SHORT, indicesp);
495 } 492 }
496
497 glDisableClientState(GL_COLOR_ARRAY);
498} 493}
499 494
500void LLVOWLSky::drawDome(void) 495void LLVOWLSky::drawDome(void)
@@ -507,19 +502,8 @@ void LLVOWLSky::drawDome(void)
507 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); 502 LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
508 503
509 const U32 data_mask = LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK; 504 const U32 data_mask = LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK;
510 505
511 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
512
513#if DOME_SLICES 506#if DOME_SLICES
514 //mFanVerts->setBuffer(data_mask);
515 //glDrawRangeElements(
516 // GL_TRIANGLES,
517 // 0, getFanNumVerts()-1, getFanNumIndices(),
518 // GL_UNSIGNED_SHORT,
519 // mFanVerts->getIndicesPointer());
520
521 //gPipeline.addTrianglesDrawn(getFanNumIndices()/3);
522
523 std::vector< LLPointer<LLVertexBuffer> >::const_iterator strips_vbo_iter, end_strips; 507 std::vector< LLPointer<LLVertexBuffer> >::const_iterator strips_vbo_iter, end_strips;
524 end_strips = mStripsVerts.end(); 508 end_strips = mStripsVerts.end();
525 for(strips_vbo_iter = mStripsVerts.begin(); strips_vbo_iter != end_strips; ++strips_vbo_iter) 509 for(strips_vbo_iter = mStripsVerts.begin(); strips_vbo_iter != end_strips; ++strips_vbo_iter)
@@ -528,13 +512,10 @@ void LLVOWLSky::drawDome(void)
528 512
529 strips_segment->setBuffer(data_mask); 513 strips_segment->setBuffer(data_mask);
530 514
531 glDrawRangeElements( 515 strips_segment->drawRange(
532 //GL_TRIANGLES, 516 LLVertexBuffer::TRIANGLE_STRIP,
533 GL_TRIANGLE_STRIP, 517 0, strips_segment->getRequestedVerts()-1, strips_segment->getRequestedIndices(),
534 0, strips_segment->getRequestedVerts()-1, strips_segment->getRequestedIndices(), 518 0);
535 GL_UNSIGNED_SHORT,
536 strips_segment->getIndicesPointer());
537
538 gPipeline.addTrianglesDrawn(strips_segment->getRequestedIndices() - 2); 519 gPipeline.addTrianglesDrawn(strips_segment->getRequestedIndices() - 2);
539 } 520 }
540 521
@@ -547,8 +528,6 @@ void LLVOWLSky::drawDome(void)
547 mStripsVerts->getIndicesPointer()); 528 mStripsVerts->getIndicesPointer());
548#endif 529#endif
549 530
550 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
551
552 LLVertexBuffer::unbind(); 531 LLVertexBuffer::unbind();
553} 532}
554 533
diff --git a/linden/indra/newview/llwebbrowserctrl.cpp b/linden/indra/newview/llwebbrowserctrl.cpp
index a9c1ec8..fbbd827 100644
--- a/linden/indra/newview/llwebbrowserctrl.cpp
+++ b/linden/indra/newview/llwebbrowserctrl.cpp
@@ -71,7 +71,8 @@ LLWebBrowserCtrl::LLWebBrowserCtrl( const std::string& name, const LLRect& rect
71 mIgnoreUIScale( true ), 71 mIgnoreUIScale( true ),
72 mAlwaysRefresh( false ), 72 mAlwaysRefresh( false ),
73 mExternalUrl( "" ), 73 mExternalUrl( "" ),
74 mMediaSource( 0 ) 74 mMediaSource( 0 ),
75 mTakeFocusOnClick( true )
75{ 76{
76 S32 screen_width = mIgnoreUIScale ? 77 S32 screen_width = mIgnoreUIScale ?
77 llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth(); 78 llround((F32)getRect().getWidth() * LLUI::sGLScaleFactor.mV[VX]) : getRect().getWidth();
@@ -161,6 +162,13 @@ void LLWebBrowserCtrl::setBorderVisible( BOOL border_visible )
161}; 162};
162 163
163//////////////////////////////////////////////////////////////////////////////// 164////////////////////////////////////////////////////////////////////////////////
165//
166void LLWebBrowserCtrl::setTakeFocusOnClick( bool take_focus )
167{
168 mTakeFocusOnClick = take_focus;
169}
170
171////////////////////////////////////////////////////////////////////////////////
164// set flag that forces the embedded browser to open links in the external system browser 172// set flag that forces the embedded browser to open links in the external system browser
165void LLWebBrowserCtrl::setOpenInExternalBrowser( bool valIn ) 173void LLWebBrowserCtrl::setOpenInExternalBrowser( bool valIn )
166{ 174{
@@ -209,7 +217,17 @@ BOOL LLWebBrowserCtrl::handleMouseUp( S32 x, S32 y, MASK mask )
209 convertInputCoords(x, y); 217 convertInputCoords(x, y);
210 218
211 if (mMediaSource) 219 if (mMediaSource)
220 {
212 mMediaSource->mouseUp(x, y); 221 mMediaSource->mouseUp(x, y);
222
223 // *HACK: LLMediaImplLLMozLib automatically takes focus on mouseup,
224 // in addition to the onFocusReceived() call below. Undo this. JC
225 if (!mTakeFocusOnClick)
226 {
227 mMediaSource->focus(false);
228 gViewerWindow->focusClient();
229 }
230 }
213 231
214 gViewerWindow->setMouseCapture( NULL ); 232 gViewerWindow->setMouseCapture( NULL );
215 233
@@ -227,7 +245,10 @@ BOOL LLWebBrowserCtrl::handleMouseDown( S32 x, S32 y, MASK mask )
227 245
228 gViewerWindow->setMouseCapture( this ); 246 gViewerWindow->setMouseCapture( this );
229 247
230 setFocus( TRUE ); 248 if (mTakeFocusOnClick)
249 {
250 setFocus( TRUE );
251 }
231 252
232 return TRUE; 253 return TRUE;
233} 254}
@@ -243,7 +264,10 @@ BOOL LLWebBrowserCtrl::handleDoubleClick( S32 x, S32 y, MASK mask )
243 264
244 gViewerWindow->setMouseCapture( this ); 265 gViewerWindow->setMouseCapture( this );
245 266
246 setFocus( TRUE ); 267 if (mTakeFocusOnClick)
268 {
269 setFocus( TRUE );
270 }
247 271
248 return TRUE; 272 return TRUE;
249} 273}
diff --git a/linden/indra/newview/llwebbrowserctrl.h b/linden/indra/newview/llwebbrowserctrl.h
index f7c9647..e1b5357 100644
--- a/linden/indra/newview/llwebbrowserctrl.h
+++ b/linden/indra/newview/llwebbrowserctrl.h
@@ -182,6 +182,12 @@ class LLWebBrowserCtrl :
182 182
183 void setBorderVisible( BOOL border_visible ); 183 void setBorderVisible( BOOL border_visible );
184 184
185 // For the tutorial window, we don't want to take focus on clicks,
186 // as the examples include how to move around with the arrow
187 // keys. Thus we keep focus on the app by setting this false.
188 // Defaults to true.
189 void setTakeFocusOnClick( bool take_focus );
190
185 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 191 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
186 192
187 // handle mouse related methods 193 // handle mouse related methods
@@ -263,6 +269,7 @@ class LLWebBrowserCtrl :
263 269
264 private: 270 private:
265 static void onClickLinkExternalTarget( S32 option, void* userdata ); 271 static void onClickLinkExternalTarget( S32 option, void* userdata );
272
266 LLWebBrowserCtrlEventEmitter< LLWebBrowserCtrlObserver > mEventEmitter; 273 LLWebBrowserCtrlEventEmitter< LLWebBrowserCtrlObserver > mEventEmitter;
267 const S32 mTextureDepthBytes; 274 const S32 mTextureDepthBytes;
268 int mEmbeddedBrowserWindowId; 275 int mEmbeddedBrowserWindowId;
@@ -278,6 +285,7 @@ class LLWebBrowserCtrl :
278 bool mIgnoreUIScale; 285 bool mIgnoreUIScale;
279 bool mAlwaysRefresh; 286 bool mAlwaysRefresh;
280 LLMediaBase* mMediaSource; 287 LLMediaBase* mMediaSource;
288 bool mTakeFocusOnClick;
281}; 289};
282 290
283//////////////////////////////////////////////////////////////////////////////// 291////////////////////////////////////////////////////////////////////////////////
diff --git a/linden/indra/newview/mozilla-theme/classic.jar b/linden/indra/newview/mozilla-theme/classic.jar
index f9c03eb..0f33170 100644
--- a/linden/indra/newview/mozilla-theme/classic.jar
+++ b/linden/indra/newview/mozilla-theme/classic.jar
Binary files differ
diff --git a/linden/indra/newview/pipeline.cpp b/linden/indra/newview/pipeline.cpp
index 5f45e26..92a9811 100644
--- a/linden/indra/newview/pipeline.cpp
+++ b/linden/indra/newview/pipeline.cpp
@@ -168,7 +168,7 @@ glh::matrix4f glh_get_current_projection()
168 return glh_copy_matrix(gGLProjection); 168 return glh_copy_matrix(gGLProjection);
169} 169}
170 170
171void glh_copy_matrix(glh::matrix4f& src, GLdouble* dst) 171void glh_copy_matrix(const glh::matrix4f& src, GLdouble* dst)
172{ 172{
173 for (U32 i = 0; i < 16; i++) 173 for (U32 i = 0; i < 16; i++)
174 { 174 {
@@ -176,7 +176,7 @@ void glh_copy_matrix(glh::matrix4f& src, GLdouble* dst)
176 } 176 }
177} 177}
178 178
179void glh_set_current_modelview(glh::matrix4f& mat) 179void glh_set_current_modelview(const glh::matrix4f& mat)
180{ 180{
181 glh_copy_matrix(mat, gGLModelView); 181 glh_copy_matrix(mat, gGLModelView);
182} 182}
@@ -2144,9 +2144,9 @@ void render_hud_elements()
2144 LLViewerParcelMgr::getInstance()->renderParcelCollision(); 2144 LLViewerParcelMgr::getInstance()->renderParcelCollision();
2145 2145
2146 // Render debugging beacons. 2146 // Render debugging beacons.
2147 gObjectList.renderObjectBeacons(); 2147 //gObjectList.renderObjectBeacons();
2148 LLHUDObject::renderAll(); 2148 //LLHUDObject::renderAll();
2149 gObjectList.resetObjectBeacons(); 2149 //gObjectList.resetObjectBeacons();
2150 } 2150 }
2151 else if (gForceRenderLandFence) 2151 else if (gForceRenderLandFence)
2152 { 2152 {
@@ -2253,11 +2253,11 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
2253 // 2253 //
2254 // 2254 //
2255 2255
2256 glEnableClientState(GL_VERTEX_ARRAY);
2257
2258 stop_glerror(); 2256 stop_glerror();
2259 gFrameStats.start(LLFrameStats::RENDER_SYNC); 2257 gFrameStats.start(LLFrameStats::RENDER_SYNC);
2260 2258
2259 glEnableClientState(GL_VERTEX_ARRAY);
2260
2261 // Do verification of GL state 2261 // Do verification of GL state
2262#ifndef LL_RELEASE_FOR_DOWNLOAD 2262#ifndef LL_RELEASE_FOR_DOWNLOAD
2263 LLGLState::checkStates(); 2263 LLGLState::checkStates();
@@ -2377,10 +2377,10 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
2377 break; 2377 break;
2378 } 2378 }
2379 2379
2380 p->resetTrianglesDrawn();
2381 p->render(i); 2380 p->render(i);
2382 } 2381 }
2383 poolp->endRenderPass(i); 2382 poolp->endRenderPass(i);
2383 LLVertexBuffer::unbind();
2384#ifndef LL_RELEASE_FOR_DOWNLOAD 2384#ifndef LL_RELEASE_FOR_DOWNLOAD
2385# if LL_DEBUG_GL 2385# if LL_DEBUG_GL
2386 GLint depth; 2386 GLint depth;
@@ -2413,6 +2413,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
2413 } 2413 }
2414 } 2414 }
2415 2415
2416 LLVertexBuffer::unbind();
2416#ifndef LL_RELEASE_FOR_DOWNLOAD 2417#ifndef LL_RELEASE_FOR_DOWNLOAD
2417 LLGLState::checkStates(); 2418 LLGLState::checkStates();
2418 LLGLState::checkTextureChannels(); 2419 LLGLState::checkTextureChannels();
@@ -2452,6 +2453,15 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
2452 LLVertexBuffer::stopRender(); 2453 LLVertexBuffer::stopRender();
2453 LLVertexBuffer::unbind(); 2454 LLVertexBuffer::unbind();
2454 2455
2456 if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
2457 {
2458 gGL.start();
2459 // Render debugging beacons.
2460 gObjectList.renderObjectBeacons();
2461 LLHUDObject::renderAll();
2462 gObjectList.resetObjectBeacons();
2463 gGL.stop();
2464 }
2455 2465
2456 //HACK: preserve/restore matrices around HUD render 2466 //HACK: preserve/restore matrices around HUD render
2457 if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) 2467 if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
@@ -2472,15 +2482,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
2472 2482
2473void LLPipeline::renderGeomDeferred() 2483void LLPipeline::renderGeomDeferred()
2474{ 2484{
2475 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
2476 glEnableClientState(GL_NORMAL_ARRAY);
2477 glEnableClientState(GL_COLOR_ARRAY);
2478 gDeferredDiffuseProgram.bind(); 2485 gDeferredDiffuseProgram.bind();
2479 gPipeline.renderObjects(LLRenderPass::PASS_SIMPLE, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL, TRUE); 2486 gPipeline.renderObjects(LLRenderPass::PASS_SIMPLE, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL, TRUE);
2480 gDeferredDiffuseProgram.unbind(); 2487 gDeferredDiffuseProgram.unbind();
2481 glDisableClientState(GL_COLOR_ARRAY);
2482 glDisableClientState(GL_NORMAL_ARRAY);
2483 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
2484} 2488}
2485 2489
2486void LLPipeline::addTrianglesDrawn(S32 count) 2490void LLPipeline::addTrianglesDrawn(S32 count)
@@ -2506,11 +2510,6 @@ void LLPipeline::renderDebug()
2506 2510
2507 gGL.start(); 2511 gGL.start();
2508 2512
2509 // Disable all client state
2510 //glDisableClientState(GL_TEXTURE_COORD_ARRAY);
2511 //glDisableClientState(GL_NORMAL_ARRAY);
2512 //glDisableClientState(GL_COLOR_ARRAY);
2513
2514 gGLLastMatrix = NULL; 2513 gGLLastMatrix = NULL;
2515 glLoadMatrixd(gGLModelView); 2514 glLoadMatrixd(gGLModelView);
2516 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); 2515 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
@@ -2603,8 +2602,6 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects)
2603 LLGLDepthTest gls_depth(GL_TRUE,GL_TRUE); 2602 LLGLDepthTest gls_depth(GL_TRUE,GL_TRUE);
2604 disableLights(); 2603 disableLights();
2605 2604
2606 glEnableClientState ( GL_VERTEX_ARRAY );
2607
2608 //for each drawpool 2605 //for each drawpool
2609#ifndef LL_RELEASE_FOR_DOWNLOAD 2606#ifndef LL_RELEASE_FOR_DOWNLOAD
2610 LLGLState::checkStates(); 2607 LLGLState::checkStates();
@@ -2619,7 +2616,7 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects)
2619 { 2616 {
2620 LLFacePool* face_pool = (LLFacePool*) poolp; 2617 LLFacePool* face_pool = (LLFacePool*) poolp;
2621 face_pool->renderForSelect(); 2618 face_pool->renderForSelect();
2622 2619 LLVertexBuffer::unbind();
2623 gGLLastMatrix = NULL; 2620 gGLLastMatrix = NULL;
2624 glLoadMatrixd(gGLModelView); 2621 glLoadMatrixd(gGLModelView);
2625 2622
@@ -2635,7 +2632,6 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects)
2635 } 2632 }
2636 } 2633 }
2637 2634
2638 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
2639 LLGLEnable alpha_test(GL_ALPHA_TEST); 2635 LLGLEnable alpha_test(GL_ALPHA_TEST);
2640 if (gPickTransparent) 2636 if (gPickTransparent)
2641 { 2637 {
@@ -2759,10 +2755,10 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects)
2759 } 2755 }
2760 2756
2761 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 2757 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
2762 glDisableClientState( GL_TEXTURE_COORD_ARRAY );
2763 2758
2759 LLVertexBuffer::unbind();
2764 LLVertexBuffer::stopRender(); 2760 LLVertexBuffer::stopRender();
2765 2761
2766 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 2762 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
2767} 2763}
2768 2764
@@ -4866,6 +4862,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
4866{ 4862{
4867 if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) 4863 if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
4868 { 4864 {
4865#ifndef LL_RELEASE_FOR_DOWNLOAD
4866 LLGLState::checkStates();
4867 LLGLState::checkTextureChannels();
4868 LLGLState::checkClientArrays();
4869#endif
4870
4869 LLCamera camera = camera_in; 4871 LLCamera camera = camera_in;
4870 camera.setFar(camera.getFar()*0.87654321f); 4872 camera.setFar(camera.getFar()*0.87654321f);
4871 LLPipeline::sReflectionRender = TRUE; 4873 LLPipeline::sReflectionRender = TRUE;
@@ -5052,6 +5054,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
5052 LLDrawPoolWater::sNeedsDistortionUpdate = FALSE; 5054 LLDrawPoolWater::sNeedsDistortionUpdate = FALSE;
5053 LLViewerCamera::getInstance()->setUserClipPlane(LLPlane(-pnorm, -pd)); 5055 LLViewerCamera::getInstance()->setUserClipPlane(LLPlane(-pnorm, -pd));
5054 LLPipeline::sUseOcclusion = occlusion; 5056 LLPipeline::sUseOcclusion = occlusion;
5057
5058#ifndef LL_RELEASE_FOR_DOWNLOAD
5059 LLGLState::checkStates();
5060 LLGLState::checkTextureChannels();
5061 LLGLState::checkClientArrays();
5062#endif
5055 } 5063 }
5056} 5064}
5057 5065
diff --git a/linden/indra/newview/pipeline.h b/linden/indra/newview/pipeline.h
index a2a404f..9896a4a 100644
--- a/linden/indra/newview/pipeline.h
+++ b/linden/indra/newview/pipeline.h
@@ -67,8 +67,9 @@ BOOL compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn
67bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0); 67bool LLRayAABB(const LLVector3 &center, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0);
68BOOL LLLineSegmentAABB(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); 68BOOL LLLineSegmentAABB(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size);
69BOOL setup_hud_matrices(BOOL for_select); 69BOOL setup_hud_matrices(BOOL for_select);
70glh::matrix4f glh_copy_matrix(GLdouble* src);
70glh::matrix4f glh_get_current_modelview(); 71glh::matrix4f glh_get_current_modelview();
71void glh_set_current_modelview(glh::matrix4f& mat); 72void glh_set_current_modelview(const glh::matrix4f& mat);
72glh::matrix4f glh_get_current_projection(); 73glh::matrix4f glh_get_current_projection();
73void glh_set_current_projection(glh::matrix4f& mat); 74void glh_set_current_projection(glh::matrix4f& mat);
74glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat znear, GLfloat zfar); 75glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat znear, GLfloat zfar);
diff --git a/linden/indra/newview/releasenotes.txt b/linden/indra/newview/releasenotes.txt
index 040c1da..0243fd7 100644
--- a/linden/indra/newview/releasenotes.txt
+++ b/linden/indra/newview/releasenotes.txt
@@ -1,3 +1,27 @@
1Release Notes for Second Life 1.20(3) April 23th, 2008
2=====================================
3Fixes:
4* Fixed: removed mac release notes dialog from LLAppviewer::init
5* Fixed: Scrollbar channel missing in 1.20
6* Fixed: VWR-5080: Certain color combinations hard on visually impaired (and the not-visually-impaired)
7* Fixed: VWR-2404: lossless texture compression on small textures not lossless
8* Fixed: Window opens large, then small, then large on startup
9* Fixed: Imposters sometimes render without attachments
10* Fixed: VWR-380: Resized Flexible Prims Render Improperly
11* Fixed: Yellow edit outline detached from selected prim
12* Language tweaks to World Map UI
13* Fixed: Help > Tutorial makes the world disappear
14* Fixed: Help > Tutorial kills the keyboard.
15* Fixed: VWR-5869: Broken BVH Animation upload causes dialog / interface error, and crash.
16* Fixed: VWR-6275: Character runs when not supposed to.
17* Fix for vibrating name tags.
18* Fixed issue with mozilla scrollbars
19* Fixed: Background and Foreground color are the same in all scroll lists
20
21Localization Fixes:
22* Fixed: main Toolbar will not match to its Korean localization xml
23* Fixed: erroneous German translation for Active Speakers
24
1Release Notes for Second Life 1.20(2) April 18th, 2008 25Release Notes for Second Life 1.20(2) April 18th, 2008
2===================================== 26=====================================
3Changes: 27Changes:
diff --git a/linden/indra/newview/skins/xui/de/floater_active_speakers.xml b/linden/indra/newview/skins/xui/de/floater_active_speakers.xml
index 88c3e15..9ec58c1 100644
--- a/linden/indra/newview/skins/xui/de/floater_active_speakers.xml
+++ b/linden/indra/newview/skins/xui/de/floater_active_speakers.xml
@@ -1,5 +1,5 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?> 1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<floater name="active_speakers" title="Aktive Lautsprecher"> 2<floater name="active_speakers" title="Aktive Sprecher">
3 <panel name="active_speakers_panel"> 3 <panel name="active_speakers_panel">
4 <scroll_list name="speakers_list"> 4 <scroll_list name="speakers_list">
5 <column label="Name" name="speaker_name" /> 5 <column label="Name" name="speaker_name" />
diff --git a/linden/indra/newview/skins/xui/de/menu_viewer.xml b/linden/indra/newview/skins/xui/de/menu_viewer.xml
index d72e7b7..d4a569c 100644
--- a/linden/indra/newview/skins/xui/de/menu_viewer.xml
+++ b/linden/indra/newview/skins/xui/de/menu_viewer.xml
@@ -77,7 +77,7 @@
77 <menu_item_check label="Lokaler Chat" name="Chat History" /> 77 <menu_item_check label="Lokaler Chat" name="Chat History" />
78 <menu_item_check label="Unterhalten" name="Instant Message" /> 78 <menu_item_check label="Unterhalten" name="Instant Message" />
79 <menu_item_call label="Inventar" name="Inventory" /> 79 <menu_item_call label="Inventar" name="Inventory" />
80 <menu_item_check label="Aktive Lautsprecher" name="Active Speakers" /> 80 <menu_item_check label="Aktive Sprecher" name="Active Speakers" />
81 <menu_item_check label="Stummschalten-Liste" name="Mute List" /> 81 <menu_item_check label="Stummschalten-Liste" name="Mute List" />
82 <menu_item_separator label="-----------" name="separator2" /> 82 <menu_item_separator label="-----------" name="separator2" />
83 <menu_item_check label="Kamerasteuerung" name="Camera Controls" /> 83 <menu_item_check label="Kamerasteuerung" name="Camera Controls" />
diff --git a/linden/indra/newview/skins/xui/de/panel_preferences_general.xml b/linden/indra/newview/skins/xui/de/panel_preferences_general.xml
index 635f43e..b7779b6 100644
--- a/linden/indra/newview/skins/xui/de/panel_preferences_general.xml
+++ b/linden/indra/newview/skins/xui/de/panel_preferences_general.xml
@@ -86,22 +86,22 @@
86 汉语/漢語 (Chinesisch) - Beta 86 汉语/漢語 (Chinesisch) - Beta
87 </combo_item> 87 </combo_item>
88 <combo_item type="string" length="1" name="Deutsch(German)"> 88 <combo_item type="string" length="1" name="Deutsch(German)">
89 Deutsch 89 Deutsch - Beta
90 </combo_item> 90 </combo_item>
91 <combo_item type="string" length="1" name="French"> 91 <combo_item type="string" length="1" name="French">
92 Français (Französisch) 92 Français (Französisch) - Beta
93 </combo_item> 93 </combo_item>
94 <combo_item type="string" length="1" name="(Japanese)"> 94 <combo_item type="string" length="1" name="(Japanese)">
95 日本語 (Japanisch) 95 日本語 (Japanisch) - Beta
96 </combo_item> 96 </combo_item>
97 <combo_item type="string" length="1" name="(Korean)"> 97 <combo_item type="string" length="1" name="(Korean)">
98 한국어 (Koreanisch) 98 한국어 (Koreanisch) - Beta
99 </combo_item> 99 </combo_item>
100 <combo_item type="string" length="1" name="Portugese"> 100 <combo_item type="string" length="1" name="Portugese">
101 Português (Portugiesisch) - Beta 101 Português (Portugiesisch) - Beta
102 </combo_item> 102 </combo_item>
103 <combo_item type="string" length="1" name="Spanish"> 103 <combo_item type="string" length="1" name="Spanish">
104 Español (Spanisch) 104 Español (Spanisch) - Beta
105 </combo_item> 105 </combo_item>
106 </combo_box> 106 </combo_box>
107</panel> 107</panel>
diff --git a/linden/indra/newview/skins/xui/en-us/alerts.xml b/linden/indra/newview/skins/xui/en-us/alerts.xml
index d0ee7f0..b36a4ea 100644
--- a/linden/indra/newview/skins/xui/en-us/alerts.xml
+++ b/linden/indra/newview/skins/xui/en-us/alerts.xml
@@ -1032,6 +1032,9 @@ If you continue to have problems, please visit: http://www.secondlife.com/suppor
1032MINSPECS 1032MINSPECS
1033Do you wish to visit [_URL] for more information? 1033Do you wish to visit [_URL] for more information?
1034 </message> 1034 </message>
1035 <ignore message="ignore">
1036 Ignore unsupported hardware
1037 </ignore>
1035 <option name="Yes"> 1038 <option name="Yes">
1036 Yes 1039 Yes
1037 </option> 1040 </option>
@@ -1067,6 +1070,20 @@ Do you wish to visit [_URL] for more information?
1067 510 1070 510
1068 </message> 1071 </message>
1069 </alert> 1072 </alert>
1073
1074 <alert modal="true" name="UnknownGPU">
1075 <message name="message">
1076Your system contains a graphics card that is unknown to us at this time.
1077This is often the case with new hardware we haven't had a chance to
1078test. Second Life will most likely run properly, but you may need to
1079adjust your graphics settings to something more appropriate.
1080(Edit->Preferences->Graphics).
1081 </message>
1082 <ignore name="ignore">
1083 Ignore unknown graphics card
1084 </ignore>
1085 </alert>
1086
1070 <alert modal="true" name="DisplaySettingsRecommended"> 1087 <alert modal="true" name="DisplaySettingsRecommended">
1071 <message name="message"> 1088 <message name="message">
1072 Display settings have been set to recommended levels 1089 Display settings have been set to recommended levels
diff --git a/linden/indra/newview/skins/xui/en-us/floater_world_map.xml b/linden/indra/newview/skins/xui/en-us/floater_world_map.xml
index b8341f2..4e26986 100644
--- a/linden/indra/newview/skins/xui/en-us/floater_world_map.xml
+++ b/linden/indra/newview/skins/xui/en-us/floater_world_map.xml
@@ -149,20 +149,20 @@
149 image_name="map_track_16.tga" left="1013" mouse_opaque="true" 149 image_name="map_track_16.tga" left="1013" mouse_opaque="true"
150 name="avatar_icon" width="16" /> 150 name="avatar_icon" width="16" />
151 <combo_box allow_text_entry="true" bottom_delta="0" follows="top|right" height="20" 151 <combo_box allow_text_entry="true" bottom_delta="0" follows="top|right" height="20"
152 label="My Friends" left_delta="20" max_chars="60" mouse_opaque="true" 152 label="Online Friends" left_delta="20" max_chars="60" mouse_opaque="true"
153 name="friend combo" tool_tip="Friend to Show on Map" width="202"> 153 name="friend combo" tool_tip="Friend to Show on Map" width="202">
154 <combo_item name="none_selected" value="None"> 154 <combo_item name="none_selected" value="None">
155 My Friends 155 Online Friends
156 </combo_item> 156 </combo_item>
157 </combo_box> 157 </combo_box>
158 <icon bottom_delta="-25" color="0.5, 0, 0, 1" follows="top|right" height="16" 158 <icon bottom_delta="-25" color="0.5, 0, 0, 1" follows="top|right" height="16"
159 image_name="map_track_16.tga" left="1013" mouse_opaque="true" 159 image_name="map_track_16.tga" left="1013" mouse_opaque="true"
160 name="landmark_icon" width="16" /> 160 name="landmark_icon" width="16" />
161 <combo_box allow_text_entry="true" bottom_delta="0" follows="top|right" height="20" 161 <combo_box allow_text_entry="true" bottom_delta="0" follows="top|right" height="20"
162 label="My Landmarks" left_delta="20" max_chars="60" mouse_opaque="true" 162 label="Landmarks" left_delta="20" max_chars="60" mouse_opaque="true"
163 name="landmark combo" tool_tip="Landmark to Show on Map" width="202"> 163 name="landmark combo" tool_tip="Landmark to Show on Map" width="202">
164 <combo_item name="none_selected" value="None"> 164 <combo_item name="none_selected" value="None">
165 My Landmarks 165 Landmarks
166 </combo_item> 166 </combo_item>
167 </combo_box> 167 </combo_box>
168 <icon bottom_delta="-25" color="0.5, 0, 0, 1" follows="top|right" height="16" 168 <icon bottom_delta="-25" color="0.5, 0, 0, 1" follows="top|right" height="16"
diff --git a/linden/indra/newview/skins/xui/es/panel_preferences_general.xml b/linden/indra/newview/skins/xui/es/panel_preferences_general.xml
index 7703e0b..66fb9bd 100644
--- a/linden/indra/newview/skins/xui/es/panel_preferences_general.xml
+++ b/linden/indra/newview/skins/xui/es/panel_preferences_general.xml
@@ -69,16 +69,22 @@
69 Inglés 69 Inglés
70 </combo_item> 70 </combo_item>
71 <combo_item type="string" length="1" name="Deutsch(German)"> 71 <combo_item type="string" length="1" name="Deutsch(German)">
72 Deutsch (German) 72 Deutsch (Alemán) - Beta
73 </combo_item>
74 <combo_item type="string" length="1" name="French">
75 Français (Francés) - Beta
73 </combo_item> 76 </combo_item>
74 <combo_item type="string" length="1" name="(Japanese)"> 77 <combo_item type="string" length="1" name="(Japanese)">
75 日本語 (Japanese) 78 日本語 (Japonés) - Beta
76 </combo_item> 79 </combo_item>
77 <combo_item type="string" length="1" name="(Korean)"> 80 <combo_item type="string" length="1" name="(Korean)">
78 한국어 (Korean) 81 한국어 (Coreano) - Beta
79 </combo_item> 82 </combo_item>
80 <combo_item type="string" length="1" name="Chinese"> 83 <combo_item type="string" length="1" name="Chinese">
81 Chino 84 汉语/漢語 (Chino) - Beta
85 </combo_item>
86 <combo_item type="string" name="Spanish">
87 Español - Beta
82 </combo_item> 88 </combo_item>
83 </combo_box> 89 </combo_box>
84</panel> 90</panel>
diff --git a/linden/indra/newview/skins/xui/fr/panel_preferences_general.xml b/linden/indra/newview/skins/xui/fr/panel_preferences_general.xml
index c17fd3b..acf89cd 100644
--- a/linden/indra/newview/skins/xui/fr/panel_preferences_general.xml
+++ b/linden/indra/newview/skins/xui/fr/panel_preferences_general.xml
@@ -70,16 +70,16 @@
70 Anglais 70 Anglais
71 </combo_item> 71 </combo_item>
72 <combo_item type="string" length="1" name="Deutsch(German)"> 72 <combo_item type="string" length="1" name="Deutsch(German)">
73 Deutsch (German) 73 Deutsch (German) - Beta
74 </combo_item> 74 </combo_item>
75 <combo_item type="string" length="1" name="(Japanese)"> 75 <combo_item type="string" length="1" name="(Japanese)">
76 日本語 (Japanese) 76 日本語 (Japanese) - Beta
77 </combo_item> 77 </combo_item>
78 <combo_item type="string" length="1" name="(Korean)"> 78 <combo_item type="string" length="1" name="(Korean)">
79 한국어 (Korean) 79 한국어 (Korean) - Beta
80 </combo_item> 80 </combo_item>
81 <combo_item type="string" length="1" name="Chinese"> 81 <combo_item type="string" length="1" name="Chinese">
82 Chinois 82 Chinois - Beta
83 </combo_item> 83 </combo_item>
84 </combo_box> 84 </combo_box>
85</panel> 85</panel>
diff --git a/linden/indra/newview/skins/xui/ja/panel_preferences_general.xml b/linden/indra/newview/skins/xui/ja/panel_preferences_general.xml
index e5deeb3..5017f37 100644
--- a/linden/indra/newview/skins/xui/ja/panel_preferences_general.xml
+++ b/linden/indra/newview/skins/xui/ja/panel_preferences_general.xml
@@ -92,22 +92,22 @@
92 汉语/漢語(中国語) – ベータ 92 汉语/漢語(中国語) – ベータ
93 </combo_item> 93 </combo_item>
94 <combo_item type="string" length="1" name="Deutsch(German)"> 94 <combo_item type="string" length="1" name="Deutsch(German)">
95 Deutsch (ドイツ語) 95 Deutsch (ドイツ語) – ベータ
96 </combo_item> 96 </combo_item>
97 <combo_item type="string" length="1" name="French"> 97 <combo_item type="string" length="1" name="French">
98 Français (フランス語) 98 Français (フランス語) – ベータ
99 </combo_item> 99 </combo_item>
100 <combo_item type="string" length="1" name="(Japanese)"> 100 <combo_item type="string" length="1" name="(Japanese)">
101 日本語 101 日本語 – ベータ
102 </combo_item> 102 </combo_item>
103 <combo_item type="string" length="1" name="(Korean)"> 103 <combo_item type="string" length="1" name="(Korean)">
104 한국어 (韓国語) 104 한국어 (韓国語) – ベータ
105 </combo_item> 105 </combo_item>
106 <combo_item type="string" length="1" name="Portugese"> 106 <combo_item type="string" length="1" name="Portugese">
107 Português (ポルトガル語) – ベータ 107 Português (ポルトガル語) – ベータ
108 </combo_item> 108 </combo_item>
109 <combo_item type="string" length="1" name="Spanish"> 109 <combo_item type="string" length="1" name="Spanish">
110 Español (スペイン語) 110 Español (スペイン語) – ベータ
111 </combo_item> 111 </combo_item>
112 </combo_box> 112 </combo_box>
113</panel> 113</panel>
diff --git a/linden/indra/newview/skins/xui/ko/panel_preferences_general.xml b/linden/indra/newview/skins/xui/ko/panel_preferences_general.xml
index 15e1e31..9c02484 100644
--- a/linden/indra/newview/skins/xui/ko/panel_preferences_general.xml
+++ b/linden/indra/newview/skins/xui/ko/panel_preferences_general.xml
@@ -87,22 +87,22 @@
87 汉语/漢語(중국어) - 베타 87 汉语/漢語(중국어) - 베타
88 </combo_item> 88 </combo_item>
89 <combo_item type="string" length="1" name="Deutsch(German)"> 89 <combo_item type="string" length="1" name="Deutsch(German)">
90 Deutsch (독일어) 90 Deutsch (독일어) - 베타
91 </combo_item> 91 </combo_item>
92 <combo_item type="string" length="1" name="French"> 92 <combo_item type="string" length="1" name="French">
93 Français (불어) 93 Français (불어) - 베타
94 </combo_item> 94 </combo_item>
95 <combo_item type="string" length="1" name="(Japanese)"> 95 <combo_item type="string" length="1" name="(Japanese)">
96 日本語 (일본어) 96 日本語 (일본어) - 베타
97 </combo_item> 97 </combo_item>
98 <combo_item type="string" length="1" name="(Korean)"> 98 <combo_item type="string" length="1" name="(Korean)">
99 한국어 99 한국어 - 베타
100 </combo_item> 100 </combo_item>
101 <combo_item type="string" length="1" name="Portugese"> 101 <combo_item type="string" length="1" name="Portugese">
102 Português(포르투갈어) - 베타 102 Português(포르투갈어) - 베타
103 </combo_item> 103 </combo_item>
104 <combo_item type="string" length="1" name="Spanish"> 104 <combo_item type="string" length="1" name="Spanish">
105 Español (스페인어) 105 Español (스페인어) - 베타
106 </combo_item> 106 </combo_item>
107 </combo_box> 107 </combo_box>
108</panel> 108</panel>
diff --git a/linden/indra/newview/skins/xui/ko/panel_toolbar.xml b/linden/indra/newview/skins/xui/ko/panel_toolbar.xml
index 1a61390..1c92f88 100644
--- a/linden/indra/newview/skins/xui/ko/panel_toolbar.xml
+++ b/linden/indra/newview/skins/xui/ko/panel_toolbar.xml
@@ -1,9 +1,7 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?> 1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<panel name="toolbar"> 2<panel name="toolbar">
3 <button label="메신저" name="im_btn" tool_tip="친구들과 메신저 하기." /> 3 <string name="Redock Windows">창 합치기</string>
4 <string name="Redock Windows"> 4 <layout_stack name="toolbar_stack">
5 창 합치기
6 </string>
7 <button label="통신" name="communicate_btn" 5 <button label="통신" name="communicate_btn"
8 tool_tip="친구 및 그룹과 통신합니다." /> 6 tool_tip="친구 및 그룹과 통신합니다." />
9 <button label="" name="chat_btn" tool_tip="채팅 표시줄 표시 (입력)" /> 7 <button label="" name="chat_btn" tool_tip="채팅 표시줄 표시 (입력)" />
@@ -20,4 +18,5 @@
20 tool_tip="내 주변 영역의 지도 (Ctrl-Shift-M)" /> 18 tool_tip="내 주변 영역의 지도 (Ctrl-Shift-M)" />
21 <button label="지도" name="map_btn" tool_tip="월드 지도 (Ctrl-M)" /> 19 <button label="지도" name="map_btn" tool_tip="월드 지도 (Ctrl-M)" />
22 <button label="인벤토리" name="inventory_btn" tool_tip="아이템. (Ctrl-I)" /> 20 <button label="인벤토리" name="inventory_btn" tool_tip="아이템. (Ctrl-I)" />
21 </layout_stack>
23</panel> 22</panel>
diff --git a/linden/indra/newview/skins/xui/zh/panel_preferences_general.xml b/linden/indra/newview/skins/xui/zh/panel_preferences_general.xml
index 3eccaab..77460f2 100644
--- a/linden/indra/newview/skins/xui/zh/panel_preferences_general.xml
+++ b/linden/indra/newview/skins/xui/zh/panel_preferences_general.xml
@@ -68,16 +68,16 @@
68 英语 68 英语
69 </combo_item> 69 </combo_item>
70 <combo_item type="string" length="1" name="Deutsch(German)"> 70 <combo_item type="string" length="1" name="Deutsch(German)">
71 Deutsch (German) 71 Deutsch (German) - Beta
72 </combo_item> 72 </combo_item>
73 <combo_item type="string" length="1" name="(Japanese)"> 73 <combo_item type="string" length="1" name="(Japanese)">
74 日本語 (Japanese) 74 日本語 (Japanese) - Beta
75 </combo_item> 75 </combo_item>
76 <combo_item type="string" length="1" name="(Korean)"> 76 <combo_item type="string" length="1" name="(Korean)">
77 한국어 (Korean) 77 한국어 (Korean) - Beta
78 </combo_item> 78 </combo_item>
79 <combo_item type="string" length="1" name="Chinese"> 79 <combo_item type="string" length="1" name="Chinese">
80 中文 80 中文 - Beta
81 </combo_item> 81 </combo_item>
82 </combo_box> 82 </combo_box>
83</panel> 83</panel>