aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahiel@protonmail.ch>2015-11-03 12:37:29 +0100
committerRahiel Kasim <rahiel@protonmail.ch>2015-11-03 12:37:29 +0100
commitb18080d4169351e9fa6cc2a572b8eed8beb2504d (patch)
tree163cc4379ded7472618d28a2711da0b81d28d897
parent8712d27e03fc868d6bfdc488e15305b31216c3a8 (diff)
import all dependencies with webpack, replacing cdnjs
-rw-r--r--calc.js3
-rw-r--r--index.html4
-rw-r--r--main.js10
-rw-r--r--package.json14
-rw-r--r--systems.js4
5 files changed, 22 insertions, 13 deletions
diff --git a/calc.js b/calc.js
index f28dd09..04f5c4d 100644
--- a/calc.js
+++ b/calc.js
@@ -1,4 +1,5 @@
-let Vec3 = THREE.Vector3;
+let Vec3 = require("three.js").Vector3;
+
import Body from "./systems.js";
export const G = 6.67408E-11;
diff --git a/index.html b/index.html
index 1434d6d..1778c6c 100644
--- a/index.html
+++ b/index.html
@@ -6,10 +6,6 @@
<script type="text/javascript">if(window.location.protocol=="http:"&&window.location.host=="sunsistemo.js.org")window.location.protocol="https";</script>
<title>Sunsistemo - N-body simulator</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r73/three.min.js"></script>
- <script src="lib/OrbitControls.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/stats.js/r14/Stats.min.js"></script>
</head>
<body>
<div id="gui"></div>
diff --git a/main.js b/main.js
index e14ca6b..0d0a063 100644
--- a/main.js
+++ b/main.js
@@ -1,3 +1,8 @@
+let THREE = require("three.js");
+let OrbitControls = require("three-orbit-controls")(THREE);
+let d3 = require("d3");
+let Stats = require("stats.js");
+
let scene, camera, light, renderer;
let controls, stats;
let requestId = undefined;
@@ -12,7 +17,6 @@ let sphereP = 12;
let sunOn;
let timer;
-var steps;
let system, bodies, spheres;
let menuList = [
@@ -23,7 +27,7 @@ let menuList = [
{"label": "Solar System", "function": systems.genSolarSystem, "args": [true]},
{"label": "Random Bodies", "function": systems.genBodies, "args": [200, true, false]},
{"label": "Angular Momentum", "function": systems.genBodiesRot, "args": [200, "solar", true, false]},
- {"label": "Angular with Bounce", "function": systems.genBodiesRot, "args": [200,"balls", true, true, true]},
+ {"label": "Angular with Bounce", "function": systems.genBodiesRot, "args": [200, "balls", true, true, true]},
{"label": "Choreographies", "function": showSubmenu, "args": []}
];
@@ -218,7 +222,7 @@ function init() {
scene.add(camera);
// orbitcontrols
- controls = new THREE.OrbitControls(camera);
+ controls = new OrbitControls(camera);
// texture loader
let loader = new THREE.TextureLoader();
diff --git a/package.json b/package.json
index a5a3fa7..e14cc05 100644
--- a/package.json
+++ b/package.json
@@ -3,10 +3,10 @@
"version": "0.0.0",
"description": "Simulation of the solar system",
"scripts": {
- "start": "webpack-dev-server",
- "prepublish": "webpack",
- "prestart": "webpack",
- "test": "echo \"Error: no test specified\" && exit 1"
+ "start": "webpack-dev-server",
+ "prepublish": "webpack",
+ "prestart": "webpack",
+ "test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
@@ -27,5 +27,11 @@
"babel-loader": "^5.3.2",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
+ },
+ "dependencies": {
+ "three.js": "^0.73.0",
+ "d3": "^3.5.6",
+ "three-orbit-controls": "^72.0.0",
+ "stats.js": "0.0.14-master"
}
}
diff --git a/systems.js b/systems.js
index faa0403..ef71820 100644
--- a/systems.js
+++ b/systems.js
@@ -1,6 +1,8 @@
-import * as calc from "./calc.js";
+let THREE = require("three.js");
let Vec3 = THREE.Vector3;
+import * as calc from "./calc.js";
+
let textureSets = {
solar: ["sun", "mercury", "venus", "earth", "moon", "mars", "jupiter",
"saturn", "uranus", "neptune", "pluto"],