User Tools

Site Tools


public:t-gede-14-1:lab2

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.

Discussion

Discussion thread for this lab will be on Piazza: 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:

  1. Follow the instructions in Lab 1.
  2. Find an easy way to copy VS project configurations to another project and share your prospects with the rest.
  3. Follow the hack below.

Copying VS configurations the farmers way →

  1. Create a new empty “win32 console application” project for this Lab.
  2. Make sure to add the project to the solution where the previous project is located.
  3. Navigate to the previous lab project folder on disk (right click project→Open Project in File Explorer in VS2013).
  4. 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.)
  5. Copy the file <Project name>.vcxproj from the previous project into the new one.
  6. Edit the <project name>.vcxproj with a text editor and change the following. (Make sure you save the solution and close visual studio prior to this step)
          <RootNamespace>"previous project name"</RootNamespace>
    	to 
          <RootNamespace>"new project name"</RootNamespace>
  7. Then finally rename the project file to match the new project name and overwrite the vcxproj file of the new project.
  8. 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.
  9. Now the project should build correctly and you can go on your way to start the next lab assignment. “such hack, so amaze
  10. Know an easier solution? Then please share with the rest on the discussion forum :)

Lab Project

Work through the enumerated actions in the Beginners Guide

  1. “Creating a class”
  2. “Adding a FrameListener”
  3. “Adding input”
  4. “Using our own rendering loop”
  5. “Adding a frame listener - Camera”
  6. “Adding a plane and a light”

Bonus Pts

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.

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.

/var/www/cadia.ru.is/wiki/data/pages/public/t-gede-14-1/lab2.txt · Last modified: 2024/04/29 13:33 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki