Panda3D
 All Classes Functions Variables Enumerations
destTextureImage.h
1 // Filename: destTextureImage.h
2 // Created by: drose (05Dec00)
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 DESTTEXTUREIMAGE_H
16 #define DESTTEXTUREIMAGE_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "imageFile.h"
21 
22 class TexturePlacement;
23 class TextureImage;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : DestTextureImage
27 // Description : This represents a texture filename as it has been
28 // resized and copied to the map directory (e.g. for an
29 // unplaced texture).
30 ////////////////////////////////////////////////////////////////////
31 class DestTextureImage : public ImageFile {
32 private:
34 
35 public:
37 
38  void copy(TextureImage *texture);
39  void copy_if_stale(const DestTextureImage *other, TextureImage *texture);
40 
41 private:
42  static int to_power_2(int value);
43 
44 
45  // The TypedWritable interface follows.
46 public:
47  static void register_with_read_factory();
48  virtual void write_datagram(BamWriter *writer, Datagram &datagram);
49 
50 protected:
51  static TypedWritable *make_DestTextureImage(const FactoryParams &params);
52  void fillin(DatagramIterator &scan, BamReader *manager);
53 
54 public:
55  static TypeHandle get_class_type() {
56  return _type_handle;
57  }
58  static void init_type() {
59  ImageFile::init_type();
60  register_type(_type_handle, "DestTextureImage",
61  ImageFile::get_class_type());
62  }
63  virtual TypeHandle get_type() const {
64  return get_class_type();
65  }
66 
67 private:
68  static TypeHandle _type_handle;
69 };
70 
71 INLINE ostream &
72 operator << (ostream &out, const DestTextureImage &dest) {
73  dest.output_filename(out);
74  return out;
75 }
76 
77 #endif
78 
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
This represents a texture filename as it has been resized and copied to the map directory (e...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
void output_filename(ostream &out) const
Writes the filename (or pair of filenames) to the indicated output stream.
Definition: imageFile.cxx:483
void copy_if_stale(const DestTextureImage *other, TextureImage *texture)
Copies the source texture into the appropriate filename only if the indicated old reference...
This is the base class of both TextureImage and PaletteImage.
Definition: imageFile.h:36
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
This corresponds to a particular assignment of a TextureImage with a PaletteGroup, and specifically describes which PaletteImage (if any), and where on the PaletteImage, the TextureImage has been assigned to.
void copy(TextureImage *texture)
Unconditionally copies the source texture into the appropriate filename.
A class to retrieve the individual data elements previously stored in a Datagram. ...
This represents a single source texture that is referenced by one or more egg files.
Definition: textureImage.h:51
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
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.