TEST( Vector3, exchangingDataWithDX ) { Vector dxVec( 1, 2, 3 ); const Vector& castDxVec = ( const Vector& )(dxVec); CPPUNIT_ASSERT_EQUAL( 1.0f, castDxVec[0] ); CPPUNIT_ASSERT_EQUAL( 2.0f, castDxVec[1] ); CPPUNIT_ASSERT_EQUAL( 3.0f, castDxVec[2] ); // now go the other way around Vector tamyVec( 5, 6, 7 ); const Vector& castTamyVec = ( const Vector& )(tamyVec); CPPUNIT_ASSERT_EQUAL( 5.0f, castTamyVec[0] ); CPPUNIT_ASSERT_EQUAL( 6.0f, castTamyVec[1] ); CPPUNIT_ASSERT_EQUAL( 7.0f, castTamyVec[2] ); }
TEST( Vector4, exchangingDataWithDX ) { D3DXVECTOR4 dxVec( 1, 2, 3, 4 ); const Vector& castDxVec = (const Vector& )(dxVec); CPPUNIT_ASSERT_EQUAL( 1.0f, castDxVec[0] ); CPPUNIT_ASSERT_EQUAL( 2.0f, castDxVec[1] ); CPPUNIT_ASSERT_EQUAL( 3.0f, castDxVec[2] ); CPPUNIT_ASSERT_EQUAL( 4.0f, castDxVec[3] ); // now go the other way around Vector tamyVec( 5, 6, 7, 8 ); const D3DXVECTOR4& castTamyVec = ( const D3DXVECTOR4& )(tamyVec); CPPUNIT_ASSERT_EQUAL( 5.0f, castTamyVec[0] ); CPPUNIT_ASSERT_EQUAL( 6.0f, castTamyVec[1] ); CPPUNIT_ASSERT_EQUAL( 7.0f, castTamyVec[2] ); CPPUNIT_ASSERT_EQUAL( 8.0f, castTamyVec[3] ); }
D3DXVECTOR3 DXVector(const PAVECTOR& v) { D3DXVECTOR3 dxVec(v.x, v.y, v.z); return dxVec; }