Exemplo n.º 1
0
        public bool issueAOGenJob(AmbientOcclusion.eAOQuality quality, bool includeObjects, Controls.AOGenDialog primDlg)
        {
            networkAOInterface.ensureDirectories();

            deleteExistingInputFile();
            deleteExistingResults();
            deleteExistingJobs();

            if (doIHavePendingJobs())
            {
                MessageBox.Show("There are still jobs still being processed from this client. \n Please try again in a few moments.");
                return(false);
            }


            string mHostName = Dns.GetHostName();

            mCurrJobGUID    = System.Guid.NewGuid().ToString();
            mIncludeObjects = includeObjects;

            //Now, start up a thread to watch for file IO
            mControllingDialog = primDlg;
            if (mControllingDialog != null)
            {
                mControllingDialog.setNumWorkUnits(cNumSections);
            }

            mNumSectionsToComplete = cNumSections;


            mWorkerThread = new BackgroundWorker();
            mWorkerThread.WorkerReportsProgress      = true;
            mWorkerThread.WorkerSupportsCancellation = true;
            mWorkerThread.DoWork             += bw_DoWork;
            mWorkerThread.ProgressChanged    += bw_ProgressChanged;
            mWorkerThread.RunWorkerCompleted += bw_RunWorkerCompleted;

            mWorkerThread.RunWorkerAsync(quality);


            {
                //clear current AO Values to zero
                float[] AOVals = TerrainGlobals.getEditor().getAmbientOcclusionValues();
                for (int i = 0; i < AOVals.Length; i++)
                {
                    AOVals[i] = 0.0f;
                }

                if (TerrainGlobals.getTerrain().getQuadNodeRoot() != null)
                {
                    TerrainGlobals.getTerrain().getQuadNodeRoot().clearVisibleDatHandle();
                }
            }



            return(true);
        }
Exemplo n.º 2
0
        public void issueAOGenLocal(AmbientOcclusion.eAOQuality quality, bool includeObjects, Controls.AOGenDialog primDlg)
        {
            mControllingDialog = primDlg;
            if (mControllingDialog != null)
            {
                mControllingDialog.setNumWorkUnits(1);
            }

            TerrainGlobals.getEditor().computeAmbientOcclusion(quality, includeObjects);
            if (mControllingDialog != null)
            {
                mControllingDialog.increaseWorkUnitCount();
            }
        }