Open3D (C++ API)
Data Structures | Public Types | Public Member Functions
open3d::gui::SceneWidget Class Reference

#include <SceneWidget.h>

Inheritance diagram for open3d::gui::SceneWidget:
open3d::gui::Widget

Data Structures

struct  Impl
 
struct  ModelDescription
 

Public Types

enum  Controls {
  ROTATE_OBJ, FLY, ROTATE_SUN, ROTATE_IBL,
  ROTATE_MODEL
}
 
enum  Quality { Quality::FAST, Quality::BEST }
 
enum  CameraPreset { CameraPreset::PLUS_X, CameraPreset::PLUS_Y, CameraPreset::PLUS_Z }
 
- Public Types inherited from open3d::gui::Widget
enum  DrawResult { DrawResult::NONE, DrawResult::REDRAW, DrawResult::RELAYOUT }
 
enum  EventResult { EventResult::IGNORED, EventResult::CONSUMED, EventResult::DISCARD }
 

Public Member Functions

 SceneWidget (visualization::Scene &scene)
 
 ~SceneWidget () override
 
void SetFrame (const Rect &f) override
 
void SetBackgroundColor (const Color &color)
 
void SetDiscardBuffers (const visualization::View::TargetBuffers &buffers)
 
void SetViewControls (Controls mode)
 
void SetupCamera (float verticalFoV, const geometry::AxisAlignedBoundingBox &geometry_bounds, const Eigen::Vector3f &center_of_rotation)
 
void SetCameraChangedCallback (std::function< void(visualization::Camera *)> on_cam_changed)
 
void SelectDirectionalLight (visualization::LightHandle dirLight, std::function< void(const Eigen::Vector3f &)> on_dir_changed)
 
void SetSkyboxHandle (visualization::SkyboxHandle skybox, bool is_on)
 Enables showing the skybox while in skybox ROTATE_IBL mode. More...
 
void SetModel (const ModelDescription &desc)
 
void SetRenderQuality (Quality level)
 
Quality GetRenderQuality () const
 
void GoToCameraPreset (CameraPreset preset)
 
visualization::ViewGetView () const
 
visualization::SceneGetScene () const
 
Widget::DrawResult Draw (const DrawContext &context) override
 
Widget::EventResult Mouse (const MouseEvent &e) override
 
Widget::EventResult Key (const KeyEvent &e) override
 
Widget::DrawResult Tick (const TickEvent &e) override
 
- Public Member Functions inherited from open3d::gui::Widget
 Widget ()
 
 Widget (const std::vector< std::shared_ptr< Widget >> &children)
 
virtual ~Widget ()
 
void AddChild (std::shared_ptr< Widget > child)
 
const std::vector< std::shared_ptr< Widget > > GetChildren () const
 
const RectGetFrame () const
 Returns the frame size in pixels. More...
 
const ColorGetBackgroundColor () const
 
bool IsDefaultBackgroundColor () const
 
void SetBackgroundColor (const Color &color)
 
bool IsVisible () const
 
virtual void SetVisible (bool vis)
 
bool IsEnabled () const
 
virtual void SetEnabled (bool enabled)
 
virtual Size CalcPreferredSize (const Theme &theme) const
 
virtual void Layout (const Theme &theme)
 

Additional Inherited Members

- Static Public Attributes inherited from open3d::gui::Widget
static constexpr int DIM_GROW = 10000
 
- Protected Member Functions inherited from open3d::gui::Widget
void DrawImGuiPushEnabledState ()
 
void DrawImGuiPopEnabledState ()
 

Member Enumeration Documentation

◆ CameraPreset

Enumerator
PLUS_X 
PLUS_Y 
PLUS_Z 

◆ Controls

Enumerator
ROTATE_OBJ 
FLY 
ROTATE_SUN 
ROTATE_IBL 
ROTATE_MODEL 

◆ Quality

Enumerator
FAST 
BEST 

Constructor & Destructor Documentation

◆ SceneWidget()

open3d::gui::SceneWidget::SceneWidget ( visualization::Scene scene)
explicit

