Skip to content
Permalink
Browse files

Added particles 3d classes

  • Loading branch information
lordjone committed Feb 7, 2014
1 parent a7541d4 commit 4511e7ec6a9b828e8e09a5c8ca06a7725e55700e
Showing with 4,968 additions and 3 deletions.
  1. +1 −1 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor/Chart.java
  2. +1 −1 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor/Slider.java
  3. +74 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/CountPanel.java
  4. +56 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/DrawPanel.java
  5. +168 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/EditorPanel.java
  6. +349 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/EffectPanel.java
  7. +60 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/FacingPanel.java
  8. +105 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/ForcePanel.java
  9. +395 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/GradientPanel.java
  10. +113 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/ImagePanel.java
  11. +63 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/NumericPanel.java
  12. +122 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/OptionsPanel.java
  13. +551 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/ParticleEditor3D.java
  14. +91 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/PercentagePanel.java
  15. +105 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/RangedNumericPanel.java
  16. +228 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/ScaledNumericPanel.java
  17. +167 −0 extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor3d/SpawnPanel.java
  18. +68 −0 gdx/src/com/badlogic/gdx/assets/loaders/ParticleEffect3DLoader.java
  19. +22 −0 gdx/src/com/badlogic/gdx/graphics/g3d/particles/EmitObject.java
  20. +838 −0 gdx/src/com/badlogic/gdx/graphics/g3d/particles/Emitter.java
  21. +43 −0 gdx/src/com/badlogic/gdx/graphics/g3d/particles/Particle.java
  22. +243 −0 gdx/src/com/badlogic/gdx/graphics/g3d/particles/ParticleEffect.java
  23. +1,009 −0 gdx/src/com/badlogic/gdx/graphics/g3d/particles/ParticleEmitter.java
  24. +96 −1 gdx/src/com/badlogic/gdx/graphics/g3d/utils/ModelBuilder.java
@@ -30,7 +30,7 @@

import javax.swing.JPanel;

class Chart extends JPanel {
public class Chart extends JPanel {
static private final int POINT_SIZE = 6;
static private final int POINT_SIZE_EXPANDED = 10;

@@ -36,7 +36,7 @@
import javax.swing.event.ChangeListener;

// BOZO - Slider is a placeholder that uses a spinner until the slider (in NewSlider) is complete.
class Slider extends JPanel {
public class Slider extends JPanel {
private JSpinner spinner;

public Slider (float initialValue, final float min, final float max, float stepSize, final float sliderMin,
@@ -0,0 +1,74 @@
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package com.badlogic.gdx.tools.particleeditor3d;
import java.awt.GridBagConstraints;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import com.badlogic.gdx.tools.particleeditor.Slider;

class CountPanel extends EditorPanel {
Slider maxSlider, minSlider;

public CountPanel (final ParticleEditor3D editor, String name, String description) {
super(null, name, description);

initializeComponents();

maxSlider.setValue(editor.getEmitter().getMaxParticleCount());
maxSlider.addChangeListener(new ChangeListener() {
public void stateChanged (ChangeEvent event) {
editor.getEmitter().setMaxParticleCount((int)maxSlider.getValue());
}
});

minSlider.setValue(editor.getEmitter().getMinParticleCount());
minSlider.addChangeListener(new ChangeListener() {
public void stateChanged (ChangeEvent event) {
editor.getEmitter().setMinParticleCount((int)minSlider.getValue());
}
});
}

private void initializeComponents () {
JPanel contentPanel = getContentPanel();
{
JLabel label = new JLabel("Min:");
contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 6), 0, 0));
}
{
minSlider = new Slider(0, 0, 99999, 1, 0, 500);
contentPanel.add(minSlider, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
}
{
JLabel label = new JLabel("Max:");
contentPanel.add(label, new GridBagConstraints(2, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(0, 12, 0, 6), 0, 0));
}
{
maxSlider = new Slider(0, 0, 99999, 1, 0, 500);
contentPanel.add(maxSlider, new GridBagConstraints(3, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
}
}
}
@@ -0,0 +1,56 @@
package com.badlogic.gdx.tools.particleeditor3d;

import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class DrawPanel extends EditorPanel
{
JCheckBox drawXYZCheckBox,
drawXZPlaneBox;

public DrawPanel (final ParticleEditor3D editor, String name, String description) {
super(null, name, description);

initializeComponents();

drawXYZCheckBox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
editor.getRenderer().setDrawXYZ(drawXYZCheckBox.isSelected());
}
});
drawXYZCheckBox.setSelected(editor.getRenderer().IsDrawXYZ());

drawXZPlaneBox.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
editor.getRenderer().setDrawXZPlane(drawXZPlaneBox.isSelected());
}
});
drawXZPlaneBox.setSelected(editor.getRenderer().IsDrawXZPlane());
}

