aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llwaterpatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llwaterpatch.cpp')
-rw-r--r--linden/indra/newview/llwaterpatch.cpp132
1 files changed, 0 insertions, 132 deletions
diff --git a/linden/indra/newview/llwaterpatch.cpp b/linden/indra/newview/llwaterpatch.cpp
deleted file mode 100644
index f6a8640..0000000
--- a/linden/indra/newview/llwaterpatch.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
1/**
2 * @file llwaterpatch.cpp
3 * @brief LLWaterTri class implementation
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#include "llviewerprecompiledheaders.h"
30
31#include "llwaterpatch.h"
32
33#include "llvowater.h"
34
35U32 LLWaterTri::sMinStep;
36LL2Coord LLWaterTri::sCam;
37F32 LLWaterTri::sClipFar;
38U32 LLWaterTri::sMaxDivLevel;
39BOOL LLWaterTri::sCurrRound = FALSE;
40
41
42LLWaterTri::LLWaterTri (U8 level, S8 type, LLWaterTri* par): LLRoamTriNode(level, type, par), mRefine(FALSE)
43{
44 if (!parent() || type == 0)
45 {
46 mSize = mLvtx.distance(mRvtx) * sMinStep;
47 mCurr = sCurrRound;
48 setNotUpToDate();
49 return;
50 }
51
52 mSize = par->size() * OO_SQRT2;
53 setPatch(par->patch());
54 // LL2Coord c1 = par->Lvtx();
55 // LL2Coord c2 = par->Rvtx();
56
57 // if (c1.x() - c2.x() == 1 || c1.y() - c2.y() == 1)
58 // bool stophere = true;
59
60 if (type < 0) // left child
61 {
62 mLvtx = par->Tvtx();
63 mRvtx = par->Lvtx();
64 //mTvtx = middle(c1, c2);
65 } else {
66 mRvtx = par->Tvtx();
67 mLvtx = par->Rvtx();
68 //mTvtx = middle(c1, c2);
69 }
70 mTvtx = par->middleSide();
71 mMiddle = mLvtx.middle(mRvtx);
72 if (((LLWaterPatch*)patch())->visible())
73 setNotUpToDate();
74 else
75 setUpToDate();
76}
77
78
79void LLWaterTri::updatePassive()
80{
81 setUpToDate();
82 if (!leaf())
83 {
84 mLchild->updatePassive();
85 mRchild->updatePassive();
86 }
87}
88
89
90BOOL LLWaterTri::refine()
91{
92 if (upToDate())
93 return mRefine;
94
95 if (!patch()->refine(this))
96 {
97 setUpToDate();
98 mRefine = FALSE;
99 return mRefine;
100 }
101
102 const static F32 a = 0.6f;
103 const static F32 K = sMinStep / 50.f;//0.08f;
104 const static F32 eps = K;//0.01f;
105
106 const F32 tri_dist = llmin(sCam.distance(middleSide()) * sMinStep, sClipFar);
107 const F32 func = K * (1 - (1 - eps) * exp(a * (tri_dist - sClipFar)));
108
109
110 //const F32 tri_size = distance(mLvtx, mRvtx) * sMinStep;// * min_step2;
111 const F32 ratio = mSize / (tri_dist + 1);
112
113 if (tri_dist > 0.8 * sClipFar)
114 mRefine = ratio > func;
115 else
116 mRefine = (ratio > func) && (mLevel < sMaxDivLevel);
117
118 if (!mRefine && !mLeaf)
119 {
120 if (mLchild->refine())
121 mRefine = TRUE;
122 else if (mRchild->refine())
123 mRefine = TRUE;
124 }
125
126 setUpToDate();
127 return mRefine;
128
129 //return mGrid->refine(this);
130 //return FALSE;
131}
132