コード例 #1
0
        private void SimTileQuality_Load(object sender, EventArgs e)
        {
            trackBar1.Minimum = 0;
            trackBar1.Maximum = (int)eSimQuality.cQuality_Count - 1;

            int v = (int)(1.0f / TerrainGlobals.getEditor().getSimRep().getVisToSimScale());

            //ugggg...
            if (v == (int)eSimQuality.cQuality_Max)
            {
                trackBar1.Value = 4;
            }
            else if (v == (int)eSimQuality.cQuality_High)
            {
                trackBar1.Value = 3;
            }
            else if (v == (int)eSimQuality.cQuality_Med)
            {
                trackBar1.Value = 2;
            }
            else if (v == (int)eSimQuality.cQuality_Low)
            {
                trackBar1.Value = 1;
            }
            else if (v == (int)eSimQuality.cQuality_Min)
            {
                trackBar1.Value = 0;
            }

            visToSimMul = (int)Math.Pow(2, (double)eSimQuality.cQuality_Count - trackBar1.Value);

            updateLabel();
        }
コード例 #2
0
 private void SampleMinHeightButton_Click(object sender, EventArgs e)
 {
     this.UseMinHeightCheckBox.Checked = true;
     TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeSampleMinHeight);
     TerrainGlobals.getEditor().mComponentMaskSettings.mbUseMinHeight = true;
     UpdateComponentMaskingSettings();
 }
コード例 #3
0
        void SelectButton(FoliageBladeButton but)
        {
            if (mSelectedButton != null)
            {
                mSelectedButton.Invalidate();
            }

            mSelectedButton = but;

            mSelectedButton.Invalidate();

            if (paintSet.Checked)
            {
                TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeFoliageSet);
            }
            else if (paintErase.Checked)
            {
                TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeFoliageErase);
            }

            int selectedSetIndex   = FoliageManager.giveIndexOfSet(mSelectedButton.mFullFileName);
            int selectedBladeIndex = mSelectedButton.mIndexInConatiningSet;

            FoliageManager.SelectedSetIndex   = selectedSetIndex;
            FoliageManager.SelectedBladeIndex = selectedBladeIndex;

            TerrainGlobals.getEditor().newFoliageBrush();

            CoreGlobals.getEditorMain().MainMode = BEditorMain.eMainMode.cTerrain;

            CoreGlobals.getEditorMain().mPhoenixScenarioEditor.HandleCommand("Foliage Paint");
        }
コード例 #4
0
        public void addSelectTexture(TerrainTextureButton but)
        {
            if (mSelectedButton != null)
            {
                mSelectedButton.Invalidate();
            }

            mSelectedButton = but;
            mSelectedButton.Invalidate();


            if (but is TerrainTextureSplatButton)
            {
                SelectedDef = SimTerrainType.getFromTypeName(but.typename);

                if (!isActiveSetSelected())
                {
                    TerrainGlobals.getTexturing().addActiveTexture(SimTerrainType.getWorkingTexName(mSelectedDef));
                }
            }
            else if (but is TerrainTextureDecalButton)
            {
                if (!isActiveSetSelected())
                {
                    TerrainGlobals.getTexturing().addActiveDecal(((TerrainTextureDecalButton)but).mFullFilename);
                }
                TerrainGlobals.getTerrainFrontEnd().SelectedDecalIndex = TerrainGlobals.getTexturing().getActiveDecalIndex(((TerrainTextureDecalButton)but).mFullFilename);
                if (TerrainGlobals.getEditor().getRenderMode() == BTerrainEditor.eEditorRenderMode.cRenderTextureSelectRender)
                {
                    TerrainGlobals.getTexturing().reloadCachedVisuals();
                }
            }
        }
コード例 #5
0
        private void markOverrideTessellations(ErrorMetricRefine refiner)
        {
            JaggedContainer <byte> v = TerrainGlobals.getEditor().getJaggedTesselation();

            int width = TerrainGlobals.getTerrain().getNumXVerts();

            long id;
            byte maskValue;

            v.ResetIterator();
            while (v.MoveNext(out id, out maskValue))
            {
                if (maskValue == BTerrainEditor.cTesselationEmptyVal)
                {
                    continue;
                }

                int x = (int)(id / width);
                int z = (int)(id - x * width);

                if (maskValue == (int)BTerrainEditor.eTessOverrideVal.cTess_Max)
                {
                    refiner.setMarkedPt(x, z, true);
                }
                else if (maskValue == (int)BTerrainEditor.eTessOverrideVal.cTess_Min)
                {
                    refiner.setMarkedPt(x, z, false);
                }
            }
        }
