Пример #1
0
        void loadRandomTexture(String rootname)
        {
            //do we have a random map?
            if (File.Exists(rootname + ".random.png"))
            {
                TextureHandle RandomTextureFile = BRenderDevice.getTextureManager().getTexture(rootname + ".random.png");
                mRandomTexture = RandomTextureFile.mTexture;

                //Huzzah! We have a random texture!
                //build our mipmap levels internal
                //Surface s = RandomTextureFile.mTexture.GetSurfaceLevel(0);

                //mRandomTexture = Texture(BRenderDevice.getDevice(), s.Description.Width, s.Description.Height, 1, Usage.None, Format.A8R8G8B8, Pool.Default);

                ////copy the data over from the file to our local file
                //GraphicsStream inputStream = RandomTextureFile.mTexture.LockRectangle(0, LockFlags.None);
                //byte* data = (byte*)inputStream.InternalDataPointer;
                //int rectPitch = s.Description.Format;
                //for (int j = 0; j < a.exemplar().recoloredStack(l).height(); j++)
                //{
                //   for (int i = 0; i < a.exemplar().recoloredStack(l).width(); i++)
                //   {
                //   }
                //}
                //RandomTextureFile.mTexture.UnlockRectangle(0);
                ////build our mip-map chain (higher levels contain min of lower 4 pixels)

                //s.Dispose();
                //s =null;
            }
            else
            {
                mRandomTexture = null;
            }
        }
Пример #2
0
 public void destroyDeviceData()
 {
     for (int i = 0; i < (int)BTerrainTexturing.eTextureChannels.cSplatChannelCount; i++)
     {
         if (mTexChannels[i] != null)
         {
             mTexChannels[i].destroy();
             BRenderDevice.getTextureManager().freeTexture(mTexChannels[i].mFilename);
         }
     }
 }
Пример #3
0
 // -----------------------------------------------------
 public void loadHighResExemplarImg(String rootname)
 {
     if (File.Exists(rootname + ".highres.png"))
     {
         mHighResExemplarTexture = BRenderDevice.getTextureManager().getTexture(rootname + ".highres.png");
     }
     else
     {
         mHighResExemplarTexture = null;
     }
 }
Пример #4
0
 public void destroy()
 {
     if (mTexChannels != null)
     {
         for (int i = 0; i < (int)BTerrainTexturing.eTextureChannels.cDecalChannelCount; i++)
         {
             if (mTexChannels[i] != null)
             {
                 BRenderDevice.getTextureManager().freeTexture(mTexChannels[i].mFilename);
                 mTexChannels[i].destroy();
                 mTexChannels[i] = null;
             }
         }
         mTexChannels = null;
     }
 }
Пример #5
0
        public Exemplar(String filename)
        {
            //we're given a filename
            mOrigionalExemplarTexture = BRenderDevice.getTextureManager().getTexture(filename);

            String rootFilename = stripToRootName(filename);

            m_name = rootFilename;


            StreamReader f = new StreamReader(File.Open(rootFilename + ".analyse", FileMode.Open, FileAccess.Read));

            loadAnalysisFile(f);

            f.Close();

            createInternalExemplar();
        }
Пример #6
0
        public int addActiveTexture(String filename)
        {
            for (int i = 0; i < mActiveTextures.Count; i++)
            {
                if (mActiveTextures[i].mFilename == filename)
                {
                    return(i);
                }
            }

            BTerrainActiveTextureContainer atc = new BTerrainActiveTextureContainer();

            atc.mFilename = filename;
            atc.loadTextures();
            mActiveTextures.Add(atc);

            BRenderDevice.getTextureManager().addWatchedTexture(filename, activeTextureReloaded);
            return(mActiveTextures.Count - 1);
        }
