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

# TranslationLight.cpp

Go to the documentation of this file.

    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 "System/stdafx.h"
    00026 #include "Translator/Light/TranslationLight.h"
    00027
    00028 namespace LampForMaya{
    00029
    00030 /// 最小ライト強度
    00031 float TranslationLight::minimumLightPower = 256.f / 16.f;
    00032
    00033 //------------------------------------------------------------------------------
    00034 // コンストラクタ
    00035 TranslationLight::TranslationLight(
    00036     const MDagPath& initializeDagPath, const String& initializeName) :
    00037     dagPath_(initializeDagPath), name_(initializeName){
    00038     MStatus result;
    00039     // オブジェクトの取得
    00040     object_ = dagPath_.node(&result);
    00041     MayaStatusCheck(result);
    00042 }
    00043 //------------------------------------------------------------------------------
    00044 // デストラクタ
    00045 TranslationLight::~TranslationLight(){
    00046 }
    00047 //------------------------------------------------------------------------------
    00048 // ライトの分析
    00049 bool TranslationLight::analyzeLight(){
    00050     MStatus result;
    00051     String errorString;
    00052     MFnLight lightShape(dagPath_.node(), &result);
    00053     MayaStatusCheck(result);
    00054
    00055     // ライトカラー
    00056     MColor color = lightShape.color(&result);
    00057     MayaStatusCheck(result);
    00058     color_.set(color.r, color.g, color.b);
    00059
    00060     // ライト強度
    00061     intensity_ = lightShape.intensity(&result);
    00062     MayaStatusCheck(result);
    00063
    00064     // 出力カラー算出
    00065     exportColor_.set(color_.r * intensity_,
    00066         color_.g * intensity_, color_.b * intensity_);
    00067
    00068     // ライトマスク
    00069     lightMask_ = 1;
    00070     lightShape.attribute("LampLightMask", &result);
    00071     if(result){
    00072         // LightShapeにLampLightMaskアトリビュートを追加する
    00073         lightMask_ = MayaAttributeUtility::getInt(object_, "LampLightMask");
    00074     }
    00075
    00076     // 表示フラグ
    00077     visibility_ = MayaAttributeUtility::getBool(object_, "visibility");
    00078
    00079     return true;
    00080 }
    00081 //------------------------------------------------------------------------------
    00082 } // End of namespace LampForMaya
    00083 //------------------------------------------------------------------------------