Commit 9e899785 authored by Pavel Rojtberg's avatar Pavel Rojtberg

ovis: add SCENE_AA flag to allow pixel-exact rendering

parent 4c1802a7
...@@ -26,6 +26,8 @@ enum SceneSettings ...@@ -26,6 +26,8 @@ enum SceneSettings
SCENE_SHOW_CS_CROSS = 4, SCENE_SHOW_CS_CROSS = 4,
/// @ref WindowScene::getScreenshot returns images as CV_32FC4 instead of CV_8UC3 /// @ref WindowScene::getScreenshot returns images as CV_32FC4 instead of CV_8UC3
SCENE_RENDER_FLOAT = 8, SCENE_RENDER_FLOAT = 8,
/// Apply anti-aliasing. The first window determines the setting for all windows.
SCENE_AA = 16
}; };
enum MaterialProperty enum MaterialProperty
...@@ -180,7 +182,7 @@ CV_EXPORTS_W void addResourceLocation(const String& path); ...@@ -180,7 +182,7 @@ CV_EXPORTS_W void addResourceLocation(const String& path);
* @param flags a combination of @ref SceneSettings * @param flags a combination of @ref SceneSettings
*/ */
CV_EXPORTS_W Ptr<WindowScene> createWindow(const String& title, const Size& size, CV_EXPORTS_W Ptr<WindowScene> createWindow(const String& title, const Size& size,
int flags = SCENE_INTERACTIVE); int flags = SCENE_INTERACTIVE | SCENE_AA);
/** /**
* update all windows and wait for keyboard event * update all windows and wait for keyboard event
......
...@@ -144,10 +144,11 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp ...@@ -144,10 +144,11 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp
uint32_t w; uint32_t w;
uint32_t h; uint32_t h;
int key_pressed; int key_pressed;
int flags;
Application(const Ogre::String& _title, const Size& sz) Application(const Ogre::String& _title, const Size& sz, int _flags)
: OgreBites::ApplicationContext("ovis", false), sceneMgr(NULL), title(_title), w(sz.width), : OgreBites::ApplicationContext("ovis", false), sceneMgr(NULL), title(_title), w(sz.width),
h(sz.height), key_pressed(-1) h(sz.height), key_pressed(-1), flags(_flags)
{ {
logMgr.reset(new LogManager()); logMgr.reset(new LogManager());
logMgr->createLog("ovis.log", true, true, true); logMgr->createLog("ovis.log", true, true, true);
...@@ -183,7 +184,10 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp ...@@ -183,7 +184,10 @@ struct Application : public OgreBites::ApplicationContext, public OgreBites::Inp
_h = h; _h = h;
_name = title; _name = title;
} }
miscParams["FSAA"] = "4";
if (flags & SCENE_AA)
miscParams["FSAA"] = "4";
miscParams["vsync"] = "true"; miscParams["vsync"] = "true";
OgreBites::NativeWindowPair ret = OgreBites::NativeWindowPair ret =
...@@ -539,7 +543,7 @@ Ptr<WindowScene> createWindow(const String& title, const Size& size, int flags) ...@@ -539,7 +543,7 @@ Ptr<WindowScene> createWindow(const String& title, const Size& size, int flags)
{ {
if (!_app) if (!_app)
{ {
_app = makePtr<Application>(title.c_str(), size); _app = makePtr<Application>(title.c_str(), size, flags);
_app->initApp(); _app->initApp();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment