Commit 245b0bc8 authored by unknown's avatar unknown
Browse files

Made it all workgit clear -f

parent 0f5f2bfc
......@@ -8,6 +8,16 @@
#include <raytracer/utilities.glh>
#include <raytracer/mesh_linespace.glh>
#ifndef RNDR_CFG
#define RNDR_CFG
uniform struct
{
uint num_bounces;
uint current_sample;
uint max_samples;
} u_render_config;
#endif
Bounds getNodeBounds(int index, const in Mesh mesh)
{
return mesh.nodes[index].bounds;
......
......@@ -3,6 +3,16 @@
#extension GL_ARB_shading_language_include : require
#extension GL_ARB_compute_variable_group_size : require
#ifndef RNDR_CFG
#define RNDR_CFG
uniform struct
{
uint num_bounces;
uint current_sample;
uint max_samples;
} u_render_config;
#endif
#include <raytracer/std.glh>
#include <raytracer/basic_structs.glh>
......@@ -23,13 +33,6 @@ layout(local_size_variable) in;
//color value of this texture divided by the current sample count.
layout(rgba32f) volatile uniform image2D u_color_store;
uniform struct
{
uint num_bounces;
uint current_sample;
uint max_samples;
} u_render_config;
bool shade(int id, inout vec3 weight)
{
Hit hit = b_traces[id].hit;
......
......@@ -148,7 +148,7 @@ namespace glare
#define DEBUG__ADD_ROTATOR
#ifdef DEBUG__ADD_ROTATOR
if (auto &&node = m_scene_root->findFirstWithName("#Suzanne-mesh")) {
if (auto &&node = m_scene_root->findFirstWithName("#Suzanne_001-mesh")) {
node->addComponent(std::make_shared<component::Rotator>());
}
#endif
......
......@@ -179,7 +179,7 @@ namespace glare
std::vector<unsigned char> converted_data(data.width()*data.height()*data.components());
for (int i = 0; i < converted_data.size(); ++i) {
converted_data[i] = unsigned char(data.data()[i] * 255);
converted_data[i] = unsigned char(glm::clamp(data.data()[i], 0, 1) * 255);
if (i % 4 == 3)
converted_data[i] = 255;
}
......
......@@ -20,7 +20,7 @@ namespace glare
unsigned goodSubdivision(size_t polygon_count, glm::vec3 bounds_size)
{
return 12;// unsigned(5 * glm::ceil(glm::log2(glm::max(size_t(2), polygon_count)) * glm::log(log2((glm::compMax(bounds_size) / glm::compMin(bounds_size)) + 2 * glm::e<float>()))));
return 25;// unsigned(5 * glm::ceil(glm::log2(glm::max(size_t(2), polygon_count)) * glm::log(log2((glm::compMax(bounds_size) / glm::compMin(bounds_size)) + 2 * glm::e<float>()))));
}
}
......@@ -87,7 +87,7 @@ namespace glare
math::Ray ray;
ray.direction = glm::normalize(center_end - center_begin).xyz;
ray.origin = center_begin.xyz;
ray.origin = center_begin.xyz - 1e-2*ray.direction;
Line &line = m_lines[lineIndex(begin, end)];
......
#ifndef __LINESPACE_H
#define __LINESPACE_H
#include <array>
#include <advanced/meshlocal/SceneCollector.h>
#include <advanced/meshlocal/LocalCollector.h>
#include <advanced/meshlocal/LocalBVH.h>
#include <engine/rendering/Shader.h>
namespace glare
{
namespace ls
#ifndef __LINESPACE_H
#define __LINESPACE_H
#include <array>
#include <advanced/meshlocal/SceneCollector.h>
#include <advanced/meshlocal/LocalCollector.h>
#include <advanced/meshlocal/LocalBVH.h>
#include <engine/rendering/Shader.h>
namespace glare
{
namespace ls
{
enum class Face : uint32_t
{
......@@ -45,7 +45,7 @@ namespace glare
{
math::Hit nearest;
math::Hit farthest;
};
};
const glm::uvec3 c_face_width_axises = { 2, 2, 0 };
const glm::uvec3 c_face_height_axises = { 1, 0, 1 };
......@@ -80,64 +80,64 @@ namespace glare
std::pair<Patch, Patch>{Patch(Face::eNegY), Patch(Face::eNegZ)},
//no further configurations needed.
};
namespace utilities
{
};
namespace utilities
{
unsigned faceAxis(Face face);
size_t faceRangeIndex(Face in, Face out);
unsigned goodSubdivision(size_t polygon_count, glm::vec3 bounds_size);
}
class LineSpaceRenderer;
class LineSpace
{
friend class LineSpaceRenderer;
public:
LineSpace();
~LineSpace();
LineSpace(const advanced::LocalCollector &collector, int max_subdivisions);
void generate(const advanced::LocalCollector &collector, int max_subdivisions);
const core::Buffer<gl::BufferType::eShaderStorage> &lineBuffer() const;
const std::vector<Line> &lines() const;
const math::Bounds &bounds() const;
const math::UniformBoundsSubdivision &subdivisions() const;
const std::array<size_t, 15> &offsets() const;
private:
size_t faceRangeIndex(Face in, Face out);
unsigned goodSubdivision(size_t polygon_count, glm::vec3 bounds_size);
}
class LineSpaceRenderer;
class LineSpace
{
friend class LineSpaceRenderer;
public:
LineSpace();
~LineSpace();
LineSpace(const advanced::LocalCollector &collector, int max_subdivisions);
void generate(const advanced::LocalCollector &collector, int max_subdivisions);
const core::Buffer<gl::BufferType::eShaderStorage> &lineBuffer() const;
const std::vector<Line> &lines() const;
const math::Bounds &bounds() const;
const math::UniformBoundsSubdivision &subdivisions() const;
const std::array<size_t, 15> &offsets() const;
private:
void calculateOffsets();
size_t linesBetweenFaces(Face in, Face out);
size_t lineIndex(const Patch &in, const Patch &out);
size_t calculateLineCount();
glm::vec3 patchCenter(const Patch &patch);
size_t m_mesh_id;
math::Bounds m_bounds;
std::array<size_t, 15> m_offsets;
math::UniformBoundsSubdivision m_subdivision;
std::vector<Line> m_lines;
core::Buffer<gl::BufferType::eShaderStorage> m_line_buffer;
};
class LineSpaceRenderer
{
public:
LineSpaceRenderer(const advanced::SceneCollector &collector, const LineSpace &linespace);
~LineSpaceRenderer();
void draw() const;
private:
const advanced::SceneCollector &m_collector;
const LineSpace &m_linespace;
std::unique_ptr<core::ShaderProgram> m_program;
std::unique_ptr<core::VertexArray> m_vertex_array;
};
}
}
#endif //__LINESPACE_H
size_t calculateLineCount();
glm::vec3 patchCenter(const Patch &patch);
size_t m_mesh_id;
math::Bounds m_bounds;
std::array<size_t, 15> m_offsets;
math::UniformBoundsSubdivision m_subdivision;
std::vector<Line> m_lines;
core::Buffer<gl::BufferType::eShaderStorage> m_line_buffer;
};
class LineSpaceRenderer
{
public:
LineSpaceRenderer(const advanced::SceneCollector &collector, const LineSpace &linespace);
~LineSpaceRenderer();
void draw() const;
private:
const advanced::SceneCollector &m_collector;
const LineSpace &m_linespace;
std::unique_ptr<core::ShaderProgram> m_program;
std::unique_ptr<core::VertexArray> m_vertex_array;
};
}
}
#endif //__LINESPACE_H
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