MCPcopy Create free account
hub / github.com/defold/defold / Matrix4_Perspective

Function Matrix4_Perspective

engine/script/src/script_vmath.cpp:1573–1586  ·  view source on GitHub ↗

creates a perspective projection matrix * Creates a perspective projection matrix. * This is useful to construct a projection matrix for a camera or rendering in general. * * @name vmath.matrix4_perspective * @param fov [type:number] angle of the full vertical field of view in radians * @param aspect [type:number] aspect ratio * @param near [type:number] coordina

Source from the content-addressed store, hash-verified

1571 * ```
1572 */
1573 static int Matrix4_Perspective(lua_State* L)
1574 {
1575 float fov = (float) luaL_checknumber(L, 1);
1576 float aspect = (float) luaL_checknumber(L, 2);
1577 float near_z = (float) luaL_checknumber(L, 3);
1578 float far_z = (float) luaL_checknumber(L, 4);
1579 if(near_z == 0.0f)
1580 {
1581 luaL_where(L, 1);
1582 dmLogWarning("%sperspective projection invalid, znear = 0", lua_tostring(L,-1));
1583 }
1584 PushMatrix4(L, Matrix4::perspective(fov, aspect, near_z, far_z));
1585 return 1;
1586 }
1587
1588 /*# creates a matrix from a quaternion
1589 * The resulting matrix describes the same rotation as the quaternion, but does not have any translation (also like the quaternion).

Callers

nothing calls this directly

Calls 3

luaL_checknumberFunction · 0.85
luaL_whereFunction · 0.85
PushMatrix4Function · 0.85

Tested by

no test coverage detected