Inside a window I have Viewport3D
which has ModelVisual3D
with Model3DGroup
inside.
I configure 17 GeometryModel3D
's. Meshes of all of them share the same Point3DCollection
.
The model is shown Ok.
Then I change the Point3DCollection
:
private void btMutate_Click(object sender, RoutedEventArgs e)
{
Stopwatch sw = Stopwatch.StartNew();
int npcount = points.Count;
var rnd = new Random();
for (int i = 0; i < 10; ++i)
{
int index = rnd.Next(npcount);
var p = points[index];
p.X *= 1.2;
p.Y *= 0.9;
points[index] = p;
}
sw.Stop();
Trace.TraceInformation("Mutation took {0} ms", sw.ElapsedMilliseconds);
}
The code execution takes 1-3 ms.
But I actually see the changes only after a couple of seconds.
This is a question by example.
To put it simple, how do I properly animate vertices of my 3d objects?
(or what's wrong here?)