Support Forum G3D Web Page |
By default, the ThirdPersonManipulator moves an object relative to its own axes. More...
Inherits G3D::Manipulator.
Public Member Functions | |
virtual Rect2D | bounds () const override |
Inherited from Surface2D. More... | |
void | computeProjection (RenderDevice *rd) const |
Assumes that m_controlFrame is the current object to world matrix. More... | |
virtual float | depth () const override |
Inherited from Surface2D. More... | |
Vector3 | doubleAxisTranslationDrag (int a0, int a1, const Vector2 &delta) |
bool | enabled () const |
virtual void | fireEvent (const GEvent &event) |
Fire an event on the containing window. More... | |
virtual CoordinateFrame | frame () const |
void | getControlFrame (CoordinateFrame &c) const |
void | getFrame (CoordinateFrame &c) const |
Returns the object's new frame. More... | |
WidgetManager * | manager () 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 void | onDrag (const Vector2 &delta) |
Called when the user has dragged on the control. More... | |
virtual void | onDragBegin (const Vector2 &start) |
Called when it has been determined that the user first began a drag on one of our controls. More... | |
virtual void | onDragEnd (const Vector2 &stop) |
Invoked after m_dragging is false. More... | |
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 > > &surfaceArray, Array< shared_ptr< Surface2D > > &surface2DArray) |
Appends a posed model for this object to the array, if it has a graphic representation. More... | |
virtual void | onPose (Array< shared_ptr< Surface > > &posedArray, Array< shared_ptr< Surface2D >> &posed2DArray) |
void | onSimulation (RealTime rdt, SimTime sdt, SimTime idt) |
void | onUserInput (UserInput *ui) |
virtual float | positionalEventZ (const Point2 &pixel) const |
The camera-space z position that this Widget considers this pixel to be at. More... | |
virtual void | render (RenderDevice *rd) const override |
Inherited from Surface2D. More... | |
virtual void | render3D (RenderDevice *rd) |
Called by the Surface. More... | |
bool | rotationEnabled () const |
void | setControlFrame (const CoordinateFrame &c) |
Keeps the object where it in world space is and moves the control in world space. More... | |
virtual void | setDepth (float d) |
Called by the WidgetManager. More... | |
void | setEnabled (bool e) |
void | setFrame (const CoordinateFrame &c) |
Moves the object and the control in world space. More... | |
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 | setRotationEnabled (bool r) |
void | setTranslationEnabled (bool r) |
Vector3 | singleAxisTranslationDrag (int a, const Vector2 &delta) |
Called from onDrag. More... | |
bool | translationEnabled () const |
virtual OSWindow * | window () const |
Returns the operating system window that is currently rendering this Widget. More... | |
Static Public Member Functions | |
static CoordinateFrame | computeOffsetFrame (const CoordinateFrame &controlFrame, const CoordinateFrame &objectFrame) |
Given the desired start frame for the axes and the desired frame for the object, returns the offsetFrame that should be used t. More... | |
static ThirdPersonManipulatorRef | create () |
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 | |
ThirdPersonManipulator () | |
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 | |
float | m_depth |
WidgetManager * | m_manager |
The manager, set by setManager(). More... | |
Friends | |
class | TPMSurface |
By default, the ThirdPersonManipulator moves an object relative to its own axes.
To move the object relative to the world axes, use setOffsetFrame.
To manipulate an object, set that object's coordinate frame to the frame(), as in:
shared_ptr<Surface> posedModel = model->pose(manipulator->frame());
(see the shader demo for an example)
Examples:
CoordinateFrame obj = CoordinateFrame(Matrix3::fromAxisAngle(Vector3::unitY(), toRadians(30)), Vector3(2, 0, 0));
// To move object relative to its own axes manipulator.setFrame(obj); manipulator.setControlFrame(obj);
// Move object relative to the world axes manipulator.setFrame(obj); manipulator.setControlFrame(CoordinateFrame());
// Move object relative to the world axes using its own translation manipulator.setFrame(obj); manipulator.setControlFrame(CoordinateFrame(obj.translation));
|
protected |
|
inlineoverridevirtualinherited |
Inherited from Surface2D.
Implements G3D::Surface2D.
Reimplemented in G3D::GuiWindow, G3D::GConsole, and G3D::FullScreenWidget.
|
static |
Given the desired start frame for the axes and the desired frame for the object, returns the offsetFrame that should be used t.
void G3D::ThirdPersonManipulator::computeProjection | ( | RenderDevice * | rd | ) | const |
Assumes that m_controlFrame is the current object to world matrix.
|
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.
Vector3 G3D::ThirdPersonManipulator::doubleAxisTranslationDrag | ( | int | a0, |
int | a1, | ||
const Vector2 & | delta | ||
) |
|
virtual |
Reimplemented from G3D::Manipulator.
|
virtualinherited |
Fire an event on the containing window.
Reimplemented in G3D::WidgetManager.
|
virtual |
Implements G3D::Manipulator.
void G3D::ThirdPersonManipulator::getControlFrame | ( | CoordinateFrame & | c | ) | const |
|
virtual |
Returns the object's new frame.
Implements G3D::Manipulator.
|
inlineinherited |
|
inlinevirtualinherited |
Invoked after all onEvent handlers for the current frame and before onUserInput for any other Widget.
Reimplemented in G3D::WidgetManager, and G3D::GameController.
|
virtual |
Reimplemented from G3D::Widget.
|
inlinevirtualinherited |
Invoked by WidgetManager immediately before GApp::onGraphics runs.
Reimplemented in G3D::WidgetManager, G3D::CallbackWidget, and G3D::XRWidget.
|
virtual |
Called when the user has dragged on the control.
|
virtual |
Called when it has been determined that the user first began a drag on one of our controls.
Invoked before m_dragging is true.
|
virtual |
Invoked after m_dragging is false.
|
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.
|
virtual |
Reimplemented from G3D::Widget.
|
inlinevirtualinherited |
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 in G3D::GuiWindow, G3D::WidgetManager, G3D::Discovery::Client, G3D::SceneEditorWindow, G3D::CallbackWidget, G3D::FullScreenWidget, G3D::UprightSplineManipulator, and G3D::ControlPointEditor.
|
virtual |
Reimplemented from G3D::Widget.
|
virtual |
Reimplemented from G3D::Widget.
|
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.
|
inlineoverridevirtualinherited |
Inherited from Surface2D.
Implements G3D::Surface2D.
Reimplemented in G3D::GConsole, G3D::GuiWindow, G3D::GuiMenu, and G3D::DebugTextWidget.
|
virtual |
Called by the Surface.
bool G3D::ThirdPersonManipulator::rotationEnabled | ( | ) | const |
void G3D::ThirdPersonManipulator::setControlFrame | ( | const CoordinateFrame & | c | ) |
Keeps the object where it in world space is and moves the control in world space.
Changes the value of frame() constant.
|
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.
|
virtual |
Reimplemented from G3D::Manipulator.
void G3D::ThirdPersonManipulator::setFrame | ( | const CoordinateFrame & | c | ) |
Moves the object and the control in world space.
|
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::ThirdPersonManipulator::setRotationEnabled | ( | bool | r | ) |
void G3D::ThirdPersonManipulator::setTranslationEnabled | ( | bool | r | ) |
Called from onDrag.
a | Axis index. |
Sorts from farthest to nearest.
|
staticinherited |
Calls sort, RenderDevice::push2D, and then render on all elements.
bool G3D::ThirdPersonManipulator::translationEnabled | ( | ) | const |
|
virtualinherited |
Returns the operating system window that is currently rendering this Widget.
Reimplemented in G3D::WidgetManager.
Referenced by G3D::FullScreenWidget::bounds().
|
friend |
|
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().