Blob Blame Raw
#ifndef CHUNK_H
#define CHUNK_H


#include "common.h"
#include "tree.h"


#define CHUNK_WIDTH 10
#define CHUNK_HEIGHT 2
#define CHUNK_GROUND_SUBDIVISIONS 3
#define CHUNK_GROUND_POINTS ((1 << CHUNK_GROUND_SUBDIVISIONS) + 1)
#define CHUNK_MAX_TREES 1


typedef struct {
  int index;
  int seed;
  
  double x, y;
  double width;
  double dy;
  double ground[CHUNK_GROUND_POINTS];
    
  int treeCount;
  Tree trees[CHUNK_MAX_TREES];
} Chunk;


void chunkGenerate(Chunk *c, int rootSeed, const Chunk *base, int offset);
double chunkGroundLevel(const Chunk *c, double x);
void chunkDraw(const Chunk *c, double time, int flags);


#endif