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

📄 affinematrix.hpp

📁 机甲指挥官2源代码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
					fmul        dword ptr [esi+4]		//	s2[1][0]	M3,2

					fxch		st(1)
					fstp        dword ptr [eax+8]		//	[2][0]		S2

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

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

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

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

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

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

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

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

//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

					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

					faddp		st(1),st				//				A3,2
					fadd        dword ptr [esi+02Ch]	//	s2[3][2]	A3,3
					
					fstp        dword ptr [eax+02Ch]	//	[3][2]		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);
#endif

			return *this;
		};

		AffineMatrix4D&
			operator*=(const AffineMatrix4D& m)
				{AffineMatrix4D temp(*this); return Multiply(temp,m);}

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

		//
		// Scaling, Rotation and Translation
		//
		AffineMatrix4D&
			Multiply(const AffineMatrix4D &m,const Vector3D &v);
		AffineMatrix4D&
			operator*=(const Vector3D &v)
				{AffineMatrix4D m(*this); return Multiply(m,v);}
		AffineMatrix4D&
			Multiply(const AffineMatrix4D &m,const UnitQuaternion &q);
		AffineMatrix4D&
			operator*=(const UnitQuaternion &q)
				{AffineMatrix4D m(*this); return Multiply(m,q);}
		AffineMatrix4D&
			Multiply(const AffineMatrix4D &m,const Point3D &p);
		AffineMatrix4D&
			operator*=(const Point3D& p)
				{AffineMatrix4D m(*this); return Multiply(m,p);}

		//
		// Miscellaneous Functions
		//
		Scalar
			Determinant() const;
		AffineMatrix4D&
			Solve();

		//
		// Support functions
		//
		#if !defined(Spew)
			friend void
				::Spew(
					const char* group,
					const AffineMatrix4D& matrix
				);
		#endif

		void
			TestInstance() const
				{}
		static bool
			TestClass();
	};

	inline Point3D&
		Point3D::operator=(const AffineMatrix4D& m)
			{
				Check_Pointer(this); Check_Object(&m);
				x = m(W_Axis, X_Axis);
				y = m(W_Axis, Y_Axis);
				z = m(W_Axis, Z_Axis);
				Check_Object(this);
				return *this;
			}

}

namespace MemoryStreamIO {

	inline Stuff::MemoryStream&
		Read(
			Stuff::MemoryStream *stream,
			Stuff::AffineMatrix4D *output
		)
			{return stream->ReadBytes(output, sizeof(*output));}
	inline Stuff::MemoryStream&
		Write(
			Stuff::MemoryStream *stream,
			const Stuff::AffineMatrix4D *input
		)
			{return stream->WriteBytes(input, sizeof(*input));}

}

⌨️ 快捷键说明

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