aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llworld.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llworld.cpp')
-rw-r--r--linden/indra/newview/llworld.cpp87
1 files changed, 41 insertions, 46 deletions
diff --git a/linden/indra/newview/llworld.cpp b/linden/indra/newview/llworld.cpp
index c03ef6e..60312db 100644
--- a/linden/indra/newview/llworld.cpp
+++ b/linden/indra/newview/llworld.cpp
@@ -636,7 +636,8 @@ void LLWorld::updateParticles()
636 636
637void LLWorld::updateClouds(const F32 dt) 637void LLWorld::updateClouds(const F32 dt)
638{ 638{
639 if (gSavedSettings.getBOOL("FreezeTime")) 639 if (gSavedSettings.getBOOL("FreezeTime") ||
640 !gSavedSettings.getBOOL("SkyUseClassicClouds"))
640 { 641 {
641 // don't move clouds in snapshot mode 642 // don't move clouds in snapshot mode
642 return; 643 return;
@@ -791,7 +792,6 @@ void LLWorld::setLandFarClip(const F32 far_clip)
791 792
792void LLWorld::updateWaterObjects() 793void LLWorld::updateWaterObjects()
793{ 794{
794 //llinfos << "Start water update" << llendl;
795 if (!gAgent.getRegion()) 795 if (!gAgent.getRegion())
796 { 796 {
797 return; 797 return;
@@ -803,35 +803,33 @@ void LLWorld::updateWaterObjects()
803 } 803 }
804 804
805 // First, determine the min and max "box" of water objects 805 // First, determine the min and max "box" of water objects
806 bool first = true;
807 S32 min_x = 0; 806 S32 min_x = 0;
808 S32 min_y = 0; 807 S32 min_y = 0;
809 S32 max_x = 0; 808 S32 max_x = 0;
810 S32 max_y = 0; 809 S32 max_y = 0;
811 U32 region_x, region_y; 810 U32 region_x, region_y;
812 811
813 S32 rwidth = llfloor(getRegionWidthInMeters()); 812 S32 rwidth = 256;
814 813
814 // We only want to fill in water for stuff that's near us, say, within 256 or 512m
815 S32 range = gCamera->getFar() > 256.f ? 512 : 256;
816
817 LLViewerRegion* regionp = gAgent.getRegion();
818 from_region_handle(regionp->getHandle(), &region_x, &region_y);
819
820 min_x = (S32)region_x - range;
821 min_y = (S32)region_y - range;
822 max_x = (S32)region_x + range;
823 max_y = (S32)region_y + range;
824
825 F32 height = 0.f;
815 826
816 for (region_list_t::iterator iter = mRegionList.begin(); 827 for (region_list_t::iterator iter = mRegionList.begin();
817 iter != mRegionList.end(); ++iter) 828 iter != mRegionList.end(); ++iter)
818 { 829 {
819 LLViewerRegion* regionp = *iter; 830 LLViewerRegion* regionp = *iter;
820 from_region_handle(regionp->getHandle(), &region_x, &region_y);
821 if (first)
822 {
823 first = false;
824 min_x = max_x = region_x;
825 min_y = max_y = region_y;
826 }
827 else
828 {
829 min_x = llmin(min_x, (S32)region_x);
830 min_y = llmin(min_y, (S32)region_y);
831 max_x = llmax(max_x, (S32)region_x);
832 max_y = llmax(max_y, (S32)region_y);
833 }
834 LLVOWater* waterp = regionp->getLand().getWaterObj(); 831 LLVOWater* waterp = regionp->getLand().getWaterObj();
832 height += regionp->getWaterHeight();
835 if (waterp) 833 if (waterp)
836 { 834 {
837 gObjectList.updateActive(waterp); 835 gObjectList.updateActive(waterp);
@@ -846,15 +844,6 @@ void LLWorld::updateWaterObjects()
846 } 844 }
847 mHoleWaterObjects.clear(); 845 mHoleWaterObjects.clear();
848 846
849 // We only want to fill in holes for stuff that's near us, say, within 512m
850 LLViewerRegion* regionp = gAgent.getRegion();
851 from_region_handle(regionp->getHandle(), &region_x, &region_y);
852
853 min_x = llmax((S32)region_x - 512, min_x);
854 min_y = llmax((S32)region_y - 512, min_y);
855 max_x = llmin((S32)region_x + 512, max_x);
856 max_y = llmin((S32)region_y + 512, max_y);
857
858 // Now, get a list of the holes 847 // Now, get a list of the holes
859 S32 x, y; 848 S32 x, y;
860 for (x = min_x; x <= max_x; x += rwidth) 849 for (x = min_x; x <= max_x; x += rwidth)
@@ -866,11 +855,11 @@ void LLWorld::updateWaterObjects()
866 { 855 {
867 LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion()); 856 LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion());
868 waterp->setUseTexture(FALSE); 857 waterp->setUseTexture(FALSE);
869 gPipeline.addObject(waterp);
870 waterp->setPositionGlobal(LLVector3d(x + rwidth/2, 858 waterp->setPositionGlobal(LLVector3d(x + rwidth/2,
871 y + rwidth/2, 859 y + rwidth/2,
872 DEFAULT_WATER_HEIGHT)); 860 256.f+DEFAULT_WATER_HEIGHT));
873 waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 0.f)); 861 waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));
862 gPipeline.addObject(waterp);
874 mHoleWaterObjects.push_back(waterp); 863 mHoleWaterObjects.push_back(waterp);
875 } 864 }
876 } 865 }
@@ -884,15 +873,12 @@ void LLWorld::updateWaterObjects()
884 center_x = min_x + (wx >> 1); 873 center_x = min_x + (wx >> 1);
885 center_y = min_y + (wy >> 1); 874 center_y = min_y + (wy >> 1);
886 875
887
888
889 S32 add_boundary[4] = { 876 S32 add_boundary[4] = {
890 512 - (max_x - region_x), 877 512 - (max_x - region_x),
891 512 - (max_y - region_y), 878 512 - (max_y - region_y),
892 512 - (region_x - min_x), 879 512 - (region_x - min_x),
893 512 - (region_y - min_y) }; 880 512 - (region_y - min_y) };
894 881
895
896 S32 dir; 882 S32 dir;
897 for (dir = 0; dir < 8; dir++) 883 for (dir = 0; dir < 8; dir++)
898 { 884 {
@@ -910,16 +896,10 @@ void LLWorld::updateWaterObjects()
910 default: dim[1] = add_boundary[1]; break; 896 default: dim[1] = add_boundary[1]; break;
911 } 897 }
912 898
913 if (dim[0] == 0 || dim[1] == 0)
914 {
915 continue;
916 }
917
918 // Resize and reshape the water objects 899 // Resize and reshape the water objects
919 const S32 water_center_x = center_x + llround((wx + dim[0]) * 0.5f * gDirAxes[dir][0]); 900 const S32 water_center_x = center_x + llround((wx + dim[0]) * 0.5f * gDirAxes[dir][0]);
920 const S32 water_center_y = center_y + llround((wy + dim[1]) * 0.5f * gDirAxes[dir][1]); 901 const S32 water_center_y = center_y + llround((wy + dim[1]) * 0.5f * gDirAxes[dir][1]);
921 902
922
923 LLVOWater* waterp = mEdgeWaterObjects[dir]; 903 LLVOWater* waterp = mEdgeWaterObjects[dir];
924 if (!waterp || waterp->isDead()) 904 if (!waterp || waterp->isDead())
925 { 905 {
@@ -929,23 +909,38 @@ void LLWorld::updateWaterObjects()
929 gAgent.getRegion()); 909 gAgent.getRegion());
930 waterp = mEdgeWaterObjects[dir]; 910 waterp = mEdgeWaterObjects[dir];
931 waterp->setUseTexture(FALSE); 911 waterp->setUseTexture(FALSE);
912 waterp->setIsEdgePatch(TRUE);
932 gPipeline.addObject(waterp); 913 gPipeline.addObject(waterp);
933 } 914 }
934 915
935 waterp->setRegion(gAgent.getRegion()); 916 waterp->setRegion(gAgent.getRegion());
936 LLVector3d water_pos(water_center_x, water_center_y, 917 LLVector3d water_pos(water_center_x, water_center_y,
937 DEFAULT_WATER_HEIGHT); 918 DEFAULT_WATER_HEIGHT+256.f);
919 LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f);
920
921 //stretch out to horizon
922 water_scale.mV[0] += fabsf(2048.f * gDirAxes[dir][0]);
923 water_scale.mV[1] += fabsf(2048.f * gDirAxes[dir][1]);
924
925 water_pos.mdV[0] += 1024.f * gDirAxes[dir][0];
926 water_pos.mdV[1] += 1024.f * gDirAxes[dir][1];
927
938 waterp->setPositionGlobal(water_pos); 928 waterp->setPositionGlobal(water_pos);
939 waterp->setScale(LLVector3((F32)dim[0], (F32)dim[1], 0.f)); 929 waterp->setScale(water_scale);
930
940 gObjectList.updateActive(waterp); 931 gObjectList.updateActive(waterp);
941 /*if (!gNoRender)
942 {
943 gPipeline.markMoved(waterp->mDrawable);
944 }*/
945 } 932 }
933}
946 934
935void LLWorld::shiftRegions(const LLVector3& offset)
936{
937 for (region_list_t::iterator i = getRegionList().begin(); i != getRegionList().end(); ++i)
938 {
939 LLViewerRegion* region = *i;
940 region->updateRenderMatrix();
941 }
947 942
948 //llinfos << "End water update" << llendl; 943 mPartSim.shift(offset);
949} 944}
950 945
951LLViewerImage* LLWorld::getDefaultWaterTexture() 946LLViewerImage* LLWorld::getDefaultWaterTexture()