Пример #1
0
void    plRTSpotLight::GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box )
{
    Point3  loc = node->GetObjectTM( t ).GetTrans();
    float   scaleFactor = vpt->NonScalingObjectSize() * vpt->GetVPWorldWidth( loc ) / 360.0f;
    float   width, depth;

    box = fMesh.getBoundingBox();
    // Because we want to scale about the origin, not the box center, we have to do this funky offset
    Point3  boxCenter = box.Center();
    box.Translate( -boxCenter );
    box.Scale( scaleFactor );
    boxCenter *= scaleFactor;
    box.Translate( boxCenter );

    // Include points for the spotlight. That means either the attenuated cone or 
    // our unattenuated cone display
    if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) )
    {
        if( GetUseAtten() ) 
            depth = GetAtten( t, ATTEN_END );
        else
            depth = 100.f + 50.f;   // Include arrows

        width = depth * tan( DegToRad( GetFallsize( t ) / 2.f ) );

        box += Point3( -width, -width, 0.f );
        box += Point3( width, width, -depth );
    }
}
Пример #2
0
void    plRTProjDirLight::GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box )
{
    Point3  loc = node->GetObjectTM( t ).GetTrans();
    float   scaleFactor = vpt->NonScalingObjectSize() * vpt->GetVPWorldWidth( loc ) / 360.0f;
    float   width, height, depth;

    box = fMesh.getBoundingBox();
    // Because we want to scale about the origin, not the box center, we have to do this funky offset
    Point3  boxCenter = box.Center();
    box.Translate( -boxCenter );
    box.Scale( scaleFactor );
    boxCenter *= scaleFactor;
    box.Translate( boxCenter );

    if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) )
    {
        fProjPB->GetValue( kWidth, t, width, FOREVER );
        fProjPB->GetValue( kHeight, t, height, FOREVER );
        fProjPB->GetValue( kRange, t, depth, FOREVER );
        width /= 2.f;
        height /= 2.f;

        box += Point3( -width, -height, 0.f );
        box += Point3( width, height, -depth );
    }
}
Пример #3
0
void    plRTDirLight::GetLocalBoundBox( TimeValue t, INode *node, ViewExp *vpt, Box3 &box )
{
    Point3  loc = node->GetObjectTM( t ).GetTrans();
    float   scaleFactor = vpt->NonScalingObjectSize() * vpt->GetVPWorldWidth( loc ) / 360.0f;
    float   width, height, depth;

    box = fMesh.getBoundingBox();
    // Because we want to scale about the origin, not the box center, we have to do this funky offset
    Point3  boxCenter = box.Center();
    box.Translate( -boxCenter );
    box.Scale( scaleFactor );
    boxCenter *= scaleFactor;
    box.Translate( boxCenter );

    if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) )
    {
        width = 2 * 20.f + ( 10.f / 2.f );  // Add in half arrow size
        height = 2 * 20.f + ( 10.f / 2.f );
        depth = 100.f;

        box += Point3( -width, -height, 0.f );
        box += Point3( width, height, -depth );
    }
}