00001 // Filename: fltPackedColor.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 "fltPackedColor.h" 00020 #include "fltRecordReader.h" 00021 #include "fltRecordWriter.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: FltPackedColor::output 00025 // Access: Public 00026 // Description: 00027 //////////////////////////////////////////////////////////////////// 00028 void FltPackedColor:: 00029 output(ostream &out) const { 00030 out << "(" << _r << " " << _g << " " << _b << " " << _a << ")"; 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: FltPackedColor::extract_record 00035 // Access: Public 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 bool FltPackedColor:: 00039 extract_record(FltRecordReader &reader) { 00040 DatagramIterator &iterator = reader.get_iterator(); 00041 00042 _a = iterator.get_uint8(); 00043 _b = iterator.get_uint8(); 00044 _g = iterator.get_uint8(); 00045 _r = iterator.get_uint8(); 00046 00047 return true; 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: FltPackedColor::build_record 00052 // Access: Public 00053 // Description: 00054 //////////////////////////////////////////////////////////////////// 00055 bool FltPackedColor:: 00056 build_record(FltRecordWriter &writer) const { 00057 Datagram &datagram = writer.update_datagram(); 00058 00059 datagram.add_uint8(_a); 00060 datagram.add_uint8(_b); 00061 datagram.add_uint8(_g); 00062 datagram.add_uint8(_r); 00063 00064 return true; 00065 }