protected override JobHandle OnUpdate(JobHandle inputDeps) { var entityType = GetArchetypeChunkEntityType(); var childType = GetArchetypeChunkBufferType <Child>(true); var childFromEntity = GetBufferFromEntity <Child>(true); var worldSpaceRectFromEntity = GetComponentDataFromEntity <WorldSpaceRect>(); var rectTransformFromEntity = GetComponentDataFromEntity <RectTransform>(true); var rebuildFlagType = GetComponentDataFromEntity <RebuildElementMeshFlag>(); var dpi = ScreenUtils.GetScaledDpi(); var updateHierarchyJob = new UpdateHierarchy { Dpi = new float2(dpi, dpi), RectTransformType = GetArchetypeChunkComponentType <RectTransform>(true), CanvasSizeType = GetArchetypeChunkComponentType <CanvasScreenSize>(true), EntityType = entityType, ChildType = childType, ConstantPhysicalScaler = GetArchetypeChunkComponentType <CanvasConstantPhysicalSizeScaler>(true), ConstantPixelScaler = GetArchetypeChunkComponentType <CanvasConstantPixelSizeScaler>(true), RebuildContext = new HierarchyRebuildContext() { ChildrenFromEntity = childFromEntity, WorldSpaceRectFromEntity = worldSpaceRectFromEntity, RectTransformFromEntity = rectTransformFromEntity, RebuildFlagFromEntity = rebuildFlagType, ElementScaleFromEntity = GetComponentDataFromEntity <ElementScale>(), WorldSpaceMaskFromEntity = GetComponentDataFromEntity <WorldSpaceMask>(), RectMaskFromEntity = GetComponentDataFromEntity <RectMask>(true) } }; var updateHierarchyJobHandle = updateHierarchyJob.Schedule(m_Group, inputDeps); return(updateHierarchyJobHandle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var rectTransformType = GetArchetypeChunkComponentType <RectTransform>(true); var entityType = GetArchetypeChunkEntityType(); var childType = GetArchetypeChunkBufferType <UIChild>(true); var childFromEntity = GetBufferFromEntity <UIChild>(true); var localToWorldFromEntity = GetComponentDataFromEntity <WorldSpaceRect>(); var rectTransformFromEntity = GetComponentDataFromEntity <RectTransform>(true); var rebuildFlagType = GetComponentDataFromEntity <RebuildElementMeshFlag>(); var dpi = ScreenUtils.GetScaledDpi(); var updateHierarchyJob = new UpdateHierarchy { Dpi = new float2(dpi, dpi), ScreenWidth = Screen.width, ScreenHeight = Screen.height, RectTransformType = rectTransformType, EntityType = entityType, ChildType = childType, ChildFromEntity = childFromEntity, LocalToWorldFromEntity = localToWorldFromEntity, RectTransformFromEntity = rectTransformFromEntity, RebuildFlagType = rebuildFlagType, ElementScaleType = GetComponentDataFromEntity <ElementScale>(), ConstantPhysicalScaler = GetArchetypeChunkComponentType <CanvasConstantPhysicalSizeScaler>(true), ConstantPixelScaler = GetArchetypeChunkComponentType <CanvasConstantPixelSizeScaler>(true), WorldSpaceMaskFromEntity = GetComponentDataFromEntity <WorldSpaceMask>(), RectMaskFromEntity = GetComponentDataFromEntity <RectMask>(true) }; var updateHierarchyJobHandle = updateHierarchyJob.Schedule(m_Group, inputDeps); updateHierarchyJobHandle.Complete(); return(updateHierarchyJobHandle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var localToWorldType = GetArchetypeChunkComponentType <LocalToWorld>(true); var childType = GetArchetypeChunkBufferType <Child>(true); var childFromEntity = GetBufferFromEntity <Child>(true); var localToParentFromEntity = GetComponentDataFromEntity <LocalToParent>(true); var localToWorldFromEntity = GetComponentDataFromEntity <LocalToWorld>(); var updateHierarchyJob = new UpdateHierarchy { LocalToWorldType = localToWorldType, ChildType = childType, ChildFromEntity = childFromEntity, LocalToParentFromEntity = localToParentFromEntity, LocalToWorldFromEntity = localToWorldFromEntity }; var updateHierarchyJobHandle = updateHierarchyJob.Schedule(m_RootsGroup, inputDeps); return(updateHierarchyJobHandle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var entityType = GetArchetypeChunkEntityType(); var childType = GetArchetypeChunkBufferType <Child>(true); var dpi = ScreenUtils.GetScaledDpi(); var updateHierarchyJob = new UpdateHierarchy { Dpi = new float2(dpi, dpi), RectTransformType = GetArchetypeChunkComponentType <RectTransform>(true), CanvasSizeType = GetArchetypeChunkComponentType <CanvasScreenSize>(true), EntityType = entityType, ChildType = childType, ConstantPhysicalScaler = GetArchetypeChunkComponentType <CanvasConstantPhysicalSizeScaler>(true), ConstantPixelScaler = GetArchetypeChunkComponentType <CanvasConstantPixelSizeScaler>(true), RebuildContext = HierarchyRebuildContext.Create(this) }; var updateHierarchyJobHandle = updateHierarchyJob.Schedule(m_Group, inputDeps); return(updateHierarchyJobHandle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var localToWorldType = GetComponentTypeHandle <LocalToWorld>(true); var childType = GetBufferTypeHandle <Child>(true); var childFromEntity = GetBufferFromEntity <Child>(true); var localToParentFromEntity = GetComponentDataFromEntity <LocalToParent>(true); var localToWorldFromEntity = GetComponentDataFromEntity <LocalToWorld>(); var updateHierarchyJob = new UpdateHierarchy { LocalToWorldTypeHandle = localToWorldType, ChildTypeHandle = childType, ChildFromEntity = childFromEntity, LocalToParentFromEntity = localToParentFromEntity, LocalToWorldFromEntity = localToWorldFromEntity, LocalToWorldWriteGroupMask = m_LocalToWorldWriteGroupMask, LastSystemVersion = LastSystemVersion }; var updateHierarchyJobHandle = updateHierarchyJob.Schedule(m_RootsGroup, inputDeps); return(updateHierarchyJobHandle); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { int rootCount = m_RootRotGroup.Length + m_RootTransGroup.Length + m_RootRotTransTransformGroup.Length + m_RootRotTransNoTransformGroup.Length; if (rootCount == 0) { return(inputDeps); } var transRoots = new NativeArray <Entity>(m_RootTransGroup.Length, Allocator.TempJob); var rotTransTransformRoots = new NativeArray <Entity>(m_RootRotTransTransformGroup.Length, Allocator.TempJob); var rotTransNoTransformRoots = new NativeArray <Entity>(m_RootRotTransNoTransformGroup.Length, Allocator.TempJob); var rotTransTransformRootMatrices = new NativeArray <float4x4>(m_RootRotTransTransformGroup.Length, Allocator.TempJob); var rotTransNoTransformRootMatrices = new NativeArray <float4x4>(m_RootRotTransNoTransformGroup.Length, Allocator.TempJob); var rotRoots = new NativeArray <Entity>(m_RootRotGroup.Length, Allocator.TempJob); m_Hierarchy.Capacity = math.max(m_ParentGroup.Length + rootCount, m_Hierarchy.Capacity); m_Hierarchy.Clear(); var copyTransRootsJob = new CopyEntities { source = m_RootTransGroup.entities, result = transRoots }; var copyTransRootsJobHandle = copyTransRootsJob.Schedule(m_RootTransGroup.Length, 64, inputDeps); var copyRotTransTransformRootsJob = new CopyEntities { source = m_RootRotTransTransformGroup.entities, result = rotTransTransformRoots }; var copyRotTransTransformRootsJobHandle = copyRotTransTransformRootsJob.Schedule(m_RootRotTransTransformGroup.Length, 64, inputDeps); var copyRotTransNoTransformRootsJob = new CopyEntities { source = m_RootRotTransNoTransformGroup.entities, result = rotTransNoTransformRoots }; var copyRotTransNoTransformRootsJobHandle = copyRotTransNoTransformRootsJob.Schedule(m_RootRotTransNoTransformGroup.Length, 64, inputDeps); var copyRotRootsJob = new CopyEntities { source = m_RootRotGroup.entities, result = rotTransTransformRoots }; var copyRotRootsJobHandle = copyRotRootsJob.Schedule(m_RootRotGroup.Length, 64, inputDeps); var buildHierarchyJob = new BuildHierarchy { hierarchy = m_Hierarchy, transformParents = m_ParentGroup.transformParents, entities = m_ParentGroup.entities }; var buildHierarchyJobHandle = buildHierarchyJob.Schedule(m_ParentGroup.Length, 64, inputDeps); var updateRotTransTransformRootsJob = new UpdateRotTransTransformRoots { rotations = m_RootRotTransTransformGroup.rotations, positions = m_RootRotTransTransformGroup.positions, matrices = rotTransTransformRootMatrices, transforms = m_RootRotTransTransformGroup.transforms }; var updateRotTransTransformRootsJobHandle = updateRotTransTransformRootsJob.Schedule(m_RootRotTransTransformGroup.Length, 64, inputDeps); var updateRotTransNoTransformRootsJob = new UpdateRotTransNoTransformRoots { rotations = m_RootRotTransNoTransformGroup.rotations, positions = m_RootRotTransNoTransformGroup.positions, matrices = rotTransNoTransformRootMatrices }; var updateRotTransNoTransformRootsJobHandle = updateRotTransNoTransformRootsJob.Schedule(m_RootRotTransNoTransformGroup.Length, 64, inputDeps); var jh0 = JobHandle.CombineDependencies(copyRotTransTransformRootsJobHandle, copyRotTransNoTransformRootsJobHandle); var jh1 = JobHandle.CombineDependencies(copyTransRootsJobHandle, jh0); var jh2 = JobHandle.CombineDependencies(copyRotRootsJobHandle, buildHierarchyJobHandle); var jh3 = JobHandle.CombineDependencies(updateRotTransTransformRootsJobHandle, updateRotTransNoTransformRootsJobHandle); var jh4 = JobHandle.CombineDependencies(jh1, jh2); var jh5 = JobHandle.CombineDependencies(jh3, jh4); var updateTransHierarchyJob = new UpdateHierarchy { hierarchy = m_Hierarchy, roots = transRoots, localPositions = m_LocalPositions, localRotations = m_LocalRotations, positions = m_Positions, rotations = m_Rotations, transformMatrices = m_TransformMatrices }; var updateTransHierarchyJobHandle = updateTransHierarchyJob.Schedule(jh5); var updateRotTransTransformHierarchyJob = new UpdateSubHierarchy { hierarchy = m_Hierarchy, roots = rotTransTransformRoots, rootMatrices = rotTransTransformRootMatrices, localPositions = m_LocalPositions, localRotations = m_LocalRotations, positions = m_Positions, rotations = m_Rotations, transformMatrices = m_TransformMatrices }; var updateRotTransTransformHierarchyJobHandle = updateRotTransTransformHierarchyJob.Schedule(updateTransHierarchyJobHandle); var updateRotTransNoTransformHierarchyJob = new UpdateSubHierarchy { hierarchy = m_Hierarchy, roots = rotTransNoTransformRoots, rootMatrices = rotTransNoTransformRootMatrices, localPositions = m_LocalPositions, localRotations = m_LocalRotations, positions = m_Positions, rotations = m_Rotations, transformMatrices = m_TransformMatrices }; var updateRotTransNoTransformHierarchyJobHandle = updateRotTransNoTransformHierarchyJob.Schedule(updateRotTransTransformHierarchyJobHandle); var updateRotHierarchyJob = new UpdateHierarchy { hierarchy = m_Hierarchy, roots = rotRoots, localPositions = m_LocalPositions, localRotations = m_LocalRotations, positions = m_Positions, rotations = m_Rotations, transformMatrices = m_TransformMatrices }; var updateRotHierarchyJobHandle = updateRotHierarchyJob.Schedule(updateRotTransNoTransformHierarchyJobHandle); return(updateRotHierarchyJobHandle); }