Initial commit

This commit is contained in:
Thomas FORGIONE 2015-04-02 12:38:06 +02:00
parent 085984aa6b
commit e297123be7
52 changed files with 129222 additions and 1 deletions

View File

@ -1 +1,3 @@
# 3dinterface
# 3D Interface
Various 3d interfaces based on Three.js

19
bouncing/index.html Normal file
View File

@ -0,0 +1,19 @@
<!doctype html>
<html>
<head>
<title>The begining</title>
<meta charset="utf-8">
</head>
<body>
<h1>Here is stuff</h1>
<div id="container"></div>
<script src="/js/three/three.min.js"></script>
<script src="/js/three/OBJLoader.js"></script>
<script src="/js/three/OrbitControls.js"></script>
<script src="/js/three/PointerLockControls.js"></script>
<script src="/js/Cube.js"></script>
<script src="/js/BouncingCube.js"></script>
<script src="/js/Camera.js"></script>
<script src="js/BouncingMain.js"></script>
</body>
</html>

View File

@ -0,0 +1,97 @@
var renderer, scene, camera, controls, cube, container, plane, mouse= {x:0, y:0};
var raycaster;
var objects = [];
var container_size = new Object();
container_size.width = 1067;
container_size.height = 600;
init();
animate();
function init() {
// on initialise le moteur de rendu
container = document.getElementById('container');
container.style.height = container_size.height + 'px';
container.style.width = container_size.width + 'px';
renderer = new THREE.WebGLRenderer({alpha:"true"});
renderer.setSize(container_size.width, container_size.height);
renderer.shadowMapEnabled = true;
document.getElementById('container').appendChild(renderer.domElement);
// on initialise la scène
scene = new THREE.Scene();
raycaster = new THREE.Raycaster();
// init light
var directional_light = new THREE.DirectionalLight(0xffffff);
directional_light.position.set(1, 0.5, 1).normalize();
directional_light.castShadow = true;
scene.add(directional_light);
var ambient_light = new THREE.AmbientLight(0x444444);
scene.add(ambient_light);
// on initialise la camera que lon place ensuite sur la scène
camera = new Camera(50, container_size.width / container_size.height, 1, 10000);
scene.add(camera);
window.addEventListener('resize', onWindowResize, false);
container.addEventListener('mousedown', click, false);
// on créé un cube au quel on définie un matériau puis on lajoute à la scène
cube = new BouncingCube(200, {color: "red"});
plane = new Plane(1000,1000);
plane.translate(0,0,-100);
cube.addToScene(scene);
plane.addToScene(scene);
objects.push(cube);
objects.push(plane);
}
function animate() {
// on appelle la fonction animate() récursivement à chaque frame
requestAnimationFrame(animate);
cube.update();
camera.update();
camera.look();
renderer.render(scene, camera);
}
function onWindowResize() {
camera.aspect = container.offsetWidth / container.offsetHeight;
camera.updateProjectionMatrix();
renderer.setSize(container.offsetWidth, container.offsetHeight);
renderer.render(scene, camera);
}
function click(event) {
mouse.x = ( ( event.clientX - renderer.domElement.offsetLeft ) / renderer.domElement.width ) * 2 - 1;
mouse.y = - ( ( event.clientY - renderer.domElement.offsetTop ) / renderer.domElement.height ) * 2 + 1;
// For this alternate method, set the canvas position *fixed*; set top > 0, set left > 0; padding must be 0; margin > 0 is OK
//mouse.x = ( ( event.clientX - container.offsetLeft ) / container.clientWidth ) * 2 - 1;
//mouse.y = - ( ( event.clientY - container.offsetTop ) / container.clientHeight ) * 2 + 1;
var vector = new THREE.Vector3(mouse.x, mouse.y, 0.5);
vector.unproject(camera);
raycaster.set(camera.position, vector.sub(camera.position).normalize());
intersects = raycaster.intersectObjects(scene.children);
if ( intersects.length > 0 ) {
for (var i in intersects) {
if (intersects[i].object.id === cube.mesh.id) {
cube.speed.z = 300;
}
}
}
}

22
data/spheres/1.obj Normal file
View File

@ -0,0 +1,22 @@
v 5.88231e-39 100 5.88009e-39
v 5.88231e-39 -100 5.88009e-39
v 86.6025 50.0001 5.88009e-39
v 9.94527e-05 50.0001 86.6025
v -86.6025 50.0001 0.000198905
v -0.000288034 50.0001 -86.6025
v 86.6026 -49.9999 5.88009e-39
v 9.94529e-05 -49.9999 86.6026
v -86.6026 -49.9999 0.000198906
v -0.000288035 -49.9999 -86.6026
f 3 4 8 7
f 4 5 9 8
f 5 6 10 9
f 6 3 7 10
f 1 4 3
f 2 7 8
f 1 5 4
f 2 8 9
f 1 6 5
f 2 9 10
f 1 3 6
f 2 10 7

1642
data/spheres/10.obj Normal file

File diff suppressed because it is too large Load Diff

1982
data/spheres/11.obj Normal file

File diff suppressed because it is too large Load Diff

2354
data/spheres/12.obj Normal file

File diff suppressed because it is too large Load Diff

2758
data/spheres/13.obj Normal file

File diff suppressed because it is too large Load Diff

3194
data/spheres/14.obj Normal file

File diff suppressed because it is too large Load Diff

3662
data/spheres/15.obj Normal file

File diff suppressed because it is too large Load Diff

4162
data/spheres/16.obj Normal file

File diff suppressed because it is too large Load Diff

4694
data/spheres/17.obj Normal file

File diff suppressed because it is too large Load Diff

5258
data/spheres/18.obj Normal file

File diff suppressed because it is too large Load Diff

5854
data/spheres/19.obj Normal file

File diff suppressed because it is too large Load Diff

74
data/spheres/2.obj Normal file
View File

@ -0,0 +1,74 @@
v 5.88231e-39 100 5.88009e-39
v 5.88231e-39 -100 5.88009e-39
v 58.7785 80.9017 5.88009e-39
v 41.5627 80.9017 41.5626
v 6.75001e-05 80.9017 58.7785
v -41.5626 80.9017 41.5627
v -58.7785 80.9017 0.000135
v -41.5628 80.9017 -41.5625
v -0.000195493 80.9017 -58.7785
v 41.5625 80.9017 -41.5628
v 95.1056 30.9018 5.88009e-39
v 67.2499 30.9018 67.2498
v 0.000109218 30.9018 95.1056
v -67.2497 30.9018 67.2499
v -95.1056 30.9018 0.000218435
v -67.25 30.9018 -67.2496
v -0.000316315 30.9018 -95.1056
v 67.2496 30.9018 -67.2501
v 95.1057 -30.9016 5.88009e-39
v 67.2499 -30.9016 67.2498
v 0.000109218 -30.9016 95.1057
v -67.2498 -30.9016 67.25
v -95.1057 -30.9016 0.000218435
v -67.2501 -30.9016 -67.2497
v -0.000316315 -30.9016 -95.1057
v 67.2496 -30.9016 -67.2502
v 58.7787 -80.9016 5.88009e-39
v 41.5628 -80.9016 41.5628
v 6.75003e-05 -80.9016 58.7787
v -41.5627 -80.9016 41.5629
v -58.7787 -80.9016 0.000135001
v -41.5629 -80.9016 -41.5627
v -0.000195494 -80.9016 -58.7787
v 41.5626 -80.9016 -41.563
f 3 4 12 11
f 4 5 13 12
f 5 6 14 13
f 6 7 15 14
f 7 8 16 15
f 8 9 17 16
f 9 10 18 17
f 10 3 11 18
f 11 12 20 19
f 12 13 21 20
f 13 14 22 21
f 14 15 23 22
f 15 16 24 23
f 16 17 25 24
f 17 18 26 25
f 18 11 19 26
f 19 20 28 27
f 20 21 29 28
f 21 22 30 29
f 22 23 31 30
f 23 24 32 31
f 24 25 33 32
f 25 26 34 33
f 26 19 27 34
f 1 4 3
f 2 27 28
f 1 5 4
f 2 28 29
f 1 6 5
f 2 29 30
f 1 7 6
f 2 30 31
f 1 8 7
f 2 31 32
f 1 9 8
f 2 32 33
f 1 10 9
f 2 33 34
f 1 3 10
f 2 34 27

6482
data/spheres/20.obj Normal file

File diff suppressed because it is too large Load Diff

7142
data/spheres/21.obj Normal file

File diff suppressed because it is too large Load Diff

7834
data/spheres/22.obj Normal file

File diff suppressed because it is too large Load Diff

8558
data/spheres/23.obj Normal file

File diff suppressed because it is too large Load Diff

9314
data/spheres/24.obj Normal file

File diff suppressed because it is too large Load Diff

10102
data/spheres/25.obj Normal file

File diff suppressed because it is too large Load Diff

158
data/spheres/3.obj Normal file
View File

@ -0,0 +1,158 @@
v 5.88231e-39 100 5.88009e-39
v 5.88231e-39 -100 5.88009e-39
v 43.3883 90.0969 5.88009e-39
v 37.5754 90.0969 21.6942
v 21.6942 90.0969 37.5754
v 5.49987e-05 90.0969 43.3883
v -21.6941 90.0969 37.5754
v -37.5754 90.0969 21.6942
v -43.3883 90.0969 0.000109997
v -37.5755 90.0969 -21.6941
v -21.6943 90.0969 -37.5753
v -0.000164996 90.0969 -43.3883
v 21.694 90.0969 -37.5755
v 37.5753 90.0969 -21.6943
v 78.1831 62.349 5.88009e-39
v 67.7086 62.349 39.0915
v 39.0916 62.349 67.7085
v 9.91042e-05 62.349 78.1831
v -39.0914 62.349 67.7086
v -67.7085 62.349 39.0917
v -78.1831 62.349 0.000198208
v -67.7087 62.349 -39.0914
v -39.0918 62.349 -67.7084
v -0.000297313 62.349 -78.1831
v 39.0913 62.349 -67.7087
v 67.7084 62.349 -39.0919
v 97.4928 22.2522 5.88009e-39
v 84.4312 22.2522 48.7463
v 48.7465 22.2522 84.4312
v 0.000123581 22.2522 97.4928
v -48.7462 22.2522 84.4313
v -84.4311 22.2522 48.7465
v -97.4928 22.2522 0.000247162
v -84.4314 22.2522 -48.7461
v -48.7467 22.2522 -84.4311
v -0.000370743 22.2522 -97.4928
v 48.7461 22.2522 -84.4314
v 84.431 22.2522 -48.7468
v 97.4928 -22.252 5.88009e-39
v 84.4313 -22.252 48.7464
v 48.7465 -22.252 84.4312
v 0.000123581 -22.252 97.4928
v -48.7463 -22.252 84.4313
v -84.4312 -22.252 48.7466
v -97.4928 -22.252 0.000247162
v -84.4314 -22.252 -48.7462
v -48.7467 -22.252 -84.4311
v -0.000370743 -22.252 -97.4928
v 48.7461 -22.252 -84.4314
v 84.431 -22.252 -48.7468
v 78.1833 -62.3488 5.88009e-39
v 67.7087 -62.3488 39.0916
v 39.0917 -62.3488 67.7087
v 9.91044e-05 -62.3488 78.1833
v -39.0915 -62.3488 67.7087
v -67.7086 -62.3488 39.0918
v -78.1833 -62.3488 0.000198209
v -67.7088 -62.3488 -39.0914
v -39.0918 -62.3488 -67.7086
v -0.000297313 -62.3488 -78.1833
v 39.0914 -62.3488 -67.7088
v 67.7085 -62.3488 -39.0919
v 43.3886 -90.0968 5.88009e-39
v 37.5756 -90.0968 21.6943
v 21.6943 -90.0968 37.5756
v 5.4999e-05 -90.0968 43.3886
v -21.6942 -90.0968 37.5756
v -37.5756 -90.0968 21.6944
v -43.3886 -90.0968 0.000109998
v -37.5757 -90.0968 -21.6942
v -21.6944 -90.0968 -37.5755
v -0.000164997 -90.0968 -43.3886
v 21.6941 -90.0968 -37.5757
v 37.5755 -90.0968 -21.6945
f 3 4 16 15
f 4 5 17 16
f 5 6 18 17
f 6 7 19 18
f 7 8 20 19
f 8 9 21 20
f 9 10 22 21
f 10 11 23 22
f 11 12 24 23
f 12 13 25 24
f 13 14 26 25
f 14 3 15 26
f 15 16 28 27
f 16 17 29 28
f 17 18 30 29
f 18 19 31 30
f 19 20 32 31
f 20 21 33 32
f 21 22 34 33
f 22 23 35 34
f 23 24 36 35
f 24 25 37 36
f 25 26 38 37
f 26 15 27 38
f 27 28 40 39
f 28 29 41 40
f 29 30 42 41
f 30 31 43 42
f 31 32 44 43
f 32 33 45 44
f 33 34 46 45
f 34 35 47 46
f 35 36 48 47
f 36 37 49 48
f 37 38 50 49
f 38 27 39 50
f 39 40 52 51
f 40 41 53 52
f 41 42 54 53
f 42 43 55 54
f 43 44 56 55
f 44 45 57 56
f 45 46 58 57
f 46 47 59 58
f 47 48 60 59
f 48 49 61 60
f 49 50 62 61
f 50 39 51 62
f 51 52 64 63
f 52 53 65 64
f 53 54 66 65
f 54 55 67 66
f 55 56 68 67
f 56 57 69 68
f 57 58 70 69
f 58 59 71 70
f 59 60 72 71
f 60 61 73 72
f 61 62 74 73
f 62 51 63 74
f 1 4 3
f 2 63 64
f 1 5 4
f 2 64 65
f 1 6 5
f 2 65 66
f 1 7 6
f 2 66 67
f 1 8 7
f 2 67 68
f 1 9 8
f 2 68 69
f 1 10 9
f 2 69 70
f 1 11 10
f 2 70 71
f 1 12 11
f 2 71 72
f 1 13 12
f 2 72 73
f 1 14 13
f 2 73 74
f 1 3 14
f 2 74 63

274
data/spheres/4.obj Normal file
View File

@ -0,0 +1,274 @@
v 5.88231e-39 100 5.88009e-39
v 5.88231e-39 -100 5.88009e-39
v 34.202 93.9693 5.88009e-39
v 31.5985 93.9693 13.0885
v 24.1845 93.9693 24.1844
v 13.0886 93.9693 31.5985
v 3.92769e-05 93.9693 34.202
v -13.0885 93.9693 31.5985
v -24.1844 93.9693 24.1845
v -31.5985 93.9693 13.0886
v -34.202 93.9693 7.85539e-05
v -31.5986 93.9693 -13.0885
v -24.1845 93.9693 -24.1844
v -13.0886 93.9693 -31.5985
v -0.000113754 93.9693 -34.202
v 13.0884 93.9693 -31.5986
v 24.1844 93.9693 -24.1846
v 31.5985 93.9693 -13.0887
v 64.2787 76.6045 5.88009e-39
v 59.3858 76.6045 24.5984
v 45.452 76.6045 45.4519
v 24.5985 76.6045 59.3858
v 7.38165e-05 76.6045 64.2787
v -24.5983 76.6045 59.3858
v -45.4518 76.6045 45.452
v -59.3857 76.6045 24.5985
v -64.2787 76.6045 0.000147633
v -59.3859 76.6045 -24.5982
v -45.4521 76.6045 -45.4518
v -24.5986 76.6045 -59.3857
v -0.000213787 76.6045 -64.2787
v 24.5982 76.6045 -59.3859
v 45.4517 76.6045 -45.4521
v 59.3857 76.6045 -24.5987
v 86.6025 50.0001 5.88009e-39
v 80.0103 50.0001 33.1413
v 61.2373 50.0001 61.2372
v 33.1414 50.0001 80.0103
v 9.94527e-05 50.0001 86.6025
v -33.1412 50.0001 80.0103
v -61.2371 50.0001 61.2373
v -80.0102 50.0001 33.1415
v -86.6025 50.0001 0.000198905
v -80.0104 50.0001 -33.1411
v -61.2374 50.0001 -61.237
v -33.1416 50.0001 -80.0102
v -0.000288034 50.0001 -86.6025
v 33.1411 50.0001 -80.0104
v 61.237 50.0001 -61.2375
v 80.0101 50.0001 -33.1417
v 98.4808 17.3649 5.88009e-39
v 90.9844 17.3649 37.6869
v 69.6365 17.3649 69.6364
v 37.687 17.3649 90.9843
v 0.000113093 17.3649 98.4808
v -37.6868 17.3649 90.9844
v -69.6363 17.3649 69.6365
v -90.9843 17.3649 37.6871
v -98.4808 17.3649 0.000226187
v -90.9845 17.3649 -37.6867
v -69.6366 17.3649 -69.6362
v -37.6872 17.3649 -90.9842
v -0.000327541 17.3649 -98.4808
v 37.6866 17.3649 -90.9845
v 69.6361 17.3649 -69.6367
v 90.9842 17.3649 -37.6873
v 98.4808 -17.3647 5.88009e-39
v 90.9844 -17.3647 37.6869
v 69.6365 -17.3647 69.6364
v 37.687 -17.3647 90.9844
v 0.000113094 -17.3647 98.4808
v -37.6868 -17.3647 90.9845
v -69.6363 -17.3647 69.6366
v -90.9843 -17.3647 37.6871
v -98.4808 -17.3647 0.000226187
v -90.9845 -17.3647 -37.6867
v -69.6366 -17.3647 -69.6362
v -37.6872 -17.3647 -90.9843
v -0.000327541 -17.3647 -98.4808
v 37.6866 -17.3647 -90.9845
v 69.6362 -17.3647 -69.6367
v 90.9842 -17.3647 -37.6874
v 86.6026 -49.9999 5.88009e-39
v 80.0104 -49.9999 33.1414
v 61.2373 -49.9999 61.2373
v 33.1414 -49.9999 80.0103
v 9.94528e-05 -49.9999 86.6026
v -33.1413 -49.9999 80.0104
v -61.2372 -49.9999 61.2374
v -80.0103 -49.9999 33.1415
v -86.6026 -49.9999 0.000198906
v -80.0105 -49.9999 -33.1412
v -61.2375 -49.9999 -61.2371
v -33.1416 -49.9999 -80.0103
v -0.000288035 -49.9999 -86.6026
v 33.1411 -49.9999 -80.0105
v 61.237 -49.9999 -61.2375
v 80.0102 -49.9999 -33.1417
v 64.2789 -76.6043 5.88009e-39
v 59.386 -76.6043 24.5984
v 45.4521 -76.6043 45.452
v 24.5985 -76.6043 59.3859
v 7.38167e-05 -76.6043 64.2789
v -24.5984 -76.6043 59.386
v -45.452 -76.6043 45.4521
v -59.3859 -76.6043 24.5986
v -64.2789 -76.6043 0.000147633
v -59.386 -76.6043 -24.5983
v -45.4522 -76.6043 -45.4519
v -24.5986 -76.6043 -59.3859
v -0.000213787 -76.6043 -64.2789
v 24.5983 -76.6043 -59.386
v 45.4519 -76.6043 -45.4522
v 59.3858 -76.6043 -24.5987
v 34.2022 -93.9692 5.88009e-39
v 31.5987 -93.9692 13.0886
v 24.1846 -93.9692 24.1846
v 13.0886 -93.9692 31.5987
v 3.92772e-05 -93.9692 34.2022
v -13.0886 -93.9692 31.5987
v -24.1846 -93.9692 24.1846
v -31.5987 -93.9692 13.0887
v -34.2022 -93.9692 7.85544e-05
v -31.5987 -93.9692 -13.0885
v -24.1847 -93.9692 -24.1845
v -13.0887 -93.9692 -31.5987
v -0.000113754 -93.9692 -34.2022
v 13.0885 -93.9692 -31.5988
v 24.1845 -93.9692 -24.1847
v 31.5987 -93.9692 -13.0888
f 3 4 20 19
f 4 5 21 20
f 5 6 22 21
f 6 7 23 22
f 7 8 24 23
f 8 9 25 24
f 9 10 26 25
f 10 11 27 26
f 11 12 28 27
f 12 13 29 28
f 13 14 30 29
f 14 15 31 30
f 15 16 32 31
f 16 17 33 32
f 17 18 34 33
f 18 3 19 34
f 19 20 36 35
f 20 21 37 36
f 21 22 38 37
f 22 23 39 38
f 23 24 40 39
f 24 25 41 40
f 25 26 42 41
f 26 27 43 42
f 27 28 44 43
f 28 29 45 44
f 29 30 46 45
f 30 31 47 46
f 31 32 48 47
f 32 33 49 48
f 33 34 50 49
f 34 19 35 50
f 35 36 52 51
f 36 37 53 52
f 37 38 54 53
f 38 39 55 54
f 39 40 56 55
f 40 41 57 56
f 41 42 58 57
f 42 43 59 58
f 43 44 60 59
f 44 45 61 60
f 45 46 62 61
f 46 47 63 62
f 47 48 64 63
f 48 49 65 64
f 49 50 66 65
f 50 35 51 66
f 51 52 68 67
f 52 53 69 68
f 53 54 70 69
f 54 55 71 70
f 55 56 72 71
f 56 57 73 72
f 57 58 74 73
f 58 59 75 74
f 59 60 76 75
f 60 61 77 76
f 61 62 78 77
f 62 63 79 78
f 63 64 80 79
f 64 65 81 80
f 65 66 82 81
f 66 51 67 82
f 67 68 84 83
f 68 69 85 84
f 69 70 86 85
f 70 71 87 86
f 71 72 88 87
f 72 73 89 88
f 73 74 90 89
f 74 75 91 90
f 75 76 92 91
f 76 77 93 92
f 77 78 94 93
f 78 79 95 94
f 79 80 96 95
f 80 81 97 96
f 81 82 98 97
f 82 67 83 98
f 83 84 100 99
f 84 85 101 100
f 85 86 102 101
f 86 87 103 102
f 87 88 104 103
f 88 89 105 104
f 89 90 106 105
f 90 91 107 106
f 91 92 108 107
f 92 93 109 108
f 93 94 110 109
f 94 95 111 110
f 95 96 112 111
f 96 97 113 112
f 97 98 114 113
f 98 83 99 114
f 99 100 116 115
f 100 101 117 116
f 101 102 118 117
f 102 103 119 118
f 103 104 120 119
f 104 105 121 120
f 105 106 122 121
f 106 107 123 122
f 107 108 124 123
f 108 109 125 124
f 109 110 126 125
f 110 111 127 126
f 111 112 128 127
f 112 113 129 128
f 113 114 130 129
f 114 99 115 130
f 1 4 3
f 2 115 116
f 1 5 4
f 2 116 117
f 1 6 5
f 2 117 118
f 1 7 6
f 2 118 119
f 1 8 7
f 2 119 120
f 1 9 8
f 2 120 121
f 1 10 9
f 2 121 122
f 1 11 10
f 2 122 123
f 1 12 11
f 2 123 124
f 1 13 12
f 2 124 125
f 1 14 13
f 2 125 126
f 1 15 14
f 2 126 127
f 1 16 15
f 2 127 128
f 1 17 16
f 2 128 129
f 1 18 17
f 2 129 130
f 1 3 18
f 2 130 115

