Working more on the lights. Trying to get around the packing requirements for passing data to CL
This commit is contained in:
@@ -50,7 +50,8 @@ public:
|
|||||||
// Both will create the view matrix, view res buffer
|
// Both will create the view matrix, view res buffer
|
||||||
void create_viewport(int width, int height, float v_fov, float h_fov) override;
|
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<LightController> *lights) override;
|
||||||
|
void assign_lights();
|
||||||
void assign_map(Old_Map *map) override;
|
void assign_map(Old_Map *map) override;
|
||||||
void assign_camera(Camera *camera) override;
|
void assign_camera(Camera *camera) override;
|
||||||
void validate() override;
|
void validate() override;
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <SFML/System/Vector3.hpp>
|
|
||||||
#include <SFML/System/Vector2.hpp>
|
|
||||||
#include "util.hpp"
|
|
||||||
#include "Pub_Sub.h"
|
|
||||||
|
|
||||||
class Light : public VrEventSubscriber {
|
|
||||||
public:
|
|
||||||
|
|
||||||
enum DIRECTION { FORWARD, REARWARD, LEFT, RIGHT, UP, DOWN };
|
|
||||||
|
|
||||||
Light();
|
|
||||||
Light(sf::Vector3f position, sf::Vector3f direction);
|
|
||||||
~Light();
|
|
||||||
|
|
||||||
int set_position(sf::Vector3f position);
|
|
||||||
|
|
||||||
int add_static_impulse(sf::Vector3f impulse);
|
|
||||||
int add_relative_impulse(DIRECTION direction, float speed);
|
|
||||||
|
|
||||||
int slew_camera(sf::Vector3f input);
|
|
||||||
void set_camera(sf::Vector3f input);
|
|
||||||
|
|
||||||
int update(double delta_time);
|
|
||||||
|
|
||||||
void look_at_center();
|
|
||||||
|
|
||||||
sf::Vector3f* get_direction_pointer();
|
|
||||||
sf::Vector3f* get_position_pointer();
|
|
||||||
sf::Vector3f* get_movement_pointer();
|
|
||||||
|
|
||||||
sf::Vector3f get_movement();
|
|
||||||
sf::Vector3f get_position();
|
|
||||||
sf::Vector3f get_direction();
|
|
||||||
|
|
||||||
|
|
||||||
void recieve_event(VrEventPublisher* p, std::unique_ptr<vr::Event> event) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// XYZ
|
|
||||||
sf::Vector3f position;
|
|
||||||
|
|
||||||
sf::Vector3f direction_cartesian;
|
|
||||||
|
|
||||||
sf::Vector4f rgbi;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
50
include/LightController.h
Normal file
50
include/LightController.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <SFML/System/Vector3.hpp>
|
||||||
|
#include <SFML/System/Vector2.hpp>
|
||||||
|
#include "util.hpp"
|
||||||
|
#include "Pub_Sub.h"
|
||||||
|
|
||||||
|
class LightController : public VrEventSubscriber {
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum DIRECTION { FORWARD, REARWARD, LEFT, RIGHT, UP, DOWN };
|
||||||
|
|
||||||
|
struct Light {
|
||||||
|
Light(sf::Vector3f position, sf::Vector3f direction_cartesian, sf::Vector4f rgbi) :
|
||||||
|
position(position), direction_cartesian(direction_cartesian), rgbi(rgbi) {
|
||||||
|
}
|
||||||
|
Light();
|
||||||
|
sf::Vector3f position;
|
||||||
|
sf::Vector3f direction_cartesian;
|
||||||
|
sf::Vector4f rgbi;
|
||||||
|
};
|
||||||
|
|
||||||
|
LightController();
|
||||||
|
LightController(sf::Vector3f position, sf::Vector3f direction, sf::Vector4f rgbi);
|
||||||
|
~LightController();
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
void look_at_center();
|
||||||
|
|
||||||
|
void recieve_event(VrEventPublisher* p, std::unique_ptr<vr::Event> event) override;
|
||||||
|
|
||||||
|
static void erase_light();
|
||||||
|
std::vector<LightController::Light>* get_lights();
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Need to allow N byte light class to be packed into 10 byte packets
|
||||||
|
int packed_size = sizeof(Light);
|
||||||
|
|
||||||
|
// Index that this light is in the packed data
|
||||||
|
int packed_index;
|
||||||
|
|
||||||
|
std::vector<LightController::Light> packed_data;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <Map.h>
|
#include <Map.h>
|
||||||
#include "Old_Map.h"
|
#include "Old_Map.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Light.h"
|
#include "LightController.h"
|
||||||
|
|
||||||
|
|
||||||
class RayCaster {
|
class RayCaster {
|
||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
virtual void assign_map(Old_Map *map) = 0;
|
virtual void assign_map(Old_Map *map) = 0;
|
||||||
virtual void assign_camera(Camera *camera) = 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 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<LightController> *lights) = 0;
|
||||||
virtual void validate() = 0;
|
virtual void validate() = 0;
|
||||||
|
|
||||||
// draw will abstract the gl sharing and software rendering
|
// draw will abstract the gl sharing and software rendering
|
||||||
@@ -40,7 +40,7 @@ protected:
|
|||||||
|
|
||||||
Old_Map * map = nullptr;
|
Old_Map * map = nullptr;
|
||||||
Camera *camera = nullptr;
|
Camera *camera = nullptr;
|
||||||
std::vector<Light> *lights;
|
std::vector<LightController::Light> *lights;
|
||||||
int light_count = 0;
|
int light_count = 0;
|
||||||
sf::Uint8 *viewport_image = nullptr;
|
sf::Uint8 *viewport_image = nullptr;
|
||||||
sf::Vector4f *viewport_matrix = nullptr;
|
sf::Vector4f *viewport_matrix = nullptr;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#define GAME_RENDERER_H
|
#define GAME_RENDERER_H
|
||||||
|
|
||||||
#include "SFML/Graphics.hpp"
|
#include "SFML/Graphics.hpp"
|
||||||
#include "CL_Wrapper.h"
|
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Old_Map.h"
|
#include "Old_Map.h"
|
||||||
#include "RayCaster.h"
|
#include "RayCaster.h"
|
||||||
@@ -35,14 +35,13 @@ public:
|
|||||||
void register_map(Old_Map* map);
|
void register_map(Old_Map* map);
|
||||||
void register_lights();
|
void register_lights();
|
||||||
void create_viewport(float v_fov, float h_fov, int height, int width);
|
void create_viewport(float v_fov, float h_fov, int height, int width);
|
||||||
void register_light(Light l);
|
void register_light(LightController l);
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
sf::RenderWindow* get_window();
|
sf::RenderWindow* get_window();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
CL_Wrapper *cl;
|
|
||||||
RayCaster *rc;
|
RayCaster *rc;
|
||||||
|
|
||||||
bool sharing_supported = false;
|
bool sharing_supported = false;
|
||||||
@@ -51,7 +50,7 @@ private:
|
|||||||
sf::Uint8 *drawing_surface;
|
sf::Uint8 *drawing_surface;
|
||||||
sf::RenderWindow* window;
|
sf::RenderWindow* window;
|
||||||
|
|
||||||
std::vector<Light> lights;
|
std::vector<LightController> lights;
|
||||||
Old_Map* map;
|
Old_Map* map;
|
||||||
Camera* camera;
|
Camera* camera;
|
||||||
sf::Uint8 *view_matrix;
|
sf::Uint8 *view_matrix;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public:
|
|||||||
// Both will create the view matrix, view res buffer
|
// Both will create the view matrix, view res buffer
|
||||||
void create_viewport(int width, int height, float v_fov, float h_fov) override;
|
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<LightController> *lights) override;
|
||||||
void assign_map(Old_Map *map) override;
|
void assign_map(Old_Map *map) override;
|
||||||
void assign_camera(Camera *camera) override;
|
void assign_camera(Camera *camera) override;
|
||||||
void validate() override;
|
void validate() override;
|
||||||
|
|||||||
@@ -196,16 +196,35 @@ void Hardware_Caster::create_viewport(int width, int height, float v_fov, float
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hardware_Caster::assign_lights(std::vector<Light> *lights) {
|
void Hardware_Caster::assign_lights(std::vector<LightController> *lights) {
|
||||||
|
|
||||||
this->lights = lights;
|
//this->lights = ;
|
||||||
|
|
||||||
|
std::cout << sizeof(LightController);
|
||||||
|
std::cout << sizeof(float);
|
||||||
|
light_count = static_cast<int>(lights->size());
|
||||||
|
|
||||||
|
//create_buffer("lights", sizeof(float) * 10 * light_count, this->lights->data(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR);
|
||||||
|
|
||||||
|
create_buffer("light_count", sizeof(int), &light_count);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hardware_Caster::assign_lights() {
|
||||||
|
|
||||||
|
// Get a pointer to the packed light data
|
||||||
|
this->lights = LightController::get_lights();
|
||||||
|
|
||||||
light_count = static_cast<int>(lights->size());
|
light_count = static_cast<int>(lights->size());
|
||||||
|
|
||||||
create_buffer("lights", sizeof(float) * 10 * light_count, this->lights->data(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR);
|
size_t packed_size = sizeof(LightController::Light);
|
||||||
|
|
||||||
|
create_buffer("lights", packed_size * light_count, lights->data(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR);
|
||||||
|
|
||||||
create_buffer("light_count", sizeof(int), &light_count);
|
create_buffer("light_count", sizeof(int), &light_count);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hardware_Caster::draw(sf::RenderWindow* window) {
|
void Hardware_Caster::draw(sf::RenderWindow* window) {
|
||||||
|
|||||||
138
src/Light.cpp
138
src/Light.cpp
@@ -1,138 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "Light.h"
|
|
||||||
#include "Pub_Sub.h"
|
|
||||||
|
|
||||||
|
|
||||||
Light::Light() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Light::Light(sf::Vector3f position, sf::Vector3f direction) :
|
|
||||||
position(position), direction_cartesian(direction_cartesian)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Light::~Light() {
|
|
||||||
}
|
|
||||||
|
|
||||||
int Light::set_position(sf::Vector3f position) {
|
|
||||||
this->position = position;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Light::add_static_impulse(sf::Vector3f impulse) {
|
|
||||||
movement += impulse;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Light::add_relative_impulse(DIRECTION impulse_direction, float speed) {
|
|
||||||
|
|
||||||
// No sense in doing fancy dot products, adding Pi's will suffice
|
|
||||||
// Always add PI/2 to X initially to avoid negative case
|
|
||||||
sf::Vector2f dir;
|
|
||||||
|
|
||||||
switch (impulse_direction) {
|
|
||||||
|
|
||||||
case DIRECTION::FORWARD:
|
|
||||||
dir = sf::Vector2f(direction_cartesian.y, direction_cartesian.x);
|
|
||||||
break;
|
|
||||||
case DIRECTION::REARWARD:
|
|
||||||
dir = sf::Vector2f(direction_cartesian.y, direction_cartesian.x + PI_F);
|
|
||||||
break;
|
|
||||||
case DIRECTION::LEFT:
|
|
||||||
dir = sf::Vector2f(direction_cartesian.y + PI_F + PI_F / 2, PI_F / 2);
|
|
||||||
break;
|
|
||||||
case DIRECTION::RIGHT:
|
|
||||||
dir = sf::Vector2f(direction_cartesian.y + PI_F / 2, PI_F / 2);
|
|
||||||
break;
|
|
||||||
case DIRECTION::UP:
|
|
||||||
dir = sf::Vector2f(direction_cartesian.y, direction_cartesian.x + PI_F / 2);
|
|
||||||
break;
|
|
||||||
case DIRECTION::DOWN:
|
|
||||||
dir = sf::Vector2f(direction_cartesian.y + PI_F, (direction_cartesian.x * -1) + PI_F / 2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
movement += SphereToCart(dir);
|
|
||||||
movement *= speed;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Light::slew_camera(sf::Vector3f input) {
|
|
||||||
direction_cartesian -= input;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Light::set_camera(sf::Vector3f input) {
|
|
||||||
direction_cartesian = input;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Light::update(double delta_time) {
|
|
||||||
|
|
||||||
double multiplier = 40;
|
|
||||||
|
|
||||||
position.x += static_cast<float>(movement.x * delta_time * multiplier);
|
|
||||||
position.y += static_cast<float>(movement.y * delta_time * multiplier);
|
|
||||||
position.z += static_cast<float>(movement.z * delta_time * multiplier);
|
|
||||||
|
|
||||||
movement *= static_cast<float>(1.0f * delta_time * multiplier);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Light::recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Event> event) {
|
|
||||||
|
|
||||||
if (event.get()->type == vr::Event::KeyHeld) {}
|
|
||||||
else if (event->type == vr::Event::KeyPressed) {}
|
|
||||||
else if (event->type == vr::Event::MouseMoved) {}
|
|
||||||
|
|
||||||
else if (event->type == vr::Event::JoystickMoved) {
|
|
||||||
|
|
||||||
vr::JoystickMoved *joystick_event = static_cast<vr::JoystickMoved*>(event.get());
|
|
||||||
|
|
||||||
if (joystick_event->axis == sf::Joystick::Axis::X) {
|
|
||||||
movement.x -= joystick_event->position / 5;
|
|
||||||
//add_relative_impulse(Camera::DIRECTION::FORWARD, joystick_event->position);
|
|
||||||
}
|
|
||||||
else if (joystick_event->axis == sf::Joystick::Axis::Y) {
|
|
||||||
movement.y += joystick_event->position / 5;
|
|
||||||
//add_relative_impulse(Camera::DIRECTION::RIGHT, joystick_event->position);
|
|
||||||
}
|
|
||||||
//else if (joystick_event->axis == sf::Joystick::Axis::Z) {
|
|
||||||
// add_relative_impulse(Camera::DIRECTION::DOWN, joystick_event->position);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Light::look_at_center() {
|
|
||||||
|
|
||||||
//direction_cartesian = CartToNormalizedSphere(sf::Vector3f(75, 75, 75) - position);
|
|
||||||
}
|
|
||||||
|
|
||||||
sf::Vector3f* Light::get_direction_pointer() {
|
|
||||||
return &direction_cartesian;
|
|
||||||
}
|
|
||||||
|
|
||||||
sf::Vector3f* Light::get_movement_pointer() {
|
|
||||||
return &movement;
|
|
||||||
}
|
|
||||||
|
|
||||||
sf::Vector3f* Light::get_position_pointer() {
|
|
||||||
return &position;
|
|
||||||
}
|
|
||||||
|
|
||||||
sf::Vector3f Light::get_movement() {
|
|
||||||
return movement;
|
|
||||||
}
|
|
||||||
|
|
||||||
sf::Vector3f Light::get_position() {
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
sf::Vector3f Light::get_direction() {
|
|
||||||
return direction_cartesian;
|
|
||||||
}
|
|
||||||
108
src/LightController.cpp
Normal file
108
src/LightController.cpp
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "LightController.h"
|
||||||
|
#include "Pub_Sub.h"
|
||||||
|
|
||||||
|
|
||||||
|
LightController::LightController() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LightController::LightController(sf::Vector3f position, sf::Vector3f direction, sf::Vector4f rgbi) {
|
||||||
|
packed_index = packed_data.size() / packed_size;
|
||||||
|
packed_data.emplace_back(Light(position, direction, rgbi));
|
||||||
|
}
|
||||||
|
|
||||||
|
LightController::~LightController() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void LightController::set_position(sf::Vector3f position) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int LightController::add_static_impulse(sf::Vector3f impulse) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LightController::add_relative_impulse(DIRECTION impulse_direction, float speed) {
|
||||||
|
|
||||||
|
// No sense in doing fancy dot products, adding Pi's will suffice
|
||||||
|
// Always add PI/2 to X initially to avoid negative case
|
||||||
|
sf::Vector2f dir;
|
||||||
|
|
||||||
|
switch (impulse_direction) {
|
||||||
|
|
||||||
|
case DIRECTION::FORWARD:
|
||||||
|
dir = sf::Vector2f(packed_data.at(packed_index).direction_cartesian.y, packed_data.at(packed_index).direction_cartesian.x);
|
||||||
|
break;
|
||||||
|
case DIRECTION::REARWARD:
|
||||||
|
dir = sf::Vector2f(packed_data.at(packed_index).direction_cartesian.y, packed_data.at(packed_index).direction_cartesian.x + PI_F);
|
||||||
|
break;
|
||||||
|
case DIRECTION::LEFT:
|
||||||
|
dir = sf::Vector2f(packed_data.at(packed_index).direction_cartesian.y + PI_F + PI_F / 2, PI_F / 2);
|
||||||
|
break;
|
||||||
|
case DIRECTION::RIGHT:
|
||||||
|
dir = sf::Vector2f(packed_data.at(packed_index).direction_cartesian.y + PI_F / 2, PI_F / 2);
|
||||||
|
break;
|
||||||
|
case DIRECTION::UP:
|
||||||
|
dir = sf::Vector2f(packed_data.at(packed_index).direction_cartesian.y, packed_data.at(packed_index).direction_cartesian.x + PI_F / 2);
|
||||||
|
break;
|
||||||
|
case DIRECTION::DOWN:
|
||||||
|
dir = sf::Vector2f(packed_data.at(packed_index).direction_cartesian.y + PI_F, (packed_data.at(packed_index).direction_cartesian.x * -1) + PI_F / 2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//movement += SphereToCart(dir);
|
||||||
|
//movement *= speed;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int LightController::update(double delta_time) {
|
||||||
|
|
||||||
|
double multiplier = 40;
|
||||||
|
|
||||||
|
//position.x += static_cast<float>(movement.x * delta_time * multiplier);
|
||||||
|
//position.y += static_cast<float>(movement.y * delta_time * multiplier);
|
||||||
|
//position.z += static_cast<float>(movement.z * delta_time * multiplier);
|
||||||
|
|
||||||
|
//movement *= static_cast<float>(1.0f * delta_time * multiplier);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LightController::recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Event> event) {
|
||||||
|
|
||||||
|
if (event.get()->type == vr::Event::KeyHeld) {}
|
||||||
|
else if (event->type == vr::Event::KeyPressed) {}
|
||||||
|
else if (event->type == vr::Event::MouseMoved) {}
|
||||||
|
|
||||||
|
else if (event->type == vr::Event::JoystickMoved) {
|
||||||
|
|
||||||
|
vr::JoystickMoved *joystick_event = static_cast<vr::JoystickMoved*>(event.get());
|
||||||
|
|
||||||
|
if (joystick_event->axis == sf::Joystick::Axis::X) {
|
||||||
|
//movement.x -= joystick_event->position / 5;
|
||||||
|
//add_relative_impulse(Camera::DIRECTION::FORWARD, joystick_event->position);
|
||||||
|
}
|
||||||
|
else if (joystick_event->axis == sf::Joystick::Axis::Y) {
|
||||||
|
//movement.y += joystick_event->position / 5;
|
||||||
|
//add_relative_impulse(Camera::DIRECTION::RIGHT, joystick_event->position);
|
||||||
|
}
|
||||||
|
//else if (joystick_event->axis == sf::Joystick::Axis::Z) {
|
||||||
|
// add_relative_impulse(Camera::DIRECTION::DOWN, joystick_event->position);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<LightController::Light>* LightController::get_lights() {
|
||||||
|
return &packed_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LightController::look_at_center() {
|
||||||
|
|
||||||
|
//direction_cartesian = CartToNormalizedSphere(sf::Vector3f(75, 75, 75) - position);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -82,10 +82,11 @@ void Software_Caster::create_viewport(int width, int height, float v_fov, float
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Software_Caster::assign_lights(std::vector<Light> *lights) {
|
void Software_Caster::assign_lights(std::vector<LightController::PackedData> *data) {
|
||||||
this->lights = lights;
|
|
||||||
|
|
||||||
int light_count = static_cast<int>(lights->size());
|
this->lights = data;
|
||||||
|
|
||||||
|
int light_count = static_cast<int>(data->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Software_Caster::assign_map(Old_Map * map) {
|
void Software_Caster::assign_map(Old_Map * map) {
|
||||||
|
|||||||
10
src/main.cpp
10
src/main.cpp
@@ -37,7 +37,7 @@
|
|||||||
#include "Input.h"
|
#include "Input.h"
|
||||||
#include "Pub_Sub.h"
|
#include "Pub_Sub.h"
|
||||||
#include "NetworkInput.h"
|
#include "NetworkInput.h"
|
||||||
#include "light.h"
|
#include "LightController.h"
|
||||||
|
|
||||||
const int WINDOW_X = 1000;
|
const int WINDOW_X = 1000;
|
||||||
const int WINDOW_Y = 1000;
|
const int WINDOW_Y = 1000;
|
||||||
@@ -124,16 +124,14 @@ int main() {
|
|||||||
float h = 90.0;
|
float h = 90.0;
|
||||||
|
|
||||||
// Light for the currently non functional Bling Phong shader
|
// Light for the currently non functional Bling Phong shader
|
||||||
Light l(
|
LightController l(
|
||||||
sf::Vector3f(256.0f, 256.0f, 256.0f),
|
sf::Vector3f(256.0f, 256.0f, 256.0f),
|
||||||
sf::Vector3f(-1.0f, -1.0f, -1.5f),
|
sf::Vector3f(-1.0f, -1.0f, -1.5f),
|
||||||
&window
|
sf::Vector4f(1.0f, 1.0f, 1.0f, 1.0f)
|
||||||
);
|
);
|
||||||
|
|
||||||
std::vector<Light> light_vec;
|
|
||||||
light_vec.push_back(l);
|
|
||||||
// *links* the lights to the GPU
|
// *links* the lights to the GPU
|
||||||
raycaster->assign_lights(&light_vec);
|
raycaster->assign_lights();
|
||||||
|
|
||||||
|
|
||||||
// Load in the spritesheet texture
|
// Load in the spritesheet texture
|
||||||
|
|||||||
Reference in New Issue
Block a user