public ChunkRenderDispatcher() { for (int i = 0; i < 2; ++i) { ChunkRenderWorker chunkrenderworker = new ChunkRenderWorker(this); Thread thread = threadFactory.newThread(chunkrenderworker); thread.start(); this.listThreadedWorkers.add(chunkrenderworker); } for (int j = 0; j < 5; ++j) { this.queueFreeRenderBuilders.add(new RegionRenderCacheBuilder()); } this.renderWorker = new ChunkRenderWorker(this, new RegionRenderCacheBuilder()); }
public void stopChunkUpdates() { this.clearChunkUpdates(); while (this.runChunkUploads(0L)) { ; } List<RegionRenderCacheBuilder> list = Lists.<RegionRenderCacheBuilder>newArrayList(); while (((List)list).size() != 5) { try { list.add(this.allocateRenderBuilder()); } catch (InterruptedException var3) { ; } } this.queueFreeRenderBuilders.addAll(list); }
public void stopChunkUpdates() { this.clearChunkUpdates(); List<RegionRenderCacheBuilder> list = Lists.<RegionRenderCacheBuilder>newArrayList(); while (((List)list).size() != this.countRenderBuilders) { this.runChunkUploads(Long.MAX_VALUE); try { list.add(this.allocateRenderBuilder()); } catch (InterruptedException var3) { ; } } this.queueFreeRenderBuilders.addAll(list); }
private void postRenderOverlay(BlockRenderLayer p_postRenderOverlay_1_, RegionRenderCacheBuilder p_postRenderOverlay_2_, CompiledChunk p_postRenderOverlay_3_, boolean[] p_postRenderOverlay_4_) { net.minecraft.client.renderer.VertexBuffer vertexbuffer = p_postRenderOverlay_2_.getWorldRendererByLayer(p_postRenderOverlay_1_); if (vertexbuffer.isDrawing()) { p_postRenderOverlay_3_.setLayerStarted(p_postRenderOverlay_1_); p_postRenderOverlay_4_[p_postRenderOverlay_1_.ordinal()] = true; } }
public ChunkRenderDispatcher(int countRenderBuilders) { int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760); int j = Math.max(1, MathHelper.clamp_int(Runtime.getRuntime().availableProcessors(), 1, i / 5)); if(countRenderBuilders < 0) countRenderBuilders = MathHelper.clamp_int(j * 10, 1, i); this.countRenderBuilders = countRenderBuilders; if (j > 1) { for (int k = 0; k < j; ++k) { ChunkRenderWorker chunkrenderworker = new ChunkRenderWorker(this); Thread thread = THREAD_FACTORY.newThread(chunkrenderworker); thread.start(); this.listThreadedWorkers.add(chunkrenderworker); this.listWorkerThreads.add(thread); } } this.queueFreeRenderBuilders = Queues.<RegionRenderCacheBuilder>newArrayBlockingQueue(this.countRenderBuilders); for (int l = 0; l < this.countRenderBuilders; ++l) { this.queueFreeRenderBuilders.add(new RegionRenderCacheBuilder()); } this.renderWorker = new ChunkRenderWorker(this, new RegionRenderCacheBuilder()); }
public ChunkRenderWorker(ChunkRenderDispatcher p_i46201_1_) { this(p_i46201_1_, (RegionRenderCacheBuilder)null); }
public ChunkRenderWorker(ChunkRenderDispatcher chunkRenderDispatcherIn, RegionRenderCacheBuilder regionRenderCacheBuilderIn) { this.chunkRenderDispatcher = chunkRenderDispatcherIn; this.regionRenderCacheBuilder = regionRenderCacheBuilderIn; }
private RegionRenderCacheBuilder getRegionRenderCacheBuilder() throws InterruptedException { return this.regionRenderCacheBuilder != null ? this.regionRenderCacheBuilder : this.chunkRenderDispatcher.allocateRenderBuilder(); }
public void freeRenderBuilder(RegionRenderCacheBuilder p_178512_1_) { this.queueFreeRenderBuilders.add(p_178512_1_); }
public RegionRenderCacheBuilder allocateRenderBuilder() throws InterruptedException { return (RegionRenderCacheBuilder)this.queueFreeRenderBuilders.take(); }
public RegionRenderCacheBuilder getRegionRenderCacheBuilder() { return this.regionRenderCacheBuilder; }
public void setRegionRenderCacheBuilder(RegionRenderCacheBuilder regionRenderCacheBuilderIn) { this.regionRenderCacheBuilder = regionRenderCacheBuilderIn; }
public ChunkRenderWorker(ChunkRenderDispatcher chunkRenderDispatcherIn, @Nullable RegionRenderCacheBuilder regionRenderCacheBuilderIn) { this.shouldRun = true; this.chunkRenderDispatcher = chunkRenderDispatcherIn; this.regionRenderCacheBuilder = regionRenderCacheBuilderIn; }
public ChunkRenderDispatcher(int p_i1_1_) { this.listWorkerThreads = Lists.<Thread>newArrayList(); this.listThreadedWorkers = Lists.<ChunkRenderWorker>newArrayList(); this.queueChunkUpdates = Queues.<ChunkCompileTaskGenerator>newPriorityBlockingQueue(); this.worldVertexUploader = new WorldVertexBufferUploader(); this.vertexUploader = new VertexBufferUploader(); this.queueChunkUploads = Queues.<ChunkRenderDispatcher.PendingUpload>newPriorityQueue(); int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760); int j = Math.max(1, MathHelper.clamp(Runtime.getRuntime().availableProcessors(), 1, i / 5)); if (p_i1_1_ < 0) { this.countRenderBuilders = MathHelper.clamp(j, 1, i); } else { this.countRenderBuilders = p_i1_1_; } if (j > 1) { for (int k = 0; k < j; ++k) { ChunkRenderWorker chunkrenderworker = new ChunkRenderWorker(this); Thread thread = THREAD_FACTORY.newThread(chunkrenderworker); thread.start(); this.listThreadedWorkers.add(chunkrenderworker); this.listWorkerThreads.add(thread); } } this.queueFreeRenderBuilders = Queues.<RegionRenderCacheBuilder>newArrayBlockingQueue(this.countRenderBuilders); for (int l = 0; l < this.countRenderBuilders; ++l) { this.queueFreeRenderBuilders.add(new RegionRenderCacheBuilder()); } this.renderWorker = new ChunkRenderWorker(this, new RegionRenderCacheBuilder()); }