clean up blurring code. remove dead code
[carveJwlIkooP6JGAAIwe30JlM.git] / world_render.h
1 /*
2 * Copyright (C) 2021-2024 Mt.ZERO Software, Harry Godden - All Rights Reserved
3 */
4
5 #pragma once
6
7 #define WORLD_CUBEMAP_RES 32
8
9 #include "vg/vg_camera.h"
10 #include "world.h"
11 #include "shaders/scene_standard.h"
12 #include "shaders/scene_standard_alphatest.h"
13 #include "shaders/scene_foliage.h"
14 #include "shaders/scene_override.h"
15 #include "shaders/scene_cubemapped.h"
16 #include "shaders/scene_vertex_blend.h"
17 #include "shaders/scene_terrain.h"
18 #include "shaders/scene_fxglow.h"
19 #include "shaders/scene_depth.h"
20 #include "shaders/scene_position.h"
21 #include "shaders/scene_font.h"
22 #include "shaders/model_sky.h"
23 #include "shaders/model_sky_space.h"
24
25 static const float k_world_light_cube_size = 8.0f;
26
27 struct world_render
28 {
29 GLuint tex_terrain_noise;
30
31 /* rendering */
32 glmesh skydome;
33
34 double sky_time, sky_rate, sky_target_rate;
35
36 v3f render_gate_pos;
37 struct timer_text{
38 char text[8];
39 m4x3f transform;
40 ent_gate *gate;
41 ent_route *route;
42 }
43 timer_texts[4];
44 u32 timer_text_count;
45
46 struct text_particle{
47 rigidbody rb;
48 m4x3f mlocal;
49 ent_glyph *glyph;
50 v4f colour;
51 m4x3f mdl;
52 f32 radius;
53 }
54 text_particles[6*4];
55 u32 text_particle_count;
56 }
57 extern world_render;
58
59 void world_render_init(void);
60
61 void world_prerender( world_instance *world );
62 void world_link_lighting_ub( world_instance *world, GLuint shader );
63 void world_bind_position_texture( world_instance *world,
64 GLuint shader, GLuint location,
65 int slot );
66 void world_bind_light_array( world_instance *world,
67 GLuint shader, GLuint location,
68 int slot );
69 void world_bind_light_index( world_instance *world,
70 GLuint shader, GLuint location,
71 int slot );
72 void render_world_position( world_instance *world, vg_camera *cam );
73 void render_world_depth( world_instance *world, vg_camera *cam );
74 void render_world( world_instance *world, vg_camera *cam,
75 int stenciled, int viewing_from_gate,
76 int with_water, int with_cubemaps );
77 void render_world_cubemaps( world_instance *world );
78 void bind_terrain_noise(void);
79 void render_world_override( world_instance *world,
80 world_instance *lighting_source,
81 m4x3f mmdl,
82 vg_camera *cam,
83 ent_spawn *dest_spawn, v4f map_info );
84 void render_world_gates( world_instance *world, vg_camera *cam );
85 void imgui_world_light_edit( ui_context *ctx, world_instance *world );
86
87 #define WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( WORLD, SHADER ) \
88 world_link_lighting_ub( WORLD, _shader_##SHADER.id ); \
89 world_bind_position_texture( WORLD, _shader_##SHADER.id, \
90 _uniform_##SHADER##_g_world_depth, 2 ); \
91 world_bind_light_array( WORLD, _shader_##SHADER.id, \
92 _uniform_##SHADER##_uLightsArray, 3 ); \
93 world_bind_light_index( WORLD, _shader_##SHADER.id, \
94 _uniform_##SHADER##_uLightsIndex, 4 );
95