Added Google Analytics and frameworks for line drawing and entity removal
This commit is contained in:
parent
e3c523d63d
commit
8af99436ae
@ -85,6 +85,7 @@ var SpriteText2D = THREE_Text.SpriteText2D;
|
||||
var textAlign = THREE_Text.textAlign
|
||||
var raycaster = new THREE.Raycaster();
|
||||
var mouse = new THREE.Vector2();
|
||||
var rays = [];
|
||||
|
||||
jsonEmpire = jsonEmpire['ATS_Navcomp_DB']['empires'];
|
||||
|
||||
@ -100,6 +101,7 @@ for (var key in jsonEmpire) {
|
||||
borders[border.name].position.x = border.x;
|
||||
borders[border.name].position.y = border.y;
|
||||
borders[border.name].position.z = border.z;
|
||||
borders[border.name].name = border.name;
|
||||
scene.add( borders[border.name] );
|
||||
if (border.radius > 10) {
|
||||
var text = new Text2D(border.name, { align: textAlign.center, font: '25px Arial', fillStyle: '#777' , antialias: false });
|
||||
@ -121,6 +123,7 @@ for (var key in jsonEmpire) {
|
||||
planets[planet.name].position.x=planet.x;
|
||||
planets[planet.name].position.y=planet.y;
|
||||
planets[planet.name].position.z=planet.z;
|
||||
planets[planet.name].name = planet.name;
|
||||
var text = new Text2D(planet.name, { align: textAlign.right, font: '12px Arial', fillStyle: '#FFF' , antialias: false });
|
||||
text.material.alphaTest = 0.0;
|
||||
text.position.set(planet.x,planet.y,planet.z);
|
||||
@ -139,6 +142,7 @@ for (var key in jsonEmpire) {
|
||||
bases[base.name].position.x=base.x;
|
||||
bases[base.name].position.y=base.y;
|
||||
bases[base.name].position.z=base.z;
|
||||
bases[base.name].name = base.name;
|
||||
scene.add( bases[base.name] );
|
||||
var text = new Text2D(base.name, { align: textAlign.left, font: '12px Arial', fillStyle: '#ABABAB' , antialias: false });
|
||||
text.material.alphaTest = 0.0;
|
||||
@ -162,7 +166,6 @@ window.onresize = function() {
|
||||
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
|
||||
controls.handleResize();
|
||||
|
||||
render();
|
||||
|
||||
@ -171,8 +174,9 @@ window.onresize = function() {
|
||||
function animate() {
|
||||
var delta = clock.getDelta();
|
||||
requestAnimationFrame( animate );
|
||||
|
||||
scene.updateMatrixWorld()
|
||||
controls.update(delta);
|
||||
renderer.render(scene, camera);
|
||||
}
|
||||
|
||||
|
||||
@ -223,3 +227,21 @@ function zoomfocus(name) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function drawline(name,origin,dest) {
|
||||
var geometry = new THREE.Geometry();
|
||||
var material = new THREE.LineBasicMaterial( { color: '#FFF', });
|
||||
geometry.vertices.push(origin, direction);
|
||||
var line = new THREE.Line( geometry, material );
|
||||
ray.name = "test";
|
||||
scene.add(ray);
|
||||
animate();
|
||||
|
||||
}
|
||||
|
||||
function removeEntity(object) {
|
||||
var selectedObject = scene.getObjectByName(object);
|
||||
scene.remove( selectedObject );
|
||||
animate();
|
||||
}
|
||||
|
@ -9,6 +9,16 @@
|
||||
<link href="https://fonts.googleapis.com/css?family=Space+Mono" rel="stylesheet">
|
||||
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
|
||||
<script src="js/GUI.Utils.js"></script>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-80748037-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
body { margin: 0; overflow:hidden;}
|
||||
canvas { width: 75%; height: 100% ;}
|
||||
|
Loading…
Reference in New Issue
Block a user