Commit 969f57dd authored by Johannes Braun's avatar Johannes Braun
Browse files

Several fixes

parent 3c5c9e1a
......@@ -51,7 +51,7 @@ namespace glare::raytrace
m_subdivision = m_bounds.subdivide(max_subdivisions);
Log_Info << "Building " << m_subdivision.resolution.x << "x" << m_subdivision.resolution.y << "x"<<m_subdivision.resolution.z<< " Line Space";
//Log_Info << "Building " << m_subdivision.resolution.x << "x" << m_subdivision.resolution.y << "x"<<m_subdivision.resolution.z<< " Line Space";
m_filled = collector.triangles().cend() != std::find_if(collector.triangles().cbegin(), collector.triangles().cend(), [this, &collector](const TriangleIDs& tri)
{
......
......@@ -65,7 +65,7 @@ namespace glare::raytrace
{
m_samples_current = 0;
m_collector->apply(*m_render_shader);
m_collector->apply(*m_render_shader, "scene");
m_render_shader->uniform("bounce_count", m_bounce_count);
m_render_shader->uniform("clamp_direct", m_clamp_direct);
......
......@@ -53,15 +53,15 @@ namespace glare::raytrace
std::shared_ptr<SceneCollector> collector() const;
void setBounceCount(unsigned count) { m_bounce_count = count; reset(); }
void setBounceThreshold(Effect effect, uint8_t count) { m_bounce_thresholds[effect] = count; reset(); }
void setBounceThreshold(Effect effect, int count) { m_bounce_thresholds[effect] = count; reset(); }
void setClampDirect(float clamp) { m_clamp_direct = clamp; reset(); }
void setClampIndirect(float clamp) { m_clamp_indirect = clamp; reset(); }
void setDebugTimes(bool show) { m_debug_times = show; reset(); }
void setLinespaceAccuracy(float accuracy) { m_linespace_accuracy = accuracy; reset(); }
void setLinespaceShadow(float shadow) { m_linespace_shadow = shadow; reset(); }
void setLinespaceDistance(float distance) { m_linespace_distance = distance; reset(); }
void setLinespaceBounces(Effect effect, uint8_t count) { m_linespace_bounces[effect] = count; reset(); }
void setSamplesMax(unsigned max) { m_bounce_count = max; }
void setLinespaceBounces(Effect effect, int count) { m_linespace_bounces[effect] = count; reset(); }
void setSamplesMax(unsigned max) { m_samples_max = max; }
void setSamplesPerFrame(unsigned spframe) { m_samples_per_frame = spframe; }
void setRayGenerator(RayGenType generator) { m_ray_generator = generator; reset(); }
......
......@@ -41,11 +41,12 @@ namespace glare::raytrace
{
const static auto generator_program = std::make_unique<core::Program>(files::shader("/pathtracer/generators/bvh/bvh_raygenerator.comp"));
generator_program->use();
generator_program->uniform("u_render_target", pathtracer.renderTarget().imageAddress(gl::Access::eReadWrite));
generator_program->storageBuffer("trace_buffer", pathtracer.traceBuffer());
generator_program->uniform("render_target", pathtracer.renderTarget().imageAddress(gl::Access::eReadWrite));
generator_program->uniform("trace_buffer", pathtracer.traceBuffer().makeResident(gl::Access::eReadWrite));
generator_program->uniform("random_seed", randomSeed());
generator_program->uniform("random_subpixel", true);
generator_program->uniform("use_linespace", pathtracer.getRayGenerator() == RayGenType::eLinespace);
pathtracer.collector()->apply(*generator_program);
pathtracer.collector()->apply(*generator_program, "scene");
generator_program->dispatch2D(m_last_width, 12, m_last_height, 12);
}
......@@ -63,14 +64,13 @@ namespace glare::raytrace
static std::unique_ptr<core::Framebuffer> framebuffer;
if (updated_size) {
framebuffer = std::make_unique<core::Framebuffer>(pathtracer.width(), pathtracer.height(), 8);
framebuffer = std::make_unique<core::Framebuffer>(pathtracer.width(), pathtracer.height());
framebuffer->attach(gl::Attachment::eColor0);
framebuffer->attach(gl::Attachment::eDepth);
}
generator_program->use();
//m_generator_shader_gbuffer->updateStorageBuffer("mesh_buffer", pathtracer.collector()->meshBuffer());
pathtracer.collector()->apply(*generator_program);
pathtracer.collector()->apply(*generator_program, "scene");
core::CaptureGlState();
framebuffer->activate();
......@@ -100,7 +100,7 @@ namespace glare::raytrace
depthtest_program->uniform("samples", pathtracer.renderTarget().samples());
depthtest_program->storageBuffer("trace_buffer", pathtracer.traceBuffer());
pathtracer.collector()->apply(*depthtest_program);
pathtracer.collector()->apply(*depthtest_program, "scene");
depthtest_program->uniform("random_seed", randomSeed());
depthtest_program->dispatch1D(m_last_width*m_last_height, 1024);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment