Package com.ijurnove.cpu3d
Class PointLight
java.lang.Object
com.ijurnove.cpu3d.Light
com.ijurnove.cpu3d.PointLight
- All Implemented Interfaces:
Rotatable,Scalable,Translatable
PointLight extends the abstract class Light. A PointLight illuminates the area around it. Shadow
calculations are significantly more expensive than DirectionalLights, as shadows must be calculated in all six directions.
PointLight have a decayPow field that specifies how fast the light should decay as it gets farther away
from the source. For each illuminated point, the diffuse and specular light values are divided by
the distance from the light source raised to the power of decayPow. The default value is 3.
PointLights can be translated, rotated, and scaled.
-
Constructor Summary
ConstructorsConstructorDescriptionPointLight(Point3d pos, PhongComponents components) Constructs aPointLightwith a specified position andPhongComponents. -
Method Summary
Modifier and TypeMethodDescriptionprotected doubledoublegetDecay()Returns the decay exponent.getPos()Returns the position as aPoint3d.protected voidinit()protected Vector3dvoidRotates this object about a given point on a specified axis.voidScales this object by a given amount from a point.voidsetDecay(double decay) Sets the decay exponent.protected doubleshadowValue(Point3d point) voidtranslate(double x, double y, double z) Shifts this object's X, Y, and Z position by the given values.protected voidMethods inherited from class com.ijurnove.cpu3d.Light
getComponents, getParent, getType, setComponents, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ijurnove.cpu3d.Translatable
translate
-
Constructor Details
-
PointLight
Constructs aPointLightwith a specified position andPhongComponents.- Parameters:
pos- the specified positioncomponents- the specified PhongComponents
-
-
Method Details
-
getPos
Returns the position as aPoint3d.- Returns:
- the position of this PointLight
-
init
protected void init() -
setDecay
public void setDecay(double decay) Sets the decay exponent.- Parameters:
decay- the decay exponent
-
getDecay
public double getDecay()Returns the decay exponent.- Returns:
- the decay exponent
-
updateShadowMap
protected void updateShadowMap() -
shadowValue
-
lightVec
-
distance
-
translate
public void translate(double x, double y, double z) Description copied from interface:TranslatableShifts this object's X, Y, and Z position by the given values.- Specified by:
translatein interfaceTranslatable- Parameters:
x- how far the object should be translated along the X axisy- how far the object should be translated along the Y axisz- how far the object should be translated along the Z axis
-
rotate
Description copied from interface:RotatableRotates this object about a given point on a specified axis. 0 corresponds to the X axis, 1 corresponds to the Y axis, and 2 corresponds to the Z axis. -
scale
Description copied from interface:ScalableScales this object by a given amount from a point.
-