本文整理汇总了C++中Mat4::loadProjection方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4::loadProjection方法的具体用法?C++ Mat4::loadProjection怎么用?C++ Mat4::loadProjection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4
的用法示例。
在下文中一共展示了Mat4::loadProjection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: orthographic
void GLFunctions::orthographic(float _width,float _height, float _zNear, float _zFar)
{
float right = _width/2.0f;
float top = _height/2.0f;
Mat4 result;
result.m_00 = 1.0f / right;
result.m_11 = 1.0f / top;
result.m_22 = -2.0f / (_zFar - _zNear);
result.m_23 = -(_zFar + _zNear) / (_zFar - _zNear);
result.loadProjection();
}
示例2: perspective
void GLFunctions::perspective(float _fovy,float _aspect, float _zNear, float _zFar)
{
float range = tan(radians(_fovy / 2.0)) * _zNear;
float left = -range * _aspect;
float right = range * _aspect;
float bottom = -range;
float top = range;
Mat4 result;
result.m_00 = (2.0f * _zNear) / (right - left);
result.m_11 = (2.0f * _zNear) / (top - bottom);
result.m_22 = - (_zFar + _zNear) / (_zFar - _zNear);
result.m_23 = - 1.0f;
result.m_32 = - (2.0f* _zFar * _zNear) / (_zFar - _zNear);
result.loadProjection();
}