CryEngine ViewMat
来源:互联网 发布:穷养儿富养女知乎 编辑:程序博客网 时间:2024/05/22 02:06
mathMatrixLookAt 函数生的矩阵和camera.GetViewMatrix 获得的视图矩阵不相同。
mathMatrixLookAt 函数与osg::Matrix::makeLookAt 函数产生的矩阵一致
// 对于Camera获得的ViewMatrix 经过以下方式可以正确计算:
{
osg::Matrix osgViewMatT = Matrix34ToOSG_T(camera.GetViewMatrix());
osg::Vec3d eye_, center_, up_;
osg::Matrix inv = osg::Matrix::inverse(osgViewMatT);
// note: e and c variables must be used inside this method instead of eye and center
// because eye and center are references and they may point to the same variable.
osg::Vec3d e = osg::Vec3d(0.0, 0.0, 0.0)*inv;
up_ = osg::Matrix::transform3x3(osgViewMatT, osg::Vec3d(0.0, 0.0, 1.0));
osg::Vec3d c = osg::Matrix::transform3x3(osgViewMatT, osg::Vec3d(0.0, 1, 0.0));
c.normalize();
c = e + c*1;
// assign the results
eye_ = e;
center_ = c;
}
inline osg::Matrix Matrix34ToOSG_T(const Matrix34& mat)
{
osg::Matrix osgMat;
osgMat.set(
mat.m00, mat.m10, mat.m20, 0,
mat.m01, mat.m11, mat.m21, 0,
mat.m02, mat.m12, mat.m22, 0,
mat.m03, mat.m13, mat.m23, 1
);
return osgMat;
}
mathMatrixLookAt 函数与osg::Matrix::makeLookAt 函数产生的矩阵一致
// 对于Camera获得的ViewMatrix 经过以下方式可以正确计算:
{
osg::Matrix osgViewMatT = Matrix34ToOSG_T(camera.GetViewMatrix());
osg::Vec3d eye_, center_, up_;
osg::Matrix inv = osg::Matrix::inverse(osgViewMatT);
// note: e and c variables must be used inside this method instead of eye and center
// because eye and center are references and they may point to the same variable.
osg::Vec3d e = osg::Vec3d(0.0, 0.0, 0.0)*inv;
up_ = osg::Matrix::transform3x3(osgViewMatT, osg::Vec3d(0.0, 0.0, 1.0));
osg::Vec3d c = osg::Matrix::transform3x3(osgViewMatT, osg::Vec3d(0.0, 1, 0.0));
c.normalize();
c = e + c*1;
// assign the results
eye_ = e;
center_ = c;
}
inline osg::Matrix Matrix34ToOSG_T(const Matrix34& mat)
{
osg::Matrix osgMat;
osgMat.set(
mat.m00, mat.m10, mat.m20, 0,
mat.m01, mat.m11, mat.m21, 0,
mat.m02, mat.m12, mat.m22, 0,
mat.m03, mat.m13, mat.m23, 1
);
return osgMat;
}
阅读全文
0 0
- CryEngine ViewMat
- CryENGINE 3
- CryENGINE Feathure
- CryEngine中的发布准备
- Cryengine渲染引擎剖析
- CryEngine模型格式浅析
- Cryengine渲染引擎剖析
- CDK? 免费版CryEngine 3
- Cryengine渲染引擎剖析
- CryEngine技术讲解
- Cryengine渲染引擎剖析
- CryEngine 代码公开了
- CryEngine Plugin 创建
- CryEngine 动态添加模型
- CryENGINE™ 2 功能介绍
- CryEngine 2 完全技术分析
- CryENGINE 3 百度百科介绍
- CryEngine的maya插件安装
- Java设计模式-适配器模式和装饰模式
- 石像鬼(Gargoyle)1.8.1 ar71xx SS + pdnsd 实现代理
- 一个mongodb的备份脚本
- <machine_learning>_Regression
- 视频截点上传
- CryEngine ViewMat
- 从webshell开始的内网入侵
- 海在恋服装的设计方法
- python 核心模块总结
- hdu 1325 Is It A Tree?
- 文件上传
- Effictive Java中学到的一些常识
- 【Leetcode问题搬运翻译】Add two numbers
- 初次使用Python脚本,proto协议文件转Lua代码