Nimbin[12]?Games / Entropie / entropie/src/world/meadow.h

Entropie git · main

Entropie festival game; first steps

sdl c game entropie cmake · first commit 2026-10-10 · last commit 2026-11-02 (18 hours ago) · synced 10 hours ago

C 88.5% Markdown 9.1% GLSL 2.3%
git clone https://git.christianimmanuel.de/games/Entropie.gitwget https://git.christianimmanuel.de/games/Entropie/archive/Entropie.tar.gz
entropie/src/world/meadow.h 985 B · 29 lines raw
#ifndef WORLD_MEADOW_H
#define WORLD_MEADOW_H

/*
 * Grass blades on the meadow, near the eye.
 *
 * The ground is cut into squares; the squares around the camera get tufts of
 * grass (built when first needed, dropped when far away). Each blade stands
 * on the ground, sways a little and lies down where people walk (the wear
 * map, see terrain.h). No grass on roads and buildings, little on the yard,
 * the field and under the pines.
 */

#include "world/world.h"

#define MEADOW_CHUNK 16.0f
#define MEADOW_SIDE  22     /* squares per side: covers TERRAIN_SIZE */

typedef struct {
    Mesh  chunks[MEADOW_SIDE * MEADOW_SIDE];
    bool  built[MEADOW_SIDE * MEADOW_SIDE];
    int   mow_rev, mow_wait; /* the field's mowing last built in, frames since it changed */
} Meadow;

/* Draws the grass around eye, building squares that come into view. */
void Meadow_draw(Meadow *m, const World *world, Renderer *r, Vec3 eye);
void Meadow_destroy(Meadow *m);

#endif /* WORLD_MEADOW_H */