Support Forum       G3D Web Page     
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::UprightSplineManipulator Class Reference


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< Cameracamera ()
 
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
 
WidgetManagermanager () 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 Color3pathColor () 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 UprightSplinespline () const
 Returns the underlying spline. More...
 
int splineSize () const
 Number of control points. More...
 
double time () const
 
virtual OSWindowwindow () const
 Returns the operating system window that is currently rendering this Widget. More...
 

Static Public Member Functions

static shared_ptr< UprightSplineManipulatorcreate (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 ()
 
UprightSplineManipulatoroperator= (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 Cameram_camera
 
CoordinateFrame m_currentFrame
 
float m_depth
 
WidgetManagerm_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...
 

Detailed Description


Allows recording and playback of a G3D::UprightSpline based on a G3D::Camera.

Used by G3D::CameraControlWindow.

See also
G3D::UprightFrame, G3D::UprightSpline, G3D::FirstPersonManipulator

Member Enumeration Documentation

◆ Mode

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 

Constructor & Destructor Documentation

◆ UprightSplineManipulator()

G3D::UprightSplineManipulator::UprightSplineManipulator ( )
protected

Member Function Documentation

◆ bounds()

virtual Rect2D G3D::Widget::bounds ( ) const
inlineoverridevirtualinherited

Inherited from Surface2D.

Implements G3D::Surface2D.

Reimplemented in G3D::GuiWindow, G3D::GConsole, and G3D::FullScreenWidget.

◆ camera() [1/2]

const shared_ptr<Camera>& G3D::UprightSplineManipulator::camera ( ) const
inline

◆ camera() [2/2]

shared_ptr<Camera> G3D::UprightSplineManipulator::camera ( )
inline

◆ clear()

void G3D::UprightSplineManipulator::clear ( )

Destroys the current path.

◆ create()

static shared_ptr<UprightSplineManipulator> G3D::UprightSplineManipulator::create ( const shared_ptr< class Camera > &  c = shared_ptr< Camera >())
static

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ depth()

virtual float G3D::Widget::depth ( ) const
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.

◆ enabled()

virtual bool G3D::Manipulator::enabled ( ) const
inlinevirtualinherited

◆ extrapolationMode()

SplineExtrapolationMode::Value G3D::UprightSplineManipulator::extrapolationMode ( ) const
inline

◆ fireEvent()

virtual void G3D::Widget::fireEvent ( const GEvent event)
virtualinherited

Fire an event on the containing window.

Reimplemented in G3D::WidgetManager.

◆ frame()

virtual CoordinateFrame G3D::UprightSplineManipulator::frame ( ) const
virtual

Implements G3D::Manipulator.

◆ getFrame()

virtual void G3D::UprightSplineManipulator::getFrame ( CoordinateFrame c) const
virtual

Implements G3D::Manipulator.

◆ manager()

WidgetManager* G3D::Widget::manager ( ) const
inlineinherited

◆ mode()

Mode G3D::UprightSplineManipulator::mode ( ) const

◆ onAfterEvents()

virtual void G3D::Widget::onAfterEvents ( )
inlinevirtualinherited

Invoked after all onEvent handlers for the current frame and before onUserInput for any other Widget.

Reimplemented in G3D::WidgetManager, and G3D::GameController.

◆ onAI()

virtual void G3D::UprightSplineManipulator::onAI ( )
inlinevirtual

Reimplemented from G3D::Widget.

◆ onBeforeGraphics()

virtual void G3D::Widget::onBeforeGraphics ( )
inlinevirtualinherited

Invoked by WidgetManager immediately before GApp::onGraphics runs.

Reimplemented in G3D::WidgetManager, G3D::CallbackWidget, and G3D::XRWidget.

◆ onEvent()

virtual bool G3D::UprightSplineManipulator::onEvent ( const GEvent event)
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.

◆ onNetwork()

virtual void G3D::UprightSplineManipulator::onNetwork ( )
inlinevirtual

Reimplemented from G3D::Widget.

◆ onPose()

virtual void G3D::UprightSplineManipulator::onPose ( Array< shared_ptr< Surface > > &  surfaceArray,
Array< shared_ptr< Surface2D > > &  surface2DArray 
)
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.

◆ onSimulation()

virtual void G3D::UprightSplineManipulator::onSimulation ( RealTime  rdt,
SimTime  sdt,
SimTime  idt 
)
virtual

Reimplemented from G3D::Widget.

◆ onUserInput()

virtual void G3D::UprightSplineManipulator::onUserInput ( UserInput ui)
virtual

Reimplemented from G3D::Widget.

◆ operator=()

UprightSplineManipulator& G3D::UprightSplineManipulator::operator= ( const UprightSplineManipulator )
protected

◆ pathColor()

const Color3& G3D::UprightSplineManipulator::pathColor ( ) const
inline

◆ positionalEventZ()

virtual float G3D::Widget::positionalEventZ ( const Point2 pixel) const
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.

◆ recordKey()

GKey G3D::UprightSplineManipulator::recordKey ( ) const
inline

◆ render()

virtual void G3D::Widget::render ( RenderDevice rd) const
inlineoverridevirtualinherited

Inherited from Surface2D.

Implements G3D::Surface2D.

Reimplemented in G3D::GConsole, G3D::GuiWindow, G3D::GuiMenu, and G3D::DebugTextWidget.

◆ setCamera()

void G3D::UprightSplineManipulator::setCamera ( const shared_ptr< Camera > &  c)
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

◆ setDepth()

virtual void G3D::Widget::setDepth ( float  d)
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.

◆ setEnabled()

virtual void G3D::Manipulator::setEnabled ( bool  b)
inlinevirtualinherited

◆ setExtrapolationMode()

void G3D::UprightSplineManipulator::setExtrapolationMode ( SplineExtrapolationMode::Value  m)
inline

◆ setFrame()

virtual void G3D::Manipulator::setFrame ( const CFrame c)
inlinevirtualinherited

By default, does nothing.

◆ setManager()

virtual void G3D::Widget::setManager ( WidgetManager m)
inlinevirtualinherited

◆ setMode()

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.

◆ setPathColor()

void G3D::UprightSplineManipulator::setPathColor ( const Color3 c)
inline

◆ setRecordKey()

void G3D::UprightSplineManipulator::setRecordKey ( GKey  k)
inline

◆ setShowPath()

void G3D::UprightSplineManipulator::setShowPath ( bool  b)
inline

If set to true, the camera's path is shown as a glowing curve.

◆ setSpline()

void G3D::UprightSplineManipulator::setSpline ( const UprightSpline s)
inline

◆ setTime()

void G3D::UprightSplineManipulator::setTime ( double  t)

Time since the beginning of recording or playback.

◆ showPath()

bool G3D::UprightSplineManipulator::showPath ( ) const
inline

◆ sort()

static void G3D::Surface2D::sort ( Array< shared_ptr< Surface2D >> &  array)
staticinherited

Sorts from farthest to nearest.

◆ sortAndRender()

static void G3D::Surface2D::sortAndRender ( RenderDevice rd,
Array< shared_ptr< Surface2D >> &  array 
)
staticinherited

Calls sort, RenderDevice::push2D, and then render on all elements.

◆ spline()

const UprightSpline& G3D::UprightSplineManipulator::spline ( ) const
inline

Returns the underlying spline.

◆ splineSize()

int G3D::UprightSplineManipulator::splineSize ( ) const
inline

Number of control points.

◆ time()

double G3D::UprightSplineManipulator::time ( ) const
inline

◆ window()

virtual OSWindow* G3D::Widget::window ( ) const
virtualinherited

Returns the operating system window that is currently rendering this Widget.

Reimplemented in G3D::WidgetManager.

Referenced by G3D::FullScreenWidget::bounds().

Member Data Documentation

◆ m_camera

shared_ptr<class Camera> G3D::UprightSplineManipulator::m_camera
protected

Referenced by camera(), and setCamera().

◆ m_currentFrame

CoordinateFrame G3D::UprightSplineManipulator::m_currentFrame
protected

◆ m_depth

float G3D::Widget::m_depth
protectedinherited

◆ m_manager

WidgetManager* G3D::Widget::m_manager
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().

◆ m_mode

Mode G3D::UprightSplineManipulator::m_mode
protected

◆ m_pathColor

Color3 G3D::UprightSplineManipulator::m_pathColor
protected

Referenced by pathColor(), and setPathColor().

◆ m_recordKey

GKey G3D::UprightSplineManipulator::m_recordKey
protected

Referenced by recordKey(), and setRecordKey().

◆ m_sampleRate

const float G3D::UprightSplineManipulator::m_sampleRate
protected

samples per second

◆ m_showPath

bool G3D::UprightSplineManipulator::m_showPath
protected

Referenced by setShowPath(), and showPath().

◆ m_spline

UprightSpline G3D::UprightSplineManipulator::m_spline
protected

◆ m_time

RealTime G3D::UprightSplineManipulator::m_time
protected

Current time during playback.

Referenced by time().


documentation generated on Wed Nov 24 2021 08:02:01 using doxygen 1.8.15