Fixed the way lights were linked to opencl, did some tweaking of the phong lighting.

This commit is contained in:
MitchellHansen
2017-01-15 13:17:33 -08:00
parent 7d7ed5367c
commit 129e475b15
11 changed files with 218 additions and 131 deletions

View File

@@ -1,6 +1,6 @@
#pragma once
#include <SFML/System/Vector3.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/System/Vector2.hpp>
#include "util.hpp"
#include "Pub_Sub.h"
@@ -10,7 +10,7 @@ public:
enum DIRECTION { FORWARD, REARWARD, LEFT, RIGHT, UP, DOWN };
Camera();
Camera(sf::Vector3f position, sf::Vector2f direction);
Camera(sf::Vector3f position, sf::Vector2f direction, sf::RenderWindow *window);
~Camera();
int set_position(sf::Vector3f position);
@@ -50,5 +50,12 @@ private:
// These are spherical coords
sf::Vector2f direction;
bool mouse_enabled = true;
sf::Vector2i deltas;
sf::Vector2i fixed;
sf::Vector2i prev_pos;
sf::RenderWindow *window;
};

View File

@@ -50,7 +50,7 @@ public:
// Both will create the view matrix, view res buffer
void create_viewport(int width, int height, float v_fov, float h_fov) override;
void assign_lights(std::vector<Light> lights) override;
void assign_lights(std::vector<Light> *lights) override;
void assign_map(Old_Map *map) override;
void assign_camera(Camera *camera) override;
void validate() override;
@@ -60,6 +60,8 @@ public:
void compute() override;
void draw(sf::RenderWindow* window) override;
void test_edit_viewport(int width, int height, float v_fov, float h_fov);
private:

View File

@@ -24,7 +24,7 @@ public:
virtual void assign_map(Old_Map *map) = 0;
virtual void assign_camera(Camera *camera) = 0;
virtual void create_viewport(int width, int height, float v_fov, float h_fov) = 0;
virtual void assign_lights(std::vector<Light> lights) = 0;
virtual void assign_lights(std::vector<Light> *lights) = 0;
virtual void validate() = 0;
// draw will abstract the gl sharing and software rendering
@@ -39,7 +39,7 @@ protected:
Old_Map * map = nullptr;
Camera *camera = nullptr;
std::vector<Light> lights;
std::vector<Light> *lights;
int light_count = 0;
sf::Uint8 *viewport_image = nullptr;
sf::Vector4f *viewport_matrix = nullptr;

View File

@@ -15,7 +15,7 @@ public:
// Both will create the view matrix, view res buffer
void create_viewport(int width, int height, float v_fov, float h_fov) override;
void assign_lights(std::vector<Light> lights) override;
void assign_lights(std::vector<Light> *lights) override;
void assign_map(Old_Map *map) override;
void assign_camera(Camera *camera) override;
void validate() override;