SceneView.txt 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. TODO:
  2. - Core thread gets stuck on shutdown when OpenGL is used...Somewhere in kernel
  3. Weekend:
  4. - SceneGrid is very ugly. Consider using default lines for now and come back with a better approach later.
  5. I have no way of read data from window framebuffer. Will need special methods for it?
  6. - Think about is this even needed? If I do post-processing I'm going to draw everything to render textures and then
  7. just blit to back buffer. I think.
  8. OpenGL texture read/write from render textures isn't hooked up at all
  9. ----------------------------------------------------------------------
  10. Handles
  11. - Make a few different base handle types:
  12. - Slider 1D (e.g. for movement using an arrow cap)
  13. - Slider 2D (e.g. for movement in 2D using a plane render)
  14. - Similar for scale/rotation handles (see Unity for its implementations of those)
  15. Handles should have colliders which will be queries whenever user input is detected in scene view
  16. If any handle is hit the input will not proceed further (e.g. no picking will be done) and that handle control
  17. will become active.
  18. Base handle types should just be positioned in space and then return value every frame as user moves them.
  19. - This way they can also easily be used from C# for custom user-made stuff
  20. TODO - Think about this
  21. See for inspiration: http://docs.unity3d.com/ScriptReference/Handles.html
  22. ----------------------------------------------------------------------
  23. Picking
  24. BsPicking
  25. - HGameObject PickClosestGameObject(Camera cam, Vector2 position, Vector2 area)
  26. - PickResult PickClosestObject(Camera cam, Vector2 position, Vector2 area)
  27. - void PickGameObjects(Camera cam, Vector2 position, Vector2 area, Vector<HGameObject>& selection)
  28. - void PickObjects(Camera cam, Vector2 position, Vector2 area, Vector<PickResults>& selection)
  29. PickResult
  30. Type (GameObject or Gizmo)
  31. Data (Handle to GameObject or gizmo ID)
  32. Picking will internally:
  33. - Be performed on the Scene render target just before actual rendering
  34. - Use scissor rect to limit itself to the specified screen area
  35. - TODO later - I could also limit the camera frustum to this area for additional culling
  36. - Go through every scene object and find all renderables
  37. - Perform culling over all renderables and generate a list of visible nodes
  38. - Access GizmoManager and get a list of all gizmos and their IDs
  39. - Generate unique colors for all renderables and gizmos
  40. - Send meshes/colors/ids to core thread to be rendered with a special shader
  41. - Wait until core thread completes and returns an AsyncOp with a list of selected IDs
  42. - Ensure I can read-back from a render target on the core thread
  43. - Check DX9, DX11 and OpenGL implementations for both render textures and render windows
  44. Also:
  45. - I need to send the primary used texture so I properly determine transparent areas using alpha
  46. - TODO - But I do not have a way of defining a primary texture in-engine. Add a renderer semantic?
  47. ----------------------------------------------------------------------
  48. Rendering selection
  49. Get the mesh from the selected Renderable
  50. Draw that same mesh again using a shader that grays out the original
  51. The second mesh will likely need to use depth bias (sloped depth bias too?)
  52. ----------------------------------------------------------------------
  53. Grid
  54. Generate grid of X size around Y point
  55. Normally Y is (0, 0, 0) but we should be able to move it with camera
  56. There will be minor and major axes with slightly different color (and thickness?)
  57. Instead of pixel perfect lines draw 2D quads (Using DrawHelper which has thick line support)
  58. 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)
  59. Material is retrieved from builtin materials list
  60. This can be drawn directly using the draw list and not a renderable
  61. ----------------------------------------------------------------------
  62. Gizmos
  63. Custom gizmos:
  64. - Users can override the Gizmo class to create their own custom gizmos
  65. - It contains various methods that can be used for constructing the gizmo
  66. - DrawCube
  67. - DrawSphere
  68. - DrawWireCube
  69. - DrawWireSphere
  70. - DrawRay
  71. - DrawLine
  72. - DrawFrustum
  73. - DrawIcon
  74. - Any Gizmo is registered with GizmoTypes manager
  75. - Components may associate themselves with a gizmo using [SetGizmo(Gizmo)] attribute
  76. - It contains other properties, like when should gizmo be displayed (active, selected, not selected, parent selected) and whether
  77. or not the gizmo is pickable
  78. - When drawing an icon
  79. - It should always face the camera
  80. - It can be static size in screen space, or resizable with distance
  81. - Need a way to notify the gizmo needs updating from component with the gizmo
  82. - Gizmos.MarkDirty(GameObject)
  83. - How do I assign a texture to DrawIcon? I'm assuming Gizmo class will not have an inspector.
  84. - A special ManagedResource that allows you to assign textures to it?
  85. - WIll need a Dictionary inspector?
  86. Gizmo rendering:
  87. GizmoTypes
  88. - All gizmo types are registered here
  89. - It contains prebuilt gizmo meshes and textures
  90. GizmoManager
  91. - Every frame goes through all game objects and create/removes their gizmos. It keeps a cached version of all gizmos
  92. - It keeps a list of gizmo descriptors
  93. - A "diff" of this list is sent to Core thread every frame
  94. GizmosRenderer
  95. - Batches all gizmos into a single buffer and renders them with a single call
  96. - It might be a bit problematic if custom textures are used for gizmos
  97. - Just don't batch those? Yep, probably not worth batching at this point.
  98. When picking GizmosRenderer can draw the gizmos as normal but using a special shader.