Notifications
Clear all

[Closed] getVert using MXS, dotnet and C#

i agree about IGame. it gives almost everything that you need to know about the scene. probably it’s the easiest way to collect a data (meshes, materials, animation…).

To be honest, I’m just experimenting/practicing at the moment. This exporter I’m working from time to time is a side project to the pipeline system I’m developing for the office and it’s also my intro to the SDK. Since C++ is too much for me at the moment, C# seams to me as the best alternative. Thanks for your advices!

Btw, do you have any other comments/advices for the code that I’ve uploaded?

Btw, do you have any other comments/advices for the code that I’ve uploaded?

sorry it’s it’s in the weirdo language invented by micro$oft which means visual studio c++ has an odd ^ symbol that i never use in it. I don’t do # Other than that stay clear of exporter writing as they can become monolithic monsters of coding ! though that said they are probably the easiest entry point for starting proper c++ plugin writing.

hehehe thanks anyway!

if you really want the fastest possible way to export mesh verts you’d be hard pressed to beat…

fwrite(mesh.verts, sizeof(Point3), mesh.numVerts, fstream);
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

it might be hard to believe but i found that many ‘data access’ operations are faster for MNMesh than for Mesh…

you can write the entire mnmesh vert array in one call but you would have to read it back as (int, Point3, int) but it will be slower as it’s a larger write.

fwrite(mnmesh.v, sizeof(MNVert), mnmesh.numv, fstream);
to have a continuous stream of vert positions you would have
to use...

    MNVert* verts = mnmesh.v;
    for(int i = 0; i < mnmesh.numv; ++i)
    	 fwrite(&verts[i].p,sizeof(Point3),1,fstream);

you could if were feeling adventurous go even lower level and use clever pointer math and write the bytes with system calls.

in my case it was exactly iteration through all verts(normals) … so i couldn’t use a power of easy pointing to…
i really couldn’t understand why the iteration through mnmesh data was faster for me than through mesh

something like this might work

char* verts = &((char *)mnmesh.v)[4];
   for(int i = 0;i < mnmesh.numv; ++i, verts += sizeof(MNVert))
   	 _write(fd, verts, sizeof(Point3));

but you’re looking at marginal gains if any. but i think the mesh
fwrite call would still just evaluate to

_write(fd, verts, sizeof(Point3) * numverts);

but without access to win32 fwrite source code who can say.

Page 2 / 2