Răsfoiți Sursa

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
bre..ns 13 ani în urmă
părinte
comite
86766eb1d0

+ 8 - 1
jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/AddSkyboxAction.java

@@ -4,6 +4,7 @@
  */
 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.NewSpatialAction;
 import com.jme3.math.Vector3f;
@@ -68,7 +69,13 @@ public class AddSkyboxAction extends AbstractNewSpatialWizardAction {
             Texture textureSingle = (Texture) wiz.getProperty("textureSingle");
             Vector3f normalScale = (Vector3f) wiz.getProperty("normalScale");
             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);
         }
     }
 

+ 1 - 0
jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/Bundle.properties

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

+ 14 - 2
jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.form

@@ -391,7 +391,10 @@
                           <EmptySpace min="6" pref="6" max="-2" attributes="0"/>
                           <Component id="normal2Z" min="-2" pref="21" max="-2" attributes="1"/>
                       </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>
                   <EmptySpace pref="31" max="32767" attributes="0"/>
               </Group>
@@ -418,7 +421,9 @@
                   </Group>
                   <EmptySpace type="unrelated" 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>
         </DimensionLayout>
@@ -483,6 +488,13 @@
             </Property>
           </Properties>
         </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>
     </Container>
   </SubComponents>

+ 14 - 2
jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java

@@ -142,6 +142,7 @@ public final class SkyboxVisualPanel2 extends JPanel {
         normal2Z = new javax.swing.JTextField();
         spheremapCheckBox = new javax.swing.JCheckBox();
         singlePic = new javax.swing.JLabel();
+        flipYcheckBox = new javax.swing.JCheckBox();
 
         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
@@ -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(flipYcheckBox, org.openide.util.NbBundle.getMessage(SkyboxVisualPanel2.class, "SkyboxVisualPanel2.flipYcheckBox.text")); // NOI18N
+
         javax.swing.GroupLayout singleTexturePanelLayout = new javax.swing.GroupLayout(singleTexturePanel);
         singleTexturePanel.setLayout(singleTexturePanelLayout);
         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)
                         .addGap(6, 6, 6)
                         .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))
         );
         singleTexturePanelLayout.setVerticalGroup(
@@ -390,7 +395,9 @@ public final class SkyboxVisualPanel2 extends JPanel {
                             .addComponent(jLabel9))))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                 .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);
@@ -561,6 +568,7 @@ public final class SkyboxVisualPanel2 extends JPanel {
     // 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 jLabel2;
     private javax.swing.JLabel jLabel3;
@@ -621,4 +629,8 @@ public final class SkyboxVisualPanel2 extends JPanel {
     public JCheckBox getSpheremapCheckBox() {
         return spheremapCheckBox;
     }
+    
+    public JCheckBox getFlipYCheckBox() {
+        return flipYcheckBox;
+    }
 }

+ 1 - 0
jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxWizardPanel2.java

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