Fixed some TODOs, removed old comments

This commit is contained in:
Martin Opat 2025-01-11 13:25:24 +01:00
parent 9afd242121
commit 4971d693fd
3 changed files with 7 additions and 21 deletions

View File

@ -28,7 +28,7 @@ const float MAX_SPEED = 14.0f;
// --------------------------- Raycasting Constants ---------------------------
const int SAMPLES_PER_PIXEL = 1;
const float alphaAcumLimit = 1.0f; // TODO: Idk what a good accumulation value is <--- This finally does something when using alpha in both places at least
const float alphaAcumLimit = 1.0f; // TODO: Atm, this does not work very intuitively, other parameters control transparency
const float minAllowedDensity = 0.001f;
const float stepSize = 0.02f;

View File

@ -1,6 +1,5 @@
#include "shading.h"
// TODO: Consider wrapping this in a class (?)
__device__ Vec3 phongShading(const Vec3& normal, const Vec3& lightDir, const Vec3& viewDir, const Vec3& baseColor) {
Vec3 ambient = baseColor * ambientStrength;
double diff = fmax(normal.dot(lightDir), 0.0);

View File

@ -60,19 +60,15 @@ int main() {
std::cout << "DATA size: " << data.size() << std::endl;
// TODO: Eveontually remove debug below (i.e., eliminate for-loop etc.)
// Generate debug volume data
// TODO: Eventually, we should not need to load the volume like this
float* hostVolume = new float[VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH];
// generateVolume(hostVolume, VOLUME_WIDTH, VOLUME_HEIGHT, VOLUME_DEPTH);
int inftyCount=0;
for (int i = 0; i < VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH; i++) {
// Discard temperatures above a small star (supposedly, missing temperature values)
hostVolume[i] = data[i + 0*VOLUME_DEPTH*VOLUME_HEIGHT*VOLUME_WIDTH];
if (data[i + 0*VOLUME_DEPTH*VOLUME_HEIGHT*VOLUME_WIDTH] + epsilon >= infty) {hostVolume[i] = -infty; inftyCount++;}
// Discard missing values
if (data[i + 0*VOLUME_DEPTH*VOLUME_HEIGHT*VOLUME_WIDTH] + epsilon >= infty) hostVolume[i] = -infty;
}
std::cout << "inftyCount: " << inftyCount << std::endl;
// Reverse the order of hostVolume
// Reverse the order of hostVolume TODO: Idk why the volume upside down, this can probably be deleted and substituted with a minus sign somehwere (camera position?)
for (int i = 0; i < VOLUME_WIDTH; i++) {
for (int j = 0; j < VOLUME_HEIGHT; j++) {
for (int k = 0; k < VOLUME_DEPTH/2; k++) {
@ -83,8 +79,7 @@ int main() {
}
}
// Store the half-way up slice data into a file
// Store the half-way up slice data into a file TODO: Remove this debug
std::ofstream myfile;
myfile.open("halfwayup.txt");
for (int i = 0; i < VOLUME_WIDTH; i++) {
@ -95,6 +90,7 @@ int main() {
}
myfile.close();
// Print min, max, avg., and median values TODO: Remove this debug
float minVal = *std::min_element(hostVolume, hostVolume + VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH, [](float a, float b) {
if (a <= epsilon) return false;
if (b <= epsilon) return true;
@ -102,15 +98,6 @@ int main() {
});
float maxVal = *std::max_element(hostVolume, hostVolume + VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH);
std::cout << "minVal: " << minVal << " maxVal: " << maxVal << std::endl;
// Min-max normalization TODO: Decide whether to keep the normalization here but probably not
// Normalize to [0, 1]
// Temperature: min: 0 max: 1 avg: 0.776319 median: 0.790567
// Speed: min: 0 max: 1 avg: 0.132117 median: 0.0837869
// for (int i = 0; i < VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH; i++) {
// hostVolume[i] = (hostVolume[i] - minVal) / (maxVal - minVal);
// }
// // print min, max, avg., and median values <--- the code actually does not work when this snippet is enabled so probably TODO: Delete this later
// std::sort(hostVolume, hostVolume + VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH);
// float sum = std::accumulate(hostVolume, hostVolume + VOLUME_WIDTH * VOLUME_HEIGHT * VOLUME_DEPTH, 0.0f);