00001 /* 00002 ** Projet etudiants CPE Lyon 00003 ** Copyright (C) 2012 Damien Rohmer 00004 ** 00005 ** This program is free software: you can redistribute it and/or modify 00006 ** it under the terms of the GNU General Public License as published by 00007 ** the Free Software Foundation, either version 3 of the License, or 00008 ** (at your option) any later version. 00009 ** 00010 ** This program is distributed in the hope that it will be useful, 00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 ** GNU General Public License for more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef TEXTURE_HPP 00020 #define TEXTURE_HPP 00021 00022 #include <iostream> 00023 #include <vector> 00024 00025 00026 namespace cpe 00027 { 00029 class texture 00030 { 00031 public: 00032 00033 // ********************************************* // 00034 // ********************************************* // 00035 // CONSTRUCTORS 00036 // ********************************************* // 00037 // ********************************************* // 00038 00040 texture(); 00041 00042 00043 // ********************************************* // 00044 // ********************************************* // 00045 // Load/Save texture file 00046 // ********************************************* // 00047 // ********************************************* // 00048 00050 void load_picture(const std::string& filename); 00052 void export_ppm(const std::string& filename) const; 00053 00054 // ********************************************* // 00055 // ********************************************* // 00056 // Get parameters 00057 // ********************************************* // 00058 // ********************************************* // 00059 00061 const unsigned int& get_Nx() const; 00063 const unsigned int& get_Ny() const; 00065 const unsigned int& get_depth() const; 00066 00067 00068 // ********************************************* // 00069 // ********************************************* // 00070 // Get data 00071 // ********************************************* // 00072 // ********************************************* // 00073 00075 const std::vector<unsigned char>& get_data() const; 00076 00077 private: 00078 00080 void load_ppm_picture(const std::string& filename); 00081 00083 unsigned int N_x; 00085 unsigned int N_y; 00087 unsigned int depth; 00088 00090 std::vector<unsigned char> picture; 00091 00092 }; 00093 } 00094 00095 #endif