public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!chunk.DidChange(RendererBounds, LastSystemVersion) && !chunk.DidChange(LocalToWorld, LastSystemVersion)) { return; } //@TODO: Delta change... var worldBounds = chunk.GetNativeArray(WorldRenderBounds); var localBounds = chunk.GetNativeArray(RendererBounds); var localToWorld = chunk.GetNativeArray(LocalToWorld); MinMaxAABB combined = MinMaxAABB.Empty; for (int i = 0; i != localBounds.Length; i++) { var transformed = AABB.Transform(localToWorld[i].Value, localBounds[i].Value); worldBounds[i] = new WorldRenderBounds { Value = transformed }; combined.Encapsulate(transformed); } chunk.SetChunkComponentData(ChunkWorldRenderBounds, new ChunkWorldRenderBounds { Value = combined }); }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!chunk.DidChange(RectTransformType, LastSystemVersion) && !chunk.DidChange(LocalToWorldType, LastSystemVersion)) { return; } var rectTransforms = chunk.GetNativeArray(RectTransformType); var localToWorld = chunk.GetNativeArray(LocalToWorldType); var worldRectTransforms = chunk.GetNativeArray(WorldRectTransformType); MinMaxAABB combined = MinMaxAABB.Empty; for (int i = 0; i != rectTransforms.Length; i++) { var transformed = AABB.Transform(localToWorld[i].Value, rectTransforms[i].Value); worldRectTransforms[i] = new WorldRectTransform { Value = transformed }; combined.Encapsulate(transformed); } chunk.SetChunkComponentData(ChunkWorldRectTransformType, new ChunkWorldRectTransform { Value = combined }); }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var inputAChanged = chunk.DidChange(CInputA_TypeHandle, LastSystemVersion); var inputBChanged = chunk.DidChange(CInputB_TypeHandle, LastSystemVersion); // If neither component changed, skip the current chunk if (!(inputAChanged || inputBChanged)) { return; } // 为了方便,去掉brust编译 UnityEngine.Debug.Log("------------Change-------------"); var InputA_Array = chunk.GetNativeArray(CInputA_TypeHandle); var InputB_Array = chunk.GetNativeArray(CInputB_TypeHandle); var OutPut_Array = chunk.GetNativeArray(COutput_TypeHandle); for (int i = 0; i < chunk.Count; i++) { OutPut_Array[i] = new COutput { Value = InputA_Array[i].Value + InputB_Array[i].Value }; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!chunk.DidChange(LocalToWorldType, LastSystemVersion) && !chunk.DidChange(ChildType, LastSystemVersion)) { return; } var chunkLocalToWorld = chunk.GetNativeArray(LocalToWorldType); var chunkChildren = chunk.GetBufferAccessor(ChildType); for (var i = 0; i < chunk.Count; i++) { var localToWorldMatrix = chunkLocalToWorld[i].Value; var children = chunkChildren[i]; for (var j = 0; j < children.Length; j++) { TopLevelChildren[firstEntityIndex + i + j] = new ChildInfo { Child = children[j].Value, ParentLocalToWorld = localToWorldMatrix } } ; } } }
public unsafe void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { bool didChunkChange = chunk.DidChange(PositionType, m_LastSystemVersion) || chunk.DidChange(RotationType, m_LastSystemVersion) || chunk.DidChange(PhysicsColliderType, m_LastSystemVersion); ChunkHasChangesOutput[chunkIndex] = didChunkChange ? 1 : 0; }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var didChunkChange = chunk.DidChange(LocalToWorldType, LastSystemVersion) || chunk.DidChange(TranslationType, LastSystemVersion) || chunk.DidChange(RotationType, LastSystemVersion) || chunk.DidChange(PhysicsColliderType, LastSystemVersion); ChunkHasChangesOutput[chunkIndex] = didChunkChange ? 1 : 0; }
public void Execute(ArchetypeChunk batchInChunk, int batchIndex) { bool chunkHasChanges = batchInChunk.DidChange(LocalToWorldTypeHandleInfo, L2WChangeVersion); if (!chunkHasChanges) { return; // early out if the chunk transforms haven't changed } NativeArray <LocalToWorld> transforms = batchInChunk.GetNativeArray <LocalToWorld>(LocalToWorldTypeHandleInfo); UnityEngine.Bounds bounds = new UnityEngine.Bounds(); bounds.center = transforms[0].Position; for (int i = 1; i < transforms.Length; i++) { bounds.Encapsulate(transforms[i].Position); } batchInChunk.SetChunkComponentData( ChunkAabbTypeHandleInfo, new ChunkAABB() { Value = bounds.ToAABB() }); }
public void Execute(ArchetypeChunk batchInChunk, int batchIndex) { if (batchInChunk.DidChange(ParentTypeHandle, LastSystemVersion)) { var chunkPreviousParents = batchInChunk.GetNativeArray(PreviousParentTypeHandle); var chunkParents = batchInChunk.GetNativeArray(ParentTypeHandle); var chunkEntities = batchInChunk.GetNativeArray(EntityTypeHandle); for (int j = 0; j < batchInChunk.Count; j++) { if (chunkParents[j].Value != chunkPreviousParents[j].Value) { var childEntity = chunkEntities[j]; var parentEntity = chunkParents[j].Value; var previousParentEntity = chunkPreviousParents[j].Value; ParentChildrenToAdd.Add(parentEntity, childEntity); UniqueParents.TryAdd(parentEntity, 0); if (previousParentEntity != Entity.Null) { ParentChildrenToRemove.Add(previousParentEntity, childEntity); UniqueParents.TryAdd(previousParentEntity, 0); } chunkPreviousParents[j] = new PreviousParent { Value = parentEntity }; } } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { bool weaponFiredChanged = chunk.DidChange <Weapon>(WeaponType, LastSystemVersion); if (!weaponFiredChanged) { return; } var chunkWeapons = chunk.GetNativeArray(WeaponType); var chunkTranslations = chunk.GetNativeArray(TranslationType); var chunkRotations = chunk.GetNativeArray(RotationType); for (int i = 0; i < chunk.Count; i++) { Weapon weapon = chunkWeapons[i]; Translation translation = chunkTranslations[i]; Rotation rotation = chunkRotations[i]; Entity projectile = CommandBuffer.Instantiate(weapon.ProjectilePrefab); CommandBuffer.SetComponent(projectile, new Translation { Value = translation.Value }); CommandBuffer.SetComponent(projectile, new Rotation { Value = rotation.Value }); } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (chunk.DidChange(ParentType, LastSystemVersion)) { var chunkPreviousParents = chunk.GetNativeArray(PreviousParentType); var chunkParents = chunk.GetNativeArray(ParentType); var chunkEntities = chunk.GetNativeArray(EntityType); for (int j = 0; j < chunk.Count; j++) { if (chunkParents[j].Value != chunkPreviousParents[j].Value) { var childEntity = chunkEntities[j]; ltsAccess[childEntity] = ltsAccess[childEntity].RecordParentChange(tsAccess[childEntity].KeepTimeScaleOnParentChange); var parentEntity = chunkParents[j].Value; var previousParentEntity = chunkPreviousParents[j].Value; ParentChildrenToAdd.Add(parentEntity, childEntity); UniqueParents.TryAdd(parentEntity, 0); if (previousParentEntity != Entity.Null) { ParentChildrenToRemove.Add(previousParentEntity, childEntity); UniqueParents.TryAdd(previousParentEntity, 0); } chunkPreviousParents[j] = new PreviousParentTime { Value = parentEntity }; } } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!chunk.DidChange(SpriteAnimationTimeSpeedStateType, LastSystemVersion)) { return; } var states = chunk.GetNativeArray(SpriteAnimationTimeSpeedStateType); var playingStates = chunk.GetNativeArray(SpriteAnimationPlayingStateType); var propertyComponents = chunk.GetNativeArray(PropertyType); if (propertyComponents.Length > 0) { var clipSet = ClipSetFromEntity[Filter.ClipSetEntity][Filter.ClipIndex]; for (var i = 0; i < propertyComponents.Length; ++i) { var isPlaying = clipSet.Loop || clipSet.ComputeNormalizedTime(states[i].Time) > clipSet.ComputeNormalizedTime(states[i].PrevioutTime); propertyComponents[i] = new TProperty { Value = clipSet.GetValue(states[i].Time) }; if (isPlaying) { playingStates[i] = new SpriteAnimationPlayingState { Value = true } } ; } } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (Changed.Value || (!ForceChange && !chunk.DidChange(ChunkType, LastSystemVersion))) { return; } Changed.Value = true; }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!ForceChange && !chunk.DidChange(ChunkType, LastSystemVersion)) { return; } ChangedIndices[chunkIndex] = firstEntityIndex; }
public void Execute(ArchetypeChunk batchInChunk, int batchIndex) { bool didBatchChange = batchInChunk.DidChange(LocalToWorldType, m_LastSystemVersion) || batchInChunk.DidChange(PositionType, m_LastSystemVersion) || batchInChunk.DidChange(RotationType, m_LastSystemVersion) || batchInChunk.DidChange(PhysicsColliderType, m_LastSystemVersion) || batchInChunk.DidOrderChange(m_LastSystemVersion); if (didBatchChange) { // Note that multiple worker threads may be running at the same time. // They either write 1 to Result[0] or not write at all. In case multiple // threads are writing 1 to this variable, in C#, reads or writes of int // data type are atomic, which guarantees that Result[0] is 1. Result[0] = 1; } }
public void Execute(ArchetypeChunk batchInChunk, int batchIndex) { bool updateChildrenTransform = batchInChunk.DidChange <LocalToWorld>(LocalToWorldTypeHandle, LastSystemVersion) || batchInChunk.DidChange <Child>(ChildTypeHandle, LastSystemVersion); var chunkLocalToWorld = batchInChunk.GetNativeArray(LocalToWorldTypeHandle); var chunkChildren = batchInChunk.GetBufferAccessor(ChildTypeHandle); for (int i = 0; i < batchInChunk.Count; i++) { var localToWorldMatrix = chunkLocalToWorld[i].Value; var children = chunkChildren[i]; for (int j = 0; j < children.Length; j++) { ChildLocalToWorld(localToWorldMatrix, children[j].Value, updateChildrenTransform); } } }
public void Execute(ArchetypeChunk chunk, int index, int entityOffset) { bool updateChildrenTimeScale = chunk.DidChange <TimeScale>(TimeScaleType, LastSystemVersion) || chunk.DidChange <ChildTime>(ChildType, LastSystemVersion); var chunkTimeScale = chunk.GetNativeArray(TimeScaleType); var chunkChildren = chunk.GetBufferAccessor(ChildType); for (int i = 0; i < chunk.Count; i++) { var timeScale = chunkTimeScale[i].value; var children = chunkChildren[i]; for (int j = 0; j < children.Length; j++) { ChildTimeScale(timeScale, children[j].Value, updateChildrenTimeScale, 0); } } }
public void Execute(ArchetypeChunk chunk, int index, int entityOffset) { if (!chunk.DidChange(LocalToWorldType, LastSystemVersion) && !chunk.DidChange(LocalToParentType, LastSystemVersion) && !chunk.DidChange(ChildType, LastSystemVersion)) { return; } var chunkLocalToWorld = chunk.GetNativeArray(LocalToWorldType); var chunkChildren = chunk.GetBufferAccessor(ChildType); for (int i = 0; i < chunk.Count; i++) { var localToWorldMatrix = chunkLocalToWorld[i].Value; var children = chunkChildren[i]; for (int j = 0; j < children.Length; j++) { ChildLocalToWorld(localToWorldMatrix, children[j].Value); } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var inputAChanged = chunk.DidChange(InputATypeHandle, LastSystemVersion); var inputBChanged = chunk.DidChange(InputBTypeHandle, LastSystemVersion); // If neither component changed, skip the current chunk if (!(inputAChanged || inputBChanged)) { return; } var inputAs = chunk.GetNativeArray(InputATypeHandle); var inputBs = chunk.GetNativeArray(InputBTypeHandle); var outputs = chunk.GetNativeArray(OutputTypeHandle); for (var i = 0; i < outputs.Length; i++) { outputs[i] = new Output { Value = inputAs[i].Value + inputBs[i].Value }; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!ExtractAll && !chunk.DidChange(ChunkType, LastSystemVersion)) { return; } var components = chunk.GetNativeArray(ChunkType); for (var i = 0; i < components.Length; ++i) { Values[firstEntityIndex + i] = new half4x4(components[i].Value); } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!chunk.DidChange(ChunkType, LastSystemVersion)) { return; } var entities = chunk.GetNativeArray(EntityType); var components = chunk.GetNativeArray(ChunkType); for (var i = 0; i < chunk.Count; ++i) { ChangedComponents.TryAdd(entities[i], components[i]); } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { bool structuralChange = chunk.DidChange(SpecCube0Handle, LastSystemVersion); if (structuralChange || DefaultSpecCubeChanged) { var specCube0s = chunk.GetNativeArray(SpecCube0Handle); for (int i = 0; i < chunk.Count; ++i) { var specCube = specCube0s[i]; specCube.Value = DefaultSpecCube; specCube0s[i] = specCube; } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!chunk.DidChange(LocalToWorldType, LastSystemVersion)) { return; } var chunkLocalToWorld = chunk.GetNativeArray(LocalToWorldType); var chunkWorldToLocal = chunk.GetNativeArray(WorldToLocalType); for (int i = 0; i < chunk.Count; i++) { var localToWorld = chunkLocalToWorld[i].Value; chunkWorldToLocal[i] = new WorldToLocal { Value = math.inverse(localToWorld) }; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var didChange = chunk.DidChange(ComponentAs, LastSystemVersion); if (!didChange) { return; } Debug.LogError("JobA running!"); var compANative = chunk.GetNativeArray(ComponentAs); // for (int i = 0; i < compANative.Length; i++) // { // compANative[i] = new ComponentA() // { // Value = i, // }; // } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var localToWorldChunkChanged = chunk.DidChange(LocalToWorldType, LastSystemVersion); if (ChangedLookAtEntities.Length == 0 && !localToWorldChunkChanged) { return; } var lookAtArray = chunk.GetNativeArray(LookAtType); var localToWorldArray = new NativeArray <LocalToWorld>(); for (var i = 0; i < chunk.Count; ++i) { var lookAtEntity = lookAtArray[i].Value; if (!LocalToWorldFromEntity.Exists(lookAtEntity)) { continue; } // Avoid multiple nested rotations if (TransformUtility.ExistsInHierarchy(lookAtEntity, ParentFromEntity, LookFromEntity)) { continue; } if (!localToWorldChunkChanged && !ChangedLookAtEntities.ContainsKey(lookAtEntity)) { continue; } localToWorldArray = localToWorldArray.IsCreated ? localToWorldArray : chunk.GetNativeArray(LocalToWorldType); var localToWorld = localToWorldArray[i]; var forward = math.normalize(LocalToWorldFromEntity[lookAtEntity].Value.Forward()); var up = math.normalize(LocalToWorldFromEntity[lookAtEntity].Value.Up()); if (!math.cross(forward, up).Equals(float3.zero)) { localToWorldArray[i] = new LocalToWorld { Value = math.mul(new float4x4(quaternion.LookRotation(forward, up), localToWorld.Position), float4x4.Scale(localToWorld.Value.Scale())) } } ; } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var isChange = chunk.DidChange(PositionArch, LastSystemVersion); if (!isChange) { return; } var positionNativeArray = chunk.GetNativeArray(PositionArch); var faceNativeArray = chunk.GetNativeArray(FaceArch); var localToWorldNativeArray = chunk.GetNativeArray(LocalToWorldArch); var length = positionNativeArray.Length; for (int i = 0; i < length; i++) { localToWorldNativeArray[i] = new LocalToWorldComponent { Value = float4x4.TRS(positionNativeArray[i].Value, faceNativeArray[i].Value, 1), }; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!chunk.DidChange(SpriteAnimationStateType, LastSystemVersion)) { return; } var states = chunk.GetNativeArray(SpriteAnimationStateType); var propertyComponents = chunk.GetNativeArray(PropertyType); if (propertyComponents.Length > 0) { ref var clipSet = ref ClipSetFromEntity[Filter.ClipSetEntity][Filter.ClipIndex].Value.Value; for (var i = 0; i < propertyComponents.Length; ++i) { propertyComponents[i] = new TProperty { Value = clipSet.GetValue(states[i].Time) } } ; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (!chunk.DidChange(LocalToWorldType, LastSystemVersion) && !chunk.DidChange(TextDataType, LastSystemVersion) && !chunk.DidChange(TextRendererType, LastSystemVersion) && !chunk.DidChange(ColorValueType, LastSystemVersion) && !chunk.DidChange(ColorMultiplierType, LastSystemVersion) && !chunk.DidChange(LocalRectTransformType, LastSystemVersion)) { return; } var textDataArray = chunk.GetNativeArray(TextDataType); var worldRenderBoundsArray = chunk.GetNativeArray(LocalRectTransformType); var textRendererArray = chunk.GetNativeArray(TextRendererType); var vertexColorArray = chunk.GetNativeArray(ColorValueType); var vertexColorMultiplierArray = chunk.GetNativeArray(ColorMultiplierType); var localToWorldArray = chunk.GetNativeArray(LocalToWorldType); var vertexBufferAccessor = chunk.GetBufferAccessor(VertexType); var vertexIndexBufferAccessor = chunk.GetBufferAccessor(VertexIndexType); var textLineBufferAccessor = chunk.GetBufferAccessor(TextLineType); for (int i = 0; i < chunk.Count; i++) { var textRenderer = textRendererArray[i]; if (!FontAssetFromEntity.Exists(textRenderer.Font)) { continue; } var vertices = vertexBufferAccessor[i]; var vertexIndices = vertexIndexBufferAccessor[i]; var textData = textDataArray[i]; var vertexCount = textData.Value.LengthInBytes * 4; var vertexIndexCount = textData.Value.LengthInBytes * 6; if (vertexCount != vertices.Length) { vertices.ResizeUninitialized(vertexCount); vertexIndices.ResizeUninitialized(vertexIndexCount); } var lines = textLineBufferAccessor[i]; lines.Clear(); var renderBounds = worldRenderBoundsArray[i]; var localToWorld = localToWorldArray[i]; var color = vertexColorArray[i].Value * vertexColorMultiplierArray[i].Value; PopulateMesh(renderBounds, localToWorld.Value, textRenderer, color, textData, vertices, vertexIndices, lines); } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var hasScale = chunk.Has(ScaleType); var hasNonUniformScale = chunk.Has(NonUniformScaleType); var hasCompositeScale = chunk.Has(CompositeScaleType); if (hasCompositeScale) { var didChange = chunk.DidChange(CompositeScaleType, LastSystemVersion) || chunk.DidChange(ChildType, LastSystemVersion); if (!didChange) { return; } var chunkCompositeScales = chunk.GetNativeArray(CompositeScaleType); var chunkChildren = chunk.GetBufferAccessor(ChildType); for (var i = 0; i < chunk.Count; i++) { var inverseScale = math.inverse(chunkCompositeScales[i].Value); var children = chunkChildren[i]; for (var j = 0; j < children.Length; j++) { var childEntity = children[j].Value; if (!ParentScaleInverseFromEntity.Exists(childEntity)) { continue; } ParentScaleInverseFromEntity[childEntity] = new ParentScaleInverse { Value = inverseScale }; } } } else if (hasScale) { var didChange = chunk.DidChange(ScaleType, LastSystemVersion) || chunk.DidChange(ChildType, LastSystemVersion); if (!didChange) { return; } var chunkScales = chunk.GetNativeArray(ScaleType); var chunkChildren = chunk.GetBufferAccessor(ChildType); for (var i = 0; i < chunk.Count; i++) { var inverseScale = float4x4.Scale(1.0f / chunkScales[i].Value); var children = chunkChildren[i]; for (var j = 0; j < children.Length; j++) { var childEntity = children[j].Value; if (!ParentScaleInverseFromEntity.Exists(childEntity)) { continue; } ParentScaleInverseFromEntity[childEntity] = new ParentScaleInverse { Value = inverseScale }; } } } else // if (hasNonUniformScale) { var didChange = chunk.DidChange(NonUniformScaleType, LastSystemVersion) || chunk.DidChange(ChildType, LastSystemVersion); if (!didChange) { return; } var chunkNonUniformScales = chunk.GetNativeArray(NonUniformScaleType); var chunkChildren = chunk.GetBufferAccessor(ChildType); for (var i = 0; i < chunk.Count; i++) { var inverseScale = float4x4.Scale(1.0f / chunkNonUniformScales[i].Value); var children = chunkChildren[i]; for (var j = 0; j < children.Length; j++) { var childEntity = children[j].Value; if (!ParentScaleInverseFromEntity.Exists(childEntity)) { continue; } ParentScaleInverseFromEntity[childEntity] = new ParentScaleInverse { Value = inverseScale }; } } } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { if (chunk.Has(RotationEulerXyzTypeHandle)) { if (!chunk.DidChange(RotationEulerXyzTypeHandle, LastSystemVersion)) { return; } var chunkRotations = chunk.GetNativeArray(RotationTypeHandle); var chunkRotationEulerXYZs = chunk.GetNativeArray(RotationEulerXyzTypeHandle); for (var i = 0; i < chunk.Count; i++) { chunkRotations[i] = new Rotation { Value = quaternion.EulerXYZ(chunkRotationEulerXYZs[i].Value) }; } } else if (chunk.Has(RotationEulerXzyTypeHandle)) { if (!chunk.DidChange(RotationEulerXzyTypeHandle, LastSystemVersion)) { return; } var chunkRotations = chunk.GetNativeArray(RotationTypeHandle); var chunkRotationEulerXZYs = chunk.GetNativeArray(RotationEulerXzyTypeHandle); for (var i = 0; i < chunk.Count; i++) { chunkRotations[i] = new Rotation { Value = quaternion.EulerXZY(chunkRotationEulerXZYs[i].Value) }; } } else if (chunk.Has(RotationEulerYxzTypeHandle)) { if (!chunk.DidChange(RotationEulerYxzTypeHandle, LastSystemVersion)) { return; } var chunkRotations = chunk.GetNativeArray(RotationTypeHandle); var chunkRotationEulerYXZs = chunk.GetNativeArray(RotationEulerYxzTypeHandle); for (var i = 0; i < chunk.Count; i++) { chunkRotations[i] = new Rotation { Value = quaternion.EulerYXZ(chunkRotationEulerYXZs[i].Value) }; } } else if (chunk.Has(RotationEulerYzxTypeHandle)) { if (!chunk.DidChange(RotationEulerYzxTypeHandle, LastSystemVersion)) { return; } var chunkRotations = chunk.GetNativeArray(RotationTypeHandle); var chunkRotationEulerYZXs = chunk.GetNativeArray(RotationEulerYzxTypeHandle); for (var i = 0; i < chunk.Count; i++) { chunkRotations[i] = new Rotation { Value = quaternion.EulerYZX(chunkRotationEulerYZXs[i].Value) }; } } else if (chunk.Has(RotationEulerZxyTypeHandle)) { if (!chunk.DidChange(RotationEulerZxyTypeHandle, LastSystemVersion)) { return; } var chunkRotations = chunk.GetNativeArray(RotationTypeHandle); var chunkRotationEulerZXYs = chunk.GetNativeArray(RotationEulerZxyTypeHandle); for (var i = 0; i < chunk.Count; i++) { chunkRotations[i] = new Rotation { Value = quaternion.EulerZXY(chunkRotationEulerZXYs[i].Value) }; } } else if (chunk.Has(RotationEulerZyxTypeHandle)) { if (!chunk.DidChange(RotationEulerZyxTypeHandle, LastSystemVersion)) { return; } var chunkRotations = chunk.GetNativeArray(RotationTypeHandle); var chunkRotationEulerZYXs = chunk.GetNativeArray(RotationEulerZyxTypeHandle); for (var i = 0; i < chunk.Count; i++) { chunkRotations[i] = new Rotation { Value = quaternion.EulerZYX(chunkRotationEulerZYXs[i].Value) }; } } }
public static bool DidChange <T>(this ArchetypeChunk chunk, ComponentTypeHandle <T> chunkComponentType, uint version) where T : struct, IComponentData => chunk.DidChange(chunkComponentType.Value, version);