Going to need to get rid of the spherical camera

master
mitchellhansen 8 years ago
parent c3be6e2240
commit d609ed695a

@ -23,6 +23,9 @@ class Ray {
// The 3d voxel position the ray is currently at
sf::Vector3<int> voxel;
// The 2d pixel coordinate
sf::Vector2<int> pixel;
// Reference to the voxel map
Map *map;

@ -13,6 +13,7 @@ Ray::Ray(
sf::Vector3<float> camera_position,
sf::Vector3<float> ray_direction) {
this->pixel = pixel;
this->map = map;
origin = camera_position;
direction = ray_direction;
@ -46,6 +47,13 @@ sf::Color Ray::Cast() {
fabsf((float) (1.0 / cartesian.z))
);
//97, 25, 34 is an interesting example of the problems
// Ahhh, ya know what? This is a problem with how spherical coords
// work when approaching 0 on the chi axis as rotation about
// the theta axis is completely useless. A viewing frustum will
// be needed unfortunately
// Intersection T is the collection of the next intersection points
// for all 3 axis XYZ.
@ -59,6 +67,11 @@ sf::Color Ray::Cast() {
delta_t.z + origin.z
);
if (pixel.x == 0){
int i = 0;
i++;
}
int dist = 0;
do {

@ -49,8 +49,8 @@ sf::Color* RayCaster::CastRays(sf::Vector3<float> camera_direction, sf::Vector3<
//-resolution.y / 2
// Start the loop at the top left, scan right and work down
for (int x = 0; x < resolution.x; x++) {
for (int y = 0; y < resolution.y; y++) {
for (int y = 0; y < resolution.y; y++) {
for (int x = 0; x < resolution.x; x++) {
// The direction the final ray will point.
// First take a reference to the base direction to setup the viewport

Loading…
Cancel
Save