Panda3D
destTextureImage.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 destTextureImage.h
10  * @author drose
11  * @date 2000-12-05
12  */
13 
14 #ifndef DESTTEXTUREIMAGE_H
15 #define DESTTEXTUREIMAGE_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "imageFile.h"
20 
21 class TexturePlacement;
22 class TextureImage;
23 
24 /**
25  * This represents a texture filename as it has been resized and copied to the
26  * map directory (e.g. for an unplaced texture).
27  */
28 class DestTextureImage : public ImageFile {
29 private:
31 
32 public:
34 
35  void copy(TextureImage *texture);
36  void copy_if_stale(const DestTextureImage *other, TextureImage *texture);
37 
38 private:
39  static int to_power_2(int value);
40 
41 
42  // The TypedWritable interface follows.
43 public:
44  static void register_with_read_factory();
45  virtual void write_datagram(BamWriter *writer, Datagram &datagram);
46 
47 protected:
48  static TypedWritable *make_DestTextureImage(const FactoryParams &params);
49  void fillin(DatagramIterator &scan, BamReader *manager);
50 
51 public:
52  static TypeHandle get_class_type() {
53  return _type_handle;
54  }
55  static void init_type() {
56  ImageFile::init_type();
57  register_type(_type_handle, "DestTextureImage",
58  ImageFile::get_class_type());
59  }
60  virtual TypeHandle get_type() const {
61  return get_class_type();
62  }
63 
64 private:
65  static TypeHandle _type_handle;
66 };
67 
68 INLINE std::ostream &
69 operator << (std::ostream &out, const DestTextureImage &dest) {
70  dest.output_filename(out);
71  return out;
72 }
73 
74 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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....
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
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
void output_filename(std::ostream &out) const
Writes the filename (or pair of filenames) to the indicated output stream.
Definition: imageFile.cxx:424
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
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:33
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
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:46
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
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...