Vector3 vertices

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
RyanGadz
Posts: 32
Joined: Thu Aug 12, 2010 8:34 pm
Contact:

Vector3 vertices

Post by RyanGadz »

okay i switched the vertices to Vector3 like how my custom contrent processor stores them so things should be faster now right because im not converting them to make a mesh

however with v.15 my load times have gone from 3-4 seconds to 6-8 seconds.. twice as slow? what gives?

Code: Select all

 for (var i = 0; i < _mapDecor.numS; i++)
            {
                structure[i] = content.Load<Model>(_mapDecor.structure[i]);
                // Look up our custom collision data from the Tag property of the model.
                var tagData = (Dictionary<string, object>) structure[i].Tag;
                var vertices = (Vector3[]) tagData["Vertices"];
                var indices = (int[]) tagData["Indices"];

                var mesh = new StaticMesh(vertices, indices);

                space.Add(mesh);
            //    ModelDrawer.Add(mesh);
            }
StaticTriangleGroup and StaticMesh that much different?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vector3 vertices

Post by Norbo »

I wouldn't expect the difference to be that pronounced. Most of the difference may be in the memory management during hierarchy construction. If I remember right, the old system used pooling during hierarchy construction. This kept garbage down some (not completely, due to list resizes), but tended to infect the pool with large size lists that weren't ever really used again, wasting a good deal of memory. The new system favors creating garbage during the load phase over holding garbage indefinitely, which may cause longer load times. The effect could be exaggerated on the phone.

If you ever change the world transform of the static mesh, you could put that into the mesh's constructor for some savings. Changing the world transform triggers a refit, which while faster than the hierarchy construction, still isn't instant.

The actual algorithm used by the TriangleMesh to construct a hierarchy is identical, though. In the future, possibly in v0.16.0, I'd like to look into expanding the usage of dynamic hierarchies in the engine. The construction times on dynamic hierarchies are extremely fast (the broadphase is a dynamic hierarchy and reconstructs on the fly sometimes). If I can get the query performance of dynamic hierarchies for meshes close enough to the current hierarchies, I'll switch them all over.
RyanGadz
Posts: 32
Joined: Thu Aug 12, 2010 8:34 pm
Contact:

Re: Vector3 vertices

Post by RyanGadz »

i have taken out all transforms of the mesh during runtime already. i guess the only thing i can do now is start taking out parts of the mesh that dont need to be there

thanks for the clarification
Post Reply