use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.
the class DynamicsInfluencerPanel method createVelocity.
protected void createVelocity(Object selectedItem) {
//Add the velocity to the table and to the influencer
ParticleController controller = editor.getEmitter();
DynamicsInfluencer influencer = (DynamicsInfluencer) controller.findInfluencer(DynamicsInfluencer.class);
VelocityWrapper wrapper = new VelocityWrapper(createVelocityValue(selectedItem), true);
velocities.add(wrapper);
influencer.velocities.add(wrapper.velocityValue);
int index = velocities.size - 1;
velocityTableModel.addRow(new Object[] { "Velocity " + index, true });
//Reinit
editor.restart();
//Select new velocity
velocityTable.getSelectionModel().setSelectionInterval(index, index);
revalidate();
repaint();
}
use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.
the class ParticleControllerFinalizerInfluencer method update.
@Override
public void update() {
for (int i = 0, positionOffset = 0, c = controller.particles.size; i < c; ++i, positionOffset += positionChannel.strideSize) {
ParticleController particleController = controllerChannel.data[i];
float scale = hasScale ? scaleChannel.data[i] : 1;
float qx = 0, qy = 0, qz = 0, qw = 1;
if (hasRotation) {
int rotationOffset = i * rotationChannel.strideSize;
qx = rotationChannel.data[rotationOffset + ParticleChannels.XOffset];
qy = rotationChannel.data[rotationOffset + ParticleChannels.YOffset];
qz = rotationChannel.data[rotationOffset + ParticleChannels.ZOffset];
qw = rotationChannel.data[rotationOffset + ParticleChannels.WOffset];
}
particleController.setTransform(positionChannel.data[positionOffset + ParticleChannels.XOffset], positionChannel.data[positionOffset + ParticleChannels.YOffset], positionChannel.data[positionOffset + ParticleChannels.ZOffset], qx, qy, qz, qw, scale);
particleController.update();
}
}
use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.
the class ParticleControllerTest method addEmitter.
private void addEmitter(float[] colors, Texture particleTexture, Vector3 translation, Vector3 actionAxis, float actionRotation) {
ParticleController controller = createBillboardController(colors, particleTexture);
controller.init();
controller.start();
emitters.add(controller);
controller.translate(translation);
ui.addAction(new RotationAction(controller, actionAxis, actionRotation));
}
use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.
the class ParticleControllerTest method createBillboardController.
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);
}
use of com.badlogic.gdx.graphics.g3d.particles.ParticleController in project libgdx by libgdx.
the class FlameMain method initializeComponents.
private void initializeComponents() {
splitPane = new JSplitPane();
splitPane.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
splitPane.setDividerSize(4);
getContentPane().add(splitPane, BorderLayout.CENTER);
{
JSplitPane rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
rightSplit.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
rightSplit.setDividerSize(4);
splitPane.add(rightSplit, JSplitPane.RIGHT);
{
JPanel propertiesPanel = new JPanel(new GridBagLayout());
rightSplit.add(propertiesPanel, JSplitPane.TOP);
propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory.createTitledBorder("Editor Properties")));
{
JScrollPane scroll = new JScrollPane();
propertiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
{
editorPropertiesPanel = new JPanel(new GridBagLayout());
scroll.setViewportView(editorPropertiesPanel);
scroll.getVerticalScrollBar().setUnitIncrement(70);
}
}
}
{
JSplitPane rightSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
rightSplitPane.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
rightSplitPane.setDividerSize(4);
rightSplitPane.setDividerLocation(100);
rightSplit.add(rightSplitPane, JSplitPane.BOTTOM);
JPanel propertiesPanel = new JPanel(new GridBagLayout());
rightSplitPane.add(propertiesPanel, JSplitPane.TOP);
propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory.createTitledBorder("Influencers")));
{
JScrollPane scroll = new JScrollPane();
propertiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
{
JPanel influencersPanel = new JPanel(new GridBagLayout());
influencerBox = new JComboBox(new DefaultComboBoxModel());
JButton addInfluencerButton = new JButton("Add");
addInfluencerButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
InfluencerWrapper wrapper = (InfluencerWrapper) influencerBox.getSelectedItem();
ParticleController controller = getEmitter();
if (controller != null)
addInfluencer(wrapper.type, controller);
}
});
influencersPanel.add(influencerBox, new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
influencersPanel.add(addInfluencerButton, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
scroll.setViewportView(influencersPanel);
scroll.getVerticalScrollBar().setUnitIncrement(70);
}
}
propertiesPanel = new JPanel(new GridBagLayout());
rightSplitPane.add(propertiesPanel, JSplitPane.BOTTOM);
propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory.createTitledBorder("Particle Controller Components")));
{
JScrollPane scroll = new JScrollPane();
propertiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
{
controllerPropertiesPanel = new JPanel(new GridBagLayout());
scroll.setViewportView(controllerPropertiesPanel);
scroll.getVerticalScrollBar().setUnitIncrement(70);
}
}
}
rightSplit.setDividerLocation(250);
}
{
JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
leftSplit.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
leftSplit.setDividerSize(4);
splitPane.add(leftSplit, JSplitPane.LEFT);
{
JPanel spacer = new JPanel(new BorderLayout());
leftSplit.add(spacer, JSplitPane.TOP);
spacer.add(lwjglCanvas.getCanvas());
spacer.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4));
}
{
JPanel emittersPanel = new JPanel(new BorderLayout());
leftSplit.add(emittersPanel, JSplitPane.BOTTOM);
emittersPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(0, 6, 6, 0), BorderFactory.createTitledBorder("Particle Controllers")));
{
effectPanel = new EffectPanel(this);
emittersPanel.add(effectPanel);
}
}
leftSplit.setDividerLocation(625);
}
splitPane.setDividerLocation(500);
}
Aggregations