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