source: experimental/distortionNG/DistortionSet.h @ 350

Last change on this file since 350 was 350, checked in by Torben Dannhauer, 12 years ago
File size: 3.8 KB
Line 
1#ifndef OSGVIEWER_DistortionSet
2#define OSGVIEWER_DistortionSet 1
3
4/* -*-c++-*- osgVisual - Copyright (C) 2009-2012 Torben Dannhauer
5 *
6 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
7 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
8 * (at your option) any later version.  The full license is in LICENSE file
9 * included with this distribution, and on the openscenegraph.org website.
10 *
11 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
12 * You have to aquire licenses for all used proprietary modules.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * OpenSceneGraph Public License for more details.
18*/
19
20#include <osg/Object>
21#include <osg/Image>
22#include <osg/Matrixd>
23
24namespace osgViewer {
25
26class DistortionSet : public osg::Object
27{
28public:
29        META_Object(osgViewer,DistortionSet);   // Required for serializer
30
31        DistortionSet(const osgViewer::DistortionSet& ds, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): // Required for serializer
32                _distortionMeshRows(ds._distortionMeshRows),
33                _distortionMeshColumns(ds._distortionMeshColumns),
34                //osg::PrimitiveSet::Mode _MeshType
35                _intensityMap(ds._intensityMap),
36                _texUnitScene(ds._texUnitScene),
37                _texUnitIntensityMap(ds._texUnitIntensityMap),
38                _viewOffset(ds._viewOffset),
39                _projectionOffset(ds._projectionOffset),
40                _showIntesityMapMapOnly(ds._showIntesityMapMapOnly){}
41
42        DistortionSet();
43        virtual ~DistortionSet();
44
45        // Working access
46        osg::Image* getIntensityMap()  { return _intensityMap; }        // Also for manipulating the intensity map
47        bool& getShowIntensityMapOnlyAsRef()    { return _showIntesityMapMapOnly;}
48
49
50
51        // Serializer Access
52        void setDistortionMeshRows(int distortionMeshRows)              { _distortionMeshRows = distortionMeshRows; }
53        int getDistortionMeshRows() const       { return _distortionMeshRows; }
54
55        void setDistortionMeshColumns(int distortionMeshColumns)                { _distortionMeshColumns = distortionMeshColumns; }
56        int getDistortionMeshColumns() const    { return _distortionMeshColumns; }
57
58        void setMeshType(GLenum meshType) { _meshType = meshType; }
59    inline GLenum getMeshType() const { return _meshType; }
60
61        void setIntensityMap(osg::Image* intensityMap)          { _intensityMap = intensityMap; }
62        const osg::Image* getIntensityMap() const       { return _intensityMap; }
63
64
65        void setTexUnitScene(unsigned int texUnitScene)         { _texUnitScene = texUnitScene; }
66        unsigned int getTexUnitScene() const    { return _texUnitScene; }
67
68        void setTexUnitIntensityMap(unsigned int texUnitIntensityMap)   { _texUnitIntensityMap = texUnitIntensityMap; }
69        unsigned int getTexUnitIntensityMap() const     { return _texUnitIntensityMap; }
70
71        void setViewOffset(const osg::Matrixd& viewOffset)      { _viewOffset = viewOffset; }
72        const osg::Matrixd& getViewOffset() const       { return _viewOffset; }
73
74        void setProjectionOffset(const osg::Matrixd& projectionOffset)          { _projectionOffset = projectionOffset; }
75        const osg::Matrixd& getProjectionOffset() const { return _projectionOffset; }
76
77        void setShowIntensityMapOnly(bool show) {_showIntesityMapMapOnly = show;}
78        bool getShowIntensityMapOnly() const    { return _showIntesityMapMapOnly;}
79
80
81private:
82        int _distortionMeshRows;
83        int _distortionMeshColumns;
84        GLenum _meshType;
85       
86        osg::ref_ptr<osg::Image> _intensityMap;
87        unsigned int _texUnitScene;
88        unsigned int _texUnitIntensityMap;
89
90        osg::Matrixd _viewOffset;
91        osg::Matrixd _projectionOffset;
92
93        bool _showIntesityMapMapOnly;   // Intensity Blending is done by a frag shader. To control it on runtime, the uniform must be bound to a central variable.
94};
95
96}
97
98
99#endif
Note: See TracBrowser for help on using the repository browser.