summaryrefslogtreecommitdiff
path: root/terrain_loader.h
blob: a30ddec3d89c576e306176eeb43993ee4e91c54a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef TERRAIN_LOADER_H
#define TERRAIN_LOADER_H

#include "vector.h"

#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>

#include <list>

namespace fs = boost::filesystem;

class TerrainLoader {
	private:
		fs::path root;

	public:
		typedef boost::shared_ptr<TerrainLoader> p;

		TerrainLoader(fs::path root);
		virtual ~TerrainLoader();

		virtual float *get_chunk(int64_t x, int64_t y, unsigned int width, unsigned int height);
		bool has_chunk(int64_t x, int64_t y);
		void save_chunk(float *chunk, int64_t x, int64_t y, unsigned int width, unsigned int height);
		float *load_chunk(int64_t x, int64_t y, unsigned int width, unsigned int height);

		// FIXME: Support other object types.
		virtual std::list<Vector3> get_objects(int64_t x, int64_t y);
		bool has_objects(int64_t x, int64_t y);
		void save_objects(std::list<Vector3>& objects, int64_t x, int64_t y);
		std::list<Vector3> load_objects(int64_t x, int64_t y);
};

#endif