com.xj.anylogic.engine.presentation
Class Light3D

java.lang.Object
  extended by com.xj.anylogic.engine.presentation.Light3D
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal, com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Light3DAmbient, Light3DDirectional, Light3DPoint, Light3DSpot

public abstract class Light3D
extends java.lang.Object

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.

The intensity and color of each component is defined in terms of general 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:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Shape3DGroup.add(Light3D), Serialized Form

Method Summary
 Light3D clone()
          Creates and returns a copy of this light (i.e. new light instance).
 Element3D_xjal get3DElement_xjal()
          This method is internal and shouldn't be accessed by user.
 java.awt.Color getAmbientColor()
          Returns the ambient color component
 java.awt.Color getDiffuseColor()
          Returns the diffuse color component
 ShapeGroup getGroup()
          Returns the group containing this light.
 java.lang.String getName()
          If the light is declared as field in a presentable object class (ActiveObject), e.g. if it was drawn in the graphical editor, returns the name of the field, otherwise returns the string Shape.UNKNOWN_NAME.
 Presentable getPresentable()
          Returns the Presentable object (ActiveObject or Experiment) where this light belongs to, or null.
 java.awt.Color getSpecularColor()
          Returns the specular color component
 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 restoreOwner(java.lang.Object owner)
          This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
 void set3DElement_xjal(Element3D_xjal element3D)
          This method is internal and shouldn't be accessed by user.
 void setAmbientColor(java.awt.Color ambientColor)
          Sets the ambient color component
 void setContextReference_xjal(Presentable contextReference)
          This method is internal and shouldn't be accessed by user.
 void setDiffuseColor(java.awt.Color diffuseColor)
          Sets the diffuse color component
 void setEnabled(boolean enabled)
          Enables or disables this light
 void setGlobal(boolean global)
          Sets whether this light should affect shapes outside the parent group of this light
 void setSpecularColor(java.awt.Color specularColor)
          Sets the specular color component
 void update()
          User extension point for dynamic properties update code
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDiffuseColor

public java.awt.Color getDiffuseColor()
Returns the diffuse color component

Returns:
the diffuse color component

setDiffuseColor

public void setDiffuseColor(java.awt.Color diffuseColor)
Sets the diffuse color component

Parameters:
diffuseColor - the diffuse color component

getSpecularColor

public java.awt.Color getSpecularColor()
Returns the specular color component

Returns:
the specular color component

setSpecularColor

public void setSpecularColor(java.awt.Color specularColor)
Sets the specular color component

Parameters:
specularColor - the specular color component

getAmbientColor

public java.awt.Color getAmbientColor()
Returns the ambient color component

Returns:
the ambient color component

setAmbientColor

public void setAmbientColor(java.awt.Color ambientColor)
Sets the ambient color component

Parameters:
ambientColor - the ambient color component

isGlobal

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

setGlobal

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

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this light

Parameters:
enabled - true to turn on the light

isEnabled

public boolean isEnabled()
Returns true if this light is turned on

Returns:
true if this light is enabled

getGroup

public ShapeGroup getGroup()
Returns the group containing this light.

Returns:
the group containing this light

getPresentable

public Presentable getPresentable()
Returns the Presentable object (ActiveObject or Experiment) where this light belongs to, or null.

Specified by:
getPresentable in interface com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal
Returns:
the Presentable that owns this light, or null

getName

public java.lang.String getName()
If the light is declared as field in a presentable object class (ActiveObject), 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 and fails in the models exported as applets

Returns:
the name of the corresponding field or Shape.UNKNOWN_NAME

update

public void update()
User extension point for dynamic properties update code


clone

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 active object

Overrides:
clone in class java.lang.Object

restoreOwner

public final void restoreOwner(java.lang.Object owner)
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading

Specified by:
restoreOwner in interface com.xj.anylogic.engine.internal.Child
Parameters:
owner - owner of this object, usually ActiveObject, Experiment or ShapeGroup

setContextReference_xjal

public void setContextReference_xjal(Presentable contextReference)
Description copied from interface: com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
setContextReference_xjal in interface com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal

set3DElement_xjal

public void set3DElement_xjal(Element3D_xjal element3D)
Description copied from interface: com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
set3DElement_xjal in interface com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal

get3DElement_xjal

public Element3D_xjal get3DElement_xjal()
Description copied from interface: com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
get3DElement_xjal in interface com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.