mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Merge remote-tracking branch 'JackDavidson/master' into procedural-terrain-coverage
This commit is contained in:
commit
05e6fbf3d6
4 changed files with 178 additions and 11 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#include "gui/core/guiCanvas.h"
|
||||
#include "gui/worldEditor/terrainActions.h"
|
||||
#include "terrain/terrMaterial.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
|
||||
|
|
@ -2868,7 +2869,7 @@ ConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, 3, 3, 0)
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope )
|
||||
void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage )
|
||||
{
|
||||
if (!mActiveTerrain)
|
||||
return;
|
||||
|
|
@ -2876,7 +2877,12 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
|
|||
S32 mat = getPaintMaterialIndex();
|
||||
if (mat == -1)
|
||||
return;
|
||||
|
||||
|
||||
//setup for randomized coverage
|
||||
mCoverage*=100;
|
||||
srand((unsigned)time(0));
|
||||
int randomNumber;
|
||||
|
||||
mUndoSel = new Selection;
|
||||
|
||||
U32 terrBlocks = mActiveTerrain->getBlockSize();
|
||||
|
|
@ -2894,6 +2900,10 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
|
|||
|
||||
if (gi.mMaterial == mat)
|
||||
continue;
|
||||
|
||||
randomNumber = (rand() % 10000);
|
||||
if (randomNumber > mCoverage)
|
||||
continue;
|
||||
|
||||
Point3F wp;
|
||||
gridToWorld(gp, wp);
|
||||
|
|
@ -2933,7 +2943,7 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
|
|||
scheduleMaterialUpdate();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 6, 6, "(float minHeight, float maxHeight, float minSlope, float maxSlope)")
|
||||
ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 7, 7, "(float minHeight, float maxHeight, float minSlope, float maxSlope, float coverage)")
|
||||
{
|
||||
object->autoMaterialLayer( dAtof(argv[2]), dAtof(argv[3]), dAtof(argv[4]), dAtof(argv[5]) );
|
||||
object->autoMaterialLayer( dAtof(argv[2]), dAtof(argv[3]), dAtof(argv[4]), dAtof(argv[5]), dAtof(argv[6]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ class TerrainEditor : public EditTSCtrl
|
|||
void submitMaterialUndo( String actionName );
|
||||
void onMaterialUndo( TerrainBlock *terr );
|
||||
|
||||
void autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope );
|
||||
void autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue