public int GetSharedComponentIndex(MatchingArchetype *match, int indexInEntityQuery) { var componentIndexInArcheType = match->IndexInArchetype[indexInEntityQuery]; var componentIndexInChunk = componentIndexInArcheType - match->Archetype->FirstSharedComponent; return(GetSharedComponentValue(componentIndexInChunk)); }
public int GetSharedComponentIndex(MatchingArchetype *match, int indexInEntityQuery) { var sharedComponentIndexInArchetype = match->IndexInArchetype[indexInEntityQuery]; var sharedComponentIndexOffset = sharedComponentIndexInArchetype - match->Archetype->FirstSharedComponent; return(GetSharedComponentValue(sharedComponentIndexOffset)); }
// Determines how many chunks of a particular archetype we must iterate through while filtering // If the chunk is in the current archetype, we can calculate # of iterations // If the chunk is not in the current archetype, just loop over all chunks in the current archetype private int CalculateFilteredIterationChunkCount(MatchingArchetype *match) { var archetype = match->Archetype; var chunkCount = match == m_CurrentMatchingArchetype ? m_CurrentChunkIndex : archetype->Chunks.Count; return(chunkCount); }
public bool MatchesFilter(MatchingArchetype *match, ref EntityQueryFilter filter) { if ((filter.Type & FilterType.SharedComponent) != 0) { var sharedComponentsInChunk = SharedComponentValues; var filteredCount = filter.Shared.Count; fixed(int *indexInEntityQueryPtr = filter.Shared.IndexInEntityQuery, sharedComponentIndexPtr = filter.Shared.SharedComponentIndex) { for (var i = 0; i < filteredCount; ++i) { var indexInEntityQuery = indexInEntityQueryPtr[i]; var sharedComponentIndex = sharedComponentIndexPtr[i]; var componentIndexInArcheType = match->IndexInArchetype[indexInEntityQuery]; var componentIndexInChunk = componentIndexInArcheType - match->Archetype->FirstSharedComponent; if (sharedComponentsInChunk[componentIndexInChunk] != sharedComponentIndex) { return(false); } } } return(true); } if ((filter.Type & FilterType.Changed) != 0) { var changedCount = filter.Changed.Count; var requiredVersion = filter.RequiredChangeVersion; fixed(int *indexInEntityQueryPtr = filter.Changed.IndexInEntityQuery) { for (var i = 0; i < changedCount; ++i) { var indexInArchetype = match->IndexInArchetype[indexInEntityQueryPtr[i]]; var changeVersion = GetChangeVersion(indexInArchetype); if (ChangeVersionUtility.DidChange(changeVersion, requiredVersion)) { return(true); } } } return(false); } return(true); }
public bool MatchesFilter(MatchingArchetype *match, ref EntityQueryFilter filter) { return(match->ChunkMatchesFilter(ListIndex, ref filter)); }