-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene.h
69 lines (52 loc) · 1.57 KB
/
scene.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include "engine/utils/vec.h"
#include <vector>
#include <stdint.h>
#include "renderer.h"
namespace ReservedObjIds {
enum : uint32_t {
kFirst = 1,
kGizmoFirst = kFirst,
kGizmoMoveX = kGizmoFirst,
kGizmoMoveY,
kGizmoMoveZ,
kGizmoMoveXZ,
kGizmoMoveYX,
kGizmoMoveYZ,
kGizmoRotateX,
kGizmoRotateY,
kGizmoRotateZ,
kGizmoRotateXYZ,
kGizmoScaleX,
kGizmoScaleY,
kGizmoScaleZ,
kGizmoScaleXZ,
kGizmoScaleYX,
kGizmoScaleYZ,
kGizmoScaleXYZ,
kGizmoLast,
// here can go other ids
kLast,
};
}
class GameObject;
typedef uint32_t GameObjectId;
namespace scene {
constexpr uint32_t kInvalidObjectId = 0xffffffff;
constexpr uint32_t kFirstGameObjectId = ReservedObjIds::kLast;
}
void initialize_scene(const struct camera* cam, struct RenderFrameContext* rfc);
void finalize_scene();
void scene_update(const struct camera* cam, const bool b_update_simulation, const float dt);
void scene_render_update(struct RenderFrameContext*, bool is_in_editor_mode);
void scene_get_intersected_objects(
const vec3& ws_orig, const vec3& ws_dir,
std::vector<std::pair<float, GameObject *>>& out_obj);
void scene_add_game_object(GameObject* go);
void scene_delete_game_object(GameObject* go);
const std::vector<PointLight>& scene_get_light_list();
GameObject* scene_get_object_by_id(GameObjectId id);
void scene_set_object_id_under_cursor(uint32_t obj_id);
uint32_t scene_get_object_id_under_cursor();
// thi sfunction immediately returns object under cursor, uses simple AABB intersection
class GameObject* scene_get_object_under_cursor(int x, int y);