private static final class GlfwKeyListener implements GLFWKeyCallbackI {
private int key;
@Override
public void invoke(long window, int key, int scancode, int action, int mods) {
KeyClass.key = key;
//schedule to set key to 0 on next frame
}
}
private void logUsedKeys() {
int key = KeyClass.key;
if (key != 0) {
LOGGER.info("Key {}", key);
}
}
shaderc_compile_into_spv
takes an explicit size_t source_text_size
parameter and LWJGL passes sourceBuffer.remaining()
there implicitly, which includes the null-terminator.sourceBuffer = stack.UTF8(shaderSource.trim(), false)
, which will encode the source buffer without the null-terminator.
Matrix4f m = new Matrix4f();
Quaternionf q = new Quaternionf(0.0f, 0.965f, 0.2622f, 0.0f);
m.rotate(q);
AxisAngle4f a = new AxisAngle4f();
m.getRotation(a);
System.out.println(a);
m.getRotation(a);
System.out.println(a);
m.getRotation(a);
System.out.println(a);
m.getRotation(a);
System.out.println(a);
( 0.000E+0 9.650E-1 2.530E-1 <| 3.142E+0)
( 0.000E+0 9.650E-1 1.000E+0 <| 3.142E+0)
( 0.000E+0 9.650E-1 2.530E-1 <| 3.142E+0)
( 0.000E+0 9.650E-1 1.000E+0 <| 3.142E+0)
QuoteFrees the buffer allocation.All MemoryUtil methods that allocate explicitly-managed memory have the following note (or similar):
This method should not be used if the memory backing this buffer is not owned by the buffer.
QuoteMemory allocated with this method must be freed with memFree.ByteBuffer.allocateDirect, PointerBuffer.allocateDirect, BufferUtils methods and MemoryStack methods do not have such a note because, well, you don't have to do anything special to deallocate the returned buffer.