public void applyOnSelection(IMask selection, float intensity, bool alternate) { //using (PerfSection p = new PerfSection("applyOnSelection")) { if (!isApplyOnSelectionEnabled()) { return; } List <VertIndexWeight> verts = new List <VertIndexWeight>(); //Dictionary<long, float>.Enumerator pointsIterator = points.GetEnumerator(); long index; float weight; selection.ResetIterator(); while (selection.MoveNext(out index, out weight)) { if (weight == 0.0f) { continue; } verts.Add(new VertIndexWeight((int)index, weight)); } apply(verts, intensity, alternate); } }
static public void setCurrSelectionMaskWeights(IMask mask) { mCurrSelectionMask = mask; mCurrSelectionMaskExtends.empty(); int stride = TerrainGlobals.getTerrain().getNumZVerts(); long id; float value; mCurrSelectionMask.ResetIterator(); while (mCurrSelectionMask.MoveNext(out id, out value)) //it.MoveNext() == true) { int x = (int)(id / stride); int z = (int)(id - x * stride); extendCurrSelectionMask(x, z); } rebuildVisualsAfterSelection(); }
public override void applyOnSelection(IMask selection, float intensity, bool alternate) { //using (PerfSection p = new PerfSection("applyOnSelection")) { if (!isApplyOnSelectionEnabled()) { return; } List <VertIndexWeight> verts = new List <VertIndexWeight>(); //Dictionary<long, float>.Enumerator pointsIterator = points.GetEnumerator(); long index; float weight; selection.ResetIterator(); while (selection.MoveNext(out index, out weight)) { if (weight == 0.0f) { continue; } //mask indicies are in vis-vert space int x = (int)(index / TerrainGlobals.getTerrain().getNumZVerts()); int z = (int)(index % TerrainGlobals.getTerrain().getNumZVerts()); //convert to local vert space (scale values here to match up with what "apply" expects) x = (int)Math.Ceiling(x * TerrainGlobals.getEditor().getSimRep().getVisToSimScale()) + 1; z = (int)Math.Ceiling(z * TerrainGlobals.getEditor().getSimRep().getVisToSimScale()) + 1; if (x < 0 || z < 0) { continue; } index = x + TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumXPoints() * z; verts.Add(new VertIndexWeight((int)index, weight)); } apply(verts, intensity, alternate); } }