Package gaiasky.scenegraph
Class Spacecraft
java.lang.Object
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,IObserver,I3DTextRenderable,ILineRenderable,IModelRenderable,IQuadRenderable,IRenderable,IFocus,IStarContainer,IVisibilitySwitch,IPosition
public class Spacecraft extends GenericSpacecraft implements ILineRenderable, IObserver
The spacecraft
-
Field Summary
Fields Modifier and Type Field Description Vector3daccelForce, acceleration and velocityVector3ddirectionDirection and up vectorscom.badlogic.gdx.math.Vector3directionfFloat counterpartsPair<Vector3d,Vector3d>dirupdoubleenginePowerInstantaneous engine power, this is in [0..1]Vector3dforceForce, acceleration and velocitydoublefullPowerTimeSeconds to reach full powerbooleanlevelingdoublemassMass in kgdoublepitchdoublepitchadoublepitchfdoublepitchpYaw, pitch and rolldoublepitchvcom.badlogic.gdx.math.Vector3posfFloat counterpartsdoublerolldoublerolladoublerollfdoublerollpYaw, pitch and rolldoublerollvcom.badlogic.gdx.math.Matrix4rotationMatrixOnly the rotation matrixbooleanstoppingVector3dthrustEngine thrust vectorstatic double[]thrustFactorFactor (adapt to be able to navigate small and large scale structuresintthrustFactorIndexIndex of the current engine power settingstatic doublethrustLengthThis is the powerVector3dupDirection and up vectorscom.badlogic.gdx.math.Vector3upfFloat counterpartsVector3dvelForce, acceleration and velocitydoubleyawdoubleyawadoubleyawfdoubleyawpYaw, pitch and rolldoubleyawvFields inherited from class gaiasky.scenegraph.GenericSpacecraft
renderQuadFields inherited from class gaiasky.scenegraph.Satellite
hidden, orientationf, parentOrientation, parentrc, TH_ANGLE_NONE, TH_ANGLE_POINT, TH_ANGLE_QUADFields inherited from class gaiasky.scenegraph.ModelBody
fadeOpacity, inverseRefPlaneTransform, locThOverFactor, locVaMultiplier, mc, refPlane, refPlaneTransform, shadow, shadowMapValues, sizeScaleFactor, transformationsFields inherited from class gaiasky.scenegraph.CelestialBody
absmag, appmag, ccPale, ccTransit, colorbv, compalpha, coordinatesTimeOverflow, rc, TH_OVER_FACTOR, wikinameFields inherited from class gaiasky.scenegraph.SceneGraphNode
aux3b1, aux3b2, aux3b3, aux3b4, aux3d1, aux3d2, aux3d3, aux3d4, aux3f1, aux3f2, aux3f3, aux3f4, cc, children, computed, coordinates, copy, ct, distToCamera, id, lastStateChangeTimeMs, localTransform, namekey, names, numChildren, octant, octantId, opacity, orientation, parent, parentkey, parentName, pos, posSph, ROOT_NAME, sg, size, translation, viewAngle, viewAngleApparent, visible -
Constructor Summary
Constructors Constructor Description Spacecraft() -
Method Summary
Modifier and Type Method Description protected voidaddToRenderLists(ICamera camera)Adds this entity to the necessary render lists after the distance to the camera and the view angle have been determined.doublecomputeDirectionUp(double dt, Pair<Vector3d,Vector3d> pair)Vector3bcomputePosition(double dt, IFocus closest, double enginePower, Vector3d thrust, Vector3d direction, Vector3d force, Vector3d accel, Vector3d vel, Vector3b posb)voiddecreaseThrustFactorIndex(boolean broadcast)voiddispose()voiddoneLoading(com.badlogic.gdx.assets.AssetManager manager)doublegetDistToCamera()Returns the current distance to the camera in internal units.intgetGlPrimitive()floatgetLineWidth()com.badlogic.gdx.math.QuaterniongetRotationQuaternion()<T extends SceneGraphNode>
TgetSimpleCopy()Gets a copy of this object but does not copy its parent or childrenbooleanhasAtmosphere()voidincreaseThrustFactorIndex(boolean broadcast)booleanisStabilising()booleanisStopping()protected floatlabelFactor()protected booleanmustUpdatePosition(ITimeFrameProvider time)Whether position must be recomputed for this entity.voidnotify(Events event, java.lang.Object... data)voidrender(LineRenderSystem renderer, ICamera camera, float alpha)voidrender(IntModelBatch modelBatch, float alpha, double t, boolean shadowEnv)Model opaque rendering for light glow pass.voidrender(IntModelBatch modelBatch, float alpha, double t, RenderingContext rc)Model rendering.voidsetEnginePower(double enginePower)Sets the current engine powervoidsetMass(java.lang.Double mass)voidsetModel(ModelComponent mc)voidsetPitchPower(double pitchp)Sets the current pitch powervoidsetRollPower(double rollp)Sets the current roll powervoidsetSize(java.lang.Double size)Sets the absolute size of this entityvoidsetSize(java.lang.Long size)Sets the absolute size (diameter) of this entityvoidsetThrustFactorIndex(int i, boolean broadcast)voidsetYawPower(double yawp)Sets the current yaw powervoidstopAllMovement()voidupdateLocal(ITimeFrameProvider time, ICamera camera)Updates the transform matrix with the transformations that will apply to the children and the local transform matrix with the transformations that will apply only to this object.protected voidupdateLocalTransform()Update the local transform with the transform and the rotations/scales necessary.voidupdateLocalValues(ITimeFrameProvider time, ICamera camera)This function updates all the local values before the localTransform is updated.Methods inherited from class gaiasky.scenegraph.GenericSpacecraft
setRenderquad, setRenderquadMethods inherited from class gaiasky.scenegraph.Satellite
forceUpdatePosition, getFuzzyRenderSize, getRotationComponent, getThOverFactorScl, getViewAnglePow, initialize, labelMax, renderText, setHidden, setParentorientation, setToLocalTransform, THRESHOLD_NONE, THRESHOLD_POINT, THRESHOLD_QUADMethods inherited from class gaiasky.scenegraph.ModelBody
addHit, addHit, getHeight, getHeight, getHeight, getHeightScale, getInnerRad, getPositionAboveSurface, getRadius, getSize, getThOverFactor, isShadow, labelSizeConcrete, prepareShadowEnvironment, render, renderTessellated, setLocthoverfactor, setLocvamultiplier, setRefplane, setShadowvalues, setSizescalefactor, setToLocalTransform, setTransformations, textScaleMethods 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, getWikiname, isActive, isCoordinatesTimeOverflow, isLabel, isStar, isValidPosition, makeFocus, render, setAbsmag, setAltname, setAppmag, setColor2Data, setColorbv, setMag, setRotation, setWikiname, text, textColour, textDepthBuffer, textPosition, textSizeMethods inherited from class gaiasky.scenegraph.SceneGraphNode
add, add, addChild, addChild, addName, addNodes, addToIndex, addToRender, computeFuturePosition, getAbsoluteOrientation, getAbsolutePosition, getAbsolutePosition, getAggregatedChildren, getAlpha, getChildByName, getChildByNameAndType, getChildrenByComponentType, getChildrenByType, getColor, getComponentType, getCt, getDelta, getDescription, getFirstStarAncestor, getId, getLineCopy, getName, getNames, getNext, getNode, getNode, getOctant, getOpacity, getOrientation, getPos, getPosition, getPosition, getPosSph, getPredictedPosition, getRoot, getSceneGraphDepth, getStarCount, getUnrotatedPos, getVelocity, getViewAngleApparent, getVisibilityOpacityFactor, hasCt, hasName, hasName, insert, insert, isCopy, isInRender, isInRender, isVisibilityOn, isVisible, isVisible, isVisibleGroup, msSinceStateChange, mustAddToIndex, namesConcat, removeChild, removeFromIndex, removeFromRender, render2DLabel, render2DLabel, render2DLabel, render2DLabel, render3DLabel, render3DLabel, returnToPool, setColor, setColor, setComputedFlag, setCoordinates, setCt, setCt, setDescription, setId, setLabelcolor, setLabelcolor, setName, setNamekey, setNames, setParent, setParentkey, setUp, setVisible, setVisibleGroup, shouldRender, toString, update, update, updateNames, updateNamesRecMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gaiasky.scenegraph.IFocus
getAbsolutePosition, getAbsolutePosition, getAlpha, getColor, getCt, getDelta, getFirstStarAncestor, getId, getName, getNames, getNext, getOctant, getOrientation, getPos, getPosSph, getPredictedPosition, getSceneGraphDepth, getViewAngleApparent, hasName, hasName, isCopyMethods inherited from interface gaiasky.render.IRenderable
getComponentType, getOpacity
-
Field Details
-
thrustLength
public static final double thrustLengthThis is the power- See Also:
- Constant Field Values
-
thrustFactor
public static final double[] thrustFactorFactor (adapt to be able to navigate small and large scale structures -
fullPowerTime
public double fullPowerTimeSeconds to reach full power -
force
Force, acceleration and velocity -
accel
Force, acceleration and velocity -
vel
Force, acceleration and velocity -
direction
Direction and up vectors -
up
Direction and up vectors -
dirup
-
posf
public com.badlogic.gdx.math.Vector3 posfFloat counterparts -
directionf
public com.badlogic.gdx.math.Vector3 directionfFloat counterparts -
upf
public com.badlogic.gdx.math.Vector3 upfFloat counterparts -
thrust
Engine thrust vector -
mass
public double massMass in kg -
rotationMatrix
public com.badlogic.gdx.math.Matrix4 rotationMatrixOnly the rotation matrix -
thrustFactorIndex
public int thrustFactorIndexIndex of the current engine power setting -
enginePower
public double enginePowerInstantaneous engine power, this is in [0..1] -
yawp
public double yawpYaw, pitch and roll -
pitchp
public double pitchpYaw, pitch and roll -
rollp
public double rollpYaw, 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
-
-
Constructor Details
-
Spacecraft
public Spacecraft()
-
-
Method Details
-
doneLoading
public void doneLoading(com.badlogic.gdx.assets.AssetManager manager)- Overrides:
doneLoadingin classSatellite
-
notify
-
updateLocal
Description copied from class:SceneGraphNodeUpdates the transform matrix with the transformations that will apply to the children and the local transform matrix with the transformations that will apply only to this object.- Overrides:
updateLocalin classModelBody
-
updateLocalTransform
protected void updateLocalTransform()Description copied from class:ModelBodyUpdate the local transform with the transform and the rotations/scales necessary. Override if your model contains more than just the position and size.- Overrides:
updateLocalTransformin classSatellite
-
computePosition
-
computeDirectionUp
-
updateLocalValues
Description copied from class:SceneGraphNodeThis function updates all the local values before the localTransform is updated. Position, rotations and scale must be updated in here.- Overrides:
updateLocalValuesin 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
Adds this entity to the necessary render lists after the distance to the camera and the view angle have been determined.- Overrides:
addToRenderListsin classGenericSpacecraft
-
setModel
-
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:SceneGraphNodeSets the absolute size (diameter) of this entity -
setMass
public void setMass(java.lang.Double mass) -
isStopping
public boolean isStopping() -
isStabilising
public boolean isStabilising() -
getDistToCamera
public double getDistToCamera()Description copied from class:SceneGraphNodeReturns the current distance to the camera in internal units.- Specified by:
getDistToCamerain interfaceIFocus- Specified by:
getDistToCamerain interfaceIRenderable- Overrides:
getDistToCamerain classSceneGraphNode- Returns:
- The current distance to the camera, in internal units.
-
getRotationQuaternion
public com.badlogic.gdx.math.Quaternion getRotationQuaternion() -
hasAtmosphere
public boolean hasAtmosphere()- Specified by:
hasAtmospherein interfaceIModelRenderable- Overrides:
hasAtmospherein classCelestialBody
-
dispose
public void dispose() -
render
Model rendering. SPACECRAFT_MODE in spacecraft mode is not affected by the relativistic aberration- Specified by:
renderin interfaceIModelRenderable- Overrides:
renderin classModelBody
-
render
Model opaque rendering for light glow pass. Do not render shadows -
render
- Specified by:
renderin interfaceILineRenderable
-
getSimpleCopy
Description copied from class:SceneGraphNodeGets a copy of this object but does not copy its parent or children- Overrides:
getSimpleCopyin classCelestialBody- Returns:
- The copied object
-
labelFactor
protected float labelFactor()- Overrides:
labelFactorin classSatellite
-
mustUpdatePosition
Description copied from class:SceneGraphNodeWhether position must be recomputed for this entity. By default, only when time is on- Overrides:
mustUpdatePositionin classSceneGraphNode- Parameters:
time- The current time- Returns:
- True if position should be recomputed for this entity
-
getLineWidth
public float getLineWidth()- Specified by:
getLineWidthin interfaceILineRenderable
-
getGlPrimitive
public int getGlPrimitive()- Specified by:
getGlPrimitivein interfaceILineRenderable
-