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

TranslationScene.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/Scene/TranslationScene.h"
00027 #include "Translator/Fog/TranslationFog.h"
00028 #include "Translator/Camera/TranslationCameraManager.h"
00029 #include "Translator/Light/TranslationLightManager.h"
00030 #include "Translator/Instance/TranslationInstanceManager.h"
00031 #include "Translator/SceneNode/TranslationSceneNodeManager.h"
00032 #include "Translator/Model/TranslationModelManager.h"
00033 #include "Translator/Mesh/TranslationMeshManager.h"
00034 #include "Translator/Material/TranslationMaterialManager.h"
00035 #include "Translator/Texture/TranslationTextureManager.h"
00036 #include "Translator/Picture/TranslationPictureManager.h"
00037 
00038 namespace LampForMaya{
00039 
00040 //------------------------------------------------------------------------------
00041 // コンストラクタ
00042 TranslationScene::TranslationScene(){
00043     fog_ = new TranslationFog();
00044     instanceManager_ = new TranslationInstanceManager();
00045     cameraManager_ = new TranslationCameraManager();
00046     lightManager_ = new TranslationLightManager();
00047     sceneNodeManager_ = new TranslationSceneNodeManager();
00048     modelManager_ = new TranslationModelManager();
00049     meshManager_ = new TranslationMeshManager();
00050     materialManager_ = new TranslationMaterialManager();
00051     textureManager_ = new TranslationTextureManager();
00052     pictureManager_ = new TranslationPictureManager();
00053 }
00054 //------------------------------------------------------------------------------
00055 // デストラクタ
00056 TranslationScene::~TranslationScene(){
00057     SafeDelete(pictureManager_);
00058     SafeDelete(textureManager_);
00059     SafeDelete(materialManager_);
00060     SafeDelete(meshManager_);
00061     SafeDelete(modelManager_);
00062     SafeDelete(sceneNodeManager_);
00063     SafeDelete(lightManager_);
00064     SafeDelete(cameraManager_);
00065     SafeDelete(instanceManager_);
00066     SafeDelete(fog_);
00067 }
00068 //------------------------------------------------------------------------------
00069 // 情報の収集
00070 bool TranslationScene::collection(){
00071     // テクスチャ情報の収集
00072     if(!textureManager_->collectTextures()){ return false; }
00073     // ピクチャ情報の収集
00074     if(!pictureManager_->collectPictures(textureManager_)){ return false; }
00075     // マテリアル情報の収集
00076     if(!materialManager_->collectMaterials()){ return false; }
00077     // モデル情報の収集
00078     if(!modelManager_->collectModels(meshManager_)){ return false; }
00079     // ライト情報の収集
00080     if(!lightManager_->collectLights()){ return false; }
00081     // シーンノード情報の収集
00082     if(!sceneNodeManager_->collectSceneNodes()){ return false; }
00083     // ピボットのコンパイル
00084     if(!sceneNodeManager_->compilePivot(modelManager_)){ return false; }
00085     // カメラ情報の収集
00086     if(!cameraManager_->collectCameras()){ return false; }
00087     // インスタンス情報の収集
00088     if(!instanceManager_->collectInstances()){ return false; }
00089     // フォグ情報の収集
00090     if(!fog_->analyze()){ return false; }
00091     return true;
00092 }
00093 //------------------------------------------------------------------------------
00094 // アニメーション情報の収集
00095 bool TranslationScene::collectAnimation(){
00096     // カメラのアニメーション情報収集
00097     if(!cameraManager_->collectAnimations()){ return false; }
00098     // シーンノードのアニメーション情報収集
00099     if(!sceneNodeManager_->collectAnimations()){ return false; }
00100     // シーンノードのアニメーション情報収集
00101     if(!modelManager_->collectAnimations()){ return false; }
00102     return true;
00103 }
00104 //------------------------------------------------------------------------------
00105 // Lampへの変換
00106 bool TranslationScene::convertToLamp(Scene* scene){
00107     if(!pictureManager_->convertToLamp(scene)){ return false; }
00108     if(!textureManager_->convertToLamp(scene)){ return false; }
00109     if(!materialManager_->convertToLamp(scene)){ return false; }
00110     if(!meshManager_->convertToLamp(scene)){ return false; }
00111     if(!modelManager_->convertToLamp(scene)){ return false; }
00112     if(!lightManager_->convertToLamp(scene)){ return false; }
00113     if(!sceneNodeManager_->convertToLamp(scene)){ return false; }
00114     if(!cameraManager_->convertToLamp(scene)){ return false; }
00115     if(!instanceManager_->convertToLamp(scene)){ return false; }
00116     if(!fog_->convertToLamp(scene)){ return false; }
00117     return true;
00118 }
00119 //------------------------------------------------------------------------------
00120 // アニメーションの変換
00121 bool TranslationScene::convertAnimation(
00122     AnimationManager* animationManager, AnimationSet* animationSet){
00123     // シーンノードアニメーション変換
00124     if(!sceneNodeManager_->convertAnimation(
00125         animationManager, animationSet)){ return false; }
00126     // モデルアニメーション変換
00127     if(!modelManager_->convertAnimation(
00128         animationManager, animationSet)){ return false; }
00129     // カメラアニメーション変換
00130     if(!cameraManager_->convertAnimation(
00131         animationManager, animationSet)){ return false; }
00132     // インスタンスアニメーション変換
00133     if(!instanceManager_->convertAnimation(
00134         animationManager, animationSet)){ return false; }
00135     return true;
00136 }
00137 //------------------------------------------------------------------------------
00138 // クリア
00139 int TranslationScene::clear(){
00140     int result = 0;
00141     result += pictureManager_->clear();
00142     result += textureManager_->clear();
00143     result += materialManager_->clear();
00144     result += meshManager_->clear();
00145     result += modelManager_->clear();
00146     result += sceneNodeManager_->clear();
00147     result += lightManager_->clear();
00148     result += cameraManager_->clear();
00149     result += instanceManager_->clear();
00150     return result;
00151 }
00152 //------------------------------------------------------------------------------
00153 } // End of namespace LampForMaya
00154 //------------------------------------------------------------------------------

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