forked from mrkite/minutor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbiomeidentifier.h
67 lines (57 loc) · 1.72 KB
/
biomeidentifier.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/** Copyright (c) 2013, Sean Kasun */
#ifndef BIOMEIDENTIFIER_H_
#define BIOMEIDENTIFIER_H_
#include <QHash>
#include <QList>
#include <QString>
#include <QColor>
class JSONArray;
class BiomeInfo {
// public methods
public:
BiomeInfo();
QColor getBiomeGrassColor ( QColor blockcolor, int elevation ) const;
QColor getBiomeFoliageColor( QColor blockcolor, int elevation ) const;
QColor getBiomeWaterColor( QColor watercolor ) const;
// public members
public:
int id;
QString name;
bool enabled;
QColor colors[16];
QColor watermodifier;
bool enabledwatermodifier;
double alpha;
double temperature;
double humidity;
// private methods and members
private:
typedef struct T_BiomeCorner {
int red;
int green;
int blue;
} T_BiomeCorner;
static T_BiomeCorner grassCorners[3];
static T_BiomeCorner foliageCorners[3];
static QColor getBiomeColor( float temperature, float humidity, int elevation, T_BiomeCorner *corners );
static QColor mixColor( QColor colorizer, QColor blockcolor );
};
class BiomeIdentifier {
public:
// singleton: access to global usable instance
static BiomeIdentifier &Instance();
int addDefinitions(JSONArray *, int pack = -1);
void enableDefinitions(int id);
void disableDefinitions(int id);
void updateBiomeDefinition();
const BiomeInfo &getBiome(int id) const;
private:
// singleton: prevent access to constructor and copyconstructor
BiomeIdentifier();
~BiomeIdentifier();
BiomeIdentifier(const BiomeIdentifier &);
BiomeIdentifier &operator=(const BiomeIdentifier &);
QHash<int, BiomeInfo*> biomes; // consolidated Biome mapping
QList<QList<BiomeInfo*> > packs; // raw data of all available packs
};
#endif // BIOMEIDENTIFIER_H_