00001 // Vamos Automotive Simulator 00002 // Copyright (C) 2001--2003 Sam Varner 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 #ifndef _TEXTURE_IMAGE_H_ 00019 #define _TEXTURE_IMAGE_H_ 00020 00021 #include <string> 00022 #include <fstream> 00023 #include <iostream> 00024 00025 #include <stdio.h> 00026 00027 namespace Vamos_Geometry 00028 { 00029 // Exception class for texture files that can't be found. 00030 class Missing_Texture_File 00031 { 00032 std::string m_file; 00033 public: 00034 Missing_Texture_File (std::string file) : m_file (file) {}; 00035 std::string message () const { return m_file; } 00036 }; 00037 00038 class Texture_Image 00039 { 00040 // unsigned char* m_data; 00041 protected: 00042 int m_data_size; 00043 int m_width_pixels; 00044 int m_height_pixels; 00045 double m_width; 00046 double m_height; 00047 int m_channels; 00048 00049 public: 00050 Texture_Image (std::string file_name, 00051 double width = 1.0, 00052 double height = 1.0); 00053 Texture_Image (const Texture_Image& image); 00054 //virtual ~Texture_Image (); 00055 00056 const Texture_Image& operator = (const Texture_Image& image); 00057 //const unsigned char* data () const { return m_data; } 00058 int width_pixels () const { return m_width_pixels; } 00059 int height_pixels () const { return m_height_pixels; } 00060 double aspect_ratio () const 00061 { return double (m_width_pixels) / m_height_pixels; } 00062 00063 void set_width (double width) { m_width = width; } 00064 void set_height (double height) { m_height = height; } 00065 00066 double height () const { return m_height; } 00067 double width () const { return m_width; } 00068 int channels () const { return m_channels; } 00069 }; 00070 00071 00072 } 00073 00074 #endif
1.4.6