Пример #7
0
        public override void render()
        {
            if (mPrimitives == null)
            {
                return;
            }

            for (int k = 0; k < mPrimitives.Count; k++)
            {
                BRenderDevice.getDevice().VertexShader      = null;
                BRenderDevice.getDevice().PixelShader       = null;
                BRenderDevice.getDevice().VertexDeclaration = mPrimitives[k].mVDecl;

                BRenderDevice.getDevice().SetStreamSource(0, mPrimitives[k].mVB, 0, mPrimitives[k].mVertexSize);

                if (mPrimitives[k].mIB != null)
                {
                    BRenderDevice.getDevice().Indices = mPrimitives[k].mIB;
                }

                // And now render the groups with the right textures and materials.
                BRenderDevice.getDevice().SetTexture(0, null);
                for (int i = 0; i < mPrimitives[k].mGroups.Count; i++)
                {
                    if (mPrimitives[k].mGroups[i].mMaterial != null)
                    {
                        if (mPrimitives[k].mGroups[i].mMaterial.mTextures[0].mTexture != null)
                        {
                            BRenderDevice.getDevice().SetTexture(0, mPrimitives[k].mGroups[i].mMaterial.mTextures[0].mTexture);
                        }
                        else
                        {
                            BRenderDevice.getDevice().SetTexture(0, BRenderDevice.getTextureManager().getDefaultTexture(TextureManager.eDefaultTextures.cDefTex_Red));
                        }
                    }
                    else
                    {
                        BRenderDevice.getDevice().SetTexture(0, null);
                    }
                    BRenderDevice.getDevice().DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, mPrimitives[k].mNumVerts, mPrimitives[k].mGroups[i].mStartIndex, mPrimitives[k].mGroups[i].mPrimCount);
                }
            }
        }
Пример #8
0
        public void loadTextures()
        {
            if (mTexChannels == null)
            {
                mTexChannels = new TextureHandle[(int)BTerrainTexturing.eTextureChannels.cDecalChannelCount + 1];
            }

            if (!File.Exists(mFilename))
            {
                mFilename = EditorCore.CoreGlobals.getWorkPaths().mBlankTextureName;
                mTexChannels[(int)BTerrainTexturing.eTextureChannels.cAlbedo]  = BRenderDevice.getTextureManager().getTexture(mFilename); // = TextureLoader.FromFile(BRenderDevice.getDevice(),mFilename);
                mTexChannels[(int)BTerrainTexturing.eTextureChannels.cNormal]  = BRenderDevice.getTextureManager().getTexture(mFilename); // = TextureLoader.FromFile(BRenderDevice.getDevice(), mFilename);
                mTexChannels[(int)BTerrainTexturing.eTextureChannels.cOpacity] = BRenderDevice.getTextureManager().getTexture(mFilename); // = TextureLoader.FromFile(BRenderDevice.getDevice(), mFilename);

                return;
            }


            mTexChannels[(int)BTerrainTexturing.eTextureChannels.cAlbedo] = BRenderDevice.getTextureManager().getTexture(mFilename, TerrainGlobals.getTexturing().activeDecalReloaded);//         mTexChannels[0] = TextureLoader.FromFile(BRenderDevice.getDevice(), mFilename);

            String ext   = Path.GetExtension(mFilename);
            string tName = mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_nm" + ext;

            mTexChannels[(int)BTerrainTexturing.eTextureChannels.cNormal] = BRenderDevice.getTextureManager().getTexture(tName, TerrainGlobals.getTexturing().activeDecalReloaded);// = TextureLoader.FromFile(BRenderDevice.getDevice(), tName);

            tName = mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_op" + ext;
            mTexChannels[(int)BTerrainTexturing.eTextureChannels.cOpacity] = BRenderDevice.getTextureManager().getTexture(tName, TerrainGlobals.getTexturing().activeDecalReloaded);// = TextureLoader.FromFile(BRenderDevice.getDevice(), tName);

            SurfaceDescription sd = mTexChannels[(int)BTerrainTexturing.eTextureChannels.cAlbedo].mTexture.GetLevelDescription(0);

            mWidth  = sd.Width;
            mHeight = sd.Height;

            //calculate our total memory footprint for this texture
            m360MemoryFootprint = 0;
            //m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_df.ddx");
            //m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_nm.ddx");
            //m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_em.ddx");
            //m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_rm.ddx");
            //m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_sp.ddx");
            //m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_op.ddx");
        }
