MCPcopy Create free account
hub / github.com/assimp/assimp / GetProjectionMatrix

Function GetProjectionMatrix

tools/assimp_view/assimp_view.cpp:1019–1039  ·  view source on GitHub ↗

-------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1017
1018//-------------------------------------------------------------------------------
1019int GetProjectionMatrix(aiMatrix4x4 &p_mOut) {
1020 const float fFarPlane = 100.0f;
1021 const float fNearPlane = 0.1f;
1022 const float fFOV = (float)(45.0 * 0.0174532925);
1023
1024 const float s = 1.0f / tanf(fFOV * 0.5f);
1025 const float Q = fFarPlane / (fFarPlane - fNearPlane);
1026
1027 RECT sRect;
1028 GetWindowRect(GetDlgItem(g_hDlg, IDC_RT), &sRect);
1029 sRect.right -= sRect.left;
1030 sRect.bottom -= sRect.top;
1031 const float fAspect = (float)sRect.right / (float)sRect.bottom;
1032
1033 p_mOut = aiMatrix4x4(
1034 s / fAspect, 0.0f, 0.0f, 0.0f,
1035 0.0f, s, 0.0f, 0.0f,
1036 0.0f, 0.0f, Q, 1.0f,
1037 0.0f, 0.0f, -Q * fNearPlane, 0.0f);
1038 return 1;
1039}
1040
1041//-------------------------------------------------------------------------------
1042aiVector3D GetCameraMatrix(aiMatrix4x4 &p_mOut) {

Callers 2

RenderFullSceneMethod · 0.85
OnPostRenderMethod · 0.85

Calls 1

aiMatrix4x4Class · 0.85

Tested by

no test coverage detected