/// <summary> /// Add all update functions in this block. It is Time-managed through the opentk game window /// </summary> public virtual void OnUpdate(FrameEventArgs e) { //generate ActiveChunks; SpatialManager.OnUpdate(); GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W); foreach (var entity in Entities) { if (entity.Active) { entity.OnUpdate(); } } }
public override void OnGui() { base.OnGui(); // call first for all entities ImGui.Begin("Main"); if (ImGui.Button("Exit")) { StateMaschine.Exit(); } ImGui.ColorEdit4("ClearColor", ref ClearColor); ImGui.Text("Avg Rendertime:" + StateMaschine.Context.AverageLastFrameRenderTime.ToString("0.000") + "ms"); if (ImGui.Button("Tree")) { var listof_obj = Directory.GetFiles("Models/", "*.obj"); for (int f = 0; f < 1000; f++) { var item = listof_obj[rnd.Next(0, listof_obj.Length - 1)]; var t = AddEntity(new StaticOBJModel(item.Remove(item.Length - 4).Substring(7), new Vector3(0, 0, 0), false)); GetEntity(t).GetComponent <Transform>().SetPosition(new Vector3(rnd.Next(0, 100), 0, rnd.Next(0, 100))); } } ImGui.Checkbox("Camera Gui", ref Camera.ShowGUI); ImGui.Checkbox("Wireframe", ref _WireFrame); StateMaschine.Context.WireMode(_WireFrame); ImGui.Checkbox("Print Profiler", ref Profiler.DebugPrint); ImGui.Checkbox("show random lines", ref drawlines); ImGui.Checkbox("Gui Demo Window", ref ShowImGUIDemoWindow); ImGui.Checkbox("Show Chunk Outlines", ref SpatialManager.ShowChunkOutline); ImGui.Checkbox("Show Profiler Window", ref Profiler.RenderProfiler); ImGui.Text($"Current Chunk ID {SpatialManager.GetTupelChunkIDAndInChunkPos(SpatialManager.GetIDfromWorldPos(Camera.Position))}"); ImGui.Text($"Chunks {SpatialManager._Chunks.Count}"); ImGui.Text($"Visible Chunks {SpatialManager.VisibleChunksAccordFrustum.Count}"); ImGui.Text($"Mouse Delta:{picker.getIntersectionGround()}"); if (house1.Draw("Models/house_type01.png", new Vector2(100, 100))) { build_mode = true; GetEntity <StaticOBJModel>(wellmodel).ChangeModel("house_type01"); current_build = "house_type01"; } if (house2.Draw("Models/house_type02.png", new Vector2(100, 100))) { build_mode = true; GetEntity <StaticOBJModel>(wellmodel).ChangeModel("house_type02"); current_build = "house_type02"; } if (street1.Draw("Models/road_straight.png", new Vector2(100, 100))) { build_mode = true; GetEntity <StaticOBJModel>(wellmodel).ChangeModel("road_straight"); current_build = "road_straight"; } pillar.Draw("Models/bridge_pillar.png", new Vector2(100, 100)); if (build_mode) { StateMaschine.Context.CursorVisible = false; } float[] x = StateMaschine.Context.ListLastFrameTimes.ToArray(); if (ShowImGUIDemoWindow) { ImGui.ShowDemoWindow(); } ImGui.End(); }