00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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 }
00082