MCPcopy Create free account
hub / github.com/carbonengine/trinity / RenderDebugInfo

Method RenderDebugInfo

trinity/Particle/Tr2PlaneConstraint.cpp:257–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257void 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}

Callers

nothing calls this directly

Calls 4

LengthFunction · 0.85
SizeMethod · 0.80
Vector3Class · 0.50
DrawLineMethod · 0.45

Tested by

no test coverage detected