SceneView.txt 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. TODO:
  2. - Core thread gets stuck on shutdown when OpenGL is used...Somewhere in kernel
  3. CONCRETE TASK:
  4. - SceneView editor window: Add a way to detect exact mouse position on the render texture
  5. - Similar to how I have onRenderViewport callback in Renderer have another one that gets triggered from core thread
  6. - Hook up gizmo rendering there
  7. - Hook up gizmo manager to ScenePicking so gizmos are considered when picking
  8. - I'll likely need to update GizmoManager so I can query gizmo SceneObject based on gizmo index
  9. - Selection/ScenePicking/GizmoManager need to be started
  10. IMMEDIATE:
  11. - SceneGrid is very ugly. Consider using default lines for now and come back with a better approach later.
  12. - Potentially enable line AA?
  13. - Picking code is completely untested and will likely need major fixing
  14. - Disable DX9 for editor as I will likely want to use geometry shaders for icon rendering, and possibly new AA line shader
  15. - Or just use MeshHeap and update the icon/lines every frame?
  16. - Test all the new DrawHelper3D methods
  17. GIZMO TODO:
  18. - IMPORTANT: Gizmo rendering happens in update() but it should happen whenever scene view is being rendered as the render target isn't set anywhere
  19. - 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?)
  20. LATER:
  21. - Need a way to render text for gizmos and handles, and in scene in general
  22. ----------------------------------------------------------------------
  23. Handles
  24. - Make a few different base handle types:
  25. - Slider 1D (e.g. for movement using an arrow cap)
  26. - Slider 2D (e.g. for movement in 2D using a plane render)
  27. - Similar for scale/rotation handles (see Unity for its implementations of those)
  28. Handles should have colliders which will be queries whenever user input is detected in scene view
  29. If any handle is hit the input will not proceed further (e.g. no picking will be done) and that handle control
  30. will become active.
  31. Base handle types should just be positioned in space and then return value every frame as user moves them.
  32. - This way they can also easily be used from C# for custom user-made stuff
  33. TODO - Think about this
  34. See for inspiration: http://docs.unity3d.com/ScriptReference/Handles.html
  35. ----------------------------------------------------------------------
  36. SelectionRenderer
  37. Retrieve a list of selected objects from SelectionManager
  38. Find ones with Renderable components
  39. Retrieve Meshes, and world transforms from them
  40. Draw that same mesh with either a wireframe or a grayed out shader with a slight depth bias
  41. ----------------------------------------------------------------------
  42. SceneView editor flow:
  43. Hook up gizmo, handle and selection rendering methods to be executed after the scene is rendered
  44. Calculate mouse coords manually relative to the window and to the render texture GUI element
  45. - Don't use GUI events as we require more precise control (do we?)
  46. Detect mouse clicks on the scene render target
  47. Forward those mouse coordinates to HandleManager
  48. It checks if screen ray intersects any handles and returns the handle if it does
  49. If handle is found it is activated and method returns
  50. Otherwise we mark the coordinates as selection start
  51. Detect mouse drag on the scene render target
  52. - If we have an active handle
  53. Forward mouse coordinates to the active handle so it can do its thing
  54. return
  55. - Otherwise its assumed we are dragging a selection
  56. Update selection endpoint and send it to ScenePicking
  57. Use Selection to select picked objects if any
  58. return
  59. Detect mouse release on scene render target
  60. If we have an active handle
  61. Clear active handle
  62. return
  63. Otheriwse its assumed we are dragging a selection
  64. Do nothing
  65. return