I dont know
This commit is contained in:
@@ -46,13 +46,9 @@ struct AABB
|
||||
}
|
||||
bool intersects(Ray ray, float tmin, float tmax)
|
||||
{
|
||||
std::cout << "Hello1" << std::endl;
|
||||
glm::vec3 invD = 1.0f / ray.direction;
|
||||
std::cout << "Hello2: " << min.x << " " << min.y << " " << min.z << " " << max.x << " " << max.y << " " << max.z << " " << std::endl;
|
||||
glm::vec3 t0s = glm::vec3(min - ray.origin) * invD;
|
||||
std::cout << "Hello3" << std::endl;
|
||||
glm::vec3 t1s = glm::vec3(max - ray.origin) * invD;
|
||||
std::cout << "Hello4" << std::endl;
|
||||
|
||||
glm::vec3 tsmaller = glm::min(t0s, t1s);
|
||||
glm::vec3 tbigger = glm::max(t0s, t1s);
|
||||
|
||||
+4
-4
@@ -14,14 +14,14 @@ void BVH::addModel(PModel model, glm::mat4 transform)
|
||||
|
||||
void BVH::addModels(std::vector<PModel> _models, glm::mat4 transform)
|
||||
{
|
||||
for (int i = 0; i < _models.size(); ++i)
|
||||
for (auto & _model : _models)
|
||||
{
|
||||
_models[i]->boundingBox.transform(transform);
|
||||
for (auto& point : _models[i]->positions)
|
||||
_model->boundingBox.transform(transform);
|
||||
for (auto& point : _model->positions)
|
||||
{
|
||||
point = glm::vec3(transform * glm::vec4(point, 1));
|
||||
}
|
||||
models.push_back(std::move(_models[i]));
|
||||
models.push_back(std::move(_model));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -46,12 +46,10 @@ void Scene::render(Camera cam, RenderParameter params)
|
||||
{
|
||||
Ray r = Ray{
|
||||
.origin = glm::vec3(0.0f),
|
||||
.direction = glm::vec3(0.0f, 0.0f, 1.0f)
|
||||
.direction = glm::normalize(glm::vec3((float)std::rand() / RAND_MAX, (float)std::rand() / RAND_MAX, (float)std::rand() / RAND_MAX))
|
||||
};
|
||||
bvh.traceRay(r);
|
||||
|
||||
std::cout << "HELLO" << std::endl;
|
||||
|
||||
accumulator[w + h * params.width] +=
|
||||
glm::vec3(w / float(params.width * params.numSamples), h / float(params.height * params.numSamples), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user