Improved Demo and multithreading rendering:
-added support for multithreaded rendering (fast) -improved shaders -added support for rendering depth -added rendering color support -improved DeptThreadPool (dynamics setting number of tryWait counts before TryWait. Low cpu usage with high responivity) -added possibility to change number of threads
This commit is contained in:
parent
f6e7af1014
commit
c94510a487
8 changed files with 311 additions and 105 deletions
|
|
@ -58,6 +58,7 @@ struct Launcher
|
|||
uint style = 3;
|
||||
uint entities_count;
|
||||
bool multithreading;
|
||||
int threads;
|
||||
ulong timer_freq;
|
||||
double delta_time;
|
||||
uint fps;
|
||||
|
|
@ -253,13 +254,12 @@ void mainLoop(void* arg)
|
|||
if(launcher.tool && launcher.tool_repeat != 0 && launcher.mouse.left && !igIsWindowHovered(ImGuiHoveredFlags_AnyWindow) && !igIsWindowFocused(ImGuiFocusedFlags_AnyWindow))
|
||||
{
|
||||
float range = 500.0 / cast(float)launcher.tool_repeat;
|
||||
launcher.repeat_time += launcher.delta_time*100;
|
||||
launcher.repeat_time += launcher.delta_time;
|
||||
while(launcher.repeat_time > range)
|
||||
{
|
||||
launcher.repeat_time -= range;
|
||||
launcher.tool((launcher.mouse.position*launcher.scalling)-launcher.render_position, launcher.used_tool, launcher.tool_size);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
version(WebAssembly)
|
||||
|
|
@ -317,6 +317,14 @@ void mainLoop(void* arg)
|
|||
{
|
||||
launcher.multithreading = !launcher.multithreading;
|
||||
}
|
||||
igSetNextItemWidth(0);
|
||||
igLabelText("Threads:",null);
|
||||
igSameLine(0,4);
|
||||
if(igSliderInt("##Threads",&launcher.threads, 1, 12, null))//"Multithreading", null, launcher.multithreading, true))
|
||||
{
|
||||
launcher.job_updater.pool.setThreadsNum(launcher.threads);
|
||||
//launcher.threads = !launcher.multithreading;
|
||||
}
|
||||
if(igBeginMenu("Show",true))
|
||||
{
|
||||
if(igMenuItemBool("Statistics",null,launcher.show_stat_wnd,true))
|
||||
|
|
@ -539,11 +547,14 @@ void mainLoop(void* arg)
|
|||
launcher.renderer.clear();
|
||||
|
||||
double loop_time = launcher.getTime();
|
||||
launcher.job_updater.pool.tryWaitCount = 5000;
|
||||
if(launcher.loop && !launcher.loop())
|
||||
{
|
||||
quit();
|
||||
*cast(bool*)arg = false;
|
||||
}
|
||||
launcher.job_updater.pool.tryWaitCount = 10;
|
||||
|
||||
loop_time = launcher.getTime() - loop_time;
|
||||
|
||||
double draw_time = launcher.getTime();
|
||||
|
|
@ -785,7 +796,15 @@ void loadGFX()
|
|||
GfxConfig.materials[0].compile();
|
||||
GfxConfig.materials[0].bindAttribLocation("positions",0);
|
||||
GfxConfig.materials[0].bindAttribLocation("tex_coords",1);
|
||||
GfxConfig.materials[0].bindAttribLocation("depth",2);
|
||||
GfxConfig.materials[0].bindAttribLocation("vcolor",3);
|
||||
GfxConfig.materials[0].link();
|
||||
|
||||
/* import std.stdio;
|
||||
writeln("positions ",glGetAttribLocation(GfxConfig.materials[0].data.modules[0].gl_handle,"positions"));
|
||||
writeln("tex_coords ",glGetAttribLocation(GfxConfig.materials[0].data.modules[0].gl_handle,"tex_coords"));
|
||||
writeln("depth ",glGetAttribLocation(GfxConfig.materials[0].data.modules[0].gl_handle,"depth"));
|
||||
writeln("vcolor ",glGetAttribLocation(GfxConfig.materials[0].data.modules[0].gl_handle,"vcolor"));*/
|
||||
|
||||
GfxConfig.materials[0].data.uniforms = Mallocator.makeArray!(Material.Uniform)(3);
|
||||
GfxConfig.materials[0].data.uniforms[0] = Material.Uniform(Material.Type.float4, GfxConfig.materials[0].getLocation("matrix_1"), 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue