00001 // Filename: geomLinestrip.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 "config_gobj.h" 00029 #include "geomLinestrip.h" 00030 00031 TypeHandle GeomLinestrip::_type_handle; 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: GeomLinestrip::make_copy 00035 // Access: Public, Virtual 00036 // Description: Returns a newly-allocated Geom that is a shallow copy 00037 // of this one. It will be a different Geom pointer, 00038 // but its internal data may or may not be shared with 00039 // that of the original Geom. 00040 //////////////////////////////////////////////////////////////////// 00041 Geom *GeomLinestrip:: 00042 make_copy() const { 00043 return new GeomLinestrip(*this); 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: GeomLinestrip::draw_immediate 00048 // Access: 00049 // Description: 00050 //////////////////////////////////////////////////////////////////// 00051 void GeomLinestrip:: 00052 draw_immediate(GraphicsStateGuardianBase *gsg, GeomContext *gc) { 00053 gsg->draw_linestrip(this, gc); 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: GeomLinestrip::explode 00058 // Access: 00059 // Description: 00060 //////////////////////////////////////////////////////////////////// 00061 Geom *GeomLinestrip:: 00062 explode() const { 00063 gobj_cat.error() 00064 << "GeomLinestrip::explode() - not implemented yet!!!" << endl; 00065 return new GeomLinestrip(*this); 00066 } 00067 00068 //////////////////////////////////////////////////////////////////// 00069 // Function: GeomLinestrip::write_datagram 00070 // Access: Public 00071 // Description: Function to write the important information in 00072 // the particular object to a Datagram 00073 //////////////////////////////////////////////////////////////////// 00074 void GeomLinestrip:: 00075 write_datagram(BamWriter *manager, Datagram &me) { 00076 Geom::write_datagram(manager, me); 00077 // Changed from uint32 to float32 on 1/16/02; didn't bother to 00078 // update the bam version on the assumption that no actual bam files 00079 // contain GeomLinestrip objects. 00080 me.add_float32(_width); 00081 } 00082 00083 //////////////////////////////////////////////////////////////////// 00084 // Function: GeomLinestrip::make_GeomLinestrip 00085 // Access: Protected 00086 // Description: Factory method to generate a GeomLinestrip object 00087 //////////////////////////////////////////////////////////////////// 00088 TypedWritable* GeomLinestrip:: 00089 make_GeomLinestrip(const FactoryParams ¶ms) { 00090 GeomLinestrip *me = new GeomLinestrip; 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 //////////////////////////////////////////////////////////////////// 00102 // Function: GeomLinestrip::fillin 00103 // Access: Protected 00104 // Description: Function that reads out of the datagram (or asks 00105 // manager to read) all of the data that is needed to 00106 // re-create this object and stores it in the appropiate 00107 // place 00108 //////////////////////////////////////////////////////////////////// 00109 void GeomLinestrip:: 00110 fillin(DatagramIterator& scan, BamReader* manager) { 00111 Geom::fillin(scan, manager); 00112 _width = scan.get_float32(); 00113 } 00114 00115 //////////////////////////////////////////////////////////////////// 00116 // Function: GeomLinestrip::register_with_factory 00117 // Access: Public, Static 00118 // Description: Factory method to generate a GeomLinestrip object 00119 //////////////////////////////////////////////////////////////////// 00120 void GeomLinestrip:: 00121 register_with_read_factory(void) { 00122 BamReader::get_factory()->register_factory(get_class_type(), make_GeomLinestrip); 00123 }