public void PreRenderFrame(PipelineCamera cam, ref PipelineCommandData data)
        {
            if (!Decal.decalDatas.isCreated)
            {
                return;
            }
            decalCullResults    = new NativeArray <DecalStrct>(Decal.allDecalCount, Allocator.Temp);
            decalCompareResults = new NativeArray <DecalIndexCompare>(Decal.allDecalCount, Allocator.Temp);
            float2 albedoSize;
            float2 normalSize;

            cullJob = new DecalCullJob
            {
                count                 = 0,
                decalDatas            = decalCullResults.Ptr(),
                frustumPlanes         = (float4 *)proper.frustumPlanes.Ptr(),
                availiableDistanceSqr = lightingEvt.cbdrDistance * lightingEvt.cbdrDistance,
                camPos                = cam.cam.transform.position,
                indexCompares         = decalCompareResults.Ptr(),
                allDatas              = Decal.decalDatas.unsafePtr,
                albedoAtlasSize       = atlasWidth,
                normalAtlasSize       = atlasHeight,
            };
            handle = cullJob.ScheduleRefBurst(Decal.allDecalCount, 32);
            handle = new DecalSortJob
            {
                compares   = decalCompareResults.Ptr(),
                count      = cullJob.count.Ptr(),
                decalDatas = decalCullResults.Ptr(),
            }.Schedule(handle);
        }
Example #2
0
        public void PreRenderFrame(PipelineCamera cam, ref PipelineCommandData data)
        {
            if (!Decal.decalDatas.isCreated)
            {
                return;
            }
            decalCullResults    = new NativeArray <DecalStrct>(Decal.allDecalCount, Allocator.Temp);
            decalCompareResults = new NativeArray <DecalIndexCompare>(Decal.allDecalCount, Allocator.Temp);
            cullJob             = new DecalCullJob
            {
                count                 = 0,
                decalDatas            = decalCullResults.Ptr(),
                frustumPlanes         = (float4 *)proper.frustumPlanes.Ptr(),
                availiableDistanceSqr = lightingEvt.cbdrDistance * lightingEvt.cbdrDistance,
                camPos                = cam.cam.transform.position,
                allDatas              = Decal.decalDatas.unsafePtr,
                camMinPos             = cam.frustumMinPoint,
                camMaxPos             = cam.frustumMaxPoint
            };
            cullJob.indexCompares = decalCompareResults.Ptr();
            handle = cullJob.ScheduleRefBurst(Decal.allDecalCount, max(1, Decal.allDecalCount / 4));

            sortJob.compares   = decalCompareResults.Ptr();
            sortJob.count      = cullJob.count.Ptr();
            sortJob.decalDatas = decalCullResults.Ptr();
            handle             = sortJob.Schedule(handle);
        }
 public override void PreRenderFrame(PipelineCamera cam, ref PipelineCommandData data)
 {
     decalCullResults = new NativeArray <DecalData>(Decal.allDecalCount, Allocator.Temp);
     cullJob          = new DecalCullJob
     {
         count         = 0,
         decalDatas    = (DecalData *)decalCullResults.GetUnsafePtr(),
         frustumPlanes = (float4 *)data.frustumPlanes.Ptr()
     };
     handle = cullJob.ScheduleRef(Decal.allDecalCount, 32);
 }
Example #4
0
 public void PreRenderFrame(PipelineCamera cam, ref PipelineCommandData data)
 {
     decalCullResults = new NativeArray <DecalData>(DecalBase.allDecalCount, Allocator.Temp);
     cullJob          = new DecalCullJob
     {
         count                 = 0,
         decalDatas            = (DecalData *)decalCullResults.GetUnsafePtr(),
         frustumPlanes         = (float4 *)proper.frustumPlanes.Ptr(),
         availiableDistanceSqr = availiableDistance * availiableDistance,
         camPos                = cam.cam.transform.position
     };
     handle = cullJob.ScheduleRef(DecalBase.allDecalCount, 32);
 }