Updated the create skybox gui in the SDK so that it fits the new API and supports loading equirect Skybox maps.

cleanup_build_scripts
Nehon 9 years ago
parent 40177c1524
commit 5cb72c6582
  1. 8
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/AddSkyboxAction.java
  2. 2
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/Bundle.properties
  3. 54
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.form
  4. 63
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java
  5. 3
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxWizardPanel2.java

@ -69,14 +69,16 @@ public class AddSkyboxAction extends AbstractNewSpatialWizardAction {
} else {
Texture textureSingle = (Texture) wiz.getProperty("textureSingle");
Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
boolean useSpheremap = (Boolean) wiz.getProperty("useSpheremap");
SkyFactory.EnvMapType type = (SkyFactory.EnvMapType) wiz.getProperty("envMapType");
boolean flipY = (Boolean) wiz.getProperty("flipY");
// reload the texture so we can use flipY
TextureKey key = (TextureKey) textureSingle.getKey();
TextureKey newKey = new TextureKey(key.getName(), flipY);
newKey.setGenerateMips(true);
newKey.setAsCube(!useSpheremap);
return SkyFactory.createSky(pm, pm.loadTexture(newKey), normalScale, useSpheremap);
if(type == SkyFactory.EnvMapType.CubeMap){
newKey.setTextureTypeHint(Texture.Type.CubeMap);
}
return SkyFactory.createSky(pm, pm.loadTexture(newKey), normalScale, type);
}
}

@ -17,7 +17,6 @@ SkyboxVisualPanel2.multipleTexWestLoadButton.text=Load
SkyboxVisualPanel2.multipleTexTopLoadButton.text=Load
SkyboxVisualPanel2.multipleTexBottomLoadButton.text=Load
SkyboxVisualPanel2.jLabel9.text=Normal Scale (x,y,z):
SkyboxVisualPanel2.spheremapCheckBox.text=Sphere map
SkyboxVisualPanel2.normal1X.text=1
SkyboxVisualPanel2.normal1Y.text=1
SkyboxVisualPanel2.normal1Z.text=1
@ -32,3 +31,4 @@ SkyboxVisualPanel2.topPic.text=
SkyboxVisualPanel2.bottomPic.text=
SkyboxVisualPanel2.singlePic.text=
SkyboxVisualPanel2.flipYcheckBox.text=Flip Y
SkyboxVisualPanel2.jLabel10.text=Map type

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
@ -127,7 +127,7 @@
</Group>
</Group>
</Group>
<EmptySpace pref="27" max="32767" attributes="0"/>
<EmptySpace pref="29" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -172,7 +172,7 @@
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="multipleTexTopLoadButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="westPic" min="-2" pref="20" max="-2" attributes="0"/>
@ -376,11 +376,17 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="flipYcheckBox" alignment="0" min="-2" pref="100" max="-2" attributes="1"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="mapTypeCombo" min="-2" pref="166" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Component id="singleTexLoadButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="singlePic" min="-2" pref="20" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
@ -391,12 +397,8 @@
<EmptySpace min="6" pref="6" max="-2" attributes="0"/>
<Component id="normal2Z" min="-2" pref="21" max="-2" attributes="1"/>
</Group>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="flipYcheckBox" alignment="1" max="32767" attributes="1"/>
<Component id="spheremapCheckBox" alignment="1" max="32767" attributes="1"/>
</Group>
</Group>
<EmptySpace pref="31" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -420,7 +422,10 @@
</Group>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="spheremapCheckBox" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="mapTypeCombo" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="flipYcheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="75" max="32767" attributes="0"/>
@ -474,24 +479,39 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="spheremapCheckBox">
<Component class="javax.swing.JLabel" name="singlePic">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/terraineditor/sky/Bundle.properties" key="SkyboxVisualPanel2.spheremapCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/terraineditor/sky/Bundle.properties" key="SkyboxVisualPanel2.singlePic.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="singlePic">
<Component class="javax.swing.JCheckBox" name="flipYcheckBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/terraineditor/sky/Bundle.properties" key="SkyboxVisualPanel2.singlePic.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/terraineditor/sky/Bundle.properties" key="SkyboxVisualPanel2.flipYcheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="flipYcheckBox">
<Component class="javax.swing.JComboBox" name="mapTypeCombo">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mapTypeComboActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/terraineditor/sky/Bundle.properties" key="SkyboxVisualPanel2.flipYcheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/terraineditor/sky/Bundle.properties" key="SkyboxVisualPanel2.jLabel10.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>

