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

TranslationMaterial.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/Material/TranslationMaterial.h"
00027 #include "Graphics/Material/Material.h"
00028 
00029 namespace LampForMaya{
00030 
00031 //------------------------------------------------------------------------------
00032 // コンストラクタ
00033 TranslationMaterial::TranslationMaterial(
00034     const MObject& initializeObject, const String& initializeName) :
00035     object_(initializeObject), name_(initializeName){
00036 }
00037 //------------------------------------------------------------------------------
00038 // デストラクタ
00039 TranslationMaterial::~TranslationMaterial(){
00040 }
00041 //------------------------------------------------------------------------------
00042 // マテリアルの分析
00043 bool TranslationMaterial::analyzeMaterial(){
00044     // ブレンドモード
00045     blendMode_ = MayaAttributeUtility::getInt(object_, "blendMode");
00046     // アルファ
00047     alpha_ = MayaAttributeUtility::getFloat(object_, "alpha");
00048     // ブレンドソース
00049     blendSource_ = MayaAttributeUtility::getInt(object_, "blendSource");
00050     // ブレンドデスティネーション
00051     blendDestination_ =
00052         MayaAttributeUtility::getInt(object_, "blendDestination");
00053     // Z書き込み
00054     zWrite_ = MayaAttributeUtility::getBool(object_, "zWrite");
00055     // Zテスト
00056     zTestlag_ = MayaAttributeUtility::getBool(object_, "zTest");
00057     // フォグオプション
00058     fogOption_ = MayaAttributeUtility::getInt(object_, "fogOption");
00059     // ライトマスク
00060     lightMask_ = MayaAttributeUtility::getInt(object_, "lightMask");
00061     // 優先度
00062     priority_ = MayaAttributeUtility::getInt(object_, "priority");
00063     return true;
00064 }
00065 //------------------------------------------------------------------------------
00066 // マテリアルのコンバート
00067 bool TranslationMaterial::convertMaterial(Material* material){
00068     material->setBlendMode((Material::BlendMode)blendMode_);
00069     material->setAlpha(alpha_);
00070     material->setBlendSource((Material::BlendState)blendSource_);
00071     material->setBlendDestination((Material::BlendState)blendDestination_);
00072     material->setZWrite(zWrite_);
00073     material->setZTest(zTestlag_);
00074     material->setFogOption((Material::FogOption)fogOption_);
00075     material->setLightMask(lightMask_);
00076     material->setPriority(priority_);
00077     return true;
00078 }
00079 //------------------------------------------------------------------------------
00080 } // End of namespace LampForMaya
00081 //------------------------------------------------------------------------------

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