Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/flt/fltPackedColor.I

Go to the documentation of this file.
00001 // Filename: fltPackedColor.I
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 INLINE ostream &
00020 operator << (ostream &out, const FltPackedColor &color) {
00021   color.output(out);
00022   return out;
00023 }
00024 
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //     Function: FltPackedColor::Constructor
00028 //       Access: Public
00029 //  Description:
00030 ////////////////////////////////////////////////////////////////////
00031 INLINE FltPackedColor::
00032 FltPackedColor() {
00033   _a = 0;
00034   _b = 0;
00035   _g = 0;
00036   _r = 0;
00037 }
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //     Function: FltPackedColor::get_color
00041 //       Access: Public
00042 //  Description: Returns the four-component color as a Colorf, where
00043 //               each component is in the range [0, 1].
00044 ////////////////////////////////////////////////////////////////////
00045 INLINE Colorf FltPackedColor::
00046 get_color() const {
00047   return Colorf(_r / 255.0, _g / 255.0, _b / 255.0, _a / 255.0);
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: FltPackedColor::get_rgb
00052 //       Access: Public
00053 //  Description: Returns the three-component color as an RGBColorf
00054 //               (ignoring the alpha component), where each component
00055 //               is in the range [0, 1].
00056 ////////////////////////////////////////////////////////////////////
00057 INLINE RGBColorf FltPackedColor::
00058 get_rgb() const {
00059   return RGBColorf(_r / 255.0, _g / 255.0, _b / 255.0);
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: FltPackedColor::set_color
00064 //       Access: Public
00065 //  Description: Sets the color according to the indicated
00066 //               four-component Colorf value (including alpha).
00067 ////////////////////////////////////////////////////////////////////
00068 INLINE void FltPackedColor::
00069 set_color(const Colorf &color) {
00070   _r = (int)floor(color[0] * 255.0);
00071   _g = (int)floor(color[0] * 255.0);
00072   _b = (int)floor(color[0] * 255.0);
00073   _a = (int)floor(color[0] * 255.0);
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: FltPackedColor::set_rgb
00078 //       Access: Public
00079 //  Description: Sets the color according to the indicated
00080 //               three-component RGBColorf value, and set the alpha to
00081 //               1.0.
00082 ////////////////////////////////////////////////////////////////////
00083 INLINE void FltPackedColor::
00084 set_rgb(const RGBColorf &color) {
00085   _r = (int)floor(color[0] * 255.0);
00086   _g = (int)floor(color[0] * 255.0);
00087   _b = (int)floor(color[0] * 255.0);
00088   _a = 255;
00089 }

Generated on Fri May 2 03:19:29 2003 for Panda-Tool by doxygen1.3