Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
GUIScene Class Reference

#include <guiScene.h>

+ Inheritance diagram for GUIScene:
+ Collaboration diagram for GUIScene:

Public Member Functions

 GUIScene (gui::IGUIEnvironment *env, scene::ISceneManager *smgr, gui::IGUIElement *parent, core::recti rect, s32 id=-1)
 
 ~GUIScene ()
 
scene::IAnimatedMeshSceneNode * setMesh (scene::IAnimatedMesh *mesh=nullptr)
 
void setTexture (u32 idx, video::ITexture *texture)
 
void setBackgroundColor (const video::SColor &color) noexcept
 
void setFrameLoop (f32 begin, f32 end)
 Sets the frame loop range for the mesh.
 
void setAnimationSpeed (f32 speed)
 Sets the animation speed (FPS) for the mesh.
 
void enableMouseControl (bool enable) noexcept
 
void setRotation (v2f rot) noexcept
 
void enableContinuousRotation (bool enable) noexcept
 
void setStyles (const std::array< StyleSpec, StyleSpec::NUM_STATES > &styles)
 
virtual void draw ()
 
virtual bool OnEvent (const SEvent &event)
 

Private Member Functions

void calcOptimalDistance ()
 
void updateTargetPos ()
 
void updateCamera (scene::ISceneNode *target)
 
void setCameraRotation (v3f rot)
 
bool correctBounds (v3f &rot)
 
void cameraLoop ()
 
void updateCameraPos ()
 
v3f getCameraRotation () const
 
void rotateCamera (const v3f &delta)
 

Private Attributes

scene::ISceneManager * m_smgr
 
video::IVideoDriver * m_driver
 
scene::ICameraSceneNode * m_cam
 
scene::ISceneNode * m_target = nullptr
 
scene::IAnimatedMeshSceneNode * m_mesh = nullptr
 
f32 m_cam_distance = 50.f
 
u64 m_last_time = 0
 
v3f m_cam_pos
 
v3f m_target_pos
 
v3f m_last_target_pos
 
v2f m_curr_pos
 
v2f m_last_pos
 
v2f m_custom_rot
 
bool m_mouse_ctrl = true
 
bool m_update_cam = false
 
bool m_inf_rot = false
 
bool m_initial_rotation = true
 
video::SColor m_bgcolor = 0
 

Constructor & Destructor Documentation

◆ GUIScene()

GUIScene::GUIScene ( gui::IGUIEnvironment * env,
scene::ISceneManager * smgr,
gui::IGUIElement * parent,
core::recti rect,
s32 id = -1 )

References m_cam, m_driver, and m_smgr.

◆ ~GUIScene()

GUIScene::~GUIScene ( )

References m_smgr, and setMesh().

+ Here is the call graph for this function:

Member Function Documentation

◆ calcOptimalDistance()

void GUIScene::calcOptimalDistance ( )
inlineprivate

References m_cam, m_cam_distance, m_mesh, and m_update_cam.

Referenced by draw().

+ Here is the caller graph for this function:

◆ cameraLoop()

void GUIScene::cameraLoop ( )
private

References correctBounds(), getCameraRotation(), m_cam, m_cam_distance, m_cam_pos, m_last_target_pos, m_target_pos, m_update_cam, setCameraRotation(), updateCameraPos(), and updateTargetPos().

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ correctBounds()

bool GUIScene::correctBounds ( v3f & rot)
private
Returns
true indicates that the rotation was corrected

Referenced by cameraLoop(), and setCameraRotation().

+ Here is the caller graph for this function:

◆ draw()

void GUIScene::draw ( )
virtual

References calcOptimalDistance(), cameraLoop(), porting::getDeltaMs(), porting::getTimeMs(), m_bgcolor, m_cam, m_custom_rot, m_driver, m_inf_rot, m_initial_rotation, m_last_time, m_mesh, m_smgr, m_target, rotateCamera(), and updateCamera().

+ Here is the call graph for this function:

◆ enableContinuousRotation()

void GUIScene::enableContinuousRotation ( bool enable)
inlinenoexcept

References m_inf_rot.

Referenced by GUIFormSpecMenu::parseModel().

+ Here is the caller graph for this function:

◆ enableMouseControl()

void GUIScene::enableMouseControl ( bool enable)
inlinenoexcept

References m_mouse_ctrl.

Referenced by GUIFormSpecMenu::parseModel().

+ Here is the caller graph for this function:

◆ getCameraRotation()

v3f GUIScene::getCameraRotation ( ) const
inlineprivate

References m_cam_pos, and m_target_pos.

Referenced by cameraLoop(), and rotateCamera().

+ Here is the caller graph for this function:

◆ OnEvent()

bool GUIScene::OnEvent ( const SEvent & event)
virtual

References m_curr_pos, m_last_pos, m_mouse_ctrl, and rotateCamera().

+ Here is the call graph for this function:

◆ rotateCamera()

