Class ParticleController

    • Field Detail

      • DEFAULT_TIME_STEP

        protected static final float DEFAULT_TIME_STEP
        the default time step used to update the simulation
        See Also:
        Constant Field Values
      • name

        public java.lang.String name
        Name of the controller
      • emitter

        public Emitter emitter
        Controls the emission of the particles
      • influencers

        public Array<Influencer> influencers
        Update the properties of the particles
      • transform

        public Matrix4 transform
        Current transform of the controller DO NOT CHANGE MANUALLY
      • scale

        public Vector3 scale
        Transform flags
      • boundingBox

        protected BoundingBox boundingBox
        Not used by the simulation, it should represent the bounding box containing all the particles
      • deltaTime

        public float deltaTime
        Time step, DO NOT CHANGE MANUALLY
      • deltaTimeSqr

        public float deltaTimeSqr
        Time step, DO NOT CHANGE MANUALLY
    • Constructor Detail

      • ParticleController

        public ParticleController()
    • Method Detail

      • setTransform

        public void setTransform​(Matrix4 transform)
        Sets the current transformation to the given one.
        Parameters:
        transform - the new transform matrix
      • setTransform

        public void setTransform​(float x,
                                 float y,
                                 float z,
                                 float qx,
                                 float qy,
                                 float qz,
                                 float qw,
                                 float scale)
        Sets the current transformation.
      • rotate

        public void rotate​(Quaternion rotation)
        Post-multiplies the current transformation with a rotation matrix represented by the given quaternion.
      • rotate

        public void rotate​(Vector3 axis,
                           float angle)
        Post-multiplies the current transformation with a rotation matrix by the given angle around the given axis.
        Parameters:
        axis - the rotation axis
        angle - the rotation angle in degrees
      • translate

        public void translate​(Vector3 translation)
        Postmultiplies the current transformation with a translation matrix represented by the given translation.
      • setTranslation

        public void setTranslation​(Vector3 translation)
      • scale

        public void scale​(float scaleX,
                          float scaleY,
                          float scaleZ)
        Postmultiplies the current transformation with a scale matrix represented by the given scale on x,y,z.
      • scale

        public void scale​(Vector3 scale)
        Postmultiplies the current transformation with a scale matrix represented by the given scale vector.
      • mul

        public void mul​(Matrix4 transform)
        Postmultiplies the current transformation with the given matrix.
      • getTransform

        public void getTransform​(Matrix4 transform)
        Set the given matrix to the current transformation matrix.
      • isComplete

        public boolean isComplete()
      • init

        public void init()
        Initialize the controller. All the sub systems will be initialized and binded to the controller. Must be called before any other method.
      • allocateChannels

        protected void allocateChannels​(int maxParticleCount)
      • bind

        protected void bind()
        Bind the sub systems to the controller Called once during the init phase.
      • start

        public void start()
        Start the simulation.
      • reset

        public void reset()
        Reset the simulation.
      • end

        public void end()
        End the simulation.
      • activateParticles

        public void activateParticles​(int startIndex,
                                      int count)
        Generally called by the Emitter. This method will notify all the sub systems that a given amount of particles has been activated.
      • killParticles

        public void killParticles​(int startIndex,
                                  int count)
        Generally called by the Emitter. This method will notify all the sub systems that a given amount of particles has been killed.
      • update

        public void update()
        Updates the particles data
      • update

        public void update​(float deltaTime)
        Updates the particles data
      • draw

        public void draw()
        Updates the renderer used by this controller, usually this means the particles will be draw inside a batch.
      • dispose

        public void dispose()
      • getBoundingBox

        public BoundingBox getBoundingBox()
        Returns:
        a copy of this controller, should be used after the particle effect has been loaded.
      • calculateBoundingBox

        protected void calculateBoundingBox()
        Updates the bounding box using the position channel.
      • findInfluencer

        public <K extends Influencer> K findInfluencer​(java.lang.Class<K> influencerClass)
        Returns:
        the influencer having the given type.
      • removeInfluencer

        public <K extends Influencer> void removeInfluencer​(java.lang.Class<K> type)
        Removes the Influencer of the given type.
      • replaceInfluencer

        public <K extends Influencer> boolean replaceInfluencer​(java.lang.Class<K> type,
                                                                K newInfluencer)
        Replaces the Influencer of the given type with the one passed as parameter.