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