adding camera params
This commit is contained in:
+18
-5
@@ -1,9 +1,22 @@
|
|||||||
#include "Scene.h"
|
#include "Scene.h"
|
||||||
|
|
||||||
Scene::Scene()
|
Scene::Scene(glm::vec3 cameraPos, glm::vec3 cameraDirection) : cameraPos(cameraPos), cameraDirection(cameraDirection) {}
|
||||||
: window(1920, 1080)
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
for (int h = 0; h < height; ++h)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void Scene::render() {}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+5
-2
@@ -1,15 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "BVH.h"
|
#include "BVH.h"
|
||||||
#include "window/Window.h"
|
#include "window/Window.h"
|
||||||
|
#include "util/Camera.h"
|
||||||
|
|
||||||
class Scene
|
class Scene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Scene();
|
Scene();
|
||||||
~Scene();
|
~Scene();
|
||||||
void render();
|
void render(Camera cam, int width, int height, int numSamples);
|
||||||
private:
|
private:
|
||||||
Window window;
|
// the thing being displayed
|
||||||
std::vector<unsigned char> image;
|
std::vector<unsigned char> image;
|
||||||
|
// radiance accumulator
|
||||||
|
std::vector<unsigned char> accumulator;
|
||||||
BVH bvh;
|
BVH bvh;
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
target_sources(RayTracer
|
target_sources(RayTracer
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
Camera.h
|
||||||
Model.h
|
Model.h
|
||||||
Model.cpp
|
Model.cpp
|
||||||
ModelLoader.h
|
ModelLoader.h
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
struct Camera
|
||||||
|
{
|
||||||
|
glm::vec3 position;
|
||||||
|
glm::vec3 direction;
|
||||||
|
glm::vec2 sensorSize = glm::vec2(0.036, 0.024);
|
||||||
|
float S_O = 6.9;
|
||||||
|
float f = 0.7;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user