00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __PLENGINE_TOOLS_CAMCORDER_H__
00024 #define __PLENGINE_TOOLS_CAMCORDER_H__
00025 #pragma once
00026
00027
00028
00029
00030
00031 #include "PLCore/Tools/Loadable.h"
00032 #include <PLScene/Scene/SceneNodeHandler.h>
00033 #include "PLEngine/PLEngine.h"
00034
00035
00036
00037
00038
00039 namespace PLEngine {
00040
00041
00042
00043
00044
00045 class EngineApplication;
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 class Camcorder : public PLCore::Object, public PLCore::Loadable {
00059
00060
00061
00062
00063
00064 friend class CamcorderLoaderPL;
00065
00066
00067
00068
00069
00070 pl_class(PL_RTTI_EXPORT, Camcorder, "PLEngine", PLCore::Object, "Camcorder interaction component")
00071
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
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
00084 pl_signal_0(SignalPlaybackFinished, "Playback has been finished", "")
00085
00086 pl_slot_0(OnAnimationStop, "Called when one of the keyframe animations has been stopped", "")
00087 pl_class_end
00088
00089
00090
00091
00092
00093 public:
00094
00095
00096
00097
00098
00099
00100
00101 PL_API Camcorder(EngineApplication &cApplication);
00102
00103
00104
00105
00106
00107 PL_API virtual ~Camcorder();
00108
00109
00110
00111
00112
00113
00114
00115
00116 PL_API EngineApplication &GetApplication() const;
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 PL_API void StartRecord(const PLCore::String &sName);
00130
00131
00132
00133
00134
00135
00136
00137
00138 PL_API bool IsRecording() const;
00139
00140
00141
00142
00143
00144 PL_API void StopRecord();
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 PL_API void StartPlayback(const PLCore::String &sName);
00158
00159
00160
00161
00162
00163
00164
00165
00166 PL_API bool IsPlaying() const;
00167
00168
00169
00170
00171
00172 PL_API void StopPlayback();
00173
00174
00175
00176
00177
00178 PL_API void Update();
00179
00180
00181
00182
00183
00184 public:
00185 PL_API virtual bool Unload() override;
00186 PL_API virtual PLCore::String GetLoadableTypeName() const override;
00187
00188
00189
00190
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
00198
00199 private:
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209 void SetupSceneNodeModifiers(PLScene::SceneNode &cSceneNode, bool bActive);
00210
00211
00212
00213
00214
00215 void OnAnimationStop();
00216
00217
00218
00219
00220
00221 private:
00222 EngineApplication *m_pApplication;
00223 bool m_bRecording;
00224 bool m_bPlaying;
00225 bool m_bPlaybackFinished;
00226 PLCore::String m_sRecordName;
00227 PLScene::SceneNodeHandler m_cCameraSceneNodeHandler;
00228 PLCore::String m_sCameraStartSceneContainer;
00229 PLCore::String m_sCameraStartName;
00230
00231
00232 };
00233
00234
00235
00236
00237
00238 }
00239
00240
00241 #endif // __PLENGINE_TOOLS_CAMCORDER_H__