422
data/spheres/5.obj Normal file
View File

@ -0,0 +1,422 @@
v 5.88231e-39 100 5.88009e-39
v 5.88231e-39 -100 5.88009e-39
v 28.1732 95.9493 5.88009e-39
v 26.7943 95.9493 8.706
v 22.7926 95.9493 16.5598
v 16.5598 95.9493 22.7926
v 8.70603 95.9493 26.7943
v 3.23536e-05 95.9493 28.1732
v -8.70597 95.9493 26.7944
v -16.5598 95.9493 22.7927
v -22.7926 95.9493 16.5599
v -26.7943 95.9493 8.70607
v -28.1732 95.9493 6.47072e-05
v -26.7944 95.9493 -8.70594
v -22.7927 95.9493 -16.5597
v -16.5599 95.9493 -22.7926
v -8.70609 95.9493 -26.7943
v -9.37024e-05 95.9493 -28.1732
v 8.70591 95.9493 -26.7944
v 16.5597 95.9493 -22.7927
v 22.7926 95.9493 -16.5599
v 26.7943 95.9493 -8.70612
v 54.064 84.1254 5.88009e-39
v 51.418 84.1254 16.7067
v 43.7387 84.1254 31.778
v 31.7781 84.1254 43.7387
v 16.7068 84.1254 51.4179
v 6.20861e-05 84.1254 54.064
v -16.7066 84.1254 51.418
v -31.778 84.1254 43.7388
v -43.7387 84.1254 31.7781
v -51.4179 84.1254 16.7068
v -54.064 84.1254 0.000124172
v -51.418 84.1254 -16.7066
v -43.7388 84.1254 -31.7779
v -31.7782 84.1254 -43.7386
v -16.7069 84.1254 -51.4179
v -0.000179814 84.1254 -54.064
v 16.7065 84.1254 -51.418
v 31.7779 84.1254 -43.7389
v 43.7386 84.1254 -31.7782
v 51.4179 84.1254 -16.7069
v 75.5749 65.4861 5.88009e-39
v 71.876 65.4861 23.3539
v 61.1414 65.4861 44.4218
v 44.4219 65.4861 61.1414
v 23.354 65.4861 71.876
v 8.67888e-05 65.4861 75.5749
v -23.3538 65.4861 71.876
v -44.4217 65.4861 61.1415
v -61.1413 65.4861 44.4219
v -71.876 65.4861 23.3541
v -75.5749 65.4861 0.000173578
v -71.8761 65.4861 -23.3538
v -61.1415 65.4861 -44.4216
v -44.422 65.4861 -61.1413
v -23.3541 65.4861 -71.8759
v -0.000251357 65.4861 -75.5749
v 23.3537 65.4861 -71.8761
v 44.4216 65.4861 -61.1416
v 61.1412 65.4861 -44.4221
v 71.8759 65.4861 -23.3542
v 90.9632 41.5416 5.88009e-39
v 86.5111 41.5416 28.1091
v 73.5908 41.5416 53.4668
v 53.4669 41.5416 73.5907
v 28.1092 41.5416 86.5111
v 0.00010446 41.5416 90.9632
v -28.109 41.5416 86.5111
v -53.4667 41.5416 73.5908
v -73.5906 41.5416 53.4669
v -86.511 41.5416 28.1094
v -90.9632 41.5416 0.000208921
v -86.5112 41.5416 -28.109
v -73.5909 41.5416 -53.4666
v -53.467 41.5416 -73.5906
v -28.1094 41.5416 -86.511
v -0.000302538 41.5416 -90.9632
v 28.1088 41.5416 -86.5112
v 53.4665 41.5416 -73.591
v 73.5905 41.5416 -53.4671
v 86.511 41.5416 -28.1095
v 98.9821 14.2316 5.88009e-39
v 94.1376 14.2316 30.5871
v 80.0783 14.2316 58.1802
v 58.1803 14.2316 80.0782
v 30.5872 14.2316 94.1376
v 0.000113669 14.2316 98.9821
v -30.587 14.2316 94.1376
v -58.1801 14.2316 80.0783
v -80.0781 14.2316 58.1804
v -94.1375 14.2316 30.5874
v -98.9821 14.2316 0.000227339
v -94.1377 14.2316 -30.5869
v -80.0784 14.2316 -58.18
v -58.1805 14.2316 -80.078
v -30.5874 14.2316 -94.1375
v -0.000329208 14.2316 -98.9821
v 30.5868 14.2316 -94.1377
v 58.1799 14.2316 -80.0785
v 80.078 14.2316 -58.1806
v 94.1375 14.2316 -30.5876
v 98.9822 -14.2314 5.88009e-39
v 94.1376 -14.2314 30.5871
v 80.0783 -14.2314 58.1802
v 58.1803 -14.2314 80.0782
v 30.5873 -14.2314 94.1376
v 0.000113669 -14.2314 98.9822
v -30.587 -14.2314 94.1377
v -58.1801 -14.2314 80.0783
v -80.0781 -14.2314 58.1804
v -94.1376 -14.2314 30.5874
v -98.9822 -14.2314 0.000227339
v -94.1377 -14.2314 -30.5869
v -80.0784 -14.2314 -58.18
v -58.1805 -14.2314 -80.0781
v -30.5875 -14.2314 -94.1375
v -0.000329208 -14.2314 -98.9822
v 30.5868 -14.2314 -94.1377
v 58.1799 -14.2314 -80.0785
v 80.078 -14.2314 -58.1806
v 94.1375 -14.2314 -30.5876
v 90.9633 -41.5414 5.88009e-39
v 86.5112 -41.5414 28.1092
v 73.5909 -41.5414 53.4668
v 53.4669 -41.5414 73.5908
v 28.1093 -41.5414 86.5112
v 0.000104461 -41.5414 90.9633
v -28.1091 -41.5414 86.5112
v -53.4668 -41.5414 73.5909
v -73.5907 -41.5414 53.467
v -86.5111 -41.5414 28.1094
v -90.9633 -41.5414 0.000208921
v -86.5113 -41.5414 -28.109
v -73.591 -41.5414 -53.4667
v -53.4671 -41.5414 -73.5907
v -28.1095 -41.5414 -86.5111
v -0.000302538 -41.5414 -90.9633
v 28.1089 -41.5414 -86.5113
v 53.4666 -41.5414 -73.591
v 73.5906 -41.5414 -53.4672
v 86.5111 -41.5414 -28.1096
v 75.5751 -65.4859 5.88009e-39
v 71.8762 -65.4859 23.354
v 61.1415 -65.4859 44.4219
v 44.422 -65.4859 61.1415
v 23.354 -65.4859 71.8761
v 8.6789e-05 -65.4859 75.5751
v -23.3539 -65.4859 71.8762
v -44.4218 -65.4859 61.1416
v -61.1414 -65.4859 44.422
v -71.8761 -65.4859 23.3541
v -75.5751 -65.4859 0.000173578
v -71.8762 -65.4859 -23.3538
v -61.1416 -65.4859 -44.4217
v -44.4221 -65.4859 -61.1414
v -23.3542 -65.4859 -71.8761
v -0.000251358 -65.4859 -75.5751
v 23.3537 -65.4859 -71.8763
v 44.4217 -65.4859 -61.1417
v 61.1413 -65.4859 -44.4222
v 71.8761 -65.4859 -23.3543
v 54.0642 -84.1253 5.88009e-39
v 51.4182 -84.1253 16.7068
v 43.7389 -84.1253 31.7781
v 31.7782 -84.1253 43.7389
v 16.7068 -84.1253 51.4181
v 6.20864e-05 -84.1253 54.0642
v -16.7067 -84.1253 51.4182
v -31.7781 -84.1253 43.7389
v -43.7388 -84.1253 31.7782
v -51.4181 -84.1253 16.7069
v -54.0642 -84.1253 0.000124173
v -51.4182 -84.1253 -16.7066
v -43.739 -84.1253 -31.778
v -31.7783 -84.1253 -43.7388
v -16.7069 -84.1253 -51.4181
v -0.000179814 -84.1253 -54.0642
v 16.7066 -84.1253 -51.4182
v 31.778 -84.1253 -43.739
v 43.7388 -84.1253 -31.7784
v 51.4181 -84.1253 -16.707
v 28.1735 -95.9492 5.88009e-39
v 26.7946 -95.9492 8.70607
v 22.7928 -95.9492 16.5599
v 16.56 -95.9492 22.7928
v 8.7061 -95.9492 26.7945
v 3.23539e-05 -95.9492 28.1735
v -8.70604 -95.9492 26.7946
v -16.5599 -95.9492 22.7928
v -22.7928 -95.9492 16.56
v -26.7945 -95.9492 8.70614
v -28.1735 -95.9492 6.47078e-05
v -26.7946 -95.9492 -8.70602
v -22.7929 -95.9492 -16.5599
v -16.56 -95.9492 -22.7928
v -8.70616 -95.9492 -26.7945
v -9.37031e-05 -95.9492 -28.1735
v 8.70598 -95.9492 -26.7946
v 16.5599 -95.9492 -22.7929
v 22.7927 -95.9492 -16.56
v 26.7945 -95.9492 -8.70619
f 3 4 24 23
f 4 5 25 24
f 5 6 26 25
f 6 7 27 26
f 7 8 28 27
f 8 9 29 28
f 9 10 30 29
f 10 11 31 30
f 11 12 32 31
f 12 13 33 32
f 13 14 34 33
f 14 15 35 34
f 15 16 36 35
f 16 17 37 36
f 17 18 38 37
f 18 19 39 38
f 19 20 40 39
f 20 21 41 40
f 21 22 42 41
f 22 3 23 42
f 23 24 44 43
f 24 25 45 44
f 25 26 46 45
f 26 27 47 46
f 27 28 48 47
f 28 29 49 48
f 29 30 50 49
f 30 31 51 50
f 31 32 52 51
f 32 33 53 52
f 33 34 54 53
f 34 35 55 54
f 35 36 56 55
f 36 37 57 56
f 37 38 58 57
f 38 39 59 58
f 39 40 60 59
f 40 41 61 60
f 41 42 62 61
f 42 23 43 62
f 43 44 64 63
f 44 45 65 64
f 45 46 66 65
f 46 47 67 66
f 47 48 68 67
f 48 49 69 68
f 49 50 70 69
f 50 51 71 70
f 51 52 72 71
f 52 53 73 72
f 53 54 74 73
f 54 55 75 74
f 55 56 76 75
f 56 57 77 76
f 57 58 78 77
f 58 59 79 78
f 59 60 80 79
f 60 61 81 80
f 61 62 82 81
f 62 43 63 82
f 63 64 84 83
f 64 65 85 84
f 65 66 86 85
f 66 67 87 86
f 67 68 88 87
f 68 69 89 88
f 69 70 90 89
f 70 71 91 90
f 71 72 92 91
f 72 73 93 92
f 73 74 94 93
f 74 75 95 94
f 75 76 96 95
f 76 77 97 96
f 77 78 98 97
f 78 79 99 98
f 79 80 100 99
f 80 81 101 100
f 81 82 102 101
f 82 63 83 102
f 83 84 104 103
f 84 85 105 104
f 85 86 106 105
f 86 87 107 106
f 87 88 108 107
f 88 89 109 108
f 89 90 110 109
f 90 91 111 110
f 91 92 112 111
f 92 93 113 112
f 93 94 114 113
f 94 95 115 114
f 95 96 116 115
f 96 97 117 116
f 97 98 118 117
f 98 99 119 118
f 99 100 120 119
f 100 101 121 120
f 101 102 122 121
f 102 83 103 122
f 103 104 124 123
f 104 105 125 124
f 105 106 126 125
f 106 107 127 126
f 107 108 128 127
f 108 109 129 128
f 109 110 130 129
f 110 111 131 130
f 111 112 132 131
f 112 113 133 132
f 113 114 134 133
f 114 115 135 134
f 115 116 136 135
f 116 117 137 136
f 117 118 138 137
f 118 119 139 138
f 119 120 140 139
f 120 121 141 140
f 121 122 142 141
f 122 103 123 142
f 123 124 144 143
f 124 125 145 144
f 125 126 146 145
f 126 127 147 146
f 127 128 148 147
f 128 129 149 148
f 129 130 150 149
f 130 131 151 150
f 131 132 152 151
f 132 133 153 152
f 133 134 154 153
f 134 135 155 154
f 135 136 156 155
f 136 137 157 156
f 137 138 158 157
f 138 139 159 158
f 139 140 160 159
f 140 141 161 160
f 141 142 162 161
f 142 123 143 162
f 143 144 164 163
f 144 145 165 164
f 145 146 166 165
f 146 147 167 166
f 147 148 168 167
f 148 149 169 168
f 149 150 170 169
f 150 151 171 170
f 151 152 172 171
f 152 153 173 172
f 153 154 174 173
f 154 155 175 174
f 155 156 176 175
f 156 157 177 176
f 157 158 178 177
f 158 159 179 178
f 159 160 180 179
f 160 161 181 180
f 161 162 182 181
f 162 143 163 182
f 163 164 184 183
f 164 165 185 184
f 165 166 186 185
f 166 167 187 186
f 167 168 188 187
f 168 169 189 188
f 169 170 190 189
f 170 171 191 190
f 171 172 192 191
f 172 173 193 192
f 173 174 194 193
f 174 175 195 194
f 175 176 196 195
f 176 177 197 196
f 177 178 198 197
f 178 179 199 198
f 179 180 200 199
f 180 181 201 200
f 181 182 202 201
f 182 163 183 202
f 1 4 3
f 2 183 184
f 1 5 4
f 2 184 185
f 1 6 5
f 2 185 186
f 1 7 6
f 2 186 187
f 1 8 7
f 2 187 188
f 1 9 8
f 2 188 189
f 1 10 9
f 2 189 190
f 1 11 10
f 2 190 191
f 1 12 11
f 2 191 192
f 1 13 12
f 2 192 193
f 1 14 13
f 2 193 194
f 1 15 14
f 2 194 195
f 1 16 15
f 2 195 196
f 1 17 16
f 2 196 197
f 1 18 17
f 2 197 198
f 1 19 18
f 2 198 199
f 1 20 19
f 2 199 200
f 1 21 20
f 2 200 201
f 1 22 21
f 2 201 202
f 1 3 22
f 2 202 183

602
data/spheres/6.obj Normal file
View File

