[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Returning to Work on Z Layers" vod_platform=youtube id=PYdOZ_r9RLw annotator=Miblo] [0:11][Recap and set the stage for the day] [2:08][handmade_world_mode.cpp: Make AddStandardRoom() generate multiple layers, run the game and see how wrong the sorting is] [3:24][A few words of encouragement on exploratory programming and embracing the forward flow of the architecture] [5:36][handmade_entity.cpp: Make UpdateAndRenderEntities() work as it did before the work on the sorting, run the game and see how it looks] [8:37][Blackboard: Z Slices and Two Separate Conceptualisations of What it Means to be Up] [11:29][Blackboard: Layered Alpha Blending] [17:57][Blackboard: Solving this Problem] [19:34][Blackboard: Render Buffers] [21:32][Blackboard: Back of the envelope calculation on the potential Graphics Memory available to us] [24:13][Blackboard: Back of the envelope calculation on the potential Memory Bandwidth available to us] [29:21][Consider how to proceed] [30:18][handmade_entity.cpp: Introduce a TestAlpha in UpdateAndRenderEntities()] [34:01][Run the game and see what happens] [34:46][Debugger: Break into UpdateAndRenderEntities() and inspect the fade values] [40:05][handmade_entity.cpp: Tweak the FadeTopEndZ and FadeTopStartZ values in UpdateAndRenderEntities(), and again break into it] [42:27][handmade_opengl.cpp: Pass Entry->PremulColor.a to the rectangle drawing glColor4f() call in OpenGLRenderCommands()] [43:49]["So I'm going to go work this out on the blackboard and figure out if I'm just... uh... on crack"][quote 523] [45:14][handmade_entity.cpp: Subtract WorldMode->CameraOffset.z from the CameraRelativeGroundZ computation in UpdateAndRenderEntities()] [45:42][Run the game and see that we're fine again] [47:00][Blackboard: What RecanonicalizeCoord is doing] [49:31][Blackboard: Offsetting Z] [51:01][handmade_world_mode.cpp: Make ChunkPositionFromTilePosition() Offset the entities' Z downwards] [53:12][handmade_world_mode.cpp: Make ChunkPositionFromTilePosition() compute TileDepthInMeters differently] [54:20][Debugger: Break into ChunkPositionFromTilePosition() and inspect the offset values] [57:38][Debugger: Break into ConvertToLayerRelative() and inspect the Z values] [59:50][handmade_entity.cpp: Provisionally compute the relative layer we want for the entities] [1:02:06][Q&A] [1:03:47][@insobot][Um. Because undefined behavior?] [1:04:30][@telepathyy][What keyboard do you have?] [1:05:40]["Like putting your finger in a cloud"][quote 506] [1:06:00][@bestofluck][Do you expect that the final game will contain enough sprites to warrant using a texture atlas to reduce the number of texture binds per frame?] [1:08:33][@khorm][I don't understand why the "base" Z value of each floor would be negative, it seems really contrived. It seems very logical to me to have 0 as as the "bottom". Maybe it has to do with rendering? I have not followed the latest shows] [1:09:50][Blackboard: Canonical Point for a Chunk] [1:13:22][Wrap it up] [/video]