00001 // Filename: texturePosition.h 00002 // Created by: drose (04Dec00) 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 TEXTUREPOSITION_H 00020 #define TEXTUREPOSITION_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include <typedWritable.h> 00025 #include <luse.h> 00026 #include <eggTexture.h> 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : TexturePosition 00030 // Description : This represents a particular position of a texture 00031 // within a PaletteImage. There is only one of these 00032 // per TexturePlacement, but it exists as a separate 00033 // structure so the TexturePlacement can easily consider 00034 // repositioning the texture. 00035 //////////////////////////////////////////////////////////////////// 00036 class TexturePosition : public TypedWritable { 00037 public: 00038 TexturePosition(); 00039 TexturePosition(const TexturePosition ©); 00040 void operator = (const TexturePosition ©); 00041 00042 int _margin; 00043 int _x, _y; 00044 int _x_size, _y_size; 00045 00046 TexCoordd _min_uv; 00047 TexCoordd _max_uv; 00048 00049 EggTexture::WrapMode _wrap_u; 00050 EggTexture::WrapMode _wrap_v; 00051 00052 // The TypedWritable interface follows. 00053 public: 00054 static void register_with_read_factory(); 00055 virtual void write_datagram(BamWriter *writer, Datagram &datagram); 00056 00057 protected: 00058 static TypedWritable *make_TexturePosition(const FactoryParams ¶ms); 00059 00060 public: 00061 void fillin(DatagramIterator &scan, BamReader *manager); 00062 00063 public: 00064 static TypeHandle get_class_type() { 00065 return _type_handle; 00066 } 00067 static void init_type() { 00068 TypedWritable::init_type(); 00069 register_type(_type_handle, "TexturePosition", 00070 TypedWritable::get_class_type()); 00071 } 00072 virtual TypeHandle get_type() const { 00073 return get_class_type(); 00074 } 00075 00076 private: 00077 static TypeHandle _type_handle; 00078 }; 00079 00080 #endif 00081