Beispiel #1
0
 public void purgeObjects()
 {
     NifLoadJob.clearCache();
     foreach (telara_obj obj in GameObject.FindObjectsOfType <telara_obj>())
     {
         // don't unload terrain
         if (obj.gameObject.GetComponent <TerrainObj>() == null)
         {
             obj.unload();
         }
     }
 }
Beispiel #2
0
        public void addJob(telara_obj parent, string filename)
        {
            NifLoadJob job = new NifLoadJob(filename);

            job.parent = parent;
            Vector3 pos = parent.transform.position;

            job.parentPos = pos;

            lock (jobsToAdd)
            {
                jobsToAdd.Enqueue(job);
            }
        }
Beispiel #3
0
 void startJob(NifLoadJob job, TreeDictionary <long, NifLoadJob> runningList, KdTreeNode <float, SCG.List <NifLoadJob> >[] candidates)
 {
     lock (loadingCapsuleQueue)
     {
         loadingCapsuleQueue.Enqueue(job);
     };
     lock (runningList)
     {
         runningList.Add(job.uid, job);
     }
     foreach (KdTreeNode <float, SCG.List <NifLoadJob> > n in candidates)
     {
         n.Value.Remove(job);
     }
     //Debug.Log("Start job:" + job.filename);
     job.Start((System.Threading.ThreadPriority)ProgramSettings.get("OBJECT_LOAD_THREAD_PRIORITY", (int)System.Threading.ThreadPriority.Normal));
 }
Beispiel #4
0
    private bool finalizeJob(NifLoadJob job)
    {
        telara_obj to         = job.parent;
        Transform  loadingObj = to.gameObject.transform.FindDeepChild("Loading");

        if (loadingObj != null)
        {
            GameObject.Destroy(loadingObj.gameObject);
        }
        if (to.gameObject != null)
        {
            // reapply the lod to take into account any new meshes created
            applyLOD(to.gameObject);
        }

        to.doLoad = false;
        to.loaded = true;
        return(true);
    }
Beispiel #5
0
 private void addLoading(NifLoadJob job)
 {
     // Add a loading capsule to the location of the job
     if (!job.IsDone)
     {
         telara_obj obj     = job.parent;
         GameObject loading = (GameObject)GameObject.Instantiate(Resources.Load("LoadingCapsule"));
         loading.name = "Loading";
         SphereCollider sp = obj.GetComponent <SphereCollider>();
         if (sp != null)
         {
             loading.transform.localScale = Vector3.one * 3;
         }
         loading.transform.parent        = obj.gameObject.transform;
         loading.transform.localPosition = Vector3.zero;
         loading.transform.localRotation = Quaternion.identity;
         //applyLOD(loading);
     }
 }
 public void chooseWorld()
 {
     NifLoadJob.clearCache();
     SceneManager.LoadScene("test-decomp");
 }