root/OpenSceneGraph/trunk/include/osgDB/ReadFile @ 13041

Revision 13041, 12.9 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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_READFILE
15#define OSGDB_READFILE 1
16
17#include <string>
18
19#include <osg/Node>
20#include <osg/Image>
21#include <osg/ArgumentParser>
22
23#include <osgDB/Export>
24#include <osgDB/Registry>
25
26namespace osgDB {
27
28
29/** Read an osg::Object from file.
30  * Return valid osg::Object on success,
31  * return NULL on failure.
32  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
33  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
34  * for the filename extension, and this plugin then handles the request
35  * to read the specified file.*/
36extern OSGDB_EXPORT osg::Object* readObjectFile(const std::string& filename,const Options* options);
37
38/** Read an osg::Object from file.
39  * Return valid osg::Object on success,
40  * return NULL on failure.
41  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
42  * for the filename extension, and this plugin then handles the request
43  * to read the specified file.*/
44inline osg::Object* readObjectFile(const std::string& filename)
45{
46    return readObjectFile(filename,Registry::instance()->getOptions());
47}
48
49/** Read an osg::Image from file.
50  * Return valid osg::Image on success,
51  * return NULL on failure.
52  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
53  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
54  * for the filename extension, and this plugin then handles the request
55  * to read the specified file.*/
56extern OSGDB_EXPORT osg::Image*  readImageFile(const std::string& filename,const Options* options);
57
58/** Read an osg::Image from file.
59  * Return valid osg::Image on success,
60  * return NULL on failure.
61  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
62  * for the filename extension, and this plugin then handles the request
63  * to read the specified file.*/
64inline osg::Image*  readImageFile(const std::string& filename)
65{
66    return readImageFile(filename,Registry::instance()->getOptions());
67}
68
69/** Read an osg::HeightField from file.
70  * Return valid osg::HeightField on success,
71  * return NULL on failure.
72  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
73  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
74  * for the filename extension, and this plugin then handles the request
75  * to read the specified file.*/
76extern OSGDB_EXPORT osg::HeightField*  readHeightFieldFile(const std::string& filename,const Options* options);
77
78/** Read an osg::HeightField from file.
79  * Return valid osg::HeightField on success,
80  * return NULL on failure.
81  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
82  * for the filename extension, and this plugin then handles the request
83  * to read the specified file.*/
84inline osg::HeightField*  readHeightFieldFile(const std::string& filename)
85{
86    return readHeightFieldFile(filename,Registry::instance()->getOptions());
87}
88
89/** Read an osg::Node from file.
90  * Return valid osg::Node on success,
91  * return NULL on failure.
92  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
93  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
94  * for the filename extension, and this plugin then handles the request
95  * to read the specified file.*/
96extern OSGDB_EXPORT osg::Node*  readNodeFile(const std::string& filename,const Options* options);
97
98/** Read an osg::Node from file.
99  * Return valid osg::Node on success,
100  * return NULL on failure.
101  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
102  * for the filename extension, and this plugin then handles the request
103  * to read the specified file.*/
104inline osg::Node*  readNodeFile(const std::string& filename)
105{
106    return readNodeFile(filename,Registry::instance()->getOptions());
107}
108
109
110/** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more
111  * than one subgraph has been loaded.
112  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
113  * Does NOT ignore strings beginning with a dash '-' character. */
114extern OSGDB_EXPORT osg::Node* readNodeFiles(std::vector<std::string>& fileList,const Options* options);
115
116/** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more
117  * than one subgraph has been loaded.*/
118inline osg::Node* readNodeFiles(std::vector<std::string>& fileList)
119{
120    return readNodeFiles(fileList,Registry::instance()->getOptions());
121}
122
123
124/** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more
125  * than one subgraph has been loaded.
126  * Use the Options object to control cache operations and file search paths in osgDB::Registry.*/
127extern OSGDB_EXPORT osg::Node* readNodeFiles(osg::ArgumentParser& parser,const Options* options);
128
129/** Read an osg::Node subgraph from files, creating a osg::Group to contain the nodes if more
130  * than one subgraph has been loaded.*/
131inline osg::Node* readNodeFiles(osg::ArgumentParser& parser)
132{
133    return readNodeFiles(parser,Registry::instance()->getOptions());
134}
135
136/** Read an osg::Shader from file.
137  * Return valid osg::Shader on success,
138  * return NULL on failure.
139  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
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 read the specified file.*/
143extern OSGDB_EXPORT osg::Shader*  readShaderFile(const std::string& filename,const Options* options);
144
145/** Read an osg::Shader from file.
146  * Return valid osg::Shader on success,
147  * return NULL on failure.
148  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
149  * for the filename extension, and this plugin then handles the request
150  * to read the specified file.*/
151inline osg::Shader*  readShaderFile(const std::string& filename)
152{
153    return readShaderFile(filename,Registry::instance()->getOptions());
154}
155
156/** Read an osg::Shader from file and set to specified shader type.
157  * Return valid osg::Shader on success,
158  * return NULL on failure.
159  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
160  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
161  * for the filename extension, and this plugin then handles the request
162  * to read the specified file.*/
163inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& filename,const Options* options)
164{
165    osg::Shader* shader = readShaderFile(filename, options);
166    if (shader && type != osg::Shader::UNDEFINED) shader->setType(type);
167    return shader;
168}
169
170/** Read an osg::Shader from file and set to specified shader type
171  * Return valid osg::Shader on success,
172  * return NULL on failure.
173  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
174  * for the filename extension, and this plugin then handles the request
175  * to read the specified file.*/
176inline osg::Shader* readShaderFile(osg::Shader::Type type, const std::string& filename)
177{
178    return readShaderFile(type, filename,Registry::instance()->getOptions());
179}
180
181/** Read an osg::Object from file.
182  * Return an assigned osg::ref_ptr on success,
183  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
184  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
185  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
186  * for the filename extension, and this plugin then handles the request
187  * to read the specified file.*/
188extern OSGDB_EXPORT osg::ref_ptr<osg::Object> readRefObjectFile(const std::string& filename,const Options* options);
189
190/** Read an osg::Object from file.
191  * Return an assigned osg::ref_ptr on success,
192  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
193  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
194  * for the filename extension, and this plugin then handles the request
195  * to read the specified file.*/
196inline osg::ref_ptr<osg::Object> readRefObjectFile(const std::string& filename)
197{
198    return readRefObjectFile(filename,Registry::instance()->getOptions());
199}
200
201/** Read an osg::Image from file.
202  * Return an assigned osg::ref_ptr on success,
203  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
204  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
205  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
206  * for the filename extension, and this plugin then handles the request
207  * to read the specified file.*/
208extern OSGDB_EXPORT osg::ref_ptr<osg::Image>  readRefImageFile(const std::string& filename,const Options* options);
209
210/** Read an osg::Image from file.
211  * Return an assigned osg::ref_ptr on success,
212  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
213  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
214  * for the filename extension, and this plugin then handles the request
215  * to read the specified file.*/
216inline osg::ref_ptr<osg::Image>  readRefImageFile(const std::string& filename)
217{
218    return readRefImageFile(filename,Registry::instance()->getOptions());
219}
220
221/** Read an osg::HeightField from file.
222  * Return an assigned osg::ref_ptr on success,
223  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
224  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
225  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
226  * for the filename extension, and this plugin then handles the request
227  * to read the specified file.*/
228extern OSGDB_EXPORT osg::ref_ptr<osg::HeightField>  readRefHeightFieldFile(const std::string& filename,const Options* options);
229
230/** Read an osg::HeightField from file.
231  * Return an assigned osg::ref_ptr on success,
232  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
233  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
234  * for the filename extension, and this plugin then handles the request
235  * to read the specified file.*/
236inline osg::ref_ptr<osg::HeightField>  readRefHeightFieldFile(const std::string& filename)
237{
238    return readRefHeightFieldFile(filename,Registry::instance()->getOptions());
239}
240
241/** Read an osg::Node from file.
242  * Return an assigned osg::ref_ptr on success,
243  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
244  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
245  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
246  * for the filename extension, and this plugin then handles the request
247  * to read the specified file.*/
248extern OSGDB_EXPORT osg::ref_ptr<osg::Node>  readRefNodeFile(const std::string& filename,const Options* options);
249
250/** Read an osg::Node from file.
251  * Return an assigned osg::ref_ptr on success,
252  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
253  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
254  * for the filename extension, and this plugin then handles the request
255  * to read the specified file.*/
256inline osg::ref_ptr<osg::Node>  readRefNodeFile(const std::string& filename)
257{
258    return readRefNodeFile(filename,Registry::instance()->getOptions());
259}
260
261/** Read an osg::Shader from file.
262  * Return an assigned osg::ref_ptr on success,
263  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
264  * Use the Options object to control cache operations and file search paths in osgDB::Registry.
265  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
266  * for the filename extension, and this plugin then handles the request
267  * to read the specified file.*/
268extern OSGDB_EXPORT osg::ref_ptr<osg::Shader>  readRefShaderFile(const std::string& filename,const Options* options);
269
270/** Read an osg::Shader from file.
271  * Return an assigned osg::ref_ptr on success,
272  * return an osg::ref_ptr with a NULL pointer assigned to it on failure.
273  * The osgDB::Registry is used to load the appropriate ReaderWriter plugin
274  * for the filename extension, and this plugin then handles the request
275  * to read the specified file.*/
276inline osg::ref_ptr<osg::Shader>  readRefShaderFile(const std::string& filename)
277{
278    return readRefShaderFile(filename,Registry::instance()->getOptions());
279}
280
281
282}
283
284#endif
Note: See TracBrowser for help on using the browser.