the luxuries of a modern C compiler
[carveJwlIkooP6JGAAIwe30JlM.git] / world_render.h
1 /*
2 * Copyright (C) 2021-2023 Mt.ZERO Software, Harry Godden - All Rights Reserved
3 */
4
5 #ifndef WORLD_RENDER_H
6 #define WORLD_RENDER_H
7
8 #include "camera.h"
9 #include "world.h"
10
11 #include "shaders/scene_standard.h"
12 #include "shaders/scene_standard_alphatest.h"
13 #include "shaders/scene_vertex_blend.h"
14 #include "shaders/scene_terrain.h"
15 #include "shaders/scene_depth.h"
16 #include "shaders/scene_position.h"
17 #include "shaders/model_sky.h"
18
19 static const float k_world_light_cube_size = 8.0f;
20
21 struct world_render{
22 GLuint tex_terrain_noise;
23
24 /* rendering */
25 glmesh skydome;
26
27 double sky_time, sky_rate, sky_target_rate;
28
29 /* water rendering */
30 struct{
31 struct framebuffer fbreflect, fbdepth;
32 }
33 water;
34
35 v3f render_gate_pos;
36 struct timer_text{
37 char text[8];
38 m4x3f transform;
39 ent_gate *gate;
40 ent_route *route;
41 }
42 timer_texts[4];
43 u32 timer_text_count;
44
45 struct text_particle{
46 rb_object obj;
47 m4x3f mlocal;
48 ent_glyph *glyph;
49 v4f colour;
50
51 m4x3f mdl;
52 }
53 text_particles[6*4];
54 u32 text_particle_count;
55 }
56 static world_render;
57 VG_STATIC void world_render_init(void);
58
59 VG_STATIC void world_link_lighting_ub( world_instance *world, GLuint shader );
60 VG_STATIC void world_bind_position_texture( world_instance *world,
61 GLuint shader, GLuint location,
62 int slot );
63 VG_STATIC void world_bind_light_array( world_instance *world,
64 GLuint shader, GLuint location,
65 int slot );
66 VG_STATIC void world_bind_light_index( world_instance *world,
67 GLuint shader, GLuint location,
68 int slot );
69 VG_STATIC void render_world_position( world_instance *world, camera *cam );
70 VG_STATIC void render_world_depth( world_instance *world, camera *cam );
71 VG_STATIC void render_world( world_instance *world, camera *cam,
72 int layer_depth );
73
74 #endif /* WORLD_RENDER_H */