I’d like to create a mesh that grows over time, something like a time-lapse animation of a knitted blanket. I can’t pre-create it and reveal it, because the data is dynamic. I have to add on in real time.
When I tried to add on to the mesh, I got an error on this line:
[java]m.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));[/java]
Partial stacktrace:
java.lang.UnsupportedOperationException: Data has already been sent. Cannot setupData again.
at com.jme3.scene.VertexBuffer.setupData(VertexBuffer.java:296)
at com.jme3.scene.Mesh.setBuffer(Mesh.java:497)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:132)
at xref.XrefController$_closure2.doCall(XrefController.groovy:102)
What is the right way to do this?
Thanks,
Lee