Hi Colin,

2012/2/4 Colin McDonald <[email protected]>
>
>
> I'd seen that the ive format did an endian test to determine which format
> the file was written out in.  But there is no endian flag field in the
> current
> osgb file format.  We could use the OSG_HEADER_LOW/HIGH fields,
> testing for swapped versions, but I didn't like that as it means there are
> two
> "magic number" variants at the start of the file.  I far as I know most
> other
> binary file format (such as image file formats) just choose an endian value
> and lump it on other systems.  Thats why I just went for little endian, its
> the most common for x86 and ARM, as you say.  Actually my model tool
> path tends to generate the models on a big endian system, but deploy on
> x86 - so choosing little endian is better for me than writing the file in
> the
> generating system format.
>
>
In fact we have good places for such flags. In the osgDB/OutputStream.cpp,
OutputStream::start() method, we have an attribute written to the binary
file, that is:

        if ( _useSchemaData )
        {
            attributes |= 0x2;  // Record if we use inbuilt schema data or
not
            useCompressSource = true;
        }
        *this << attributes;

You may set up the integer attribute here to add endian flags and accept it
in InputStream.cpp. This won't break compatibility with previous versions.

Hope this would help,

Wang Rui
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to