rig.h 1 KB
Newer Older
TheNumbat's avatar
TheNumbat committed
1
2
3
4

#pragma once

#include "../rays/tri_mesh.h"
TheNumbat's avatar
TheNumbat committed
5
6
#include "widgets.h"
#include <SDL2/SDL.h>
TheNumbat's avatar
TheNumbat committed
7
8
9
10
11
12
13
14

namespace Gui {

enum class Mode;
class Manager;

class Rig {
public:
TheNumbat's avatar
TheNumbat committed
15
16
17
18
19
    bool keydown(Widgets &widgets, Undo &undo, SDL_Keysym key);

    void select(Scene &scene, Widgets &widgets, Undo &undo, Scene_ID id, Vec3 cam, Vec2 spos,
                Vec3 dir);
    void hover(Vec3 cam, Vec2 spos, Vec3 dir);
TheNumbat's avatar
TheNumbat committed
20

TheNumbat's avatar
TheNumbat committed
21
22
    void end_transform(Widgets &widgets, Undo &undo, Scene_Object &obj);
    void apply_transform(Widgets &widgets);
TheNumbat's avatar
TheNumbat committed
23
24
25
26

    Vec3 selected_pos();
    void clear_select();
    void clear();
TheNumbat's avatar
TheNumbat committed
27
    void invalidate(Joint *j);
TheNumbat's avatar
TheNumbat committed
28

TheNumbat's avatar
TheNumbat committed
29
30
    void render(Scene_Maybe obj_opt, Widgets &widgets, Camera &cam);
    Mode UIsidebar(Manager &manager, Undo &undo, Widgets &widgets, Scene_Maybe obj);
TheNumbat's avatar
TheNumbat committed
31
32
33
34
35

private:
    bool creating_bone = false;
    bool root_selected = false;
    Vec3 old_pos, old_base, old_ext;
TheNumbat's avatar
TheNumbat committed
36
37
38
39

    Scene_Object *my_obj = nullptr;
    Joint *selected = nullptr;
    Joint *new_joint = nullptr;
TheNumbat's avatar
TheNumbat committed
40
41
42
    PT::Tri_Mesh mesh_bvh;
};

TheNumbat's avatar
TheNumbat committed
43
} // namespace Gui