38#include <OgreBitwise.h>
39#include <OgreDepthBuffer.h>
44SSubEntitySelectorBuffer::SSubEntitySelectorBuffer(
SWindow* targetWindow,
bool useDepth)
46 mBaseResourceName = std::string(SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP) +
"/"+ targetWindow->
GetName();
49 if (rendererName ==
"Vulkan Rendering Subsystem")
53 Ogre::ResourceGroupManager::getSingleton().createResourceGroup(mBaseResourceName,
false);
56 mWindow = targetWindow;
57 mRenderPickerBuffer = 0;
59 mOgreRenderTexture = 0;
60 mOgreRenderDepthTexture = 0;
62 mOgreDebugOverlay = 0;
63 mOgreDebugOverlayPanel = 0;
64 mOgreOverlayMaterial.reset();
69 mCompensateNPOT =
false;
71 nodeSelectorMaterialSwitcher = 0;
72 mOgreRenderWindow =
static_cast <Ogre::RenderTarget*
> (
const_cast <Ogre::RenderWindow*
> (mWindow->
GetOgreRenderWindowPointer()));
75 mOgrePickerRenderTexture = 0;
77 mOgrePickerCamera = 0;
80 const Ogre::RenderSystemCapabilities* caps = ogreRenderSystem->getCapabilities();
81 if (mUseDepth && caps && !caps->hasCapability(Ogre::RSC_MRT_SAME_BIT_DEPTHS))
87 mPickerMat = Ogre::MaterialManager::getSingletonPtr()->getByName(
"SO3/Internal/EntitySelector/Material/MouseColor");
91 CreateTexture(mOgreRenderWindow->getWidth(), mOgreRenderWindow->getHeight());
99SSubEntitySelectorBuffer::SSubEntitySelectorBuffer()
109 Ogre::ResourceGroupManager::getSingleton().unloadResourceGroup(mBaseResourceName);
110 Ogre::ResourceGroupManager::getSingleton().clearResourceGroup(mBaseResourceName);
111 Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(mBaseResourceName);
113 SO3_SAFE_DELETE(nodeSelectorMaterialSwitcher);
127 CreateTexture(mOgreRenderWindow->getWidth(), mOgreRenderWindow->getHeight());
135 Ogre::PixelFormat rttpf = Ogre::PF_A8R8G8B8;
139 mOgrePickerTexture = Ogre::TextureManager::getSingleton().createManual(mBaseResourceName +
"/Picker", SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP, Ogre::TEX_TYPE_2D, 1, 1, 0, rttpf, Ogre::TU_RENDERTARGET);
140 mOgrePickerTexture->load();
142 catch (Ogre::Exception &e)
144 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"An exception has occurred in SSubEntitySelectorBuffer::CreatePicker : "+ e.getDescription());
145 mOgrePickerTexture.reset();
148 if (mOgrePickerTexture)
151 Ogre::HardwarePixelBufferSharedPtr ogrePixelBuffer = mOgrePickerTexture->getBuffer();
152 mOgrePickerRenderTexture = ogrePixelBuffer->getRenderTarget();
153 mOgrePickerRenderTexture->setAutoUpdated(
false);
155#if defined(APPLE_IOS)
156 mOgrePickerRenderTexture->setDepthBufferPool(Ogre::DepthBuffer::POOL_NO_DEPTH);
160 size_t bufferSize = ogrePixelBuffer->getSizeInBytes();
161 mRenderPickerBuffer =
new Ogre::uint8[bufferSize];
162 mOgrePixelBox =
new Ogre::PixelBox(ogrePixelBuffer->getWidth(), ogrePixelBuffer->getHeight(), ogrePixelBuffer->getDepth(), ogrePixelBuffer->getFormat(), mRenderPickerBuffer);
165 mOgrePickerScene = Ogre::Root::getSingleton().createSceneManager(Ogre::SMT_DEFAULT, mBaseResourceName+
"/Picker/Scene");
167 Ogre::AxisAlignedBox octreeBox(-1, -1, -1, 1, 1, 1);
169 mOgrePickerScene->setOption(
"Size", &octreeBox);
170 mOgrePickerScene->setOption(
"Depth", &octreeDepth);
172 Ogre::RenderQueue* rq = mOgrePickerScene->getRenderQueue();
173 rq->getQueueGroup(Ogre::RENDER_QUEUE_WORLD_GEOMETRY_1)->setShadowsEnabled(
false);
174 rq->getQueueGroup(Ogre::RENDER_QUEUE_WORLD_GEOMETRY_2)->setShadowsEnabled(
false);
175 rq->getQueueGroup(Ogre::RENDER_QUEUE_MAIN)->setShadowsEnabled(
false);
176 rq->getQueueGroup(49)->setShadowsEnabled(
false);
179 mOgrePickerCamera = mOgrePickerScene->createCamera(mBaseResourceName+
"/Picker/Camera");
180 mOgrePickerScene->getRootSceneNode()->attachObject(mOgrePickerCamera);
181 mOgrePickerCamera->setFarClipDistance(100.0f);
182 mOgrePickerCamera->setNearClipDistance(0.1f);
184 Ogre::Viewport* pickerViewport = mOgrePickerRenderTexture->addViewport(mOgrePickerCamera);
185 pickerViewport->setOverlaysEnabled(
false);
186 pickerViewport->setShadowsEnabled(
false);
190 mOgrePickerRect =
new Ogre::Rectangle2D(
true);
191 mOgrePickerRect->setCastShadows(
false);
195 mOgrePickerRect->setMaterial(mPickerMat);
197 catch(Ogre::Exception &e)
199 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"An exception has occurred: " + e.getDescription());
202 mOgrePickerRect->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
203 mOgrePickerScene->getRootSceneNode()->attachObject(mOgrePickerRect);
204 mOgrePickerRect->setCorners(-1.0f, 1.0f, 1.0f, -1.0f);
207 Ogre::AxisAlignedBox aabInf;
208 aabInf.setInfinite();
209 mOgrePickerRect->setBoundingBox(aabInf);
210 mOgrePickerRect->setVisible(
true);
213#if SO3_SUBENTITY_SELECTOR_DEBUG_OVERLAY
222#if SO3_SUBENTITY_SELECTOR_DEBUG_OVERLAY
226 if(mOgrePickerRect != 0)
228 mOgrePickerRect->detachFromParent();
229 SAFE_DELETE(mOgrePickerRect);
232 if (mOgrePickerScene)
234 mOgrePickerScene->destroyAllCameras();
235 Ogre::Root::getSingleton().destroySceneManager(mOgrePickerScene);
236 mOgrePickerCamera = 0;
237 mOgrePickerScene = 0;
240 if(mOgrePickerRenderTexture)
242 mOgrePickerRenderTexture->removeAllViewports();
243 mOgrePickerRenderTexture = 0;
246 if (mOgrePickerTexture)
248 Ogre::TextureManager::getSingleton().remove(mOgrePickerTexture->getHandle());
249 mOgrePickerTexture.reset();
252 SO3_SAFE_DELETE(mOgrePixelBox);
253 SO3_SAFE_DELETE_ARRAY(mRenderPickerBuffer);
258 Ogre::Viewport* renderWindowViewport = mOgreRenderWindow->getViewport(newViewport->
GetPriority());
260 mSelectorViewportList[newViewport] = 0;
265 SelectorViewportList::iterator iSearchedOgreViewport = mSelectorViewportList.find(existingViewport);
266 if(iSearchedOgreViewport != mSelectorViewportList.end())
268 mSelectorViewportList.erase(iSearchedOgreViewport);
274 return mUseDepth && mOgreRenderDepthTexture;
284 posX = (int)(((
float)mTextureWidth / (
float)mRealWidth) * (float)posX);
285 posY = (int)(((
float)mTextureHeight / (float)mRealHeight) * (float)posY);
288 if (mOgrePickerRenderTexture && (posX >= 0) && (posY >= 0))
291 Ogre::Technique* pickerTech = 0;
292 Ogre::Material::Techniques techs = mPickerMat->getTechniques();
294 if (techs.size() == 0)
297 pickerTech = techs[0];
299 Ogre::Vector4 mousePos;
300 mousePos.x = (1.0f / (float)mTextureWidth) * (float)posX;
301 mousePos.y = (1.0f / (float)mTextureHeight) * (float)posY;
304 Ogre::ColourValue ogreColour;
308 Ogre::Pass* pickerPass = pickerTech->getPass(0);
309 Ogre::GpuProgramParametersSharedPtr fparams = pickerPass->getFragmentProgramParameters();
310 fparams->setNamedConstant(
"inMouse", mousePos);
312 pickerPass->getTextureUnitState(0)->setTexture(mOgreTexture);
328 mOgrePickerRenderTexture->update();
329 mOgrePickerRenderTexture->copyContentsToMemory(Ogre::Box(0, 0, 1, 1), *mOgrePixelBox, Ogre::RenderTarget::FB_AUTO);
331 if (mRenderPickerBuffer)
332 ogreColour = mOgrePixelBox->getColourAt(0, 0, 0);
336 catch(Ogre::Exception&)
343 Ogre::SubEntity* selectedEntity = (nodeSelectorMaterialSwitcher) ? nodeSelectorMaterialSwitcher->
GetSubEntity(ogreColour) : 0;
344 return selectedEntity;
356 posX = (int)(((
float)mTextureWidth / (
float)mRealWidth) * (float)posX);
357 posY = (int)(((
float)mTextureHeight / (float)mRealHeight) * (float)posY);
360 if (mOgreDepthTexture && (posX >= 0) && (posY >= 0))
363 Ogre::Technique* pickerTech = 0;
364 Ogre::Material::Techniques techs = mPickerMat->getTechniques();
366 if (techs.size() == 0)
369 pickerTech = techs[0];
371 Ogre::Vector4 mousePos;
372 mousePos.x = (1.0f / (float)mTextureWidth) * (float)posX;
373 mousePos.y = (1.0f / (float)mTextureHeight) * (float)posY;
377 Ogre::ColourValue ogreColour;
380 Ogre::Pass* pickerPass = pickerTech->getPass(0);
381 Ogre::GpuProgramParametersSharedPtr fparams = pickerPass->getFragmentProgramParameters();
382 fparams->setNamedConstant(
"inMouse", mousePos);
384 pickerPass->getTextureUnitState(0)->setTexture(mOgreDepthTexture);
400 mOgrePickerRenderTexture->update();
401 mOgrePickerRenderTexture->copyContentsToMemory(Ogre::Box(0, 0, 1, 1), *mOgrePixelBox, Ogre::RenderTarget::FB_AUTO);
403 if (mRenderPickerBuffer)
404 ogreColour = mOgrePixelBox->getColourAt(0, 0, 0);
407 Ogre::Vector4 shift(1.0f / (256.0f * 256.0f * 256.0f), 1.0f / (256.0f * 256.0f), 1.0f / 256.0f, 1.0f);
408 zpos = Ogre::Vector4(ogreColour.a, ogreColour.b, ogreColour.g, ogreColour.r).dotProduct(shift);
410 catch (Ogre::Exception&)
421void SSubEntitySelectorBuffer::CreateTexture(
const unsigned int& width,
const unsigned int& height)
425 const Ogre::RenderSystemCapabilities* caps = ogreRenderSystem->getCapabilities();
428 if (caps && (!caps->hasCapability(Ogre::RSC_NON_POWER_OF_2_TEXTURES)
430 || caps->getNonPOW2TexturesLimited()
434 mTextureWidth = Ogre::Bitwise::firstPO2From(width / 3) / 2;
435 mTextureHeight = Ogre::Bitwise::firstPO2From(height / 3) / 2;
437 mTextureWidth = std::max(mTextureWidth, mTextureHeight);
438 mTextureHeight = mTextureWidth;
443 mTextureWidth = width;
444 mTextureHeight = height;
446 mTextureWidth = (width / 4);
447 mTextureHeight = (height / 4);
451 mCompensateNPOT =
true;
454 mRealHeight = height;
457 std::string textureName = mBaseResourceName+
"/Texture";
460 Ogre::PixelFormat rttpf = Ogre::PF_A8R8G8B8;
462 mOgreTexture = Ogre::TextureManager::getSingleton().createManual(textureName, SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP, Ogre::TEX_TYPE_2D, mTextureWidth, mTextureHeight, 0, rttpf, Ogre::TU_RENDERTARGET);
463 mOgreTexture->load();
468 mOgreDepthTexture = Ogre::TextureManager::getSingleton().createManual(textureName +
"/Depth", SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP, Ogre::TEX_TYPE_2D, mTextureWidth, mTextureHeight, 0, rttpf, Ogre::TU_RENDERTARGET);
469 mOgreDepthTexture->load();
472 catch (Ogre::Exception &e)
474 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(
"An exception has occurred in SSubEntitySelectorBuffer::CreateTexture : "+ e.getDescription());
475 mOgreTexture.reset();
476 mOgreDepthTexture.reset();
482 Ogre::HardwarePixelBufferSharedPtr ogrePixelBuffer = mOgreTexture->getBuffer();
483 mOgreRenderTexture = ogrePixelBuffer->getRenderTarget();
484 mOgreRenderTexture->setAutoUpdated(
true);
485 mOgreRenderTexture->setPriority(100);
487#if defined(APPLE_IOS)
488 mOgreRenderTexture->setDepthBufferPool(Ogre::DepthBuffer::POOL_NO_DEPTH);
491 if (mOgreDepthTexture)
493 Ogre::HardwarePixelBufferSharedPtr ogreDepthPixelBuffer = mOgreDepthTexture->getBuffer();
494 mOgreRenderDepthTexture = ogreDepthPixelBuffer->getRenderTarget();
495 mOgreRenderDepthTexture->setAutoUpdated(
false);
496 mOgreRenderDepthTexture->setPriority(100);
499 mOgreRenderTexture->setAutoUpdated(
false);
501#if defined(APPLE_IOS)
502 mOgreRenderDepthTexture->setDepthBufferPool(Ogre::DepthBuffer::POOL_NO_DEPTH);
504 mMrtTexture = Ogre::Root::getSingleton().getRenderSystem()->createMultiRenderTarget(textureName +
"/MRT");
507 mMrtTexture->bindSurface(0, mOgreRenderTexture);
508 mMrtTexture->bindSurface(1, mOgreRenderDepthTexture);
509 mMrtTexture->setAutoUpdated(
true);
514 const SelectorViewportList viewportListCopy = mSelectorViewportList;
515 SelectorViewportList::const_iterator iOgreViewportList = viewportListCopy.begin();
516 while(iOgreViewportList != viewportListCopy.end())
519 SViewPort* renderWindowViewport = iOgreViewportList->first;
520 SCamera* renderWindowCamera = renderWindowViewport->GetCamera();
521 if (renderWindowCamera)
523 Ogre::Camera* ogreRenderWindowCamera = renderWindowCamera->GetOgreCameraPointer();
524 Ogre::Real ratio = ogreRenderWindowCamera->getAspectRatio();
525 Ogre::Viewport* ogreRenderWindowViewport = renderWindowViewport->GetOgreViewPortPointer();
526 Ogre::Viewport* ogreRenderTextureViewport = mOgreRenderTexture->addViewport(ogreRenderWindowCamera, ogreRenderWindowViewport->getZOrder(), ogreRenderWindowViewport->getLeft(), ogreRenderWindowViewport->getTop(), ogreRenderWindowViewport->getWidth(), ogreRenderWindowViewport->getHeight());
528 ogreRenderTextureViewport->setClearEveryFrame(
true);
529 ogreRenderTextureViewport->setOverlaysEnabled(
false);
530 ogreRenderTextureViewport->setMaterialScheme(mBaseResourceName);
531 ogreRenderTextureViewport->setShadowsEnabled(
false);
532 ogreRenderTextureViewport->setSkiesEnabled(
false);
533 ogreRenderTextureViewport->setVisibilityMask(ogreRenderWindowViewport->getVisibilityMask() & ~SO3_VISIBILITY_FLAG_INVISIBLE_ENVIRONMENT &~Ogre::SceneManager::FX_TYPE_MASK &~Ogre::SceneManager::LIGHT_TYPE_MASK);
535 Ogre::Viewport* ogreRenderDepthTextureViewport = 0;
536 if (mOgreRenderDepthTexture)
538 ogreRenderDepthTextureViewport = mOgreRenderDepthTexture->addViewport(ogreRenderWindowCamera, ogreRenderWindowViewport->getZOrder(), ogreRenderWindowViewport->getLeft(), ogreRenderWindowViewport->getTop(), ogreRenderWindowViewport->getWidth(), ogreRenderWindowViewport->getHeight());
539 ogreRenderDepthTextureViewport->setClearEveryFrame(
true);
540 ogreRenderDepthTextureViewport->setOverlaysEnabled(
false);
541 ogreRenderDepthTextureViewport->setMaterialScheme(mBaseResourceName);
542 ogreRenderDepthTextureViewport->setShadowsEnabled(
false);
543 ogreRenderDepthTextureViewport->setSkiesEnabled(
false);
544 ogreRenderDepthTextureViewport->setVisibilityMask(ogreRenderWindowViewport->getVisibilityMask() & ~SO3_VISIBILITY_FLAG_INVISIBLE_ENVIRONMENT &~Ogre::SceneManager::FX_TYPE_MASK &~Ogre::SceneManager::LIGHT_TYPE_MASK);
547 Ogre::Viewport* ogreRenderMrtViewport = 0;
550 ogreRenderMrtViewport = mMrtTexture->addViewport(ogreRenderWindowCamera, ogreRenderWindowViewport->getZOrder(), ogreRenderWindowViewport->getLeft(), ogreRenderWindowViewport->getTop(), ogreRenderWindowViewport->getWidth(), ogreRenderWindowViewport->getHeight());
551 ogreRenderMrtViewport->setClearEveryFrame(
true);
552 ogreRenderMrtViewport->setOverlaysEnabled(
false);
553 ogreRenderMrtViewport->setMaterialScheme(mBaseResourceName);
554 ogreRenderMrtViewport->setShadowsEnabled(
false);
555 ogreRenderMrtViewport->setSkiesEnabled(
false);
556 ogreRenderMrtViewport->setVisibilityMask(ogreRenderWindowViewport->getVisibilityMask() & ~SO3_VISIBILITY_FLAG_INVISIBLE_ENVIRONMENT &~Ogre::SceneManager::FX_TYPE_MASK &~Ogre::SceneManager::LIGHT_TYPE_MASK);
560 ogreRenderWindowCamera->setAspectRatio(ratio);
563 ogreRenderWindowCamera->_notifyViewport(ogreRenderWindowViewport);
566 if(renderWindowViewport->GetClearColor() || renderWindowViewport->GetClearDepth())
569 if(renderWindowViewport->GetClearDepth() && renderWindowViewport->GetClearColor())
570 mode = Ogre::FBT_COLOUR|Ogre::FBT_DEPTH;
571 else if (renderWindowViewport->GetClearDepth())
572 mode = Ogre::FBT_DEPTH;
574 mode = Ogre::FBT_COLOUR;
575 ogreRenderTextureViewport->setClearEveryFrame(
true, mode);
577 if (ogreRenderDepthTextureViewport)
578 ogreRenderDepthTextureViewport->setClearEveryFrame(
true, mode);
580 if (ogreRenderMrtViewport)
581 ogreRenderMrtViewport->setClearEveryFrame(
true, mode);
583 mSelectorViewportList[renderWindowViewport] = ogreRenderTextureViewport;
591 mOgreRenderTexture->addListener(
this);
593 mMrtTexture->addListener(
this);
595#if SO3_SUBENTITY_SELECTOR_DEBUG_OVERLAY
596 CreateDebugOverlay();
601void SSubEntitySelectorBuffer::DeleteTexture()
603 if(mOgreRenderTexture)
605#if SO3_SUBENTITY_SELECTOR_DEBUG_OVERLAY
606 DeleteDebugOverlay();
610 mOgreRenderTexture->removeListener(
this);
611 mOgreRenderTexture->removeAllViewports();
613 mOgreRenderTexture = 0;
616 if (mOgreRenderDepthTexture)
618 mOgreRenderDepthTexture->removeAllViewports();
619 mOgreRenderDepthTexture = 0;
625 mMrtTexture->removeListener(
this);
626 mMrtTexture->removeAllViewports();
627 Ogre::Root::getSingleton().getRenderSystem()->destroyRenderTarget(mBaseResourceName +
"/Texture/MRT");
633 Ogre::TextureManager::getSingleton().remove(mOgreTexture->getHandle());
634 mOgreTexture.reset();
637 if (mOgreDepthTexture)
639 Ogre::TextureManager::getSingleton().remove(mOgreDepthTexture->getHandle());
640 mOgreDepthTexture.reset();
644void SSubEntitySelectorBuffer::CreateDebugOverlay()
646 if (!mOgreDebugOverlay)
648 std::string ogreOverlayMaterialName = mBaseResourceName+
"/Material/DebugOverlay";
649 mOgreOverlayMaterial = Ogre::MaterialManager::getSingleton().create(ogreOverlayMaterialName, mBaseResourceName);
650 mOgreOverlayMaterial->getTechnique(0)->getPass(0)->createTextureUnitState()->setTexture(mOgreTexture);
651 mOgreOverlayMaterial->getTechnique(0)->setLightingEnabled(
false);
653 Ogre::OverlayManager* overlayManager = Ogre::OverlayManager::getSingletonPtr();
654 mOgreDebugOverlay = overlayManager->create(mBaseResourceName+
"/Overlay/DebugOverlay");
655 mOgreDebugOverlayPanel =
static_cast<Ogre::OverlayContainer*
> (overlayManager->createOverlayElement(
"Panel", mBaseResourceName+
"/Overlay/DebugOverlayPanel"));
656 mOgreDebugOverlayPanel->setPosition(0.5f, 0.5f);
657 mOgreDebugOverlayPanel->setDimensions(0.5f, 0.5f);
658 mOgreDebugOverlayPanel->setMaterialName(ogreOverlayMaterialName);
659 mOgreDebugOverlay->add2D(mOgreDebugOverlayPanel);
660 mOgreDebugOverlay->show();
664void SSubEntitySelectorBuffer::DeleteDebugOverlay()
666 if (mOgreDebugOverlay)
669 Ogre::OverlayManager* overlayManager = Ogre::OverlayManager::getSingletonPtr();
670 mOgreDebugOverlay->remove2D(mOgreDebugOverlayPanel);
671 overlayManager->destroyOverlayElement(mOgreDebugOverlayPanel);
672 mOgreDebugOverlayPanel = 0;
673 overlayManager->destroy(mOgreDebugOverlay);
674 mOgreDebugOverlay = 0;
679 Ogre::RTShader::ShaderGenerator::getSingletonPtr()->removeAllShaderBasedTechniques(mOgreOverlayMaterial->getName(), mOgreOverlayMaterial->getGroup());
681 Ogre::MaterialManager::getSingleton().remove(mOgreOverlayMaterial->getHandle());
682 mOgreOverlayMaterial.reset();
717 unsigned int newWidth = mOgreRenderWindow->getWidth();
718 unsigned int newHeight = mOgreRenderWindow->getHeight();
720 if ((newWidth != mRealWidth)
721 ||(newHeight != mRealHeight)
723 ||(!mOgreRenderTexture))
728 CreateTexture(newWidth, newHeight);
730 catch(Ogre::Exception &)
739 if (nodeSelectorMaterialSwitcher)
741 if (evt.source == mOgreRenderTexture || evt.source == mMrtTexture)
747 SelectorViewportList::iterator iOgreViewportList = mSelectorViewportList.begin();
748 while(iOgreViewportList != mSelectorViewportList.end())
750 SViewPort* viewport = iOgreViewportList->first;
756 if (ogreWindowCamera->getPolygonMode() != Ogre::PM_SOLID)
758 mWireCameraList[ogreWindowCamera] = ogreWindowCamera->getPolygonMode();
759 ogreWindowCamera->setPolygonMode(Ogre::PM_SOLID);
763 ogreWindowCamera->_notifyViewport(iOgreViewportList->second);
770 Ogre::MaterialManager::getSingleton().addListener(nodeSelectorMaterialSwitcher, mBaseResourceName);
776 if (((evt.source == mOgreRenderTexture) && mOgreRenderTexture->isActive()) || ((evt.source == mMrtTexture) && mMrtTexture->isActive()))
779 SelectorViewportList::iterator iOgreViewportList = mSelectorViewportList.begin();
780 while(iOgreViewportList != mSelectorViewportList.end())
782 if (iOgreViewportList->second && iOgreViewportList->second->getCamera())
783 iOgreViewportList->second->getCamera()->_notifyViewport(iOgreViewportList->first->GetOgreViewPortPointer());
788 WireCameraList::iterator iWireCameraList = mWireCameraList.begin();
789 while(iWireCameraList != mWireCameraList.end())
791 iWireCameraList->first->setPolygonMode(iWireCameraList->second);
794 mWireCameraList.clear();
796 if (nodeSelectorMaterialSwitcher)
800 if (nodeSelectorMaterialSwitcher)
801 Ogre::MaterialManager::getSingleton().removeListener(nodeSelectorMaterialSwitcher, mBaseResourceName);
Ogre::Camera * GetOgreCameraPointer()
std::string GetName() const
bool GetRttPixelFormat(Ogre::PixelFormat &format, bool alpha=false, bool floattex=false)
Ogre::RenderSystem * GetOgreRenderSystem()
static SRoot & getSingleton()
static SRoot * getSingletonPtr()
void UpdateBufferSize(const bool &forceRefresh)
void RemoveViewport(SViewPort *existingViewport)
float GetSelectedZdepth(int posX, int posY)
virtual void preRenderTargetUpdate(const Ogre::RenderTargetEvent &evt)
~SSubEntitySelectorBuffer()
void AddViewport(SViewPort *newViewport)
virtual void postRenderTargetUpdate(const Ogre::RenderTargetEvent &evt)
Ogre::SubEntity * GetSelectedSubEntity(int posX, int posY)
void ResetPriorizedObject()
Ogre::SubEntity * GetSubEntity(const Ogre::ColourValue &searchedColour)
Ogre::RenderWindow * GetOgreRenderWindowPointer()