Operating System: Win10
Render System: OGL3+
Hello There,
I need to ask some noob questions as I want to understand it right.
I've got working EmptyScene and added there a cube to render as it is from another tutorials.
Here are steps how I added the cube:
Defined mSceneNode in EmptyProjectGamestate.h right below generateDebugText
Ogre::SceneNode *mSceneNode;
Added mSceneNode(0) in EmptyProjectGameState.cpp right after TutorialGameState( helpDescription ) inside this function:
Code: Select all
EmptyProjectGameState::EmptyProjectGameState( const Ogre::String &helpDescription ) :
TutorialGameState( helpDescription ),
mSceneNode(0)
{
}
Code: Select all
void EmptyProjectGameState::createScene01(void)
{
mCameraController = new CameraController( mGraphicsSystem, false );
Ogre::SceneManager *sceneManager = mGraphicsSystem->getSceneManager();
Ogre::Item *item = sceneManager->createItem("Cube_d.mesh",
Ogre::ResourceGroupManager::
AUTODETECT_RESOURCE_GROUP_NAME,
Ogre::SCENE_DYNAMIC);
mSceneNode = sceneManager->getRootSceneNode(Ogre::SCENE_DYNAMIC)->
createChildSceneNode(Ogre::SCENE_DYNAMIC);
mSceneNode->attachObject(item);
TutorialGameState::createScene01();
}
Why do I need to add mSceneNode(0) in the beginning when it is defined in EmptyProjectGameState.h ?
If I will remove it from the EmptyProjectGameState.h then I can directly call it and the only edit will be in CreateScene01 so it will look like this:
Code: Select all
void EmptyProjectGameState::createScene01(void)
{
mCameraController = new CameraController( mGraphicsSystem, false );
Ogre::SceneManager *sceneManager = mGraphicsSystem->getSceneManager();
Ogre::Item *item = sceneManager->createItem("Cube_d.mesh",
Ogre::ResourceGroupManager::
AUTODETECT_RESOURCE_GROUP_NAME,
Ogre::SCENE_DYNAMIC);
Ogre::SceneNode *mSceneNode = sceneManager->getRootSceneNode(Ogre::SCENE_DYNAMIC)->createChildSceneNode(Ogre::SCENE_DYNAMIC);
mSceneNode->attachObject(item);
TutorialGameState::createScene01();
}
Is "mCameraController = new CameraController( mGraphicsSystem, false );" used for mouse movements?
Why we don't need to define root? "Ogre::Root *root = mGraphicsSystem->getRoot();"
Here "Ogre::SceneManager *sceneManager = mGraphicsSystem->getSceneManager();" we create a new scene node which belongs to root node, right?
Next to our newly created scene node we attach an object: "mSceneNode->attachObject(item);"
Then createScene01 is called to display everything up?
Why there is no destroySystems in EmptyProject.cpp ? Is destroySystems called when application is being closed also by cross button?
I'm really sorry for these types of questions and thank you very much for your effort help and tips.