Support Forum G3D Web Page |
Allows recording and playback of a G3D::UprightSpline based on a G3D::Camera.
More...
Inherits G3D::Manipulator.
Public Types | |
enum | Mode { RECORD_INTERVAL_MODE, RECORD_KEY_MODE, PLAY_MODE, INACTIVE_MODE } |
RECORD_INTERVAL_MODE: Automatically add one frame per second to the spline, reading from the camera. More... | |
Public Member Functions | |
virtual Rect2D | bounds () const override |
Inherited from Surface2D. More... | |
const shared_ptr< Camera > & | camera () const |
shared_ptr< Camera > | camera () |
void | clear () |
Destroys the current path. More... | |
virtual float | depth () const override |
Inherited from Surface2D. More... | |
virtual bool | enabled () const |
SplineExtrapolationMode::Value | extrapolationMode () const |
virtual void | fireEvent (const GEvent &event) |
Fire an event on the containing window. More... | |
virtual CoordinateFrame | frame () const |
virtual void | getFrame (CoordinateFrame &c) const |
WidgetManager * | manager () const |
Mode | mode () const |
virtual void | onAfterEvents () |
Invoked after all onEvent handlers for the current frame and before onUserInput for any other Widget. More... | |
virtual void | onAI () |
virtual void | onBeforeGraphics () |
Invoked by WidgetManager immediately before GApp::onGraphics runs. More... | |
virtual bool | onEvent (const GEvent &event) |
Returning true consumes the event and prevents other GModules from seeing it. More... | |
virtual void | onNetwork () |
virtual void | onPose (Array< shared_ptr< Surface > > &posedArray, Array< shared_ptr< Surface2D > > &posed2DArray) |
Appends a posed model for this object to the array, if it has a graphic representation. More... | |
virtual void | onSimulation (RealTime rdt, SimTime sdt, SimTime idt) |
virtual void | onUserInput (UserInput *ui) |
const Color3 & | pathColor () const |
virtual float | positionalEventZ (const Point2 &pixel) const |
The camera-space z position that this Widget considers this pixel to be at. More... | |
GKey | recordKey () const |
virtual void | render (RenderDevice *rd) const override |
Inherited from Surface2D. More... | |
void | setCamera (const shared_ptr< Camera > &c) |
Sets the camera from which the frame will be read when recording. More... | |
virtual void | setDepth (float d) |
Called by the WidgetManager. More... | |
virtual void | setEnabled (bool b) |
void | setExtrapolationMode (SplineExtrapolationMode::Value m) |
virtual void | setFrame (const CFrame &c) |
By default, does nothing. More... | |
virtual void | setManager (WidgetManager *m) |
Called by the WidgetManager when this module is added to it. More... | |
void | setMode (Mode m) |
Setting the mode to RECORD_KEY_MODE and RECORD_INTERVAL_MODE require that a non-nullptr camera have previously been set. More... | |
void | setPathColor (const Color3 &c) |
void | setRecordKey (GKey k) |
void | setShowPath (bool b) |
If set to true, the camera's path is shown as a glowing curve. More... | |
void | setSpline (const UprightSpline &s) |
void | setTime (double t) |
Time since the beginning of recording or playback. More... | |
bool | showPath () const |
const UprightSpline & | spline () const |
Returns the underlying spline. More... | |
int | splineSize () const |
Number of control points. More... | |
double | time () const |
virtual OSWindow * | window () const |
Returns the operating system window that is currently rendering this Widget. More... | |
Static Public Member Functions | |
static shared_ptr< UprightSplineManipulator > | create (const shared_ptr< class Camera > &c=shared_ptr< Camera >()) |
static void | sort (Array< shared_ptr< Surface2D >> &array) |
Sorts from farthest to nearest. More... | |
static void | sortAndRender (RenderDevice *rd, Array< shared_ptr< Surface2D >> &array) |
Calls sort, RenderDevice::push2D, and then render on all elements. More... | |
Protected Member Functions | |
UprightSplineManipulator () | |
UprightSplineManipulator & | operator= (const UprightSplineManipulator &) |
Static Protected Member Functions | |
template<class T , class ... ArgTypes> | |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
Like std::make_shared, but works for protected constructors. More... | |
Protected Attributes | |
shared_ptr< class Camera > | m_camera |
CoordinateFrame | m_currentFrame |
float | m_depth |
WidgetManager * | m_manager |
The manager, set by setManager(). More... | |
Mode | m_mode |
Color3 | m_pathColor |
GKey | m_recordKey |
const float | m_sampleRate |
samples per second More... | |
bool | m_showPath |
UprightSpline | m_spline |
RealTime | m_time |
Current time during playback. More... | |
Allows recording and playback of a G3D::UprightSpline based on a G3D::Camera.
Used by G3D::CameraControlWindow.
RECORD_INTERVAL_MODE: Automatically add one frame per second to the spline, reading from the camera.
RECORD_KEY_MODE: Add one frame every time the recordKey() is pressed.
PLAY_MODE: Move the frame() through the spline over time. Does not mutate the camera.
INACTIVE_MODE: Do nothing.
The manipulator begins in INACTIVE_MODE.
Enumerator | |
---|---|
RECORD_INTERVAL_MODE | |
RECORD_KEY_MODE | |
PLAY_MODE | |
INACTIVE_MODE |
|
protected |
|
inlineoverridevirtualinherited |
Inherited from Surface2D.
Implements G3D::Surface2D.
Reimplemented in G3D::GuiWindow, G3D::GConsole, and G3D::FullScreenWidget.
|
inline |
|
inline |
void G3D::UprightSplineManipulator::clear | ( | ) |
Destroys the current path.
|
static |
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
|
inlineoverridevirtualinherited |
Inherited from Surface2D.
Controls the depth of objects when rendering. Subclasses may override this but it can interfere with the normal handling of rendering and event delivery. depth = 0 is usually the "top" widget and depth = 1 is usually the "bottom" widget.
Implements G3D::Surface2D.
Reimplemented in G3D::GuiWindow, G3D::GConsole, and G3D::FullScreenWidget.
|
inlinevirtualinherited |
Reimplemented in G3D::ThirdPersonManipulator, and G3D::FirstPersonManipulator.
|
inline |
|
virtualinherited |
Fire an event on the containing window.
Reimplemented in G3D::WidgetManager.
|
virtual |
Implements G3D::Manipulator.
|
virtual |
Implements G3D::Manipulator.
|
inlineinherited |
Mode G3D::UprightSplineManipulator::mode | ( | ) | const |
|
inlinevirtualinherited |
Invoked after all onEvent handlers for the current frame and before onUserInput for any other Widget.
Reimplemented in G3D::WidgetManager, and G3D::GameController.
|
inlinevirtual |
Reimplemented from G3D::Widget.
|
inlinevirtualinherited |
Invoked by WidgetManager immediately before GApp::onGraphics runs.
Reimplemented in G3D::WidgetManager, G3D::CallbackWidget, and G3D::XRWidget.
|
virtual |
Returning true consumes the event and prevents other GModules from seeing it.
Motion events (GEventType::MOUSEMOTION, GEventType::JOYHATMOTION, JGEventType::OYBALLMOTION, and GEventType::JOYAXISMOTION) cannot be cancelled.
Reimplemented from G3D::Widget.
|
inlinevirtual |
Reimplemented from G3D::Widget.
|
virtual |
Appends a posed model for this object to the array, if it has a graphic representation.
The posed model appended is allowed to reference the agent and is allowed to mutate if the agent is mutated.
Reimplemented from G3D::Widget.
|
virtual |
Reimplemented from G3D::Widget.
|
virtual |
Reimplemented from G3D::Widget.
|
protected |
|
inline |
|
inlinevirtualinherited |
The camera-space z position that this Widget considers this pixel to be at.
Used for positional event (e.g., mouse click) delivery. Higher means closer.
Large negative values are far away. 0 is the closest 3D object. Values greater than zero are used for 2D objects. Returning fnan() [the default] requests the WidgetManager to set hte positionalEventZ to the object's normal event zorder.
See the implementation of ControlPointEditor::positionalEventZ for an example of how to use this with a 3D object.
Reimplemented in G3D::ControlPointEditor.
|
inline |
|
inlineoverridevirtualinherited |
Inherited from Surface2D.
Implements G3D::Surface2D.
Reimplemented in G3D::GConsole, G3D::GuiWindow, G3D::GuiMenu, and G3D::DebugTextWidget.
|
inline |
Sets the camera from which the frame will be read when recording.
Argument may be nullptr, but recording cannot proceed until this is non-null.
This camera will also be used for playback
|
inlinevirtualinherited |
Called by the WidgetManager.
This is the depth that the Widget is expected to use when posed as a Surface2D. Subclasses may override or ignore this but it can interfere with the normal handling of rendering.
|
inlinevirtualinherited |
Reimplemented in G3D::ThirdPersonManipulator, and G3D::FirstPersonManipulator.
|
inline |
|
inlinevirtualinherited |
By default, does nothing.
|
inlinevirtualinherited |
Called by the WidgetManager when this module is added to it.
The argument may be nullptr
Reimplemented in G3D::SceneEditorWindow, G3D::ControlPointEditor, G3D::CameraControlWindow, G3D::GameController, G3D::DeveloperWindow, G3D::ProfilerWindow, G3D::TextureBrowserWindow, and G3D::SettingsWindow.
void G3D::UprightSplineManipulator::setMode | ( | Mode | m | ) |
Setting the mode to RECORD_KEY_MODE and RECORD_INTERVAL_MODE require that a non-nullptr camera have previously been set.
When in INACTIVE_MODE, time does not elapse for the manipulator.
|
inline |
|
inline |
|
inline |
If set to true, the camera's path is shown as a glowing curve.
|
inline |
void G3D::UprightSplineManipulator::setTime | ( | double | t | ) |
Time since the beginning of recording or playback.
|
inline |
Sorts from farthest to nearest.
|
staticinherited |
Calls sort, RenderDevice::push2D, and then render on all elements.
|
inline |
Returns the underlying spline.
|
inline |
Number of control points.
|
inline |
|
virtualinherited |
Returns the operating system window that is currently rendering this Widget.
Reimplemented in G3D::WidgetManager.
Referenced by G3D::FullScreenWidget::bounds().
|
protected |
Referenced by camera(), and setCamera().
|
protected |
|
protectedinherited |
Referenced by G3D::Widget::depth(), and G3D::Widget::setDepth().
|
protectedinherited |
The manager, set by setManager().
This cannot be a reference counted pointer because that would create a cycle between the Widget and its manager.
Referenced by G3D::Widget::manager(), G3D::GuiWindow::manager(), G3D::Widget::setManager(), and G3D::GuiWindow::setVisible().
|
protected |
|
protected |
Referenced by pathColor(), and setPathColor().
|
protected |
Referenced by recordKey(), and setRecordKey().
|
protected |
samples per second
|
protected |
Referenced by setShowPath(), and showPath().
|
protected |
Referenced by extrapolationMode(), setExtrapolationMode(), setSpline(), spline(), and splineSize().