diff --git a/mirrors/Dotdots.pd b/mirrors/Dotdots.pd new file mode 100644 index 0000000..8ae1b6e --- /dev/null +++ b/mirrors/Dotdots.pd @@ -0,0 +1,253 @@ +#N canvas 217 167 548 621 12; +#X obj 21 22 r fromGodot\$0; +#X obj 21 46 list trim; +#X obj 303 253 hsl 100 20 -1 1 0 0 empty empty empty -2 -10 0 12 #fcfcfc #000000 #000000 0 1; +#X obj 300 349 line~; +#X msg 300 325 \$1 100; +#X obj 300 278 expr ($f1 + 1)/8; +#X floatatom 300 302 5 0 0 0 - - - 0; +#N canvas 68 97 450 300 pan2~ 0; +#X obj 51 98 cos~; +#X obj 111 98 cos~; +#X obj 33 128 *~; +#X obj 93 128 *~; +#X obj 33 158 outlet~; +#X obj 93 158 outlet~; +#X obj 33 24 inlet~; +#X obj 111 24 inlet~; +#X obj 111 74 +~ 0.75; +#X connect 0 0 2 1; +#X connect 1 0 3 1; +#X connect 2 0 4 0; +#X connect 3 0 5 0; +#X connect 6 0 2 0; +#X connect 6 0 3 0; +#X connect 7 0 8 0; +#X connect 7 0 0 0; +#X connect 8 0 1 0; +#X restore 199 437 pd pan2~; +#X obj 199 467 dac~ 1 2; +#X obj 199 408 *~; +#X obj 189 127 unpack f f; +#X floatatom 296 159 5 0 0 0 - - - 0; +#X obj 296 182 sin; +#X floatatom 296 206 5 0 0 0 - - - 0; +#X obj 21 120 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; +#X obj 361 21 loadbang; +#X msg 361 81 \; pd dsp 1; +#X obj 21 70 route bang panvol param preset; +#X obj 361 45 del 300; +#N canvas 404 97 1087 864 Dotdots 0; +#X obj 107 15 inlet; +#X obj 73 723 outlet~; +#X obj 542 128 inlet; +#X obj 157 15 r \$0-preset; +#X obj 487 678 s \$0-preset; +#X obj 76 438 expr~ round($v1/$f2); +#X floatatom 225 416 5 0 3 0 - - - 0; +#X obj 75 662 *~; +#X obj 75 690 *~; +#X floatatom 75 386 5 0 0 0 - - - 0; +#X obj 280 325 hsl 162 19 1 16 0 0 empty empty empty -2 -10 0 12 #c6ffc7 #000000 #000000 0 1; +#X floatatom 276 380 5 0 0 0 - - - 0; +#X obj 277 354 int; +#X obj 277 406 expr pow (2 \, $f1)-1; +#X floatatom 277 430 5 0 0 0 - - - 0; +#X text 316 381 bitDepth; +#X text 319 430 resolution; +#X obj 276 456 expr 1/$f1; +#X obj 277 276 snapshot~; +#X obj 354 226 metro 100; +#X obj 354 201 tgl 19 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0 1; +#X floatatom 277 300 5 0 0 0 - - - 0; +#X floatatom 110 149 5 0 0 0 - - - 0; +#X obj 277 252 *~ 8; +#X obj 76 412 osc~; +#X obj 276 227 phasor~; +#X obj 68 301 snapshot~; +#X obj 138 384 metro 100; +#X obj 136 358 tgl 19 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0 1; +#X obj 68 228 osc~; +#X obj 68 252 +~ 1; +#X floatatom 64 149 5 0 0 0 - - - 0; +#X obj 355 150 loadbang; +#X msg 356 173 1; +#X obj 135 310 loadbang; +#X msg 136 333 1; +#X floatatom 240 146 5 0 0 0 - - - 0; +#X obj 78 553 vcf~ 1; +#X obj 97 523 sig~; +#X floatatom 153 148 5 0 0 0 - - - 0; +#X floatatom 197 146 5 0 0 0 - - - 0; +#X obj 68 276 *~ 10; +#X floatatom 284 146 5 0 0 0 - - - 0; +#X obj 134 113 unpack f f f f f f; +#X floatatom 674 91 5 0 0 0 - - - 0; +#X obj 674 119 s rev_a; +#X obj 673 62 line; +#X msg 666 7 3 2000; +#X msg 732 7 10 2000; +#X msg 610 8 0 2000; +#X obj 542 168 sel 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23, f 65; +#X msg 542 222 27.1 27 516 355.9 1.53 0.11; +#X msg 552 246 2.92 500 776 451 3.3 1; +#X msg 562 270 95 1208 447 1228 0.84 12; +#X msg 572 294 111.1 1 339 372 2.9 15; +#X msg 582 318 512 0.78 376 543 0.63 8.56; +#X msg 592 342 362.1 0 1620 709 0.75 929; +#X msg 602 366 110.1 0.2 388 607.4 7.99 65; +#X msg 612 390 3 17 445 1413 -0.32 0.93; +#X msg 622 414 11.42 0.16 653 1026 0.52 908.2; +#X msg 632 438 980.7 0.53 608 1109 0.56 282.4; +#X msg 642 462 486 0.05 135 297 0.75 458; +#X msg 652 486 427 0.04 122 384 0.89 66; +#X msg 660 510 27.1 27 516 355.9 1.53 0.11; +#X msg 671 537 2.92 500 776 451 3.3 1; +#X msg 684 563 95 1208 447 1228 0.84 12; +#X msg 697 589 111.1 1 339 372 2.9 15; +#X msg 704 613 512 0.78 376 543 0.63 8.56; +#X msg 712 637 362.1 0 1620 709 0.75 929; +#X msg 723 660 110.1 0.2 388 607.4 7.99 65; +#X msg 732 684 3 17 445 1413 -0.32 0.93; +#X msg 738 709 11.42 0.16 653 1026 0.52 908.2; +#X msg 748 734 980.7 0.53 608 1109 0.56 282.4; +#X msg 755 758 486 0.05 135 297 0.75 458; +#X connect 0 0 43 0; +#X connect 2 0 50 0; +#X connect 3 0 43 0; +#X connect 5 0 37 0; +#X connect 6 0 5 1; +#X connect 6 0 7 1; +#X connect 7 0 8 0; +#X connect 8 0 1 0; +#X connect 9 0 24 0; +#X connect 10 0 12 0; +#X connect 11 0 13 0; +#X connect 12 0 11 0; +#X connect 13 0 14 0; +#X connect 14 0 17 0; +#X connect 17 0 6 0; +#X connect 18 0 21 0; +#X connect 19 0 18 0; +#X connect 20 0 19 0; +#X connect 21 0 10 0; +#X connect 22 0 25 0; +#X connect 23 0 18 0; +#X connect 24 0 5 0; +#X connect 25 0 23 0; +#X connect 26 0 9 0; +#X connect 27 0 26 0; +#X connect 28 0 27 0; +#X connect 29 0 30 0; +#X connect 30 0 41 0; +#X connect 31 0 29 0; +#X connect 32 0 33 0; +#X connect 33 0 20 0; +#X connect 34 0 35 0; +#X connect 35 0 28 0; +#X connect 36 0 8 1; +#X connect 37 0 7 0; +#X connect 38 0 37 1; +#X connect 39 0 38 0; +#X connect 40 0 37 2; +#X connect 41 0 26 0; +#X connect 42 0 41 1; +#X connect 43 0 31 0; +#X connect 43 1 22 0; +#X connect 43 2 39 0; +#X connect 43 3 40 0; +#X connect 43 4 36 0; +#X connect 43 5 42 0; +#X connect 44 0 45 0; +#X connect 46 0 44 0; +#X connect 47 0 46 0; +#X connect 48 0 46 0; +#X connect 49 0 46 0; +#X connect 50 0 51 0; +#X connect 50 1 52 0; +#X connect 50 2 53 0; +#X connect 50 3 54 0; +#X connect 50 4 55 0; +#X connect 50 5 56 0; +#X connect 50 6 57 0; +#X connect 50 7 58 0; +#X connect 50 8 59 0; +#X connect 50 9 60 0; +#X connect 50 10 61 0; +#X connect 50 11 62 0; +#X connect 50 12 63 0; +#X connect 50 13 64 0; +#X connect 50 14 65 0; +#X connect 50 15 66 0; +#X connect 50 16 67 0; +#X connect 50 17 68 0; +#X connect 50 18 69 0; +#X connect 50 19 70 0; +#X connect 50 20 71 0; +#X connect 50 21 72 0; +#X connect 50 22 73 0; +#X connect 51 0 4 0; +#X connect 52 0 4 0; +#X connect 53 0 4 0; +#X connect 54 0 4 0; +#X connect 55 0 4 0; +#X connect 56 0 4 0; +#X connect 57 0 4 0; +#X connect 58 0 4 0; +#X connect 59 0 4 0; +#X connect 60 0 4 0; +#X connect 61 0 4 0; +#X connect 62 0 4 0; +#X connect 63 0 4 0; +#X connect 64 0 4 0; +#X connect 65 0 4 0; +#X connect 66 0 4 0; +#X connect 67 0 4 0; +#X connect 68 0 4 0; +#X connect 69 0 4 0; +#X connect 70 0 4 0; +#X connect 71 0 4 0; +#X connect 72 0 4 0; +#X connect 73 0 4 0; +#X restore 20 300 pd Dotdots; +#X obj 189 264 line~; +#X msg 189 240 \$1 100; +#X floatatom 189 177 5 0 0 0 - - - 0; +#X obj 132 310 switch~; +#X obj 132 286 tgl 19 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0 1; +#X obj 132 262 change; +#X text 89 155 switch on/off before 0 to stop startup pops, f 12; +#X obj 189 216 max 0; +#X obj 203 336 *~; +#X obj 132 238 > -0.1; +#X connect 0 0 1 0; +#X connect 1 0 17 0; +#X connect 2 0 5 0; +#X connect 3 0 7 1; +#X connect 4 0 3 0; +#X connect 5 0 6 0; +#X connect 6 0 4 0; +#X connect 7 0 8 0; +#X connect 7 1 8 1; +#X connect 9 0 7 0; +#X connect 10 0 22 0; +#X connect 10 1 11 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 13 0 2 0; +#X connect 15 0 18 0; +#X connect 17 0 14 0; +#X connect 17 1 10 0; +#X connect 17 3 19 1; +#X connect 18 0 16 0; +#X connect 19 0 9 0; +#X connect 20 0 28 0; +#X connect 20 0 28 1; +#X connect 21 0 20 0; +#X connect 22 0 27 0; +#X connect 22 0 29 0; +#X connect 24 0 23 0; +#X connect 25 0 24 0; +#X connect 27 0 21 0; +#X connect 28 0 9 1; +#X connect 29 0 25 0; diff --git a/mirrors/Mirrors.dmg b/mirrors/Mirrors.dmg new file mode 100644 index 0000000..b569f40 Binary files /dev/null and b/mirrors/Mirrors.dmg differ diff --git a/mirrors/Region.gd b/mirrors/Region.gd new file mode 100644 index 0000000..b514cb3 --- /dev/null +++ b/mirrors/Region.gd @@ -0,0 +1,25 @@ +extends Spatial + +var main = load("res://main.tscn") +var sub = load("res://osc.tscn") + +func _ready(): + # 'main' at center. + var m = main.instance() + add_child(m) + m.set_size(rand_range(0.1, 2)) + m.audible_range_max = 80 + m.set_preset(randi()%12 + 1) + m.set_gain(40) + + # many 'sub' surrounds 'main' like satellites + for i in range(25): + var s = sub.instance() + add_child(s) + s.set_preset(wrapi(i, 6, 23)) # get 6 ... 23 + s.set_size(rand_range(0.1, 1.2)) + s.set_color(Color.blue) + var d = polar2cartesian(rand_range(1, 10), rand_range(0, PI)) + s.translate(Vector3(d.x, rand_range(-5, 5), d.y)) + s.set_freq(rand_range(1, 100)) + s.set_gain(0.3) diff --git a/mirrors/Region.tscn b/mirrors/Region.tscn new file mode 100644 index 0000000..32efd0b --- /dev/null +++ b/mirrors/Region.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Region.gd" type="Script" id=1] + +[node name="Region" type="Spatial"] +script = ExtResource( 1 ) diff --git a/mirrors/WooWang.pd b/mirrors/WooWang.pd new file mode 100644 index 0000000..fc2010e --- /dev/null +++ b/mirrors/WooWang.pd @@ -0,0 +1,224 @@ +#N canvas 80 207 548 621 12; +#X obj 21 22 r fromGodot\$0; +#X obj 21 46 list trim; +#X obj 303 253 hsl 100 20 -1 1 0 0 empty empty empty -2 -10 0 12 #fcfcfc #000000 #000000 0 1; +#X obj 300 349 line~; +#X msg 300 325 \$1 100; +#X obj 300 278 expr ($f1 + 1)/8; +#X floatatom 300 302 5 0 0 0 - - - 0; +#N canvas 68 97 450 300 pan2~ 0; +#X obj 51 98 cos~; +#X obj 111 98 cos~; +#X obj 33 128 *~; +#X obj 93 128 *~; +#X obj 33 158 outlet~; +#X obj 93 158 outlet~; +#X obj 33 24 inlet~; +#X obj 111 24 inlet~; +#X obj 111 74 +~ 0.75; +#X connect 0 0 2 1; +#X connect 1 0 3 1; +#X connect 2 0 4 0; +#X connect 3 0 5 0; +#X connect 6 0 2 0; +#X connect 6 0 3 0; +#X connect 7 0 8 0; +#X connect 7 0 0 0; +#X connect 8 0 1 0; +#X restore 199 437 pd pan2~; +#X obj 199 467 dac~ 1 2; +#X obj 199 407 *~; +#X obj 189 127 unpack f f; +#X floatatom 296 159 5 0 0 0 - - - 0; +#X obj 296 182 sin; +#X floatatom 296 206 5 0 0 0 - - - 0; +#X obj 21 120 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; +#X obj 361 21 loadbang; +#X msg 361 81 \; pd dsp 1; +#X obj 21 70 route bang panvol param preset; +#X obj 361 45 del 300; +#N canvas 0 23 1014 927 Ww 0; +#X obj 542 128 inlet; +#X obj 487 678 s \$0-preset; +#X obj 542 168 sel 1 2 3 4 5 6 7 8 9 10 11 12, f 65; +#X msg 542 222 47.97 62 60 67 0.6 0.3; +#X msg 552 246 114 120 158 183 0.55 0.3; +#X msg 562 270 223 126 166 217 0.62 0.73; +#X msg 572 294 101 399 250 96.57 0.43 1.03; +#X msg 582 318 64 108 109 46 0.5 8.99; +#X msg 592 342 69 251 281 311 0.22 3.21; +#X msg 602 366 387 328 296 378 0.31 0.38; +#X msg 612 390 32 120 276.3 74 0.32 0.3; +#X msg 622 414 220 251 280 310 0.31 0.35; +#X msg 632 438 73 87 97 132 0.37 0.79; +#X msg 642 462 595.8 65.23 135 471 0.36 0.22; +#X msg 652 486 66 128 112 127 0.3 2.42; +#X obj 111 788 *~ 0.1; +#X obj 133 490 rpole~; +#X obj 133 465 rzero_rev~; +#X obj 133 539 rpole~; +#X obj 133 514 rzero_rev~; +#X obj 133 587 rpole~; +#X obj 133 562 rzero_rev~; +#X obj 133 636 rpole~; +#X obj 133 611 rzero_rev~; +#X obj 121 663 +~; +#X obj 242 399 phasor~ 0.3; +#X obj 242 426 expr~ 1 - 0.03 - 0.6*abs($v1-0.5)*abs($v1-0.5); +#X obj 29 207 -~ 0.5; +#X obj 28 251 clip~ -0.5 0.5; +#X obj 29 279 cos~; +#X obj 162 365 hip~ 5; +#X obj 29 232 *~ 3; +#X obj 28 179 phasor~ 220; +#X obj 162 202 -~ 0.5; +#X obj 162 251 clip~ -0.5 0.5; +#X obj 162 274 cos~; +#X obj 162 227 *~ 3; +#X obj 297 205 -~ 0.5; +#X obj 297 254 clip~ -0.5 0.5; +#X obj 297 277 cos~; +#X obj 297 230 *~ 3; +#X obj 432 205 -~ 0.5; +#X obj 432 254 clip~ -0.5 0.5; +#X obj 432 277 cos~; +#X obj 432 230 *~ 3; +#X obj 162 179 phasor~ 251; +#X obj 297 182 phasor~ 281; +#X obj 432 182 phasor~ 311; +#X obj 162 398 *~ 0.2; +#X floatatom 29 153 5 0 0 0 - - - 0; +#X floatatom 163 153 5 0 0 0 - - - 0; +#X floatatom 297 155 5 0 0 0 - - - 0; +#X floatatom 433 155 5 0 0 0 - - - 0; +#X obj 115 14 inlet; +#X floatatom 154 738 5 0 0 0 - - - 0; +#X obj 111 760 *~; +#X floatatom 235 151 5 0 0 0 - - - 0; +#X obj 116 40 unpack f f f f f f; +#X obj 164 13 r \$0-preset; +#X obj 111 812 outlet~; +#X connect 0 0 2 0; +#X connect 2 0 3 0; +#X connect 2 1 4 0; +#X connect 2 2 5 0; +#X connect 2 3 6 0; +#X connect 2 4 7 0; +#X connect 2 5 8 0; +#X connect 2 6 9 0; +#X connect 2 7 10 0; +#X connect 2 8 11 0; +#X connect 2 9 12 0; +#X connect 2 10 13 0; +#X connect 2 11 14 0; +#X connect 3 0 1 0; +#X connect 4 0 1 0; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 7 0 1 0; +#X connect 8 0 1 0; +#X connect 9 0 1 0; +#X connect 10 0 1 0; +#X connect 11 0 1 0; +#X connect 12 0 1 0; +#X connect 13 0 1 0; +#X connect 14 0 1 0; +#X connect 15 0 59 0; +#X connect 16 0 19 0; +#X connect 17 0 16 0; +#X connect 18 0 21 0; +#X connect 19 0 18 0; +#X connect 20 0 23 0; +#X connect 21 0 20 0; +#X connect 22 0 24 1; +#X connect 23 0 22 0; +#X connect 24 0 55 0; +#X connect 25 0 26 0; +#X connect 26 0 17 1; +#X connect 26 0 16 1; +#X connect 26 0 19 1; +#X connect 26 0 18 1; +#X connect 26 0 21 1; +#X connect 26 0 20 1; +#X connect 26 0 23 1; +#X connect 26 0 22 1; +#X connect 27 0 31 0; +#X connect 28 0 29 0; +#X connect 29 0 30 0; +#X connect 30 0 48 0; +#X connect 31 0 28 0; +#X connect 32 0 27 0; +#X connect 33 0 36 0; +#X connect 34 0 35 0; +#X connect 35 0 30 0; +#X connect 36 0 34 0; +#X connect 37 0 40 0; +#X connect 38 0 39 0; +#X connect 39 0 30 0; +#X connect 40 0 38 0; +#X connect 41 0 44 0; +#X connect 42 0 43 0; +#X connect 43 0 30 0; +#X connect 44 0 42 0; +#X connect 45 0 33 0; +#X connect 46 0 37 0; +#X connect 47 0 41 0; +#X connect 48 0 24 0; +#X connect 48 0 17 0; +#X connect 49 0 32 0; +#X connect 50 0 45 0; +#X connect 51 0 46 0; +#X connect 52 0 47 0; +#X connect 53 0 57 0; +#X connect 54 0 55 1; +#X connect 55 0 15 0; +#X connect 56 0 25 0; +#X connect 57 0 49 0; +#X connect 57 1 50 0; +#X connect 57 2 51 0; +#X connect 57 3 52 0; +#X connect 57 4 54 0; +#X connect 57 5 56 0; +#X connect 58 0 57 0; +#X restore 80 300 pd Ww; +#X obj 189 264 line~; +#X msg 189 240 \$1 100; +#X floatatom 189 177 5 0 0 0 - - - 0; +#X obj 132 310 switch~; +#X obj 132 286 tgl 19 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0 1; +#X obj 132 262 change; +#X text 89 155 switch on/off before 0 to stop startup pops, f 12; +#X obj 189 216 max 0; +#X obj 203 336 *~; +#X obj 132 238 > -0.1; +#X connect 0 0 1 0; +#X connect 1 0 17 0; +#X connect 2 0 5 0; +#X connect 3 0 7 1; +#X connect 4 0 3 0; +#X connect 5 0 6 0; +#X connect 6 0 4 0; +#X connect 7 0 8 0; +#X connect 7 1 8 1; +#X connect 9 0 7 0; +#X connect 10 0 22 0; +#X connect 10 1 11 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; +#X connect 13 0 2 0; +#X connect 15 0 18 0; +#X connect 17 0 14 0; +#X connect 17 1 10 0; +#X connect 17 3 19 1; +#X connect 18 0 16 0; +#X connect 19 0 9 0; +#X connect 20 0 28 0; +#X connect 20 0 28 1; +#X connect 21 0 20 0; +#X connect 22 0 27 0; +#X connect 22 0 29 0; +#X connect 24 0 23 0; +#X connect 25 0 24 0; +#X connect 27 0 21 0; +#X connect 28 0 9 1; +#X connect 29 0 25 0; diff --git a/mirrors/addons/gdpd/bin/gdpd.gdns b/mirrors/addons/gdpd/bin/gdpd.gdns new file mode 100644 index 0000000..869b3c3 --- /dev/null +++ b/mirrors/addons/gdpd/bin/gdpd.gdns @@ -0,0 +1,8 @@ +[gd_resource type="NativeScript" load_steps=2 format=2] + +[ext_resource path="res://addons/gdpd/bin/libgdpd.gdnlib" type="GDNativeLibrary" id=1] + +[resource] +resource_name = "gdpd" +class_name = "Gdpd" +library = ExtResource( 1 ) diff --git a/mirrors/addons/gdpd/bin/libgdpd.gdnlib b/mirrors/addons/gdpd/bin/libgdpd.gdnlib new file mode 100644 index 0000000..048e4af --- /dev/null +++ b/mirrors/addons/gdpd/bin/libgdpd.gdnlib @@ -0,0 +1,18 @@ +[general] + +singleton=false +load_once=false +symbol_prefix="godot_" +reloadable=true + +[entry] + +X11.64="res://addons/gdpd/bin/x11/libgdpd.so" +Windows.64="res://addons/gdpd/bin/win/libgdpd.dll" +OSX.64="res://addons/gdpd/bin/osx/libgdpd.dylib" + +[dependencies] + +X11.64=[ ] +Windows.64=[ ] +OSX.64=[ ] diff --git a/mirrors/addons/gdpd/bin/osx-arm64/libgdpd.dylib b/mirrors/addons/gdpd/bin/osx-arm64/libgdpd.dylib new file mode 100755 index 0000000..85e8613 Binary files /dev/null and b/mirrors/addons/gdpd/bin/osx-arm64/libgdpd.dylib differ diff --git a/mirrors/addons/gdpd/bin/osx-x86_64/libgdpd.dylib b/mirrors/addons/gdpd/bin/osx-x86_64/libgdpd.dylib new file mode 100755 index 0000000..a8021de Binary files /dev/null and b/mirrors/addons/gdpd/bin/osx-x86_64/libgdpd.dylib differ diff --git a/mirrors/addons/gdpd/bin/osx/libgdpd.dylib b/mirrors/addons/gdpd/bin/osx/libgdpd.dylib new file mode 100755 index 0000000..a8021de Binary files /dev/null and b/mirrors/addons/gdpd/bin/osx/libgdpd.dylib differ diff --git a/mirrors/assets/icon.png b/mirrors/assets/icon.png new file mode 100644 index 0000000..2b65815 Binary files /dev/null and b/mirrors/assets/icon.png differ diff --git a/mirrors/assets/levels/Game.tscn b/mirrors/assets/levels/Game.tscn new file mode 100644 index 0000000..de45746 --- /dev/null +++ b/mirrors/assets/levels/Game.tscn @@ -0,0 +1,459 @@ +[gd_scene load_steps=38 format=2] + +[ext_resource path="res://assets/scripts/OnReadyWorld.gd" type="Script" id=1] +[ext_resource path="res://assets/scenes/Player.tscn" type="PackedScene" id=2] +[ext_resource path="res://assets/shaders/BrickMaterial.material" type="Material" id=8] +[ext_resource path="res://assets/scenes/PortalPair.tscn" type="PackedScene" id=9] + +[sub_resource type="CubeMesh" id=1] +size = Vector3( 1, 2, 1.23 ) + +[sub_resource type="SpatialMaterial" id=2] +albedo_color = Color( 0.243137, 0.305882, 0.54902, 1 ) +uv1_scale = Vector3( 25, 25, 1 ) + +[sub_resource type="ConvexPolygonShape" id=3] +points = PoolVector3Array( -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1 ) + +[sub_resource type="Shader" id=16] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=17] +resource_local_to_scene = true +shader = SubResource( 16 ) + +[sub_resource type="Shader" id=18] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=19] +resource_local_to_scene = true +shader = SubResource( 18 ) + +[sub_resource type="SpatialMaterial" id=60] +albedo_color = Color( 0.415686, 0.741176, 0.282353, 1 ) + +[sub_resource type="Shader" id=20] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=21] +resource_local_to_scene = true +shader = SubResource( 20 ) + +[sub_resource type="Shader" id=22] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=23] +resource_local_to_scene = true +shader = SubResource( 22 ) + +[sub_resource type="Shader" id=24] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=25] +resource_local_to_scene = true +shader = SubResource( 24 ) + +[sub_resource type="Shader" id=26] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=27] +resource_local_to_scene = true +shader = SubResource( 26 ) + +[sub_resource type="Shader" id=28] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=29] +resource_local_to_scene = true +shader = SubResource( 28 ) + +[sub_resource type="Shader" id=30] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=31] +resource_local_to_scene = true +shader = SubResource( 30 ) + +[sub_resource type="QuadMesh" id=32] +size = Vector2( 140.08, 39.2 ) + +[sub_resource type="SpatialMaterial" id=59] +albedo_color = Color( 0.996078, 1, 0.32549, 1 ) + +[sub_resource type="ConvexPolygonShape" id=34] +points = PoolVector3Array( -56.865, -19.6, 0, -56.865, 19.6, 0, 56.865, 19.6, 0, -56.865, -19.6, 0, 56.865, 19.6, 0, 56.865, -19.6, 0 ) + +[sub_resource type="QuadMesh" id=35] +size = Vector2( 140.08, 39.2 ) + +[sub_resource type="SpatialMaterial" id=33] +albedo_color = Color( 0.615686, 0.498039, 0.941176, 1 ) +uv1_scale = Vector3( 2.5, 1, 1 ) + +[sub_resource type="QuadMesh" id=36] +size = Vector2( 116.41, 147.4 ) + +[sub_resource type="BoxShape" id=37] +extents = Vector3( 56.09, 0.01, 70.86 ) + +[sub_resource type="CubeMesh" id=47] +size = Vector3( 2, 7, 26 ) + +[sub_resource type="ConvexPolygonShape" id=48] +points = PoolVector3Array( -1, 3.5, 13, 1, 3.5, -13, 1, 3.5, 13, -1, 3.5, -13, -1, -3.5, 13, 1, -3.5, -13, 1, -3.5, 13, -1, -3.5, -13, 1, 3.5, 13, -1, 3.5, -13, 1, 3.5, -13, -1, 3.5, 13, 1, -3.5, 13, -1, -3.5, -13, 1, -3.5, -13, -1, -3.5, 13, 1, 3.5, 13, -1, -3.5, 13, -1, 3.5, 13, 1, -3.5, 13, 1, 3.5, -13, -1, -3.5, -13, -1, 3.5, -13, 1, -3.5, -13 ) + +[sub_resource type="CubeMesh" id=49] +size = Vector3( 2, 7, 26 ) + +[sub_resource type="ConvexPolygonShape" id=50] +points = PoolVector3Array( -1, 3.5, 13, 1, 3.5, -13, 1, 3.5, 13, -1, 3.5, -13, -1, -3.5, 13, 1, -3.5, -13, 1, -3.5, 13, -1, -3.5, -13, 1, 3.5, 13, -1, 3.5, -13, 1, 3.5, -13, -1, 3.5, 13, 1, -3.5, 13, -1, -3.5, -13, 1, -3.5, -13, -1, -3.5, 13, 1, 3.5, 13, -1, -3.5, 13, -1, 3.5, 13, 1, -3.5, 13, 1, 3.5, -13, -1, -3.5, -13, -1, 3.5, -13, 1, -3.5, -13 ) + +[sub_resource type="CubeMesh" id=51] +size = Vector3( 2, 7.98, 26 ) + +[sub_resource type="ConvexPolygonShape" id=52] +points = PoolVector3Array( -1, 3.99, 13, 1, 3.99, -13, 1, 3.99, 13, -1, 3.99, -13, -1, -3.99, 13, 1, -3.99, -13, 1, -3.99, 13, -1, -3.99, -13, 1, 3.99, 13, -1, 3.99, -13, 1, 3.99, -13, -1, 3.99, 13, 1, -3.99, 13, -1, -3.99, -13, 1, -3.99, -13, -1, -3.99, 13, 1, 3.99, 13, -1, -3.99, 13, -1, 3.99, 13, 1, -3.99, 13, 1, 3.99, -13, -1, -3.99, -13, -1, 3.99, -13, 1, -3.99, -13 ) + +[node name="Game" type="Spatial"] +script = ExtResource( 1 ) + +[node name="World1" type="Spatial" parent="."] + +[node name="Floor" type="MeshInstance" parent="World1"] +transform = Transform( 113.7, 0, 0, 0, 1, 0, 0, 0, 113.732, 0, 0, 0 ) +mesh = SubResource( 1 ) +material/0 = SubResource( 2 ) + +[node name="StaticBody" type="StaticBody" parent="World1/Floor"] + +[node name="CollisionShape" type="CollisionShape" parent="World1/Floor/StaticBody"] +shape = SubResource( 3 ) + +[node name="Textures" parent="World1" instance=ExtResource( 9 )] + +[node name="PortalA" parent="World1/Textures" index="0"] +transform = Transform( -1.13994, 0, -1.70777, 0, 1.18788, 0, 0.334075, 0, -5.82728, -11.0168, 4.488, -9.83145 ) + +[node name="MeshInstance" parent="World1/Textures/PortalA" index="2"] +material_override = SubResource( 17 ) + +[node name="PortalB" parent="World1/Textures" index="1"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -8.07889, 3.02662, -4.2944 ) + +[node name="MeshInstance" parent="World1/Textures/PortalB" index="2"] +visible = true +material_override = SubResource( 19 ) +material/0 = SubResource( 60 ) + +[node name="Textures2" parent="World1" instance=ExtResource( 9 )] + +[node name="PortalA" parent="World1/Textures2" index="0"] +transform = Transform( 0.985025, 0, -0.17241, 0, 1, 0, 0.822905, 0, 4.70148, 8, 4.488, 24.1383 ) + +[node name="MeshInstance" parent="World1/Textures2/PortalA" index="2"] +material_override = SubResource( 21 ) + +[node name="PortalB" parent="World1/Textures2" index="1"] +transform = Transform( -1.71379, 0, -1.49824e-07, 0, 1, 0, 8.74228e-08, 0, -1, 5.90367, 4.65802, 17.9699 ) + +[node name="MeshInstance" parent="World1/Textures2/PortalB" index="2"] +visible = true +material_override = SubResource( 23 ) + +[node name="Textures3" parent="World1" instance=ExtResource( 9 )] + +[node name="PortalA" parent="World1/Textures3" index="0"] +transform = Transform( -1.51927, 0, 1.04851, 0, 1.1786, 0, -5.07458, 0, -7.353, 26.2939, 4.488, -23.435 ) + +[node name="MeshInstance" parent="World1/Textures3/PortalA" index="2"] +material_override = SubResource( 25 ) + +[node name="PortalB" parent="World1/Textures3" index="1"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 435, 4.488, 15 ) + +[node name="MeshInstance" parent="World1/Textures3/PortalB" index="2"] +material_override = SubResource( 27 ) + +[node name="Textures4" parent="World1" instance=ExtResource( 9 )] + +[node name="PortalA" parent="World1/Textures4" index="0"] +transform = Transform( 1.05025, 0, 1.37292, 0, 4.17857, 0, -0.794601, 0, 0.607978, 29.9959, 5.79503, 19.3677 ) + +[node name="MeshInstance" parent="World1/Textures4/PortalA" index="2"] +material_override = SubResource( 29 ) + +[node name="PortalB" parent="World1/Textures4" index="1"] +transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -365, 4.488, 16.6594 ) + +[node name="MeshInstance" parent="World1/Textures4/PortalB" index="2"] +visible = true +material_override = SubResource( 31 ) + +[node name="Walls" type="Spatial" parent="World1"] + +[node name="MeshInstance" type="MeshInstance" parent="World1/Walls"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 20, -70 ) +mesh = SubResource( 32 ) +material/0 = SubResource( 59 ) + +[node name="StaticBody" type="StaticBody" parent="World1/Walls/MeshInstance"] + +[node name="CollisionShape" type="CollisionShape" parent="World1/Walls/MeshInstance/StaticBody"] +shape = SubResource( 34 ) + +[node name="MeshInstance3" type="MeshInstance" parent="World1/Walls"] +transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 20, 70 ) +mesh = SubResource( 35 ) +material/0 = SubResource( 33 ) + +[node name="StaticBody" type="StaticBody" parent="World1/Walls/MeshInstance3"] + +[node name="CollisionShape" type="CollisionShape" parent="World1/Walls/MeshInstance3/StaticBody"] +shape = SubResource( 34 ) + +[node name="MeshInstance2" type="MeshInstance" parent="World1/Walls"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -55, 20, 0 ) +mesh = SubResource( 32 ) +material/0 = SubResource( 33 ) + +[node name="StaticBody" type="StaticBody" parent="World1/Walls/MeshInstance2"] + +[node name="CollisionShape" type="CollisionShape" parent="World1/Walls/MeshInstance2/StaticBody"] +shape = SubResource( 34 ) + +[node name="MeshInstance4" type="MeshInstance" parent="World1/Walls"] +transform = Transform( 1.31134e-07, 0, -1, 0, 1, 0, 1, 0, 1.31134e-07, 56, 20, 0 ) +mesh = SubResource( 32 ) +material/0 = SubResource( 33 ) + +[node name="StaticBody" type="StaticBody" parent="World1/Walls/MeshInstance4"] + +[node name="CollisionShape" type="CollisionShape" parent="World1/Walls/MeshInstance4/StaticBody"] +shape = SubResource( 34 ) + +[node name="Ceiling" type="MeshInstance" parent="World1"] +transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.0658512, 38.1816, -0.0260773 ) +mesh = SubResource( 36 ) + +[node name="StaticBody" type="StaticBody" parent="World1/Ceiling"] +input_ray_pickable = false + +[node name="CollisionShape" type="CollisionShape" parent="World1/Ceiling/StaticBody"] +transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 ) +shape = SubResource( 37 ) + +[node name="World4" type="Spatial" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 400, 0, 0 ) + +[node name="Floor" type="MeshInstance" parent="World4"] +transform = Transform( 113.7, 0, 0, 0, 1, 0, 0, 0, 113.732, 0, 0, 0 ) +mesh = SubResource( 1 ) +material/0 = SubResource( 2 ) + +[node name="StaticBody" type="StaticBody" parent="World4/Floor"] + +[node name="CollisionShape" type="CollisionShape" parent="World4/Floor/StaticBody"] +shape = SubResource( 3 ) + +[node name="TunnelSmall" type="Spatial" parent="World4"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 27, 0, 11 ) + +[node name="MeshInstance" type="MeshInstance" parent="World4/TunnelSmall"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 4.49304, 17 ) +mesh = SubResource( 47 ) +material/0 = ExtResource( 8 ) + +[node name="StaticBody" type="StaticBody" parent="World4/TunnelSmall/MeshInstance"] + +[node name="CollisionShape" type="CollisionShape" parent="World4/TunnelSmall/MeshInstance/StaticBody"] +shape = SubResource( 48 ) + +[node name="MeshInstance2" type="MeshInstance" parent="World4/TunnelSmall"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10.9999, 4.50006, 17 ) +mesh = SubResource( 49 ) +material/0 = ExtResource( 8 ) + +[node name="StaticBody" type="StaticBody" parent="World4/TunnelSmall/MeshInstance2"] + +[node name="CollisionShape" type="CollisionShape" parent="World4/TunnelSmall/MeshInstance2/StaticBody"] +shape = SubResource( 50 ) + +[node name="MeshInstance3" type="MeshInstance" parent="World4/TunnelSmall"] +transform = Transform( -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 7.99989, 8.98167, 17 ) +mesh = SubResource( 51 ) +material/0 = ExtResource( 8 ) + +[node name="StaticBody" type="StaticBody" parent="World4/TunnelSmall/MeshInstance3"] + +[node name="CollisionShape" type="CollisionShape" parent="World4/TunnelSmall/MeshInstance3/StaticBody"] +shape = SubResource( 52 ) + +[node name="Walls4" type="Spatial" parent="World4"] + +[node name="MeshInstance" type="MeshInstance" parent="World4/Walls4"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 20, -70 ) +mesh = SubResource( 32 ) +material/0 = SubResource( 33 ) + +[node name="StaticBody" type="StaticBody" parent="World4/Walls4/MeshInstance"] + +[node name="CollisionShape" type="CollisionShape" parent="World4/Walls4/MeshInstance/StaticBody"] +shape = SubResource( 34 ) + +[node name="MeshInstance3" type="MeshInstance" parent="World4/Walls4"] +transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 20, 70 ) +mesh = SubResource( 35 ) +material/0 = SubResource( 33 ) + +[node name="StaticBody" type="StaticBody" parent="World4/Walls4/MeshInstance3"] + +[node name="CollisionShape" type="CollisionShape" parent="World4/Walls4/MeshInstance3/StaticBody"] +shape = SubResource( 34 ) + +[node name="MeshInstance2" type="MeshInstance" parent="World4/Walls4"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -55, 20, 0 ) +mesh = SubResource( 32 ) +material/0 = SubResource( 33 ) + +[node name="StaticBody" type="StaticBody" parent="World4/Walls4/MeshInstance2"] + +[node name="CollisionShape" type="CollisionShape" parent="World4/Walls4/MeshInstance2/StaticBody"] +shape = SubResource( 34 ) + +[node name="MeshInstance4" type="MeshInstance" parent="World4/Walls4"] +transform = Transform( 1.31134e-07, 0, -1, 0, 1, 0, 1, 0, 1.31134e-07, 56, 20, 0 ) +mesh = SubResource( 32 ) +material/0 = SubResource( 33 ) + +[node name="StaticBody" type="StaticBody" parent="World4/Walls4/MeshInstance4"] + +[node name="CollisionShape" type="CollisionShape" parent="World4/Walls4/MeshInstance4/StaticBody"] +shape = SubResource( 34 ) + +[node name="Player" parent="." instance=ExtResource( 2 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.52113, -40.8553 ) + +[editable path="World1/Textures"] +[editable path="World1/Textures/PortalA"] +[editable path="World1/Textures/PortalB"] +[editable path="World1/Textures2"] +[editable path="World1/Textures2/PortalA"] +[editable path="World1/Textures2/PortalB"] +[editable path="World1/Textures3"] +[editable path="World1/Textures3/PortalA"] +[editable path="World1/Textures3/PortalB"] +[editable path="World1/Textures4"] +[editable path="World1/Textures4/PortalA"] +[editable path="World1/Textures4/PortalB"] diff --git a/mirrors/assets/scenes/Player.tscn b/mirrors/assets/scenes/Player.tscn new file mode 100644 index 0000000..00dea63 --- /dev/null +++ b/mirrors/assets/scenes/Player.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://assets/scripts/Player.gd" type="Script" id=1] + +[node name="Player" type="KinematicBody"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.52113, 0.98772 ) +script = ExtResource( 1 ) + +[node name="Capsule" type="CollisionShape" parent="."] +transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 ) + +[node name="Head" type="Spatial" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0 ) + +[node name="Camera" type="Camera" parent="Head"] +far = 10000.0 diff --git a/mirrors/assets/scenes/Portal.tscn b/mirrors/assets/scenes/Portal.tscn new file mode 100644 index 0000000..38083e0 --- /dev/null +++ b/mirrors/assets/scenes/Portal.tscn @@ -0,0 +1,50 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://Region.tscn" type="PackedScene" id=1] +[ext_resource path="res://main.tscn" type="PackedScene" id=2] +[ext_resource path="res://osc.tscn" type="PackedScene" id=3] + +[sub_resource type="Shader" id=1] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=2] +resource_local_to_scene = true +shader = SubResource( 1 ) + +[sub_resource type="QuadMesh" id=3] +size = Vector2( 4, 7 ) + +[node name="Portal" type="Spatial" groups=["portals"]] + +[node name="CameraHolder" type="Spatial" parent="."] + +[node name="Viewport" type="Viewport" parent="."] + +[node name="Camera" type="Camera" parent="Viewport"] +current = true +fov = 60.0 +far = 500.0 + +[node name="MeshInstance" type="MeshInstance" parent="."] +material_override = SubResource( 2 ) +mesh = SubResource( 3 ) + +[node name="Region" parent="." instance=ExtResource( 1 )] + +[node name="osc" parent="." instance=ExtResource( 3 )] + +[node name="main" parent="." instance=ExtResource( 2 )] diff --git a/mirrors/assets/scenes/PortalPair.tscn b/mirrors/assets/scenes/PortalPair.tscn new file mode 100644 index 0000000..0987455 --- /dev/null +++ b/mirrors/assets/scenes/PortalPair.tscn @@ -0,0 +1,76 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://assets/scripts/PortalPair.gd" type="Script" id=1] +[ext_resource path="res://assets/scenes/Portal.tscn" type="PackedScene" id=2] + +[sub_resource type="Shader" id=1] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=2] +resource_local_to_scene = true +shader = SubResource( 1 ) + +[sub_resource type="Shader" id=3] +resource_local_to_scene = true +code = "shader_type spatial; +render_mode unshaded; +uniform sampler2D texture_albedo : hint_albedo; + +void vertex() { +} + +void fragment() { + vec2 base_uv = SCREEN_UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + ALBEDO = albedo_tex.rgb; + ALBEDO = pow(ALBEDO, vec3(2.2)); +} +" + +[sub_resource type="ShaderMaterial" id=4] +resource_local_to_scene = true +shader = SubResource( 3 ) + +[sub_resource type="QuadMesh" id=5] +size = Vector2( 0, 0 ) + +[node name="PortalPair" type="Node"] +script = ExtResource( 1 ) + +[node name="PortalA" parent="." instance=ExtResource( 2 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 0 ) + +[node name="Camera" parent="PortalA/Viewport" index="0"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 0 ) + +[node name="MeshInstance" parent="PortalA" index="2"] +material_override = SubResource( 2 ) + +[node name="PortalB" parent="." instance=ExtResource( 2 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4.41454, 0.27, -0.192314 ) + +[node name="Camera" parent="PortalB/Viewport" index="0"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0 ) + +[node name="MeshInstance" parent="PortalB" index="2"] +transform = Transform( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) +visible = false +material_override = SubResource( 4 ) +mesh = SubResource( 5 ) + +[editable path="PortalA"] +[editable path="PortalB"] diff --git a/mirrors/assets/scripts/OnReadyWorld.gd b/mirrors/assets/scripts/OnReadyWorld.gd new file mode 100644 index 0000000..cf33e0c --- /dev/null +++ b/mirrors/assets/scripts/OnReadyWorld.gd @@ -0,0 +1,37 @@ +extends Spatial + +var mouse_captured : bool = false + +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + mouse_captured = true + OS.set_window_title("Mirrors") + var portals = get_tree().get_nodes_in_group("portals") + for p in portals: + var o = p.get_node('osc') + var pre = ceil(rand_range(0, 23)) + o.set_preset(pre) + +func _process(delta): + var current_res = OS.get_screen_size() + ProjectSettings.set("display/window/size/width", current_res.x) + ProjectSettings.set("display/window/size/height", current_res.y) + + if Input.is_action_just_released("reload_scene"): + get_tree().reload_current_scene() + + if Input.is_action_just_released("fullscreen_toggle"): + OS.window_fullscreen = !OS.window_fullscreen + if !OS.window_fullscreen: + OS.window_maximized = true + + if Input.is_action_just_released("toggle_help"): + $ControlsUI.visible = !$ControlsUI.visible + + if Input.is_action_just_pressed("mouse_toggle"): + if mouse_captured: + mouse_captured = false + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + else: + mouse_captured = true + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) diff --git a/mirrors/assets/scripts/Player.gd b/mirrors/assets/scripts/Player.gd new file mode 100644 index 0000000..6b57097 --- /dev/null +++ b/mirrors/assets/scripts/Player.gd @@ -0,0 +1,75 @@ +extends KinematicBody + +var camera_angle = 0 +var mouse_sensitivity = 0.07 +var camera_change = Vector2() + +var velocity = Vector3() +var direction = Vector3() + +#fly variables +const FLY_SPEED = 10 +const FLY_ACCEL = 4 + +var mouse_captured = true + +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + +func _physics_process(delta): + + if mouse_captured: + aim() + fly(delta) + # emit signal - playerinfo_updated + Events.emit_signal("player_transform_updated", $Head/Camera.get_global_translation(), $Head.global_rotation.y) + + if Input.is_action_just_pressed('toggle_mouse'): + if mouse_captured: + mouse_captured = false + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + else: + mouse_captured = true + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + +func _input(event): + if event is InputEventMouseMotion: + camera_change = event.relative + +func fly(delta): + # reset the direction of the player + direction = Vector3() + + # get the rotation of the camera + var aim = $Head/Camera.get_global_transform().basis + + # check input and change direction + if Input.is_action_pressed("move_fd"): + direction -= aim.z + if Input.is_action_pressed("move_bk"): + direction += aim.z + if Input.is_action_pressed("move_left"): + direction -= aim.x + if Input.is_action_pressed("move_right"): + direction += aim.x + + direction = direction.normalized() + + # where would the player go at max speed + var target = direction * FLY_SPEED + + # calculate a portion of the distance to go + velocity = velocity.linear_interpolate(target, FLY_ACCEL * delta) + + # move + move_and_slide(velocity) + +func aim(): + if camera_change.length() > 0: + $Head.rotate_y(deg2rad(-camera_change.x * mouse_sensitivity)) + + var change = -camera_change.y * mouse_sensitivity + if change + camera_angle < 90 and change + camera_angle > -90: + $Head/Camera.rotate_x(deg2rad(change)) + camera_angle += change + camera_change = Vector2() diff --git a/mirrors/assets/scripts/PlayerAlt.gd b/mirrors/assets/scripts/PlayerAlt.gd new file mode 100644 index 0000000..3a5c148 --- /dev/null +++ b/mirrors/assets/scripts/PlayerAlt.gd @@ -0,0 +1,78 @@ +extends KinematicBody + +var camera_angle = 0 +var mouse_sensitivity = 0.3 +var camera_change = Vector2() + +var velocity = Vector3() +var direction = Vector3() + +#fly variables +const FLY_SPEED = 20 +const FLY_ACCEL = 4 + +var mouse_captured = true + +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + +func _physics_process(delta): + + if mouse_captured: + aim() + fly(delta) + # emit signal - playerinfo_updated + var tf = $Head/Camera.get_global_transform_interpolated() + if tf != Events.player_tf_old: + Events.emit_signal("player_transform_updated", $Head/Camera.get_global_translation(), $Head.global_rotation.y) + Events.player_tf_old = tf + + if Input.is_action_just_pressed('toggle_mouse'): + if mouse_captured: + mouse_captured = false + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + else: + mouse_captured = true + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + +func _input(event): + if event is InputEventMouseMotion: + camera_change = event.relative + +func fly(delta): + # reset the direction of the player + direction = Vector3() + + # get the rotation of the camera + var aim = $Head/Camera.get_global_transform().basis + + # check input and change direction + if Input.is_action_pressed("move_forward"): + direction -= aim.z + if Input.is_action_pressed("move_backward"): + direction += aim.z + if Input.is_action_pressed("move_left"): + direction -= aim.x + if Input.is_action_pressed("move_right"): + direction += aim.x + + direction = direction.normalized() + + # where would the player go at max speed + var target = direction * FLY_SPEED + + # calculate a portion of the distance to go + velocity = velocity.linear_interpolate(target, FLY_ACCEL * delta) + + # move + move_and_slide(velocity) + +func aim(): + if camera_change.length() > 0: + $Head.rotate_y(deg2rad(-camera_change.x * mouse_sensitivity)) + + var change = -camera_change.y * mouse_sensitivity + if change + camera_angle < 90 and change + camera_angle > -90: + $Head/Camera.rotate_x(deg2rad(change)) + camera_angle += change + camera_change = Vector2() diff --git a/mirrors/assets/scripts/PortalPair.gd b/mirrors/assets/scripts/PortalPair.gd new file mode 100644 index 0000000..af21ca7 --- /dev/null +++ b/mirrors/assets/scripts/PortalPair.gd @@ -0,0 +1,51 @@ +extends Node + +onready var portals := [$PortalA, $PortalB] +onready var links := { + $PortalA: $PortalB, + $PortalB: $PortalA, +} + +func init_portal(portal: Node) -> void: + # Connect the mesh material shader to the viewport of the linked portal + var linked: Node = links[portal] + var link_viewport: Viewport = linked.get_node("Viewport") + var tex := link_viewport.get_texture() + var mat = portal.get_node("MeshInstance").material_override + mat.set_shader_param("texture_albedo", tex) + +# Init portals +func _ready() -> void: + for portal in portals: + init_portal(portal) + +func get_camera() -> Camera: + return get_viewport().get_camera() + +# Move the camera to a location near the linked portal; this is done by +# taking the position of the player relative to the linked portal, and +# rotating it pi radians +func move_camera(portal: Node) -> void: + var linked: Node = links[portal] + var trans: Transform = linked.global_transform.inverse() \ + * get_camera().global_transform + var up := Vector3(0, 1, 0) + trans = trans.rotated(up, PI) + portal.get_node("CameraHolder").transform = trans + var cam_pos: Transform = portal.get_node("CameraHolder").global_transform + portal.get_node("Viewport/Camera").global_transform = cam_pos + +# Sync the viewport size with the window size +func sync_viewport(portal: Node) -> void: + portal.get_node("Viewport").size = get_viewport().size + +# warning-ignore:unused_argument +func _process(delta: float) -> void: + for portal in portals: + move_camera(portal) + sync_viewport(portal) + +# Return whether the position is in front of a portal +func in_front_of_portal(portal: Node, pos: Transform) -> bool: + var portal_pos = portal.global_transform + return portal_pos.xform_inv(pos.origin).z < 0 diff --git a/mirrors/assets/shaders/BrickMaterial.material b/mirrors/assets/shaders/BrickMaterial.material new file mode 100644 index 0000000..0563133 Binary files /dev/null and b/mirrors/assets/shaders/BrickMaterial.material differ diff --git a/mirrors/autoload/Events.gd b/mirrors/autoload/Events.gd new file mode 100644 index 0000000..b212a61 --- /dev/null +++ b/mirrors/autoload/Events.gd @@ -0,0 +1,5 @@ +extends Node + +signal player_transform_updated(position, heading) +# position : Vector3 +# heading : Vector2 (projected x-z plane, and normalized) diff --git a/mirrors/autoload/Events.tscn b/mirrors/autoload/Events.tscn new file mode 100644 index 0000000..00dabc1 --- /dev/null +++ b/mirrors/autoload/Events.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://autoload/Events.gd" type="Script" id=1] + +[node name="Events" type="Node"] +script = ExtResource( 1 ) diff --git a/mirrors/autoload/Global.gd b/mirrors/autoload/Global.gd new file mode 100644 index 0000000..c971dfb --- /dev/null +++ b/mirrors/autoload/Global.gd @@ -0,0 +1,93 @@ +extends Node + + +#gdpd (pd interface with godot) +var _gdpd +var _patches = [] + +export (bool) var _enable_gui = false +export (String) var _gui_path = "/Applications/Pd-0.53-1.app/Contents/Resources" +export (bool) var _verbose = false +export (int) var _sample_rate = 48000 +export (int) var _blocksize = 256 + +func _ready(): + _gdpd = load("res://addons/gdpd/bin/gdpd.gdns").new() + if _enable_gui: + # set gui path to activate gui window (otherwise, nogui) + _gdpd.set_gui_path(_gui_path) + _gdpd.set_volume(1) # by default, volume(gain) == 0 + _gdpd.set_verbose(_verbose) # by default, suppress 'print' + _gdpd.init(0, 2, _sample_rate, _blocksize) + _gdpd.computeAudio(true) # [; pd dsp 1 ( + _gdpd.subscribe("toGodot") + # delayed 'stream start' to prevent start-up 'pop' noise. + yield(get_tree().create_timer(0.3), "timeout") + _gdpd.streamstart() + +func _exit_tree(): + if _patches.size() != 0: + print() + print("! ======== * purging leftover opened patches ... * ======== !") + print() + for id in _patches: + _gdpd.closePatch(id) + _patches.clear() + _gdpd.stop() + +func load_patch(pd_patch) -> int: + #the patch path should be the absolute one + #separate file name from directory + var patch_name = pd_patch.split("/")[-1] + var patch_dir = pd_patch.trim_suffix(patch_name) + var id = _gdpd.openPatch(patch_name, patch_dir) + _patches.append(id) + return id + +func close_patch(id): + if id in _patches: + _gdpd.closePatch(id) + _patches.erase(id) + +func _process(_delta) : + while _gdpd.has_message(): + var msg = _gdpd.get_next() + print(msg) +# if msg[0] == "random": +# print("r") + + + + + +# ==== archived. ==== + + + # duplicate "res://" into 'user://' ==> we need godot 4 for this approach.. +# _copydirectory_recursive("res://", "user://") + + +## copy directory recursively ==> we need godot 4 for this approach.. +#func _copydirectory_recursive(src, dst): +# var dotfolders = RegEx.new() +# dotfolders.compile("^\\.\\w*") +# var pdfiles = RegEx.new() +# pdfiles.compile("\\w+\\.pd$") +# var dir = Directory.new() +# if dir.open(src) == OK: +# dir.list_dir_begin() +# var file_name = dir.get_next() +# while file_name != "": +# if dir.current_is_dir(): +# print("Found directory: " + file_name) +# if not dotfolders.search(file_name): +# dir.make_dir(dst + "/" + file_name) +# _copydirectory_recursive(dir.get_current_dir() + "/" + file_name, dst + "/" + file_name) +# else: +# if pdfiles.search(file_name): +# print("Found puredata file: " + file_name) +# dir.copy(src + "/" + file_name, dst + "/" + file_name) +# +# file_name = dir.get_next() +# else: +# print("An error occurred when trying to access the path. : " + src) diff --git a/mirrors/autoload/Global.tscn b/mirrors/autoload/Global.tscn new file mode 100644 index 0000000..a00373d --- /dev/null +++ b/mirrors/autoload/Global.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://autoload/Global.gd" type="Script" id=1] + +[node name="Global" type="Node"] +script = ExtResource( 1 ) diff --git a/mirrors/default_env.tres b/mirrors/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/mirrors/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/mirrors/export_presets.cfg b/mirrors/export_presets.cfg new file mode 100644 index 0000000..c4ba098 --- /dev/null +++ b/mirrors/export_presets.cfg @@ -0,0 +1,73 @@ +[preset.0] + +name="Mac OSX" +platform="Mac OSX" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="./Mirrors.dmg" +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +application/name="" +application/info="Made with Godot Engine" +application/icon="" +application/identifier="org.sandreceive.mirrors" +application/signature="" +application/app_category="Games" +application/short_version="1.0" +application/version="1.0" +application/copyright="" +display/high_res=false +privacy/microphone_usage_description="" +privacy/camera_usage_description="" +privacy/location_usage_description="" +privacy/address_book_usage_description="" +privacy/calendar_usage_description="" +privacy/photos_library_usage_description="" +privacy/desktop_folder_usage_description="" +privacy/documents_folder_usage_description="" +privacy/downloads_folder_usage_description="" +privacy/network_volumes_usage_description="" +privacy/removable_volumes_usage_description="" +codesign/enable=true +codesign/identity="" +codesign/timestamp=false +codesign/hardened_runtime=false +codesign/replace_existing_signature=true +codesign/entitlements/custom_file="" +codesign/entitlements/allow_jit_code_execution=false +codesign/entitlements/allow_unsigned_executable_memory=false +codesign/entitlements/allow_dyld_environment_variables=false +codesign/entitlements/disable_library_validation=true +codesign/entitlements/audio_input=false +codesign/entitlements/camera=false +codesign/entitlements/location=false +codesign/entitlements/address_book=false +codesign/entitlements/calendars=false +codesign/entitlements/photos_library=false +codesign/entitlements/apple_events=false +codesign/entitlements/debugging=false +codesign/entitlements/app_sandbox/enabled=false +codesign/entitlements/app_sandbox/network_server=false +codesign/entitlements/app_sandbox/network_client=false +codesign/entitlements/app_sandbox/device_usb=false +codesign/entitlements/app_sandbox/device_bluetooth=false +codesign/entitlements/app_sandbox/files_downloads=0 +codesign/entitlements/app_sandbox/files_pictures=0 +codesign/entitlements/app_sandbox/files_music=0 +codesign/entitlements/app_sandbox/files_movies=0 +codesign/custom_options=PoolStringArray( ) +notarization/enable=false +notarization/apple_id_name="" +notarization/apple_id_password="" +notarization/apple_team_id="" +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false diff --git a/mirrors/icon.png b/mirrors/icon.png new file mode 100644 index 0000000..bc9b06a Binary files /dev/null and b/mirrors/icon.png differ diff --git a/mirrors/main.gd b/mirrors/main.gd new file mode 100644 index 0000000..6f44e13 --- /dev/null +++ b/mirrors/main.gd @@ -0,0 +1,95 @@ +extends RigidBody + +export (String, MULTILINE) var patch = "" +export (float, 0, 100) var audible_range_max = 10.0 +export (float, 1, 12) var preset = 0 + +var _my_patch = "res://WooWang.pd" +var _my_id = 0 + +func set_size(size): + $CollisionShape.shape.radius = size + $MeshInstance.mesh.radius = size + $MeshInstance.mesh.height = size * 2 + +func set_freq(freq): + Global._gdpd.start_message(2) + Global._gdpd.add_symbol('freq') + Global._gdpd.add_float(freq) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + +func set_gain(gain): + Global._gdpd.start_message(2) + Global._gdpd.add_symbol('gain') + Global._gdpd.add_float(gain) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + +func set_param(param): + Global._gdpd.start_message(param.size()+1) + Global._gdpd.add_symbol("param") + for i in range(param.size()): + Global._gdpd.add_float(param[i]) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + +func set_preset(prs): + preset = prs + Global._gdpd.start_message(2) + Global._gdpd.add_symbol("preset") + Global._gdpd.add_float(prs) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + +func set_color(color): + $MeshInstance.material_override = SpatialMaterial.new() + $MeshInstance.material_override.albedo_color = color + +func _ready(): + # save patch (for export) +# _save_patch() + + # load patch + _my_id = Global.load_patch(ProjectSettings.globalize_path(_my_patch)) + + # listen 'player_transform_updated' event + Events.connect("player_transform_updated", self, "_on_Events_player_transform_updated") + + # send 'preset' +# set_preset(preset) + +func _on_Events_player_transform_updated(playerpos, playerheading): + var mypos = get_global_translation() + var mypos2d = Vector2(mypos.x, mypos.z) + var playerpos2d = Vector2(playerpos.x, playerpos.z) + # calculate distance + var distance = mypos.distance_to(playerpos) + # calculate angle + var angle = fmod(fmod(playerpos2d.angle_to_point(mypos2d) + playerheading - PI/2, PI*2) + PI*2, PI*2) + if angle > PI: + angle = angle - PI*2 + # (check) +# print(str(_my_id) +" : ("+ str(distance) +","+ str(angle) +")") + # calculate gain + var gain = 1 - distance/audible_range_max + # send to the patch + Global._gdpd.start_message(3) + Global._gdpd.add_symbol("panvol") + Global._gdpd.add_float(gain) + Global._gdpd.add_float(angle) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + + +func _exit_tree(): + Global.close_patch(_my_id) + pass + +#func _save_patch(): +# # save patch +# # prepare directory +# var patch_name = _my_patch.split("/")[-1] +# var patch_dir = _my_patch.trim_suffix(patch_name) +# var dir = Directory.new() +# dir.make_dir_recursive(patch_dir) +# # save to file +# var file = File.new() +# file.open(_my_patch, File.WRITE) +# file.store_string(patch) +# file.close() diff --git a/mirrors/main.pd b/mirrors/main.pd new file mode 100644 index 0000000..ef404f7 --- /dev/null +++ b/mirrors/main.pd @@ -0,0 +1,83 @@ +#N canvas 647 210 456 518 12; +#X obj 361 21 loadbang; +#X msg 361 51 \; pd dsp 1; +#X floatatom 21 198 5 0 0 0 - - - 0; +#X obj 21 22 r fromGodot\$0; +#X obj 21 46 list trim; +#X obj 303 253 hsl 100 20 -1 1 0 0 empty empty empty -2 -10 0 12 #fcfcfc #000000 #000000 0 1; +#X obj 300 349 line~; +#X msg 300 325 \$1 100; +#X obj 300 278 expr ($f1 + 1)/8; +#X floatatom 300 302 5 0 0 0 - - - 0; +#N canvas 68 97 450 300 pan2~ 0; +#X obj 51 98 cos~; +#X obj 111 98 cos~; +#X obj 33 128 *~; +#X obj 93 128 *~; +#X obj 33 158 outlet~; +#X obj 93 158 outlet~; +#X obj 33 24 inlet~; +#X obj 111 24 inlet~; +#X obj 111 74 +~ 0.75; +#X connect 0 0 2 1; +#X connect 1 0 3 1; +#X connect 2 0 4 0; +#X connect 3 0 5 0; +#X connect 6 0 2 0; +#X connect 6 0 3 0; +#X connect 7 0 8 0; +#X connect 7 0 0 0; +#X connect 8 0 1 0; +#X restore 199 437 pd pan2~; +#X obj 199 467 dac~ 1 2; +#X obj 199 407 *~; +#X obj 189 127 unpack f f; +#X floatatom 296 159 5 0 0 0 - - - 0; +#X obj 296 182 sin; +#X floatatom 296 206 5 0 0 0 - - - 0; +#X obj 21 256 noise~; +#X obj 21 286 bp~ 500 1000; +#X obj 21 70 route freq gain panvol; +#X obj 21 316 *~; +#X obj 189 264 line~; +#X msg 189 240 \$1 100; +#X floatatom 189 177 5 0 0 0 - - - 0; +#X obj 132 310 switch~; +#X obj 132 286 tgl 19 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000 0 1; +#X obj 132 262 change; +#X text 89 155 switch on/off before 0 to stop startup pops, f 12; +#X obj 189 216 max 0; +#X obj 203 336 *~; +#X obj 132 238 > -0.1; +#X connect 2 0 18 1; +#X connect 3 0 4 0; +#X connect 4 0 19 0; +#X connect 5 0 8 0; +#X connect 6 0 10 1; +#X connect 7 0 6 0; +#X connect 8 0 9 0; +#X connect 9 0 7 0; +#X connect 10 0 11 0; +#X connect 10 1 11 1; +#X connect 12 0 10 0; +#X connect 13 0 23 0; +#X connect 13 1 14 0; +#X connect 14 0 15 0; +#X connect 15 0 16 0; +#X connect 16 0 5 0; +#X connect 17 0 18 0; +#X connect 18 0 20 0; +#X connect 19 0 2 0; +#X connect 19 1 20 1; +#X connect 19 2 13 0; +#X connect 20 0 12 0; +#X connect 21 0 29 0; +#X connect 21 0 29 1; +#X connect 22 0 21 0; +#X connect 23 0 28 0; +#X connect 23 0 30 0; +#X connect 25 0 24 0; +#X connect 26 0 25 0; +#X connect 28 0 22 0; +#X connect 29 0 12 1; +#X connect 30 0 26 0; diff --git a/mirrors/main.tscn b/mirrors/main.tscn new file mode 100644 index 0000000..8e07e9d --- /dev/null +++ b/mirrors/main.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://main.gd" type="Script" id=1] + +[sub_resource type="PhysicsMaterial" id=3] + +[sub_resource type="SphereShape" id=1] + +[sub_resource type="SphereMesh" id=2] +resource_local_to_scene = true + +[sub_resource type="SpatialMaterial" id=6] +albedo_color = Color( 0.101961, 0.027451, 1, 1 ) + +[node name="main" type="RigidBody" groups=["sounders"]] +collision_layer = 4 +collision_mask = 0 +physics_material_override = SubResource( 3 ) +gravity_scale = 0.0 +script = ExtResource( 1 ) + +[node name="CollisionShape" type="CollisionShape" parent="."] +shape = SubResource( 1 ) + +[node name="MeshInstance" type="MeshInstance" parent="."] +mesh = SubResource( 2 ) +material/0 = SubResource( 6 ) diff --git a/mirrors/osc.gd b/mirrors/osc.gd new file mode 100644 index 0000000..e6d7793 --- /dev/null +++ b/mirrors/osc.gd @@ -0,0 +1,96 @@ +extends RigidBody + +export (String, MULTILINE) var patch = "" +export (float, 0, 100) var audible_range_max = 10.0 +export (float, 1, 23) var preset = 1 + +var _my_patch = "res://Dotdots.pd" +var _my_id = 0 + +func set_size(size): + $CollisionShape.shape.radius = size + $MeshInstance.mesh.radius = size + $MeshInstance.mesh.height = size * 2 + +func set_freq(freq): + Global._gdpd.start_message(2) + Global._gdpd.add_symbol('freq') + Global._gdpd.add_float(freq) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + +func set_gain(gain): + Global._gdpd.start_message(2) + Global._gdpd.add_symbol('gain') + Global._gdpd.add_float(gain) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + +func set_param(param): + Global._gdpd.start_message(param.size()+1) + Global._gdpd.add_symbol("param") + for i in range(param.size()): + Global._gdpd.add_float(param[i]) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + +func set_preset(prs): + preset = prs + Global._gdpd.start_message(2) + Global._gdpd.add_symbol("preset") + Global._gdpd.add_float(prs) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + +func set_color(color): + $MeshInstance.material_override = SpatialMaterial.new() + $MeshInstance.material_override.albedo_color = color + +func _ready(): + # save patch (for export) +# _save_patch() + + # load patch + _my_id = Global.load_patch(ProjectSettings.globalize_path(_my_patch)) + + # listen 'player_transform_updated' event + Events.connect("player_transform_updated", self, "_on_Events_player_transform_updated") + + # send 'preset' +# set_preset(preset) + set_preset(ceil(rand_range(0, 23))) + +func _on_Events_player_transform_updated(playerpos, playerheading): + var mypos = get_global_translation() + var mypos2d = Vector2(mypos.x, mypos.z) + var playerpos2d = Vector2(playerpos.x, playerpos.z) + # calculate distance + var distance = mypos.distance_to(playerpos) + # calculate angle + var angle = fmod(fmod(playerpos2d.angle_to_point(mypos2d) + playerheading - PI/2, PI*2) + PI*2, PI*2) + if angle > PI: + angle = angle - PI*2 + # (check) +# print(str(_my_id) +" : ("+ str(distance) +","+ str(angle) +")") + # calculate gain + var gain = 1 - distance/audible_range_max + # send to the patch + Global._gdpd.start_message(3) + Global._gdpd.add_symbol("panvol") + Global._gdpd.add_float(gain) + Global._gdpd.add_float(angle) + Global._gdpd.finish_list("fromGodot" + String(_my_id)) + + +func _exit_tree(): + Global.close_patch(_my_id) + pass + +#func _save_patch(): +# # save patch +# # prepare directory +# var patch_name = _my_patch.split("/")[-1] +# var patch_dir = _my_patch.trim_suffix(patch_name) +# var dir = Directory.new() +# dir.make_dir_recursive(patch_dir) +# # save to file +# var file = File.new() +# file.open(_my_patch, File.WRITE) +# file.store_string(patch) +# file.close() diff --git a/mirrors/osc.tscn b/mirrors/osc.tscn new file mode 100644 index 0000000..45c2780 --- /dev/null +++ b/mirrors/osc.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://osc.gd" type="Script" id=1] + +[sub_resource type="PhysicsMaterial" id=3] + +[sub_resource type="SphereShape" id=1] + +[sub_resource type="SphereMesh" id=2] +resource_local_to_scene = true + +[node name="osc" type="RigidBody" groups=["sounders"]] +collision_layer = 4 +collision_mask = 0 +physics_material_override = SubResource( 3 ) +gravity_scale = 0.0 +script = ExtResource( 1 ) + +[node name="CollisionShape" type="CollisionShape" parent="."] +shape = SubResource( 1 ) + +[node name="MeshInstance" type="MeshInstance" parent="."] +mesh = SubResource( 2 ) diff --git a/mirrors/project.godot b/mirrors/project.godot new file mode 100644 index 0000000..fdf0604 --- /dev/null +++ b/mirrors/project.godot @@ -0,0 +1,130 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +_global_script_classes=[ ] +_global_script_class_icons={ +} + +[application] + +config/name="Mirrors" +run/main_scene="res://assets/levels/Game.tscn" +config/icon="res://icon.png" + +[autoload] + +Events="*res://autoload/Events.tscn" +Global="*res://autoload/Global.tscn" + +[input] + +ui_left={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) + ] +} +ui_right={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null) + ] +} +ui_up={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) + ] +} +ui_down={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) + ] +} +move_fd={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +move_bk={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +move_left={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +move_right={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +jump={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +use={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +FlyCheat={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":true,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":51,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +fullscreen_toggle={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":true,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +add={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777349,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +sub={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777347,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +reset_speed={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777345,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +reload_scene={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +toggle_help={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777244,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +toggle_mouse={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +mouse_toggle={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":74,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +}