documentation, gitignore update, start on bar plot
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
62e727cdea
commit
ffbbd15a5e
5
.gitignore
vendored
5
.gitignore
vendored
@ -39,4 +39,7 @@
|
||||
.settings
|
||||
|
||||
#docs
|
||||
/docs-dist/**
|
||||
/docs-dist/**
|
||||
|
||||
#imgui local layout
|
||||
/imgui.ini
|
||||
@ -8,3 +8,4 @@
|
||||
- @subpage magicindex
|
||||
- @subpage creaturesindex
|
||||
- @subpage macrosimtimeline
|
||||
- @subpage narrativemanager
|
||||
|
||||
@ -36,4 +36,7 @@
|
||||
- IDK if this should be made out of marching cubes or particles or what
|
||||
|
||||
### Massive Ruins
|
||||
- For instance sticking out of the side of a mountain and of comparable size to said mountain
|
||||
- For instance sticking out of the side of a mountain and of comparable size to said mountain
|
||||
|
||||
### Sunset Ruins
|
||||
- Extremely tall ruins that are permanently sunset. Always overcast with godrays shooting through.
|
||||
@ -0,0 +1,8 @@
|
||||
@page narrativemanager Narrative Manager
|
||||
|
||||
TODO: describe
|
||||
|
||||
basic idea is have a system that watches over each player and tries to shape the world around them to create interesting stories.
|
||||
ie creates quests and tries to lightly railroad the players on to them -- or at the very least provides them as options.
|
||||
Will need to have plotline templates and generate/select characters to be members of that plotline.
|
||||
Then move macro level pieces around to conform to the plotline.
|
||||
@ -141,6 +141,11 @@ Bake in imgui
|
||||
# TODO
|
||||
|
||||
|
||||
Server frametime bar graph
|
||||
|
||||
Environment background noise manager - does what it says on the tin
|
||||
|
||||
Methods for sleeping physics bodies if nothing nearby them is dynamic (ie trees if there are no moving creatures near them)
|
||||
|
||||
|
||||
|
||||
|
||||
25
imgui.ini
25
imgui.ini
@ -1,25 +0,0 @@
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][test window]
|
||||
Pos=791,428
|
||||
Size=328,189
|
||||
Collapsed=1
|
||||
|
||||
[Window][FPS Graph]
|
||||
Pos=1148,36
|
||||
Size=775,335
|
||||
Collapsed=0
|
||||
|
||||
[Window][Frametime Graph]
|
||||
Pos=1308,4
|
||||
Size=566,324
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug]
|
||||
Pos=10,9
|
||||
Size=178,77
|
||||
Collapsed=0
|
||||
|
||||
@ -244,7 +244,7 @@ public class Main {
|
||||
// track total frametiime in debug graph
|
||||
//
|
||||
if(captureFramerate){
|
||||
ImGuiWindowMacros.addFramerateDatapoint("totalframerate",deltaTime * 1000);
|
||||
ImGuiWindowMacros.addGlobalFramerateDatapoint("totalframerate",deltaTime * 1000);
|
||||
}
|
||||
|
||||
|
||||
@ -303,7 +303,7 @@ public class Main {
|
||||
ClientFunctions.runClientFunctions();
|
||||
}
|
||||
if(!Globals.HEADLESS && captureFramerate){
|
||||
ImGuiWindowMacros.addFramerateDatapoint("clientsim",(glfwGetTime()-functionTrackTimeStart)*1000);
|
||||
ImGuiWindowMacros.addGlobalFramerateDatapoint("clientsim",(glfwGetTime()-functionTrackTimeStart)*1000);
|
||||
}
|
||||
|
||||
|
||||
@ -333,7 +333,7 @@ public class Main {
|
||||
Globals.macroSimulation.simulate();
|
||||
}
|
||||
if(!Globals.HEADLESS && captureFramerate){
|
||||
ImGuiWindowMacros.addFramerateDatapoint("serversim",(glfwGetTime()-functionTrackTimeStart)*1000);
|
||||
ImGuiWindowMacros.addGlobalFramerateDatapoint("serversim",(glfwGetTime()-functionTrackTimeStart)*1000);
|
||||
}
|
||||
|
||||
|
||||
@ -349,7 +349,7 @@ public class Main {
|
||||
Globals.renderingEngine.drawScreen();
|
||||
}
|
||||
if(!Globals.HEADLESS && captureFramerate){
|
||||
ImGuiWindowMacros.addFramerateDatapoint("render",(glfwGetTime()-functionTrackTimeStart)*1000);
|
||||
ImGuiWindowMacros.addGlobalFramerateDatapoint("render",(glfwGetTime()-functionTrackTimeStart)*1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
100
src/main/java/electrosphere/renderer/ui/imgui/ImGuiBarPlot.java
Normal file
100
src/main/java/electrosphere/renderer/ui/imgui/ImGuiBarPlot.java
Normal file
@ -0,0 +1,100 @@
|
||||
package electrosphere.renderer.ui.imgui;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import imgui.ImVec2;
|
||||
import imgui.extension.implot.ImPlot;
|
||||
import imgui.extension.implot.flag.ImPlotAxisFlags;
|
||||
|
||||
/**
|
||||
* A bar plot
|
||||
*/
|
||||
public class ImGuiBarPlot implements ImGuiElement {
|
||||
|
||||
//the title of the plot
|
||||
String plotTitle;
|
||||
|
||||
//the data sets to draw
|
||||
List<ImGuiBarPlotDatapoint> dataPoints = new LinkedList<ImGuiBarPlotDatapoint>();
|
||||
|
||||
float width = 0.5f;
|
||||
|
||||
/**
|
||||
* Creates an im gui line plot
|
||||
*/
|
||||
public ImGuiBarPlot(String plotTitle){
|
||||
this.plotTitle = plotTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
if(ImPlot.beginPlot(plotTitle,"","",new ImVec2(-1,-1),0,ImPlotAxisFlags.AutoFit,ImPlotAxisFlags.AutoFit)){
|
||||
double[] xs = IntStream.range(0, dataPoints.size()).mapToDouble(v -> (double)v).toArray();
|
||||
double[] ys = dataPoints.stream().map(v -> v.value).mapToDouble(Double::doubleValue).toArray();
|
||||
ImPlot.plotBars(plotTitle, xs, ys, dataPoints.size(), width, 0);
|
||||
ImPlot.endPlot();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a datapoint to the bar plot
|
||||
* @param datapoint The datapoint
|
||||
*/
|
||||
public void addDatapoint(ImGuiBarPlotDatapoint datapoint){
|
||||
this.dataPoints.add(datapoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a value amount to the current amount in a given datapoint. If the datapoint is null, it is created with value as its initial amount.
|
||||
* @param datapointName The datapoint's name
|
||||
* @param value The value to add to the datapoint
|
||||
*/
|
||||
public void addToDatapoint(String datapointName, double value){
|
||||
ImGuiBarPlotDatapoint targetDatapoint = null;
|
||||
for(ImGuiBarPlotDatapoint point : dataPoints){
|
||||
if(point.label.equals(datapointName)){
|
||||
targetDatapoint = point;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(targetDatapoint!=null){
|
||||
targetDatapoint.value = targetDatapoint.value + value;
|
||||
} else {
|
||||
dataPoints.add(new ImGuiBarPlotDatapoint(datapointName, value));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the values in all datapoints
|
||||
*/
|
||||
public void clearDatapoints(){
|
||||
for(ImGuiBarPlotDatapoint dataPoint : dataPoints){
|
||||
dataPoint.value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A single set of data to be plotted in this graph
|
||||
*/
|
||||
public static class ImGuiBarPlotDatapoint {
|
||||
|
||||
//the label of the line
|
||||
String label;
|
||||
|
||||
double value;
|
||||
|
||||
/**
|
||||
* Creates a datapoint object
|
||||
* @param label the label for the data
|
||||
* @param value the value of this bar item
|
||||
*/
|
||||
public ImGuiBarPlotDatapoint(String label, double value){
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import electrosphere.renderer.RenderingEngine;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiBarPlot.ImGuiBarPlotDatapoint;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiLinePlot.ImGuiLinePlotDataset;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||
import imgui.ImGui;
|
||||
@ -13,39 +14,46 @@ import imgui.ImGui;
|
||||
*/
|
||||
public class ImGuiWindowMacros {
|
||||
|
||||
//Framerate graph
|
||||
private static ImGuiWindow framerateWindow;
|
||||
private static ImGuiLinePlot plot;
|
||||
private static Map<String,ImGuiLinePlotDataset> dataSetMap;
|
||||
|
||||
//main debug menu
|
||||
private static ImGuiWindow mainDebugWindow;
|
||||
|
||||
|
||||
//Framerate graph
|
||||
private static ImGuiWindow globalFrametimeWindow;
|
||||
private static ImGuiLinePlot globalFrametimePlot;
|
||||
private static Map<String,ImGuiLinePlotDataset> globalFrametimeDatasets;
|
||||
|
||||
//server sim time graph
|
||||
private static ImGuiWindow serverFrametimeWindow;
|
||||
private static ImGuiBarPlot serverFrametimePlot;
|
||||
|
||||
/**
|
||||
* Initializes imgui windows
|
||||
*/
|
||||
public static void initImGuiWindows(){
|
||||
createMainDebugMenu();
|
||||
createFramerateGraph();
|
||||
createServerFrametimeGraph();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a framerate graph
|
||||
*/
|
||||
private static void createFramerateGraph(){
|
||||
framerateWindow = new ImGuiWindow("Frametime Graph");
|
||||
plot = new ImGuiLinePlot("Frametime plot");
|
||||
dataSetMap = new HashMap<String,ImGuiLinePlotDataset>();
|
||||
globalFrametimeWindow = new ImGuiWindow("Frametime Graph");
|
||||
globalFrametimePlot = new ImGuiLinePlot("Frametime plot");
|
||||
globalFrametimeDatasets = new HashMap<String,ImGuiLinePlotDataset>();
|
||||
initFramerateGraphSeries("totalframerate");
|
||||
initFramerateGraphSeries("serversim");
|
||||
initFramerateGraphSeries("clientsim");
|
||||
initFramerateGraphSeries("render");
|
||||
framerateWindow.addElement(plot);
|
||||
framerateWindow.setCallback(new ImGuiWindowCallback() {
|
||||
globalFrametimeWindow.addElement(globalFrametimePlot);
|
||||
globalFrametimeWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
if(ImGui.button("Close")){
|
||||
RenderingEngine.removeImGuiWindow(framerateWindow);
|
||||
RenderingEngine.removeImGuiWindow(globalFrametimeWindow);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -55,13 +63,13 @@ public class ImGuiWindowMacros {
|
||||
* Inits a series for the framerate graph
|
||||
* @param seriesName The name of the series
|
||||
*/
|
||||
public static void initFramerateGraphSeries(String seriesName){
|
||||
private static void initFramerateGraphSeries(String seriesName){
|
||||
ImGuiLinePlotDataset dataSet = new ImGuiLinePlotDataset(seriesName, 50);
|
||||
dataSetMap.put(seriesName,dataSet);
|
||||
globalFrametimeDatasets.put(seriesName,dataSet);
|
||||
for(int x = 0; x < 50; x++){
|
||||
dataSet.addPoint(x, 0);
|
||||
}
|
||||
plot.addDataset(dataSet);
|
||||
globalFrametimePlot.addDataset(dataSet);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,12 +77,45 @@ public class ImGuiWindowMacros {
|
||||
* @param seriesName The name of the series to add a datapoint for
|
||||
* @param y the y coord
|
||||
*/
|
||||
public static void addFramerateDatapoint(String seriesName, double y){
|
||||
if(dataSetMap != null && dataSetMap.containsKey(seriesName)){
|
||||
dataSetMap.get(seriesName).addPoint(y);
|
||||
public static void addGlobalFramerateDatapoint(String seriesName, double y){
|
||||
if(globalFrametimeDatasets != null && globalFrametimeDatasets.containsKey(seriesName)){
|
||||
globalFrametimeDatasets.get(seriesName).addPoint(y);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a server frametime breakdown graph
|
||||
*/
|
||||
private static void createServerFrametimeGraph(){
|
||||
serverFrametimeWindow = new ImGuiWindow("Server Frametime Graph");
|
||||
serverFrametimePlot = new ImGuiBarPlot("Server Frametime plot");
|
||||
serverFrametimeWindow.addElement(serverFrametimePlot);
|
||||
serverFrametimeWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
if(ImGui.button("Close")){
|
||||
RenderingEngine.removeImGuiWindow(serverFrametimeWindow);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an amount to a single bar in the server frametime graph
|
||||
* @param valueName The value to add to
|
||||
* @param amountToAdd The amount to add
|
||||
*/
|
||||
public static void addToServerFrametimeValue(String valueName, double amountToAdd){
|
||||
serverFrametimePlot.addToDatapoint(valueName, amountToAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the server frametime values so they can be re-filled
|
||||
*/
|
||||
public static void clearServerFrametime(){
|
||||
serverFrametimePlot.clearDatapoints();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inits the main debug menu
|
||||
@ -84,9 +125,13 @@ public class ImGuiWindowMacros {
|
||||
mainDebugWindow.callback = new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
//show framerate graph
|
||||
//show global framerate line graph
|
||||
if(ImGui.button("Show Overall Frametime")){
|
||||
RenderingEngine.addImGuiWindow(framerateWindow);
|
||||
RenderingEngine.addImGuiWindow(globalFrametimeWindow);
|
||||
}
|
||||
//show server frametime bar graph
|
||||
if(ImGui.button("Show Server Frametime Breakdown")){
|
||||
RenderingEngine.addImGuiWindow(serverFrametimeWindow);
|
||||
}
|
||||
//close button
|
||||
if(ImGui.button("Close")){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user