New Object, Material, Camera, Lamp File Format
2 posters
New Object, Material, Camera, Lamp File Format
As Im continuing the development I see alot of problem coming up from the file format for the next revision (v1.2). Binary is cool because its fast but its not really flexible. So I will go for a text format, using similar syntax as C (and honestly look alot like the ID fileformat, except that this one is not sequential ~ well almost ), at the moment the parser performances are pretty good:
Parsing tags (root, token, values, comments etc...): +/- 530 meg per sec.
Parsing tags + Affectation: +/- 150 meg per sec.
This new file format have some good features, basically now you can mix multiple SIO2 structure into 1 file or have (like it is right now) 1 structure per file. The parser is based on dynamic callbacks (and user defined when the root/token is unknown). So that means that you can literally add your own root, token and value and be capable add extra information to any SIO2 structure and use your custom loader (as a callback) to deal with the value you put in. Using this kind of approach the current format & future format will be backward and forward compatible ( v2.0 will still be capable to read v1.0 and vice versa ), which is also kinda cool, it also can execute LUA script at loading time etc... The only thing Im trading with all theses features and flexibility is speed. I didn't test yet against the current file format, put im pretty sure its going to be slower, since at the moment its like EXTREMELY optimized so...
There's an example:
[ my_model.txt ]
Ok now the question that everyone will ask:
Q:"Yeah well I already have some models that I make work with the previous version are they still good?"
A: Yes they are, simply export them again, properties will not change they will only be expanded along the current version, if you are loading something that doesn't not contain that new property the value will be set automatically to the default one.
So that's about it... If you guys have comments, questions or suggestions lemme know
Cheers,
Parsing tags (root, token, values, comments etc...): +/- 530 meg per sec.
Parsing tags + Affectation: +/- 150 meg per sec.
This new file format have some good features, basically now you can mix multiple SIO2 structure into 1 file or have (like it is right now) 1 structure per file. The parser is based on dynamic callbacks (and user defined when the root/token is unknown). So that means that you can literally add your own root, token and value and be capable add extra information to any SIO2 structure and use your custom loader (as a callback) to deal with the value you put in. Using this kind of approach the current format & future format will be backward and forward compatible ( v2.0 will still be capable to read v1.0 and vice versa ), which is also kinda cool, it also can execute LUA script at loading time etc... The only thing Im trading with all theses features and flexibility is speed. I didn't test yet against the current file format, put im pretty sure its going to be slower, since at the moment its like EXTREMELY optimized so...
There's an example:
[ my_model.txt ]
- Code:
/* Some comments */
script( "SOME LUA SCRIPT COMMANDS HERE" )
/* Some comments */
object( "myobject" )
{
mass( 16.0 )
rot( 1.0 2.0 3.0 )
pos( -100.123 -200 -300.123456 )
material("mymaterial")
nvert( 3 )
usenorm( 1 )
usevcol( 1 )
useuv0( 1 )
useuv1( 1 )
/* vert, normals, vcolor, uv0, uv1 */
vert( 1.0 2.0 3.0 -1.0 -2.0 -3.0 1 2 3 4 0.0 1.0 0.0 1.0 )
vert( 1.0 2.0 3.0 -1.0 -2.0 -3.0 1 2 3 4 0.0 1.0 0.0 1.0 )
vert( 1.0 2.0 3.0 -1.0 -2.0 -3.0 1 2 3 4 0.0 1.0 0.0 1.0 )
}
material("anewmaterial")
{
diff(1.0 2.0 3.0 4.0)
tex0( "image/texture0.jpg" )
tex1( "image/texture1.tga" )
}
Ok now the question that everyone will ask:
Q:"Yeah well I already have some models that I make work with the previous version are they still good?"
A: Yes they are, simply export them again, properties will not change they will only be expanded along the current version, if you are loading something that doesn't not contain that new property the value will be set automatically to the default one.
So that's about it... If you guys have comments, questions or suggestions lemme know
Cheers,
Last edited by sio2interactive on Fri Oct 03, 2008 2:07 am; edited 3 times in total (Reason for editing : typo...)
Re: New Object, Material, Camera, Lamp File Format
I like the idea. It makes debugging and editing a bit easier, plus it allows to version-control and diff your exported assets. I'm not sure whether it's available already, but if not, could you please add support for Blenders custom properties that you can add on Blenders Logic panel to your exporter?
Keep up the good work, highly appreciated!
Matt
Keep up the good work, highly appreciated!
Matt
Re: New Object, Material, Camera, Lamp File Format
Is it really necessary to support blender object custom properties as another dynamic struct attached to the object?
I think it would be more appropriate to write them down as custom token so you can link you can receive the control using a callback to parse them using your own preferred method.
Can someone else please comment on this,
Cheers,
I think it would be more appropriate to write them down as custom token so you can link you can receive the control using a callback to parse them using your own preferred method.
Can someone else please comment on this,
Cheers,
Similar topics
» Rotate the camera instead of the object...
» Camera / object movement
» Strange behavior of object and lamp during rotation
» Binding a Camera to an Object
» Static Camera to follow an Object
» Camera / object movement
» Strange behavior of object and lamp during rotation
» Binding a Camera to an Object
» Static Camera to follow an Object
Permissions in this forum:
You cannot reply to topics in this forum