Don't know what is in this one

This commit is contained in:
Mitchell Hansen
2016-07-30 20:32:15 -07:00
parent 45343a2e97
commit 624d2771ac
6 changed files with 714 additions and 26 deletions

43
include/Ray.h Normal file
View File

@@ -0,0 +1,43 @@
#pragma once
#include <SFML/Graphics.hpp>
#include <iostream>
#include "Map.h"
class Ray {
private:
// The Tail of the vector
sf::Vector3<float> origin
// Direction / Length of the vector
sf::Vector3<float> direction;
// The incrementing points at which T intersects int(X, Y, Z) points
sf::Vector3<float> intersction_t;
// The speed at which the ray climbs.
// Take the slope of the line (1 / cartesian.x/y/z) = delta_t.x/y/z
sf::Vector3<float> delta_t;
// The 3d voxel position the ray is currently at
sf::Vector3<int> voxel;
// Reference to the voxel map
Map *m;
// The dimensions of the voxel map
sf::Vector3<int> dimensions;
public:
public Ray(
Map *m,
sf::Vector2<int> resolution,
sf::Vector2<int> pixel,
sf::Vector3<float> camera_position,
sf::Vector3<float> ray_direction
);
public sf::Color Cast();
}

31
include/util.hpp Normal file
View File

@@ -0,0 +1,31 @@
#pragma once
#include <SFML/Graphics.hpp>
struct fps_counter {
public:
fps_counter(){
if(!f.loadFromFile("../assets/fonts/Arial.ttf")){
std::cout << "couldn't find the fallback Arial font "
"in ../assets/fonts/" << std::endl;
} else {
t.setFont(f);
}
}
void frame(double delta_time){
frame_count++;
fps_average += (delta_time - fps_average) / frame_count;
}
void draw(sf::RenderWindow *r){
t.setString(std::to_string(fps_average));
r->draw(t);
}
private:
sf::Font f;
sf::Text t;
int frame_count = 0;
double fps_average = 0;
};