jMonkeyEngine / jMonkeyEngine/jmonkeyengine

proper float16 etc. support for vertex buffers

Open
#1,834 0 comments 1 reaction 0 assignees View on GitHub

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.createFloat16Buffer and most other util functions like setInBuffer are only for FloatBuffers 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.updateBound or MikkTSpaceImpl a float buffer is assumed for positions/normals/texcoords and it's blindly cast to FloatBuffer which will fail with any other data type. Interestingly for IndexBuffer there's wrapIndexBuffer which deals with the different base types.
  • GLRenderer.updateBufferData and convertFormat format handling (GL_HALF_FLOAT etc.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.