public static void UnLoadMCRBakeAssets(MCRSceneContext scene)
 {
     if (null == scene)
     {
         return;
     }
 }
Exemplo n.º 2
0
 public void OnDestroy()
 {
     if (context.ClusterCount > 0 && context.VertexCount > 0)
     {
         MCRRenderer.RemoveFromRenderList(this);
         context.Destroy();
         context = null;
     }
 }
        public static void LoadMCRBakeAsset(MCRSceneContext scene)
        {
            if (null == scene)
            {
                return;
            }


            lock (lockObj)
            {
                bakeAssetsQueue.Enqueue(scene);
            }
        }
        //private static bool isHaveMission()
        //{
        //    return bakeAssetsQueue.Count > 0;
        //}

        private static void ProcessBakeAssetLoadingQueue()
        {
            MCRSceneContext mcrScenecontext = null;

            lock (lockObj)
            {
                if (bakeAssetsQueue.Count > 0)
                {
                    mcrScenecontext = bakeAssetsQueue.Dequeue();
                }
            }

            if (null == mcrScenecontext || mcrScenecontext.bDestroyed)
            {
                return;
            }

            System.IO.BinaryReader reader = new System.IO.BinaryReader(System.IO.File.OpenRead(mcrScenecontext.ClusterInfoAssetsPath));

            int clusterCount = reader.ReadInt32();
            int vertexCount  = reader.ReadInt32();

            //读取cluster
            for (int i = 0; i < clusterCount; i++)
            {
                byte[]      bytes       = reader.ReadBytes(Marshal.SizeOf <ClusterInfo>());
                ClusterInfo clusterinfo = IOUtils.ByteToStruct <ClusterInfo>(bytes);

                if (mcrScenecontext.bDestroyed)
                {
                    reader.Close();
                    return;
                }
                mcrScenecontext.clusterList[i] = clusterinfo;
            }

            //读取顶点
            for (int i = 0; i < vertexCount; i++)
            {
                byte[]     bytes      = reader.ReadBytes(Marshal.SizeOf <VertexInfo>());
                VertexInfo vertexinfo = IOUtils.ByteToStruct <VertexInfo>(bytes);

                if (mcrScenecontext.bDestroyed)
                {
                    reader.Close();
                    return;
                }

                mcrScenecontext.vertexList[i] = vertexinfo;
            }

            if (mcrScenecontext.bDestroyed)
            {
                reader.Close();
                return;
            }

            mcrScenecontext.bLoadFinish = true;

            reader.Close();
        }