[5] | 1 | /* |
---|
| 2 | ----------------------------------------------------------------------------- |
---|
| 3 | This source file is part of OGRE |
---|
| 4 | (Object-oriented Graphics Rendering Engine) |
---|
| 5 | For the latest info, see http://www.ogre3d.org/ |
---|
| 6 | |
---|
| 7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
| 8 | Also see acknowledgements in Readme.html |
---|
| 9 | |
---|
| 10 | You may use this sample code for anything you like, it is not covered by the |
---|
| 11 | LGPL like the rest of the engine. |
---|
| 12 | ----------------------------------------------------------------------------- |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include <Ogre.h> |
---|
| 16 | #include <OgreTimer.h> |
---|
| 17 | #include <CEGUI/CEGUIPropertyHelper.h> |
---|
| 18 | |
---|
| 19 | #include "CompositorDemo_FrameListener.h" |
---|
| 20 | #include "Compositor.h" |
---|
| 21 | |
---|
| 22 | /************************************************************************* |
---|
| 23 | HeatVisionListener Methods |
---|
| 24 | *************************************************************************/ |
---|
| 25 | //--------------------------------------------------------------------------- |
---|
| 26 | HeatVisionListener::HeatVisionListener() |
---|
| 27 | { |
---|
| 28 | timer = new Ogre::Timer(); |
---|
| 29 | start = end = curr = 0.0f; |
---|
| 30 | } |
---|
| 31 | //--------------------------------------------------------------------------- |
---|
| 32 | HeatVisionListener::~HeatVisionListener() |
---|
| 33 | { |
---|
| 34 | delete timer; |
---|
| 35 | } |
---|
| 36 | //--------------------------------------------------------------------------- |
---|
| 37 | void HeatVisionListener::notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat) |
---|
| 38 | { |
---|
| 39 | if(pass_id == 0xDEADBABE) |
---|
| 40 | { |
---|
| 41 | timer->reset(); |
---|
| 42 | fpParams = |
---|
| 43 | mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters(); |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | //--------------------------------------------------------------------------- |
---|
| 47 | void HeatVisionListener::notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat) |
---|
| 48 | { |
---|
| 49 | if(pass_id == 0xDEADBABE) |
---|
| 50 | { |
---|
| 51 | // "random_fractions" parameter |
---|
| 52 | fpParams->setNamedConstant("random_fractions", Ogre::Vector4(Ogre::Math::RangeRandom(0.0, 1.0), Ogre::Math::RangeRandom(0, 1.0), 0, 0)); |
---|
| 53 | |
---|
| 54 | // "depth_modulator" parameter |
---|
| 55 | float inc = ((float)timer->getMilliseconds())/1000.0f; |
---|
| 56 | if ( (fabs(curr-end) <= 0.001) ) { |
---|
| 57 | // take a new value to reach |
---|
| 58 | end = Ogre::Math::RangeRandom(0.95, 1.0); |
---|
| 59 | start = curr; |
---|
| 60 | } else { |
---|
| 61 | if (curr > end) curr -= inc; |
---|
| 62 | else curr += inc; |
---|
| 63 | } |
---|
| 64 | timer->reset(); |
---|
| 65 | |
---|
| 66 | fpParams->setNamedConstant("depth_modulator", Ogre::Vector4(curr, 0, 0, 0)); |
---|
| 67 | } |
---|
| 68 | } |
---|
| 69 | //--------------------------------------------------------------------------- |
---|
| 70 | |
---|
| 71 | /************************************************************************* |
---|
| 72 | HDRListener Methods |
---|
| 73 | *************************************************************************/ |
---|
| 74 | //--------------------------------------------------------------------------- |
---|
| 75 | HDRListener::HDRListener() |
---|
| 76 | { |
---|
| 77 | } |
---|
| 78 | //--------------------------------------------------------------------------- |
---|
| 79 | HDRListener::~HDRListener() |
---|
| 80 | { |
---|
| 81 | } |
---|
| 82 | //--------------------------------------------------------------------------- |
---|
| 83 | void HDRListener::notifyViewportSize(int width, int height) |
---|
| 84 | { |
---|
| 85 | mVpWidth = width; |
---|
| 86 | mVpHeight = height; |
---|
| 87 | } |
---|
| 88 | //--------------------------------------------------------------------------- |
---|
| 89 | void HDRListener::notifyCompositor(Ogre::CompositorInstance* instance) |
---|
| 90 | { |
---|
| 91 | // Get some RTT dimensions for later calculations |
---|
| 92 | Ogre::CompositionTechnique::TextureDefinitionIterator defIter = |
---|
| 93 | instance->getTechnique()->getTextureDefinitionIterator(); |
---|
| 94 | while (defIter.hasMoreElements()) |
---|
| 95 | { |
---|
| 96 | Ogre::CompositionTechnique::TextureDefinition* def = |
---|
| 97 | defIter.getNext(); |
---|
| 98 | if(def->name == "rt_bloom0") |
---|
| 99 | { |
---|
| 100 | mBloomSize = (int)def->width; // should be square |
---|
| 101 | // Calculate gaussian texture offsets & weights |
---|
| 102 | float deviation = 3.0f; |
---|
| 103 | float texelSize = 1.0f / (float)mBloomSize; |
---|
| 104 | |
---|
| 105 | // central sample, no offset |
---|
| 106 | mBloomTexOffsetsHorz[0][0] = 0.0f; |
---|
| 107 | mBloomTexOffsetsHorz[0][1] = 0.0f; |
---|
| 108 | mBloomTexOffsetsVert[0][0] = 0.0f; |
---|
| 109 | mBloomTexOffsetsVert[0][1] = 0.0f; |
---|
| 110 | mBloomTexWeights[0][0] = mBloomTexWeights[0][1] = |
---|
| 111 | mBloomTexWeights[0][2] = Ogre::Math::gaussianDistribution(0, 0, deviation); |
---|
| 112 | mBloomTexWeights[0][3] = 1.0f; |
---|
| 113 | |
---|
| 114 | // 'pre' samples |
---|
| 115 | for(int i = 1; i < 8; ++i) |
---|
| 116 | { |
---|
| 117 | mBloomTexWeights[i][0] = mBloomTexWeights[i][1] = |
---|
| 118 | mBloomTexWeights[i][2] = 1.25f * Ogre::Math::gaussianDistribution(i, 0, deviation); |
---|
| 119 | mBloomTexWeights[i][3] = 1.0f; |
---|
| 120 | mBloomTexOffsetsHorz[i][0] = i * texelSize; |
---|
| 121 | mBloomTexOffsetsHorz[i][1] = 0.0f; |
---|
| 122 | mBloomTexOffsetsVert[i][0] = 0.0f; |
---|
| 123 | mBloomTexOffsetsVert[i][1] = i * texelSize; |
---|
| 124 | } |
---|
| 125 | // 'post' samples |
---|
| 126 | for(int i = 8; i < 15; ++i) |
---|
| 127 | { |
---|
| 128 | mBloomTexWeights[i][0] = mBloomTexWeights[i][1] = |
---|
| 129 | mBloomTexWeights[i][2] = mBloomTexWeights[i - 7][0]; |
---|
| 130 | mBloomTexWeights[i][3] = 1.0f; |
---|
| 131 | |
---|
| 132 | mBloomTexOffsetsHorz[i][0] = -mBloomTexOffsetsHorz[i - 7][0]; |
---|
| 133 | mBloomTexOffsetsHorz[i][1] = 0.0f; |
---|
| 134 | mBloomTexOffsetsVert[i][0] = 0.0f; |
---|
| 135 | mBloomTexOffsetsVert[i][1] = -mBloomTexOffsetsVert[i - 7][1]; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | } |
---|
| 139 | } |
---|
| 140 | } |
---|
| 141 | //--------------------------------------------------------------------------- |
---|
| 142 | void HDRListener::notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat) |
---|
| 143 | { |
---|
| 144 | // Prepare the fragment params offsets |
---|
| 145 | switch(pass_id) |
---|
| 146 | { |
---|
| 147 | //case 994: // rt_lum4 |
---|
| 148 | case 993: // rt_lum3 |
---|
| 149 | case 992: // rt_lum2 |
---|
| 150 | case 991: // rt_lum1 |
---|
| 151 | case 990: // rt_lum0 |
---|
| 152 | break; |
---|
| 153 | case 800: // rt_brightpass |
---|
| 154 | break; |
---|
| 155 | case 701: // rt_bloom1 |
---|
| 156 | { |
---|
| 157 | // horizontal bloom |
---|
| 158 | mat->load(); |
---|
| 159 | Ogre::GpuProgramParametersSharedPtr fparams = |
---|
| 160 | mat->getBestTechnique()->getPass(0)->getFragmentProgramParameters(); |
---|
| 161 | const Ogre::String& progName = mat->getBestTechnique()->getPass(0)->getFragmentProgramName(); |
---|
| 162 | fparams->setNamedConstant("sampleOffsets", mBloomTexOffsetsHorz[0], 15); |
---|
| 163 | fparams->setNamedConstant("sampleWeights", mBloomTexWeights[0], 15); |
---|
| 164 | |
---|
| 165 | break; |
---|
| 166 | } |
---|
| 167 | case 700: // rt_bloom0 |
---|
| 168 | { |
---|
| 169 | // vertical bloom |
---|
| 170 | mat->load(); |
---|
| 171 | Ogre::GpuProgramParametersSharedPtr fparams = |
---|
| 172 | mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters(); |
---|
| 173 | const Ogre::String& progName = mat->getBestTechnique()->getPass(0)->getFragmentProgramName(); |
---|
| 174 | fparams->setNamedConstant("sampleOffsets", mBloomTexOffsetsVert[0], 15); |
---|
| 175 | fparams->setNamedConstant("sampleWeights", mBloomTexWeights[0], 15); |
---|
| 176 | |
---|
| 177 | break; |
---|
| 178 | } |
---|
| 179 | } |
---|
| 180 | } |
---|
| 181 | //--------------------------------------------------------------------------- |
---|
| 182 | void HDRListener::notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat) |
---|
| 183 | { |
---|
| 184 | } |
---|
| 185 | //--------------------------------------------------------------------------- |
---|
| 186 | |
---|
| 187 | |
---|
| 188 | /************************************************************************* |
---|
| 189 | GaussianListener Methods |
---|
| 190 | *************************************************************************/ |
---|
| 191 | //--------------------------------------------------------------------------- |
---|
| 192 | GaussianListener::GaussianListener() |
---|
| 193 | { |
---|
| 194 | } |
---|
| 195 | //--------------------------------------------------------------------------- |
---|
| 196 | GaussianListener::~GaussianListener() |
---|
| 197 | { |
---|
| 198 | } |
---|
| 199 | //--------------------------------------------------------------------------- |
---|
| 200 | void GaussianListener::notifyViewportSize(int width, int height) |
---|
| 201 | { |
---|
| 202 | mVpWidth = width; |
---|
| 203 | mVpHeight = height; |
---|
| 204 | // Calculate gaussian texture offsets & weights |
---|
| 205 | float deviation = 3.0f; |
---|
| 206 | float texelSize = 1.0f / (float)std::min(mVpWidth, mVpHeight); |
---|
| 207 | |
---|
| 208 | // central sample, no offset |
---|
| 209 | mBloomTexOffsetsHorz[0][0] = 0.0f; |
---|
| 210 | mBloomTexOffsetsHorz[0][1] = 0.0f; |
---|
| 211 | mBloomTexOffsetsVert[0][0] = 0.0f; |
---|
| 212 | mBloomTexOffsetsVert[0][1] = 0.0f; |
---|
| 213 | mBloomTexWeights[0][0] = mBloomTexWeights[0][1] = |
---|
| 214 | mBloomTexWeights[0][2] = Ogre::Math::gaussianDistribution(0, 0, deviation); |
---|
| 215 | mBloomTexWeights[0][3] = 1.0f; |
---|
| 216 | |
---|
| 217 | // 'pre' samples |
---|
| 218 | for(int i = 1; i < 8; ++i) |
---|
| 219 | { |
---|
| 220 | mBloomTexWeights[i][0] = mBloomTexWeights[i][1] = |
---|
| 221 | mBloomTexWeights[i][2] = Ogre::Math::gaussianDistribution(i, 0, deviation); |
---|
| 222 | mBloomTexWeights[i][3] = 1.0f; |
---|
| 223 | mBloomTexOffsetsHorz[i][0] = i * texelSize; |
---|
| 224 | mBloomTexOffsetsHorz[i][1] = 0.0f; |
---|
| 225 | mBloomTexOffsetsVert[i][0] = 0.0f; |
---|
| 226 | mBloomTexOffsetsVert[i][1] = i * texelSize; |
---|
| 227 | } |
---|
| 228 | // 'post' samples |
---|
| 229 | for(int i = 8; i < 15; ++i) |
---|
| 230 | { |
---|
| 231 | mBloomTexWeights[i][0] = mBloomTexWeights[i][1] = |
---|
| 232 | mBloomTexWeights[i][2] = mBloomTexWeights[i - 7][0]; |
---|
| 233 | mBloomTexWeights[i][3] = 1.0f; |
---|
| 234 | |
---|
| 235 | mBloomTexOffsetsHorz[i][0] = -mBloomTexOffsetsHorz[i - 7][0]; |
---|
| 236 | mBloomTexOffsetsHorz[i][1] = 0.0f; |
---|
| 237 | mBloomTexOffsetsVert[i][0] = 0.0f; |
---|
| 238 | mBloomTexOffsetsVert[i][1] = -mBloomTexOffsetsVert[i - 7][1]; |
---|
| 239 | } |
---|
| 240 | } |
---|
| 241 | //--------------------------------------------------------------------------- |
---|
| 242 | void GaussianListener::notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat) |
---|
| 243 | { |
---|
| 244 | // Prepare the fragment params offsets |
---|
| 245 | switch(pass_id) |
---|
| 246 | { |
---|
| 247 | case 701: // blur horz |
---|
| 248 | { |
---|
| 249 | // horizontal bloom |
---|
| 250 | mat->load(); |
---|
| 251 | Ogre::GpuProgramParametersSharedPtr fparams = |
---|
| 252 | mat->getBestTechnique()->getPass(0)->getFragmentProgramParameters(); |
---|
| 253 | const Ogre::String& progName = mat->getBestTechnique()->getPass(0)->getFragmentProgramName(); |
---|
| 254 | fparams->setNamedConstant("sampleOffsets", mBloomTexOffsetsHorz[0], 15); |
---|
| 255 | fparams->setNamedConstant("sampleWeights", mBloomTexWeights[0], 15); |
---|
| 256 | |
---|
| 257 | break; |
---|
| 258 | } |
---|
| 259 | case 700: // blur vert |
---|
| 260 | { |
---|
| 261 | // vertical bloom |
---|
| 262 | mat->load(); |
---|
| 263 | Ogre::GpuProgramParametersSharedPtr fparams = |
---|
| 264 | mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters(); |
---|
| 265 | const Ogre::String& progName = mat->getBestTechnique()->getPass(0)->getFragmentProgramName(); |
---|
| 266 | fparams->setNamedConstant("sampleOffsets", mBloomTexOffsetsVert[0], 15); |
---|
| 267 | fparams->setNamedConstant("sampleWeights", mBloomTexWeights[0], 15); |
---|
| 268 | |
---|
| 269 | break; |
---|
| 270 | } |
---|
| 271 | } |
---|
| 272 | } |
---|
| 273 | //--------------------------------------------------------------------------- |
---|
| 274 | void GaussianListener::notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat) |
---|
| 275 | { |
---|
| 276 | } |
---|
| 277 | //--------------------------------------------------------------------------- |
---|
| 278 | |
---|
| 279 | /************************************************************************* |
---|
| 280 | CompositorDemo_FrameListener methods that handle all input for this Compositor demo. |
---|
| 281 | *************************************************************************/ |
---|
| 282 | |
---|
| 283 | CompositorDemo_FrameListener::CompositorDemo_FrameListener(CompositorDemo* main) |
---|
| 284 | : mMain(main) |
---|
| 285 | , hvListener(0) |
---|
| 286 | , hdrListener(0) |
---|
| 287 | , gaussianListener(0) |
---|
| 288 | , mTranslateVector(Ogre::Vector3::ZERO) |
---|
| 289 | , mStatsOn(true) |
---|
| 290 | , mNumScreenShots(0) |
---|
| 291 | , mWriteToFile(false) |
---|
| 292 | , mSkipCount(0) |
---|
| 293 | , mUpdateFreq(50) |
---|
| 294 | , mSceneDetailIndex(0) |
---|
| 295 | , mFiltering(Ogre::TFO_BILINEAR) |
---|
| 296 | , mAniso(1) |
---|
| 297 | , mQuit(false) |
---|
| 298 | , mMoveScale(0.0f) |
---|
| 299 | , mRotScale(0.0f) |
---|
| 300 | , mSpeed(MINSPEED) |
---|
| 301 | , mAvgFrameTime(0.1) |
---|
| 302 | , mMoveSpeed(100) |
---|
| 303 | , mRotateSpeed(0) |
---|
| 304 | , mLastMousePositionSet(false) |
---|
| 305 | , mTimeUntilNextToggle(0) |
---|
| 306 | , mRotX(0) |
---|
| 307 | , mRotY(0) |
---|
| 308 | , mProcessMovement(false) |
---|
| 309 | , mUpdateMovement(false) |
---|
| 310 | |
---|
| 311 | , mLMBDown(false) |
---|
| 312 | , mRMBDown(false) |
---|
| 313 | , mMoveFwd(false) |
---|
| 314 | , mMoveBck(false) |
---|
| 315 | , mMoveLeft(false) |
---|
| 316 | , mMoveRight(false) |
---|
| 317 | , mSpinny(0) |
---|
| 318 | , mCompositorSelectorViewManager(0) |
---|
| 319 | , mMouse(0) |
---|
| 320 | , mKeyboard(0) |
---|
| 321 | |
---|
| 322 | { |
---|
| 323 | |
---|
| 324 | Ogre::Root::getSingleton().addFrameListener(this); |
---|
| 325 | |
---|
| 326 | // using buffered input |
---|
| 327 | OIS::ParamList pl; |
---|
| 328 | size_t windowHnd = 0; |
---|
| 329 | std::ostringstream windowHndStr; |
---|
| 330 | |
---|
| 331 | mMain->getRenderWindow()->getCustomAttribute("WINDOW", &windowHnd); |
---|
| 332 | windowHndStr << windowHnd; |
---|
| 333 | pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str())); |
---|
| 334 | |
---|
| 335 | mInputManager = OIS::InputManager::createInputSystem( pl ); |
---|
| 336 | |
---|
| 337 | //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) |
---|
| 338 | mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true )); |
---|
| 339 | mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true )); |
---|
| 340 | |
---|
| 341 | unsigned int width, height, depth; |
---|
| 342 | int left, top; |
---|
| 343 | mMain->getRenderWindow()->getMetrics(width, height, depth, left, top); |
---|
| 344 | |
---|
| 345 | //Set Mouse Region.. if window resizes, we should alter this to reflect as well |
---|
| 346 | const OIS::MouseState &ms = mMouse->getMouseState(); |
---|
| 347 | ms.width = width; |
---|
| 348 | ms.height = height; |
---|
| 349 | |
---|
| 350 | mMouse->setEventCallback(this); |
---|
| 351 | mKeyboard->setEventCallback(this); |
---|
| 352 | |
---|
| 353 | mGuiRenderer = CEGUI::System::getSingleton().getRenderer(); |
---|
| 354 | |
---|
| 355 | mGuiAvg = CEGUI::WindowManager::getSingleton().getWindow("OPAverageFPS"); |
---|
| 356 | mGuiCurr = CEGUI::WindowManager::getSingleton().getWindow("OPCurrentFPS"); |
---|
| 357 | mGuiBest = CEGUI::WindowManager::getSingleton().getWindow("OPBestFPS"); |
---|
| 358 | mGuiWorst = CEGUI::WindowManager::getSingleton().getWindow("OPWorstFPS"); |
---|
| 359 | mGuiTris = CEGUI::WindowManager::getSingleton().getWindow("OPTriCount"); |
---|
| 360 | mGuiDbg = CEGUI::WindowManager::getSingleton().getWindow("OPDebugMsg"); |
---|
| 361 | mRoot = CEGUI::WindowManager::getSingleton().getWindow("root"); |
---|
| 362 | |
---|
| 363 | registerCompositors(); |
---|
| 364 | initDebugRTTWindow(); |
---|
| 365 | connectEventHandlers(); |
---|
| 366 | } |
---|
| 367 | //-------------------------------------------------------------------------- |
---|
| 368 | CompositorDemo_FrameListener::~CompositorDemo_FrameListener() |
---|
| 369 | { |
---|
| 370 | if(mInputManager) |
---|
| 371 | { |
---|
| 372 | mInputManager->destroyInputObject(mKeyboard); |
---|
| 373 | mInputManager->destroyInputObject(mMouse); |
---|
| 374 | OIS::InputManager::destroyInputSystem(mInputManager); |
---|
| 375 | mInputManager = 0; |
---|
| 376 | } |
---|
| 377 | |
---|
| 378 | delete hvListener; |
---|
| 379 | delete hdrListener; |
---|
| 380 | delete gaussianListener; |
---|
| 381 | delete mCompositorSelectorViewManager; |
---|
| 382 | } |
---|
| 383 | //-------------------------------------------------------------------------- |
---|
| 384 | void CompositorDemo_FrameListener::connectEventHandlers(void) |
---|
| 385 | { |
---|
| 386 | CEGUI::Window* wndw = CEGUI::WindowManager::getSingleton().getWindow("root"); |
---|
| 387 | |
---|
| 388 | wndw->subscribeEvent(CEGUI::Window::EventMouseMove, CEGUI::Event::Subscriber(&CompositorDemo_FrameListener::handleMouseMove, this)); |
---|
| 389 | |
---|
| 390 | wndw->subscribeEvent(CEGUI::Window::EventMouseButtonUp, CEGUI::Event::Subscriber(&CompositorDemo_FrameListener::handleMouseButtonUp, this)); |
---|
| 391 | |
---|
| 392 | wndw->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&CompositorDemo_FrameListener::handleMouseButtonDown, this)); |
---|
| 393 | |
---|
| 394 | wndw->subscribeEvent(CEGUI::Window::EventMouseWheel, CEGUI::Event::Subscriber(&CompositorDemo_FrameListener::handleMouseWheelEvent, this)); |
---|
| 395 | wndw->subscribeEvent(CEGUI::Window::EventKeyDown, CEGUI::Event::Subscriber(&CompositorDemo_FrameListener::handleKeyDownEvent, this )); |
---|
| 396 | wndw->subscribeEvent(CEGUI::Window::EventKeyUp, CEGUI::Event::Subscriber(&CompositorDemo_FrameListener::handleKeyUpEvent, this )); |
---|
| 397 | } |
---|
| 398 | //-------------------------------------------------------------------------- |
---|
| 399 | bool CompositorDemo_FrameListener::frameStarted(const Ogre::FrameEvent& evt) |
---|
| 400 | { |
---|
| 401 | mMouse->capture(); |
---|
| 402 | mKeyboard->capture(); |
---|
| 403 | |
---|
| 404 | if( mMain->getRenderWindow()->isClosed() ) |
---|
| 405 | return false; |
---|
| 406 | |
---|
| 407 | if (mQuit) |
---|
| 408 | return false; |
---|
| 409 | else |
---|
| 410 | { |
---|
| 411 | mSkipCount++; |
---|
| 412 | if (mSkipCount >= mUpdateFreq) |
---|
| 413 | { |
---|
| 414 | mSkipCount = 0; |
---|
| 415 | updateStats(); |
---|
| 416 | } |
---|
| 417 | // update movement process |
---|
| 418 | if(mProcessMovement || mUpdateMovement) |
---|
| 419 | { |
---|
| 420 | mTranslateVector.x += mMoveLeft ? mAvgFrameTime * -MOVESPEED : 0; |
---|
| 421 | mTranslateVector.x += mMoveRight ? mAvgFrameTime * MOVESPEED : 0; |
---|
| 422 | mTranslateVector.z += mMoveFwd ? mAvgFrameTime * -MOVESPEED : 0; |
---|
| 423 | mTranslateVector.z += mMoveBck ? mAvgFrameTime * MOVESPEED : 0; |
---|
| 424 | |
---|
| 425 | mMain->getCamera()->yaw(Ogre::Angle(mRotX)); |
---|
| 426 | mMain->getCamera()->pitch(Ogre::Angle(mRotY)); |
---|
| 427 | mMain->getCamera()->moveRelative(mTranslateVector); |
---|
| 428 | |
---|
| 429 | mUpdateMovement = false; |
---|
| 430 | mRotX = 0; |
---|
| 431 | mRotY = 0; |
---|
| 432 | mTranslateVector = Ogre::Vector3::ZERO; |
---|
| 433 | } |
---|
| 434 | |
---|
| 435 | if(mWriteToFile) |
---|
| 436 | { |
---|
| 437 | mMain->getRenderWindow()->writeContentsToFile("frame_" + |
---|
| 438 | Ogre::StringConverter::toString(++mNumScreenShots) + ".png"); |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | if (mSpinny) |
---|
| 442 | mSpinny->yaw(Ogre::Degree(10 * evt.timeSinceLastFrame)); |
---|
| 443 | |
---|
| 444 | return true; |
---|
| 445 | } |
---|
| 446 | } |
---|
| 447 | |
---|
| 448 | //-------------------------------------------------------------------------- |
---|
| 449 | bool CompositorDemo_FrameListener::mouseMoved (const OIS::MouseEvent &e) |
---|
| 450 | { |
---|
| 451 | CEGUI::System::getSingleton().injectMouseMove( e.state.X.rel, e.state.Y.rel ); |
---|
| 452 | CEGUI::System::getSingleton().injectMouseWheelChange(e.state.Z.rel); |
---|
| 453 | return true; |
---|
| 454 | } |
---|
| 455 | |
---|
| 456 | //-------------------------------------------------------------------------- |
---|
| 457 | bool CompositorDemo_FrameListener::keyPressed (const OIS::KeyEvent &e) |
---|
| 458 | { |
---|
| 459 | // give 'quitting' priority |
---|
| 460 | if (e.key == OIS::KC_ESCAPE) |
---|
| 461 | { |
---|
| 462 | mQuit = true; |
---|
| 463 | return false; |
---|
| 464 | } |
---|
| 465 | |
---|
| 466 | if (e.key == OIS::KC_V) |
---|
| 467 | mMain->getRenderWindow()->getViewport(0)->setBackgroundColour(Ogre::ColourValue(0,1,0)); |
---|
| 468 | |
---|
| 469 | if (e.key == OIS::KC_SYSRQ ) |
---|
| 470 | { |
---|
| 471 | std::ostringstream ss; |
---|
| 472 | ss << "screenshot_" << ++mNumScreenShots << ".png"; |
---|
| 473 | mMain->getRenderWindow()->writeContentsToFile(ss.str()); |
---|
| 474 | mDebugText = "Saved: " + ss.str(); |
---|
| 475 | //mTimeUntilNextToggle = 0.5; |
---|
| 476 | } |
---|
| 477 | |
---|
| 478 | // do event injection |
---|
| 479 | CEGUI::System& cegui = CEGUI::System::getSingleton(); |
---|
| 480 | cegui.injectKeyDown(e.key); |
---|
| 481 | cegui.injectChar(e.text); |
---|
| 482 | return true; |
---|
| 483 | } |
---|
| 484 | |
---|
| 485 | //-------------------------------------------------------------------------- |
---|
| 486 | bool CompositorDemo_FrameListener::keyReleased (const OIS::KeyEvent &e) |
---|
| 487 | { |
---|
| 488 | CEGUI::System::getSingleton().injectKeyUp(e.key); |
---|
| 489 | return true; |
---|
| 490 | } |
---|
| 491 | |
---|
| 492 | //-------------------------------------------------------------------------- |
---|
| 493 | bool CompositorDemo_FrameListener::mousePressed (const OIS::MouseEvent &e, OIS::MouseButtonID id) |
---|
| 494 | { |
---|
| 495 | CEGUI::System::getSingleton().injectMouseButtonDown(convertOISButtonToCegui(id)); |
---|
| 496 | return true; |
---|
| 497 | } |
---|
| 498 | |
---|
| 499 | //-------------------------------------------------------------------------- |
---|
| 500 | bool CompositorDemo_FrameListener::mouseReleased (const OIS::MouseEvent &e, OIS::MouseButtonID id) |
---|
| 501 | { |
---|
| 502 | CEGUI::System::getSingleton().injectMouseButtonUp(convertOISButtonToCegui(id)); |
---|
| 503 | return true; |
---|
| 504 | } |
---|
| 505 | |
---|
| 506 | //-------------------------------------------------------------------------- |
---|
| 507 | CEGUI::MouseButton CompositorDemo_FrameListener::convertOISButtonToCegui(int ois_button_id) |
---|
| 508 | { |
---|
| 509 | switch (ois_button_id) |
---|
| 510 | { |
---|
| 511 | case 0: return CEGUI::LeftButton; |
---|
| 512 | case 1: return CEGUI::RightButton; |
---|
| 513 | case 2: return CEGUI::MiddleButton; |
---|
| 514 | case 3: return CEGUI::X1Button; |
---|
| 515 | default: return CEGUI::LeftButton; |
---|
| 516 | } |
---|
| 517 | } |
---|
| 518 | |
---|
| 519 | //-------------------------------------------------------------------------- |
---|
| 520 | void CompositorDemo_FrameListener::updateStats(void) |
---|
| 521 | { |
---|
| 522 | static CEGUI::String currFps = "Current FPS: "; |
---|
| 523 | static CEGUI::String avgFps = "Average FPS: "; |
---|
| 524 | static CEGUI::String bestFps = "Best FPS: "; |
---|
| 525 | static CEGUI::String worstFps = "Worst FPS: "; |
---|
| 526 | static CEGUI::String tris = "Triangle Count: "; |
---|
| 527 | |
---|
| 528 | |
---|
| 529 | const Ogre::RenderTarget::FrameStats& stats = mMain->getRenderWindow()->getStatistics(); |
---|
| 530 | |
---|
| 531 | mGuiAvg->setText(avgFps + Ogre::StringConverter::toString(stats.avgFPS)); |
---|
| 532 | mGuiCurr->setText(currFps + Ogre::StringConverter::toString(stats.lastFPS)); |
---|
| 533 | mGuiBest->setText(bestFps + Ogre::StringConverter::toString(stats.bestFPS) |
---|
| 534 | + " " + Ogre::StringConverter::toString(stats.bestFrameTime)+" ms"); |
---|
| 535 | mGuiWorst->setText(worstFps + Ogre::StringConverter::toString(stats.worstFPS) |
---|
| 536 | + " " + Ogre::StringConverter::toString(stats.worstFrameTime)+" ms"); |
---|
| 537 | |
---|
| 538 | mGuiTris->setText(tris + Ogre::StringConverter::toString(stats.triangleCount)); |
---|
| 539 | mGuiDbg->setText(mDebugText); |
---|
| 540 | mAvgFrameTime = 1.0f/(stats.avgFPS + 1.0f); |
---|
| 541 | if (mAvgFrameTime > 0.1f) mAvgFrameTime = 0.1f; |
---|
| 542 | |
---|
| 543 | } |
---|
| 544 | |
---|
| 545 | |
---|
| 546 | //-------------------------------------------------------------------------- |
---|
| 547 | bool CompositorDemo_FrameListener::handleMouseMove(const CEGUI::EventArgs& e) |
---|
| 548 | { |
---|
| 549 | using namespace CEGUI; |
---|
| 550 | |
---|
| 551 | if( mLMBDown && !mRMBDown) |
---|
| 552 | { |
---|
| 553 | // rotate camera |
---|
| 554 | mRotX += -((const MouseEventArgs&)e).moveDelta.d_x * mAvgFrameTime * 10.0; |
---|
| 555 | mRotY += -((const MouseEventArgs&)e).moveDelta.d_y * mAvgFrameTime * 10.0; |
---|
| 556 | MouseCursor::getSingleton().setPosition( mLastMousePosition ); |
---|
| 557 | mUpdateMovement = true; |
---|
| 558 | } |
---|
| 559 | else |
---|
| 560 | { |
---|
| 561 | if( mRMBDown && !mLMBDown) |
---|
| 562 | { |
---|
| 563 | // translate camera |
---|
| 564 | mTranslateVector.x += ((const MouseEventArgs&)e).moveDelta.d_x * mAvgFrameTime * MOVESPEED; |
---|
| 565 | mTranslateVector.y += -((const MouseEventArgs&)e).moveDelta.d_y * mAvgFrameTime * MOVESPEED; |
---|
| 566 | //mTranslateVector.z = 0; |
---|
| 567 | MouseCursor::getSingleton().setPosition( mLastMousePosition ); |
---|
| 568 | mUpdateMovement = true; |
---|
| 569 | } |
---|
| 570 | else |
---|
| 571 | { |
---|
| 572 | if( mRMBDown && mLMBDown) |
---|
| 573 | { |
---|
| 574 | mTranslateVector.z += (((const MouseEventArgs&)e).moveDelta.d_x + ((const MouseEventArgs&)e).moveDelta.d_y) * mAvgFrameTime * MOVESPEED; |
---|
| 575 | MouseCursor::getSingleton().setPosition( mLastMousePosition ); |
---|
| 576 | mUpdateMovement = true; |
---|
| 577 | } |
---|
| 578 | |
---|
| 579 | } |
---|
| 580 | } |
---|
| 581 | |
---|
| 582 | return true; |
---|
| 583 | } |
---|
| 584 | |
---|
| 585 | //-------------------------------------------------------------------------- |
---|
| 586 | bool CompositorDemo_FrameListener::handleMouseButtonUp(const CEGUI::EventArgs& e) |
---|
| 587 | { |
---|
| 588 | using namespace CEGUI; |
---|
| 589 | |
---|
| 590 | //Window* wndw = ((const WindowEventArgs&)e).window; |
---|
| 591 | if( ((const MouseEventArgs&)e).button == LeftButton ) |
---|
| 592 | { |
---|
| 593 | mLMBDown = false; |
---|
| 594 | } |
---|
| 595 | |
---|
| 596 | if( ((const MouseEventArgs&)e).button == RightButton ) |
---|
| 597 | { |
---|
| 598 | mRMBDown = false; |
---|
| 599 | } |
---|
| 600 | if( !mLMBDown && !mRMBDown ) |
---|
| 601 | { |
---|
| 602 | MouseCursor::getSingleton().show(); |
---|
| 603 | if(mLastMousePositionSet) |
---|
| 604 | { |
---|
| 605 | MouseCursor::getSingleton().setPosition( mLastMousePosition ); |
---|
| 606 | mLastMousePositionSet = false; |
---|
| 607 | } |
---|
| 608 | mRoot->releaseInput(); |
---|
| 609 | } |
---|
| 610 | |
---|
| 611 | return true; |
---|
| 612 | } |
---|
| 613 | |
---|
| 614 | //-------------------------------------------------------------------------- |
---|
| 615 | bool CompositorDemo_FrameListener::handleMouseButtonDown(const CEGUI::EventArgs& e) |
---|
| 616 | { |
---|
| 617 | using namespace CEGUI; |
---|
| 618 | |
---|
| 619 | //Window* wndw = ((const WindowEventArgs&)e).window; |
---|
| 620 | if( ((const MouseEventArgs&)e).button == LeftButton ) |
---|
| 621 | { |
---|
| 622 | mLMBDown = true; |
---|
| 623 | } |
---|
| 624 | |
---|
| 625 | if( ((const MouseEventArgs&)e).button == RightButton ) |
---|
| 626 | { |
---|
| 627 | mRMBDown = true; |
---|
| 628 | } |
---|
| 629 | |
---|
| 630 | if( mLMBDown || mRMBDown ) |
---|
| 631 | { |
---|
| 632 | MouseCursor::getSingleton().hide(); |
---|
| 633 | if (!mLastMousePositionSet) |
---|
| 634 | { |
---|
| 635 | mLastMousePosition = MouseCursor::getSingleton().getPosition(); |
---|
| 636 | mLastMousePositionSet = true; |
---|
| 637 | } |
---|
| 638 | mRoot->captureInput(); |
---|
| 639 | } |
---|
| 640 | |
---|
| 641 | return true; |
---|
| 642 | } |
---|
| 643 | |
---|
| 644 | //-------------------------------------------------------------------------- |
---|
| 645 | bool CompositorDemo_FrameListener::handleMouseWheelEvent(const CEGUI::EventArgs& e) |
---|
| 646 | { |
---|
| 647 | using namespace CEGUI; |
---|
| 648 | mTranslateVector.z += ((const MouseEventArgs&)e).wheelChange * -5.0; |
---|
| 649 | mUpdateMovement = true; |
---|
| 650 | |
---|
| 651 | return true; |
---|
| 652 | } |
---|
| 653 | |
---|
| 654 | //-------------------------------------------------------------------------- |
---|
| 655 | bool CompositorDemo_FrameListener::handleKeyDownEvent(const CEGUI::EventArgs& e) |
---|
| 656 | { |
---|
| 657 | using namespace CEGUI; |
---|
| 658 | |
---|
| 659 | CheckMovementKeys( ((const KeyEventArgs&)e).scancode , true); |
---|
| 660 | |
---|
| 661 | return true; |
---|
| 662 | } |
---|
| 663 | |
---|
| 664 | //-------------------------------------------------------------------------- |
---|
| 665 | bool CompositorDemo_FrameListener::handleKeyUpEvent(const CEGUI::EventArgs& e) |
---|
| 666 | { |
---|
| 667 | using namespace CEGUI; |
---|
| 668 | CheckMovementKeys( ((const KeyEventArgs&)e).scancode, false ); |
---|
| 669 | |
---|
| 670 | return true; |
---|
| 671 | } |
---|
| 672 | |
---|
| 673 | //-------------------------------------------------------------------------- |
---|
| 674 | void CompositorDemo_FrameListener::CheckMovementKeys( CEGUI::Key::Scan scancode, bool state ) |
---|
| 675 | { |
---|
| 676 | using namespace CEGUI; |
---|
| 677 | |
---|
| 678 | switch ( scancode ) |
---|
| 679 | { |
---|
| 680 | case Key::A: |
---|
| 681 | mMoveLeft = state; |
---|
| 682 | break; |
---|
| 683 | |
---|
| 684 | case Key::D: |
---|
| 685 | mMoveRight = state; |
---|
| 686 | break; |
---|
| 687 | |
---|
| 688 | case Key::S: |
---|
| 689 | mMoveBck = state; |
---|
| 690 | break; |
---|
| 691 | |
---|
| 692 | case Key::W: |
---|
| 693 | mMoveFwd = state; |
---|
| 694 | break; |
---|
| 695 | |
---|
| 696 | default: |
---|
| 697 | break; |
---|
| 698 | |
---|
| 699 | } |
---|
| 700 | |
---|
| 701 | mProcessMovement = mMoveLeft || mMoveRight || mMoveFwd || mMoveBck; |
---|
| 702 | |
---|
| 703 | } |
---|
| 704 | |
---|
| 705 | //----------------------------------------------------------------------------------- |
---|
| 706 | void CompositorDemo_FrameListener::itemStateChanged(const size_t index, const bool state) |
---|
| 707 | { |
---|
| 708 | // get the item text and tell compositor manager to set enable state |
---|
| 709 | Ogre::CompositorManager::getSingleton().setCompositorEnabled(mMain->getRenderWindow()->getViewport(0), |
---|
| 710 | mCompositorSelectorViewManager->getItemSelectorText(index), state); |
---|
| 711 | updateDebugRTTWindow(); |
---|
| 712 | } |
---|
| 713 | //----------------------------------------------------------------------------------- |
---|
| 714 | void CompositorDemo_FrameListener::registerCompositors(void) |
---|
| 715 | { |
---|
| 716 | Ogre::Viewport *vp = mMain->getRenderWindow()->getViewport(0); |
---|
| 717 | hvListener = new HeatVisionListener(); |
---|
| 718 | hdrListener = new HDRListener(); |
---|
| 719 | gaussianListener = new GaussianListener(); |
---|
| 720 | |
---|
| 721 | mCompositorSelectorViewManager = new ItemSelectorViewManager("CompositorSelectorWin"); |
---|
| 722 | // tell view manager to notify us when an item changes selection state |
---|
| 723 | mCompositorSelectorViewManager->setItemSelectorController(this); |
---|
| 724 | //iterate through Compositor Managers resources and add name keys ast Item selectors to Compositor selector view manager |
---|
| 725 | Ogre::CompositorManager::ResourceMapIterator resourceIterator = |
---|
| 726 | Ogre::CompositorManager::getSingleton().getResourceIterator(); |
---|
| 727 | |
---|
| 728 | // add all compositor resources to the view container |
---|
| 729 | while (resourceIterator.hasMoreElements()) |
---|
| 730 | { |
---|
| 731 | Ogre::ResourcePtr resource = resourceIterator.getNext(); |
---|
| 732 | const Ogre::String& compositorName = resource->getName(); |
---|
| 733 | // Don't add base Ogre/Scene compositor to view |
---|
| 734 | if (compositorName == "Ogre/Scene") |
---|
| 735 | continue; |
---|
| 736 | |
---|
| 737 | mCompositorSelectorViewManager->addItemSelector(compositorName); |
---|
| 738 | int addPosition = -1; |
---|
| 739 | if (compositorName == "HDR") |
---|
| 740 | { |
---|
| 741 | // HDR must be first in the chain |
---|
| 742 | addPosition = 0; |
---|
| 743 | } |
---|
| 744 | Ogre::CompositorInstance *instance = Ogre::CompositorManager::getSingleton().addCompositor(vp, compositorName, addPosition); |
---|
| 745 | Ogre::CompositorManager::getSingleton().setCompositorEnabled(vp, compositorName, false); |
---|
| 746 | // special handling for Heat Vision which uses a listener |
---|
| 747 | if(instance && (compositorName == "Heat Vision")) |
---|
| 748 | instance->addListener(hvListener); |
---|
| 749 | else if(instance && (compositorName == "HDR")) |
---|
| 750 | { |
---|
| 751 | instance->addListener(hdrListener); |
---|
| 752 | hdrListener->notifyViewportSize(vp->getActualWidth(), vp->getActualHeight()); |
---|
| 753 | hdrListener->notifyCompositor(instance); |
---|
| 754 | |
---|
| 755 | } |
---|
| 756 | else if(instance && (compositorName == "Gaussian Blur")) |
---|
| 757 | { |
---|
| 758 | instance->addListener(gaussianListener); |
---|
| 759 | gaussianListener->notifyViewportSize(vp->getActualWidth(), vp->getActualHeight()); |
---|
| 760 | } |
---|
| 761 | } |
---|
| 762 | } |
---|
| 763 | //--------------------------------------------------------------------- |
---|
| 764 | void CompositorDemo_FrameListener::initDebugRTTWindow(void) |
---|
| 765 | { |
---|
| 766 | mDebugRTTStaticImage = CEGUI::WindowManager::getSingleton().getWindow((CEGUI::utf8*)"DebugRTTImage"); |
---|
| 767 | mDebugRTTListbox = static_cast<CEGUI::Listbox*>( |
---|
| 768 | CEGUI::WindowManager::getSingleton().getWindow((CEGUI::utf8*)"DebugRTTListbox")); |
---|
| 769 | mDebugRTTListbox->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, |
---|
| 770 | CEGUI::Event::Subscriber(&CompositorDemo_FrameListener::handleRttSelection, this)); |
---|
| 771 | } |
---|
| 772 | //--------------------------------------------------------------------- |
---|
| 773 | bool CompositorDemo_FrameListener::handleRttSelection(const CEGUI::EventArgs& e) |
---|
| 774 | { |
---|
| 775 | if (mDebugRTTListbox->getSelectedCount() > 0) |
---|
| 776 | { |
---|
| 777 | // image set is in user data |
---|
| 778 | CEGUI::Imageset* imgSet = (CEGUI::Imageset*)mDebugRTTListbox->getFirstSelectedItem()->getUserData(); |
---|
| 779 | |
---|
| 780 | mDebugRTTStaticImage->setProperty("Image", |
---|
| 781 | CEGUI::PropertyHelper::imageToString(&imgSet->getImage("RttImage"))); |
---|
| 782 | |
---|
| 783 | } |
---|
| 784 | else |
---|
| 785 | { |
---|
| 786 | mDebugRTTStaticImage->setProperty("Image", ""); |
---|
| 787 | |
---|
| 788 | } |
---|
| 789 | return true; |
---|
| 790 | } |
---|
| 791 | //--------------------------------------------------------------------- |
---|
| 792 | void CompositorDemo_FrameListener::updateDebugRTTWindow(void) |
---|
| 793 | { |
---|
| 794 | // Clear listbox |
---|
| 795 | mDebugRTTListbox->resetList(); |
---|
| 796 | // Clear imagesets |
---|
| 797 | mDebugRTTStaticImage->setProperty("Image", ""); |
---|
| 798 | for (ImageSetList::iterator isIt = mDebugRTTImageSets.begin(); |
---|
| 799 | isIt != mDebugRTTImageSets.end(); ++isIt) |
---|
| 800 | { |
---|
| 801 | CEGUI::ImagesetManager::getSingleton().destroyImageset(*isIt); |
---|
| 802 | } |
---|
| 803 | mDebugRTTImageSets.clear(); |
---|
| 804 | // Add an entry for each render texture for all active compositors |
---|
| 805 | Ogre::Viewport* vp = mMain->getRenderWindow()->getViewport(0); |
---|
| 806 | Ogre::CompositorChain* chain = Ogre::CompositorManager::getSingleton().getCompositorChain(vp); |
---|
| 807 | Ogre::CompositorChain::InstanceIterator it = chain->getCompositors(); |
---|
| 808 | while (it.hasMoreElements()) |
---|
| 809 | { |
---|
| 810 | Ogre::CompositorInstance* inst = it.getNext(); |
---|
| 811 | if (inst->getEnabled()) |
---|
| 812 | { |
---|
| 813 | Ogre::CompositionTechnique::TextureDefinitionIterator texIt = |
---|
| 814 | inst->getTechnique()->getTextureDefinitionIterator(); |
---|
| 815 | while (texIt.hasMoreElements()) |
---|
| 816 | { |
---|
| 817 | Ogre::CompositionTechnique::TextureDefinition* texDef = texIt.getNext(); |
---|
| 818 | |
---|
| 819 | // Get instance name of texture |
---|
| 820 | const Ogre::String& instName = inst->getTextureInstanceName(texDef->name); |
---|
| 821 | // Create CEGUI texture from name of OGRE texture |
---|
| 822 | CEGUI::Texture* tex = mMain->getGuiRenderer()->createTexture(instName); |
---|
| 823 | // Create imageset |
---|
| 824 | CEGUI::Imageset* imgSet = |
---|
| 825 | CEGUI::ImagesetManager::getSingleton().createImageset( |
---|
| 826 | instName, tex); |
---|
| 827 | mDebugRTTImageSets.push_back(imgSet); |
---|
| 828 | imgSet->defineImage((CEGUI::utf8*)"RttImage", |
---|
| 829 | CEGUI::Point(0.0f, 0.0f), |
---|
| 830 | CEGUI::Size(tex->getWidth(), tex->getHeight()), |
---|
| 831 | CEGUI::Point(0.0f,0.0f)); |
---|
| 832 | |
---|
| 833 | |
---|
| 834 | CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem(texDef->name, 0, imgSet); |
---|
| 835 | item->setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush"); |
---|
| 836 | item->setSelectionColours(CEGUI::colour(0,0,1)); |
---|
| 837 | mDebugRTTListbox->addItem(item); |
---|
| 838 | |
---|
| 839 | } |
---|
| 840 | |
---|
| 841 | } |
---|
| 842 | |
---|
| 843 | } |
---|
| 844 | |
---|
| 845 | |
---|
| 846 | |
---|
| 847 | } |
---|
| 848 | |
---|
| 849 | |
---|