Modern OpenGL从零开始 – Fbxsdk::FbxAMatrix转换为glm::mat4
本文作者:StubbornHuang
版权声明:本文为站长原创文章,如果转载请注明原文链接!
原文标题:Modern OpenGL从零开始 – Fbxsdk::FbxAMatrix转换为glm::mat4
原文链接:https://www.stubbornhuang.com/907/
发布于:2020年09月02日 14:26:23
修改于:2020年10月31日 16:44:48

1 Fbxsdk与OpenGL中矩阵存储顺序的不同
Fbxsdk的文档说明了FbxAMatrix是行主序矩阵,而OpenGL或者说glm中的glm::mat4是列主序矩阵,所以二者进行转换时要进行转置。
2 Fbxsdk::FbxAMatrix转换为glm::mat4
glm::mat4 FbxModel::FbxMatToGlm(const FbxAMatrix& mat)
{
// row:列 column : 行
// Fbxsdk使用行主序存储矩阵,glm使用列主序存储矩阵,所以要进行转置
glm::vec4 c0 = glm::make_vec4((double*)mat.GetColumn(0).Buffer()); // 得到矩阵第一行数据
glm::vec4 c1 = glm::make_vec4((double*)mat.GetColumn(1).Buffer());
glm::vec4 c2 = glm::make_vec4((double*)mat.GetColumn(2).Buffer());
glm::vec4 c3 = glm::make_vec4((double*)mat.GetColumn(3).Buffer());
glm::mat4 convertMatr = glm::mat4(c0, c1, c2, c3);
return glm::transpose(convertMatr);
}
当前分类随机文章推荐
- Modern OpenGL从零开始 - 从茫茫多的OpenGL第三方库讲起 阅读2764次,点赞1次
- Modern OpenGL - 与着色器Shader相关的API函数总结以及如何创建、编译与使用Shader 阅读63次,点赞0次
- Modern OpenGL从零开始 - 多个帧缓存Framebuffer绘制到同一个铺满屏幕四边形Quad上 阅读2046次,点赞1次
- Modern OpenGL从零开始 - 在Visual Studio中配置OpenGL开发环境 阅读1867次,点赞0次
- Modern OpenGL - GLSL着色语言3:GLSL中的数据类型 阅读1236次,点赞0次
- Modern OpenGL从零开始 - Fbxsdk::FbxAMatrix转换为glm::mat4 阅读1866次,点赞0次
- Modern OpenGL - GLSL着色语言4:GLSL中的数据存储限制符 阅读1547次,点赞0次
- Modern OpenGL - GLSL着色语言2:GLSL入口函数和GLSL中的变量 阅读1984次,点赞0次
- Modern OpenGL - GLSL着色语言1:OpenGL着色器简介 阅读1901次,点赞0次
全站随机文章推荐
- 资源分享 - Computational Geometry on Surfaces - Performing Computational Geometry on the Cylinder, the Sphere, the Torus, and the Cone 英文高清PDF下载 阅读1171次,点赞0次
- Github - 如何进行Pull requests 阅读44次,点赞0次
- 资源分享 - Artificial Intelligence - A Modern Approach , Second Edition 英文高清PDF下载 阅读752次,点赞1次
- Github - 使用新的Personal Access Token进行仓库认证 阅读1088次,点赞0次
- Windows - 使用类的成员函数作为Win32窗口消息回调处理函数WindowProc 阅读201次,点赞0次
- VTK以批量三维点坐标为中心(点云)绘制球体,可用于标识特征点或者是化学分子 阅读3494次,点赞0次
- 资源分享 - Level of Detail for 3D Graphics 英文高清PDF下载 阅读1090次,点赞1次
- WordPress - 限制非管理员用户进入WordPress后台页面,重定向到首页 阅读277次,点赞0次
- Python - 运算符/ or // or %的含义和区别 阅读1325次,点赞0次
- UnrealEngine4 - C++层打印信息到屏幕 阅读1592次,点赞0次
评论
148