|
@@ -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]));
|
|
|
}
|