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