00001 // Filename: fltFace.cxx00002 // Created by: drose (25Aug00)00003 //00004 ////////////////////////////////////////////////////////////////////00005 //00006 // PANDA 3D SOFTWARE00007 // Copyright (c) Carnegie Mellon University. All rights reserved.00008 //00009 // All use of this software is subject to the terms of the revised BSD00010 // license. You should have received a copy of this license along00011 // 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::Constructor00025 // Access: Public00026 // Description:00027 ////////////////////////////////////////////////////////////////////00028 FltFace::
00029 FltFace(FltHeader *header) : FltGeometry(header) {
00030 }
00031
00032 ////////////////////////////////////////////////////////////////////00033 // Function: FltFace::extract_record00034 // Access: Protected, Virtual00035 // Description: Fills in the information in this bead based on the00036 // information given in the indicated datagram, whose00037 // opcode has already been read. Returns true on00038 // success, false if the datagram is invalid.00039 ////////////////////////////////////////////////////////////////////00040 boolFltFace::00041extract_record(FltRecordReader &reader) {
00042 if (!FltBeadID::extract_record(reader)) {
00043 returnfalse;
00044 }
00045 if (!FltGeometry::extract_record(reader)) {
00046 returnfalse;
00047 }
00048
00049 nassertr(reader.get_opcode() == FO_face, false);
00050
00051 DatagramIterator &iterator = reader.get_iterator();
00052 check_remaining_size(iterator);
00053 returntrue;
00054 }
00055
00056 ////////////////////////////////////////////////////////////////////00057 // Function: FltFace::build_record00058 // Access: Protected, Virtual00059 // Description: Fills up the current record on the FltRecordWriter with00060 // data for this record, but does not advance the00061 // writer. Returns true on success, false if there is00062 // some error.00063 ////////////////////////////////////////////////////////////////////00064 boolFltFace::00065build_record(FltRecordWriter &writer) const {
00066 if (!FltBeadID::build_record(writer)) {
00067 returnfalse;
00068 }
00069 if (!FltGeometry::build_record(writer)) {
00070 returnfalse;
00071 }
00072
00073 writer.set_opcode(FO_face);
00074
00075 returntrue;
00076 }