Exemplo n.º 1
0
        protected override JobHandle OnUpdate(JobHandle deps)
        {
            EntityManager.GetAllUniqueSharedComponentDatas(_renderers);

            for (var i = 0; i < _renderers.Count; i++)
            {
                var renderer = _renderers[i];
                if (renderer.WorkMesh == null)
                {
                    continue;
                }

                renderer.Counter.Count = 0;
                _group.SetFilter(renderer);

                var job = new ReconstructionJob()
                {
                    Disintegrators = _group.GetComponentDataArray <Disintegrator>(),
                    Positions      = _group.GetComponentDataArray <Position>(),
                    Facets         = _group.GetComponentDataArray <Facet>(),
                    Vertices       = renderer.Vertices,
                    Normals        = renderer.Normals,
                    Counter        = renderer.Counter
                };

                deps = job.Schedule(_group.CalculateLength(), 16, deps);
            }

            _renderers.Clear();

            return(deps);
        }
Exemplo n.º 2
0
        protected override JobHandle OnUpdate(JobHandle deps)
        {
            EntityManager.GetAllUniqueSharedComponentDatas(_renderers);

            for (var i = 0; i < _renderers.Count; i++)
            {
                var renderer = _renderers[i];
                if (renderer.WorkMesh == null)
                {
                    continue;
                }

                _group.SetFilter(renderer);

                // Reset the triangle counter.
                renderer.Counter.Count = 0;

                // Create a reconstruction job and add it to the job chain.
                var job = new ReconstructionJob()
                {
                    Particles = _group.GetComponentDataArray <Particle>(),
                    Positions = _group.GetComponentDataArray <Position>(),
                    Triangles = _group.GetComponentDataArray <Triangle>(),
                    Vertices  = renderer.Vertices,
                    Normals   = renderer.Normals,
                    Counter   = renderer.Counter
                };

                deps = job.Schedule(_group.CalculateLength(), 16, deps);
            }

            _renderers.Clear();

            return(deps);
        }