User Tools

Site Tools


public:t-gede-13-1:lab2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

public:t-gede-13-1:lab2 [2014/01/09 14:26]
hannes
public:t-gede-13-1:lab2 [2014/01/09 14:26] (current)
hannes
Line 50: Line 50:
   - **Instantiate Effect and Update from FrameListener** Now you have to create an instance of your effect, passing the Cube entity into it's constructor, giving it initial position and velocity values, and finally make sure to call this effect's update function in every frame, e.g. inside the FrameListener's ''frameStarted'' method (note that you'll have to pass a pointer to this effect into the FrameListener constructor so that it knows about it). Don't forget to delete your effect instance in the destructor of your application!   - **Instantiate Effect and Update from FrameListener** Now you have to create an instance of your effect, passing the Cube entity into it's constructor, giving it initial position and velocity values, and finally make sure to call this effect's update function in every frame, e.g. inside the FrameListener's ''frameStarted'' method (note that you'll have to pass a pointer to this effect into the FrameListener constructor so that it knows about it). Don't forget to delete your effect instance in the destructor of your application!
   - **OPTIONAL: Activate Only when Facing Ogre** To know if an object is in front of the camera, you can apply a simple dot product test. Take the vector between the camera and the object (use vector subtraction) and call that **V**. Now take the dot product between **V** and the facing vector **F** of the camera (''Ogre::Vector3 F = _Cam->getDirection();''). If this dot product is greater than 0, you know the object is in front of the camera. Finally, why don't you also check to see if the object is relatively close to the camera (you can use the Ogre::Vector3::length() method). Now you can add this to your project such that the special effect only gets updated when these two checks are passed! :-)   - **OPTIONAL: Activate Only when Facing Ogre** To know if an object is in front of the camera, you can apply a simple dot product test. Take the vector between the camera and the object (use vector subtraction) and call that **V**. Now take the dot product between **V** and the facing vector **F** of the camera (''Ogre::Vector3 F = _Cam->getDirection();''). If this dot product is greater than 0, you know the object is in front of the camera. Finally, why don't you also check to see if the object is relatively close to the camera (you can use the Ogre::Vector3::length() method). Now you can add this to your project such that the special effect only gets updated when these two checks are passed! :-)
-  - <box green>This is optional</box>+  - <box green left>This is optional</box>
  
 ===== When You Are Finished ===== ===== When You Are Finished =====
  
 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. 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/ailab/WWW/wiki/data/pages/public/t-gede-13-1/lab2.txt ยท Last modified: 2014/01/09 14:26 by hannes