Skip to main content
GameDev.net gamedev.net
🔒 Locked

.obj conversion and fast load

Started by lomateron Nov 6, 2012 at 12:48 AM 0 replies 1k views
Original Post
lomateron
lomateron
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
Tordin
Tordin
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.
"There will be major features. none to be thought of yet"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.