Commit 156b9c0e authored by langurmonkey's avatar langurmonkey

Jitter + Spacecraft

parent 00ad230e
{ "data" : [
{
"loader": gaia.cu9.ari.gaiaorbit.data.JsonLoader,
"files": [
"data/satellites2.json",
]
}
]}
{"objects" : [
{
"name" : "Spacecraft",
"color" : [0.3, 0.5, 0.9, 1.0],
// in Km
"size" : 10.0,
"ct" : Satellites,
// in Kg
"mass" : 2e5,
"parent" : "Universe",
"impl" : "gaia.cu9.ari.gaiaorbit.scenegraph.Spacecraft",
"renderquad" : False,
"model" : {
"args" : [true],
"usecolor" : False,
"model" : "data/models/usse/usse.obj",
},
"shadowvalues" : [ 270.0, 1.5, 1.5 ]
},
{
"name" : "Solar sail",
"color" : [0.3, 0.5, 0.9, 1.0],
// in Km
"size" : 0.01,
"ct" : Satellites,
"parent" : "Universe",
"impl" : "gaia.cu9.ari.gaiaorbit.scenegraph.GenericSpacecraft",
"coordinates" : {
// This must implement gaia.cu9.ari.gaiaorbit.util.coord.IBodyCoordinates
"impl" : "gaia.cu9.ari.gaiaorbit.util.coord.StaticCoordinates",
//"position" : [0.0, 0.0, -1e11],
"position" : [0.0, 0.0, 0.0],
"transformMatrix" : [-0.9292035398230076, 0.35398228778724056, 0.10619473392453657, 0.0, 0.3539823139826705, 0.7699115044247788, 0.5309734425956234, 0.0, 0.10619464660643674, 0.5309734600592433, -0.8407079646017688, 0.0, 0.0, 0.0, 0.0, 1.0]
},
"renderquad" : False,
"model": {
"args" : [true],
"usecolor" : False,
"model" : "data/models/gaia/gaia.obj"
},
"shadowvalues" : [ 240.0, 1.5, 1.5 ]
}
]}
\ No newline at end of file
...@@ -398,7 +398,7 @@ public class GaiaSky implements ApplicationListener, IObserver, IMainRenderer { ...@@ -398,7 +398,7 @@ public class GaiaSky implements ApplicationListener, IObserver, IMainRenderer {
// Set focus to Earth // Set focus to Earth
EventManager.instance.post(Events.CAMERA_MODE_CMD, CameraMode.Focus); EventManager.instance.post(Events.CAMERA_MODE_CMD, CameraMode.Focus);
EventManager.instance.post(Events.FOCUS_CHANGE_CMD, sg.getNode("Earth"), true); EventManager.instance.post(Events.FOCUS_CHANGE_CMD, sg.getNode("Solar sail"), true);
EventManager.instance.post(Events.GO_TO_OBJECT_CMD); EventManager.instance.post(Events.GO_TO_OBJECT_CMD);
initialized = true; initialized = true;
...@@ -541,7 +541,8 @@ public class GaiaSky implements ApplicationListener, IObserver, IMainRenderer { ...@@ -541,7 +541,8 @@ public class GaiaSky implements ApplicationListener, IObserver, IMainRenderer {
renderGui(loadingGui); renderGui(loadingGui);
} }
} else { } else {
//GlobalConf.scene.OCTANT_THRESHOLD_0 = (float) (1.d * MathUtilsd.degRad);
//GlobalConf.scene.OCTANT_THRESHOLD_1 = GlobalConf.scene.OCTANT_THRESHOLD_0 + 1.f * GlobalConf.scene.OCTANT_THRESHOLD_0;
// Asynchronous load of textures and resources // Asynchronous load of textures and resources
manager.update(); manager.update();
......
...@@ -193,8 +193,8 @@ public class GaiaSkyDesktop implements IObserver { ...@@ -193,8 +193,8 @@ public class GaiaSkyDesktop implements IObserver {
cfg.height = GlobalConf.screen.getScreenHeight(); cfg.height = GlobalConf.screen.getScreenHeight();
cfg.samples = 0; cfg.samples = 0;
cfg.vSyncEnabled = GlobalConf.screen.VSYNC; cfg.vSyncEnabled = GlobalConf.screen.VSYNC;
cfg.foregroundFPS = 0; cfg.foregroundFPS = 60;
cfg.backgroundFPS = 0; cfg.backgroundFPS = 30;
cfg.useHDPI = true; cfg.useHDPI = true;
cfg.addIcon("icon/ic_launcher.png", Files.FileType.Internal); cfg.addIcon("icon/ic_launcher.png", Files.FileType.Internal);
......
...@@ -148,7 +148,7 @@ public class DesktopConfInit extends ConfInit { ...@@ -148,7 +148,7 @@ public class DesktopConfInit extends ConfInit {
/** RUNTIME CONF **/ /** RUNTIME CONF **/
RuntimeConf rc = new RuntimeConf(); RuntimeConf rc = new RuntimeConf();
rc.initialize(true, false, false, false, true, false, 20, false, false); rc.initialize(true, false, false, false, true, false, 20, false, true);
/** DATA CONF **/ /** DATA CONF **/
DataConf dc = new DataConf(); DataConf dc = new DataConf();
......
...@@ -670,6 +670,13 @@ public enum Events { ...@@ -670,6 +670,13 @@ public enum Events {
/** Broadcasts the new thrust index **/ /** Broadcasts the new thrust index **/
SPACECRAFT_THRUST_INFO, SPACECRAFT_THRUST_INFO,
/** Positions spacecraft at camera **/
SPACECRAFT_POS_CAM,
/** Positons spacecraft behind camera, same dir and some vel **/
SPACECRAFT_BACK_CAM,
/** Positions spacecraft in fron to camera, opposite dir and some vel **/
SPACECRAFT_FRONT_CAM,
/** /**
* Contains following info: * Contains following info:
* <ul> * <ul>
......
...@@ -34,7 +34,7 @@ public class KeyBindings { ...@@ -34,7 +34,7 @@ public class KeyBindings {
} }
} }
public static int SPECIAL1, SPECIAL2; public static int SPECIAL1, SPECIAL2, SPECIAL3;
/** /**
* Creates a key mappings instance. * Creates a key mappings instance.
...@@ -44,6 +44,7 @@ public class KeyBindings { ...@@ -44,6 +44,7 @@ public class KeyBindings {
// Init special keys // Init special keys
SPECIAL1 = Keys.CONTROL_LEFT; SPECIAL1 = Keys.CONTROL_LEFT;
SPECIAL2 = Keys.SHIFT_LEFT; SPECIAL2 = Keys.SHIFT_LEFT;
SPECIAL3 = Keys.ALT_LEFT;
// For now this will do // For now this will do
initDefault(); initDefault();
} }
...@@ -182,6 +183,14 @@ public class KeyBindings { ...@@ -182,6 +183,14 @@ public class KeyBindings {
} }
}), SPECIAL2, Keys.H); }), SPECIAL2, Keys.H);
// SHIFT+V -> Toggle clusters
addMapping(new ProgramAction(txt("action.toggle", txt("element.clusters")), new Runnable() {
@Override
public void run() {
EventManager.instance.post(Events.TOGGLE_VISIBILITY_CMD, "element.clusters", false);
}
}), SPECIAL2, Keys.V);
// Left bracket -> divide speed // Left bracket -> divide speed
addMapping(new ProgramAction(txt("action.dividetime"), new Runnable() { addMapping(new ProgramAction(txt("action.dividetime"), new Runnable() {
@Override @Override
...@@ -417,6 +426,29 @@ public class KeyBindings { ...@@ -417,6 +426,29 @@ public class KeyBindings {
} }
}), Keys.TAB); }), Keys.TAB);
// CTRL + ALT + S -> Spacecraft at current position
addMapping(new ProgramAction("Spacecraft at current cam pos", new Runnable() {
@Override
public void run() {
EventManager.instance.post(Events.SPACECRAFT_POS_CAM);
}
}), SPECIAL1, SPECIAL3, Keys.S);
// CTRL + ALT + B -> Spacecraft at current position
addMapping(new ProgramAction("Spacecraft behind cam", new Runnable() {
@Override
public void run() {
EventManager.instance.post(Events.SPACECRAFT_BACK_CAM);
}
}), SPECIAL1, SPECIAL3, Keys.B);
// CTRL + ALT + F -> Spacecraft at current position
addMapping(new ProgramAction("Spacecraft front cam", new Runnable() {
@Override
public void run() {
EventManager.instance.post(Events.SPACECRAFT_FRONT_CAM);
}
}), SPECIAL1, SPECIAL3, Keys.F);
} }
/** /**
......
...@@ -649,8 +649,12 @@ public class SpacecraftGui extends AbstractGui { ...@@ -649,8 +649,12 @@ public class SpacecraftGui extends AbstractGui {
pitchvel.setText(nf.format(p) + "°"); pitchvel.setText(nf.format(p) + "°");
rollvel.setText(nf.format(r) + "°"); rollvel.setText(nf.format(r) + "°");
Pair<Double, String> velstr = GlobalResources.doubleToVelocityString(v); if (GlobalConf.runtime.RELATIVISTIC_ABERRATION) {
mainvel.setText(sf.format(velstr.getFirst()) + " " + velstr.getSecond()); mainvel.setText(nf.format(v * Constants.U_TO_C) + " c");
} else {
Pair<Double, String> velstr = GlobalResources.doubleToVelocityString(v);
mainvel.setText(sf.format(velstr.getFirst()) + " " + velstr.getSecond());
}
thrustfactor.setText("x" + (thf > 1000 ? sf.format(thf) : nf.format(thf))); thrustfactor.setText("x" + (thf > 1000 ? sf.format(thf) : nf.format(thf)));
......
...@@ -58,6 +58,7 @@ public abstract class AbstractCamera implements ICamera { ...@@ -58,6 +58,7 @@ public abstract class AbstractCamera implements ICamera {
* The closest star to the camera * The closest star to the camera
*/ */
protected IStarFocus closestStar; protected IStarFocus closestStar;
protected String cstarname = "";
public AbstractCamera(CameraManager parent) { public AbstractCamera(CameraManager parent) {
this.parent = parent; this.parent = parent;
...@@ -280,8 +281,9 @@ public abstract class AbstractCamera implements ICamera { ...@@ -280,8 +281,9 @@ public abstract class AbstractCamera implements ICamera {
} }
public void setClosestStar(IStarFocus star) { public void setClosestStar(IStarFocus star) {
if (closestStar == null || closestStar.getClosestDist() > star.getClosestDist()) { if (closestStar == null || cstarname.equals("Sol") || star.getCandidateName().equals("Sol")) {
closestStar = star; closestStar = star;
cstarname = "Sol";
} }
} }
......
...@@ -11,6 +11,7 @@ import com.badlogic.gdx.math.Vector3; ...@@ -11,6 +11,7 @@ import com.badlogic.gdx.math.Vector3;
import gaia.cu9.ari.gaiaorbit.render.I3DTextRenderable; import gaia.cu9.ari.gaiaorbit.render.I3DTextRenderable;
import gaia.cu9.ari.gaiaorbit.render.RenderingContext; import gaia.cu9.ari.gaiaorbit.render.RenderingContext;
import gaia.cu9.ari.gaiaorbit.render.RenderingContext.CubemapSide; import gaia.cu9.ari.gaiaorbit.render.RenderingContext.CubemapSide;
import gaia.cu9.ari.gaiaorbit.util.Constants;
import gaia.cu9.ari.gaiaorbit.util.DecalUtils; import gaia.cu9.ari.gaiaorbit.util.DecalUtils;
import gaia.cu9.ari.gaiaorbit.util.GlobalResources; import gaia.cu9.ari.gaiaorbit.util.GlobalResources;
import gaia.cu9.ari.gaiaorbit.util.Logger; import gaia.cu9.ari.gaiaorbit.util.Logger;
...@@ -211,7 +212,10 @@ public abstract class AbstractPositionEntity extends SceneGraphNode { ...@@ -211,7 +212,10 @@ public abstract class AbstractPositionEntity extends SceneGraphNode {
@Override @Override
public void updateLocal(ITimeFrameProvider time, ICamera camera) { public void updateLocal(ITimeFrameProvider time, ICamera camera) {
updateLocalValues(time, camera); updateLocalValues(time, camera);
if (this.name.equals("Solar sail")) {
pos.set(0, 0, 0.0012125);
size = (float) (10 * Constants.M_TO_U);
}
this.transform.translate(pos); this.transform.translate(pos);
Vector3d aux = aux3d1.get(); Vector3d aux = aux3d1.get();
......
...@@ -108,8 +108,9 @@ public abstract class ModelBody extends CelestialBody { ...@@ -108,8 +108,9 @@ public abstract class ModelBody extends CelestialBody {
IStarFocus sf = camera.getClosestStar(); IStarFocus sf = camera.getClosestStar();
if (sf != null) { if (sf != null) {
float[] col = sf.getClosestCol(); float[] col = sf.getClosestCol();
float brightness = (float) MathUtilsd.lint(sf.getClosestDist(), 0, 500 * Constants.PC_TO_U, 1f, 0.1f);
mc.dlight.direction.sub(sf.getClosestPos(aux3d1.get()).put(aux3f1.get())); mc.dlight.direction.sub(sf.getClosestPos(aux3d1.get()).put(aux3f1.get()));
mc.dlight.color.set(col[0], col[1], col[2], 1.0f); mc.dlight.color.set(col[0] * brightness, col[1] * brightness, col[2] * brightness, 1f);
} else { } else {
Vector3d campos = camera.getPos(); Vector3d campos = camera.getPos();
mc.dlight.direction.add((float) campos.x, (float) campos.y, (float) campos.z); mc.dlight.direction.add((float) campos.x, (float) campos.y, (float) campos.z);
......
...@@ -350,7 +350,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver { ...@@ -350,7 +350,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver {
this.pos.set(fccopy.transform.getTranslation()); this.pos.set(fccopy.transform.getTranslation());
this.pos.add(0, 0, entity1.getRadius() * 5); this.pos.add(0, 0, entity1.getRadius() * 5);
this.posinv.set(this.pos).scl(-1); //this.posinv.set(this.pos).scl(-1);
this.direction.set(0, 0, -1); this.direction.set(0, 0, -1);
this.up.set(0, 1, 0); this.up.set(0, 1, 0);
closest = entity1; closest = entity1;
...@@ -438,14 +438,16 @@ public class NaturalCamera extends AbstractCamera implements IObserver { ...@@ -438,14 +438,16 @@ public class NaturalCamera extends AbstractCamera implements IObserver {
protected void updatePerspectiveCamera() { protected void updatePerspectiveCamera() {
double closestStarDist = closestStar == null ? Double.MAX_VALUE : closestStar.getClosestDist(); double closestStarDist = closestStar == null ? Double.MAX_VALUE : closestStar.getClosestDist();
if (closest != null) { if (closest != null) {
camera.near = (float) Math.min(CAM_NEAR, Math.min(closest.distToCamera - closest.getRadius(), closestStarDist) / 3); camera.near = (float) Math.min(CAM_NEAR, Math.min(closest.distToCamera - closest.getRadius(), closestStarDist)) * 0.0002f;
camera.far = 1f;
} }
camera.position.set(0f, 0f, 0f); camera.position.set(pos.valuesf());
camera.direction.set(direction.valuesf()); camera.direction.set(direction.valuesf());
camera.up.set(up.valuesf()); camera.up.set(up.valuesf());
//camera.fieldOfView = 4.9f;
camera.update(); camera.update();
posinv.set(pos).scl(-1); //posinv.set(pos).scl(-1);
} }
...@@ -750,7 +752,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver { ...@@ -750,7 +752,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver {
lastvel.set(vel); lastvel.set(vel);
force.setZero(); force.setZero();
} }
posinv.set(pos).scl(-1); //posinv.set(pos).scl(-1);
} }
/** /**
...@@ -945,7 +947,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver { ...@@ -945,7 +947,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver {
} else { } else {
dist = distance; dist = distance;
} }
return dist > 0 ? dist * GlobalConf.scene.CAMERA_SPEED : 0; return (dist > 0 ? dist * GlobalConf.scene.CAMERA_SPEED : 0) * 0.001d;
} }
/** /**
...@@ -961,7 +963,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver { ...@@ -961,7 +963,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver {
} else { } else {
dist = distance; dist = distance;
} }
return Math.max(2000, Math.min(dist * Constants.U_TO_KM, GlobalConf.scene.ROTATION_SPEED)); return Math.max(2000, Math.min(dist * Constants.U_TO_KM, GlobalConf.scene.ROTATION_SPEED)) * 1000;
} }
@Override @Override
...@@ -1010,7 +1012,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver { ...@@ -1010,7 +1012,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver {
break; break;
case CAMERA_POS_CMD: case CAMERA_POS_CMD:
pos.set((double[]) data[0]); pos.set((double[]) data[0]);
posinv.set(pos).scl(-1d); //posinv.set(pos).scl(-1d);
break; break;
case CAMERA_DIR_CMD: case CAMERA_DIR_CMD:
direction.set((double[]) data[0]); direction.set((double[]) data[0]);
...@@ -1051,8 +1053,8 @@ public class NaturalCamera extends AbstractCamera implements IObserver { ...@@ -1051,8 +1053,8 @@ public class NaturalCamera extends AbstractCamera implements IObserver {
f.getAbsolutePosition(aux1); f.getAbsolutePosition(aux1);
pos.set(aux1); pos.set(aux1);
pos.add(0, 0, -f.getSize() * 3); pos.add(0, 0, -f.getSize() * 105);
posinv.set(pos).scl(-1); //posinv.set(pos).scl(-1);
direction.set(0, 0, 1); direction.set(0, 0, 1);
up.set(0, 1, 0); up.set(0, 1, 0);
rotate(up, 0.01); rotate(up, 0.01);
...@@ -1217,7 +1219,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver { ...@@ -1217,7 +1219,7 @@ public class NaturalCamera extends AbstractCamera implements IObserver {
pos.set(aux1); pos.set(aux1);
pos.add(0, 0, -this.focus.getSize() * 6); pos.add(0, 0, -this.focus.getSize() * 6);
posinv.set(pos).scl(-1); //posinv.set(pos).scl(-1);
direction.set(0, 0, 1); direction.set(0, 0, 1);
} }
} }
......
...@@ -117,11 +117,12 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO ...@@ -117,11 +117,12 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO
vel = new Vector3d(); vel = new Vector3d();
// orientation // orientation
pos.set(0, 0, 1);
direction = new Vector3d(1, 0, 0); direction = new Vector3d(1, 0, 0);
up = new Vector3d(0, 1, 0); up = new Vector3d(0, 1, 0);
dirup = new Pair<Vector3d, Vector3d>(direction, up); dirup = new Pair<Vector3d, Vector3d>(direction, up);
posf = new Vector3(); posf = new Vector3(0, 0, 1);
directionf = new Vector3(1, 0, 0); directionf = new Vector3(1, 0, 0);
upf = new Vector3(0, 1, 0); upf = new Vector3(0, 1, 0);
...@@ -330,7 +331,8 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO ...@@ -330,7 +331,8 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO
public void updateLocalValues(ITimeFrameProvider time, ICamera camera) { public void updateLocalValues(ITimeFrameProvider time, ICamera camera) {
if (yawv != 0 || pitchv != 0 || rollv != 0 || vel.len2() != 0 || render) { if (yawv != 0 || pitchv != 0 || rollv != 0 || vel.len2() != 0 || render) {
// We use the simulation time for the integration // We use the simulation time for the integration
double dt = time.getDt() * Constants.H_TO_S; //double dt = time.getDt() * Constants.H_TO_S;
double dt = Gdx.graphics.getDeltaTime();
// Poll keys // Poll keys
pollKeys(Gdx.graphics.getDeltaTime()); pollKeys(Gdx.graphics.getDeltaTime());
...@@ -408,7 +410,7 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO ...@@ -408,7 +410,7 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO
protected void stopAllMovement() { protected void stopAllMovement() {
setEnginePower(0); setEnginePower(0);
//vel.set(0, 0, 0); //vel.setZero();
setYawPower(0); setYawPower(0);
setPitchPower(0); setPitchPower(0);
...@@ -562,7 +564,7 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO ...@@ -562,7 +564,7 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO
ICamera cam = GaiaSky.instance.getICamera(); ICamera cam = GaiaSky.instance.getICamera();
prepareShadowEnvironment(); prepareShadowEnvironment();
mc.touch(); mc.touch();
mc.setTransparency(alpha * fadeOpacity); mc.setTransparency(alpha);
if (cam.getMode().isSpacecraft()) if (cam.getMode().isSpacecraft())
// In Spacecraft mode, we are not affected by relativistic aberration or Doppler shift // In Spacecraft mode, we are not affected by relativistic aberration or Doppler shift
mc.updateRelativisticEffects(cam, 0); mc.updateRelativisticEffects(cam, 0);
...@@ -576,7 +578,7 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO ...@@ -576,7 +578,7 @@ public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IO
public void renderOpaque(ModelBatch modelBatch, float alpha, double t) { public void renderOpaque(ModelBatch modelBatch, float alpha, double t) {
ICamera cam = GaiaSky.instance.getICamera(); ICamera cam = GaiaSky.instance.getICamera();
mc.touch(); mc.touch();
mc.setTransparency(alpha * fadeOpacity); mc.setTransparency(alpha);
if (cam.getMode().isSpacecraft()) if (cam.getMode().isSpacecraft())
// In Spacecraft mode, we are not affected by relativistic aberration or Doppler shift // In Spacecraft mode, we are not affected by relativistic aberration or Doppler shift
mc.updateRelativisticEffects(cam, 0); mc.updateRelativisticEffects(cam, 0);
......
...@@ -114,7 +114,7 @@ public class SpacecraftCamera extends AbstractCamera implements IObserver { ...@@ -114,7 +114,7 @@ public class SpacecraftCamera extends AbstractCamera implements IObserver {
chh2 = crosshairTex.getHeight() / 2f; chh2 = crosshairTex.getHeight() / 2f;
// Focus is changed from GUI // Focus is changed from GUI
EventManager.instance.subscribe(this, Events.FOV_CHANGED_CMD, Events.SPACECRAFT_LOADED); EventManager.instance.subscribe(this, Events.FOV_CHANGED_CMD, Events.SPACECRAFT_LOADED, Events.SPACECRAFT_POS_CAM, Events.SPACECRAFT_BACK_CAM, Events.SPACECRAFT_FRONT_CAM);
} }
@Override @Override
...@@ -164,6 +164,7 @@ public class SpacecraftCamera extends AbstractCamera implements IObserver { ...@@ -164,6 +164,7 @@ public class SpacecraftCamera extends AbstractCamera implements IObserver {
// We use the simulation time for the integration // We use the simulation time for the integration
double sdt = time.getDt() * Constants.H_TO_S; double sdt = time.getDt() * Constants.H_TO_S;
sdt = dt;
scthrust.set(sc.thrust); scthrust.set(sc.thrust);
scforce.set(sc.force); scforce.set(sc.force);
...@@ -216,6 +217,7 @@ public class SpacecraftCamera extends AbstractCamera implements IObserver { ...@@ -216,6 +217,7 @@ public class SpacecraftCamera extends AbstractCamera implements IObserver {
*/ */
public void updateHard(double dt, ITimeFrameProvider time) { public void updateHard(double dt, ITimeFrameProvider time) {
double sdt = time.getDt() * Constants.H_TO_S; double sdt = time.getDt() * Constants.H_TO_S;
sdt = dt;
// POSITION // POSITION
double tgfac = targetDistance * sc.sizeFactor / fovFactor; double tgfac = targetDistance * sc.sizeFactor / fovFactor;
...@@ -326,6 +328,31 @@ public class SpacecraftCamera extends AbstractCamera implements IObserver { ...@@ -326,6 +328,31 @@ public class SpacecraftCamera extends AbstractCamera implements IObserver {
this.targetDistance = sc.size * 3.5; this.targetDistance = sc.size * 3.5;
this.relpos.set(targetDistance, targetDistance / 2, 0); this.relpos.set(targetDistance, targetDistance / 2, 0);
break; break;
case SPACECRAFT_POS_CAM:
Gdx.app.postRunnable(() -> {
ICamera cam = GaiaSky.instance.getICamera();
firstTime = false;
sc.pos.set(cam.getPos());
sc.direction.set(cam.getDirection());
sc.up.set(cam.getUp());
sc.stopAllMovement();
sc.vel.setZero();
});
break;
case SPACECRAFT_BACK_CAM:
Gdx.app.postRunnable(() -> {
ICamera cam = GaiaSky.instance.getICamera();
firstTime = false;
Vector3d offset = aux1.set(cam.getDirection()).nor().scl(-10 * sc.getRadius());
sc.pos.set(cam.getPos()).add(offset);
sc.direction.set(cam.getDirection());
sc.up.set(cam.getUp());
sc.vel.set(cam.getDirection()).nor().scl(18 * Constants.KM_TO_U);
});
break;
case SPACECRAFT_FRONT_CAM:
firstTime = false;
break;
default: default:
break; break;
} }
......
...@@ -238,6 +238,7 @@ public class ModelComponent implements Disposable, IObserver { ...@@ -238,6 +238,7 @@ public class ModelComponent implements Disposable, IObserver {
} }
public void setTransparency(float alpha) { public void setTransparency(float alpha) {
alpha = 1;
if (instance != null) { if (instance != null) {
int n = instance.materials.size; int n = instance.materials.size;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
......
...@@ -90,6 +90,7 @@ public class Constants { ...@@ -90,6 +90,7 @@ public class Constants {
/** Milliseconds to year **/ /** Milliseconds to year **/
public static final double MS_TO_Y = 1 / Y_TO_MS; public static final double MS_TO_Y = 1 / Y_TO_MS;
/** /**
* Speed of light in m/s * Speed of light in m/s
*/ */
...@@ -105,6 +106,11 @@ public class Constants { ...@@ -105,6 +106,11 @@ public class Constants {
*/ */
public static final double C_US = C * M_TO_U; public static final double C_US = C * M_TO_U;
/**
* Internal units to c
*/
public static final double U_TO_C = U_TO_M / C;
/** /**
* Solar radius in Km * Solar radius in Km
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment