1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSGDB_WRITEFILE
15#define OSGDB_WRITEFILE 1
21#include <osgDB/Export>
22#include <osgDB/Registry>
28/** Write an osg::Object to file.
29 * Return true on success,
30 * return false on failure.
31 * Use the Options object to control cache operations and file search paths in osgDB::Registry.
32 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
33 * for the filename extension, and this plugin then handles the request
34 * to write the specified file.*/
35extern OSGDB_EXPORT bool writeObjectFile(const osg::Object& object, const std::string& filename, const Options* options );
37/** Write an osg::Object to file.
38 * Return true on success,
39 * return false on failure.
40 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
41 * for the filename extension, and this plugin then handles the request
42 * to write the specified file.*/
43inline bool writeObjectFile(const osg::Object& object, const std::string& filename)
45 return writeObjectFile( object, filename, Registry::instance()->getOptions() );
48/** Write an osg::Image to file.
49 * Return true on success,
50 * return false on failure.
51 * Use the Options object to control cache operations and file search paths in osgDB::Registry.
52 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
53 * for the filename extension, and this plugin then handles the request
54 * to write the specified file.*/
55extern OSGDB_EXPORT bool writeImageFile(const osg::Image& image, const std::string& filename, const Options* options );
57/** Write an osg::Image to file.
58 * Return true on success,
59 * return false on failure.
60 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
61 * for the filename extension, and this plugin then handles the request
62 * to write the specified file.*/
63inline bool writeImageFile(const osg::Image& image, const std::string& filename)
65 return writeImageFile( image, filename, Registry::instance()->getOptions() );
68/** Write an osg::HeightField to file.
69 * Return true on success,
70 * return false on failure.
71 * Use the Options object to control cache operations and file search paths in osgDB::Registry.
72 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
73 * for the filename extension, and this plugin then handles the request
74 * to write the specified file.*/
75extern OSGDB_EXPORT bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& filename, const Options* options );
77/** Write an osg::HeightField to file.
78 * Return true on success,
79 * return false on failure.
80 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
81 * for the filename extension, and this plugin then handles the request
82 * to write the specified file.*/
83inline bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& filename)
85 return writeHeightFieldFile( hf, filename, Registry::instance()->getOptions() );
88/** Write an osg::Node to file.
89 * Return true on success,
90 * return false on failure.
91 * Use the Options object to control cache operations and file search paths in osgDB::Registry.
92 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
93 * for the filename extension, and this plugin then handles the request
94 * to write the specified file.*/
95extern OSGDB_EXPORT bool writeNodeFile(const osg::Node& node, const std::string& filename, const Options* options );
97/** Write an osg::Node to file.
98 * Return true on success,
99 * return false on failure.
100 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
101 * for the filename extension, and this plugin then handles the request
102 * to write the specified file.*/
103inline bool writeNodeFile(const osg::Node& node, const std::string& filename)
105 return writeNodeFile( node, filename, Registry::instance()->getOptions() );
108/** Write an osg::Shader to file.
109 * Return true on success,
110 * return false on failure.
111 * Use the Options object to control cache operations and file search paths in osgDB::Registry.
112 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
113 * for the filename extension, and this plugin then handles the request
114 * to write the specified file.*/
115extern OSGDB_EXPORT bool writeShaderFile(const osg::Shader& shader, const std::string& filename, const Options* options );
117/** Write an osg::Shader to file.
118 * Return true on success,
119 * return false on failure.
120 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
121 * for the filename extension, and this plugin then handles the request
122 * to write the specified file.*/
123inline bool writeShaderFile(const osg::Shader& shader, const std::string& filename)
125 return writeShaderFile( shader, filename, Registry::instance()->getOptions() );
128/** Write an osg::Script to file.
129 * Return true on success,
130 * return false on failure.
131 * Use the Options object to control cache operations and file search paths in osgDB::Registry.
132 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
133 * for the filename extension, and this plugin then handles the request
134 * to write the specified file.*/
135extern OSGDB_EXPORT bool writeScriptFile(const osg::Script& image, const std::string& filename, const Options* options );
137/** Write an osg::Script to file.
138 * Return true on success,
139 * return false on failure.
140 * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
141 * for the filename extension, and this plugin then handles the request
142 * to write the specified file.*/
143inline bool writeScriptFile(const osg::Script& image, const std::string& filename)
145 return writeScriptFile( image, filename, Registry::instance()->getOptions() );