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

pandatool/src/flt/fltLOD.cxx

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

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