void GuiDecalEditorCtrl::get3DCursor( GuiCursor *&cursor, bool &visible, const Gui3DMouseEvent &event_ ) { cursor = NULL; visible = false; GuiCanvas *root = getRoot(); if ( !root ) return; S32 currCursor = PlatformCursorController::curArrow; if ( root->mCursorChanged == currCursor ) return; PlatformWindow *window = root->getPlatformWindow(); PlatformCursorController *controller = window->getCursorController(); // We've already changed the cursor, // so set it back before we change it again. if( root->mCursorChanged != -1) controller->popCursor(); // Now change the cursor shape controller->pushCursor(currCursor); root->mCursorChanged = currCursor; }
bool VolumetricFogRTManager::Init() { if (mIsInitialized) { Con::errorf("VolumetricFogRTManager allready initialized!!"); return true; } GuiCanvas* cv = dynamic_cast<GuiCanvas*>(Sim::findObject("Canvas")); if (cv == NULL) { Con::errorf("VolumetricFogRTManager::Init() - Canvas not found!!"); return false; } mPlatformWindow = cv->getPlatformWindow(); mPlatformWindow->getScreenResChangeSignal().notify(this,&VolumetricFogRTManager::ResizeRT); if (mTargetScale < 1 || GFX->getAdapterType() == Direct3D11) mTargetScale = 1; mWidth = mFloor(mPlatformWindow->getClientExtent().x / mTargetScale); mHeight = mFloor(mPlatformWindow->getClientExtent().y / mTargetScale); mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F, &GFXRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__)); if (!mDepthBuffer.isValid()) { Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create Depthbuffer"); return false; } if (!mDepthTarget.registerWithName("volfogdepth")) { Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Depthbuffer"); return false; } mDepthTarget.setTexture(mDepthBuffer); mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F, &GFXRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__)); if (!mFrontBuffer.isValid()) { Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create front buffer"); return false; } if (!mFrontTarget.registerWithName("volfogfront")) { Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Frontbuffer"); return false; } mFrontTarget.setTexture(mFrontBuffer); Con::setVariable("$VolumetricFog::density", "0.0"); mIsInitialized = true; return true; }
bool VolumetricFog::onAdd() { if (!Parent::onAdd()) return false; if (!VFRTM->IsInitialized()) { Con::errorf("No VolumetricFogRTManager present!!"); return false; } resetWorldBox(); mShapeLoaded = LoadShape(); setRenderTransform(mObjToWorld); addToScene(); ColBox.set(getTransform(), (mObjBox.getExtents() * getScale() * COLBOX_SCALE)); mObjSize = mWorldBox.getGreatestDiagonalLength(); mObjScale = getScale(); mTexTiles = mAbs(mTexTiles); mSpeed.set(mSpeed1.x, mSpeed1.y, mSpeed2.x, mSpeed2.y); mInvScale = (1.0f / getMax(getMax(mObjScale.x, mObjScale.y), mObjScale.z)); if (isClientObject()) { conn = GameConnection::getConnectionToServer(); if (!conn) { Con::errorf("VolumetricFog::onAdd - No Serverconnection"); return false; } glowFX = static_cast<PostEffect*>(Sim::findObject("VolFogGlowPostFx")); mOldLightRayStrength = Con::getFloatVariable("$LightRayPostFX::brightScalar",1.0f); GuiCanvas* cv = dynamic_cast<GuiCanvas*>(Sim::findObject("Canvas")); if (cv == NULL) { Con::errorf("VolumetricFog::onAdd - Canvas not found!!"); return false; } mPlatformWindow = cv->getPlatformWindow(); VolumetricFogRTManager::getVolumetricFogRTMResizeSignal().notify(this, &VolumetricFog::handleResize); GuiCanvas::getCanvasSizeChangeSignal().notify(this, &VolumetricFog::handleCanvasResize); InitTexture(); return setupRenderer(); } VFRTM->IncFogObjects(); return true; }
void ForestEditorCtrl::onSleep() { // Pop our default cursor off. GuiCanvas *root = getRoot(); if ( root ) { PlatformWindow *window = root->getPlatformWindow(); PlatformCursorController *controller = window->getCursorController(); controller->popCursor(); } Parent::onSleep(); }
bool ForestEditorCtrl::onWake() { if ( !Parent::onWake() ) return false; // Push our default cursor on here once. GuiCanvas *root = getRoot(); if ( root ) { S32 currCursor = PlatformCursorController::curArrow; PlatformWindow *window = root->getPlatformWindow(); PlatformCursorController *controller = window->getCursorController(); controller->pushCursor( currCursor ); } return true; }