holy shit is this slow
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
-1
@@ -9,8 +9,9 @@ int main()
|
|||||||
Renderer scene;
|
Renderer scene;
|
||||||
Window window(1920, 1080);
|
Window window(1920, 1080);
|
||||||
Camera camera = Camera{
|
Camera camera = Camera{
|
||||||
.position = glm::vec3(20, 5, 5),
|
.position = glm::vec3(-30, 5, 5),
|
||||||
.target = glm::vec3(0, 0, 0),
|
.target = glm::vec3(0, 0, 0),
|
||||||
|
.S_O = 40,
|
||||||
};
|
};
|
||||||
RenderParameter render = RenderParameter{
|
RenderParameter render = RenderParameter{
|
||||||
.width = 1920,
|
.width = 1920,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Renderer::Renderer()
|
|||||||
.direction = glm::normalize(glm::vec3(-0.4f, -0.3f, -0.2f)),
|
.direction = glm::normalize(glm::vec3(-0.4f, -0.3f, -0.2f)),
|
||||||
.color = glm::vec3(1, 1, 1),
|
.color = glm::vec3(1, 1, 1),
|
||||||
});
|
});
|
||||||
bvh.addModels(ModelLoader::loadModel("../res/models/cube.fbx"),
|
bvh.addModels(ModelLoader::loadModel("../res/models/stanford-bunny.obj"),
|
||||||
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::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, 0.0f, 1.0f)));
|
||||||
bvh.generate();
|
bvh.generate();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
void startRender(Camera cam, RenderParameter params);
|
void startRender(Camera cam, RenderParameter params);
|
||||||
constexpr const std::vector<glm::vec3>& getImage() const { return image; }
|
constexpr const std::vector<glm::vec3>& getImage() const { return image; }
|
||||||
constexpr const std::vector<float>& getSampleTimes() const { return sampleTimes; }
|
constexpr const std::vector<float>& getSampleTimes() const { return sampleTimes; }
|
||||||
constexpr const float getLastSampleTime() const { return sampleTimes.back(); }
|
constexpr const float getLastSampleTime() const { return sampleTimes.empty() ? 0 : sampleTimes.back(); }
|
||||||
constexpr const float getAverageSampleTime() const
|
constexpr const float getAverageSampleTime() const
|
||||||
{
|
{
|
||||||
return std::accumulate(sampleTimes.begin(), sampleTimes.end(), 0.0f) / sampleTimes.size();
|
return std::accumulate(sampleTimes.begin(), sampleTimes.end(), 0.0f) / sampleTimes.size();
|
||||||
|
|||||||
+1
-1
@@ -159,7 +159,7 @@ IntersectionInfo Scene::generateIntersections(const PNode& currentNode, const Ra
|
|||||||
{
|
{
|
||||||
if (!currentNode->aabb.intersects(ray, tmin, tmax))
|
if (!currentNode->aabb.intersects(ray, tmin, tmax))
|
||||||
{
|
{
|
||||||
return {};
|
// return {};
|
||||||
}
|
}
|
||||||
if (currentNode->model.numIndices > 0)
|
if (currentNode->model.numIndices > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,14 @@ std::vector<PModel> ModelLoader::loadModel(std::string_view filename)
|
|||||||
{
|
{
|
||||||
auto aiVert = mesh->mVertices[v];
|
auto aiVert = mesh->mVertices[v];
|
||||||
model->positions.push_back(glm::vec3(aiVert.x, aiVert.y, aiVert.z));
|
model->positions.push_back(glm::vec3(aiVert.x, aiVert.y, aiVert.z));
|
||||||
model->texCoords.push_back(glm::vec2(mesh->mTextureCoords[0][v].x, mesh->mTextureCoords[0][v].y));
|
if (mesh->HasTextureCoords(0))
|
||||||
|
{
|
||||||
|
model->texCoords.push_back(glm::vec2(mesh->mTextureCoords[0][v].x, mesh->mTextureCoords[0][v].y));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model->texCoords.push_back(glm::vec2(0, 0));
|
||||||
|
}
|
||||||
aabb.adjust(model->positions.back());
|
aabb.adjust(model->positions.back());
|
||||||
}
|
}
|
||||||
for (int i = 0; i < mesh->mNumFaces; ++i)
|
for (int i = 0; i < mesh->mNumFaces; ++i)
|
||||||
|
|||||||
Reference in New Issue
Block a user