1 | /* osgVisual test. distortionNG, experimental. |
---|
2 | * |
---|
3 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
4 | * of this software and associated documentation files (the "Software"), to deal |
---|
5 | * in the Software without restriction, including without limitation the rights |
---|
6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
7 | * copies of the Software, and to permit persons to whom the Software is |
---|
8 | * furnished to do so, subject to the following conditions: |
---|
9 | * |
---|
10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
11 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
12 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
13 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
14 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
15 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
16 | * THE SOFTWARE. |
---|
17 | */ |
---|
18 | |
---|
19 | #pragma once |
---|
20 | |
---|
21 | #include <osg/Notify> |
---|
22 | #include <osgDB/FileNameUtils> |
---|
23 | #include <osgDB/FileUtils> |
---|
24 | #include <osgDB/Registry> |
---|
25 | #include <osgDB/ReadFile> |
---|
26 | #include <osgDB/WriteFile> |
---|
27 | #include <stdlib.h> |
---|
28 | |
---|
29 | |
---|
30 | class ReaderWriterDist : public osgDB::ReaderWriter |
---|
31 | { |
---|
32 | public: |
---|
33 | ReaderWriterDist(); |
---|
34 | |
---|
35 | virtual const char* className() const { return "distortion set loader"; }; |
---|
36 | Options* prepareReading( ReadResult& result, std::string& fileName, std::ios::openmode& mode, const Options* options ) const; |
---|
37 | Options* prepareWriting( WriteResult& result, const std::string& fileName, std::ios::openmode& mode, const Options* options ) const; |
---|
38 | virtual ReadResult readObject( const std::string& file, const osgDB::ReaderWriter::Options* options) const; |
---|
39 | virtual ReadResult readObject( std::istream& fin, const osgDB::ReaderWriter::Options* options ) const; |
---|
40 | virtual WriteResult writeObject( const osg::Object& object, const std::string& fileName, const osgDB::ReaderWriter::Options* options ) const; |
---|
41 | virtual WriteResult writeObject( const osg::Object& object, std::ostream& fout, const osgDB::ReaderWriter::Options* options ) const; |
---|
42 | |
---|
43 | |
---|
44 | private: |
---|
45 | std::string extensionToAdd; |
---|
46 | |
---|
47 | osg::ref_ptr<osgDB::Options> readOptions; |
---|
48 | osg::ref_ptr<osgDB::Options> writeOptions; |
---|
49 | osg::ref_ptr<osgDB::ReaderWriter> rw; |
---|
50 | }; |
---|