Package gaiasky.scenegraph
Class Spacecraft
- java.lang.Object
-
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,IObserver
,I3DTextRenderable
,ILineRenderable
,IModelRenderable
,IQuadRenderable
,IRenderable
,IFocus
,IStarContainer
,IPosition
public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IObserver
The spacecraft.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gaiasky.scenegraph.SceneGraphNode
SceneGraphNode.RenderGroup, SceneGraphNode.TLV3, SceneGraphNode.TLV3D
-
-
Field Summary
Fields Modifier and Type Field Description Vector3d
accel
Force, acceleration and velocityVector3d
direction
Direction and up vectorscom.badlogic.gdx.math.Vector3
directionf
Float counterpartsPair<Vector3d,Vector3d>
dirup
double
enginePower
Instantaneous engine power, this is in [0..1]Vector3d
force
Force, acceleration and velocitydouble
fullPowerTime
Seconds to reach full powerboolean
leveling
double
mass
Mass in kgdouble
pitch
double
pitcha
double
pitchf
double
pitchp
Yaw, pitch and rolldouble
pitchv
com.badlogic.gdx.math.Vector3
posf
Float counterpartsdouble
roll
double
rolla
double
rollf
double
rollp
Yaw, pitch and rolldouble
rollv
com.badlogic.gdx.math.Matrix4
rotationMatrix
Only the rotation matrixdouble
sizeFactor
Factor hackboolean
stopping
Vector3d
thrust
Engine thrust vectorstatic double[]
thrustFactor
Factor (adapt to be able to navigate small and large scale structuresint
thrustFactorIndex
Index of the current engine power settingstatic double
thrustLength
This is the powerVector3d
up
Direction and up vectorscom.badlogic.gdx.math.Vector3
upf
Float counterpartsVector3d
vel
Force, acceleration and velocitydouble
yaw
double
yawa
double
yawf
double
yawp
Yaw, pitch and rolldouble
yawv
-
Fields inherited from class gaiasky.scenegraph.GenericSpacecraft
renderQuad
-
Fields inherited from class gaiasky.scenegraph.Satellite
hidden, orientationf, parentOrientation, parentrc, TH_ANGLE_NONE, TH_ANGLE_POINT, TH_ANGLE_QUAD
-
Fields inherited from class gaiasky.scenegraph.ModelBody
fadeOpacity, inverseRefPlaneTransform, locThOverFactor, locVaMultiplier, mc, refPlane, refPlaneTransform, shadow, shadowMapValues, sizeScaleFactor, transformations, wikiname
-
Fields inherited from class gaiasky.scenegraph.CelestialBody
absmag, appmag, ccPale, ccTransit, colorbv, compalpha, coordinatesTimeOverflow, lastTransitIncrease, rc, TH_OVER_FACTOR, transits
-
Fields inherited from class gaiasky.scenegraph.AbstractPositionEntity
cc, coordinates, copy, distToCamera, octant, octantId, pos, posSph, size, viewAngle, viewAngleApparent
-
Fields inherited from class gaiasky.scenegraph.SceneGraphNode
aux3d1, aux3d2, aux3d3, aux3d4, aux3f1, aux3f2, aux3f3, aux3f4, children, computed, ct, id, localTransform, namekey, names, numChildren, opacity, orientation, parent, parentkey, parentName, ROOT_NAME, sg, translation
-
-
Constructor Summary
Constructors Constructor Description Spacecraft()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addToRenderLists(ICamera camera)
Adds this entity to the necessary render lists after the distance to the camera and the view angle have been determined.double
computeDirectionUp(double dt, Pair<Vector3d,Vector3d> pair)
Vector3d
computePosition(double dt, IFocus closest, double enginePower, Vector3d thrust, Vector3d direction, Vector3d force, Vector3d accel, Vector3d vel, Vector3d pos)
void
decreaseThrustFactorIndex(boolean broadcast)
void
dispose()
void
doneLoading(com.badlogic.gdx.assets.AssetManager manager)
double
getDistToCamera()
Returns the current distance to the camera in internal units.int
getGlPrimitive()
float
getLineWidth()
double
getRadius()
Returns the radius in internal unitscom.badlogic.gdx.math.Quaternion
getRotationQuaternion()
<T extends SceneGraphNode>
TgetSimpleCopy()
Gets a copy of this object but does not copy its parent or childrendouble
getSize()
Returns the size (diameter) of this entity in internal units.boolean
hasAtmosphere()
void
increaseThrustFactorIndex(boolean broadcast)
boolean
isStabilising()
boolean
isStopping()
protected float
labelFactor()
protected boolean
mustUpdatePosition(ITimeFrameProvider time)
Whether position must be recomputed for this entity.void
notify(Events event, java.lang.Object... data)
void
render(LineRenderSystem renderer, ICamera camera, float alpha)
void
render(IntModelBatch modelBatch, float alpha, double t, boolean shadowEnv)
Model opaque rendering for light glow pass.void
render(IntModelBatch modelBatch, float alpha, double t, RenderingContext rc)
Model rendering.void
setEnginePower(double enginePower)
Sets the current engine powervoid
setMass(java.lang.Double mass)
void
setModel(ModelComponent mc)
void
setPitchPower(double pitchp)
Sets the current pitch powervoid
setRollPower(double rollp)
Sets the current roll powervoid
setSize(java.lang.Double size)
Sets the absolute size of this entityvoid
setSize(java.lang.Long size)
Sets the absolute size (diameter) of this entityvoid
setThrustFactorIndex(int i, boolean broadcast)
void
setYawPower(double yawp)
Sets the current yaw powervoid
stopAllMovement()
void
updateLocal(ITimeFrameProvider time, ICamera camera)
Updates the local transform matrix.protected void
updateLocalTransform()
Update the local transform with the transform and the rotations/scales necessary.void
updateLocalValues(ITimeFrameProvider time, ICamera camera)
This function updates all the local values before the localTransform is updated.-
Methods inherited from class gaiasky.scenegraph.GenericSpacecraft
setRenderquad, setRenderquad
-
Methods inherited from class gaiasky.scenegraph.Satellite
forceUpdatePosition, getFuzzyRenderSize, getRotationComponent, getThOverFactorScl, getViewAnglePow, initialize, labelMax, renderText, setHidden, setParentorientation, setToLocalTransform, THRESHOLD_NONE, THRESHOLD_POINT, THRESHOLD_QUAD
-
Methods inherited from class gaiasky.scenegraph.ModelBody
addHit, addHit, getHeight, getHeight, getHeight, getHeightScale, getInnerRad, getPositionAboveSurface, getThOverFactor, getWikiname, isShadow, labelSizeConcrete, prepareShadowEnvironment, render, renderTessellated, setLocthoverfactor, setLocvamultiplier, setRefplane, setShadowvalues, setSizescalefactor, setToLocalTransform, setTransformations, setWikiname, textScale, withinMagLimit
-
Methods inherited from class gaiasky.scenegraph.CelestialBody
addFocusableObjects, checkClickDistance, checkHitCondition, computeViewAngle, getAbsmag, getAppmag, getCandidateId, getCandidateName, getCandidateViewAngleApparent, getClosestAbsolutePos, getClosestDistToCamera, getClosestName, getFocus, getOrientationQuaternion, getPmX, getPmY, getPmZ, getTextOpacity, getViewAngle, isActive, isCoordinatesTimeOverflow, isLabel, isStar, isValidPosition, makeFocus, render, setAbsmag, setAltname, setAppmag, setColor2Data, setMag, setRotation, text, textColour, textDepthBuffer, textPosition, textSize, timeCondition, update, updateTransitNumber
-
Methods inherited from class gaiasky.scenegraph.AbstractPositionEntity
computeFuturePosition, getAbsoluteOrientation, getAbsolutePosition, getAbsolutePosition, getAlpha, getDelta, getNext, getOctant, getPos, getPosition, getPosition, getPosSph, getPredictedPosition, getViewAngleApparent, isCopy, render2DLabel, render2DLabel, render2DLabel, render2DLabel, render3DLabel, setColor, setColor, setCoordinates, setLabelcolor, setLabelcolor
-
Methods inherited from class gaiasky.scenegraph.SceneGraphNode
add, add, addChild, addChild, addName, addNodes, addToIndex, addToRender, getAggregatedChildren, getChildByName, getChildByNameAndType, getChildrenByType, getComponentType, getCt, getFirstStarAncestor, getId, getLineCopy, getName, getNames, getNode, getNode, getOpacity, getOrientation, getRoot, getSceneGraphDepth, getStarCount, getVelocity, hasName, hasName, insert, insert, isInRender, isInRender, isVisibilityOn, mustAddToIndex, namesConcat, removeChild, removeFromIndex, removeFromRender, returnToPool, setComputedFlag, setCt, setCt, setId, setName, setNamekey, setNames, setParent, setParentkey, setUp, toString, update, updateNames, updateNamesRec
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gaiasky.scenegraph.IFocus
getAbsolutePosition, getAbsolutePosition, getAlpha, getCt, getDelta, getFirstStarAncestor, getId, getName, getNames, getNext, getOctant, getOrientation, getPos, getPosSph, getPredictedPosition, getSceneGraphDepth, getViewAngleApparent, hasName, hasName, isCopy
-
Methods inherited from interface gaiasky.render.IRenderable
getComponentType, getOpacity
-
-
-
-
Field Detail
-
thrustLength
public static final double thrustLength
This is the power- See Also:
- Constant Field Values
-
thrustFactor
public static final double[] thrustFactor
Factor (adapt to be able to navigate small and large scale structures
-
fullPowerTime
public double fullPowerTime
Seconds to reach full power
-
force
public Vector3d force
Force, acceleration and velocity
-
accel
public Vector3d accel
Force, acceleration and velocity
-
vel
public Vector3d vel
Force, acceleration and velocity
-
direction
public Vector3d direction
Direction and up vectors
-
up
public Vector3d up
Direction and up vectors
-
posf
public com.badlogic.gdx.math.Vector3 posf
Float counterparts
-
directionf
public com.badlogic.gdx.math.Vector3 directionf
Float counterparts
-
upf
public com.badlogic.gdx.math.Vector3 upf
Float counterparts
-
thrust
public Vector3d thrust
Engine thrust vector
-
mass
public double mass
Mass in kg
-
sizeFactor
public double sizeFactor
Factor hack
-
rotationMatrix
public com.badlogic.gdx.math.Matrix4 rotationMatrix
Only the rotation matrix
-
thrustFactorIndex
public int thrustFactorIndex
Index of the current engine power setting
-
enginePower
public double enginePower
Instantaneous engine power, this is in [0..1]
-
yawp
public double yawp
Yaw, pitch and roll
-
pitchp
public double pitchp
Yaw, pitch and roll
-
rollp
public double rollp
Yaw, pitch and roll
-
yawf
public double yawf
-
pitchf
public double pitchf
-
rollf
public double rollf
-
yawa
public double yawa
-
pitcha
public double pitcha
-
rolla
public double rolla
-
yawv
public double yawv
-
pitchv
public double pitchv
-
rollv
public double rollv
-
yaw
public double yaw
-
pitch
public double pitch
-
roll
public double roll
-
leveling
public boolean leveling
-
stopping
public boolean stopping
-
-
Method Detail
-
doneLoading
public void doneLoading(com.badlogic.gdx.assets.AssetManager manager)
- Overrides:
doneLoading
in classSatellite
-
notify
public void notify(Events event, java.lang.Object... data)
-
updateLocal
public void updateLocal(ITimeFrameProvider time, ICamera camera)
Description copied from class:AbstractPositionEntity
Updates the local transform matrix.- Overrides:
updateLocal
in classModelBody
-
updateLocalTransform
protected void updateLocalTransform()
Description copied from class:ModelBody
Update the local transform with the transform and the rotations/scales necessary. Override if your model contains more than just the position and size.- Overrides:
updateLocalTransform
in classSatellite
-
computePosition
public Vector3d computePosition(double dt, IFocus closest, double enginePower, Vector3d thrust, Vector3d direction, Vector3d force, Vector3d accel, Vector3d vel, Vector3d pos)
-
updateLocalValues
public void updateLocalValues(ITimeFrameProvider time, ICamera camera)
Description copied from class:AbstractPositionEntity
This function updates all the local values before the localTransform is updated. Position, rotations and scale must be updated in here.- Overrides:
updateLocalValues
in classSatellite
-
stopAllMovement
public void stopAllMovement()
-
setEnginePower
public void setEnginePower(double enginePower)
Sets the current engine power- Parameters:
enginePower
- The power in [-1..1]
-
setYawPower
public void setYawPower(double yawp)
Sets the current yaw power- Parameters:
yawp
- The yaw power in [-1..1]
-
setPitchPower
public void setPitchPower(double pitchp)
Sets the current pitch power- Parameters:
pitchp
- The pitch power in [-1..1]
-
setRollPower
public void setRollPower(double rollp)
Sets the current roll power- Parameters:
rollp
- The roll power in [-1..1]
-
increaseThrustFactorIndex
public void increaseThrustFactorIndex(boolean broadcast)
-
decreaseThrustFactorIndex
public void decreaseThrustFactorIndex(boolean broadcast)
-
setThrustFactorIndex
public void setThrustFactorIndex(int i, boolean broadcast)
-
addToRenderLists
protected void addToRenderLists(ICamera camera)
Adds this entity to the necessary render lists after the distance to the camera and the view angle have been determined.- Overrides:
addToRenderLists
in classGenericSpacecraft
-
setModel
public void setModel(ModelComponent mc)
-
setSize
public void setSize(java.lang.Double size)
Sets the absolute size of this entity
-
setSize
public void setSize(java.lang.Long size)
Description copied from class:AbstractPositionEntity
Sets the absolute size (diameter) of this entity
-
getRadius
public double getRadius()
Description copied from class:AbstractPositionEntity
Returns the radius in internal units
-
getSize
public double getSize()
Description copied from class:AbstractPositionEntity
Returns the size (diameter) of this entity in internal units.
-
setMass
public void setMass(java.lang.Double mass)
-
isStopping
public boolean isStopping()
-
isStabilising
public boolean isStabilising()
-
getDistToCamera
public double getDistToCamera()
Description copied from class:AbstractPositionEntity
Returns the current distance to the camera in internal units.- Specified by:
getDistToCamera
in interfaceIFocus
- Specified by:
getDistToCamera
in interfaceIRenderable
- Overrides:
getDistToCamera
in classAbstractPositionEntity
- Returns:
- The current distance to the camera, in internal units.
-
getRotationQuaternion
public com.badlogic.gdx.math.Quaternion getRotationQuaternion()
-
hasAtmosphere
public boolean hasAtmosphere()
- Specified by:
hasAtmosphere
in interfaceIModelRenderable
- Overrides:
hasAtmosphere
in classCelestialBody
-
dispose
public void dispose()
-
render
public void render(IntModelBatch modelBatch, float alpha, double t, RenderingContext rc)
Model rendering. SPACECRAFT_MODE in spacecraft mode is not affected by the relativistic aberration- Specified by:
render
in interfaceIModelRenderable
- Overrides:
render
in classModelBody
-
render
public void render(IntModelBatch modelBatch, float alpha, double t, boolean shadowEnv)
Model opaque rendering for light glow pass. Do not render shadows
-
render
public void render(LineRenderSystem renderer, ICamera camera, float alpha)
- Specified by:
render
in interfaceILineRenderable
-
getSimpleCopy
public <T extends SceneGraphNode> T getSimpleCopy()
Description copied from class:AbstractPositionEntity
Gets a copy of this object but does not copy its parent or children- Overrides:
getSimpleCopy
in classCelestialBody
- Returns:
- The copied object
-
labelFactor
protected float labelFactor()
- Overrides:
labelFactor
in classSatellite
-
mustUpdatePosition
protected boolean mustUpdatePosition(ITimeFrameProvider time)
Description copied from class:AbstractPositionEntity
Whether position must be recomputed for this entity. By default, only when time is on- Overrides:
mustUpdatePosition
in classAbstractPositionEntity
- Parameters:
time
- The current time- Returns:
- True if position should be recomputed for this entity
-
getLineWidth
public float getLineWidth()
- Specified by:
getLineWidth
in interfaceILineRenderable
-
getGlPrimitive
public int getGlPrimitive()
- Specified by:
getGlPrimitive
in interfaceILineRenderable
-
-