====== 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/i4l9of1fw8j3ew?cid=17|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.You have three options: * Create a new project and follow the instructions in Lab 1. (Again) * Create a VS project template. Instuctions below * or Create a new project the crude way. Instuctions below. **> - Open up your solution explorer. **Important! You should already have lab 1 Working and running correctly inside your current solution directory!** - File->Export Template - Pick lab 1 from the dropdown list of which project to base the template on. (next) - Name the template and give it a description. Just something that you will be able to recognize - Make sure automatically import is checked and click Finish. - Now you can right click your solution folder-> Add -> New project -> Visual C++ -> "Your Template" - Give it a name and the project should inherit all the configurations from the previous project you had configured - If you wish to move the source files to the new project **You must copy them from the file explorer outside of Visual studio, visual studio only creates symbolic links to the source files otherwise.** **> - 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. - 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. - Now the project should build correctly and you can go on your way to start the next lab assignment. "So amaze" ===== 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 }} ( This will be the last lab that we use this 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 ** briefly commented (if appropriate) source files, ONLY .cpp and .h no project related thanks!** 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.