Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions trinity/Eve/EveTriggerVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ void EveTriggerVolume::RenderDebugInfo( ITr2DebugRenderer2& renderer )
{
volume->RenderDebugInfo( renderer, m_worldTransform, color );
}

// the volume edges are hard to read from inside, so label the volume with the trigger state
const Vector3 center = Transform( m_boundingSphere.center, m_worldTransform ).GetXYZ();
renderer.DrawText( TRI_DBG_FONT_MEDIUM, center, color, "%s: %s (%.2f)", m_name.c_str(), m_isInside ? "INSIDE" : "outside", m_currentIntensity );
}

if( renderer.HasOption( GetRawRoot(), "Trigger Exclusion Volumes" ) )
Expand Down
8 changes: 6 additions & 2 deletions trinity/Eve/Volume/EveBoxVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ bool EveBoxVolume::Initialize()

void EveBoxVolume::RenderDebugInfo( ITr2DebugRenderer2& renderer, const Matrix& parentTransform, const Color& baseColor )
{
renderer.DrawBox( this, m_boxTransform * parentTransform, MIN_AABB, MAX_AABB, Tr2DebugRenderer::Wireframe, baseColor * 0.5f );
renderer.DrawBox( this, m_innerBoxTransform * parentTransform, MIN_AABB, MAX_AABB, Tr2DebugRenderer::Wireframe, baseColor * 0.6f );
const Matrix boxTransform = m_boxTransform * parentTransform;
const Tr2DebugColor fill = EveVolumeFillColor( baseColor );
renderer.DrawBox( this, boxTransform, MIN_AABB, MAX_AABB, Tr2DebugRenderer::Solid, fill );
renderer.DrawBox( this, EveVolumeInsideOut( boxTransform ), MIN_AABB, MAX_AABB, Tr2DebugRenderer::Solid, fill );
renderer.DrawBox( this, boxTransform, MIN_AABB, MAX_AABB, Tr2DebugRenderer::Wireframe, EveVolumeDebugColor( baseColor * 0.5f ) );
renderer.DrawBox( this, m_innerBoxTransform * parentTransform, MIN_AABB, MAX_AABB, Tr2DebugRenderer::Wireframe, EveVolumeDebugColor( baseColor * 0.6f ) );

if( m_debugShowIntersection )
{
Expand Down
9 changes: 6 additions & 3 deletions trinity/Eve/Volume/EveEllipsoidVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ void EveEllipsoidVolume::Setup()

void EveEllipsoidVolume::RenderDebugInfo( ITr2DebugRenderer2& renderer, const Matrix& parentTransform, const Color& baseColor )
{
Matrix outerTransform = TransformationMatrix( m_shape, m_rotation, m_position ) * parentTransform;
renderer.DrawSphere( Tr2DebugObjectReference( this, 200 ), outerTransform, 20, Tr2DebugRenderer::Wireframe, baseColor * 0.5f );
const Matrix outerTransform = TransformationMatrix( m_shape, m_rotation, m_position ) * parentTransform;
const Tr2DebugColor fill = EveVolumeFillColor( baseColor );
renderer.DrawSphere( Tr2DebugObjectReference( this, 200 ), outerTransform, 20, Tr2DebugRenderer::Solid, fill );
renderer.DrawSphere( Tr2DebugObjectReference( this, 200 ), EveVolumeInsideOut( outerTransform ), 20, Tr2DebugRenderer::Solid, fill );
renderer.DrawSphere( Tr2DebugObjectReference( this, 200 ), outerTransform, 20, Tr2DebugRenderer::Wireframe, EveVolumeDebugColor( baseColor * 0.5f ) );

Matrix innerTransform = TransformationMatrix( m_innerShape, m_rotation, m_position ) * parentTransform;
renderer.DrawSphere( Tr2DebugObjectReference( this, 200 ), innerTransform, 20, Tr2DebugRenderer::Wireframe, baseColor * 0.6f );
renderer.DrawSphere( Tr2DebugObjectReference( this, 200 ), innerTransform, 20, Tr2DebugRenderer::Wireframe, EveVolumeDebugColor( baseColor * 0.6f ) );

if( m_debugShowIntersection )
{
Expand Down
8 changes: 6 additions & 2 deletions trinity/Eve/Volume/EveSphereVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ EveSphereVolume::~EveSphereVolume()

void EveSphereVolume::RenderDebugInfo( ITr2DebugRenderer2& renderer, const Matrix& parentTransform, const Color& baseColor )
{
renderer.DrawSphere( this, TranslationMatrix( m_outerSphere.center ) * parentTransform, m_outerSphere.radius, 20, Tr2DebugRenderer::Wireframe, baseColor * 0.5f );
renderer.DrawSphere( this, TranslationMatrix( m_outerSphere.center + m_innerSphere.center ) * parentTransform, m_innerSphere.radius, 20, Tr2DebugRenderer::Wireframe, baseColor * 0.6f );
const Matrix outerTransform = TranslationMatrix( m_outerSphere.center ) * parentTransform;
const Tr2DebugColor fill = EveVolumeFillColor( baseColor );
renderer.DrawSphere( this, outerTransform, m_outerSphere.radius, 20, Tr2DebugRenderer::Solid, fill );
renderer.DrawSphere( this, EveVolumeInsideOut( outerTransform ), m_outerSphere.radius, 20, Tr2DebugRenderer::Solid, fill );
renderer.DrawSphere( this, outerTransform, m_outerSphere.radius, 20, Tr2DebugRenderer::Wireframe, EveVolumeDebugColor( baseColor * 0.5f ) );
renderer.DrawSphere( this, TranslationMatrix( m_outerSphere.center + m_innerSphere.center ) * parentTransform, m_innerSphere.radius, 20, Tr2DebugRenderer::Wireframe, EveVolumeDebugColor( baseColor * 0.6f ) );
}

const CcpMath::Sphere EveSphereVolume::GetBoundingSphere() const
Expand Down
24 changes: 24 additions & 0 deletions trinity/Eve/Volume/IEveVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@

BLUE_DECLARE_INTERFACE( IEveVolume );

// Debug colors shared by the volume shapes. The outline stays faintly visible where the volume is hidden
// behind other geometry, and the fill is a faint tint that also carries through to whatever is inside it.
inline Tr2DebugColor EveVolumeDebugColor( const Color& color )
{
Color occluded = color;
occluded.a *= 0.25f;
return Tr2DebugColor( color, occluded );
}

inline Tr2DebugColor EveVolumeFillColor( const Color& color )
{
Color fill = color;
fill.a *= 0.15f;
return EveVolumeDebugColor( fill );
}

// The debug renderer culls back faces, so a solid shape is invisible from inside. Drawing it a second time
// with this transform mirrors it, which reverses the winding so the inner faces render as well: together the
// two draws are a two-sided solid.
inline Matrix EveVolumeInsideOut( const Matrix& transform )
{
return ScalingMatrix( -1.0f, 1.0f, 1.0f ) * transform;
}

BLUE_INTERFACE( IEveVolume ) :
public IRoot
{
Expand Down
Loading