-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1119 lines (800 loc) · 27 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>test</title>
<style type="text/css">
::-webkit-scrollbar {
width: 10px; /* ширина для вертикального скролла */
height: 3px; /* высота для горизонтального скролла */
background-color: #000;
}
::-webkit-scrollbar-thumb {
/*background-color: gray;*/
background-color: rgb(14, 17, 33);
border-radius: 9em;
box-shadow: inset 1px 1px 10px rgb(37, 38, 52);
}
#text-about{
top: 10px;
overflow-y: scroll;
/*scrollbar-color: #458245 #714826;*/
height: 300px;
color: white;
text-align: center;
}
#more-information{
width: 200px;
}
body{
max-width: 1366;
max-height: 736;
}
.line{
font-family: 'Rajdhani-Regular', sans-serif;
align-items: center;
/*background-color: black;*/
background-color: rgb(0, 1, 13);
/* border-radius: 10px 10px; */
width: 100%;
height: 70px;
/* background-color: white;*/
}
.bar{
font-family: 'Rajdhani-Regular', sans-serif;
/*background-color: black;*/
background-color: rgb(0, 0, 10);
color: white;
/* background-color: white; */
float: right;
height: 100%;
width: 365px;
}
.bar h1{
text-align: center;
}
.planets{
position: relative;
left: 20px;
}
button, input{
text-align: center;
/*font-family: "Roboto";*/
background-color: black;
color: white;
/*border-color: blue;*/
/*border-color: rgb(94, 193, 253);*/
border-color: rgb(64, 182, 253);
margin-top: 7px;
/*margin: 1px;*/
border-radius: 3px;
width: 105px;
height: 45px;
box-shadow: 0px 0px 10px 2px rgb(0, 10, 79);
}
button:hover, input:hover{
background-color: rgb(0, 0, 9);
border-color: rgb(121, 204, 253);
box-shadow: 0px 0px 10px 2px rgb(0, 14, 108);
}
#solar{
width: 120px;
}
.languages {
margin: 2px;
/* border-color: rgb(64, 182, 253);*/
border: none;
float: right;
position: relative;
width: 50px;
height: 35px;
}
#tajik{
background-image: url(./img/tajik.png);
background-repeat: no-repeat;
background-size: 100% 100%;
}
#russian{
background-image: url(./img/russian.png);
background-repeat: no-repeat;
background-size: 100% 100%;
}
#english{
background-image: url(./img/usa.png);
background-repeat: no-repeat;
background-size: 100% 100%;
}
#english{
}
#editor{
width: 50px;
}
.modal{
/*display: none;*/
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.modal .overlay{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: black;
opacity: 0.7;
}
.modal-window{
border: solid;
color: white;
position: relative;
z-index: 2;
width: 250px;
height: 50px;
background-color: black;
border-radius: 10px;
border-color: rgb(64, 182, 253);
box-shadow: 0 10px 15px rgba(0, 0, 0, .2);
text-align: center;
padding: 200px;
}
#close{
/*border: 0;*/
color: white;
width: 50px;
}
.modal{
display: none;
}
#modal-h1{
position: relative;
top: -20px
}
.modal-text{
position: relative;
widows: 200px;
top: -100px;
}
a{
text-decoration: none;
color: white;
}
/* .bar, .line{
display: none;
}
</style>
<link rel="shortcut icon" href="./img/icon.png" type="image/x-icon">
</head>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r127/three.min.js"></script> -->
<script src="./Three_JS_Main_Lib.js"></script>
<script src="./public/llib.js"></script>
<script src="./main.js"></script>
<!--
<script src="./public/llib.js"></script>
<script src="./FirstPersonControls.js"></script>
<script src="./EffectComposer.js"></script>
<script src="./RenderPass.js"></script>
<script src="./UnrealBloomPass.js"></script> -->
<!-- <script src="./FlyControls.js"></script> -->
<script src="./OrbitControls.js"></script>
<body style="margin: 0; width: 100%; height: 100vh; background-color: #000; overflow: hidden;">
<!-- <div id="asd" style="width: 30px; position: absolute; z-index: 100; display: none;">
Замин
</div>
-->
<div class="modal">
<div class="modal-window">
<span class="modal-text">
<h1 id="modal-h1">Создатели</h1>
<span id="moddal-text">
<p id="dev-main">Разработчик: Мирзоев Парвиз</p>
<!-- <br> -->
<p id="dev-op">Dev-Ops:<a href="https://avazbekhub.github.io/#"> Авазбек Эшмуродов</a></p>
<!-- <br> -->
<p id="thank"> Благодарности: Хочу поблагодарить мою семью, отдельное благодарность радителям и моим друзьям, они очень помогли мне в обучении нового для меня инструмента.</p>
</span>
</span>
<button id="close">X</button>
</div>
<div class="overlay"></div>
</div>
<div class="line" style="">
<!-- <button id="sun">Офтоб</button> -->
<button id="solar">Главная</button>
<input type="button" value="Солнце" id="sun" onclick="">
<!-- <button id="mercury">Меркурий</button> -->
<input type="button" value="Меркурий" id="mercury" onclick="">
<button id="venera">Венера</button>
<button id="earth">Земля</button>
<button id="mars">Марс</button>
<button id="jupiter">Юпитер</button>
<button id="saturn">Сатурн</button>
<button id="uran">Уран</button>
<button id="neptun">Нептун</button>
<button class="languages" id="editor">i</button>
<button class="languages" id="english"></button>
<button class="languages" id="russian"></button>
<button class="languages" id="tajik"></button>
</div>
<div class="bar" style="">
<h1 id="title">Солнечная система</h1>
</div>
</div>
<script>
const line = document.querySelector('.line');
//import { RenderPass } from "https://threejs.org/examples/js/postprocessing/RenderPass.js";
let music = new Audio('./audio/relaxing-music-vol1-124477.mp3');
music.play();
let perem = new Audio('./audio/relaxing-music-vol1-124477.mp3')
let sunRise = false;
let anything = document.createElement('canvas');
//Moving boolean
let moving = true;
let movingMercury = true;
let movingVenera = true;
let movingEarth = true;
let movingMars = true;
let movingJupiter = true;
let movingSaturn = true;
let movingUran = true;
let movingNeptun = true;
// console.log(document.body.clientWidth);
//
// let H = window.innerHeight-80, W = window.innerWidth-350;
let H = (document.body.clientHeight)-70, W = (document.body.clientWidth)-365;
// let H = 600, W = 100;
// let H = (window.innerHeight) - 70, W = 980;
// console.log(`${window.innerHeight} \n ${window.innerWidth}`)
//Сцена и Камера
const scene = new THREE.Scene;
const camera = new THREE.PerspectiveCamera(45, W/H, 1, 10000000);
const container = document.createElement('div');
//Рендер
const render = new THREE.WebGLRenderer({
alpha: true,
antialias: true
});
render.setSize(W, H);
document.body.appendChild(container);
// render.shadowMap.enabled = true;
// render.shadowMap.type = THREE.BasicShadowMap;
let light = new THREE.PointLight(0xffffff, 1, 50000);
//light.position.set(10, 10, 50000);
// light.position = 0
//light.castSahdow = true;
light.shadow.mapSize.width = 2048;
light.shadow.mapSize.height = 2048;
light.shadow.camera.near = 0.1;
light.shadow.camera.far = 25;
scene.add(light);
window.addEventListener('resize', owWindowResize);
function owWindowResize(){
camera.aspect = ((document.body.clientWidth)-365) / ((document.body.clientHeight)-70);
camera.updateProjectionMatrix();
render.setSize(((document.body.clientWidth)-365), ((document.body.clientHeight)-70));
}
//Stars
let radius = 6371;
const r = radius, starsGeometry = [ new THREE.BufferGeometry(), new THREE.BufferGeometry() ];
const vertices1 = [];
const vertices2 = [];
const vertex = new THREE.Vector3();
for ( let i = 0; i < 2500; i ++ ) {
vertex.x = Math.random() * 2 - 1;
vertex.y = Math.random() * 2 - 1;
vertex.z = Math.random() * 2 - 1;
vertex.multiplyScalar( r );
vertices1.push( vertex.x, vertex.y, vertex.z );
}
for ( let i = 0; i < 15000; i ++ ) {
vertex.x = Math.random() * 2 - 1;
vertex.y = Math.random() * 2 - 1;
vertex.z = Math.random() * 2 - 1;
vertex.multiplyScalar( r );
vertices2.push( vertex.x, vertex.y, vertex.z );
}
starsGeometry[ 0 ].setAttribute( 'position', new THREE.Float32BufferAttribute( vertices1, 3 ) );
starsGeometry[ 1 ].setAttribute( 'position', new THREE.Float32BufferAttribute( vertices2, 3 ) );
const starsMaterials = [
new THREE.PointsMaterial( { color: 0x555555, size: 2, sizeAttenuation: false } ),
new THREE.PointsMaterial( { color: 0x555555, size: 1, sizeAttenuation: false } ),
new THREE.PointsMaterial( { color: 0x333333, size: 2, sizeAttenuation: false } ),
new THREE.PointsMaterial( { color: 0x3a3a3a, size: 1, sizeAttenuation: false } ),
new THREE.PointsMaterial( { color: 0x1a1a1a, size: 2, sizeAttenuation: false } ),
new THREE.PointsMaterial( { color: 0x1a1a1a, size: 1, sizeAttenuation: false } )
];
for ( let i = 10; i < 30; i ++ ) {
const stars = new THREE.Points( starsGeometry[ i % 2 ], starsMaterials[ i % 6 ] );
stars.rotation.x = Math.random() * 6;
stars.rotation.y = Math.random() * 6;
stars.rotation.z = Math.random() * 6;
stars.scale.setScalar( i * 10 );
stars.matrixAutoUpdate = false;
stars.updateMatrix();
scene.add( stars );
}
//\stars
let ambient = new THREE.AmbientLight(0x111111);
scene.add(ambient)
//Sun
//var sun_geom = new THREE.SphereGeometry(2300, 50, 50, 0, Math.PI * 2, 0, Math.PI * 2);
let sun_geom = new THREE.SphereGeometry(2300, 800, 800)
let texture = new THREE.TextureLoader().load(
'./img/textures/sun.jpg'
//'https://cosmos-online.ru/wp-content/uploads/2018/10/8k_sun.jpg'
//'http://xnameetingpoint.weebly.com/uploads/7/4/1/2/7412327/2399293_orig.png'
//'https://i.imgur.com/WCenSFw.jpg'
// 'https://www.filterforge.com/filters/10089.jpg'
);
texture.anisotropy = 8;
const sun_mat = new THREE.MeshBasicMaterial({
map: texture,
//emissive: 0xffffff
})
let sun = new THREE.Mesh(sun_geom, sun_mat);
const haloVertexShader = /*glsl*/`
varying vec3 vertexNormal;
void main() {
vertexNormal = normal;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`;
const haloFragmentShader = /*glsl*/`
varying vec3 vertexNormal;
void main() {
float intensity = pow(0.9 - dot(vertexNormal, vec3(0, 0, 1.0)), 2.0);
gl_FragColor = vec4(0.8, 1.0, 0.6, 0.2) * intensity;
}
`;
const halo = new THREE.Mesh(
new THREE.SphereGeometry(2300, 800, 800),
new THREE.ShaderMaterial({
vertexShader:haloVertexShader,
fragmentShader:haloFragmentShader,
blending: THREE.AdditiveBlending,
side: THREE.BackSide
})
)
halo.scale.set(1.2, 1.2, 1.2);
//scene.add(halo);
scene.add(sun);
//</Sun>
//Mercury
let mercury_geom = new THREE.SphereGeometry(40, 20, 20);
let mercury_texture = new THREE.TextureLoader().load(
//'https://phonoteka.org/uploads/posts/2022-09/thumbs/1663099480_2-phonoteka-org-p-tekstura-merkuriya-pinterest-2.jpg'
'./img/textures/mercury.jpg'
);
mercury_texture.anisotropy = 8
let mercury_mat = new THREE.MeshPhongMaterial({
map: mercury_texture,
bumpMap: THREE.ImageUtils.loadTexture('./img/textures/mercury.jpg'),
// bumpMap: THREE.ImageUtils.loadTexture('./img/textures/earth_clouds_2048.png'),
bumpScale : 3
});
let mercury = new THREE.Mesh(mercury_geom, mercury_mat);
mercury.castShadow = true;
mercury.receiveShadow = true;
scene.add(mercury);
//
//Venera
let venera_geom = new THREE.SphereGeometry(70, 20, 20);
let textureVen = new THREE.TextureLoader().load(
//'https://kartinkin.net/uploads/posts/2021-07/1627422862_21-kartinkin-com-p-tekstura-poverkhnosti-planet-krasivo-24.jpg'
'./img/textures/venera.jpg'
);
textureVen.anisotropy = 8;
let venera_mat = new THREE.MeshPhongMaterial({
map: textureVen,
bumpMap: THREE.ImageUtils.loadTexture('./img/textures/venera.jpg'),
// bumpMap: THREE.ImageUtils.loadTexture('./img/textures/earth_clouds_2048.png'),
bumpScale : 3
});
let venera = new THREE.Mesh(venera_geom, venera_mat)
venera.castShadow = true;
venera.receiveShadow = true;
scene.add(venera);
//Earth
let earth_geom = new THREE.SphereGeometry(80, 20, 30),
// earth_mat = new THREE.MeshNormalMaterial();
thisT = new THREE.TextureLoader().load(
//'https://gamerwall.pro/uploads/posts/2021-11/1637037519_5-gamerwall-pro-p-tekstura-planeti-oboi-na-zastavku-5.jpg'
// './img/textures/earth.jpg'
'./img/textures/earth_atmos_4096.jpg'
);
thisT.anisotropy = 8
earth_mat = new THREE.MeshPhongMaterial({
map: thisT,
bumpMap: THREE.ImageUtils.loadTexture('./img/textures/earth_atmos_2048.jpg'),
// bumpMap: THREE.ImageUtils.loadTexture('./img/textures/earth_clouds_2048.png'),
bumpScale : 10
})
let earth = new THREE.Mesh(earth_geom, earth_mat);
earth.position.x = 15000;
earth.castShadow = true;
earth.receiveShadow = true;
scene.add(earth);
// cloud Geometry
const cloudGeometry = new THREE.SphereGeometry(81, 32, 32);
// cloud metarial
const cloudMetarial = new THREE.MeshPhongMaterial({
map: THREE.ImageUtils.loadTexture('./img/textures/earth_clouds_2048.png'),
transparent: true,
});
// cloud mesh
const cloudMesh = new THREE.Mesh(cloudGeometry, cloudMetarial);
scene.add(cloudMesh);
// earth.add(cloudMesh)
//Moon
let moon_geom = new THREE.SphereGeometry(25, 20, 30),
moon_texture = new THREE.TextureLoader().load(
//'https://postila.ru/data/3c/d5/5e/1f/3cd55e1f677d390f3ea58756c7e660e2eb559221af021948c6db57f698265090.jpg'
'./img/textures/moon.jpg'
);
moon_texture.anisotropy = 8;
moon_mat = new THREE.MeshPhongMaterial({
//color: #ff
map: moon_texture,
bumpMap: THREE.ImageUtils.loadTexture('./img/textures/moon.jpg'),
// bumpMap: THREE.ImageUtils.loadTexture('./img/textures/earth_clouds_2048.png'),
bumpScale : 3
}),
moon = new THREE.Mesh(moon_geom, moon_mat);
scene.add(moon)
//Mars
let mars_geom = new THREE.SphereGeometry(60, 20, 30),
// mars_mat = new THREE.MeshNormalMaterial();
tex_m = new THREE.TextureLoader().load(
//'https://phonoteka.org/uploads/posts/2022-09/1663036482_2-phonoteka-org-p-tekstura-marsa-pinterest-2.jpg'
'./img/textures/mars.jpg'
);
tex_m.anisotropy = 8
mars_mat = new THREE.MeshPhongMaterial({
//emissiveMap: thisT
map: tex_m,
bumpMap: THREE.ImageUtils.loadTexture('./img/textures/mars.jpg'),
// bumpMap: THREE.ImageUtils.loadTexture('./img/textures/earth_clouds_2048.png'),
bumpScale : 5
})
let mars = new THREE.Mesh(mars_geom, mars_mat);
mars.castShadow = true;
mars.receiveShadow = true;
scene.add(mars);
//Jupiter
let jup_geom = new THREE.SphereGeometry(330, 100, 100);
let tex_j = new THREE.TextureLoader().load(
//'https://www.solarsystemscope.com/textures/download/8k_jupiter.jpg'
//'https://textures.forrest.cz/textures/library/maps/Jupiter.jpg'
'./img/textures/Jupiter.jpg'
);
tex_j.anisotropy = 8;
let jup_mat = new THREE.MeshPhongMaterial({
map: tex_j
});
let jupiter = new THREE.Mesh(jup_geom, jup_mat);
jupiter.castShadow = true;
//jupiter.receiveShadow = true;
scene.add(jupiter)
//
//Saturn
let saturn_geom = new THREE.SphereGeometry(210, 50, 50);
let tex_s = new THREE.TextureLoader().load(
//'https://www.solarsystemscope.com/textures/download/8k_saturn.jpg'
//'https://static.wikia.nocookie.net/planet-texture-maps/images/6/61/Saturn.jpg/revision/latest?cb=20190416043829'
'./img/textures/Saturn.jpg'
);
tex_s.anisotropy = 8;
let sat_mat = new THREE.MeshPhongMaterial({
map: tex_s,
//shiness: 50,
//wireframe: false
//flatShading: true
});
let saturn = new THREE.Mesh(saturn_geom, sat_mat);
saturn.castShadow = true;
saturn.receiveShadow = true;
scene.add(saturn)
let sat_ring_geom = new THREE.BufferGeometry();
let sat_ring_mat = new THREE.ParticleBasicMaterial({
color: 0x3A3A3A,
opacity: 0.3,
size:1,
sizeAttenuation: false
});
let vertices = [];
for(let i = 0; i<20000; i++){
let vertex = new THREE.Vector3();
vertex.x = Math.sin(Math.PI/360*i)*(550-i/80);
vertex.y = Math.random()*20;
vertex.z = Math.cos(Math.PI/360*i)*(550-i/80);
vertices.push(vertex.x, vertex.y, vertex.z)
}
sat_ring_geom.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3))
let ring = new THREE.Points(sat_ring_geom, sat_ring_mat);
ring.castShadow = true;
scene.add(ring)
//Uran Rings
let ur_ring_mat = new THREE.ParticleBasicMaterial({
color: 0x323232,
opacity: 0.3,
size:1,
sizeAttenuation: false
});
let ur_ring_geom = new THREE.BufferGeometry();
let vertic = [];
for(let i = 0; i<5000; i++){
let vertex = new THREE.Vector3();
vertex.x = Math.sin(Math.PI/360*i)*(350-i/80);
vertex.y = Math.random()*20;
vertex.z = Math.cos(Math.PI/360*i)*(350-i/80);
vertic.push(vertex.x, vertex.y, vertex.z)
}
ur_ring_geom.setAttribute('position', new THREE.Float32BufferAttribute(vertic, 3))
let ur_ring = new THREE.Points(ur_ring_geom, ur_ring_mat);
ur_ring.castShadow = true;
scene.add(ur_ring)
//Uran
let uran_geom = new THREE.SphereGeometry(140, 20, 20);
let tex_u = new THREE.TextureLoader().load(
//'https://kartinkin.net/uploads/posts/2021-07/1627112608_1-kartinkin-com-p-tekstura-planeti-uran-krasivo-1.jpg'
'./img/textures/uran.jpg'
);
tex_u.anisotropy = 8;
let uran_mat = new THREE.MeshPhongMaterial({
map: tex_u
});
let uran = new THREE.Mesh(uran_geom, uran_mat);
uran.castShadow = true;
uran.receiveShadow = true;
scene.add(uran)
//Neptun
let neptun_geom = new THREE.SphereGeometry(130, 20, 20);
let tex_n = new THREE.TextureLoader().load(
//'https://kartinkin.net/uploads/posts/2021-07/1627112608_1-kartinkin-com-p-tekstura-planeti-uran-krasivo-1.jpg'
//'https://upload.wikimedia.org/wikipedia/commons/1/1e/Solarsystemscope_texture_2k_neptune.jpg'
'./img/textures/neptune.jpg'
);
tex_u.anisotropy = 8;
let neptun_mat = new THREE.MeshPhongMaterial({
map: tex_n,
});
let neptun = new THREE.Mesh(neptun_geom, neptun_mat);
neptun.castShadow = true;
neptun.receiveShadow = true;
scene.add(neptun)
// earth.rotation.z = -0.5;
// ring.rotation.z = -0.1;
ring.rotation.x = -0.3;
ur_ring.rotation.z = 2.5;
ur_ring.rotation.x = 1.5;
// ur_ring.rotation.y = 1;
let t = 0;
// camera.position.z = 200000;
// camera.rotation.z = - Math.PI/20;
// camera.position.y = 5000;
//let controlsaz = new THREE.OrbitControls(camera, render.domElement )
// let controls = new THREE.OrbitControls(camera, render.domElement );
// controls.domElement = render.domElement;
// controls.movementSpeed = 20000;
// controls.lookSpeed = 1.6;
// //let controls = new THREE.OrbitControls(camera, render.domElement)
// //let controls = new THREE.OrbitControls(camera)
// // controls.movementSpeed = 200000;
// // controls.lookSpeed = 0.05;
// // controls = new FlyControls( camera, renderer.domElement );
// controls.movementSpeed = 1000;
// //controls.domElement = renderer.domElement;
// controls.rollSpeed = Math.PI / 24;
// controls.autoForward = false;
// controls.dragToLook = false;
// function animate(){
// requestAnimationFrame(animate);
// // controls.update(0.0001)
// //sun
// sun.rotation.y += 0.001;
// mercury.rotation.y += 0.03;
// venera.rotation.y += 0.01;
// earth.rotation.y += 0.01;
// mars.rotation.y += 0.01;
// jupiter.rotation.y += 0.01;
// saturn.rotation.y += 0.01;
// ring.rotation.y -= 0.001;
// uran.rotation.y += 0.01;
// neptun.rotation.y += 0.01;
// //Mercury
// mercury.position.x = Math.sin(t*0.3)*8000;
// mercury.position.z = Math.cos(t*0.3)*8000;
// //Venera
// venera.position.x = Math.sin(t*0.2)*17000;
// venera.position.z = Math.cos(t*0.2)*17000;
// //earth
// earth.position.x = Math.sin(t*0.1)*30000;
// earth.position.z = Math.cos(t*0.1)*30000;
// //Mars
// mars.position.x = Math.sin(t*0.08)*50000;
// mars.position.z = Math.cos(t*0.08)*50000;
// //Jupiter
// jupiter.position.x = Math.sin(t*0.10)*(-74700);
// jupiter.position.z = Math.cos(t*0.10)*(-74700);
// //Saturn
// saturn.position.x = Math.sin(t*0.05)*98000;
// saturn.position.z = Math.cos(t*0.05)*98000;
// ring.position.x = saturn.position.x;
// ring.position.z = saturn.position.z
// // camera.position.x = saturn.position.x;
// // camera.position.z = saturn.position.z+1000;
// // //camera.lookAt(saturn.position)
// // //Uran
// uran.position.x = Math.sin(t*0.03)*120000;
// uran.position.z = Math.cos(t*0.01)*120000;
// //Neptun
// neptun.position.x = Math.sin(t*0.08)*180000;
// neptun.position.z = Math.cos(t*0.08)*180000;
// // // // //camera
// // camera.position.z = neptun.position.z+200;
// // camera.lookAt(neptun.position);
// // scene.rotation.x = mouseX * 0.0005;
// // scene.rotation.y = mouseY * 0.0005;
// t += Math.PI/180*2*0.1;
// render.render(scene, camera);
// }
// animate();
// container.appendChild(render.domElement);
camera.position.z = 20300;
camera.rotation.z = - Math.PI/20;
//camera.position.y = -5000;
function animate(){
requestAnimationFrame(animate);
//Rotating
sun.rotation.y += 0.001;
mercury.rotation.y += 0.01;
venera.rotation.y += 0.01;
earth.rotation.y += 0.002;
// earth.rotation.x += 0.002;
cloudMesh.rotation.y += 0.004;
// cloudMesh.rotation.z += 0.001;
mars.rotation.y += 0.02;
jupiter.rotation.y += 0.03;
saturn.rotation.y += 0.04;
ring.rotation.y -= 0.01;
// ur_ring.rotation.y -= 0.01;
// ur_ring.rotation.x -= 0.01;
uran.rotation.y += 0.06;
neptun.rotation.y += 0.07;
if(moving === true){
//Mercury
if(movingMercury === true){
mercury.position.x = Math.sin(t*0.03)*5000;
mercury.position.z = Math.cos(t*0.03)*5000;
}
// mercury.position.x = 4000;
//Venera
if(movingVenera === true){
venera.position.x = Math.sin(t*0.02)*6500;
venera.position.z = Math.cos(t*0.02)*6500;
}
// venera.position.x = 5500;
// //earth
if(movingEarth === true){
earth.position.x = Math.sin(t*0.01)*9500;
earth.position.z = Math.cos(t*0.01)*9500;
cloudMesh.position.z = Math.cos(t*0.01)*9500;
cloudMesh.position.x = Math.sin(t*0.01)*9500;
}
//moon
moon.position.x = Math.sin(earth.rotation.y)*500;
moon.position.z = Math.cos(earth.rotation.y)*500;
moon.position.z += earth.position.z;
moon.position.x += earth.position.x;
// moon.position.z = earth.position.z;
// moon.position.x = earth.position.x;
//Mars
if(movingMars === true){
mars.position.x = Math.sin(t*0.08)*10500;
mars.position.z = Math.cos(t*0.08)*10500;
}
// mars.position.x = 8500;
//Jupiter
if(movingJupiter === true){
jupiter.position.x = Math.sin(t*0.06)*14500;
jupiter.position.z = Math.cos(t*0.06)*14500;
// jupiter.position.x = 11500;
}
// //Saturn
if(movingSaturn === true){
saturn.position.x = Math.sin(t*0.04)*16000;
saturn.position.z = Math.cos(t*0.04)*16000;
}
// saturn.position.x = 13000;
ring.position.x = saturn.position.x;
ring.position.z = saturn.position.z;
// //Uran
if(movingUran === true){