rig.h 1005 Bytes
Newer Older
TheNumbat's avatar
TheNumbat committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

#pragma once

#include <SDL2/SDL.h>
#include "widgets.h"
#include "../rays/tri_mesh.h"

namespace Gui {

enum class Mode;
class Manager;

class Rig {
public:
    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);    

    void end_transform(Widgets& widgets, Undo& undo, Scene_Object& obj);
    void apply_transform(Widgets& widgets);

    Vec3 selected_pos();
    void clear_select();
    void clear();
    void invalidate(Joint* j);

    void render(Scene_Maybe obj_opt, Widgets& widgets, Camera& cam);
    Mode UIsidebar(Manager& manager, Undo& undo, Widgets& widgets, Scene_Maybe obj);

private:
    bool creating_bone = false;
    bool root_selected = false;
    Vec3 old_pos, old_base, old_ext;
    
    Scene_Object* my_obj = nullptr;
    Joint* selected = nullptr;
    Joint* new_joint = nullptr;
    PT::Tri_Mesh mesh_bvh;
};

}