00001 // Filename: geomPoint.cxx 00002 // Created by: charles (13Jul00) 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 <datagram.h> 00020 #include <datagramIterator.h> 00021 #include <bamReader.h> 00022 #include <bamWriter.h> 00023 #include <ioPtaDatagramShort.h> 00024 #include <ioPtaDatagramInt.h> 00025 #include <ioPtaDatagramLinMath.h> 00026 #include <graphicsStateGuardianBase.h> 00027 00028 #include "geomPoint.h" 00029 00030 TypeHandle GeomPoint::_type_handle; 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: GeomPoint::make_copy 00034 // Access: Public, Virtual 00035 // Description: Returns a newly-allocated Geom that is a shallow copy 00036 // of this one. It will be a different Geom pointer, 00037 // but its internal data may or may not be shared with 00038 // that of the original Geom. 00039 //////////////////////////////////////////////////////////////////// 00040 Geom *GeomPoint:: 00041 make_copy() const { 00042 return new GeomPoint(*this); 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: GeomPoint::print_draw_immediate 00047 // Access: 00048 // Description: 00049 //////////////////////////////////////////////////////////////////// 00050 void GeomPoint:: 00051 print_draw_immediate(void) const { 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: GeomPoint::draw_immediate 00056 // Access: 00057 // Description: 00058 //////////////////////////////////////////////////////////////////// 00059 void GeomPoint:: 00060 draw_immediate(GraphicsStateGuardianBase *gsg, GeomContext *gc) { 00061 gsg->draw_point(this, gc); 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: GeomPoint::write_datagram 00066 // Access: Public 00067 // Description: Function to write the important information in 00068 // the particular object to a Datagram 00069 //////////////////////////////////////////////////////////////////// 00070 void GeomPoint:: 00071 write_datagram(BamWriter *manager, Datagram &me) { 00072 Geom::write_datagram(manager, me); 00073 // Changed from uint32 to float32 on 1/16/02; didn't bother to 00074 // update the bam version on the assumption that no actual bam files 00075 // contain GeomPoint objects. 00076 me.add_float32(_size); 00077 } 00078 00079 //////////////////////////////////////////////////////////////////// 00080 // Function: GeomPoint::make_GeomPoint 00081 // Access: Protected 00082 // Description: Factory method to generate a GeomPoint object 00083 //////////////////////////////////////////////////////////////////// 00084 TypedWritable* GeomPoint:: 00085 make_GeomPoint(const FactoryParams ¶ms) { 00086 GeomPoint *me = new GeomPoint; 00087 DatagramIterator scan; 00088 BamReader *manager; 00089 00090 parse_params(params, scan, manager); 00091 me->fillin(scan, manager); 00092 me->make_dirty(); 00093 me->config(); 00094 return me; 00095 } 00096 00097 //////////////////////////////////////////////////////////////////// 00098 // Function: GeomPoint::fillin 00099 // Access: Protected 00100 // Description: Function that reads out of the datagram (or asks 00101 // manager to read) all of the data that is needed to 00102 // re-create this object and stores it in the appropiate 00103 // place 00104 //////////////////////////////////////////////////////////////////// 00105 void GeomPoint:: 00106 fillin(DatagramIterator& scan, BamReader* manager) { 00107 Geom::fillin(scan, manager); 00108 _size = scan.get_float32(); 00109 } 00110 00111 //////////////////////////////////////////////////////////////////// 00112 // Function: GeomPoint::register_with_factory 00113 // Access: Public, Static 00114 // Description: Factory method to generate a GeomPoint object 00115 //////////////////////////////////////////////////////////////////// 00116 void GeomPoint:: 00117 register_with_read_factory(void) { 00118 BamReader::get_factory()->register_factory(get_class_type(), make_GeomPoint); 00119 }