diff options
Diffstat (limited to 'linden/indra/newview/llcloud.cpp')
-rw-r--r-- | linden/indra/newview/llcloud.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/linden/indra/newview/llcloud.cpp b/linden/indra/newview/llcloud.cpp index 0099817..f4f5761 100644 --- a/linden/indra/newview/llcloud.cpp +++ b/linden/indra/newview/llcloud.cpp | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "v4math.h" | 38 | #include "v4math.h" |
39 | #include "llquaternion.h" | 39 | #include "llquaternion.h" |
40 | #include "v4color.h" | 40 | #include "v4color.h" |
41 | #include "llviewercontrol.h" | ||
41 | 42 | ||
42 | #include "llwind.h" | 43 | #include "llwind.h" |
43 | #include "llcloud.h" | 44 | #include "llcloud.h" |
@@ -56,15 +57,6 @@ | |||
56 | 57 | ||
57 | extern LLPipeline gPipeline; | 58 | extern LLPipeline gPipeline; |
58 | 59 | ||
59 | const F32 CLOUD_UPDATE_RATE = 1.0f; // Global time dilation for clouds | ||
60 | const F32 CLOUD_GROW_RATE = 0.05f; | ||
61 | const F32 CLOUD_DECAY_RATE = -0.05f; | ||
62 | const F32 CLOUD_VELOCITY_SCALE = 0.01f; | ||
63 | const F32 CLOUD_DENSITY = 25.f; | ||
64 | const S32 CLOUD_COUNT_MAX = 20; | ||
65 | const F32 CLOUD_HEIGHT_RANGE = 48.f; | ||
66 | const F32 CLOUD_HEIGHT_MEAN = 192.f; | ||
67 | |||
68 | enum | 60 | enum |
69 | { | 61 | { |
70 | LL_PUFF_GROWING = 0, | 62 | LL_PUFF_GROWING = 0, |
@@ -80,7 +72,7 @@ S32 LLCloudPuff::sPuffCount = 0; | |||
80 | 72 | ||
81 | LLCloudPuff::LLCloudPuff() : | 73 | LLCloudPuff::LLCloudPuff() : |
82 | mAlpha(0.01f), | 74 | mAlpha(0.01f), |
83 | mRate(CLOUD_GROW_RATE*CLOUD_UPDATE_RATE), | 75 | mRate((gSavedSettings.getF32("CloudGrowRate")/100)*gSavedSettings.getF32("CloudUpdateRate")), |
84 | mLifeState(LL_PUFF_GROWING) | 76 | mLifeState(LL_PUFF_GROWING) |
85 | { | 77 | { |
86 | } | 78 | } |
@@ -121,7 +113,7 @@ void LLCloudGroup::updatePuffs(const F32 dt) | |||
121 | mVOCloudsp->setPositionRegion(mCenterRegion); | 113 | mVOCloudsp->setPositionRegion(mCenterRegion); |
122 | mVOCloudsp->setScale(LLVector3(256.f/CLOUD_GROUPS_PER_EDGE + CLOUD_PUFF_WIDTH, | 114 | mVOCloudsp->setScale(LLVector3(256.f/CLOUD_GROUPS_PER_EDGE + CLOUD_PUFF_WIDTH, |
123 | 256.f/CLOUD_GROUPS_PER_EDGE + CLOUD_PUFF_WIDTH, | 115 | 256.f/CLOUD_GROUPS_PER_EDGE + CLOUD_PUFF_WIDTH, |
124 | CLOUD_HEIGHT_RANGE + CLOUD_PUFF_HEIGHT)*0.5f); | 116 | gSavedSettings.getF32("ClassicCloudRange") + CLOUD_PUFF_HEIGHT)*0.5f); |
125 | gPipeline.createObject(mVOCloudsp); | 117 | gPipeline.createObject(mVOCloudsp); |
126 | } | 118 | } |
127 | 119 | ||
@@ -132,7 +124,7 @@ void LLCloudGroup::updatePuffs(const F32 dt) | |||
132 | { | 124 | { |
133 | LLCloudPuff &puff = mCloudPuffs[i]; | 125 | LLCloudPuff &puff = mCloudPuffs[i]; |
134 | velocity = mCloudLayerp->getRegion()->mWind.getCloudVelocity(mCloudLayerp->getRegion()->getPosRegionFromGlobal(puff.mPositionGlobal)); | 126 | velocity = mCloudLayerp->getRegion()->mWind.getCloudVelocity(mCloudLayerp->getRegion()->getPosRegionFromGlobal(puff.mPositionGlobal)); |
135 | velocity *= CLOUD_VELOCITY_SCALE*CLOUD_UPDATE_RATE; | 127 | velocity *= (gSavedSettings.getF32("CloudVelocityScale")/100)*gSavedSettings.getF32("CloudUpdateRate"); |
136 | vel_d.setVec(velocity); | 128 | vel_d.setVec(velocity); |
137 | mCloudPuffs[i].mPositionGlobal += vel_d; | 129 | mCloudPuffs[i].mPositionGlobal += vel_d; |
138 | mCloudPuffs[i].mAlpha += mCloudPuffs[i].mRate * dt; | 130 | mCloudPuffs[i].mAlpha += mCloudPuffs[i].mRate * dt; |
@@ -163,7 +155,7 @@ void LLCloudGroup::updatePuffOwnership() | |||
163 | { | 155 | { |
164 | //llinfos << "Killing puff not in group" << llendl; | 156 | //llinfos << "Killing puff not in group" << llendl; |
165 | mCloudPuffs[i].setLifeState(LL_PUFF_DYING); | 157 | mCloudPuffs[i].setLifeState(LL_PUFF_DYING); |
166 | mCloudPuffs[i].mRate = CLOUD_DECAY_RATE*CLOUD_UPDATE_RATE; | 158 | mCloudPuffs[i].mRate = (gSavedSettings.getF32("CloudDecayRate")/100)*gSavedSettings.getF32("CloudUpdateRate"); |
167 | i++; | 159 | i++; |
168 | continue; | 160 | continue; |
169 | } | 161 | } |
@@ -185,9 +177,9 @@ void LLCloudGroup::updatePuffCount() | |||
185 | return; | 177 | return; |
186 | } | 178 | } |
187 | S32 i; | 179 | S32 i; |
188 | S32 target_puff_count = llround(CLOUD_DENSITY * mDensity); | 180 | S32 target_puff_count = llround((S32)gSavedSettings.getF32("CloudDensity") * mDensity); |
189 | target_puff_count = llmax(0, target_puff_count); | 181 | target_puff_count = llmax(0, target_puff_count); |
190 | target_puff_count = llmin(CLOUD_COUNT_MAX, target_puff_count); | 182 | target_puff_count = llmin((S32)gSavedSettings.getF32("CloudCountMax"), target_puff_count); |
191 | S32 current_puff_count = (S32) mCloudPuffs.size(); | 183 | S32 current_puff_count = (S32) mCloudPuffs.size(); |
192 | // Create a new cloud if we need one | 184 | // Create a new cloud if we need one |
193 | if (current_puff_count < target_puff_count) | 185 | if (current_puff_count < target_puff_count) |
@@ -199,7 +191,7 @@ void LLCloudGroup::updatePuffCount() | |||
199 | puff_pos_global = mVOCloudsp->getPositionGlobal(); | 191 | puff_pos_global = mVOCloudsp->getPositionGlobal(); |
200 | F32 x = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; | 192 | F32 x = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; |
201 | F32 y = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; | 193 | F32 y = ll_frand(256.f/CLOUD_GROUPS_PER_EDGE) - 128.f/CLOUD_GROUPS_PER_EDGE; |
202 | F32 z = ll_frand(CLOUD_HEIGHT_RANGE) - 0.5f*CLOUD_HEIGHT_RANGE; | 194 | F32 z = ll_frand(gSavedSettings.getF32("ClassicCloudRange")) - 0.5f*gSavedSettings.getF32("ClassicCloudRange"); |
203 | puff_pos_global += LLVector3d(x, y, z); | 195 | puff_pos_global += LLVector3d(x, y, z); |
204 | mCloudPuffs[i].mPositionGlobal = puff_pos_global; | 196 | mCloudPuffs[i].mPositionGlobal = puff_pos_global; |
205 | mCloudPuffs[i].mAlpha = 0.01f; | 197 | mCloudPuffs[i].mAlpha = 0.01f; |
@@ -227,7 +219,7 @@ void LLCloudGroup::updatePuffCount() | |||
227 | { | 219 | { |
228 | //llinfos << "Killing extra live cloud" << llendl; | 220 | //llinfos << "Killing extra live cloud" << llendl; |
229 | mCloudPuffs[i].setLifeState(LL_PUFF_DYING); | 221 | mCloudPuffs[i].setLifeState(LL_PUFF_DYING); |
230 | mCloudPuffs[i].mRate = CLOUD_DECAY_RATE*CLOUD_UPDATE_RATE; | 222 | mCloudPuffs[i].mRate = (gSavedSettings.getF32("CloudDecayRate")/100)*gSavedSettings.getF32("CloudUpdateRate"); |
231 | new_dying_count--; | 223 | new_dying_count--; |
232 | } | 224 | } |
233 | i++; | 225 | i++; |
@@ -294,7 +286,7 @@ LLCloudLayer::LLCloudLayer() | |||
294 | x = (0.5f + j)*(256.f/CLOUD_GROUPS_PER_EDGE); | 286 | x = (0.5f + j)*(256.f/CLOUD_GROUPS_PER_EDGE); |
295 | 287 | ||
296 | mCloudGroups[i][j].setCloudLayerp(this); | 288 | mCloudGroups[i][j].setCloudLayerp(this); |
297 | mCloudGroups[i][j].setCenterRegion(LLVector3(x, y, CLOUD_HEIGHT_MEAN)); | 289 | mCloudGroups[i][j].setCenterRegion(LLVector3(x, y, gSavedSettings.getF32("ClassicCloudHeight"))); |
298 | } | 290 | } |
299 | } | 291 | } |
300 | } | 292 | } |
@@ -348,8 +340,6 @@ void LLCloudLayer::destroy() | |||
348 | void LLCloudLayer::reset() | 340 | void LLCloudLayer::reset() |
349 | { | 341 | { |
350 | } | 342 | } |
351 | |||
352 | |||
353 | void LLCloudLayer::setWindPointer(LLWind *windp) | 343 | void LLCloudLayer::setWindPointer(LLWind *windp) |
354 | { | 344 | { |
355 | if (mWindp) | 345 | if (mWindp) |