mirror of
				https://github.com/GayPizzaSpecifications/foundation.git
				synced 2025-11-04 11:39:39 +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 isEmpty() = blocks.isEmpty()
 | 
				
			||||||
 | 
					  fun isNotEmpty() = blocks.isNotEmpty()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  fun buildBlockMap(offset: BlockCoordinate = BlockCoordinate.zero): BlockMap {
 | 
					  fun buildBlockMap(offset: BlockCoordinate = BlockCoordinate.zero): BlockMap {
 | 
				
			||||||
    val map = BlockMap()
 | 
					    val map = BlockMap()
 | 
				
			||||||
 | 
				
			|||||||
@ -59,14 +59,13 @@ class BlockMapRenderPool<T>(
 | 
				
			|||||||
    val sliced = changelog.slice(slice)
 | 
					    val sliced = changelog.slice(slice)
 | 
				
			||||||
    val tracker = BlockLogTracker(blockTrackMode)
 | 
					    val tracker = BlockLogTracker(blockTrackMode)
 | 
				
			||||||
    tracker.replay(sliced)
 | 
					    tracker.replay(sliced)
 | 
				
			||||||
    if (tracker.isEmpty()) {
 | 
					    if (tracker.isNotEmpty()) {
 | 
				
			||||||
      return
 | 
					      trackers[slice] = tracker
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    trackers[slice] = tracker
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  interface RenderPoolDelegate<T> {
 | 
					  interface RenderPoolDelegate<T> {
 | 
				
			||||||
    fun buildRenderJobs(pool: BlockMapRenderPool<T>, trackers: Map<BlockChangelogSlice, BlockLogTracker>)
 | 
					    fun buildRenderJobs(pool: BlockMapRenderPool<T>, trackers: MutableMap<BlockChangelogSlice, BlockLogTracker>)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  companion object {
 | 
					  companion object {
 | 
				
			||||||
 | 
				
			|||||||
@ -19,10 +19,25 @@ class BlockMapTimelapse<T>(val trim: Pair<BlockCoordinate, BlockCoordinate>? = n
 | 
				
			|||||||
    if (limit != null) {
 | 
					    if (limit != null) {
 | 
				
			||||||
      intervals = intervals.takeLast(limit).toMutableList()
 | 
					      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: Map<BlockChangelogSlice, BlockLogTracker>) {
 | 
					  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)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    val allBlockOffsets = trackers.map { it.value.calculateZeroBlockOffset() }
 | 
					    val allBlockOffsets = trackers.map { it.value.calculateZeroBlockOffset() }
 | 
				
			||||||
    val globalBlockOffset = BlockCoordinate.maxOf(allBlockOffsets)
 | 
					    val globalBlockOffset = BlockCoordinate.maxOf(allBlockOffsets)
 | 
				
			||||||
    val allBlockMaxes = trackers.map { it.value.calculateMaxBlock() }
 | 
					    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)
 | 
					    val renderer = pool.rendererFactory(globalBlockExpanse)
 | 
				
			||||||
    for ((slice, tracker) in trackers) {
 | 
					    for ((slice, tracker) in trackers) {
 | 
				
			||||||
      if (trim != null) {
 | 
					      if (tracker.isEmpty()) {
 | 
				
			||||||
        tracker.trimOutsideXAndZRange(trim.first, trim.second)
 | 
					        continue
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      pool.submitRenderJob(slice) {
 | 
					      pool.submitRenderJob(slice) {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user