Ejemplo n.º 1
0
 public static Task Logger(Task task, string taskName)
 {
                 #if DEBUG
     if (_instance == null)
     {
         GameObject go = new GameObject();
         go.name   = "TaskLogger";
         _instance = go.AddComponent <TaskLog>();
     }
     long begin = 0;
     TaskManager.PushFront(task, delegate() {
         //time_t t = time(null)
         begin = DateTime.Now.Ticks;
     });
     TaskManager.PushBack(task, delegate() {
         long all = DateTime.Now.Ticks - begin;
         if (_instance.dict_.ContainsKey(taskName))
         {
             _instance.dict_[taskName] += all;
         }
         else
         {
             _instance.dict_[taskName] = all;
         }
         //Debug.Log(taskName + ":" + all);
     });
                 #endif
     return(task);
 }
Ejemplo n.º 2
0
        private Task task_(VoxelProduct product)
        {
            TaskList tl = new TaskList();

            tl.push(TaskLog.Logger(initVerticesTask(product.draw), "init_vertices"));
            tl.push(TaskLog.Logger(removeFacesTask(), "remove_face"));
            tl.push(TaskLog.Logger(updateVerticesAndTriangleOfProductTask(product), "update_vertices"));

            return(tl);
        }
Ejemplo n.º 3
0
        private Task initVerticesTask(VoxelDrawData data)
        {
            TaskList tl = new TaskList();

            tl.push(TaskLog.Logger(initVertices0Task(data), "init_vertices0"));
            tl.push(TaskLog.Logger(initVertices1Task(data), "init_vertices1"));
            tl.push(TaskLog.Logger(initVertices2Task(), "init_vertices2"));
            tl.push(TaskLog.Logger(initVertices3Task(), "init_vertices3"));
            tl.push(TaskLog.Logger(initVertices4Task(), "init_vertices4"));
            return(tl);
        }
Ejemplo n.º 4
0
        public Task buildData(VoxelStruct vs, MeshDataResult result)
        {
            VoxelProduct product = new VoxelProduct();
            TaskList     tl      = new TaskList();

            VoxelData[] datas = vs.datas.ToArray();
            tl.push(TaskLog.Logger(Build.Task(new VoxelData2Point(datas), product), "d2p"));
            tl.push(TaskLog.Logger(Build.Task(new VoxelSplitSmall(new VectorInt3(8, 8, 8)), product), "vss"));
            tl.push(TaskLog.Logger(Build.Task(new VoxelMeshBuild(), product), "vmb"));             //43%
            tl.push(TaskLog.Logger(Build.Task(new VoxelRemoveSameVertices(), product), "vrv"));
            tl.push(TaskLog.Logger(Build.Task(new VoxelRemoveFace(), product), "vrf"));            //47%
            TaskManager.PushBack(tl, delegate {
                result(product.getMeshData());
            });
            return(tl);
        }