aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltoolbrush.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/lltoolbrush.cpp')
-rw-r--r--linden/indra/newview/lltoolbrush.cpp45
1 files changed, 33 insertions, 12 deletions
diff --git a/linden/indra/newview/lltoolbrush.cpp b/linden/indra/newview/lltoolbrush.cpp
index 46b36d9..d23e29d 100644
--- a/linden/indra/newview/lltoolbrush.cpp
+++ b/linden/indra/newview/lltoolbrush.cpp
@@ -96,7 +96,24 @@ LLToolBrushLand::LLToolBrushLand()
96 mGotHover(FALSE), 96 mGotHover(FALSE),
97 mBrushSelected(FALSE) 97 mBrushSelected(FALSE)
98{ 98{
99 mBrushIndex = gSavedSettings.getS32("LandBrushSize"); 99 mBrushSize = gSavedSettings.getF32("LandBrushSize");
100}
101
102
103U8 LLToolBrushLand::getBrushIndex()
104{
105 // find the best index for desired size
106 // (compatibility with old sims, brush_index is now depricated - DEV-8252)
107 U8 index = 0;
108 for (U8 i = 0; i < LAND_BRUSH_SIZE_COUNT; i++)
109 {
110 if (mBrushSize > LAND_BRUSH_SIZE[i])
111 {
112 index = i;
113 }
114 }
115
116 return index;
100} 117}
101 118
102void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, 119void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
@@ -157,7 +174,6 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
157 F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce"); 174 F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce");
158 F32 x_pos = (F32)pos_region.mV[VX]; 175 F32 x_pos = (F32)pos_region.mV[VX];
159 F32 y_pos = (F32)pos_region.mV[VY]; 176 F32 y_pos = (F32)pos_region.mV[VY];
160 U8 brush_size = (U8)mBrushIndex;
161 LLMessageSystem* msg = gMessageSystem; 177 LLMessageSystem* msg = gMessageSystem;
162 msg->newMessageFast(_PREHASH_ModifyLand); 178 msg->newMessageFast(_PREHASH_ModifyLand);
163 msg->nextBlockFast(_PREHASH_AgentData); 179 msg->nextBlockFast(_PREHASH_AgentData);
@@ -165,7 +181,7 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
165 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 181 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
166 msg->nextBlockFast(_PREHASH_ModifyBlock); 182 msg->nextBlockFast(_PREHASH_ModifyBlock);
167 msg->addU8Fast(_PREHASH_Action, (U8)action); 183 msg->addU8Fast(_PREHASH_Action, (U8)action);
168 msg->addU8Fast(_PREHASH_BrushSize, brush_size); 184 msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex());
169 msg->addF32Fast(_PREHASH_Seconds, seconds); 185 msg->addF32Fast(_PREHASH_Seconds, seconds);
170 msg->addF32Fast(_PREHASH_Height, mStartingZ); 186 msg->addF32Fast(_PREHASH_Height, mStartingZ);
171 msg->nextBlockFast(_PREHASH_ParcelData); 187 msg->nextBlockFast(_PREHASH_ParcelData);
@@ -174,6 +190,8 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
174 msg->addF32Fast(_PREHASH_South, y_pos ); 190 msg->addF32Fast(_PREHASH_South, y_pos );
175 msg->addF32Fast(_PREHASH_East, x_pos ); 191 msg->addF32Fast(_PREHASH_East, x_pos );
176 msg->addF32Fast(_PREHASH_North, y_pos ); 192 msg->addF32Fast(_PREHASH_North, y_pos );
193 msg->nextBlock("ModifyBlockExtended");
194 msg->addF32("BrushSize", mBrushSize);
177 msg->sendMessage(regionp->getHost()); 195 msg->sendMessage(regionp->getHost());
178 } 196 }
179} 197}
@@ -294,7 +312,6 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
294 regionp->forceUpdate(); 312 regionp->forceUpdate();
295 313
296 // tell the simulator what we've done 314 // tell the simulator what we've done
297 U8 brush_size = (U8)mBrushIndex;
298 LLMessageSystem* msg = gMessageSystem; 315 LLMessageSystem* msg = gMessageSystem;
299 msg->newMessageFast(_PREHASH_ModifyLand); 316 msg->newMessageFast(_PREHASH_ModifyLand);
300 msg->nextBlockFast(_PREHASH_AgentData); 317 msg->nextBlockFast(_PREHASH_AgentData);
@@ -302,7 +319,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
302 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 319 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
303 msg->nextBlockFast(_PREHASH_ModifyBlock); 320 msg->nextBlockFast(_PREHASH_ModifyBlock);
304 msg->addU8Fast(_PREHASH_Action, (U8)action); 321 msg->addU8Fast(_PREHASH_Action, (U8)action);
305 msg->addU8Fast(_PREHASH_BrushSize, brush_size); 322 msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex());
306 msg->addF32Fast(_PREHASH_Seconds, seconds); 323 msg->addF32Fast(_PREHASH_Seconds, seconds);
307 msg->addF32Fast(_PREHASH_Height, mStartingZ); 324 msg->addF32Fast(_PREHASH_Height, mStartingZ);
308 325
@@ -327,6 +344,9 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
327 msg->addF32Fast(_PREHASH_East, max_region.mV[VX] ); 344 msg->addF32Fast(_PREHASH_East, max_region.mV[VX] );
328 msg->addF32Fast(_PREHASH_North, max_region.mV[VY] ); 345 msg->addF32Fast(_PREHASH_North, max_region.mV[VY] );
329 } 346 }
347
348 msg->nextBlock("ModifyBlockExtended");
349 msg->addF32("BrushSize", mBrushSize);
330 350
331 msg->sendMessage(regionp->getHost()); 351 msg->sendMessage(regionp->getHost());
332 } 352 }
@@ -447,7 +467,8 @@ void LLToolBrushLand::render()
447 spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 ); 467 spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
448 spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 ); 468 spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
449 469
450 mBrushIndex = gSavedSettings.getS32("LandBrushSize"); 470 mBrushSize = gSavedSettings.getF32("LandBrushSize");
471
451 region_list_t regions; 472 region_list_t regions;
452 determineAffectedRegions(regions, spot); 473 determineAffectedRegions(regions, spot);
453 474
@@ -499,7 +520,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region
499 520
500 S32 i = (S32) pos_region.mV[VX]; 521 S32 i = (S32) pos_region.mV[VX];
501 S32 j = (S32) pos_region.mV[VY]; 522 S32 j = (S32) pos_region.mV[VY];
502 S32 half_edge = llfloor(LAND_BRUSH_SIZE[mBrushIndex]); 523 S32 half_edge = llfloor(mBrushSize);
503 S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); 524 S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
504 F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100? 525 F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100?
505 526
@@ -556,27 +577,27 @@ void LLToolBrushLand::determineAffectedRegions(region_list_t& regions,
556 const LLVector3d& spot ) const 577 const LLVector3d& spot ) const
557{ 578{
558 LLVector3d corner(spot); 579 LLVector3d corner(spot);
559 corner.mdV[VX] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2); 580 corner.mdV[VX] -= (mBrushSize / 2);
560 corner.mdV[VY] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2); 581 corner.mdV[VY] -= (mBrushSize / 2);
561 LLViewerRegion* region = NULL; 582 LLViewerRegion* region = NULL;
562 region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); 583 region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
563 if(region && regions.find(region) == regions.end()) 584 if(region && regions.find(region) == regions.end())
564 { 585 {
565 regions.insert(region); 586 regions.insert(region);
566 } 587 }
567 corner.mdV[VY] += LAND_BRUSH_SIZE[mBrushIndex]; 588 corner.mdV[VY] += mBrushSize;
568 region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); 589 region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
569 if(region && regions.find(region) == regions.end()) 590 if(region && regions.find(region) == regions.end())
570 { 591 {
571 regions.insert(region); 592 regions.insert(region);
572 } 593 }
573 corner.mdV[VX] += LAND_BRUSH_SIZE[mBrushIndex]; 594 corner.mdV[VX] += mBrushSize;
574 region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); 595 region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
575 if(region && regions.find(region) == regions.end()) 596 if(region && regions.find(region) == regions.end())
576 { 597 {
577 regions.insert(region); 598 regions.insert(region);
578 } 599 }
579 corner.mdV[VY] -= LAND_BRUSH_SIZE[mBrushIndex]; 600 corner.mdV[VY] -= mBrushSize;
580 region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); 601 region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
581 if(region && regions.find(region) == regions.end()) 602 if(region && regions.find(region) == regions.end())
582 { 603 {