[video output=day421 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Passing Lighting as Boxes" vod_platform=youtube id=ic7mS4tfv8Y annotator=Miblo]
[0:00][Welcome to the stream, power outage edition][:speech]
[2:04][Recap and set the stage for the day][:lighting :rendering :speech]
[3:43][Fix the P, N and XAxis for the fifth and sixth surfaces in PushCube()[ref
    site=GitHub
    page="Switched X surfaces positive and negative in PushCube rendergroup function"
    url=https://github.com/HandmadeHero/cpp/issues/64]][:lighting :rendering]
[7:41][:Run the game to see our hopefully corrected :lighting][:rendering]
[8:27][Flip back to the old settings in PushCube()][:lighting :rendering]
[8:42][:Run the game to see that bug exhibiting][:lighting :rendering]
[8:55][Redo the correction in PushCube()][:lighting :rendering]
[9:17][:Run the game and check out the newly corrected :lighting][:rendering]
[9:35][Close that bug[ref
    site=GitHub
    page="Switched X surfaces positive and negative in PushCube rendergroup function"
    url=https://github.com/HandmadeHero/cpp/issues/64]][:admin]
[10:29][Determine to compress PushCube()][:lighting :rendering :speech]
[13:49][Compress what we can of PushCube()][:lighting :rendering]
[36:38][Specify the lighting_box struct and begin to fix up compile errors in PushCube()][:lighting :rendering]
[40:10][Light Box Face Interpolation][:blackboard :geometry :lighting :rendering]
[42:22][Make PushCube() procedurally interpolate the :lighting surfaces for each axis][:geometry :rendering]
[45:55][Min and max corners of a cube vs its faces][:blackboard :geometry]
[46:40][Continue to make PushCube() interpolate the :lighting surfaces][:geometry :rendering]
[1:00:19][Switch DefaultRenderCommands() from lighting_surface to lighting_box][:lighting :rendering]
[1:02:16][Introduce GetBoxSurface() to perform some of the work of PushCube() for LightingTest() to call][:lighting :rendering]
[1:09:12][Compress LightingTest() using GetBoxSurface()][:lighting :rendering]
[1:18:12][Change OutputLightingPoints() to display the actually used axes][:"debug visualisation" :lighting :rendering]
[1:22:18][:Run the game and crash in LightingTest()][:lighting :rendering]
[1:23:19][Step in to LightingTest() and inspect the Surface][:lighting :rendering :run]
[1:24:11][Fix LightingTest() to correctly iterate over the box surfaces][:lighting :rendering]
[1:24:51][:Run the game to see that we are completely wrong][:lighting :rendering]
[1:25:32][Step in to LightingTest() and inspect the data][:lighting :rendering :run]
[1:26:26][Make GetBoxSurface() correctly set the YAxis][:lighting :rendering]
[1:26:57][:Run the game to see our :lighting surfaces][:"debug visualisation" :rendering]
[1:28:12][Check the time][:admin]
[1:28:21][@insobot][87 minutes into the main stream. 33 until Q&A. (based on NOTE)]
[1:28:48][:Run it in release mode][:lighting :rendering]
[1:29:17][Step through PushCube() and inspect the LightBox data][:lighting :rendering :run]
[1:31:54][Make GetBoxSurface() set the Span after setting the Max and Min corners][:geometry :lighting :rendering]
[1:32:44][Step through GetBoxSurface() and LightingTest() and inspect their data][:geometry :lighting :rendering :run]
[1:37:37][:Run the game and consider whether the debug and main views do not correspond][:"debug visualisation" :lighting :rendering]
[1:39:52][Step through LightingTest() to see that a Surface.Width is negative][:lighting :rendering :run]
[1:42:48][Note that Min in light_box_surface is not necessarily the minimum relative to the axes, and respecify light_box_surface][:geometry :lighting :rendering]
[1:48:41][:Run the game to view the :"debug visualisation"][:lighting :rendering]
[1:50:58][Step in to PushCube() to verify if the surfaces were pushed on in the expected order][:lighting :rendering :run]
[1:53:19][Reorder the PushQuad() calls in PushCube()][:geometry :lighting :rendering]
[1:56:13][:Run the game to see that we're closer][:lighting :rendering]
[1:57:31][Flip the Y PushQuad() calls in PushCube][:geometry :lighting :rendering]
[1:57:46][:Run the game to see that we're better][:lighting :rendering]
[1:58:58][Q&A][:speech]
[2:00:03][@areriff][Q: Is there any way to put a break point outside Visual Studio?]
[2:01:22][Pull up the profiler and note the cycle usage of ComputeLightPropagation][:performance :run]
[2:02:32][@theditv][Q: What do you think about the blockchain future? I have no idea if questions outside of the game are allowed][:currency]
[2:06:30][@vtlmks][Q: Shouldn't we go back to do more stuff in assembler like on the Amiga][:asm]
[2:06:39][@areriff][Q: How do you jump to a function during debugging? Usually there's a lot of functions and not easy to find them]
[2:07:37][@macielda][Q: @Jon tweeted once again about how X-Forward, Right Handed coordinate systems should be standard.[ref
    site=Twitter
    page="Right-handed, X-axis-forward everywhere is the simplest convention and the one that will cause you the fewest number of weird conversions. I wish we could standardize on that but so many people seem to think that -Z is forward ... aaaaargh"
    url=https://twitter.com/Jonathan_Blow/status/954483149962035200] Do you know details on why is that important?[ref
        site=Wikipedia
        page="Mars Climate Orbiter"
        url=https://en.wikipedia.org/wiki/Mars_Climate_Orbiter#Cause_of_failure]][:geometry :hardware :measurement]
[2:16:25][@elnar4uk][Q: What kind of :memory allocations do you use? Are there any custom stack allocations, pools etc. or are you using standard malloc / new? If custom, how do you define memory chunk size?]
[2:17:05][@gprincip][Q: Did you manually build all of the menus currently on the screen, or get it from somewhere?][:profiling :ui]
[2:17:32][@areriff][Q: Is ComputeLightPropagation 92% seems too high at the moment?]
[2:17:46][@euler9119][Q: Hi [@cmuratori Casey], would you be able to recommend good resources to learn / practise efficient programming habits (e.g. efficient algorithms, code, etc.)?]
[2:18:23][@ingenero][Q: Can :metaprogramming do everything and solve all the world's problems?]
[2:18:33][Close this up][:speech]
[/video]
