public List<String> getTexFile() { if (renderType == RenderType.CTM || renderType == RenderType.CTMH || renderType == RenderType.CTMV) { List<String> ret = Lists.newArrayList(TEX_FILE_BEFORE); ret.add(String.format(TEX_FILE_TYPE, renderType)); ret.add(TEX_FILE_1); File[] additionalFiles = renderType.getAdditionalFiles(textureFile); String[] textures = new String[additionalFiles.length + 1]; for (int i = 0; i < textures.length - 1; i++) { textures[i] = String.format(TEX_FILE_TEX, additionalFiles[i].getName().replace(".png", "")) + ","; } textures[textures.length - 1] = String.format(TEX_FILE_TEX, textureFile.getName().replace(".png", "")); ret.addAll(tabsToSpaces(textures)); ret.addAll(TEX_FILE_AFTER); return ret; } else { return Lists.newArrayList(String.format(TEX_FILE_SIMPLE, renderType)); } }
/** * Generates the VBOs from the pre calculated arrays. * * @return True if something was generated */ public boolean generateVBOs() { if (lock.tryLock()) { try { // IMPORTANT: A mesh can only be generated once. if (vertexElements == null || disposed) { return false; } for (RenderType type : RenderType.values()) { generateVBO(type); } // Free unused space on the heap vertexElements = null; // Calculate the final amount of triangles triangleCount = (vertexCount[0] + vertexCount[1] + vertexCount[2] + vertexCount[3]) / 3; } finally { lock.unlock(); } return true; } return false; }
public BlockVariation(File file) { this.textureFile = file; this.relPath = ChiselBlockPorter.INPUT_FOLDER.relativize(file.toPath()); this.renderType = RenderType.forPath(file.getPath()); // System.out.println("With suffix chopped is" + this.renderType.chopSuffix(path)); String[] parts = this.renderType.chopSuffix(file.getPath()).split(File.separator + File.separator); this.name = parts[parts.length - 1]; // System.out.println("Variation name "+name); }
private void generateVBO(RenderType type) { VertexElements elements = vertexElements.get(type); int id = type.getIndex(); if (!disposed && elements.finalIndices.limit() > 0 && elements.finalVertices.limit() > 0) { vertexBuffers[id] = bufferPool.get("chunkMesh"); idxBuffers[id] = bufferPool.get("chunkMesh"); vertexCount[id] = elements.finalIndices.limit(); VertexBufferObjectUtil.bufferVboElementData( idxBuffers[id], elements.finalIndices, GL15.GL_STATIC_DRAW); VertexBufferObjectUtil.bufferVboData( vertexBuffers[id], elements.finalVertices, GL15.GL_STATIC_DRAW); } else { vertexBuffers[id] = 0; idxBuffers[id] = 0; vertexCount[id] = 0; } }
/** * {@inheritDoc} * * @see org.eclipse.draw3d.RenderFragment#getRenderType() */ public RenderType getRenderType() { return RenderType.getRenderType(m_alpha, m_superimposed); }
public ChunkMesh(GLBufferPool bufferPool) { this.bufferPool = bufferPool; for (RenderType type : RenderType.values()) { vertexElements.put(type, new VertexElements()); } }