Package com.anylogic.engine.presentation
- Nested Class Summary
- Method Summary
- Method Details
- getDiffuseColor
- setDiffuseColor
- getSpecularColor
- setSpecularColor
- getAmbientColor
- setAmbientColor
- isGlobal
- setGlobal
- onAggregatorVisibilityChanged
- setEnabled
- isEnabled
- getGroup
- getPresentable
- getName
- update
- clone
- getSVGId
- updateSVGProperties
- resetSVGState
- findSVGElement
- executeUserAction
- removeSVGFromOwner
- updateDynamicPropertiesStructural
- getLevel
- setLevel
- restoreOwner
- setContextReference_xjal
- java.lang.Object
- com.anylogic.engine.presentation.Light3D
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,Serializable
,Cloneable
- Direct Known Subclasses:
Light3DAmbient
,Light3DDirectional
,Light3DPoint
,Light3DSpot
public abstract class Light3D extends Object implements SVGElement
Base class for all 3D lights, may be added to 3D groups for scene lighting
The light consists of a number of different components: Ambient, Diffuse and Specular.
Each component is applied to the corresponding color part of shape's texture (if shape has texture) or the general shape's color (if shape has only
The light consists of a number of different components: Ambient, Diffuse and Specular.
- Ambient light is a light that had scattered for many times, so that it does not have any certain direction. Ambient light does not die out and is uniformly distributed all over the space.
- Diffuse light shines in a particular direction but is reflected homogenously from each point of the surface (for example, fluorescent lights).
- Specular light is a light that reflects off a smooth shiny surface.
Color
object.
For example, Black means "No light",
White - white light with maximum intensity,
Red - red light with maximum intensity (e.g. green shape will be invisible under this light),
Dark Red - red light with low intensity.Each component is applied to the corresponding color part of shape's texture (if shape has texture) or the general shape's color (if shape has only
Color
).- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
-
ShapeGroup.add(Light3D)
Serialized Form
Modifier and Type | Class | Description |
---|---|---|
static class | Light3D.CarHeadlight | |
static class | Light3D.Daylight | |
static class | Light3D.Moonlight | |
static class | Light3D.StreetLight |
Modifier and Type | Method | Description |
---|---|---|
Light3D | clone() |
Creates and returns a copy of this light (i.e.
|
void | executeUserAction |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
SVGElement | findSVGElement |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
Color | getAmbientColor() |
Returns the ambient color component
|
Color | getDiffuseColor() |
Returns the diffuse color component
|
ShapeGroup | getGroup() |
Returns the group containing this light.
|
Level | getLevel() |
Returns the level containing this shape.
|
String | getName() |
If the light is declared as field in a presentable object class
(
Agent ), e.g. |
Presentable | getPresentable() | |
Color | getSpecularColor() |
Returns the specular color component
|
long | getSVGId() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
boolean | isEnabled() |
Returns
true if this light is turned on. |
boolean | isGlobal() |
Returns
true if this light affects shapes outside the parent group of this light |
void | onAggregatorVisibilityChanged() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | removeSVGFromOwner |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | resetSVGState() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
final void | restoreOwner |
Deprecated.
|
void | setAmbientColor |
Sets the ambient color component
|
void | setContextReference_xjal |
Deprecated.
|
void | setDiffuseColor |
Sets the diffuse color component
|
void | setEnabled |
Enables or disables this light
|
void | setGlobal |
Sets whether this light should affect shapes outside the parent group of this light
|
void | setLevel |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | setSpecularColor |
Sets the specular color component
|
void | update() |
User extension point for dynamic properties update code
|
boolean | updateDynamicPropertiesStructural | |
SVGElement | updateSVGProperties |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Updates SVG properties of the element that are then sent to the rendering client. |
public Color getDiffuseColor()
Returns the diffuse color component
- Returns:
- the diffuse color component
public void setDiffuseColor(Color diffuseColor)
Sets the diffuse color component
- Parameters:
diffuseColor
- the diffuse color component
public Color getSpecularColor()
Returns the specular color component
- Returns:
- the specular color component
public void setSpecularColor(Color specularColor)
Sets the specular color component
- Parameters:
specularColor
- the specular color component
public Color getAmbientColor()
Returns the ambient color component
- Returns:
- the ambient color component
public void setAmbientColor(Color ambientColor)
Sets the ambient color component
- Parameters:
ambientColor
- the ambient color component
public boolean isGlobal()
Returns
true
if this light affects shapes outside the parent group of this light- Returns:
true
if this light affects shapes outside the parent group of this light
public void setGlobal(boolean global)
Sets whether this light should affect shapes outside the parent group of this light
- Parameters:
global
-true
if this light should affect shapes outside the parent group of this light
public void onAggregatorVisibilityChanged()
Description copied from interface:
AggregatableAnimationElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
onAggregatorVisibilityChanged
in interfaceAggregatableAnimationElement
public void setEnabled(boolean enabled)
Enables or disables this light
- Parameters:
enabled
-true
to turn on the light
public boolean isEnabled()
Returns
true
if this light is turned on. Note that Level
containing the
element may be invisible, and this method only returns the own state of the element.- Returns:
true
if this light is enabled
public ShapeGroup getGroup()
Returns the group containing this light.
- Returns:
- the group containing this light
public Presentable getPresentable()
- Returns:
- the Presentable that owns this light, or
null
public String getName()
If the light is declared as field in a presentable object class
(
This method is designed to be used for debug/development purposes only. It has a very inefficient implementation
Agent
), e.g. if it was drawn in the graphical editor,
returns the name of the field, otherwise returns the string Shape.UNKNOWN_NAME
.This method is designed to be used for debug/development purposes only. It has a very inefficient implementation
- Returns:
- the name of the corresponding field or
Shape.UNKNOWN_NAME
public void update()
User extension point for dynamic properties update code
public Light3D clone()
Creates and returns a copy of this light (i.e. new light instance).
The returned light has the same type and parameters
The returned copy isn't automatically added to the group this light belongs to.
The clone is created in the context of the same agent
The returned light has the same type and parameters
The returned copy isn't automatically added to the group this light belongs to.
The clone is created in the context of the same agent
@AnyLogicInternalAPI public long getSVGId()
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
getSVGId
in interfaceSVGElement
@AnyLogicInternalAPI public SVGElement updateSVGProperties(List<SVGCommand> commands, ShapeDrawMode drawMode, boolean publicOnly, SVGElement owner, SVGElement elbehind)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Updates SVG properties of the element that are then sent to the rendering client. If the element is not yet in the SVG scene, generates "C" command, if it is there, but some properties are out of date, generates "U" command. If SVG drawing of this element is not needed because of public only settings, or permanently not needed, or not supported yet, returns false and does nothing.
it may be removed/renamed in future.
Updates SVG properties of the element that are then sent to the rendering client. If the element is not yet in the SVG scene, generates "C" command, if it is there, but some properties are out of date, generates "U" command. If SVG drawing of this element is not needed because of public only settings, or permanently not needed, or not supported yet, returns false and does nothing.
- Specified by:
updateSVGProperties
in interfaceSVGElement
- Parameters:
commands
- the list of commands to add todrawMode
- TODOpublicOnly
- drawing context: if true, only shapes that are marked as public only are updatedowner
- the SVG element that serves as a container for this elementelbehind
- the SVG element behind this one, or null if none or if order is irrelevant- Returns:
- the actual owner this element has been added to or
null
if element is not drawn (e.g. drawing of this element is not needed because of public only settings, permanently not needed or not supported - hence SVG id is not set). The actual owner may differ from the givenowner
when the svg element is added to a different place (e.g. GIS map).
@AnyLogicInternalAPI public void resetSVGState()
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
resetSVGState
in interfaceSVGElement
@AnyLogicInternalAPI public SVGElement findSVGElement(long svgId)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
findSVGElement
in interfaceSVGElement
@AnyLogicInternalAPI public void executeUserAction(String value)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
executeUserAction
in interfaceSVGElement
@AnyLogicInternalAPI public void removeSVGFromOwner(Shape oldOwner)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
removeSVGFromOwner
in interfaceSVGElement
@AnyLogicInternalAPI public boolean updateDynamicPropertiesStructural(boolean publicOnly)
- Returns:
true
if update was done (usually for visible elements, respecting public flag etc.)
public Level getLevel()
Returns the level containing this shape.
The returned value is
null
for shapes in the experiments.@AnyLogicInternalAPI public void setLevel(Level level)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Please use
it may be removed/renamed in future. Please use
Level.add(Shape)
instead.- Specified by:
setLevel
in interfaceLevelElement
@AnyLogicInternalCodegenAPI @Deprecated public final void restoreOwner(Object owner)
Deprecated.
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
This method restores owner of this object
The method is used in snapshot saving/loading
- Specified by:
restoreOwner
in interfacecom.anylogic.engine.internal.Child
- Parameters:
owner
- owner of this object, usuallyAgent
,Experiment
orShapeGroup
@AnyLogicInternalAPI @Deprecated public void setContextReference_xjal(Presentable contextReference)
Deprecated.