summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorPasi Keränen <pasi.keranen@digia.com>2015-09-07 09:49:20 +0300
committerPasi Keränen <pasi.keranen@digia.com>2015-09-07 08:46:45 +0000
commitdb15889c5f993fd770ec0b396cdcb48103c345d0 (patch)
tree66e21c76b3a7d688915d052f34dbde156a9fa0a2 /examples
parent7bc1f2f08300b9cf3556c4b1cc3157bc48120450 (diff)
Minor clarifications to the method names and comments.
Tried to clarify some method names and comments. Change-Id: If94bd7ccddc0f43cb91d6cae99b09ef37dbdbc61 Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/canvas3d/canvas3d/threejs/planets/planets.js29
-rw-r--r--examples/canvas3d/canvas3d/threejs/planets/planets.qml4
2 files changed, 17 insertions, 16 deletions
diff --git a/examples/canvas3d/canvas3d/threejs/planets/planets.js b/examples/canvas3d/canvas3d/threejs/planets/planets.js
index 536b0e2..67cd339 100644
--- a/examples/canvas3d/canvas3d/threejs/planets/planets.js
+++ b/examples/canvas3d/canvas3d/threejs/planets/planets.js
@@ -128,14 +128,14 @@ function initializeGL(canvas, eventSource, mainView) {
function loadPlanetData() {
// Planet Data
- // radius - planet radius
+ // radius - planet radius in millions of meters
// tilt - planet axis angle
- // N1/2 - longitude of the ascending node
- // i1/2 - inclination to the ecliptic (plane of the Earth's orbit)
- // w1/2 - argument of perihelion
- // a1/2 - semi-major axis, or mean distance from Sun
- // e1/2 - eccentricity (0=circle, 0-1=ellipse, 1=parabola)
- // M1/2 - mean anomaly (0 at perihelion; increases uniformly with time)
+ // N1 N2 - longitude of the ascending node
+ // i1 i2 - inclination to the ecliptic (plane of the Earth's orbit)
+ // w1 w2 - argument of perihelion
+ // a1 a2 - semi-major axis, or mean distance from Sun
+ // e1 e2 - eccentricity (0=circle, 0-1=ellipse, 1=parabola)
+ // M1 M2 - mean anomaly (0 at perihelion; increases uniformly with time)
// period - sidereal rotation period
// centerOfOrbit - the planet in the center of the orbit
// (orbital elements based on http://www.stjarnhimlen.se/comp/ppcomp.html)
@@ -308,12 +308,12 @@ function createSun(radius) {
return mesh;
}
-function createPlanet(radius, scale, mapTexture, bumpTexture, specularTexture) {
+function createPlanet(radius, bumpMapScale, mapTexture, bumpTexture, specularTexture) {
var material = new THREE.MeshPhongMaterial({
map: THREE.ImageUtils.loadTexture(mapTexture),
bumpMap: THREE.ImageUtils.loadTexture(bumpTexture),
- bumpScale: scale
+ bumpScale: bumpMapScale
});
if (specularTexture) {
@@ -431,11 +431,11 @@ function setScale(value, focused) {
}
-function setOldPlanet() {
+function prepareFocusedPlanetAnimation() {
oldCameraPosition = camera.position.clone();
- var planet = 0;
+ var planet = SUN;
if (qmlView.oldPlanet !== SOLAR_SYSTEM)
planet = qmlView.oldPlanet;
oldFocusedPlanetPosition = objects[planet].position.clone();
@@ -452,6 +452,9 @@ function setOldPlanet() {
setScale(actualScale);
}
+ calculateLookAtOffset();
+ calculateCameraOffset();
+
}
function setCameraDistance(distance) {
@@ -460,7 +463,7 @@ function setCameraDistance(distance) {
}
-function setLookAtOffset() {
+function calculateLookAtOffset() {
var offset = oldFocusedPlanetPosition.clone();
@@ -477,7 +480,7 @@ function setLookAtOffset() {
}
-function setCameraOffset() {
+function calculateCameraOffset() {
var offset = oldCameraPosition.clone();
diff --git a/examples/canvas3d/canvas3d/threejs/planets/planets.qml b/examples/canvas3d/canvas3d/threejs/planets/planets.qml
index 4e07bb0..e5c1578 100644
--- a/examples/canvas3d/canvas3d/threejs/planets/planets.qml
+++ b/examples/canvas3d/canvas3d/threejs/planets/planets.qml
@@ -92,9 +92,7 @@ Rectangle {
info.opacity = 0.5;
}
- GLCode.setOldPlanet();
- GLCode.setLookAtOffset();
- GLCode.setCameraOffset();
+ GLCode.prepareFocusedPlanetAnimation();
lookAtOffsetAnimation.restart();
cameraOffsetAnimation.restart();