00001 // Filename: destTextureImage.h 00002 // Created by: drose (05Dec00) 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 DESTTEXTUREIMAGE_H 00016 #define DESTTEXTUREIMAGE_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "imageFile.h" 00021 00022 class TexturePlacement; 00023 class TextureImage; 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Class : DestTextureImage 00027 // Description : This represents a texture filename as it has been 00028 // resized and copied to the map directory (e.g. for an 00029 // unplaced texture). 00030 //////////////////////////////////////////////////////////////////// 00031 class DestTextureImage : public ImageFile { 00032 private: 00033 DestTextureImage(); 00034 00035 public: 00036 DestTextureImage(TexturePlacement *placement); 00037 00038 void copy(TextureImage *texture); 00039 void copy_if_stale(const DestTextureImage *other, TextureImage *texture); 00040 00041 private: 00042 static int to_power_2(int value); 00043 00044 00045 // The TypedWritable interface follows. 00046 public: 00047 static void register_with_read_factory(); 00048 virtual void write_datagram(BamWriter *writer, Datagram &datagram); 00049 00050 protected: 00051 static TypedWritable *make_DestTextureImage(const FactoryParams ¶ms); 00052 void fillin(DatagramIterator &scan, BamReader *manager); 00053 00054 public: 00055 static TypeHandle get_class_type() { 00056 return _type_handle; 00057 } 00058 static void init_type() { 00059 ImageFile::init_type(); 00060 register_type(_type_handle, "DestTextureImage", 00061 ImageFile::get_class_type()); 00062 } 00063 virtual TypeHandle get_type() const { 00064 return get_class_type(); 00065 } 00066 00067 private: 00068 static TypeHandle _type_handle; 00069 }; 00070 00071 INLINE ostream & 00072 operator << (ostream &out, const DestTextureImage &dest) { 00073 dest.output_filename(out); 00074 return out; 00075 } 00076 00077 #endif 00078