forestBrushTool.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "platform/platform.h"
  23. #include "forest/editor/forestBrushTool.h"
  24. #include "forest/forest.h"
  25. #include "forest/editor/forestUndo.h"
  26. #include "forest/editor/forestBrushElement.h"
  27. #include "forest/editor/forestEditorCtrl.h"
  28. #include "gui/worldEditor/editTSCtrl.h"
  29. #include "console/consoleTypes.h"
  30. #include "core/util/tVector.h"
  31. #include "gfx/gfxDrawUtil.h"
  32. #include "gui/core/guiCanvas.h"
  33. #include "gfx/primBuilder.h"
  34. #include "gui/controls/guiTreeViewCtrl.h"
  35. #include "core/strings/stringUnit.h"
  36. #include "math/mRandomDeck.h"
  37. #include "math/mRandomSet.h"
  38. bool ForestBrushTool::protectedSetSize( void *object, const char *index, const char *data )
  39. {
  40. ForestBrushTool *tool = static_cast<ForestBrushTool*>( object );
  41. F32 val = dAtof(data);
  42. tool->setSize( val );
  43. return false;
  44. }
  45. bool ForestBrushTool::protectedSetPressure( void *object, const char *index, const char *data )
  46. {
  47. ForestBrushTool *tool = static_cast<ForestBrushTool*>( object );
  48. F32 val = dAtof(data);
  49. tool->setPressure( val );
  50. return false;
  51. }
  52. bool ForestBrushTool::protectedSetHardness( void *object, const char *index, const char *data )
  53. {
  54. ForestBrushTool *tool = static_cast<ForestBrushTool*>( object );
  55. F32 val = dAtof(data);
  56. tool->setHardness( val );
  57. return false;
  58. }
  59. ImplementEnumType( ForestBrushMode,
  60. "Active brush mode type.\n"
  61. "@internal\n\n")
  62. { ForestBrushTool::Paint, "Paint", "Creates Items based on the Elements you have selected.\n" },
  63. { ForestBrushTool::Erase, "Erase", "Erases Items of any Mesh type.\n" },
  64. { ForestBrushTool::EraseSelected, "EraseSelected", "Erases items of a specific type.\n" },
  65. EndImplementEnumType;
  66. ForestBrushTool::ForestBrushTool()
  67. : mSize( 5.0f ),
  68. mPressure( 0.1f ),
  69. mHardness( 1.0f ),
  70. mDrawBrush( false ),
  71. mCurrAction( NULL ),
  72. mStrokeEvent( 0 ),
  73. mBrushDown( false ),
  74. mColor( ColorI::WHITE ),
  75. mMode( Paint ),
  76. mRandom( Platform::getRealMilliseconds() + 1 )
  77. {
  78. }
  79. ForestBrushTool::~ForestBrushTool()
  80. {
  81. }
  82. IMPLEMENT_CONOBJECT( ForestBrushTool );
  83. ConsoleDocClass( ForestBrushTool,
  84. "@brief Defines the brush properties when painting trees in Forest Editor\n\n"
  85. "Editor use only.\n\n"
  86. "@internal"
  87. );
  88. void ForestBrushTool::initPersistFields()
  89. {
  90. addGroup( "ForestBrushTool" );
  91. addField( "mode", TYPEID< BrushMode >(), Offset( mMode, ForestBrushTool) );
  92. addProtectedField( "size", TypeF32, Offset( mSize, ForestBrushTool ),
  93. &protectedSetSize, &defaultProtectedGetFn, "Brush Size" );
  94. addProtectedField( "pressure", TypeF32, Offset( mPressure, ForestBrushTool ),
  95. &protectedSetPressure, &defaultProtectedGetFn, "Brush Pressure" );
  96. addProtectedField( "hardness", TypeF32, Offset( mHardness, ForestBrushTool ),
  97. &protectedSetHardness, &defaultProtectedGetFn, "Brush Hardness" );
  98. endGroup( "ForestBrushTool" );
  99. Parent::initPersistFields();
  100. }
  101. bool ForestBrushTool::onAdd()
  102. {
  103. if ( !Parent::onAdd() )
  104. return false;
  105. return true;
  106. }
  107. void ForestBrushTool::onRemove()
  108. {
  109. Parent::onRemove();
  110. }
  111. void ForestBrushTool::on3DMouseDown( const Gui3DMouseEvent &evt )
  112. {
  113. Con::executef( this, "onMouseDown" );
  114. if ( !_updateBrushPoint( evt ) || !mForest )
  115. return;
  116. mBrushDown = true;
  117. mEditor->getRoot()->showCursor( false );
  118. _collectElements();
  119. _onStroke();
  120. return;
  121. }
  122. void ForestBrushTool::on3DMouseUp( const Gui3DMouseEvent &evt )
  123. {
  124. _updateBrushPoint( evt );
  125. Sim::cancelEvent( mStrokeEvent );
  126. mBrushDown = false;
  127. mEditor->getRoot()->showCursor( true );
  128. if ( mCurrAction )
  129. {
  130. _submitUndo( mCurrAction );
  131. mCurrAction = NULL;
  132. }
  133. //mElements.clear();
  134. }
  135. void ForestBrushTool::on3DMouseMove( const Gui3DMouseEvent &evt )
  136. {
  137. _updateBrushPoint( evt );
  138. }
  139. void ForestBrushTool::on3DMouseDragged( const Gui3DMouseEvent &evt )
  140. {
  141. _updateBrushPoint( evt );
  142. if ( mBrushDown && !Sim::isEventPending( mStrokeEvent ) )
  143. mStrokeEvent = Sim::postEvent( this, new ForestBrushToolEvent(), Sim::getCurrentTime() + 250 );
  144. }
  145. bool ForestBrushTool::onMouseWheel( const GuiEvent &evt )
  146. {
  147. if ( evt.modifier & SI_PRIMARY_CTRL )
  148. setPressure( mPressure + evt.fval * ( 0.05f / 120.0f ) );
  149. else if ( evt.modifier & SI_SHIFT )
  150. setHardness( mHardness + evt.fval * ( 0.05f / 120.0f ) );
  151. else
  152. setSize( mSize + evt.fval * ( 1.0f / 120.0f ) );
  153. return true;
  154. }
  155. void ForestBrushTool::onRender3D( )
  156. {
  157. }
  158. void ForestBrushTool::onRender2D()
  159. {
  160. if ( !mDrawBrush )
  161. return;
  162. if ( !mEditor->getRoot()->isCursorON() && !mBrushDown )
  163. return;
  164. RayInfo ri;
  165. Point3F start( 0, 0, mLastBrushPoint.z + mSize );
  166. Point3F end( 0, 0, mLastBrushPoint.z - mSize );
  167. Vector<Point3F> pointList;
  168. const U32 steps = 32;
  169. if ( mForest )
  170. mForest->disableCollision();
  171. for ( S32 i = 0; i < steps; i++ )
  172. {
  173. F32 radians = (F32)i / (F32)(steps-1) * M_2PI_F;
  174. VectorF vec(0,1,0);
  175. MathUtils::vectorRotateZAxis( vec, radians );
  176. end.x = start.x = mLastBrushPoint.x + vec.x * mSize;
  177. end.y = start.y = mLastBrushPoint.y + vec.y * mSize;
  178. bool hit = gServerContainer.castRay( start, end, TerrainObjectType | StaticShapeObjectType, &ri );
  179. if ( hit )
  180. pointList.push_back( ri.point );
  181. }
  182. if ( mForest )
  183. mForest->enableCollision();
  184. if ( pointList.empty() )
  185. return;
  186. ColorI brushColor( ColorI::WHITE );
  187. if ( mMode == Paint )
  188. brushColor = ColorI::BLUE;
  189. else if ( mMode == Erase )
  190. brushColor = ColorI::RED;
  191. else if ( mMode == EraseSelected )
  192. brushColor.set( 150, 0, 0 );
  193. if ( mMode == Paint || mMode == EraseSelected )
  194. {
  195. if ( mElements.empty() )
  196. {
  197. brushColor.set( 140, 140, 140 );
  198. }
  199. }
  200. mEditor->drawLineList( pointList, brushColor, 1.5f );
  201. }
  202. void ForestBrushTool::onActivated( const Gui3DMouseEvent &lastEvent )
  203. {
  204. _updateBrushPoint( lastEvent );
  205. Con::executef( this, "onActivated" );
  206. }
  207. void ForestBrushTool::onDeactivated()
  208. {
  209. Con::executef( this, "onDeactivated" );
  210. }
  211. bool ForestBrushTool::updateGuiInfo()
  212. {
  213. GuiTextCtrl *statusbar;
  214. Sim::findObject( "EWorldEditorStatusBarInfo", statusbar );
  215. GuiTextCtrl *selectionBar;
  216. Sim::findObject( "EWorldEditorStatusBarSelection", selectionBar );
  217. String text;
  218. if ( mMode == Paint )
  219. text = "Forest Editor ( Paint Tool ) - This brush creates Items based on the Elements you have selected.";
  220. else if ( mMode == Erase )
  221. text = "Forest Editor ( Erase Tool ) - This brush erases Items of any Mesh type.";
  222. else if ( mMode == EraseSelected )
  223. text = "Forest Editor ( Erase Selected ) - This brush erases Items based on the Elements you have selected.";
  224. if ( statusbar )
  225. statusbar->setText( text );
  226. if ( mMode == Paint || mMode == EraseSelected )
  227. text = String::ToString( "%i elements selected", mElements.size() );
  228. else
  229. text = "";
  230. if ( selectionBar )
  231. selectionBar->setText( text );
  232. return true;
  233. }
  234. void ForestBrushTool::setSize( F32 val )
  235. {
  236. mSize = mClampF( val, 0.0f, 150.0f );
  237. Con::executef( this, "syncBrushToolbar" );
  238. }
  239. void ForestBrushTool::setPressure( F32 val )
  240. {
  241. mPressure = mClampF( val, 0.0f, 1.0f );
  242. Con::executef( this, "syncBrushToolbar" );
  243. }
  244. void ForestBrushTool::setHardness( F32 val )
  245. {
  246. mHardness = mClampF( val, 0.0f, 1.0f );
  247. Con::executef( this, "syncBrushToolbar" );
  248. }
  249. void ForestBrushTool::_onStroke()
  250. {
  251. if ( !mForest || !mBrushDown )
  252. return;
  253. _action( mLastBrushPoint );
  254. }
  255. void ForestBrushTool::_action( const Point3F &point )
  256. {
  257. if ( mMode == Paint )
  258. _paint( point );
  259. else if ( mMode == Erase || mMode == EraseSelected )
  260. _erase( point );
  261. }
  262. inline F32 mCircleArea( F32 radius )
  263. {
  264. return radius * radius * M_PI_F;
  265. }
  266. void ForestBrushTool::_paint( const Point3F &point )
  267. {
  268. AssertFatal( mForest, "ForestBrushTool::_paint() - Can't paint without a Forest!" );
  269. if ( mElements.empty() )
  270. return;
  271. // Iterators, pointers, and temporaries.
  272. ForestBrushElement *pElement;
  273. ForestItemData *pData;
  274. F32 radius, area;
  275. // How much area do we have to fill with trees ( within the brush ).
  276. F32 fillArea = mCircleArea( mSize );
  277. // Scale that down by pressure, this is how much area we want to fill.
  278. fillArea *= mPressure;
  279. // Create an MRandomSet we can get items we are painting out of with
  280. // the desired distribution.
  281. // Also grab the smallest and largest radius elements while we are looping.
  282. ForestBrushElement *smallestElement, *largestElement;
  283. smallestElement = largestElement = mElements[0];
  284. MRandomSet<ForestBrushElement*> randElementSet(&mRandom);
  285. for ( S32 i = 0; i < mElements.size(); i++ )
  286. {
  287. pElement = mElements[i];
  288. if ( pElement->mData->mRadius > largestElement->mData->mRadius )
  289. largestElement = pElement;
  290. if ( pElement->mData->mRadius < smallestElement->mData->mRadius )
  291. smallestElement = pElement;
  292. randElementSet.add( pElement, pElement->mProbability );
  293. }
  294. // Pull elements from the random set until we would theoretically fill
  295. // the desired area.
  296. F32 areaLeft = fillArea;
  297. F32 scaleFactor, sink, randRot, worldCoordZ, slope;
  298. Point2F worldCoords;
  299. Point3F normalVector, right;
  300. Point2F temp;
  301. const S32 MaxTries = 5;
  302. while ( areaLeft > 0.0f )
  303. {
  304. pElement = randElementSet.get();
  305. pData = pElement->mData;
  306. scaleFactor = mLerp( pElement->mScaleMin, pElement->mScaleMax, mClampF( mPow( mRandom.randF(), pElement->mScaleExponent ), 0.0f, 1.0f ) );
  307. radius = getMax( pData->mRadius * scaleFactor, 0.1f );
  308. area = mCircleArea( radius );
  309. areaLeft -= area * 5.0f; // fudge value
  310. // No room left we are done.
  311. //if ( areaLeft < 0.0f )
  312. // break;
  313. // We have area left to fill...
  314. const F32 rotRange = mDegToRad( pElement->mRotationRange );
  315. // Get a random sink value.
  316. sink = mRandom.randF( pElement->mSinkMin, pElement->mSinkMax ) * scaleFactor;
  317. // Get a random rotation.
  318. randRot = mRandom.randF( 0.0f, rotRange );
  319. // Look for a place within the brush area to place this item.
  320. // We may have to try several times or give and go onto the next.
  321. S32 i = 0;
  322. for ( ; i < MaxTries; i++ )
  323. {
  324. // Pick some randoms for placement.
  325. worldCoords = MathUtils::randomPointInCircle( mSize ) + point.asPoint2F();
  326. // Look for the ground at this position.
  327. if ( !getGroundAt( Point3F( worldCoords.x, worldCoords.y , point.z ),
  328. &worldCoordZ,
  329. &normalVector ) )
  330. {
  331. continue;
  332. }
  333. // Does this pass our slope and elevation limits.
  334. right.set( normalVector.x, normalVector.y, 0 );
  335. right.normalizeSafe();
  336. slope = mRadToDeg( mDot( right, normalVector ) );
  337. if ( worldCoordZ < pElement->mElevationMin ||
  338. worldCoordZ > pElement->mElevationMax ||
  339. slope < pElement->mSlopeMin ||
  340. slope > pElement->mSlopeMax )
  341. {
  342. continue;
  343. }
  344. // Are we up against another tree?
  345. if ( mForest->getData()->getItems( worldCoords, radius, NULL ) > 0 )
  346. continue;
  347. // If the trunk radius is set then we need to sink
  348. // the tree into the ground a bit to hide the bottom.
  349. if ( pElement->mSinkRadius > 0.0f )
  350. {
  351. // Items that are not aligned to the ground surface
  352. // get sunken down to hide the bottom of their trunks.
  353. // sunk down a bit to hide their bottoms on slopes.
  354. normalVector.z = 0;
  355. normalVector.normalizeSafe();
  356. normalVector *= sink;
  357. temp = worldCoords + normalVector.asPoint2F();
  358. getGroundAt( Point3F( temp.x, temp.y, point.z ),
  359. &worldCoordZ,
  360. NULL );
  361. }
  362. worldCoordZ -= sink;
  363. // Create a new undo action if this is a new stroke.
  364. ForestCreateUndoAction *action = dynamic_cast<ForestCreateUndoAction*>( mCurrAction );
  365. if ( !action )
  366. {
  367. action = new ForestCreateUndoAction( mForest->getData(), mEditor );
  368. mCurrAction = action;
  369. }
  370. //Con::printf( "worldCoords = %g, %g, %g", worldCoords.x, worldCoords.y, worldCoordZ );
  371. // Let the action manage adding it to the forest.
  372. action->addItem( pData,
  373. Point3F( worldCoords.x, worldCoords.y, worldCoordZ ),
  374. randRot,
  375. scaleFactor );
  376. break;
  377. }
  378. }
  379. }
  380. void ForestBrushTool::_erase( const Point3F &point )
  381. {
  382. AssertFatal( mForest, "ForestBrushTool::_erase() - Can't erase without a Forest!" );
  383. // First grab all the forest items around the point.
  384. ForestItemVector trees;
  385. if ( mForest->getData()->getItems( point.asPoint2F(), mSize, &trees ) == 0 )
  386. return;
  387. if ( mMode == EraseSelected )
  388. {
  389. for ( U32 i = 0; i < trees.size(); i++ )
  390. {
  391. const ForestItem &tree = trees[i];
  392. if ( !mDatablocks.contains( tree.getData() ) )
  393. {
  394. trees.erase_fast( i );
  395. i--;
  396. }
  397. }
  398. }
  399. if ( trees.empty() )
  400. return;
  401. // Number of trees to erase depending on pressure.
  402. S32 eraseCount = getMax( (S32)mCeil( (F32)trees.size() * mPressure ), 0 );
  403. // Initialize an MRandomDeck with trees under the brush.
  404. MRandomDeck<ForestItem> deck(&mRandom);
  405. deck.addToPile( trees );
  406. deck.shuffle();
  407. ForestItem currentTree;
  408. // Draw eraseCount number of trees from MRandomDeck, adding them to our erase action.
  409. for ( U32 i = 0; i < eraseCount; i++ )
  410. {
  411. deck.draw(&currentTree);
  412. // Create a new undo action if this is a new stroke.
  413. ForestDeleteUndoAction *action = dynamic_cast<ForestDeleteUndoAction*>( mCurrAction );
  414. if ( !action )
  415. {
  416. action = new ForestDeleteUndoAction( mForest->getData(), mEditor );
  417. mCurrAction = action;
  418. }
  419. action->removeItem( currentTree );
  420. }
  421. }
  422. bool ForestBrushTool::_updateBrushPoint( const Gui3DMouseEvent &event_ )
  423. {
  424. // Do a raycast for terrain... thats the placement center.
  425. const U32 mask = TerrainObjectType | StaticShapeObjectType; // TODO: Make an option!
  426. Point3F start( event_.pos );
  427. Point3F end( event_.pos + ( event_.vec * 10000.0f ) );
  428. if ( mForest )
  429. mForest->disableCollision();
  430. RayInfo rinfo;
  431. mDrawBrush = gServerContainer.castRay( start, end, mask, &rinfo );
  432. if ( mForest )
  433. mForest->enableCollision();
  434. if ( mDrawBrush )
  435. {
  436. mLastBrushPoint = rinfo.point;
  437. mLastBrushNormal = rinfo.normal;
  438. }
  439. return mDrawBrush;
  440. }
  441. bool findSelectedElements( ForestBrushElement *obj )
  442. {
  443. if ( obj->isSelectedRecursive() )
  444. return true;
  445. return false;
  446. }
  447. void ForestBrushTool::_collectElements()
  448. {
  449. mElements.clear();
  450. // Get the selected objects from the tree view.
  451. // These can be a combination of ForestBrush(s) and ForestBrushElement(s).
  452. GuiTreeViewCtrl *brushTree;
  453. if ( !Sim::findObject( "ForestEditBrushTree", brushTree ) )
  454. return;
  455. const char* objectIdList = Con::executef( brushTree, "getSelectedObjectList" );
  456. // Collect those objects in a vector and mark them as selected.
  457. Vector<SimObject*> objectList;
  458. SimObject *simobj;
  459. S32 wordCount = StringUnit::getUnitCount( objectIdList, " " );
  460. for ( S32 i = 0; i < wordCount; i++ )
  461. {
  462. const char* word = StringUnit::getUnit( objectIdList, i, " " );
  463. if ( Sim::findObject( word, simobj ) )
  464. {
  465. objectList.push_back( simobj );
  466. simobj->setSelected(true);
  467. }
  468. }
  469. // Find all ForestBrushElements that are directly or indirectly selected.
  470. SimGroup *brushGroup = ForestBrush::getGroup();
  471. brushGroup->findObjectByCallback( findSelectedElements, mElements );
  472. // We just needed to flag these objects as selected for the benefit of our
  473. // findSelectedElements callback, we can now mark them un-selected again.
  474. for ( S32 i = 0; i < objectList.size(); i++ )
  475. objectList[i]->setSelected(false);
  476. // If we are in Paint or EraseSelected mode we filter out elements with
  477. // a non-positive probability.
  478. if ( mMode == Paint || mMode == EraseSelected )
  479. {
  480. for ( S32 i = 0; i < mElements.size(); i++ )
  481. {
  482. if ( mElements[i]->mProbability <= 0.0f )
  483. {
  484. mElements.erase_fast(i);
  485. i--;
  486. }
  487. }
  488. }
  489. // Filter out elements with NULL datablocks and collect all unique datablocks
  490. // in a vector.
  491. mDatablocks.clear();
  492. for ( S32 i = 0; i < mElements.size(); i++ )
  493. {
  494. if ( mElements[i]->mData == NULL )
  495. {
  496. mElements.erase_fast(i);
  497. i--;
  498. continue;
  499. }
  500. mDatablocks.push_back_unique( mElements[i]->mData );
  501. }
  502. }
  503. bool ForestBrushTool::getGroundAt( const Point3F &worldPt, F32 *zValueOut, VectorF *normalOut )
  504. {
  505. const U32 mask = TerrainObjectType | StaticShapeObjectType;
  506. Point3F start( worldPt.x, worldPt.y, worldPt.z + mSize );
  507. Point3F end( worldPt.x, worldPt.y, worldPt.z - mSize );
  508. if ( mForest )
  509. mForest->disableCollision();
  510. // Do a cast ray at this point from the top to
  511. // the bottom of our brush radius.
  512. RayInfo rinfo;
  513. bool hit = gServerContainer.castRay( start, end, mask, &rinfo );
  514. if ( mForest )
  515. mForest->enableCollision();
  516. if ( !hit )
  517. return false;
  518. if (zValueOut)
  519. *zValueOut = rinfo.point.z;
  520. if (normalOut)
  521. *normalOut = rinfo.normal;
  522. return true;
  523. }
  524. ConsoleMethod( ForestBrushTool, collectElements, void, 2, 2, "" )
  525. {
  526. object->collectElements();
  527. }