@ -0,0 +1,602 @@
v 5.88231e-39 100 5.88009e-39
v 5.88231e-39 -100 5.88009e-39
v 23.9315 97.0942 5.88009e-39
v 23.1161 97.0942 6.19394
v 20.7253 97.0942 11.9658
v 16.9222 97.0942 16.9221
v 11.9658 97.0942 20.7253
v 6.19396 97.0942 23.1161
v 3.03354e-05 97.0942 23.9315
v -6.19391 97.0942 23.1161
v -11.9657 97.0942 20.7253
v -16.9221 97.0942 16.9222
v -20.7253 97.0942 11.9658
v -23.1161 97.0942 6.19399
v -23.9315 97.0942 6.06708e-05
v -23.1161 97.0942 -6.19388
v -20.7254 97.0942 -11.9657
v -16.9222 97.0942 -16.9221
v -11.9658 97.0942 -20.7253
v -6.19402 97.0942 -23.1161
v -9.10062e-05 97.0942 -23.9315
v 6.19385 97.0942 -23.1161
v 11.9657 97.0942 -20.7254
v 16.9221 97.0942 -16.9222
v 20.7253 97.0942 -11.9659
v 23.1161 97.0942 -6.19405
v 46.4723 88.5456 5.88009e-39
v 44.8888 88.5456 12.0279
v 40.2462 88.5456 23.2361
v 32.8609 88.5456 32.8608
v 23.2362 88.5456 40.2462
v 12.028 88.5456 44.8888
v 5.89078e-05 88.5456 46.4723
v -12.0278 88.5456 44.8888
v -23.2361 88.5456 40.2462
v -32.8608 88.5456 32.8609
v -40.2461 88.5456 23.2362
v -44.8888 88.5456 12.028
v -46.4723 88.5456 0.000117816
v -44.8888 88.5456 -12.0278
v -40.2462 88.5456 -23.236
v -32.861 88.5456 -32.8608
v -23.2363 88.5456 -40.2461
v -12.0281 88.5456 -44.8887
v -0.000176724 88.5456 -46.4723
v 12.0277 88.5456 -44.8888
v 23.236 88.5456 -40.2463
v 32.8607 88.5456 -32.861
v 40.2461 88.5456 -23.2363
v 44.8887 88.5456 -12.0281
v 66.3122 74.8511 5.88009e-39
v 64.0527 74.8511 17.1629
v 57.4281 74.8511 33.1561
v 46.8899 74.8511 46.8898
v 33.1562 74.8511 57.428
v 17.1629 74.8511 64.0527
v 8.40568e-05 74.8511 66.3122
v -17.1628 74.8511 64.0527
v -33.156 74.8511 57.4281
v -46.8897 74.8511 46.8899
v -57.428 74.8511 33.1562
v -64.0527 74.8511 17.163
v -66.3122 74.8511 0.000168114
v -64.0527 74.8511 -17.1627
v -57.4282 74.8511 -33.1559
v -46.89 74.8511 -46.8897
v -33.1563 74.8511 -57.428
v -17.1631 74.8511 -64.0526
v -0.00025217 74.8511 -66.3122
v 17.1626 74.8511 -64.0528
v 33.1559 74.8511 -57.4282
v 46.8896 74.8511 -46.89
v 57.4279 74.8511 -33.1564
v 64.0526 74.8511 -17.1632
v 82.2983 56.8065 5.88009e-39
v 79.4941 56.8065 21.3004
v 71.2725 56.8065 41.1491
v 58.1938 56.8065 58.1937
v 41.1492 56.8065 71.2724
v 21.3005 56.8065 79.4941
v 0.000104321 56.8065 82.2983
v -21.3003 56.8065 79.4941
v -41.1491 56.8065 71.2725
v -58.1936 56.8065 58.1938
v -71.2724 56.8065 41.1493
v -79.494 56.8065 21.3006
v -82.2983 56.8065 0.000208641
v -79.4942 56.8065 -21.3002
v -71.2726 56.8065 -41.149
v -58.1939 56.8065 -58.1936
v -41.1494 56.8065 -71.2723
v -21.3006 56.8065 -79.494
v -0.000312962 56.8065 -82.2983
v 21.3001 56.8065 -79.4942
v 41.1489 56.8065 -71.2726
v 58.1935 56.8065 -58.194
v 71.2723 56.8065 -41.1495
v 79.494 56.8065 -21.3007
v 93.5016 35.4606 5.88009e-39
v 90.3156 35.4606 24.2
v 80.9748 35.4606 46.7508
v 66.1157 35.4606 66.1156
v 46.7509 35.4606 80.9747
v 24.2001 35.4606 90.3156
v 0.000118522 35.4606 93.5016
v -24.1999 35.4606 90.3156
v -46.7507 35.4606 80.9748
v -66.1155 35.4606 66.1157
v -80.9747 35.4606 46.751
v -90.3156 35.4606 24.2002
v -93.5016 35.4606 0.000237044
v -90.3157 35.4606 -24.1998
v -80.9749 35.4606 -46.7506
v -66.1158 35.4606 -66.1154
v -46.7511 35.4606 -80.9746
v -24.2003 35.4606 -90.3155
v -0.000355565 35.4606 -93.5016
v 24.1996 35.4606 -90.3157
v 46.7505 35.4606 -80.9749
v 66.1153 35.4606 -66.1159
v 80.9745 35.4606 -46.7512
v 90.3155 35.4606 -24.2004
v 99.2709 12.0538 5.88009e-39
v 95.8883 12.0538 25.6932
v 85.9711 12.0538 49.6354
v 70.1952 12.0538 70.1951
v 49.6355 12.0538 85.9711
v 25.6933 12.0538 95.8883
v 0.000125835 12.0538 99.2709
v -25.6931 12.0538 95.8883
v -49.6353 12.0538 85.9712
v -70.195 12.0538 70.1952
v -85.971 12.0538 49.6356
v -95.8882 12.0538 25.6934
v -99.2709 12.0538 0.00025167
v -95.8884 12.0538 -25.6929
v -85.9712 12.0538 -49.6352
v -70.1953 12.0538 -70.1949
v -49.6357 12.0538 -85.9709
v -25.6935 12.0538 -95.8882
v -0.000377505 12.0538 -99.2709
v 25.6928 12.0538 -95.8884
v 49.6351 12.0538 -85.9713
v 70.1948 12.0538 -70.1954
v 85.9709 12.0538 -49.6358
v 95.8882 12.0538 -25.6936
v 99.2709 -12.0535 5.88009e-39
v 95.8883 -12.0535 25.6932
v 85.9711 -12.0535 49.6354
v 70.1952 -12.0535 70.1951
v 49.6355 -12.0535 85.9711
v 25.6933 -12.0535 95.8883
v 0.000125835 -12.0535 99.2709
v -25.6931 -12.0535 95.8884
v -49.6353 -12.0535 85.9712
v -70.195 -12.0535 70.1953
v -85.971 -12.0535 49.6356
v -95.8883 -12.0535 25.6934
v -99.2709 -12.0535 0.00025167
v -95.8884 -12.0535 -25.693
v -85.9713 -12.0535 -49.6352
v -70.1953 -12.0535 -70.1949
v -49.6357 -12.0535 -85.971
v -25.6935 -12.0535 -95.8882
v -0.000377505 -12.0535 -99.2709
v 25.6928 -12.0535 -95.8884
v 49.6351 -12.0535 -85.9713
v 70.1948 -12.0535 -70.1954
v 85.9709 -12.0535 -49.6358
v 95.8882 -12.0535 -25.6936
v 93.5017 -35.4604 5.88009e-39
v 90.3157 -35.4604 24.2
v 80.9748 -35.4604 46.7508
v 66.1157 -35.4604 66.1156
v 46.7509 -35.4604 80.9748
v 24.2001 -35.4604 90.3157
v 0.000118522 -35.4604 93.5017
v -24.1999 -35.4604 90.3157
v -46.7507 -35.4604 80.9749
v -66.1155 -35.4604 66.1158
v -80.9747 -35.4604 46.751
v -90.3156 -35.4604 24.2002
v -93.5017 -35.4604 0.000237044
v -90.3158 -35.4604 -24.1998
v -80.975 -35.4604 -46.7506
v -66.1159 -35.4604 -66.1155
v -46.7511 -35.4604 -80.9747
v -24.2003 -35.4604 -90.3156
v -0.000355566 -35.4604 -93.5017
v 24.1997 -35.4604 -90.3158
v 46.7505 -35.4604 -80.975
v 66.1154 -35.4604 -66.116
v 80.9746 -35.4604 -46.7512
v 90.3156 -35.4604 -24.2004
v 82.2985 -56.8063 5.88009e-39
v 79.4942 -56.8063 21.3004
v 71.2726 -56.8063 41.1492
v 58.1939 -56.8063 58.1938
v 41.1493 -56.8063 71.2725
v 21.3005 -56.8063 79.4942
v 0.000104321 -56.8063 82.2985
v -21.3003 -56.8063 79.4943
v -41.1491 -56.8063 71.2726
v -58.1937 -56.8063 58.1939
v -71.2725 -56.8063 41.1494
v -79.4942 -56.8063 21.3006
v -82.2985 -56.8063 0.000208642
v -79.4943 -56.8063 -21.3002
v -71.2727 -56.8063 -41.149
v -58.194 -56.8063 -58.1936
v -41.1495 -56.8063 -71.2724
v -21.3007 -56.8063 -79.4942
v -0.000312962 -56.8063 -82.2985
v 21.3001 -56.8063 -79.4943
v 41.149 -56.8063 -71.2727
v 58.1936 -56.8063 -58.1941
v 71.2724 -56.8063 -41.1496
v 79.4941 -56.8063 -21.3008
v 66.3124 -74.851 5.88009e-39
v 64.0529 -74.851 17.1629
v 57.4282 -74.851 33.1562
v 46.89 -74.851 46.8899
v 33.1562 -74.851 57.4282
v 17.163 -74.851 64.0528
v 8.4057e-05 -74.851 66.3124
v -17.1628 -74.851 64.0529
v -33.1561 -74.851 57.4283
v -46.8899 -74.851 46.89
v -57.4282 -74.851 33.1563
v -64.0528 -74.851 17.1631
v -66.3124 -74.851 0.000168114
v -64.0529 -74.851 -17.1627
v -57.4283 -74.851 -33.156
v -46.8901 -74.851 -46.8898
v -33.1564 -74.851 -57.4281
v -17.1631 -74.851 -64.0528
v -0.000252171 -74.851 -66.3124
v 17.1627 -74.851 -64.0529
v 33.156 -74.851 -57.4284
v 46.8897 -74.851 -46.8902
v 57.4281 -74.851 -33.1565
v 64.0528 -74.851 -17.1632
v 46.4725 -88.5455 5.88009e-39
v 44.889 -88.5455 12.028
v 40.2464 -88.5455 23.2362
v 32.861 -88.5455 32.861
v 23.2363 -88.5455 40.2463
v 12.028 -88.5455 44.889
v 5.89081e-05 -88.5455 46.4725
v -12.0279 -88.5455 44.889
v -23.2362 -88.5455 40.2464
v -32.861 -88.5455 32.8611
v -40.2463 -88.5455 23.2363
v -44.889 -88.5455 12.0281
v -46.4725 -88.5455 0.000117816
v -44.889 -88.5455 -12.0279
v -40.2464 -88.5455 -23.2361
v -32.8611 -88.5455 -32.8609
v -23.2364 -88.5455 -40.2463
v -12.0281 -88.5455 -44.8889
v -0.000176724 -88.5455 -46.4725
v 12.0278 -88.5455 -44.889
v 23.2361 -88.5455 -40.2465
v 32.8609 -88.5455 -32.8612
v 40.2463 -88.5455 -23.2364
v 44.8889 -88.5455 -12.0282
v 23.9318 -97.0941 5.88009e-39
v 23.1163 -97.0941 6.19399
v 20.7255 -97.0941 11.9659
v 16.9223 -97.0941 16.9223
v 11.9659 -97.0941 20.7255
v 6.19402 -97.0941 23.1163
v 3.03357e-05 -97.0941 23.9318
v -6.19397 -97.0941 23.1163
v -11.9659 -97.0941 20.7255
v -16.9223 -97.0941 16.9224
v -20.7255 -97.0941 11.9659
v -23.1163 -97.0941 6.19405
v -23.9318 -97.0941 6.06714e-05
v -23.1163 -97.0941 -6.19394
v -20.7256 -97.0941 -11.9658
v -16.9224 -97.0941 -16.9223
v -11.966 -97.0941 -20.7255
v -6.19408 -97.0941 -23.1163
v -9.10071e-05 -97.0941 -23.9318
v 6.19391 -97.0941 -23.1163
v 11.9658 -97.0941 -20.7256
v 16.9222 -97.0941 -16.9224
v 20.7255 -97.0941 -11.966
v 23.1163 -97.0941 -6.1941
f 3 4 28 27
f 4 5 29 28
f 5 6 30 29
f 6 7 31 30
f 7 8 32 31
f 8 9 33 32
f 9 10 34 33
f 10 11 35 34
f 11 12 36 35
f 12 13 37 36
f 13 14 38 37
f 14 15 39 38
f 15 16 40 39
f 16 17 41 40
f 17 18 42 41
f 18 19 43 42
f 19 20 44 43
f 20 21 45 44
f 21 22 46 45
f 22 23 47 46
f 23 24 48 47
f 24 25 49 48
f 25 26 50 49
f 26 3 27 50
f 27 28 52 51
f 28 29 53 52
f 29 30 54 53
f 30 31 55 54
f 31 32 56 55
f 32 33 57 56
f 33 34 58 57
f 34 35 59 58
f 35 36 60 59
f 36 37 61 60
f 37 38 62 61
f 38 39 63 62
f 39 40 64 63
f 40 41 65 64
f 41 42 66 65
f 42 43 67 66
f 43 44 68 67
f 44 45 69 68
f 45 46 70 69
f 46 47 71 70
f 47 48 72 71
f 48 49 73 72
f 49 50 74 73
f 50 27 51 74
f 51 52 76 75
f 52 53 77 76
f 53 54 78 77
f 54 55 79 78
f 55 56 80 79
f 56 57 81 80
f 57 58 82 81
f 58 59 83 82
f 59 60 84 83
f 60 61 85 84
f 61 62 86 85
f 62 63 87 86
f 63 64 88 87
f 64 65 89 88
f 65 66 90 89
f 66 67 91 90
f 67 68 92 91
f 68 69 93 92
f 69 70 94 93
f 70 71 95 94
f 71 72 96 95
f 72 73 97 96
f 73 74 98 97
f 74 51 75 98
f 75 76 100 99
f 76 77 101 100
f 77 78 102 101
f 78 79 103 102
f 79 80 104 103
f 80 81 105 104
f 81 82 106 105
f 82 83 107 106
f 83 84 108 107
f 84 85 109 108
f 85 86 110 109
f 86 87 111 110
f 87 88 112 111
f 88 89 113 112
f 89 90 114 113
f 90 91 115 114
f 91 92 116 115
f 92 93 117 116
f 93 94 118 117
f 94 95 119 118
f 95 96 120 119
f 96 97 121 120
f 97 98 122 121
f 98 75 99 122
f 99 100 124 123
f 100 101 125 124
f 101 102 126 125
f 102 103 127 126
f 103 104 128 127
f 104 105 129 128
f 105 106 130 129
f 106 107 131 130
f 107 108 132 131
f 108 109 133 132
f 109 110 134 133
f 110 111 135 134
f 111 112 136 135
f 112 113 137 136
f 113 114 138 137
f 114 115 139 138
f 115 116 140 139
f 116 117 141 140
f 117 118 142 141
f 118 119 143 142
f 119 120 144 143
f 120 121 145 144
f 121 122 146 145
f 122 99 123 146
f 123 124 148 147
f 124 125 149 148
f 125 126 150 149
f 126 127 151 150
f 127 128 152 151
f 128 129 153 152
f 129 130 154 153
f 130 131 155 154
f 131 132 156 155
f 132 133 157 156
f 133 134 158 157
f 134 135 159 158
f 135 136 160 159
f 136 137 161 160
f 137 138 162 161
f 138 139 163 162
f 139 140 164 163
f 140 141 165 164
f 141 142 166 165
f 142 143 167 166
f 143 144 168 167
f 144 145 169 168
f 145 146 170 169
f 146 123 147 170
f 147 148 172 171
f 148 149 173 172
f 149 150 174 173
f 150 151 175 174
f 151 152 176 175
f 152 153 177 176
f 153 154 178 177
f 154 155 179 178
f 155 156 180 179
f 156 157 181 180
f 157 158 182 181
f 158 159 183 182
f 159 160 184 183
f 160 161 185 184
f 161 162 186 185
f 162 163 187 186
f 163 164 188 187
f 164 165 189 188
f 165 166 190 189
f 166 167 191 190
f 167 168 192 191
f 168 169 193 192
f 169 170 194 193
f 170 147 171 194
f 171 172 196 195
f 172 173 197 196
f 173 174 198 197
f 174 175 199 198
f 175 176 200 199
f 176 177 201 200
f 177 178 202 201
f 178 179 203 202
f 179 180 204 203
f 180 181 205 204
f 181 182 206 205
f 182 183 207 206
f 183 184 208 207
f 184 185 209 208
f 185 186 210 209
f 186 187 211 210
f 187 188 212 211
f 188 189 213 212
f 189 190 214 213
f 190 191 215 214
f 191 192 216 215
f 192 193 217 216
f 193 194 218 217
f 194 171 195 218
f 195 196 220 219
f 196 197 221 220
f 197 198 222 221
f 198 199 223 222
f 199 200 224 223
f 200 201 225 224
f 201 202 226 225
f 202 203 227 226
f 203 204 228 227
f 204 205 229 228
f 205 206 230 229
f 206 207 231 230
f 207 208 232 231
f 208 209 233 232
f 209 210 234 233
f 210 211 235 234
f 211 212 236 235
f 212 213 237 236
f 213 214 238 237
f 214 215 239 238
f 215 216 240 239
f 216 217 241 240
f 217 218 242 241
f 218 195 219 242
f 219 220 244 243
f 220 221 245 244
f 221 222 246 245
f 222 223 247 246
f 223 224 248 247
f 224 225 249 248
f 225 226 250 249
f 226 227 251 250
f 227 228 252 251
f 228 229 253 252
f 229 230 254 253
f 230 231 255 254
f 231 232 256 255
f 232 233 257 256
f 233 234 258 257
f 234 235 259 258
f 235 236 260 259
f 236 237 261 260
f 237 238 262 261
f 238 239 263 262
f 239 240 264 263
f 240 241 265 264
f 241 242 266 265
f 242 219 243 266
f 243 244 268 267
f 244 245 269 268
f 245 246 270 269
f 246 247 271 270
f 247 248 272 271
f 248 249 273 272
f 249 250 274 273
f 250 251 275 274
f 251 252 276 275
f 252 253 277 276
f 253 254 278 277
f 254 255 279 278
f 255 256 280 279
f 256 257 281 280
f 257 258 282 281
f 258 259 283 282
f 259 260 284 283
f 260 261 285 284
f 261 262 286 285
f 262 263 287 286
f 263 264 288 287
f 264 265 289 288
f 265 266 290 289
f 266 243 267 290
f 1 4 3
f 2 267 268
f 1 5 4
f 2 268 269
f 1 6 5
f 2 269 270
f 1 7 6
f 2 270 271
f 1 8 7
f 2 271 272
f 1 9 8
f 2 272 273
f 1 10 9
f 2 273 274
f 1 11 10
f 2 274 275
f 1 12 11
f 2 275 276
f 1 13 12
f 2 276 277
f 1 14 13
f 2 277 278
f 1 15 14
f 2 278 279
f 1 16 15
f 2 279 280
f 1 17 16
f 2 280 281
f 1 18 17
f 2 281 282
f 1 19 18
f 2 282 283
f 1 20 19
f 2 283 284
f 1 21 20
f 2 284 285
f 1 22 21
f 2 285 286
f 1 23 22
f 2 286 287
f 1 24 23
f 2 287 288
f 1 25 24
f 2 288 289
f 1 26 25
f 2 289 290
f 1 3 26
f 2 290 267

814
data/spheres/7.obj Normal file
View File

