Added samples per pixel gui param

This commit is contained in:
2025-01-15 20:03:39 +01:00
parent 91c9aa193c
commit 2c6594244e
5 changed files with 21 additions and 14 deletions

View File

@@ -25,6 +25,7 @@ Widget::Widget(GLFWwindow* window) {
this->fps = (char*)malloc(512*sizeof(char));
this->paused = true;
this->renderOnce = false;
this->samplesPerPixel = 1;
this->opacityK = 0;
this->sigmoidShift = 0.5f;
@@ -101,6 +102,7 @@ void Widget::tick(double fps) {
}
sprintf(this->fps, "%.3f fps\n", fps);
ImGui::Text(this->fps);
ImGui::DragInt("Samples per pixel", &this->samplesPerPixel, 1, 1, 16, "%d", ImGuiSliderFlags_AlwaysClamp);
ImGui::End();
ImGui::Begin("Camera Controls");
@@ -125,6 +127,8 @@ void Widget::copyToDevice() {
cudaMemcpyToSymbol(&d_cameraDir, &this->cameraDir, sizeof(Vec3));
cudaMemcpyToSymbol(&d_lightPos, &this->lightPos, sizeof(Point3));
cudaMemcpyToSymbol(&d_backgroundColor, &this->bgColor, sizeof(Color3));
cudaMemcpyToSymbol(&d_samplesPerPixel, &this->samplesPerPixel, sizeof(int));
// cudaMemcpyToSymbol(&d_opacityK, &this->opacityK, sizeof(float));
this->opacityKReal = std::pow(10.0f, (-10 + 0.1 * this->opacityK));