SceneView.txt 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. GIZMO TODO:
  2. - 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?)
  3. - Make those two a non-component types. Anywhere they are used in the Renderer they should just be passed as pointers.
  4. - Then make a Component wrapper around the non-component types, and also a C# wrapper around the same types
  5. TESTING:
  6. - Test picking on an object with alpha
  7. - Ensure that selecting an item in scene properly marks it in scene view
  8. - Ensure that selecting an item in scene or resource tree view properly updates Selection
  9. Test gizmos
  10. - Test rendering of icon gizmos
  11. - Need a way to load a texture from C# (Extend ProjectLibrary?)
  12. - HOOK UP GIZMO SELECTION and test it
  13. Test handles
  14. - Test basic move handle
  15. - Test a custom handle from C#
  16. - FINISH HANDLE IMPLEMENTATION AND GLUE EVERYTHING TOGHETHER
  17. IMPLEMENT SELECTION RENDERING
  18. IMPROVE SceneGrid LOOK
  19. - LIKELY USE PIXEL SceneGrid WITH AA
  20. - OR (better) instead of drawing rows and columns of lines, just draw a plane with procedural texture
  21. Need a way to drag and drop items from Scene tree view to Scene view
  22. LATER:
  23. - Need a way to render text for gizmos and handles, and in scene in general
  24. - Add drag to select
  25. - Need a better system to catch broken shaders. DX11 just draws nothing with depth, DX9 draws all white.
  26. ----------------------------------------------------------------------
  27. Handles
  28. SliderLine - position, direction, length
  29. - When initially activated it records position nearest so the line as the starting point
  30. - Further mouse dragging also finds nearest position to the line
  31. - Difference between those two results in a float value (how much to move along direction from position to reach new position)
  32. - Slider line has a capsule + sphere collider size of which can be set manually
  33. SliderPlane - position, normal, size
  34. - Similar to line slider only the direction is determined dynamically as well as distance
  35. - Outputs a Vector2 (direction * distance moved)
  36. - A OOB is used as a collider
  37. SliderDisc - position, normal, radius
  38. - When initially activated it records position nearest so the disc as the starting point
  39. - Further movement calculates the dynamic direction from the starting point to the current point on the plane the disc lies on
  40. - Distance along that direction is returned as amount of movement (similar to line slider)
  41. - Outputs a single float
  42. - A torus is used as a collider
  43. Free move/rotate/scale handles need to exist as well
  44. - Scale is easy, just perform uniform scale. Use SliderPlane oriented towards camera
  45. - Move also use SliderPlane oriented towards camera
  46. - Rotation use SliderDisc oriented towards camera
  47. ----------------------------------------------------
  48. STAGE 1
  49. CONCRETE TODO:
  50. HandleSliderPlane/HandleSliderDisc
  51. - update() implementation
  52. ScriptHandleManager
  53. - Needs to be started up somewhere
  54. SceneEditorWidget
  55. - Need to glue everything together
  56. ----------------------------------------------------
  57. STAGE 2
  58. Implement RotateHandle & ScaleHandle in C#
  59. - Nearest point to disc/arc code
  60. Add free move, free rotate, free scale functionality
  61. Handles that remain the same size regardless of distance from camera
  62. - For both drawing and collision
  63. More complex types for drawing like DrawArrow in HandleDrawManager
  64. ----------------------------------------------------------------------
  65. SelectionRenderer
  66. Retrieve a list of selected objects from SelectionManager
  67. Find ones with Renderable components
  68. Retrieve Meshes, and world transforms from them
  69. Draw that same mesh with either a wireframe or a grayed out shader with a slight depth bias
  70. ----------------------------------------------------------------------
  71. SceneView editor flow:
  72. Hook up gizmo, handle and selection rendering methods to be executed after the scene is rendered
  73. Calculate mouse coords manually relative to the window and to the render texture GUI element
  74. - Don't use GUI events as we require more precise control (do we?)
  75. Detect mouse clicks on the scene render target
  76. Forward those mouse coordinates to HandleManager
  77. It checks if screen ray intersects any handles and returns the handle if it does
  78. If handle is found it is activated and method returns
  79. Otherwise we mark the coordinates as selection start
  80. Detect mouse drag on the scene render target
  81. - If we have an active handle
  82. Forward mouse coordinates to the active handle so it can do its thing
  83. return
  84. - Otherwise its assumed we are dragging a selection
  85. Update selection endpoint and send it to ScenePicking
  86. Use Selection to select picked objects if any
  87. return
  88. Detect mouse release on scene render target
  89. If we have an active handle
  90. Clear active handle
  91. return
  92. Otheriwse its assumed we are dragging a selection
  93. Do nothing
  94. return
  95. ---------------------------------------------------------------------
  96. Multi-resources
  97. Importer::import
  98. - Each SpecificImporter is responsible for importing all needed resources and registering them with Resources manager
  99. - However only the main resource is returned from that method
  100. - Rest of the resources are referenced by the UUID in ResourceMeta and can be retrieved there if needed
  101. Resources::save
  102. - Add to documentation that it will only save that exact resource and not any dependencies, you must call save() for them manually
  103. Resources::load
  104. - Will automatically load all dependencies, optionally add a boolean that allows you to load only the main asset
  105. ProjectLibrary
  106. - Needs to be extended so it shows sub-resources in tree view
  107. - Need to extend my mapping so one asset maps to multiple assets in library (need to remember how I do that currently, is it just by name or meta-file identifier?)
  108. ---------------------
  109. With this approach I can:
  110. - Reference and load the sub-resources directly
  111. - Technically I can also delete sub-resources