use of org.terasology.engine.rendering.assets.mesh.resource.VertexShortAttributeBinding in project Terasology by MovingBlocks.
the class VertexGLAttributeTest method testShortBinding.
@Test
public void testShortBinding() {
VertexResourceBuilder builder = new VertexResourceBuilder();
VertexShortAttributeBinding a1 = builder.add(0, GLAttributes.SHORT_1_VERTEX_ATTRIBUTE);
VertexResource resource = builder.build();
a1.put((short) 10);
a1.put((short) 150);
a1.put((short) 100);
a1.put((short) 100);
assertEquals(4, a1.getPosition());
resource.writeBuffer(buffer -> {
assertEquals(4 * Short.BYTES, buffer.limit());
assertEquals(10, Short.toUnsignedInt(buffer.getShort(Short.BYTES * 0)));
assertEquals(150, Short.toUnsignedInt(buffer.getShort(Short.BYTES * 1)));
assertEquals(100, Short.toUnsignedInt(buffer.getShort(Short.BYTES * 2)));
assertEquals(100, Short.toUnsignedInt(buffer.getShort(Short.BYTES * 3)));
});
}
Aggregations