Light

Inheritance: java.lang.Object, com.aspose.threed.A3DObject, com.aspose.threed.SceneObject, com.aspose.threed.Entity, com.aspose.threed.Frustum

public class Light extends Frustum

The light illuminates the scene.

The formula to calculate the total attenuation of light is: A = ConstantAttenuation + (Dist * LinearAttenuation) + ((Dist^2) * QuadraticAttenuation)

Constructors

ConstructorDescription
Light()Initializes a new instance of the Light class.
Light(String name)Initializes a new instance of the Light class.
Light(String name, LightType type)Initializes a new instance of the Light class.

Methods

MethodDescription
equals(Object arg0)
findProperty(String propertyName)Finds the property.
getAspect()Gets the aspect ratio of the frustum
getBoundingBox()Gets the bounding box of current entity in its object space coordinate system.
getCastLight()Gets if the current light instance can illuminate other objects.
getCastShadows()Gets if the light can cast shadows on other objects.
getClass()
getColor()Gets the light’s color
getConstantAttenuation()Gets the constant attenuation to calculate the total attenuation of the light
getDirection()Gets the direction that the camera is looking at.
getEntityRendererKey()Gets the key of the entity renderer registered in the renderer
getExcluded()Gets whether to exclude this entity during exporting.
getFalloff()Gets the falloff cone angle (in degrees).
getFarPlane()Gets the frustum’s far plane distance.
getHotSpot()Gets the hot spot cone angle(in degrees).
getIntensity()Gets the light’s intensity, default value is 100
getLightType()Gets the light’s type
getLinearAttenuation()Gets the linear attenuation to calculate the total attenuation of the light
getLookAt()Gets the the interested position that the camera is looking at.
getName()Gets the name.
getNearPlane()Gets the frustum’s near plane distance.
getOrthoHeight()Gets the height when frustum in orthographic projection.
getParentNode()Gets the first parent node, if set the first parent node, this entity will be detached from other parent nodes.
getParentNodes()Gets all parent nodes, an entity can be attached to multiple parent nodes for geometry instancing
getProperties()Gets the collection of all properties.
getProperty(String property)Get the value of specified property
getQuadraticAttenuation()Gets the quadratic attenuation to calculate the total attenuation of the light
getRotationMode()Gets the frustum’s orientation mode This property only works when the getTarget is null.
getScene()Gets the scene that this object belongs to
getShadowColor()Gets the shadow’s color.
getTarget()Gets the target that the camera is looking at.
getUp()Gets the up direction of the camera
hashCode()
notify()
notifyAll()
removeProperty(Property property)Removes a dynamic property.
removeProperty(String property)Remove the specified property identified by name
setAspect(double value)Sets the aspect ratio of the frustum
setCastLight(boolean value)Sets if the current light instance can illuminate other objects.
setCastShadows(boolean value)Sets if the light can cast shadows on other objects.
setColor(Vector3 value)Sets the light’s color
setConstantAttenuation(double value)Sets the constant attenuation to calculate the total attenuation of the light
setDirection(Vector3 value)Sets the direction that the camera is looking at.
setExcluded(boolean value)Sets whether to exclude this entity during exporting.
setFalloff(double value)Sets the falloff cone angle (in degrees).
setFarPlane(double value)Sets the frustum’s far plane distance.
setHotSpot(double value)Sets the hot spot cone angle(in degrees).
setIntensity(double value)Sets the light’s intensity, default value is 100
setLightType(LightType value)Sets the light’s type
setLinearAttenuation(double value)Sets the linear attenuation to calculate the total attenuation of the light
setLookAt(Vector3 value)Sets the the interested position that the camera is looking at.
setName(String value)Sets the name.
setNearPlane(double value)Sets the frustum’s near plane distance.
setOrthoHeight(double value)Sets the height when frustum in orthographic projection.
setParentNode(Node value)Sets the first parent node, if set the first parent node, this entity will be detached from other parent nodes.
setProperty(String property, Object value)Sets the value of specified property
setQuadraticAttenuation(double value)Sets the quadratic attenuation to calculate the total attenuation of the light
setRotationMode(RotationMode value)Sets the frustum’s orientation mode This property only works when the getTarget is null.
setShadowColor(Vector3 value)Sets the shadow’s color.
setTarget(Node value)Sets the target that the camera is looking at.
setUp(Vector3 value)Sets the up direction of the camera
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

Light()

public Light()

Initializes a new instance of the Light class.

Light(String name)

public Light(String name)

Initializes a new instance of the Light class.

Parameters:

ParameterTypeDescription
namejava.lang.StringName

Light(String name, LightType type)

public Light(String name, LightType type)

Initializes a new instance of the Light class.

Parameters:

ParameterTypeDescription
namejava.lang.StringName
typeLightTypeNew light’s type

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

findProperty(String propertyName)

public Property findProperty(String propertyName)

Finds the property. It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) or native property(Identified by its name)

Parameters:

ParameterTypeDescription
propertyNamejava.lang.StringProperty name.

Returns: Property - The property.

getAspect()

public double getAspect()

Gets the aspect ratio of the frustum

Returns: double

getBoundingBox()

public BoundingBox getBoundingBox()

Gets the bounding box of current entity in its object space coordinate system. Example: The following code shows how to calculate the bounding box of a shape

Entity entity = new Sphere();
     entity.setRadius(10);
     var bbox = entity.getBoundingBox();
     System.out.printf("The bounding box of the entity is %s ~ %s", bbox.getMinimum(), bbox.getMaximum());

Returns: BoundingBox

getCastLight()

public boolean getCastLight()

Gets if the current light instance can illuminate other objects.

Returns: boolean

getCastShadows()

public boolean getCastShadows()

Gets if the light can cast shadows on other objects.

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getColor()

public Vector3 getColor()

Gets the light’s color

Returns: Vector3

getConstantAttenuation()

public double getConstantAttenuation()

Gets the constant attenuation to calculate the total attenuation of the light

Returns: double

getDirection()

public Vector3 getDirection()

Gets the direction that the camera is looking at. Changes on this property will also affects the getLookAt and getTarget.

Returns: Vector3

getEntityRendererKey()

public EntityRendererKey getEntityRendererKey()

Gets the key of the entity renderer registered in the renderer

Returns: EntityRendererKey

getExcluded()

public boolean getExcluded()

Gets whether to exclude this entity during exporting.

Returns: boolean

getFalloff()

public double getFalloff()

Gets the falloff cone angle (in degrees).

Returns: double

getFarPlane()

public double getFarPlane()

Gets the frustum’s far plane distance.

Returns: double

getHotSpot()

public double getHotSpot()

Gets the hot spot cone angle(in degrees).

Returns: double

getIntensity()

public double getIntensity()

Gets the light’s intensity, default value is 100

Returns: double

getLightType()

public LightType getLightType()

Gets the light’s type

Returns: LightType

getLinearAttenuation()

public double getLinearAttenuation()

Gets the linear attenuation to calculate the total attenuation of the light

Returns: double

getLookAt()

public Vector3 getLookAt()

Gets the the interested position that the camera is looking at.

Returns: Vector3

getName()

public String getName()

Gets the name.

Returns: java.lang.String

getNearPlane()

public double getNearPlane()

Gets the frustum’s near plane distance.

Returns: double

getOrthoHeight()

public double getOrthoHeight()

Gets the height when frustum in orthographic projection.

Returns: double

getParentNode()

public Node getParentNode()

Gets the first parent node, if set the first parent node, this entity will be detached from other parent nodes.

Returns: Node

getParentNodes()

public ArrayList<Node> getParentNodes()

Gets all parent nodes, an entity can be attached to multiple parent nodes for geometry instancing

Returns: java.util.ArrayList<com.aspose.threed.Node>

getProperties()

public PropertyCollection getProperties()

Gets the collection of all properties.

Returns: PropertyCollection

getProperty(String property)

public Object getProperty(String property)

Get the value of specified property

Parameters:

ParameterTypeDescription
propertyjava.lang.StringProperty name

Returns: java.lang.Object - The value of the found property

getQuadraticAttenuation()

public double getQuadraticAttenuation()

Gets the quadratic attenuation to calculate the total attenuation of the light

Returns: double

getRotationMode()

public RotationMode getRotationMode()

Gets the frustum’s orientation mode This property only works when the getTarget is null. If the value is RotationMode.FIXED_TARGET, the direction is always calculated by the property getLookAt Otherwise the getLookAt is always calculated by the getDirection

Returns: RotationMode

getScene()

public Scene getScene()

Gets the scene that this object belongs to

Returns: Scene

getShadowColor()

public Vector3 getShadowColor()

Gets the shadow’s color.

Returns: Vector3

getTarget()

public Node getTarget()

Gets the target that the camera is looking at. If the user supports this property, it should be prior to getLookAt property.

Returns: Node

getUp()

public Vector3 getUp()

Gets the up direction of the camera

Returns: Vector3

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

removeProperty(Property property)

public boolean removeProperty(Property property)

Removes a dynamic property.

Parameters:

ParameterTypeDescription
propertyPropertyWhich property to remove

Returns: boolean - true if the property is successfully removed

removeProperty(String property)

public boolean removeProperty(String property)

Remove the specified property identified by name

