⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matrix.hpp

📁 机甲指挥官2源代码
💻 HPP
📖 第 1 页 / 共 2 页
字号:

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

					fld         dword ptr [edx]			//	s1[0][0]
					fmul        dword ptr [esi+020h]	//	s2[0][2]	M0,1

					fxch		st(2)
					faddp		st(1),st				//				A3,2

					fld         dword ptr [edx+010h]	//	s1[0][1]
					fmul        dword ptr [esi+024h]	//	s2[1][2]	M0,2

					fxch		st(1)
					fadd        dword ptr [esi+01Ch]	//	s2[3][1]	A3,3
					
					fld         dword ptr [edx+020h]	//	s1[0][2]
					fmul        dword ptr [esi+028h]	//	s2[2][2]	M0,3

					fxch		st(1)
					fstp        dword ptr [eax+01Ch]	//	[3][1]		S3

//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

					fxch		st(2)
					faddp       st(1),st				//				A0,1

					fld         dword ptr [edx+4]		//	s1[1][0]
					fmul        dword ptr [esi+020h]	//	s2[0][2]	M1,1

					fxch		st(2)
					faddp       st(1),st				//				A0,2

					fld         dword ptr [edx+014h]	//	s1[1][1]
					fmul        dword ptr [esi+024h]	//	s2[1][2]	M1,2
					
					fxch		st(1)
					fstp        dword ptr [eax+020h]	//	[0][2]		S0

					fld         dword ptr [edx+024h]	//	s1[1][2]
					fmul        dword ptr [esi+028h]	//	s2[2][2]	M1,3

					fxch		st(2)
					faddp       st(1),st				//				A1,1

					fld         dword ptr [edx+8]		//	s1[2][0]
					fmul        dword ptr [esi+020h]	//	s2[0][2]	M2,1

					fxch		st(2)
					faddp       st(1),st				//				A1,2

					fld         dword ptr [edx+018h]	//	s1[2][1]
					fmul        dword ptr [esi+024h]	//	s2[1][2]	M2,2

					fxch		st(1)
					fstp        dword ptr [eax+024h]	//	[1][2]		S1

					fld         dword ptr [edx+028h]	//	s1[2][2]
					fmul        dword ptr [esi+028h]	//	s2[2][2]	M2,3
					
					fxch		st(2)
					faddp       st(1),st				//				A2,1

					fld         dword ptr [edx+0ch]		//	s1[3][0]
					fmul        dword ptr [esi+020h]	//	s2[0][2]	M3,1

					fxch		st(2)
					faddp       st(1),st				//				A2,2

					fld         dword ptr [edx+01ch]	//	s1[3][1]
					fmul        dword ptr [esi+024h]	//	s2[1][2]	M3,2

					fxch		st(1)
					fstp        dword ptr [eax+028h]	//	[2][2]		S2

					fld         dword ptr [edx+02ch]	//	s1[3][2]
					fmul        dword ptr [esi+028h]	//	s2[2][2]	M3,3

					fxch		st(2)
					faddp       st(1),st				//				A3,1

//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

					fld         dword ptr [edx]			//	s1[0][0]
					fmul        dword ptr [esi+030h]	//	s2[0][3]	M0,1

					fxch		st(2)
					faddp		st(1),st				//				A3,2

					fld         dword ptr [edx+010h]	//	s1[0][1]
					fmul        dword ptr [esi+034h]	//	s2[1][3]	M0,2

					fxch		st(1)
					fadd        dword ptr [esi+02Ch]	//	s2[3][2]	A3,3
					
					fld         dword ptr [edx+020h]	//	s1[0][2]
					fmul        dword ptr [esi+038h]	//	s2[2][3]	M0,3

					fxch		st(1)
					fstp        dword ptr [eax+02Ch]	//	[3][2]		S3

//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

					fxch		st(2)
					faddp       st(1),st				//				A0,1

					fld         dword ptr [edx+4]		//	s1[1][0]
					fmul        dword ptr [esi+030h]	//	s2[0][3]	M1,1

					fxch		st(2)
					faddp       st(1),st				//				A0,2

					fld         dword ptr [edx+014h]	//	s1[1][1]
					fmul        dword ptr [esi+034h]	//	s2[1][3]	M1,2
					
					fxch		st(1)
					fstp        dword ptr [eax+030h]	//	[0][3]		S0

					fld         dword ptr [edx+024h]	//	s1[1][2]
					fmul        dword ptr [esi+038h]	//	s2[2][3]	M1,3

					fxch		st(2)
					faddp       st(1),st				//				A1,1

					fld         dword ptr [edx+8]		//	s1[2][0]
					fmul        dword ptr [esi+030h]	//	s2[0][3]	M2,1

					fxch		st(2)
					faddp       st(1),st				//				A1,2

					fld         dword ptr [edx+018h]	//	s1[2][1]
					fmul        dword ptr [esi+034h]	//	s2[1][3]	M2,2

					fxch		st(1)
					fstp        dword ptr [eax+034h]	//	[1][3]		S1

					fld         dword ptr [edx+028h]	//	s1[2][2]
					fmul        dword ptr [esi+038h]	//	s2[2][3]	M2,3
					
					fxch		st(2)
					faddp       st(1),st				//				A2,1

					fld         dword ptr [edx+0ch]		//	s1[3][0]
					fmul        dword ptr [esi+030h]	//	s2[0][3]	M3,1

					fxch		st(2)
					faddp       st(1),st				//				A2,2

					fld         dword ptr [edx+01ch]	//	s1[3][1]
					fmul        dword ptr [esi+034h]	//	s2[1][3]	M3,2

					fxch		st(1)
					fstp        dword ptr [eax+038h]	//	[2][3]		S2

					fld         dword ptr [edx+02ch]	//	s1[3][2]
					fmul        dword ptr [esi+038h]	//	s2[2][3]	M3,3

					fxch		st(2)
					faddp       st(1),st				//				A3,1

					faddp		st(1),st				//				A3,2
					fadd        dword ptr [esi+03Ch]	//	s2[3][3]	A3,3
					
					fstp        dword ptr [eax+03Ch]	//	[3][3]		S3

					pop         esi
				}

