Hi Rui, > the binary format won't write such keywords. Instead the osgb files > will have a magic number at the beginning for differentiation.
I see. Binary formats may be a problem. I saw one format that writes ascii header to the binary file. There was just a condition that the header should not exceed 80 characters, but the binary data started just after the \n character anyway. Anyway, I am sure that you have a clear idea. My suggestion, if it is not against your design, would be to put "OSG " or "OSG\n" or "OSGb" or [something else] characters followed by any magic numbers (soversion, etc.), or if you have nothing against longer magic sequence, to put "OpenSceneGraph Binary Scene\n" followed by the rest of the magic. If writing strings is a problem in the binary file, we may speak about binary data of fixed length instead. I personally would like the longer version for better readability. Anyway, it is completely up to you. I just intended to write ideas that you may or may not find interesting. There is one more thing that I would appreciate very much with text version of the format: I am sometimes hand-editing it. When I made a single mistake among all the changes and the file can not be read, I feel lost and the line number in the error message would be very helpful. Anyway, just an idea and do not bother if you are too much occupied. Thanks, John On Wednesday 29 of August 2012 22:18:11 Wang Rui wrote: > Hi John, > > Thanks for the suggestion. Change the ascii file header to a more > clear one should be necessary. I would like to consider the > modification this time. > > But it may not be enough to only test the characters here for backward > compatibility because the binary format won't write such keywords. > Instead the osgb files will have a magic number at the beginning for > differentiation. So for binary files the best way is to make use of > the soversion number, or the attribute flags which is always written > in osgb files (at present it is used only for enabling/disabling > compressors). > > Cheers, > > Wang Rui > > 2012/8/29 PCJohn <[email protected]>: > > Hi Rui, > > > >> > When you say at the beginning of each file, what do you mean? > >> > >> I just mean that the version string can be stored in the saved file, > >> too, so it will be used automatically while reading. A boolean flag > >> will be also used to indicate the feature is enabled or disabled for > >> backward-compatibility. > > > > First of all, osgt is great for storing OSG scene graph. Thanks for it. > > Maybe just a stupid comment. When I look to osgt files, I am always > > thinking about the header: > > > > #Ascii Scene > > #Version 90 > > #Generator OpenSceneGraph 3.1.0 > > > > Would it be possible to follow Unix customs and to make first line > > identify the content of the file? "Ascii Scene" is good, but there are > > other 3D scene formats in ascii (X3D, STL, Inventor,...). "OpenSceneGraph > > Ascii Scene" would be more precise. To get OpenSceneGraph from Generator > > string is not correct as OSG can write to many file formats (and > > Generator string is not the first line> > > :-) ). > > > > Backward compatibility can be implemented by testing for both headers > > "Ascii Scene" and the new one. > > > > Just a small idea. > > John > > _______________________________________________ > > osg-submissions mailing list > > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegrap > > h.org > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph. > org _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
