| 1 | module sgl |
| 2 | |
| 3 | // setup/shutdown/misc |
| 4 | fn C.sgl_setup(const_desc &C.sgl_desc_t) |
| 5 | fn C.sgl_shutdown() |
| 6 | fn C.sgl_error() SglError |
| 7 | fn C.sgl_context_error(ctx C.sgl_context) SglError |
| 8 | fn C.sgl_rad(deg f32) f32 |
| 9 | fn C.sgl_deg(rad f32) f32 |
| 10 | |
| 11 | // context functions |
| 12 | fn C.sgl_make_context(const_desc &C.sgl_context_desc_t) C.sgl_context |
| 13 | fn C.sgl_destroy_context(ctx C.sgl_context) |
| 14 | fn C.sgl_set_context(ctx C.sgl_context) |
| 15 | fn C.sgl_get_context() C.sgl_context |
| 16 | fn C.sgl_default_context() C.sgl_context |
| 17 | |
| 18 | // create and destroy pipeline objects |
| 19 | fn C.sgl_make_pipeline(const_desc &C.sg_pipeline_desc) C.sgl_pipeline |
| 20 | fn C.sgl_context_make_pipeline(ctx C.sgl_context, const_desc &C.sg_pipeline_desc) C.sgl_pipeline |
| 21 | fn C.sgl_destroy_pipeline(pip C.sgl_pipeline) |
| 22 | |
| 23 | // render state functions |
| 24 | fn C.sgl_defaults() |
| 25 | fn C.sgl_viewport(x int, y int, w int, h int, origin_top_left bool) |
| 26 | fn C.sgl_viewportf(x f32, y f32, w f32, h f32, origin_top_left bool) |
| 27 | fn C.sgl_scissor_rect(x int, y int, w int, h int, origin_top_left bool) |
| 28 | fn C.sgl_scissor_rectf(x f32, y f32, w f32, h f32, origin_top_left bool) |
| 29 | fn C.sgl_enable_texture() |
| 30 | fn C.sgl_disable_texture() |
| 31 | fn C.sgl_texture(img C.sg_image, sampler C.sg_sampler) |
| 32 | |
| 33 | // pipeline stack functions |
| 34 | fn C.sgl_load_default_pipeline() |
| 35 | fn C.sgl_load_pipeline(pip C.sgl_pipeline) |
| 36 | fn C.sgl_push_pipeline() |
| 37 | fn C.sgl_pop_pipeline() |
| 38 | |
| 39 | // matrix stack functions |
| 40 | fn C.sgl_matrix_mode_modelview() |
| 41 | fn C.sgl_matrix_mode_projection() |
| 42 | fn C.sgl_matrix_mode_texture() |
| 43 | fn C.sgl_load_identity() |
| 44 | fn C.sgl_load_matrix(m [16]f32) |
| 45 | fn C.sgl_load_transpose_matrix(m [16]f32) |
| 46 | fn C.sgl_mult_matrix(m [16]f32) |
| 47 | fn C.sgl_mult_transpose_matrix(m [16]f32) |
| 48 | fn C.sgl_rotate(angle_rad f32, x f32, y f32, z f32) |
| 49 | fn C.sgl_scale(x f32, y f32, z f32) |
| 50 | fn C.sgl_translate(x f32, y f32, z f32) |
| 51 | fn C.sgl_frustum(l f32, r f32, b f32, t f32, n f32, f f32) |
| 52 | fn C.sgl_ortho(l f32, r f32, b f32, t f32, n f32, f f32) |
| 53 | fn C.sgl_perspective(fov_y f32, aspect f32, z_near f32, z_far f32) |
| 54 | fn C.sgl_lookat(eye_x f32, eye_y f32, eye_z f32, center_x f32, center_y f32, center_z f32, up_x f32, up_y f32, |
| 55 | up_z f32) |
| 56 | fn C.sgl_push_matrix() |
| 57 | fn C.sgl_pop_matrix() |
| 58 | |
| 59 | // these functions only set the internal 'current texcoord / color' (valid inside or outside begin/end) |
| 60 | fn C.sgl_t2f(u f32, v f32) |
| 61 | fn C.sgl_c3f(r f32, g f32, b f32) |
| 62 | fn C.sgl_c4f(r f32, g f32, b f32, a f32) |
| 63 | fn C.sgl_c3b(r u8, g u8, b u8) |
| 64 | fn C.sgl_c4b(r u8, g u8, b u8, a u8) |
| 65 | fn C.sgl_c1i(rgba u32) |
| 66 | fn C.sgl_point_size(s f32) |
| 67 | |
| 68 | // define primitives, each begin/end is one draw command |
| 69 | fn C.sgl_begin_points() |
| 70 | fn C.sgl_begin_lines() |
| 71 | fn C.sgl_begin_line_strip() |
| 72 | fn C.sgl_begin_triangles() |
| 73 | fn C.sgl_begin_triangle_strip() |
| 74 | fn C.sgl_begin_quads() |
| 75 | fn C.sgl_v2f(x f32, y f32) |
| 76 | fn C.sgl_v3f(x f32, y f32, z f32) |
| 77 | fn C.sgl_v2f_t2f(x f32, y f32, u f32, v f32) |
| 78 | fn C.sgl_v3f_t2f(x f32, y f32, z f32, u f32, v f32) |
| 79 | fn C.sgl_v2f_c3f(x f32, y f32, r f32, g f32, b f32) |
| 80 | fn C.sgl_v2f_c3b(x f32, y f32, r u8, g u8, b u8) |
| 81 | fn C.sgl_v2f_c4f(x f32, y f32, r f32, g f32, b f32, a f32) |
| 82 | fn C.sgl_v2f_c4b(x f32, y f32, r u8, g u8, b u8, a u8) |
| 83 | fn C.sgl_v2f_c1i(x f32, y f32, rgba u32) |
| 84 | fn C.sgl_v3f_c3f(x f32, y f32, z f32, r f32, g f32, b f32) |
| 85 | fn C.sgl_v3f_c3b(x f32, y f32, z f32, r u8, g u8, b u8) |
| 86 | fn C.sgl_v3f_c4f(x f32, y f32, z f32, r f32, g f32, b f32, a f32) |
| 87 | fn C.sgl_v3f_c4b(x f32, y f32, z f32, r u8, g u8, b u8, a u8) |
| 88 | fn C.sgl_v3f_c1i(x f32, y f32, z f32, rgba u32) |
| 89 | fn C.sgl_v2f_t2f_c3f(x f32, y f32, u f32, v f32, r f32, g f32, b f32) |
| 90 | fn C.sgl_v2f_t2f_c3b(x f32, y f32, u f32, v f32, r u8, g u8, b u8) |
| 91 | fn C.sgl_v2f_t2f_c4f(x f32, y f32, u f32, v f32, r f32, g f32, b f32, a f32) |
| 92 | fn C.sgl_v2f_t2f_c4b(x f32, y f32, u f32, v f32, r u8, g u8, b u8, a u8) |
| 93 | fn C.sgl_v2f_t2f_c1i(x f32, y f32, u f32, v f32, rgba u32) |
| 94 | fn C.sgl_v3f_t2f_c3f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32) |
| 95 | fn C.sgl_v3f_t2f_c3b(x f32, y f32, z f32, u f32, v f32, r u8, g u8, b u8) |
| 96 | fn C.sgl_v3f_t2f_c4f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32, a f32) |
| 97 | fn C.sgl_v3f_t2f_c4b(x f32, y f32, z f32, u f32, v f32, r u8, g u8, b u8, a u8) |
| 98 | fn C.sgl_v3f_t2f_c1i(x f32, y f32, z f32, u f32, v f32, rgba u32) |
| 99 | fn C.sgl_end() |
| 100 | |
| 101 | // render recorded commands |
| 102 | fn C.sgl_draw() |
| 103 | fn C.sgl_context_draw(ctx C.sgl_context) |
| 104 | |