Panda3D
 All Classes Functions Variables Enumerations
fltFace.cxx
00001 // Filename: fltFace.cxx
00002 // Created by:  drose (25Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "fltFace.h"
00016 #include "fltRecordReader.h"
00017 #include "fltRecordWriter.h"
00018 #include "fltHeader.h"
00019 #include "fltMaterial.h"
00020 
00021 TypeHandle FltFace::_type_handle;
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //     Function: FltFace::Constructor
00025 //       Access: Public
00026 //  Description:
00027 ////////////////////////////////////////////////////////////////////
00028 FltFace::
00029 FltFace(FltHeader *header) : FltGeometry(header) {
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: FltFace::extract_record
00034 //       Access: Protected, Virtual
00035 //  Description: Fills in the information in this bead based on the
00036 //               information given in the indicated datagram, whose
00037 //               opcode has already been read.  Returns true on
00038 //               success, false if the datagram is invalid.
00039 ////////////////////////////////////////////////////////////////////
00040 bool FltFace::
00041 extract_record(FltRecordReader &reader) {
00042   if (!FltBeadID::extract_record(reader)) {
00043     return false;
00044   }
00045   if (!FltGeometry::extract_record(reader)) {
00046     return false;
00047   }
00048 
00049   nassertr(reader.get_opcode() == FO_face, false);
00050 
00051   DatagramIterator &iterator = reader.get_iterator();
00052   check_remaining_size(iterator);
00053   return true;
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: FltFace::build_record
00058 //       Access: Protected, Virtual
00059 //  Description: Fills up the current record on the FltRecordWriter with
00060 //               data for this record, but does not advance the
00061 //               writer.  Returns true on success, false if there is
00062 //               some error.
00063 ////////////////////////////////////////////////////////////////////
00064 bool FltFace::
00065 build_record(FltRecordWriter &writer) const {
00066   if (!FltBeadID::build_record(writer)) {
00067     return false;
00068   }
00069   if (!FltGeometry::build_record(writer)) {
00070     return false;
00071   }
00072 
00073   writer.set_opcode(FO_face);
00074 
00075   return true;
00076 }
 All Classes Functions Variables Enumerations