SceneView.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. TODO - Think about this
  13. See for inspiration: http://docs.unity3d.com/ScriptReference/Handles.html
  14. ----------------------------------------------------------------------
  15. Picking
  16. TODO - Think about this
  17. Picking
  18. - Create core thread class that accepts a screen coordinate and a camera and it determines object at its position
  19. - System then renders all visible objects with diferent colors
  20. - Image then needs to be read back to determine what was hit
  21. - Result is returned via async op
  22. - Needs to support multi-select where I draw a rectangle on screen
  23. - 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.
  24. - Similar issue might happen with particles and other systems
  25. ----------------------------------------------------------------------
  26. Rendering selection
  27. Get the mesh from the selected Renderable
  28. Draw that same mesh again using a shader that grays out the original
  29. The second mesh will likely need to use depth bias (sloped depth bias too?)
  30. ----------------------------------------------------------------------
  31. Grid
  32. Generate grid of X size around Y point
  33. Normally Y is (0, 0, 0) but we should be able to move it with camera
  34. There will be minor and major axes with slightly different color (and thickness?)
  35. Instead of pixel perfect lines draw 2D quads (Using DrawHelper which has thick line support)
  36. 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)
  37. Material is retrieved from builtin materials list
  38. This can be drawn directly using the draw list and not a renderable
  39. ----------------------------------------------------------------------
  40. Gizmos
  41. GizmoSetups
  42. - Determines what to display for a certain component (or a SceneObject) itself
  43. GizmoManager
  44. - Every frame goes through all game objects and create/removes their gizmos. It keeps a cached version of all gizmos
  45. - It keeps a list of gizmo descriptors
  46. - A "diff" of this list is sent to Core thread every frame
  47. GizmosRenderer
  48. - Batches all gizmos into a single buffer and renders them with a single call
  49. - It might be a bit problematic if custom textures are used for gizmos
  50. - Just don't batch those?
  51. When picking GizmosRenderer can draw the gizmos as normal but using a special shader.
  52. --------
  53. Need to allow the user to specify custom gizmos.
  54. - Have a set of methods like Gizmos.DrawSphere, DrawIcon, DrawLine, DrawCube, DrawFrustum, etc.
  55. - Have a CustomGizmo attribute which you can attach to a method
  56. - That method can then call above methods
  57. - Additionally in the attribute you can specify when is the gizmo displayed: Active, Selected, NotSelected, SelectedOrChild
  58. - And an option if gizmo can be picked or not
  59. - These methods will somehow automatically be registered with the GizmoSetups
  60. -----------------------------------------------------------------------
  61. RenderTarget (and in turn, Viewport) make data available to sim thread, even though that data can be arbitrarily modified from the core thread
  62. Create a separate set of classes: RenderTargetCore, RenderTextureCore, RenderWindowCore.
  63. - They would not be core objects but would be used exclusively on the core thread
  64. - Majority of the current classes would go into those new classes
  65. Current RenderTarget/RenderTexture/RenderWindow would stay and be useable on sim thread but not meant for core thread use.
  66. - Internally it would store the *Core versions of the objects
  67. Whenever a core object gets changed it should notify a RenderTargetManager, which will on beginning of every frame update
  68. non-core version with valid data.
  69. Viewport should return a ViewportProxy for use on core thread (instead of a clone as it has now)
  70. - The proxy will reference the *Core version of render target
  71. IMPLEMENTATION:
  72. - Create RenderTargetCore, RenderTextureCore, RenderWindowCore files
  73. - Start copying (don't modify original files) code from original files and modify them for core use
  74. - Find any references of render targets on the core thread and make sure it uses those core objects instead
  75. - Add getCoreImplementation() that returns the core version from "normal" objects
  76. Stuff that needs to be synchronized:
  77. mIsFullscreen
  78. mWidth
  79. mHeight
  80. mHidden
  81. mTop
  82. mLeft
  83. mHasFocus
  84. (more? check)