Urho3D Wiki
Register
Advertisement

How to write text into console[]

Urho implements its own functions for writing text (logging) into console. If you want to use them, first you need to include Log.h

#include "Urho3D/IO/Log.h"

Writing info messages:

LOGINFO(text);

Writing debug messages:

LOGDEBUG(text);

Writing error messages:

LOGERROR(text);

Creating and using your own subsystems[]

If you have a class inherited from Urho's Object class, you can create a subsystem out of it. The subsystems are helpful, for example, when you want to make a class instance available to every other class inheriting from Object. In this HowTo I will create a subsystem of a class called Settings.

First things to note in subsystem creation (this text is copied from the Urho documentation):

Any Object can be registered to the Context as a subsystem, by using the function RegisterSubsystem(). They can then be accessed by any other Object inside the same context by calling GetSubsystem(). Only one instance of each object type can exist as a subsystem.

So, we can create our own subsystem in just a few steps:

1. Create an instance of your desired class inheriting from Object. I'm using a class called Settings:

Settings* gs = new Settings(context_);

2. Register it to the Context:

context_->RegisterSubsystem(gs);

So now we have created our own subsystem. We can now use it from any Object class we want by using GetSubsystem<NameOfSubsystem>()

Settings* settings = context_->GetSubsystem<Settings>();

How To Enable Post Process Effects[]

Urho comes with several post process effects (screen effects). Some are listed here: http://urho3d.prophpbb.com/topic55.html

You can enable them like this:

RenderPath* effectRenderPath=viewport->GetRenderPath();
effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/AutoExposure.xml"));
effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/BloomHDR.xml"));
effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/FXAA2.xml"));

The linked forum post uses the Clone() function, that crashed when I use it and just appending the effect to the current RenderPath works too.

The difference between the three effects being appended and not: (I configured the effects to be stronger as per default in their .xml so they may be different if you try it.)

Postprocess effects on
Postprocess effects off
Advertisement