Exported more constants and removed old code
This commit is contained in:
parent
c7a871d9a4
commit
98935c34e4
11
src/consts.h
11
src/consts.h
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CONSTS_H
|
#ifndef CONSTS_H
|
||||||
#define CONSTS_H
|
#define CONSTS_H
|
||||||
|
|
||||||
|
#include "linalg/vec.h"
|
||||||
|
|
||||||
// --------------------------- Basic Constants ---------------------------
|
// --------------------------- Basic Constants ---------------------------
|
||||||
const int VOLUME_WIDTH = 49;
|
const int VOLUME_WIDTH = 49;
|
||||||
const int VOLUME_HEIGHT = 51;
|
const int VOLUME_HEIGHT = 51;
|
||||||
|
|
@ -19,6 +21,8 @@ const int SAMPLES_PER_PIXEL = 8; // TODO: Right now uses simple variance, consi
|
||||||
const float alphaAcumLimit = 0.65f; // TODO: Idk what a good accumulation value is
|
const float alphaAcumLimit = 0.65f; // TODO: Idk what a good accumulation value is
|
||||||
const float minAllowedDensity = 0.001f;
|
const float minAllowedDensity = 0.001f;
|
||||||
|
|
||||||
|
float stepSize = 0.002f;
|
||||||
|
|
||||||
|
|
||||||
// --------------------------- Illumination Constants ---------------------------
|
// --------------------------- Illumination Constants ---------------------------
|
||||||
const double ambientStrength = 0.3;
|
const double ambientStrength = 0.3;
|
||||||
|
|
@ -26,4 +30,11 @@ const double diffuseStrength = 0.8;
|
||||||
const double specularStrength = 0.5;
|
const double specularStrength = 0.5;
|
||||||
const int shininess = 32;
|
const int shininess = 32;
|
||||||
|
|
||||||
|
// Camera and Light
|
||||||
|
Vec3 cameraPos(-0.7, -1.0, -2.0);
|
||||||
|
Vec3 cameraDir(0.4, 0.6, 1.0);
|
||||||
|
Vec3 cameraUp(0.0, 1.0, 0.0);
|
||||||
|
float fov = 60.0f * (M_PI / 180.0f);
|
||||||
|
Vec3 lightPos(1.5, 2.0, -1.0);
|
||||||
|
|
||||||
#endif // CONSTS_H
|
#endif // CONSTS_H
|
||||||
68
src/main.cu
68
src/main.cu
|
|
@ -215,16 +215,8 @@ int main(int argc, char** argv) {
|
||||||
cudaMalloc((void**)&d_framebuffer, fbSize);
|
cudaMalloc((void**)&d_framebuffer, fbSize);
|
||||||
cudaMemset(d_framebuffer, 0, fbSize);
|
cudaMemset(d_framebuffer, 0, fbSize);
|
||||||
|
|
||||||
// Camera and Light
|
|
||||||
Vec3 cameraPos(-0.7, -1.0, -2.0);
|
|
||||||
Vec3 cameraDir(0.4, 0.6, 1.0);
|
|
||||||
Vec3 cameraUp(0.0, 1.0, 0.0);
|
|
||||||
float fov = 60.0f * (M_PI / 180.0f);
|
|
||||||
float stepSize = 0.002f;
|
|
||||||
Vec3 lightPos(1.5, 2.0, -1.0);
|
|
||||||
|
|
||||||
// Launch kernel
|
// Launch kernel
|
||||||
dim3 blockSize(16, 16);
|
dim3 blockSize(16, 16); // TODO: Figure out a good size for parallelization
|
||||||
dim3 gridSize((IMAGE_WIDTH + blockSize.x - 1)/blockSize.x,
|
dim3 gridSize((IMAGE_WIDTH + blockSize.x - 1)/blockSize.x,
|
||||||
(IMAGE_HEIGHT + blockSize.y - 1)/blockSize.y);
|
(IMAGE_HEIGHT + blockSize.y - 1)/blockSize.y);
|
||||||
|
|
||||||
|
|
@ -257,60 +249,4 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
std::cout << "Phong-DVR rendering done. Image saved to output.ppm" << std::endl;
|
std::cout << "Phong-DVR rendering done. Image saved to output.ppm" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// // gpu-buffer-handler branch main
|
|
||||||
// #include "hurricanedata/fielddata.h"
|
|
||||||
// #include "hurricanedata/gpubufferhandler.h"
|
|
||||||
// #include "hurricanedata/datareader.h"
|
|
||||||
// #include "hurricanedata/gpubuffer.h"
|
|
||||||
|
|
||||||
// #include <cuda_runtime.h>
|
|
||||||
// #include <device_launch_parameters.h>
|
|
||||||
// #include <iostream>
|
|
||||||
// #include <cmath>
|
|
||||||
// #include <memory>
|
|
||||||
// #include <iomanip>
|
|
||||||
|
|
||||||
// __global__ void middleOfTwoValues(float *ans, const FieldMetadata &fmd, FieldData fd) {
|
|
||||||
// float xi = getVal(fmd, fd, 0, 20, 100, 100);
|
|
||||||
// float yi = getVal(fmd, fd, 1, 20, 100, 100);
|
|
||||||
// *ans = (xi+yi)/2;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// int main() {
|
|
||||||
// // std::string path = "data/atmosphere_MERRA-wind-speed[179253532]";
|
|
||||||
// std::string path = "data/trimmed";
|
|
||||||
|
|
||||||
// std::string variable = "T";
|
|
||||||
|
|
||||||
// DataReader dataReader{path, variable};
|
|
||||||
|
|
||||||
// std::cout << "created datareader\n";
|
|
||||||
|
|
||||||
// GPUBuffer buffer (dataReader);
|
|
||||||
|
|
||||||
// std::cout << "created buffer\n";
|
|
||||||
|
|
||||||
// GPUBufferHandler bufferHandler(buffer);
|
|
||||||
|
|
||||||
// float *ptr_test_read;
|
|
||||||
// cudaMallocManaged(&ptr_test_read, sizeof(float));
|
|
||||||
|
|
||||||
// std::cout << "created buffer handler\n";
|
|
||||||
// for (int i = 0; i < 10; i++) {
|
|
||||||
// FieldData fd = bufferHandler.nextFieldData();
|
|
||||||
|
|
||||||
// middleOfTwoValues<<<1, 1>>>(ptr_test_read, *bufferHandler.fmd, fd);
|
|
||||||
|
|
||||||
// cudaDeviceSynchronize();
|
|
||||||
// std::cout << "ptr_test_read = " << std::fixed << std::setprecision(6) << *ptr_test_read << "\n";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // TODO: measure data transfer time in this example code.
|
|
||||||
// cudaFree(ptr_test_read);
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue