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

45 lines
4.2 KiB
Plaintext
Raw Permalink Normal View History

[video output=day301 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Sorting with Sprite Bounds" vod_platform=youtube id=SSgo0UdesQg annotator=Miblo]
[0:02][Recap and set the stage for the day]
[4:37][handmade_sort.cpp: Double check that the sense of IsInFrontOf() is correct]
[5:46][handmade_sort.cpp: Consider how to get sorting into layers for free, and turning the whole renderer into sprite-bound sorting]
[9:35][handmade_render_group.h: Consider excising SortKey entirely from entity_basis_p_result]
[10:52][handmade_render_group.cpp: Make PushRenderElement_() take a sort_sprite_bound rather than SortKey]
[13:13][handmade_sort.cpp: Separate sort_sprite_bound out into sprite_bound and make IsInFrontOf() take sprite_bound]
[15:01][handmade_sort.cpp: Consider which are the correct values to pass to PushBitmap()]
[17:14][handmade_render_group.h and *.cpp: Delete SortKey from entity_basis_p_result]
[18:55][handmade_render_group.cpp: Make PushBitmap() set the SpriteBound.YMin and .ZMax for Upright sprites]
[23:42][handmade_render_group.cpp: Make PushBitmap() set the SpriteBound.YMin, .YMax and .ZMax for non-Upright sprites]
[25:28][handmade_render_group.cpp: SpriteBound]
[26:32][handmade_render_group.cpp: Consider making PushRect() do the same calculations as PushBitmap(), and make Clear() sort below everything]
[27:48][handmade_render_group.cpp: Introduce GetBoundFor() and pull functionality into it from PushBitmap()]
[29:14][Run the game and run into a world of hurt very quickly]
[30:04][handmade_sort.cpp: Introduce GetSortEntries() in order to cast Entries to sort_sprite_bound]
[32:28][handmade_render.cpp: Make SortEntries() call GetSortEntries() and no longer call RadixSort() in favour of MergeSort()]
[34:25][handmade_render.cpp: Pull GetSortEntries() in from handmade_sort.cpp: and introduce GetSortTempMemorySize()]
[35:23][win32_handmade.cpp: Make WinMain() call GetSortTempMemorySize()]
[36:33][handmade_sort.cpp: Make SortEntries() a TIMED_FUNCTION()]
[37:35][Debugger: Step into SortEntries() and inspect the SortKey values for EntryA and EntryB]
[41:02][handmade_sort.cpp: #if 0 the HANDMADE_SLOW code in SortEntries(), run the game and see nothing]
[42:10][handmade.cpp: Make GAME_UPDATE_AND_RENDER() just play the Cutscene]
[43:00][Debugger: Break into SortEntries() and ensure that the sense of the IsInFrontOf() and MergeSort() are correct]
[47:23][build.bat: Disable HANDMADE_INTERNAL and #define DEBUG_ macros in handmade_debug_interface.h]
[49:06][Debugger: Break into SortEntries() and inspect the SortKey() values for the first 8 Entries]
[50:23][Mini Owl of Shame Moment: This is not a front-to-back renderer]
[50:54][handmade_sort.cpp: Make IsInFrontOf() sort in the correct direction]
[51:47][Run the game and find that our fundamentals are not completely messed up]
[52:35][handmade.cpp: Make GAME_UPDATE_AND_RENDER() go straight to the game, and then run the game and determine that we never fail our check in an obvious linear sweep]
[53:36][handmade_entity.cpp: Make UpdateAndRenderEntities() draw entities in Z without flattening them to the plane]
[54:39][Run the game and find that we're not getting the expected sort]
[55:05][build.bat: Enable HANDMADE_INTERNAL]
[56:08][Q&A][:speech]
[57:05][@andrewrussellnet][Hey Casey, managed to make the stream today. Just wanted to pop in and say hi]
[58:40][@cvaucher][The coordinates used for the sort rules are world space, right? Would another approach be to sort the screen space coordinates from the top of the screen down?]
[59:14][Blackboard: Cases against being able to sort screen space without Z]
[1:04:46][@andrewrussellnet][I have a question about your development approach: I don't think I've ever seen you create a separate program or environment to test stuff. You always seem to work within the running game. Do you ever find this "noisy"?]
[1:10:17][@andrewrussellnet][I realise I tell a lie now. I have seen you do something along those lines on Witness Wednesdays, just less so on Handmade Hero]
[1:12:47][@magik603][How do you clean all the directories without deleting them?]
[1:14:25][Demo Math Visualizations]
[1:23:00][@andrewrussellnet][That was really awesome to see! Thanks!]
[1:23:28][Close it on up][:speech]
[/video]