–Why the off by one on voxel.y? lolololol

master
MitchellHansen 8 years ago
parent f8be952a9b
commit 475a879b51

@ -133,9 +133,7 @@ __kernel void raycaster(
voxel_step *= (ray_dir > 0) - (ray_dir < 0); voxel_step *= (ray_dir > 0) - (ray_dir < 0);
// Setup the voxel coords from the camera origin // Setup the voxel coords from the camera origin
// Off by one error here in regards to the camera position. int3 voxel = convert_int3(*cam_pos);
// Will need to hunt this down later
int3 voxel = convert_int3(*cam_pos + 1);
// Delta T is the units a ray must travel along an axis in order to // Delta T is the units a ray must travel along an axis in order to
// traverse an integer split // traverse an integer split
@ -197,8 +195,7 @@ __kernel void raycaster(
// If we hit a voxel // If we hit a voxel
//int index = voxel.x * (*map_dim).y * (*map_dim).z + voxel.z * (*map_dim).z + voxel.y; //int index = voxel.x * (*map_dim).y * (*map_dim).z + voxel.z * (*map_dim).z + voxel.y;
// Why the off by one on voxel.y? int index = voxel.x + (*map_dim).x * (voxel.y + (*map_dim).z * (voxel.z));
int index = voxel.x + (*map_dim).x * (voxel.y + (*map_dim).z * (voxel.z-1));
int voxel_data = map[index]; int voxel_data = map[index];
if (voxel_data != 0) { if (voxel_data != 0) {

Loading…
Cancel
Save