77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
#ifndef STREAM_H_
|
|
#define STREAM_H_
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
#include <tuple>
|
|
#include <algorithm>
|
|
#include <scene/3d/spatial.h>
|
|
#include <core/io/config_file.h>
|
|
class VoxelViewer;
|
|
class VoxelLodTerrain;
|
|
class BuildingsData;
|
|
class StreamWorld : public Spatial {
|
|
GDCLASS(StreamWorld, Spatial)
|
|
private:
|
|
VoxelViewer *viewer;
|
|
VoxelLodTerrain *terrain;
|
|
Node *current_scene;
|
|
ConfigFile config;
|
|
#if 0
|
|
using tile_key_t = std::tuple<int, int>;
|
|
struct tile_hash : public std::unary_function<key_t, std::size_t> {
|
|
std::size_t operator()(const tile_key_t &k) const
|
|
{
|
|
return std::get<0>(k) ^ std::get<1>(k);
|
|
}
|
|
};
|
|
using tile_map_t = std::unordered_map<const tile_key_t,
|
|
std::vector<String>, tile_hash>;
|
|
Vector3 eye;
|
|
tile_map_t tiles;
|
|
tile_map_t loaded_tiles;
|
|
#endif
|
|
|
|
int world_extent;
|
|
int tile_size;
|
|
int view_distance;
|
|
bool initialized;
|
|
int current_x, current_z;
|
|
int frame_count;
|
|
bool road_setup_needed;
|
|
bool road_setup_complete;
|
|
int count_shit;
|
|
void _notification(int which);
|
|
// void create_tilemap();
|
|
void update_view();
|
|
void viewer_dead();
|
|
void terrain_dead();
|
|
// void load_tile(int tx, int ty);
|
|
// void erase_tile(int tx, int ty);
|
|
void load_building(const String &key);
|
|
void unload_building(const String &key);
|
|
void update_items();
|
|
void remove_building(const String &key);
|
|
void remove_generated_stuff();
|
|
void place_zebras();
|
|
void undo();
|
|
void road_setup();
|
|
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
struct components {
|
|
struct Initialized {};
|
|
struct WorldData {
|
|
VoxelViewer *viewer;
|
|
VoxelLodTerrain *terrain;
|
|
};
|
|
struct RoadSetupNeeded {};
|
|
struct RoadSetupDone {};
|
|
};
|
|
VoxelLodTerrain *get_terrain();
|
|
void run_command(const String &command, const Vector<Variant> &args);
|
|
StreamWorld();
|
|
~StreamWorld();
|
|
static void cleanup();
|
|
};
|
|
#endif |