| 1 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield |
|---|
| 2 | * |
|---|
| 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. |
|---|
| 7 | * |
|---|
| 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. |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #ifndef OSGDB_WRITEFILE |
|---|
| 15 | #define OSGDB_WRITEFILE 1 |
|---|
| 16 | |
|---|
| 17 | #include <osg/Image> |
|---|
| 18 | #include <osg/Shape> |
|---|
| 19 | #include <osg/Node> |
|---|
| 20 | |
|---|
| 21 | #include <osgDB/Export> |
|---|
| 22 | #include <osgDB/Registry> |
|---|
| 23 | |
|---|
| 24 | #include <string> |
|---|
| 25 | |
|---|
| 26 | namespace osgDB { |
|---|
| 27 | |
|---|
| 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.*/ |
|---|
| 35 | extern OSGDB_EXPORT bool writeObjectFile(const osg::Object& object, const std::string& filename, const Options* options ); |
|---|
| 36 | |
|---|
| 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.*/ |
|---|
| 43 | inline bool writeObjectFile(const osg::Object& object, const std::string& filename) |
|---|
| 44 | { |
|---|
| 45 | return writeObjectFile( object, filename, Registry::instance()->getOptions() ); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 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.*/ |
|---|
| 55 | extern OSGDB_EXPORT bool writeImageFile(const osg::Image& image, const std::string& filename, const Options* options ); |
|---|
| 56 | |
|---|
| 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.*/ |
|---|
| 63 | inline bool writeImageFile(const osg::Image& image, const std::string& filename) |
|---|
| 64 | { |
|---|
| 65 | return writeImageFile( image, filename, Registry::instance()->getOptions() ); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 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.*/ |
|---|
| 75 | extern OSGDB_EXPORT bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& filename, const Options* options ); |
|---|
| 76 | |
|---|
| 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.*/ |
|---|
| 83 | inline bool writeHeightFieldFile(const osg::HeightField& hf, const std::string& filename) |
|---|
| 84 | { |
|---|
| 85 | return writeHeightFieldFile( hf, filename, Registry::instance()->getOptions() ); |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 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.*/ |
|---|
| 95 | extern OSGDB_EXPORT bool writeNodeFile(const osg::Node& node, const std::string& filename, const Options* options ); |
|---|
| 96 | |
|---|
| 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.*/ |
|---|
| 103 | inline bool writeNodeFile(const osg::Node& node, const std::string& filename) |
|---|
| 104 | { |
|---|
| 105 | return writeNodeFile( node, filename, Registry::instance()->getOptions() ); |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 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.*/ |
|---|
| 115 | extern OSGDB_EXPORT bool writeShaderFile(const osg::Shader& shader, const std::string& filename, const Options* options ); |
|---|
| 116 | |
|---|
| 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.*/ |
|---|
| 123 | inline bool writeShaderFile(const osg::Shader& shader, const std::string& filename) |
|---|
| 124 | { |
|---|
| 125 | return writeShaderFile( shader, filename, Registry::instance()->getOptions() ); |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | #endif |
|---|