-
Notifications
You must be signed in to change notification settings - Fork 30
/
pillars.s
128 lines (116 loc) · 3.74 KB
/
pillars.s
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
@ This file is part of the Team 28 Project
@ Licensing information can be found in the LICENSE file
@ (C) 2014 The Team 28 Authors. All rights reserved.
.global draw_pillars
.global pillar_pos
.section .data
.include "assets/pillar.s"
.section .text
@ ------------------------------------------------------------------------------
@ Cubes on the sides
@ ------------------------------------------------------------------------------
.equ PILLAR_COUNT, 24
pillar_pos: .float 0.0
pillar_list:
.float -10.0, 0.0, -142.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -130.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -118.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -106.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -94.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -82.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -70.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -58.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -46.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -34.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -22.0
.float 1.0, 6.0, 1.0
.float -10.0, 0.0, -10.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -142.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -130.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -118.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -106.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -94.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -82.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -70.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -58.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -46.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -34.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -22.0
.float 1.0, 6.0, 1.0
.float 10.0, 0.0, -10.0
.float 1.0, 6.0, 1.0
@ ------------------------------------------------------------------------------
@ Renders the pillars on the sides
@ ------------------------------------------------------------------------------
draw_pillars:
stmfd sp!, {lr}
ldr r12, =PILLAR_COUNT
ldr r11, =pillar_list
@ Reset model matrix
ldr r0, =mtx_id
vldm.f32 r0, {s0 - s15}
ldr r0, =mtx_model
vstm.f32 r0, {s0 - s15}
@ Get player position
ldr r0, =player_speed
vldr.f32 s3, [r0]
ldr r0, =pillar_pos
vldr.f32 s4, [r0]
vadd.f32 s4, s4, s3
ldr r1, =0x41400000
vmov.f32 s5, r1
vcmp.f32 s4, s5
fmstat
ldr r1, =0x00000000
vmovgt.f32 s4, r1
vstr.f32 s4, [r0]
1:
vldm.f32 r11!, {s0 - s2}
vstmdb.f32 sp!, {s4}
vadd.f32 s2, s2, s4
bl draw_pillar
vldmia.f32 sp!, {s4}
subs r12, r12, #1
bne 1b
ldmfd sp!, {pc}
@ ------------------------------------------------------------------------------
@ Draws a single pillar
@ ------------------------------------------------------------------------------
draw_pillar:
stmfd sp!, {lr}
ldr r0, =mtx_model
bl mat4_translate
vldm.f32 r11!, {s0 - s2}
bl mat4_scale
ldr r0, =mtx_vp
ldr r1, =mtx_model
ldr r2, =mtx_mvp
bl mat4_mul_mat4
ldr r0, =pillar_vtx
ldr r1, =pillar_idx
ldr r2, =10
ldr r3, =mtx_mvp
ldr r4, =light_dir
bl gfx_draw_trgs
ldmfd sp!, {pc}