1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CL_MOVIE_SHOOTER_H
20 #define CL_MOVIE_SHOOTER_H
26 #include "nel/misc/types_nl.h"
27 #include "nel/misc/rgba.h"
28 #include "nel/misc/bitmap.h"
29 #include "nel/3d/u_driver.h"
30 #include "nel/3d/u_text_context.h"
38 using NL3D::UTextContext
;
40 // ***************************************************************************
41 /** Shoot frames into RAM, then write them to disc.
50 /// Fail if can't allocate Movie Memory, or if maxMemory==0
51 bool init(uint maxMemory
);
53 /// Clear the container.
56 bool enabled() const {return _MemorySize
>0;}
58 /// Add a frame from driver shoot.
59 bool addFrame(double time
, UDriver
*pDriver
);
61 /// Add a frame. return false if error. NB: if the movie has looped, erase some images from begin, but still return true
62 bool addFrame(double time
, CRGBA
*pImage
, uint w
, uint h
);
64 /// return the number of frames currenty added.
67 /** replay the movie in a driver, until end of movie
68 * NB: stop if ESC is pressed.
70 void replayMovie(UDriver
*drv
, UTextContext
*textContext
);
72 /** Save the movie to a directory: shoot_00000.tga, .... Throw Exception if error.
73 * Frames are saved at a constant rate. if linearInterp is true, frames are interpolated to give
74 * the best view result.
75 * NB: stop if ESC is pressed
77 void saveMovie(UDriver
*drv
, UTextContext
*textContext
, const char *path
, float framePeriod
, bool allowLinearInterp
= true, const char *prefix
= "shot_");
79 /// Reset all frames. ready to addFrame() from 0.
82 /// Set the frame skipping (in nb frame) set to 0 to not skip frames
83 void setFrameSkip (uint32 nNbFrameToSkip
);
94 // NULL if end of list.
101 uint32 _CurrentIndex
;
103 // The first frame of the movie. != from _MemoryBlock if looped
104 CFrameHeader
*_FirstFrame
;
105 CFrameHeader
*_LastFrame
;
108 uint32 _CurrentFrameSkip
;
110 // Resize and Fill a bitmap with a frame.
111 void getFrameData(CFrameHeader
*frame
, NLMISC::CBitmap
&bmp
);
115 // ***************************************************************************
116 // The default movie_shooter
117 extern CMovieShooter MovieShooter
;