SceneView.txt 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. 2. Extend C++ Texture so it keeps a CPU cached copy if we want it (PixelData per face, per mip)
  2. - Texture::readCPUData(face, mip). Return null if not supported by texture.
  3. 3. Figure out how to port AsyncOp to C#
  4. 4. Write a C# interface for Texture, Texture2D, Texture3D, TextureCube
  5. - Port PixelFormat to C#: Only a subset of actual formats? Only IDs not meta-data.
  6. - Texture: width, height, format, numMipmaps, usage, sRGB, sampleCount
  7. - Texture2D: GetPixels(int mip), SetPixels(int mip), AsyncOp GetGPUPixels(int mip)
  8. - Texture3D: depth, GetPixels(int mip), SetPixels(int mip), AsyncOp GetGPUPixels(int mip)
  9. - TextureCube: GetPixels(CubeFace face, int mip), SetPixels(CubeFace face, int mip), AsyncOp GetGPUPixels(CubeFace face, int mip)
  10. -------------
  11. Get rid of multisample hint from Texture and move it to RenderTarget (RENDER_TEXTURE_DESC actually)
  12. - Seems they only use it for some kind of qality hint
  13. - Possibly replace it with an enum if I can't remove it?
  14. -------------
  15. Optionally port PixelUtility to compressing, converting, generating mipmaps, applying gamma to PixelData
  16. - Also getMaxMimaps and other methods for retrieving pixel format information
  17. WEEKEND END
  18. -----------------------
  19. GIZMO TODO:
  20. - Make a C# wrapper for Renderable
  21. Refactor GizmoManager and HandleManager so they accept a CameraHandler
  22. - I need to ensure scene CameraHandler has proper position/rotation before being passed to handle and gizmo manager
  23. - Delete SceneViewLocator, I don't think it's used anywhere
  24. Tomorrow:
  25. - Figure out how to deal with Textures, especially reading them
  26. - Move handle/gizmo manager to CameraHandler
  27. - Finish up Cursor
  28. Port SceneCameraController to C#
  29. - Will need a C# Cursor
  30. Port RenderTexture to C# and likely extend Texture2D so it accepts renderable flags. While at it add TextureCube and Texture3D as well.
  31. - Actually Texture2D doesn't seem to be implemented at all. Will also need to add PixelData wrapper.
  32. - Will I need to add support for readable textures? e.g. what happens when you try to read a texture from C#?
  33. - Almost certainly. It's very useful to be able to read textures.
  34. - I can't sync the threads when reading, it would be too slow. Have an AsyncOp similar to c++ code?
  35. - Also DX11 already creates a temporary staging buffer when reading from a texture, so keeping yet another CPU
  36. copy seems like a waste.
  37. Ensure that EditorWindow resize callback works properly.
  38. - Perhaps add OnResizeEnd callback that can be used for updating the render texture
  39. Create a C# wrapper around ProjectSettings
  40. Make a Script version of SceneEditorWindow
  41. - This would replace SceneEditorWidget so it would initialize scene grid and call
  42. update on handle manager and scene grid, as well as apply ProjectSettings to them.
  43. Move handle is buggy as hell - It moves in wrong direction sometimes, sometimes it skips, other times collision seems to be wrong
  44. Need a way to drag and drop items from Scene tree view to Scene view
  45. When dragging a handle make sure it works when cursor leaves the scene view
  46. Also make sure that handle manager receives mouse up event if its done outside of scene view
  47. AFTER I have scene widget in C#:
  48. - Finish up C# Handles class so it returns proper values
  49. - Ensure fixed handle size and handle snapping works
  50. - Implement free move handle and remaining handles
  51. - Test custom handles from C#
  52. IMPLEMENT SELECTION RENDERING
  53. IMPROVE SceneGrid LOOK
  54. - LIKELY USE PIXEL SceneGrid WITH AA
  55. - OR (better) instead of drawing rows and columns of lines, just draw a plane with procedural texture
  56. LATER:
  57. - Need a way to render text for gizmos and handles, and in scene in general
  58. - Add drag to select
  59. - Need a better system to catch broken shaders. DX11 just draws nothing with depth, DX9 draws all white.
  60. - The bounds I retrieve from GUIUtility are relative to the entire window, not just the current widget.
  61. - Set up Application::getPrimaryViewport so it returns a valid viewport otherwise C# Camera won't work properly
  62. ---------------------------------------------------------------------
  63. Render textures in C#:
  64. - In C# have Texture2D, TextureCube, TextureVolume. They should have a common Texture base.
  65. - Each of those can be created with a Renderable flag
  66. - Render textures mirror what we have in C++
  67. - RenderTexture and MultiRenderTexture (since we have these separate representation we don't need RenderBuffer that Unity has)
  68. - You can provide an existing texture from types listed above, or create a new render target and
  69. create a basic 2D texture (multiple constructors)
  70. - Both RT types should have their color buffer (s) and depth buffer accessible as a texture to be used for rendering, or for reading
  71. ----------------------------------------------------------------------
  72. Handles
  73. SliderLine - position, direction, length
  74. - When initially activated it records position nearest so the line as the starting point
  75. - Further mouse dragging also finds nearest position to the line
  76. - Difference between those two results in a float value (how much to move along direction from position to reach new position)
  77. - Slider line has a capsule + sphere collider size of which can be set manually
  78. SliderPlane - position, normal, size
  79. - Similar to line slider only the direction is determined dynamically as well as distance
  80. - Outputs a Vector2 (direction * distance moved)
  81. - A OOB is used as a collider
  82. SliderDisc - position, normal, radius
  83. - When initially activated it records position nearest so the disc as the starting point
  84. - Further movement calculates the dynamic direction from the starting point to the current point on the plane the disc lies on
  85. - Distance along that direction is returned as amount of movement (similar to line slider)
  86. - Outputs a single float
  87. - A torus is used as a collider
  88. Free move/rotate/scale handles need to exist as well
  89. - Scale is easy, just perform uniform scale. Use SliderPlane oriented towards camera
  90. - Move also use SliderPlane oriented towards camera
  91. - Rotation use SliderDisc oriented towards camera
  92. ----------------------------------------------------
  93. STAGE 1
  94. CONCRETE TODO:
  95. HandleSliderPlane/HandleSliderDisc
  96. - update() implementation
  97. ----------------------------------------------------
  98. STAGE 2
  99. Implement RotateHandle & ScaleHandle in C#
  100. - Nearest point to disc/arc code
  101. Add free move, free rotate, free scale functionality
  102. Handles that remain the same size regardless of distance from camera
  103. - For both drawing and collision
  104. More complex types for drawing like DrawArrow in HandleDrawManager
  105. ----------------------------------------------------------------------
  106. SelectionRenderer
  107. Retrieve a list of selected objects from SelectionManager
  108. Find ones with Renderable components
  109. Retrieve Meshes, and world transforms from them
  110. Draw that same mesh with either a wireframe or a grayed out shader with a slight depth bias
  111. ---------------------------------------------------------------------
  112. Multi-resources
  113. Importer::import
  114. - Each SpecificImporter is responsible for importing all needed resources and registering them with Resources manager
  115. - However only the main resource is returned from that method
  116. - Rest of the resources are referenced by the UUID in ResourceMeta and can be retrieved there if needed
  117. Resources::save
  118. - Add to documentation that it will only save that exact resource and not any dependencies, you must call save() for them manually
  119. Resources::load
  120. - Will automatically load all dependencies, optionally add a boolean that allows you to load only the main asset
  121. ProjectLibrary
  122. - Needs to be extended so it shows sub-resources in tree view
  123. - 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?)
  124. ---------------------
  125. With this approach I can:
  126. - Reference and load the sub-resources directly
  127. - Technically I can also delete sub-resources