Parameters:

ParameterTypeDescription
propertyjava.lang.String

Returns: boolean

setAspect(double value)

public void setAspect(double value)

Sets the aspect ratio of the frustum

Parameters:

ParameterTypeDescription
valuedoubleNew value

setCastLight(boolean value)

public void setCastLight(boolean value)

Sets if the current light instance can illuminate other objects.

Parameters:

ParameterTypeDescription
valuebooleanNew value

setCastShadows(boolean value)

public void setCastShadows(boolean value)

Sets if the light can cast shadows on other objects.

Parameters:

ParameterTypeDescription
valuebooleanNew value

setColor(Vector3 value)

public void setColor(Vector3 value)

Sets the light’s color

Parameters:

ParameterTypeDescription
valueVector3New value

setConstantAttenuation(double value)

public void setConstantAttenuation(double value)

Sets the constant attenuation to calculate the total attenuation of the light

Parameters:

ParameterTypeDescription
valuedoubleNew value

setDirection(Vector3 value)

public void setDirection(Vector3 value)

Sets the direction that the camera is looking at. Changes on this property will also affects the getLookAt and getTarget.

Parameters:

ParameterTypeDescription
valueVector3New value

setExcluded(boolean value)

public void setExcluded(boolean value)

Sets whether to exclude this entity during exporting.

Parameters:

ParameterTypeDescription
valuebooleanNew value

setFalloff(double value)

public void setFalloff(double value)

Sets the falloff cone angle (in degrees).

Parameters:

ParameterTypeDescription
valuedoubleNew value

setFarPlane(double value)

public void setFarPlane(double value)

Sets the frustum’s far plane distance.

Parameters:

ParameterTypeDescription
valuedoubleNew value

setHotSpot(double value)

public void setHotSpot(double value)

Sets the hot spot cone angle(in degrees).

Parameters:

ParameterTypeDescription
valuedoubleNew value

setIntensity(double value)

public void setIntensity(double value)

Sets the light’s intensity, default value is 100

Parameters:

ParameterTypeDescription
valuedoubleNew value

setLightType(LightType value)

public void setLightType(LightType value)

Sets the light’s type

Parameters:

ParameterTypeDescription
valueLightTypeNew value

setLinearAttenuation(double value)

public void setLinearAttenuation(double value)

Sets the linear attenuation to calculate the total attenuation of the light

Parameters:

ParameterTypeDescription
valuedoubleNew value

setLookAt(Vector3 value)

public void setLookAt(Vector3 value)

Sets the the interested position that the camera is looking at.

Parameters:

ParameterTypeDescription
valueVector3New value

setName(String value)

public void setName(String value)

Sets the name.

Parameters:

ParameterTypeDescription
valuejava.lang.StringNew value

setNearPlane(double value)

public void setNearPlane(double value)

Sets the frustum’s near plane distance.

Parameters:

ParameterTypeDescription
valuedoubleNew value

setOrthoHeight(double value)

public void setOrthoHeight(double value)

Sets the height when frustum in orthographic projection.

Parameters:

ParameterTypeDescription
valuedoubleNew value

setParentNode(Node value)

public void setParentNode(Node value)

Sets the first parent node, if set the first parent node, this entity will be detached from other parent nodes.

Parameters:

ParameterTypeDescription
valueNodeNew value

setProperty(String property, Object value)

public void setProperty(String property, Object value)

Sets the value of specified property

Parameters:

ParameterTypeDescription
propertyjava.lang.StringProperty name
valuejava.lang.ObjectThe value of the property

setQuadraticAttenuation(double value)

public void setQuadraticAttenuation(double value)

Sets the quadratic attenuation to calculate the total attenuation of the light

Parameters:

ParameterTypeDescription
valuedoubleNew value

setRotationMode(RotationMode value)

public void setRotationMode(RotationMode value)

Sets the frustum’s orientation mode This property only works when the getTarget is null. If the value is RotationMode.FIXED_TARGET, the direction is always calculated by the property getLookAt Otherwise the getLookAt is always calculated by the getDirection

Parameters:

ParameterTypeDescription
valueRotationModeNew value

setShadowColor(Vector3 value)

public void setShadowColor(Vector3 value)

Sets the shadow’s color.

Parameters:

ParameterTypeDescription
valueVector3New value

setTarget(Node value)

public void setTarget(Node value)

Sets the target that the camera is looking at. If the user supports this property, it should be prior to getLookAt property.

Parameters:

ParameterTypeDescription
valueNodeNew value

setUp(Vector3 value)

public void setUp(Vector3 value)

Sets the up direction of the camera

Parameters:

ParameterTypeDescription
valueVector3New value

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int