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

TranslationDirectionalLight.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/TranslationDirectionalLight.h"
00027 #include "Graphics/Scene/Scene.h"
00028 #include "Graphics/Light/LightManager.h"
00029 
00030 namespace LampForMaya{
00031 
00032 //------------------------------------------------------------------------------
00033 // コンストラクタ
00034 TranslationDirectionalLight::TranslationDirectionalLight(
00035     const MDagPath& initializeDagPath, const String& initializeName) :
00036     TranslationLight(initializeDagPath, initializeName){
00037 }
00038 //------------------------------------------------------------------------------
00039 // デストラクタ
00040 TranslationDirectionalLight::~TranslationDirectionalLight(){
00041 }
00042 //------------------------------------------------------------------------------
00043 // 分析
00044 bool TranslationDirectionalLight::analyze(){
00045     // ライトのアナライズ
00046     if(!analyzeLight()){ return false; }
00047     MStatus result;
00048     String errorString;
00049     MFnDirectionalLight lightShape(dagPath_.node(), &result);
00050     MayaStatusCheck(result);
00051     MFloatVector direction =
00052         lightShape.lightDirection(0, MSpace::kWorld, &result);
00053     // なぜか機能しない
00054 //  MFloatVector direction =
00055 //      lightShape.lightDirection(0, MSpace::kObject, &result);
00056     MayaStatusCheck(result);
00057     direction_.set(direction.x, direction.y, direction.z);
00058     // SceneNodeの変換を使用する
00059     direction_.set(0.f, 0.f, -1.f);
00060     return true;
00061 }
00062 //------------------------------------------------------------------------------
00063 // Lampへの変換
00064 bool TranslationDirectionalLight::convertToLamp(Scene* scene){
00065     LightManager* lightManager = scene->getLightManager();
00066     DirectionalLight* light = lightManager->createDirectionalLight(name_);
00067     light->setColor(exportColor_);
00068     light->setLightMask(lightMask_);
00069     light->setEnabled(visibility_);
00070     light->setDirection(direction_);
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