mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-21 12:29:18 +02:00
Add brush mode in editor mode
This commit is contained in:
120
editormode.h
120
editormode.h
@@ -16,68 +16,72 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "sceneeditor.h"
|
||||
#include "scenenode.h"
|
||||
|
||||
class editor_mode : public application_mode {
|
||||
class editor_mode : public application_mode
|
||||
{
|
||||
|
||||
public:
|
||||
// constructors
|
||||
editor_mode();
|
||||
// methods
|
||||
// initializes internal data structures of the mode. returns: true on success, false otherwise
|
||||
bool init() override;
|
||||
// mode-specific update of simulation data. returns: false on error, true otherwise
|
||||
bool update() override;
|
||||
// maintenance method, called when the mode is activated
|
||||
void enter() override;
|
||||
// maintenance method, called when the mode is deactivated
|
||||
void exit() override;
|
||||
// input handlers
|
||||
void on_key( int Key, int Scancode, int Action, int Mods ) override;
|
||||
void on_cursor_pos( double Horizontal, double Vertical ) override;
|
||||
void on_mouse_button( int Button, int Action, int Mods ) override;
|
||||
void on_scroll( double const Xoffset, double const Yoffset ) override { ; }
|
||||
void on_window_resize( int w, int h ) override { ; }
|
||||
void on_event_poll() override;
|
||||
bool is_command_processor() const override;
|
||||
public:
|
||||
// constructors
|
||||
editor_mode();
|
||||
// methods
|
||||
// initializes internal data structures of the mode. returns: true on success, false otherwise
|
||||
bool init() override;
|
||||
// mode-specific update of simulation data. returns: false on error, true otherwise
|
||||
bool update() override;
|
||||
// maintenance method, called when the mode is activated
|
||||
void enter() override;
|
||||
// maintenance method, called when the mode is deactivated
|
||||
void exit() override;
|
||||
// input handlers
|
||||
void on_key(int Key, int Scancode, int Action, int Mods) override;
|
||||
void on_cursor_pos(double Horizontal, double Vertical) override;
|
||||
void on_mouse_button(int Button, int Action, int Mods) override;
|
||||
void on_scroll(double const Xoffset, double const Yoffset) override
|
||||
{
|
||||
;
|
||||
}
|
||||
void on_window_resize(int w, int h) override
|
||||
{
|
||||
;
|
||||
}
|
||||
void on_event_poll() override;
|
||||
bool is_command_processor() const override;
|
||||
|
||||
private:
|
||||
// types
|
||||
struct editormode_input {
|
||||
private:
|
||||
// types
|
||||
struct editormode_input
|
||||
{
|
||||
|
||||
editormouse_input mouse;
|
||||
editorkeyboard_input keyboard;
|
||||
editormouse_input mouse;
|
||||
editorkeyboard_input keyboard;
|
||||
|
||||
bool init();
|
||||
void poll();
|
||||
};
|
||||
bool init();
|
||||
void poll();
|
||||
};
|
||||
|
||||
struct state_backup {
|
||||
struct state_backup
|
||||
{
|
||||
|
||||
TCamera camera;
|
||||
bool freefly;
|
||||
bool picking;
|
||||
};
|
||||
// methods
|
||||
void
|
||||
update_camera( double const Deltatime );
|
||||
bool
|
||||
mode_translation() const;
|
||||
bool
|
||||
mode_translation_vertical() const;
|
||||
bool
|
||||
mode_rotationY() const;
|
||||
bool
|
||||
mode_rotationX() const;
|
||||
bool
|
||||
mode_rotationZ() const;
|
||||
bool
|
||||
mode_snap() const;
|
||||
// members
|
||||
state_backup m_statebackup; // helper, cached variables to be restored on mode exit
|
||||
editormode_input m_input;
|
||||
TCamera Camera;
|
||||
double fTime50Hz { 0.0 }; // bufor czasu dla komunikacji z PoKeys
|
||||
scene::basic_editor m_editor;
|
||||
scene::basic_node *m_node; // currently selected scene node
|
||||
bool m_takesnapshot { true }; // helper, hints whether snapshot of selected node(s) should be taken before modification
|
||||
bool m_dragging = false;
|
||||
TCamera camera;
|
||||
bool freefly;
|
||||
bool picking;
|
||||
};
|
||||
// methods
|
||||
void update_camera(double const Deltatime);
|
||||
bool mode_translation() const;
|
||||
bool mode_translation_vertical() const;
|
||||
bool mode_rotationY() const;
|
||||
bool mode_rotationX() const;
|
||||
bool mode_rotationZ() const;
|
||||
bool mode_snap() const;
|
||||
// members
|
||||
state_backup m_statebackup; // helper, cached variables to be restored on mode exit
|
||||
editormode_input m_input;
|
||||
TCamera Camera;
|
||||
double fTime50Hz{0.0}; // bufor czasu dla komunikacji z PoKeys
|
||||
scene::basic_editor m_editor;
|
||||
scene::basic_node *m_node; // currently selected scene node
|
||||
bool m_takesnapshot{true}; // helper, hints whether snapshot of selected node(s) should be taken before modification
|
||||
bool m_dragging = false;
|
||||
glm::vec3 oldPos;
|
||||
bool mouseHold{false};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user