7c026532f66178d5496bc86ddf5830e14e110909
1 // Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved
6 SHADER_DEFINE( shader_tile_colour
,
9 "layout (location=0) in vec2 a_co;"
11 "uniform vec3 uOffset;"
15 "gl_Position = vec4( uPv * vec3( a_co * uOffset.z + uOffset.xy, 1.0 ), 1.0 );"
20 "uniform vec4 uColour;"
24 "FragColor = uColour;"
27 UNIFORMS({ "uPv", "uOffset", "uColour" })
30 const char *level_pack
[] =
60 "###+##+####;bbb,bb\n"
65 "###-#####-###;a,aaa\n"
72 "######+######;aaaa\n"
77 "###-#####-###;aaa,aa\n"
84 "###+#####+###;aa,aaa\n"
92 #define FLAG_INPUT 0x1
93 #define FLAG_OUTPUT 0x2
94 #define FLAG_CANAL 0x4
96 #define FLAG_DROP_L 0x10
97 #define FLAG_SPLIT 0x20
98 #define FLAG_MERGER 0x40
99 #define FLAG_DROP_R 0x80
100 #define FLAG_FLIP_FLOP 0x100
103 { { 0.9f
, 0.2f
, 0.01f
},
104 { 0.2f
, 0.9f
, 0.14f
},
105 { 0.1f
, 0.3f
, 0.85f
} };
107 static void colour_code_v3( char cc
, v3f target
)
109 if( cc
>= 'a' && cc
<= 'z' )
113 if( id
< vg_list_size( colour_sets
) )
115 v3_copy( colour_sets
[ id
], target
);
120 v3_copy( (v3f
){0.0f
,0.0f
,0.0f
}, target
);
129 static void init_mesh( struct mesh
*m
, float *tris
, u32 length
)
131 m
->elements
= length
/3;
132 glGenVertexArrays( 1, &m
->vao
);
133 glGenBuffers( 1, &m
->vbo
);
135 glBindVertexArray( m
->vao
);
136 glBindBuffer( GL_ARRAY_BUFFER
, m
->vbo
);
137 glBufferData( GL_ARRAY_BUFFER
, length
*sizeof(float), tris
, GL_STATIC_DRAW
);
139 glVertexAttribPointer( 0, 2, GL_FLOAT
, GL_FALSE
, 2 * sizeof(float), (void*)0 );
140 glEnableVertexAttribArray( 0 );
145 static void free_mesh( struct mesh
*m
)
147 glDeleteVertexArrays( 1, &m
->vao
);
148 glDeleteBuffers( 1, &m
->vbo
);
151 static void draw_mesh( int const start
, int const count
)
153 glDrawArrays( GL_TRIANGLES
, start
*3, count
*3 );
156 static void use_mesh( struct mesh
*m
)
158 glBindVertexArray( m
->vao
);
178 // TODO: Split into input/output structures
188 struct mesh tile
, circle
, splitter_l
, splitter_r
;
204 static void map_free(void)
206 for( int i
= 0; i
< arrlen( world
.io
); i
++ )
207 arrfree( world
.io
[ i
].conditions
);
209 arrfree( world
.data
);
218 static int map_load( const char *str
)
227 if( str
[world
.w
] == ';' )
229 else if( !str
[world
.w
] )
231 vg_error( "Unexpected EOF when parsing level\n" );
236 struct cell
*row
= arraddnptr( world
.data
, world
.w
);
238 int reg_start
= 0, reg_end
= 0;
254 if( reg_start
< reg_end
)
256 if( *c
>= 'a' && *c
<= 'z' )
258 arrpush( world
.io
[ reg_start
].conditions
, *c
);
262 if( *c
== ',' || *c
== '\n' )
271 vg_error( "Unkown attribute '%c' (row: %u)\n", *c
, world
.h
);
278 vg_error( "Too many values to assign (row: %u)\n", world
.h
);
286 if( reg_start
!= reg_end
)
288 vg_error( "Not enough values assigned (row: %u, %u of %u)\n", world
.h
, reg_start
, reg_end
);
294 vg_error( "Not enough cells to match previous row definition (row: %u, %u<%u)\n", world
.h
, cx
, world
.w
);
298 row
= arraddnptr( world
.data
, world
.w
);
301 reg_end
= reg_start
= arrlen( world
.io
);
307 vg_error( "Too many cells to match previous row definition (row: %u, %u>%u)\n", world
.h
, cx
, world
.w
);
311 // Tile initialization
314 if( *c
== '+' || *c
== '-' )
316 struct cell_terminal term
= { .id
= cx
+ world
.h
*world
.w
};
317 arrpush( world
.io
, term
);
318 row
[ cx
++ ].state
= *c
== '+'? FLAG_INPUT
: FLAG_OUTPUT
;
323 row
[ cx
++ ].state
= FLAG_WALL
;
327 row
[ cx
++ ].state
= 0x00;
334 vg_success( "Map loaded! (%u:%u)\n", world
.w
, world
.h
);
338 static struct cell
*pcell( v2i pos
)
340 return &world
.data
[ pos
[1]*world
.w
+ pos
[0] ];
343 int main( int argc
, char *argv
[] )
345 vg_init( argc
, argv
, "Fish (Marbles Computer) Ladder Simulator 2022 | N,M: change level | SPACE: Test | LeftClick: Toggle tile" );
348 void vg_register(void)
350 SHADER_INIT( shader_tile_colour
);
359 0.0f
, 0.0f
, 0.0f
, 1.0f
, 1.0f
, 1.0f
,
360 0.0f
, 0.0f
, 1.0f
, 1.0f
, 1.0f
, 0.0f
,
362 0.48f
, 0.48f
, 0.5f
, 0.52f
, 0.52f
, 0.52f
, // Static dot
363 0.375f
, 0.25f
, 0.5f
, 0.75f
, 0.625f
, 0.25f
, // Downwards pointing arrow
364 0.25f
, 0.625f
, 0.75f
, 0.5f
, 0.25f
, 0.375f
, // Left
365 0.625f
, 0.75f
, 0.5f
, 0.25f
, 0.375f
, 0.75f
, // up
366 0.75f
, 0.375f
, 0.25f
, 0.5f
, 0.75f
, 0.625f
369 init_mesh( &world
.tile
, quad_mesh
, vg_list_size(quad_mesh
) );
374 float circle_mesh
[32*6*3];
375 int res
= vg_list_size( circle_mesh
) / (6*3);
377 for( int i
= 0; i
< res
; i
++ )
379 v2f v0
= { sinf( ((float)i
/(float)res
)*VG_TAUf
), cosf( ((float)i
/(float)res
)*VG_TAUf
) };
380 v2f v1
= { sinf( ((float)(i
+1)/(float)res
)*VG_TAUf
), cosf( ((float)(i
+1)/(float)res
)*VG_TAUf
) };
382 circle_mesh
[ i
*6+0 ] = 0.0f
;
383 circle_mesh
[ i
*6+1 ] = 0.0f
;
385 v2_copy( v0
, circle_mesh
+ 32*6 + i
*12 );
386 v2_muls( v0
, 0.8f
, circle_mesh
+ 32*6 + i
*12+2 );
387 v2_copy( v1
, circle_mesh
+ 32*6 + i
*12+4 );
389 v2_copy( v1
, circle_mesh
+ 32*6 + i
*12+6 );
390 v2_muls( v1
, 0.8f
, circle_mesh
+ 32*6 + i
*12+8 );
391 v2_muls( v0
, 0.8f
, circle_mesh
+ 32*6 + i
*12+10 );
393 v2_copy( v0
, circle_mesh
+ i
*6+4 );
394 v2_copy( v1
, circle_mesh
+ i
*6+2 );
395 v2_copy( v0
, circle_mesh
+i
*6+4 );
396 v2_copy( v1
, circle_mesh
+i
*6+2 );
399 init_mesh( &world
.circle
, circle_mesh
, vg_list_size( circle_mesh
) );
406 #include "models/splitter_l.obj.h"
410 #include "models/splitter_r.obj.h"
413 init_mesh( &world
.splitter_l
, splitter_l
, vg_list_size( splitter_l
) );
414 init_mesh( &world
.splitter_r
, splitter_r
, vg_list_size( splitter_r
) );
417 map_load( level_pack
[ 0 ] );
422 free_mesh( &world
.tile
);
423 free_mesh( &world
.circle
);
424 free_mesh( &world
.splitter_l
);
425 free_mesh( &world
.splitter_r
);
430 static int cell_interactive( v2i co
)
433 if( co
[0] < 2 || co
[0] >= world
.w
-2 || co
[1] < 2 || co
[1] >= world
.h
-2 )
437 if( world
.data
[ world
.w
*co
[1] + co
[0] ].state
& (FLAG_WALL
|FLAG_INPUT
|FLAG_OUTPUT
) )
440 // List of 3x3 configurations that we do not allow
441 static u32 invalid_src
[][9] =
473 // Statically compile invalid configurations into bitmasks
474 static u32 invalid
[ vg_list_size(invalid_src
) ];
476 for( int i
= 0; i
< vg_list_size(invalid_src
); i
++ )
480 for( int j
= 0; j
< 3; j
++ )
481 for( int k
= 0; k
< 3; k
++ )
482 comped
|= invalid_src
[i
][ j
*3+k
] << ((j
*5)+k
);
487 // Extract 5x5 grid surrounding tile
489 for( int y
= co
[1]-2; y
< co
[1]+3; y
++ )
490 for( int x
= co
[0]-2; x
< co
[0]+3; x
++ )
492 struct cell
*cell
= pcell((v2i
){x
,y
});
494 if( cell
&& (cell
->state
& (FLAG_CANAL
|FLAG_INPUT
|FLAG_OUTPUT
)) )
495 blob
|= 0x1 << ((y
-(co
[1]-2))*5 + x
-(co
[0]-2));
498 // Run filter over center 3x3 grid to check for invalid configurations
499 int kernel
[] = { 0, 1, 2, 5, 6, 7, 10, 11, 12 };
500 for( int i
= 0; i
< vg_list_size(kernel
); i
++ )
502 if( blob
& (0x1 << (6+kernel
[i
])) )
504 u32 window
= blob
>> kernel
[i
];
506 for( int j
= 0; j
< vg_list_size(invalid
); j
++ )
507 if((window
& invalid
[j
]) == invalid
[j
])
517 static int curlevel
= 0;
518 int changelvl
= curlevel
;
519 if( vg_get_button_down( "prev" ) ) { if( curlevel
> 0 ) changelvl
--; }
520 else if( vg_get_button_down( "next" ) ) { if( curlevel
< vg_list_size( level_pack
)-1 ) changelvl
++; }
522 if( changelvl
!= curlevel
)
524 map_load( level_pack
[ changelvl
] );
525 curlevel
= changelvl
;
528 world
.simulating
= 0;
529 world
.num_fishes
= 0;
532 for( int i
= 0; i
< arrlen( world
.io
); i
++ )
533 world
.io
[i
].recv_count
= 0;
535 vg_info( "Stopping simulation!\n" );
538 float ratio
= (float)vg_window_y
/ (float)vg_window_x
;
539 float const size
= 9.5f
;
542 origin
[0] = -0.5f
* world
.w
;
543 origin
[1] = -0.5f
* world
.h
;
546 m3x3_projection( m_projection
, -size
, size
, -size
*ratio
, size
*ratio
);
547 m3x3_identity( m_view
);
548 m3x3_translate( m_view
, origin
);
549 m3x3_mul( m_projection
, m_view
, vg_pv
);
550 vg_projection_update();
555 v2_copy( vg_mouse_ws
, tile_pos
);
557 int tile_x
= floorf( tile_pos
[0] );
558 int tile_y
= floorf( tile_pos
[1] );
561 if( !world
.simulating
)
563 if( cell_interactive( (v2i
){ tile_x
, tile_y
} ))
565 world
.selected
= tile_y
* world
.w
+ tile_x
;
567 if( vg_get_button_down("primary") )
569 world
.data
[ world
.selected
].state
^= FLAG_CANAL
;
576 // Simulation stop/start
577 if( vg_get_button_down("go") )
579 if( world
.simulating
)
581 world
.simulating
= 0;
582 world
.num_fishes
= 0;
585 for( int i
= 0; i
< arrlen( world
.io
); i
++ )
586 world
.io
[i
].recv_count
= 0;
588 vg_info( "Stopping simulation!\n" );
592 vg_success( "Starting simulation!\n" );
594 world
.simulating
= 1;
595 world
.num_fishes
= 0;
597 world
.sim_start
= vg_time
;
599 for( int i
= 0; i
< world
.w
*world
.h
; i
++ )
601 world
.data
[ i
].state
&= ~FLAG_FLIP_FLOP
;
604 for( int i
= 0; i
< arrlen( world
.io
); i
++ )
605 world
.io
[i
].recv_count
= 0;
610 // ========================================================
612 // Reclassify world. TODO: Move into own function
613 for( int y
= 2; y
< world
.h
-2; y
++ )
615 for( int x
= 2; x
< world
.w
-2; x
++ )
617 v2i dirs
[] = {{1,0},{0,1},{-1,0},{0,-1}};
621 if( pcell((v2i
){x
,y
})->state
& FLAG_CANAL
)
623 for( int i
= 0; i
< vg_list_size( dirs
); i
++ )
625 struct cell
*neighbour
= pcell((v2i
){x
+dirs
[i
][0], y
+dirs
[i
][1]});
626 if( neighbour
->state
& (FLAG_CANAL
|FLAG_INPUT
|FLAG_OUTPUT
) )
631 pcell((v2i
){x
,y
})->config
= config
;
632 pcell((v2i
){x
,y
})->state
&= ~(FLAG_DROP_L
|FLAG_DROP_R
|FLAG_SPLIT
|FLAG_MERGER
);
636 for( int y
= 2; y
< world
.h
-2; y
++ )
637 for( int x
= 2; x
< world
.w
-2; x
++ )
639 // R,D,L,- 1110 (splitter, 1 drop created)
641 // R,-,L,U - 1011 (merger, 2 drop created)
643 u8 config
= pcell((v2i
){x
,y
})->config
;
645 if( config
== 0x7 ) // splitter
647 world
.data
[y
*world
.w
+x
].state
|= (FLAG_SPLIT
| FLAG_DROP_L
| FLAG_DROP_R
);
649 else if( config
== 0xD )
651 world
.data
[y
*world
.w
+x
-1].state
|= FLAG_DROP_R
;
652 world
.data
[y
*world
.w
+x
+1].state
|= FLAG_DROP_L
;
653 world
.data
[y
*world
.w
+x
].state
|= FLAG_MERGER
;
658 if( world
.simulating
)
660 while( world
.sim_frame
< (int)((vg_time
-world
.sim_start
)*2.0f
) )
662 vg_info( "frame: %u\n", world
.sim_frame
);
664 for( int i
= 0; i
< arrlen( world
.io
); i
++ )
666 struct cell_terminal
*term
= &world
.io
[ i
];
667 int posx
= term
->id
% world
.w
;
668 int posy
= (term
->id
- posx
)/world
.w
;
669 int is_input
= world
.data
[ term
->id
].state
& FLAG_INPUT
;
673 if( world
.sim_frame
< arrlen( term
->conditions
) )
675 struct fish
*fish
= &world
.fishes
[world
.num_fishes
++];
679 fish
->payload
= term
->conditions
[world
.sim_frame
];
683 v2i dirs
[] = {{1,0},{-1,0},{0,-1}};
684 for( int j
= 0; j
< vg_list_size(dirs
); j
++ )
685 if( pcell( (v2i
){ posx
+dirs
[j
][0], posy
+dirs
[j
][1] } )->state
& FLAG_CANAL
)
687 fish
->dir
[0] = dirs
[j
][0];
688 fish
->dir
[1] = dirs
[j
][1];
699 for( int i
= 0; i
< world
.num_fishes
; i
++ )
701 struct fish
*fish
= &world
.fishes
[i
];
702 struct cell
*cell_current
= pcell( fish
->pos
);
708 if( cell_current
->state
& FLAG_OUTPUT
)
710 for( int j
= 0; j
< arrlen( world
.io
); j
++ )
712 struct cell_terminal
*term
= &world
.io
[j
];
714 if( term
->id
== fish
->pos
[1]*world
.w
+ fish
->pos
[0] )
716 term
->recv
[ term
->recv_count
++ ] = fish
->payload
;
725 if( !(cell_current
->state
& (FLAG_INPUT
|FLAG_CANAL
)) )
731 if( cell_current
->state
& FLAG_SPLIT
)
734 fish
->dir
[0] = cell_current
->state
&FLAG_FLIP_FLOP
?1:-1;
737 cell_current
->state
^= FLAG_FLIP_FLOP
;
739 else if( cell_current
->state
& FLAG_MERGER
)
747 struct cell
*cell_next
= pcell( (v2i
){ fish
->pos
[0]+fish
->dir
[0], fish
->pos
[1]+fish
->dir
[1] } );
748 if( !(cell_next
->state
& (FLAG_CANAL
|FLAG_OUTPUT
)) )
750 // Try other directions for valid, so down, left, right..
751 v2i dirs
[] = {{1,0},{-1,0},{0,-1}};
752 vg_info( "Trying some other directions...\n" );
754 for( int j
= 0; j
< vg_list_size(dirs
); j
++ )
756 if( (dirs
[j
][0] == -fish
->dir
[0]) && (dirs
[j
][1] == -fish
->dir
[1]) )
759 if( pcell( (v2i
){ fish
->pos
[0]+dirs
[j
][0], fish
->pos
[1]+dirs
[j
][1] } )->state
& (FLAG_CANAL
|FLAG_OUTPUT
) )
761 fish
->dir
[0] = dirs
[j
][0];
762 fish
->dir
[1] = dirs
[j
][1];
768 fish
->pos
[0] += fish
->dir
[0];
769 fish
->pos
[1] += fish
->dir
[1];
780 glViewport( 0,0, vg_window_x
, vg_window_y
);
782 glDisable( GL_DEPTH_TEST
);
783 glClearColor( 0.8f
, 0.8f
, 0.8f
, 1.0f
);
784 glClear( GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
786 use_mesh( &world
.tile
);
787 SHADER_USE( shader_tile_colour
);
788 glUniformMatrix3fv( SHADER_UNIFORM( shader_tile_colour
, "uPv" ), 1, GL_FALSE
, (float *)vg_pv
);
791 glUniform4f( SHADER_UNIFORM( shader_tile_colour
, "uColour" ), 0.5f
, 0.5f
, 0.5f
, 1.0f
);
792 for( int y
= 0; y
< world
.h
; y
++ )
793 for( int x
= 0; x
< world
.w
; x
++ )
795 struct cell
*cell
= pcell((v2i
){x
,y
});
797 if( cell
->state
& FLAG_CANAL
)
802 glUniform3f( SHADER_UNIFORM( shader_tile_colour
, "uOffset" ), (float)x
- 0.2f
, (float)y
- 0.15f
, 1.0f
);
806 for( int y
= 0; y
< world
.h
; y
++ )
808 for( int x
= 0; x
< world
.w
; x
++ )
810 struct cell
*cell
= pcell((v2i
){x
,y
});
811 int selected
= world
.selected
== y
*world
.w
+ x
;
813 if( cell
->state
& FLAG_SPLIT
)
815 glUniform4f( SHADER_UNIFORM( shader_tile_colour
, "uColour" ), 0.9f
, 0.9f
, 0.9f
, 1.0f
);
816 glUniform3f( SHADER_UNIFORM( shader_tile_colour
, "uOffset" ), (float)x
, (float)y
, 1.0f
);
818 struct mesh
*splitter
= cell
->state
& FLAG_FLIP_FLOP
? &world
.splitter_r
: &world
.splitter_l
;
820 use_mesh( splitter
);
821 draw_mesh( 0, splitter
->elements
);
822 use_mesh( &world
.tile
);
825 if( (cell
->state
& FLAG_CANAL
) && !selected
)
828 glUniform3f( SHADER_UNIFORM( shader_tile_colour
, "uOffset" ), (float)x
, (float)y
, 1.0f
);
832 if( cell
->state
& FLAG_WALL
) { v4_copy( (v4f
){ 0.2f
, 0.2f
, 0.2f
, 1.0f
}, colour
); }
833 else if( cell
->state
& FLAG_CANAL
) { v4_copy( (v4f
){ 0.6f
, 0.6f
, 0.6f
, 1.0f
}, colour
); }
834 else if( cell
->state
& FLAG_INPUT
) { v4_copy( (v4f
){ 0.5f
, 0.5f
, 0.5f
, 1.0f
}, colour
); }
835 else if( cell
->state
& FLAG_OUTPUT
) { v4_copy( (v4f
){ 0.4f
, 0.4f
, 0.4f
, 1.0f
}, colour
); }
836 else v4_copy( (v4f
){ 0.9f
, 0.9f
, 0.9f
, 1.0f
}, colour
);
838 //if( cell->water[world.frame&0x1] )
839 // v4_copy( (v4f){ 0.2f, 0.3f, 0.7f * (float)(cell->water[world.frame&0x1]) * (1.0f/16.0f), 1.0f }, colour );
842 v3_muls( colour
, sinf( vg_time
)*0.25f
+ 0.5f
, colour
);
844 //if( cell->state & (FLAG_SPLIT) )
845 // v4_copy( (v4f){ 0.75f, 0.75f, 0.02f, 1.0f }, colour );
846 //if( cell->state & (FLAG_MERGER) )
847 // v4_copy( (v4f){ 0.75f, 0.02f, 0.75f, 1.0f }, colour );
849 glUniform4fv( SHADER_UNIFORM( shader_tile_colour
, "uColour" ), 1, colour
);
855 use_mesh( &world
.circle
);
858 for( int i
= 0; i
< arrlen( world
.io
); i
++ )
860 struct cell_terminal
*term
= &world
.io
[ i
];
861 int posx
= term
->id
% world
.w
;
862 int posy
= (term
->id
- posx
)/world
.w
;
863 int is_input
= world
.data
[ term
->id
].state
& FLAG_INPUT
;
865 int const filled_start
= 0;
866 int const filled_count
= 32;
867 int const empty_start
= 32;
868 int const empty_count
= 32*2;
870 v4f dot_colour
= { 0.0f
, 0.0f
, 0.0f
, 1.0f
};
872 for( int j
= 0; j
< arrlen( term
->conditions
); j
++ )
874 glUniform3f( SHADER_UNIFORM( shader_tile_colour
, "uOffset" ), (float)posx
+ 0.2f
+ 0.2f
* (float)j
, (float)posy
+ 0.2f
, 0.1f
);
878 colour_code_v3( term
->conditions
[j
], dot_colour
);
879 glUniform4fv( SHADER_UNIFORM( shader_tile_colour
, "uColour" ), 1, dot_colour
);
881 // Draw filled if tick not passed, draw empty if empty
882 if( world
.sim_frame
> j
)
883 draw_mesh( empty_start
, empty_count
);
885 draw_mesh( filled_start
, filled_count
);
889 if( term
->recv_count
> j
)
891 colour_code_v3( term
->recv
[j
], dot_colour
);
892 v3_muls( dot_colour
, 0.8f
, dot_colour
);
893 glUniform4fv( SHADER_UNIFORM( shader_tile_colour
, "uColour" ), 1, dot_colour
);
895 draw_mesh( filled_start
, filled_count
);
898 colour_code_v3( term
->conditions
[j
], dot_colour
);
899 glUniform4fv( SHADER_UNIFORM( shader_tile_colour
, "uColour" ), 1, dot_colour
);
901 draw_mesh( empty_start
, empty_count
);
907 if( world
.simulating
)
909 float scaled_time
= (vg_time
-world
.sim_start
)*2.0f
;
910 float lerp
= 1.0f
-(scaled_time
- (float)world
.sim_frame
);
912 v4f dot_colour
= { 0.0f
, 0.0f
, 0.0f
, 1.0f
};
914 for( int i
= 0; i
< world
.num_fishes
; i
++ )
916 struct fish
*fish
= &world
.fishes
[i
];
921 colour_code_v3( fish
->payload
, dot_colour
);
922 glUniform4fv( SHADER_UNIFORM( shader_tile_colour
, "uColour" ), 1, dot_colour
);
924 glUniform3f( SHADER_UNIFORM( shader_tile_colour
, "uOffset" ), (float)fish
->pos
[0] + 0.5f
- (float)fish
->dir
[0]*lerp
, (float)fish
->pos
[1] + 0.25f
- (float)fish
->dir
[1]*lerp
, 0.25f
);
929 if( world
.simulating
)
931 glUniform4f( SHADER_UNIFORM( shader_tile_colour
, "uColour" ), 0.0f
, 0.0f
, 0.0f
, 1.0f
);
932 glUniform3f( SHADER_UNIFORM( shader_tile_colour
, "uOffset" ), -0.5f
+ cosf( vg_time
* 4.0f
) * 0.2f
, sinf( vg_time
* 4.0f
) * 0.2f
+ (float)world
.h
* 0.5f
, 0.05f
);