Hah! I got it working!
This commit is contained in:
@@ -343,7 +343,7 @@ __kernel void raycaster(
|
|||||||
//if (z_percent > 0 && z_percent > 1)
|
//if (z_percent > 0 && z_percent > 1)
|
||||||
// face_position = (float3)(-1.0f, 1-y_percent, 1-z_percent);
|
// face_position = (float3)(-1.0f, 1-y_percent, 1-z_percent);
|
||||||
|
|
||||||
face_position = (float3)(1.0f, y_percent, z_percent);
|
face_position = (float3)(1.001f, y_percent, z_percent);
|
||||||
}
|
}
|
||||||
else if (face_mask.y == -1) {
|
else if (face_mask.y == -1) {
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ __kernel void raycaster(
|
|||||||
float x_percent = (intersection_t.x - (intersection_t.y - delta_t.y)) / delta_t.x;
|
float x_percent = (intersection_t.x - (intersection_t.y - delta_t.y)) / delta_t.x;
|
||||||
float z_percent = (intersection_t.z - (intersection_t.y - delta_t.y)) / delta_t.z;
|
float z_percent = (intersection_t.z - (intersection_t.y - delta_t.y)) / delta_t.z;
|
||||||
|
|
||||||
face_position = (float3)(x_percent, 1.0f, z_percent);
|
face_position = (float3)(x_percent, 1.001f, z_percent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,19 +365,28 @@ __kernel void raycaster(
|
|||||||
float x_percent = (intersection_t.x - (intersection_t.z - delta_t.z)) / delta_t.x;
|
float x_percent = (intersection_t.x - (intersection_t.z - delta_t.z)) / delta_t.x;
|
||||||
float y_percent = (intersection_t.y - (intersection_t.z - delta_t.z)) / delta_t.y;
|
float y_percent = (intersection_t.y - (intersection_t.z - delta_t.z)) / delta_t.y;
|
||||||
|
|
||||||
face_position = (float3)(x_percent, y_percent, 1.0f);
|
face_position = (float3)(x_percent, y_percent, 1.001f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ray_dir.x > 0)
|
if (ray_dir.x > 0)
|
||||||
face_position.x = - face_position.x - 1;
|
face_position.x = - face_position.x + 1;
|
||||||
|
|
||||||
|
if (ray_dir.x < 0)
|
||||||
|
face_position.x = face_position.x + 0;
|
||||||
|
|
||||||
if (ray_dir.y > 0)
|
if (ray_dir.y > 0)
|
||||||
face_position.y = - face_position.y - 1;
|
face_position.y = - face_position.y + 1;
|
||||||
|
|
||||||
|
if (ray_dir.y < 0)
|
||||||
|
face_position.y = face_position.y + 0;
|
||||||
|
|
||||||
if (ray_dir.z > 0)
|
if (ray_dir.z > 0)
|
||||||
face_position.z = - face_position.z - 1;
|
face_position.z = - face_position.z + 1;
|
||||||
|
|
||||||
|
if (ray_dir.z < 0)
|
||||||
|
face_position.z = face_position.z + 0;
|
||||||
|
|
||||||
|
|
||||||
if (cast_light_intersection_ray(
|
if (cast_light_intersection_ray(
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ int main() {
|
|||||||
light_vec.at(0).direction_cartesian = SphereToCart(camera->get_direction());
|
light_vec.at(0).direction_cartesian = SphereToCart(camera->get_direction());
|
||||||
}
|
}
|
||||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::O)) {
|
if (sf::Keyboard::isKeyPressed(sf::Keyboard::O)) {
|
||||||
// light_vec.at(0).orbit_around_center(timer_accumulator += delta_time);
|
light_vec.at(0).orbit_around_center(timer_accumulator += delta_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::M)) {
|
if (sf::Keyboard::isKeyPressed(sf::Keyboard::M)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user