polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

test_game.h (1616B)


      1 #pragma once
      2 
      3 #include "render.h"
      4 #include "terrain.h"
      5 #include "vbo.h"
      6 #include "fbo.h"
      7 #include "geometry.h"
      8 #include "skybox.h"
      9 #include "orbit.h"
     10 #include "gpu.h"
     11 #include "engine.h"
     12 
     13 enum test_game_programs {
     14     DEFAULT_PROGRAM,
     15     TERRAIN_PROGRAM,
     16     UI_PROGRAM,
     17     SKYBOX_PROGRAM,
     18     CHESS_PIECE_PROGRAM,
     19     NUM_TEST_GAME_PROGRAMS,
     20 };
     21 
     22 struct common_uniforms {
     23 // int diffuse_on;
     24 	int fog_on;
     25 	float sky_intensity;
     26 	float light_intensity;
     27 	float depth_mvp[MAT4_ELEMS];
     28 	// mat4 *depth_vp;
     29 	float model_view[MAT4_ELEMS];
     30 	float mvp[MAT4_ELEMS];
     31 	float normal_matrix[MAT4_ELEMS];
     32 	// float time;
     33 	// float ambient_str;
     34 	float sun_color[3];
     35 	float *camera_position;
     36 	float light_dir[3];
     37 };
     38 
     39 struct test_game {
     40 	struct terrain terrain;
     41 	struct vbo vertex_buffer, element_buffer, normal_buffer;
     42 	struct fbo shadow_buffer;
     43 
     44 	struct common_uniforms common_vars;
     45 	struct node_id root_id;
     46 	struct entity_id player_id;
     47 	struct geometry qh_test;
     48 	struct orbit orbit_camera;
     49 	struct node_id free_camera_id;
     50 	struct node_id camera_node_id;
     51 	struct node_id sun_camera_id;
     52 
     53 	u32 test_cubemap;
     54 	float time;
     55 
     56 	struct skybox skybox;
     57 	struct ui ui;
     58 	float proj_persp[MAT4_ELEMS];
     59 	float proj_ortho[MAT4_ELEMS];
     60 };
     61 
     62 
     63 void init_test_gl(struct test_game *game, struct gpu *gpu, int width, int height);
     64 void init_test_game(struct engine *engine, struct test_game *game);
     65 void test_game_frame(struct engine *engine, struct test_game *game);
     66 
     67 void default_scene(struct test_game *);
     68 void entity_test_scene(struct terrain *);
     69 void pbr_scene(struct test_game *);
     70 
     71 struct lens *get_common_lenses();
     72 int get_common_lenses_length();