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

TranslationPictureManager.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/Picture/TranslationPictureManager.h"
00027 #include "Translator/Texture/TranslationTextureManager.h"
00028 
00029 namespace LampForMaya{
00030 
00031 //------------------------------------------------------------------------------
00032 // コンストラクタ
00033 TranslationPictureManager::TranslationPictureManager() :
00034     database_(256, 0.75f), array_(256){
00035 }
00036 //------------------------------------------------------------------------------
00037 // デストラクタ
00038 TranslationPictureManager::~TranslationPictureManager(){
00039     Assert(database_.getCount() == 0);
00040     Assert(array_.getCount() == 0);
00041     if(getCount() != 0){ clear(); }
00042 }
00043 //------------------------------------------------------------------------------
00044 // ピクチャの収集
00045 bool TranslationPictureManager::collectPictures(
00046     TranslationTextureManager* textureManager){
00047     int textureNum = textureManager->getCount();
00048     for(int i = 0; i < textureNum; i++){
00049         TranslationTexture* texture = textureManager->get(i);
00050         // 名前の重複があれば無視
00051         String pictureName = texture->getPictureName();
00052         TranslationPicture* exist = search(pictureName);
00053         if(exist != NULL){ continue; }
00054         String picturePath = texture->getPicturePath();
00055         TranslationPicture* picture =
00056             new TranslationPicture(pictureName, picturePath);
00057         database_.put(pictureName, picture);
00058         array_.add(picture);
00059     }
00060     return true;
00061 }
00062 //------------------------------------------------------------------------------
00063 // Lampへの変換
00064 bool TranslationPictureManager::convertToLamp(Scene* scene){
00065     for(int i = 0; i < getCount(); i++){
00066         if(!get(i)->convertToLamp(scene)){ return false; }
00067     }
00068     return true;
00069 }
00070 //------------------------------------------------------------------------------
00071 // クリア
00072 int TranslationPictureManager::clear(){
00073     int result = getCount();
00074     // 要素の削除
00075     for(int i = 0; i < result; i++){ delete array_.get(i); }
00076     array_.clear();
00077     database_.clear();
00078     return result;
00079 }
00080 //------------------------------------------------------------------------------
00081 } // End of namespace LampForMaya
00082 //------------------------------------------------------------------------------

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