00001 //------------------------------------------------------------------------------ 00002 // Lamp : Open source game middleware 00003 // Copyright (C) 2004 Junpei Ohtani ( Email : junpee@users.sourceforge.jp ) 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //------------------------------------------------------------------------------ 00019 00020 /** @file 00021 * 四要素実数カラー実装 00022 * @author Junpee 00023 */ 00024 00025 #include "LampBasic.h" 00026 #include "Core/Primitive/Color4f.h" 00027 #include "Core/Primitive/Color3c.h" 00028 #include "Core/Primitive/Color4c.h" 00029 #include "Core/Primitive/Color3f.h" 00030 00031 namespace Lamp{ 00032 00033 //------------------------------------------------------------------------------ 00034 // 定数 00035 //------------------------------------------------------------------------------ 00036 // 白 00037 const Color4f Color4f::white(1.f, 1.f, 1.f); 00038 00039 // 灰色 00040 const Color4f Color4f::gray(0.5f, 0.5f, 0.5f); 00041 00042 // 黒 00043 const Color4f Color4f::black(0.f, 0.f, 0.f); 00044 00045 // 赤 00046 const Color4f Color4f::red(1.f, 0.f, 0.f); 00047 00048 // 緑 00049 const Color4f Color4f::green(0.f, 1.f, 0.f); 00050 00051 // 青 00052 const Color4f Color4f::blue(0.f, 0.f, 1.f); 00053 00054 // 黄 00055 const Color4f Color4f::yellow(1.f, 1.f, 0.f); 00056 00057 // 青緑 00058 const Color4f Color4f::cyan(0.f, 1.f, 1.f); 00059 00060 // 赤紫 00061 const Color4f Color4f::magenta(1.f, 0.f, 1.f); 00062 00063 //------------------------------------------------------------------------------ 00064 // コンストラクタ 00065 Color4f::Color4f(const Color3c& source) : 00066 r(source.r / 255.f), g(source.g / 255.f), b(source.b / 255.f), a(1.f){ 00067 } 00068 //------------------------------------------------------------------------------ 00069 // コンストラクタ 00070 Color4f::Color4f(const Color4c& source) : 00071 r(source.r / 255.f), g(source.g / 255.f), b(source.b / 255.f), 00072 a(source.a / 255.f){ 00073 } 00074 //------------------------------------------------------------------------------ 00075 // コンストラクタ 00076 Color4f::Color4f(const Color3f& source) : 00077 r(source.r), g(source.g), b(source.b), a(1.f){ 00078 } 00079 //------------------------------------------------------------------------------ 00080 // 三要素キャラクタカラーの設定 00081 void Color4f::set(const Color3c& source){ 00082 set(source.r / 255.f, source.g / 255.f, source.b / 255.f, 1.f); 00083 } 00084 //------------------------------------------------------------------------------ 00085 // 四要素キャラクタカラーの設定 00086 void Color4f::set(const Color4c& source){ 00087 set(source.r / 255.f, source.g / 255.f, source.b / 255.f, source.a / 255.f); 00088 } 00089 //------------------------------------------------------------------------------ 00090 // 三要素実数カラーの設定 00091 void Color4f::set(const Color3f& source){ 00092 set(source.r, source.g, source.b, 1.f); 00093 } 00094 //------------------------------------------------------------------------------ 00095 } // End of namespace Lamp 00096 //------------------------------------------------------------------------------