Skip to content

Commit

Permalink
Updated Milky Way data & add button to toggle infos.
Browse files Browse the repository at this point in the history
  • Loading branch information
gbiobob committed Jan 25, 2016
1 parent f778457 commit 0ff9ca5
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 26 deletions.
16 changes: 12 additions & 4 deletions data/milkyway.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@
{"x":8039, "z":-7019, "rotate":0 },
{"x":32905, "z":4565, "rotate":45 }
],
"The Cygnus arm" : [
"The Norma arm" : [
{"x":7944, "z":17960, "rotate":40 },
{"x":13524, "z":29918, "rotate":90 },
{"x":7498, "z":40348, "rotate":-35 },
{"x":7498, "z":40348, "rotate":-35 }
],
"The Cygnus arm" : [
{"x":-7724, "z":43523, "rotate":0 },
{"x":-22353, "z":37643, "rotate":38 }
],
Expand All @@ -84,6 +86,12 @@
{"x":14300, "z":46140, "rotate":-38 },
{"x":19815, "z":31418, "rotate":90 },
{"x":16637, "z":17458, "rotate":48 }
],
"The near 3KPC arm" : [
{"x":5765, "z":22639, "rotate":45 }
],
"The far 3KPC arm" : [
{"x":-4906 ,"z":28535, "rotate":45 }
]
},

Expand All @@ -108,8 +116,8 @@
{"x":31522 , "z":11890, "rotate":50}
],
"The Carina-Scutum gap" : [
{"x":14535 , "z":54942, "rotate":-25},
{"x":22140 , "z":45532, "rotate":-40}
{"x":14535 , "z":54942, "rotate":-35},
{"x":22140 , "z":45532, "rotate":-60}
]

},
Expand Down
1 change: 0 additions & 1 deletion js/components/action.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ var Action = {

if(intersection.object.showCoord) {

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

}
Expand Down
26 changes: 20 additions & 6 deletions js/components/galaxy.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var Galaxy = {
'infos' : null,
'milkyway' : [],
'milkyway2D' : null,
'backActive' : true,
'colors' : [],

'x' : 25,
Expand Down Expand Up @@ -68,9 +69,10 @@ var Galaxy = {

'showGalaxyInfos' : function() {

this.infos = new THREE.Object3D();
if(!Ed3d.showGalaxyInfos) return;

this.infos = new THREE.Object3D();

$.getJSON(Ed3d.basePath + "data/milkyway.json", function(data) {

$.each(data.quadrants, function(key, val) {
Expand Down Expand Up @@ -107,19 +109,33 @@ var Galaxy = {
}).done(function() {

scene.add(Galaxy.infos);
console.log(Galaxy.infos);

});

},

/**
* Show additional galaxy infos
*/
'infosShow' : function() {
if(Galaxy.infos == null) this.showGalaxyInfos();
if(Galaxy.infos !== null) Galaxy.infos.visible = Ed3d.showGalaxyInfos;
},

/**
* Show additional galaxy infos
*/
'infosHide' : function() {
if(Galaxy.infos !== null) Galaxy.infos.visible = false;
},

/**
* Appli opacity for Milky Way info based on distance
*/

'infosUpdateCallback' : function(scale) {

if(this.infos == null) return;
if(!Ed3d.showGalaxyInfos || this.infos == null) return;

scale -= 70;

Expand Down Expand Up @@ -186,7 +202,7 @@ var Galaxy = {
'weight': 'normal',
'style': 'normal',
'size': size,
'curveSegments': 100
'curveSegments': 12
});

var textGeo = new THREE.ShapeGeometry(textShapes);
Expand Down Expand Up @@ -308,8 +324,6 @@ var Galaxy = {
}
}

console.log(nbBig+nb);

//-- Create small particles milkyway

particles.colors = this.colors;
Expand Down
35 changes: 23 additions & 12 deletions js/components/hud.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@ var HUD = {
*/
'create' : function(container) {

if(!Ed3d.withHudPanel) return;

this.container = container;

$('#'+this.container).append(
' <div id="controls">'+
' <a href="#" data-view="3d" class="view selected">3D</a>'+
' <a href="#" data-view="top" class="view">2D</a>'+
' <a href="#" data-view="infos" class="'+(Ed3d.showGalaxyInfos ? 'selected' : '')+'">i</a>'+
' <a href="#" data-view="options">'+Ico.cog+'</a>'+
' <div id="options" style="display:none;"></div>'+
' </div>'
);
this.createSubOptions();

if(!Ed3d.withHudPanel) return;

$('#'+this.container).append('<div id="hud"></div>');
$('#hud').append(
'<div>'+
Expand All @@ -41,16 +52,6 @@ var HUD = {
);
$('#'+this.container).append('<div id="systemDetails" style="display:none;"></div>');

$('#'+this.container).append(
' <div id="controls">'+
' <a href="#" data-view="3d" class="view selected">3D</a>'+
' <a href="#" data-view="top" class="view">2D</a>'+
' <a href="#" data-view="options">'+Ico.cog+'</a>'+
' <div id="options" style="display:none;"></div>'+
' </div>'
);
this.createSubOptions();

},

/**
Expand Down Expand Up @@ -118,6 +119,16 @@ var HUD = {
HUD.moveCamera(moveFrom,moveCoords);
break;

case 'infos':
if(!Ed3d.showGalaxyInfos) {
Ed3d.showGalaxyInfos = true;
Galaxy.infosShow();
} else {
Ed3d.showGalaxyInfos = false;
Galaxy.infosHide();
}
$(this).toggleClass('selected');
break;

case 'options':
$('#options').toggle();
Expand Down
4 changes: 2 additions & 2 deletions js/ed3dmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ function enableFarView (scale, withAnim) {

//-- Enable 2D galaxy
Galaxy.milkyway2D.visible = true;
Galaxy.infos.visible = true;
Galaxy.infosShow();


//Galaxy.obj.scale.set(20,20,20);
Expand Down Expand Up @@ -624,7 +624,7 @@ function disableFarView(scale, withAnim) {

//-- Disable 2D galaxy
Galaxy.milkyway2D.visible = false;
Galaxy.infos.visible = false;
Galaxy.infosHide();

//-- Show element
Galaxy.milkyway[0].material.size = 16;
Expand Down
2 changes: 1 addition & 1 deletion js/ed3dmap.min.js

Large diffs are not rendered by default.

0 comments on commit 0ff9ca5

Please sign in to comment.