Hmm.. This OBJ file structure is not available to load with wavefront loader. You must export this model using other OBJ exporter. Faces - this must be as triangles.
Hehehe.. I know. My model loader handles it... Took me days to figure it out.
You need to count how many point the face has.
Most commun are 3 point
x/x/x x/x/x x/x/x
But many have quads or more. Some even have a \ to tell the loader to continue reading the face point in the next line
What you do, you transform the the data into triplets yourself
in the case of a quads
1/1/1 2/2/2 3/3/3 4/4/4
you make 2 triplets
1,2,3, the other using 3,4,1
in the case of a huge set like this one
f 1782//143 1781//144 1780//145 1779//146 1778//143 1781//1 1782//1 1777//147 1776//148 1775//146 \
1782//1 1777//147 1776//148 1775//146
you split into triplets1782//143
1781//144 1780//145 1780//145
1778//143 1781//1 1782//1
1782//1 1777//147 1776//148
1776//148 1775//146 1782//1
1782//1 1777//147 1776//148
1776//148 1775//146 1782//143
some times you need to rewind if you are left with a single last entry like if you have 5 points, the last point must be linked to the first and either the second or the next to last point.
Though, GM models, if you are making them, do allow changing from triplets triglelist to mutiple triangle fans right in the model definition, it's best for faster models to pre translate to triplets.
And yes, it's best to tell to exporter to convert to triplets (triangles)...
I made a exporter when I did not find, at the time, a GM program that would load a obj while keeping the texture, color and uv and alpha... or support many of the models I had got. they had quads or more..
But then I was hoping to make a blender to d3d model export. But that would be pointeless now since all the blender imports dont work LOL.
I have yet to find a obj import export for blender that actually works. In fact I have yet to find ANY blender import export that work without loosing or screwing something in the translation... It's the main reason I made an obj and .x reader... I just could not load any of the models I downloaded into blender without something getting screwed up.
The main point is, it is best to have a separate obj reader that will make a GM d3d model; it supports everything you need excect multiple textures.
Well, that house I gave you takes 45 seconds to load from a obj file... But it's loads it d3d eqivalent in no time.
In a game, when it's starts. if you load 150 models.... Can you imagine the amount of time the user would wait?
As for the textures and fast drawing, I recommend you pretranslate the obj to a d3d model, create an iterim file,
a file that has 2 entries:
and copy over that material texture file.
Loading a model you just need to sprite_add or sprite_add_alpha the texture and model_load the d3d file and model_draw the model using the loaded texture....
Edited by icuurd12b42, 27 May 2008 - 07:07 PM.