Implemented deselecting entity in editor

dev
Shariq Shah 6 years ago
parent 66b72cca73
commit e45c143f52
  1. 9
      src/game/editor.c
  2. 8
      src/game/renderer.c
  3. 2
      todo.txt

@ -601,6 +601,15 @@ void editor_on_mousebutton(const struct Event* event)
intersected_entity->editor_selected = true;
editor->selected_entity = intersected_entity;
}
else
{
//Deselect the currently selected entity if nothing was found
if(editor->selected_entity)
{
editor->selected_entity->editor_selected = false;
editor->selected_entity = NULL;
}
}
}
}

@ -421,10 +421,10 @@ void renderer_draw(struct Renderer* renderer, struct Scene* scene)
{
static mat4 mvp;
shader_set_uniform_vec4(renderer->debug_shader, "debug_color", &game_state->editor->selected_entity_colour);
struct Static_Mesh* mesh = (struct Static_Mesh*)game_state->editor->selected_entity;
struct Model* model = &mesh->model;
struct Transform* transform = &mesh->base.transform;
int geometry = model->geometry_index;
struct Static_Mesh* mesh = (struct Static_Mesh*)game_state->editor->selected_entity;
struct Model* model = &mesh->model;
struct Transform* transform = &mesh->base.transform;
int geometry = model->geometry_index;
mat4_identity(&mvp);
mat4_mul(&mvp, &active_camera->view_proj_mat, &transform->trans_mat);
shader_set_uniform_mat4(renderer->debug_shader, "mvp", &mvp);

@ -68,6 +68,7 @@ Bugs:
- Fix light rotation/direction bugs
- Fix lights type not being correctly saved/loaded from file
- Fix culling
- Fix bounding boxes not aligning in editor
Done:
* Input
@ -200,3 +201,4 @@ Done:
* Fixed mouse button press/release behaviour by using event callbacks for editor mouse picking
* Ray picking for editor
* Highlight entity selected in editor in a specific color
* Deselect selected entity in editor when nothing is hit on click and an entity is already selected

Loading…
Cancel
Save