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/Color3f.h" 00027 #include "Core/Primitive/Color3c.h" 00028 #include "Core/Primitive/Color4c.h" 00029 #include "Core/Primitive/Color4f.h" 00030 00031 namespace Lamp{ 00032 00033 //------------------------------------------------------------------------------ 00034 // 定数 00035 //------------------------------------------------------------------------------ 00036 // 白 00037 const Color3f Color3f::white(1.f, 1.f, 1.f); 00038 00039 // 灰色 00040 const Color3f Color3f::gray(0.5f, 0.5f, 0.5f); 00041 00042 // 黒 00043 const Color3f Color3f::black(0.f, 0.f, 0.f); 00044 00045 // 赤 00046 const Color3f Color3f::red(1.f, 0.f, 0.f); 00047 00048 // 緑 00049 const Color3f Color3f::green(0.f, 1.f, 0.f); 00050 00051 // 青 00052 const Color3f Color3f::blue(0.f, 0.f, 1.f); 00053 00054 // 黄 00055 const Color3f Color3f::yellow(1.f, 1.f, 0.f); 00056 00057 // 青緑 00058 const Color3f Color3f::cyan(0.f, 1.f, 1.f); 00059 00060 // 赤紫 00061 const Color3f Color3f::magenta(1.f, 0.f, 1.f); 00062 00063 //------------------------------------------------------------------------------ 00064 // コンストラクタ 00065 Color3f::Color3f(const Color3c& source) : 00066 r(source.r / 255.f), g(source.g / 255.f), b(source.b / 255.f){ 00067 } 00068 //------------------------------------------------------------------------------ 00069 // コンストラクタ 00070 Color3f::Color3f(const Color4c& source) : 00071 r(source.r / 255.f), g(source.g / 255.f), b(source.b / 255.f){ 00072 } 00073 //------------------------------------------------------------------------------ 00074 // コンストラクタ 00075 Color3f::Color3f(const Color4f& source) : 00076 r(source.r), g(source.g), b(source.b){ 00077 } 00078 //------------------------------------------------------------------------------ 00079 // 三要素キャラクタカラーの設定 00080 void Color3f::set(const Color3c& source){ 00081 set(source.r / 255.f, source.g / 255.f, source.b / 255.f); 00082 } 00083 //------------------------------------------------------------------------------ 00084 // 四要素キャラクタカラーの設定 00085 void Color3f::set(const Color4c& source){ 00086 set(source.r / 255.f, source.g / 255.f, source.b / 255.f); 00087 } 00088 //------------------------------------------------------------------------------ 00089 // 四要素実数カラーの設定 00090 void Color3f::set(const Color4f& source){ 00091 set(source.r, source.g, source.b); 00092 } 00093 //------------------------------------------------------------------------------ 00094 } // End of namespace Lamp 00095 //------------------------------------------------------------------------------