SceneView.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. TODO:
  2. - Core thread gets stuck on shutdown when OpenGL is used...Somewhere in kernel
  3. CONCRETE TASK:
  4. - Similar to how I have onRenderViewport callback in Renderer have another one that gets triggered from core thread
  5. - Hook up gizmo rendering there
  6. - Hook up gizmo manager to ScenePicking so gizmos are considered when picking
  7. - I'll likely need to update GizmoManager so I can query gizmo SceneObject based on gizmo index
  8. - Selection/ScenePicking/GizmoManager need to be started
  9. IMMEDIATE:
  10. - SceneGrid is very ugly. Consider using default lines for now and come back with a better approach later.
  11. - Potentially enable line AA?
  12. - Picking code is completely untested and will likely need major fixing
  13. - Disable DX9 for editor as I will likely want to use geometry shaders for icon rendering, and possibly new AA line shader
  14. - Or just use MeshHeap and update the icon/lines every frame?
  15. - Test all the new DrawHelper3D methods
  16. GIZMO TODO:
  17. - IMPORTANT: Gizmo rendering happens in update() but it should happen whenever scene view is being rendered as the render target isn't set anywhere
  18. - 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?)
  19. LATER:
  20. - Need a way to render text for gizmos and handles, and in scene in general
  21. ----------------------------------------------------------------------
  22. Handles
  23. SliderLine - position, direction, length
  24. - When initially activated it records position nearest so the line as the starting point
  25. - Further mouse dragging also finds nearest position to the line
  26. - Difference between those two results in a float value (how much to move along direction from position to reach new position)
  27. - Slider line has a capsule + sphere collider size of which can be set manually
  28. SliderPlane - position, normal, size
  29. - Similar to line slider only the direction is determined dynamically as well as distance
  30. - Outputs a Vector2 (direction * distance moved)
  31. - A OOB is used as a collider
  32. SliderDisc - position, normal, radius
  33. - When initially activated it records position nearest so the disc as the starting point
  34. - Further movement calculates the dynamic direction from the starting point to the current point on the plane the disc lies on
  35. - Distance along that direction is returned as amount of movement (similar to line slider)
  36. - Outputs a single float
  37. - A torus is used as a collider
  38. Handles are always the same size regardless of the distance from camera. (Use same code as from gizmo rendering?)
  39. These three types can be used for creating MoveHandle, RotationHandle, ScaleHandle
  40. - I can potentially move the colliders out of the sliders and add them to the *Handle classes as well
  41. - Handle classes will also handle the rendering (using the existing DrawHelper methods)
  42. CONCRETE TASKS:
  43. - Need to add capsule, torus and OOB colliders
  44. - They need ray intersection code
  45. - Line, plane and disc need code for finding nearest point to a ray
  46. Think about C# implementation.
  47. Take into consideration local vs. global handles
  48. Free move/rotate/scale handles need to exist as well
  49. - Scale is easy, just perform uniform scale. Use SliderPlane oriented towards camera
  50. - Move also use SliderPlane oriented towards camera
  51. - Rotation use SliderDisc oriented towards camera
  52. See for inspiration: http://docs.unity3d.com/ScriptReference/Handles.html
  53. ----------------------------------------------------------------------
  54. SelectionRenderer
  55. Retrieve a list of selected objects from SelectionManager
  56. Find ones with Renderable components
  57. Retrieve Meshes, and world transforms from them
  58. Draw that same mesh with either a wireframe or a grayed out shader with a slight depth bias
  59. ----------------------------------------------------------------------
  60. SceneView editor flow:
  61. Hook up gizmo, handle and selection rendering methods to be executed after the scene is rendered
  62. Calculate mouse coords manually relative to the window and to the render texture GUI element
  63. - Don't use GUI events as we require more precise control (do we?)
  64. Detect mouse clicks on the scene render target
  65. Forward those mouse coordinates to HandleManager
  66. It checks if screen ray intersects any handles and returns the handle if it does
  67. If handle is found it is activated and method returns
  68. Otherwise we mark the coordinates as selection start
  69. Detect mouse drag on the scene render target
  70. - If we have an active handle
  71. Forward mouse coordinates to the active handle so it can do its thing
  72. return
  73. - Otherwise its assumed we are dragging a selection
  74. Update selection endpoint and send it to ScenePicking
  75. Use Selection to select picked objects if any
  76. return
  77. Detect mouse release on scene render target
  78. If we have an active handle
  79. Clear active handle
  80. return
  81. Otheriwse its assumed we are dragging a selection
  82. Do nothing
  83. return