r3635 - trunk/tools/ImgToMap/src/imgtomap
savagex at icculus.org
savagex at icculus.org
Sun May 18 09:13:48 EDT 2008
Author: savagex
Date: 2008-05-18 09:13:47 -0400 (Sun, 18 May 2008)
New Revision: 3635
Modified:
trunk/tools/ImgToMap/src/imgtomap/JFrameMain.form
trunk/tools/ImgToMap/src/imgtomap/JFrameMain.java
trunk/tools/ImgToMap/src/imgtomap/MapWriter.java
trunk/tools/ImgToMap/src/imgtomap/Parameters.java
Log:
autogenerate skybox, fill dropped blocks with full-height sky (first step to autogenerate vis-blockers)
Modified: trunk/tools/ImgToMap/src/imgtomap/JFrameMain.form
===================================================================
--- trunk/tools/ImgToMap/src/imgtomap/JFrameMain.form 2008-05-18 10:49:15 UTC (rev 3634)
+++ trunk/tools/ImgToMap/src/imgtomap/JFrameMain.form 2008-05-18 13:13:47 UTC (rev 3635)
@@ -22,10 +22,28 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" alignment="1" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="103" alignment="1" groupAlignment="1" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jPanelSky" max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jPanel2" max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jPanel1" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jButtonOK" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
<EmptySpace max="-2" attributes="0"/>
- <Component id="jPanel1" max="32767" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -33,8 +51,14 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="jPanel1" max="32767" attributes="0"/>
+ <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
+ <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jPanelSky" min="-2" pref="157" max="-2" attributes="0"/>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="jButtonOK" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -44,7 +68,7 @@
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
- <TitledBorder title="Convert image to map"/>
+ <TitledBorder title="Files"/>
</Border>
</Property>
</Properties>
@@ -53,41 +77,17 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
- <EmptySpace max="-2" attributes="0"/>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="jTextFieldOutput" alignment="0" pref="278" max="32767" attributes="2"/>
+ <Component id="jTextFieldInput" alignment="0" pref="278" max="32767" attributes="2"/>
+ </Group>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="jTextFieldTexture" alignment="0" pref="465" max="32767" attributes="0"/>
- <Component id="jButtonOK" alignment="0" min="-2" max="-2" attributes="0"/>
- <Group type="102" alignment="0" attributes="0">
- <Group type="103" groupAlignment="0" attributes="0">
- <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
- <Component id="jSpinnerUnits" alignment="0" min="-2" max="-2" attributes="1"/>
- </Group>
- <EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
- <Group type="103" groupAlignment="0" attributes="0">
- <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
- <Component id="jSpinnerHeight" alignment="0" min="-2" max="-2" attributes="1"/>
- </Group>
- <EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
- <Group type="103" groupAlignment="0" max="-2" attributes="0">
- <Component id="jSpinnerTextureScale" max="32767" attributes="1"/>
- <Component id="jLabel4" alignment="0" max="32767" attributes="1"/>
- </Group>
- </Group>
- <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
- <Component id="jCheckBoxDetail" alignment="0" min="-2" max="-2" attributes="0"/>
- <Group type="102" alignment="0" attributes="0">
- <Group type="103" groupAlignment="1" max="-2" attributes="0">
- <Component id="jTextFieldOutput" alignment="0" max="32767" attributes="1"/>
- <Component id="jTextFieldInput" alignment="0" pref="313" max="32767" attributes="1"/>
- </Group>
- <EmptySpace max="-2" attributes="0"/>
- <Group type="103" groupAlignment="0" attributes="0">
- <Component id="jButtonInput" alignment="0" pref="146" max="32767" attributes="2"/>
- <Component id="jButtonOutput" pref="146" max="32767" attributes="2"/>
- </Group>
- </Group>
+ <Component id="jButtonInput" alignment="1" pref="120" max="32767" attributes="2"/>
+ <Component id="jButtonOutput" alignment="1" max="32767" attributes="2"/>
</Group>
- <EmptySpace max="-2" attributes="0"/>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -104,27 +104,7 @@
<Component id="jButtonOutput" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextFieldOutput" alignment="3" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
- <EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
- <Group type="103" groupAlignment="3" attributes="0">
- <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
- <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
- <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
- </Group>
- <EmptySpace max="-2" attributes="0"/>
- <Group type="103" groupAlignment="3" attributes="0">
- <Component id="jSpinnerUnits" alignment="3" min="-2" max="-2" attributes="0"/>
- <Component id="jSpinnerHeight" alignment="3" min="-2" max="-2" attributes="0"/>
- <Component id="jSpinnerTextureScale" alignment="3" min="-2" max="-2" attributes="0"/>
- </Group>
- <EmptySpace type="unrelated" max="-2" attributes="0"/>
- <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
- <Component id="jTextFieldTexture" min="-2" max="-2" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
- <Component id="jCheckBoxDetail" min="-2" max="-2" attributes="0"/>
- <EmptySpace pref="24" max="32767" attributes="0"/>
- <Component id="jButtonOK" min="-2" max="-2" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -150,6 +130,99 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOutputActionPerformed"/>
</Events>
</Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="jButtonOK">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Start conversion!"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOKActionPerformed"/>
+ </Events>
+ </Component>
+ <Container class="javax.swing.JPanel" name="jPanel2">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="Terrain configuration"/>
+ </Border>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel2" alignment="1" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" max="-2" attributes="0">
+ <Component id="jSpinnerHeight" min="0" pref="0" max="32767" attributes="1"/>
+ <Component id="jSpinnerUnits" alignment="0" max="32767" attributes="1"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Component id="jLabel4" min="-2" max="-2" attributes="1"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jSpinnerTextureScale" max="32767" attributes="1"/>
+ </Group>
+ <Component id="jCheckBoxDetail" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="jTextFieldTexture" alignment="1" pref="404" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jSpinnerUnits" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jSpinnerTextureScale" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jSpinnerHeight" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jCheckBoxDetail" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jTextFieldTexture" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JCheckBox" name="jCheckBoxDetail">
+ <Properties>
+ <Property name="selected" type="boolean" value="true"/>
+ <Property name="text" type="java.lang.String" value="make detail"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jTextFieldTexture">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="terrain/terrain1"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel3">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Cover terrain surface with texture:"/>
+ </Properties>
+ </Component>
<Component class="javax.swing.JSpinner" name="jSpinnerUnits">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
@@ -157,57 +230,126 @@
</Property>
</Properties>
</Component>
- <Component class="javax.swing.JLabel" name="jLabel1">
+ <Component class="javax.swing.JSpinner" name="jSpinnerHeight">
<Properties>
- <Property name="text" type="java.lang.String" value="Units per pixel:"/>
+ <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
+ <SpinnerModel initial="1024" maximum="16384" minimum="256" numberType="java.lang.Integer" stepSize="1" type="number"/>
+ </Property>
</Properties>
</Component>
- <Component class="javax.swing.JSpinner" name="jSpinnerHeight">
+ <Component class="javax.swing.JSpinner" name="jSpinnerTextureScale">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
- <SpinnerModel initial="1024" maximum="16384" minimum="256" numberType="java.lang.Integer" stepSize="1" type="number"/>
+ <SpinnerModel initial="0.5" maximum="16.0" minimum="0.25" numberType="java.lang.Double" stepSize="0.25" type="number"/>
</Property>
</Properties>
</Component>
+ <Component class="javax.swing.JLabel" name="jLabel4">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Texture scale:"/>
+ </Properties>
+ </Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Height for white:"/>
</Properties>
</Component>
- <Component class="javax.swing.JButton" name="jButtonOK">
+ <Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
- <Property name="text" type="java.lang.String" value="Start conversion!"/>
+ <Property name="text" type="java.lang.String" value="Units per pixel:"/>
</Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="jPanelSky">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="Sky configuration"/>
+ </Border>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jTextFieldSkyTexture" alignment="0" pref="404" max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jCheckBoxSky" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="18" pref="18" max="-2" attributes="0"/>
+ <Component id="jCheckBoxSkyFill" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabel5" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jSpinnerSkyHeight" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jCheckBoxSky" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jCheckBoxSkyFill" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jSpinnerSkyHeight" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="unrelated" max="-2" attributes="0"/>
+ <Component id="jLabel6" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jTextFieldSkyTexture" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JCheckBox" name="jCheckBoxSky">
+ <Properties>
+ <Property name="selected" type="boolean" value="true"/>
+ <Property name="text" type="java.lang.String" value="generate a skybox"/>
+ </Properties>
<Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOKActionPerformed"/>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jCheckBoxSkyActionPerformed"/>
</Events>
</Component>
- <Component class="javax.swing.JLabel" name="jLabel3">
+ <Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
- <Property name="text" type="java.lang.String" value="Cover terrain surface with texture:"/>
+ <Property name="text" type="java.lang.String" value="Sky height:"/>
</Properties>
</Component>
- <Component class="javax.swing.JTextField" name="jTextFieldTexture">
+ <Component class="javax.swing.JSpinner" name="jSpinnerSkyHeight">
<Properties>
- <Property name="text" type="java.lang.String" value="terrain/terrain1"/>
+ <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
+ <SpinnerModel initial="1152" minimum="256" numberType="java.lang.Integer" stepSize="1" type="number"/>
+ </Property>
</Properties>
</Component>
- <Component class="javax.swing.JCheckBox" name="jCheckBoxDetail">
+ <Component class="javax.swing.JCheckBox" name="jCheckBoxSkyFill">
<Properties>
<Property name="selected" type="boolean" value="true"/>
- <Property name="text" type="java.lang.String" value="make detail"/>
+ <Property name="text" type="java.lang.String" value="fill alpha-gaps with sky"/>
</Properties>
</Component>
- <Component class="javax.swing.JLabel" name="jLabel4">
+ <Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
- <Property name="text" type="java.lang.String" value="Texture scale:"/>
+ <Property name="text" type="java.lang.String" value="Sky texture:"/>
</Properties>
</Component>
- <Component class="javax.swing.JSpinner" name="jSpinnerTextureScale">
+ <Component class="javax.swing.JTextField" name="jTextFieldSkyTexture">
<Properties>
- <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
- <SpinnerModel initial="0.5" maximum="16.0" minimum="0.25" numberType="java.lang.Double" stepSize="0.25" type="number"/>
- </Property>
+ <Property name="text" type="java.lang.String" value="skies/sky1"/>
</Properties>
</Component>
</SubComponents>
Modified: trunk/tools/ImgToMap/src/imgtomap/JFrameMain.java
===================================================================
--- trunk/tools/ImgToMap/src/imgtomap/JFrameMain.java 2008-05-18 10:49:15 UTC (rev 3634)
+++ trunk/tools/ImgToMap/src/imgtomap/JFrameMain.java 2008-05-18 13:13:47 UTC (rev 3635)
@@ -27,6 +27,7 @@
jTextFieldOutput.setText(testoutput);
}
+ enableSkyPanel(jCheckBoxSky.isSelected());
}
/** This method is called from within the constructor to
@@ -43,21 +44,29 @@
jButtonInput = new javax.swing.JButton();
jTextFieldOutput = new javax.swing.JTextField();
jButtonOutput = new javax.swing.JButton();
+ jButtonOK = new javax.swing.JButton();
+ jPanel2 = new javax.swing.JPanel();
+ jCheckBoxDetail = new javax.swing.JCheckBox();
+ jTextFieldTexture = new javax.swing.JTextField();
+ jLabel3 = new javax.swing.JLabel();
jSpinnerUnits = new javax.swing.JSpinner();
- jLabel1 = new javax.swing.JLabel();
jSpinnerHeight = new javax.swing.JSpinner();
+ jSpinnerTextureScale = new javax.swing.JSpinner();
+ jLabel4 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
- jButtonOK = new javax.swing.JButton();
- jLabel3 = new javax.swing.JLabel();
- jTextFieldTexture = new javax.swing.JTextField();
- jCheckBoxDetail = new javax.swing.JCheckBox();
- jLabel4 = new javax.swing.JLabel();
- jSpinnerTextureScale = new javax.swing.JSpinner();
+ jLabel1 = new javax.swing.JLabel();
+ jPanelSky = new javax.swing.JPanel();
+ jCheckBoxSky = new javax.swing.JCheckBox();
+ jLabel5 = new javax.swing.JLabel();
+ jSpinnerSkyHeight = new javax.swing.JSpinner();
+ jCheckBoxSkyFill = new javax.swing.JCheckBox();
+ jLabel6 = new javax.swing.JLabel();
+ jTextFieldSkyTexture = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("ImgToMap");
- jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Convert image to map"));
+ jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Files"));
jButtonInput.setText("Select input file");
jButtonInput.addActionListener(new java.awt.event.ActionListener() {
@@ -73,14 +82,35 @@
}
});
- jSpinnerUnits.setModel(new javax.swing.SpinnerNumberModel(256, 1, 2048, 1));
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jTextFieldOutput, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
+ .addComponent(jTextFieldInput, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jButtonInput, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)
+ .addComponent(jButtonOutput, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jButtonInput)
+ .addComponent(jTextFieldInput, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jButtonOutput)
+ .addComponent(jTextFieldOutput, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
- jLabel1.setText("Units per pixel:");
-
- jSpinnerHeight.setModel(new javax.swing.SpinnerNumberModel(1024, 256, 16384, 1));
-
- jLabel2.setText("Height for white:");
-
jButtonOK.setText("Start conversion!");
jButtonOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -88,97 +118,163 @@
}
});
- jLabel3.setText("Cover terrain surface with texture:");
+ jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Terrain configuration"));
- jTextFieldTexture.setText("terrain/terrain1");
-
jCheckBoxDetail.setSelected(true);
jCheckBoxDetail.setText("make detail");
- jLabel4.setText("Texture scale:");
+ jTextFieldTexture.setText("terrain/terrain1");
+ jLabel3.setText("Cover terrain surface with texture:");
+
+ jSpinnerUnits.setModel(new javax.swing.SpinnerNumberModel(256, 1, 2048, 1));
+
+ jSpinnerHeight.setModel(new javax.swing.SpinnerNumberModel(1024, 256, 16384, 1));
+
jSpinnerTextureScale.setModel(new javax.swing.SpinnerNumberModel(0.5d, 0.25d, 16.0d, 0.25d));
- javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
- jPanel1.setLayout(jPanel1Layout);
- jPanel1Layout.setHorizontalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
+ jLabel4.setText("Texture scale:");
+
+ jLabel2.setText("Height for white:");
+
+ jLabel1.setText("Units per pixel:");
+
+ javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
+ jPanel2.setLayout(jPanel2Layout);
+ jPanel2Layout.setHorizontalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jTextFieldTexture, javax.swing.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE)
- .addComponent(jButtonOK)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
- .addComponent(jSpinnerUnits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(27, 27, 27)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel2)
- .addComponent(jSpinnerHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(24, 24, 24)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(jSpinnerTextureScale)
- .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ .addComponent(jLabel2))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(jSpinnerHeight, 0, 0, Short.MAX_VALUE)
+ .addComponent(jSpinnerUnits))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addComponent(jLabel4)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jSpinnerTextureScale))
+ .addComponent(jCheckBoxDetail)))
.addComponent(jLabel3)
- .addComponent(jCheckBoxDetail)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
- .addComponent(jTextFieldOutput, javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jTextFieldInput, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 313, Short.MAX_VALUE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jButtonInput, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
- .addComponent(jButtonOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE))))
+ .addComponent(jTextFieldTexture, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE))
.addContainerGap())
);
- jPanel1Layout.setVerticalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jButtonInput)
- .addComponent(jTextFieldInput, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
+ jPanel2Layout.setVerticalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jSpinnerUnits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel1)
+ .addComponent(jLabel4)
+ .addComponent(jSpinnerTextureScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jButtonOutput)
- .addComponent(jTextFieldOutput, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(16, 16, 16)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel1)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
- .addComponent(jLabel4))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jSpinnerUnits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jSpinnerHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jSpinnerTextureScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jCheckBoxDetail))
+ .addGap(18, 18, 18)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextFieldTexture, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jCheckBoxDetail)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
- .addComponent(jButtonOK)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+
+ jPanelSky.setBorder(javax.swing.BorderFactory.createTitledBorder("Sky configuration"));
+
+ jCheckBoxSky.setSelected(true);
+ jCheckBoxSky.setText("generate a skybox");
+ jCheckBoxSky.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jCheckBoxSkyActionPerformed(evt);
+ }
+ });
+
+ jLabel5.setText("Sky height:");
+
+ jSpinnerSkyHeight.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1152), Integer.valueOf(256), null, Integer.valueOf(1)));
+
+ jCheckBoxSkyFill.setSelected(true);
+ jCheckBoxSkyFill.setText("fill alpha-gaps with sky");
+
+ jLabel6.setText("Sky texture:");
+
+ jTextFieldSkyTexture.setText("skies/sky1");
+
+ javax.swing.GroupLayout jPanelSkyLayout = new javax.swing.GroupLayout(jPanelSky);
+ jPanelSky.setLayout(jPanelSkyLayout);
+ jPanelSkyLayout.setHorizontalGroup(
+ jPanelSkyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelSkyLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanelSkyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jTextFieldSkyTexture, javax.swing.GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
+ .addGroup(jPanelSkyLayout.createSequentialGroup()
+ .addComponent(jCheckBoxSky)
+ .addGap(18, 18, 18)
+ .addComponent(jCheckBoxSkyFill))
+ .addGroup(jPanelSkyLayout.createSequentialGroup()
+ .addComponent(jLabel5)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jSpinnerSkyHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jLabel6))
.addContainerGap())
);
+ jPanelSkyLayout.setVerticalGroup(
+ jPanelSkyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelSkyLayout.createSequentialGroup()
+ .addGroup(jPanelSkyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jCheckBoxSky)
+ .addComponent(jCheckBoxSkyFill))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanelSkyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel5)
+ .addComponent(jSpinnerSkyHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jLabel6)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jTextFieldSkyTexture, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanelSky, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jButtonOK)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
- .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addContainerGap())
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jPanelSky, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jButtonOK)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
@@ -202,8 +298,12 @@
p.infile = jTextFieldInput.getText();
p.outfile = jTextFieldOutput.getText();
p.texture = jTextFieldTexture.getText();
+ p.skytexture = jTextFieldSkyTexture.getText();
p.pixelsize = (Integer)jSpinnerUnits.getValue();
p.height = (Integer)jSpinnerHeight.getValue();
+ p.sky = jCheckBoxSky.isSelected();
+ p.skyfill = jCheckBoxSkyFill.isSelected();
+ p.skyheight = (Integer)jSpinnerSkyHeight.getValue();
p.texturescale = (Double)jSpinnerTextureScale.getValue();
p.detail = jCheckBoxDetail.isSelected();
int ret = new MapWriter().writeMap(p);
@@ -227,6 +327,16 @@
}
}//GEN-LAST:event_jButtonOutputActionPerformed
+private void jCheckBoxSkyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxSkyActionPerformed
+ enableSkyPanel(jCheckBoxSky.isSelected());
+}//GEN-LAST:event_jCheckBoxSkyActionPerformed
+
+private void enableSkyPanel(boolean b) {
+ jCheckBoxSkyFill.setEnabled(b);
+ jSpinnerSkyHeight.setEnabled(b);
+ jTextFieldSkyTexture.setEnabled(b);
+}
+
/**
* @param args the command line arguments
*/
@@ -243,16 +353,24 @@
private javax.swing.JButton jButtonOK;
private javax.swing.JButton jButtonOutput;
private javax.swing.JCheckBox jCheckBoxDetail;
+ private javax.swing.JCheckBox jCheckBoxSky;
+ private javax.swing.JCheckBox jCheckBoxSkyFill;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
+ private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanelSky;
private javax.swing.JSpinner jSpinnerHeight;
+ private javax.swing.JSpinner jSpinnerSkyHeight;
private javax.swing.JSpinner jSpinnerTextureScale;
private javax.swing.JSpinner jSpinnerUnits;
private javax.swing.JTextField jTextFieldInput;
private javax.swing.JTextField jTextFieldOutput;
+ private javax.swing.JTextField jTextFieldSkyTexture;
private javax.swing.JTextField jTextFieldTexture;
// End of variables declaration//GEN-END:variables
Modified: trunk/tools/ImgToMap/src/imgtomap/MapWriter.java
===================================================================
--- trunk/tools/ImgToMap/src/imgtomap/MapWriter.java 2008-05-18 10:49:15 UTC (rev 3634)
+++ trunk/tools/ImgToMap/src/imgtomap/MapWriter.java 2008-05-18 13:13:47 UTC (rev 3635)
@@ -89,10 +89,54 @@
buf.append(getMapPlaneString(h, d, a, p.detail, "common/caulk", p.texturescale));
buf.append(getMapPlaneString(g, h, f, p.detail, "common/caulk", p.texturescale));
buf.append("}\n");
+ } else if (p.skyfill) {
+ // fill skipped blocks with sky
+ Vector3D p1 = new Vector3D(x * units, -(y + 1) * units, -32.0);
+ Vector3D p2 = new Vector3D((x + 1) * units, -y * units, p.skyheight);
+
+ writeBoxBrush(buf, p1, p2, false, p.skytexture, 1.0);
}
}
}
+ if (p.sky) {
+ // generate skybox
+ int x = height.length - 1;
+ int y = height[0].length - 1;
+
+ // top
+ Vector3D p1 = new Vector3D(0, -y * units, p.skyheight);
+ Vector3D p2 = new Vector3D(x * units, 0, p.skyheight + 32.0);
+ writeBoxBrush(buf, p1, p2, false, p.skytexture, 1.0);
+
+ // bottom
+ p1 = new Vector3D(0, -y * units, -64.0);
+ p2 = new Vector3D(x * units, 0, -32.0);
+ writeBoxBrush(buf, p1, p2, false, p.skytexture, 1.0);
+
+ // north
+ p1 = new Vector3D(0, 0, -32.0);
+ p2 = new Vector3D(x * units, 32, p.skyheight);
+ writeBoxBrush(buf, p1, p2, false, p.skytexture, 1.0);
+
+ // east
+ p1 = new Vector3D(x * units, -y * units, -32.0);
+ p2 = new Vector3D(x * units + 32.0, 0, p.skyheight);
+ writeBoxBrush(buf, p1, p2, false, p.skytexture, 1.0);
+
+ // south
+ p1 = new Vector3D(0, -y * units - 32, -32.0);
+ p2 = new Vector3D(x * units, -y * units, p.skyheight);
+ writeBoxBrush(buf, p1, p2, false, p.skytexture, 1.0);
+
+
+ // west
+ p1 = new Vector3D(0 - 32.0, -y * units, -32.0);
+ p2 = new Vector3D(0, 0, p.skyheight);
+ writeBoxBrush(buf, p1, p2, false, p.skytexture, 1.0);
+
+ }
+
// worldspawn end
buf.append("}\n");
try {
@@ -104,6 +148,27 @@
return 0;
}
+ private void writeBoxBrush(StringBuffer buf, Vector3D p1, Vector3D p2, boolean detail, String texture, double scale) {
+ Vector3D a = new Vector3D(p1.x, p2.y, p2.z);
+ Vector3D b = p2;
+ Vector3D c = new Vector3D(p1.x, p1.y, p2.z);
+ Vector3D d = new Vector3D(p2.x, p1.y, p2.z);
+ //Vector3D e unused
+ Vector3D f = new Vector3D(p2.x, p2.y, p1.z);
+ Vector3D g = p1;
+ Vector3D h = new Vector3D(p2.x, p1.y, p1.z);
+
+ buf.append("{\n");
+ buf.append(getMapPlaneString(a, b, d, detail, texture, scale));
+ buf.append(getMapPlaneString(d, b, f, detail, texture, scale));
+ buf.append(getMapPlaneString(c, d, h, detail, texture, scale));
+ buf.append(getMapPlaneString(a, c, g, detail, texture, scale));
+ buf.append(getMapPlaneString(f, b, a, detail, texture, scale));
+ buf.append(getMapPlaneString(g, h, f, detail, texture, scale));
+ buf.append("}\n");
+
+ }
+
private String getMapPlaneString(Vector3D p1, Vector3D p2, Vector3D p3, boolean detail, String material, double scale) {
int flag;
if (detail) {
@@ -116,7 +181,7 @@
private class Vector3D {
- public double x, y, z;
+ public double x, y, z;
public Vector3D() {
this(0.0, 0.0, 0.0);
Modified: trunk/tools/ImgToMap/src/imgtomap/Parameters.java
===================================================================
--- trunk/tools/ImgToMap/src/imgtomap/Parameters.java 2008-05-18 10:49:15 UTC (rev 3634)
+++ trunk/tools/ImgToMap/src/imgtomap/Parameters.java 2008-05-18 13:13:47 UTC (rev 3635)
@@ -10,9 +10,9 @@
* @author maik
*/
public class Parameters {
- public String infile, outfile, texture;
- public int pixelsize, height;
- public boolean detail;
+ public String infile, outfile, texture, skytexture;
+ public int pixelsize, height, skyheight;
+ public boolean detail, sky, skyfill;
public double texturescale = 0.5;
More information about the nexuiz-commits
mailing list