@ -0,0 +1,814 @@
v 5.88231e-39 100 5.88009e-39
v 5.88231e-39 -100 5.88009e-39
v 20.7912 97.8148 5.88009e-39
v 20.2699 97.8148 4.62646
v 18.7322 97.8148 9.02094
v 16.2552 97.8148 12.9631
v 12.9631 97.8148 16.2552
v 9.02096 97.8148 18.7322
v 4.62649 97.8148 20.2699
v 2.63547e-05 97.8148 20.7912
v -4.62644 97.8148 20.2699
v -9.02091 97.8148 18.7322
v -12.963 97.8148 16.2552
v -16.2552 97.8148 12.9631
v -18.7322 97.8148 9.02099
v -20.2699 97.8148 4.62652
v -20.7912 97.8148 5.27093e-05
v -20.2699 97.8148 -4.62641
v -18.7322 97.8148 -9.02089
v -16.2552 97.8148 -12.963
v -12.9631 97.8148 -16.2551
v -9.02101 97.8148 -18.7321
v -4.62654 97.8148 -20.2699
v -7.9064e-05 97.8148 -20.7912
v 4.62639 97.8148 -20.2699
v 9.02087 97.8148 -18.7322
v 12.963 97.8148 -16.2552
v 16.2551 97.8148 -12.9631
v 18.7321 97.8148 -9.02103
v 20.2699 97.8148 -4.62656
v 40.6736 91.3546 5.88009e-39
v 39.6539 91.3546 9.05073
v 36.6457 91.3546 17.6476
v 31.7999 91.3546 25.3596
v 25.3596 91.3546 31.7999
v 17.6477 91.3546 36.6457
v 9.05078 91.3546 39.6539
v 5.15575e-05 91.3546 40.6736
v -9.05068 91.3546 39.6539
v -17.6476 91.3546 36.6457
v -25.3595 91.3546 31.8
v -31.7999 91.3546 25.3597
v -36.6456 91.3546 17.6477
v -39.6538 91.3546 9.05083
v -40.6736 91.3546 0.000103115
v -39.6539 91.3546 -9.05063
v -36.6457 91.3546 -17.6475
v -31.8 91.3546 -25.3595
v -25.3597 91.3546 -31.7998
v -17.6478 91.3546 -36.6456
v -9.05087 91.3546 -39.6538
v -0.000154673 91.3546 -40.6736
v 9.05059 91.3546 -39.6539
v 17.6475 91.3546 -36.6457
v 25.3595 91.3546 -31.8
v 31.7998 91.3546 -25.3597
v 36.6456 91.3546 -17.6478
v 39.6538 91.3546 -9.05092
v 58.7785 80.9017 5.88009e-39
v 57.3048 80.9017 13.0794
v 52.9576 80.9017 25.503
v 45.9549 80.9017 36.6478
v 36.6478 80.9017 45.9548
v 25.5031 80.9017 52.9576
v 13.0795 80.9017 57.3048
v 7.45071e-05 80.9017 58.7785
v -13.0794 80.9017 57.3048
v -25.5029 80.9017 52.9576
v -36.6477 80.9017 45.9549
v -45.9548 80.9017 36.6479
v -52.9575 80.9017 25.5031
v -57.3048 80.9017 13.0796
v -58.7785 80.9017 0.000149014
v -57.3048 80.9017 -13.0793
v -52.9577 80.9017 -25.5029
v -45.955 80.9017 -36.6477
v -36.6479 80.9017 -45.9548
v -25.5032 80.9017 -52.9575
v -13.0796 80.9017 -57.3047
v -0.000223521 80.9017 -58.7785
v 13.0792 80.9017 -57.3048
v 25.5028 80.9017 -52.9577
v 36.6476 80.9017 -45.955
v 45.9547 80.9017 -36.648
v 52.9575 80.9017 -25.5033
v 57.3047 80.9017 -13.0797
v 74.3144 66.9131 5.88009e-39
v 72.4512 66.9131 16.5365
v 66.955 66.9131 32.2438
v 58.1014 66.9131 46.3343
v 46.3343 66.9131 58.1013
v 32.2439 66.9131 66.955
v 16.5366 66.9131 72.4512
v 9.42003e-05 66.9131 74.3144
v -16.5364 66.9131 72.4512
v -32.2437 66.9131 66.955
v -46.3342 66.9131 58.1014
v -58.1013 66.9131 46.3344
v -66.9549 66.9131 32.244
v -72.4512 66.9131 16.5367
v -74.3144 66.9131 0.000188401
v -72.4513 66.9131 -16.5363
v -66.9551 66.9131 -32.2436
v -58.1015 66.9131 -46.3341
v -46.3345 66.9131 -58.1012
v -32.2441 66.9131 -66.9549
v -16.5368 66.9131 -72.4512
v -0.000282601 66.9131 -74.3144
v 16.5362 66.9131 -72.4513
v 32.2436 66.9131 -66.9551
v 46.334 66.9131 -58.1016
v 58.1012 66.9131 -46.3345
v 66.9548 66.9131 -32.2441
v 72.4511 66.9131 -16.5369
v 86.6025 50.0001 5.88009e-39
v 84.4312 50.0001 19.2709
v 78.0262 50.0001 37.5754
v 67.7086 50.0001 53.9957
v 53.9958 50.0001 67.7085
v 37.5755 50.0001 78.0261
v 19.271 50.0001 84.4312
v 0.000109777 50.0001 86.6025
v -19.2708 50.0001 84.4312
v -37.5753 50.0001 78.0262
v -53.9957 50.0001 67.7087
v -67.7085 50.0001 53.9959
v -78.0261 50.0001 37.5756
v -84.4312 50.0001 19.2711
v -86.6025 50.0001 0.000219553
v -84.4312 50.0001 -19.2706
v -78.0263 50.0001 -37.5752
v -67.7087 50.0001 -53.9956
v -53.996 50.0001 -67.7084
v -37.5757 50.0001 -78.026
v -19.2712 50.0001 -84.4311
v -0.00032933 50.0001 -86.6025
v 19.2706 50.0001 -84.4313
v 37.5751 50.0001 -78.0263
v 53.9955 50.0001 -67.7088
v 67.7083 50.0001 -53.9961
v 78.026 50.0001 -37.5758
v 84.4311 50.0001 -19.2713
v 95.1056 30.9018 5.88009e-39
v 92.7211 30.9018 21.163
v 85.6872 30.9018 41.2648
v 74.3566 30.9018 59.2973
v 59.2974 30.9018 74.3565
v 41.2649 30.9018 85.6872
v 21.1631 30.9018 92.7211
v 0.000120555 30.9018 95.1056
v -21.1629 30.9018 92.7212
v -41.2646 30.9018 85.6873
v -59.2973 30.9018 74.3567
v -74.3565 30.9018 59.2975
v -85.6871 30.9018 41.265
v -92.7211 30.9018 21.1632
v -95.1056 30.9018 0.00024111
v -92.7212 30.9018 -21.1627
v -85.6873 30.9018 -41.2645
v -74.3567 30.9018 -59.2972
v -59.2976 30.9018 -74.3564
v -41.2651 30.9018 -85.6871
v -21.1633 30.9018 -92.7211
v -0.000361665 30.9018 -95.1056
v 21.1626 30.9018 -92.7212
v 41.2644 30.9018 -85.6874
v 59.2971 30.9018 -74.3568
v 74.3563 30.9018 -59.2977
v 85.687 30.9018 -41.2652
v 92.721 30.9018 -21.1634
v 99.4522 10.453 5.88009e-39
v 96.9587 10.453 22.1302
v 89.6033 10.453 43.1507
v 77.7549 10.453 62.0074
v 62.0075 10.453 77.7548
v 43.1508 10.453 89.6033
v 22.1303 10.453 96.9587
v 0.000126065 10.453 99.4522
v -22.1301 10.453 96.9587
v -43.1505 10.453 89.6034
v -62.0073 10.453 77.755
v -77.7547 10.453 62.0076
v -89.6032 10.453 43.1509
v -96.9586 10.453 22.1304
v -99.4522 10.453 0.000252129
v -96.9588 10.453 -22.1299
v -89.6034 10.453 -43.1504
v -77.755 10.453 -62.0072
v -62.0077 10.453 -77.7547
v -43.151 10.453 -89.6032
v -22.1305 10.453 -96.9586
v -0.000378194 10.453 -99.4522
v 22.1298 10.453 -96.9588
v 43.1503 10.453 -89.6035
v 62.0071 10.453 -77.7551
v 77.7546 10.453 -62.0078
v 89.6031 10.453 -43.1511
v 96.9586 10.453 -22.1306
v 99.4522 -10.4527 5.88009e-39
v 96.9587 -10.4527 22.1302
v 89.6034 -10.4527 43.1507
v 77.7549 -10.4527 62.0074
v 62.0075 -10.4527 77.7548
v 43.1508 -10.4527 89.6033
v 22.1303 -10.4527 96.9587
v 0.000126065 -10.4527 99.4522
v -22.1301 -10.4527 96.9588
v -43.1506 -10.4527 89.6034
v -62.0073 -10.4527 77.755
v -77.7547 -10.4527 62.0076
v -89.6032 -10.4527 43.1509
v -96.9587 -10.4527 22.1304
v -99.4522 -10.4527 0.000252129
v -96.9588 -10.4527 -22.1299
v -89.6035 -10.4527 -43.1504
v -77.7551 -10.4527 -62.0072
v -62.0077 -10.4527 -77.7547
v -43.151 -10.4527 -89.6032
v -22.1305 -10.4527 -96.9586
v -0.000378194 -10.4527 -99.4522
v 22.1298 -10.4527 -96.9588
v 43.1503 -10.4527 -89.6035
v 62.0071 -10.4527 -77.7551
v 77.7546 -10.4527 -62.0078
v 89.6031 -10.4527 -43.1511
v 96.9586 -10.4527 -22.1307
v 95.1057 -30.9016 5.88009e-39
v 92.7212 -30.9016 21.163
v 85.6873 -30.9016 41.2648
v 74.3567 -30.9016 59.2974
v 59.2975 -30.9016 74.3566
v 41.2649 -30.9016 85.6872
v 21.1631 -30.9016 92.7212
v 0.000120555 -30.9016 95.1057
v -21.1629 -30.9016 92.7212
v -41.2647 -30.9016 85.6873
v -59.2973 -30.9016 74.3567
v -74.3565 -30.9016 59.2976
v -85.6872 -30.9016 41.265
v -92.7211 -30.9016 21.1632
v -95.1057 -30.9016 0.00024111
v -92.7213 -30.9016 -21.1628
v -85.6874 -30.9016 -41.2646
v -74.3568 -30.9016 -59.2972
v -59.2977 -30.9016 -74.3564
v -41.2651 -30.9016 -85.6871
v -21.1633 -30.9016 -92.7211
v -0.000361665 -30.9016 -95.1057
v 21.1627 -30.9016 -92.7213
v 41.2645 -30.9016 -85.6874
v 59.2971 -30.9016 -74.3569
v 74.3564 -30.9016 -59.2978
v 85.6871 -30.9016 -41.2652
v 92.7211 -30.9016 -21.1634
v 86.6026 -49.9999 5.88009e-39
v 84.4313 -49.9999 19.2709
v 78.0263 -49.9999 37.5754
v 67.7087 -49.9999 53.9958
v 53.9959 -49.9999 67.7086
v 37.5755 -49.9999 78.0262
v 19.271 -49.9999 84.4313
v 0.000109777 -49.9999 86.6026
v -19.2708 -49.9999 84.4313
v -37.5753 -49.9999 78.0263
v -53.9957 -49.9999 67.7087
v -67.7086 -49.9999 53.996
v -78.0262 -49.9999 37.5756
v -84.4313 -49.9999 19.2711
v -86.6026 -49.9999 0.000219553
v -84.4314 -49.9999 -19.2707
v -78.0264 -49.9999 -37.5752
v -67.7088 -49.9999 -53.9957
v -53.9961 -49.9999 -67.7085
v -37.5757 -49.9999 -78.0261
v -19.2712 -49.9999 -84.4313
v -0.00032933 -49.9999 -86.6026
v 19.2706 -49.9999 -84.4314
v 37.5751 -49.9999 -78.0264
v 53.9955 -49.9999 -67.7089
v 67.7084 -49.9999 -53.9962
v 78.0261 -49.9999 -37.5758
v 84.4312 -49.9999 -19.2713
v 74.3146 -66.9129 5.88009e-39
v 72.4514 -66.9129 16.5365
v 66.9552 -66.9129 32.2439
v 58.1015 -66.9129 46.3344
v 46.3344 -66.9129 58.1015
v 32.244 -66.9129 66.9551
v 16.5366 -66.9129 72.4514
v 9.42005e-05 -66.9129 74.3146
v -16.5365 -66.9129 72.4514
v -32.2438 -66.9129 66.9552
v -46.3343 -66.9129 58.1016
v -58.1014 -66.9129 46.3345
v -66.9551 -66.9129 32.244
v -72.4513 -66.9129 16.5367
v -74.3146 -66.9129 0.000188401
v -72.4514 -66.9129 -16.5364
v -66.9552 -66.9129 -32.2437
v -58.1016 -66.9129 -46.3342
v -46.3346 -66.9129 -58.1014
v -32.2441 -66.9129 -66.955
v -16.5368 -66.9129 -72.4513
v -0.000282602 -66.9129 -74.3146
v 16.5363 -66.9129 -72.4514
v 32.2436 -66.9129 -66.9553
v 46.3341 -66.9129 -58.1017
v 58.1013 -66.9129 -46.3347
v 66.955 -66.9129 -32.2442
v 72.4513 -66.9129 -16.5369
v 58.7787 -80.9016 5.88009e-39
v 57.305 -80.9016 13.0795
v 52.9578 -80.9016 25.5031
v 45.955 -80.9016 36.6479
v 36.6479 -80.9016 45.955
v 25.5032 -80.9016 52.9577
v 13.0795 -80.9016 57.305
v 7.45073e-05 -80.9016 58.7787
v -13.0794 -80.9016 57.305
v -25.503 -80.9016 52.9578
v -36.6478 -80.9016 45.9551
v -45.955 -80.9016 36.648
v -52.9577 -80.9016 25.5032
v -57.3049 -80.9016 13.0796
v -58.7787 -80.9016 0.000149015
v -57.305 -80.9016 -13.0793
v -52.9578 -80.9016 -25.503
v -45.9551 -80.9016 -36.6478
v -36.648 -80.9016 -45.9549
v -25.5033 -80.9016 -52.9577
v -13.0797 -80.9016 -57.3049
v -0.000223522 -80.9016 -58.7787
v 13.0793 -80.9016 -57.305
v 25.5029 -80.9016 -52.9579
v 36.6477 -80.9016 -45.9552
v 45.9549 -80.9016 -36.6481
v 52.9576 -80.9016 -25.5034
v 57.3049 -80.9016 -13.0798
v 40.6739 -91.3545 5.88009e-39
v 39.6541 -91.3545 9.05078
v 36.6459 -91.3545 17.6477
v 31.8001 -91.3545 25.3597
v 25.3598 -91.3545 31.8001
v 17.6478 -91.3545 36.6459
v 9.05083 -91.3545 39.6541
v 5.15578e-05 -91.3545 40.6739
v -9.05073 -91.3545 39.6541
v -17.6477 -91.3545 36.6459
v -25.3597 -91.3545 31.8001
v -31.8001 -91.3545 25.3598
v -36.6458 -91.3545 17.6478
v -39.6541 -91.3545 9.05088
v -40.6739 -91.3545 0.000103116
v -39.6541 -91.3545 -9.05068
v -36.6459 -91.3545 -17.6476
v -31.8002 -91.3545 -25.3596
v -25.3598 -91.3545 -31.8
v -17.6479 -91.3545 -36.6458
v -9.05092 -91.3545 -39.654
v -0.000154673 -91.3545 -40.6739
v 9.05064 -91.3545 -39.6541
v 17.6476 -91.3545 -36.646
v 25.3596 -91.3545 -31.8002
v 31.8 -91.3545 -25.3599
v 36.6458 -91.3545 -17.6479
v 39.654 -91.3545 -9.05097
v 20.7914 -97.8147 5.88009e-39
v 20.2701 -97.8147 4.62652
v 18.7324 -97.8147 9.02104
v 16.2554 -97.8147 12.9632
v 12.9632 -97.8147 16.2554
v 9.02106 -97.8147 18.7324
v 4.62654 -97.8147 20.2701
v 2.6355e-05 -97.8147 20.7914
v -4.62649 -97.8147 20.2701
v -9.02102 -97.8147 18.7324
v -12.9632 -97.8147 16.2554
v -16.2553 -97.8147 12.9633
v -18.7324 -97.8147 9.02109
v -20.2701 -97.8147 4.62657
v -20.7914 -97.8147 5.271e-05
v -20.2701 -97.8147 -4.62647
v -18.7324 -97.8147 -9.021
v -16.2554 -97.8147 -12.9632
v -12.9633 -97.8147 -16.2553
v -9.02111 -97.8147 -18.7324
v -4.62659 -97.8147 -20.2701
v -7.90649e-05 -97.8147 -20.7914
v 4.62645 -97.8147 -20.2701
v 9.02097 -97.8147 -18.7324
v 12.9632 -97.8147 -16.2554
v 16.2553 -97.8147 -12.9633
v 18.7324 -97.8147 -9.02114
v 20.2701 -97.8147 -4.62662
f 3 4 32 31
f 4 5 33 32
f 5 6 34 33
f 6 7 35 34
f 7 8 36 35
f 8 9 37 36
f 9 10 38 37
f 10 11 39 38
f 11 12 40 39
f 12 13 41 40
f 13 14 42 41
f 14 15 43 42
f 15 16 44 43
f 16 17 45 44
f 17 18 46 45
f 18 19 47 46
f 19 20 48 47
f 20 21 49 48
f 21 22 50 49
f 22 23 51 50
f 23 24 52 51
f 24 25 53 52
f 25 26 54 53
f 26 27 55 54
f 27 28 56 55
f 28 29 57 56
f 29 30 58 57
f 30 3 31 58
f 31 32 60 59
f 32 33 61 60
f 33 34 62 61
f 34 35 63 62
f 35 36 64 63
f 36 37 65 64
f 37 38 66 65
f 38 39 67 66
f 39 40 68 67
f 40 41 69 68
f 41 42 70 69
f 42 43 71 70
f 43 44 72 71
f 44 45 73 72
f 45 46 74 73
f 46 47 75 74
f 47 48 76 75
f 48 49 77 76
f 49 50 78 77
f 50 51 79 78
f 51 52 80 79
f 52 53 81 80
f 53 54 82 81
f 54 55 83 82
f 55 56 84 83
f 56 57 85 84
f 57 58 86 85
f 58 31 59 86
f 59 60 88 87
f 60 61 89 88
f 61 62 90 89
f 62 63 91 90
f 63 64 92 91
f 64 65 93 92
f 65 66 94 93
f 66 67 95 94
f 67 68 96 95
f 68 69 97 96
f 69 70 98 97
f 70 71 99 98
f 71 72 100 99
f 72 73 101 100
f 73 74 102 101
f 74 75 103 102
f 75 76 104 103
f 76 77 105 104
f 77 78 106 105
f 78 79 107 106
f 79 80 108 107
f 80 81 109 108
f 81 82 110 109
f 82 83 111 110
f 83 84 112 111
f 84 85 113 112
f 85 86 114 113
f 86 59 87 114
f 87 88 116 115
f 88 89 117 116
f 89 90 118 117
f 90 91 119 118
f 91 92 120 119
f 92 93 121 120
f 93 94 122 121
f 94 95 123 122
f 95 96 124 123
f 96 97 125 124
f 97 98 126 125
f 98 99 127 126
f 99 100 128 127
f 100 101 129 128
f 101 102 130 129
f 102 103 131 130
f 103 104 132 131
f 104 105 133 132
f 105 106 134 133
f 106 107 135 134
f 107 108 136 135
f 108 109 137 136
f 109 110 138 137
f 110 111 139 138
f 111 112 140 139
f 112 113 141 140
f 113 114 142 141
f 114 87 115 142
f 115 116 144 143
f 116 117 145 144
f 117 118 146 145
f 118 119 147 146
f 119 120 148 147
f 120 121 149 148
f 121 122 150 149
f 122 123 151 150
f 123 124 152 151
f 124 125 153 152
f 125 126 154 153
f 126 127 155 154
f 127 128 156 155
f 128 129 157 156
f 129 130 158 157
f 130 131 159 158
f 131 132 160 159
f 132 133 161 160
f 133 134 162 161
f 134 135 163 162
f 135 136 164 163
f 136 137 165 164
f 137 138 166 165
f 138 139 167 166
f 139 140 168 167
f 140 141 169 168
f 141 142 170 169
f 142 115 143 170
f 143 144 172 171
f 144 145 173 172
f 145 146 174 173
f 146 147 175 174
f 147 148 176 175
f 148 149 177 176
f 149 150 178 177
f 150 151 179 178
f 151 152 180 179
f 152 153 181 180
f 153 154 182 181
f 154 155 183 182
f 155 156 184 183
f 156 157 185 184
f 157 158 186 185
f 158 159 187 186
f 159 160 188 187
f 160 161 189 188
f 161 162 190 189
f 162 163 191 190
f 163 164 192 191
f 164 165 193 192
f 165 166 194 193
f 166 167 195 194
f 167 168 196 195
f 168 169 197 196
f 169 170 198 197
f 170 143 171 198
f 171 172 200 199
f 172 173 201 200
f 173 174 202 201
f 174 175 203 202
f 175 176 204 203
f 176 177 205 204
f 177 178 206 205
f 178 179 207 206
f 179 180 208 207
f 180 181 209 208
f 181 182 210 209
f 182 183 211 210
f 183 184 212 211
f 184 185 213 212
f 185 186 214 213
f 186 187 215 214
f 187 188 216 215
f 188 189 217 216
f 189 190 218 217
f 190 191 219 218
f 191 192 220 219
f 192 193 221 220
f 193 194 222 221
f 194 195 223 222
f 195 196 224 223
f 196 197 225 224
f 197 198 226 225
f 198 171 199 226
f 199 200 228 227
f 200 201 229 228
f 201 202 230 229
f 202 203 231 230
f 203 204 232 231
f 204 205 233 232
f 205 206 234 233
f 206 207 235 234
f 207 208 236 235
f 208 209 237 236
f 209 210 238 237
f 210 211 239 238
f 211 212 240 239
f 212 213 241 240
f 213 214 242 241
f 214 215 243 242
f 215 216 244 243
f 216 217 245 244
f 217 218 246 245
f 218 219 247 246
f 219 220 248 247
f 220 221 249 248
f 221 222 250 249
f 222 223 251 250
f 223 224 252 251
f 224 225 253 252
f 225 226 254 253
f 226 199 227 254
f 227 228 256 255
f 228 229 257 256
f 229 230 258 257
f 230 231 259 258
f 231 232 260 259
f 232 233 261 260
f 233 234 262 261
f 234 235 263 262
f 235 236 264 263
f 236 237 265 264
f 237 238 266 265
f 238 239 267 266
f 239 240 268 267
f 240 241 269 268
f 241 242 270 269
f 242 243 271 270
f 243 244 272 271
f 244 245 273 272
f 245 246 274 273
f 246 247 275 274
f 247 248 276 275
f 248 249 277 276
f 249 250 278 277
f 250 251 279 278
f 251 252 280 279
f 252 253 281 280
f 253 254 282 281
f 254 227 255 282
f 255 256 284 283
f 256 257 285 284
f 257 258 286 285
f 258 259 287 286
f 259 260 288 287
f 260 261 289 288
f 261 262 290 289
f 262 263 291 290
f 263 264 292 291
f 264 265 293 292
f 265 266 294 293
f 266 267 295 294
f 267 268 296 295
f 268 269 297 296
f 269 270 298 297
f 270 271 299 298
f 271 272 300 299
f 272 273 301 300
f 273 274 302 301
f 274 275 303 302
f 275 276 304 303
f 276 277 305 304
f 277 278 306 305
f 278 279 307 306
f 279 280 308 307
f 280 281 309 308
f 281 282 310 309
f 282 255 283 310
f 283 284 312 311
f 284 285 313 312
f 285 286 314 313
f 286 287 315 314
f 287 288 316 315
f 288 289 317 316
f 289 290 318 317
f 290 291 319 318
f 291 292 320 319
f 292 293 321 320
f 293 294 322 321
f 294 295 323 322
f 295 296 324 323
f 296 297 325 324
f 297 298 326 325
f 298 299 327 326
f 299 300 328 327
f 300 301 329 328
f 301 302 330 329
f 302 303 331 330
f 303 304 332 331
f 304 305 333 332
f 305 306 334 333
f 306 307 335 334
f 307 308 336 335
f 308 309 337 336
f 309 310 338 337
f 310 283 311 338
f 311 312 340 339
f 312 313 341 340
f 313 314 342 341
f 314 315 343 342
f 315 316 344 343
f 316 317 345 344
f 317 318 346 345
f 318 319 347 346
f 319 320 348 347
f 320 321 349 348
f 321 322 350 349
f 322 323 351 350
f 323 324 352 351
f 324 325 353 352
f 325 326 354 353
f 326 327 355 354
f 327 328 356 355
f 328 329 357 356
f 329 330 358 357
f 330 331 359 358
f 331 332 360 359
f 332 333 361 360
f 333 334 362 361
f 334 335 363 362
f 335 336 364 363
f 336 337 365 364
f 337 338 366 365
f 338 311 339 366
f 339 340 368 367
f 340 341 369 368
f 341 342 370 369
f 342 343 371 370
f 343 344 372 371
f 344 345 373 372
f 345 346 374 373
f 346 347 375 374
f 347 348 376 375
f 348 349 377 376
f 349 350 378 377
f 350 351 379 378
f 351 352 380 379
f 352 353 381 380
f 353 354 382 381
f 354 355 383 382
f 355 356 384 383
f 356 357 385 384
f 357 358 386 385
f 358 359 387 386
f 359 360 388 387
f 360 361 389 388
f 361 362 390 389
f 362 363 391 390
f 363 364 392 391
f 364 365 393 392
f 365 366 394 393
f 366 339 367 394
f 1 4 3
f 2 367 368
f 1 5 4
f 2 368 369
f 1 6 5
f 2 369 370
f 1 7 6
f 2 370 371
f 1 8 7
f 2 371 372
f 1 9 8
f 2 372 373
f 1 10 9
f 2 373 374
f 1 11 10
f 2 374 375
f 1 12 11
f 2 375 376
f 1 13 12
f 2 376 377
f 1 14 13
f 2 377 378
f 1 15 14
f 2 378 379
f 1 16 15
f 2 379 380
f 1 17 16
f 2 380 381
f 1 18 17
f 2 381 382
f 1 19 18
f 2 382 383
f 1 20 19
f 2 383 384
f 1 21 20
f 2 384 385
f 1 22 21
f 2 385 386
f 1 23 22
f 2 386 387
f 1 24 23
f 2 387 388
f 1 25 24
f 2 388 389
f 1 26 25
f 2 389 390
f 1 27 26
f 2 390 391
f 1 28 27
f 2 391 392
f 1 29 28
f 2 392 393
f 1 30 29
f 2 393 394
f 1 3 30
f 2 394 367

