Go to the documentation of this file.00001
00008 #include "SO3FlashControl.h"
00009 #include <scol.h>
00010 #include <macro.h>
00011 #include "../SO3Material/SO3Material.h"
00012 #include "../SO3Renderer/SO3ViewPort.h"
00013 #include "../SO3Renderer/SO3Window.h"
00014 #include "../SO3SceneGraph/SO3Scene.h"
00015 #include "../SO3Renderer/SO3Root.h"
00016
00017 using namespace Hikari::Impl;
00018 extern SFlashControlMap listOfFlashControl;
00019
00020 extern bool GetMaterialByName(SScene *scene, SMaterial**result, string testName);
00021
00022 extern SRoot * scolRoot;
00023
00024 SFlashControl::SFlashControl(std::string ffName, SViewPort* viewport, int w, int h, Hikari::Position ffPos, Ogre::ushort z) : FlashControl(ffName, const_cast <Ogre::Viewport*> (viewport->GetOgreViewPortPointer()), w, h, ffPos, z)
00025 {
00026 m_opacity = 1.0;
00027 m_transparency = false;
00028 m_alpha = false;
00029 m_ScaleMode = SO3_FLASH_SCALE_SHOWALL;
00030 m_quality = SO3_FLASH_QUALITY_AUTOHIGH;
00031 scolViewport = 0;
00032 }
00033
00034 SFlashControl::SFlashControl(std::string ffName, SScene * scene, std::string matName, int w, int h, int techID, int passID ,int unitID) : FlashControl(ffName, scene, matName, w, h, techID, passID, unitID)
00035 {
00036 m_opacity = 1.0;
00037 m_transparency = false;
00038 m_alpha = false;
00039 m_ScaleMode = SO3_FLASH_SCALE_SHOWALL;
00040 m_quality = SO3_FLASH_QUALITY_AUTOHIGH;
00041 scolViewport = 0;
00042 }
00043
00044 SFlashControl::~SFlashControl()
00045 {
00046 okayToDelete = true;
00047 if(!onMaterial)
00048 {
00049 if(currentViewport)
00050 {
00051 if(currentViewport->currentWindow)
00052 {
00053 if(this == currentViewport->currentWindow->lastOne)
00054 currentViewport->currentWindow->lastOne = NULL;
00055
00056 currentViewport = NULL;
00057
00058 SFlashControlMap::iterator iFlashControlSearched = listOfFlashControl.find(name);
00059 if(iFlashControlSearched != listOfFlashControl.end())
00060 listOfFlashControl.erase(iFlashControlSearched);
00061 }
00062 }
00063 }
00064 else
00065 {
00066 SFlashControlMap::iterator iFlashControlSearched = currentScene->listOfFlashControl.find(materialName);
00067 if(iFlashControlSearched != currentScene->listOfFlashControl.end())
00068 currentScene->listOfFlashControl.erase(iFlashControlSearched);
00069
00070 SMaterial * material;
00071 material = NULL;
00072 GetMaterialByName(currentScene, &material, getMaterialName().c_str());
00073 if(material) material->hasFlashControl = false;
00074 currentScene = NULL;
00075 }
00076 scolRoot->O3HikariManager->update();
00077 }