jMonkeyEngine / jMonkeyEngine/jmonkeyengine
proper float16 etc. support for vertex buffers
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
VertexBuffer.Format.Half seems to be somewhat of a second-class citizen. I guess VertexBuffer.Format.Double is similarly affected.
- There's no
BufferUtils.createFloat16Bufferand most other util functions likesetInBufferare only forFloatBuffers too, ok:
private static java.nio.ByteBuffer createFloat16Buffer(Vector3f... data) {
var buf = BufferUtils.createByteBuffer(3 * 2 * data.length);
for (Vector3f v : data) {
buf.putShort(FastMath.convertFloatToHalf(v.x));
buf.putShort(FastMath.convertFloatToHalf(v.y));
buf.putShort(FastMath.convertFloatToHalf(v.z));
}
buf.flip();
return buf;
}
mesh.setBuffer(Type.Position, 3, VertexBuffer.Format.Half, createFloat16Buffer(vertices));
- In many places like
Mesh.updateBoundorMikkTSpaceImpla float buffer is assumed for positions/normals/texcoords and it's blindly cast toFloatBufferwhich will fail with any other data type. Interestingly forIndexBufferthere'swrapIndexBufferwhich deals with the different base types. GLRenderer.updateBufferDataandconvertFormatformat handling (GL_HALF_FLOATetc.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the FloatBuffer assumptions in Mesh.updateBound and MikkTSpaceImpl, then inspect BufferUtils, GLRenderer.updateBufferData, and convertFormat for Half and Double handling. Done means vertex buffers using non-float formats are supported across these utilities, mesh processing, and renderer format handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100