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

pandatool/src/flt/fltObject.cxx

Go to the documentation of this file.
00001 // Filename: fltObject.cxx
00002 // Created by:  drose (24Aug00)
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 "fltObject.h"
00020 #include "fltRecordReader.h"
00021 #include "fltRecordWriter.h"
00022 
00023 TypeHandle FltObject::_type_handle;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: FltObject::Constructor
00027 //       Access: Public
00028 //  Description:
00029 ////////////////////////////////////////////////////////////////////
00030 FltObject::
00031 FltObject(FltHeader *header) : FltBeadID(header) {
00032 }
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //     Function: FltObject::extract_record
00036 //       Access: Protected, Virtual
00037 //  Description: Fills in the information in this bead based on the
00038 //               information given in the indicated datagram, whose
00039 //               opcode has already been read.  Returns true on
00040 //               success, false if the datagram is invalid.
00041 ////////////////////////////////////////////////////////////////////
00042 bool FltObject::
00043 extract_record(FltRecordReader &reader) {
00044   if (!FltBeadID::extract_record(reader)) {
00045     return false;
00046   }
00047 
00048   nassertr(reader.get_opcode() == FO_object, false);
00049   DatagramIterator &iterator = reader.get_iterator();
00050 
00051   _flags = iterator.get_be_uint32();
00052   _relative_priority = iterator.get_be_int16();
00053   _transparency = iterator.get_be_int16();
00054   _special_id1 = iterator.get_be_int16();
00055   _special_id2 = iterator.get_be_int16();
00056   _significance = iterator.get_be_int16();
00057   iterator.skip_bytes(2);
00058 
00059   check_remaining_size(iterator);
00060   return true;
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: FltObject::build_record
00065 //       Access: Protected, Virtual
00066 //  Description: Fills up the current record on the FltRecordWriter with
00067 //               data for this record, but does not advance the
00068 //               writer.  Returns true on success, false if there is
00069 //               some error.
00070 ////////////////////////////////////////////////////////////////////
00071 bool FltObject::
00072 build_record(FltRecordWriter &writer) const {
00073   if (!FltBeadID::build_record(writer)) {
00074     return false;
00075   }
00076 
00077   writer.set_opcode(FO_object);
00078   Datagram &datagram = writer.update_datagram();
00079 
00080   datagram.add_be_uint32(_flags);
00081   datagram.add_be_int16(_relative_priority);
00082   datagram.add_be_int16(_transparency);
00083   datagram.add_be_int16(_special_id1);
00084   datagram.add_be_int16(_special_id2);
00085   datagram.add_be_int16(_significance);
00086   datagram.pad_bytes(2);
00087 
00088   return true;
00089 }

Generated on Fri May 2 03:19:27 2003 for Panda-Tool by doxygen1.3