Just to let you know - you're going to run into problems.
Namely VertexCoords changes must be stacked in order to work in realtime. Okay, I'll explain it better.
Think of the VertexCoords commands, as a command which copies the model out to a separate part of memory, applies any changes to vertex positions, then copies it back as soon as ANYTHING else in the scene is worked on. Not even necessarily rendered, just worked on.
Now - the actual mesh deformation, when it's "copied out" is very quick - and changing one vertex or 200 vertices, will take approximately the same amount of time. What chews up the processor is "copying" the mesh out and back again. (Nb: this isn't actually what it's doing, but it's a good analogy to understand how important it is to stack vertexcoord commands).
Say, in a single frame, you went from model to model, changing vertices in each of them, then updating their position, etc - it would create an unusably slow 5fps. You need to reflect ALL changes to vertex positions in a single instance, otherwise your performance is going to crawl.
IE - plan out your system carefully. What you want to do, is first of all find all meshes that need animating that are in the scene, and dump all the results into an array. Find the next frames in each of them, and what NEEDs to be animated in each of them, and dump that in an array. Find out what their new positions will be, if changed, etc, and dump that in an array. THEN, find out if any models on-screen are going to be in the same animated frame at any time and cull all the duplicates, opting for copy entity (or something similar) instead, and dump that in an array.
Next, assign all the meshes that are going to be edited, with handes. AnimatedMesh(1), AnimatedMesh(2), AnimatedSurface(1), AnimatedSurface(2), etc. You want to get all the mesh and surfaces allocated BEFORE starting to use VertexCoords, because using any other 3D command in the middle of VertexCoord changes, causes the mesh to be "copied" back - the slowdown in the process. Then, without any LINEPICKing or VIEWPORTing or anything else, run through the arrays and apply all changes to all meshes on screen all at once.
Copy any entities that need to be copied, and finally, render the scene.
Even this may be too slow. You'll probably have to find ways to "cheat" the updates in between every few frames. Which is why we generally use pre-compiled animated models. I was working on a similar system recently and gave up. Good luck! :)
+BlackD
Namely VertexCoords changes must be stacked in order to work in realtime. Okay, I'll explain it better.
Think of the VertexCoords commands, as a command which copies the model out to a separate part of memory, applies any changes to vertex positions, then copies it back as soon as ANYTHING else in the scene is worked on. Not even necessarily rendered, just worked on.
Now - the actual mesh deformation, when it's "copied out" is very quick - and changing one vertex or 200 vertices, will take approximately the same amount of time. What chews up the processor is "copying" the mesh out and back again. (Nb: this isn't actually what it's doing, but it's a good analogy to understand how important it is to stack vertexcoord commands).
Say, in a single frame, you went from model to model, changing vertices in each of them, then updating their position, etc - it would create an unusably slow 5fps. You need to reflect ALL changes to vertex positions in a single instance, otherwise your performance is going to crawl.
IE - plan out your system carefully. What you want to do, is first of all find all meshes that need animating that are in the scene, and dump all the results into an array. Find the next frames in each of them, and what NEEDs to be animated in each of them, and dump that in an array. Find out what their new positions will be, if changed, etc, and dump that in an array. THEN, find out if any models on-screen are going to be in the same animated frame at any time and cull all the duplicates, opting for copy entity (or something similar) instead, and dump that in an array.
Next, assign all the meshes that are going to be edited, with handes. AnimatedMesh(1), AnimatedMesh(2), AnimatedSurface(1), AnimatedSurface(2), etc. You want to get all the mesh and surfaces allocated BEFORE starting to use VertexCoords, because using any other 3D command in the middle of VertexCoord changes, causes the mesh to be "copied" back - the slowdown in the process. Then, without any LINEPICKing or VIEWPORTing or anything else, run through the arrays and apply all changes to all meshes on screen all at once.
Copy any entities that need to be copied, and finally, render the scene.
Even this may be too slow. You'll probably have to find ways to "cheat" the updates in between every few frames. Which is why we generally use pre-compiled animated models. I was working on a similar system recently and gave up. Good luck! :)
+BlackD