planetoids generation, bullets and movement update
This commit is contained in:
parent
bdaaac6577
commit
de7f1f637c
14597
cw 7/models/CraneoOBJ.obj
Normal file
14597
cw 7/models/CraneoOBJ.obj
Normal file
File diff suppressed because it is too large
Load Diff
358
cw 7/models/estrellica.obj
Normal file
358
cw 7/models/estrellica.obj
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
# This file uses centimeters as units for non-parametric coordinates.
|
||||||
|
|
||||||
|
mtllib estrellica.mtl
|
||||||
|
g default
|
||||||
|
v 7.889562 1.150329 -2.173651
|
||||||
|
v 2.212808 1.150329 -2.230414
|
||||||
|
v 0.068023 1.150328 -7.923502
|
||||||
|
v -2.151306 1.150329 -2.254857
|
||||||
|
v -7.817406 1.150328 -2.261558
|
||||||
|
v -3.523133 1.150328 1.888122
|
||||||
|
v -4.869315 1.150328 6.987552
|
||||||
|
v -0.006854 1.150329 4.473047
|
||||||
|
v 4.838127 1.150328 7.041885
|
||||||
|
v 3.538153 1.150329 1.927652
|
||||||
|
v 0.033757 0.000000 -0.314657
|
||||||
|
v 0.035668 2.269531 -0.312831
|
||||||
|
vt 0.626409 0.064409
|
||||||
|
vt 0.548284 0.007647
|
||||||
|
vt 0.451716 0.007647
|
||||||
|
vt 0.373591 0.064409
|
||||||
|
vt 0.343750 0.156250
|
||||||
|
vt 0.373591 0.248091
|
||||||
|
vt 0.451716 0.304853
|
||||||
|
vt 0.548284 0.304853
|
||||||
|
vt 0.626409 0.248091
|
||||||
|
vt 0.656250 0.156250
|
||||||
|
vt 0.375000 0.312500
|
||||||
|
vt 0.400000 0.312500
|
||||||
|
vt 0.425000 0.312500
|
||||||
|
vt 0.450000 0.312500
|
||||||
|
vt 0.475000 0.312500
|
||||||
|
vt 0.500000 0.312500
|
||||||
|
vt 0.525000 0.312500
|
||||||
|
vt 0.550000 0.312500
|
||||||
|
vt 0.575000 0.312500
|
||||||
|
vt 0.600000 0.312500
|
||||||
|
vt 0.625000 0.312500
|
||||||
|
vt 0.500000 0.688440
|
||||||
|
vt 0.500000 0.156250
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
s off
|
||||||
|
g pCylinder1
|
||||||
|
usemtl initialShadingGroup
|
||||||
|
f 1/11/1 11/22/2 2/12/3
|
||||||
|
f 2/12/4 11/22/5 3/13/6
|
||||||
|
f 3/13/7 11/22/8 4/14/9
|
||||||
|
f 4/14/10 11/22/11 5/15/12
|
||||||
|
f 5/15/13 11/22/14 6/16/15
|
||||||
|
f 6/16/16 11/22/17 7/17/18
|
||||||
|
f 7/17/19 11/22/20 8/18/21
|
||||||
|
f 8/18/22 11/22/23 9/19/24
|
||||||
|
f 9/19/25 11/22/26 10/20/27
|
||||||
|
f 10/20/28 11/22/29 1/21/30
|
||||||
|
f 1/1/31 12/23/32 10/10/33
|
||||||
|
f 10/10/34 12/23/35 9/9/36
|
||||||
|
f 9/9/37 12/23/38 8/8/39
|
||||||
|
f 8/8/40 12/23/41 7/7/42
|
||||||
|
f 7/7/43 12/23/44 6/6/45
|
||||||
|
f 6/6/46 12/23/47 5/5/48
|
||||||
|
f 5/5/49 12/23/50 4/4/51
|
||||||
|
f 4/4/52 12/23/53 3/3/54
|
||||||
|
f 3/3/55 12/23/56 2/2/57
|
||||||
|
f 2/2/58 12/23/59 1/1/60
|
||||||
|
g default
|
||||||
|
v 7.889562 1.150329 -2.173651
|
||||||
|
v 2.212808 1.150329 -2.230414
|
||||||
|
v 0.068023 1.150328 -7.923502
|
||||||
|
v -2.151306 1.150329 -2.254857
|
||||||
|
v -7.817406 1.150328 -2.261558
|
||||||
|
v -3.523133 1.150328 1.888122
|
||||||
|
v -4.869315 1.150328 6.987552
|
||||||
|
v -0.006854 1.150329 4.473047
|
||||||
|
v 4.838127 1.150328 7.041885
|
||||||
|
v 3.538153 1.150329 1.927652
|
||||||
|
v 0.033757 0.000000 -0.314657
|
||||||
|
v 0.035668 2.269531 -0.312831
|
||||||
|
vt 0.626409 0.064409
|
||||||
|
vt 0.548284 0.007647
|
||||||
|
vt 0.451716 0.007647
|
||||||
|
vt 0.373591 0.064409
|
||||||
|
vt 0.343750 0.156250
|
||||||
|
vt 0.373591 0.248091
|
||||||
|
vt 0.451716 0.304853
|
||||||
|
vt 0.548284 0.304853
|
||||||
|
vt 0.626409 0.248091
|
||||||
|
vt 0.656250 0.156250
|
||||||
|
vt 0.375000 0.312500
|
||||||
|
vt 0.400000 0.312500
|
||||||
|
vt 0.425000 0.312500
|
||||||
|
vt 0.450000 0.312500
|
||||||
|
vt 0.475000 0.312500
|
||||||
|
vt 0.500000 0.312500
|
||||||
|
vt 0.525000 0.312500
|
||||||
|
vt 0.550000 0.312500
|
||||||
|
vt 0.575000 0.312500
|
||||||
|
vt 0.600000 0.312500
|
||||||
|
vt 0.625000 0.312500
|
||||||
|
vt 0.500000 0.688440
|
||||||
|
vt 0.500000 0.156250
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
s off
|
||||||
|
g pCylinder1
|
||||||
|
f 13/34/61 23/45/62 14/35/63
|
||||||
|
f 14/35/64 23/45/65 15/36/66
|
||||||
|
f 15/36/67 23/45/68 16/37/69
|
||||||
|
f 16/37/70 23/45/71 17/38/72
|
||||||
|
f 17/38/73 23/45/74 18/39/75
|
||||||
|
f 18/39/76 23/45/77 19/40/78
|
||||||
|
f 19/40/79 23/45/80 20/41/81
|
||||||
|
f 20/41/82 23/45/83 21/42/84
|
||||||
|
f 21/42/85 23/45/86 22/43/87
|
||||||
|
f 22/43/88 23/45/89 13/44/90
|
||||||
|
f 13/24/91 24/46/92 22/33/93
|
||||||
|
f 22/33/94 24/46/95 21/32/96
|
||||||
|
f 21/32/97 24/46/98 20/31/99
|
||||||
|
f 20/31/100 24/46/101 19/30/102
|
||||||
|
f 19/30/103 24/46/104 18/29/105
|
||||||
|
f 18/29/106 24/46/107 17/28/108
|
||||||
|
f 17/28/109 24/46/110 16/27/111
|
||||||
|
f 16/27/112 24/46/113 15/26/114
|
||||||
|
f 15/26/115 24/46/116 14/25/117
|
||||||
|
f 14/25/118 24/46/119 13/24/120
|
||||||
|
g default
|
||||||
|
v 7.889562 1.150329 -2.173651
|
||||||
|
v 2.212808 1.150329 -2.230414
|
||||||
|
v 0.068023 1.150328 -7.923502
|
||||||
|
v -2.151306 1.150329 -2.254857
|
||||||
|
v -7.817406 1.150328 -2.261558
|
||||||
|
v -3.523133 1.150328 1.888122
|
||||||
|
v -4.869315 1.150328 6.987552
|
||||||
|
v -0.006854 1.150329 4.473047
|
||||||
|
v 4.838127 1.150328 7.041885
|
||||||
|
v 3.538153 1.150329 1.927652
|
||||||
|
v 0.033757 0.000000 -0.314657
|
||||||
|
v 0.035668 2.269531 -0.312831
|
||||||
|
vt 0.626409 0.064409
|
||||||
|
vt 0.548284 0.007647
|
||||||
|
vt 0.451716 0.007647
|
||||||
|
vt 0.373591 0.064409
|
||||||
|
vt 0.343750 0.156250
|
||||||
|
vt 0.373591 0.248091
|
||||||
|
vt 0.451716 0.304853
|
||||||
|
vt 0.548284 0.304853
|
||||||
|
vt 0.626409 0.248091
|
||||||
|
vt 0.656250 0.156250
|
||||||
|
vt 0.375000 0.312500
|
||||||
|
vt 0.400000 0.312500
|
||||||
|
vt 0.425000 0.312500
|
||||||
|
vt 0.450000 0.312500
|
||||||
|
vt 0.475000 0.312500
|
||||||
|
vt 0.500000 0.312500
|
||||||
|
vt 0.525000 0.312500
|
||||||
|
vt 0.550000 0.312500
|
||||||
|
vt 0.575000 0.312500
|
||||||
|
vt 0.600000 0.312500
|
||||||
|
vt 0.625000 0.312500
|
||||||
|
vt 0.500000 0.688440
|
||||||
|
vt 0.500000 0.156250
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.005105 -0.859861 -0.510503
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn 0.365127 -0.920739 -0.137556
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn -0.360232 -0.922140 -0.141034
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn 0.000604 -0.859880 -0.510496
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.189615 -0.962051 0.196222
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn -0.358980 -0.928522 -0.094766
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn 0.120430 -0.965019 0.232884
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn -0.122414 -0.965251 0.230880
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.363409 -0.927039 -0.092374
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.188029 -0.961689 0.199495
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.183421 0.963579 0.194606
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn 0.355062 0.930476 -0.090252
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn -0.119338 0.967005 0.225079
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn 0.117452 0.966757 0.227125
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.350315 0.932055 -0.092478
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn -0.184852 0.963969 0.191293
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn 0.000591 0.866128 -0.499821
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn -0.351624 0.925964 -0.137664
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.356828 0.924447 -0.134430
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
vn 0.004998 0.866108 -0.499832
|
||||||
|
s off
|
||||||
|
g pCylinder1
|
||||||
|
f 25/57/121 35/68/122 26/58/123
|
||||||
|
f 26/58/124 35/68/125 27/59/126
|
||||||
|
f 27/59/127 35/68/128 28/60/129
|
||||||
|
f 28/60/130 35/68/131 29/61/132
|
||||||
|
f 29/61/133 35/68/134 30/62/135
|
||||||
|
f 30/62/136 35/68/137 31/63/138
|
||||||
|
f 31/63/139 35/68/140 32/64/141
|
||||||
|
f 32/64/142 35/68/143 33/65/144
|
||||||
|
f 33/65/145 35/68/146 34/66/147
|
||||||
|
f 34/66/148 35/68/149 25/67/150
|
||||||
|
f 25/47/151 36/69/152 34/56/153
|
||||||
|
f 34/56/154 36/69/155 33/55/156
|
||||||
|
f 33/55/157 36/69/158 32/54/159
|
||||||
|
f 32/54/160 36/69/161 31/53/162
|
||||||
|
f 31/53/163 36/69/164 30/52/165
|
||||||
|
f 30/52/166 36/69/167 29/51/168
|
||||||
|
f 29/51/169 36/69/170 28/50/171
|
||||||
|
f 28/50/172 36/69/173 27/49/174
|
||||||
|
f 27/49/175 36/69/176 26/48/177
|
||||||
|
f 26/48/178 36/69/179 25/47/180
|
@ -17,7 +17,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "SOIL/SOIL.h"
|
#include "SOIL/SOIL.h"
|
||||||
|
#include <chrono>
|
||||||
namespace texture {
|
namespace texture {
|
||||||
GLuint earth;
|
GLuint earth;
|
||||||
GLuint clouds;
|
GLuint clouds;
|
||||||
@ -59,22 +59,25 @@ Core::Shader_Loader shaderLoader;
|
|||||||
Core::RenderContext shipContext;
|
Core::RenderContext shipContext;
|
||||||
Core::RenderContext sphereContext;
|
Core::RenderContext sphereContext;
|
||||||
Core::RenderContext cubeContext;
|
Core::RenderContext cubeContext;
|
||||||
|
Core::RenderContext starContext;
|
||||||
glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0);
|
Core::RenderContext saberContext;
|
||||||
|
glm::vec3 cameraPos = glm::vec3(-3.f, 0, 0);
|
||||||
glm::vec3 cameraDir = glm::vec3(1.f, 0.f, 0.f);
|
glm::vec3 cameraDir = glm::vec3(1.f, 0.f, 0.f);
|
||||||
|
|
||||||
glm::vec3 spaceshipPos = glm::vec3(-4.f, 0, 0);
|
glm::vec3 spaceshipPos = glm::vec3(-3.f, 0, 0);
|
||||||
glm::vec3 spaceshipDir = glm::vec3(1.f, 0.f, 0.f);
|
glm::vec3 spaceshipDir = glm::vec3(1.f, 0.f, 0.f);
|
||||||
|
|
||||||
bool START_AS = false;
|
bool fire = false;
|
||||||
float a = 3 ;
|
float a = 3 ;
|
||||||
|
|
||||||
std::random_device rd;
|
std::random_device rd;
|
||||||
std::mt19937 gen(rd());
|
std::mt19937 gen(rd());
|
||||||
std::uniform_real_distribution<float> distribution(-0.5f, 0.5f);
|
//std::uniform_real_distribution<float> distribution(-0.5f, 0.5f);
|
||||||
std::uniform_real_distribution<float> planetoidsYDistribution(-1.f, 1.f);
|
std::uniform_real_distribution<float> radiusDistribution(-5.f, 5.f);
|
||||||
std::uniform_real_distribution<float> planetoidsScaleDistribution(0.01f, 0.05f);
|
std::uniform_real_distribution<float> planetoidsYDistribution(-3.f, 3.f);
|
||||||
float planetoidsArray[500][4];
|
std::uniform_real_distribution<float> planetoidsXDistribution(-2.f, 10.f);
|
||||||
|
std::uniform_real_distribution<float> planetoidsScaleDistribution(0.1f, 0.2f);
|
||||||
|
float planetoidsArray[400][4];
|
||||||
glm::vec3 asteroid_Calc = spaceshipDir * glm::vec3(a, a, a);
|
glm::vec3 asteroid_Calc = spaceshipDir * glm::vec3(a, a, a);
|
||||||
glm::vec3 asteroid_Pos = spaceshipPos + glm::vec3(0, a, 0) + asteroid_Calc;
|
glm::vec3 asteroid_Pos = spaceshipPos + glm::vec3(0, a, 0) + asteroid_Calc;
|
||||||
glm::vec3 distance = asteroid_Pos - spaceshipPos;
|
glm::vec3 distance = asteroid_Pos - spaceshipPos;
|
||||||
@ -84,7 +87,7 @@ double step = 0.0000001;
|
|||||||
GLuint VAO,VBO;
|
GLuint VAO,VBO;
|
||||||
float lastAsteroidTime = 0;
|
float lastAsteroidTime = 0;
|
||||||
float aspectRatio = 1.f;
|
float aspectRatio = 1.f;
|
||||||
|
glm::vec3 ammoPos;
|
||||||
unsigned int textureID;
|
unsigned int textureID;
|
||||||
|
|
||||||
float tiltAngleSide;
|
float tiltAngleSide;
|
||||||
@ -192,23 +195,50 @@ void generateAsteroids(glm::vec3 asteroid_Pos, glm::vec3 distance, double step)
|
|||||||
drawObjectTexture(sphereContext, glm::translate(asteroid_Pos) * glm::scale(glm::vec3(0.1f)), texture::moon, texture::moonNormal, texture::metalnessSphere, texture::roughnessSphere);
|
drawObjectTexture(sphereContext, glm::translate(asteroid_Pos) * glm::scale(glm::vec3(0.1f)), texture::moon, texture::moonNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
float speed = 0.03;
|
||||||
|
float starind = 50;
|
||||||
void generatePlanetoidBelt() {
|
void generatePlanetoidBelt() {
|
||||||
|
|
||||||
for (int i = 0; i < 500; ++i) {
|
|
||||||
|
|
||||||
float x = planetoidsArray[i][0];
|
for (int i = 0; i < 400; ++i) {
|
||||||
float z = planetoidsArray[i][1];
|
float z = planetoidsArray[i][0];
|
||||||
float y = planetoidsArray[i][2];
|
float y = planetoidsArray[i][1];
|
||||||
float pScale = planetoidsArray[i][3];
|
float pScale = planetoidsArray[i][2];
|
||||||
|
bool collision = false;
|
||||||
|
planetoidsArray[i][3] -= speed;
|
||||||
|
if (planetoidsArray[i][3] < -3.f) {
|
||||||
|
planetoidsArray[i][3] = 10.f;
|
||||||
|
}
|
||||||
|
float x = planetoidsArray[i][3];
|
||||||
|
for (int j = 0; j < i; ++j) {
|
||||||
|
float prevZ = planetoidsArray[j][0];
|
||||||
|
float prevY = planetoidsArray[j][1];
|
||||||
|
float prevScale = planetoidsArray[j][2];
|
||||||
|
float prevX = planetoidsArray[j][3];
|
||||||
|
|
||||||
|
float distance = std::sqrt((z - prevZ) * (z - prevZ) + (y - prevY) * (y - prevY) + (x - prevX) * (x - prevX));
|
||||||
|
|
||||||
|
float sumRadii = pScale + prevScale;
|
||||||
|
|
||||||
|
if (distance < sumRadii) {
|
||||||
|
collision = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!collision) {
|
||||||
|
if (fmod(i, starind) == 0) {
|
||||||
float time = glfwGetTime();
|
float time = glfwGetTime();
|
||||||
|
glm::mat4 modelMatrix = glm::translate(glm::vec3(x, y, z)) * glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 1.0f));
|
||||||
drawObjectTexture(sphereContext,glm::eulerAngleY(time / 5) * glm::translate(glm::vec3(x, y, z)) * glm::scale(glm::vec3(pScale)), texture::moon, texture::moonNormal, texture::metalnessSphere, texture::roughnessSphere);
|
drawObjectColor(starContext, modelMatrix * glm::eulerAngleX(time) * glm::scale(glm::vec3(0.03f)), glm::vec3(0.2,0.3,0.2));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drawObjectTexture(sphereContext, glm::translate(glm::vec3(x, y, z)) * glm::scale(glm::vec3(pScale)), texture::moon, texture::moonNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int steps = 0;
|
|
||||||
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
||||||
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
|
||||||
glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
|
glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
|
||||||
@ -219,9 +249,6 @@ glm::mat4 specshipCameraRotrationMatrix = glm::mat4({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void renderScene(GLFWwindow* window)
|
void renderScene(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
|
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
|
||||||
@ -234,19 +261,19 @@ void renderScene(GLFWwindow* window)
|
|||||||
drawObjectSkyBox(cubeContext, glm::translate(cameraPos));
|
drawObjectSkyBox(cubeContext, glm::translate(cameraPos));
|
||||||
|
|
||||||
|
|
||||||
drawObjectTexture(sphereContext, glm::scale(glm::mat4(), glm::vec3(2.0f, 2.0f, 2.0f)), texture::sun, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::scale(glm::mat4(), glm::vec3(2.0f, 2.0f, 2.0f)), texture::sun, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
|
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(8.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.3f)), texture::earth, texture::earthNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(8.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.3f)), texture::earth, texture::earthNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
drawObjectTexture(sphereContext,
|
//drawObjectTexture(sphereContext,
|
||||||
glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(8.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)), texture::moon, texture::moonNormal, texture::metalnessSphere, texture::roughnessSphere);
|
// glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(8.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)), texture::moon, texture::moonNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
|
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.15f)), texture::mercury, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::eulerAngleY(time) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.15f)), texture::mercury, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 4) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.2f)), texture::mars, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::eulerAngleY(time / 4) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.2f)), texture::mars, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 2) * glm::translate(glm::vec3(6.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.3f)), texture::venus, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::eulerAngleY(time / 2) * glm::translate(glm::vec3(6.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.3f)), texture::venus, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 50000) * glm::translate(glm::vec3(14.f, 0, 0)) * glm::eulerAngleY(time/500000) * glm::scale(glm::vec3(0.9f)), texture::jupiter, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::eulerAngleY(time / 50000) * glm::translate(glm::vec3(14.f, 0, 0)) * glm::eulerAngleY(time/500000) * glm::scale(glm::vec3(0.9f)), texture::jupiter, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 6) * glm::translate(glm::vec3(17.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.9f)), texture::saturn, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::eulerAngleY(time / 6) * glm::translate(glm::vec3(17.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.9f)), texture::saturn, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 7) * glm::translate(glm::vec3(20.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.6f)), texture::uranus, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::eulerAngleY(time / 7) * glm::translate(glm::vec3(20.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.6f)), texture::uranus, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 8) * glm::translate(glm::vec3(23.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.6f)), texture::neptune, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
//drawObjectTexture(sphereContext, glm::eulerAngleY(time / 8) * glm::translate(glm::vec3(23.f, 0, 0)) * glm::eulerAngleY(time) * glm::scale(glm::vec3(0.6f)), texture::neptune, texture::rustNormal, texture::metalnessSphere, texture::roughnessSphere);
|
||||||
|
|
||||||
|
|
||||||
spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
||||||
@ -274,30 +301,14 @@ void renderScene(GLFWwindow* window)
|
|||||||
//);
|
//);
|
||||||
|
|
||||||
generatePlanetoidBelt();
|
generatePlanetoidBelt();
|
||||||
|
lastAsteroidTime = glfwGetTime();
|
||||||
if (time - lastAsteroidTime < 5 && START_AS) { //funkcja generujaca pierwsza asteroide
|
if (fire == true){
|
||||||
step = step + 0.03;
|
ammoPos = ammoPos + glm::vec3(0.1f, 0.f, 0.f);
|
||||||
generateAsteroids(asteroid_Pos, distance, step);
|
std::cout << ammoPos.x;
|
||||||
//steps++;
|
glm::mat4 modelMatrix = glm::translate(ammoPos) * glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(0.0f, 0.0f, 0.0f));
|
||||||
//std::cout << steps << std::endl;
|
drawObjectColor(saberContext, glm::translate(ammoPos) * glm::scale(glm::vec3(0.005f)), glm::vec3(0.2, 0.3, 0.2));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
float random_x = distribution(gen);
|
|
||||||
float random_y = distribution(gen);
|
|
||||||
float random_z = distribution(gen);
|
|
||||||
//std::cout << random_x << std::endl;
|
|
||||||
glm::vec3 random_dir = glm::normalize(glm::vec3(spaceshipDir.x + random_x, spaceshipDir.y + random_y, spaceshipDir.z + random_z));
|
|
||||||
|
|
||||||
asteroid_Calc = a * random_dir;
|
|
||||||
glm::vec3 estimated_Spaceship_Pos = spaceshipPos + glm::vec3(1.f, 1.f, 1.f) * glm::normalize(spaceshipDir);
|
|
||||||
asteroid_Pos = spaceshipPos + glm::vec3(0, a / 5, 0) + asteroid_Calc;
|
|
||||||
|
|
||||||
distance = asteroid_Pos - estimated_Spaceship_Pos;
|
|
||||||
lastAsteroidTime = time;
|
|
||||||
step = 0.0001;
|
|
||||||
//std::cout << cameraDir.x << cameraDir.y << cameraDir.z << std::endl;
|
|
||||||
//steps = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
@ -339,7 +350,8 @@ void init(GLFWwindow* window)
|
|||||||
loadModelToContext("./models/sphere.obj", sphereContext);
|
loadModelToContext("./models/sphere.obj", sphereContext);
|
||||||
loadModelToContext("./models/spaceship_new.obj", shipContext);
|
loadModelToContext("./models/spaceship_new.obj", shipContext);
|
||||||
loadModelToContext("./models/cube.obj", cubeContext);
|
loadModelToContext("./models/cube.obj", cubeContext);
|
||||||
|
loadModelToContext("./models/estrellica.obj", starContext);
|
||||||
|
loadModelToContext("./models/CraneoOBJ.obj", saberContext);
|
||||||
texture::earth = Core::LoadTexture("textures/earth.png");
|
texture::earth = Core::LoadTexture("textures/earth.png");
|
||||||
texture::ship = Core::LoadTexture("textures/ship/spaceship_color.jpg");
|
texture::ship = Core::LoadTexture("textures/ship/spaceship_color.jpg");
|
||||||
texture::moon = Core::LoadTexture("textures/moon.jpg");
|
texture::moon = Core::LoadTexture("textures/moon.jpg");
|
||||||
@ -364,24 +376,20 @@ void init(GLFWwindow* window)
|
|||||||
|
|
||||||
texture::metalnessShip = Core::LoadTexture("textures/ship/spaceship_metalness.jpg");
|
texture::metalnessShip = Core::LoadTexture("textures/ship/spaceship_metalness.jpg");
|
||||||
texture::roughnessShip = Core::LoadTexture("textures/ship/spaceship_rough.jpg");
|
texture::roughnessShip = Core::LoadTexture("textures/ship/spaceship_rough.jpg");
|
||||||
|
for (int i = 0; i < 400; ++i) {
|
||||||
|
float z = radiusDistribution(gen);
|
||||||
|
float x = planetoidsXDistribution(gen);
|
||||||
|
float y = planetoidsYDistribution(gen);
|
||||||
|
float pScale = planetoidsScaleDistribution(gen);
|
||||||
|
planetoidsArray[i][0] = z;
|
||||||
|
planetoidsArray[i][1] = y;
|
||||||
|
planetoidsArray[i][2] = pScale;
|
||||||
|
planetoidsArray[i][3] = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
glGenTextures(1, &textureID);
|
glGenTextures(1, &textureID);
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
||||||
std::uniform_real_distribution<float> angleDistribution(0.0f, 2.0f * glm::pi<float>());
|
|
||||||
std::uniform_real_distribution<float> radiusDistribution(10.f, 17.f);
|
|
||||||
|
|
||||||
for (int i = 0; i < 500; ++i) {
|
|
||||||
float angle = angleDistribution(gen);
|
|
||||||
float radius = radiusDistribution(gen);
|
|
||||||
float y = planetoidsYDistribution(gen);
|
|
||||||
float pScale = planetoidsScaleDistribution(gen);
|
|
||||||
planetoidsArray[i][0] = radius * std::cos(angle);
|
|
||||||
planetoidsArray[i][1] = radius * std::sin(angle);
|
|
||||||
planetoidsArray[i][2] = y;
|
|
||||||
planetoidsArray[i][3] = pScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> filepaths = {
|
std::vector<std::string> filepaths = {
|
||||||
"textures/skybox/space_rt.png",
|
"textures/skybox/space_rt.png",
|
||||||
@ -420,29 +428,13 @@ double lastX = 0.0;
|
|||||||
double lastY = 0.0;
|
double lastY = 0.0;
|
||||||
|
|
||||||
|
|
||||||
void mouseCallback(GLFWwindow* window, double xpos, double ypos) {
|
|
||||||
|
|
||||||
double deltaX = xpos - lastX;
|
|
||||||
double deltaY = ypos - lastY;
|
|
||||||
lastX = xpos;
|
|
||||||
lastY = ypos;
|
|
||||||
//std::cout << lastY << " " << ypos << std::endl;
|
|
||||||
const float sensitivity = 0.001f;
|
|
||||||
deltaX *= sensitivity;
|
|
||||||
deltaY *= sensitivity;
|
|
||||||
glm::mat4 rotationMatrix = glm::eulerAngleY(-deltaX);
|
|
||||||
|
|
||||||
spaceshipDir = glm::normalize(rotationMatrix * glm::vec4(spaceshipDir,0));
|
|
||||||
spaceshipDir = spaceshipDir + glm::vec3(0, -deltaY / 4, 0);
|
|
||||||
|
|
||||||
/*specshipCameraRotrationMatrix = glm::rotate(specshipCameraRotrationMatrix, static_cast<float>(deltaX), glm::vec3(0.f, 1.f, 0.f));
|
|
||||||
specshipCameraRotrationMatrix = glm::rotate(specshipCameraRotrationMatrix, static_cast<float>(deltaY), spaceshipSide);
|
|
||||||
spaceshipDir = glm::normalize(glm::vec3(-specshipCameraRotrationMatrix[2]));
|
|
||||||
spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
|
||||||
spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));*/
|
|
||||||
|
|
||||||
|
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) {
|
||||||
|
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS) {
|
||||||
|
fire = true;
|
||||||
|
ammoPos = spaceshipPos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//obsluga wejscia
|
//obsluga wejscia
|
||||||
void processInput(GLFWwindow* window)
|
void processInput(GLFWwindow* window)
|
||||||
@ -450,63 +442,59 @@ void processInput(GLFWwindow* window)
|
|||||||
spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
|
||||||
spaceshipUp = glm::vec3(0.f, 1.f, 0.f);
|
spaceshipUp = glm::vec3(0.f, 1.f, 0.f);
|
||||||
float angleSpeed = 0.005f;
|
float angleSpeed = 0.005f;
|
||||||
float moveSpeed = 0.005f;
|
float moveSpeed = 0.01f;
|
||||||
|
|
||||||
double x = 0.002;
|
double x = 0.01;
|
||||||
|
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||||
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
|
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
|
||||||
glfwSetWindowShouldClose(window, true);
|
glfwSetWindowShouldClose(window, true);
|
||||||
}
|
}
|
||||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) {
|
||||||
spaceshipPos += spaceshipDir * moveSpeed;
|
spaceshipPos += glm::vec3(0.f,moveSpeed,0.f);
|
||||||
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
|
|
||||||
spaceshipPos -= spaceshipDir * moveSpeed;
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS)
|
|
||||||
spaceshipPos += spaceshipSide * moveSpeed;
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_Z) == GLFW_PRESS)
|
|
||||||
spaceshipPos -= spaceshipSide * moveSpeed;
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS){
|
|
||||||
spaceshipPos += spaceshipUp * moveSpeed;
|
|
||||||
tiltAngleUpDown -= easeInExpo(x);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (tiltAngleUpDown < 0) {
|
|
||||||
tiltAngleUpDown += 0.0005;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS){
|
|
||||||
spaceshipPos -= spaceshipUp * moveSpeed;
|
|
||||||
tiltAngleUpDown += easeInExpo(x);
|
tiltAngleUpDown += easeInExpo(x);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (tiltAngleUpDown > 0) {
|
if (tiltAngleUpDown > 0) {
|
||||||
tiltAngleUpDown -= 0.0005;
|
tiltAngleUpDown -= 0.003;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS){
|
||||||
|
spaceshipPos -= glm::vec3(0.f, moveSpeed, 0.f);
|
||||||
|
tiltAngleUpDown -= easeInExpo(x);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (tiltAngleUpDown < 0) {
|
||||||
|
tiltAngleUpDown += 0.003;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (glfwGetKey(window, GLFW_KEY_X) == GLFW_PRESS)
|
||||||
|
spaceshipPos += spaceshipSide * moveSpeed;
|
||||||
|
if (glfwGetKey(window, GLFW_KEY_Z) == GLFW_PRESS)
|
||||||
|
spaceshipPos -= spaceshipSide * moveSpeed;
|
||||||
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) {
|
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS) {
|
||||||
spaceshipDir = glm::vec3(glm::eulerAngleY(angleSpeed) * glm::vec4(spaceshipDir, 0));
|
spaceshipPos -= glm::vec3(0.f, 0.f, moveSpeed);
|
||||||
tiltAngleSide -= easeInExpo(x);
|
tiltAngleSide -= easeInExpo(x);
|
||||||
} else {
|
} else {
|
||||||
if (tiltAngleSide < 0) {
|
if (tiltAngleSide < 0) {
|
||||||
tiltAngleSide += 0.0005;
|
tiltAngleSide += 0.003;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) {
|
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) {
|
||||||
spaceshipDir = glm::vec3(glm::eulerAngleY(-angleSpeed) * glm::vec4(spaceshipDir, 0));
|
spaceshipPos += glm::vec3(0.f, 0.f, moveSpeed);
|
||||||
tiltAngleSide += easeInExpo(-x);
|
tiltAngleSide += easeInExpo(-x);
|
||||||
} else {
|
} else {
|
||||||
if (tiltAngleSide > 0) {
|
if (tiltAngleSide > 0) {
|
||||||
tiltAngleSide -= 0.0005;
|
tiltAngleSide -= 0.003;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (glfwGetKey(window, GLFW_KEY_G) == GLFW_PRESS)
|
|
||||||
START_AS = true;
|
|
||||||
|
|
||||||
glfwSetCursorPosCallback(window, mouseCallback);
|
|
||||||
|
|
||||||
cameraPos = spaceshipPos - 0.5 * spaceshipDir + glm::vec3(0, 2, 0) * 0.1f;
|
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
||||||
|
|
||||||
|
cameraPos = spaceshipPos - 0.5 * spaceshipDir+ glm::vec3(0.f,0.3,0.f);
|
||||||
cameraDir = spaceshipDir;
|
cameraDir = spaceshipDir;
|
||||||
|
|
||||||
tiltAngleSide = fmaxf(-1, fminf(1, tiltAngleSide));
|
tiltAngleSide = fmaxf(-1, fminf(1, tiltAngleSide));
|
||||||
|
Loading…
Reference in New Issue
Block a user