PixelLightAPI  .
Camcorder.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Camcorder.h                                    *
00003  *
00004  *  Copyright (C) 2002-2012 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             // Constructors
00075             pl_constructor_1(ParameterConstructor,  EngineApplication&, "Parameter constructor. Owner application as first parameter.", "")
00076             // Methods
00077             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.",    "")
00078             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'.",                                                                                                                 "")
00079             pl_method_0(StopRecord,     pl_ret_type(void),                          "Stops the record",                                                                                                                                                                                                                     "")
00080             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.",            "")
00081             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'.",                                                                                                                   "")
00082             pl_method_0(StopPlayback,   pl_ret_type(void),                          "Stops the playback",                                                                                                                                                                                                                   "")
00083             pl_method_0(Update,         pl_ret_type(void),                          "Updates the camcorder component",                                                                                                                                                                                                      "")
00084         #endif
00085         // Signals
00086         pl_signal_0(SignalPlaybackFinished, "Playback has been finished",   "")
00087         // Slots
00088         pl_slot_0(OnAnimationStop,  "Called when one of the keyframe animations has been stopped",  "")
00089     pl_class_end
00090 
00091 
00092     //[-------------------------------------------------------]
00093     //[ Public functions                                      ]
00094     //[-------------------------------------------------------]
00095     public:
00096         /**
00097         *  @brief
00098         *    Constructor
00099         *
00100         *  @param[in] cApplication
00101         *    Owner application
00102         */
00103         PL_API Camcorder(EngineApplication &cApplication);
00104 
00105         /**
00106         *  @brief
00107         *    Destructor
00108         */
00109         PL_API virtual ~Camcorder();
00110 
00111         /**
00112         *  @brief
00113         *    Returns the owner application
00114         *
00115         *  @return
00116         *    The owner application
00117         */
00118         PL_API EngineApplication &GetApplication() const;
00119 
00120         /**
00121         *  @brief
00122         *    Starts the record
00123         *
00124         *  @param[in] sName
00125         *    Record name, if empty string, no recording can be started
00126         *
00127         *  @note
00128         *    - The currently used application camera will be recorded
00129         *    - If playback is currently enabled, the playback will be stopped at once
00130         */
00131         PL_API void StartRecord(const PLCore::String &sName);
00132 
00133         /**
00134         *  @brief
00135         *    Returns whether or not recording is currently active
00136         *
00137         *  @return
00138         *    'true' if recording is currently active, else 'false'
00139         */
00140         PL_API bool IsRecording() const;
00141 
00142         /**
00143         *  @brief
00144         *    Stops the record
00145         */
00146         PL_API void StopRecord();
00147 
00148         /**
00149         *  @brief
00150         *    Starts the playback
00151         *
00152         *  @param[in] sName
00153         *    Record name, must be valid
00154         *
00155         *  @note
00156         *    - The currently used application camera will be feed with the recorded data
00157         *    - If recording is currently enabled, the recording will be stopped at once
00158         */
00159         PL_API void StartPlayback(const PLCore::String &sName);
00160 
00161         /**
00162         *  @brief
00163         *    Returns whether or not playback is currently active
00164         *
00165         *  @return
00166         *    'true' if playback is currently active, else 'false'
00167         */
00168         PL_API bool IsPlaying() const;
00169 
00170         /**
00171         *  @brief
00172         *    Stops the playback
00173         */
00174         PL_API void StopPlayback();
00175 
00176         /**
00177         *  @brief
00178         *    Updates the camcorder component
00179         */
00180         PL_API void Update();
00181 
00182 
00183     //[-------------------------------------------------------]
00184     //[ Public virtual PLCore::Loadable functions             ]
00185     //[-------------------------------------------------------]
00186     public:
00187         PL_API virtual bool Unload() override;
00188         PL_API virtual PLCore::String GetLoadableTypeName() const override;
00189 
00190 
00191     //[-------------------------------------------------------]
00192     //[ Protected virtual PLCore::Loadable functions          ]
00193     //[-------------------------------------------------------]
00194     protected:
00195         PL_API virtual bool CallLoadable(PLCore::File &cFile, PLCore::Loader &cLoader, const PLCore::String &sMethod, const PLCore::String &sParams) override;
00196 
00197 
00198     //[-------------------------------------------------------]
00199     //[ Private functions                                     ]
00200     //[-------------------------------------------------------]
00201     private:
00202         /**
00203         *  @brief
00204         *    Activates/deactivates certain scene node modifiers of the given scene node
00205         *
00206         *  @param[in] cSceneNode
00207         *    Scene node
00208         *  @param[in] bActive
00209         *    New scene node modifier active state
00210         */
00211         void SetupSceneNodeModifiers(PLScene::SceneNode &cSceneNode, bool bActive);
00212 
00213         /**
00214         *  @brief
00215         *    Called when one of the keyframe animations has been stopped
00216         */
00217         void OnAnimationStop();
00218 
00219 
00220     //[-------------------------------------------------------]
00221     //[ Private data                                          ]
00222     //[-------------------------------------------------------]
00223     private:
00224         EngineApplication         *m_pApplication;                  /**< Owner application, always valid! */
00225         bool                       m_bRecording;                    /**< Is recording currently enabled? */
00226         bool                       m_bPlaying;                      /**< Is playback currently enabled? */
00227         bool                       m_bPlaybackFinished;             /**< Playback finished? */
00228         PLCore::String             m_sRecordName;                   /**< Current record name */
00229         PLScene::SceneNodeHandler  m_cCameraSceneNodeHandler;       /**< Recorded camera scene node handler */
00230         PLCore::String             m_sCameraStartSceneContainer;    /**< Camera start scene container */
00231         PLCore::String             m_sCameraStartName;              /**< Camera start name */
00232 
00233 
00234 };
00235 
00236 
00237 //[-------------------------------------------------------]
00238 //[ Namespace                                             ]
00239 //[-------------------------------------------------------]
00240 } // PLEngine
00241 
00242 
00243 #endif // __PLENGINE_TOOLS_CAMCORDER_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:52
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported