Package lighting
Class NarrowSpotlight
java.lang.Object
lighting.Light
lighting.LightSource
lighting.PointLight
lighting.Spotlight
lighting.NarrowSpotlight
public class NarrowSpotlight extends Spotlight
This class is represents an directional light source that attenuates with
respect to distance.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description NarrowSpotlight(Colour colour, Point position, NormalizedVector direction, double q, double l, double c, double focus)
-
Method Summary
Methods inherited from class lighting.PointLight
squareDistance, vectorTo
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
NarrowSpotlight
public NarrowSpotlight(Colour colour, Point position, NormalizedVector direction, double q, double l, double c, double focus)Construct aSpotlight
from aColour
, a direction, and 3 doubles that represent the attenuation constants and the focus factor.- Parameters:
colour
- The colour of the lightposition
- The position in space of the light sourcedirection
- The direction of the spot lightq
- The quadratic factorl
- The linear factorc
- The constant factorfocus
- The focus factor, between 0 and 1. (The closer to 0, the wider the spotlight)
-
-
Method Details
-
factor
Description copied from class:Spotlight
Calculate the factor by which to scale the colour at a given point, based on the direction of the spotlight.
-