Merge pull request #273 from thecelloman/kpaint-addendum

Filled in the variable names in autoMaterialLayers() prototype
This commit is contained in:
SilentMike 2013-03-22 12:09:50 -07:00
commit f92a1969e7
2 changed files with 45 additions and 45 deletions

View file

@ -2937,67 +2937,67 @@ 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 )
{ {
if (!mActiveTerrain) if (!mActiveTerrain)
return; return;
S32 mat = getPaintMaterialIndex(); S32 mat = getPaintMaterialIndex();
if (mat == -1) if (mat == -1)
return; return;
mUndoSel = new Selection; mUndoSel = new Selection;
U32 terrBlocks = mActiveTerrain->getBlockSize(); U32 terrBlocks = mActiveTerrain->getBlockSize();
for (U32 y = 0; y < terrBlocks; y++) for (U32 y = 0; y < terrBlocks; y++)
{ {
for (U32 x = 0; x < terrBlocks; x++) for (U32 x = 0; x < terrBlocks; x++)
{ {
// get info // get info
GridPoint gp; GridPoint gp;
gp.terrainBlock = mActiveTerrain; gp.terrainBlock = mActiveTerrain;
gp.gridPos.set(x, y); gp.gridPos.set(x, y);
GridInfo gi; GridInfo gi;
getGridInfo(gp, gi); getGridInfo(gp, gi);
if (gi.mMaterial == mat) if (gi.mMaterial == mat)
continue; continue;
Point3F wp; Point3F wp;
gridToWorld(gp, wp); gridToWorld(gp, wp);
if (!(wp.z >= mMinHeight && wp.z <= mMaxHeight)) if (!(wp.z >= mMinHeight && wp.z <= mMaxHeight))
continue; continue;
// transform wp to object space // transform wp to object space
Point3F op; Point3F op;
mActiveTerrain->getWorldTransform().mulP(wp, &op); mActiveTerrain->getWorldTransform().mulP(wp, &op);
Point3F norm; Point3F norm;
mActiveTerrain->getNormal(Point2F(op.x, op.y), &norm, true); mActiveTerrain->getNormal(Point2F(op.x, op.y), &norm, true);
if (mMinSlope > 0) if (mMinSlope > 0)
if (norm.z > mSin(mDegToRad(90.0f - mMinSlope))) if (norm.z > mSin(mDegToRad(90.0f - mMinSlope)))
continue; continue;
if (mMaxSlope < 90) if (mMaxSlope < 90)
if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope))) if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope)))
continue; continue;
gi.mMaterialChanged = true; gi.mMaterialChanged = true;
mUndoSel->add(gi); mUndoSel->add(gi);
gi.mMaterial = mat; gi.mMaterial = mat;
setGridInfo(gi); setGridInfo(gi);
} }
} }
if(mUndoSel->size()) if(mUndoSel->size())
submitUndo( mUndoSel ); submitUndo( mUndoSel );
else else
delete mUndoSel; delete mUndoSel;
mUndoSel = 0; mUndoSel = 0;
scheduleMaterialUpdate(); scheduleMaterialUpdate();
} }
ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 6, 6, "(float minHeight, float maxHeight, float minSlope, float maxSlope)") ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 6, 6, "(float minHeight, float maxHeight, float minSlope, float maxSlope)")

View file

@ -230,7 +230,7 @@ class TerrainEditor : public EditTSCtrl
void submitMaterialUndo( String actionName ); void submitMaterialUndo( String actionName );
void onMaterialUndo( TerrainBlock *terr ); void onMaterialUndo( TerrainBlock *terr );
void autoMaterialLayer(F32, F32, F32, F32); void autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope );
private: private: