Skip to content

Commit 999ebe9

Browse files
committedJul 31, 2016
Improve routes + add option for sprites
1 parent 6ca77f5 commit 999ebe9

File tree

11 files changed

+673
-613
lines changed

11 files changed

+673
-613
lines changed
 

‎README.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ED3D-Galaxy-Map
22
ED3D-Galaxy-Map is a 3D galactic map (web app) for the game Elite: Dangerous.
3-
Work with JSon file to embed stelar systems data.
3+
Work with JSon file to embed stellar systems data.
44

55
## Demo
66
* [Elite: Dangerous Milky Way](http://en.ed-board.net/3Dgalaxy/)
@@ -30,24 +30,30 @@ Require Three.js (r75) & JQuery
3030

3131
**basePath:** Custom base path
3232

33-
**withHudPanel:** Enable the HUD (panel to filter and navigate throughout systems). *Default: false*
34-
35-
**withOptionsPanel:** Enable the HUD (panel to filter and navigate throughout systems). *Default: false*
36-
37-
**hudMultipleSelect:** Enable showing multiple filters at same time *Default: true*
38-
39-
**showGalaxyInfos:** Show Milky Way info on start *Default: false*
33+
### Sprites
34+
**starSprite:** Add a custom sprite image for stars, exemple for round stars: ```"textures/lensflare/star_round.png"``` (default: ```"textures/lensflare/star_grey2.png"```)
4035

4136
**systemColor:** Set custom color(Hex) for system's sprite *Default: #eeeeee*
4237

4338
**effectScaleSystem:** Set an array with min & max value for system scale effect (sprite size) on zoom in/out *Default: [10,800]*
4439

40+
### Camera
4541
**startAnim:** Use initial animation (Zoom into the galaxy) *Default: true*
4642

4743
**playerPos: [x,y,z]** Player position, ex.:```[150,269,28]``` (used for initial camera target position) *Default: [0,0,0]*
4844

4945
**cameraPos: [x,y,z]** Initial camera position, ex.:```[0,45000,-45000]``` (used for initial camera position)
5046

47+
### Hud
48+
**withHudPanel:** Enable the HUD (panel to filter and navigate throughout systems). *Default: false*
49+
50+
**withOptionsPanel:** Enable the HUD (panel to filter and navigate throughout systems). *Default: false*
51+
52+
**hudMultipleSelect:** Enable showing multiple filters at same time *Default: true*
53+
54+
### Labels
55+
**showGalaxyInfos:** Show Milky Way info on start *Default: false*
56+
5157
**showNameNear:** Show labels close from the camera target (Default: false)
5258

5359
## Methods

‎demo_galnet.html

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
hudMultipleSelect : false,
5050
effectScaleSystem : [28,1000],
5151
startAnim: true,
52+
starSprite: "textures/lensflare/star_round.png",
5253
showNameNear: true //-- EXPERIMENTAL (Show name from systems near camera)
5354
});
5455

‎demo_routes.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ <h1>Milky Way</h1>
8181
effectScaleSystem : [50,10000],
8282
startAnim: true,
8383
showGalaxyInfos: true,
84-
systemColor: '#FF9D00'
84+
systemColor: '#FF9D00',
85+
playerPos: [25,-2100,-3900],
86+
cameraPos: [25,9100,-7900],
8587
});
8688

8789
</script>
8890

8991
</body>
90-
</html>
92+
</html>

‎js/components/action.class.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ var Action = {
302302

303303
$('#debug').html(Math.round(intersection.point.x)+' , '+Math.round(-intersection.point.z));
304304

305-
Route.addPoint(Math.round(intersection.point.x),0,Math.round(-intersection.point.z));
305+
//Route.addPointToRoute(Math.round(intersection.point.x),0,Math.round(-intersection.point.z));
306306

307307
}
308308
}

