option to flip texture's Y for skyFactory in SDK

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9343 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 13 years ago
parent f9593adee1
commit a5c8cb8ead
  1. 9
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/AddSkyboxAction.java
  2. 1
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/Bundle.properties
  3. 16
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.form
  4. 16
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java
  5. 1
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxWizardPanel2.java

@ -4,6 +4,7 @@
*/ */
package com.jme3.gde.terraineditor.sky; package com.jme3.gde.terraineditor.sky;
import com.jme3.asset.TextureKey;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialWizardAction; import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractNewSpatialWizardAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewSpatialAction; import com.jme3.gde.core.sceneexplorer.nodes.actions.NewSpatialAction;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
@ -68,7 +69,13 @@ public class AddSkyboxAction extends AbstractNewSpatialWizardAction {
Texture textureSingle = (Texture) wiz.getProperty("textureSingle"); Texture textureSingle = (Texture) wiz.getProperty("textureSingle");
Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale"); Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
boolean useSpheremap = (Boolean) wiz.getProperty("useSpheremap"); boolean useSpheremap = (Boolean) wiz.getProperty("useSpheremap");
return SkyFactory.createSky(pm, textureSingle, normalScale, useSpheremap); 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);
} }
} }

@ -31,3 +31,4 @@ SkyboxVisualPanel2.westPic.text=
SkyboxVisualPanel2.topPic.text= SkyboxVisualPanel2.topPic.text=
SkyboxVisualPanel2.bottomPic.text= SkyboxVisualPanel2.bottomPic.text=
SkyboxVisualPanel2.singlePic.text= SkyboxVisualPanel2.singlePic.text=
SkyboxVisualPanel2.flipYcheckBox.text=Flip Y

@ -391,7 +391,10 @@
<EmptySpace min="6" pref="6" max="-2" attributes="0"/> <EmptySpace min="6" pref="6" max="-2" attributes="0"/>
<Component id="normal2Z" min="-2" pref="21" max="-2" attributes="1"/> <Component id="normal2Z" min="-2" pref="21" max="-2" attributes="1"/>
</Group> </Group>
<Component id="spheremapCheckBox" alignment="0" min="-2" max="-2" attributes="0"/> <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> </Group>
<EmptySpace pref="31" max="32767" attributes="0"/> <EmptySpace pref="31" max="32767" attributes="0"/>
</Group> </Group>
@ -418,7 +421,9 @@
</Group> </Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="spheremapCheckBox" min="-2" max="-2" attributes="0"/> <Component id="spheremapCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="98" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="flipYcheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="75" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -483,6 +488,13 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<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.flipYcheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
</SubComponents> </SubComponents>

@ -142,6 +142,7 @@ public final class SkyboxVisualPanel2 extends JPanel {
normal2Z = new javax.swing.JTextField(); normal2Z = new javax.swing.JTextField();
spheremapCheckBox = new javax.swing.JCheckBox(); spheremapCheckBox = new javax.swing.JCheckBox();
singlePic = new javax.swing.JLabel(); singlePic = new javax.swing.JLabel();
flipYcheckBox = new javax.swing.JCheckBox();
titleLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); titleLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.titleLabel.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(titleLabel, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.titleLabel.text")); // NOI18N
@ -349,6 +350,8 @@ public final class SkyboxVisualPanel2 extends JPanel {
org.openide.awt.Mnemonics.setLocalizedText(singlePic, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.singlePic.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
javax.swing.GroupLayout singleTexturePanelLayout = new javax.swing.GroupLayout(singleTexturePanel); javax.swing.GroupLayout singleTexturePanelLayout = new javax.swing.GroupLayout(singleTexturePanel);
singleTexturePanel.setLayout(singleTexturePanelLayout); singleTexturePanel.setLayout(singleTexturePanelLayout);
singleTexturePanelLayout.setHorizontalGroup( singleTexturePanelLayout.setHorizontalGroup(
@ -370,7 +373,9 @@ public final class SkyboxVisualPanel2 extends JPanel {
.addComponent(normal2Y, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(normal2Y, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6) .addGap(6, 6, 6)
.addComponent(normal2Z, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(normal2Z, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(spheremapCheckBox)) .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)) .addContainerGap(31, Short.MAX_VALUE))
); );
singleTexturePanelLayout.setVerticalGroup( singleTexturePanelLayout.setVerticalGroup(
@ -390,7 +395,9 @@ public final class SkyboxVisualPanel2 extends JPanel {
.addComponent(jLabel9)))) .addComponent(jLabel9))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(spheremapCheckBox) .addComponent(spheremapCheckBox)
.addContainerGap(98, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(flipYcheckBox)
.addContainerGap(75, Short.MAX_VALUE))
); );
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -561,6 +568,7 @@ public final class SkyboxVisualPanel2 extends JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel bottomPic; private javax.swing.JLabel bottomPic;
private javax.swing.JLabel eastPic; private javax.swing.JLabel eastPic;
private javax.swing.JCheckBox flipYcheckBox;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel3;
@ -621,4 +629,8 @@ public final class SkyboxVisualPanel2 extends JPanel {
public JCheckBox getSpheremapCheckBox() { public JCheckBox getSpheremapCheckBox() {
return spheremapCheckBox; return spheremapCheckBox;
} }
public JCheckBox getFlipYCheckBox() {
return flipYcheckBox;
}
} }

@ -143,6 +143,7 @@ public class SkyboxWizardPanel2 implements WizardDescriptor.Panel {
float z = new Float(comp.getNormal2Z().getText()); float z = new Float(comp.getNormal2Z().getText());
wiz.putProperty("normalScale", new Vector3f(x,y,z) ); wiz.putProperty("normalScale", new Vector3f(x,y,z) );
wiz.putProperty("useSpheremap", comp.getSpheremapCheckBox().isSelected()); wiz.putProperty("useSpheremap", comp.getSpheremapCheckBox().isSelected());
wiz.putProperty("flipY", comp.getFlipYCheckBox().isSelected());
} }
} }
} }

Loading…
Cancel
Save