1058
data/spheres/8.obj Normal file

File diff suppressed because it is too large Load Diff

1334
data/spheres/9.obj Normal file

File diff suppressed because it is too large Load Diff

37
index.html Normal file
View File

@ -0,0 +1,37 @@
<!doctype html>
<html>
<head>
<title>The begining</title>
<meta charset="utf-8">
</head>
<body>
<h1 id="title">Here is a list of places where you can go</h1>
<ul>
<li><a href="/bouncing/">A bouncing cube that jumps when you click on it</a></li>
<li>
<p>
<a href="/multisphere/">Sphere with multi-resolution</a>
</p>
<p>
Lots of obj files loaded and displayed. When you click
somewhere, the current obj is hidden and the next one, with
a better resolution is shown.
</p>
</li>
<li>
<p>
<a href="/scene/">A proto of the real thing</a>
</p>
<p>
You can move the camera with the arrow keys and move the
angle of the camera with 2, 4, 6 and 8 (the arrows of the
numpad). You can also select a camera by clicking on the
red part of it, and get back to the free camera by clicking
again. You can also select a camera by simply clicking on
the object you want to see. The program will choose the
camera that you want.
</p>
</li>
</ul>
</body>
</html>

112
js/BigScene.js Normal file
View File

@ -0,0 +1,112 @@
var mesh_number = 25;
var renderer, scene, controls, cube, container, plane, mouse= {x:0, y:0};
var bigmesh;
var raycaster;
var objects = [];
var cameras = new CameraContainer();
var spheres = new Array(mesh_number);
var visible = 0;
var loader;
var container_size = new Object();
container_size.width = 1067;
container_size.height = 600;
init();
animate();
function init() {
// on initialise le moteur de rendu
container = document.getElementById('container');
container.style.height = container_size.height + 'px';
container.style.width = container_size.width + 'px';
renderer = new THREE.WebGLRenderer({alpha:"true"});
renderer.setSize(container_size.width, container_size.height);
renderer.shadowMapEnabled = true;
renderer.setClearColor(0x000000);
document.getElementById('container').appendChild(renderer.domElement);
// on initialise la scène
scene = new THREE.Scene();
raycaster = new THREE.Raycaster();
// init light
var directional_light = new THREE.DirectionalLight(0x444444);
directional_light.position.set(1, 0.5, 1).normalize();
directional_light.castShadow = true;
scene.add(directional_light);
var ambient_light = new THREE.AmbientLight(0x666666);
scene.add(ambient_light);
// on initialise la camera que lon place ensuite sur la scène
var camera1 = new PointerCamera(50, container_size.width / container_size.height, 1, 100000);
camera1.position.z = 1500;
scene.add(camera1);
cameras.push(camera1);
var camera3 = new FixedCamera(
50,
container_size.width / container_size.height,
1,
100000,
new THREE.Vector3(500,0,500),
new THREE.Vector3(0,0,0)
);
camera3.addToScene(scene);
cameras.push(camera3);
window.addEventListener('resize', onWindowResize, false);
container.addEventListener('mousedown', click, false);
// Création d'un objloader
var helper = new THREE.LoadingManager();
helper.onProgress = function(item, loaded, total) {
console.log(item, ": " , loaded, " / ", total);
};
loader = new THREE.OBJLoader(helper);
loader.load('mesh/TheCarnival.obj', function (object) {
object.traverse(function (child) {
if (child instanceof THREE.Mesh) {
child.up = new THREE.Vector3(0,0,1);
child.rotation.x = Math.PI / 2;
child.scale.set(0.05,0.05,0.05);
}
});
scene.add(object);
});
}
function animate() {
// on appelle la fonction animate() récursivement à chaque frame
requestAnimationFrame(animate);
cameras.update();
cameras.look();
renderer.render(scene, cameras.mainCamera());
}
function onWindowResize() {
cameras.forEach(function(camera) {camera.aspect = container.offsetWidth / container.offsetHeight;});
cameras.forEach(function(camera) {camera.updateProjectionMatrix();});
renderer.setSize(container.offsetWidth, container.offsetHeight);
renderer.render(scene, cameras.mainCamera());
}
function hide(object) {
object.traverse(function(object) {object.visible = false;});
}
function show(object) {
object.traverse(function(object) {object.visible = true;});
}
function click(event) {
cameras.nextCamera();
}

36
js/BouncingCube.js Normal file
View File

@ -0,0 +1,36 @@
DT = new THREE.Vector3(0.1,0.1,0.1);
FRICTION = new THREE.Vector3(1, 1, 1);
G = new THREE.Vector3(0,0,-10);
var BouncingCube = function(size, style) {
Cube.call(this, size, style);
this.fixed_center = new THREE.Vector3();
this.center = new THREE.Vector3();
this.speed = new THREE.Vector3(0,0,300);
}
BouncingCube.prototype = Object.create(Cube.prototype);
BouncingCube.prototype.constructor = BouncingCube;
BouncingCube.prototype.update = function() {
// Compute new center
var speed_clone = this.speed.clone();
speed_clone.multiply(DT);
this.speed.add(G);
if (this.speed.dot(this.speed) > 100) {
this.center.add(speed_clone);
}
if (this.center.z < 0) {
this.speed.multiply(new THREE.Vector3(1,1,-0.5));
this.center.z = 0;
}
// Update the mesh
this.mesh.position.set(this.center.x, this.center.y, this.center.z);
// console.log(this.center.x, this.center.y, this.center.z);
}

28
js/Camera.js Normal file
View File

@ -0,0 +1,28 @@
// class camera extends THREE.PerspectiveCamera
var Camera = function() {
THREE.PerspectiveCamera.apply(this, arguments);
this.theta = 0;
this.position.x = Camera.DISTANCE_X;
this.position.z = Camera.DISTANCE_Z;
this.up = new THREE.Vector3(0,0,1);
this.target = new THREE.Vector3();
}
Camera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
// Update function
Camera.prototype.update = function() {
this.theta += 0.01;
this.position.x = Camera.DISTANCE_X*Math.cos(this.theta);
this.position.y = Camera.DISTANCE_X*Math.sin(this.theta);
}
// Look function
Camera.prototype.look = function() {
this.lookAt(this.target);
}
// Static members
Camera.DISTANCE_X = 1000;
Camera.DISTANCE_Z = 300;

61
js/CameraContainer.js Normal file
View File

@ -0,0 +1,61 @@
var CameraContainer = function () {
this.current_camera = 0;
this.cameras = new Array();
}
CameraContainer.prototype.mainCamera = function(id) {
if (typeof id === 'undefined') {
return this.cameras[this.current_camera];
}
if (id >= cameras.length || id < 0) {
console.log('Warning : this camera does not exist');
return;
}
this.current_camera = id;
}
CameraContainer.prototype.forEach = function(callback) {
this.cameras.forEach(callback);
}
CameraContainer.prototype.look = function() {
this.cameras[this.current_camera].look();
}
CameraContainer.prototype.update = function() {
this.cameras[this.current_camera].update();
}
CameraContainer.prototype.push = function(camera) {
this.cameras.push(camera);
}
CameraContainer.prototype.get = function(i) {
return this.cameras[i];
}
CameraContainer.prototype.getById = function(id) {
for (var i in this.cameras) {
if (typeof this.cameras[i].mesh !== 'undefined') {
if (this.cameras[i].mesh.id == id) {
return i;
}
}
}
return -1;
}
CameraContainer.prototype.setById = function(id) {
var i = this.getById(id);
if (i !== -1)
this.current_camera = i;
}
CameraContainer.prototype.nextCamera = function() {
if (this.cameras.length != 0) {
this.current_camera++;
this.current_camera%=this.cameras.length;
}
}

56
js/Cube.js Normal file
View File

@ -0,0 +1,56 @@
var Displayable = function() {
// Nothing to do here
}
Displayable.prototype.addToScene = function(scene) {
scene.add(this.mesh);
}
Displayable.prototype.translate = function(x,y,z) {
this.geometry.applyMatrix(new THREE.Matrix4().makeTranslation(x,y,z));
}
// class Cube extends Displayable
var Cube = function(size, style) {
// Super constructor call
Displayable.call(this);
if (typeof size === 'undefined') size = 100;
if (typeof style === 'undefined') style = {};
this.geometry = new THREE.BoxGeometry(size, size, size);
this.geometry.computeVertexNormals();
this.material = new THREE.MeshLambertMaterial(style);
this.mesh = new THREE.Mesh(this.geometry, this.material);
this.mesh.castShadow = false;
}
Cube.prototype = Object.create(Displayable.prototype);
Cube.prototype.constructor = Cube;
// class Plane extends Displayable
var Plane = function(size1, size2, style) {
Displayable.call(this);
if (typeof style === 'undefined') style = {};
this.geometry = new THREE.PlaneBufferGeometry(size1, size2);
this.material = new THREE.MeshLambertMaterial(style);
this.material.side = THREE.FrontSide;
this.materialBack = new THREE.MeshLambertMaterial(style);
this.materialBack.side = THREE.BackSide;
this.mesh = new THREE.Mesh(this.geometry, this.material);
this.meshBack = new THREE.Mesh(this.geometry, this.materialBack);
this.mesh.receiveShadow = true;
}
Plane.prototype = Object.create(Displayable.prototype);
Plane.prototype.constructor = Plane;
Plane.prototype.addToScene = function(scene) {
scene.add(this.mesh);
scene.add(this.meshBack);
}

110
js/FixedCamera.js Normal file
View File

@ -0,0 +1,110 @@
// Initialization
// class camera extends THREE.PerspectiveCamera
var FixedCamera = function(arg1, arg2, arg3, arg4, position, target) {
THREE.PerspectiveCamera.apply(this, arguments);
// Set Position
if (typeof position === 'undefined')
{
this.position = new THREE.Vector3(0,0,5);
}
else
{
this.position.x = position.x;
this.position.y = position.y;
this.position.z = position.z;
}
if (typeof target === 'undefined') target = new THREE.Vector3(0,0,0);
var direction = target.clone();
direction.sub(this.position);
direction.normalize();
this.target = this.position.clone();
this.target.add(direction);
this.up = new THREE.Vector3(0,0,1);
// Compute corners
// Create the mesh to draw
var geometry = new THREE.Geometry();
var left = Tools.cross(direction, this.up);
var other = Tools.cross(direction, left);
left.normalize();
other.normalize();
left = Tools.mul(left, 100);
other = Tools.mul(other, 100);
geometry.vertices.push(Tools.sum(Tools.sum(this.position, left), other),
Tools.diff(Tools.sum(this.position, other),left),
Tools.diff(Tools.diff(this.position, left),other),
Tools.sum(Tools.diff(this.position, other), left)
);
geometry.faces.push(new THREE.Face3(0,1,2), // new THREE.Face3(0,2,1),
new THREE.Face3(0,2,3) // new THREE.Face3(0,3,2)
);
(function(self, direction, left, other) {
var material = new THREE.LineBasicMaterial({ color: '0x000000'});
var geometry = new THREE.Geometry();
var direction = Tools.mul(direction, -200);
var target = Tools.sum(self.position, direction);
// geometry.vertices.push(self.position, target);
geometry.vertices.push(
Tools.sum(Tools.sum(self.position, left), other),
Tools.diff(Tools.sum(self.position, other),left),
Tools.diff(Tools.diff(self.position, left),other),
Tools.sum(Tools.diff(self.position, other), left),
Tools.sum(Tools.sum(self.position, left), other),
Tools.sum(Tools.diff(self.position, other), left),
Tools.sum(self.position, direction),
Tools.sum(Tools.sum(self.position, left), other),
Tools.sum(self.position, direction),
Tools.diff(Tools.sum(self.position, other),left),
Tools.sum(self.position, direction),
Tools.diff(Tools.diff(self.position, left),other),
Tools.sum(self.position, direction),
Tools.sum(Tools.diff(self.position, other), left)
);
self.line = new THREE.Line(geometry, material);
})(this, direction, left, other);
var material = new THREE.MeshBasicMaterial({
color : 0xff0000,
transparent : true,
opacity : 0.5,
side: THREE.DoubleSide
});
this.mesh = new THREE.Mesh(geometry, material);
}
FixedCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
FixedCamera.prototype.constructor = FixedCamera;
// Update function
FixedCamera.prototype.update = function() {
}
// Look function
FixedCamera.prototype.look = function() {
this.lookAt(this.target);
}
FixedCamera.prototype.addToScene = function(scene) {
scene.add(this);
scene.add(this.mesh);
scene.add(this.line);
}

120
js/PointerCamera.js Normal file
View File

@ -0,0 +1,120 @@
// Initialization
// class camera extends THREE.PerspectiveCamera
var PointerCamera = function() {
THREE.PerspectiveCamera.apply(this, arguments);
// Set Position
this.theta = Math.PI;
this.phi = Math.PI;
this.keyboard = 'undefined';
// Stuff for rendering
this.position = new THREE.Vector3();
this.forward = new THREE.Vector3();
this.left = new THREE.Vector3();
this.up = new THREE.Vector3(0,0,1);
this.target = new THREE.Vector3(0,1,0);
// Stuff for events
this.moveForward = false;
this.moveBackward = false;
this.moveRight = false;
this.moveLeft = false;
this.sensitivity = 0.05;
this.speed = 1;
// Set events from the document
var self = this;
var onKeyDown = function(event) {self.onKeyDown(event);};
var onKeyUp = function(event) {self.onKeyUp(event);};
document.addEventListener('keydown', onKeyDown, false);
document.addEventListener('keyup', onKeyUp, false);
}
PointerCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
PointerCamera.prototype.constructor = PointerCamera;
// Update function
PointerCamera.prototype.update = function() {
// Update angles
if (this.increasePhi) this.phi += this.sensitivity;
if (this.decreasePhi) this.phi -= this.sensitivity;
if (this.increaseTheta) this.theta += this.sensitivity;
if (this.decreaseTheta) this.theta -= this.sensitivity;
// Clamp phi
this.phi = Math.min(Math.max(-(Math.PI/2-0.1),this.phi), Math.PI/2-0.1);
var delta = 0.1;
// Update direction
this.forward.z = Math.sin(this.phi);
var cos = Math.cos(this.phi);
this.forward.x = cos * Math.cos(this.theta);
this.forward.y = cos * Math.sin(this.theta);
this.forward.normalize();
// Update
var forward = this.forward.clone();
forward.multiplyScalar(400.0 * delta);
var left = this.up.clone();
left.cross(forward);
left.normalize();
left.multiplyScalar(400.0 * delta);
if (this.moveForward) this.position.add(Tools.mul(forward, this.speed));
if (this.moveBackward) this.position.sub(Tools.mul(forward, this.speed));
if (this.moveLeft) this.position.add(Tools.mul(left, this.speed));
if (this.moveRight) this.position.sub(Tools.mul(left, this.speed));
this.target = this.position.clone();
this.target.add(forward);
}
// Look function
PointerCamera.prototype.look = function() {
this.lookAt(this.target);
}
PointerCamera.prototype.addToScene = function(scene) {
scene.add(this);
}
PointerCamera.prototype.onKeyEvent = function(event, toSet) {
switch ( event.keyCode ) {
// Azerty keyboards
case 38: case 90: this.moveForward = toSet; break; // up / z
case 37: case 81: this.moveLeft = toSet; break; // left / q
case 40: case 83: this.moveBackward = toSet; break; // down / s
case 39: case 68: this.moveRight = toSet; break; // right / d
// Qwerty keyboards
// case 38: case 87: this.moveForward = toSet; break; // up / w
// case 37: case 65: this.moveLeft = toSet; break; // left / a
// case 40: case 83: this.moveBackward = toSet; break; // down / s
// case 39: case 68: this.moveRight = toSet; break; // right / d
case 104: this.increasePhi = toSet; break; // 8 Up for angle
case 98: this.decreasePhi = toSet; break; // 2 Down for angle
case 100: this.increaseTheta = toSet; break; // 4 Left for angle
case 102: this.decreaseTheta = toSet; break; // 6 Right for angle
}
}
PointerCamera.prototype.onKeyDown = function(event) {
this.onKeyEvent(event, true);
}
PointerCamera.prototype.onKeyUp = function(event) {
this.onKeyEvent(event, false);
}
// Static members
PointerCamera.DISTANCE_X = 1000;
PointerCamera.DISTANCE_Z = 300;

33
js/Tools.js Normal file
View File

@ -0,0 +1,33 @@
var Tools = {version : "1.0" };
Tools.sum = function(v1, v2) {
var ret = v1.clone();
ret.add(v2);
return ret;
}
Tools.diff = function(v1, v2) {
var ret = v1.clone();
ret.sub(v2);
return ret;
}
Tools.dot = function(v1, v2) {
return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;
}
Tools.cross = function(v1, v2) {
var ret = v1.clone();
ret.cross(v2);
return ret;
}
Tools.mul = function(v1, lambda) {
var ret = v1.clone();
ret.multiplyScalar(lambda);
return ret;
}
Tools.equals = function(v1, v2) {
return v1.x == v2.x && v1.y == v2.y && v1.z == v2.z;
}

79
js/ToolsTest.js Normal file
View File

@ -0,0 +1,79 @@
function test(b) {
if (b)
document.write("<li style='color: #008800'>Success !</li>");
else
document.write("<li style='color: red'>Failure !</li>");
}
function main() {
document.write("<h1>Starting test !</h1>");
var v1 = new THREE.Vector3(1,2,3);
var v2 = new THREE.Vector3(2,3,4);
var v1Bak = v1.clone();
var v2Bak = v2.clone();
// First tests
document.write("<ol>");
var v3 = Tools.sum(v1,v2);
test(v3.x == v1.x + v2.x && v3.y == v1.y + v2.y && v3.z == v1.z + v2.z);
test(Tools.equals(v1, v1Bak));
test(Tools.equals(v2, v2Bak));
document.write('</ol>');
// Clear v1, v2
v1 = v1Bak.clone();
v2 = v2Bak.clone();
document.write("<ol>");
var v4 = Tools.diff(v1,v2);
test(v4.x == v1.x - v2.x && v4.y == v1.y - v2.y && v4.z == v1.z - v2.z);
test(Tools.equals(v1, v1Bak));
test(Tools.equals(v2, v2Bak));
document.write('</ol>');
v1 = v1Bak.clone();
v2 = v2Bak.clone();
document.write("<ol>");
var v5 = Tools.dot(v1,v2);
test(v5 == v1.x * v2.x + v1.y * v2.y + v1.z * v2.z);
test(Tools.equals(v1, v1Bak));
test(Tools.equals(v2, v2Bak));
document.write('</ol>');
v1 = v1Bak.clone();
v2 = v2Bak.clone();
document.write("<ol>");
var v6 = Tools.cross(new THREE.Vector3(1,0,0), new THREE.Vector3(0,1,0));
test(Tools.equals(v6, new THREE.Vector3(0,0,1)));
test(Tools.equals(v1, v1Bak));
test(Tools.equals(v2, v2Bak));
document.write('</ol>');
v1 = v1Bak.clone();
v2 = v2Bak.clone();
document.write("<ol>");
for (var lambda = 0; lambda < 5; lambda += 0.5)
{
var v7 = Tools.mul(v1, lambda);
test(Tools.equals(v7, new THREE.Vector3(v1Bak.x*lambda, v1Bak.y*lambda, v1Bak.z*lambda)));
v1 = v1Bak.clone();
v2 = v2Bak.clone();
var v8 = Tools.mul(v1, lambda);
test(Tools.equals(v8, new THREE.Vector3(v1Bak.x*lambda, v1Bak.y*lambda, v1Bak.z*lambda)));
v1 = v1Bak.clone();
v2 = v2Bak.clone();
// Try into v1
v1 = Tools.mul(v1, lambda);
test(Tools.equals(v1, new THREE.Vector3(v1Bak.x*lambda, v1Bak.y*lambda, v1Bak.z*lambda)));
v1 = v1Bak.clone();
v2 = v2Bak.clone();
}
}
main();

88
js/test1.js Normal file
View File

@ -0,0 +1,88 @@
var renderer, scene, camera, controls, mesh, i = 0;
var raycaster;
var objects = [];
var container_size = new Object();
container_size.width = 1067;
container_size.height = 600;
init();
animate();
function init()
{
// on initialise le moteur de rendu
container = document.getElementById('container');
container.style.height = container_size.height + 'px';
container.style.width = container_size.width + 'px';
renderer = new THREE.WebGLRenderer({alpha:"true"});
renderer.setSize(container_size.width, container_size.height);
renderer.shadowMapEnabled = true;
document.getElementById('container').appendChild(renderer.domElement);
container.addEventListener('mousedown', click, false);
// on initialise la scène
scene = new THREE.Scene();
raycaster = new THREE.Raycaster();
// init light
var directional_light = new THREE.DirectionalLight(0xffffff);
directional_light.position.set(1, 0.5, 1).normalize();
directional_light.castShadow = true;
scene.add(directional_light);
var ambient_light = new THREE.AmbientLight(0x444444);
scene.add(ambient_light);
// on initialise la camera que lon place ensuite sur la scène
camera = new Camera(50, container_size.width / container_size.height, 1, 10000);
scene.add(camera);
window.addEventListener('resize', onWindowResize, false);
geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(0,0,0), new THREE.Vector3(100,100,0), new THREE.Vector3(100,0,100));
geometry.faces.push(new THREE.Face3(0,1,2));
geometry.faces.push(new THREE.Face3(0,2,1));
geometry.verticesNeedUpdate = true;
geometry.groupsNeedUpdate = true;
mesh = new THREE.Mesh(geometry);
scene.add(mesh);
}
function animate()
{
// on appelle la fonction animate() récursivement à chaque frame
requestAnimationFrame(animate);
i += 1;
mesh.geometry.vertices.push(new THREE.Vector3(0+i,0+i,0+i), new THREE.Vector3(100+i,100+i,+i), new THREE.Vector3(100+i,0+i,100+i));
var size = mesh.geometry.vertices.length-3;
mesh.geometry.faces.push(new THREE.Face3(size, size+1, size+2), new THREE.Face3(size, size+2, size+1));
mesh.geometry.verticesNeedUpdate = true;
mesh.geometry.groupsNeedUpdate = true;
camera.update();
camera.look();
renderer.render(scene, camera);
}
function onWindowResize()
{
camera.aspect = container.offsetWidth / container.offsetHeight;
camera.updateProjectionMatrix();
renderer.setSize(container.offsetWidth, container.offsetHeight);
renderer.render(scene, camera);
}
function click(event)
{
}

35133
js/three.js Normal file

File diff suppressed because one or more lines are too long

237
js/three/DDSLoader.js Normal file
View File

@ -0,0 +1,237 @@
/*
* @author mrdoob / http://mrdoob.com/
*/
THREE.DDSLoader = function () {
this._parser = THREE.DDSLoader.parse;
};
THREE.DDSLoader.prototype = Object.create( THREE.CompressedTextureLoader.prototype );
THREE.DDSLoader.prototype.constructor = THREE.DDSLoader;
THREE.DDSLoader.parse = function ( buffer, loadMipmaps ) {
var dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 };
// Adapted from @toji's DDS utils
// https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js
// All values and structures referenced from:
// http://msdn.microsoft.com/en-us/library/bb943991.aspx/
var DDS_MAGIC = 0x20534444;
var DDSD_CAPS = 0x1,
DDSD_HEIGHT = 0x2,
DDSD_WIDTH = 0x4,
DDSD_PITCH = 0x8,
DDSD_PIXELFORMAT = 0x1000,
DDSD_MIPMAPCOUNT = 0x20000,
DDSD_LINEARSIZE = 0x80000,
DDSD_DEPTH = 0x800000;
var DDSCAPS_COMPLEX = 0x8,
DDSCAPS_MIPMAP = 0x400000,
DDSCAPS_TEXTURE = 0x1000;
var DDSCAPS2_CUBEMAP = 0x200,
DDSCAPS2_CUBEMAP_POSITIVEX = 0x400,
DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800,
DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000,
DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000,
DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000,
DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000,
DDSCAPS2_VOLUME = 0x200000;
var DDPF_ALPHAPIXELS = 0x1,
DDPF_ALPHA = 0x2,
DDPF_FOURCC = 0x4,
DDPF_RGB = 0x40,
DDPF_YUV = 0x200,
DDPF_LUMINANCE = 0x20000;
function fourCCToInt32( value ) {
return value.charCodeAt(0) +
(value.charCodeAt(1) << 8) +
(value.charCodeAt(2) << 16) +
(value.charCodeAt(3) << 24);
}
function int32ToFourCC( value ) {
return String.fromCharCode(
value & 0xff,
(value >> 8) & 0xff,
(value >> 16) & 0xff,
(value >> 24) & 0xff
);
}
function loadARGBMip( buffer, dataOffset, width, height ) {
var dataLength = width * height * 4;
var srcBuffer = new Uint8Array( buffer, dataOffset, dataLength );
var byteArray = new Uint8Array( dataLength );
var dst = 0;
var src = 0;
for ( var y = 0; y < height; y ++ ) {
for ( var x = 0; x < width; x ++ ) {
var b = srcBuffer[src]; src ++;
var g = srcBuffer[src]; src ++;
var r = srcBuffer[src]; src ++;
var a = srcBuffer[src]; src ++;
byteArray[dst] = r; dst ++; //r
byteArray[dst] = g; dst ++; //g
byteArray[dst] = b; dst ++; //b
byteArray[dst] = a; dst ++; //a
}
}
return byteArray;
}
var FOURCC_DXT1 = fourCCToInt32("DXT1");
var FOURCC_DXT3 = fourCCToInt32("DXT3");
var FOURCC_DXT5 = fourCCToInt32("DXT5");
var headerLengthInt = 31; // The header length in 32 bit ints
// Offsets into the header array
var off_magic = 0;
var off_size = 1;
var off_flags = 2;
var off_height = 3;
var off_width = 4;
var off_mipmapCount = 7;
var off_pfFlags = 20;
var off_pfFourCC = 21;
var off_RGBBitCount = 22;
var off_RBitMask = 23;
var off_GBitMask = 24;
var off_BBitMask = 25;
var off_ABitMask = 26;
var off_caps = 27;
var off_caps2 = 28;
var off_caps3 = 29;
var off_caps4 = 30;
// Parse header
var header = new Int32Array( buffer, 0, headerLengthInt );
if ( header[ off_magic ] !== DDS_MAGIC ) {
console.error( 'THREE.DDSLoader.parse: Invalid magic number in DDS header.' );
return dds;
}
if ( ! header[ off_pfFlags ] & DDPF_FOURCC ) {
console.error( 'THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code.' );
return dds;
}
var blockBytes;
var fourCC = header[ off_pfFourCC ];
var isRGBAUncompressed = false;
switch ( fourCC ) {
case FOURCC_DXT1:
blockBytes = 8;
dds.format = THREE.RGB_S3TC_DXT1_Format;
break;
case FOURCC_DXT3:
blockBytes = 16;
dds.format = THREE.RGBA_S3TC_DXT3_Format;
break;
case FOURCC_DXT5:
blockBytes = 16;
dds.format = THREE.RGBA_S3TC_DXT5_Format;
break;
default:
if ( header[off_RGBBitCount] == 32
&& header[off_RBitMask]&0xff0000
&& header[off_GBitMask]&0xff00
&& header[off_BBitMask]&0xff
&& header[off_ABitMask]&0xff000000 ) {
isRGBAUncompressed = true;
blockBytes = 64;
dds.format = THREE.RGBAFormat;
} else {
console.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) );
return dds;
}
}
dds.mipmapCount = 1;
if ( header[ off_flags ] & DDSD_MIPMAPCOUNT && loadMipmaps !== false ) {
dds.mipmapCount = Math.max( 1, header[ off_mipmapCount ] );
}
//TODO: Verify that all faces of the cubemap are present with DDSCAPS2_CUBEMAP_POSITIVEX, etc.
dds.isCubemap = header[ off_caps2 ] & DDSCAPS2_CUBEMAP ? true : false;
dds.width = header[ off_width ];
dds.height = header[ off_height ];
var dataOffset = header[ off_size ] + 4;
// Extract mipmaps buffers
var width = dds.width;
var height = dds.height;
var faces = dds.isCubemap ? 6 : 1;
for ( var face = 0; face < faces; face ++ ) {
for ( var i = 0; i < dds.mipmapCount; i ++ ) {
if ( isRGBAUncompressed ) {
var byteArray = loadARGBMip( buffer, dataOffset, width, height );
var dataLength = byteArray.length;
} else {
var dataLength = Math.max( 4, width ) / 4 * Math.max( 4, height ) / 4 * blockBytes;
var byteArray = new Uint8Array( buffer, dataOffset, dataLength );
}
var mipmap = { "data": byteArray, "width": width, "height": height };
dds.mipmaps.push( mipmap );
dataOffset += dataLength;
width = Math.max( width * 0.5, 1 );
height = Math.max( height * 0.5, 1 );
}
width = dds.width;
height = dds.height;
}
return dds;
};

441
js/three/MTLLoader.js Normal file
View File

@ -0,0 +1,441 @@
/**
* Loads a Wavefront .mtl file specifying materials
*
* @author angelxuanchang
*/
THREE.MTLLoader = function( baseUrl, options, crossOrigin ) {
this.baseUrl = baseUrl;
this.options = options;
this.crossOrigin = crossOrigin;
};
THREE.MTLLoader.prototype = {
constructor: THREE.MTLLoader,
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
var loader = new THREE.XHRLoader();
loader.setCrossOrigin( this.crossOrigin );
loader.load( url, function ( text ) {
onLoad( scope.parse( text ) );
}, onProgress, onError );
},
/**
* Parses loaded MTL file
* @param text - Content of MTL file
* @return {THREE.MTLLoader.MaterialCreator}
*/
parse: function ( text ) {
var lines = text.split( "\n" );
var info = {};
var delimiter_pattern = /\s+/;
var materialsInfo = {};
for ( var i = 0; i < lines.length; i ++ ) {
var line = lines[ i ];
line = line.trim();
if ( line.length === 0 || line.charAt( 0 ) === '#' ) {
// Blank line or comment ignore
continue;
}
var pos = line.indexOf( ' ' );
var key = ( pos >= 0 ) ? line.substring( 0, pos ) : line;
key = key.toLowerCase();
var value = ( pos >= 0 ) ? line.substring( pos + 1 ) : "";
value = value.trim();
if ( key === "newmtl" ) {
// New material
info = { name: value };
materialsInfo[ value ] = info;
} else if ( info ) {
if ( key === "ka" || key === "kd" || key === "ks" ) {
var ss = value.split( delimiter_pattern, 3 );
info[ key ] = [ parseFloat( ss[0] ), parseFloat( ss[1] ), parseFloat( ss[2] ) ];
} else {
info[ key ] = value;
}
}
}
var materialCreator = new THREE.MTLLoader.MaterialCreator( this.baseUrl, this.options );
materialCreator.crossOrigin = this.crossOrigin
materialCreator.setMaterials( materialsInfo );
return materialCreator;
}
};
/**
* Create a new THREE-MTLLoader.MaterialCreator
* @param baseUrl - Url relative to which textures are loaded
* @param options - Set of options on how to construct the materials
* side: Which side to apply the material
* THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide
* wrap: What type of wrapping to apply for textures
* THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping
* normalizeRGB: RGBs need to be normalized to 0-1 from 0-255
* Default: false, assumed to be already normalized
* ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's
* Default: false
* invertTransparency: If transparency need to be inverted (inversion is needed if d = 0 is fully opaque)
* Default: false (d = 1 is fully opaque)
* @constructor
*/
THREE.MTLLoader.MaterialCreator = function( baseUrl, options ) {
this.baseUrl = baseUrl;
this.options = options;
this.materialsInfo = {};
this.materials = {};
this.materialsArray = [];
this.nameLookup = {};
this.side = ( this.options && this.options.side ) ? this.options.side : THREE.FrontSide;
this.wrap = ( this.options && this.options.wrap ) ? this.options.wrap : THREE.RepeatWrapping;
};
THREE.MTLLoader.MaterialCreator.prototype = {
constructor: THREE.MTLLoader.MaterialCreator,
setMaterials: function( materialsInfo ) {
this.materialsInfo = this.convert( materialsInfo );
this.materials = {};
this.materialsArray = [];
this.nameLookup = {};
},
convert: function( materialsInfo ) {
if ( !this.options ) return materialsInfo;
var converted = {};
for ( var mn in materialsInfo ) {
// Convert materials info into normalized form based on options
var mat = materialsInfo[ mn ];
var covmat = {};
converted[ mn ] = covmat;
for ( var prop in mat ) {
var save = true;
var value = mat[ prop ];
var lprop = prop.toLowerCase();
switch ( lprop ) {
case 'kd':
case 'ka':
case 'ks':
// Diffuse color (color under white light) using RGB values
if ( this.options && this.options.normalizeRGB ) {
value = [ value[ 0 ] / 255, value[ 1 ] / 255, value[ 2 ] / 255 ];
}
if ( this.options && this.options.ignoreZeroRGBs ) {
if ( value[ 0 ] === 0 && value[ 1 ] === 0 && value[ 1 ] === 0 ) {
// ignore
save = false;
}
}
break;
case 'd':
// According to MTL format (http://paulbourke.net/dataformats/mtl/):
// d is dissolve for current material
// factor of 1.0 is fully opaque, a factor of 0 is fully dissolved (completely transparent)
if ( this.options && this.options.invertTransparency ) {
value = 1 - value;
}
break;
default:
break;
}
if ( save ) {
covmat[ lprop ] = value;
}
}
}
return converted;
},
preload: function () {
for ( var mn in this.materialsInfo ) {
this.create( mn );
}
},
getIndex: function( materialName ) {
return this.nameLookup[ materialName ];
},
getAsArray: function() {
var index = 0;
for ( var mn in this.materialsInfo ) {
this.materialsArray[ index ] = this.create( mn );
this.nameLookup[ mn ] = index;
index ++;
}
return this.materialsArray;
},
create: function ( materialName ) {
if ( this.materials[ materialName ] === undefined ) {
this.createMaterial_( materialName );
}
return this.materials[ materialName ];
},
createMaterial_: function ( materialName ) {
// Create material
var mat = this.materialsInfo[ materialName ];
var params = {
name: materialName,
side: this.side
};
for ( var prop in mat ) {
var value = mat[ prop ];
switch ( prop.toLowerCase() ) {
// Ns is material specular exponent
case 'kd':
// Diffuse color (color under white light) using RGB values
params[ 'diffuse' ] = new THREE.Color().fromArray( value );
break;
case 'ka':
// Ambient color (color under shadow) using RGB values
break;
case 'ks':
// Specular color (color when light is reflected from shiny surface) using RGB values
params[ 'specular' ] = new THREE.Color().fromArray( value );
break;
case 'map_kd':
// Diffuse texture map
params[ 'map' ] = this.loadTexture( this.baseUrl + value );
params[ 'map' ].wrapS = this.wrap;
params[ 'map' ].wrapT = this.wrap;
break;
case 'ns':
// The specular exponent (defines the focus of the specular highlight)
// A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000.
params['shininess'] = value;
break;
case 'd':
// According to MTL format (http://paulbourke.net/dataformats/mtl/):
// d is dissolve for current material
// factor of 1.0 is fully opaque, a factor of 0 is fully dissolved (completely transparent)
if ( value < 1 ) {
params['transparent'] = true;
params['opacity'] = value;
}
break;
case 'map_bump':
case 'bump':
// Bump texture map
if ( params[ 'bumpMap' ] ) break; // Avoid loading twice.
params[ 'bumpMap' ] = this.loadTexture( this.baseUrl + value );
params[ 'bumpMap' ].wrapS = this.wrap;
params[ 'bumpMap' ].wrapT = this.wrap;
break;
default:
break;
}
}
if ( params[ 'diffuse' ] ) {
params[ 'color' ] = params[ 'diffuse' ];
}
this.materials[ materialName ] = new THREE.MeshPhongMaterial( params );
return this.materials[ materialName ];
},
loadTexture: function ( url, mapping, onLoad, onError ) {
var texture;
var loader = THREE.Loader.Handlers.get( url );
if ( loader !== null ) {
texture = loader.load( url, onLoad );
} else {
texture = new THREE.Texture();
loader = new THREE.ImageLoader();
loader.crossOrigin = this.crossOrigin;
loader.load( url, function ( image ) {
texture.image = THREE.MTLLoader.ensurePowerOfTwo_( image );
texture.needsUpdate = true;
if ( onLoad ) onLoad( texture );
} );
}
if ( mapping !== undefined ) texture.mapping = mapping;
return texture;
}
};
THREE.MTLLoader.ensurePowerOfTwo_ = function ( image ) {
if ( ! THREE.Math.isPowerOfTwo( image.width ) || ! THREE.Math.isPowerOfTwo( image.height ) ) {
var canvas = document.createElement( "canvas" );
canvas.width = THREE.MTLLoader.nextHighestPowerOfTwo_( image.width );
canvas.height = THREE.MTLLoader.nextHighestPowerOfTwo_( image.height );
var ctx = canvas.getContext("2d");
ctx.drawImage( image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height );
return canvas;
}
return image;
};
THREE.MTLLoader.nextHighestPowerOfTwo_ = function( x ) {
-- x;
for ( var i = 1; i < 32; i <<= 1 ) {
x = x | x >> i;
}
return x + 1;
};
THREE.EventDispatcher.prototype.apply( THREE.MTLLoader.prototype );

372
js/three/OBJLoader.js Normal file
View File

