cinera_handmade.network/cmuratori/hero/code/code491.hmml

79 lines
8.6 KiB
Plaintext
Raw Permalink Normal View History

[video output=day491 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Debugging the Basic Editor UI" vod_platform=youtube id=1vq8sVOzGRQ annotator=Miblo]
2018-12-01 23:53:30 +00:00
[0:01][Recap and set the stage for the day wiring up our asset editor][:"asset system" :speech :ui]
[1:03][:Run the game to show our current asset editor :UI][:"asset system"]
[2:36][A few words on our immediate-mode user interface][:speech :ui]
[8:42][Introduce the notion of an Immediate Button][:ui]
[15:22][See if there's anything of DEBUGInteract() that could be shared between the asset and debug systems][:"asset system" :"debug system" :research :ui]
[18:24][Introduce EditorInteract() for GameUpdateAndRender() to call, guided by DEBUGInteract()][:"asset system" :ui]
[29:50][Enable EditorInteract() to handle mouse input][:"asset system" :"input handling" :ui]
[42:40][:Run the game and crash in Undo()][:"asset system" :"undo / redo"]
[43:05][Introduce IsValid() for Button() to call][:"asset system" :ui :"undo / redo"]
[44:59][:Run the game to see all our :UI buttons lighting up because they share the same ID][:"asset system" :ui]
[45:36][Try making Button() set the ID from the passed LabelText][:"asset system" :ui]
[46:41][:Run the game to see that buttons with the same label light up, due to our compiler doing string pooling][:"asset system" :ui]
[47:14][String pooling][:language :speech]
[48:11][Make Button() take a dev_id ID which AssetEditor() is responsible for constructing][:"asset system" :ui]
[49:57][Introduce DevIDFromPointer() calling a newly introduced FILE_AND_LINE(), and rename UniqueFileCounterString() to DEBUG_NAME()][:"asset system" :"debug system"]
[57:42][Make AssetEditor() and UpdateAndRenderEditor() call DevIDFromPointer()][:"asset system" :ui]
[58:41][:Run the game to find that our :UI buttons light up individually, and that Undo() crashes][:"asset system" :"undo / redo"]
[59:34][Introduce Sentinelize() to initialise the Undo and Redo lists][:"asset system" :"undo / redo"]
[1:01:47][:Run the game to find that Undo and Redo are unavailable][:"asset system" :ui :"undo / redo"]
[1:02:07][Make AllocateEditorEdit() call PushFirst()][:"asset system" :"undo / redo"]
[1:04:32][:Run the game and crash in Undo()][:"asset system" :ui :"undo / redo"]
[1:04:55][Make EndUIFrame() clear the UI->IDToExecute to prevent Undo from operating forever][:"asset system" :ui :"undo / redo"]
[1:05:33][:Run the game to find that our button clicks do not perform an edit][:"asset system" :ui]
[1:05:46][Augment dev_ui with a NextIDToExecute so that EndUIFrame() may set an IDToExecute that is valid for the current frame only][:"asset system" :ui]
[1:07:49][:Run the game to find that edits, Undo and Redo all work, but Revert crashes][:"asset system" :ui :"undo / redo"]
[1:08:11][Make InitializeEditor() initialise the CleanUndoSentinalNext][:"asset system" :ui :"undo / redo"]
[1:09:02][:Run the game to find that Revert now works, but Delete does not][:"asset system" :ui :"undo / redo"]
[1:10:00][Fix AssetEditor() to correctly delete edits][:"asset system" :ui]
[1:11:55][:Run the game to find that deletion works, and prioritise our next steps: 1) Asset selection; 2) :UI positioning; 3) UI edit interaction][:"asset system"]
[1:13:55][Enable EditorInteract() to handle asset picking on click][:"asset system" :ui]
[1:21:28][:Run the game to find that asset picking works][:"asset system" :ui]
[1:22:47][Dive into making UpdateAndRenderEntities() only highlight the selected entity][:"entity system" :ui]
[1:28:34][Introduce DevIDFromU32s() and a dev_id_value union to enable even 32-bit systems to use 64-bit IDs][:"asset system" :ui]
[1:34:38][Replace the u32 HighlightAssetIndex in editable_hit_test with a dev_id HighlightID, and make AssetEditor() set this HighlightID][:"asset system" :ui]
[1:37:08][:Run the game to find that the highlighting still occurs on hover][:"asset system" :"entity system" :ui]
[1:37:21][Make UpdateAndRenderEntities() only call PushVolumeOutline() to highlight the entity whose DevID matches the HighlightID][:"asset system" :"entity system" :ui]
[1:38:43][:Run the game to find that everyone highlights][:"asset system" :"entity system" :ui]
[1:39:21][Fix typo in DevIDFromU32s()][:ui]
[1:39:44][:Run the game to find that selection / highlighting works][:"asset system" :"entity system" :ui]
[1:40:01][Enable EditorInteract() to clear highlighting when clicking on no asset][:"asset system" :"entity system" :ui]
[1:41:00][:Run the game to find that highlight clearing works, but certain entities are tough to pick][:"asset system" :"entity system" :ui]
[1:42:11][Investigate the :sorting in RayInterectsBox()][:"entity system" :research]
[1:44:07][:Run the game to find that our currently picked entity seems to affect which entity we may pick next][:"asset system" :"entity system" :ui]
[1:45:39][Make EditorInteract() straight up set the HighlightID to the first asset in the hot group][:"asset system" :"entity system" :ui]
[1:46:17][:Run the game and move the cursor around the scene to see which entity gets highlighted][:"asset system" :"entity system" :ui]
[1:47:40][Make UpdateAndRenderEditor() set the HighlightID on every update][:"asset system" :"entity system" :ui]
[1:47:56][:Run the game to still see stickiness on some entities][:"asset system" :"entity system" :ui]
[1:50:18][Make UpdateAndRenderEntities() highlight whichever entity our ray cast hits][:"asset system" :"entity system" :ui]
[1:51:02][:Run the game to find that our cursor does not get stuck, which suggests that either our hit :sorting routine or ID setting may be incorrect][:"asset system" :"entity system" :ui]
[1:52:15][Make UpdateAndRenderEntities() highlight both our ray hits and the entity the :"asset system" told us to highlight][:"entity system" :ui]
[1:52:43][:Run the game to see these different highlights][:"asset system" :"entity system" :ui]
[1:54:17][Fix AddHit() to set the ID][:"asset system" :ui]
[1:54:42][:Run the game to find that our asset picking works perfectly][:"asset system" :"entity system" :ui]
[1:54:51][Revert UpdateAndRenderEditor() to only set the HighlightID on click][:"asset system" :"entity system" :ui]
[1:55:12][:Run the game to find that all is good, and consider our next steps][:"asset system" :"entity system" :ui]
[1:56:19][Q&A][:speech]
[1:57:28][@guybru5h_vi][Q: How long do you think it would have taken you to get to this level in the project if you were working on it 8 hours a day?]
[1:59:07][@cvaucher][Q: Is there a reason for making two lists for :"undo / redo" rather than one?]
[2:00:22][@montify][Q: Big engines support multiple render paths (D3D, OpenGL), but why do these engines not use only OpenGL instead of D3D?][:api]
[2:02:34][@euphius][Q: Which parts of C++ do you use?][:language]
[2:03:21][@pythno][Q: Follow-up question regarding OpenGL: Can you name some of the stuff of the subset they should have marked as OpenGL v5?][:api]
[2:04:10][@mekagem][Q: Then do you think Vulkan would not have this type of problem with bugs because it's more low level?][:api]
[2:06:13][@vaualbus][Q: So will we switch to D3D before shipping this game, or for simplicity will we stay with OpenGL?][:api]
[2:07:53][@easylovingyou][Q: Can you program shaders in :asm on Vulkan, or any of the other graphics APIs?][:api]
[2:10:57][@craterlord][Q: Doesn't that same problem APIs growing old and unsuitable for current graphics cards also apply to DX12?][:api]
[2:15:59][@pythno][Q: In [~hero Handmade Hero] I saw this concept of BeginRender / EndRender (I believe it is called) which reminds me of fixed function OpenGL glBegin, glEnd. Can you say how these functions in [~hero Handmade Hero] roughly work or what is the concept behind it?]
[2:16:49][@l04d][Q: Shouldn't these graphics APIs be made by GPU vendors, or can they not do that?][:api]
[2:18:09][@easylovingyou][Q: I mean current APIs. I know DX9 supports it up to 3.x or 4.0][:api]
[2:18:21][@gaius_is_best_colossus][Q: What do you expect people to learn with this series, other than how to make a game?]
[2:19:38][@guybru5h_vi][Q: Do you think next generation consoles will adopt raytracing extensions, even if just to avoid using shadow maps?]
[2:21:09][@blamebauer][Q: Why are most AAA games still running on DX11? Is DX12 too new and still not well supported?][:api]
[2:21:45][@serioussennaw][Q: What would make a graphics :API great?]
[2:22:04][@yoshimoto555][Q: How often do you read other people's code bases? Do you have any recommendations of good examples of well architected code bases to learn from?]
[2:23:15][@cacheoverride][Q: Was OpenGL 2.1 a great :API?]
[2:23:25][@xxthebigfoxx][Q: Is there a good :API for GUI applications on Windows that you would suggest?][:ui]
[2:23:47][Wrap it up][:speech]
[/video]