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


C++ Mat4::makeFullOne方法代码示例

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


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

示例1: TestMat4

void TestMat4()
{
	// -------- Basics
	{
		Mat4 A;
		for (int i = 0; i < 16; i++)
			failIf(A[i] != 0,
				"Mat4() constructor or array style reading (partial test)");
	}

	{
		Mat4 A(1, 2, 3, 4,
				5, 6, 7, 8,
				9, 10, 11, 12,
				13, 14, 15, 16);
		for (int i = 0; i < 16; i++)
			failIf(A[i] != (i + 1),
				"Mat4(double, ...) constructor or array style reading "
				"(partial test)");
	}

	{
		Mat4 A(1, 2, 3, 4,
				5, 6, 7, 8,
				9, 10, 11, 12,
				13, 14, 15, 16);
		failIf(!(A == A) || (A != A), "Mat4 self-equality");
	}

	{
		Mat4 A(1, 2, 3, 4,
				5, 6, 7, 8,
				9, 10, 11, 12,
				13, 14, 15, 16);
		Mat4 B(20, 21, 22, 23,
				24, 25, 26, 27,
				28, 29, 30, 31,
				32, 33, 34, 35);
		failIf(A == B, "Not-equal Mat4's");
	}

	{
		Mat4 A(1, 2, 3, 4,
				5, 6, 7, 8,
				9, 10, 11, 12,
				13, 14, 15, 16);
		Mat4 B(A);
		failIf(A != B, "Mat4 copy constructor");
	}

	{
		Mat4 A;
		A.makeIdentity();
		Mat4 B(1, 0, 0, 0,
				0, 1, 0, 0,
				0, 0, 1, 0,
				0, 0, 0, 1);
		failIf(A != B, "Mat4.makeIdentity()");
	}

	{
		Mat4 A;
		A.makeFullOne();
		Mat4 B(1, 1, 1, 1,
				1, 1, 1, 1,
				1, 1, 1, 1,
				1, 1, 1, 1);
		failIf(A != B, "Mat4.makeFullOne()");
	}

	{
		Mat4 A(8, 8, 8, 8,
				1, 0, 0, 0,
				8, 8, 8, 8,
				8, 8, 8, 8);
		Vec3 r = A.column(1);
		Vec3 result(1, 0, 0);
		failIf(r != result, "Mat4.column()");
	}

	{
		Mat4 A(8, 1, 8, 8,
				8, 0, 8, 8,
				8, 0, 8, 8,
				8, 0, 8, 8);
		Vec3 r = A.row(1);
		Vec3 result(1, 0, 0);
		failIf(r != result, "Mat4.row()");
	}

	// -------- Addition, Subtraction
	{
		Mat4 A(1, 2, 3, 4,
				5, 6, 7, 8,
				9, 10, 11, 12,
				13, 14, 15, 16);
		Mat4 B(16, 12, 8, 4,
				15, 11, 7, 3,
				14, 10, 6, 2,
				13, 9, 5, 1);
//.........这里部分代码省略.........
开发者ID:vain,项目名称:GravSim,代码行数:101,代码来源:VecMathTests.cpp


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