@ -0,0 +1,372 @@
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.OBJLoader = function ( manager ) {
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
};
THREE.OBJLoader.prototype = {
constructor: THREE.OBJLoader,
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
var loader = new THREE.XHRLoader( scope.manager );
loader.setCrossOrigin( this.crossOrigin );
loader.load( url, function ( text ) {
onLoad( scope.parse( text ) );
}, onProgress, onError );
},
parse: function ( text ) {
console.time( 'OBJLoader' );
var object, objects = [];
var geometry, material;
function parseVertexIndex( value ) {
var index = parseInt( value );
return ( index >= 0 ? index - 1 : index + vertices.length / 3 ) * 3;
}
function parseNormalIndex( value ) {
var index = parseInt( value );
return ( index >= 0 ? index - 1 : index + normals.length / 3 ) * 3;
}
function parseUVIndex( value ) {
var index = parseInt( value );
return ( index >= 0 ? index - 1 : index + uvs.length / 2 ) * 2;
}
function addVertex( a, b, c ) {
geometry.vertices.push(
vertices[ a ], vertices[ a + 1 ], vertices[ a + 2 ],
vertices[ b ], vertices[ b + 1 ], vertices[ b + 2 ],
vertices[ c ], vertices[ c + 1 ], vertices[ c + 2 ]
);
}
function addNormal( a, b, c ) {
geometry.normals.push(
normals[ a ], normals[ a + 1 ], normals[ a + 2 ],
normals[ b ], normals[ b + 1 ], normals[ b + 2 ],
normals[ c ], normals[ c + 1 ], normals[ c + 2 ]
);
}
function addUV( a, b, c ) {
geometry.uvs.push(
uvs[ a ], uvs[ a + 1 ],
uvs[ b ], uvs[ b + 1 ],
uvs[ c ], uvs[ c + 1 ]
);
}
function addFace( a, b, c, d, ua, ub, uc, ud, na, nb, nc, nd ) {
var ia = parseVertexIndex( a );
var ib = parseVertexIndex( b );
var ic = parseVertexIndex( c );
var id;
if ( d === undefined ) {
addVertex( ia, ib, ic );
} else {
id = parseVertexIndex( d );
addVertex( ia, ib, id );
addVertex( ib, ic, id );
}
if ( ua !== undefined ) {
ia = parseUVIndex( ua );
ib = parseUVIndex( ub );
ic = parseUVIndex( uc );
if ( d === undefined ) {
addUV( ia, ib, ic );
} else {
id = parseUVIndex( ud );
addUV( ia, ib, id );
addUV( ib, ic, id );
}
}
if ( na !== undefined ) {
ia = parseNormalIndex( na );
ib = parseNormalIndex( nb );
ic = parseNormalIndex( nc );
if ( d === undefined ) {
addNormal( ia, ib, ic );
} else {
id = parseNormalIndex( nd );
addNormal( ia, ib, id );
addNormal( ib, ic, id );
}
}
}
// create mesh if no objects in text
if ( /^o /gm.test( text ) === false ) {
geometry = {
vertices: [],
normals: [],
uvs: []
};
material = {
name: ''
};
object = {
name: '',
geometry: geometry,
material: material
};
objects.push( object );
}
var vertices = [];
var normals = [];
var uvs = [];
// v float float float
var vertex_pattern = /v( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/;
// vn float float float
var normal_pattern = /vn( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/;
// vt float float
var uv_pattern = /vt( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/;
// f vertex vertex vertex ...
var face_pattern1 = /f( +-?\d+)( +-?\d+)( +-?\d+)( +-?\d+)?/;
// f vertex/uv vertex/uv vertex/uv ...
var face_pattern2 = /f( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+))?/;
// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...
var face_pattern3 = /f( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))( +(-?\d+)\/(-?\d+)\/(-?\d+))?/;
// f vertex//normal vertex//normal vertex//normal ...
var face_pattern4 = /f( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))( +(-?\d+)\/\/(-?\d+))?/
//
var lines = text.split( '\n' );
for ( var i = 0; i < lines.length; i ++ ) {
var line = lines[ i ];
line = line.trim();
var result;
if ( line.length === 0 || line.charAt( 0 ) === '#' ) {
continue;
} else if ( ( result = vertex_pattern.exec( line ) ) !== null ) {
// ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
vertices.push(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] ),
parseFloat( result[ 3 ] )
);
} else if ( ( result = normal_pattern.exec( line ) ) !== null ) {
// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
normals.push(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] ),
parseFloat( result[ 3 ] )
);
} else if ( ( result = uv_pattern.exec( line ) ) !== null ) {
// ["vt 0.1 0.2", "0.1", "0.2"]
uvs.push(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] )
);
} else if ( ( result = face_pattern1.exec( line ) ) !== null ) {
// ["f 1 2 3", "1", "2", "3", undefined]
addFace(
result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ]
);
} else if ( ( result = face_pattern2.exec( line ) ) !== null ) {
// ["f 1/1 2/2 3/3", " 1/1", "1", "1", " 2/2", "2", "2", " 3/3", "3", "3", undefined, undefined, undefined]
addFace(
result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ],
result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ]
);
} else if ( ( result = face_pattern3.exec( line ) ) !== null ) {
// ["f 1/1/1 2/2/2 3/3/3", " 1/1/1", "1", "1", "1", " 2/2/2", "2", "2", "2", " 3/3/3", "3", "3", "3", undefined, undefined, undefined, undefined]
addFace(
result[ 2 ], result[ 6 ], result[ 10 ], result[ 14 ],
result[ 3 ], result[ 7 ], result[ 11 ], result[ 15 ],
result[ 4 ], result[ 8 ], result[ 12 ], result[ 16 ]
);
} else if ( ( result = face_pattern4.exec( line ) ) !== null ) {
// ["f 1//1 2//2 3//3", " 1//1", "1", "1", " 2//2", "2", "2", " 3//3", "3", "3", undefined, undefined, undefined]
addFace(
result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ],
undefined, undefined, undefined, undefined,
result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ]
);
} else if ( /^o /.test( line ) ) {
geometry = {
vertices: [],
normals: [],
uvs: []
};
material = {
name: ''
};
object = {
name: line.substring( 2 ).trim(),
geometry: geometry,
material: material
};
objects.push( object )
} else if ( /^g /.test( line ) ) {
// group
} else if ( /^usemtl /.test( line ) ) {
// material
material.name = line.substring( 7 ).trim();
} else if ( /^mtllib /.test( line ) ) {
// mtl file
} else if ( /^s /.test( line ) ) {
// smooth shading
} else {
// console.log( "THREE.OBJLoader: Unhandled line " + line );
}
}
var container = new THREE.Object3D();
for ( var i = 0, l = objects.length; i < l; i ++ ) {
object = objects[ i ];
geometry = object.geometry;
var buffergeometry = new THREE.BufferGeometry();
buffergeometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( geometry.vertices ), 3 ) );
if ( geometry.normals.length > 0 ) {
buffergeometry.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( geometry.normals ), 3 ) );
}
if ( geometry.uvs.length > 0 ) {
buffergeometry.addAttribute( 'uv', new THREE.BufferAttribute( new Float32Array( geometry.uvs ), 2 ) );
}
material = new THREE.MeshLambertMaterial();
material.name = object.material.name;
var mesh = new THREE.Mesh( buffergeometry, material );
mesh.name = object.name;
container.add( mesh );
}
console.timeEnd( 'OBJLoader' );
return container;
}
};

365
js/three/OBJMTLLoader.js Normal file
View File

@ -0,0 +1,365 @@
/**
* Loads a Wavefront .obj file with materials
*
* @author mrdoob / http://mrdoob.com/
* @author angelxuanchang
*/
THREE.OBJMTLLoader = function ( manager ) {
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
};
THREE.OBJMTLLoader.prototype = {
constructor: THREE.OBJMTLLoader,
load: function ( url, mtlurl, onLoad, onProgress, onError ) {
var scope = this;
var mtlLoader = new THREE.MTLLoader( url.substr( 0, url.lastIndexOf( "/" ) + 1 ) );
mtlLoader.crossOrigin = scope.crossOrigin;
mtlLoader.load( mtlurl, function ( materials ) {
var materialsCreator = materials;
materialsCreator.preload();
var loader = new THREE.XHRLoader( scope.manager );
loader.setCrossOrigin( scope.crossOrigin );
loader.load( url, function ( text ) {
var object = scope.parse( text );
object.traverse( function ( object ) {
if ( object instanceof THREE.Mesh ) {
if ( object.material.name ) {
var material = materialsCreator.create( object.material.name );
if ( material ) object.material = material;
}
}
} );
onLoad( object );
}, onProgress, onError );
}, onProgress, onError );
},
/**
* Parses loaded .obj file
* @param data - content of .obj file
* @param mtllibCallback - callback to handle mtllib declaration (optional)
* @return {THREE.Object3D} - Object3D (with default material)
*/
parse: function ( data, mtllibCallback ) {
function vector( x, y, z ) {
return new THREE.Vector3( x, y, z );
}
function uv( u, v ) {
return new THREE.Vector2( u, v );
}
function face3( a, b, c, normals ) {
return new THREE.Face3( a, b, c, normals );
}
var face_offset = 0;
function meshN( meshName, materialName ) {
if ( vertices.length > 0 ) {
geometry.vertices = vertices;
geometry.mergeVertices();
geometry.computeFaceNormals();
geometry.computeBoundingSphere();
object.add( mesh );
geometry = new THREE.Geometry();
mesh = new THREE.Mesh( geometry, material );
}
if ( meshName !== undefined ) mesh.name = meshName;
if ( materialName !== undefined ) {
material = new THREE.MeshLambertMaterial();
material.name = materialName;
mesh.material = material;
}
}
var group = new THREE.Group();
var object = group;
var geometry = new THREE.Geometry();
var material = new THREE.MeshLambertMaterial();
var mesh = new THREE.Mesh( geometry, material );
var vertices = [];
var normals = [];
var uvs = [];
function add_face( a, b, c, normals_inds ) {
if ( normals_inds === undefined ) {
geometry.faces.push( face3(
parseInt( a ) - (face_offset + 1),
parseInt( b ) - (face_offset + 1),
parseInt( c ) - (face_offset + 1)
) );
} else {
geometry.faces.push( face3(
parseInt( a ) - (face_offset + 1),
parseInt( b ) - (face_offset + 1),
parseInt( c ) - (face_offset + 1),
[
normals[ parseInt( normals_inds[ 0 ] ) - 1 ].clone(),
normals[ parseInt( normals_inds[ 1 ] ) - 1 ].clone(),
normals[ parseInt( normals_inds[ 2 ] ) - 1 ].clone()
]
) );
}
}
function add_uvs( a, b, c ) {
geometry.faceVertexUvs[ 0 ].push( [
uvs[ parseInt( a ) - 1 ].clone(),
uvs[ parseInt( b ) - 1 ].clone(),
uvs[ parseInt( c ) - 1 ].clone()
] );
}
function handle_face_line(faces, uvs, normals_inds) {
if ( faces[ 3 ] === undefined ) {
add_face( faces[ 0 ], faces[ 1 ], faces[ 2 ], normals_inds );
if (!(uvs === undefined) && uvs.length > 0) {
add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 2 ] );
}
} else {
if (!(normals_inds === undefined) && normals_inds.length > 0) {
add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ], [ normals_inds[ 0 ], normals_inds[ 1 ], normals_inds[ 3 ] ]);
add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ], [ normals_inds[ 1 ], normals_inds[ 2 ], normals_inds[ 3 ] ]);
} else {
add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ]);
add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ]);
}
if (!(uvs === undefined) && uvs.length > 0) {
add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] );
add_uvs( uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] );
}
}
}
// v float float float
var vertex_pattern = /v( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// vn float float float
var normal_pattern = /vn( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// vt float float
var uv_pattern = /vt( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// f vertex vertex vertex ...
var face_pattern1 = /f( +\d+)( +\d+)( +\d+)( +\d+)?/;
// f vertex/uv vertex/uv vertex/uv ...
var face_pattern2 = /f( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))?/;
// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...
var face_pattern3 = /f( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))?/;
// f vertex//normal vertex//normal vertex//normal ...
var face_pattern4 = /f( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))?/
//
var lines = data.split( "\n" );
for ( var i = 0; i < lines.length; i ++ ) {
var line = lines[ i ];
line = line.trim();
var result;
if ( line.length === 0 || line.charAt( 0 ) === '#' ) {
continue;
} else if ( ( result = vertex_pattern.exec( line ) ) !== null ) {
// ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
vertices.push( vector(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] ),
parseFloat( result[ 3 ] )
) );
} else if ( ( result = normal_pattern.exec( line ) ) !== null ) {
// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
normals.push( vector(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] ),
parseFloat( result[ 3 ] )
) );
} else if ( ( result = uv_pattern.exec( line ) ) !== null ) {
// ["vt 0.1 0.2", "0.1", "0.2"]
uvs.push( uv(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] )
) );
} else if ( ( result = face_pattern1.exec( line ) ) !== null ) {
// ["f 1 2 3", "1", "2", "3", undefined]
handle_face_line([ result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ] ]);
} else if ( ( result = face_pattern2.exec( line ) ) !== null ) {
// ["f 1/1 2/2 3/3", " 1/1", "1", "1", " 2/2", "2", "2", " 3/3", "3", "3", undefined, undefined, undefined]
handle_face_line(
[ result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ] ], //faces
[ result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ] //uv
);
} else if ( ( result = face_pattern3.exec( line ) ) !== null ) {
// ["f 1/1/1 2/2/2 3/3/3", " 1/1/1", "1", "1", "1", " 2/2/2", "2", "2", "2", " 3/3/3", "3", "3", "3", undefined, undefined, undefined, undefined]
handle_face_line(
[ result[ 2 ], result[ 6 ], result[ 10 ], result[ 14 ] ], //faces
[ result[ 3 ], result[ 7 ], result[ 11 ], result[ 15 ] ], //uv
[ result[ 4 ], result[ 8 ], result[ 12 ], result[ 16 ] ] //normal
);
} else if ( ( result = face_pattern4.exec( line ) ) !== null ) {
// ["f 1//1 2//2 3//3", " 1//1", "1", "1", " 2//2", "2", "2", " 3//3", "3", "3", undefined, undefined, undefined]
handle_face_line(
[ result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ] ], //faces
[ ], //uv
[ result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ] //normal
);
} else if ( /^o /.test( line ) ) {
// object
meshN();
face_offset = face_offset + vertices.length;
vertices = [];
object = new THREE.Object3D();
object.name = line.substring( 2 ).trim();
group.add( object );
} else if ( /^g /.test( line ) ) {
// group
meshN( line.substring( 2 ).trim(), undefined );
} else if ( /^usemtl /.test( line ) ) {
// material
meshN( undefined, line.substring( 7 ).trim() );
} else if ( /^mtllib /.test( line ) ) {
// mtl file
if ( mtllibCallback ) {
var mtlfile = line.substring( 7 );
mtlfile = mtlfile.trim();
mtllibCallback( mtlfile );
}
} else if ( /^s /.test( line ) ) {
// Smooth shading
} else {
console.log( "THREE.OBJMTLLoader: Unhandled line " + line );
}
}
//Add last object
meshN(undefined, undefined);
return group;
}
};
THREE.EventDispatcher.prototype.apply( THREE.OBJMTLLoader.prototype );

706
js/three/OrbitControls.js Normal file
View File