コード例 #6
0
        private void checkBox2_CheckedChanged(object sender, EventArgs e)
        {
            bool mbValue = ((CheckBox)sender).Checked;

            TerrainGlobals.getEditor().mComponentMaskSettings.mUseGradiant = mbValue;
            //if (mbValue == false)
            UpdateComponentMasking();
        }
コード例 #7
0
        private void roadTextureListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            mSelectedRoadTextue      = roadTextureListBox.SelectedIndex;
            mSelectedRoadTextureName = (string)roadTextureListBox.SelectedItem;
            RoadManager.setRoadTexture(mSelectedRoadTextureName);

            tabControl1.SelectedTab = tabControl1.TabPages[0];
            TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeRoadAdd);
        }
コード例 #8
0
        private void paintErase_CheckedChanged(object sender, EventArgs e)
        {
            TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeFoliageErase);

            TerrainGlobals.getEditor().newFoliageBrush();

            CoreGlobals.getEditorMain().MainMode = BEditorMain.eMainMode.cTerrain;

            CoreGlobals.getEditorMain().mPhoenixScenarioEditor.HandleCommand("Foliage Paint");
        }
コード例 #9
0
        private void UseMaxHeightCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            bool mbValue = ((CheckBox)sender).Checked;

            TerrainGlobals.getEditor().mComponentMaskSettings.mbUseMaxHeight = mbValue;
            if (mbValue == false)
            {
                UpdateComponentMasking();
            }
        }
コード例 #10
0
        private void ZPosUpDown_ValueChanged(object sender, EventArgs e)
        {
            if (mbSuspendUIUpdate)
            {
                return;
            }

            TerrainGlobals.getEditor().mLastTerrainPasteLocationZ = (int)ZPosUpDown.Value;

            ClipArtSetDirty();
        }
コード例 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            TerrainCreationParams prms = new TerrainCreationParams();

            prms.initFromVisData(TerrainGlobals.getTerrain().getNumXVerts(), TerrainGlobals.getTerrain().getNumZVerts(), TerrainGlobals.getTerrain().getTileScale(), visToSimMul);

            TerrainGlobals.getEditor().getSimRep().reinit(prms.mNumSimXTiles, prms.mNumSimZTiles, prms.mSimTileSpacing, 1.0f / (float)visToSimMul);

            TerrainGlobals.getEditor().getSimRep().update(false, false);// updateSimRep(TerrainGlobals.getEditor().getDetailPoints(), TerrainGlobals.getTerrain().getNumXVerts(), TerrainGlobals.getTerrain().getTileScale(), false);

            this.Close();
        }
コード例 #12
0
 private void tabControl1_TabIndexChanged(object sender, EventArgs e)
 {
     if (tabControl1.TabIndex == 0)
     {
         if (roadTextureListBox.SelectedIndex != -1)
         {
             TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeRoadAdd);
         }
     }
     else if (tabControl1.TabIndex == 1)
     {
         TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeRoadEdit);
     }
 }
コード例 #13
0
        private void button7_Click_1(object sender, EventArgs e)
        {
            //   return;

            //CLM
            //TerrainGlobals.getTexturing().flattenLayers();
            TerrainGlobals.getTexturing().removeUnusedActiveTextures();
            TerrainGlobals.getTexturing().removeUnusedActiveDecals();
            TerrainGlobals.getTexturing().ensureCleanLayers();
            TerrainGlobals.getTexturing().reloadCachedVisuals();

            redrawPreviewList(0);
            TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeNone);
        }
コード例 #14
0
        public void apply()
        {
            string fName     = Path.GetFileNameWithoutExtension(mData.Texture);
            string dir       = Path.GetDirectoryName(mData.Texture);
            string themeName = dir.Substring(dir.LastIndexOf("\\") + 1);

            TerrainTextureDef SelectedDef = SimTerrainType.getFromTypeName(themeName + "_" + fName);

            TerrainGlobals.getTexturing().addActiveTexture(SimTerrainType.getWorkingTexName(SelectedDef));
            SimTerrainType.addActiveSetDef(SelectedDef);
            TerrainGlobals.getTerrainFrontEnd().SelectedTextureIndex = SimTerrainType.getActiveSetIndex(SelectedDef);


            TerrainGlobals.getEditor().applyTextureToMask();
        }
