private JobHandle OnPerformCulling(BatchRendererGroup batchRendererGroup, BatchCullingContext cullingContext)
    {
        var planes   = Unity.Rendering.FrustumPlanes.BuildSOAPlanePackets(cullingContext.cullingPlanes, Allocator.TempJob);
        var lodParms = LODGroupExtensions.CalculateLODParams(cullingContext.lodParameters);

        var cull = new MyCullJob()
        {
            Planes    = planes,
            LODParams = lodParms,
            IndexList = cullingContext.visibleIndices,
            Batches   = cullingContext.batchVisibility,
            CullDatas = _cullDic,
        };
        // Debug.Log(_cullDic.GetKeyArray(Allocator.Temp).Length); ;
        var handle = cull.Schedule(batchIndex + 1, 1);

        return(handle);
    }
Esempio n. 2
0
    private JobHandle OnPerformCulling(
        BatchRendererGroup rendererGroup,
        BatchCullingContext cullingContext)
    {
        var planes    = FrustumPlanes.BuildSOAPlanePackets(cullingContext.cullingPlanes, Allocator.TempJob);
        var lodParams = LODGroupExtensions.CalculateLODParams(cullingContext.lodParameters);
        var cull      = new MyCullJob()
        {
            Planes    = planes,
            LODParams = lodParams,
            IndexList = cullingContext.visibleIndices,
            Batches   = cullingContext.batchVisibility,
            CullDatas = cullData,
        };
        var handle = cull.Schedule(100, 32, cullingDependency);

        cullingDependency = JobHandle.CombineDependencies(handle, cullingDependency);
        return(handle);
    }
Esempio n. 3
0
        private JobHandle MyOnPerformCulling(BatchRendererGroup renderergroup, BatchCullingContext cullingContext)
        {
            var planes    = OtherUtils.BuildSOAPlanePackets(cullingContext.cullingPlanes, Allocator.TempJob);
            var lodParams = OtherUtils.CalculateLODParams(cullingContext.lodParameters);
            //传入visibleIndices和batchVisibility 在job里面修改
            var cull = new MyCullJob()
            {
                planes    = planes,
                lodParams = lodParams,
                indexList = cullingContext.visibleIndices,
                batches   = cullingContext.batchVisibility,
                cullDatas = cullData,
            };
            //50组lod0 + 50组lod1 = 100
            // cullingDependency 形成队列关系
            var handle = cull.Schedule(100, 32, cullingDependency);

            cullingDependency = JobHandle.CombineDependencies(handle, cullingDependency);
            return(handle);
        }