use of org.concord.energy3d.shapes.Heliodon in project energy3d by concord-consortium.
the class SceneManager method update.
@Override
public void update(final ReadOnlyTimer timer) {
final double tpf = timer.getTimePerFrame();
passManager.updatePasses(tpf);
taskManager.getQueue(GameTaskQueue.UPDATE).setExecuteMultiple(executeAllTask);
taskManager.getQueue(GameTaskQueue.UPDATE).execute(canvas.getCanvasRenderer().getRenderer());
if (operationFlag) {
executeOperation();
}
if (mouseState != null) {
mouseMoved();
}
if (Scene.isRedrawAll()) {
Scene.getInstance().redrawAllNow();
}
if (rotAnim && viewMode == ViewMode.NORMAL && canvas.getCanvasRenderer() != null) {
final Matrix3 rotate = new Matrix3();
rotate.fromAngleNormalAxis(45 * tpf * MathUtils.DEG_TO_RAD, Vector3.UNIT_Z);
final Camera camera = getCamera();
camera.setLocation(rotate.applyPre(camera.getLocation(), null));
camera.lookAt(0, 0, 1, Vector3.UNIT_Z);
getCameraNode().updateFromCamera();
Scene.getInstance().updateEditShapes();
}
final Heliodon heliodon = Heliodon.getInstance();
if (heliodon != null) {
if (sunAnim) {
heliodon.setHourAngle(heliodon.getHourAngle() + tpf * 0.5, true, true, false);
SceneManager.getInstance().changeSkyTexture();
SceneManager.getInstance().setShading(heliodon.isNightTime());
final boolean night = Heliodon.getInstance().isNightTime();
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof Mirror) {
final Mirror m = (Mirror) part;
if (night) {
// call this so that the light beams can be set invisible
m.drawSunBeam();
} else {
if (m.getReceiver() != null) {
m.draw();
}
}
} else if (part instanceof ParabolicTrough) {
final ParabolicTrough t = (ParabolicTrough) part;
if (night) {
// call this so that the light beams can be set invisible
t.drawSunBeam();
} else {
t.draw();
}
} else if (part instanceof ParabolicDish) {
final ParabolicDish d = (ParabolicDish) part;
if (night) {
// call this so that the light beams can be set invisible
d.drawSunBeam();
} else {
d.draw();
}
} else if (part instanceof FresnelReflector) {
final FresnelReflector f = (FresnelReflector) part;
if (night) {
// call this so that the light beams can be set invisible
f.drawSunBeam();
} else {
f.draw();
}
} else if (part instanceof SolarPanel) {
final SolarPanel sp = (SolarPanel) part;
if (!night && sp.getTracker() != Trackable.NO_TRACKER) {
sp.draw();
}
if (sp.isSunBeamVisible()) {
sp.drawSunBeam();
}
} else if (part instanceof Rack) {
final Rack rack = (Rack) part;
if (!night && rack.getTracker() != Trackable.NO_TRACKER) {
rack.draw();
}
if (rack.isSunBeamVisible()) {
rack.drawSunBeam();
}
}
}
}
heliodon.update();
}
if (cameraControl != null && cameraControl.isAnimating()) {
cameraControl.animate();
}
root.updateGeometricState(tpf);
}
Aggregations