#else
				(*this)(0,0) =
					Source1(0,0)*Source2(0,0)
					 + Source1(0,1)*Source2(1,0)
					 + Source1(0,2)*Source2(2,0);
				(*this)(1,0) =
					Source1(1,0)*Source2(0,0)
					 + Source1(1,1)*Source2(1,0)
					 + Source1(1,2)*Source2(2,0);
				(*this)(2,0) =
					Source1(2,0)*Source2(0,0)
					 + Source1(2,1)*Source2(1,0)
					 + Source1(2,2)*Source2(2,0);
				(*this)(3,0) =
					Source1(3,0)*Source2(0,0)
					 + Source1(3,1)*Source2(1,0)
					 + Source1(3,2)*Source2(2,0)
					 + Source2(3,0);

				(*this)(0,1) =
					Source1(0,0)*Source2(0,1)
					 + Source1(0,1)*Source2(1,1)
					 + Source1(0,2)*Source2(2,1);
				(*this)(1,1) =
					Source1(1,0)*Source2(0,1)
					 + Source1(1,1)*Source2(1,1)
					 + Source1(1,2)*Source2(2,1);
				(*this)(2,1) =
					Source1(2,0)*Source2(0,1)
					 + Source1(2,1)*Source2(1,1)
					 + Source1(2,2)*Source2(2,1);
				(*this)(3,1) =
					Source1(3,0)*Source2(0,1)
					 + Source1(3,1)*Source2(1,1)
					 + Source1(3,2)*Source2(2,1)
					 + Source2(3,1);

				(*this)(0,2) =
					Source1(0,0)*Source2(0,2)
					 + Source1(0,1)*Source2(1,2)
					 + Source1(0,2)*Source2(2,2);
				(*this)(1,2) =
					Source1(1,0)*Source2(0,2)
					 + Source1(1,1)*Source2(1,2)
					 + Source1(1,2)*Source2(2,2);
				(*this)(2,2) =
					Source1(2,0)*Source2(0,2)
					 + Source1(2,1)*Source2(1,2)
					 + Source1(2,2)*Source2(2,2);
				(*this)(3,2) =
					Source1(3,0)*Source2(0,2)
					 + Source1(3,1)*Source2(1,2)
					 + Source1(3,2)*Source2(2,2)
					 + Source2(3,2);

				(*this)(0,3) =
					Source1(0,0)*Source2(0,3)
					 + Source1(0,1)*Source2(1,3)
					 + Source1(0,2)*Source2(2,3);
				(*this)(1,3) =
					Source1(1,0)*Source2(0,3)
					 + Source1(1,1)*Source2(1,3)
					 + Source1(1,2)*Source2(2,3);
				(*this)(2,3) =
					Source1(2,0)*Source2(0,3)
					 + Source1(2,1)*Source2(1,3)
					 + Source1(2,2)*Source2(2,3);
				(*this)(3,3) =
					Source1(3,0)*Source2(0,3)
					 + Source1(3,1)*Source2(1,3)
					 + Source1(3,2)*Source2(2,3)
					 + Source2(3,3);
#endif

			return *this;
		};

		Matrix4D&
			Multiply(
				const AffineMatrix4D &Source1,
				const AffineMatrix4D &Source2
			);

		//
		// Matrix4D Inversion
		//
		Matrix4D&
			Invert(const Matrix4D& Source);
		Matrix4D&
			Invert()
				{Matrix4D src(*this); return Invert(src);}

		//
		// Viewpoint Calculation
		//
		#if !defined(Spew)
			friend void
				::Spew(
					const char* group,
					const Matrix4D &matrix
				);
		#endif
		static bool
			TestClass();
		void
			TestInstance() const
				{}

		//
		// Creating perspective Matrix4D
		//
		void
			SetPerspective(
				Scalar near_clip,
				Scalar far_clip,
				Scalar left_clip,
				Scalar right_clip,
				Scalar top_clip,
				Scalar bottom_clip
			);

		void
			GetPerspective(
				Scalar *near_clip,
				Scalar *far_clip,
				Scalar *left_clip,
				Scalar *right_clip,
				Scalar *top_clip,
				Scalar *bottom_clip
			) const;

		void
			SetPerspective(
				Scalar near_clip,
				Scalar far_clip,
				const Radian &horizontal_fov,
				Scalar height_to_width
			);
		void
			GetPerspective(
				Scalar *near_clip,
				Scalar *far_clip,
				Radian *horizontal_fov,
				Scalar *height_to_width
			) const;


	};

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -