Tutorial 6         Broken Rules and the sky is Falling

Broken Rules and the sky is Falling

Everybody has their own rules for coding in a standard format. I unfortunately broke one of my own cardinal rules. I never put two classes in the same file. So while creating a new Tutorial6 I put the TutorialFrameListener into its own file. Follow the steps from the previous tutorials and create a new Tutorial Project, but instead, put TutorialFrameListener into its own file as I did. You should now have a new Tutorial project called Tutorial6. This project should contain the following files.

Sources

  • TutorialFrameListener.cpp
  • TutorialApplication.cpp
  • WinMain.cpp


Headers

  • TutorialFrameListener.h
  • TutorialApplication.h


Ok, new project, new tutorial, now what? Well you may think we are creating a space scene as one of the other tutorials available shows. To be honest, we were, at least until I remembered that existing tutorial. So we are going to do something different. On wards and upwards, but not too far up for the sky is falling. Remember that cool looking skybox? Did you know Ogre Scene Managers also supports skyplanes and skydomes?

We will do something creative in this part of the tutorial: changing the skybox to a skydome.
Find the following piece of code in your TutorialApplication::createScene() method.

// Create the SkyBox
mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox");

Now delete that code and enter the following:

// Create the SkyDome
mSceneMgr->setSkyDome(true, "Examples/CloudySky", 5, 8);


While we are here, move the setAmbientLight() from the bottom of the method to the top. This is just so that the coding style looks good. But what is the setSkyDome doing?

The value of true tells the SceneManger that the sky dome is enabled. Examples/CloudySky is again, another material definition that already exists in the media directory. Now 5 and 8 are interesting. 5 is the sky curvature and 8 is the tiling of the texture in the sky.
A more detailed description of the setSkyDome() can be found in Ogrenew\OgreMain\include\OgreSceneManager.h
Now compile and see what we have created.

xorekis6_1.jpg

Ohh, that looks good. But it is still missing something. Let’s keep adding stuff shall we? So on to

Tutorial 7