1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use crate::bindings::*;

pub fn Particle_DoRender(
    size: &Vec2,
    pos: &Vec3,
    rec: &TextureRec,
    col: PackedCol,
) -> [VertexTextured; 4] {
    let sX = size.x * 0.5;
    let sY = size.y * 0.5;
    let mut centre = *pos;
    centre.y += sY;
    let view = unsafe { &Gfx.View };

    let aX = view.row1.x * sX;
    let aY = view.row2.x * sX;
    let aZ = view.row3.x * sX; // right * size.x * 0.5f
    let bX = view.row1.y * sY;
    let bY = view.row2.y * sY;
    let bZ = view.row3.y * sY; // up    * size.y * 0.5f

    [
        VertexTextured {
            x: centre.x - aX - bX,
            y: centre.y - aY - bY,
            z: centre.z - aZ - bZ,
            Col: col,
            U: rec.u1,
            V: rec.v2,
        },
        VertexTextured {
            x: centre.x - aX + bX,
            y: centre.y - aY + bY,
            z: centre.z - aZ + bZ,
            Col: col,
            U: rec.u1,
            V: rec.v1,
        },
        VertexTextured {
            x: centre.x + aX + bX,
            y: centre.y + aY + bY,
            z: centre.z + aZ + bZ,
            Col: col,
            U: rec.u2,
            V: rec.v1,
        },
        VertexTextured {
            x: centre.x + aX - bX,
            y: centre.y + aY - bY,
            z: centre.z + aZ - bZ,
            Col: col,
            U: rec.u2,
            V: rec.v2,
        },
    ]
}