Implemented functionality to handle arc drawing when arc size is greater than 360 or less than -360

dev
Shariq Shah 6 years ago
parent 3be1a71957
commit 65c9157910
  1. 3
      src/game/editor.c
  2. 11
      src/game/im_render.c
  3. 5
      todo.txt

@ -121,6 +121,7 @@ void editor_init(struct Editor* editor)
editor->grid_scale = 1.f;
editor->tool_mesh_draw_enabled = 1;
editor->tool_snap_enabled = 1;
editor->tool_rotate_amount = 0.f;
editor->tool_rotate_arc_radius = 5.f;
editor->tool_rotate_arc_segments = 50.f;
editor->tool_rotate_axis_selection_enabled = true;
@ -560,7 +561,7 @@ void editor_on_mousebutton_release(const struct Event* event)
}
if(editor->selected_entity && event->mousebutton.button == MSB_LEFT)
if(editor->selected_entity && event->mousebutton.button == MSB_LEFT && nk_item_is_any_active(&gui->context) == 0)
{
if(editor->current_mode == EDITOR_MODE_TRANSLATE)
{

@ -170,19 +170,24 @@ void im_arc(float radius, float angle_start, float angle_end, int num_divisions,
{
im_begin(position, rotation, (vec3) { 1.f, 1.f, 1.f }, color, filled ? GDM_TRIANGLE_FAN : GDM_LINE_LOOP, draw_order);
float arc_degrees = angle_end - angle_start;
float increment = arc_degrees / num_divisions;
if(arc_degrees != 360)
im_pos(0.f, 0.f, 0.f);
if(arc_degrees > 360.f)
arc_degrees = (int)arc_degrees % 360;
if(arc_degrees < -360.f)
arc_degrees = (int)arc_degrees % -360;
float increment = arc_degrees / num_divisions;
if(angle_start < angle_end)
{
for(float i = angle_start; i <= angle_end; i += increment)
for(float i = angle_start; i <= arc_degrees; i += increment)
im_pos(sinf(i * M_PI / 180.f) * radius, cosf(i * M_PI / 180.f) * radius, 0.f);
}
else
{
for(float i = angle_start; i >= angle_end; i += increment)
for(float i = angle_start; i >= arc_degrees; i += increment)
im_pos(sinf(i * M_PI / 180.f) * radius, cosf(i * M_PI / 180.f) * radius, 0.f);
}

@ -1,4 +1,5 @@
Todo:
- Rotation degree snapping
- Only show rotation gizmo for one axis at a time
- Rotate mesh along mouse movement or show what the rotation is going to look like by using a wireframe version of mesh when rotating
- Match amount to be rotate with actual axes and the gizmo arc being drawn
@ -12,6 +13,9 @@ Todo:
- Scale Mode
- Color picker
- Color palette, picker and dropper
- Key binding and function to snap editor camera to selected entity
location
- Key binding and function to orient entity to camera orientation
- Mouse warp to opposite side of the window when it reaches bounds
- Add other axis combinations like YZ and XY to transform tool
- Transformation space selection for translation, rotation and scale.
@ -259,4 +263,5 @@ Done:
* Handle negative values in im_arc
* Rotate mode tool widget
* Complete rotate mode
* Implement arc values greater than 360 or -360

Loading…
Cancel
Save