// Gets public List <TerrainIndexMapping> GetVertsInBrush(Vector3 position) { List <TerrainIndexMapping> tim = new List <TerrainIndexMapping>(); Vector3d v3d = Convert.ToV3d(position); AxisAlignedBox3d pointBox = new AxisAlignedBox3d(v3d, brushRadius.GetValue()); pointBox.Min += new Vector3d(0, -1000f, 0); pointBox.Max += new Vector3d(0, 1000f, 0); //adjust box to always find neighboring chunks. foreach (TerrainChunk t in terrainChunks) { if (pointBox.Intersects(t.dMeshAABB.Bounds)) { foreach (int v in t.dMesh.VertexIndices()) { Vector3 vert = Convert.ToV3(t.dMesh.GetVertex(v)); if (Vector3.Distance(vert, position) <= brushRadius.GetValue()) { tim.Add(new TerrainIndexMapping(v, t.arrayX, t.arrayY)); } } } } return(tim); }
public void SetProperty(Object obj, string property) { SliderObject = obj; SliderProperty = obj.GetType().GetProperty(property); SliderValue = (int)SliderProperty.GetValue(obj); }
public override void PerformFunction() { released = true; if (Input.LMBPressed) { released = false; foreach (Terrain.TerrainIndexMapping tim in Editor.scenario.terrain.GetVertsInBrush(Editor.cursor.t.position, radius.GetValue())) { Editor.scenario.terrain.EditVertexHeight(tim, .10f, Terrain.EditMode.Add); } Editor.scenario.terrain.UpdateRequiredVisuals(); collisionMeshUpdateNeeded = true; } if (Input.RMBPressed) { released = false; if (Editor.cursor.hitInfoExists) { //foreach (int i in Editor.scenario.terrain.GetVertsInRadius(Editor.scenario.terrain.dMesh.GetTriangle(Editor.cursor.currHitTri).a, radius.GetValue())) //{ // Editor.scenario.terrain.EditVertexHeight(i, -.10F, Terrain.EditMode.Add); //} Editor.scenario.terrain.UpdateRequiredVisuals(); collisionMeshUpdateNeeded = true; } } if (released && collisionMeshUpdateNeeded) { collisionMeshUpdateNeeded = false; Editor.scenario.terrain.UpdateRequiredCollisionModels(); } }
public override void PerformFunction() { released = true; if (Input.LMBPressed) { released = false; foreach (Terrain.TerrainIndexMapping tim in Editor.scenario.terrain.GetVertsInBrush(Editor.cursor.t.position)) { Editor.scenario.terrain.Paint(tim, (Terrain.TextureIndex)texture.GetActiveIndex(), (byte)opacity.GetValue()); } Editor.scenario.terrain.UpdateRequiredPaints(); } }