PixelLightAPI  .
Camcorder.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Camcorder.h                                    *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLENGINE_TOOLS_CAMCORDER_H__
00024 #define __PLENGINE_TOOLS_CAMCORDER_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/Tools/Loadable.h"
00032 #include <PLScene/Scene/SceneNodeHandler.h>
00033 #include "PLEngine/PLEngine.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLEngine {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Forward declarations                                  ]
00044 //[-------------------------------------------------------]
00045 class EngineApplication;
00046 
00047 
00048 //[-------------------------------------------------------]
00049 //[ Classes                                               ]
00050 //[-------------------------------------------------------]
00051 /**
00052 *  @brief
00053 *    Camcorder interaction component
00054 *
00055 *  @note
00056 *    - Do not perform playback if the current camera is using physics...
00057 */
00058 class Camcorder : public PLCore::Object, public PLCore::Loadable {
00059 
00060 
00061     //[-------------------------------------------------------]
00062     //[ Friends                                               ]
00063     //[-------------------------------------------------------]
00064     friend class CamcorderLoaderPL;
00065 
00066 
00067     //[-------------------------------------------------------]
00068     //[ RTTI interface                                        ]
00069     //[-------------------------------------------------------]
00070     pl_class(PL_RTTI_EXPORT, Camcorder, "PLEngine", PLCore::Object, "Camcorder interaction component")
00071         // Attributes
00072         pl_attribute(CamcorderDirectory,    PLCore::String, "Data/Camcorder/",  ReadWrite,  DirectValue,    "Default directory for the camcorder files",    "")
00073         #ifdef PLENGINE_EXPORTS // The following is only required when compiling PLEngine
00074             // Methods
00075             pl_method_1(StartRecord,    pl_ret_type(void),  const PLCore::String&,  "Starts the record, record name as first parameter (if empty string, no recording can be started). The currently used application camera will be recorded. If playback is currently enabled, the playback will be stopped at once.",    "")
00076             pl_method_0(IsRecording,    pl_ret_type(bool),                          "Returns whether or not recording is currently active. Returns 'true' if recording is currently active, else 'false'.",                                                                                                                 "")
00077             pl_method_0(StopRecord,     pl_ret_type(void),                          "Stops the record",                                                                                                                                                                                                                     "")
00078             pl_method_1(StartPlayback,  pl_ret_type(void),  const PLCore::String&,  "Starts the playback, record name as first parameter (must be valid). The currently used application camera will be feed with the recorded data. If recording is currently enabled, the recording will be stopped at once.",            "")
00079             pl_method_0(IsPlaying,      pl_ret_type(bool),                          "Returns whether or not playback is currently active. Returns 'true' if playback is currently active, else 'false'.",                                                                                                                   "")
00080             pl_method_0(StopPlayback,   pl_ret_type(void),                          "Stops the playback",                                                                                                                                                                                                                   "")
00081             pl_method_0(Update,         pl_ret_type(void),                          "Updates the camcorder component",                                                                                                                                                                                                      "")
00082         #endif
00083         // Signals
00084         pl_signal_0(SignalPlaybackFinished, "Playback has been finished",   "")
00085         // Slots
00086         pl_slot_0(OnAnimationStop,  "Called when one of the keyframe animations has been stopped",  "")
00087     pl_class_end
00088 
00089 
00090     //[-------------------------------------------------------]
00091     //[ Public functions                                      ]
00092     //[-------------------------------------------------------]
00093     public:
00094         /**
00095         *  @brief
00096         *    Constructor
00097         *
00098         *  @param[in] cApplication
00099         *    Owner application
00100         */
00101         PL_API Camcorder(EngineApplication &cApplication);
00102 
00103         /**
00104         *  @brief
00105         *    Destructor
00106         */
00107         PL_API virtual ~Camcorder();
00108 
00109         /**
00110         *  @brief
00111         *    Returns the owner application
00112         *
00113         *  @return
00114         *    The owner application
00115         */
00116         PL_API EngineApplication &GetApplication() const;
00117 
00118         /**
00119         *  @brief
00120         *    Starts the record
00121         *
00122         *  @param[in] sName
00123         *    Record name, if empty string, no recording can be started
00124         *
00125         *  @note
00126         *    - The currently used application camera will be recorded
00127         *    - If playback is currently enabled, the playback will be stopped at once
00128         */
00129         PL_API void StartRecord(const PLCore::String &sName);
00130 
00131         /**
00132         *  @brief
00133         *    Returns whether or not recording is currently active
00134         *
00135         *  @return
00136         *    'true' if recording is currently active, else 'false'
00137         */
00138         PL_API bool IsRecording() const;
00139 
00140         /**
00141         *  @brief
00142         *    Stops the record
00143         */
00144         PL_API void StopRecord();
00145 
00146         /**
00147         *  @brief
00148         *    Starts the playback
00149         *
00150         *  @param[in] sName
00151         *    Record name, must be valid
00152         *
00153         *  @note
00154         *    - The currently used application camera will be feed with the recorded data
00155         *    - If recording is currently enabled, the recording will be stopped at once
00156         */
00157         PL_API void StartPlayback(const PLCore::String &sName);
00158 
00159         /**
00160         *  @brief
00161         *    Returns whether or not playback is currently active
00162         *
00163         *  @return
00164         *    'true' if playback is currently active, else 'false'
00165         */
00166         PL_API bool IsPlaying() const;
00167 
00168         /**
00169         *  @brief
00170         *    Stops the playback
00171         */
00172         PL_API void StopPlayback();
00173 
00174         /**
00175         *  @brief
00176         *    Updates the camcorder component
00177         */
00178         PL_API void Update();
00179 
00180 
00181     //[-------------------------------------------------------]
00182     //[ Public virtual PLCore::Loadable functions             ]
00183     //[-------------------------------------------------------]
00184     public:
00185         PL_API virtual bool Unload() override;
00186         PL_API virtual PLCore::String GetLoadableTypeName() const override;
00187 
00188 
00189     //[-------------------------------------------------------]
00190     //[ Protected virtual PLCore::Loadable functions          ]
00191     //[-------------------------------------------------------]
00192     protected:
00193         PL_API virtual bool CallLoadable(PLCore::File &cFile, PLCore::Loader &cLoader, const PLCore::String &sMethod, const PLCore::String &sParams) override;
00194 
00195 
00196     //[-------------------------------------------------------]
00197     //[ Private functions                                     ]
00198     //[-------------------------------------------------------]
00199     private:
00200         /**
00201         *  @brief
00202         *    Activates/deactivates certain scene node modifiers of the given scene node
00203         *
00204         *  @param[in] cSceneNode
00205         *    Scene node
00206         *  @param[in] bActive
00207         *    New scene node modifier active state
00208         */
00209         void SetupSceneNodeModifiers(PLScene::SceneNode &cSceneNode, bool bActive);
00210 
00211         /**
00212         *  @brief
00213         *    Called when one of the keyframe animations has been stopped
00214         */
00215         void OnAnimationStop();
00216 
00217 
00218     //[-------------------------------------------------------]
00219     //[ Private data                                          ]
00220     //[-------------------------------------------------------]
00221     private:
00222         EngineApplication         *m_pApplication;                  /**< Owner application, always valid! */
00223         bool                       m_bRecording;                    /**< Is recording currently enabled? */
00224         bool                       m_bPlaying;                      /**< Is playback currently enabled? */
00225         bool                       m_bPlaybackFinished;             /**< Playback finished? */
00226         PLCore::String             m_sRecordName;                   /**< Current record name */
00227         PLScene::SceneNodeHandler  m_cCameraSceneNodeHandler;       /**< Recorded camera scene node handler */
00228         PLCore::String             m_sCameraStartSceneContainer;    /**< Camera start scene container */
00229         PLCore::String             m_sCameraStartName;              /**< Camera start name */
00230 
00231 
00232 };
00233 
00234 
00235 //[-------------------------------------------------------]
00236 //[ Namespace                                             ]
00237 //[-------------------------------------------------------]
00238 } // PLEngine
00239 
00240 
00241 #endif // __PLENGINE_TOOLS_CAMCORDER_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:51
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported