Newer
Older
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//-----------------------------------------------------------------------------------------------------------------------
// REFERENCE SPHERE
//-----------------------------------------------------------------------------------------------------------------------
if(show_sphere){
var mat_sphere = new THREE.MeshPhongMaterial( {
color: 0x282400,
transparent: true,
side: THREE.FrontSide,
metal: true,
depthWrite: false, depthTest: false, alphaTest: 0.1,
opacity: 0.4,
} );
var mat_sphere2 = new THREE.MeshBasicMaterial( {
color: 0xBBBBBB,
transparent: true,
side: THREE.FrontSide,
metal: true,
depthWrite: false, depthTest: false, alphaTest: 0.1,
opacity: 0.11,
} );
var mats_sphere = [mat_sphere, mat_sphere2];
var sphere = THREE.SceneUtils.createMultiMaterialObject(new THREE.SphereGeometry( sphere_radius, sphere_segments, sphere_segments ), mats_sphere);
sphere.position.set( 0, 0, 0 );
sphere.renderDepth = -0.1;
scene.add( sphere );
}
//-----------------------------------------------------------------------------------------------------------------------
// MINI SPHERES
//-----------------------------------------------------------------------------------------------------------------------
if(show_mini_spheres){
if(!canvas_mode)
var mat_mini = new THREE.MeshPhongMaterial( { color: 0xAAAAAA, metal: true } );
else
var mat_mini = new THREE.MeshBasicMaterial( { color: 0xAAAAAA } );
var miniSphere = new THREE.Mesh(new THREE.SphereGeometry( miniSphere_radius, miniSphere_seg, miniSphere_seg ), mat_mini);
miniSphere.position.set( 0, 0, 0 );
//if(!show_spacecraft){
//scene.add( miniSphere );
//}
miniSphereX = miniSphere.clone();
miniSphereX.position.set( sphere_radius+miniSphere_margin, 0, 0 );
scene.add( miniSphereX );
miniSphereXX = miniSphere.clone();
miniSphereXX.position.set( -sphere_radius-miniSphere_margin, 0, 0 );
scene.add( miniSphereXX );
miniSphereY = miniSphere.clone();
miniSphereY.position.set( 0, sphere_radius+miniSphere_margin, 0 );
scene.add( miniSphereY );
miniSphereYY = miniSphere.clone();
miniSphereYY.position.set( 0, -sphere_radius-miniSphere_margin, 0 );
scene.add( miniSphereYY );
miniSphereZ = miniSphere.clone();
miniSphereZ.position.set( 0, 0, sphere_radius+miniSphere_margin);
scene.add( miniSphereZ );
miniSphereZZ = miniSphere.clone();
miniSphereZZ.position.set( 0, 0, -sphere_radius-miniSphere_margin);
scene.add( miniSphereZZ );
}
initSpacecraft();
//-----------------------------------------------------------------------------------------------------------------------
// SPHERE CIRCLES
//-----------------------------------------------------------------------------------------------------------------------
if(show_circles){
if(!canvas_mode)
var mat_torus = new THREE.MeshPhongMaterial( { color: 0xAAAAAA, metal: true, transparent: false, opacity: 1.0, side: THREE.BackSide } );
else
var mat_torus = new THREE.MeshBasicMaterial( { color: 0xAAAAAA, side: THREE.BackSide } );
var sphere_y = new THREE.Mesh( new THREE.TorusGeometry( torus_radius, torus_tube, torus_seg_r, torus_seg_t ), mat_torus );
sphere_y.position.set( 0, 0, 0 );
scene.add( sphere_y );
var sphere_z = new THREE.Mesh( new THREE.TorusGeometry( torus_radius, torus_tube, torus_seg_r, torus_seg_t ), mat_torus );
sphere_z.position.set( 0, 0, 0 );
sphere_z.rotation.x = Math.PI/2;
scene.add( sphere_z );
var sphere_x = new THREE.Mesh( new THREE.TorusGeometry( torus_radius, torus_tube, torus_seg_r, torus_seg_t ), mat_torus );
sphere_x.position.set( 0, 0, 0 );
sphere_x.rotation.y = Math.PI/2;
scene.add( sphere_x );
}
//-----------------------------------------------------------------------------------------------------------------------
// REFERENCE AXIS
//-----------------------------------------------------------------------------------------------------------------------
if(show_axis){
var axis = new THREE.AxisHelper( sphere_radius );
axis.position.set( 0, 0, 0 );
scene.add( axis );
}
if(show_axis_labels){
var sprite_X = makeTextSprite( 0, " X ",
{ fontsize: 48, borderColor: {r:0, g:0, b:0, a:1.0}, borderThickness: 1, backgroundColor: {r:0, g:0, b:0, a:0.5}, fontColor: {r:255, g:174, b:0, a:1.0} } );
sprite_X.position.set( sphere_radius+miniSphere_margin, 0, 0 );
scene.add( sprite_X );
var sprite_Y = makeTextSprite( 0, " Y ",
{ fontsize: 48, borderColor: {r:0, g:0, b:0, a:1.0}, borderThickness: 1, backgroundColor: {r:0, g:0, b:0, a:0.5}, fontColor: {r:16, g:219, b:2, a:1.0} } );
sprite_Y.position.set( 0, sphere_radius+miniSphere_margin, 0 );
scene.add( sprite_Y );
var sprite_Z = makeTextSprite( 0, " Z ",
{ fontsize: 48, borderColor: {r:0, g:0, b:0, a:1.0}, borderThickness: 1, backgroundColor: {r:0, g:0, b:0, a:0.5}, fontColor: {r:50, g:119, b:255, a:1.0} } );
sprite_Z.position.set( 0, 0, sphere_radius+miniSphere_margin );
scene.add( sprite_Z );
}
}