Skip to content

Commit

Permalink
Gizmo System (#5928)
Browse files Browse the repository at this point in the history
* gizmo colliison example setup

* fixed bug in ray triangle intersection code

* extracted light and material creation

* added child transform class with axes and props in examples to change shape

* added planes; added basic movement for arrows and planes

* fixed y plane transform movement

* reworking intersection for gizmo transform

* ported axis and plane transforms from editor gizmo code

* removed unused camera distance function

* removed planeaxis mapping object

* renamed methods and added comments for point calc

* add guidlines when moving translate gizmo

* starting setting gizmo nodes positions based on translation

* applied offsets to selected nodes and update gizmo position based on nodes

* extracted guildine axes constant outside class

* replaced new vector with reusing tmp vector

* updated commented box for testing

* added plane size setting to controls

* comma removal

* abstracted parameters for gizmo base class

* gizmo axis rotation when set coord to local

* removed unused intersect

* moved selection variables inside function

* change gizmo position and rotation getters to internal setters

* add setting in examples for coord space

* extracted transform superclass and implemented translate and scale classes

* added all axes entity scaling and removed unused variables

* added all axes entity scaling and removed unused variables

* removed math import

* added camera controls and gizmo scaling for perspective

* added fixed gizmo scaling constants for persp and otho camera

* increased guideline size ;fixed hover drag issue

* add gizmo type changing in example; disabled drawLine update if gizmo disabled

* add plane gap setting

* added gizmo rotation and cleaned up inherit classes

* added gizmo handler to example for type switching

* added extra box in examples

* cleaned up example and disabled set firing when switching gizmos

* add dynamic controls to gizmo example

* refactor spaces and removed unused temporary vector

* added facing ring for rotation and updated colors

* refactor and renaming methods from using update to set

* moved node updates to child classes

* gizmo type switching keybinds in example

* reording detach and faceDisks happens on attach

* fixed rotation issue when gizmo not at origin

* update facing disk when changing coord space

* added snapping for translate rotate and scale

* added plane flipping when viewing from underneath; changed coordSpace get override to event fire

* added missing flipAxis for plane flipping

* moved plane array initialize and added create transform in ctor

* fixed axis plane gap getter

* renamed dirtyElement to hoverElement

* added check for plane flip on attach override

* refactored example code

* customization for gizmo colors

* added semi colons to end of import

* hoisted temporary vectors outside methods

* removed commented lighting code

* changed getter and setter to use color object instead of array

* replaced overrides with events for attach and detach.

* renamed elements to shapes and made private

* moved predefined attributes to class body

* moved all axis shapes to separate file

* removed VEC3_AXIS

* reordered methods in gizmo base class

* check if gizmo enabled on snapping check

* refactored update methods and added events firing for each

* moved snapping to gizmo transform; made update pos rot and scale private; added jsdoc to gizmo base class

* changed internal coordSpace to protected

* removed line drawing from gizmo layer and renamed to layer.

* removed unnecessary vec creation in updateLine

* and segments and sides to rotate rings

* replaced segment and side settings with ratios to each radius

* window define to update react state using keybinds

* removed tube radius ratio (minimal noticable effect)

* added face tube and ring radius settings and fixed segments

* added hover and guide line color customization

* refactor gizmo-transform getters/setters

* spread argument refactor

* refactor axis to xyz for radii names

* formatted color property names and organised controls in example

* added jsdoc to transform and refactored attribute names and changed visibility

* rename entity mesh root

* refactor shapeMap

* refactored axisShape to shape

* refactor propName to prop

* added jsdoc to translate rotate and scale classes

* added snap increment setting

* fixed potential division by zero

* fixed updateScale issue and added jsdoc

* used camera component instead of camera entity

* removed check for flip; used material culling

* fixed accidental axis color switch

* renamed cull materials

* jsdoc update for materials

* removed unused vector in gizmo scale

* add uniform scaling on planes

* updated unform scaling to use length

* added fly controls; added update scale to app update

* added cull none material for hovering

* removed guidline disk and facing disk set on app update

* fixed local rotation stuttering issue

* fixed facing axis rotation

* added rotate angle guide line; hover cleanup on detach

* rename of offset to delta

* transform event cleanup; angle guide line now match axis colors

* fixed guide line angle colors

* set guide line angle color to black

* fixed face rotation and added its guide line for angle

* refactored camera rotation quaternion

* entity fix for camera rotation

* added lighting to meshes; hoisted ray intersection function

* changed rotate guide line to hover color

* made axes colors semi transparent

* refactoring of unused variable in createShadowMesh

* fixed entity transform for shadow to use correct entity

* color constants rename

* updated rotation rings to be arcs for rotation

* extracted camera position for look at functions

* updated face disk size

* added full circle when dragging and hiding of other axes

* fixed guide angle rotation for local space

* refactored all colors; removed excess color settings

* added alias for gizmoRot in draw guide lines

* inverted uniform keybind

* hoisted guideAngleEnd

* added guide colors object

* added separation between intersection and render meshes

* intersect meshInstance using tmp material

* fixed lighting issue on outer disk; prepping for triangle intersection

* extracted ray intersection code into tri class

* tri class for ray intersection

* modified intersection code to use triangles

* fixed linting issue

* added check for window for event listeners

* removed todo

* created variables for magic numbers

* extracted mesh tri data into new class

* Removed unused code in tri class

* removed unused vectors in tri class

* removed bloat vec3 and array ctor override for tri class

* removed vec3 creation in intersectRay

* updated jsdoc for ptm

* extracted layer outside gizmo class; fixed tri set issue

* removed unused variables in gizmo class

* used constants for world and local space

* moved event handlers to ctor and added dtor for event handler and gizmo entity cleanup

* removed get/set uvs from shadow mesh creation

* moved repeated methods to base class in axis-shapes

* destroy handler for tri mesh and shapes

* hover plane now shows plane axis over facing axis

* replaced fly camera with orbit; removed distance control

* Fixed rotate lighting and added starting guide angle line

* Updated guide angle start color and jsdoc type

* Fixed jsdoc type for guide angle start color

* reverted default transform in example to translate

* modified selection to sort by camera distance

* added intersection tolerance as control setting

* added center tolerance; fixed center material overlap

* added new rotation logic; modified guide line angle calculation

* cleaned up example and prepared for picker

* renamed legacyRotation to useLegacyRotation

* use legacy rotation when axis almost parallel to camera forward axis

* added picker to example and make design like editor viewport

* Fixed lighting; changed local rotation of multiple nodes to follow last node

* removed legacy rotation

* updated parameters for createTorus in core engine

* updated jsdoc

* fixed scale warping on global rotation of inverted scale objects.

* changed torus sectorAngle to be degrees

* updated jsdoc for createTorus

* moved deg to rad conversion to variable initializer

* snapping on load fix

* hidden coordspace for scaling

* disabled webgpu for example

* Fixed picker resizing selection issue

* removed orthoHeight setting; set in orbit camera
  • Loading branch information
kpal81xd authored Jan 19, 2024
1 parent 9602a97 commit 46e2acb
Show file tree
Hide file tree
Showing 13 changed files with 3,057 additions and 5 deletions.
601 changes: 601 additions & 0 deletions examples/src/examples/misc/gizmos.mjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/src/examples/misc/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./hello-world.mjs";
export * from "./mini-stats.mjs";
export * from "./spineboy.mjs";
export * from "./gizmos.mjs";
export * from "./multi-app.mjs";
Loading

0 comments on commit 46e2acb

Please sign in to comment.