-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2.html
406 lines (294 loc) · 12.4 KB
/
index2.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>ΔΦΝ=Η</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="./assets/css/main.css">
</head>
<body>
<div id="container"></div>
<div id="info">
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - webgl ocean
<div class="pressStart">Press Start</div>
</div>
<div class="virtualkeyboard-container-L0">
</div>
<script src="./THREE_Scene.js"></script>
<script type="module">
import * as THREE from './libraries/modules/three.module.js';
import Stats from './libraries/modules/stats.module.js';
import { GUI } from './libraries/config/lil-gui.module.min.js';
import { OrbitControls } from './libraries/controllers/OrbitControls.js';
import { Water } from './assets/objects/Water.js';
import { Sky } from './assets/objects/Sky.js';
let container, stats;
let camera, scene, renderer;
let controls, water, sun, mesh, ΔΦ, ΔΩ;
let Φ, MeshHDC_01, meshA1, goldenGearTest, goldenGearTest2 ;
let neoncircle;
let timeSphere, mesh_timeSphere_L0;
const particlesGeometryA = new THREE.BufferGeometry()
const textureLoader = new THREE.TextureLoader();
// const testImg01 = textureLoader.load('./assets/img/Purple_Tech01.jpeg')
const testImg01 = textureLoader.load('./assets/img/backgrounds/Glitter_Pixels.jpeg')
const testImg02 = textureLoader.load('./assets/img/backgrounds/01_Purple_Galaxy.jpeg')
const clockPNG = textureLoader.load('./assets/img/clocks/Clock03_A1.png')
const gear01_png = textureLoader.load('./assets/img/gears/GoldenGear01_A1.png')
// const neoncircle01 = textureLoader.load('./assets/img/gears/neoncircle.png')
// Test ui_Folder_01
const neoncircle01 = textureLoader.load('./assets/img/backgrounds/InfiniteContainer.jpg')
// TimeSphereImgs
const timeSphereImg_01 = textureLoader.load('./assets/img/backgrounds/galaxy_light_no_light.jpg')
init();
animate();
function init() {
container = document.getElementById( 'container' );
//
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.toneMapping = THREE.ACESFilmicToneMapping;
container.appendChild( renderer.domElement );
//
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 55, window.innerWidth / window.innerHeight, 1, 20000 );
camera.position.set( 30, 100, 400 );
camera.view = sun;
//
sun = new THREE.Vector3();
// Water
const waterGeometry = new THREE.PlaneGeometry( 50000, 50000 );
water = new Water(
waterGeometry,
{
textureWidth: 512,
textureHeight: 512,
waterNormals: new THREE.TextureLoader().load( './assets/textures/waternormals.jpg', function ( texture ) {
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
} ),
sunDirection: new THREE.Vector3(),
sunColor: 0xffffff,
waterColor: 0x001e0f,
distortionScale: 3.7,
fog: scene.fog !== undefined
}
);
water.rotation.x = - Math.PI / 2;
scene.add( water );
// Skybox
const sky = new Sky();
sky.scale.setScalar( 50000 );
scene.add( sky );
const skyUniforms = sky.material.uniforms;
skyUniforms[ 'turbidity' ].value = 10;
skyUniforms[ 'rayleigh' ].value = 2;
skyUniforms[ 'mieCoefficient' ].value = 0.005;
skyUniforms[ 'mieDirectionalG' ].value = 0.8;
const parameters = {
elevation: 2,
azimuth: 180
};
sky.rotation.x = Math.PI / 2;
const pmremGenerator = new THREE.PMREMGenerator( renderer );
function updateSun() {
const phi = THREE.MathUtils.degToRad( 90 - parameters.elevation );
const theta = THREE.MathUtils.degToRad( parameters.azimuth );
sun.setFromSphericalCoords( 1, phi, theta );
sky.material.uniforms[ 'sunPosition' ].value.copy( sun );
water.material.uniforms[ 'sunDirection' ].value.copy( sun ).normalize();
scene.environment = pmremGenerator.fromScene( sky ).texture;
}
updateSun();
// Toc_Geometries
const geometry = new THREE.BoxGeometry( 30, 30, 30 );
const material = new THREE.MeshStandardMaterial( { roughness: 0 } );
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
const ΔΦ01_OA1 = new THREE.ConeGeometry(30, 30, 3);
ΔΦ = new THREE.Mesh(ΔΦ01_OA1, material );
ΔΦ.position.x = 0
ΔΦ.position.y = 75
scene.add ( ΔΦ );
const ΔΦ01_0Α2 = new THREE.ConeGeometry(30, 30, 3);
const ΔΦ01_1Α2 = new THREE.MeshStandardMaterial({side: THREE.DoubleSide});
ΔΩ = new THREE.Mesh(ΔΦ01_0Α2, material);
ΔΩ.position.x = 0
ΔΩ.position.y = 40
ΔΩ.rotation.z = 3.14
scene.add ( ΔΩ );
const ΔΦ02_Α1 = new THREE.IcosahedronGeometry(7, 2);
Φ = new THREE.Mesh(ΔΦ02_Α1, ΔΦ01_1Α2);
Φ.position.y = 57.423
scene.add ( Φ )
const geometry2 = new THREE.SphereGeometry(5000, 32, 32)
const material2 = new THREE.MeshBasicMaterial({ map: testImg02, side: THREE.DoubleSide });
meshA1 = new THREE.Mesh(geometry2, material2)
material2.transparent = false;
material2.alphaMap = testImg02
material2.wireframe = false;
scene.add(meshA1)
const geometry4 = new THREE.BoxGeometry(500, 500, 500, 32, 32, 32)
const material4 = new THREE.MeshBasicMaterial({ map: testImg01, side: THREE.DoubleSide });
const mesh3 = new THREE.Mesh(geometry4, material4)
material4.transparent = true;
material4.alphaMap = testImg01
material4.wireframe = false;
mesh3.position.set(0, 2000, 0)
scene.add(mesh3)
const geometry_neon01 = new THREE.BoxGeometry(1000, 1000, 1000, 32, 32, 32)
const mat_neoncircle = new THREE.MeshBasicMaterial({ map: neoncircle01, side: THREE.DoubleSide });
const mesh_neoncircle = new THREE.Mesh(geometry_neon01, mat_neoncircle);
mat_neoncircle.transparent = false;
mat_neoncircle.alphaMap = neoncircle01;
mesh_neoncircle.position.set(0, 10, 0);
scene.add(mesh_neoncircle);
3.7
const geometry04_HyperDataCardTest = new THREE.PlaneGeometry(400, 400);
const mat_clock = new THREE.MeshBasicMaterial({map: clockPNG, side: THREE.DoubleSide});
MeshHDC_01 = new THREE.Mesh(geometry04_HyperDataCardTest, mat_clock);
mat_clock.transparent = true;
MeshHDC_01.position.set(0, 55, 0);
scene.add(MeshHDC_01);
const geometry04_GoldenGear01 = new THREE.PlaneGeometry(300, 300);
const mat_goldengear01 = new THREE.MeshBasicMaterial(
{
map: gear01_png,
side: THREE.DoubleSide
}
);
goldenGearTest = new THREE.Mesh(
geometry04_GoldenGear01,
mat_goldengear01
);
mat_goldengear01.transparent = true;
goldenGearTest.position.set(0, 55, -1);
scene.add(goldenGearTest);
const geometry05_NeonCircle = new THREE.PlaneGeometry(500, 500);
const mat_goldengear02 = new THREE.MeshBasicMaterial(
{
map: gear01_png,
side: THREE.DoubleSide
}
);
goldenGearTest2 = new THREE.Mesh(
geometry05_NeonCircle,
mat_goldengear02,
);
mat_goldengear02.transparent = true;
goldenGearTest2.position.set(0, 55, -2);
scene.add(goldenGearTest2);
// Groups
const group01_timeSphere = new THREE.Group();
group01_timeSphere.position.set(500, 0, 0);
scene.add(group01_timeSphere);
// TimeSphere_Layer01_Skeleton
const geo_timeSphere_L0 = new THREE.SphereGeometry( 5000, 32, 32)
const mat_timeSphere_L0 = new THREE.MeshBasicMaterial({ map: timeSphereImg_01, side: THREE.DoubleSide });
mesh_timeSphere_L0 = new THREE.Mesh(geo_timeSphere_L0, mat_timeSphere_L0)
mat_timeSphere_L0.transparent = false;
mat_timeSphere_L0.alphaMap = timeSphereImg_01
mat_timeSphere_L0.wireframe = false;
mesh_timeSphere_L0.position.set(10000, 2000, 0)
group01_timeSphere.add(mesh_timeSphere_L0);
// const ambientLight = new THREE.AmbientLight(0xffffff, 0.3)
// scene.add(ambientLight)
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.3)
scene.add(directionalLight)
directionalLight.position.x = 255
directionalLight.shadow.mapSize.width = 1024
directionalLight.shadow.mapSize.height = 1024
directionalLight.shadow.camera.near = 1
directionalLight.shadow.camera.far = 6
directionalLight.shadow.camera.top = 2
directionalLight.shadow.camera.right = 2
directionalLight.shadow.camera.bottom = - 2
directionalLight.shadow.camera.left = - 2
directionalLight.position.set(2, 2, - 1)
scene.add(directionalLight)
// var geometry2 = new THREE.BoxGeometry( 100, 100, 20 );
// geometry2.applyMatrix( new THREE.Matrix4().makeRotationZ( Math.PI / 4 ) );
// geometry2.applyMatrix( new THREE.Matrix4().makeScale( 1, 2, 1 ) );
// const mesh2 = new THREE.Mesh( geometry2, material );
// mesh.scale.set( 1,1, 1 );
// scene.add( mesh2 );
//
controls = new OrbitControls( camera, renderer.domElement );
// controls.maxPolarAngle = Math.PI * 0.495;
// controls.target.set( 0, 55, 0 );
// controls.minDistance = 40.0;
// controls.maxDistance = 200.0;
controls.update();
//
camera.lookAt(0, 55, 0 )
stats = new Stats();
container.appendChild( stats.dom );
// Toc.GUI
const gui = new GUI();
const folderSky = gui.addFolder( 'Sky' );
folderSky.add( parameters, 'elevation', 0, 90, 0.1 ).onChange( updateSun );
folderSky.add( parameters, 'azimuth', - 180, 180, 0.1 ).onChange( updateSun );
folderSky.open();
const waterUniforms = water.material.uniforms;
const folderWater = gui.addFolder( 'Water' );
folderWater.add( waterUniforms.distortionScale, 'value', 0, 8, 0.1 ).name( 'distortionScale' );
folderWater.add( waterUniforms.size, 'value', 0.1, 10, 0.1 ).name( 'size' );
folderWater.open();
const folderPositions = gui.addFolder( 'Positions' )
folderPositions.add(Φ.position, 'x').min(-200).max(200).step(0.001).name('x-position');
folderPositions.add(Φ.position, 'y').min(-200).max(200).step(0.001).name('y-position');
folderPositions.add(Φ.position, 'z').min(-200).max(200).step(0.001).name('z-position');
const folderTransformations = gui.addFolder( 'Transformations');
folderTransformations.add(ΔΩ.rotation, 'x').min(-3.14).max(3.14).step(0.001).name('x-rotation');
folderTransformations.add(ΔΩ.rotation, 'y').min(-3.14).max(3.14).step(0.001).name('y-rotation');
folderTransformations.add(ΔΩ.rotation, 'z').min(-3.14).max(3.14).step(0.001).name('z-rotation');
const folderCamera = gui.addFolder('Camera');
folderCamera.add(camera.position, 'x').min(-500).max(500).step(0.001).name('x-camera')
folderCamera.add(camera.position, 'y').min(-500).max(500).step(0.001).name('y-camera')
folderCamera.add(camera.position, 'z').min(-500).max(500).step(0.001).name('z-camera')
window.addEventListener( 'resize', onWindowResize );
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
camera.lookAt()
renderer.setSize( window.innerWidth, window.innerHeight );
}
function animate() {
requestAnimationFrame( animate );
render();
stats.update();
}
function render() {
const time = performance.now() * 0.001;
mesh.position.z = Math.PI / 3 ;
mesh.rotation.z = Math.PI / 4 ;
mesh.position.y = 35;
mesh.position.x = 300;
// mesh.scale.x = 0.5;
// mesh.position.y = Math.sin( time ) * 20 + 5;
mesh.position.y = 30
// mesh.rotation.z = 260
// mesh.rotation.y = 80
// mesh.rotation.x = time * 0.00001;
// mesh.rotation.y = time * 1;
// mesh.rotation.z = time * 0;
mesh.rotation.y = time * 0.1;
// mesh2.rotation.y = time * 0.1;
// camera.rotation.x = time * 0.1;
mesh.position.x = Math.cos(time * 2) * 212.5
mesh.position.z = Math.sin(time * 2) * 212.5
// mesh.position.y = Math.sin(time * 2) * 112.5
ΔΦ.rotation.y = time * 15;
ΔΩ.rotation.y = time * 15;
// meshA1.rotation.y = time * 15;
meshA1.rotation.x = time * 15
MeshHDC_01.rotation.z = time * -0.5;
goldenGearTest.rotation.z = time * 0.5;
goldenGearTest2.rotation.z = time * 0.5;
water.material.uniforms[ 'time' ].value += 1.0 / 60.0;
renderer.render( scene, camera );
}
</script>
</body>
</html>