Nasty bug in BufferUtils

The following functions in BufferUtils write four values for nonnull Elements, but only three for null ones:
createFloatBuffer(Quaternion… data)
createFloatBuffer(Vector4f… data)

The other functions seem to be okay.

Here’s the SVN patch:

[java]Index: src/core/com/jme3/util/BufferUtils.java

— src/core/com/jme3/util/BufferUtils.java (Revision 10490)
+++ src/core/com/jme3/util/BufferUtils.java (Arbeitskopie)
@@ -195,7 +195,7 @@
if (element != null) {
buff.put(element.getX()).put(element.getY()).put(element.getZ()).put(element.getW());
} else {

  •            buff.put(0).put(0).put(0);
    
  •            buff.put(0).put(0).put(0).put(0);
           }
       }
       buff.flip();
    

@@ -217,7 +217,7 @@
if (data[x] != null) {
buff.put(data[x].getX()).put(data[x].getY()).put(data[x].getZ()).put(data[x].getW());
} else {

  •            buff.put(0).put(0).put(0);
    
  •            buff.put(0).put(0).put(0).put(0);
           }
       }
       buff.flip();
    

[/java]

2 Likes

it’s an opened issue in the tracker yep, didn’t have time to take care of it.
Thanks for the patch.

1 Like

Ah, I should have checked.

I somehow forgot that JME has an issue tracker.
Ah… because it’s not linked from the main page, that’s the reason.
Okay, it’s on the googlecode page, put the patch there so it won’t be forgotten.

1 Like

I committed the patch thanks

1 Like

Thanks, got it back from upstream :slight_smile: