====== Lab2: Making a Scene ====== Today we will go a little bit deeper into the Ogre framework, and create an interactive scene, where we can navigate around, add a ground and explore the use of keyboard and Mouse input. For this lab we will break down the application made in Lab1 into a class definition. We will look at the rendering loop and create a listener class that will handle the per-frame updates, as well as listening for user input. This lab is based on chapter 9 "The Ogre 3D Startup Sequence" from the book "Ogre 3D 1.7 - Beginner's Guide" by Felix Kerger. At the end of this lab, we will have a similar scene as in Lab1 but we will be able to interact with the scene. This lab will include Some bonus points, and we encourage you to do them. While the Lab Assignment is a little hard boiled, feel free and I encourage you to experiment, change the code structure (its quite ugly in the guide :) and or add functionality. Just make sure your application qualifies to the standard requirements of the Lab :) This is somewhat our goal. {{ :public:t-gede-14-1:gede_lab2_final_example.png?nolink |}} ===== Discussion ===== Discussion thread for this lab will be on Piazza: [[https://piazza.com/class/hq7dlipqggr2qe?cid=6|Lab 2 Discussion Thread]]. Please don't hesitate to ask questions or comment on the Lab assignment. ===== Preperation ===== You need to create a new project, and configure it like we did in the first lab. As I could not find any easy way to move one projects configurations to the next, you have three options: - Follow the instructions in Lab 1. - Find an easy way to copy VS project configurations to another project and share your prospects with the rest. - Follow the hack below. **Copying VS configurations the farmers way ->** - Create a new empty //"win32 console application"// project for this Lab. - Make sure to add the project to the solution where the previous project is located. - Navigate to the previous lab project folder on disk (**//right click project->Open Project in File Explorer//** in VS2013). - Copy all the source and header files from previous Lab into the new Lab folder (**//You must copy them from the file explorer outside of Visual studio, visual studio only creates symbolic links to the source files otherwise.//**) - Copy the file .vcxproj from the previous project into the new one. - Edit the ''.vcxproj'' with a text editor and change the following. (**//Make sure you save the solution and close visual studio prior to this step//**) "previous project name" to "new project name" - Then finally rename the project file to match the new project name and overwrite the vcxproj file of the new project. - Also make sure to copy the ogre.cfg, resources_d.cfg and plugins_d.cfg to the correct working directory of the new project. ''../"solution name"/Debug/"Project Name"/'' If you are doing release builds, make sure to copy the configuration files from the Release folder as well. - Now the project should build correctly and you can go on your way to start the next lab assignment. "//such hack, so amaze//" - Know an easier solution? Then please share with the rest on the discussion forum :) ===== Lab Project ===== Work through the enumerated actions in the {{:public:t-gede-14-1:ogrestartup_ogre3d_1.7_beginners_guide_chapter_9_by_felix_kerger.pdf| Beginners Guide }} - "Creating a class" - "Adding a FrameListener" - "Adding input" - "Using our own rendering loop" - "Adding a frame listener - Camera" - "Adding a plane and a light" 7. "Controlling the model with the arrow keys"\\ 8. "Adding animation"\\ While this part is optional, you are free and encouraged to experiment on your own, make the input more pleasing, trying other animations, Sinbad can dance for an extra bonus credit :) // Print out all available animation names for _SinbadEnt. Ogre::AnimationStateIterator iter = _SinbadEnt->getAllAnimationStates()->getAnimationStateIterator(); while (iter.hasMoreElements()) { Ogre::AnimationState *a = iter.getNext(); std::cout << a->getAnimationName() << std::endl; } ===== When You Are Finished ===== You should be able to navigate the camera around Sinbad, and you should also see the plane under Sinbad receiving his shadow. {{ :public:t-gede-14-1:gede_lab2_final_example.png?nolink |}} If you were a good citizen and implemented the Bonus points in the guide, you should also be able to move Sinbad with very lame controls (**//We will address this in a later Lab :)//** ), and see him animated while walking. Upload your **commented source files** into Lab2 in MySchool (zip them up if more than one). The lab projects will not be graded, but their completion counts towards your participation grade.