Home | History | Annotate | Download | only in renderers
      1 package com.badlogic.gdx.graphics.g3d.particles.renderers;
      2 
      3 import com.badlogic.gdx.graphics.g3d.particles.ParticleChannels;
      4 import com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.ColorInitializer;
      5 import com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.Rotation2dInitializer;
      6 import com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.ScaleInitializer;
      7 import com.badlogic.gdx.graphics.g3d.particles.ParticleChannels.TextureRegionInitializer;
      8 import com.badlogic.gdx.graphics.g3d.particles.ParticleControllerComponent;
      9 import com.badlogic.gdx.graphics.g3d.particles.batches.BillboardParticleBatch;
     10 import com.badlogic.gdx.graphics.g3d.particles.batches.ParticleBatch;
     11 import com.badlogic.gdx.graphics.g3d.particles.batches.PointSpriteParticleBatch;
     12 
     13 /** A {@link ParticleControllerRenderer} which will render particles as point sprites to a {@link PointSpriteParticleBatch} .
     14  * @author Inferno */
     15 public class PointSpriteRenderer extends ParticleControllerRenderer<PointSpriteControllerRenderData, PointSpriteParticleBatch> {
     16 	public PointSpriteRenderer(){
     17 		super(new PointSpriteControllerRenderData());
     18 	}
     19 
     20 	public PointSpriteRenderer(PointSpriteParticleBatch batch){
     21 		this();
     22 		setBatch(batch);
     23 	}
     24 
     25 	@Override
     26 	public void allocateChannels () {
     27 		renderData.positionChannel = controller.particles.addChannel(ParticleChannels.Position);
     28 		renderData.regionChannel = controller.particles.addChannel(ParticleChannels.TextureRegion, TextureRegionInitializer.get());
     29 		renderData.colorChannel = controller.particles.addChannel(ParticleChannels.Color, ColorInitializer.get());
     30 		renderData.scaleChannel = controller.particles.addChannel(ParticleChannels.Scale, ScaleInitializer.get());
     31 		renderData.rotationChannel = controller.particles.addChannel(ParticleChannels.Rotation2D, Rotation2dInitializer.get());
     32 	}
     33 
     34 	@Override
     35 	public boolean isCompatible (ParticleBatch<?> batch) {
     36 		return batch instanceof PointSpriteParticleBatch;
     37 	}
     38 
     39 	@Override
     40 	public ParticleControllerComponent copy () {
     41 		return new PointSpriteRenderer(batch);
     42 	}
     43 
     44 }
     45