当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix4::getValue方法代码示例

本文整理汇总了C++中math::Matrix4::getValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4::getValue方法的具体用法?C++ Matrix4::getValue怎么用?C++ Matrix4::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在math::Matrix4的用法示例。


在下文中一共展示了Matrix4::getValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setup

void Frustum::setup(const Math::Matrix4 &matrix) {
	// Based on "Fast Extraction of Viewing Frustum Planes from the
	// World-View-Projection matrix" by Gil Gribb and Klaus Hartmann.
	// http://www.cs.otago.ac.nz/postgrads/alexis/planeExtraction.pdf

	_planes[0]._normal.x() = matrix.getValue(3, 0) + matrix.getValue(0, 0);
	_planes[0]._normal.y() = matrix.getValue(3, 1) + matrix.getValue(0, 1);
	_planes[0]._normal.z() = matrix.getValue(3, 2) + matrix.getValue(0, 2);
	_planes[0]._d = matrix.getValue(3, 3) + matrix.getValue(0, 3);

	_planes[1]._normal.x() = matrix.getValue(3, 0) - matrix.getValue(0, 0);
	_planes[1]._normal.y() = matrix.getValue(3, 1) - matrix.getValue(0, 1);
	_planes[1]._normal.z() = matrix.getValue(3, 2) - matrix.getValue(0, 2);
	_planes[1]._d = matrix.getValue(3, 3) - matrix.getValue(0, 3);

	_planes[2]._normal.x() = matrix.getValue(3, 0) - matrix.getValue(1, 0);
	_planes[2]._normal.y() = matrix.getValue(3, 1) - matrix.getValue(1, 1);
	_planes[2]._normal.z() = matrix.getValue(3, 2) - matrix.getValue(1, 2);
	_planes[2]._d = matrix.getValue(3, 3) - matrix.getValue(1, 3);

	_planes[3]._normal.x() = matrix.getValue(3, 0) + matrix.getValue(1, 0);
	_planes[3]._normal.y() = matrix.getValue(3, 1) + matrix.getValue(1, 1);
	_planes[3]._normal.z() = matrix.getValue(3, 2) + matrix.getValue(1, 2);
	_planes[3]._d = matrix.getValue(3, 3) + matrix.getValue(1, 3);

	_planes[4]._normal.x() = matrix.getValue(3, 0) + matrix.getValue(2, 0);
	_planes[4]._normal.y() = matrix.getValue(3, 1) + matrix.getValue(2, 1);
	_planes[4]._normal.z() = matrix.getValue(3, 2) + matrix.getValue(2, 2);
	_planes[4]._d = matrix.getValue(3, 3) + matrix.getValue(2, 3);

	_planes[5]._normal.x() = matrix.getValue(3, 0) - matrix.getValue(2, 0);
	_planes[5]._normal.y() = matrix.getValue(3, 1) - matrix.getValue(2, 1);
	_planes[5]._normal.z() = matrix.getValue(3, 2) - matrix.getValue(2, 2);
	_planes[5]._d = matrix.getValue(3, 3) - matrix.getValue(2, 3);
	
	for (int i = 0; i < 6; ++i) {
		_planes[i].normalize();
	}
}
开发者ID:JoseJX,项目名称:random_tools,代码行数:39,代码来源:frustum.cpp


注:本文中的math::Matrix4::getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。