summaryrefslogtreecommitdiff
path: root/terrain.h
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-05-14 23:22:05 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-05-14 23:22:05 +0200
commite7e6a79f8bf2855b5d1d432613151e48d2d685da (patch)
tree147fbe4a4af633427958d1bf1dcbaaaf0c0a1e00 /terrain.h
parent07ec7829e75a71fa7b70b513f0a2c7daeaea11d5 (diff)
Implemented terrain chunk caching.
Diffstat (limited to 'terrain.h')
-rw-r--r--terrain.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/terrain.h b/terrain.h
index 84abe26..6fa39b3 100644
--- a/terrain.h
+++ b/terrain.h
@@ -2,14 +2,11 @@
#define TERRAIN_H
#include "vector.h"
+#include "terrain_cache.h"
#include <list>
-#include <set>
class Terrain {
- private:
- std::set<std::pair<int, int> > chunk_indices;
-
public:
struct Chunk;
@@ -36,6 +33,7 @@ class Terrain {
float x, y, width, height;
int h_width, h_height;
float *heights;
+ TerrainCacheObject::p cache_obj;
Vector3 *normals;
size_t buf_size;
unsigned int vbo_object;
@@ -55,15 +53,10 @@ class Terrain {
static const int chunk_size = 32;
std::list<Chunk*> chunks;
+ TerrainCache *tc;
Terrain();
virtual ~Terrain();
- float *generate_heights(int x, int y, int width, int height);
- float *get_chunk(int x, int y, int width, int height);
- bool has_chunk(int x, int y);
- void save_chunk(float *chunk, int x, int y, int width, int height);
- float *load_chunk(int x, int y, int width, int height);
-
void raise(float x, float z, float radius, float focus, float strength, bool up = true);
void update(float x, float z);