Wrestling with the compiler to pass these shared_ptr's

This commit is contained in:
MitchellHansen
2017-02-04 22:34:09 -08:00
parent a01b089d12
commit fa047f9e3a
10 changed files with 102 additions and 85 deletions

View File

@@ -4,6 +4,7 @@
#include "util.hpp"
#include "Pub_Sub.h"
#include "RayCaster.h"
#include "LightHandle.h"
class LightController : public VrEventSubscriber {
public:
@@ -15,29 +16,21 @@ public:
PackedData(sf::Vector3f position, sf::Vector3f direction_cartesian, sf::Vector4f rgbi) :
position(position), direction_cartesian(direction_cartesian), rgbi(rgbi) {
}
PackedData();
PackedData() {};
sf::Vector3f position;
sf::Vector3f direction_cartesian;
sf::Vector4f rgbi;
};
// Data that enables "camera" style movement. I can't really use inheritance easily because
// of the data packing requirements
struct Light {
Light();
int packed_index;
float friction_coefficient = 0.1f;
float default_impulse = 1.0f;
sf::Vector3f movement;
};
LightController(std::shared_ptr<RayCaster> raycaster);
// LightController(std::shared_ptr<RayCaster> raycaster);
LightController();
~LightController();
//void create_light(LightController::PackedData light_data, std::string light_name);
// LightHandle get_light_handle(std::string light_name);
void set_position(sf::Vector3f position);
int add_static_impulse(sf::Vector3f impulse);
int add_relative_impulse(DIRECTION direction, float speed);
int update(double delta_time);
@@ -46,19 +39,19 @@ public:
void recieve_event(VrEventPublisher* p, std::unique_ptr<vr::Event> event) override;
void erase_light();
std::vector<LightController::PackedData>* get_lights();
//std::vector<LightController::PackedData>* get_lights();
private:
// Need to allow N byte light class to be packed into 10 byte packets
int packed_size = sizeof(PackedData);
// Index that this light is in the packed data
int packed_index;
//// Need to allow N byte light class to be packed into 10 byte packets
//int packed_size = sizeof(PackedData);
std::vector<PackedData> packed_data_array;
std::unordered_map<std::string, Light> light_map;
std::shared_ptr<RayCaster> raycaster;
//std::vector<PackedData> packed_data_array;
//
//
//std::unordered_map<std::string, LightHandle> light_map;
//
//std::shared_ptr<RayCaster> raycaster;
};