-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html~
243 lines (194 loc) · 10.4 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<<<<<<< HEAD
<html lang="en">
<head>
<title>3D Starry Night - Explore the Universe</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Monospace;
background-color: #f0f0f0;
margin: 0px;
overflow: hidden;
}
</style>
</head>
<body>
<script src="three/three.min.js"></script>
<script src="js/renderers/CanvasRenderer.js"></script>
<script src="js/stats.min.js"></script>
<script>
var container, stats;
var camera, scene, renderer;
var starSource = "data/stars.json";
var scale = 30;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;
init(scale);
render();
// read stars coordinates from stars.json
function init(scaleFactor) {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 55, window.innerWidth / window.innerHeight, 0.1, 100000000 );
camera.position.set(-0.2, 0, 0);
scene = new THREE.Scene();
var particles;
var geometry = new THREE.Geometry();
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === 4) {
//parse JSON data
//alert("checkppoint 1");
var stars = JSON.parse(httpRequest.responseText);
var colors = [];
var colorsh = [];
var lumsh = [];
//alert("checkpoint 2");
stars.forEach(function(star, i) {
var pX = star.pos[0] * scaleFactor,
pY = star.pos[1] * scaleFactor,
pZ = star.pos[2] * scaleFactor;
var vertex = new THREE.Vector3(pX, pY, pZ);
geometry.vertices.push(vertex);
colors[i] = new THREE.Color();
var int = star.color;
colors[i].setRGB(int[0]/255, int[1]/255, int[2]/255);
colorsh[i] = [int[0]/255, int[1]/255, int[2]/255];
lumsh[i] = Math.pow(star.luminosity, 0.25);
//TODO: add label
});
geometry.colors = colors;
var starMaterial = new THREE.ParticleSystemMaterial( {
uniforms: {
cutoff: { type: 'f', value: 1}
},
attributes: {
color: { type: 'v3', value: colorsh },
luminosity: { type: 'f', value: lumsh }
},
//vertexShader: document.getElementById('vertexshader').textContent,
//fragmentShader: document.getElementById('fragmentshader').textContent,
side: THREE.DoubleSide,
blending: THREE.AdditiveBlending,
transparent: true,
depthTest: true
});
particles = new THREE.ParticleSystem(geometry, starMaterial);
scene.add(particles);
}
}
httpRequest.open("GET", starSource);
httpRequest.send();
renderer = new THREE.WebGLRenderer();
renderer.setClearColor( 0x000 ); // black background
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );
// Lights
var light = new THREE.PointLight('#FFFFFF', 1.5);
light.position.set(0, 0, 0.3);
scene.add(light);
var ambient = new THREE.AmbientLight('#292725');
scene.add(ambient);
// Universe Sphere
var sphereGeom = new THREE.SphereGeometry(9000000, 32, 16);
var material = new THREE.MeshBasicMaterial({
map: THREE.ImageUtils.loadTexture( 'images/milkyway_pan.jpg' ),
transparent: false,
side: THREE.BackSide
});
var universe = new THREE.Mesh(sphereGeom.clone(), material);
universe.position.set(0, 0, 0);
scene.add(universe);
stats = new Stats();
stats.domElement.style.position = 'absolute';
stats.domElement.style.top = '0px';
container.appendChild( stats.domElement );
window.addEventListener( 'resize', onWindowResize, false );
}
function onWindowResize() {
windowHalfX = window.innerWidth / 2;
windowHalfY = window.innerHeight / 2;
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
function render() {
requestAnimationFrame(render);
renderer.render(scene, camera);
stats.update();
}
</script>
</body>
</html>
=======
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=640">
<link rel="stylesheet" href="stylesheets/core.css" media="screen">
<link rel="stylesheet" href="stylesheets/mobile.css" media="handheld, only screen and (max-device-width:640px)">
<link rel="stylesheet" href="stylesheets/github-light.css">
<script type="text/javascript" src="javascripts/modernizr.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="javascripts/headsmart.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#main_content').headsmart()
})
</script>
<title>3dstarrynight by CodeTaha</title>
</head>
<body>
<a id="forkme_banner" href="https://github.com/CodeTaha/3DStarryNight">View on GitHub</a>
<div class="shell">
<header>
<span class="ribbon-outer">
<span class="ribbon-inner">
<h1>3dstarrynight</h1>
<h2></h2>
</span>
<span class="left-tail"></span>
<span class="right-tail"></span>
</span>
</header>
<section id="downloads">
<span class="inner">
<a href="https://github.com/CodeTaha/3DStarryNight/zipball/master" class="zip"><em>download</em> .ZIP</a><a href="https://github.com/CodeTaha/3DStarryNight/tarball/master" class="tgz"><em>download</em> .TGZ</a>
</span>
</section>
<span class="banner-fix"></span>
<section id="main_content">
<h3>
<a id="welcome-to-github-pages" class="anchor" href="#welcome-to-github-pages" aria-hidden="true"><span class="octicon octicon-link"></span></a>Welcome to GitHub Pages.</h3>
<p>This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here <a href="https://guides.github.com/features/mastering-markdown/">using GitHub Flavored Markdown</a>, select a template crafted by a designer, and publish. After your page is generated, you can check out the new <code>gh-pages</code> branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.</p>
<h3>
<a id="designer-templates" class="anchor" href="#designer-templates" aria-hidden="true"><span class="octicon octicon-link"></span></a>Designer Templates</h3>
<p>We’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.</p>
<h3>
<a id="creating-pages-manually" class="anchor" href="#creating-pages-manually" aria-hidden="true"><span class="octicon octicon-link"></span></a>Creating pages manually</h3>
<p>If you prefer to not use the automatic generator, push a branch named <code>gh-pages</code> to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.</p>
<h3>
<a id="authors-and-contributors" class="anchor" href="#authors-and-contributors" aria-hidden="true"><span class="octicon octicon-link"></span></a>Authors and Contributors</h3>
<p>You can <a href="https://github.com/blog/821" class="user-mention">@mention</a> a GitHub username to generate a link to their profile. The resulting <code><a></code> element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (<a href="https://github.com/defunkt" class="user-mention">@defunkt</a>), PJ Hyett (<a href="https://github.com/pjhyett" class="user-mention">@pjhyett</a>), and Tom Preston-Werner (<a href="https://github.com/mojombo" class="user-mention">@mojombo</a>) founded GitHub.</p>
<h3>
<a id="support-or-contact" class="anchor" href="#support-or-contact" aria-hidden="true"><span class="octicon octicon-link"></span></a>Support or Contact</h3>
<p>Having trouble with Pages? Check out our <a href="https://help.github.com/pages">documentation</a> or <a href="https://github.com/contact">contact support</a> and we’ll help you sort it out.</p>
</section>
<footer>
<span class="ribbon-outer">
<span class="ribbon-inner">
<p>this project by <a href="https://github.com/CodeTaha">CodeTaha</a> can be found on <a href="https://github.com/CodeTaha/3DStarryNight">GitHub</a></p>
</span>
<span class="left-tail"></span>
<span class="right-tail"></span>
</span>
<p>Generated with <a href="https://pages.github.com">GitHub Pages</a> using Merlot</p>
<span class="octocat"></span>
</footer>
</div>
</body>
</html>
>>>>>>> Create gh-pages branch via GitHub