@ -0,0 +1,706 @@
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
* @author erich666 / http://erichaines.com
*/
/*global THREE, console */
// This set of controls performs orbiting, dollying (zooming), and panning. It maintains
// the "up" direction as +Y, unlike the TrackballControls. Touch on tablet and phones is
// supported.
//
// Orbit - left mouse / touch: one finger move
// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
// Pan - right mouse, or arrow keys / touch: three finter swipe
THREE.OrbitControls = function ( object, domElement ) {
this.object = object;
this.domElement = ( domElement !== undefined ) ? domElement : document;
// API
// Set to false to disable this control
this.enabled = true;
// "target" sets the location of focus, where the control orbits around
// and where it pans with respect to.
this.target = new THREE.Vector3();
// center is old, deprecated; use "target" instead
this.center = this.target;
// This option actually enables dollying in and out; left as "zoom" for
// backwards compatibility
this.noZoom = false;
this.zoomSpeed = 1.0;
// Limits to how far you can dolly in and out ( PerspectiveCamera only )
this.minDistance = 0;
this.maxDistance = Infinity;
// Limits to how far you can zoom in and out ( OrthographicCamera only )
this.minZoom = 0;
this.maxZoom = Infinity;
// Set to true to disable this control
this.noRotate = false;
this.rotateSpeed = 1.0;
// Set to true to disable this control
this.noPan = false;
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
// Set to true to automatically rotate around the target
this.autoRotate = false;
this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
// How far you can orbit vertically, upper and lower limits.
// Range is 0 to Math.PI radians.
this.minPolarAngle = 0; // radians
this.maxPolarAngle = Math.PI; // radians
// How far you can orbit horizontally, upper and lower limits.
// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].
this.minAzimuthAngle = - Infinity; // radians
this.maxAzimuthAngle = Infinity; // radians
// Set to true to disable use of the keys
this.noKeys = false;
// The four arrow keys
this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
// Mouse buttons
this.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };
////////////
// internals
var scope = this;
var EPS = 0.000001;
var rotateStart = new THREE.Vector2();
var rotateEnd = new THREE.Vector2();
var rotateDelta = new THREE.Vector2();
var panStart = new THREE.Vector2();
var panEnd = new THREE.Vector2();
var panDelta = new THREE.Vector2();
var panOffset = new THREE.Vector3();
var offset = new THREE.Vector3();
var dollyStart = new THREE.Vector2();
var dollyEnd = new THREE.Vector2();
var dollyDelta = new THREE.Vector2();
var theta;
var phi;
var phiDelta = 0;
var thetaDelta = 0;
var scale = 1;
var pan = new THREE.Vector3();
var lastPosition = new THREE.Vector3();
var lastQuaternion = new THREE.Quaternion();
var STATE = { NONE : -1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };
var state = STATE.NONE;
// for reset
this.target0 = this.target.clone();
this.position0 = this.object.position.clone();
this.zoom0 = this.object.zoom;
// so camera.up is the orbit axis
var quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );
var quatInverse = quat.clone().inverse();
// events
var changeEvent = { type: 'change' };
var startEvent = { type: 'start' };
var endEvent = { type: 'end' };
this.rotateLeft = function ( angle ) {
if ( angle === undefined ) {
angle = getAutoRotationAngle();
}
thetaDelta -= angle;
};
this.rotateUp = function ( angle ) {
if ( angle === undefined ) {
angle = getAutoRotationAngle();
}
phiDelta -= angle;
};
// pass in distance in world space to move left
this.panLeft = function ( distance ) {
var te = this.object.matrix.elements;
// get X column of matrix
panOffset.set( te[ 0 ], te[ 1 ], te[ 2 ] );
panOffset.multiplyScalar( - distance );
pan.add( panOffset );
};
// pass in distance in world space to move up
this.panUp = function ( distance ) {
var te = this.object.matrix.elements;
// get Y column of matrix
panOffset.set( te[ 4 ], te[ 5 ], te[ 6 ] );
panOffset.multiplyScalar( distance );
pan.add( panOffset );
};
// pass in x,y of change desired in pixel space,
// right and down are positive
this.pan = function ( deltaX, deltaY ) {
var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
if ( scope.object instanceof THREE.PerspectiveCamera ) {
// perspective
var position = scope.object.position;
var offset = position.clone().sub( scope.target );
var targetDistance = offset.length();
// half of the fov is center to top of screen
targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
// we actually don't use screenWidth, since perspective camera is fixed to screen height
scope.panLeft( 2 * deltaX * targetDistance / element.clientHeight );
scope.panUp( 2 * deltaY * targetDistance / element.clientHeight );
} else if ( scope.object instanceof THREE.OrthographicCamera ) {
// orthographic
scope.panLeft( deltaX * (scope.object.right - scope.object.left) / element.clientWidth );
scope.panUp( deltaY * (scope.object.top - scope.object.bottom) / element.clientHeight );
} else {
// camera neither orthographic or perspective
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
}
};
this.dollyIn = function ( dollyScale ) {
if ( dollyScale === undefined ) {
dollyScale = getZoomScale();
}
if ( scope.object instanceof THREE.PerspectiveCamera ) {
scale /= dollyScale;
} else if ( scope.object instanceof THREE.OrthographicCamera ) {
scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom * dollyScale ) );
scope.object.updateProjectionMatrix();
scope.dispatchEvent( changeEvent );
} else {
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
}
};
this.dollyOut = function ( dollyScale ) {
if ( dollyScale === undefined ) {
dollyScale = getZoomScale();
}
if ( scope.object instanceof THREE.PerspectiveCamera ) {
scale *= dollyScale;
} else if ( scope.object instanceof THREE.OrthographicCamera ) {
scope.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / dollyScale ) );
scope.object.updateProjectionMatrix();
scope.dispatchEvent( changeEvent );
} else {
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
}
};
this.update = function () {
var position = this.object.position;
offset.copy( position ).sub( this.target );
// rotate offset to "y-axis-is-up" space
offset.applyQuaternion( quat );
// angle from z-axis around y-axis
theta = Math.atan2( offset.x, offset.z );
// angle from y-axis
phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );
if ( this.autoRotate && state === STATE.NONE ) {
this.rotateLeft( getAutoRotationAngle() );
}
theta += thetaDelta;
phi += phiDelta;
// restrict theta to be between desired limits
theta = Math.max( this.minAzimuthAngle, Math.min( this.maxAzimuthAngle, theta ) );
// restrict phi to be between desired limits
phi = Math.max( this.minPolarAngle, Math.min( this.maxPolarAngle, phi ) );
// restrict phi to be betwee EPS and PI-EPS
phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );
var radius = offset.length() * scale;
// restrict radius to be between desired limits
radius = Math.max( this.minDistance, Math.min( this.maxDistance, radius ) );
// move target to panned location
this.target.add( pan );
offset.x = radius * Math.sin( phi ) * Math.sin( theta );
offset.y = radius * Math.cos( phi );
offset.z = radius * Math.sin( phi ) * Math.cos( theta );
// rotate offset back to "camera-up-vector-is-up" space
offset.applyQuaternion( quatInverse );
position.copy( this.target ).add( offset );
this.object.lookAt( this.target );
thetaDelta = 0;
phiDelta = 0;
scale = 1;
pan.set( 0, 0, 0 );
// update condition is:
// min(camera displacement, camera rotation in radians)^2 > EPS
// using small-angle approximation cos(x/2) = 1 - x^2 / 8
if ( lastPosition.distanceToSquared( this.object.position ) > EPS
|| 8 * (1 - lastQuaternion.dot(this.object.quaternion)) > EPS ) {
this.dispatchEvent( changeEvent );
lastPosition.copy( this.object.position );
lastQuaternion.copy (this.object.quaternion );
}
};
this.reset = function () {
state = STATE.NONE;
this.target.copy( this.target0 );
this.object.position.copy( this.position0 );
this.object.zoom = this.zoom0;
this.object.updateProjectionMatrix();
this.dispatchEvent( changeEvent );
this.update();
};
this.getPolarAngle = function () {
return phi;
};
this.getAzimuthalAngle = function () {
return theta
};
function getAutoRotationAngle() {
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
}
function getZoomScale() {
return Math.pow( 0.95, scope.zoomSpeed );
}
function onMouseDown( event ) {
if ( scope.enabled === false ) return;
event.preventDefault();
if ( event.button === scope.mouseButtons.ORBIT ) {
if ( scope.noRotate === true ) return;
state = STATE.ROTATE;
rotateStart.set( event.clientX, event.clientY );
} else if ( event.button === scope.mouseButtons.ZOOM ) {
if ( scope.noZoom === true ) return;
state = STATE.DOLLY;
dollyStart.set( event.clientX, event.clientY );
} else if ( event.button === scope.mouseButtons.PAN ) {
if ( scope.noPan === true ) return;
state = STATE.PAN;
panStart.set( event.clientX, event.clientY );
}
if ( state !== STATE.NONE ) {
document.addEventListener( 'mousemove', onMouseMove, false );
document.addEventListener( 'mouseup', onMouseUp, false );
scope.dispatchEvent( startEvent );
}
}
function onMouseMove( event ) {
if ( scope.enabled === false ) return;
event.preventDefault();
var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
if ( state === STATE.ROTATE ) {
if ( scope.noRotate === true ) return;
rotateEnd.set( event.clientX, event.clientY );
rotateDelta.subVectors( rotateEnd, rotateStart );
// rotating across whole screen goes 360 degrees around
scope.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
// rotating up and down along whole screen attempts to go 360, but limited to 180
scope.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
rotateStart.copy( rotateEnd );
} else if ( state === STATE.DOLLY ) {
if ( scope.noZoom === true ) return;
dollyEnd.set( event.clientX, event.clientY );
dollyDelta.subVectors( dollyEnd, dollyStart );
if ( dollyDelta.y > 0 ) {
scope.dollyIn();
} else if ( dollyDelta.y < 0 ) {
scope.dollyOut();
}
dollyStart.copy( dollyEnd );
} else if ( state === STATE.PAN ) {
if ( scope.noPan === true ) return;
panEnd.set( event.clientX, event.clientY );
panDelta.subVectors( panEnd, panStart );
scope.pan( panDelta.x, panDelta.y );
panStart.copy( panEnd );
}
if ( state !== STATE.NONE ) scope.update();
}
function onMouseUp( /* event */ ) {
if ( scope.enabled === false ) return;
document.removeEventListener( 'mousemove', onMouseMove, false );
document.removeEventListener( 'mouseup', onMouseUp, false );
scope.dispatchEvent( endEvent );
state = STATE.NONE;
}
function onMouseWheel( event ) {
if ( scope.enabled === false || scope.noZoom === true || state !== STATE.NONE ) return;
event.preventDefault();
event.stopPropagation();
var delta = 0;
if ( event.wheelDelta !== undefined ) { // WebKit / Opera / Explorer 9
delta = event.wheelDelta;
} else if ( event.detail !== undefined ) { // Firefox
delta = - event.detail;
}
if ( delta > 0 ) {
scope.dollyOut();
} else if ( delta < 0 ) {
scope.dollyIn();
}
scope.update();
scope.dispatchEvent( startEvent );
scope.dispatchEvent( endEvent );
}
function onKeyDown( event ) {
if ( scope.enabled === false || scope.noKeys === true || scope.noPan === true ) return;
switch ( event.keyCode ) {
case scope.keys.UP:
scope.pan( 0, scope.keyPanSpeed );
scope.update();
break;
case scope.keys.BOTTOM:
scope.pan( 0, - scope.keyPanSpeed );
scope.update();
break;
case scope.keys.LEFT:
scope.pan( scope.keyPanSpeed, 0 );
scope.update();
break;
case scope.keys.RIGHT:
scope.pan( - scope.keyPanSpeed, 0 );
scope.update();
break;
}
}
function touchstart( event ) {
if ( scope.enabled === false ) return;
switch ( event.touches.length ) {
case 1: // one-fingered touch: rotate
if ( scope.noRotate === true ) return;
state = STATE.TOUCH_ROTATE;
rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
break;
case 2: // two-fingered touch: dolly
if ( scope.noZoom === true ) return;
state = STATE.TOUCH_DOLLY;
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
var distance = Math.sqrt( dx * dx + dy * dy );
dollyStart.set( 0, distance );
break;
case 3: // three-fingered touch: pan
if ( scope.noPan === true ) return;
state = STATE.TOUCH_PAN;
panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
break;
default:
state = STATE.NONE;
}
if ( state !== STATE.NONE ) scope.dispatchEvent( startEvent );
}
function touchmove( event ) {
if ( scope.enabled === false ) return;
event.preventDefault();
event.stopPropagation();
var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
switch ( event.touches.length ) {
case 1: // one-fingered touch: rotate
if ( scope.noRotate === true ) return;
if ( state !== STATE.TOUCH_ROTATE ) return;
rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
rotateDelta.subVectors( rotateEnd, rotateStart );
// rotating across whole screen goes 360 degrees around
scope.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
// rotating up and down along whole screen attempts to go 360, but limited to 180
scope.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
rotateStart.copy( rotateEnd );
scope.update();
break;
case 2: // two-fingered touch: dolly
if ( scope.noZoom === true ) return;
if ( state !== STATE.TOUCH_DOLLY ) return;
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
var distance = Math.sqrt( dx * dx + dy * dy );
dollyEnd.set( 0, distance );
dollyDelta.subVectors( dollyEnd, dollyStart );
if ( dollyDelta.y > 0 ) {
scope.dollyOut();
} else if ( dollyDelta.y < 0 ) {
scope.dollyIn();
}
dollyStart.copy( dollyEnd );
scope.update();
break;
case 3: // three-fingered touch: pan
if ( scope.noPan === true ) return;
if ( state !== STATE.TOUCH_PAN ) return;
panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
panDelta.subVectors( panEnd, panStart );
scope.pan( panDelta.x, panDelta.y );
panStart.copy( panEnd );
scope.update();
break;
default:
state = STATE.NONE;
}
}
function touchend( /* event */ ) {
if ( scope.enabled === false ) return;
scope.dispatchEvent( endEvent );
state = STATE.NONE;
}
this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
this.domElement.addEventListener( 'mousedown', onMouseDown, false );
this.domElement.addEventListener( 'mousewheel', onMouseWheel, false );
this.domElement.addEventListener( 'DOMMouseScroll', onMouseWheel, false ); // firefox
this.domElement.addEventListener( 'touchstart', touchstart, false );
this.domElement.addEventListener( 'touchend', touchend, false );
this.domElement.addEventListener( 'touchmove', touchmove, false );
window.addEventListener( 'keydown', onKeyDown, false );
// force an update at start
this.update();
};
THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
THREE.OrbitControls.prototype.constructor = THREE.OrbitControls;

View File

@ -0,0 +1,63 @@
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.PointerLockControls = function ( camera ) {
var scope = this;
camera.rotation.set( 0, 0, 0 );
var pitchObject = new THREE.Object3D();
pitchObject.add( camera );
var yawObject = new THREE.Object3D();
yawObject.position.y = 10;
yawObject.add( pitchObject );
var PI_2 = Math.PI / 2;
var onMouseMove = function ( event ) {
if ( scope.enabled === false ) return;
var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;
yawObject.rotation.y -= movementX * 0.002;
pitchObject.rotation.x -= movementY * 0.002;
pitchObject.rotation.x = Math.max( - PI_2, Math.min( PI_2, pitchObject.rotation.x ) );
};
document.addEventListener( 'mousemove', onMouseMove, false );
this.enabled = false;
this.getObject = function () {
return yawObject;
};
this.getDirection = function() {
// assumes the camera itself is not rotated
var direction = new THREE.Vector3( 0, 0, -1 );
var rotation = new THREE.Euler( 0, 0, 0, "YXZ" );
return function( v ) {
rotation.set( pitchObject.rotation.x, yawObject.rotation.y, 0 );
v.copy( direction ).applyEuler( rotation );
return v;
}
}();
};

835
js/three/three.min.js vendored Normal file

File diff suppressed because one or more lines are too long

19
multisphere/index.html Normal file
View File

@ -0,0 +1,19 @@
<!doctype html>
<html>
<head>
<title>The begining</title>
<meta charset="utf-8">
</head>
<body>
<h1>Here is stuff</h1>
<div id="container"></div>
<script src="/js/three/three.min.js"></script>
<script src="/js/three/OBJLoader.js"></script>
<script src="/js/three/OrbitControls.js"></script>
<script src="/js/three/PointerLockControls.js"></script>
<script src="/js/Cube.js"></script>
<script src="/js/BouncingCube.js"></script>
<script src="/js/Camera.js"></script>
<script src="js/MultiSphere.js"></script>
</body>
</html>

View File

@ -0,0 +1,116 @@
var mesh_number = 25;
var renderer, scene, camera, controls, cube, container, plane, mouse= {x:0, y:0};
var raycaster;
var objects = [];
var spheres = new Array(mesh_number);
var visible = 0;
var loader;
var container_size = new Object();
container_size.width = 1067;
container_size.height = 600;
init();
animate();
function init() {
// on initialise le moteur de rendu
container = document.getElementById('container');
container.style.height = container_size.height + 'px';
container.style.width = container_size.width + 'px';
renderer = new THREE.WebGLRenderer({alpha:"true"});
renderer.setSize(container_size.width, container_size.height);
renderer.shadowMapEnabled = true;
document.getElementById('container').appendChild(renderer.domElement);
// on initialise la scène
scene = new THREE.Scene();
raycaster = new THREE.Raycaster();
// init light
var directional_light = new THREE.DirectionalLight(0xffffff);
directional_light.position.set(1, 0.5, 1).normalize();
directional_light.castShadow = true;
scene.add(directional_light);
var ambient_light = new THREE.AmbientLight(0x444444);
scene.add(ambient_light);
// on initialise la camera que lon place ensuite sur la scène
camera = new Camera(50, container_size.width / container_size.height, 1, 10000);
scene.add(camera);
window.addEventListener('resize', onWindowResize, false);
container.addEventListener('mousedown', click, false);
// Création d'un objloader
loader = new THREE.OBJLoader();
for (var i = 0; i < mesh_number; i++) {
// Capture of i
// I am pretty good
(function(i) {
loader.load('/data/spheres/' + (i+1) + '.obj', function (object) {
object.traverse(function (child) {
if (child instanceof THREE.Mesh ) {
child.material.color.setHex(0xff0000);
child.up = new THREE.Vector3(0,0,1);
child.geometry.computeFaceNormals();
child.geometry.computeVertexNormals();
}
});
spheres[i] = object;
scene.add(object);
if (i != 0)
hide(object);
});
})(i);
}
plane = new Plane(1000,1000);
plane.translate(0,0,-100);
plane.addToScene(scene);
}
function animate() {
// on appelle la fonction animate() récursivement à chaque frame
requestAnimationFrame(animate);
camera.update();
camera.look();
renderer.render(scene, camera);
}
function onWindowResize() {
camera.aspect = container.offsetWidth / container.offsetHeight;
camera.updateProjectionMatrix();
renderer.setSize(container.offsetWidth, container.offsetHeight);
renderer.render(scene, camera);
}
function click(event) {
++visible;
visible %= spheres.length;
console.log('Mesh ', visible + 1, ' out of ', spheres.length, ' : ', spheres[visible].children[0].geometry.attributes.position.array.length, ' vertices (with duplication...)');
// hide everything except visible
for (var i in spheres)
{
hide(spheres[i]);
}
show(spheres[visible]);
}
function hide(object) {
object.traverse(function ( object ) { object.visible = false; } );
}
function show(object) {
object.traverse(function ( object ) { object.visible = true; } );
}

26
scene/index.html Normal file
View File

@ -0,0 +1,26 @@
<!doctype html>
<html>
<head>
<title>The begining</title>
<meta charset="utf-8">
</head>
<body>
<h1>Here is stuff</h1>
<div style="border-width:1px; border-style: solid;" id="container"></div>
<script src="/js/three/three.min.js"></script>
<script src="/js/three/MTLLoader.js"></script>
<script src="/js/three/OBJLoader.js"></script>
<script src="/js/three/OBJMTLLoader.js"></script>
<script src="/js/three/OrbitControls.js"></script>
<script src="/js/three/PointerLockControls.js"></script>
<script src="/js/Cube.js"></script>
<script src="/js/BouncingCube.js"></script>
<script src="/js/Camera.js"></script>
<script src="/js/PointerCamera.js"></script>
<script src="/js/FixedCamera.js"></script>
<script src="/js/CameraContainer.js"></script>
<script src="/js/Tools.js"></script>
<script src="js/main.js"></script>
</body>
</html>

49
scene/js/gen.py Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/python3
import random
N = 4;
def rand_vector():
print('new THREE.Vector3(', end='')
print(random.uniform(-500,500), end='')
print(',', end='')
print(random.uniform(-500,500), end='')
print(',', end='')
print(random.uniform(0,500), end='')
print(')', end='')
def rand_color():
chars = [ str(x) for x in range(10)] + [chr(x) for x in range(ord('a'), ord('f') + 1)]
print('0x', end='')
for i in range(6):
print(chars[random.randint(0, len(chars)-1)],end='');
def gen_positions():
print('var positions = [')
for i in range(N):
print(' ', end='')
rand_vector()
print(',')
print(' ', end='')
gen_vector()
print('\n];')
def gen_colors():
print('var colors = [')
for i in range(N):
print(' ', end='')
rand_color()
print(',')
print(' ', end='')
rand_color()
print('\n];')
def main():
gen_colors()
if __name__ == '__main__':
main()

231
scene/js/main.js Normal file
View File

@ -0,0 +1,231 @@
var mesh_number = 25;
var renderer, scene, controls, cube, container, plane, mouse= {x:0, y:0};
var bigmesh;
var raycaster;
var objects = [];
var cameras = new CameraContainer();
var spheres = new Array(mesh_number);
var visible = 0;
var loader;
var container_size = new Object();
container_size.width = 1067;
container_size.height = 600;
init();
animate();
function init() {
// on initialise le moteur de rendu
container = document.getElementById('container');
container.style.height = container_size.height + 'px';
container.style.width = container_size.width + 'px';
renderer = new THREE.WebGLRenderer({alpha:"true"});
renderer.setSize(container_size.width, container_size.height);
renderer.shadowMapEnabled = true;
// renderer.setClearColor(0x000000);
document.getElementById('container').appendChild(renderer.domElement);
// on initialise la scène
scene = new THREE.Scene();
raycaster = new THREE.Raycaster();
// init light
var directional_light = new THREE.DirectionalLight(0x999999);
directional_light.position.set(1, 0.5, 1).normalize();
directional_light.castShadow = true;
scene.add(directional_light);
var ambient_light = new THREE.AmbientLight(0x333333);
scene.add(ambient_light);
// on initialise la camera que lon place ensuite sur la scène
var camera1 = new PointerCamera(50, container_size.width / container_size.height, 1, 100000);
var camera2 = new FixedCamera(50,
container_size.width / container_size.height,
1, 100000,
new THREE.Vector3(707,-247,603),
new THREE.Vector3(683,-269,580)
);
var camera3 = new FixedCamera(50,
container_size.width / container_size.height,
1, 100000,
new THREE.Vector3(727,165,310),
new THREE.Vector3(693,173,291)
);
var camera4 = new FixedCamera(50,
container_size.width / container_size.height,
1, 100000,
new THREE.Vector3(-67,-105,306),
new THREE.Vector3(-103,-120,314)
);
scene.add(camera1);
cameras.push(camera1);
cameras.push(camera2);
cameras.push(camera3);
cameras.push(camera4);
camera2.addToScene(scene);
camera3.addToScene(scene);
camera4.addToScene(scene);
// var camera3 = new FixedCamera(
// 50,
// container_size.width / container_size.height,
// 1,
// 100000,
// new THREE.Vector3(500,0,500),
// new THREE.Vector3(0,0,0)
// );
// camera3.addToScene(scene);
// cameras.push(camera3);
window.addEventListener('resize', onWindowResize, false);
container.addEventListener('mousedown', click, false);
// Load the scene
loadScene();
plane = new Plane(1000,1000);
plane.translate(0,0,-100);
plane.addToScene(scene);
}
function loadScene() {
var positions = [
new THREE.Vector3(139.4026786273838,135.5184946130355,398.44068539970607),
new THREE.Vector3(-435.43466612542625,-213.42817928744614,357.9683852860272),
new THREE.Vector3(331.55730402813379,-554.75051838788778,327.9545043861335),
new THREE.Vector3(337.83563114154583,494.02776032947725,91.40149126173162),
new THREE.Vector3(-483.7218395537484,26.07460345877575,16.1503626453437)
];
var colors = [
0x5bf9ef,
0xec5e15,
0xcac518,
0x39c8d6,
0x04da72
];
var seen_by = [
[],
[3],
[1],
[2],
[2]
];
var mesh_number = positions.length;
loader = new THREE.OBJLoader();
for (var i = 0; i < mesh_number; i++) {
// Capture of i
// I am pretty good
(function(i) {
var new_id;
loader.load('/data/spheres/' + (i+1) + '.obj', function (object) {
object.traverse(function (child) {
if (child instanceof THREE.Mesh ) {
child.material.color.setHex(colors[i]);
child.up = new THREE.Vector3(0,0,1);
child.geometry.computeVertexNormals();
child.translateX(positions[i].x);
child.translateY(positions[i].y);
child.translateZ(positions[i].z);
new_id = child.id;
}
});
spheres[i] = object;
scene.add(object);
objects.push({obj: object, seen_by: seen_by[i], id: new_id});
});
})(i);
}
}
function animate() {
// on appelle la fonction animate() récursivement à chaque frame
requestAnimationFrame(animate);
cameras.update();
cameras.look();
renderer.render(scene, cameras.mainCamera());
}
function onWindowResize() {
cameras.forEach(function(camera) {camera.aspect = container.offsetWidth / container.offsetHeight;});
cameras.forEach(function(camera) {camera.updateProjectionMatrix();});
renderer.setSize(container.offsetWidth, container.offsetHeight);
renderer.render(scene, cameras.mainCamera());
}
function hide(object) {
object.traverse(function(object) {object.visible = false;});
}
function show(object) {
object.traverse(function(object) {object.visible = true;});
}
function click(event) {
if (cameras.mainCamera() == cameras.get(0)) {
var mouse = Object();
mouse.x = ( ( event.clientX - renderer.domElement.offsetLeft ) / renderer.domElement.width ) * 2 - 1;
mouse.y = - ( ( event.clientY - renderer.domElement.offsetTop ) / renderer.domElement.height ) * 2 + 1;
var camera = cameras.mainCamera();
var vector = new THREE.Vector3(mouse.x, mouse.y, 0.5);
vector.unproject(camera);
raycaster.set(camera.position, vector.sub(camera.position).normalize());
var intersects = raycaster.intersectObjects(scene.children, true);
if ( intersects.length > 0 ) {
var minDistance;
var bestIndex;
// Looking for cameras
for (i in intersects) {
if (typeof minDistance == 'undefined' || intersects[i].distance < minDistance) {
// We will not consider a line as clickable
if (! (intersects[i].object instanceof THREE.Line)) {
minDistance = intersects[i].distance;
bestIndex = i;
}
}
}
if (typeof bestIndex!= 'undefined') {
console.log(intersects[bestIndex]);
cameras.setById(intersects[bestIndex].object.id);
}
// Looking for objects
for (o in objects) {
if ( intersects[bestIndex].object.id == objects[o].id) {
cameras.mainCamera(objects[o].seen_by[0]);
}
}
}
}
else
{
cameras.mainCamera(0);
}
// var pos = cameras.mainCamera().position;
// var target = cameras.mainCamera().target
// console.log("Position = ", pos.x, pos.y, pos.z);
// console.log("Target = ", target.x, target.y, target.z);
}