Пример #9
0
        public void loadTextures()
        {
            if (mTexChannels == null)
            {
                mTexChannels = new TextureHandle[(int)BTerrainTexturing.eTextureChannels.cSplatChannelCount];
            }

            if (!File.Exists(mFilename))
            {
                mFilename       = EditorCore.CoreGlobals.getWorkPaths().mBlankTextureName;
                mTexChannels[0] = BRenderDevice.getTextureManager().getTexture(mFilename); // = TextureLoader.FromFile(BRenderDevice.getDevice(),mFilename);
                mTexChannels[1] = BRenderDevice.getTextureManager().getTexture(mFilename); // = TextureLoader.FromFile(BRenderDevice.getDevice(), mFilename);

                return;
            }


            mTexChannels[0] = BRenderDevice.getTextureManager().getTexture(mFilename, TerrainGlobals.getTexturing().activeTextureReloaded);//         mTexChannels[0] = TextureLoader.FromFile(BRenderDevice.getDevice(), mFilename);

            String ext   = Path.GetExtension(mFilename);
            string tName = mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_nm" + ext;

            mTexChannels[1] = BRenderDevice.getTextureManager().getTexture(tName, TerrainGlobals.getTexturing().activeTextureReloaded);// = TextureLoader.FromFile(BRenderDevice.getDevice(), tName);


            //gather our information data for the editor
            mMatHasEmissive = File.Exists(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_em" + ext);
            mMatHasEnvMask  = File.Exists(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_rm" + ext);
            mMatHasSpecular = File.Exists(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_sp" + ext);
            mMatHasMask     = File.Exists(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_mk" + ".bmp");

            //calculate our total memory footprint for this texture
            m360MemoryFootprint  = 0;
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_df.ddx");
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_nm.ddx");
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_em.ddx");
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_rm.ddx");
            m360MemoryFootprint += DDXBridge.give360TextureMemFootprint(mFilename.Substring(0, mFilename.LastIndexOf("_df")) + "_sp.ddx");
        }
Пример #10
0
        public void init(int width, int height, int scaleFactor)
        {
            mScalingFactor = scaleFactor;

            Globals.setValue("4D", "true", true);

            m_iSynthWidth  = width;
            m_iSynthHeight = height;

            m_Quad     = new D3DQuad(true);
            m_QuadDual = new D3DQuad(false);

            allocateBuffers(m_iSynthWidth * mScalingFactor, m_iSynthHeight * mScalingFactor);



            loadPrograms();
            clearJacobianMap();


            createControlPackets();

            // load splat texture for painting
            m_d3dSplat = BRenderDevice.getTextureManager().getTexture(AppDomain.CurrentDomain.BaseDirectory + "textures\\splatBrushMask.png");



            // set miscellaneous render states
            BRenderDevice.getDevice().SetRenderState(RenderStates.DitherEnable, false);
            BRenderDevice.getDevice().SetRenderState(RenderStates.SpecularEnable, false);
            BRenderDevice.getDevice().SetRenderState(RenderStates.Lighting, false);
            BRenderDevice.getDevice().SetRenderState(RenderStates.ZEnable, false);
            BRenderDevice.getDevice().SetRenderState(RenderStates.CullMode, (int)Cull.None);

            // set the world matrix
            BRenderDevice.getDevice().Transform.World = Matrix.Identity;
            BRenderDevice.getDevice().Transform.View = Matrix.Identity;
            BRenderDevice.getDevice().Transform.Projection = Matrix.OrthoOffCenterRH(0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f);
        }
Пример #11
0
        public void loadSet(string filename)
        {
            // saveSet(filename + "1");

            mFullFileName = filename;
            if (mFullFileName.Contains(".xml"))
            {
                mFullFileName = mFullFileName.Substring(0, mFullFileName.LastIndexOf(".xml"));
            }

            foliageSetXML fsXML = new foliageSetXML();

            XmlSerializer s  = new XmlSerializer(typeof(foliageSetXML), new Type[] { });
            Stream        st = File.OpenRead(filename);

            fsXML = (foliageSetXML)s.Deserialize(st);
            st.Close();

            mSetName          = fsXML.SetName;
            mNumVertsPerBlade = Convert.ToInt32(fsXML.numVertsPerType);
            mNumBlades        = Convert.ToInt32(fsXML.typecount);
            mBBMax            = TextVectorHelper.FromString(fsXML.max);
            mBBMin            = TextVectorHelper.FromString(fsXML.min);

            for (int i = 0; i < mNumBlades; i++)
            {
                FoliageBlade fb = new FoliageBlade();
                for (int q = 0; q < mNumVertsPerBlade; q++)
                {
                    Vector3 v  = TextVectorHelper.FromString(fsXML.mBlades[i].mVerts[q].pos);
                    Vector3 n  = TextVectorHelper.FromString(fsXML.mBlades[i].mVerts[q].norm);
                    Vector3 uv = TextVectorHelper.FromString(fsXML.mBlades[i].mVerts[q].uv);

                    fb.verts.Add(v);
                    fb.norms.Add(n);
                    fb.uvs.Add(uv);
                }

                mFoliageBlades.Add(fb);
            }

            fsXML = null;

            denitDeviceData();

            //load our albedo texture;
            string textureName = filename.Substring(0, filename.LastIndexOf(".")) + "_df.tga";

            if (File.Exists(textureName))
            {
                mD3DAlbedoTexture = BRenderDevice.getTextureManager().getTexture(textureName);
                SurfaceDescription sd = mD3DAlbedoTexture.mTexture.GetLevelDescription(0);
                mAlbedoImageWidth = sd.Width;
            }

            textureName = filename.Substring(0, filename.LastIndexOf(".")) + "_op.tga";
            if (File.Exists(textureName))
            {
                mD3DOpacityTexture = BRenderDevice.getTextureManager().getTexture(textureName);
            }


            //create our positions texture
            createD3DTexturesFromBlades();
        }
Пример #12
0
        public bool render()
        {
            if (mSetVBs.Count == 0)
            {
                createRenderVBs();
                if (mSetVBs.Count == 0)
                {
                    return(false);
                }
            }

            BRenderDevice.getDevice().VertexDeclaration = VertexTypes.Pos.vertDecl;

            //my shader is started in the parent FoliageManager class..

            BTerrainQuadNode qn = TerrainGlobals.getTerrain().getQuadNodeLeafArray()[mOwnerQNIndex];

            //find our visual handle index
            //CLM the skirts f**k this up.. just find the highest LOD that's valid...
            BTerrainVisualDataHandle vdh = null;

            for (int i = 0; i < (int)Terrain.BTerrainVisual.eLODLevel.cLODCount; i++)
            {
                if (qn.mVisualDataIndxPerLOD[i] != -1)
                {
                    vdh = TerrainGlobals.getVisual().getVisualHandle(qn.mVisualDataIndxPerLOD[i]);
                    break;
                }
            }

            if (vdh == null)
            {
                return(false);
            }

            //bind my QN positions texture
            FoliageManager.mFoliageGPUShader.mShader.SetValue(FoliageManager.mTerrainQNPosTexture, vdh.mHandle.mPositionsTexture);

            Vector4 QnData = new Vector4((BTerrainQuadNode.getMaxNodeWidth() >> vdh.LOD), TerrainGlobals.getTerrain().getTileScale(), mOwnerNodeDesc.mMinXVert, mOwnerNodeDesc.mMinZVert);

            FoliageManager.mFoliageGPUShader.mShader.SetValue(FoliageManager.mTerrainQNData, QnData);


            for (int setI = 0; setI < mSetsUsed.Count; setI++)
            {
                FoliageSet set = FoliageManager.giveSet(mSetsUsed[setI]);

                float rcpBladeImgWidth = 1.0f / (float)set.mNumBlades;
                FoliageManager.mFoliageGPUShader.mShader.SetValue(FoliageManager.mSetRCPBladeTexWidth, rcpBladeImgWidth);


                FoliageManager.mFoliageGPUShader.mShader.SetValue(FoliageManager.mSetAlbedoTexture,
                                                                  set.mD3DAlbedoTexture == null?
                                                                  BRenderDevice.getTextureManager().getDefaultTexture(TextureManager.eDefaultTextures.cDefTex_Red):
                                                                  set.mD3DAlbedoTexture.mTexture);

                FoliageManager.mFoliageGPUShader.mShader.SetValue(FoliageManager.mSetOpacityTexture,
                                                                  set.mD3DOpacityTexture == null ?
                                                                  BRenderDevice.getTextureManager().getDefaultTexture(TextureManager.eDefaultTextures.cDefTex_White) :
                                                                  set.mD3DOpacityTexture.mTexture);


                FoliageManager.mFoliageGPUShader.mShader.SetValue(FoliageManager.mSetPositionsTexture, set.mD3DPositionsTexture);
                FoliageManager.mFoliageGPUShader.mShader.SetValue(FoliageManager.mSetUVsTexture, set.mD3DUVsTexture);

                //DRAW US FOOL!
                BRenderDevice.getDevice().SetStreamSource(0, mSetVBs[setI], 0);
                BRenderDevice.getDevice().Indices = mSetIBs[setI];

                FoliageManager.mFoliageGPUShader.mShader.CommitChanges();
                BRenderDevice.getDevice().DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, mSetVertCount[setI], 0, mSetPolyCount[setI]);
            }

            return(true);
        }
Пример #13
0
        static public bool doExport(String terrainFileName,
                                    String scenarioFileName,
                                    String outputOverrideDir,
                                    ref ExportSettings expSettings, ref ExportResults results,
                                    bool doXTD, bool doXTT, bool doXTH, bool doXSD, bool doLRP, bool doDEP, bool doTAG, bool doXMB)
        {
            //This is now done outside using work topics
            //if (CoreGlobals.UsingPerforce == true)
            //{
            //   if (!checkPerforceFileAlloances(terrainFileName, scenarioFileName,
            //                                 doXTD, doXTT, doXTH, doXSD, doLRP, doDEP, doTAG, doXMB))
            //      return false;
            //}

            init();
            int maxValues = (doXTD?1:0) +
                            (doXTT?1:0) +
                            (doXTH?1:0) +
                            (doXSD?1:0) +
                            (doLRP?1:0) +
                            (doDEP?1:0) +
                            (doTAG?1:0) +
                            (doXMB?1:0) +
                            (expSettings.AmbientOcclusion != AmbientOcclusion.eAOQuality.cAO_Off?1:0)
            ;

            initOverrideDir(outputOverrideDir);


            mEPB.Init(maxValues);
            mEPB.setName(Path.GetFileNameWithoutExtension(terrainFileName));
            mEPB.Show();
            DateTime start = DateTime.Now;


            GC.Collect();
            GC.WaitForPendingFinalizers();


            mECF.clear();
            mDEP.clear();

            bool sofarSoGood = true;



            if (sofarSoGood && doXTT)
            {
                XTTExporter XTTexporter = new XTTExporter();
                sofarSoGood &= XTTexporter.export_XTT(terrainFileName, expSettings, ref results);
                XTTexporter.destroy();
                XTTexporter = null;
                ExportTo360.mECF.clear();
                ExportProgressDialog.Increase();
            }



            //From here on out we don't need textures in memory..
            if (sofarSoGood && (expSettings.AmbientOcclusion != AmbientOcclusion.eAOQuality.cAO_Off || doXTH))
            {
                BRenderDevice.getTextureManager().freeAllD3DTextureHandles();
            }



            if (sofarSoGood && doXTD)
            {
                XTDExporter XTDexporter = new XTDExporter();
                sofarSoGood &= XTDexporter.export_XTD(terrainFileName, expSettings, ref results);
                XTDexporter.destroy();
                XTDexporter = null;
                ExportTo360.mECF.clear();
                ExportProgressDialog.Increase();
            }



            if (sofarSoGood && doXSD)
            {
                XSDExporter XSDexporter = new XSDExporter();
                sofarSoGood &= XSDexporter.export_XSD(scenarioFileName, expSettings, ref results);
                XSDexporter.destroy();
                if (sofarSoGood && doLRP)
                {
                    sofarSoGood &= XSDexporter.CreateLRP(spliceFilenameWithOverride(scenarioFileName));
                }
                XSDexporter = null;
                ExportTo360.mECF.clear();
                ExportProgressDialog.Increase();
            }


            if (sofarSoGood && doXTH)
            {
                XTHExporter XTHexporter = new XTHExporter();
                sofarSoGood &= XTHexporter.export_XTH(terrainFileName, expSettings, ref results);
                XTHexporter.destroy();
                XTHexporter = null;
                ExportTo360.mECF.clear();
                ExportProgressDialog.Increase();
            }


            // OVERRIDE! if ANY terrain files are changed, then generate a .TAG
            if (sofarSoGood && doTAG && (doXTT | doXTD | doXTH | doXSD))
            {
                TAG      mTAG            = new TAG();
                String[] extentions      = new String[] { ".XTD", ".XTT", ".XTH", ".XSD", ".LRP" };
                String   desiredFilename = "";
                for (int i = 0; i < extentions.Length - 1; i++)
                {
                    desiredFilename = spliceFilenameWithOverride(Path.ChangeExtension(terrainFileName, extentions[i]));
                    mTAG.addFile(desiredFilename);
                }

                //XSD
                desiredFilename = spliceFilenameWithOverride(Path.ChangeExtension(scenarioFileName, extentions[extentions.Length - 2]));
                mTAG.addFile(desiredFilename);
                desiredFilename = spliceFilenameWithOverride(Path.ChangeExtension(scenarioFileName, extentions[extentions.Length - 1]));
                mTAG.addFile(desiredFilename);

                mTAG.writeToFile(spliceFilenameWithOverride(Path.ChangeExtension(scenarioFileName, ".TAG")));
                mTAG = null;


                ExportProgressDialog.Increase();
            }



            if (sofarSoGood && doXTT && doDEP) //CLM XTT is the only one that marks dependents currently...
            {
                mDEP.writeToFile(spliceFilenameWithOverride(terrainFileName));
            }



            if (sofarSoGood && doXMB)
            {
                string outputDir = null;
                if (mOutputOverrideDir != null)
                {
                    outputDir = spliceFilenameWithOverride(terrainFileName);
                    outputDir = Path.GetDirectoryName(outputDir);
                }

                if (File.Exists(Path.ChangeExtension(scenarioFileName, ".SCN")))
                {
                    XMBProcessor.CreateXMB(Path.ChangeExtension(scenarioFileName, ".SCN"), outputDir, false);
                }
                if (File.Exists(Path.ChangeExtension(scenarioFileName, ".GLS")))
                {
                    XMBProcessor.CreateXMB(Path.ChangeExtension(scenarioFileName, ".GLS"), outputDir, false);
                }

                if (File.Exists(Path.ChangeExtension(scenarioFileName, ".DEP")))
                {
                    XMBProcessor.CreateXMB(spliceFilenameWithOverride(Path.ChangeExtension(scenarioFileName, ".DEP")), false);
                }
                ExportProgressDialog.Increase();
            }



            TimeSpan ts = DateTime.Now - start;

            results.totalTime = ts.TotalMinutes;

            destroy();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            //if we've cleared the textures, force them to reload..
            if (expSettings.AmbientOcclusion != AmbientOcclusion.eAOQuality.cAO_Off || doXTH)
            {
                BRenderDevice.getTextureManager().reloadTexturesIfNeeded(true);
            }

            mOutputOverrideDir = null;

            return(sofarSoGood);
        }