Voreen - Volume Rendering Engine Voreen - Volume Rendering Engine
Voreen - Volume Rendering Engine Westfälische Wilhelms-Universität Münster
  • About
  • Gallery
  • Download
  • Documentation
  • Publications
  • Community

  • Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

include/voreen/core/datastructures/transfunc/transfunc.h

00001 /**********************************************************************
00002  *                                                                    *
00003  * Voreen - The Volume Rendering Engine                               *
00004  *                                                                    *
00005  * Copyright (C) 2005-2010 The Voreen Team. <http://www.voreen.org>   *
00006  *                                                                    *
00007  * This file is part of the Voreen software package. Voreen is free   *
00008  * software: you can redistribute it and/or modify it under the terms *
00009  * of the GNU General Public License version 2 as published by the    *
00010  * Free Software Foundation.                                          *
00011  *                                                                    *
00012  * Voreen is distributed in the hope that it will be useful,          *
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the       *
00015  * GNU General Public License for more details.                       *
00016  *                                                                    *
00017  * You should have received a copy of the GNU General Public License  *
00018  * in the file "LICENSE.txt" along with this program.                 *
00019  * If not, see <http://www.gnu.org/licenses/>.                        *
00020  *                                                                    *
00021  * The authors reserve all rights not expressly granted herein. For   *
00022  * non-commercial academic use see the license exception specified in *
00023  * the file "LICENSE-academic.txt". To get information about          *
00024  * commercial licensing please contact the authors.                   *
00025  *                                                                    *
00026  **********************************************************************/
00027 
00028 #ifndef VRN_TRANSFUNC_H
00029 #define VRN_TRANSFUNC_H
00030 
00031 #include "voreen/core/io/serialization/serialization.h"
00032 
00033 #include "tgt/texture.h"
00034 #include "tgt/vector.h"
00035 
00036 #include <vector>
00037 #include <string>
00038 
00039 namespace voreen {
00040 
00047 class TransFunc : public Serializable {
00048 public:
00049 
00060     TransFunc(int width = 256, int height = 1, int depth = 1,
00061         GLint format = GL_RGBA, GLenum dataType = GL_UNSIGNED_BYTE, tgt::Texture::Filter filter = tgt::Texture::NEAREST);
00062 
00066     virtual ~TransFunc();
00067 
00075     virtual std::string getShaderDefines() const;
00076 
00083     virtual std::string getSamplerType() const;
00084 
00088     tgt::ivec3 getDimensions() const;
00089 
00097     void bind();
00098 
00106     tgt::Texture* getTexture();
00107 
00116     virtual void resize(int width, int height = 1, int depth = 1);
00117 
00122     void invalidateTexture();
00123 
00127     bool isTextureInvalid() const;
00128 
00138     virtual void updateTexture();
00139 
00151     virtual void setPixelData(GLubyte* data);
00152 
00156     virtual GLubyte* getPixelData();
00157 
00164     virtual bool load(const std::string& filename);
00165 
00171     const std::vector<std::string>& getLoadFileFormats() const;
00172 
00178     const std::vector<std::string>& getSaveFileFormats() const;
00179 
00185     virtual void serialize(XmlSerializer& s) const;
00186 
00192     virtual void deserialize(XmlDeserializer& s);
00193 
00197     virtual TransFunc* clone() const;
00198 
00202     GLint getFormat() const;
00203 
00204 protected:
00205 
00209     virtual void createTex();
00210 
00211     tgt::Texture* tex_;           
00212     tgt::ivec3 dimensions_;       
00213     GLint format_;                
00214     GLenum dataType_;             
00215     tgt::Texture::Filter filter_; 
00216 
00217     std::vector<std::string> loadFileFormats_; 
00218     std::vector<std::string> saveFileFormats_; 
00219 
00220     bool textureInvalid_;         
00221 
00222 private:
00231     void fitDimensions(int& width, int& height, int& depth) const;
00232 
00233     static const std::string loggerCat_; 
00234 };
00235 
00236 } // namespace voreen
00237 
00238 #endif // VRN_TRANSFUNC_H
  • Getting Started
  • Video Tutorials
  • Build Instructions
  • Adding a Module
  • Programming Tutorials
  • API Documentation
  • FAQ
edit