[video output=day522 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Solving for Sorting Displacement" vod_platform=youtube id=q8_iHs_GJPs annotator=Miblo]
[0:02][Recap yesterday's post-stream suggestion from @binjimin, that our erroneous ParentAlignType may be caused by an unset parent TextureHandle][:speech]
[1:25][Change UpdateAndRenderEntities() to acquire the TextureHandle after having set all the BitmapInfo][:"entity system"]
[4:47][Separating streaming and non-streaming information][:memory :speech]
[7:09][Change WorldDimFromWorldHeight() to take a hha_bitmap *][:"entity system"]
[8:26][Find that the game runs, trusting that we've solved the ParentAlignType bug][:"entity system" :run]
[9:18][Snapping sprite stacks to be fully aligned when at the center of the scene][:camera :"entity system" :research]
[10:28][Demonstrate our sprite alignment requirements][:camera :"entity system" :run]
[13:33][Offsetting pieces, e.g. head bobbing, after aligning the sprite stack][:camera :"entity system" :research]
[17:42][Align for Default :Camera][:blackboard :"entity system"]
[24:09][Solving our child−parent sprite alignment][:blackboard :camera :"entity system" :geometry]
[30:08][Make UpdateAndRenderEntities() align child sprites to their parent as per our diagram][:camera :"entity system" :geometry]
[37:25][Find that our child−parent sprite snapping works just great][:camera :"entity system" :geometry :run]
[39:56][Make UpdateAndRenderEntities() apply the Piece->Offset][:camera :"entity system" :geometry]
[40:27][Find that our child and parent sprites' alignment points are not aligned][:camera :"entity system" :geometry :run]
[43:21][Make AddPlayer() elevate the hero's head higher][:camera :"entity system" :geometry]
[44:25][Check out our perspective shifting, and determine to handle rotating sprites][:camera :"entity system" :geometry :run]
[46:13][Aligning rotating sprites][:camera :"entity system" :research]
[53:44][Replacing entity pieces with sprite snapping][:"entity system" :run]
[54:56][Temporarily make UpdateAndRenderEntities() spin the hero's head and glove][:camera :"entity system"]
[56:51][Note the pulsing of rotating sprites caused by MinP no longer always representing the lowest point on the sprite][:camera :"entity system" :run]
[57:30][Make SpriteValuesForUpright() compute a ZDisplacement to provide a stable lowest point][:camera :"entity system"]
[1:01:15][Find that our rotating sprites now remain at a stable elevation][:camera :"entity system" :run]
[1:02:56][Remove the test spinning code from UpdateAndRenderEntities()][:camera :"entity system"]
[1:03:47][Make UpdateAndRenderEntities() hide sprites when their alignment point is disabled, changing FindAlign() to return a find_align_result][:"entity system" :ui]
[1:11:05][Try toggling alignment points / sprites][:"entity system" :run :ui]
[1:11:34][Begin to change UpdateAndRenderEntities() to hide the child sprites of parents][:"entity system" :ui]
[1:15:52][Delete the lot of the sprite hiding code][:"entity system" :ui]
[1:16:37][Add a "Show Children" button in our asset editor, introducing ShouldDrawChildren() for UpdateAndRenderEntities() to call][:"entity system" :ui]
[1:24:24][Try out our "Show Children" button, without success][:"entity system" :run :ui]
[1:25:10][Make InitializeEditor() enable ShouldDrawChildren and proofread our new children hiding code][:"entity system" :ui]
[1:28:27][Note that our entity selection does not record which specific asset we clicked][:"entity system" :run :ui]
[1:29:16][Scour our child sprite hiding code][:"entity system" :research :ui]
[1:32:36][Find that the hero's "head" child sprite never gets hidden][:"entity system" :run :ui]
[1:34:24][Step in to ShouldDrawChildren() and compare the ParentID and HitTest->Editor->HighlightID][:"entity system" :run :ui]
[1:38:36][Find that DevIDFromU32s() differentiates one dev_id from another by their file and line number][:"entity system" :run :ui]
[1:39:09][Introduce CopyType() to harmonise two separate dev_id settings][:"entity system"]
[1:40:59][Find that our "Show Children" button remains busted][:"entity system" :run :ui]
[1:42:14][Step in to ShouldDrawChildren() and again compare our values to find that they differ][:"entity system" :run :ui]
[1:44:31][Fix CopyType() to persist its work][:"entity system"]
[1:45:01][Try out our "Show Children" button with success][:"entity system" :run :ui]
[1:45:40][Prevent EditorInteract() from deselecting assets when moving the :camera][:"entity system" :ui]
[1:46:49][Try out our asset editor][:"entity system" :run :ui]
[1:48:20][Condense the asset editor, introducing HHAEditor()][:"entity system" :ui]
[1:52:49][Check out our condensed asset editor][:"entity system" :run :ui]
[1:53:31][Fix F4 to display the HHA page, and remove SectionPicker()][:"entity system" :ui]
[1:54:08][Try out our slicker asset editor, aligning the hero][:"entity system" :run :ui]
[2:01:06][Reload the game to find the our alignment points persist, and align Molly and Orphan #4][:"entity system" :run :ui]
[2:06:06][Q&A][:speech]
[2:06:28][@0lpbm][Q: Shouldn't body pieces' displacement be a function of :camera distance (and maybe angle)?][:"entity system"]
[2:07:48][@0lpbm][Q: If nobody jumps in with another Q, maybe can you do the gloves?][:"entity system"]
[2:08:31][@pragmascrypt][Q: Suggestion: Maybe turn down :lighting quality in debug mode so debug can run with higher FPS again][:performance]
[2:08:38][@saidwho12][Q: What graphics :API(s) does [~hero Handmade Hero] use?]
[2:09:13][@vapenir][Q: Speaking of :lighting, I assume this isn't what the final lighting will look like, right? What do you have planned for that?]
[2:10:09][@eyedoteye][Q: Dear [@cmuratori Mr Muratori], I followed like 15 of your videos and now I'm in a game dev studio. Are you proud of me, Sensei?]
[2:10:35][@vapenir][Q: Have you tried out Vulkan on any project yet?][:api]
[2:11:03][@wheeel][Q: What causes the flickering in the :lighting?]
[2:11:24][@0lpbm][Q: The skewing when moving on Y is only applied on the body. Should the head also be modified?][:camera :"entity system"]
[2:12:10][@saidwho12][Q: Is light estimated using Monte Carlo integration?][:lighting]
[2:13:14][@centhusiast][Q: Is there any good article on :camera in the computer graphic field or video games? I am ready to learn in detail about the camera. Thanks![ref
    author="Johannes Hanika, Carsten Dachsbacher"
    title="Efficient Monte Carlo Rendering with Realistic Lenses"
    url=https://cg.ivd.kit.edu/publications/pubhanika/2014_lenssim.pdf][ref
        author="Craig Kolb, Don Mitchell, Pat Hanrahan"
        title="A Realistic Camera Model for Computer Graphics"
        url=https://www.cs.utexas.edu/~fussell/courses/cs395t/lens.pdf][ref
            author="Matt Pharr, Wenzel Jakob, Greg Humphreys"
            title="Physically Based Rendering: From Theory To Implementation"
            url=http://www.pbr-book.org/]]
[2:19:58][@myop][Q: Regarding Vulkan, I really wonder why you think it's not relevant these days. Or are you talking about your current project? Thanks][:api]
[2:22:45][@ormone88][Q: Are you going to to compose specific particle effects with the editor, or are they all going to be composed at runtime?][:"particle system" :ui]
[2:23:55][@botondar][Nintendo Switch is kinda pushing Vulkan, isn't it? Which I guess is kind of similar to mobile programming][:api]
[2:26:07][@insobot][Structname membername =]
[2:26:43][@vapenir][id announced they're going Vulkan-only for the next engine, for whatever it's worth][:api]
[2:27:59][@vapenir][Does OS support really matter that much? Seems like it's really the GPU / driver vendors who you have to care about][:api]
[2:29:09][@botondar][Q: Hasn't this "have to use the platform specific :API" thing always been the case for multiplatform console games?]
[2:30:06][@saidwho12][Linux people care a lot about Vulkan, though, if that means anything][:api]
[2:31:22][@hexadecimalinteger][Even macOS is not worth it for most][:api]
[2:31:59][Close it up][:speech]
[/video]
