Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


.obj conversion and fast load


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 lomateron   Members   -  Reputation: 363

Like
0Likes
Like

Posted 05 November 2012 - 06:48 PM

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, 05 November 2012 - 07:13 PM.


Sponsor:

#2 Tordin   Members   -  Reputation: 604

Like
0Likes
Like

Posted 06 November 2012 - 04:24 AM

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"




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS