Lecture #15. Per frame updates

Computer graphics in Game development

Ivan Belyavtsev

22.10.2022

Window procedure events

  • WM_KEYDOWN - each time when user press a key
  • WM_KEYUP - each time when user release a key
  • WM_PAINT - each time when the windows is redrawing [1]

On update method

  • Adjust the world variables according to modifiers
  • Recalculate projection matrices
  • Measure performance [1]

Order of linear transformation

  • Linalg.h: mul(mat<T,M,N> a, vec<T,N> b)
  • DirectXMath: XMVECTOR XM_CALLCONV XMVector4Transform(FXMVECTOR V, FXMMATRIX M) [2]

View and projection matrices

// View matrix
DirectX::FXMVECTOR eye_position{position.x, position.y,position.z};
// ..
DirectX::XMMatrixLookToRH(eye_position, eye_direction, up_direction);

// Perspective matrix
DirectX::XMMatrixPerspectiveFovRH(angle_of_view, aspect_ratio, z_near, z_far);

On key down

  • Parse the keystroke
  • Adjust the modifiers [1]

On key up

  • Parse the keystroke
  • Reset the modifiers [1]

Lab: 3.08 Per frame updates

  1. Check code of window_proc
  2. Implement get_dxm_view_matrix, get_dxm_projection_matrix, and get_dxm_mvp_matrix methods of camera
  3. Implement update method of dx12_renderer

Homework

  1. Implement DX12 labs (fix TODO 3.01-3.08)
  2. Mark your final commit with dx12 tag
  3. Push your implementation and the dx12 tag
  4. Make sure that an instructor has access to your repo (djbelyak on github)
  5. Submit your implementation in Moodle with the repo URL

Due date: 02.12.2022

References

1.
Satran M., Jacobs M. Get started with Win32 and c++ [Electronic resource]. 2018. URL: https://docs.microsoft.com/en-us/windows/win32/learnwin32/learn-to-program-for-windows.
2.
DirectXMath programming guide [Electronic resource]. 2018. URL: https://docs.microsoft.com/en-us/windows/win32/dxmath/ovw-xnamath-progguide.
// reveal.js plugins