classicube_sys/
particle.rs1use crate::bindings::*;
2
3pub fn Particle_DoRender(
4 size: &Vec2,
5 pos: &Vec3,
6 rec: &TextureRec,
7 col: PackedCol,
8) -> [VertexTextured; 4] {
9 let sX = size.x * 0.5;
10 let sY = size.y * 0.5;
11 let mut centre = *pos;
12 centre.y += sY;
13 let view = unsafe { &Gfx.View };
14
15 let aX = view.row1.x * sX;
16 let aY = view.row2.x * sX;
17 let aZ = view.row3.x * sX; let bX = view.row1.y * sY;
19 let bY = view.row2.y * sY;
20 let bZ = view.row3.y * sY; [
23 VertexTextured {
24 x: centre.x - aX - bX,
25 y: centre.y - aY - bY,
26 z: centre.z - aZ - bZ,
27 Col: col,
28 U: rec.u1,
29 V: rec.v2,
30 },
31 VertexTextured {
32 x: centre.x - aX + bX,
33 y: centre.y - aY + bY,
34 z: centre.z - aZ + bZ,
35 Col: col,
36 U: rec.u1,
37 V: rec.v1,
38 },
39 VertexTextured {
40 x: centre.x + aX + bX,
41 y: centre.y + aY + bY,
42 z: centre.z + aZ + bZ,
43 Col: col,
44 U: rec.u2,
45 V: rec.v1,
46 },
47 VertexTextured {
48 x: centre.x + aX - bX,
49 y: centre.y + aY - bY,
50 z: centre.z + aZ - bZ,
51 Col: col,
52 U: rec.u2,
53 V: rec.v2,
54 },
55 ]
56}