| 255 | } |
| 256 | |
| 257 | void Tr2PlaneConstraint::RenderDebugInfo( ITr2DebugRenderer2& renderer, const Matrix& worldTransform, const CcpMath::AxisAlignedBox& aabb ) const |
| 258 | { |
| 259 | if( !m_isValid ) |
| 260 | { |
| 261 | return; |
| 262 | } |
| 263 | auto local = TranslationMatrix( 0, 0, -m_normalizedPlane.d ) * OrthoNormalBasisZ( Vector3( m_normalizedPlane.a, m_normalizedPlane.b, m_normalizedPlane.c ) ); |
| 264 | auto world = local * worldTransform; |
| 265 | auto center = TransformCoord( aabb.Center(), Inverse( local ) ); |
| 266 | center.z = 0; |
| 267 | float radius = std::max( 10.f, Length( aabb.Size() ) * 0.25f ); |
| 268 | float step = radius * 0.2f; |
| 269 | for( int i = -5; i <= 5; ++i ) |
| 270 | { |
| 271 | Vector3 p0( float( i ) * step, -radius, 0 ); |
| 272 | Vector3 p1( float( i ) * step, radius, 0 ); |
| 273 | renderer.DrawLine( this, TransformCoord( p0 + center, world ), TransformCoord( p1 + center, world ), 0xffff4444 ); |
| 274 | } |
| 275 | for( int i = -5; i <= 5; ++i ) |
| 276 | { |
| 277 | Vector3 p0( -radius, float( i ) * step, 0 ); |
| 278 | Vector3 p1( radius, float( i ) * step, 0 ); |
| 279 | renderer.DrawLine( this, TransformCoord( p0 + center, world ), TransformCoord( p1 + center, world ), 0xffff4444 ); |
| 280 | } |
| 281 | } |