Welcome to the new Ogre Wiki!
If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
/* ----------------------------------------------------------------------------- Copyright (c) 2008 Torus Knot Software Ltd You may use this sample code for anything you like, it is public domain. ----------------------------------------------------------------------------- */ /* ----------------------------------------------------------------------------- Filename: Camcorder.h Description: A subsystem for recording camera points and playing them back ----------------------------------------------------------------------------- */ #ifndef __Camcorder_H__ #define __Camcorder_H__ #include "Ogre.h" #include "OIS/OIS.h" #include "OgreTextAreaOverlayElement.h" using namespace Ogre; /** Helper class which provides an interface to the Camcorder */ class CamcorderHelper { public: CamcorderHelper(); virtual ~CamcorderHelper(); void init(Viewport* vp, Camera* cam); /** Process unbuffered keyboard state. */ void processUnbufferedKeyboard(OIS::Keyboard* keyboard, Real timeElapsed); /** Update the camera based on a frame. @remarks Will only update the camera if in playback mode, safe to call in all cases */ void update(Real timeElapsed); enum Mode { /// Not actively doing anything (although manual keyframes can be taken) IDLE, /// Recording the motion of the camera according to setKeyFrameFrequency RECORDING, /// Playing back an animation PLAYBACK }; /// Get the current mode Mode getMode() const { return mMode; } /// Manually change the mode rather than let the input processing do it void setMode(Mode m); bool isPlayingBack() const; bool isRecording() const; bool isIdle() const; /// Enable the class, showing the overlay, processing input and recording / playback if required void setEnabled(bool enabled); bool getEnabled() const { return mEnabled; } /// Set the position interpolation mode void setPositionInterpolationMode(Animation::InterpolationMode m); /// Set the rotation interpolation mode void setRotationInterpolationMode(Animation::RotationInterpolationMode m); Animation::InterpolationMode getPositionInterpolationMode() const { return mInterpolationMode; } /// Set the rotation interpolation mode Animation::RotationInterpolationMode getRotationInterpolationMode() const { return mRotationInterpolationMode; } /// Set how often to take a keyframe in seconds when recording void setKeyFrameFrequency(Real f) { mKeyFrameFrequency = f; } /// Get how often to take a keyframe in seconds when recording Real getKeyFrameFrequency() const { return mKeyFrameFrequency; } /// Take a keyframe of the current camera position void addKeyFrame(Real time); protected: Mode mMode; bool mEnabled; Viewport* mViewport; Camera* mCamera; Real mPlaybackTime; Real mRecordingTime; Real mLastKeyTime; Vector3 mSavedPos; Quaternion mSavedOrientation; Animation* mCurrentAnimation; NodeAnimationTrack* mCurrentTrack; Animation::InterpolationMode mInterpolationMode; Animation::RotationInterpolationMode mRotationInterpolationMode; Real mKeyFrameFrequency; Real mPlaybackSpeed; Overlay* mOverlay; OverlayElement* mModeText; OverlayElement* mLengthText; OverlayElement* mKeyFramesText; OverlayElement* mFreqText; OverlayElement* mFreqLabel; OverlayElement* mCurrentPosText; void createOverlay(); TextAreaOverlayElement* createText(Real left, Real top, const String& text); }; #endif
Contributors to this page: jacmoe
.
Page last modified on Saturday 31 of July, 2010 12:56:30 UTC by jacmoe
.
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.
Sidebar
Last changes
- Hydrax
- QtOgre
- SoC2012 Complete the DirectX 11 render system
- SoC2012 Volume Rendering with LOD aimed at terrain
- SoC2012 Improve and Demo the Terrain System
- Mogre and WPF
- SoC2012 Implementation of Off-Screen Particles
- Advanced Ogre Framework
- Ogre overlays using Qt
- Architecture and Design in Games

