classicube_sys\graphics/
mod.rs1mod owned_gfx_texture;
2mod owned_vertex_buffer;
3
4pub use self::{owned_gfx_texture::*, owned_vertex_buffer::*};
5use crate::{
6 bindings::*,
7 std_types::{c_int, c_void},
8};
9
10#[allow(clippy::missing_safety_doc)]
11pub unsafe fn Gfx_UpdateDynamicVb_IndexedTris(
12 vb: GfxResourceID,
13 vertices: *mut c_void,
14 vCount: c_int,
15) {
16 Gfx_SetDynamicVbData(vb, vertices, vCount);
17 Gfx_DrawVb_IndexedTris(vCount);
18}
19
20pub fn Gfx_Make2DQuad(tex: &mut Texture, col: PackedCol) -> [VertexTextured; 4] {
21 let x1: f32 = tex.x as _;
22 let x2: f32 = (tex.x as f32 + tex.width as f32) as _;
23 let y1: f32 = tex.y as _;
24 let y2: f32 = (tex.y as f32 + tex.height as f32) as _;
25
26 [
27 VertexTextured {
28 x: x1,
29 y: y1,
30 z: 0 as _,
31 Col: col,
32 U: tex.uv.u1,
33 V: tex.uv.v1,
34 },
35 VertexTextured {
36 x: x2,
37 y: y1,
38 z: 0 as _,
39 Col: col,
40 U: tex.uv.u2,
41 V: tex.uv.v1,
42 },
43 VertexTextured {
44 x: x2,
45 y: y2,
46 z: 0 as _,
47 Col: col,
48 U: tex.uv.u2,
49 V: tex.uv.v2,
50 },
51 VertexTextured {
52 x: x1,
53 y: y2,
54 z: 0 as _,
55 Col: col,
56 U: tex.uv.u1,
57 V: tex.uv.v2,
58 },
59 ]
60}