コード例 #15
0
        private void ApplyButton_Click(object sender, EventArgs e)
        {
            if (mbDirty == true)
            {
                Cursor.Current = Cursors.WaitCursor;
                int x = TerrainGlobals.getEditor().mLastTerrainPasteLocationX;
                int z = TerrainGlobals.getEditor().mLastTerrainPasteLocationZ;

                TerrainGlobals.getEditor().TransformClipart(GetXScale(), GetYScale(), GetZScale(), GetRotation());
                TerrainGlobals.getEditor().applyPastedData(x, z, GetYOffset());
                CoreGlobals.getEditorMain().mOneFrame = true;
                Cursor.Current = Cursors.Default;
            }

            TerrainGlobals.getEditor().OKPaste();
        }
コード例 #16
0
        private void MinNoiseCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            bool mbValue = ((CheckBox)sender).Checked;

            if (mbValue == true)
            {
                NoiseFunction func = new NoiseFunction();
                TerrainGlobals.getEditor().mComponentMaskSettings.mMinNoiseFunction = func;
            }
            else
            {
                TerrainGlobals.getEditor().mComponentMaskSettings.mMinNoiseFunction = null;
            }

            UpdateComponentMasking();
        }
コード例 #17
0
        private void MaxNoiseCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            bool mbValue = ((CheckBox)sender).Checked;

            if (mbValue == true)
            {
                NoiseFunction func = new NoiseFunction();
                //NoiseGeneration.RigedMultiFractal.mFrequency = 0.05f;
                TerrainGlobals.getEditor().mComponentMaskSettings.mMaxNoiseFunction = func;
            }
            else
            {
                TerrainGlobals.getEditor().mComponentMaskSettings.mMaxNoiseFunction = null;
            }

            UpdateComponentMasking();
        }
コード例 #18
0
        private void MinHeightCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            bool mbValue = ((CheckBox)sender).Checked;

            if (mbValue == true)
            {
                GradientFunction func = new GradientFunction();
                func.mStartValue = 1;
                func.mEndValue   = 0;
                TerrainGlobals.getEditor().mComponentMaskSettings.mMinGradient = func;
            }
            else
            {
                TerrainGlobals.getEditor().mComponentMaskSettings.mMinGradient = null;
            }
            UpdateComponentMasking();
        }
コード例 #19
0
        void mMaskPalette_mTextureSelected(int id)
        {
            try
            {
                TerrainGlobals.getTerrainFrontEnd().SelectedMaskIndex = id;

                //Todo cleaner way to access this window???
                if (MainWindow.mMainWindow.mBrushSettingsWindow != null)
                {
                    MainWindow.mMainWindow.mBrushSettingsWindow.Stroke = TerrainGlobals.getEditor().getCurrentStroke();
                }
            }
            catch (System.Exception ex)
            {
                CoreGlobals.getErrorManager().OnException(ex);
            }
        }
コード例 #20
0
        void SelectButton(ClipArtButton b)
        {
            if (mSelectedButton != null)
            {
                mSelectedButton.Invalidate();
            }

            mSelectedButton = b;
            mSelectedButton.Invalidate();

            //selectedgroupBox.Text = String.Format("Selected: {0}", Path.GetFileName(mSelectedButton.mData.mFileName));
            //this.selectedMetaDesctextBox.Text = mSelectedButton.mData.mMetadata.mDescription;

            //this.selectedDesctextBox.Text = String.Format("VertCount:{0}\r\nDataChannels:\r\n{1}", mSelectedButton.mData.mMetadata.mVertCount, mSelectedButton.mData.getComponentList());

            TerrainGlobals.getEditor().SetClipArt(mSelectedButton.mData);
            TerrainGlobals.getTerrainFrontEnd().PasteMode();
        }
