rawVolModelRenderer.h

00001 
00002 /* Copyright (c) 2007       Maxim Makhinya
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef EVOLVE_RAW_VOL_MODEL_RENDERER_H
00019 #define EVOLVE_RAW_VOL_MODEL_RENDERER_H
00020 
00021 #include "rawVolModel.h"
00022 #include "sliceClipping.h"
00023 #include "glslShaders.h"
00024 
00025 
00026 namespace eVolve
00027 {
00028 
00029     class RawVolumeModelRenderer
00030     {
00031     public:
00032         RawVolumeModelRenderer( const std::string& filename,
00033                                 const uint32_t     precision   = 1 );
00034 
00035         bool loadHeader( const float brightness, const float alpha )
00036         {
00037             return _rawModel.loadHeader( brightness, alpha );
00038         }
00039 
00040         const VolumeScaling& getVolumeScaling() const
00041         {
00042             return _rawModel.getVolumeScaling();
00043         }
00044 
00045         void glewSetContext( GLEWContext* context )
00046         {
00047             _glewContext = context;
00048             _rawModel.glewSetContext( context );
00049         }
00050 
00051 
00052         bool render( const eq::Range&       range,
00053                      const eq::Matrix4d&  modelviewM,
00054                      const eq::Matrix3d&  modelviewITM,
00055                      const eq::Matrix4f&  invRotationM  );
00056 
00057         void setPrecision( const uint32_t precision ){ _precision = precision; }
00058         void setOrtho( const uint32_t ortho )        { _ortho = ortho; }
00059 
00060         GLEWContext* glewGetContext() { return _glewContext; }
00061         bool loadShaders();
00062 
00063     private:
00064         void _putVolumeDataToShader( const VolumeInfo&     volumeInfo,
00065                                      const double          sliceDistance,
00066                                      const eq::Matrix4f& invRotationM );
00067 
00068         RawVolumeModel  _rawModel;      
00069         SliceClipper    _sliceClipper;  
00070         uint32_t        _precision;     
00071         GLSLShaders     _shaders;       
00072 
00073         GLEWContext*    _glewContext;   
00074 
00075         bool            _ortho;         
00076 
00077     };
00078 
00079 }
00080 #endif // EVOLVE_RAW_VOL_MODEL_RENDERER_H
00081 
Generated on Mon Aug 10 18:58:41 2009 for Equalizer 0.9 by  doxygen 1.5.8