refactor (reduction)
[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 #define WORLD_CUBEMAP_RES 32
9
10 #include "camera.h"
11 #include "world.h"
12
13 #include "shaders/scene_standard.h"
14 #include "shaders/scene_standard_alphatest.h"
15 #include "shaders/scene_override.h"
16 #include "shaders/scene_cubemapped.h"
17 #include "shaders/scene_vertex_blend.h"
18 #include "shaders/scene_terrain.h"
19 #include "shaders/scene_fxglow.h"
20 #include "shaders/scene_depth.h"
21 #include "shaders/scene_position.h"
22 #include "shaders/scene_font.h"
23 #include "shaders/model_sky.h"
24
25 static const float k_world_light_cube_size = 8.0f;
26
27 struct world_render{
28 GLuint tex_terrain_noise;
29
30 /* rendering */
31 glmesh skydome;
32
33 double sky_time, sky_rate, sky_target_rate;
34
35 /* water rendering */
36 struct{
37 struct framebuffer fbreflect, fbdepth;
38 }
39 water;
40
41 v3f render_gate_pos;
42 struct timer_text{
43 char text[8];
44 m4x3f transform;
45 ent_gate *gate;
46 ent_route *route;
47 }
48 timer_texts[4];
49 u32 timer_text_count;
50
51 struct text_particle{
52 rb_object obj;
53 m4x3f mlocal;
54 ent_glyph *glyph;
55 v4f colour;
56
57 m4x3f mdl;
58 }
59 text_particles[6*4];
60 u32 text_particle_count;
61 }
62 static world_render;
63 static void world_render_init(void);
64
65 static void world_link_lighting_ub( world_instance *world, GLuint shader );
66 static void world_bind_position_texture( world_instance *world,
67 GLuint shader, GLuint location,
68 int slot );
69 static void world_bind_light_array( world_instance *world,
70 GLuint shader, GLuint location,
71 int slot );
72 static void world_bind_light_index( world_instance *world,
73 GLuint shader, GLuint location,
74 int slot );
75 static void render_world_position( world_instance *world, camera *cam );
76 static void render_world_depth( world_instance *world, camera *cam );
77 static void render_world( world_instance *world, camera *cam,
78 int layer_depth );
79 static void render_world_cubemaps( world_instance *world );
80
81 #endif /* WORLD_RENDER_H */