00001 // Filename: geomTextGlyph.cxx 00002 // Created by: drose (11Feb02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "geomTextGlyph.h" 00020 00021 #ifdef HAVE_FREETYPE 00022 00023 #include "datagramIterator.h" 00024 #include "bamReader.h" 00025 00026 TypeHandle GeomTextGlyph::_type_handle; 00027 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: GeomTextGlyph::Copy Assignment Operator 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 void GeomTextGlyph:: 00035 operator = (const GeomTextGlyph ©) { 00036 GeomTristrip::operator = (copy); 00037 if (_glyph != copy._glyph) { 00038 if (_glyph != (DynamicTextGlyph *)NULL) { 00039 _glyph->_geom_count--; 00040 } 00041 _glyph = copy._glyph; 00042 if (_glyph != (DynamicTextGlyph *)NULL) { 00043 _glyph->_geom_count++; 00044 } 00045 } 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: GeomTextGlyph::Destructor 00050 // Access: Public, Virtual 00051 // Description: 00052 //////////////////////////////////////////////////////////////////// 00053 GeomTextGlyph:: 00054 ~GeomTextGlyph() { 00055 if (_glyph != (DynamicTextGlyph *)NULL) { 00056 _glyph->_geom_count--; 00057 } 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: GeomTextGlyph::make_copy 00062 // Access: Public, Virtual 00063 // Description: Returns a newly-allocated Geom that is a shallow copy 00064 // of this one. It will be a different Geom pointer, 00065 // but its internal data may or may not be shared with 00066 // that of the original Geom. 00067 //////////////////////////////////////////////////////////////////// 00068 Geom *GeomTextGlyph:: 00069 make_copy() const { 00070 return new GeomTextGlyph(*this); 00071 } 00072 00073 //////////////////////////////////////////////////////////////////// 00074 // Function: GeomTextGlyph::register_with_factory 00075 // Access: Public, Static 00076 // Description: Factory method to generate a GeomTextGlyph object 00077 //////////////////////////////////////////////////////////////////// 00078 void GeomTextGlyph:: 00079 register_with_read_factory() { 00080 BamReader::get_factory()->register_factory(get_class_type(), make_GeomTextGlyph); 00081 } 00082 00083 //////////////////////////////////////////////////////////////////// 00084 // Function: GeomTextGlyph::make_GeomTextGlyph 00085 // Access: Public 00086 // Description: Factory method to generate a GeomTextGlyph object 00087 //////////////////////////////////////////////////////////////////// 00088 TypedWritable* GeomTextGlyph:: 00089 make_GeomTextGlyph(const FactoryParams ¶ms) { 00090 GeomTextGlyph *me = new GeomTextGlyph((DynamicTextGlyph *)NULL); 00091 DatagramIterator scan; 00092 BamReader *manager; 00093 00094 parse_params(params, scan, manager); 00095 me->fillin(scan, manager); 00096 me->make_dirty(); 00097 me->config(); 00098 return me; 00099 } 00100 00101 #endif // HAVE_FREETYPE