-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
174 lines (155 loc) · 5.49 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
/>
<link rel="icon" type="image/png" href="Media/main.png" />
<link rel="stylesheet" href="styles.css" />
<title>Galactic TrailBlaze</title>
</head>
<body>
<nav class="nav-bar">
<h3>NASA Space</h3>
<ul>
<li><a href="about.html">About</a></li>
<li><a href="NasaTerminal.html">Explore</a></li>
</ul>
<i class="fa-solid fa-bars" onclick="openNav()"></i>
<div id="myNav" class="overlay">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()"
>×</a
>
<div class="overlay-content">
<a href="about.html">About</a>
<a href="NasaTerminal.html">Explore</a>
</div>
</div>
</nav>
<header class="side-spacing">
<h2 class="side-spacing introduction">
Welcome to Space Jumpers, explore the exo-planets with visual
information
</h2>
</header>
<div class="sign-up-section">
<div class="form">
<form action="home.html">
<fieldset>
<legend id="signInUp">Sign Up</legend>
<div class="form-group removeName">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required />
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required />
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" required />
</div>
<br />
<div class="form-group">
<button><a href="home.html">Sign Up</a></button>
<p id="signOption">
Already have an account?
<a href="signin.html" onclick="signIn()">Sign In</a>
</p>
</div>
</fieldset>
</form>
</div>
<div class="earth">
<!-- The 3D model will be rendered here -->
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/loaders/GLTFLoader.js"></script>
<script>
function openNav() {
document.getElementById("myNav").style.width = "100%";
}
function closeNav() {
document.getElementById("myNav").style.width = "0%";
}
// Scene setup
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
5000
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: true,
});
renderer.setClearColor(0x000000, 0); // Set clear color to transparent
// Append the renderer to the earth div instead of body
const earthDiv = document.querySelector(".earth");
earthDiv.appendChild(renderer.domElement);
// Set renderer size based on the earth div dimensions
renderer.setSize(earthDiv.clientWidth, earthDiv.clientHeight);
camera.aspect = earthDiv.clientWidth / earthDiv.clientHeight;
camera.updateProjectionMatrix();
// Orbit Controls with damping
const controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.05;
controls.screenSpacePanning = false;
// Ambient Light
const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);
scene.add(ambientLight);
// Directional Lights
const directionalLight1 = new THREE.DirectionalLight(0xffffff, 1.5);
directionalLight1.position.set(5, 10, 7);
scene.add(directionalLight1);
const directionalLight2 = new THREE.DirectionalLight(0xffffff, 1.5);
directionalLight2.position.set(-5, 10, -7);
scene.add(directionalLight2);
// Variable to store the loaded model
let loadedModel;
// Load GLTF model
const loader = new THREE.GLTFLoader();
loader.load(
"3D%20Models/stylized_planet/scene.gltf",
function (gltf) {
loadedModel = gltf.scene;
scene.add(loadedModel);
},
undefined,
function (error) {
console.error(error);
}
);
// Camera positioning
camera.position.set(0, 0, 1.5);
camera.lookAt(0, 0, 0);
// Animation loop
function animate() {
requestAnimationFrame(animate);
// Rotate the loaded model if it exists
if (loadedModel) {
loadedModel.rotation.y += 0.005; // Adjust the rotation speed as needed
}
controls.update();
renderer.render(scene, camera);
}
animate();
// Handle window resize
window.addEventListener("resize", () => {
const width = earthDiv.clientWidth;
const height = earthDiv.clientHeight;
renderer.setSize(width, height);
camera.aspect = width / height;
camera.updateProjectionMatrix();
});
</script>
</body>
</html>
<!-- Developed by Arji Jethin & Aluru Bala Karthikeya -->