Disk TexCoords [FIX] (2 posts)

  • Profile picture of MikOfClassX MikOfClassX2p said 1 year, 12 months ago:

    Hello,

    there is an obvious bug in the jme Disk class.
    TexCoords where created as Vector3 instead of Vector2. This could lead to crashes when copying texcoords during multi-texturing.

    Here's the patch.

    Cheers,

    Mik

    Index: Disk.java
    ===================================================================
    --- Disk.java   (revision 5364)
    +++ Disk.java   (working copy)
    @@ -134,7 +134,7 @@
             setVertexCount(1 + (radialSamples+1) * shellLess);
             setVertexBuffer(BufferUtils.createVector3Buffer(getVertexCount()));
             setNormalBuffer(BufferUtils.createVector3Buffer(getVertexCount()));
    -        getTextureCoords().set(0, new TexCoords(BufferUtils.createVector3Buffer(getVertexCount())));
    +        getTextureCoords().set(0, new TexCoords(BufferUtils.createVector2Buffer(getVertexCount())));
             setTriangleQuantity(radialSamples * (2 * shellLess - 1));
             setIndexBuffer(BufferUtils.createIntBuffer(3 * getTriangleCount()));
            
    

  • Profile picture of Momoko_Fan Momoko_Fan366p said 1 year, 12 months ago:

    I approve. The Disk class writes 2D texture coordinates so the buffer should be 2D also.