diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/lltoolbrush.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/lltoolbrush.cpp')
-rw-r--r-- | linden/indra/newview/lltoolbrush.cpp | 79 |
1 files changed, 69 insertions, 10 deletions
diff --git a/linden/indra/newview/lltoolbrush.cpp b/linden/indra/newview/lltoolbrush.cpp index 89cb0b6..0869cf3 100644 --- a/linden/indra/newview/lltoolbrush.cpp +++ b/linden/indra/newview/lltoolbrush.cpp | |||
@@ -89,7 +89,7 @@ const LLColor4 OVERLAY_COLOR(1.0f, 1.0f, 1.0f, 1.0f); | |||
89 | 89 | ||
90 | // constructor | 90 | // constructor |
91 | LLToolBrushLand::LLToolBrushLand() | 91 | LLToolBrushLand::LLToolBrushLand() |
92 | : LLTool("Land"), | 92 | : LLTool(std::string("Land")), |
93 | mStartingZ( 0.0f ), | 93 | mStartingZ( 0.0f ), |
94 | mMouseX( 0 ), | 94 | mMouseX( 0 ), |
95 | mMouseY(0), | 95 | mMouseY(0), |
@@ -154,7 +154,7 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, | |||
154 | regionp->forceUpdate(); | 154 | regionp->forceUpdate(); |
155 | 155 | ||
156 | // tell the simulator what we've done | 156 | // tell the simulator what we've done |
157 | F32 seconds = 1.0f / gFPSClamped; | 157 | F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce"); |
158 | F32 x_pos = (F32)pos_region.mV[VX]; | 158 | F32 x_pos = (F32)pos_region.mV[VX]; |
159 | F32 y_pos = (F32)pos_region.mV[VY]; | 159 | F32 y_pos = (F32)pos_region.mV[VY]; |
160 | U8 brush_size = (U8)mBrushIndex; | 160 | U8 brush_size = (U8)mBrushIndex; |
@@ -242,7 +242,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() | |||
242 | 242 | ||
243 | min_region.clamp(0.f, regionp->getWidth()); | 243 | min_region.clamp(0.f, regionp->getWidth()); |
244 | max_region.clamp(0.f, regionp->getWidth()); | 244 | max_region.clamp(0.f, regionp->getWidth()); |
245 | F32 seconds = 1.0f; | 245 | F32 seconds = gSavedSettings.getF32("LandBrushForce"); |
246 | 246 | ||
247 | LLSurface &land = regionp->getLand(); | 247 | LLSurface &land = regionp->getLand(); |
248 | char action = E_LAND_LEVEL; | 248 | char action = E_LAND_LEVEL; |
@@ -251,21 +251,23 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() | |||
251 | case 0: | 251 | case 0: |
252 | // // average toward mStartingZ | 252 | // // average toward mStartingZ |
253 | action = E_LAND_LEVEL; | 253 | action = E_LAND_LEVEL; |
254 | seconds = 1.f; | 254 | seconds *= 0.25f; |
255 | break; | 255 | break; |
256 | case 1: | 256 | case 1: |
257 | action = E_LAND_RAISE; | 257 | action = E_LAND_RAISE; |
258 | seconds *= 0.25f; | ||
258 | break; | 259 | break; |
259 | case 2: | 260 | case 2: |
260 | action = E_LAND_LOWER; | 261 | action = E_LAND_LOWER; |
262 | seconds *= 0.25f; | ||
261 | break; | 263 | break; |
262 | case 3: | 264 | case 3: |
263 | action = E_LAND_SMOOTH; | 265 | action = E_LAND_SMOOTH; |
264 | seconds = 10.f; | 266 | seconds *= 5.0f; |
265 | break; | 267 | break; |
266 | case 4: | 268 | case 4: |
267 | action = E_LAND_NOISE; | 269 | action = E_LAND_NOISE; |
268 | seconds = 0.5f; | 270 | seconds *= 0.5f; |
269 | break; | 271 | break; |
270 | case 5: | 272 | case 5: |
271 | action = E_LAND_REVERT; | 273 | action = E_LAND_REVERT; |
@@ -464,6 +466,27 @@ void LLToolBrushLand::render() | |||
464 | } | 466 | } |
465 | } | 467 | } |
466 | 468 | ||
469 | /* | ||
470 | * Draw vertical lines from each vertex straight up in world space | ||
471 | * with lengths indicating the current "strength" slider. | ||
472 | * Decorate the tops and bottoms of the lines like this: | ||
473 | * | ||
474 | * Raise Revert | ||
475 | * /|\ ___ | ||
476 | * | | | ||
477 | * | | | ||
478 | * | ||
479 | * Rough Smooth | ||
480 | * /|\ ___ | ||
481 | * | | | ||
482 | * | | | ||
483 | * \|/..........._|_ | ||
484 | * | ||
485 | * Lower Flatten | ||
486 | * | | | ||
487 | * | | | ||
488 | * \|/..........._|_ | ||
489 | */ | ||
467 | void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region, | 490 | void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region, |
468 | const LLVector3& pos_world) | 491 | const LLVector3& pos_world) |
469 | { | 492 | { |
@@ -477,19 +500,55 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region | |||
477 | S32 i = (S32) pos_region.mV[VX]; | 500 | S32 i = (S32) pos_region.mV[VX]; |
478 | S32 j = (S32) pos_region.mV[VY]; | 501 | S32 j = (S32) pos_region.mV[VY]; |
479 | S32 half_edge = llfloor(LAND_BRUSH_SIZE[mBrushIndex]); | 502 | S32 half_edge = llfloor(LAND_BRUSH_SIZE[mBrushIndex]); |
503 | S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); | ||
504 | F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100? | ||
480 | 505 | ||
481 | gGL.begin(LLVertexBuffer::POINTS); | 506 | gGL.begin(LLVertexBuffer::LINES); |
482 | for(S32 di = -half_edge; di <= half_edge; di++) | 507 | for(S32 di = -half_edge; di <= half_edge; di++) |
483 | { | 508 | { |
484 | if((i+di) < 0 || (i+di) >= (S32)land.mGridsPerEdge) continue; | 509 | if((i+di) < 0 || (i+di) >= (S32)land.mGridsPerEdge) continue; |
485 | for(S32 dj = -half_edge; dj <= half_edge; dj++) | 510 | for(S32 dj = -half_edge; dj <= half_edge; dj++) |
486 | { | 511 | { |
487 | if( (j+dj) < 0 || (j+dj) >= (S32)land.mGridsPerEdge ) continue; | 512 | if( (j+dj) < 0 || (j+dj) >= (S32)land.mGridsPerEdge ) continue; |
488 | gGL.vertex3f(pos_world.mV[VX] + di, pos_world.mV[VY] + dj, | 513 | const F32 |
489 | land.getZ((i+di)+(j+dj)*land.mGridsPerEdge)); | 514 | wx = pos_world.mV[VX] + di, |
515 | wy = pos_world.mV[VY] + dj, | ||
516 | wz = land.getZ((i+di)+(j+dj)*land.mGridsPerEdge), | ||
517 | norm_dist = sqrt((float)di*di + dj*dj) / half_edge, | ||
518 | force_scale = sqrt(2.f) - norm_dist, // 1 at center, 0 at corner | ||
519 | wz2 = wz + .2 + (.2 + force/100) * force_scale, // top vertex | ||
520 | tic = .075f; // arrowhead size | ||
521 | // vertical line | ||
522 | gGL.vertex3f(wx, wy, wz); | ||
523 | gGL.vertex3f(wx, wy, wz2); | ||
524 | if(radioAction == E_LAND_RAISE || radioAction == E_LAND_NOISE) // up arrow | ||
525 | { | ||
526 | gGL.vertex3f(wx, wy, wz2); | ||
527 | gGL.vertex3f(wx+tic, wy, wz2-tic); | ||
528 | gGL.vertex3f(wx, wy, wz2); | ||
529 | gGL.vertex3f(wx-tic, wy, wz2-tic); | ||
530 | } | ||
531 | if(radioAction == E_LAND_LOWER || radioAction == E_LAND_NOISE) // down arrow | ||
532 | { | ||
533 | gGL.vertex3f(wx, wy, wz); | ||
534 | gGL.vertex3f(wx+tic, wy, wz+tic); | ||
535 | gGL.vertex3f(wx, wy, wz); | ||
536 | gGL.vertex3f(wx-tic, wy, wz+tic); | ||
537 | } | ||
538 | if(radioAction == E_LAND_REVERT || radioAction == E_LAND_SMOOTH) // flat top | ||
539 | { | ||
540 | gGL.vertex3f(wx-tic, wy, wz2); | ||
541 | gGL.vertex3f(wx+tic, wy, wz2); | ||
542 | } | ||
543 | if(radioAction == E_LAND_LEVEL || radioAction == E_LAND_SMOOTH) // flat bottom | ||
544 | { | ||
545 | gGL.vertex3f(wx-tic, wy, wz); | ||
546 | gGL.vertex3f(wx+tic, wy, wz); | ||
547 | } | ||
490 | } | 548 | } |
491 | } | 549 | } |
492 | gGL.end(); | 550 | gGL.end(); |
551 | |||
493 | glPopMatrix(); | 552 | glPopMatrix(); |
494 | } | 553 | } |
495 | 554 | ||
@@ -589,7 +648,7 @@ void LLToolBrushLand::alertNoTerraform(LLViewerRegion* regionp) | |||
589 | { | 648 | { |
590 | if (!regionp) return; | 649 | if (!regionp) return; |
591 | 650 | ||
592 | LLStringBase<char>::format_map_t args; | 651 | LLStringUtil::format_map_t args; |
593 | args["[REGION]"] = regionp->getName(); | 652 | args["[REGION]"] = regionp->getName(); |
594 | gViewerWindow->alertXml("RegionNoTerraforming", args); | 653 | gViewerWindow->alertXml("RegionNoTerraforming", args); |
595 | 654 | ||