Finally found the root of that off by one error. Changed up the readme.

This commit is contained in:
MitchellHansen
2017-01-16 02:31:51 -08:00
parent cc7a4a2efb
commit abec38e7c7
8 changed files with 91 additions and 32 deletions

View File

@@ -13,15 +13,6 @@
const double PI = 3.141592653589793238463;
const float PI_F = 3.14159265358979f;
struct Light {
sf::Vector4f rgbi;
// I believe that Vector3's get padded to Vector4's. Give them a non-garbage value
sf::Vector3f position;
sf::Vector3f direction_cartesian;
};
struct fps_counter {
public:
fps_counter(){
@@ -273,4 +264,27 @@ inline std::vector<float> sfml_get_float_input(sf::RenderWindow *window) {
return ret;
}
}
struct Light {
sf::Vector4f rgbi;
// I believe that Vector3's get padded to Vector4's. Give them a non-garbage value
sf::Vector3f position;
sf::Vector3f direction_cartesian;
void look_at_center() {
direction_cartesian = SphereToCart(CartToNormalizedSphere(sf::Vector3f(256, 256, 256) - position));
};
void orbit_around_center(double time) {
position = sf::Vector3f(
position.x * cos(time/1000) - position.y * sin(time/1000),
position.x * sin(time/1000) + position.y * cos(time/1000),
position.z
);
look_at_center();
};
};