Java 类com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter 实例源码

项目:gdx-proto    文件:BulletHit.java   
public BulletHit(Vector3 loc) {
    location = Pooler.v3().set(loc);
    if (Main.isClient()) {
        pfx = Particles.inst.obtainBulletHit();
        //mtx.setToScaling(0.5f, 0.5f, 0.5f);
        mtx.setToTranslation(loc);
        pfx.setTransform(mtx);
        Particles.inst.system.add(pfx);
        RegularEmitter emitter = (RegularEmitter) pfx.getControllers().first().emitter;
        emitter.setEmissionMode(RegularEmitter.EmissionMode.EnabledUntilCycleEnd);
        pfx.start();
    }
    list.add(this);
    if (Main.isServer()) {
        applyEffects();
    }
}
项目:exterminate    文件:Assets.java   
@Override
  public void free(ParticleEffect pfx) {
 //     ParticleSystem.get().remove(pfx);
      if(pfx==null) return;
Emitter emitter = pfx.getControllers().first().emitter;
      if (emitter instanceof RegularEmitter) {
          RegularEmitter reg = (RegularEmitter) emitter;
          reg.setEmissionMode(RegularEmitter.EmissionMode.Disabled);
      }

      super.free(pfx);
  }
项目:exterminate    文件:Assets.java   
@Override
public ParticleEffect obtain() {
    ParticleEffect newEffect = super.obtain();

//  ParticleSystem.get().add(newEffect);
    Emitter emitter = newEffect.getControllers().first().emitter;
    if (emitter instanceof RegularEmitter) {
        RegularEmitter reg = (RegularEmitter) emitter;
        reg.setEmissionMode(RegularEmitter.EmissionMode.Enabled);
    }
    newEffect.reset();

    return newEffect;
}
项目:libgdxcn    文件:EffectPanel.java   
private ParticleController createDefaultModelInstanceController () {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(80);
    emitter.getLife().setHigh(500, 1000);
    emitter.getLife().setTimeline(new float[] {0, 0.66f, 1});
    emitter.getLife().setScaling(new float[] {1, 1, 0.3f});
    emitter.setMaxParticleCount(100);

    //Color
    ColorInfluencer.Random colorInfluencer = new ColorInfluencer.Random();

    //Spawn
    EllipseSpawnShapeValue spawnShapeValue = new EllipseSpawnShapeValue();
    spawnShapeValue.setDimensions(1, 1, 1);
    SpawnInfluencer spawnSource = new SpawnInfluencer(spawnShapeValue);

    //Velocity
    DynamicsInfluencer velocityInfluencer = new DynamicsInfluencer();

    //Directional
    DynamicsModifier.CentripetalAcceleration velocityValue = new DynamicsModifier.CentripetalAcceleration();
    velocityValue.strengthValue.setHigh(5, 11);
    velocityValue.strengthValue.setActive(true);
    //velocityValue.setActive(true);
    velocityInfluencer.velocities.add(velocityValue);
    //VelocityModifier.FaceDirection faceVelocityValue = new VelocityModifier.FaceDirection();
    //velocityInfluencer.velocities.add(faceVelocityValue);

    return new ParticleController("ModelInstance Controller", emitter, new ModelInstanceRenderer(editor.getModelInstanceParticleBatch()), 
        new ModelInfluencer.Single((Model) editor.assetManager.get(FlameMain.DEFAULT_MODEL_PARTICLE) ),
        spawnSource,
        colorInfluencer,
        velocityInfluencer
        );
}
项目:libgdxcn    文件:EffectPanel.java   
private ParticleController createDefaultParticleController () {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(90);
    emitter.getLife().setHigh(3000);
    emitter.setMaxParticleCount(100);

    //Spawn
    EllipseSpawnShapeValue pointSpawnShapeValue = new EllipseSpawnShapeValue();
    pointSpawnShapeValue.setDimensions(1, 1, 1);
    pointSpawnShapeValue.setSide(SpawnSide.top);
    SpawnInfluencer spawnSource = new SpawnInfluencer(pointSpawnShapeValue);

    //Scale
    ScaleInfluencer scaleInfluencer = new ScaleInfluencer();
    scaleInfluencer.value.setHigh(1);
    scaleInfluencer.value.setLow(0);
    scaleInfluencer.value.setTimeline(new float[]{0,1});
    scaleInfluencer.value.setScaling(new float[]{1, 0});

    //Velocity
    DynamicsInfluencer velocityInfluencer = new DynamicsInfluencer();

    //Directional
    DynamicsModifier.CentripetalAcceleration velocityValue = new DynamicsModifier.CentripetalAcceleration();
    velocityValue.strengthValue.setHigh(5, 10);
    velocityValue.strengthValue.setActive(true);
    velocityInfluencer.velocities.add(velocityValue);

    return new ParticleController("ParticleController Controller", emitter, new ParticleControllerControllerRenderer(),
        new ParticleControllerInfluencer.Single(editor.assetManager.get(FlameMain.DEFAULT_TEMPLATE_PFX, ParticleEffect.class).getControllers().get(0)),
        spawnSource,
        scaleInfluencer,
        velocityInfluencer,
        new ParticleControllerFinalizerInfluencer()
        );
}
项目:libgdxcn    文件:EffectPanel.java   
public ParticleController createDefaultTemplateController(){
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(90);
    emitter.getLife().setHigh(1000);
    emitter.getLife().setTimeline(new float[] {0, 0.66f, 1});
    emitter.getLife().setScaling(new float[] {1, 1, 0.3f});
    emitter.setMaxParticleCount(100);

    //Spawn
    PointSpawnShapeValue pointSpawnShapeValue = new PointSpawnShapeValue();     
    pointSpawnShapeValue.xOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.xOffsetValue.setActive(true);
    pointSpawnShapeValue.yOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.yOffsetValue.setActive(true);
    pointSpawnShapeValue.zOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.zOffsetValue.setActive(true);
    SpawnInfluencer spawnSource = new SpawnInfluencer(pointSpawnShapeValue);

    ScaleInfluencer scaleInfluencer = new ScaleInfluencer();
    scaleInfluencer.value.setHigh(1f);

    //Color
    ColorInfluencer.Single colorInfluencer = new ColorInfluencer.Single();
    colorInfluencer.colorValue.setColors(new float[] {1, 0.12156863f, 0.047058824f, 0,0,0});
    colorInfluencer.colorValue.setTimeline(new float[] {0, 1});
    colorInfluencer.alphaValue.setHigh(1);
    colorInfluencer.alphaValue.setTimeline(new float[] {0, 0.5f, 0.8f, 1});
    colorInfluencer.alphaValue.setScaling(new float[] {0, 0.15f, 0.5f, 0});

    return new ParticleController("Billboard Controller", emitter, new BillboardRenderer(editor.getBillboardBatch()), 
        new RegionInfluencer.Single(editor.getTexture()),
        spawnSource,
        scaleInfluencer,
        colorInfluencer
        );
}
项目:gdx-proto    文件:BlueExplosion.java   
public BlueExplosion(Vector3 loc) {
    pfx = Particles.inst.obtainBlueExplosion();
    //mtx.setToScaling(0.5f, 0.5f, 0.5f);
    mtx.setToTranslation(loc);
    pfx.setTransform(mtx);
    Particles.inst.system.add(pfx);
    RegularEmitter emitter = (RegularEmitter) pfx.getControllers().first().emitter;
    emitter.setEmissionMode(RegularEmitter.EmissionMode.EnabledUntilCycleEnd);
    pfx.start();
    list.add(this);
}
项目:gdx-proto    文件:BulletHit.java   
public void update() {
    if (Main.isClient()) {
        RegularEmitter emitter = (RegularEmitter) pfx.getControllers().first().emitter;
        if (emitter.isComplete()) {
            destroy();
        }
    }
}
项目:libgdxcn    文件:FlameMain.java   
protected JPanel getPanel (Emitter emitter) {
    if(emitter instanceof RegularEmitter){
        return new RegularEmitterPanel(this, (RegularEmitter) emitter);
    }
    return null;
}
项目:libgdxcn    文件:EffectPanel.java   
private ParticleController createDefaultBillboardController () {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(250);
    emitter.getLife().setHigh(500, 1000);
    emitter.getLife().setTimeline(new float[] {0, 0.66f, 1});
    emitter.getLife().setScaling(new float[] {1, 1, 0.3f});
    emitter.setMaxParticleCount(200);

    //Spawn
    PointSpawnShapeValue pointSpawnShapeValue = new PointSpawnShapeValue();
    SpawnInfluencer spawnSource = new SpawnInfluencer(pointSpawnShapeValue);

    //Color
    ColorInfluencer.Single colorInfluencer = new ColorInfluencer.Single();
    colorInfluencer.colorValue.setColors(new float[] {1, 0.12156863f, 0.047058824f, 0,0,0});
    colorInfluencer.colorValue.setTimeline(new float[] {0, 1});
    colorInfluencer.alphaValue.setHigh(1);
    colorInfluencer.alphaValue.setTimeline(new float[] {0, 0.5f, 0.8f, 1});
    colorInfluencer.alphaValue.setScaling(new float[] {0, 0.15f, 0.5f, 0});

    //Velocity
    DynamicsInfluencer velocityInfluencer = new DynamicsInfluencer();

    //Directional
    DynamicsModifier.PolarAcceleration velocityValue = new DynamicsModifier.PolarAcceleration();
    velocityValue.phiValue.setHigh(-35, 35);
    velocityValue.phiValue.setActive(true);
    velocityValue.phiValue.setTimeline(new float[] {0, 0.5f, 1});
    velocityValue.phiValue.setScaling(new float[] {1, 0, 0});
    velocityValue.thetaValue.setHigh(0, 360);
    velocityValue.strengthValue.setHigh(5, 10);
    velocityInfluencer.velocities.add(velocityValue);

    return new ParticleController("Billboard Controller", emitter, new BillboardRenderer(editor.getBillboardBatch()), 
        new RegionInfluencer.Single(editor.getTexture()),
        spawnSource,
        colorInfluencer,
        velocityInfluencer
        );
}
项目:libgdxcn    文件:EffectPanel.java   
private ParticleController createDefaultPointController () {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(250);
    emitter.getLife().setHigh(500, 1000);
    emitter.getLife().setTimeline(new float[] {0, 0.66f, 1});
    emitter.getLife().setScaling(new float[] {1, 1, 0.3f});
    emitter.setMaxParticleCount(200);

    //Scale
    ScaleInfluencer scaleInfluencer = new ScaleInfluencer();
    scaleInfluencer.value.setHigh(1);

    //Color
    ColorInfluencer.Single colorInfluencer = new ColorInfluencer.Single();
    colorInfluencer.colorValue.setColors(new float[] {0.12156863f, 0.047058824f, 1, 0,0,0});
    colorInfluencer.colorValue.setTimeline(new float[] {0, 1});
    colorInfluencer.alphaValue.setHigh(1);
    colorInfluencer.alphaValue.setTimeline(new float[] {0, 0.5f, 0.8f, 1});
    colorInfluencer.alphaValue.setScaling(new float[] {0, 0.15f, 0.5f, 0});

    //Spawn
    PointSpawnShapeValue pointSpawnShapeValue = new PointSpawnShapeValue();
    SpawnInfluencer spawnSource = new SpawnInfluencer(pointSpawnShapeValue);

    //Velocity
    DynamicsInfluencer velocityInfluencer = new DynamicsInfluencer();

    //Directional
    DynamicsModifier.PolarAcceleration velocityValue = new DynamicsModifier.PolarAcceleration();
    velocityValue.phiValue.setHigh(-35, 35);
    velocityValue.phiValue.setActive(true);
    velocityValue.phiValue.setTimeline(new float[] {0, 0.5f, 1});
    velocityValue.phiValue.setScaling(new float[] {1, 0, 0});
    velocityValue.thetaValue.setHigh(0, 360);
    velocityValue.strengthValue.setHigh(5, 10);

    return new ParticleController("PointSprite Controller", emitter, new PointSpriteRenderer(editor.getPointSpriteBatch()),
        new RegionInfluencer.Single((Texture) editor.assetManager.get(FlameMain.DEFAULT_BILLBOARD_PARTICLE) ),
        spawnSource,
        scaleInfluencer,
        colorInfluencer,
        velocityInfluencer
        );
}
项目:libgdxcn    文件:RegularEmitterPanel.java   
public RegularEmitterPanel (FlameMain particleEditor3D, RegularEmitter emitter) {
    super(particleEditor3D, "Regular Emitter", "This is a generic emitter used to generate particles regularly.");
    initializeComponents(emitter);
    setValue(null);
}
项目:libgdxcn    文件:ParticleControllerTest.java   
private ParticleController createBillboardController (float[] colors, Texture particleTexture) {
    //Emission
    RegularEmitter emitter = new RegularEmitter();
    emitter.getDuration().setLow(3000);
    emitter.getEmission().setHigh(2900);
    emitter.getLife().setHigh(1000);
    emitter.setMaxParticleCount(3000);

    //Spawn
    PointSpawnShapeValue pointSpawnShapeValue = new PointSpawnShapeValue();     
    pointSpawnShapeValue.xOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.xOffsetValue.setActive(true);
    pointSpawnShapeValue.yOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.yOffsetValue.setActive(true);
    pointSpawnShapeValue.zOffsetValue.setLow(0, 1f);
    pointSpawnShapeValue.zOffsetValue.setActive(true);
    SpawnInfluencer spawnSource = new SpawnInfluencer(pointSpawnShapeValue);

    //Scale
    ScaleInfluencer scaleInfluencer = new ScaleInfluencer();
    scaleInfluencer.value.setTimeline(new float[]{0, 1});
    scaleInfluencer.value.setScaling(new float[]{1, 0});
    scaleInfluencer.value.setLow(0);
    scaleInfluencer.value.setHigh(1);

    //Color
    ColorInfluencer.Single colorInfluencer = new ColorInfluencer.Single();
    colorInfluencer.colorValue.setColors(new float[] {colors[0], colors[1], colors[2], 0,0,0});
    colorInfluencer.colorValue.setTimeline(new float[] {0, 1});
    colorInfluencer.alphaValue.setHigh(1);
    colorInfluencer.alphaValue.setTimeline(new float[] {0, 0.5f, 0.8f, 1});
    colorInfluencer.alphaValue.setScaling(new float[] {0, 0.15f, 0.5f, 0});

    //Dynamics
    DynamicsInfluencer dynamicsInfluencer = new DynamicsInfluencer();
    BrownianAcceleration modifier = new BrownianAcceleration();
    modifier.strengthValue.setTimeline(new float[]{0,1});
    modifier.strengthValue.setScaling(new float[]{0,1});
    modifier.strengthValue.setHigh(80);
    modifier.strengthValue.setLow(1, 5);
    dynamicsInfluencer.velocities.add(modifier);

    return new ParticleController("Billboard Controller", emitter, new BillboardRenderer(billboardParticleBatch),
        new RegionInfluencer.Single(particleTexture),
        spawnSource,
        scaleInfluencer,
        colorInfluencer,
        dynamicsInfluencer
        );
}
项目:gdx-proto    文件:BlueExplosion.java   
public void update() {
    RegularEmitter emitter = (RegularEmitter) pfx.getControllers().first().emitter;
    if (emitter.isComplete()) {
        destroy();
    }
}