From 51093beacab48f183e68b937446537ca58771595 Mon Sep 17 00:00:00 2001 From: MitchellHansen Date: Sat, 29 Oct 2016 23:55:58 -0700 Subject: [PATCH] Starting to condense the rendering and switching between the different methods --- include/Old_map.h | 1 + src/Old_map.cpp | 1 + src/main.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/Old_map.h b/include/Old_map.h index bbb9069..4740b2c 100644 --- a/include/Old_map.h +++ b/include/Old_map.h @@ -18,6 +18,7 @@ public: Old_Map(sf::Vector3i dim); ~Old_Map(); + void generate_from_data(char* dat, int len); void generate_terrain(); sf::Vector3i getDimensions(); diff --git a/src/Old_map.cpp b/src/Old_map.cpp index 11898ea..42e88c8 100644 --- a/src/Old_map.cpp +++ b/src/Old_map.cpp @@ -13,6 +13,7 @@ Old_Map::Old_Map(sf::Vector3i dim) { Old_Map::~Old_Map() { } + void Old_Map::generate_terrain() { std::mt19937 gen; std::uniform_real_distribution dis(-1.0, 1.0); diff --git a/src/main.cpp b/src/main.cpp index d1050ef..1cf11e0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -#ifdef linux +#ifdef linux #include #include @@ -78,7 +78,7 @@ int main() { sf::Vector3i map_dim(MAP_X, MAP_Y, MAP_Z); Old_Map* map = new Old_Map(map_dim); map->generate_terrain(); - + c.create_buffer("map_buffer", sizeof(char) * map_dim.x * map_dim.y * map_dim.z, map->get_voxel_data()); c.create_buffer("dim_buffer", sizeof(int) * 3, &map_dim); @@ -129,7 +129,7 @@ int main() { c.create_buffer("view_matrix_buffer", sizeof(float) * 4 * view_res.x * view_res.y, view_matrix); Camera camera( - sf::Vector3f(70, 60, 50), + sf::Vector3f(0, 0, 0), sf::Vector2f(0.0f, 1.00f) ); @@ -211,8 +211,8 @@ int main() { //RayCaster ray_caster(map, map_dim, view_res); sf::Vector2f *dp = camera.get_direction_pointer(); - debug_text cam_text_x(1, 30, &dp->x, "X: "); - debug_text cam_text_y(2, 30, &dp->y, "Y: "); + debug_text cam_text_x(1, 30, &dp->x, "incli: "); + debug_text cam_text_y(2, 30, &dp->y, "asmth: "); sf::Vector3f *mp = camera.get_movement_pointer(); debug_text cam_text_mov_x(4, 30, &mp->x, "X: ");