added light controls

This commit is contained in:
MitchellHansen
2017-01-19 21:24:21 -08:00
parent 26bc8bff70
commit 86f342432a
4 changed files with 32 additions and 24 deletions

View File

@@ -38,7 +38,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() % 5 + 10;
double SEED = rand() % 10 + 40;
//seed the data
set_sample(0, 0, SEED);
@@ -46,7 +46,7 @@ void Old_Map::generate_terrain() {
set_sample(dimensions.x, 0, SEED);
set_sample(dimensions.x, dimensions.y, SEED);
double h = 5.0;//the range (-h -> +h) for the average offset
double h = 40.0;//the range (-h -> +h) for the average offset
//for the new value in range of h
//side length is distance of a single square side
//or distance of diagonal in diamond

View File

@@ -40,9 +40,9 @@ const int WINDOW_X = 1000;
const int WINDOW_Y = 1000;
const int WORK_SIZE = WINDOW_X * WINDOW_Y;
const int MAP_X = 128;
const int MAP_Y = 128;
const int MAP_Z = 128;
const int MAP_X = 256;
const int MAP_Y = 256;
const int MAP_Z = 256;
float elap_time(){
static std::chrono::time_point<std::chrono::system_clock> start;
@@ -186,12 +186,33 @@ int main() {
//if (sf::Keyboard::isKeyPressed(sf::Keyboard::Dash)) {
// raycaster->test_edit_viewport(WINDOW_X, WINDOW_Y, w -= 5, h -= 5);
//}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
light_vec.at(0).position.x -= delta_time * 10;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
light_vec.at(0).position.x += delta_time * 10;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) {
light_vec.at(0).position.y += delta_time * 10;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) {
light_vec.at(0).position.y -= delta_time * 10;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Home)) {
light_vec.at(0).position.z += delta_time * 10;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::End)) {
light_vec.at(0).position.z -= delta_time * 10;
}
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);
light_vec.at(0).orbit_around_center(fmod(timer_accumulator += delta_time, 3));
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::M)) {