@ -36,9 +36,13 @@ import com.jme3.gde.core.properties.TexturePropertyEditor;
import com.jme3.gde.core.properties.preview.DDSPreview;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.texture.Texture;
import com.jme3.util.SkyFactory;
import java.awt.Component;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;
import jme3tools.converters.ImageToAwt;
@ -51,6 +55,12 @@ public final class SkyboxVisualPanel2 extends JPanel {
/** Creates new form SkyboxVisualPanel2 */
public SkyboxVisualPanel2() {
initComponents();
DefaultComboBoxModel<SkyFactory.EnvMapType> model = new DefaultComboBoxModel<SkyFactory.EnvMapType>();
for (SkyFactory.EnvMapType value : SkyFactory.EnvMapType.values()) {
model.addElement(value);
}
mapTypeCombo.setModel(model);
}
@Override
@ -140,11 +150,12 @@ public final class SkyboxVisualPanel2 extends JPanel {
normal2X = new javax.swing.JTextField();
normal2Y = new javax.swing.JTextField();
normal2Z = new javax.swing.JTextField();
spheremapCheckBox = new javax.swing.JCheckBox();
singlePic = new javax.swing.JLabel();
flipYcheckBox = new javax.swing.JCheckBox();
mapTypeCombo = new javax.swing.JComboBox();
jLabel10 = new javax.swing.JLabel();
titleLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
titleLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.titleLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.jLabel1.text")); // NOI18N
@ -279,7 +290,7 @@ public final class SkyboxVisualPanel2 extends JPanel {
.addComponent(multipleTexTopLoadButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(topPic, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap(27, Short.MAX_VALUE))
.addContainerGap(29, Short.MAX_VALUE))
);
multipleTexturePanelLayout.setVerticalGroup(
multipleTexturePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -315,7 +326,7 @@ public final class SkyboxVisualPanel2 extends JPanel {
.addGroup(multipleTexturePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(multipleTexTopLoadButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(multipleTexturePanelLayout.createSequentialGroup()
.addComponent(westPic, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@ -346,12 +357,19 @@ public final class SkyboxVisualPanel2 extends JPanel {
normal2Z.setText(org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.normal2Z.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(spheremapCheckBox, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.spheremapCheckBox.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(singlePic, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.singlePic.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(flipYcheckBox, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.flipYcheckBox.text")); // NOI18N
mapTypeCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
mapTypeCombo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mapTypeComboActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel10, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.jLabel10.text")); // NOI18N
javax.swing.GroupLayout singleTexturePanelLayout = new javax.swing.GroupLayout(singleTexturePanel);
singleTexturePanel.setLayout(singleTexturePanelLayout);
singleTexturePanelLayout.setHorizontalGroup(
@ -359,11 +377,16 @@ public final class SkyboxVisualPanel2 extends JPanel {
.addGroup(singleTexturePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(singleTexturePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(flipYcheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(singleTexturePanelLayout.createSequentialGroup()
.addComponent(jLabel8)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mapTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(singleTexturePanelLayout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(21, 21, 21)
.addComponent(singleTexLoadButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGap(2, 2, 2)
.addComponent(singlePic, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(39, 39, 39)
.addComponent(jLabel9)
@ -372,11 +395,8 @@ public final class SkyboxVisualPanel2 extends JPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(normal2Y, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addComponent(normal2Z, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(singleTexturePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(flipYcheckBox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(spheremapCheckBox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap(31, Short.MAX_VALUE))
.addComponent(normal2Z, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
singleTexturePanelLayout.setVerticalGroup(
singleTexturePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -394,7 +414,9 @@ public final class SkyboxVisualPanel2 extends JPanel {
.addComponent(normal2Z, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(spheremapCheckBox)
.addGroup(singleTexturePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(mapTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel10))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(flipYcheckBox)
.addContainerGap(75, Short.MAX_VALUE))
@ -565,11 +587,17 @@ public final class SkyboxVisualPanel2 extends JPanel {
}
}
}//GEN-LAST:event_singleTexLoadButtonActionPerformed
private void mapTypeComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mapTypeComboActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_mapTypeComboActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel bottomPic;
private javax.swing.JLabel eastPic;
private javax.swing.JCheckBox flipYcheckBox;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
@ -578,6 +606,7 @@ public final class SkyboxVisualPanel2 extends JPanel {
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JComboBox mapTypeCombo;
private javax.swing.JButton multipleTexBottomLoadButton;
private javax.swing.JButton multipleTexEastLoadButton;
private javax.swing.JButton multipleTexNorthLoadButton;
@ -596,7 +625,6 @@ public final class SkyboxVisualPanel2 extends JPanel {
private javax.swing.JButton singleTexLoadButton;
private javax.swing.JPanel singleTexturePanel;
private javax.swing.JLabel southPic;
private javax.swing.JCheckBox spheremapCheckBox;
private javax.swing.JLabel titleLabel;
private javax.swing.JLabel topPic;
private javax.swing.JLabel westPic;
@ -626,10 +654,11 @@ public final class SkyboxVisualPanel2 extends JPanel {
return normal2Z;
}
public JCheckBox getSpheremapCheckBox() {
return spheremapCheckBox;
public SkyFactory.EnvMapType getEnvMapType(){
return (SkyFactory.EnvMapType)mapTypeCombo.getSelectedItem();
}
public JCheckBox getFlipYCheckBox() {
return flipYcheckBox;
}

@ -123,6 +123,7 @@ public class SkyboxWizardPanel2 implements WizardDescriptor.Panel {
}
}
@Override
public void storeSettings(Object settings) {
WizardDescriptor wiz = (WizardDescriptor) settings;
SkyboxVisualPanel2 comp = (SkyboxVisualPanel2) getComponent();
@ -143,7 +144,7 @@ public class SkyboxWizardPanel2 implements WizardDescriptor.Panel {
float y = new Float(comp.getNormal2Y().getText());
float z = new Float(comp.getNormal2Z().getText());
wiz.putProperty("normalScale", new Vector3f(x,y,z) );
wiz.putProperty("useSpheremap", comp.getSpheremapCheckBox().isSelected());
wiz.putProperty("envMapType", comp.getEnvMapType());
wiz.putProperty("flipY", comp.getFlipYCheckBox().isSelected());
}
}

Loading…
Cancel
Save