Nothing special
This commit is contained in:
+3
-3
@@ -8,15 +8,15 @@
|
||||
int main()
|
||||
{
|
||||
Scene scene;
|
||||
Window window(1920, 1080);
|
||||
Window window(800, 600);
|
||||
scene.render(
|
||||
Camera{
|
||||
.position = glm::vec3(10, 0, 0),
|
||||
.direction = glm::vec3(-1, 0, 0),
|
||||
},
|
||||
RenderParameter{
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.width = 800,
|
||||
.height = 600,
|
||||
.numSamples = 10000,
|
||||
});
|
||||
while (true)
|
||||
|
||||
+8
-4
@@ -9,7 +9,7 @@ Scene::Scene()
|
||||
glm::mat4(glm::vec4(1.0f, 0.0f, 0.0f, 0.0f),
|
||||
glm::vec4(0.0f, 1.0f, 0.0f, 0.0f),
|
||||
glm::vec4(0.0f, 0.0f, 1.0f, 0.0f),
|
||||
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f)));
|
||||
glm::vec4(0.0f, 0.0f, 4.0f, 0.0f)));
|
||||
bvh.generate();
|
||||
}
|
||||
|
||||
@@ -48,10 +48,14 @@ void Scene::render(Camera cam, RenderParameter params)
|
||||
.origin = glm::vec3(0.0f),
|
||||
.direction = glm::normalize(glm::vec3((float)std::rand() / RAND_MAX, (float)std::rand() / RAND_MAX, (float)std::rand() / RAND_MAX))
|
||||
};
|
||||
bvh.traceRay(r);
|
||||
|
||||
accumulator[w + h * params.width] +=
|
||||
glm::vec3(w / float(params.width * params.numSamples), h / float(params.height * params.numSamples), 0);
|
||||
auto intersectionInfo = bvh.traceRay(r);
|
||||
|
||||
if(intersectionInfo.has_value())
|
||||
{
|
||||
accumulator[w + h * params.width] += intersectionInfo->albedo;
|
||||
//glm::vec3(w / float(params.width * params.numSamples), h / float(params.height * params.numSamples), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user