Search in sources :

Example 1 with PointSpawnShapeValue

use of com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue in project libgdx by libgdx.

the class EffectPanel method createDefaultPointController.

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);
}
Also used : DynamicsInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer) RegularEmitter(com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter) Texture(com.badlogic.gdx.graphics.Texture) DynamicsModifier(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue) ScaleInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer) PointSpriteRenderer(com.badlogic.gdx.graphics.g3d.particles.renderers.PointSpriteRenderer) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) ColorInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer) RegionInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer) SpawnInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer)

Example 2 with PointSpawnShapeValue

use of com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue in project libgdx by libgdx.

the class SpawnInfluencerPanel method initializeComponents.

protected void initializeComponents() {
    super.initializeComponents();
    pointSpawnShapeValue = new PointSpawnShapeValue();
    lineSpawnShapeValue = new LineSpawnShapeValue();
    rectangleSpawnShapeValue = new RectangleSpawnShapeValue();
    ellipseSpawnShapeValue = new EllipseSpawnShapeValue();
    cylinderSpawnShapeValue = new CylinderSpawnShapeValue();
    meshSpawnShapeValue = new UnweightedMeshSpawnShapeValue();
    weightMeshSpawnShapeValue = new WeightMeshSpawnShapeValue();
    lineSpawnShapeValue.setDimensions(6, 6, 6);
    rectangleSpawnShapeValue.setDimensions(6, 6, 6);
    ellipseSpawnShapeValue.setDimensions(6, 6, 6);
    cylinderSpawnShapeValue.setDimensions(6, 6, 6);
    pointSpawnShapeValue.setActive(true);
    lineSpawnShapeValue.setActive(true);
    rectangleSpawnShapeValue.setActive(true);
    ellipseSpawnShapeValue.setActive(true);
    cylinderSpawnShapeValue.setActive(true);
    meshSpawnShapeValue.setActive(true);
    weightMeshSpawnShapeValue.setActive(true);
    Model defaultModel = editor.assetManager.get(FlameMain.DEFAULT_MODEL_PARTICLE);
    Array<Model> models = new Array<Model>();
    models.add(defaultModel);
    int i = 0;
    JPanel panel = new JPanel(new GridBagLayout());
    EditorPanel.addContent(panel, i, 0, new JLabel("Shape"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0, 0);
    EditorPanel.addContent(panel, i++, 1, shapeCombo = new JComboBox(new DefaultComboBoxModel(spawnShapes)), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 1, 0);
    EditorPanel.addContent(panel, i, 0, edgesLabel = new JLabel("Edges"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0, 0);
    EditorPanel.addContent(panel, i++, 1, edgesCheckbox = new JCheckBox(), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0, 0);
    EditorPanel.addContent(panel, i, 0, sideLabel = new JLabel("Side"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0, 0);
    EditorPanel.addContent(panel, i++, 1, sideCombo = new JComboBox(new DefaultComboBoxModel(SpawnSide.values())), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 1, 0);
    edgesCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
    i = 0;
    addContent(i++, 0, panel, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL);
    addContent(i++, 0, meshPanel = new TemplatePickerPanel<Model>(editor, models, this, Model.class, new LoaderButton.ModelLoaderButton(editor), true, false), false, GridBagConstraints.WEST, GridBagConstraints.NONE);
    addContent(i++, 0, xPanel = new RangedNumericPanel(editor, pointSpawnShapeValue.xOffsetValue, "X Offset", "Amount to offset a particle's starting X location, in world units.", false));
    addContent(i++, 0, yPanel = new RangedNumericPanel(editor, pointSpawnShapeValue.yOffsetValue, "Y Offset", "Amount to offset a particle's starting Y location, in world units.", false));
    addContent(i++, 0, zPanel = new RangedNumericPanel(editor, pointSpawnShapeValue.zOffsetValue, "Z Offset", "Amount to offset a particle's starting Z location, in world units.", false));
    addContent(i++, 0, widthPanel = new ScaledNumericPanel(editor, pointSpawnShapeValue.getSpawnWidth(), "Duration", "Spawn Width", "Width of the spawn shape, in world units.", true));
    addContent(i++, 0, heightPanel = new ScaledNumericPanel(editor, pointSpawnShapeValue.getSpawnWidth(), "Duration", "Spawn Height", "Height of the spawn shape, in world units.", true));
    addContent(i++, 0, depthPanel = new ScaledNumericPanel(editor, pointSpawnShapeValue.getSpawnWidth(), "Duration", "Spawn Depth", "Depth of the spawn shape, in world units.", true), false);
    meshPanel.setIsAlwayShown(true);
    onTemplateChecked(defaultModel, true);
    shapeCombo.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            String shape = (String) shapeCombo.getSelectedItem();
            if (shape == SPAWN_SHAPE_POINT) {
                setPrimitiveSpawnShape(pointSpawnShapeValue, false, null);
            } else if (shape == SPAWN_SHAPE_LINE) {
                setPrimitiveSpawnShape(lineSpawnShapeValue, false, null);
            } else if (shape == SPAWN_SHAPE_RECTANGLE) {
                setPrimitiveSpawnShape(rectangleSpawnShapeValue, true, null);
            } else if (shape == SPAWN_SHAPE_ELLIPSE) {
                setPrimitiveSpawnShape(ellipseSpawnShapeValue, true, ellipseSpawnShapeValue.getSide());
            } else if (shape == SPAWN_SHAPE_CYLINDER) {
                setPrimitiveSpawnShape(cylinderSpawnShapeValue, true, null);
            } else if (shape == SPAWN_SHAPE_MESH) {
                setMeshSpawnShape(meshSpawnShapeValue);
            } else if (shape == SPAWN_SHAPE_WEIGHT_MESH) {
                setMeshSpawnShape(weightMeshSpawnShapeValue);
            }
            editor.restart();
        }
    });
    edgesCheckbox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            SpawnInfluencer influencer = (SpawnInfluencer) editor.getEmitter().findInfluencer(SpawnInfluencer.class);
            PrimitiveSpawnShapeValue shapeValue = (PrimitiveSpawnShapeValue) influencer.spawnShapeValue;
            shapeValue.setEdges(edgesCheckbox.isSelected());
            setEdgesVisible(true);
        }
    });
    sideCombo.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            SpawnSide side = (SpawnSide) sideCombo.getSelectedItem();
            SpawnInfluencer influencer = (SpawnInfluencer) editor.getEmitter().findInfluencer(SpawnInfluencer.class);
            EllipseSpawnShapeValue shapeValue = (EllipseSpawnShapeValue) influencer.spawnShapeValue;
            shapeValue.setSide(side);
        }
    });
}
Also used : RectangleSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.RectangleSpawnShapeValue) JPanel(javax.swing.JPanel) PrimitiveSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PrimitiveSpawnShapeValue) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) CylinderSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.CylinderSpawnShapeValue) WeightMeshSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.WeightMeshSpawnShapeValue) SpawnInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer) JComboBox(javax.swing.JComboBox) SpawnSide(com.badlogic.gdx.graphics.g3d.particles.values.PrimitiveSpawnShapeValue.SpawnSide) JLabel(javax.swing.JLabel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue) Array(com.badlogic.gdx.utils.Array) JCheckBox(javax.swing.JCheckBox) EllipseSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.EllipseSpawnShapeValue) ActionListener(java.awt.event.ActionListener) UnweightedMeshSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.UnweightedMeshSpawnShapeValue) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Model(com.badlogic.gdx.graphics.g3d.Model) LineSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.LineSpawnShapeValue)

