techkaczynski.dev / code

summaryrefslogtreecommitdiff
path: root/env.h
blob: 7a9266aaee9939ff963e081976b77cf618ad3a55 (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
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef ENV_H
#define ENV_H

#include "common.h"
#include "res.h"

typedef struct {
	cstr sky_sdr_key, ocean_sdr_key;

	Vec3 sun_dir;
	Vec3 moon_dir;

	Color sun_col;
	Color moon_col;
	Color ambient_col;
	Color horizon_col;
	Color zenith_col;

	f32 sun_intensity;
	f32 moon_intensity;
	f32 ambient_intensity;

	f32 day_amount;
	f32 twilight_amount;

	f32 day_cur; /* starting phase, 0 inclusive to 1 exclusive */
	f32 day_len;    /* real seconds per complete lighting cycle */
	f32 cycle;      /* current lighting phase */

	/* sun/moon textures */
	cstr sun_tex_key, moon_tex_key;
	Color sun_tint, moon_tint;
	f32 sun_sz, moon_sz;

	f32 ocean_height, ocean_time;
} Environment;

extern Environment env;

void	env_init(void);
void	env_exit(void);
void	env_update(void);
void	env_draw_sky(Camera);
void	env_draw_ocean(Camera);

#endif