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/Mesh/TranslationMeshManager.h"
00027
00028 namespace LampForMaya{
00029
00030
00031
00032 TranslationMeshManager::TranslationMeshManager() :
00033 database_(256, 0.75f), array_(256){
00034 }
00035
00036
00037 TranslationMeshManager::~TranslationMeshManager(){
00038 Assert(database_.getCount() == 0);
00039 Assert(array_.getCount() == 0);
00040 if(getCount() != 0){ clear(); }
00041 }
00042
00043
00044 bool TranslationMeshManager::convertToLamp(Scene* scene) const{
00045 for(int i = 0; i < getCount(); i++){
00046 if(!get(i)->convertToLamp(scene)){ return false; }
00047 }
00048 return true;
00049 }
00050
00051
00052 int TranslationMeshManager::clear(){
00053 int result = getCount();
00054
00055 for(int i = 0; i < result; i++){ delete array_.get(i); }
00056 array_.clear();
00057 database_.clear();
00058 return result;
00059 }
00060
00061
00062 TranslationRigidMesh* TranslationMeshManager::createRigidMesh(
00063 const String& meshName){
00064
00065 TranslationMesh* exist = search(meshName);
00066 if(exist != NULL){
00067 MayaErrorOut(String("TranslationMeshManager::createRigidMesh() "
00068 "名前が重複しています ") + meshName);
00069 return NULL;
00070 }
00071
00072 TranslationRigidMesh* mesh = new TranslationRigidMesh(meshName);
00073 database_.put(meshName, mesh);
00074 array_.add(mesh);
00075 return mesh;
00076 }
00077
00078
00079 TranslationCharacterMesh* TranslationMeshManager::createCharacterMesh(
00080 const String& meshName){
00081
00082 TranslationMesh* exist = search(meshName);
00083 if(exist != NULL){
00084 MayaErrorOut(String("TranslationMeshManager::createCharacterMesh() "
00085 "名前が重複しています ") + meshName);
00086 return NULL;
00087 }
00088
00089 TranslationCharacterMesh* mesh = new TranslationCharacterMesh(meshName);
00090 database_.put(meshName, mesh);
00091 array_.add(mesh);
00092 return mesh;
00093 }
00094
00095 }
00096