Kohi Game Engine
editor_gizmo.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <defines.h>
4 #include <math/math_types.h>
6 
7 #ifdef _DEBUG
9 #endif
10 
11 struct ray;
12 struct camera;
13 
14 typedef enum editor_gizmo_mode {
21 
30 
31 typedef struct editor_gizmo_mode_data {
34 
37 
39 
42 
46 
50 
57  // EDITOR_GIZMO_ORIENTATION_VIEW = 2,
60 
61 typedef struct editor_gizmo {
68 
71 
74 
77 
79 
80 #ifdef _DEBUG
81  debug_line3d plane_normal_line;
82 #endif
84 
87 
91 
96 
98 
100 
101 KAPI void editor_gizmo_interaction_begin(editor_gizmo* gizmo, struct camera* c, struct ray* r, editor_gizmo_interaction_type interaction_type);
103 KAPI void editor_gizmo_handle_interaction(editor_gizmo* gizmo, struct camera* c, struct ray* r, editor_gizmo_interaction_type interaction_type);
This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:177
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
_Bool b8
8-bit boolean type
Definition: defines.h:58
float f32
32-bit floating point number
Definition: defines.h:47
unsigned char u8
Unsigned 8-bit integer.
Definition: defines.h:19
KAPI b8 editor_gizmo_create(editor_gizmo *out_gizmo)
KAPI void editor_gizmo_selected_transform_set(editor_gizmo *gizmo, transform *xform)
KAPI b8 editor_gizmo_unload(editor_gizmo *gizmo)
KAPI editor_gizmo_orientation editor_gizmo_orientation_get(editor_gizmo *gizmo)
struct editor_gizmo editor_gizmo
KAPI void editor_gizmo_orientation_set(editor_gizmo *gizmo, editor_gizmo_orientation orientation)
KAPI void editor_gizmo_refresh(editor_gizmo *gizmo)
KAPI void editor_gizmo_interaction_begin(editor_gizmo *gizmo, struct camera *c, struct ray *r, editor_gizmo_interaction_type interaction_type)
editor_gizmo_mode
Definition: editor_gizmo.h:14
@ EDITOR_GIZMO_MODE_ROTATE
Definition: editor_gizmo.h:17
@ EDITOR_GIZMO_MODE_NONE
Definition: editor_gizmo.h:15
@ EDITOR_GIZMO_MODE_SCALE
Definition: editor_gizmo.h:18
@ EDITOR_GIZMO_MODE_MOVE
Definition: editor_gizmo.h:16
@ EDITOR_GIZMO_MODE_MAX
Definition: editor_gizmo.h:19
KAPI b8 editor_gizmo_initialize(editor_gizmo *gizmo)
editor_gizmo_interaction_type
Definition: editor_gizmo.h:22
@ EDITOR_GIZMO_INTERACTION_TYPE_MOUSE_HOVER
Definition: editor_gizmo.h:24
@ EDITOR_GIZMO_INTERACTION_TYPE_NONE
Definition: editor_gizmo.h:23
@ EDITOR_GIZMO_INTERACTION_TYPE_MOUSE_DRAG
Definition: editor_gizmo.h:26
@ EDITOR_GIZMO_INTERACTION_TYPE_MOUSE_DOWN
Definition: editor_gizmo.h:25
@ EDITOR_GIZMO_INTERACTION_TYPE_CANCEL
Definition: editor_gizmo.h:28
@ EDITOR_GIZMO_INTERACTION_TYPE_MOUSE_UP
Definition: editor_gizmo.h:27
KAPI void editor_gizmo_interaction_end(editor_gizmo *gizmo)
struct editor_gizmo_mode_data editor_gizmo_mode_data
KAPI void editor_gizmo_mode_set(editor_gizmo *gizmo, editor_gizmo_mode mode)
KAPI void editor_gizmo_update(editor_gizmo *gizmo)
KAPI void editor_gizmo_destroy(editor_gizmo *gizmo)
KAPI void editor_gizmo_handle_interaction(editor_gizmo *gizmo, struct camera *c, struct ray *r, editor_gizmo_interaction_type interaction_type)
editor_gizmo_orientation
Definition: editor_gizmo.h:51
@ EDITOR_GIZMO_ORIENTATION_MAX
The gizmo's transform operations are relative to the current view.
Definition: editor_gizmo.h:58
@ EDITOR_GIZMO_ORIENTATION_GLOBAL
The gizmo's transform operations are relative to global transform.
Definition: editor_gizmo.h:53
@ EDITOR_GIZMO_ORIENTATION_LOCAL
The gizmo's transform operations are relative to local transform.
Definition: editor_gizmo.h:55
KAPI b8 editor_gizmo_load(editor_gizmo *gizmo)
Contains various math types required for the engine.
This file contains the types for common resources the engine uses.
Represents a camera that can be used for a variety of things, especially rendering....
Definition: camera.h:21
Represents a single vertex in 3D space with position and colour data only.
Definition: math_types.h:201
Definition: debug_line3d.h:7
Definition: editor_gizmo.h:31
vec3 last_interaction_pos
Definition: editor_gizmo.h:48
plane_3d interaction_plane
Definition: editor_gizmo.h:44
u32 * indices
Definition: editor_gizmo.h:36
colour_vertex_3d * vertices
Definition: editor_gizmo.h:33
geometry geo
Definition: editor_gizmo.h:38
u32 index_count
Definition: editor_gizmo.h:35
u32 vertex_count
Definition: editor_gizmo.h:32
vec3 interaction_start_pos
Definition: editor_gizmo.h:47
extents_3d * mode_extents
Definition: editor_gizmo.h:41
plane_3d interaction_plane_back
Definition: editor_gizmo.h:45
u32 extents_count
Definition: editor_gizmo.h:40
u8 current_axis_index
Definition: editor_gizmo.h:43
Definition: editor_gizmo.h:61
editor_gizmo_orientation orientation
Indicates the editor transform operaton orientation.
Definition: editor_gizmo.h:73
transform xform
The transform of the gizmo.
Definition: editor_gizmo.h:63
editor_gizmo_interaction_type interaction
Definition: editor_gizmo.h:78
editor_gizmo_mode mode
The current mode of the gizmo.
Definition: editor_gizmo.h:67
transform * selected_xform
A pointer to the currently selected object's transform. Null if nothing is selected.
Definition: editor_gizmo.h:65
editor_gizmo_mode_data mode_data[EDITOR_GIZMO_MODE_MAX+1]
The data for each mode of the gizmo.
Definition: editor_gizmo.h:76
f32 scale_scalar
Used to keep the gizmo a consistent size on the screen despite camera distance.
Definition: editor_gizmo.h:70
Represents the extents of a 3d object.
Definition: math_types.h:165
Represents actual geometry in the world. Typically (but not always, depending on use) paired with a m...
Definition: resource_types.h:311
Definition: math_types.h:239
Represents a line which starts at an origin and proceed infinitely in the given direction....
Definition: geometry_3d.h:8
Represents the transform of an object in the world. Transforms can have a parent whose own transform ...
Definition: math_types.h:215
A 3-element vector.
Definition: math_types.h:49