Panda3D
|
00001 // Filename: sourceTextureImage.h 00002 // Created by: drose (28Nov00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef SOURCETEXTUREIMAGE_H 00016 #define SOURCETEXTUREIMAGE_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "imageFile.h" 00021 00022 class TextureImage; 00023 class PNMImageHeader; 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : SourceTextureImage 00027 // Description : This is a texture image reference as it appears in an 00028 // egg file: the source image of the texture. 00029 //////////////////////////////////////////////////////////////////// 00030 class SourceTextureImage : public ImageFile { 00031 private: 00032 SourceTextureImage(); 00033 00034 public: 00035 SourceTextureImage(TextureImage *texture, const Filename &filename, 00036 const Filename &alpha_filename, int alpha_file_channel); 00037 00038 TextureImage *get_texture() const; 00039 00040 void increment_egg_count(); 00041 int get_egg_count() const; 00042 00043 bool get_size(); 00044 bool read_header(); 00045 void set_header(const PNMImageHeader &header); 00046 00047 private: 00048 TextureImage *_texture; 00049 int _egg_count; 00050 bool _read_header; 00051 bool _successfully_read_header; 00052 00053 // The TypedWritable interface follows. 00054 public: 00055 static void register_with_read_factory(); 00056 virtual void write_datagram(BamWriter *writer, Datagram &datagram); 00057 virtual int complete_pointers(TypedWritable **p_list, 00058 BamReader *manager); 00059 00060 protected: 00061 static TypedWritable *make_SourceTextureImage(const FactoryParams ¶ms); 00062 void fillin(DatagramIterator &scan, BamReader *manager); 00063 00064 public: 00065 static TypeHandle get_class_type() { 00066 return _type_handle; 00067 } 00068 static void init_type() { 00069 ImageFile::init_type(); 00070 register_type(_type_handle, "SourceTextureImage", 00071 ImageFile::get_class_type()); 00072 } 00073 virtual TypeHandle get_type() const { 00074 return get_class_type(); 00075 } 00076 00077 private: 00078 static TypeHandle _type_handle; 00079 }; 00080 00081 INLINE ostream & 00082 operator << (ostream &out, const SourceTextureImage &source) { 00083 source.output_filename(out); 00084 return out; 00085 } 00086 00087 #endif 00088