'Demo Mode' release

This commit is contained in:
MitchellHansen
2017-10-07 23:22:47 -07:00
parent 87b7f60fa0
commit f733ca4aec
8 changed files with 55 additions and 30 deletions

View File

@@ -59,9 +59,9 @@ bool Application::init_clcaster() {
// Create a light prototype, send it to the controller, and get the handle back
LightPrototype prototype(
sf::Vector3f(100.0f, 100.0f, 75.0f),
sf::Vector3f(100.0f, 156.0f, 58.0f),
sf::Vector3f(-1.0f, -1.0f, -1.5f),
sf::Vector4f(0.4f, 0.4f, 0.4f, 1.0f)
sf::Vector4f(0.1f, 0.1f, 0.1f, 0.8f)
);
light_handle = light_controller->create_light(prototype);
@@ -93,6 +93,7 @@ bool Application::init_events() {
window_handler->subscribe_to_publisher(&input_handler, vr::Event::EventType::Closed);
window_handler->subscribe_to_publisher(&input_handler, vr::Event::EventType::KeyPressed);
raycaster->subscribe_to_publisher(&input_handler, vr::Event::EventType::KeyPressed);
//camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::JoystickMoved);
return true;
@@ -116,6 +117,14 @@ bool Application::game_loop() {
accumulator_time += delta_time;
while ((accumulator_time - step_size) >= step_size) {
accumulator_time -= step_size;
sf::Vector3f light_pos = light_handle->get_position();
light_pos.x = sin(elapsed_time / 2) * 100 + 100;
light_handle->set_position(light_pos);
sf::Vector3f cam_pos = camera->get_position();
cam_pos.x = sin(elapsed_time / 2 + 3.141f) * 50 + 125;
camera->set_position(cam_pos);
// ==== DELTA TIME LOCKED ====
}

View File

@@ -354,6 +354,19 @@ void CLCaster::update_gui() {
rendering = true;
}
void CLCaster::recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Event> event) {
if (event->type == vr::Event::KeyPressed) {
vr::KeyPressed *key_event = static_cast<vr::KeyPressed*>(event.get());
if (key_event->code == sf::Keyboard::T) {
debug_quick_recompile();
}
}
}
bool CLCaster::aquire_hardware() {
Logger::log("Acquiring OpenCL Hardware", Logger::LogLevel::INFO);

View File

@@ -117,9 +117,6 @@ void Camera::recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Even
else if (held_event->code == sf::Keyboard::D) {
add_relative_impulse(Camera::DIRECTION::RIGHT, default_impulse);
}
else if (held_event->code == sf::Keyboard::T) {
set_position(sf::Vector3f(50, 50, 50));
}
}
else if (event->type == vr::Event::KeyPressed) {
@@ -232,7 +229,7 @@ void Camera::update_gui() {
void Camera::look_at_center() {
direction = CartToNormalizedSphere(sf::Vector3f(60, 60, 35) - position);
direction = CartToNormalizedSphere(sf::Vector3f(143, 158, 33) - position);
}
sf::Vector2f* Camera::get_direction_pointer() {

View File

@@ -53,6 +53,11 @@ void LightHandle::set_position(sf::Vector3f position)
data_reference->position = position;
}
sf::Vector3f LightHandle::get_position() {
return data_reference->position;
}
void LightHandle::set_direction(sf::Vector3f direction)
{

View File

@@ -75,8 +75,6 @@ std::vector<std::vector<int>> generate_maze(sf::Vector2i dimensions, sf::Vector2
}
void Old_Map::generate_terrain() {
std::mt19937 gen;
std::uniform_real_distribution<double> dis(-1.0, 1.0);
@@ -101,7 +99,7 @@ void Old_Map::generate_terrain() {
int DATA_SIZE = dimensions.x + 1;
//an initial seed value for the corners of the data
//srand(f_rand());
double SEED = rand() % 10 + 30;
double SEED = rand() % 10 + 55;
//seed the data
set_sample(0, 0, SEED);
@@ -215,15 +213,25 @@ void Old_Map::generate_terrain() {
for (int x = dimensions.x / 2; x < dimensions.x / 2 + dimensions.x / 64; x++) {
for (int y = dimensions.x / 2; y < dimensions.y / 2 + dimensions.x / 64; y++) {
for (int z = 0; z < 5; z++) {
for (int z = 2; z < 7; z++) {
voxel_data[x + dimensions.x * (y + dimensions.z * z)] = 6;
}
}
}
for (int x = 60; x < 65; x++) {
for (int y = 60; y < 65; y++) {
for (int x = dimensions.x / 2 - 3; x < dimensions.x / 2 + dimensions.x / 64 + 3; x++) {
for (int y = dimensions.x / 2 - 3; y < dimensions.y / 2 + dimensions.x / 64 + 3; y++) {
for (int z = 0; z < 1; z++) {
voxel_data[x + dimensions.x * (y + dimensions.z * z)] = 5;
}
}
}
for (int x = 140; x < 145; x++) {
for (int y = 155; y < 160; y++) {
for (int z = 30; z < 35; z++) {
voxel_data[x + dimensions.x * (y + dimensions.z * z)] = 6;
}