tags:

views:

253

answers:

3

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?)

+1  A: 

hey,

try to change the entire collection of points in one shot like in this blog post.

basically because changing points one by one fire too many events.

Dave3D
+1  A: 

also, keep an eye on this list when doing optimizations.

Dave3D
+1  A: 

Robert Hogue who did some early wpf 3d demos for microsoft has a sample collection with a morph example too.

Sorry for the 3 posts ( one hyperlink per post for new users )

Dave3D