mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge pull request #273 from thecelloman/kpaint-addendum
Filled in the variable names in autoMaterialLayers() prototype
This commit is contained in:
commit
f92a1969e7
|
|
@ -2937,67 +2937,67 @@ ConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, 3, 3, 0)
|
|||
//------------------------------------------------------------------------------
|
||||
void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope )
|
||||
{
|
||||
if (!mActiveTerrain)
|
||||
return;
|
||||
if (!mActiveTerrain)
|
||||
return;
|
||||
|
||||
S32 mat = getPaintMaterialIndex();
|
||||
if (mat == -1)
|
||||
return;
|
||||
return;
|
||||
|
||||
mUndoSel = new Selection;
|
||||
mUndoSel = new Selection;
|
||||
|
||||
U32 terrBlocks = mActiveTerrain->getBlockSize();
|
||||
for (U32 y = 0; y < terrBlocks; y++)
|
||||
{
|
||||
for (U32 x = 0; x < terrBlocks; x++)
|
||||
{
|
||||
// get info
|
||||
GridPoint gp;
|
||||
gp.terrainBlock = mActiveTerrain;
|
||||
gp.gridPos.set(x, y);
|
||||
U32 terrBlocks = mActiveTerrain->getBlockSize();
|
||||
for (U32 y = 0; y < terrBlocks; y++)
|
||||
{
|
||||
for (U32 x = 0; x < terrBlocks; x++)
|
||||
{
|
||||
// get info
|
||||
GridPoint gp;
|
||||
gp.terrainBlock = mActiveTerrain;
|
||||
gp.gridPos.set(x, y);
|
||||
|
||||
GridInfo gi;
|
||||
getGridInfo(gp, gi);
|
||||
GridInfo gi;
|
||||
getGridInfo(gp, gi);
|
||||
|
||||
if (gi.mMaterial == mat)
|
||||
continue;
|
||||
if (gi.mMaterial == mat)
|
||||
continue;
|
||||
|
||||
Point3F wp;
|
||||
gridToWorld(gp, wp);
|
||||
Point3F wp;
|
||||
gridToWorld(gp, wp);
|
||||
|
||||
if (!(wp.z >= mMinHeight && wp.z <= mMaxHeight))
|
||||
continue;
|
||||
if (!(wp.z >= mMinHeight && wp.z <= mMaxHeight))
|
||||
continue;
|
||||
|
||||
// transform wp to object space
|
||||
Point3F op;
|
||||
mActiveTerrain->getWorldTransform().mulP(wp, &op);
|
||||
// transform wp to object space
|
||||
Point3F op;
|
||||
mActiveTerrain->getWorldTransform().mulP(wp, &op);
|
||||
|
||||
Point3F norm;
|
||||
mActiveTerrain->getNormal(Point2F(op.x, op.y), &norm, true);
|
||||
Point3F norm;
|
||||
mActiveTerrain->getNormal(Point2F(op.x, op.y), &norm, true);
|
||||
|
||||
if (mMinSlope > 0)
|
||||
if (norm.z > mSin(mDegToRad(90.0f - mMinSlope)))
|
||||
continue;
|
||||
if (mMinSlope > 0)
|
||||
if (norm.z > mSin(mDegToRad(90.0f - mMinSlope)))
|
||||
continue;
|
||||
|
||||
if (mMaxSlope < 90)
|
||||
if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope)))
|
||||
continue;
|
||||
if (mMaxSlope < 90)
|
||||
if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope)))
|
||||
continue;
|
||||
|
||||
gi.mMaterialChanged = true;
|
||||
mUndoSel->add(gi);
|
||||
gi.mMaterial = mat;
|
||||
setGridInfo(gi);
|
||||
}
|
||||
}
|
||||
gi.mMaterialChanged = true;
|
||||
mUndoSel->add(gi);
|
||||
gi.mMaterial = mat;
|
||||
setGridInfo(gi);
|
||||
}
|
||||
}
|
||||
|
||||
if(mUndoSel->size())
|
||||
submitUndo( mUndoSel );
|
||||
else
|
||||
delete mUndoSel;
|
||||
if(mUndoSel->size())
|
||||
submitUndo( mUndoSel );
|
||||
else
|
||||
delete mUndoSel;
|
||||
|
||||
mUndoSel = 0;
|
||||
mUndoSel = 0;
|
||||
|
||||
scheduleMaterialUpdate();
|
||||
scheduleMaterialUpdate();
|
||||
}
|
||||
|
||||
ConsoleMethod( TerrainEditor, autoMaterialLayer, void, 6, 6, "(float minHeight, float maxHeight, float minSlope, float maxSlope)")
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ class TerrainEditor : public EditTSCtrl
|
|||
void submitMaterialUndo( String actionName );
|
||||
void onMaterialUndo( TerrainBlock *terr );
|
||||
|
||||
void autoMaterialLayer(F32, F32, F32, F32);
|
||||
void autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue