@Override public void onModelBake(Supplier<BufferBuilder> model) { if (markerDisplayList.isPresent()) { GL11.glDeleteLists(markerDisplayList.get(), 1); } final BufferBuilder vb = model.get(); final int newList = GL11.glGenLists(1); GL11.glNewList(newList, GL11.GL_COMPILE); new WorldVertexBufferUploader().draw(vb); GL11.glEndList(); markerDisplayList = OptionalInt.of(newList); }
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()); }