rough outline
This commit is contained in:
+22
-10
@@ -6,17 +6,29 @@ Scene::~Scene() {}
|
||||
|
||||
void Scene::render(int width, int height, int numSamples)
|
||||
{
|
||||
image.clear();
|
||||
accumulator.clear();
|
||||
image.resize(width * height * 3);
|
||||
accumulator.resize(width * height * 3);
|
||||
for (int samp = 0; samp < numSamples; ++samp)
|
||||
{
|
||||
for (int w = 0; w < width; ++w)
|
||||
worker = std::thread(
|
||||
[&]()
|
||||
{
|
||||
for (int h = 0; h < height; ++h)
|
||||
image.clear();
|
||||
accumulator.clear();
|
||||
image.resize(width * height * 3);
|
||||
for (int samp = 0; samp < numSamples; ++samp)
|
||||
{
|
||||
std::function<void()> job = [&]()
|
||||
{
|
||||
std::vector<unsigned char> localAccumulator(width * height * 3);
|
||||
for (int w = 0; w < width; ++w)
|
||||
{
|
||||
for (int h = 0; h < height; ++h)
|
||||
{
|
||||
if (cancel)
|
||||
return;
|
||||
bvh.traceRay();
|
||||
}
|
||||
}
|
||||
// lock image
|
||||
// add result to image
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,12 +3,24 @@
|
||||
#include "window/Window.h"
|
||||
#include "util/Camera.h"
|
||||
|
||||
/// <summary>
|
||||
/// Ray1
|
||||
/// Ray2
|
||||
/// Ray3
|
||||
/// Ray4
|
||||
/// Ray5
|
||||
/// GammaResolve
|
||||
/// Ray1
|
||||
/// Ray2
|
||||
/// Ray3
|
||||
/// </summary>
|
||||
class Scene
|
||||
{
|
||||
public:
|
||||
Scene();
|
||||
~Scene();
|
||||
void render(Camera cam, int width, int height, int numSamples);
|
||||
constexpr const std::vector<unsigned char>& getImage() const { return image; }
|
||||
private:
|
||||
// the thing being displayed
|
||||
std::vector<unsigned char> image;
|
||||
|
||||
Reference in New Issue
Block a user