コード例 #21
0
        private float GetYOffset()
        {
            float v = (float)this.HeightSliderControl.NumericValue;

            if (SmartHeightcheckBox.Checked == true)
            {
                Vector3 min;
                Vector3 max;

                CopiedVertexData vertexData = TerrainGlobals.getEditor().GetClipartVertexData();
                if (vertexData != null)
                {
                    vertexData.GetOriginalSize(out min, out max);
                    v = v - min.Y;
                }
            }
            return(v);
        }
コード例 #22
0
        private int writeBuildable()
        {
            ECF.ECFChunkHolder chunkHolder = new ECF.ECFChunkHolder();
            chunkHolder.mDataMemStream = new MemoryStream();
            BinaryWriter binWriter = new BinaryWriter(chunkHolder.mDataMemStream);


            BTerrainSimRep simRep = TerrainGlobals.getEditor().getSimRep();

            // Write buildable
            bool[] landBuildable = simRep.getDataTiles().getSimLandBuildable();
            int    numTiles      = simRep.getNumXTiles();

            byte tru = 0xFF;
            byte fal = 0x00;

            for (int x = 0; x < numTiles; x++)
            {
                for (int z = 0; z < numTiles; z++)
                {
                    int index = (x * numTiles + z);

                    if (landBuildable[index])
                    {
                        binWriter.Write(tru);
                    }
                    else
                    {
                        binWriter.Write(fal);
                    }
                }
            }



            ExportTo360.mECF.addChunk((int)eXSD_ChunkID.cXSD_Buildable, chunkHolder, binWriter.BaseStream.Length);
            binWriter.Close();
            binWriter = null;
            chunkHolder.Close();
            chunkHolder = null;

            return(landBuildable.Length * sizeof(byte));
        }
コード例 #23
0
        void cleanMap()
        {
            //clean detail
            Vector3[] detialPts = TerrainGlobals.getEditor().getDetailPoints();
            int       width     = TerrainGlobals.getTerrain().getNumXVerts();

            for (int x = 0; x < width * width; x++)
            {
                detialPts[x].X = 0;
                detialPts[x].Y = 0;
                detialPts[x].Z = 0;
            }

            //clean textures

            //clear sim
            SimGlobals.getSimMain().selectAll();
            SimGlobals.getSimMain().DeleteSelected();
        }
コード例 #24
0
 public void SelectButton(TerrainTextureButton but)
 {
     if (but is TerrainTextureSplatButton)
     {
         if (mSelectSwap || mSelectReplace)
         {
             if (mSelectedButton is TerrainTextureSplatButton)
             {
                 swapSelectTexture(but);
             }
         }
         else
         {
             addSelectTexture(but);
             //show our properties window
             if (isActiveSetSelected())
             {
                 texturePropertiesPanel.Enabled = true;
                 setTextureProperties();
                 panel1.Refresh();
             }
             else
             {
                 texturePropertiesPanel.Enabled = false;
                 panel1.Refresh();
             }
             TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeTexEdit);
         }
     }
     else if (but is TerrainTextureDecalButton)
     {
         if (mSelectSwap || mSelectReplace)
         {
             return;
         }
         else
         {
             addSelectTexture(but);
             //TerrainGlobals.getEditor().setMode(BTerrainEditor.eEditorMode.cModeDecalEdit);
         }
     }
 }
