public int getElementCount() { return getElements().size(); }
public DataLayout(DataLayout layout, Element... elements) { this(layout.format, collect(layout.getElements(), elements)); }
public VertexBuffer(DataLayout layout, float... data) { this(layout, data.length / (layout.getBytesize() / 4)); for (Element e : layout.getElements()) { if (e.getDataType() != DataType.FLOAT) { throw new IllegalArgumentException("The layout must consist of only float tpye data elements!"); } } if (data.length % (layout.getBytesize() / 4) != 0) { throw new IllegalArgumentException("The data size is not an excate multiple of the data layout size!"); } setVCount(size); buffer.asFloatBuffer().put(data); }
@AssistedInject @ParametersAreNonnullByDefault public StdAttributs(GraphicContext gcontext, @Assisted Shader shader, @Assisted VertexBO[] vbuffers, @Assisted @Nullable BufferObject indice) { assert shader.isInitialized() : "Shader is not initialized!"; this.indice = indice; configs = new BufferConfigs[vbuffers.length]; for (int i = 0; i < vbuffers.length; ++i) { DataLayout dl = vbuffers[i].layout; List<AttributConfig> cs = new LinkedList<>(); for (Element ele : dl.getElements()) { Optional<ShaderAttribute> sa = shader.getAttribut(ele); if (sa.isPresent()) { cs.add(new AttributConfig(sa.get(), dl.getAttribut(ele))); } } AttributConfig[] c = new AttributConfig[cs.size()]; cs.toArray(c); configs[i] = new BufferConfigs(gcontext, vbuffers[i].buffer, c); } }
for (Element ele : vbuffer.layout.getElements()) { builder.append("\"") .append(ele.getBezeichnung())
public void copyVertex(int id, int offset, VertexBuffer vbuffer) { assert (id + offset < vcount) : "The destination vertex is not in bound of the destination buffer"; if (layout.equals(vbuffer.layout)) { ByteBuffer buf = vbuffer.buffer; int limit = offset + layout.getBytesize(); assert !(limit <= buf.capacity() || id > vcount) : "Couldn't copy Vertex"; buf.position(offset); buf.limit(limit); buffer.position(layout.getBytesize() * id); buffer.put(buf); } else { Vertex src = vbuffer.getVertex(id); Vertex dst = getVertex(id + offset); for (Element e : layout.getElements()) { if (vbuffer.layout.hasElement(e)) { dst.setAttribute(e, src.getAttribute(e)); } } } }
private static AttributeData[] createAttributeData(VertexBuffer vbuffer) { List<AttributeData> attribute = new ArrayList<>(); for (Element el : vbuffer.layout.getElements()) { if (el.equals(POSITION) || el.equals(NORMAL) || el.equals(TEX_COORD)) { continue;
public void interpolate(VertexBuffer vb) for (Element a : vb.layout.getElements()) { Set<Integer> ids = new HashSet<>(); for (int i : corners) {