bool M4TransformVectorTest::DoTest() { Matrix4 Dummy; Dummy.TransformVector(m_oVector, m_fAngle, m_cAxis, m_fScale); cout<< "\n---------------M4TransformVectorTest---------------\n"; return (m_oVector == m_oResult); }
void BatchRenderer::DrawArrow( const Matrix4& arrowTransform, const FColor& color, FLOAT arrowLength, FLOAT headSize ) { mxSWIPED("Unreal Engine 3"); const Vec3D origin = arrowTransform.GetTranslation(); const Vec3D endPoint = arrowTransform.TransformVector(Vec3D( arrowLength, 0.0f, 0.0f )); const FLOAT headScale = 0.5f; const FColor& startColor = FColor::WHITE; const FColor& endColor = color; this->DrawLine3D( origin, endPoint, startColor, endColor ); this->DrawLine3D( endPoint, arrowTransform.TransformVector(Vec3D( arrowLength-headSize, +headSize*headScale, +headSize*headScale )), startColor, endColor ); this->DrawLine3D( endPoint, arrowTransform.TransformVector(Vec3D( arrowLength-headSize, +headSize*headScale, -headSize*headScale )), startColor, endColor ); this->DrawLine3D( endPoint, arrowTransform.TransformVector(Vec3D( arrowLength-headSize, -headSize*headScale, +headSize*headScale )), startColor, endColor ); this->DrawLine3D( endPoint, arrowTransform.TransformVector(Vec3D( arrowLength-headSize, -headSize*headScale, -headSize*headScale )), startColor, endColor ); }
void Draw( BatchRenderer & batchRenderer, const Matrix4& transform, const FColor& color ) { const Vec3D apex = transform.TransformVector( arrowHeadVertex ); // draw the 'stem' batchRenderer.DrawLine3D( transform.GetTranslation(), apex, FColor::WHITE, color ); // draw the arrow head for( UINT iSegment = 0 ; iSegment < AXIS_ARROW_SEGMENTS ; iSegment++ ) { const Vec3D& p0 = transform.TransformVector( arrowVertices[ iSegment ] ); const Vec3D& p1 = transform.TransformVector( arrowVertices[ iSegment + 1 ] ); // Draw the base triangle of the cone. // NOTE: no need because we disabled backface culling //batchRenderer.DrawSolidTriangle3D( p0,p1,arrowBaseVertex,color ); // Draw the top triangle of the cone. batchRenderer.DrawSolidTriangle3D( p0, p1, apex, color ); } }