mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
TorqueLab v0.2 source code changes
This commit is contained in:
parent
84155d13d0
commit
df8aa9c625
8 changed files with 53 additions and 11 deletions
|
|
@ -40,7 +40,7 @@
|
|||
#include "math/mRandomDeck.h"
|
||||
#include "math/mRandomSet.h"
|
||||
|
||||
|
||||
F32 ForestBrushTool::smGlobalScale = 1.0f; //TorqueLab - Forest global scale Init
|
||||
bool ForestBrushTool::protectedSetSize( void *object, const char *index, const char *data )
|
||||
{
|
||||
ForestBrushTool *tool = static_cast<ForestBrushTool*>( object );
|
||||
|
|
@ -122,7 +122,14 @@ void ForestBrushTool::initPersistFields()
|
|||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
//TorqueLab - Forest brush tool new console variables
|
||||
void ForestBrushTool::consoleInit()
|
||||
{
|
||||
//TorqueLab - Forest global scale - Apply global scaling to painted elements
|
||||
Con::addVariable("$Forest::GlobalScale", TypeF32, &ForestBrushTool::smGlobalScale, "For editor use.\n"
|
||||
"@ingroup Editors\n");
|
||||
Parent::consoleInit();
|
||||
}
|
||||
bool ForestBrushTool::onAdd()
|
||||
{
|
||||
if ( !Parent::onAdd() )
|
||||
|
|
@ -380,6 +387,10 @@ void ForestBrushTool::_paint( const Point3F &point )
|
|||
randElementSet.add( pElement, pElement->mProbability );
|
||||
}
|
||||
|
||||
//TorqueLab - Check forest global scale
|
||||
if (smGlobalScale <= 0.01)
|
||||
smGlobalScale = 0.01f;
|
||||
|
||||
// Pull elements from the random set until we would theoretically fill
|
||||
// the desired area.
|
||||
|
||||
|
|
@ -403,6 +414,8 @@ void ForestBrushTool::_paint( const Point3F &point )
|
|||
|
||||
areaLeft -= area * 5.0f; // fudge value
|
||||
|
||||
scaleFactor *= smGlobalScale; //TorqueLab - Add forest global scale
|
||||
|
||||
// No room left we are done.
|
||||
//if ( areaLeft < 0.0f )
|
||||
// break;
|
||||
|
|
|
|||
|
|
@ -61,10 +61,12 @@ public:
|
|||
|
||||
// SimObject
|
||||
DECLARE_CONOBJECT( ForestBrushTool );
|
||||
static void consoleInit(); //TorqueLab - New console variables
|
||||
static void initPersistFields();
|
||||
virtual bool onAdd();
|
||||
virtual void onRemove();
|
||||
|
||||
static F32 smGlobalScale; //TorqueLab - Forest global scale
|
||||
// ForestTool
|
||||
virtual void on3DMouseDown( const Gui3DMouseEvent &evt );
|
||||
virtual void on3DMouseUp( const Gui3DMouseEvent &evt );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue