本文整理汇总了C++中Mat4x4::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4x4::Init方法的具体用法?C++ Mat4x4::Init怎么用?C++ Mat4x4::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4x4
的用法示例。
在下文中一共展示了Mat4x4::Init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateOrthoProjectionLH
Mat4x4 Anubis::CreateOrthoProjectionLH( const AREAL width, const AREAL height,
const AREAL nearZ, const AREAL farZ)
{
Mat4x4 mat;
mat.Init( Vector( 2.0f / width, 0, 0, 0),
Vector( 0, 2.0f / height, 0, 0),
Vector( 0, 0, 1.0f / (farZ - nearZ), 0),
Vector( 0, 0, nearZ / (nearZ - farZ), 1) );
return mat;
}
示例2: CreateViewMatrixLH
/* ======================================
Matrices
========================================= */
Mat4x4 Anubis::CreateViewMatrixLH(const Vec & pos, const Vec & lookDir, const Vec & up)
{
Mat4x4 mat;
Vec & zaxis = Normalize(lookDir);
Vec & xaxis = Normalize(cross(up, zaxis));
Vec & yaxis = cross(zaxis, xaxis);
mat.Init( Vector( getx(xaxis), getx(yaxis), getx(zaxis), 0),
Vector( gety(xaxis), gety(yaxis), gety(zaxis), 0),
Vector( getz(xaxis), getz(yaxis), getz(zaxis), 0),
Vector( -Dot(xaxis, pos), -Dot(yaxis, pos), -Dot(zaxis, pos), 1) );
return mat;
}
示例3: CreatePerspectiveProjectionLH
Mat4x4 Anubis::CreatePerspectiveProjectionLH( const AREAL fov, const AREAL aspect,
const AREAL nearZ, const AREAL farZ )
{
Mat4x4 mat;
//AREAL yscale = CtgR32(fov / 2);
//AREAL xscale = yscale / aspect;
AREAL SinFov = Sin(fov * 0.5f);
AREAL CosFov = Cos(fov * 0.5f);
AREAL height = CosFov / SinFov;
AREAL width = height / aspect;
mat.Init( Vector(width, 0, 0, 0),
Vector(0, height, 0, 0),
Vector(0, 0, farZ/(farZ-nearZ), 1),
Vector(0, 0, -nearZ*farZ/(farZ-nearZ), 0) );
return mat;
}