Main repository of MikuMikuStudio
Revision | 7513088f18b0a7ff36708fd1f2885f9fdb5f6258 (tree) |
---|---|
Time | 2003-09-16 07:20:28 |
Author | mojomonkey <mojomonkey@75d0...> |
Commiter | mojomonkey |
changed animation. Now requires a call to update to match all other models.
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@90 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
@@ -40,6 +40,7 @@ import jme.exception.MonkeyGLException; | ||
40 | 40 | import jme.exception.MonkeyRuntimeException; |
41 | 41 | import jme.geometry.Geometry; |
42 | 42 | import jme.geometry.bounding.BoundingVolume; |
43 | +import jme.geometry.model.Model; | |
43 | 44 | import jme.math.Vector; |
44 | 45 | import jme.physics.PhysicsModule; |
45 | 46 | import jme.entity.camera.Frustum; |
@@ -65,7 +66,7 @@ import org.lwjgl.opengl.Window; | ||
65 | 66 | * <code>Entity</code> to represent something abstract. |
66 | 67 | * |
67 | 68 | * @author Mark Powell |
68 | - * @version $Id: Entity.java,v 1.9 2003-09-10 20:32:59 mojomonkey Exp $ | |
69 | + * @version $Id: Entity.java,v 1.10 2003-09-15 22:20:28 mojomonkey Exp $ | |
69 | 70 | */ |
70 | 71 | public class Entity implements EntityInterface { |
71 | 72 |
@@ -317,6 +318,12 @@ public class Entity implements EntityInterface { | ||
317 | 318 | * <code>update</code> updates the state of the entity. |
318 | 319 | */ |
319 | 320 | public void update(float time) { |
321 | + //if the geometry is of type model it should be updated. | |
322 | + if(null != geometry) { | |
323 | + if(geometry instanceof Model) { | |
324 | + ((Model)geometry).update(time); | |
325 | + } | |
326 | + } | |
320 | 327 | if(null != physics) { |
321 | 328 | physics.update(time); |
322 | 329 | physics.updatePosition(position); |
@@ -54,7 +54,7 @@ import jme.utility.LoggingSystem; | ||
54 | 54 | import jme.utility.StringUtils; |
55 | 55 | import jme.exception.MonkeyGLException; |
56 | 56 | import jme.exception.MonkeyRuntimeException; |
57 | -import jme.geometry.Geometry; | |
57 | +import jme.geometry.model.Model; | |
58 | 58 | |
59 | 59 | import org.lwjgl.opengl.GL; |
60 | 60 | import org.lwjgl.opengl.Window; |
@@ -96,9 +96,9 @@ import org.lwjgl.opengl.Window; | ||
96 | 96 | * |
97 | 97 | * |
98 | 98 | * @author Mark Powell |
99 | - * @version $Id: Md3Model.java,v 1.11 2003-09-10 20:32:59 mojomonkey Exp $ | |
99 | + * @version $Id: Md3Model.java,v 1.12 2003-09-15 22:20:27 mojomonkey Exp $ | |
100 | 100 | */ |
101 | -public class Md3Model implements Geometry { | |
101 | +public class Md3Model implements Model { | |
102 | 102 | /** |
103 | 103 | * LOWER defines the legs section of the model. |
104 | 104 | */ |
@@ -275,15 +275,23 @@ public class Md3Model implements Geometry { | ||
275 | 275 | //set the desired color |
276 | 276 | GL.glColor4f(r, g, b, a); |
277 | 277 | |
278 | - //Update the leg and torso animations | |
279 | - updateModel(lower); | |
280 | - updateModel(upper); | |
281 | - | |
282 | 278 | //start rendering with the legs first. |
283 | 279 | drawLink(lower); |
284 | 280 | //set culling back to GL.GL_BACK |
285 | 281 | DisplaySystem.getDisplaySystem().cullMode(GL.GL_BACK, true); |
286 | 282 | } |
283 | + | |
284 | + /** | |
285 | + * <code>update</code> updates the position of the model's vertices | |
286 | + * to allow for animation. | |
287 | + * @param time the time between frames. | |
288 | + */ | |
289 | + public void update(float time) { | |
290 | + updateModel(lower); | |
291 | + updateModel(upper); | |
292 | + | |
293 | + | |
294 | + } | |
287 | 295 | |
288 | 296 | /** |
289 | 297 | * <code>setTorsoAnimation</code> sets the current animation of the |
@@ -1754,4 +1762,6 @@ public class Md3Model implements Geometry { | ||
1754 | 1762 | */ |
1755 | 1763 | Md3Tag[] tags; |
1756 | 1764 | } |
1765 | + | |
1766 | + | |
1757 | 1767 | } |
\ No newline at end of file |
@@ -188,8 +188,8 @@ public class TestMain extends AbstractGame { | ||
188 | 188 | currentAnimation = 2; |
189 | 189 | ((Md3Model) e.getGeometry()).setLegsAnimation("LEGS_RUN"); |
190 | 190 | } |
191 | - | |
192 | - } | |
191 | + | |
192 | + } | |
193 | 193 | protected void render() { |
194 | 194 | GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); |
195 | 195 | GL.glLoadIdentity(); |