Commit 2d49af97 authored by Johannes Braun's avatar Johannes Braun
Browse files

Don't like opengl instanced rendering approaches. Just keeping the pathtracing...

Don't like opengl instanced rendering approaches. Just keeping the pathtracing one and discard the OpenGL one.
parent 6b93d716
......@@ -8,6 +8,7 @@
#include <core/rendering/batch_render_list.h>
#include <core/objects/camera.h>
#include "util/files.h"
#include <core/time.h>
using namespace glare;
......@@ -33,7 +34,7 @@ int main(int argc, char* argv[])
std::vector<glm::mat4> matrices;
for (auto y = 0; y < 100; ++y)
for (auto y = 0; y < 1000; ++y)
{
for (auto x = 0; x < 200; ++x)
{
......@@ -41,7 +42,11 @@ int main(int argc, char* argv[])
}
}
core::ClockGL::instance().start();
mat_bfr.upload(matrices, gl::BufferUsage::eDynamicCopy);
auto i = core::ClockGL::instance().end();
Log_Info << "Upload took " << i;
drawable->mesh = std::make_shared<core::Mesh>();
drawable->mesh->vertexArray().linkAttributeMatrix4(mat_bfr.id(), 5, sizeof(glm::mat4), 0, 1);
......
......@@ -112,7 +112,7 @@ namespace glare::core
// --- IMPLEMENTATIONS -----------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------------------
template<typename T>
Buffer::MappedBuffer<T>::MappedBuffer(Buffer* buffer, gl::BufferMapBit flags, size_t offset = 0)
Buffer::MappedBuffer<T>::MappedBuffer(Buffer* buffer, gl::BufferMapBit flags, size_t offset)
: m_buffer(buffer), m_data(buffer->map<T>(buffer->size() / sizeof(T), offset, flags))
{
......
......@@ -12,13 +12,6 @@ namespace glare::core
if (m_shader_mapping.count(shader->id()) == 0)
{
m_shader_mapping.emplace(shader->id(), std::make_pair(shader, m_render_list.size()));
//Maybe: check if Batchdrawable being a mesh drawable exists having the same mesh?
// If so: convert to InstancedBatchDrawable.
// Also: check if InstancedBatchDrawable exists.
//Or: have multiple render lists, e.g. one for BatchDrawables and one for special "InstancedBatchDrawables"
m_render_list.push_back(std::vector<std::pair<std::shared_ptr<BatchDrawable>, glm::mat4>>(1, std::make_pair(renderable, model_matrix)));
}
else
......
......@@ -11,7 +11,7 @@
namespace glare::core
{
// mesh and material
class MeshDrawableInstanced : public BatchDrawable {
class MeshDrawable : public BatchDrawable {
public:
void onDraw(std::shared_ptr<Program> shader) override
......@@ -28,7 +28,6 @@ namespace glare::core
std::shared_ptr<Material> material;
protected:
Buffer m_per_instance_data;
void onDebugGui() override
{
......
Markdown is supported
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