00001 // Filename: fltFace.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 "fltFace.h" 00020 #include "fltRecordReader.h" 00021 #include "fltRecordWriter.h" 00022 #include "fltHeader.h" 00023 #include "fltMaterial.h" 00024 00025 TypeHandle FltFace::_type_handle; 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: FltFace::Constructor 00029 // Access: Public 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 FltFace:: 00033 FltFace(FltHeader *header) : FltGeometry(header) { 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: FltFace::extract_record 00038 // Access: Protected, Virtual 00039 // Description: Fills in the information in this bead based on the 00040 // information given in the indicated datagram, whose 00041 // opcode has already been read. Returns true on 00042 // success, false if the datagram is invalid. 00043 //////////////////////////////////////////////////////////////////// 00044 bool FltFace:: 00045 extract_record(FltRecordReader &reader) { 00046 if (!FltBeadID::extract_record(reader)) { 00047 return false; 00048 } 00049 if (!FltGeometry::extract_record(reader)) { 00050 return false; 00051 } 00052 00053 nassertr(reader.get_opcode() == FO_face, false); 00054 00055 DatagramIterator &iterator = reader.get_iterator(); 00056 check_remaining_size(iterator); 00057 return true; 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: FltFace::build_record 00062 // Access: Protected, Virtual 00063 // Description: Fills up the current record on the FltRecordWriter with 00064 // data for this record, but does not advance the 00065 // writer. Returns true on success, false if there is 00066 // some error. 00067 //////////////////////////////////////////////////////////////////// 00068 bool FltFace:: 00069 build_record(FltRecordWriter &writer) const { 00070 if (!FltBeadID::build_record(writer)) { 00071 return false; 00072 } 00073 if (!FltGeometry::build_record(writer)) { 00074 return false; 00075 } 00076 00077 writer.set_opcode(FO_face); 00078 00079 return true; 00080 }