diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/AddSkyboxAction.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/AddSkyboxAction.java index b92aed679..146f1eb17 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/AddSkyboxAction.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/AddSkyboxAction.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); } } diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/Bundle.properties b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/Bundle.properties index 794a01ca7..550d79478 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/Bundle.properties +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/Bundle.properties @@ -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 diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.form b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.form index 291361d1e..26439c888 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.form +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.form @@ -1,4 +1,4 @@ - +
@@ -127,7 +127,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -376,11 +376,17 @@ + - + + + + + + - + @@ -391,12 +397,8 @@ - - - - - + @@ -420,7 +422,10 @@ - + + + + @@ -474,24 +479,39 @@ - + - + - + - + - + + + + + + + + + + + + + + + + - + diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java index 7abe313dd..754f5e933 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java @@ -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 model = new DefaultComboBoxModel(); + 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; } diff --git a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxWizardPanel2.java b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxWizardPanel2.java index 67ab8e0f7..267751ab4 100644 --- a/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxWizardPanel2.java +++ b/sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxWizardPanel2.java @@ -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()); } }