[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Room-based Camera Zoom" vod_platform=youtube id=ASewPs1n-GA annotator=Miblo] [0:09][Promote Handmade.Network's new "Submit a Project" functionality[ref site="Handmade.Network" page="Project List" url="https://handmade.network/projects"]] [1:59][A few words on "Handmade" and the projects currently in the Network] [6:43][Promote the Handmade.Network Forums[ref site="Handmade.Network" page="Forums" url="https://handmade.network/forums"]] [7:44][Consult the issues and determine to fix the CLANG compatibility[ref site="GitHub" page="HandmadeHero/cpp Issues" url="https://github.com/HandmadeHero/cpp/issues"]] [10:52][On ending macros with __VA_ARGS__] [12:24][handmade_debug_interface.h: Prevent the TIMED_FUNCTION() macro from taking __VA_ARGS__, and the TIMED_BLOCK() ones from taking Number] [15:10][Run the game to see everything running properly, and comment on the issue] [17:24][Consider working on the camera code] [23:17][Illustrate how the camera system is currently working] [25:33][handmade_entity.h: Introduce CameraHeight variable] [27:15][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() to offset Z based on CameraHeight] [27:59][handmade_world_mode.cpp: Enable AddStandardRoom() to compute the CameraHeight based on the room proportions] [30:17][Run the game to see that it's already sort of working] [32:59][Blackboard: Room Camera Fitting] [37:40][Blackboard: Computing the camera's viewing distance] [41:45][Blackboard: Solving for the desired distance] [46:03][handmade_render_group.cpp: Explain Uproject()] [48:15][handmade_render_group.cpp: Introduce FitCameraDistanceToRectangle()] [51:22][Blackboard: Focal length[ref site="Wikipedia" page="Focal length" url="https://en.wikipedia.org/wiki/Focal_length"]] [56:18][handmade_render_group.cpp: Introduce FitCameraDistanceToDimension()] [59:17][handmade_render_group.cpp: Rename both FitCameraDistanceToRectangle() and FitCameraDistanceToDimension() to FitCameraDistanceToHalfDim(), one which returns a v2 and calls the other twice] [1:01:26][handmade_render_group.h: Consider removing DistanceAboveTarget from the camera_transform struct] [1:05:16][handmade_render_group.h: Replace DistanceAboveTarget in the camera_transform struct with a v3 CameraP] [1:06:25][handmade_render_group.cpp and handmade_world_mode.cpp: Change all necessary functions to use this CameraP] [1:11:38][handmade_entity.cpp: Make UpdateAndRenderEntities() set the CameraP] [1:13:35][handmade_world_mode.cpp: Make AddStandardRoom() manually offset the CameraHeight by 11, run the game and consider our problems] [1:16:46][handmade_world_mode.cpp: Consider what UpdateAndRenderWorld() is doing] [1:20:15][handmade_particles.cpp: Remove CameraP entirely from the particle pipeline, run the game and see our restored particles] [1:21:48][handmade_entity.cpp: Make UpdateAndRenderEntities() correctly compute CameraRelativeGroundZ, run the game and see our entities restored] [1:24:06][handmade_world_mode.cpp: Make AddStandardRoom() create an entity_collision_volume_group RoomCollision] [1:26:55][handmade_world_mode.cpp: #define TileSideInMeters] [1:29:41][Run the game and see that the bound properly encompasses the room] [1:31:19][handmade_sim_region.cpp: Enable UpdateCameraForEntityMovement() to set the Camera->Offset differently] [1:34:23][Run the game and consider camera centering] [1:37:26][handmade_sim_region.cpp: Add assertion in UpdateCameraForEntityMovement() that we are InRoom, run the game and do not hit that assertion] [1:40:23][handmade_sim_region.cpp: Consider the impact of the changeover coinciding with the time the sim region moves between blocks] [1:44:18][handmade_sim_region.cpp: Prevent UpdateCameraForEntityMovement() from setting the Offset, run the game and crash in the debug system] [1:45:31][handmade_debug.cpp: Look at GetElementFromEvent()] [1:47:06][handmade_sim_region.cpp: Document the assumption that the camera center be the sim region center] [1:47:58][Run the game and consider the camera displacement] [1:52:39][handmade_world_mode.cpp: Make UpdateAndRenderWorld() draw a rectangle around the sim region, run the game and find that it is not lined up with the room] [1:57:01][Step through BeginWorldChange() and inspect the SimRegion dimensions] [1:58:11][Step through UpdateCameraForEntityMovement() and inspect the room entity's P] [1:59:29][handmade_world_mode.cpp: Make UpdateAndRenderWorld() reduce the Z offset for the debug rectangles] [2:00:42][handmade_render_group.cpp: Consider the possibility that GetRenderEntityBasisP() is computing a bogus HeightOffFloor] [2:01:37][Q&A][:speech] [2:02:19][@Kknewkles][Hi! For how long is this bliss of weekend episodes gonna continue? Got any news in the making for us?] [2:03:51][@Kknewkles][You didn't answer about the news, though] [2:04:19][@klemensbaum][Q: A bit off-topic, but why do you use your headphone mic rather than the nice studio mic you have on the Jeff and Casey show?] [2:05:28][@zilarrezko][The camera doesn't seem to be centered perfectly. Working as intended?] [2:05:46][@mtsmox][Could you disable the Y displacement to test your theory?] [2:06:42][@krrsplat][Started following the series on YouTube, and have made it to episode 14. Loving it so far. When I try to build solution in VS, I am unable to do so unless I put the #defines and typedefs into every file. Is this a VS thing or am I doing it wrong? Sorry for going way back[ref site="Handmade Hero Forums" page="How do you set up VS to output a dll?" url="https://hero.handmade.network/forums/code-discussion/t/137"]] [2:13:10][Promote Handmade.Network and the new "Submit a Project" functionality[ref site="Handmade.Network" page="Project List" url="https://handmade.network/projects"]][:research] [2:21:06][That's it for today][:speech] [/video]