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