Example 3 with PointSpawnShapeValue

use of com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue in project libgdx by libgdx.

the class SpawnInfluencerPanel method setCurrentSpawnData.

private void setCurrentSpawnData(SpawnShapeValue spawnShapeValue) {
    SpawnShapeValue local = null;
    if (spawnShapeValue instanceof PointSpawnShapeValue)
        local = pointSpawnShapeValue;
    else if (spawnShapeValue instanceof LineSpawnShapeValue)
        local = lineSpawnShapeValue;
    else if (spawnShapeValue instanceof RectangleSpawnShapeValue)
        local = rectangleSpawnShapeValue;
    else if (spawnShapeValue instanceof EllipseSpawnShapeValue)
        local = ellipseSpawnShapeValue;
    else if (spawnShapeValue instanceof CylinderSpawnShapeValue)
        local = cylinderSpawnShapeValue;
    if (spawnShapeValue instanceof UnweightedMeshSpawnShapeValue)
        local = meshSpawnShapeValue;
    else if (spawnShapeValue instanceof WeightMeshSpawnShapeValue)
        local = weightMeshSpawnShapeValue;
    local.load(spawnShapeValue);
}
Also used : RectangleSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.RectangleSpawnShapeValue) EllipseSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.EllipseSpawnShapeValue) UnweightedMeshSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.UnweightedMeshSpawnShapeValue) WeightMeshSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.WeightMeshSpawnShapeValue) LineSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.LineSpawnShapeValue) LineSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.LineSpawnShapeValue) EllipseSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.EllipseSpawnShapeValue) UnweightedMeshSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.UnweightedMeshSpawnShapeValue) WeightMeshSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.WeightMeshSpawnShapeValue) RectangleSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.RectangleSpawnShapeValue) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue) SpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.SpawnShapeValue) PrimitiveSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PrimitiveSpawnShapeValue) CylinderSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.CylinderSpawnShapeValue) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue) CylinderSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.CylinderSpawnShapeValue)

Example 4 with PointSpawnShapeValue

use of com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue in project libgdx by libgdx.

the class EffectPanel method createDefaultBillboardController.

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);
}
Also used : DynamicsInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer) BillboardRenderer(com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer) RegularEmitter(com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter) DynamicsModifier(com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) ColorInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer) RegionInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer) SpawnInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer)

Example 5 with PointSpawnShapeValue

use of com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue in project libgdx by libgdx.

the class EffectPanel method createDefaultTemplateController.

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);
}
Also used : BillboardRenderer(com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer) ScaleInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer) RegularEmitter(com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter) ParticleController(com.badlogic.gdx.graphics.g3d.particles.ParticleController) ColorInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer) RegionInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer) SpawnInfluencer(com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer) PointSpawnShapeValue(com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue)

Aggregations

PointSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue)6 SpawnInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer)5 ParticleController (com.badlogic.gdx.graphics.g3d.particles.ParticleController)4 RegularEmitter (com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter)4 ColorInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer)4 RegionInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer)4 DynamicsInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer)3 ScaleInfluencer (com.badlogic.gdx.graphics.g3d.particles.influencers.ScaleInfluencer)3 BillboardRenderer (com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer)3 DynamicsModifier (com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier)2 CylinderSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.CylinderSpawnShapeValue)2 EllipseSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.EllipseSpawnShapeValue)2 LineSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.LineSpawnShapeValue)2 PrimitiveSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.PrimitiveSpawnShapeValue)2 RectangleSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.RectangleSpawnShapeValue)2 UnweightedMeshSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.UnweightedMeshSpawnShapeValue)2 WeightMeshSpawnShapeValue (com.badlogic.gdx.graphics.g3d.particles.values.WeightMeshSpawnShapeValue)2 Texture (com.badlogic.gdx.graphics.Texture)1 Model (com.badlogic.gdx.graphics.g3d.Model)1 Single (com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer.Single)1