Home | History | Annotate | Download | only in renderers
      1 package com.badlogic.gdx.graphics.g3d.particles.renderers;
      2 
      3 import com.badlogic.gdx.graphics.g3d.ModelInstance;
      4 import com.badlogic.gdx.graphics.g3d.particles.ParallelArray.ObjectChannel;
      5 import com.badlogic.gdx.graphics.g3d.particles.ParticleChannels;
      6 import com.badlogic.gdx.graphics.g3d.particles.ParticleController;
      7 import com.badlogic.gdx.graphics.g3d.particles.ParticleControllerComponent;
      8 import com.badlogic.gdx.graphics.g3d.particles.batches.ModelInstanceParticleBatch;
      9 import com.badlogic.gdx.graphics.g3d.particles.batches.ParticleBatch;
     10 import com.badlogic.gdx.utils.GdxRuntimeException;
     11 
     12 /** A {@link ParticleControllerRenderer} which will render the {@link ParticleController} of each particle.
     13  * @author Inferno */
     14 @SuppressWarnings("rawtypes")
     15 public class ParticleControllerControllerRenderer extends ParticleControllerRenderer{
     16 	ObjectChannel<ParticleController> controllerChannel;
     17 
     18 	@Override
     19 	public void init () {
     20 		controllerChannel = controller.particles.getChannel(ParticleChannels.ParticleController);
     21 		if(controllerChannel == null)
     22 			throw new GdxRuntimeException("ParticleController channel not found, specify an influencer which will allocate it please.");
     23 	}
     24 
     25 	@Override
     26 	public void update () {
     27 		for(int i=0, c = controller.particles.size; i< c; ++i){
     28 			controllerChannel.data[i].draw();
     29 		}
     30 	}
     31 
     32 	@Override
     33 	public ParticleControllerComponent copy () {
     34 		return new ParticleControllerControllerRenderer();
     35 	}
     36 
     37 	@Override
     38 	public boolean isCompatible (ParticleBatch batch) {
     39 		return false;
     40 	}
     41 
     42 }
     43