mirror of
https://github.com/MartinOpat/cuda-based-raytrace.git
synced 2025-06-07 02:13:10 +02:00
feat (wip): real-time gui with rendering in opengl
This commit is contained in:
27
src/main.cu
27
src/main.cu
@@ -7,7 +7,6 @@
|
||||
|
||||
#include "hurricanedata/datareader.h"
|
||||
#include "linalg/linalg.h"
|
||||
#include "objs/sphere.h"
|
||||
#include "img/handler.h"
|
||||
#include "consts.h"
|
||||
#include "illumination/illumination.h"
|
||||
@@ -46,7 +45,8 @@ void getSpeed(std::vector<float>& speedData, int idx = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// TODO: incorporate this main into main.cpp
|
||||
int unmain(int argc, char** argv) {
|
||||
std::vector<float> data;
|
||||
// getTemperature(data);
|
||||
getSpeed(data);
|
||||
@@ -83,16 +83,17 @@ int main(int argc, char** argv) {
|
||||
// Copy external constants from consts.h to cuda
|
||||
copyConstantsToDevice();
|
||||
|
||||
// Launch kernel
|
||||
dim3 blockSize(16, 16); // TODO: Figure out a good size for parallelization
|
||||
dim3 gridSize((IMAGE_WIDTH + blockSize.x - 1)/blockSize.x,
|
||||
(IMAGE_HEIGHT + blockSize.y - 1)/blockSize.y);
|
||||
|
||||
raycastKernel<<<gridSize, blockSize>>>(
|
||||
d_volume,
|
||||
d_framebuffer
|
||||
);
|
||||
cudaDeviceSynchronize();
|
||||
// NOTE: this shold be done within the rayTracer class
|
||||
// // Launch kernel
|
||||
// dim3 blockSize(16, 16);
|
||||
// dim3 gridSize((IMAGE_WIDTH + blockSize.x - 1)/blockSize.x,
|
||||
// (IMAGE_HEIGHT + blockSize.y - 1)/blockSize.y);
|
||||
//
|
||||
// raycastKernel<<<gridSize, blockSize>>>(
|
||||
// d_volume,
|
||||
// d_framebuffer
|
||||
// );
|
||||
// cudaDeviceSynchronize();
|
||||
|
||||
// Copy framebuffer back to CPU
|
||||
unsigned char* hostFramebuffer = new unsigned char[IMAGE_WIDTH * IMAGE_HEIGHT * 3];
|
||||
@@ -109,4 +110,4 @@ int main(int argc, char** argv) {
|
||||
|
||||
std::cout << "Phong-DVR rendering done. Image saved to output.ppm" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user