Panda3D
texturePosition.h
1 // Filename: texturePosition.h
2 // Created by: drose (04Dec00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef TEXTUREPOSITION_H
16 #define TEXTUREPOSITION_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "typedWritable.h"
21 #include "luse.h"
22 #include "eggTexture.h"
23 
24 class FactoryParams;
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : TexturePosition
28 // Description : This represents a particular position of a texture
29 // within a PaletteImage. There is only one of these
30 // per TexturePlacement, but it exists as a separate
31 // structure so the TexturePlacement can easily consider
32 // repositioning the texture.
33 ////////////////////////////////////////////////////////////////////
35 public:
37  TexturePosition(const TexturePosition &copy);
38  void operator = (const TexturePosition &copy);
39 
40  int _margin;
41  int _x, _y;
42  int _x_size, _y_size;
43 
44  LTexCoordd _min_uv;
45  LTexCoordd _max_uv;
46 
47  EggTexture::WrapMode _wrap_u;
48  EggTexture::WrapMode _wrap_v;
49 
50  // The TypedWritable interface follows.
51 public:
52  static void register_with_read_factory();
53  virtual void write_datagram(BamWriter *writer, Datagram &datagram);
54 
55 protected:
56  static TypedWritable *make_TexturePosition(const FactoryParams &params);
57 
58 public:
59  void fillin(DatagramIterator &scan, BamReader *manager);
60 
61 public:
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
66  TypedWritable::init_type();
67  register_type(_type_handle, "TexturePosition",
68  TypedWritable::get_class_type());
69  }
70  virtual TypeHandle get_type() const {
71  return get_class_type();
72  }
73 
74 private:
75  static TypeHandle _type_handle;
76 };
77 
78 #endif
79 
void fillin(DatagramIterator &scan, BamReader *manager)
Reads the binary data from the given datagram iterator, which was written by a previous call to write...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.
This represents a particular position of a texture within a PaletteImage.
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is a two-component point in space.
Definition: lpoint2.h:424
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43