source: experimental/distortionNG/DistortionSetupStrategyProjectionDesigner.h @ 421

Last change on this file since 421 was 410, checked in by Torben Dannhauer, 12 years ago

New Distortion setup strategy added: distortionNG can now handle configuration files of "Projection Designer"

File size: 3.1 KB
RevLine 
[406]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
[410]21#include <osgDB/FileUtils>
22#include <osg/Texture2D>
23
[406]24#include "DistortionSetupStrategy.h"
25
26/**
[410]27 * \brief This class parses the Projection Dsigner specific configuration files.
[406]28 *
29 * @author Torben Dannhauer
30 * @date  Aug 2012
31 */ 
[410]32class CameraConfigParser : public osg::Referenced
33{
34public:
35        CameraConfigParser();
36        virtual ~CameraConfigParser() {};
37
38        bool parseConfigFile(const char * filename);
39
40        bool extractFrustum(std::string data_);
41        bool extractRotation(std::string data_);
42        bool extractTranslation(std::string data_);
43
44        std::vector<double> getFrustumDataset() {return(frustumValues);}       
45        std::vector<double> getRotationDataset() {return(rotationValues);}
46        std::vector<double> getTranslationDataset() {return(translationValues);}
47        bool isConfigParsed() {return configParsed;};
48
49private:
50        bool configParsed;
51        std::vector<double> frustumValues;
52        std::vector<double> rotationValues;
53        std::vector<double> translationValues;
54};
55
56
57/**
58 * \brief "Projection Designer" Setup Strategy reads setup files of Projection Designer and configures the distortion accordingly.
59 *
60 * @author Torben Dannhauer, Ludwig Friedmann
61 * @date  Aug 2012
62 */ 
[406]63class DistortionSetupStrategyProjectionDesigner :
64        public DistortionSetupStrategy
65{
66public:
67        DistortionSetupStrategyProjectionDesigner();
68        ~DistortionSetupStrategyProjectionDesigner();
69        void delegateDistortionSetup(osgViewer::DistortionSet* distortionSet);
[410]70        void setDistortionInputFiles(std::string distortionFile, std::string blendmapFile, std::string frustumFile);
71
72        std::vector<double> getFrustumDataset() {return parser->getFrustumDataset();};
73       
74        std::vector<double> getRotationDataset() {return parser->getRotationDataset();};
75
76        std::vector<double> getTranslationDataset() {return parser->getTranslationDataset();};
77
[406]78private:
79        bool _distortionInitialized;                            //Is Distortion already initialized?
[410]80        std::string _blendmapFilename;
81        std::string _frustumFilename;
82        std::string _distortionFilename;
[406]83
[410]84
85
86        osg::Texture* loadTexture( const std::string& fileName );
87
88        osg::ref_ptr<CameraConfigParser> parser;
89        osg::ref_ptr<osg::Texture> distortMapTexture;
[406]90};
[410]91
92
93
Note: See TracBrowser for help on using the repository browser.