forked from bit/DotRecastNetSim
added setting properties
This commit is contained in:
parent
865fd13b24
commit
47239c92f3
|
@ -18,38 +18,63 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace DotRecast.Recast.Demo.Draw;
|
||||
|
||||
public class DrawMode
|
||||
{
|
||||
public static readonly DrawMode DRAWMODE_MESH = new("Input Mesh");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH = new("Navmesh");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_INVIS = new("Navmesh Invis");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_TRANS = new("Navmesh Trans");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_BVTREE = new("Navmesh BVTree");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_NODES = new("Navmesh Nodes");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_PORTALS = new("Navmesh Portals");
|
||||
public static readonly DrawMode DRAWMODE_VOXELS = new("Voxels");
|
||||
public static readonly DrawMode DRAWMODE_VOXELS_WALKABLE = new("Walkable Voxels");
|
||||
public static readonly DrawMode DRAWMODE_COMPACT = new("Compact");
|
||||
public static readonly DrawMode DRAWMODE_COMPACT_DISTANCE = new("Compact Distance");
|
||||
public static readonly DrawMode DRAWMODE_COMPACT_REGIONS = new("Compact Regions");
|
||||
public static readonly DrawMode DRAWMODE_REGION_CONNECTIONS = new("Region Connections");
|
||||
public static readonly DrawMode DRAWMODE_RAW_CONTOURS = new("Raw Contours");
|
||||
public static readonly DrawMode DRAWMODE_BOTH_CONTOURS = new("Both Contours");
|
||||
public static readonly DrawMode DRAWMODE_CONTOURS = new("Contours");
|
||||
public static readonly DrawMode DRAWMODE_POLYMESH = new("Poly Mesh");
|
||||
public static readonly DrawMode DRAWMODE_POLYMESH_DETAIL = new("Poly Mesh Detils");
|
||||
public static readonly DrawMode DRAWMODE_MESH = new(0, "Input Mesh");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH = new(1, "Navmesh");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_INVIS = new(2, "Navmesh Invis");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_TRANS = new(3, "Navmesh Trans");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_BVTREE = new(4, "Navmesh BVTree");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_NODES = new(5, "Navmesh Nodes");
|
||||
public static readonly DrawMode DRAWMODE_NAVMESH_PORTALS = new(6, "Navmesh Portals");
|
||||
public static readonly DrawMode DRAWMODE_VOXELS = new(7, "Voxels");
|
||||
public static readonly DrawMode DRAWMODE_VOXELS_WALKABLE = new(8, "Walkable Voxels");
|
||||
public static readonly DrawMode DRAWMODE_COMPACT = new(9, "Compact");
|
||||
public static readonly DrawMode DRAWMODE_COMPACT_DISTANCE = new(10, "Compact Distance");
|
||||
public static readonly DrawMode DRAWMODE_COMPACT_REGIONS = new(11, "Compact Regions");
|
||||
public static readonly DrawMode DRAWMODE_REGION_CONNECTIONS = new(12, "Region Connections");
|
||||
public static readonly DrawMode DRAWMODE_RAW_CONTOURS = new(13, "Raw Contours");
|
||||
public static readonly DrawMode DRAWMODE_BOTH_CONTOURS = new(14, "Both Contours");
|
||||
public static readonly DrawMode DRAWMODE_CONTOURS = new(15, "Contours");
|
||||
public static readonly DrawMode DRAWMODE_POLYMESH = new(16, "Poly Mesh");
|
||||
public static readonly DrawMode DRAWMODE_POLYMESH_DETAIL = new(17, "Poly Mesh Detils");
|
||||
|
||||
private readonly string text;
|
||||
public static readonly ImmutableArray<DrawMode> Values = ImmutableArray.Create(
|
||||
DRAWMODE_MESH,
|
||||
DRAWMODE_NAVMESH,
|
||||
DRAWMODE_NAVMESH_INVIS,
|
||||
DRAWMODE_NAVMESH_TRANS,
|
||||
DRAWMODE_NAVMESH_BVTREE,
|
||||
DRAWMODE_NAVMESH_NODES,
|
||||
DRAWMODE_NAVMESH_PORTALS,
|
||||
DRAWMODE_VOXELS,
|
||||
DRAWMODE_VOXELS_WALKABLE,
|
||||
DRAWMODE_COMPACT,
|
||||
DRAWMODE_COMPACT_DISTANCE,
|
||||
DRAWMODE_COMPACT_REGIONS,
|
||||
DRAWMODE_REGION_CONNECTIONS,
|
||||
DRAWMODE_RAW_CONTOURS,
|
||||
DRAWMODE_BOTH_CONTOURS,
|
||||
DRAWMODE_CONTOURS,
|
||||
DRAWMODE_POLYMESH,
|
||||
DRAWMODE_POLYMESH_DETAIL
|
||||
);
|
||||
|
||||
private DrawMode(string text)
|
||||
public int Idx { get; }
|
||||
public string Text { get; }
|
||||
|
||||
private DrawMode(int idx, string text)
|
||||
{
|
||||
this.text = text;
|
||||
Idx = idx;
|
||||
Text = text;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return text;
|
||||
return Text;
|
||||
}
|
||||
}
|
|
@ -66,6 +66,7 @@ public class RcSettingsView : IRcView
|
|||
private int maxTiles;
|
||||
private int maxPolys;
|
||||
|
||||
private int drawModeIdx = DrawMode.DRAWMODE_NAVMESH.Idx;
|
||||
private DrawMode drawMode = DrawMode.DRAWMODE_NAVMESH;
|
||||
private bool meshInputTrigerred;
|
||||
private bool navMeshInputTrigerred;
|
||||
|
@ -142,34 +143,33 @@ public class RcSettingsView : IRcView
|
|||
|
||||
ImGui.Text("Tiling");
|
||||
ImGui.Separator();
|
||||
// nk_layout_row_dynamic(ctx, 20, 1);
|
||||
// tiled = nk_check_text(ctx, "Enable", tiled);
|
||||
// if (tiled) {
|
||||
// nk_layout_row_dynamic(ctx, 20, 1);
|
||||
ImGui.Checkbox("Enable", ref tiled);
|
||||
if (tiled)
|
||||
{
|
||||
if (0 < (tileSize % 16))
|
||||
tileSize = tileSize + (16 - (tileSize % 16));
|
||||
ImGui.SliderInt("Tile Size", ref tileSize, 16, 1024);
|
||||
// nk_layout_row_dynamic(ctx, 18, 1);
|
||||
// nk_label(ctx, string.format("Tiles %d x %d", tiles[0], tiles[1]), NK_TEXT_ALIGN_RIGHT);
|
||||
// nk_layout_row_dynamic(ctx, 18, 1);
|
||||
// nk_label(ctx, string.format("Max Tiles %d", maxTiles), NK_TEXT_ALIGN_RIGHT);
|
||||
// nk_layout_row_dynamic(ctx, 18, 1);
|
||||
// nk_label(ctx, string.format("Max Polys %d", maxPolys), NK_TEXT_ALIGN_RIGHT);
|
||||
// }
|
||||
// nk_layout_row_dynamic(ctx, 18, 1);
|
||||
// nk_label(ctx, string.format("Build Time: %d ms", buildTime), NK_TEXT_ALIGN_LEFT);
|
||||
//
|
||||
// nk_layout_row_dynamic(ctx, 20, 1);
|
||||
// buildTriggered = nk_button_text(ctx, "Build");
|
||||
// nk_layout_row_dynamic(ctx, 3, 1);
|
||||
// nk_spacing(ctx, 1);
|
||||
// nk_layout_row_dynamic(ctx, 18, 1);
|
||||
// navMeshInputTrigerred = nk_button_text(ctx, "Load Nav Mesh...");
|
||||
//
|
||||
// nk_layout_row_dynamic(ctx, 18, 1);
|
||||
|
||||
ImGui.Text($"Tiles {tiles[0]} x {tiles[1]}");
|
||||
ImGui.Text($"Max Tiles {maxTiles}");
|
||||
ImGui.Text($"Max Polys {maxPolys}");
|
||||
}
|
||||
ImGui.NewLine();
|
||||
|
||||
ImGui.Text($"Build Time: {buildTime} ms");
|
||||
ImGui.Separator();
|
||||
buildTriggered = ImGui.Button("Build");
|
||||
ImGui.SameLine();
|
||||
navMeshInputTrigerred = ImGui.Button("Load Nav Mesh...");
|
||||
ImGui.NewLine();
|
||||
|
||||
ImGui.Text("Draw");
|
||||
ImGui.Separator();
|
||||
// drawMode = NuklearUIHelper.nk_radio(ctx, DrawMode.values(), drawMode, dm => dm.toString());
|
||||
//
|
||||
|
||||
DrawMode.Values.forEach(dm =>
|
||||
{
|
||||
ImGui.RadioButton(dm.Text, ref drawModeIdx, dm.Idx);
|
||||
});
|
||||
// nk_window_get_bounds(ctx, rect);
|
||||
// if (mouseX >= rect.x() && mouseX <= rect.x() + rect.w() && mouseY >= rect.y()
|
||||
// && mouseY <= rect.y() + rect.h()) {
|
||||
|
|
Loading…
Reference in New Issue