|
|
@ -72,19 +72,27 @@ sf::Texture window_texture;
|
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
int main() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Keep at this at the top of main. I think it has to do with it and
|
|
|
|
|
|
|
|
// sf::RenderWindow stepping on each others feet
|
|
|
|
|
|
|
|
glewInit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The socket listener for interacting with the TCP streaming android controller
|
|
|
|
NetworkInput ni;
|
|
|
|
NetworkInput ni;
|
|
|
|
ni.listen_for_clients(5000);
|
|
|
|
ni.listen_for_clients(5000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Map _map(sf::Vector3i(0, 0, 0));
|
|
|
|
// Currently just close it right away for debug
|
|
|
|
//_map.generate_octree();
|
|
|
|
ni.stop_listening_for_clients();
|
|
|
|
|
|
|
|
|
|
|
|
glewInit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");
|
|
|
|
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");
|
|
|
|
window.setMouseCursorVisible(false);
|
|
|
|
window.setMouseCursorVisible(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// =============================
|
|
|
|
|
|
|
|
Map _map(sf::Vector3i(0, 0, 0));
|
|
|
|
|
|
|
|
_map.generate_octree();
|
|
|
|
|
|
|
|
// =============================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*GL_Testing t;
|
|
|
|
/*GL_Testing t;
|
|
|
|
t.compile_shader("../shaders/passthrough.frag", GL_Testing::Shader_Type::FRAGMENT);
|
|
|
|
t.compile_shader("../shaders/passthrough.frag", GL_Testing::Shader_Type::FRAGMENT);
|
|
|
|
t.compile_shader("../shaders/passthrough.vert", GL_Testing::Shader_Type::VERTEX);
|
|
|
|
t.compile_shader("../shaders/passthrough.vert", GL_Testing::Shader_Type::VERTEX);
|
|
|
@ -92,8 +100,6 @@ int main() {
|
|
|
|
t.create_buffers();*/
|
|
|
|
t.create_buffers();*/
|
|
|
|
|
|
|
|
|
|
|
|
// Start up the raycaster
|
|
|
|
// Start up the raycaster
|
|
|
|
//Hardware_Caster *raycaster = new Hardware_Caster();
|
|
|
|
|
|
|
|
//Hardware_Caster *raycaster = new Hardware_Caster();
|
|
|
|
|
|
|
|
std::shared_ptr<Hardware_Caster> raycaster(new Hardware_Caster());
|
|
|
|
std::shared_ptr<Hardware_Caster> raycaster(new Hardware_Caster());
|
|
|
|
|
|
|
|
|
|
|
|
if (raycaster->init() != 1) {
|
|
|
|
if (raycaster->init() != 1) {
|
|
|
@ -165,22 +171,12 @@ int main() {
|
|
|
|
accumulator_time = 0.0,
|
|
|
|
accumulator_time = 0.0,
|
|
|
|
current_time = 0.0;
|
|
|
|
current_time = 0.0;
|
|
|
|
|
|
|
|
|
|
|
|
// Mouse capture
|
|
|
|
|
|
|
|
sf::Vector2i deltas;
|
|
|
|
|
|
|
|
sf::Vector2i fixed(window.getSize());
|
|
|
|
|
|
|
|
sf::Vector2i prev_pos;
|
|
|
|
|
|
|
|
bool mouse_enabled = true;
|
|
|
|
|
|
|
|
bool reset = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double timer_accumulator = 0.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Input input_handler;
|
|
|
|
Input input_handler;
|
|
|
|
|
|
|
|
|
|
|
|
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::KeyHeld);
|
|
|
|
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::KeyHeld);
|
|
|
|
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::KeyPressed);
|
|
|
|
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::KeyPressed);
|
|
|
|
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::MouseMoved);
|
|
|
|
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::MouseMoved);
|
|
|
|
//camera->subscribe_to_publisher(&ni, vr::Event::EventType::JoystickMoved);
|
|
|
|
|
|
|
|
handle->subscribe_to_publisher(&ni, vr::Event::EventType::JoystickMoved);
|
|
|
|
handle->subscribe_to_publisher(&ni, vr::Event::EventType::JoystickMoved);
|
|
|
|
|
|
|
|
|
|
|
|
WindowHandler win_hand(&window);
|
|
|
|
WindowHandler win_hand(&window);
|
|
|
@ -195,35 +191,9 @@ int main() {
|
|
|
|
input_handler.dispatch_events();
|
|
|
|
input_handler.dispatch_events();
|
|
|
|
ni.dispatch_events();
|
|
|
|
ni.dispatch_events();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sf::Keyboard::isKeyPressed(sf::Keyboard::F11)) {
|
|
|
|
if (sf::Keyboard::isKeyPressed(sf::Keyboard::F11)) {
|
|
|
|
while (raycaster->debug_quick_recompile() != 0);
|
|
|
|
while (raycaster->debug_quick_recompile() != 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
|
|
|
|
|
|
|
|
// light_vec.at(0).position.x -= delta_time * 100;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
|
|
|
|
|
|
|
|
// light_vec.at(0).position.x += delta_time * 100;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) {
|
|
|
|
|
|
|
|
// light_vec.at(0).position.y += delta_time * 100;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) {
|
|
|
|
|
|
|
|
// light_vec.at(0).position.y -= delta_time * 100;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::Home)) {
|
|
|
|
|
|
|
|
// light_vec.at(0).position.z += delta_time * 100;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::End)) {
|
|
|
|
|
|
|
|
// light_vec.at(0).position.z -= delta_time * 100;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt)) {
|
|
|
|
|
|
|
|
// light_vec.at(0).position = camera->get_position();
|
|
|
|
|
|
|
|
// light_vec.at(0).direction_cartesian = SphereToCart(camera->get_direction());
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::O)) {
|
|
|
|
|
|
|
|
// light_vec.at(0).orbit_around_center(timer_accumulator += delta_time);
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Num0)) {
|
|
|
|
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Num0)) {
|
|
|
|
std::string path = "../assets/";
|
|
|
|
std::string path = "../assets/";
|
|
|
|