‎js/components/hud.class.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var HUD = {
2727
' <div id="controls">'+
2828
' <a data-view="3d" class="view selected">3D</a>'+
2929
' <a data-view="top" class="view">2D</a>'+
30+
//' <a data-view="top" class="view">RED</a>'+ // TMP route edit button
3031
' <a data-view="infos" class="'+(Ed3d.showGalaxyInfos ? 'selected' : '')+'">i</a>'+
3132
' <a data-view="options">'+Ico.cog+'</a>'+
3233
' <div id="options" style="display:none;"></div>'+

‎js/components/route.class.js

+68-11
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,8 @@ var Route = {
5858
geometryL.vertices.push(
5959
new THREE.Vector3(c[0], c[1], c[2])
6060
);
61-
Route.addPoint(c[0], c[1], c[2]);
61+
//Route.addPoint(c[0], c[1], c[2]);
6262

63-
/*var geometry = new THREE.SphereGeometry(3, 10, 10);
64-
var sphere = new THREE.Mesh(geometry, Ed3d.material.white);
65-
sphere.position.set(x, y, z);
66-
scene.add(sphere);*/
6763

6864
} else {
6965

@@ -84,10 +80,11 @@ var Route = {
8480
},
8581

8682
'addCircle' : function(point) {
83+
8784
var cursor = new THREE.Object3D;
8885

8986
//-- Ring around the system
90-
var geometryL = new THREE.TorusGeometry( 12, 0.4, 3, 30 );
87+
var geometryL = new THREE.TorusGeometry( 4, 0.4, 3, 15 );
9188

9289
var selection = new THREE.Mesh(geometryL, Ed3d.material.orange);
9390
selection.rotation.x = Math.PI / 2;
@@ -99,13 +96,17 @@ var Route = {
9996
cursor.scale.set(15,15,15);
10097

10198
scene.add(cursor);
99+
100+
//-- Add to cursor list for scale effets
101+
Action.cursor[cursor.id] = cursor;
102+
102103
},
103104

104-
'addPoint' : function(x, y, z) {
105+
'addPoint' : function(x, y, z, name) {
105106

106107
/*console.log('Add point route');*/
107108

108-
/*var cursor = new THREE.Object3D;
109+
var cursor = new THREE.Object3D;
109110

110111
//-- Ring around the system
111112
var geometryL = new THREE.TorusGeometry( 12, 0.4, 3, 30 );
@@ -130,12 +131,68 @@ var Route = {
130131
cursor.add(coneInner);
131132

132133

133-
cursor.position.set(x, y, -z);
134+
cursor.position.set(x, y, z);
134135

135136
cursor.scale.set(30,30,30);
136137

137-
scene.add(cursor);*/
138-
}
138+
scene.add(cursor);
139+
140+
},
141+
142+
'newRoute' : function(name) {
143+
var routes = localStorage.getItem("routes");
144+
if(routes == undefined) {
145+
var routes = [];
146+
}
147+
148+
var myRoute = {
149+
title: "Test route",
150+
points: []
151+
}
152+
153+
routes.push(myRoute);
154+
routes.push(myRoute);
155+
routes.push(myRoute);
156+
157+
localStorage.setItem("routes",JSON.stringify(routes));
158+
},
159+
160+
'addPointToRoute' : function(x,y,z,system,label) {
161+
162+
idRoute = 1;
163+
164+
console.log('add point');
165+
166+
var routes = JSON.parse(localStorage.getItem("routes"));
167+
if(routes[idRoute] == undefined) return false;
168+
169+
var point = {
170+
"coords": {"x":x, "y":y, "z":z }
171+
}
172+
if(system==undefined) system = Math.floor(Date.now() / 1000);
173+
174+
if(system != undefined) point.s = system;
175+
if(label != undefined) point.label = label;
176+
177+
routes[idRoute].points.push(point);
178+
179+
localStorage.setItem("routes",JSON.stringify(routes));
180+
181+
182+
183+
this.drawRoute(1);
184+
},
185+
186+
'drawRoute': function(idRoute) {
187+
188+
var route = JSON.parse(localStorage.getItem("routes"))[idRoute];
189+
if(route == undefined) return false;
190+
191+
this.initRoute(0,route);
192+
this.createRoute(0,route);
193+
194+
},
195+
139196

140197

141198
}

‎js/ed3dmap.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ var Ed3d = {
7777
}),
7878
'glow_1' : null,
7979
'custom' : []
80+
},
8081

82+
'starSprite' : 'textures/lensflare/star_grey2.png',
8183

82-
83-
},
8484
'colors' : [],
8585
'textures' : {},
8686

@@ -287,7 +287,7 @@ var Ed3d = {
287287

288288
//-- Load textures
289289
this.textures.flare_white = texloader.load(Ed3d.basePath + "textures/lensflare/flare2.png");
290-
this.textures.flare_yellow = texloader.load(Ed3d.basePath + "textures/lensflare/star_grey2.png");
290+
this.textures.flare_yellow = texloader.load(Ed3d.basePath + Ed3d.starSprite);
291291
this.textures.flare_center = texloader.load(Ed3d.basePath + "textures/lensflare/flare3.png");
292292

293293
//-- Load sprites
@@ -475,6 +475,7 @@ var Ed3d = {
475475
$.each(data.routes, function(key, route) {
476476
Route.createRoute(key, route);
477477
});
478+
478479
}
479480

480481
},

‎js/ed3dmap.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎json_samples/routes.json

-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
{
22
"systems": [
3-
{
4-
"name": "Wolf 906",
5-
"coords": {
6-
"x": "-27",
7-
"y": "-25",
8-
"z": "29"
9-
}
10-
},
113
{
124
"name": "Checkpoint 1",
135
"coords": {

‎textures/lensflare/star_round.png

13.3 KB
Loading

‎vendor/three-js/OrbitControls.js

+579-579
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.