1
0
star/solar-sys/js/animation.js
2024-04-28 20:12:17 +09:00

36 lines
1.1 KiB
JavaScript

function remain(objKey) {
if (celestialBodies[objKey].parent == null)
return true;
if ((calculateParams[celestialBodies[objKey].parent.name] && celestialBodies[objKey].parent.name != "Sun") ||
calculateParams[objKey])
return true;
return false;
}
function render() {
for (var objKey in celestialBodies) {
if (firstflag || remain(objKey)) {
celestialBodies[objKey].update(globalTime.getRelative());
if (orbitParams[objKey]) {
scene.add(orbitDraw[objKey]);
} else {
scene.remove(orbitDraw[objKey]);
}
}
}
if (firstflag) {
$(function () {
setTimeout(function () {
$("#prompt").fadeOut(500);
container.appendChild(stats.domElement);
container.appendChild(renderer.domElement);
gui.open();
}, 2000);
});
}
firstflag = false;
if (needSet) {
renderCamera.setCamera();
}
renderer.render(scene, renderCamera.camera);
}