root/OpenSceneGraph/trunk/src/osgWrappers/serializers/osg/TextureCubeMap.cpp @ 13041

Revision 13041, 1.8 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1#include <osg/TextureCubeMap>
2#include <osgDB/ObjectWrapper>
3#include <osgDB/InputStream>
4#include <osgDB/OutputStream>
5
6#define FACE_IMAGE_FUNCTION( PROP, FACE ) \
7    static bool check##PROP( const osg::TextureCubeMap& tex ) { return true; } \
8    static bool read##PROP( osgDB::InputStream& is, osg::TextureCubeMap& tex ) { \
9        bool hasImage; is >> hasImage; \
10        if ( hasImage ) { \
11            is >> osgDB::BEGIN_BRACKET; tex.setImage(FACE, is.readImage()); \
12            is >> osgDB::END_BRACKET; \
13        } \
14        return true; \
15    } \
16    static bool write##PROP( osgDB::OutputStream& os, const osg::TextureCubeMap& tex ) { \
17        const osg::Image* image = tex.getImage(FACE); \
18        os << (image!=NULL); \
19        if ( image!=NULL ) { \
20            os << osgDB::BEGIN_BRACKET << std::endl << image; \
21            os << osgDB::END_BRACKET; \
22        } \
23        os << std::endl; \
24        return true; \
25    }
26
27FACE_IMAGE_FUNCTION( PosX, osg::TextureCubeMap::POSITIVE_X )
28FACE_IMAGE_FUNCTION( NegX, osg::TextureCubeMap::NEGATIVE_X )
29FACE_IMAGE_FUNCTION( PosY, osg::TextureCubeMap::POSITIVE_Y )
30FACE_IMAGE_FUNCTION( NegY, osg::TextureCubeMap::NEGATIVE_Y )
31FACE_IMAGE_FUNCTION( PosZ, osg::TextureCubeMap::POSITIVE_Z )
32FACE_IMAGE_FUNCTION( NegZ, osg::TextureCubeMap::NEGATIVE_Z )
33
34REGISTER_OBJECT_WRAPPER( TextureCubeMap,
35                         new osg::TextureCubeMap,
36                         osg::TextureCubeMap,
37                         "osg::Object osg::StateAttribute osg::Texture osg::TextureCubeMap" )
38{
39    ADD_USER_SERIALIZER( PosX );
40    ADD_USER_SERIALIZER( NegX );
41    ADD_USER_SERIALIZER( PosY );
42    ADD_USER_SERIALIZER( NegY );
43    ADD_USER_SERIALIZER( PosZ );
44    ADD_USER_SERIALIZER( NegZ );  // _images
45
46    ADD_INT_SERIALIZER( TextureWidth, 0 );  // _textureWidth
47    ADD_INT_SERIALIZER( TextureHeight, 0 );  // _textureHeight
48}
Note: See TracBrowser for help on using the browser.