コード例 #25
0
        //-----------------------------------------
        private unsafe void headerToChunk()
        {
            ECF.ECFChunkHolder chunkHolder = new ECF.ECFChunkHolder();
            chunkHolder.mDataMemStream = new MemoryStream();
            BinaryWriter binWriter = new BinaryWriter(chunkHolder.mDataMemStream);

            int version = (int)eFileVersions.cXSDVersion;

            binWriter.Write(Xbox_EndianSwap.endSwapI32(version));

            //sim terrain data stuff
            binWriter.Write(Xbox_EndianSwap.endSwapI32(TerrainGlobals.getEditor().getSimRep().getNumXTiles()));     //simTileScale
            binWriter.Write(Xbox_EndianSwap.endSwapF32(TerrainGlobals.getEditor().getSimRep().getTileScale()));     //simTileScale
            binWriter.Write(Xbox_EndianSwap.endSwapF32(TerrainGlobals.getEditor().getSimRep().getVisToSimScale())); //visToSimScale


            //round our sim-rep up to next multiple of 8 for XBOX360 memory effecient tiling
            int width      = (TerrainGlobals.getEditor().getSimRep().getNumXVerts() - 1) * cSimHeightResMultiplier + 1;
            int numXBlocks = width / 8;

            if (width % 8 != 0)
            {
                numXBlocks++;
            }
            int newWidth = numXBlocks * 8;

            float heightTileScale = (TerrainGlobals.getEditor().getSimRep().getTileScale() / (float)cSimHeightResMultiplier);


            binWriter.Write(Xbox_EndianSwap.endSwapI32(width));                   //numHeightVerts
            binWriter.Write(Xbox_EndianSwap.endSwapI32(newWidth));                //numHeightVertsCacheFeriently
            binWriter.Write(Xbox_EndianSwap.endSwapF32(heightTileScale));         //height tile scale
            binWriter.Write(Xbox_EndianSwap.endSwapI32(cSimHeightResMultiplier)); //DataToHeightMultiplier



            ExportTo360.mECF.addChunk((int)eXSD_ChunkID.cXSD_XSDHeader, chunkHolder, binWriter.BaseStream.Length);
            binWriter.Close();
            binWriter = null;
            chunkHolder.Close();
            chunkHolder = null;
        }
コード例 #26
0
        public unsafe bool export_XSD(string filename, ExportSettings expSettings, ref Export360.ExportResults results)
        {
            DateTime n = DateTime.Now;

            //update before we do anything
            TerrainGlobals.getEditor().getSimRep().updateForExport();// update(false);//

            headerToChunk();

            results.terrainSimMemorySize = simDataToChunk();


            bool exportOK = ExportTo360.safeECFFileWrite(filename, ".XSD");

            TimeSpan ts = DateTime.Now - n;

            results.terrainSimTime = ts.TotalMinutes;

            return(exportOK);
        }
コード例 #27
0
        public void writeAOData(ref ExportResults results)
        {
            //WRITE THE CHUNK
            ECF.ECFChunkHolder chunkHolder = new ECF.ECFChunkHolder();
            chunkHolder.mDataMemStream = new MemoryStream();
            BinaryWriter binWriter = new BinaryWriter(chunkHolder.mDataMemStream);

            byte[] data = packAOToDXT5A(TerrainGlobals.getEditor().getAmbientOcclusionValues(), TerrainGlobals.getTerrain().getNumXVerts());
            for (int i = 0; i < data.Length; i++)
            {
                binWriter.Write(data[i]);
            }
            results.terrainAOMemorySize = data.Length;
            data = null;

            ExportTo360.mECF.addChunk((int)eXTD_ChunkID.cXTD_AOChunk, chunkHolder, binWriter.BaseStream.Length);
            binWriter.Close();
            binWriter = null;
            chunkHolder.Close();
            chunkHolder = null;
        }
コード例 #28
0
        void writeAlpha(ref ExportResults results)
        {
            //WRITE THE CHUNK
            ECF.ECFChunkHolder chunkHolder = new ECF.ECFChunkHolder();
            chunkHolder.mDataMemStream = new MemoryStream();
            BinaryWriter binWriter = new BinaryWriter(chunkHolder.mDataMemStream);


            #region DXT5Alpha
            byte[] dataAlpha = packAlphaToDXT5A(TerrainGlobals.getEditor().getAlphaValues(), TerrainGlobals.getTerrain().getNumXVerts());
            for (int i = 0; i < dataAlpha.Length; i++)
            {
                binWriter.Write(dataAlpha[i]);
            }
            results.terrainAlphaMemorySize = dataAlpha.Length;
            dataAlpha = null;
            #endregion

            ExportTo360.mECF.addChunk((int)eXTD_ChunkID.cXTD_AlphaChunk, chunkHolder, binWriter.BaseStream.Length);
            binWriter.Close();
            binWriter = null;
            chunkHolder.Close();
            chunkHolder = null;
        }
コード例 #29
0
 private void RightClickOKCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     TerrainGlobals.getEditor().mbRightClickApply = RightClickOKCheckBox.Checked;
 }
コード例 #30
0
 private void checkBox3_CheckedChanged(object sender, EventArgs e)
 {
     TerrainGlobals.getEditor().mUseClipartSimData = checkBox3.Checked;
 }