2 * Copyright (C) 2021-2023 Mt.ZERO Software, Harry Godden - All Rights Reserved
9 #include "world_render.h"
11 static int ccmd_set_time( int argc
, const char *argv
[] ){
13 world_instance
*world
= world_current_instance();
14 world
->time
= atof( argv
[0] );
17 vg_error( "Usage set_time <0-1.0>\n" );
22 VG_STATIC
void async_world_render_init( void *payload
, u32 size
)
24 vg_info( "Allocate uniform buffers\n" );
25 for( int i
=0; i
<4; i
++ ){
26 world_instance
*world
= &world_static
.worlds
[i
];
27 world
->ubo_bind_point
= i
;
29 glGenBuffers( 1, &world
->ubo_lighting
);
30 glBindBuffer( GL_UNIFORM_BUFFER
, world
->ubo_lighting
);
31 glBufferData( GL_UNIFORM_BUFFER
, sizeof(struct ub_world_lighting
),
32 NULL
, GL_DYNAMIC_DRAW
);
34 glBindBufferBase( GL_UNIFORM_BUFFER
, i
, world
->ubo_lighting
);
38 vg_info( "Allocate frame buffers\n" );
39 for( int i
=0; i
<4; i
++ ){
40 world_instance
*world
= &world_static
.worlds
[i
];
41 struct framebuffer
*fb
= &world
->heightmap
;
43 fb
->display_name
= NULL
;
47 fb
->resolution_div
= 0;
49 fb
->attachments
[0].display_name
= NULL
;
50 fb
->attachments
[0].purpose
= k_framebuffer_attachment_type_texture
;
51 fb
->attachments
[0].internalformat
= GL_RG16F
;
52 fb
->attachments
[0].format
= GL_RG
;
53 fb
->attachments
[0].type
= GL_FLOAT
;
54 fb
->attachments
[0].attachment
= GL_COLOR_ATTACHMENT0
;
56 fb
->attachments
[1].purpose
= k_framebuffer_attachment_type_none
;
57 fb
->attachments
[2].purpose
= k_framebuffer_attachment_type_none
;
58 fb
->attachments
[3].purpose
= k_framebuffer_attachment_type_none
;
59 fb
->attachments
[4].purpose
= k_framebuffer_attachment_type_none
;
61 render_fb_allocate( fb
);
65 VG_STATIC
void world_render_init(void)
67 VG_VAR_F32( k_day_length
);
68 VG_VAR_I32( k_debug_light_indices
);
69 VG_VAR_I32( k_debug_light_complexity
);
70 VG_VAR_I32( k_light_preview
);
71 vg_console_reg_cmd( "set_time", ccmd_set_time
, NULL
);
73 world_render
.sky_rate
= 1.0;
74 world_render
.sky_target_rate
= 1.0;
76 shader_scene_standard_register();
77 shader_scene_standard_alphatest_register();
78 shader_scene_fxglow_register();
79 shader_scene_vertex_blend_register();
80 shader_scene_terrain_register();
81 shader_scene_depth_register();
82 shader_scene_position_register();
83 shader_model_sky_register();
85 vg_info( "Loading world resources\n" );
86 vg_linear_clear( vg_mem
.scratch
);
89 mdl_open( &msky
, "models/rs_skydome.mdl", vg_mem
.scratch
);
90 mdl_load_metadata_block( &msky
, vg_mem
.scratch
);
91 mdl_async_load_glmesh( &msky
, &world_render
.skydome
);
94 vg_info( "Loading default world textures\n" );
95 vg_tex2d_load_qoi_async_file( "textures/garbage.qoi",
96 VG_TEX2D_NEAREST
|VG_TEX2D_REPEAT
,
97 &world_render
.tex_terrain_noise
);
99 vg_async_call( async_world_render_init
, NULL
, 0 );
102 VG_STATIC
void world_link_lighting_ub( world_instance
*world
, GLuint shader
)
104 GLuint idx
= glGetUniformBlockIndex( shader
, "ub_world_lighting" );
105 glUniformBlockBinding( shader
, idx
, world
->ubo_bind_point
);
108 VG_STATIC
void world_bind_position_texture( world_instance
*world
,
109 GLuint shader
, GLuint location
,
112 render_fb_bind_texture( &world
->heightmap
, 0, slot
);
113 glUniform1i( location
, slot
);
116 VG_STATIC
void world_bind_light_array( world_instance
*world
,
117 GLuint shader
, GLuint location
,
120 glActiveTexture( GL_TEXTURE0
+ slot
);
121 glBindTexture( GL_TEXTURE_BUFFER
, world
->tex_light_entities
);
122 glUniform1i( location
, slot
);
125 VG_STATIC
void world_bind_light_index( world_instance
*world
,
126 GLuint shader
, GLuint location
,
129 glActiveTexture( GL_TEXTURE0
+ slot
);
130 glBindTexture( GL_TEXTURE_3D
, world
->tex_light_cubes
);
131 glUniform1i( location
, slot
);
134 VG_STATIC
void render_world_depth( world_instance
*world
, camera
*cam
);
140 VG_STATIC
void bind_terrain_noise(void)
142 glActiveTexture( GL_TEXTURE0
);
143 glBindTexture( GL_TEXTURE_2D
, world_render
.tex_terrain_noise
);
148 enum mdl_shader shader
;
149 enum world_geo_type geo_type
;
151 void (*fn_bind_textures
)( world_instance
*world
,
152 struct world_surface
*mat
);
153 void (*fn_set_mdl
)( m4x3f mdl
);
154 void (*fn_set_uPvmPrev
)( m4x4f pvm
);
158 void world_render_traffic( world_instance
*world
, u32 material_id
,
159 struct world_pass
*pass
){
160 if( !mdl_arrcount( &world
->ent_traffic
) ) return;
162 /* HACK: use the first material for every traffic entity */
163 ent_traffic
*first
= mdl_arritm( &world
->ent_traffic
, 0 );
164 if( !first
->submesh_count
) return;
166 mdl_submesh
*sm
= mdl_arritm( &world
->meta
.submeshs
, first
->submesh_start
);
167 if( sm
->material_id
!= material_id
) return;
169 struct world_surface
*mat
= &world
->surfaces
[ material_id
];
170 pass
->fn_bind_textures( world
, mat
);
172 for( u32 j
=0; j
<mdl_arrcount( &world
->ent_traffic
); j
++ ){
173 ent_traffic
*traffic
= mdl_arritm( &world
->ent_traffic
, j
);
175 for( u32 k
=0; k
<traffic
->submesh_count
; k
++ ){
176 sm
= mdl_arritm( &world
->meta
.submeshs
,
177 traffic
->submesh_start
+k
);
180 q_m3x3( traffic
->transform
.q
, mmdl
);
181 v3_copy( traffic
->transform
.co
, mmdl
[3] );
184 m4x3_expand( mmdl
, m4mdl
);
185 m4x4_mul( pass
->cam
->mtx_prev
.pv
, m4mdl
, m4mdl
);
187 pass
->fn_set_mdl( mmdl
);
188 pass
->fn_set_uPvmPrev( m4mdl
);
190 mdl_draw_submesh( sm
);
196 void world_render_pass( world_instance
*world
, struct world_pass
*pass
){
197 for( int i
=0; i
<world
->surface_count
; i
++ ){
198 struct world_surface
*mat
= &world
->surfaces
[i
];
200 if( mat
->info
.shader
== pass
->shader
){
203 if( pass
->geo_type
== k_world_geo_type_solid
){
207 world_render_traffic( world
, i
, pass
);
208 sm
= &mat
->sm_no_collide
;
211 if( !sm
->indice_count
)
215 m4x3_identity( mmdl
);
216 pass
->fn_set_mdl( mmdl
);
217 pass
->fn_set_uPvmPrev( pass
->cam
->mtx_prev
.pv
);
219 pass
->fn_bind_textures( world
, mat
);
220 mdl_draw_submesh( sm
);
226 void world_render_both_stages( world_instance
*world
, struct world_pass
*pass
)
228 mesh_bind( &world
->mesh_geo
);
229 pass
->geo_type
= k_world_geo_type_solid
;
230 world_render_pass( world
, pass
);
232 glDisable( GL_CULL_FACE
);
233 mesh_bind( &world
->mesh_no_collide
);
234 pass
->geo_type
= k_world_geo_type_nonsolid
;
235 world_render_pass( world
, pass
);
236 glEnable( GL_CULL_FACE
);
239 VG_STATIC
void bindpoint_diffuse_texture1( world_instance
*world
,
240 struct world_surface
*mat
)
243 glActiveTexture( GL_TEXTURE1
);
244 glBindTexture( GL_TEXTURE_2D
, world
->textures
[ mat
->info
.tex_diffuse
] );
247 VG_STATIC
void render_world_vb( world_instance
*world
, camera
*cam
)
249 shader_scene_vertex_blend_use();
250 shader_scene_vertex_blend_uTexGarbage(0);
251 shader_scene_vertex_blend_uTexGradients(1);
252 world_link_lighting_ub( world
, _shader_scene_vertex_blend
.id
);
253 world_bind_position_texture( world
, _shader_scene_vertex_blend
.id
,
254 _uniform_scene_vertex_blend_g_world_depth
, 2 );
255 world_bind_light_array( world
, _shader_scene_vertex_blend
.id
,
256 _uniform_scene_vertex_blend_uLightsArray
, 3 );
257 world_bind_light_index( world
, _shader_scene_vertex_blend
.id
,
258 _uniform_scene_vertex_blend_uLightsIndex
, 4 );
260 glActiveTexture( GL_TEXTURE0
);
261 glBindTexture( GL_TEXTURE_2D
, world_render
.tex_terrain_noise
);
263 shader_scene_vertex_blend_uPv( cam
->mtx
.pv
);
264 shader_scene_vertex_blend_uCamera( cam
->transform
[3] );
266 struct world_pass pass
= {
267 .shader
= k_shader_standard_vertex_blend
,
269 .fn_bind_textures
= bindpoint_diffuse_texture1
,
270 .fn_set_mdl
= shader_scene_vertex_blend_uMdl
,
271 .fn_set_uPvmPrev
= shader_scene_vertex_blend_uPvmPrev
,
274 world_render_both_stages( world
, &pass
);
277 VG_STATIC
void render_world_standard( world_instance
*world
, camera
*cam
)
279 shader_scene_standard_use();
280 shader_scene_standard_uTexGarbage(0);
281 shader_scene_standard_uTexMain(1);
282 shader_scene_standard_uPv( cam
->mtx
.pv
);
284 world_link_lighting_ub( world
, _shader_scene_standard
.id
);
285 world_bind_position_texture( world
, _shader_scene_standard
.id
,
286 _uniform_scene_standard_g_world_depth
, 2 );
287 world_bind_light_array( world
, _shader_scene_standard
.id
,
288 _uniform_scene_standard_uLightsArray
, 3 );
289 world_bind_light_index( world
, _shader_scene_standard
.id
,
290 _uniform_scene_standard_uLightsIndex
, 4 );
292 bind_terrain_noise();
293 shader_scene_standard_uCamera( cam
->transform
[3] );
295 struct world_pass pass
= {
296 .shader
= k_shader_standard
,
298 .fn_bind_textures
= bindpoint_diffuse_texture1
,
299 .fn_set_mdl
= shader_scene_standard_uMdl
,
300 .fn_set_uPvmPrev
= shader_scene_standard_uPvmPrev
,
303 world_render_both_stages( world
, &pass
);
306 VG_STATIC
void render_world_alphatest( world_instance
*world
, camera
*cam
)
308 shader_scene_standard_alphatest_use();
309 shader_scene_standard_alphatest_uTexGarbage(0);
310 shader_scene_standard_alphatest_uTexMain(1);
311 shader_scene_standard_alphatest_uPv( cam
->mtx
.pv
);
313 world_link_lighting_ub( world
, _shader_scene_standard_alphatest
.id
);
314 world_bind_position_texture( world
, _shader_scene_standard_alphatest
.id
,
315 _uniform_scene_standard_alphatest_g_world_depth
, 2 );
316 world_bind_light_array( world
, _shader_scene_standard_alphatest
.id
,
317 _uniform_scene_standard_alphatest_uLightsArray
, 3 );
318 world_bind_light_index( world
, _shader_scene_standard_alphatest
.id
,
319 _uniform_scene_standard_alphatest_uLightsIndex
, 4 );
322 bind_terrain_noise();
325 shader_scene_standard_alphatest_uCamera( cam
->transform
[3] );
327 glDisable(GL_CULL_FACE
);
329 struct world_pass pass
= {
330 .shader
= k_shader_standard_cutout
,
332 .fn_bind_textures
= bindpoint_diffuse_texture1
,
333 .fn_set_mdl
= shader_scene_standard_alphatest_uMdl
,
334 .fn_set_uPvmPrev
= shader_scene_standard_alphatest_uPvmPrev
,
337 world_render_both_stages( world
, &pass
);
339 glEnable(GL_CULL_FACE
);
343 void world_render_challenges( world_instance
*world
, struct world_pass
*pass
,
347 glDisable( GL_CULL_FACE
);
348 mesh_bind( &world
->mesh_no_collide
);
350 u32 last_material
= 0;
352 const f32 radius
= 40.0f
;
355 bh_iter_init_range( 0, &it
, pos
, radius
);
358 while( bh_next( world
->entity_bh
, &it
, &idx
) ){
359 u32 id
= world
->entity_list
[ idx
],
360 type
= mdl_entity_id_type( id
),
361 index
= mdl_entity_id_id( id
);
363 if( type
!= k_ent_challenge
) continue;
365 ent_challenge
*challenge
= mdl_arritm(&world
->ent_challenge
,index
);
367 f32 dist
= v3_dist( challenge
->transform
.co
, pos
) * (1.0f
/radius
),
368 scale
= vg_smoothstepf( vg_clampf( 10.0f
-dist
*10.0f
, 0.0f
,1.0f
) );
370 v3_fill( challenge
->transform
.s
, scale
);
373 mdl_transform_m4x3( &challenge
->transform
, mmdl
);
374 shader_scene_fxglow_uMdl( mmdl
);
376 for( u32 j
=0; j
<challenge
->submesh_count
; j
++ ){
377 mdl_submesh
*sm
= mdl_arritm( &world
->meta
.submeshs
,
378 challenge
->submesh_start
+ j
);
380 if( sm
->material_id
!= last_material
){
381 last_material
= sm
->material_id
;
383 pass
->fn_bind_textures( world
, &world
->surfaces
[sm
->material_id
] );
386 mdl_draw_submesh( sm
);
391 VG_STATIC
void render_world_fxglow( world_instance
*world
, camera
*cam
){
392 //glDrawBuffers( 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 } );
394 shader_scene_fxglow_use();
395 shader_scene_fxglow_uTexMain(1);
396 shader_scene_fxglow_uPv( cam
->mtx
.pv
);
398 world_link_lighting_ub( world
, _shader_scene_fxglow
.id
);
399 world_bind_position_texture( world
, _shader_scene_fxglow
.id
,
400 _uniform_scene_fxglow_g_world_depth
, 2 );
401 world_bind_light_array( world
, _shader_scene_fxglow
.id
,
402 _uniform_scene_fxglow_uLightsArray
, 3 );
403 world_bind_light_index( world
, _shader_scene_fxglow
.id
,
404 _uniform_scene_fxglow_uLightsIndex
, 4 );
406 shader_scene_fxglow_uCamera( cam
->transform
[3] );
407 glDisable(GL_CULL_FACE
);
409 struct world_pass pass
= {
410 .shader
= k_shader_fxglow
,
412 .fn_bind_textures
= bindpoint_diffuse_texture1
,
413 .fn_set_mdl
= shader_scene_fxglow_uMdl
,
414 .fn_set_uPvmPrev
= shader_scene_fxglow_uPvmPrev
,
417 world_render_both_stages( world
, &pass
);
418 world_render_challenges( world
, &pass
, cam
->pos
);
420 glEnable(GL_CULL_FACE
);
421 //glDrawBuffers( 2, (GLenum[]){ GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 } );
424 VG_STATIC
void bindpoint_terrain( world_instance
*world
,
425 struct world_surface
*mat
)
427 glActiveTexture( GL_TEXTURE1
);
428 glBindTexture( GL_TEXTURE_2D
, world
->textures
[ mat
->info
.tex_diffuse
] );
430 shader_scene_terrain_uSandColour( mat
->info
.colour
);
431 shader_scene_terrain_uBlendOffset( mat
->info
.colour1
);
434 VG_STATIC
void render_terrain( world_instance
*world
, camera
*cam
)
436 shader_scene_terrain_use();
437 shader_scene_terrain_uTexGarbage(0);
438 shader_scene_terrain_uTexGradients(1);
440 world_link_lighting_ub( world
, _shader_scene_terrain
.id
);
441 world_bind_position_texture( world
, _shader_scene_terrain
.id
,
442 _uniform_scene_terrain_g_world_depth
, 2 );
443 world_bind_light_array( world
, _shader_scene_terrain
.id
,
444 _uniform_scene_terrain_uLightsArray
, 3 );
445 world_bind_light_index( world
, _shader_scene_terrain
.id
,
446 _uniform_scene_terrain_uLightsIndex
, 4 );
448 glActiveTexture( GL_TEXTURE0
);
449 glBindTexture( GL_TEXTURE_2D
, world_render
.tex_terrain_noise
);
451 shader_scene_terrain_uPv( cam
->mtx
.pv
);
452 shader_scene_terrain_uCamera( cam
->transform
[3] );
454 struct world_pass pass
= {
455 .shader
= k_shader_terrain_blend
,
457 .fn_bind_textures
= bindpoint_terrain
,
458 .fn_set_mdl
= shader_scene_terrain_uMdl
,
459 .fn_set_uPvmPrev
= shader_scene_terrain_uPvmPrev
,
462 world_render_both_stages( world
, &pass
);
465 VG_STATIC
void render_sky( world_instance
*world
, camera
*cam
)
468 * Modify matrix to remove clipping and view translation
475 m4x4_copy( cam
->mtx
.v
, v
);
476 m4x4_copy( cam
->mtx_prev
.v
, v_prev
);
478 v3_zero( v_prev
[3] );
480 m4x4_copy( cam
->mtx
.p
, pv
);
481 m4x4_copy( cam
->mtx_prev
.p
, pv_prev
);
482 m4x4_reset_clipping( pv
, cam
->farz
, cam
->nearz
);
483 m4x4_reset_clipping( pv_prev
, cam
->farz
, cam
->nearz
);
485 m4x4_mul( pv
, v
, pv
);
486 m4x4_mul( pv_prev
, v_prev
, pv_prev
);
488 m4x3f identity_matrix
;
489 m4x3_identity( identity_matrix
);
494 shader_model_sky_use();
495 shader_model_sky_uMdl( identity_matrix
);
496 shader_model_sky_uPv( pv
);
497 shader_model_sky_uPvmPrev( pv_prev
);
498 shader_model_sky_uTexGarbage(0);
499 world_link_lighting_ub( world
, _shader_model_sky
.id
);
501 glActiveTexture( GL_TEXTURE0
);
502 glBindTexture( GL_TEXTURE_2D
, world_render
.tex_terrain_noise
);
504 glDepthMask( GL_FALSE
);
505 glDisable( GL_DEPTH_TEST
);
507 mesh_bind( &world_render
.skydome
);
508 mesh_draw( &world_render
.skydome
);
510 glEnable( GL_DEPTH_TEST
);
511 glDepthMask( GL_TRUE
);
514 VG_STATIC
void render_world_gates( world_instance
*world
, camera
*cam
,
517 float closest
= INFINITY
;
518 struct ent_gate
*gate
= NULL
;
520 for( u32 i
=0; i
<mdl_arrcount(&world
->ent_gate
); i
++ ){
521 ent_gate
*gi
= mdl_arritm( &world
->ent_gate
, i
);
523 if( !(gi
->flags
& k_ent_gate_linked
) )
526 float dist
= v3_dist2( gi
->co
[0], cam
->transform
[3] );
528 vg_line_point( gi
->co
[0], 0.25f
, VG__BLUE
);
530 if( dist
< closest
){
536 world
->rendering_gate
= gate
;
538 if( gate
->flags
& k_ent_gate_locked
) return;
540 if( gate
->flags
& k_ent_gate_nonlocal
){
541 if( world_loader
.state
!= k_world_loader_none
){
542 world
->rendering_gate
= NULL
;
546 world_instance
*dest_world
= &world_static
.worlds
[ gate
->target
];
547 render_gate( world
, dest_world
, gate
, cam
, layer_depth
);
550 render_gate( world
, world
, gate
, cam
, layer_depth
);
555 VG_STATIC
void world_prerender( world_instance
*world
)
558 if( mdl_arrcount( &world
->ent_light
) ){
559 f32 rate
= vg_maxf(0.1f
, fabsf(k_day_length
)) * vg_signf(k_day_length
);
560 world
->time
+= vg
.time_delta
* (1.0/(rate
*60.0));
566 struct ub_world_lighting
*state
= &world
->ub_lighting
;
568 state
->g_time
= world
->time
;
569 state
->g_realtime
= vg
.time
;
570 state
->g_debug_indices
= k_debug_light_indices
;
571 state
->g_light_preview
= k_light_preview
;
572 state
->g_debug_complexity
= k_debug_light_complexity
;
573 state
->g_time_of_day
= vg_fractf( world
->time
);
574 state
->g_day_phase
= cosf( state
->g_time_of_day
* VG_PIf
* 2.0f
);
575 state
->g_sunset_phase
= cosf( state
->g_time_of_day
* VG_PIf
* 4.0f
+ VG_PIf
);
577 state
->g_day_phase
= state
->g_day_phase
* 0.5f
+ 0.5f
;
578 state
->g_sunset_phase
= powf( state
->g_sunset_phase
* 0.5f
+ 0.5f
, 6.0f
);
580 float a
= state
->g_time_of_day
* VG_PIf
* 2.0f
;
581 state
->g_sun_dir
[0] = sinf( a
);
582 state
->g_sun_dir
[1] = cosf( a
);
583 state
->g_sun_dir
[2] = 0.2f
;
584 v3_normalize( state
->g_sun_dir
);
586 world
->probabilities
[ k_probability_curve_constant
] = 1.0f
;
587 float dp
= state
->g_day_phase
;
589 world
->probabilities
[ k_probability_curve_wildlife_day
] =
590 (dp
*dp
*0.8f
+state
->g_sunset_phase
)*0.8f
;
591 world
->probabilities
[ k_probability_curve_wildlife_night
] =
592 1.0f
-powf(fabsf((state
->g_time_of_day
-0.5f
)*5.0f
),5.0f
);
594 glBindBuffer( GL_UNIFORM_BUFFER
, world
->ubo_lighting
);
595 glBufferSubData( GL_UNIFORM_BUFFER
, 0,
596 sizeof(struct ub_world_lighting
), &world
->ub_lighting
);
599 VG_STATIC
void skateshop_render(void);
600 VG_STATIC
void render_world( world_instance
*world
, camera
*cam
,
603 render_sky( world
, cam
);
605 render_world_routes( world
, cam
, layer_depth
);
606 render_world_standard( world
, cam
);
607 render_world_vb( world
, cam
);
608 render_world_alphatest( world
, cam
);
609 render_world_fxglow( world
, cam
);
610 render_terrain( world
, cam
);
612 if( layer_depth
== 0 ){
617 float min_dist
= INFINITY
;
619 if( !mdl_arrcount( &world
->ent_route
) )
622 for( u32 i
=0; i
<mdl_arrcount( &world
->ent_route
); i
++ ){
623 ent_route
*route
= mdl_arritm( &world
->ent_route
, i
);
624 float dist
= v3_dist2( route
->board_transform
[3], cam
->pos
);
626 if( dist
< min_dist
){
632 ent_route
*route
= mdl_arritm( &world
->ent_route
, closest
);
633 sfd_render( world
, cam
, route
->board_transform
);
637 VG_STATIC
void render_world_depth( world_instance
*world
, camera
*cam
)
639 m4x3f identity_matrix
;
640 m4x3_identity( identity_matrix
);
642 shader_scene_depth_use();
643 shader_scene_depth_uCamera( cam
->transform
[3] );
644 shader_scene_depth_uPv( cam
->mtx
.pv
);
645 shader_scene_depth_uPvmPrev( cam
->mtx_prev
.pv
);
646 shader_scene_depth_uMdl( identity_matrix
);
647 world_link_lighting_ub( world
, _shader_scene_depth
.id
);
649 mesh_bind( &world
->mesh_geo
);
650 mesh_draw( &world
->mesh_geo
);
653 VG_STATIC
void render_world_position( world_instance
*world
, camera
*cam
)
655 m4x3f identity_matrix
;
656 m4x3_identity( identity_matrix
);
658 shader_scene_position_use();
659 shader_scene_position_uCamera( cam
->transform
[3] );
660 shader_scene_position_uPv( cam
->mtx
.pv
);
661 shader_scene_position_uPvmPrev( cam
->mtx_prev
.pv
);
662 shader_scene_position_uMdl( identity_matrix
);
663 world_link_lighting_ub( world
, _shader_scene_position
.id
);
665 mesh_bind( &world
->mesh_geo
);
666 mesh_draw( &world
->mesh_geo
);