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