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 class ModelComponent extends NamedComponent implements com.badlogic.gdx.utils.Disposable, IObserver, IUpdatable<ModelComponent>
  • Field Details

  • Constructor Details

    • ModelComponent

      public ModelComponent()
    • ModelComponent

      public ModelComponent(Boolean initEnvironment)
  • Method Details

    • setGlobalAmbientLight

      public static void setGlobalAmbientLight(float level)
      Sets the ambient light
      Parameters:
      level - Ambient light level between 0 and 1
    • directional

      public com.badlogic.gdx.graphics.g3d.environment.DirectionalLight directional(int i)
      Returns the given directional light
      Parameters:
      i - The index of the light (must be less than Constants.N_DIR_LIGHTS.
      Returns:
      The directional light with index i
    • clearDirectionals

      public void clearDirectionals()
      Turns off all directional lights
    • initialize

      public void initialize(String name)
      Specified by:
      initialize in interface IComponent
      Overrides:
      initialize in class NamedComponent
    • 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:
      dispose in interface com.badlogic.gdx.utils.Disposable
    • setVROffset

      public void setVROffset(NaturalCamera cam)
    • setTransparency

      public void setTransparency(float alpha, int blendSrc, int blendDest, boolean blendEnabled)
    • disableBlending

      public void disableBlending()
    • updateDepthTest

      public void updateDepthTest()
      Sets the depth test of this model using the information in the blendMode attribute 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

      public void setIntAttribute(Material mat, int attribute, int value)
    • setFloatAttribute

      public void setFloatAttribute(Material mat, int attribute, float value)
    • setVector3Attribute

      public void setVector3Attribute(Material mat, int attribute, com.badlogic.gdx.math.Vector3 value)
    • setColorAttribute

      public void setColorAttribute(int attrib, float[] rgba)
    • setType

      public void setType(String type)
      Sets the type of the model to construct.
      Parameters:
      type - The type. Currently supported types are sphere|cylinder|ring|disc.
    • setMaterial

      public void setMaterial(MaterialComponent mtc)
    • setModel

      public void setModel(String model)
      Sets the model file path (this must be a .g3db, .g3dj or .obj).
      Parameters:
      model - The model file name.
    • setStaticlight

      public void setStaticlight(String staticLight)
    • setStaticlight

      public void setStaticlight(Boolean staticLight)
    • setStaticlight

      public void setStaticlight(Double lightLevel)
    • setParams

      public void setParams(Map<String,Object> params)
    • setScale

      public void setScale(Double scale)
    • setScale

      public void setScale(Long scale)
    • setCulling

      public void setCulling(String culling)
    • setCulling

      public void setCulling(Boolean culling)
    • setUsecolor

      public void setUsecolor(String usecolor)
    • setUseColor

      public void setUseColor(String useColor)
    • setUsecolor

      public void setUsecolor(Boolean usecolor)
    • setUseColor

      public void setUseColor(Boolean useColor)
    • getBlendMode

      public BlendMode getBlendMode()
    • setBlendMode

      public void setBlendMode(BlendMode blendMode)
    • setBlendMode

      public void setBlendMode(String blendModeString)
    • updateVelocityBufferUniforms

      public void updateVelocityBufferUniforms(ICamera camera)
    • updateVelocityBufferUniforms

      public void updateVelocityBufferUniforms(Material mat, ICamera camera)
    • updateEclipsingBodyUniforms

      public void updateEclipsingBodyUniforms(com.badlogic.ashley.core.Entity entity)
    • updateRelativisticEffects

      public void updateRelativisticEffects(ICamera camera)
    • updateRelativisticEffects

      public void updateRelativisticEffects(ICamera camera, float vc)
    • updateRelativisticEffects

      public void updateRelativisticEffects(Material mat, ICamera camera)
    • updateRelativisticEffects

      public void updateRelativisticEffects(Material mat, ICamera camera, float vc)
    • addReflectionCubemapAttribute

      public void addReflectionCubemapAttribute(com.badlogic.gdx.utils.Array<Material> materials)
    • removeReflectionCubemapAttribute

      public void removeReflectionCubemapAttribute(com.badlogic.gdx.utils.Array<Material> materials)
    • hasHeight

      public boolean hasHeight()
    • notify

      public void notify(Event event, Object source, Object... data)
      Description copied from interface: IObserver
      Event notification call.
      Specified by:
      notify in interface IObserver
      Parameters:
      event - The event type.
      source - The source object, if any.
      data - The data associated with this event.
    • isModelInitialised

      public boolean isModelInitialised()
    • isModelLoading

      public boolean isModelLoading()
      Returns:
      Whether the model is loading or it has finished.
    • isStaticLight

      public boolean isStaticLight()
    • setStaticLight

      public void setStaticLight(String staticLight)
    • setStaticLight

      public void setStaticLight(Boolean staticLight)
    • setStaticLight

      public void setStaticLight(Double lightLevel)
    • setAmbientColor

      public void setAmbientColor(double[] color)
    • setAmbientLevel

      public void setAmbientLevel(Double level)
    • setAmbientColor

      public void setAmbientColor(Double level)
    • setPrimitiveType

      public void setPrimitiveType(int primitiveType)
    • setPrimitiveType

      public void setPrimitiveType(String primitiveType)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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

      public void print(Logger.Log log)
    • updateWith

      public void updateWith(ModelComponent object)
      Specified by:
      updateWith in interface IUpdatable<ModelComponent>