|
Revision 1, 3.0 kB
(checked in by krobillard, 3 years ago)
|
|
Import orca & thune.
|
| Line | |
|---|
| 1 | ORCA [ |
|---|
| 2 | Purpose: {GL-Orca test} |
|---|
| 3 | ] |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | ; 5___6 |
|---|
| 7 | ; |\1__\2 |
|---|
| 8 | ; Z Y | | | |
|---|
| 9 | ; \|_X 4\|_7_| |
|---|
| 10 | ; 0 3 |
|---|
| 11 | |
|---|
| 12 | render-state 'model |
|---|
| 13 | |
|---|
| 14 | cube-list: compile-gl [ |
|---|
| 15 | verts [ |
|---|
| 16 | 0 0 0 |
|---|
| 17 | 0 1 0 |
|---|
| 18 | 1 1 0 |
|---|
| 19 | 1 0 0 |
|---|
| 20 | |
|---|
| 21 | 0 0 1 |
|---|
| 22 | 0 1 1 |
|---|
| 23 | 1 1 1 |
|---|
| 24 | 1 0 1 |
|---|
| 25 | ] |
|---|
| 26 | |
|---|
| 27 | normals [ |
|---|
| 28 | 1 0 0 |
|---|
| 29 | 0 1 0 |
|---|
| 30 | 0 0 1 |
|---|
| 31 | -1 0 0 |
|---|
| 32 | 0 -1 0 |
|---|
| 33 | 0 0 -1 |
|---|
| 34 | ] |
|---|
| 35 | |
|---|
| 36 | 255.100.20 |
|---|
| 37 | quads nv [ |
|---|
| 38 | 5 0 5 1 5 2 5 3 ; front |
|---|
| 39 | 3 4 3 5 3 1 3 0 ; left side |
|---|
| 40 | ] |
|---|
| 41 | |
|---|
| 42 | 0.255.60 |
|---|
| 43 | quads nv [ |
|---|
| 44 | 1 6 1 2 1 1 1 5 ; top |
|---|
| 45 | ] |
|---|
| 46 | |
|---|
| 47 | 0.60.255 |
|---|
| 48 | quads nv [ |
|---|
| 49 | 0 3 0 2 0 6 0 7 ; right side |
|---|
| 50 | ] |
|---|
| 51 | |
|---|
| 52 | uvs [ |
|---|
| 53 | 0 0 |
|---|
| 54 | 0 1 |
|---|
| 55 | 1 1 |
|---|
| 56 | 1 0 |
|---|
| 57 | ] |
|---|
| 58 | |
|---|
| 59 | 255.255.255 |
|---|
| 60 | texture 0 %data/pool.png |
|---|
| 61 | quads ntv [ |
|---|
| 62 | ;7 6 5 4 |
|---|
| 63 | 2 0 7 2 1 6 2 2 5 2 3 4 ; back |
|---|
| 64 | ] |
|---|
| 65 | ] |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | do %demo/stars.r |
|---|
| 69 | do %demo/fps.r |
|---|
| 70 | |
|---|
| 71 | ;snd0: load %data/attn01.wav |
|---|
| 72 | ;snd1: load %data/click01.wav |
|---|
| 73 | stars: make-stars 500 |
|---|
| 74 | font: make-texfont #fontA %data/Chicago.ttf 12 |
|---|
| 75 | display/window 640x480 |
|---|
| 76 | fps/init |
|---|
| 77 | |
|---|
| 78 | win: make widget [ |
|---|
| 79 | mouse-move: |
|---|
| 80 | none |
|---|
| 81 | ;mouse-handler [print [mx my]] |
|---|
| 82 | |
|---|
| 83 | mouse-down: mouse-handler [ |
|---|
| 84 | either code == 1 [ |
|---|
| 85 | mouse-move: move-obj |
|---|
| 86 | ][ |
|---|
| 87 | mouse-move: rot-obj |
|---|
| 88 | ] |
|---|
| 89 | ;print code |
|---|
| 90 | ] |
|---|
| 91 | |
|---|
| 92 | mouse-up: mouse-handler [ |
|---|
| 93 | mouse-move: none |
|---|
| 94 | ] |
|---|
| 95 | |
|---|
| 96 | move-obj: mouse-handler [ |
|---|
| 97 | move posA 0.01 * dx 0.01 * dy 0.0 |
|---|
| 98 | |
|---|
| 99 | ;sx: 0.01 * dx + sx |
|---|
| 100 | ;sy: 0.01 * dy + sy |
|---|
| 101 | |
|---|
| 102 | ;vec: make vec3! [0.01 * dx 0.01 * dy 0.0] |
|---|
| 103 | ;trans posA vec |
|---|
| 104 | ] |
|---|
| 105 | |
|---|
| 106 | rot-obj: mouse-handler [ |
|---|
| 107 | rotate posA y-axis dx |
|---|
| 108 | rotate posA x-axis dy |
|---|
| 109 | ] |
|---|
| 110 | |
|---|
| 111 | ;mouse-wheel: mouse-handler [ |
|---|
| 112 | ;print dy |
|---|
| 113 | ;sz: 0.01 * dy + sz |
|---|
| 114 | ;] |
|---|
| 115 | |
|---|
| 116 | key-down: key-handler [ |
|---|
| 117 | esc [quit] |
|---|
| 118 | ;up [ |
|---|
| 119 | ; sz: sz + 0.01 print sz |
|---|
| 120 | ; ] |
|---|
| 121 | ;down [ |
|---|
| 122 | ; sz: sz - 0.01 print sz |
|---|
| 123 | ; ] |
|---|
| 124 | ;home [ |
|---|
| 125 | ; ;set-identity posA |
|---|
| 126 | ; ;set-identity cam-pos |
|---|
| 127 | ; sx: sy: sz: 0.0 |
|---|
| 128 | ; ] |
|---|
| 129 | r [recycle] |
|---|
| 130 | ;s [play snd0] |
|---|
| 131 | ;d [play snd1] |
|---|
| 132 | print [save %snapshot.png screengrab] |
|---|
| 133 | #"0" [print "zero"] |
|---|
| 134 | #"." [print "period"] |
|---|
| 135 | #"\" [print "backslash"] |
|---|
| 136 | #"'" [print "apos"] |
|---|
| 137 | #"`" [print "grave"] |
|---|
| 138 | ] |
|---|
| 139 | |
|---|
| 140 | render: [ |
|---|
| 141 | viewport self cam-pos |
|---|
| 142 | |
|---|
| 143 | render-state 'solid |
|---|
| 144 | rotate posB y-axis 0.05 |
|---|
| 145 | push-matrix posB |
|---|
| 146 | call stars |
|---|
| 147 | pop |
|---|
| 148 | |
|---|
| 149 | render-state 'model |
|---|
| 150 | call cube-prog |
|---|
| 151 | |
|---|
| 152 | ortho-view self none none |
|---|
| 153 | render-state font |
|---|
| 154 | render-text 0x0 fps/update |
|---|
| 155 | ] |
|---|
| 156 | |
|---|
| 157 | posA: copy |
|---|
| 158 | posB: make matrix! none |
|---|
| 159 | cam-pos: make matrix! [ |
|---|
| 160 | 1 0 0 0 |
|---|
| 161 | 0 1 0 0 |
|---|
| 162 | 0 0 1 0 |
|---|
| 163 | 0 0 2 1 |
|---|
| 164 | ] |
|---|
| 165 | |
|---|
| 166 | cube-prog: render-prog #cube compose [ |
|---|
| 167 | light 0 on |
|---|
| 168 | light 0 <0 1 1> |
|---|
| 169 | push (posA) |
|---|
| 170 | call (cube-list) |
|---|
| 171 | pop |
|---|
| 172 | ] |
|---|
| 173 | ] |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | ;play %data/soundtrack.ogg |
|---|
| 177 | |
|---|
| 178 | exec win |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | ;eof |
|---|