Sign in to follow this  

.obj conversion and fast load

This topic is 1897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Now that I want to use some complex meshes, and i am starting to learn how to put .obj vertex, index,UV,normals info in a D3D10_SUBRESOURCE_DATA.
I dont want to load my meshes from a .obj dirtectly, I want them to just be in a file were i just have to do this fast and simple thing:

D3D10_SUBRESOURCE_DATA InitData;

FILE * file;
fp = fopen("mesh.mesh","rb");

fread(vertices,sizeof(VERTEXCHUNKPART),1,file);

InitData.pSysMem = &vertices;

Is this possible?
If its possible, how to make the file, lets say i just have a mesh of 2 vertex with position (0,0,0)and (1,1,1)
so i have a text file with just this:
2 //because of 2 vertices
000
111
how can i convert that text into the file that can be loaded fast and simple.

FINAL EDIT
Now i see(yes I am stupid), my real question is having for example

SimpleVertex vertices[] =
{
D3DXVECTOR3( -1.0f, 1.0f, 0.0f ),
D3DXVECTOR3( 1.0f, 1.0f, 0.0f ),
D3DXVECTOR3( -1.0f, -1.0f, 0.0f ),
D3DXVECTOR3( 1.0f, -1.0f, 0.0f ),
};

how can i output vertices in to a file directly, outputting that chunk of memory directly into a file Edited by lomateron

Share this post


Link to post
Share on other sites
if you are reading binary just write the data binary to a file.
you know how you defined the file so you make the rules for it.

Share this post


Link to post
Share on other sites

This topic is 1897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this