Panda3D
 All Classes Functions Variables Enumerations
geomTextGlyph.h
1 // Filename: geomTextGlyph.h
2 // Created by: drose (31Mar05)
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 GEOMTEXTGLYPH_H
16 #define GEOMTEXTGLYPH_H
17 
18 #include "pandabase.h"
19 #include "geom.h"
20 
21 #ifdef HAVE_FREETYPE
22 
23 #include "dynamicTextGlyph.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : GeomTextGlyph
27 // Description : This is a specialization on Geom for containing a
28 // primitive intended to represent a DynamicTextGlyph.
29 // Its sole purpose is to maintain the geom count on the
30 // glyph, so we can determine the actual usage count on
31 // a dynamic glyph (and thus know when it is safe to
32 // recycle the glyph).
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_TEXT GeomTextGlyph : public Geom {
35 public:
36  GeomTextGlyph(DynamicTextGlyph *glyph,
37  const GeomVertexData *data);
38  GeomTextGlyph(const GeomVertexData *data);
39  GeomTextGlyph(const GeomTextGlyph &copy);
40  void operator = (const GeomTextGlyph &copy);
41  virtual ~GeomTextGlyph();
42  ALLOC_DELETED_CHAIN(GeomTextGlyph);
43 
44  virtual Geom *make_copy() const;
45  virtual bool copy_primitives_from(const Geom *other);
46  void count_geom(const Geom *other);
47 
48  virtual void output(ostream &out) const;
49  virtual void write(ostream &out, int indent_level = 0) const;
50 
51 private:
52  typedef pvector< PT(DynamicTextGlyph) > Glyphs;
53  Glyphs _glyphs;
54 
55 public:
56  static void register_with_read_factory();
57  static TypedWritable *make_GeomTextGlyph(const FactoryParams &params);
58 
59 PUBLISHED:
60  static TypeHandle get_class_type() {
61  return _type_handle;
62  }
63 public:
64  static void init_type() {
65  Geom::init_type();
66  register_type(_type_handle, "GeomTextGlyph",
67  Geom::get_class_type());
68  }
69  virtual TypeHandle get_type() const {
70  return get_class_type();
71  }
72  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
73 
74 private:
75  static TypeHandle _type_handle;
76 };
77 
78 #include "geomTextGlyph.I"
79 
80 #else // HAVE_FREETYPE
81 
82 // Without Freetype, a GeomTextGlyph is really just an ordinary Geom.
83 typedef Geom GeomTextGlyph;
84 
85 #endif // HAVE_FREETYPE
86 
87 #endif // GEOMTEXTGLYPH_H
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
Definition: geom.h:58
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
virtual Geom * make_copy() const
Returns a newly-allocated Geom that is a shallow copy of this one.
Definition: geom.cxx:118
virtual bool copy_primitives_from(const Geom *other)
Copies the primitives from the indicated Geom into this one.
Definition: geom.cxx:882
void operator=(const Geom &copy)
The copy assignment operator is not pipeline-safe.
Definition: geom.cxx:84
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
Definition: geom.cxx:1671
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85