shadow_test: box visualization for light

This commit is contained in:
Zack Buhman 2026-04-14 19:17:43 -05:00
parent 779b837caa
commit 2b0b29aeb9
5 changed files with 1906 additions and 905 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -112,11 +112,12 @@ XMMATRIX currentProjection()
return projection; return projection;
} }
XMMATRIX currentView(collada::instance_types::node const & camera_node) XMMATRIX currentView(collada::instance_types::node const & camera_node,
collada::instance_types::node const & camera_target_node)
{ {
XMVECTOR eye = XMVector3Transform(XMVectorZero(), camera_node.world); XMVECTOR eye = XMVector3Transform(XMVectorZero(), camera_node.world);
XMVECTOR at = XMVectorSet(0, 0, 0, 0); XMVECTOR at = XMVector3Transform(XMVectorZero(), camera_target_node.world);
XMVECTOR up = XMVectorSet(0, 0, 1, 0); XMVECTOR up = XMVectorSet(0, 0, 1, 0);
XMMATRIX view = XMMatrixLookAtLH(eye, at, up); XMMATRIX view = XMMatrixLookAtLH(eye, at, up);
return view; return view;
@ -1204,6 +1205,7 @@ int main()
SDL_GetCurrentTime(&start_time); SDL_GetCurrentTime(&start_time);
int cameraIndex = collada_state.find_node_index_by_name("Camera001"); int cameraIndex = collada_state.find_node_index_by_name("Camera001");
int cameraTargetIndex = collada_state.find_node_index_by_name("Camera001.Target");
while (quit == false) { while (quit == false) {
SDL_Event event; SDL_Event event;
@ -1379,10 +1381,11 @@ int main()
collada_state.vulkan.change_frame(commandBuffer, frameIndex); collada_state.vulkan.change_frame(commandBuffer, frameIndex);
double time = getTime(start_time); double time = getTime(start_time);
collada_state.update(time / 3.0f); collada_state.update(time / 5.0f);
XMMATRIX projection = currentProjection(); XMMATRIX projection = currentProjection();
XMMATRIX view = currentView(collada_state.node_state.node_instances[cameraIndex]); XMMATRIX view = currentView(collada_state.node_state.node_instances[cameraIndex],
collada_state.node_state.node_instances[cameraTargetIndex]);
collada_state.vulkan.transfer_transforms(projection, collada_state.vulkan.transfer_transforms(projection,
view, view,