private void initializeComponents ()
{
JPanel contentPanel = getContentPanel();

//XYZ
contentPanel.add(new JLabel("XYZ:"), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
drawXYZCheckBox = new JCheckBox();
contentPanel.add(drawXYZCheckBox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));

//XZ Plane
contentPanel.add(new JLabel("XZ Plane:"), new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(6, 0, 0, 0), 0, 0));
drawXZPlaneBox = new JCheckBox();
contentPanel.add(drawXZPlaneBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));

}
}
@@ -0,0 +1,168 @@
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/

package com.badlogic.gdx.tools.particleeditor3d;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JToggleButton;

import com.badlogic.gdx.graphics.g3d.particles.Emitter.ParticleValue;


class EditorPanel extends JPanel {
private final String name;
private final String description;
private final ParticleValue value;
private JPanel titlePanel;
JToggleButton activeButton;
private JPanel contentPanel;
JToggleButton advancedButton;
JPanel advancedPanel;
private boolean hasAdvanced;
JLabel descriptionLabel;
private boolean isAlwaysActive;

public EditorPanel (ParticleValue value, String name, String description) {
this(value, name, description, true);
}

public EditorPanel (ParticleValue value, String name, String description, boolean alwaysActive) {
this.name = name;
this.value = value;
this.description = description;

initializeComponents();

titlePanel.addMouseListener(new MouseAdapter() {
public void mouseClicked (MouseEvent event) {
if (!activeButton.isVisible()) return;
activeButton.setSelected(!activeButton.isSelected());
updateActive();
}
});
activeButton.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
updateActive();
}
});
advancedButton.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent event) {
advancedPanel.setVisible(advancedButton.isSelected());
}
});

if (value != null) {
activeButton.setSelected(value.isActive());
updateActive();
}

isAlwaysActive = value == null ? true : alwaysActive;
activeButton.setVisible(!isAlwaysActive);
if (isAlwaysActive) contentPanel.setVisible(true);
if (isAlwaysActive) titlePanel.setCursor(null);
}

void updateActive () {
contentPanel.setVisible(activeButton.isSelected());
advancedPanel.setVisible(activeButton.isSelected() && advancedButton.isSelected());
advancedButton.setVisible(activeButton.isSelected() && hasAdvanced);
descriptionLabel.setText(activeButton.isSelected() ? description : "");
if (value != null) value.setActive(activeButton.isSelected());
}

public void update (ParticleEditor3D editor) {
}

public void setHasAdvanced (boolean hasAdvanced) {
this.hasAdvanced = hasAdvanced;
advancedButton.setVisible(hasAdvanced && (value.isActive() || isAlwaysActive));
}

public JPanel getContentPanel () {
return contentPanel;
}

public JPanel getAdvancedPanel () {
return advancedPanel;
}

public String getName () {
return name;
}

public void setEmbedded () {
GridBagLayout layout = (GridBagLayout)getLayout();
GridBagConstraints constraints = layout.getConstraints(contentPanel);
constraints.insets = new Insets(0, 0, 0, 0);
layout.setConstraints(contentPanel, constraints);

titlePanel.setVisible(false);
}

private void initializeComponents () {
setLayout(new GridBagLayout());
{
titlePanel = new JPanel(new GridBagLayout());
add(titlePanel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
new Insets(3, 0, 3, 0), 0, 0));
titlePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
{
JLabel label = new JLabel(name);
titlePanel.add(label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(3, 6, 3, 6), 0, 0));
label.setFont(label.getFont().deriveFont(Font.BOLD));
}
{
descriptionLabel = new JLabel(description);
titlePanel.add(descriptionLabel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(3, 6, 3, 6), 0, 0));
}
{
advancedButton = new JToggleButton("Advanced");
titlePanel.add(advancedButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
advancedButton.setVisible(false);
}
{
activeButton = new JToggleButton("Active");
titlePanel.add(activeButton, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
}
}
{
contentPanel = new JPanel(new GridBagLayout());
add(contentPanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 6, 6, 6), 0, 0));
contentPanel.setVisible(false);
}
{
advancedPanel = new JPanel(new GridBagLayout());
add(advancedPanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(0, 6, 6, 6), 0, 0));
advancedPanel.setVisible(false);
}
}
}

0 comments on commit 4511e7e

Please sign in to comment.
You can’t perform that action at this time.