◆ ~SceneWidget()

open3d::gui::SceneWidget::~SceneWidget ( )
override

Member Function Documentation

◆ Draw()

Widget::DrawResult open3d::gui::SceneWidget::Draw ( const DrawContext context)
overridevirtual

Draws the widget. If this is a Dear ImGUI widget, this is where the actual event processing happens. Return NONE if no action needs to be taken, REDRAW if the widget needs to be redrawn (e.g. its value changed), and RELAYOUT if the widget wishes to change size.

Reimplemented from open3d::gui::Widget.

◆ GetRenderQuality()

SceneWidget::Quality open3d::gui::SceneWidget::GetRenderQuality ( ) const

◆ GetScene()

visualization::Scene * open3d::gui::SceneWidget::GetScene ( ) const

◆ GetView()

visualization::View * open3d::gui::SceneWidget::GetView ( ) const

◆ GoToCameraPreset()

void open3d::gui::SceneWidget::GoToCameraPreset ( CameraPreset  preset)

◆ Key()

Widget::EventResult open3d::gui::SceneWidget::Key ( const KeyEvent e)
overridevirtual

Widgets that use Dear ImGUI should not need to override this, as Dear ImGUI will take care of all the key handling during the Draw().

Reimplemented from open3d::gui::Widget.

◆ Mouse()

Widget::EventResult open3d::gui::SceneWidget::Mouse ( const MouseEvent e)
overridevirtual

Widgets that use Dear ImGUI should not need to override this, as Dear ImGUI will take care of all the mouse handling during the Draw().

Reimplemented from open3d::gui::Widget.

◆ SelectDirectionalLight()

void open3d::gui::SceneWidget::SelectDirectionalLight ( visualization::LightHandle  dirLight,
std::function< void(const Eigen::Vector3f &)>  on_dir_changed 
)

Enables changing the directional light with the mouse. SceneWidget will update the light's direction, so onDirChanged is only needed if other things need to be updated (like a UI).

◆ SetBackgroundColor()

void open3d::gui::SceneWidget::SetBackgroundColor ( const Color color)

◆ SetCameraChangedCallback()

void open3d::gui::SceneWidget::SetCameraChangedCallback ( std::function< void(visualization::Camera *)>  on_cam_changed)

◆ SetDiscardBuffers()

void open3d::gui::SceneWidget::SetDiscardBuffers ( const visualization::View::TargetBuffers buffers)

◆ SetFrame()

void open3d::gui::SceneWidget::SetFrame ( const Rect f)
overridevirtual

The frame is in pixels. The size of a pixel varies on different and operatings sytems now frequently scale text sizes on high DPI monitors. Prefer using a Layout to using this function, but if you must use it, it is best to use a multiple of Window::GetTheme().fontSize, which represents 1em and is scaled according to the scaling factor of the window.

Reimplemented from open3d::gui::Widget.

◆ SetModel()

void open3d::gui::SceneWidget::SetModel ( const ModelDescription desc)

◆ SetRenderQuality()

void open3d::gui::SceneWidget::SetRenderQuality ( Quality  level)

◆ SetSkyboxHandle()

void open3d::gui::SceneWidget::SetSkyboxHandle ( visualization::SkyboxHandle  skybox,
bool  is_on 
)

Enables showing the skybox while in skybox ROTATE_IBL mode.

◆ SetupCamera()

void open3d::gui::SceneWidget::SetupCamera ( float  verticalFoV,
const geometry::AxisAlignedBoundingBox geometry_bounds,
const Eigen::Vector3f &  center_of_rotation 
)

◆ SetViewControls()

void open3d::gui::SceneWidget::SetViewControls ( Controls  mode)

◆ Tick()

Widget::DrawResult open3d::gui::SceneWidget::Tick ( const TickEvent e)
overridevirtual

Tick events are sent regularly and allow for things like smoothly moving the camera based on keys that are pressed, or animations. Return DrawResult::REDRAW if you want to be redrawn.

Reimplemented from open3d::gui::Widget.


The documentation for this class was generated from the following files: