Class ModelComponent
java.lang.Object
gaiasky.scene.record.NamedComponent
gaiasky.scene.record.ModelComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, IObserver, IUpdatable<ModelComponent>, IComponent
public final class ModelComponent
extends NamedComponent
implements com.badlogic.gdx.utils.Disposable, IObserver, IUpdatable<ModelComponent>
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanbooleanCOMPONENTSdoublebooleanFields inherited from class NamedComponent
name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddReflectionCubemapAttribute(com.badlogic.gdx.utils.Array<Material> materials) voidTurns off all directional lights.voidTurns off all point lights.voidCompletely disables the depth test.voidSets the depth test of this model to read only.voidSets the depth test of this model to read and write.com.badlogic.gdx.graphics.g3d.environment.DirectionalLightdirLight(int i) Returns the given directional light.voidvoiddispose()voiddoneLoading(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.math.Matrix4 localTransform, float[] cc) voiddoneLoading(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.math.Matrix4 localTransform, float[] cc, boolean mesh) booleanhasDirLight(int i) booleanbooleanhasPointLight(int i) voidinitialize(boolean mesh) voidinitialize(String name) voidbooleanbooleanbooleanbooleanReturns whether this model is tessellated or not.voidload(com.badlogic.gdx.math.Matrix4 localTransform) voidEvent notification call.com.badlogic.gdx.graphics.g3d.environment.PointLightpointLight(int i) Returns the given point light.voidprint(Logger.Log log) voidrandomizeAll(long seed, double size) Creates a random model component using the given seed.voidremoveReflectionCubemapAttribute(com.badlogic.gdx.utils.Array<Material> materials) voidsetAmbientColor(double[] color) voidsetAmbientColor(Double level) voidsetAmbientLevel(Double level) voidsetBlending(String blendModeString) voidsetBlendMode(BlendMode blendMode) voidsetBlendMode(String blendModeString) voidsetColorAttribute(int attrib, float[] rgba) voidsetCulling(Boolean culling) voidsetCulling(String culling) voidsetDepthTest(int func, boolean mask) voidsetFloatAttribute(Material mat, int attribute, float value) voidsetFloatExtAttribute(int attrib, float value) static voidsetGlobalAmbientLight(float level) Sets the ambient lightvoidsetIntAttribute(Material mat, int attribute, int value) voidvoidSets the model file path (this must be a .g3db, .g3dj or .obj).voidsetModelInitialized(boolean initialized) voidvoidsetPrimitiveType(int primitiveType) voidsetPrimitiveType(String primitiveType) voidvoidvoidsetStaticlight(Boolean staticLight) voidsetStaticlight(Double lightLevel) voidsetStaticlight(String staticLight) voidsetStaticLight(Boolean staticLight) voidsetStaticLight(Double lightLevel) voidsetStaticLight(String staticLight) voidsetTransparency(float alpha) voidsetTransparency(float alpha, int blendSrc, int blendDest, boolean blendEnabled) voidsetTransparencyColor(float alpha) voidSets the type of the model to construct.voidsetUnits(double kmToUnits) voidsetUsecolor(Boolean usecolor) voidsetUsecolor(String usecolor) voidsetUseColor(Boolean useColor) voidsetUseColor(String useColor) voidsetVector3Attribute(Material mat, int attribute, com.badlogic.gdx.math.Vector3 value) voidsetVROffset(NaturalCamera cam) toString()voidtouch()voidtouch(com.badlogic.gdx.math.Matrix4 localTransform) Initialises the model or texture if LAZY_X_INIT is onvoidupdate(boolean relativistic, com.badlogic.gdx.math.Matrix4 localTransform, float alpha) voidupdate(boolean relativistic, com.badlogic.gdx.math.Matrix4 localTransform, float alpha, int blendSrc, int blendDst, boolean blendEnabled) voidupdate(float alpha) voidupdate(float alpha, boolean relativistic) voidupdate(com.badlogic.gdx.math.Matrix4 localTransform, float alpha) voidupdate(com.badlogic.gdx.math.Matrix4 localTransform, float alpha, int blendSrc, int blendDst, boolean blendEnabled) voidupdateCamPos(com.badlogic.gdx.math.Vector3 cameraPos) voidSets the depth test of this model using the information in theblendModeattribute like so: blendMode = alpha -> depth reads and writes blendMode = additive -> depth reads but no writesvoidupdateEclipsingBodyUniforms(com.badlogic.ashley.core.Entity entity) voidupdateRelativisticEffects(ICamera camera) voidupdateRelativisticEffects(ICamera camera, float vc) voidupdateRelativisticEffects(Material mat, ICamera camera) voidupdateRelativisticEffects(Material mat, ICamera camera, float vc) voidupdateSessionTime(double t) voidupdateSimuTime(double t) voidupdateSize(double sizeInternal) voidupdateSizeKm(double sizeInternal) voidupdateTimes(double sessionTime, double simuTime) voidupdateWith(ModelComponent object) Methods inherited from class NamedComponent
createModelParameters, gaussian, gaussian, gaussian
-
Field Details
-
forceInit
public boolean forceInit -
instance
-
env
-
params
-
type
-
modelFile
-
scale
public double scale -
culling
public boolean culling -
tessellated
public boolean tessellated -
mtc
COMPONENTS -
rec
-
-
Constructor Details
-
ModelComponent
public ModelComponent() -
ModelComponent
-
-
Method Details
-
setGlobalAmbientLight
public static void setGlobalAmbientLight(float level) Sets the ambient light- Parameters:
level- Ambient light level between 0 and 1
-
pointLight
public com.badlogic.gdx.graphics.g3d.environment.PointLight pointLight(int i) Returns the given point light.- Parameters:
i- The index of the light (must be less thanConstants.N_POINT_LIGHTS).- Returns:
- The point light with index i.
-
hasPointLight
public boolean hasPointLight(int i) -
clearPoints
public void clearPoints()Turns off all point lights. -
dirLight
public com.badlogic.gdx.graphics.g3d.environment.DirectionalLight dirLight(int i) Returns the given directional light.- Parameters:
i- The index of the light (must be less thanConstants.N_DIR_LIGHTS).- Returns:
- The directional light with index i.
-
hasDirLight
public boolean hasDirLight(int i) -
clearDirectionals
public void clearDirectionals()Turns off all directional lights. -
initialize
- Specified by:
initializein interfaceIComponent- Overrides:
initializein classNamedComponent
-
initialize
public void initialize(boolean mesh) -
initializeEnvironment
public void initializeEnvironment() -
doneLoading
public void doneLoading(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.math.Matrix4 localTransform, float[] cc) -
doneLoading
public void doneLoading(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.math.Matrix4 localTransform, float[] cc, boolean mesh) -
load
public void load(com.badlogic.gdx.math.Matrix4 localTransform) -
update
public void update(boolean relativistic, com.badlogic.gdx.math.Matrix4 localTransform, float alpha, int blendSrc, int blendDst, boolean blendEnabled) -
update
public void update(com.badlogic.gdx.math.Matrix4 localTransform, float alpha, int blendSrc, int blendDst, boolean blendEnabled) -
update
public void update(boolean relativistic, com.badlogic.gdx.math.Matrix4 localTransform, float alpha) -
update
public void update(com.badlogic.gdx.math.Matrix4 localTransform, float alpha) -
update
public void update(float alpha, boolean relativistic) -
update
public void update(float alpha) -
touch
public void touch() -
touch
public void touch(com.badlogic.gdx.math.Matrix4 localTransform) Initialises the model or texture if LAZY_X_INIT is on -
setModelInitialized
public void setModelInitialized(boolean initialized) -
addColorToMaterial
public void addColorToMaterial() -
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
setVROffset
-
setTransparency
public void setTransparency(float alpha, int blendSrc, int blendDest, boolean blendEnabled) -
updateSizeKm
public void updateSizeKm(double sizeInternal) -
updateSize
public void updateSize(double sizeInternal) -
setUnits
public void setUnits(double kmToUnits) -
disableBlending
public void disableBlending() -
updateDepthTest
public void updateDepthTest()Sets the depth test of this model using the information in theblendModeattribute like so:- blendMode = alpha -> depth reads and writes
- blendMode = additive -> depth reads but no writes
-
depthTestReadOnly
public void depthTestReadOnly()Sets the depth test of this model to read only. -
depthTestReadWrite
public void depthTestReadWrite()Sets the depth test of this model to read and write. -
depthTestDisable
public void depthTestDisable()Completely disables the depth test. -
setDepthTest
public void setDepthTest(int func, boolean mask) -
setTransparency
public void setTransparency(float alpha) -
setTransparencyColor
public void setTransparencyColor(float alpha) -
setFloatExtAttribute
public void setFloatExtAttribute(int attrib, float value) -
setIntAttribute
-
setFloatAttribute
-
setVector3Attribute
-
setColorAttribute
public void setColorAttribute(int attrib, float[] rgba) -
setType
Sets the type of the model to construct.- Parameters:
type- The type. Currently supported types are sphere|cylinder|ring|disc.
-
setMaterial
-
setModel
Sets the model file path (this must be a .g3db, .g3dj or .obj).- Parameters:
model- The model file name.
-
setStaticlight
-
setStaticlight
-
setStaticlight
-
setParams
-
setScale
-
setScale
-
setCulling
-
setCulling
-
setUsecolor
-
setUseColor
-
setUsecolor
-
setUseColor
-
getBlendMode
-
setBlendMode
-
setBlendMode
-
setBlending
-
updateEclipsingBodyUniforms
public void updateEclipsingBodyUniforms(com.badlogic.ashley.core.Entity entity) -
updateRelativisticEffects
-
updateRelativisticEffects
-
updateRelativisticEffects
-
updateRelativisticEffects
-
addReflectionCubemapAttribute
-
removeReflectionCubemapAttribute
-
hasHeight
public boolean hasHeight() -
isTessellated
public boolean isTessellated()Returns whether this model is tessellated or not.- Returns:
- Whether the model is tessellated.
-
notify
-
isModelInitialised
public boolean isModelInitialised() -
isModelLoading
public boolean isModelLoading()- Returns:
- Whether the model is loading or it has finished.
-
isStaticLight
public boolean isStaticLight() -
setStaticLight
-
setStaticLight
-
setStaticLight
-
setAmbientColor
public void setAmbientColor(double[] color) -
setAmbientLevel
-
setAmbientColor
-
setPrimitiveType
public void setPrimitiveType(int primitiveType) -
setPrimitiveType
-
toString
-
randomizeAll
public void randomizeAll(long seed, double size) Creates a random model component using the given seed. Creates random elevation data, as well as diffuse, normal and specular textures.- Parameters:
seed- The seed to use.size- The size of the base body in internal units.
-
print
-
updateWith
- Specified by:
updateWithin interfaceIUpdatable<ModelComponent>
-
updateCamPos
public void updateCamPos(com.badlogic.gdx.math.Vector3 cameraPos) -
updateTimes
public void updateTimes(double sessionTime, double simuTime) -
updateSessionTime
public void updateSessionTime(double t) -
updateSimuTime
public void updateSimuTime(double t)
-