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

TranslationAmbientLight.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/TranslationAmbientLight.h"
00027 #include "Graphics/Scene/Scene.h"
00028 #include "Graphics/Light/LightManager.h"
00029 
00030 namespace LampForMaya{
00031 
00032 //------------------------------------------------------------------------------
00033 // コンストラクタ
00034 TranslationAmbientLight::TranslationAmbientLight(
00035     const MDagPath& initializeDagPath, const String& initializeName) :
00036     TranslationLight(initializeDagPath, initializeName){
00037 }
00038 //------------------------------------------------------------------------------
00039 // デストラクタ
00040 TranslationAmbientLight::~TranslationAmbientLight(){
00041 }
00042 //------------------------------------------------------------------------------
00043 // 分析
00044 bool TranslationAmbientLight::analyze(){
00045     // ライトのアナライズ
00046     if(!analyzeLight()){ return false; }
00047     MStatus result;
00048     String errorString;
00049     MFnAmbientLight lightShape(dagPath_.node(), &result);
00050     MayaStatusCheck(result);
00051     // アンビエントシェード
00052     float ambientShade = lightShape.ambientShade(&result);
00053     MayaStatusCheck(result);
00054     if(ambientShade != 0.f){
00055         errorString.format("TranslationAmbientLight::analyze() "
00056             "%sのambientShadeアトリビュートが0でありません ( %f )",
00057             name_.getBytes(), ambientShade);
00058         MayaErrorOut(errorString);
00059         return false;
00060     }
00061     return true;
00062 }
00063 //------------------------------------------------------------------------------
00064 // Lampへの変換
00065 bool TranslationAmbientLight::convertToLamp(Scene* scene){
00066     LightManager* lightManager = scene->getLightManager();
00067     AmbientLight* light = lightManager->createAmbientLight(name_);
00068     light->setColor(exportColor_);
00069     light->setLightMask(lightMask_);
00070     light->setEnabled(visibility_);
00071     return true;
00072 }
00073 //------------------------------------------------------------------------------
00074 } // End of namespace LampForMaya
00075 //------------------------------------------------------------------------------

Generated on Wed Mar 16 10:29:55 2005 for LampForMaya by doxygen 1.3.2