How can i transform MOGRE variable to OGRE [Solved]

tainjoy

28-11-2007 04:21:21

Hi
i hava some problem,
i need transform Mogre::sceneManager to Ogre::sceneManager in managed c++,
for my unmanaged C++ lib (depend ogre)

but i can't transform Mogre's scenemanager that use static_cast<Ogre::sceneManager> ,

how can i to do it ?

thanks

bleubleu

29-11-2007 02:19:28

Hi!

If you in the objects browser, there is a type cast operator in all Mogre objects :


public static implicit operator Ogre.SceneManager*(Mogre.SceneManager t)
Member of Mogre.SceneManager


So, in your code, you can simple use a C-Style cast to get the Ogre::SceneManager*. Here is a snippet of my code.


static List<Mogre::SceneNode^>^ FindNodesIn(Mogre::SceneManager^ sm, Mogre::Sphere^ sphere)
{
Ogre::SceneManager* osm = (Ogre::SceneManager*)sm;
[...]
}


Mat

tainjoy

29-11-2007 09:32:44

thx a lot,
i try transform success, it's can call getName(), but can't call getRootNode(),

cause i use difference ogre version,(MOGRE 0.2.0 & OGRE 1.4.5 @@)

so i replace correct ogre version. it running now,

thx again ^^

Marioko

30-11-2007 19:45:40

Hey very nice...
theres is others mogre class with this cast implicit operator??

Thankss

bleubleu

05-12-2007 01:25:31

Best is to look in the object browser in VS2005. Press CTRL+J in Visual Studio, go in the Mogre namespace. Look a the classes and look for "operator [...]".

With the exception of some frequently used math classes such as Matrix3/4, Vector3/4, Quaternion, etc. All the Mogre objects wraps Ogre objects and potentially have this type cast operator.

Mat

Marioko

06-12-2007 15:01:43

ok thanks.. this a great feature for integrate mogre with existing plugins like NxOgre or PLSM2