protected override void OnCreate()
        {
            m_MissingWorldRenderBounds = GetEntityQuery
                                         (
                new EntityQueryDesc {
                All  = new[] { ComponentType.ReadOnly <RenderBounds>(), ComponentType.ReadOnly <LocalToWorld>() },
                None = new[] { ComponentType.ReadOnly <WorldRenderBounds>(), ComponentType.ReadOnly <Frozen>() }
            }
                                         );

            m_MissingWorldChunkRenderBounds = GetEntityQuery
                                              (
                new EntityQueryDesc {
                All  = new[] { ComponentType.ReadOnly <RenderBounds>(), ComponentType.ReadOnly <LocalToWorld>() },
                None = new[] { ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(), ComponentType.ReadOnly <Frozen>() }
            }
                                              );

            m_WorldRenderBounds = GetEntityQuery
                                  (
                new EntityQueryDesc {
                All  = new[] { ComponentType.ChunkComponent <ChunkWorldRenderBounds>(), ComponentType.ReadWrite <WorldRenderBounds>(), ComponentType.ReadOnly <RenderBounds>(), ComponentType.ReadOnly <LocalToWorld>() },
                None = new[] { ComponentType.ReadOnly <Frozen>() }
            }
                                  );

            var originalSystem = World.GetOrCreateSystem <Unity.Rendering.RenderBoundsUpdateSystem>();

            originalSystem.Enabled = false;
        }
        protected override void OnCreate()
        {
            //@TODO: Support SetFilter with EntityQueryDesc syntax

            m_FrozenGroup = GetEntityQuery(
                ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(),
                ComponentType.ReadOnly <WorldRenderBounds>(),
                ComponentType.ReadOnly <LocalToWorld>(),
                ComponentType.ReadOnly <RenderMesh>(),
                ComponentType.ReadOnly <FrozenRenderSceneTag>()
                );
            m_DynamicGroup = GetEntityQuery(
                ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(),
                ComponentType.Exclude <FrozenRenderSceneTag>(),
                ComponentType.ReadOnly <WorldRenderBounds>(),
                ComponentType.ReadOnly <LocalToWorld>(),
                ComponentType.ReadOnly <FloatMaterialPropertyBlock>(),
                ComponentType.ReadOnly <RenderMesh>()
                );

            // This component group must include all types that are being used by the culling job
            m_CullingJobDependencyGroup = GetEntityQuery(
                ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(),
                ComponentType.ReadOnly <RootLodRequirement>(),
                ComponentType.ReadOnly <LodRequirement>(),
                ComponentType.ReadOnly <WorldRenderBounds>()
                );

            m_InstancedRenderMeshBatchGroup = new InstancedRenderMeshBatchGroup(EntityManager, this, m_CullingJobDependencyGroup);
            m_SubsceneTagVersion            = new NativeHashMap <FrozenRenderSceneTag, int>(1000, Allocator.Persistent);
            m_LastKnownSubsceneTagVersion   = new NativeList <SubSceneTagOrderVersion>(Allocator.Persistent);
        }
Ejemplo n.º 3
0
        protected override void OnCreate()
        {
            m_MissingWorldRenderBounds = GetEntityQuery
                                         (
                new EntityQueryDesc
            {
                All  = new[] { ComponentType.ReadOnly <RenderBounds>(), ComponentType.ReadOnly <LocalToWorld>() },
                None = new[] { ComponentType.ReadOnly <WorldRenderBounds>(), ComponentType.ReadOnly <Frozen>() }
            }
                                         );

            m_MissingWorldChunkRenderBounds = GetEntityQuery
                                              (
                new EntityQueryDesc
            {
                All  = new[] { ComponentType.ReadOnly <RenderBounds>(), ComponentType.ReadOnly <LocalToWorld>() },
                None = new[] { ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(), ComponentType.ReadOnly <Frozen>() }
            }
                                              );

            m_WorldRenderBounds = GetEntityQuery
                                  (
                new EntityQueryDesc
            {
                All  = new[] { ComponentType.ChunkComponent <ChunkWorldRenderBounds>(), ComponentType.ReadWrite <WorldRenderBounds>(), ComponentType.ReadOnly <RenderBounds>(), ComponentType.ReadOnly <LocalToWorld>() },
                None = new[] { ComponentType.ReadOnly <Frozen>() }
            }
                                  );
        }
        protected override void OnCreate()
        {
            m_MissingHybridChunkInfo = GetEntityQuery(new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(),
                    ComponentType.ReadOnly <WorldRenderBounds>(),
                    ComponentType.ReadOnly <LocalToWorld>(),
                    ComponentType.ReadOnly <RenderMesh>(),
                },
                None = new[]
                {
                    ComponentType.ChunkComponentReadOnly <HybridChunkInfo>(),
                    ComponentType.ReadOnly <DisableRendering>(),
                },

                // TODO: Add chunk component to disabled entities and prefab entities to work around
                // the fragmentation issue where entities are not added to existing chunks with chunk
                // components. Remove this once chunk components don't affect archetype matching
                // on entity creation.
                Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab,
            });

            m_DisabledRenderingQuery = GetEntityQuery(new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ReadOnly <DisableRendering>(),
                },
            });
        }
Ejemplo n.º 5
0
 protected override void OnCreate()
 {
     m_query = GetEntityQuery(
         ComponentType.ReadOnly <MeshRenderer>(),
         ComponentType.ReadOnly <LitMeshReference>(),
         ComponentType.ReadOnly <LocalToWorld>(),
         ComponentType.ReadOnly <WorldBounds>(),
         ComponentType.ReadOnly <WorldBoundingSphere>(),
         ComponentType.ChunkComponentReadOnly <ChunkWorldBoundingSphere>(),
         ComponentType.ChunkComponentReadOnly <ChunkWorldBounds>(),
         ComponentType.ReadOnly <RenderToPasses>()
         );
 }
 public static EntityQueryDesc GetHybridRenderedQueryDesc()
 {
     return(new EntityQueryDesc
     {
         All = new[]
         {
             ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>(),
             ComponentType.ReadOnly <WorldRenderBounds>(),
             ComponentType.ReadOnly <LocalToWorld>(),
             ComponentType.ReadOnly <RenderMesh>(),
             ComponentType.ChunkComponent <HybridChunkInfo>(),
         },
     });
 }
 protected override void OnCreate()
 {
     query_Matrix = GetEntityQuery(ComponentType.ReadOnly <SpriteMatrix>(),
                                   ComponentType.ChunkComponentReadOnly <SpriteMatrixChangeTag>(),
                                   ComponentType.ReadOnly <SpriteSheetPointer>(),
                                   ComponentType.ReadOnly <SpriteRenderSubject>(),
                                   ComponentType.ReadOnly <BufferedRenderSubjectTag>());
     query_Color = GetEntityQuery(ComponentType.ReadOnly <SpriteColor>(),
                                  ComponentType.ReadOnly <SpriteSheetPointer>(),
                                  ComponentType.ReadOnly <SpriteRenderSubject>(),
                                  ComponentType.ReadOnly <BufferedRenderSubjectTag>());
     query_Index = GetEntityQuery(ComponentType.ReadOnly <SpriteRenderSubject>(),
                                  ComponentType.ReadOnly <SpriteSheetPointer>(),
                                  ComponentType.ReadOnly <BufferedRenderSubjectTag>());
     renderingSystem = World.GetExistingSystem <SpriteRenderingSystem>();
 }
Ejemplo n.º 8
0
 protected override void OnCreate()
 {
     _renderGroup    = new BatchRendererGroup(OnPerformCulling);
     _spriteEntities = Entities.WithAllReadOnly <SpriteComponent, LocalToWorld, SharedSpriteMaterialComponent>().ToEntityQuery();
     _spriteWithMesh = GetEntityQuery(new EntityQueryDesc
     {
         All = new[] {
             ComponentType.ReadOnly <SharedSpriteMaterialComponent>(),
             ComponentType.ChunkComponentReadOnly <ChunkSpriteMeshComponent>()
         },
     });
     _spriteMissingMesh = GetEntityQuery(new EntityQueryDesc
     {
         All  = new[] { ComponentType.ReadOnly <SharedSpriteMaterialComponent>() },
         None = new[] { ComponentType.ChunkComponent <ChunkSpriteMeshComponent>() }
     });
 }
        protected override void OnCreate()
        {
            m_MissingWorldRenderBounds = GetEntityQuery
                                         (
                new EntityQueryDesc
            {
                All     = new[] { ComponentType.ReadOnly <RenderBounds>(), ComponentType.ReadOnly <LocalToWorld>() },
                None    = new[] { ComponentType.ReadOnly <WorldRenderBounds>() },
                Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab
            }
                                         );

            m_MissingWorldChunkRenderBounds = GetEntityQuery
                                              (
                new EntityQueryDesc
            {
                All     = new[] { ComponentType.ReadOnly <RenderBounds>(), ComponentType.ReadOnly <LocalToWorld>() },
                None    = new[] { ComponentType.ChunkComponentReadOnly <ChunkWorldRenderBounds>() },
                Options = EntityQueryOptions.IncludeDisabled | EntityQueryOptions.IncludePrefab
            }
                                              );
        }