void GUIScene::rotateCamera ( const v3f & delta)
inlineprivate

References getCameraRotation(), and setCameraRotation().

Referenced by draw(), and OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAnimationSpeed()

void GUIScene::setAnimationSpeed ( f32 speed)

Sets the animation speed (FPS) for the mesh.

References m_mesh.

Referenced by GUIFormSpecMenu::parseModel().

+ Here is the caller graph for this function:

◆ setBackgroundColor()

void GUIScene::setBackgroundColor ( const video::SColor & color)
inlinenoexcept

References m_bgcolor.

Referenced by setStyles().

+ Here is the caller graph for this function:

◆ setCameraRotation()

void GUIScene::setCameraRotation ( v3f rot)
private

References correctBounds(), m_cam, m_cam_distance, m_cam_pos, m_target_pos, and m_update_cam.

Referenced by cameraLoop(), and rotateCamera().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFrameLoop()

void GUIScene::setFrameLoop ( f32 begin,
f32 end )

Sets the frame loop range for the mesh.

References m_mesh.

Referenced by GUIFormSpecMenu::parseModel().

+ Here is the caller graph for this function:

◆ setMesh()

scene::IAnimatedMeshSceneNode * GUIScene::setMesh ( scene::IAnimatedMesh * mesh = nullptr)

References m_mesh, and m_smgr.

Referenced by ~GUIScene(), and GUIFormSpecMenu::parseModel().

+ Here is the caller graph for this function:

◆ setRotation()

void GUIScene::setRotation ( v2f rot)
inlinenoexcept

References m_custom_rot.

Referenced by GUIFormSpecMenu::parseModel().

+ Here is the caller graph for this function:

◆ setStyles()

void GUIScene::setStyles ( const std::array< StyleSpec, StyleSpec::NUM_STATES > & styles)

References StyleSpec::BGCOLOR, StyleSpec::getBool(), StyleSpec::getColor(), StyleSpec::getStyleFromStatePropagation(), m_bgcolor, StyleSpec::NOCLIP, setBackgroundColor(), and StyleSpec::STATE_DEFAULT.

Referenced by GUIFormSpecMenu::parseModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTexture()

void GUIScene::setTexture ( u32 idx,
video::ITexture * texture )

References idx, and m_mesh.

Referenced by GUIFormSpecMenu::parseModel().

+ Here is the caller graph for this function:

◆ updateCamera()

void GUIScene::updateCamera ( scene::ISceneNode * target)
private

References m_last_target_pos, m_target, m_target_pos, m_update_cam, updateCameraPos(), and updateTargetPos().

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCameraPos()

void GUIScene::updateCameraPos ( )
inlineprivate

References m_cam, and m_cam_pos.

Referenced by cameraLoop(), and updateCamera().

+ Here is the caller graph for this function:

◆ updateTargetPos()

void GUIScene::updateTargetPos ( )
private

References m_last_target_pos, m_target, and m_target_pos.

Referenced by cameraLoop(), and updateCamera().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_bgcolor

video::SColor GUIScene::m_bgcolor = 0
private

Referenced by draw(), setBackgroundColor(), and setStyles().

◆ m_cam

scene::ICameraSceneNode* GUIScene::m_cam
private

◆ m_cam_distance

f32 GUIScene::m_cam_distance = 50.f
private

◆ m_cam_pos

v3f GUIScene::m_cam_pos
private

◆ m_curr_pos

v2f GUIScene::m_curr_pos
private

Referenced by OnEvent().

◆ m_custom_rot

v2f GUIScene::m_custom_rot
private

Referenced by draw(), and setRotation().

◆ m_driver

video::IVideoDriver* GUIScene::m_driver
private

Referenced by GUIScene(), and draw().

◆ m_inf_rot

bool GUIScene::m_inf_rot = false
private

Referenced by draw(), and enableContinuousRotation().

◆ m_initial_rotation

bool GUIScene::m_initial_rotation = true
private

Referenced by draw().

◆ m_last_pos

v2f GUIScene::m_last_pos
private

Referenced by OnEvent().

◆ m_last_target_pos

v3f GUIScene::m_last_target_pos
private

◆ m_last_time

u64 GUIScene::m_last_time = 0
private

Referenced by draw().

◆ m_mesh

scene::IAnimatedMeshSceneNode* GUIScene::m_mesh = nullptr
private

◆ m_mouse_ctrl

bool GUIScene::m_mouse_ctrl = true
private

Referenced by enableMouseControl(), and OnEvent().

◆ m_smgr

scene::ISceneManager* GUIScene::m_smgr
private

Referenced by GUIScene(), ~GUIScene(), draw(), and setMesh().

◆ m_target

scene::ISceneNode* GUIScene::m_target = nullptr
private

Referenced by draw(), updateCamera(), and updateTargetPos().

◆ m_target_pos

v3f GUIScene::m_target_pos
private

◆ m_update_cam

bool GUIScene::m_update_cam = false
private

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