sitting down
[carveJwlIkooP6JGAAIwe30JlM.git] / player_render.h
1 #ifndef PLAYER_RENDER_H
2 #define PLAYER_RENDER_H
3
4 #include "model.h"
5 #include "skeleton.h"
6 #include "camera.h"
7 #include "world.h"
8
9 struct player_avatar
10 {
11 mdl_context meta;
12 struct skeleton sk;
13
14 u32 id_hip,
15 id_chest,
16 id_ik_hand_l,
17 id_ik_hand_r,
18 id_ik_elbow_l,
19 id_ik_elbow_r,
20 id_head,
21 id_ik_foot_l,
22 id_ik_foot_r,
23 id_ik_knee_l,
24 id_ik_knee_r,
25 id_wheel_l,
26 id_wheel_r,
27 id_board;
28 };
29
30 enum eboard_truck{
31 k_board_truck_back = 0,
32 k_board_truck_front = 1
33 };
34
35 enum eboard_wheel{
36 k_board_wheel_fl = 0,
37 k_board_wheel_fr = 1,
38 k_board_wheel_bl = 2,
39 k_board_wheel_br = 3,
40 };
41
42 /* TODO: Fully featured dynamic models
43 * This is FAR from the final system we want at all, but it will do for now */
44 struct dynamic_model_1texture{
45 glmesh mesh;
46 GLuint texture;
47 };
48
49 struct player_board{
50 struct dynamic_model_1texture mdl;
51
52 v4f wheel_positions[4],
53 truck_positions[2],
54 board_position;
55
56 mdl_submesh wheels[4],
57 trucks[2],
58 board;
59 };
60
61 struct player_model{
62 struct dynamic_model_1texture mdl;
63 };
64
65 enum board_shader{
66 k_board_shader_player,
67 k_board_shader_entity
68 };
69
70 static void dynamic_model_load( mdl_context *ctx,
71 struct dynamic_model_1texture *mdl,
72 const char *path );
73 static void dynamic_model_unload( struct dynamic_model_1texture *mdl );
74
75 static void player_board_load( struct player_board *mdl, const char *path );
76 static void player_board_unload( struct player_board *mdl );
77
78 static void player_model_load( struct player_model *board, const char *path);
79 static void player_model_unload( struct player_model *board );
80
81 static void render_board( camera *cam, world_instance *world,
82 struct player_board *board, m4x3f root,
83 struct player_board_pose *pose,
84 enum board_shader shader );
85
86 static void render_playermodel( camera *cam, world_instance *world,
87 int depth_compare,
88 struct player_model *model,
89 struct skeleton *skeleton,
90 m4x3f *final_mtx );
91 static void apply_full_skeleton_pose( struct skeleton *sk, player_pose *pose,
92 m4x3f *final_mtx );
93 static void lerp_player_pose( player_pose *pose0, player_pose *pose1, f32 t,
94 player_pose *posed );
95
96 #endif /* PLAYER_RENDER_H */