Ejemplo n.º 10
0
        protected override void OnCreate()
        {
            m_missingWorldRectTransformsQuery = GetEntityQuery(
                new EntityQueryDesc {
                All = new[] {
                    ComponentType.ReadOnly <LocalRectTransform>(),
                    ComponentType.ReadOnly <LocalToWorld>()
                },
                None = new[] {
                    ComponentType.ReadOnly <WorldRectTransform>(),
                    ComponentType.ReadOnly <Frozen>()
                }
            });

            m_missingWorldChunkRectTransformsQuery = GetEntityQuery(
                new EntityQueryDesc {
                All = new[] {
                    ComponentType.ReadOnly <LocalRectTransform>(),
                    ComponentType.ReadOnly <LocalToWorld>()
                },
                None = new[] {
                    ComponentType.ChunkComponentReadOnly <ChunkWorldRectTransform>(),
                    ComponentType.ReadOnly <Frozen>()
                }
            });

            m_worldRectTransformQuery = GetEntityQuery(
                new EntityQueryDesc {
                All = new[] {
                    ComponentType.ChunkComponent <ChunkWorldRectTransform>(),
                    ComponentType.ReadWrite <WorldRectTransform>(),
                    ComponentType.ReadOnly <LocalRectTransform>(),
                    ComponentType.ReadOnly <LocalToWorld>()
                },
                None = new[] { ComponentType.ReadOnly <Frozen>() }
            });
        }
Ejemplo n.º 11
0
 protected override void OnCreate()
 {
     srs = World.GetExistingSystem <SpriteRenderingSystem>();
     if (UseLocalToWorldInsteadOfTranslation)
     {
         query = GetEntityQuery(
             ComponentType.ReadOnly <LocalToWorld>(),
             ComponentType.ReadOnly <Scale>(),
             ComponentType.ReadOnly <Rotation2D>(),
             ComponentType.ChunkComponentReadOnly <SpriteMatrixChangeTag>(),
             ComponentType.ReadWrite <SpriteMatrix>(),
             ComponentType.ReadOnly <BufferedRenderSubjectTag>());
     }
     else
     {
         query = GetEntityQuery(
             ComponentType.ReadOnly <Translation>(),
             ComponentType.ReadOnly <Scale>(),
             ComponentType.ReadOnly <Rotation2D>(),
             ComponentType.ChunkComponentReadOnly <SpriteMatrixChangeTag>(),
             ComponentType.ReadWrite <SpriteMatrix>(),
             ComponentType.ReadOnly <BufferedRenderSubjectTag>());
     }
 }
Ejemplo n.º 12
0
        public void Create(EntityManager entityManager)
        {
            m_OccluderGroup = entityManager.CreateEntityQuery(new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ReadOnly <WorldRenderBounds>(),
                    ComponentType.ReadOnly <LocalToWorld>(),
                    ComponentType.ChunkComponentReadOnly <HybridChunkInfo>(),
                    ComponentType.ReadOnly <OcclusionMesh>(),
                },
            });

            m_ProxyOccluderGroup = entityManager.CreateEntityQuery(new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ReadOnly <LocalToWorld>(),
                    ComponentType.ReadOnly <OcclusionMesh>(),
                },
                None = new[]
                {
                    ComponentType.ReadOnly <RenderMesh>(),
                }
            });

            m_OcclusionTestTransformGroup = entityManager.CreateEntityQuery(new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ReadOnly <RenderBounds>(),
                    ComponentType.ReadOnly <LocalToWorld>(),
                    ComponentType.ReadOnly <OcclusionTest>(),
                },
            });

            m_OcclusionTestGroup = entityManager.CreateEntityQuery(new EntityQueryDesc
            {
                All = new[]
                {
                    ComponentType.ChunkComponentReadOnly <HybridChunkInfo>(),
                    ComponentType.ReadOnly <OcclusionTest>(),
                },
            });

            //We rasterize multiple depthBuffer in parallel and then merge them together.
            //For a 512x512 depth buffer the memory size is around 100KB per depth buffer
            //after a certain amount of parallel job we stop getting performance gain when scaling so for now we limit the amount of depth buffer available to 10 to limit our memory usage
            int mocCount = Math.Min(10, Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerMaximumCount);

            m_BurstIntrinsicsArray = new NativeArray <IntPtr>(mocCount, Allocator.Persistent);

            for (int i = 0; i < m_BurstIntrinsicsArray.Length; i++)
            {
                Occlusion.MOC.BurstIntrinsics *mocBurstIntrinsics = (MOC.BurstIntrinsics *)Memory.Unmanaged.Allocate(sizeof(MOC.BurstIntrinsics), 64, Allocator.Persistent);
                mocBurstIntrinsics->Create((uint)m_MOCDepthSize, (uint)m_MOCDepthSize);

                m_BurstIntrinsicsArray[i] = (IntPtr)mocBurstIntrinsics;
            }


#if UNITY_MOC_NATIVE_AVAILABLE
            m_MocNativeArray = new NativeArray <IntPtr>(mocCount, Allocator.Persistent);
            for (int i = 0; i < m_MocNativeArray.Length; i++)
            {
                // TODO: make chosable, propagate to settings
                void *mocNative = INTEL_MOC.MOCNative.CreateMOC(
                    //INTEL_MOC.WantedImplementation.AUTO
                    //INTEL_MOC.WantedImplementation.SSE2
                    INTEL_MOC.WantedImplementation.SSE41
                    );

                m_MocNativeArray[i] = (IntPtr)mocNative;
            }
#endif
        }