From c590b8d054f85686e902e2a3f21110ccea5b7d77 Mon Sep 17 00:00:00 2001 From: "sha..rd" Date: Sat, 29 Oct 2011 03:00:10 +0000 Subject: [PATCH] * Small javadoc additions in Application * Fix animation not working for Blender 2.5+ Ogre3D models git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8538 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/animation/SkeletonControl.java | 23 +++++++++---------- engine/src/core/com/jme3/app/Application.java | 23 ++++++++++++++----- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/engine/src/core/com/jme3/animation/SkeletonControl.java b/engine/src/core/com/jme3/animation/SkeletonControl.java index 61ba80b8c..661002ae4 100644 --- a/engine/src/core/com/jme3/animation/SkeletonControl.java +++ b/engine/src/core/com/jme3/animation/SkeletonControl.java @@ -99,10 +99,8 @@ public class SkeletonControl extends AbstractControl implements Cloneable { Mesh childSharedMesh = geom.getUserData(UserData.JME_SHAREDMESH); if (childSharedMesh != null){ - // Don't bother with non-animated shared meshes if (isMeshAnimated(childSharedMesh)){ - // child is using shared mesh, // so animate the shared mesh but ignore child if (sharedMesh == null){ @@ -147,10 +145,12 @@ public class SkeletonControl extends AbstractControl implements Cloneable { // if hardware skinning is supported, the matrices and weight buffer // will be sent by the SkinningShaderLogic object assigned to the shader for (int i = 0; i < targets.length; i++) { - // only update targets with bone-vertex assignments - if (targets[i].getBuffer(Type.BoneIndex) != null) { + // NOTE: This assumes that code higher up + // Already ensured those targets are animated + // otherwise a crash will happen in skin update + //if (isMeshAnimated(targets[i])) { softwareSkinUpdate(targets[i], offsetMatrices); - } + //} } wasMeshUpdated = true; @@ -195,11 +195,11 @@ public class SkeletonControl extends AbstractControl implements Cloneable { clone.setSpatial(clonedNode); clone.skeleton = ctrl.getSkeleton(); - Mesh[] meshes = new Mesh[targets.length]; - for (int i = 0; i < meshes.length; i++) { - meshes[i] = ((Geometry) clonedNode.getChild(i)).getMesh(); - } - for (int i = meshes.length; i < clonedNode.getQuantity(); i++) { + // Fix animated targets for the cloned node + clone.targets = findTargets(clonedNode); + + // Fix attachments for the cloned node + for (int i = 0; i < clonedNode.getQuantity(); i++) { // go through attachment nodes, apply them to correct bone Spatial child = clonedNode.getChild(i); if (child instanceof Node) { @@ -214,7 +214,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable { } } } - clone.targets = meshes; + return clone; } @@ -348,7 +348,6 @@ public class SkeletonControl extends AbstractControl implements Cloneable { posBuf[idxPositions++] = rz; } - fvb.position(fvb.position() - bufLength); fvb.put(posBuf, 0, bufLength); fnb.position(fnb.position() - bufLength); diff --git a/engine/src/core/com/jme3/app/Application.java b/engine/src/core/com/jme3/app/Application.java index 31f9a9d29..b39fa3aed 100644 --- a/engine/src/core/com/jme3/app/Application.java +++ b/engine/src/core/com/jme3/app/Application.java @@ -175,9 +175,12 @@ public class Application implements SystemListener { } /** - * Set the display settings to define the display created. Examples of - * display parameters include display pixel width and height, + * Set the display settings to define the display created. + *

+ * Examples of display parameters include display pixel width and height, * color bit depth, z-buffer bits, anti-aliasing samples, and update frequency. + * If this method is called while the application is already running, then + * {@link #restart() } must be called to apply the settings to the display. * * @param settings The settings to set. */ @@ -460,7 +463,6 @@ public class Application implements SystemListener { } /** - * * Requests the context to close, shutting down the main loop * and making necessary cleanup operations. * @@ -526,11 +528,12 @@ public class Application implements SystemListener { * Internal use only. */ public void gainFocus(){ - if (pauseOnFocus){ + if (pauseOnFocus) { paused = false; context.setAutoFlushFrames(true); - if (inputManager != null) + if (inputManager != null) { inputManager.reset(); + } } } @@ -553,7 +556,11 @@ public class Application implements SystemListener { /** * Enqueues a task/callable object to execute in the jME3 - * rendering thread. + * rendering thread. + *

+ * Callables are executed right at the beginning of the main loop. + * They are executed even if the application is currently paused + * or out of focus. */ public Future enqueue(Callable callable) { AppTask task = new AppTask(callable); @@ -625,6 +632,10 @@ public class Application implements SystemListener { timer.reset(); } + /** + * @return The GUI viewport. Which is used for the on screen + * statistics and FPS. + */ public ViewPort getGuiViewPort() { return guiViewPort; }