SceneView.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. Weekend:
  2. - Grid
  3. - RenderTarget refactor
  4. - Think about picking implementation and possibly Handles implementation
  5. TODO - Think about:
  6. - How will I allow user from C# to draw gizmos and handles?
  7. - Unity uses immediate mode
  8. - I should probably focus more on implementing a nice C# drawing interface so I don't constantly have to go and use C++
  9. - Although this might be overkill for this point - I think even Unitys handles/gizmos are C++ in the end
  10. ----------------------------------------------------------------------
  11. Handles
  12. - Make a few different base handle types:
  13. - Slider 1D (e.g. for movement using an arrow cap)
  14. - Slider 2D (e.g. for movement in 2D using a plane render)
  15. - Similar for scale/rotation handles (see Unity for its implementations of those)
  16. Handles should have colliders which will be queries whenever user input is detected in scene view
  17. If any handle is hit the input will not proceed further (e.g. no picking will be done) and that handle control
  18. will become active.
  19. Base handle types should just be positioned in space and then return value every frame as user moves them.
  20. - This way they can also easily be used from C# for custom user-made stuff
  21. TODO - Think about this
  22. See for inspiration: http://docs.unity3d.com/ScriptReference/Handles.html
  23. ----------------------------------------------------------------------
  24. Picking
  25. TODO - Think about this
  26. Picking
  27. - Create core thread class that accepts a screen coordinate and a camera and it determines object at its position
  28. - System then renders all visible objects with diferent colors
  29. - Image then needs to be read back to determine what was hit
  30. - Result is returned via async op
  31. - Needs to support multi-select where I draw a rectangle on screen
  32. - NOTE: I will also need to render gizmos which I assume will all be within a single buffer. This might require special care since normally I can color each buffer with a different color, which won't work in this case.
  33. - Similar issue might happen with particles and other systems
  34. ----------------------------------------------------------------------
  35. Rendering selection
  36. Get the mesh from the selected Renderable
  37. Draw that same mesh again using a shader that grays out the original
  38. The second mesh will likely need to use depth bias (sloped depth bias too?)
  39. ----------------------------------------------------------------------
  40. Grid
  41. Generate grid of X size around Y point
  42. Normally Y is (0, 0, 0) but we should be able to move it with camera
  43. There will be minor and major axes with slightly different color (and thickness?)
  44. Instead of pixel perfect lines draw 2D quads (Using DrawHelper which has thick line support)
  45. Mesh can be static, I can just move its origin by length of the major line (+ maybe have a fadeout in shader with 1 invisible major line so the movement is not noticeable)
  46. Material is retrieved from builtin materials list
  47. This can be drawn directly using the draw list and not a renderable
  48. ----------------------------------------------------------------------
  49. Gizmos
  50. GizmoSetups
  51. - Determines what to display for a certain component (or a SceneObject) itself
  52. GizmoManager
  53. - Every frame goes through all game objects and create/removes their gizmos. It keeps a cached version of all gizmos
  54. - It keeps a list of gizmo descriptors
  55. - A "diff" of this list is sent to Core thread every frame
  56. GizmosRenderer
  57. - Batches all gizmos into a single buffer and renders them with a single call
  58. - It might be a bit problematic if custom textures are used for gizmos
  59. - Just don't batch those?
  60. When picking GizmosRenderer can draw the gizmos as normal but using a special shader.
  61. --------
  62. Need to allow the user to specify custom gizmos.
  63. - Have a set of methods like Gizmos.DrawSphere, DrawIcon, DrawLine, DrawCube, DrawFrustum, etc.
  64. - Have a CustomGizmo attribute which you can attach to a method
  65. - That method can then call above methods
  66. - Additionally in the attribute you can specify when is the gizmo displayed: Active, Selected, NotSelected, SelectedOrChild
  67. - And an option if gizmo can be picked or not
  68. - These methods will somehow automatically be registered with the GizmoSetups
  69. -----------------------------------------------------------------------
  70. RenderTarget (and in turn, Viewport) make data available to sim thread, even though that data can be arbitrarily modified from the core thread
  71. TODO:
  72. - Core thread gets stuck on shutdown when OpenGL is used...Somewhere in kernel
  73. - getProperties on non-core should just make a copy of core for now to check if everything works
  74. - Remove the debug stuff in RenderTarget when done testing
  75. Whenever a core object gets changed it should notify a RenderTargetManager, which will on beginning of every frame update
  76. non-core version with valid data.
  77. - Make sure core dirty properties are updated before render window manager events are triggered
  78. Viewport should return a ViewportProxy for use on core thread (instead of a clone as it has now)
  79. - The proxy will reference the *Core version of render target