尽力了,写的我有点恶心
This commit is contained in:
+64
@@ -0,0 +1,64 @@
|
||||
#include "terrain.h"
|
||||
#include "compound.h"
|
||||
|
||||
#ifndef TERRAIN_CHUNK_H
|
||||
#define TERRAIN_CHUNK_H
|
||||
|
||||
#define TILE_SIZE 1.0
|
||||
#define CHUNK_SIZE 16.0
|
||||
#define CHUNK_HALF 8.0
|
||||
#define CHUNK_TILE_COUNT 16
|
||||
|
||||
enum Surface_Type {
|
||||
SURFACE_BARE_ROCK = 0,
|
||||
SURFACE_SOIL,
|
||||
SURFACE_SAND,
|
||||
SURFACE_GRASS,
|
||||
SURFACE_FOREST,
|
||||
SURFACE_WATER,
|
||||
SURFACE_SNOW,
|
||||
SURFACE_ICE,
|
||||
SURFACE_COUNT
|
||||
};
|
||||
|
||||
enum Soil_Type {
|
||||
SOIL_NONE = 0,
|
||||
SOIL_SAND,
|
||||
SOIL_SILT,
|
||||
SOIL_CLAY,
|
||||
SOIL_LOAM,
|
||||
SOIL_PEAT,
|
||||
SOIL_COUNT
|
||||
};
|
||||
|
||||
struct Tile {
|
||||
double elevation;
|
||||
double slope;
|
||||
double aspect;
|
||||
double temperature;
|
||||
double moisture;
|
||||
double fertility;
|
||||
double vegetation;
|
||||
uint8_t surface_type;
|
||||
uint8_t soil_type;
|
||||
uint8_t rock_type;
|
||||
uint8_t _pad;
|
||||
// 归一化化合物组分,sum ≈ 1.0,索引见 Compound_Id
|
||||
float compound[COMPOUND_COUNT];
|
||||
};
|
||||
|
||||
struct Chunk {
|
||||
int cx, cy;
|
||||
struct Tile tiles[CHUNK_TILE_COUNT][CHUNK_TILE_COUNT];
|
||||
};
|
||||
|
||||
struct Chunk *chunk_generate(int cx, int cy, uint64_t seed,
|
||||
struct World_Block *blocks,
|
||||
struct Plate_list plates);
|
||||
|
||||
void chunk_free(struct Chunk *c);
|
||||
|
||||
struct Vector2_double chunk_origin(int cx, int cy);
|
||||
struct Vector2_double tile_world_pos(int cx, int cy, int tx, int ty);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user