-
Notifications
You must be signed in to change notification settings - Fork 3
/
alian_base.html
1983 lines (1840 loc) · 68.5 KB
/
alian_base.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 lang="en">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="img/galaxy.ico" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
/>
<link rel="stylesheet" href="main.css" />
<style>
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
}
#video {
position: fixed;
left: 0;
bottom: 0;
}
#blocker1 {
position: absolute;
text-align: center;
width: 100%;
height: 100%;
padding-left: 10%;
background-color: rgba(0, 0, 0, 0.5);
display: none;
}
#blocker {
position: absolute;
text-align: center;
width: 100%;
height: 100%;
padding-left: 10%;
background-color: rgba(0, 0, 0, 0.5);
}
#secondBlocker {
position: absolute;
font-family: "Comic Sans MS", "Comic Sans", cursive;
width: 88%;
height: 5%;
margin: 5%;
margin-top: 0.5%;
font-size: 2.5vh;
text-align: center;
color: #ffffffcc;
background-color: rgba(0, 0, 0, 0);
user-select: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
pointer-events: none;
}
.loading {
display: none;
position: absolute;
top: 48%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 99;
color: white;
font-size: 40px;
font-weight: 100;
font-family: Lato, sans-serif;
letter-spacing: 10px;
text-transform: uppercase;
cursor: wait;
}
.loading span {
animation: shrink 2s infinite;
}
@keyframes shrink {
50% {
transform: scale(0.2);
}
}
#loading_background {
position: absolute;
background-color: rgb(0, 0, 0);
z-index: 98;
height: 100%;
width: 100%;
cursor: wait;
}
</style>
<title>Alien Base</title>
</head>
<body>
<div id="loading_background"></div>
<div id="loading" class="loading">
<span style="animation-delay: 0s">L</span
><span style="animation-delay: 0.1s">o</span
><span style="animation-delay: 0.2s">a</span
><span style="animation-delay: 0.3s">d</span
><span style="animation-delay: 0.4s">i</span
><span style="animation-delay: 0.5s">n</span
><span style="animation-delay: 0.6s">g</span
><span style="animation-delay: 0.7s">·</span
><span style="animation-delay: 0.8s">·</span
><span style="animation-delay: 0.9s">·</span>
</div>
<div id="container"></div>
<div id="aiming1">
<img src="img/aiming4.png" width="21px" height="21px" />
</div>
<div id="secondBlocker" style="display: none"></div>
<div id="blocker1"></div>
<div id="blocker">
<div id="content">
<h1>Alien Base</h1>
<p id="para">
We humans are obsessed with the idea that we’re not alone, that
somewhere out there in the universe, there are other life forms
intelligent enough to communicate with us.<br />
But if there is life out there, why haven’t we heard from them yet?
<br />Or have we?
</p>
<a class="btn" onclick="hideMe()">START</a><br />
<!--<a class="btn1" onclick="goSolar()">Go Solar</a> <a class="btn1" onclick="goIsland()">Go Island</a>-->
</div>
</div>
</body>
<script src="./three.js/build/three.js"></script>
<script src="./JS/jquery.js"></script>
<script>
show_loading();
function show_loading() {
$("#loading").show();
$("#loading").css({ display: "flex", opacity: 0 });
$("#loading").animate({ opacity: 1 }, 500);
}
function hide_loading() {
$("#loading").fadeOut(800);
$("#loading_background").fadeOut(800);
}
</script>
<!-- <script src="./JS/stats.min.js"></script> -->
<script id="vertexShader" type="x-shader/x-vertex">
varying vec3 vNormal;
varying vec3 vPositionNormal;
void main()
{
vNormal = normalize( normalMatrix * normal );
vPositionNormal = normalize(( modelViewMatrix * vec4(position, 1.0) ).xyz);
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
</script>
<!-- fragment shader a.k.a. pixel shader -->
<script id="fragmentShader" type="x-shader/x-vertex">
uniform vec3 glowColor;
uniform float b;
uniform float p;
uniform float s;
varying vec3 vNormal;
varying vec3 vPositionNormal;
void main()
{
float a = pow( b + s * abs(dot(vNormal, vPositionNormal)), p );
gl_FragColor = vec4( glowColor, a );
}
</script>
<script type="module">
import {
Lensflare,
LensflareElement,
} from "./three.js/examples/jsm/objects/Lensflare.js";
import { OBJLoader } from "./three.js/examples/jsm/loaders/OBJLoader.js";
import { MTLLoader } from "./three.js/examples/jsm/loaders/MTLLoader.js";
import { GUI } from "./three.js/examples/jsm/libs/dat.gui.module.js";
import { Water } from "./three.js/examples/jsm/objects/Water.js";
var FPS = 60;
var singleFrameTime = 1 / FPS;
var timeStamp = 0;
var fps_speed = 120 / FPS;
var load_items = 0;
var loaded_items = 0;
var scene;
var camera;
var renderer;
var rotatespeed = 5 * fps_speed;
//var stats = new Stats();
//stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
//document.body.appendChild(stats.dom);
var star_radius = new Array();
var add_solar = false;
var add_city = true;
var add_base = true;
var moveForward = false;
var moveBackward = false;
var moveLeft = false;
var moveRight = false;
var jump = false;
var fast = false;
var esc = true;
var speedup = false;
var speeddown = false;
var meteorites = [];
var gotoground = false;
var arrived = 50;
var ufo_scale = 10;
var distance_to_protection = 500;
var shield_color_red = new THREE.Color(1, 0.5, 0.5);
var shield_color_blue = new THREE.Color(0xeeffff);
var spotLight;
var vec = new THREE.Vector3();
var start_point = new THREE.Vector3(0, 0, 0);
var last_position = start_point.clone().set(-131.66, -465, 1296.76);
var cameraPosition = vec.clone().set(-131.66, -465, 1296.76);
var cameraDirection = vec.clone().set(0, 0, 0);
var hit_direction = vec.clone().set(0, 0, 0);
var hit_frame = 0;
var catchspeed = 0;
var ufo_starlight = 0.06;
var tranfer_speed = 1;
var t_in = true;
var chasing = vec.clone();
var chaseing_frame = 50;
var safe_dis = 2.25;
var hit_open = true;
var SEPARATION = 250,
AMOUNTX = 12,
AMOUNTY = 4,
AMOUNTZ = 12;
var particles,
particle,
star_d,
star_d_speed,
star_s_speed,
count = 0;
var city1;
var angle = 0;
// Mouse Move
var delta = 0;
var mouseP = { x: 0, y: 0 };
var up = 0;
var down = 0;
var left = 0;
var right = 0;
var maxSpeed = 0.025 * fps_speed;
var acc = 0.25 * fps_speed;
var currentSpeedForward = 0;
var currentSpeedRight = 0;
var Forward = true;
var Right = true;
const clock = new THREE.Clock();
var angleX = 0;
var angleY = 0;
var angleZX = 0;
var angleZY = 0;
var scaling = false;
var speed = 1;
var obj3d = new THREE.Object3D();
var all_obj = obj3d.clone();
var all_obj1 = obj3d.clone();
var all_obj2 = obj3d.clone();
var all_obj3 = obj3d.clone();
var all_obj4 = obj3d.clone();
var color = new THREE.Color();
const raycaster = new THREE.Raycaster();
const raycaster1 = new THREE.Raycaster();
const mouse = new THREE.Vector2();
var selected_object = false;
var env_light = new THREE.AmbientLight(0x282930);
const sunlight = new THREE.TextureLoader().load("img/lensflare2.png");
const ufolight = new THREE.TextureLoader().load("img/ufo_light1.png");
const starball = new THREE.TextureLoader().load("img/ball.png");
var meteoriteball = new THREE.TextureLoader().load("img/star0.png");
var meteoritetail = new THREE.TextureLoader().load("img/start0.png");
var meteoriteballr = new THREE.TextureLoader().load("img/star00.png");
var meteoritetailr = new THREE.TextureLoader().load("img/start00.png");
var textureFlare0 = new THREE.TextureLoader().load("img/lensflare0.png");
var textureFlare0a = new THREE.TextureLoader().load("img/lensflare0a.png");
var textureFlare0b = new THREE.TextureLoader().load("img/lensflare0b.png");
var material = new THREE.Sprite(
new THREE.SpriteMaterial({
transparent: true,
blending: THREE.AdditiveBlending,
map: meteoriteball,
color: 0xffffff,
depthTest: true,
depthWrite: false,
polygonOffset: true,
polygonOffsetFactor: -10,
})
);
var materialr = new THREE.Sprite(
new THREE.SpriteMaterial({
transparent: true,
blending: THREE.AdditiveBlending,
map: meteoriteballr,
color: 0xffffff,
depthTest: true,
depthWrite: false,
polygonOffset: true,
polygonOffsetFactor: -10,
})
);
var material1 = new THREE.Sprite(
new THREE.SpriteMaterial({
transparent: true,
blending: THREE.AdditiveBlending,
map: meteoritetail,
color: 0xffffff,
depthTest: true,
depthWrite: false,
polygonOffset: true,
polygonOffsetFactor: -10,
})
);
var material1r = new THREE.Sprite(
new THREE.SpriteMaterial({
transparent: true,
blending: THREE.AdditiveBlending,
map: meteoritetailr,
color: 0xffffff,
depthTest: true,
depthWrite: false,
polygonOffset: true,
polygonOffsetFactor: -10,
})
);
var meteorite_Object3D = obj3d.clone();
var ufo = meteorite_Object3D.clone();
var village = meteorite_Object3D.clone();
scene = new THREE.Scene();
const waterGeometry = new THREE.CircleGeometry(5000, 100);
var MeshWater = new Water(
waterGeometry,
{
textureWidth: 1024,
textureHeight: 1024,
waterNormals: new THREE.TextureLoader().load(
"./three.js/examples/textures/waternormals.jpg",
function (texture) {
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
}
),
sunDirection: new THREE.Vector3(),
sunColor: 0xffffff,
waterColor: 0x001e1f,
distortionScale: 3,
fog: scene.fog !== undefined,
},
0.6
);
const ju_map = new THREE.TextureLoader().load("./texture/ju.jpg");
var jupiter_m = new THREE.MeshBasicMaterial({
map: ju_map,
transparent: true,
opacity: 0.75,
});
var jupiter = new THREE.Mesh(
new THREE.PlaneGeometry(2500, 2500),
jupiter_m
);
jupiter.name = "jupiter";
const normalMap2 = new THREE.TextureLoader().load(
"./three.js/examples/textures/water/Water_1_M_Normal.jpg"
);
const clearcoatNormaMap = new THREE.TextureLoader().load(
"./three.js/examples/textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png"
);
var ufo_material = new THREE.MeshPhysicalMaterial({
clearcoat: 1.0,
metalness: 1.0,
color: 0xffffff,
normalMap: normalMap2,
normalScale: new THREE.Vector2(0.05, 0.05),
clearcoatNormalMap: clearcoatNormaMap,
// y scale is negated to compensate for normal map handedness.
clearcoatNormalScale: new THREE.Vector2(1.0, -1.0),
});
var shield_uniforms = {
s: { type: "f", value: -0.75 },
b: { type: "f", value: 0.5 },
p: { type: "f", value: 3 },
glowColor: { type: "c", value: shield_color_blue },
};
var customMaterial = new THREE.ShaderMaterial({
uniforms: shield_uniforms,
vertexShader: document.getElementById("vertexShader").textContent,
fragmentShader: document.getElementById("fragmentShader").textContent,
side: THREE.DoubleSide,
blending: THREE.AdditiveBlending,
transparent: true,
});
function init() {
var skyGeometry = new THREE.SphereGeometry(8000, 100, 100);
var map = new THREE.TextureLoader().load("img/bg5.png");
map.wrapS = THREE.RepeatWrapping;
map.wrapT = THREE.RepeatWrapping;
map.repeat.set(15, 15);
var skyBox = new THREE.Mesh(
skyGeometry,
new THREE.MeshBasicMaterial({
map: map,
side: THREE.BackSide,
})
);
skyBox.name = "Sky";
scene.add(skyBox);
camera = new THREE.PerspectiveCamera(
42, // fov 45 degree
window.innerWidth / window.innerHeight, //aspect (width/height ratio)
10, //near
10000 // far
);
particles = new Array();
star_d = new Array();
star_d_speed = new Array();
star_s_speed = new Array();
var material = new THREE.SpriteMaterial({
transparent: true,
blending: THREE.AdditiveBlending,
map: starball,
color: 0xffffff,
});
var littlestar = new THREE.Sprite(material);
littlestar.renderOrder = 2;
var i = 0;
for (var ix = 0; ix < AMOUNTX; ix++) {
for (var iy = 0; iy < AMOUNTY; iy++) {
for (var iz = 0; iz < AMOUNTZ; iz++) {
particle = particles[i] = littlestar.clone();
star_d[i] = vec
.clone()
.set(
Math.random() - 0.5,
Math.random() - 0.5,
Math.random() - 0.5
);
star_d_speed[i] = vec
.clone()
.set(
Math.random() - 0.5,
Math.random() - 0.5,
Math.random() - 0.5
);
star_s_speed[i] = Math.random() - 0.5;
i++;
particle.position.x =
ix * SEPARATION -
(AMOUNTX * SEPARATION) / 2 +
(Math.random() - 0.5) * SEPARATION * 16;
particle.position.y =
(iy * SEPARATION) / 2 + (Math.random() - 0.5) * SEPARATION * 16;
particle.position.z =
iz * SEPARATION -
(AMOUNTZ * SEPARATION) / 2 +
(Math.random() - 0.5) * SEPARATION * 16;
scene.add(particle);
}
}
}
var geometryGround = new THREE.CircleBufferGeometry(5000, 100, 100);
geometryGround.rotateX(Math.PI / 2);
geometryGround.translate(0, 0, 0);
var texture = THREE.ImageUtils.loadTexture("texture/pattern5.jpg");
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(500, 500);
var materialGround = new THREE.MeshStandardMaterial({
map: texture,
side: THREE.DoubleSide,
});
var MeshGround = new THREE.Mesh(geometryGround, materialGround);
MeshGround.position.set(0, -510, 0);
MeshGround.name = "Ground";
MeshGround.receiveShadow = true;
MeshGround.castShadow = false;
all_obj4.add(MeshGround);
MeshWater.rotation.x = -Math.PI / 2;
MeshWater.position.set(0, -504, 0);
MeshWater.name = "Water";
MeshWater.receiveShadow = true;
MeshWater.castShadow = false;
all_obj4.add(MeshWater);
camera.position.set(cameraPosition.x, cameraPosition.y, cameraPosition.z);
camera.lookAt(cameraDirection.x, cameraDirection.y, cameraDirection.z);
scene.add(camera);
document.addEventListener("mousemove", mouseMove, false);
var onKeyDown = function (e) {
switch (e.keyCode) {
case 87:
case 38:
moveForward = true;
selected_object = false;
break;
case 83:
case 40:
moveBackward = true;
selected_object = false;
break;
case 65:
case 37:
moveLeft = true;
selected_object = false;
break;
case 68:
case 39:
moveRight = true;
selected_object = false;
break;
case 16:
fast = true;
break;
case 27:
esc = true;
$("#blocker").fadeIn(1000);
$("#content").fadeIn(1000);
break;
case 69:
speedup = true;
break;
case 81:
speeddown = true;
break;
}
};
var onKeyUp = function (e) {
switch (e.keyCode) {
case 87:
case 38:
moveForward = false;
break;
case 83:
case 40:
moveBackward = false;
break;
case 65:
case 37:
moveLeft = false;
break;
case 68:
case 39:
moveRight = false;
break;
case 16:
fast = false;
break;
case 69:
speedup = false;
break;
case 81:
speeddown = false;
break;
}
};
document.addEventListener("keydown", onKeyDown, false);
document.addEventListener("keyup", onKeyUp, false);
scene.add(env_light);
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(window.devicePixelRatio);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
document.getElementById("container").appendChild(renderer.domElement);
document.body.appendChild(renderer.domElement);
load_items += 2;
let onProgress_obj = function (xhr) {
if (xhr.lengthComputable) {
let percentComplete = (xhr.loaded / xhr.total) * 100;
console.log(Math.round(percentComplete, 2) + "% downloaded(obj)");
if (percentComplete == 100) {
loaded_items += 1;
}
}
};
let onProgress_mtl = function (xhr) {
if (xhr.lengthComputable) {
let percentComplete = (xhr.loaded / xhr.total) * 100;
console.log(Math.round(percentComplete, 2) + "% downloaded(mtl)");
if (percentComplete == 100) {
loaded_items += 1;
}
}
};
const mtlLoader = new MTLLoader();
mtlLoader.load(
"UFO2/UFO2.mtl",
(mtl) => {
mtl.preload();
const objLoader = new OBJLoader();
objLoader.setMaterials(mtl);
objLoader.load(
"UFO2/UFO2.obj",
(root) => {
for (var k in root.children) {
root.children[k].castShadow = true;
}
root.position.set(0, 0, 0);
root.scale.set(0.1, 0.1, 0.1);
var ufo_light_material = new THREE.SpriteMaterial({
blending: THREE.AdditiveBlending,
map: ufolight,
transparent: true,
opacity: 0.5,
});
var ufo_light = new THREE.Sprite(ufo_light_material);
ufo_light.renderOrder = 2;
var ufo_top_light = new THREE.Mesh(
new THREE.SphereGeometry(0.085, 32, 32),
new THREE.MeshBasicMaterial({ color: 0xffffee })
);
var white_light = littlestar.clone();
white_light.renderOrder = 2;
var ring_m = new THREE.MeshPhongMaterial({
color: 0xff51aa,
specular: 0xff51aa,
side: THREE.DoubleSide,
emissive: 0xff51aa,
});
var ufo_ring1 = new THREE.Mesh(
new THREE.TorusGeometry(
0.0909 * 5,
0.0025,
3,
144,
Math.PI / 5.455
),
ring_m
);
ufo_ring1.rotation.x = Math.PI / 2;
ufo_ring1.rotation.z = Math.PI / 15.35;
ufo_ring1.position.y = 0.021 * 5;
var ufo_ring2 = new THREE.Mesh(
new THREE.TorusGeometry(
0.092 * 5,
0.0025,
3,
144,
Math.PI / 5.455
),
ring_m
);
ufo_ring2.rotation.x = Math.PI / 2;
ufo_ring2.rotation.z = Math.PI / 9.35 + Math.PI / 3;
ufo_ring2.position.y = 0.021 * 5;
var ufo_ring3 = new THREE.Mesh(
new THREE.TorusGeometry(
0.09095 * 5,
0.0025,
3,
144,
Math.PI / 5.455
),
ring_m
);
ufo_ring3.rotation.x = Math.PI / 2;
ufo_ring3.rotation.z = Math.PI / 8.65 + (Math.PI * 2) / 3;
ufo_ring3.position.y = 0.021 * 5;
var ufo_ring4 = new THREE.Mesh(
new THREE.TorusGeometry(
0.09085 * 5,
0.0025,
3,
144,
Math.PI / 5.455
),
ring_m
);
ufo_ring4.rotation.x = Math.PI / 2;
ufo_ring4.rotation.z = Math.PI / 10.65 + Math.PI;
ufo_ring4.position.y = 0.021 * 5;
var ufo_ring5 = new THREE.Mesh(
new THREE.TorusGeometry(
0.09085 * 5,
0.0025,
3,
144,
Math.PI / 5.455
),
ring_m
);
ufo_ring5.rotation.x = Math.PI / 2;
ufo_ring5.rotation.z = Math.PI / 13.65 + (Math.PI * 4) / 3;
ufo_ring5.position.y = 0.021 * 5;
var ufo_ring6 = new THREE.Mesh(
new THREE.TorusGeometry(
0.09085 * 5,
0.0025,
3,
144,
Math.PI / 4.655
),
ring_m
);
ufo_ring6.rotation.x = Math.PI / 2;
ufo_ring6.rotation.z = Math.PI / 18.65 + (Math.PI * 5) / 3;
ufo_ring6.position.y = 0.021 * 5;
var ufo_ring0 = new THREE.Mesh(
new THREE.TorusGeometry(0.0566 * 5, 0.06, 3, 72),
new THREE.MeshPhongMaterial({
color: 0x44e0ff,
specular: 0x44e0ff,
side: THREE.DoubleSide,
emissive: 0x44e0ff,
})
);
ufo_top_light.position.set(0, 0.033 * 5, 0);
white_light.position.set(0, 0.036 * 5, 0);
white_light.scale.set(0.063 * 5, 0.0525 * 5);
ufo_light.position.set(0, -0.04, 0);
ufo_light.scale.set(0.05, 0.25);
var light_for_ufo = new THREE.PointLight(
0xffffee,
0.5,
(100 * ufo_scale) / 10,
0.75
);
light_for_ufo.penumbra = 0.1;
light_for_ufo.castShadow = true;
light_for_ufo.shadow.mapSize.width = 1024;
light_for_ufo.shadow.mapSize.height = 1024;
light_for_ufo.shadow.camera.far = (100 * ufo_scale) / 10;
light_for_ufo.shadow.camera.near = (0.1 * ufo_scale) / 10;
light_for_ufo.shadow.radius = 3;
light_for_ufo.shadowBias = -0.001;
light_for_ufo.position.set(0, 0.3, 0);
var light_for_ufo1 = new THREE.PointLight(
0xffffee,
1.5,
(30 * ufo_scale) / 10,
0.95
);
light_for_ufo1.penumbra = 0.1;
light_for_ufo1.castShadow = true;
light_for_ufo1.shadow.mapSize.width = 1024;
light_for_ufo1.shadow.mapSize.height = 1024;
light_for_ufo1.shadow.camera.far = (30 * ufo_scale) / 10;
light_for_ufo1.shadow.camera.near = (0.1 * ufo_scale) / 10;
light_for_ufo1.shadow.radius = 3;
light_for_ufo1.shadowBias = -0.001;
light_for_ufo1.position.set(0, 0, 0);
var ufo_ball = new THREE.Mesh(
new THREE.SphereGeometry(0.18, 30, 30),
new THREE.MeshPhongMaterial({
color: 0xffffff,
specular: 0xffffff,
emissive: 0xffffff,
transparent: true,
opacity: 0.95,
})
);
ufo_ball.scale.y = 0.1;
ufo_ball.position.y = 0.065;
ufo_ring0.rotation.x = Math.PI / 2;
ufo_ring0.position.y = 0.0222 * 5;
root.children[2].material = new THREE.MeshBasicMaterial({
color: 0xff0000,
});
root.children[3].material = new THREE.MeshBasicMaterial({
color: 0xff0000,
});
root.children[5].material = ufo_material;
ufo.add(root);
ufo.add(ufo_light);
ufo.add(ufo_top_light);
ufo.add(white_light);
ufo.add(ufo_ring1);
ufo.add(ufo_ring2);
ufo.add(ufo_ring3);
ufo.add(ufo_ring4);
ufo.add(ufo_ring5);
ufo.add(ufo_ring6);
ufo.add(ufo_ring0);
ufo.add(light_for_ufo);
ufo.add(light_for_ufo1);
ufo.add(ufo_ball);
ufo.position.z -= 0.48 * 5;
ufo.position.y -= 0.12 * 5;
},
onProgress_obj
);
},
onProgress_mtl
);
ufo.scale.set(ufo_scale, ufo_scale, ufo_scale);
scene.add(ufo);
ufo.position.set(0, -1000, 0);
// var citylight1 = light_loader("obj/light3/light3", "obj/light3/light3", 0.5, true);
// citylight1.position.set(0, -512, 0);
// citylight1.rotation.y = Math.PI;
// citylight1.name = "citylight1";
// if (add_base) all_obj2.add(citylight1);
// all_obj2.position.y += 50;
var big_light = obj3d.clone();
var Cylinder1 = new THREE.Mesh(
new THREE.CylinderGeometry(4.65, 5, 1, 50),
new THREE.MeshPhongMaterial({
color: 0xffffff,
specular: 0xffffff,
emissive: 0xffffff,
transparent: true,
opacity: 0.95,
})
);
var light_white1 = new THREE.PointLight(
0xffffff,
0.3,
700 * 1 /*ufo_scale/100*/
);
light_white1.penumbra = 0.3;
light_white1.castShadow = true;
light_white1.shadow.mapSize.width = 1024;
light_white1.shadow.mapSize.height = 1024;
light_white1.shadow.camera.far = 700 * 1 /*ufo_scale/100*/;
light_white1.shadow.camera.near = 5 * 1 /*ufo_scale/100*/;
light_white1.shadowBias = -0.001;
light_white1.shadow.radius = 3;
light_white1.position.y = 4;
big_light.add(light_white1);
big_light.add(Cylinder1);
var new_light8 = big_light.clone();
new_light8.position.set(-78.35, -373.4, 133.85);
new_light8.scale.set(3.5, 5.3, 3.5);
if (add_base) all_obj2.add(new_light8);
var new_light9 = big_light.clone();
new_light9.position.set(67.45, -373.4, 133.85);
new_light9.scale.set(3.5, 5.3, 3.5);
if (add_base) all_obj2.add(new_light9);
var new_light10 = big_light.clone();
new_light10.position.set(-82.5, -215.15, -47.75);
new_light10.scale.set(2.5, 6.2, 2.5);
if (add_base) all_obj2.add(new_light10);
var new_light11 = big_light.clone();
new_light11.position.set(69.25, -215.15, -47.75);
new_light11.scale.set(2.5, 6.2, 2.5);
if (add_base) all_obj2.add(new_light11);
var new_light12 = big_light.clone();
new_light12.position.set(82.1, -400.6, -196.4);
new_light12.scale.set(9.5, 6.2, 9.5);
if (add_base) all_obj2.add(new_light12);
city1 = obj_loader("obj/city2/city2", "obj/city2/city2", 1.5, true);
city1.position.set(21.5, -560, 499);
city1.name = "city1";
if (add_base) all_obj2.add(city1);
all_obj2.position.y += 50;
var protection_texture = THREE.ImageUtils.loadTexture(
"texture/shield4.png"
);
protection_texture.wrapS = THREE.RepeatWrapping;
protection_texture.wrapT = THREE.RepeatWrapping;
protection_texture.repeat.set(500, 500);
var protection_material = new THREE.MeshPhongMaterial({
color: 0xeeffff,
map: protection_texture,
transparent: true,
opacity: 1,
side: THREE.DoubleSide,
shininess: 0,
});
var protection = new THREE.Mesh(
new THREE.SphereGeometry(499.5, 100, 100),
protection_material
);
protection.position.y = -560;
protection.scale.y = 1.6;
protection.renderOrder = 1;
protection.name = "protection";
all_obj3.add(protection);
var protection1 = new THREE.Mesh(
new THREE.SphereGeometry(500, 100, 100),
customMaterial
);
protection1.position.y = -560;
protection1.scale.y = 1.6;
protection1.renderOrder = 1;
protection1.name = "protection";
all_obj3.add(protection1);
// var blue_light = new THREE.Mesh(new THREE.CylinderGeometry(4.65, 4.5, 1, 50), new THREE.MeshPhongMaterial({ color: 0x54a1b2, specular: 0xFFFFFF, emissive: 0x54a1b2, transparent: true, opacity: 0.95 }));
// var new_light3 = blue_light.clone();
// new_light3.position.set(-0.4, -273.1, 51);
// new_light3.scale.set(0.77, 3.5, 0.77);
// if(add_base)all_obj2.add(new_light3);
// var new_light4 = blue_light.clone();
// new_light4.position.set(-4.1, -370.9, 197.05);
// new_light4.scale.set(1.2, 3.6, 1.2);
// if(add_base)all_obj2.add(new_light4);
// var new_light5 = blue_light.clone();
// new_light5.position.set(-155.35, -366.4, 82.5);
// new_light5.scale.set(1.2, 3.6, 1.2);
// if(add_base)all_obj2.add(new_light5);
// var new_light6 = blue_light.clone();
// new_light6.position.set(151.25, -366.4, 82.5);
// new_light6.scale.set(1.2, 3.6, 1.2);
// if(add_base)all_obj2.add(new_light6);
// var new_light7 = blue_light.clone();
// new_light7.position.set(-0.2, -143.45, -31.65);
// new_light7.scale.set(1.2, 3.6, 1.2);
// if(add_base)all_obj2.add(new_light7);
jupiter.position.set(0, 4000, -6500);
//jupiter.rotation.z=Math.PI/4
jupiter.rotation.x = Math.PI / 7;
scene.add(jupiter);
all_obj2.position.y -= 20;
all_obj.add(all_obj1);
all_obj.add(all_obj2);
all_obj.add(all_obj3);
all_obj.add(all_obj4);
all_obj.scale.set(
1 /*ufo_scale/100*/,
1 /*ufo_scale/100*/,
1 /*ufo_scale/100*/
);