Proposed change to Mesh.java

Over at http://hub.jmonkeyengine.org/forum/topic/bug-fix-for-mesh-deepclone/ @wezrule pointed out an bug in how Mesh.deepClone() initializes the elementCount and vertCount fields.

As far as I know, no issue has been opened at Google Code for this.

I propose to commit Wesley’s patch to /branches/gradle-restructure/jme3-core/src/main/java/com/jme3/scene/Mesh.java and /trunk/engine/src/core/com/jme3/scene/Mesh.java

Specifically:

--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -240,8 +240,8 @@
             }
             
             clone.vertexArrayID = -1;
-            clone.vertCount = -1;
-            clone.elementCount = -1;
+            clone.vertCount = vertCount;
+            clone.elementCount = elementCount;
             
             // although this could change
             // if the bone weight/index buffers are modified
5 Likes

I wonder how you are able to scan trough all that code and still find all those bugs :slight_smile:
You just earned 10 +1 ones

And sorry for OT

Looks good to me.

1 Like

go ahead.
Isn’t Wes able to commit?

1 Like

cheers @sgold. If you are feeling adventurous, you can also have a look at this one as well:

http://hub.jmonkeyengine.org/forum/topic/added-missing-method-removepreview-string-viewname/

I did no testing nor checked if it even compiled (my build was a bit screwed if I recall). Thank

@nehon said: Isn't Wes able to commit?
nope

I also have quite a few engine modifications I will submit at some point, mainly to do with android optimizations.

Starting with this one someone found (actually it is a bug fix):
http://hub.jmonkeyengine.org/forum/topic/depthmaskfalse-in-android-causing-frame-buffer-corruption/

People with the same problem:

In Google Code Archive - Long-term storage for Google Code Project Hosting., you need to add:

GLES20.glDepthMask(true);

before GLES20.glClear(bits);

in ClearBuffers(). If it is set to false (i.e the last thing rendered did not have depth writing), you get a screwed up depth buffer. (sorry I’m at work, so no diffs).

If you are again feeling adventurous :wink: @sgold keep up the good work!!

1 Like

@wezrule
If you haven’t already, you should record all these issues at Google Code so they are not forgotten: https://code.google.com/p/jmonkeyengine/issues/entry

I’ll put the removePreView() issue on my to-do list. I don’t feel comfortable making edits to the Android module, however. That involves special expertise of a sort I don’t possess—though I hope to some day soon.

The @wezrule fix is in trunk as of rev 11080. To my mind, this is a good candidate for the 3.0.6 release.