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

Method RenderDebugInfo

trinity/Lights/Tr2FactionLight.cpp:64–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void Tr2FactionLight::RenderDebugInfo( ITr2DebugRenderer2& renderer, const Matrix& worldMatrix, const Float4x3* bones, size_t boneCount )
65{
66 if( m_isSpotlight )
67 {
68 auto baseColor = m_lightData.color * m_lightData.brightness;
69 baseColor.a = 0.025f;
70 auto colorMod = Color( 0.0f, 0.0f, 0.0f, 0.025f );
71
72 Matrix boneMatrix = m_boneTransform;
73 if( m_lightData.boneIndex >= 0 && m_lightData.boneIndex < boneCount )
74 {
75 TriMatrixCopyFrom3x4( &boneMatrix, &bones[m_lightData.boneIndex] );
76 }
77
78 Matrix lightMatrix = RotationMatrix( m_lightData.rotation ) * TranslationMatrix( m_lightData.position ) * boneMatrix * worldMatrix;
79
80 float outerAngle = TRI_2PI * m_lightData.outerAngle / 360.f;
81 float innerAngle = TRI_2PI * m_lightData.innerAngle / 360.f;
82
83 renderer.DrawCone( this, lightMatrix, m_lightData.radius, outerAngle, 15, 15, Tr2DebugRenderer::Solid, Tr2DebugColor( baseColor + colorMod * 2.0f, baseColor ) );
84 renderer.DrawCone( this, lightMatrix, m_lightData.innerRadius, innerAngle, 15, 15, Tr2DebugRenderer::Solid, Tr2DebugColor( baseColor + colorMod * 3.0f, baseColor + colorMod ) );
85 }
86 else
87 {
88 auto baseColor = m_lightData.color * m_lightData.brightness;
89 baseColor.a = 0.1;
90 auto selectedColor = baseColor + Color( 0.0, 0.0, 0.0, 0.2 );
91
92 Matrix lightMatrix = m_boneTransform;
93 if( m_lightData.boneIndex >= 0 && m_lightData.boneIndex < boneCount )
94 {
95 TriMatrixCopyFrom3x4( &lightMatrix, &bones[m_lightData.boneIndex] );
96 }
97 lightMatrix *= worldMatrix;
98
99 renderer.DrawSphere( this, lightMatrix, m_lightData.position, m_lightData.radius, 10, Tr2DebugRenderer::Solid, Tr2DebugColor( selectedColor, baseColor ) );
100 renderer.DrawSphere( this, lightMatrix, m_lightData.position, m_lightData.innerRadius, 10, Tr2DebugRenderer::Solid, Tr2DebugColor( selectedColor, baseColor ) );
101 }
102}

Callers

nothing calls this directly

Calls 4

TriMatrixCopyFrom3x4Function · 0.85
Tr2DebugColorClass · 0.85
DrawConeMethod · 0.45
DrawSphereMethod · 0.45

Tested by

no test coverage detected