partway through some documentation and bug fixing

This commit is contained in:
2018-02-17 01:08:31 -08:00
parent 176d9f7a54
commit 51be54c964
11 changed files with 146 additions and 38 deletions

View File

@@ -137,19 +137,24 @@ public:
bool create_texture_atlas(sf::Texture *t, sf::Vector2i tile_dim);
// Check to make sure that the buffers have been initiated and set them as kernel args
bool validate() ;
bool validate();
// Aquires the GL objects, runs the kernel, releases back the GL objects
bool compute() ;
bool compute();
// Take the viewport sprite and draw it to the screen
void draw(sf::RenderWindow* window) ;
void draw(sf::RenderWindow* window);
// Load the saved device config from a file
bool load_config();
// Save the chosen device config to a file
void save_config();
// Set a
void
// ================================== DEBUG =======================================
// Re compile the kernel and revalidate the args
@@ -282,6 +287,7 @@ private:
// Containers holding the kernels and buffers
std::map<std::string, cl_kernel> kernel_map;
std::map<std::string, cl_mem> buffer_map;
std::vector<std::pair<std::string, unsigned int>> settings_index_map;
std::unordered_map<std::string, std::pair<sf::Sprite, std::unique_ptr<sf::Texture>>> image_map;
// Hardware caster holds and renders its own textures

View File

@@ -6,28 +6,46 @@
#include <cmath>
#include "Gui.h"
/**
*
* Camera
*
* Camera provides a convenient way to create 3d vectors and positions which represent a camera. It provides physics
* to move the camera around in 3d space as well as impulse and friction control to alter its movement characteristics
*
*/
class Camera : public VrEventSubscriber, private Gui{
public:
enum DIRECTION { FORWARD, REARWARD, LEFT, RIGHT, UP, DOWN };
Camera();
// TODO: Remove dependency on getting a window ptr. Instead provide window interface to get and set mouse position
Camera(sf::Vector3f position, sf::Vector2f direction, sf::RenderWindow *window);
~Camera();
int set_position(sf::Vector3f position);
// Apply an incoming impule to the velocity vector
int add_static_impulse(sf::Vector3f impulse);
// Apply an impulse in one of the 6 relative directions with a certain magnitude
int add_relative_impulse(DIRECTION direction, float speed);
int slew_camera(sf::Vector2f input);
void set_camera(sf::Vector2f input);
void set_camera(sf::Vector3f input);
void set_camera_direction(sf::Vector2f input);
void set_camera_direction(sf::Vector3f input);
int update(double delta_time);
void look_at_center();
// TODO: Raw ptr's SHARED_PTR with CL, bad idea
sf::Vector2f* get_direction_pointer();
sf::Vector3f* get_position_pointer();
sf::Vector3f* get_movement_pointer();

View File

@@ -3,6 +3,19 @@
#include <Logger.h>
#include <list>
/**
*
* GUI
*
* Any class that wants to have an interactive GUI rendered to the window may
* inherit GUI and override the render_gui() and update_gui() methods
*
* ImGui operations must be completely wrapped in Begins and Ends
*
* You may enable and disable rendering by setting the 'rendering' flag to true or false
*
*/
class Gui {
public:

View File

@@ -7,6 +7,22 @@
#include "Gui.h"
#include <string>
/**
*
* Input
*
* For each frame the Application must call
*
* consume_sf_events(*window)
* handle_held_keys()
* dispatch_events()
*
* which will pull all the events from the sfml event queue, transpose them over
* to vr:events, compare to the last frame and create held key events for keys held
* for longer than one frame, and finally dispatch the events to the relevent VrEventListener's
*
*/
class Input : public VrEventPublisher, private Gui{
public:
@@ -14,9 +30,6 @@ public:
Input();
~Input();
// Keep track of keys that are not released
// Keep track of mouse up and downs in conjunction with dragging
// Keep track of joystick buttons
void consume_sf_events(sf::RenderWindow *window);
void consume_vr_events();
@@ -33,7 +46,8 @@ private:
std::vector<sf::Keyboard::Key> held_keys;
std::vector<sf::Mouse::Button> held_mouse_buttons;
// TODO: What the hell was I using these for?
std::vector<bool> keyboard_flags;
std::vector<bool> mouse_flags;

View File

@@ -4,6 +4,17 @@
#include "Pub_Sub.h"
#include <list>
/**
*
* NetworkInput
*
* Prototype network joystick, listens to clients connecting to a certain port and reads
* packets pertaining to, in the case of the lights, xyz movement. This could in theory
* provide a very generic way to listen to network input and generate events from received
* packets.
*
*/
struct CustomPacket {
char data[1024];

View File

@@ -9,19 +9,24 @@ class VrEventPublisher;
class VrEventSubscriber {
public:
virtual ~VrEventSubscriber() {};
virtual ~VrEventSubscriber();
virtual void recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Event> event) = 0;
void subscribe_to_publisher(VrEventPublisher* publisher, vr::Event::EventType type);
void subscribe_to_publisher(VrEventPublisher* publisher, std::vector<vr::Event::EventType> type);
void unsubscribe(VrEventPublisher* publisher, vr::Event::EventType type);
protected:
std::vector<vr::Event::EventType> subscribed_event_types;
// When we destroy a subscriber we need to be able to notify the publishers
// We have to keep track of every EventType because of the way EventTypes
// are mapped to subscribers in the publisher
std::map<VrEventPublisher*, std::vector<vr::Event::EventType>> subscriptions;
};
class VrEventPublisher {
public:
virtual ~VrEventPublisher() {};
virtual ~VrEventPublisher();
virtual void subscribe(VrEventSubscriber *subscriber, vr::Event::EventType type);
virtual void subscribe(VrEventSubscriber *subscriber, std::vector<vr::Event::EventType> type);
virtual void unsubscribe(VrEventSubscriber *s, vr::Event::EventType c);