mirror of
				https://github.com/GayPizzaSpecifications/foundation.git
				synced 2025-11-04 03:39:37 +00:00 
			
		
		
		
	Gjallarhorn: Various fixes to new pipeline for production usage.
This commit is contained in:
		@ -48,6 +48,7 @@ class BlockLogTracker(private val mode: BlockTrackMode = BlockTrackMode.RemoveOn
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  fun isEmpty() = blocks.isEmpty()
 | 
			
		||||
  fun isNotEmpty() = blocks.isNotEmpty()
 | 
			
		||||
 | 
			
		||||
  fun buildBlockMap(offset: BlockCoordinate = BlockCoordinate.zero): BlockMap {
 | 
			
		||||
    val map = BlockMap()
 | 
			
		||||
 | 
			
		||||
@ -59,14 +59,13 @@ class BlockMapRenderPool<T>(
 | 
			
		||||
    val sliced = changelog.slice(slice)
 | 
			
		||||
    val tracker = BlockLogTracker(blockTrackMode)
 | 
			
		||||
    tracker.replay(sliced)
 | 
			
		||||
    if (tracker.isEmpty()) {
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
    if (tracker.isNotEmpty()) {
 | 
			
		||||
      trackers[slice] = tracker
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  interface RenderPoolDelegate<T> {
 | 
			
		||||
    fun buildRenderJobs(pool: BlockMapRenderPool<T>, trackers: Map<BlockChangelogSlice, BlockLogTracker>)
 | 
			
		||||
    fun buildRenderJobs(pool: BlockMapRenderPool<T>, trackers: MutableMap<BlockChangelogSlice, BlockLogTracker>)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  companion object {
 | 
			
		||||
 | 
			
		||||
@ -19,10 +19,25 @@ class BlockMapTimelapse<T>(val trim: Pair<BlockCoordinate, BlockCoordinate>? = n
 | 
			
		||||
    if (limit != null) {
 | 
			
		||||
      intervals = intervals.takeLast(limit).toMutableList()
 | 
			
		||||
    }
 | 
			
		||||
    return intervals.map { it.minus(interval) to it }
 | 
			
		||||
    return intervals.map { start to it }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  override fun buildRenderJobs(
 | 
			
		||||
    pool: BlockMapRenderPool<T>,
 | 
			
		||||
    trackers: MutableMap<BlockChangelogSlice, BlockLogTracker>
 | 
			
		||||
  ) {
 | 
			
		||||
    if (trim != null) {
 | 
			
		||||
      trackers.values.forEach { tracker ->
 | 
			
		||||
        tracker.trimOutsideXAndZRange(trim.first, trim.second)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for ((slice, tracker) in trackers.entries.toList()) {
 | 
			
		||||
      if (tracker.isEmpty()) {
 | 
			
		||||
        trackers.remove(slice)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  override fun buildRenderJobs(pool: BlockMapRenderPool<T>, trackers: Map<BlockChangelogSlice, BlockLogTracker>) {
 | 
			
		||||
    val allBlockOffsets = trackers.map { it.value.calculateZeroBlockOffset() }
 | 
			
		||||
    val globalBlockOffset = BlockCoordinate.maxOf(allBlockOffsets)
 | 
			
		||||
    val allBlockMaxes = trackers.map { it.value.calculateMaxBlock() }
 | 
			
		||||
@ -31,8 +46,8 @@ class BlockMapTimelapse<T>(val trim: Pair<BlockCoordinate, BlockCoordinate>? = n
 | 
			
		||||
 | 
			
		||||
    val renderer = pool.rendererFactory(globalBlockExpanse)
 | 
			
		||||
    for ((slice, tracker) in trackers) {
 | 
			
		||||
      if (trim != null) {
 | 
			
		||||
        tracker.trimOutsideXAndZRange(trim.first, trim.second)
 | 
			
		||||
      if (tracker.isEmpty()) {
 | 
			
		||||
        continue
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      pool.submitRenderJob(slice) {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user