-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Implement morph targets similarly to Source Engine's Flex animation by cloning a model's vertex buffers (instancing) and using vertex_update_buffer_from_buffer() on them to lerp from base flex to target flexes when needed.
This would be difficult to implement mainly because ModelInstances are supposed to be fully garbage collectable and the workflow would be very inefficient - models would need to be exported and converted into BBMOD files for each morph and a new tool would need to be implemented to calculate deltas of vertex positions and normals (maybe even tangents!?) on each vertex buffer from base BBMOD to target BBMOD and output them.
If implemented, ModelInstance would receive a new method morph(name, value) with the following behaviour:
- On first call, clones the Model's vertex buffers (and stores the weak reference of the
ModelInstancesomewhere in order automatically destroy the buffers on GC). - Updates a
morphstruct containing the value of each morph target defined in aModel. - Use
vertex_update_buffer_from_buffer()on every cloned vertex buffer that is affected by the specified morph. - (OPTIONAL)
clear_morphs()would get rid of the cloned vertex buffers and all other morph information.