Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/char/dynamicVertices.cxx

Go to the documentation of this file.
00001 // Filename: dynamicVertices.cxx
00002 // Created by:  drose (01Mar99)
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 "dynamicVertices.h"
00020 #include "config_char.h"
00021 #include <bamReader.h>
00022 #include <bamWriter.h>
00023 #include <datagram.h>
00024 #include <datagramIterator.h>
00025 #include <ioPtaDatagramLinMath.h>
00026 
00027 TypeHandle DynamicVertices::_type_handle;
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: DynamicVertices::Constructor
00031 //       Access: Public
00032 //  Description:
00033 ////////////////////////////////////////////////////////////////////
00034 DynamicVertices::
00035 DynamicVertices() {
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: DynamicVertices::Copy Constructor
00040 //       Access: Public
00041 //  Description: Makes a copy of the DynamicVertices object by
00042 //               reference: the new copy shares the same pointers as
00043 //               the original.
00044 ////////////////////////////////////////////////////////////////////
00045 DynamicVertices::
00046 DynamicVertices(const DynamicVertices &copy) :
00047   _coords(copy._coords),
00048   _norms(copy._norms),
00049   _colors(copy._colors),
00050   _texcoords(copy._texcoords)
00051 {
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function: DynamicVertices::named deep_copy Constructor
00056 //       Access: Public
00057 //  Description: Makes a complete copy of the indicated
00058 //               DynamicVertices object, including copying all of its
00059 //               arrays.
00060 ////////////////////////////////////////////////////////////////////
00061 DynamicVertices DynamicVertices::
00062 deep_copy(const DynamicVertices &copy) {
00063   DynamicVertices dv;
00064   if (!copy._coords.empty()) {
00065     dv._coords = PTA_Vertexf::empty_array(0);
00066     dv._coords.v() = copy._coords.v();
00067   }
00068   if (!copy._norms.empty()) {
00069     dv._norms = PTA_Normalf::empty_array(0);
00070     dv._norms.v() = copy._norms.v();
00071   }
00072   if (!copy._colors.empty()) {
00073     dv._colors = PTA_Colorf::empty_array(0);
00074     dv._colors.v() = copy._colors.v();
00075   }
00076   if (!copy._texcoords.empty()) {
00077     dv._texcoords = PTA_TexCoordf::empty_array(0);
00078     dv._texcoords.v() = copy._texcoords.v();
00079   }
00080   return dv;
00081 }
00082 
00083 ////////////////////////////////////////////////////////////////////
00084 //     Function: DynamicVertices::write_datagram
00085 //       Access: Public
00086 //  Description: Function to write the important information in
00087 //               the particular object to a Datagram
00088 ////////////////////////////////////////////////////////////////////
00089 void DynamicVertices::
00090 write_datagram(BamWriter *manager, Datagram &me)
00091 {
00092   WRITE_PTA(manager, me, IPD_Vertexf::write_datagram, _coords)
00093   WRITE_PTA(manager, me, IPD_Normalf::write_datagram, _norms)
00094   WRITE_PTA(manager, me, IPD_Colorf::write_datagram, _colors)
00095   WRITE_PTA(manager, me, IPD_TexCoordf::write_datagram, _texcoords)
00096 }
00097 
00098 ////////////////////////////////////////////////////////////////////
00099 //     Function: DynamicVertices::fillin
00100 //       Access: Public
00101 //  Description: Function that reads out of the datagram (or asks
00102 //               manager to read) all of the data that is needed to
00103 //               re-create this object and stores it in the appropiate
00104 //               place
00105 ////////////////////////////////////////////////////////////////////
00106 void DynamicVertices::
00107 fillin(DatagramIterator& scan, BamReader* manager)
00108 {
00109   READ_PTA(manager, scan, IPD_Vertexf::read_datagram, _coords)
00110   READ_PTA(manager, scan, IPD_Normalf::read_datagram, _norms)
00111   READ_PTA(manager, scan, IPD_Colorf::read_datagram, _colors)
00112   READ_PTA(manager, scan, IPD_TexCoordf::read_datagram, _texcoords)
00113 }

Generated on Fri May 2 00:35:27 2003 for Panda by doxygen1.3