Working on lights, I'm conceeding and just using a fixed array. I think it will be faster in the long run, as I won't have to rebind the lights when I add/remove one. Also wrestling with really lame compiler erros with these templated pointers

This commit is contained in:
MitchellHansen
2017-02-08 23:17:10 -08:00
parent 0047db0a65
commit bfb6d922a3
12 changed files with 154 additions and 144 deletions

View File

@@ -3,6 +3,7 @@
#include <util.hpp>
#include <memory>
// We need to be able to :
// - Allow lights to exist outside the context of a LightController
// - i.e we can have a prototype light or similar
@@ -12,21 +13,37 @@
// - But still allow classes of size Y bytes
// - Preserve X packed bytes in an array which are pointed to by an array of shared pointers
struct LightPrototype;
class LightController;
struct PackedData;
class LightHandle {
public:
LightHandle();
//LightHandle(LightController light_controller, std::string light_name);
friend class LightController;
~LightHandle();
void set_friction(float friction);
void set_impulse(float impulse);
void set_movement(sf::Vector3f movement);
void add_movement(sf::Vector3f movement);
void set_position(sf::Vector3f position);
void set_direction(sf::Vector3f direction);
void set_rgbi(sf::Vector4f rgbi);
private:
LightHandle(LightController *const light_controller, unsigned int light_id, LightPrototype light_prototype, std::unique_ptr<PackedData> data_reference);
LightController *const light_controller_ref;
unsigned int light_id;
float friction_coefficient = 0.1f;
float default_impulse = 1.0f;
sf::Vector3f movement;
std::shared_ptr<sf::Vector3f> position;
std::shared_ptr<sf::Vector3f> direction_cartesian;
std::shared_ptr<sf::Vector4f> rgbi;
std::unique_ptr<PackedData> data_reference;
};