MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / g3_GetViewPortMatrix

Function g3_GetViewPortMatrix

renderer/HardwareSetup.cpp:41–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39float g3_GetAspectRatio() { return sAspect; }
40
41void g3_GetViewPortMatrix(float *viewMat) {
42 // extract the viewport data from the renderer
43 int viewportWidth, viewportHeight;
44 int viewportX, viewportY;
45 rend_GetProjectionScreenParameters(viewportX, viewportY, viewportWidth, viewportHeight);
46
47 float viewportWidthOverTwo = ((float)viewportWidth) * 0.5f;
48 float viewportHeightOverTwo = ((float)viewportHeight) * 0.5f;
49
50 // setup the matrix
51 memset(viewMat, 0, sizeof(float) * 16);
52 viewMat[0] = viewportWidthOverTwo;
53 viewMat[5] = -viewportHeightOverTwo;
54 viewMat[12] = viewportWidthOverTwo + (float)viewportX;
55 viewMat[13] = viewportHeightOverTwo + (float)viewportY;
56 viewMat[10] = viewMat[15] = 1.0f;
57}
58
59void g3_GetProjectionMatrix(float zoom, float *projMat) {
60 // get window size

Callers 1

g3_StartFrameFunction · 0.85

Calls 1

Tested by

no test coverage detected