engine

game engine on C
git clone git://git.evenfri.pw/engine.git
Log | Files | Refs | README

fns.h (2201B)


      1 #ifndef FNS_H
      2 #define FNS_H
      3 
      4 /* array */
      5 void array_init(Array_t *a, size_t elem_size);
      6 void array_free(Array_t *a);
      7 void *array_push(Array_t *a);
      8 void *array_pop(Array_t *a, size_t i);
      9 void array_remove_swap(Array_t *a, size_t i);
     10 void array_clear(Array_t *a);
     11 
     12 /* math */
     13 vec3 vec3_make(float x, float y, float z);
     14 vec3 vec3_sub(vec3 a, vec3 b); 
     15 vec3 vec3_scale(vec3 a, float s);
     16 float vec3_dot(vec3 a, vec3 b);
     17 vec3 vec3_cross(vec3 a, vec3 b);
     18 vec3 vec3_norm(vec3 a);
     19 
     20 mat4 mat4_mul(mat4 a, mat4 b);
     21 mat4 mat4_rotate_x(float radians);
     22 mat4 mat4_rotate_y(float radians);
     23 mat4 mat4_rotate_z(float radians);
     24 mat4 mat4_identity(void);
     25 mat4 mat4_perspective(float fovy, float aspect, float znear, float zfar);
     26 mat4 mat4_translate(float x, float y, float z);
     27 
     28 /* window */
     29 void window_init();
     30 void process_input(float dt);
     31 
     32 /* render */
     33 void render_init();
     34 void render_begin();
     35 void render_end();
     36 
     37 /* shader */
     38 void shader_init();
     39 void shader_end();
     40 
     41 /* camera */
     42 void camera_init(vec3 position);
     43 void camera_set_editor(void);
     44 void camera_set_game(game_obj_t *obj, camera_comp_t *comp);
     45 editor_camera_t *camera_editor(void);
     46 
     47 mat4 camera_get_view(void);
     48 float camera_get_fov(void);
     49 float camera_get_near(void);
     50 float camera_get_far(void);
     51 void camera_process_keyboard(float dt);
     52 void camera_process_mouse(float dx, float dy);
     53 void camera_update_vectors(void);
     54 
     55 /* mesh */
     56 Mesh_t mesh_load_obj(const char *path);
     57 void mesh_draw(Mesh_t *mesh);
     58 void mesh_destroy(Mesh_t *mesh);
     59 
     60 /* texture */
     61 uint texture_load(const char *path);
     62 
     63 /* scene / components */
     64 void scene_init(scene_t *w);
     65 void scene_end(scene_t *w);
     66 game_obj_t *scene_add_object(scene_t *w);
     67 void scene_render(scene_t *w, uint shader_program);
     68 
     69 void *game_obj_add_component(game_obj_t *obj, uint32_t type_id, size_t size);
     70 void *game_obj_get_component(game_obj_t *obj, uint32_t type_id);
     71 
     72 /* typed component helpers */
     73 transform_t *game_obj_add_transform(game_obj_t *obj);
     74 camera_comp_t *game_obj_add_camera(game_obj_t *obj);
     75 mesh_comp_t *game_obj_add_mesh(game_obj_t *obj, Mesh_t *mesh, uint texture);
     76 void game_obj_activate_camera(game_obj_t *obj);
     77 
     78 /* test*/
     79 int test_start();
     80 int test_update(float dt);
     81 int test_end();
     82 
     83 #endif /* FNS_H */