| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- TODO:
- - Core thread gets stuck on shutdown when OpenGL is used...Somewhere in kernel
- CONCRETE TASK:
- - Hook up gizmo manager to ScenePicking so gizmos are considered when picking
- - I'll likely need to update GizmoManager so I can query gizmo SceneObject based on gizmo index
- - Selection/ScenePicking/GizmoManager need to be started
- IMMEDIATE:
- - SceneGrid is very ugly. Consider using default lines for now and come back with a better approach later.
- - Potentially enable line AA?
- - Picking code is completely untested and will likely need major fixing
- - Test all the new DrawHelper3D methods
- GIZMO TODO:
- - Figure out how to deal with builtin components like Camera and Renderable (e.g. how will they have gizmos since they're not managed components?)
- LATER:
- - Need a way to render text for gizmos and handles, and in scene in general
- ----------------------------------------------------------------------
- Handles
- SliderLine - position, direction, length
- - When initially activated it records position nearest so the line as the starting point
- - Further mouse dragging also finds nearest position to the line
- - Difference between those two results in a float value (how much to move along direction from position to reach new position)
- - Slider line has a capsule + sphere collider size of which can be set manually
- SliderPlane - position, normal, size
- - Similar to line slider only the direction is determined dynamically as well as distance
- - Outputs a Vector2 (direction * distance moved)
- - A OOB is used as a collider
- SliderDisc - position, normal, radius
- - When initially activated it records position nearest so the disc as the starting point
- - Further movement calculates the dynamic direction from the starting point to the current point on the plane the disc lies on
- - Distance along that direction is returned as amount of movement (similar to line slider)
- - Outputs a single float
- - A torus is used as a collider
- Free move/rotate/scale handles need to exist as well
- - Scale is easy, just perform uniform scale. Use SliderPlane oriented towards camera
- - Move also use SliderPlane oriented towards camera
- - Rotation use SliderDisc oriented towards camera
- CONCRETE TODO:
- HandleSliderManager
- - Detecting input and updating the sliders
- - isHandleActive
- ScriptHandleManager
- - Pretty much everything (in more detail in .cpp file)
- - Needs to be started up somewhere
- C# Component needs "sceneObject" property
- C# SceneObject needs position/rot/scale (and local variants) properties
- SceneEditorWidget
- - Need to glue everything together
- More complex handles (combinations of sliders + draw methods)
- - In C#, called by ScriptHandleManager
- Nearest point to disc/arc code
- More complex types for drawing like DrawArrow in HandleDrawManager
- Handles that remain the same size regardless of distance from camera
- - For both drawing and collision
- Consider local vs. global handle mode
- OPEN QUESTIONS:
- - How to handle handles with multiple selection?
- EXAMPLE:
- [CustomHandle(typeof(Camera))]
- class CameraHandle : IHandle
- {
- SliderLine xAxis;
- SliderLine yAxis;
-
- CameraHandle()
- {
- xAxis = new SliderLine(Vector3.right, 10.0f);
- yAxis = new SliderLine(Vector3.up, 10.0f);
- xAxis.onDragged += onXAxis();
- yAxis.onDragged += onYAxis();
- }
- void onXAxis()
- {
- // Here I can decide whether or not I want to use handle data or not, per object instance
- target.position = xAxis.getMove(target.position);
- }
- void onYAxis()
- {
- target.position = yAxis.getMove(target.position);
- }
- void Update()
- {
- // Resize handle, change matrix, etc.
- }
- void Draw()
- {
- xAxis.Draw();
- HandleDraw.Arrow(target.position, Vector3.right, 10.0f);
- HandleDraw.Arrow(target.position, Vector3.up, 10.0f);
- }
- }
- ----------------------------------------------------------------------
- SelectionRenderer
- Retrieve a list of selected objects from SelectionManager
- Find ones with Renderable components
- Retrieve Meshes, and world transforms from them
- Draw that same mesh with either a wireframe or a grayed out shader with a slight depth bias
- ----------------------------------------------------------------------
- SceneView editor flow:
- Hook up gizmo, handle and selection rendering methods to be executed after the scene is rendered
- Calculate mouse coords manually relative to the window and to the render texture GUI element
- - Don't use GUI events as we require more precise control (do we?)
- Detect mouse clicks on the scene render target
- Forward those mouse coordinates to HandleManager
- It checks if screen ray intersects any handles and returns the handle if it does
- If handle is found it is activated and method returns
- Otherwise we mark the coordinates as selection start
- Detect mouse drag on the scene render target
- - If we have an active handle
- Forward mouse coordinates to the active handle so it can do its thing
- return
- - Otherwise its assumed we are dragging a selection
- Update selection endpoint and send it to ScenePicking
- Use Selection to select picked objects if any
- return
- Detect mouse release on scene render target
- If we have an active handle
- Clear active handle
- return
- Otheriwse its assumed we are dragging a selection
- Do nothing
- return
|