PassRefPtr<LightSource> SVGFESpotLightElement::lightSource() const
{
    FloatPoint3D pos(x(), y(), z());
    FloatPoint3D direction(pointsAtX(), pointsAtY(), pointsAtZ());

    return SpotLightSource::create(pos, direction, specularExponent(), limitingConeAngle());
}
Example #2
0
TextStream& SpotLightSource::externalRepresentation(TextStream& ts) const
{
    ts << "[type=SPOT-LIGHT] ";
    ts << "[position=\"" << position() << "\"]";
    ts << "[direction=\"" << direction() << "\"]";
    ts << "[specularExponent=\"" << specularExponent() << "\"]";
    ts << "[limitingConeAngle=\"" << limitingConeAngle() << "\"]";
    return ts;
}
SVGLightSource* SVGFESpotLightElement::lightSource() const
{
    FloatPoint3D pos(x(), y(), z());

    // convert lookAt to a direction
    FloatPoint3D direction(pointsAtX() - pos.x(), 
                             pointsAtY() - pos.y(), 
                             pointsAtZ() - pos.z());
    direction.normalize();
    return new SVGSpotLightSource(pos, direction, specularExponent(), limitingConeAngle());
}