AppleSCNLight - UBogun/Xojo-iosLib GitHub Wiki
Inherits from AppleSCNAnimatableObject
Memory leak check: not yet done.
Status: incomplete, lightWithMDLLight Constructor missing.
An SCNLight object represents a light source. SceneKit provides four types of light: ambient, directional, omnidirectional, and spot. You illuminate your scene by attaching lights to SCNNode objects using their light property.
You set a light’s type using its type property. Depending on a light’s type, its position and direction may affect its behavior—you control the light’s position and direction through the node that the light is attached to. The direction of a light, if applicable to its type, is along the negative z-axis of its node’s local coordinate system.
SCNLight includes the AppleSCNAnimatableObject Interface, which means you can use AppleCAAnimations to animate these properties. Convenience methods have not been introduced to this class. Please check the Animate… methods of the AppleView class to get an idea of how to create own property animations for this class.
Constructors
Constructor(): Creates a new light object.
Properties
AttenuationEndDistance As Double: The distance from the light at which its intensity is completely diminished. Animatable.
AttenuationFalloffExponent As Double: The transition curve for the light’s intensity between its attenuation start and end distances. Animatable.
AttenuationStartDistance As Double: The distance from the light at which its intensity begins to diminish. Animatable.
CastsShadow As Boolean: Whether the light casts shadows.
CategoryBitMask As Uinteger: A mask that defines which categories this light belongs to.
Gobo As AplleSCNMaterialProperty: An image or other visual content affecting the shape and color of a light’s illuminated area. (read-only)
LightColor As AppleColor: The color of the light. Animatable.
Please note you can also use a CGColorRef theoretically. If you need to, please inform me.
Name As Text: A name associated with the light.
OrthographicScale As Double: The orthographic scale SceneKit uses when rendering the shadow map for a directional light. This property applies only if the light’s type property is SCNLightTypeDirectional.
ShadowBias As Double: The amount of correction to apply to the shadow to prevent rendering artifacts. Default 1.0.
ShadowColor As AppleColor: The color of shadows cast by the light. Animatable.
The internal methods set and getShadowColor accept a CGColorRef too.
ShadowMapSize As FoundationFrameWork.NSSize: The size of the shadow map image that SceneKit renders when creating shadows.
ShadowMode As SCNShadowMode: The mode SceneKit uses to render shadows. Default Forward.
SCNShadowMode | Definition |
---|---|
Forward | SceneKit renders shadows during lighting computations. In this mode, the color components of the light’s shadowColor property do not apply. The color’s alpha component determines the intensity of shadows. |
Deferred | SceneKit renders shadows in a postprocessing pass. In the mode, SceneKit blends shadows into the final image after the main rendering pass, so shadows can be of any color. |
Modulated | SceneKit renders shadows by projecting the light’s gobo image. The light does not illuminate the scene. Typically, you use this mode to create a low-accuracy, high-performance shadow under a game character or similar scene element: Use an image of a radial gradient (black to white) for the light’s gobo property, and use categoryBitMask properties to prevent the shadow image from appearing on the character. |
ShadowRadius As Double: A number that specifies the amount of blurring around the edges of shadows cast by the light. Animatable.
ShadowSampleCount* As UInteger: The number of samples from the shadow map that SceneKit uses to render each pixel. Default 1.
SpotInnerAngle As Double: The angle, in degrees, of the area fully lit by a spotlight. Animatable. Default 0.0.
SpotOuterAngle As Double: The angle, in degrees, of the area partially lit by a spotlight. Animatable. Default 45.0.
Type As SCNLightType: A constant identifying the general behavior of the light.
SCNLightType | Definition |
---|---|
Ambient | A light that illuminates all objects in the scene from all directions. Because the intensity of light from an ambient source is the same everywhere in the scene, its position and direction have no effect. Attenuation, spotlight angle, and shadow attributes do not apply to ambient lights. |
Omni | An omnidirectional light, also known as a point light. Because an omnidirectional light casts equal illumination in all directions, the orientation of the node containing the light has no effect. Spotlight angle and shadow attributes do not apply to directional lights. |
Directional | A light source with a uniform direction and constant intensity. Because a directional light illuminates all objects in the scene from the same direction and with the same intensity, so the position of the node containing the light has no effect. Attenuation and spotlight angle attributes do not apply to directional lights. |
Spot | A light source that illuminates a cone-shaped area. The position and orientation of the node containing the light determines the area lit by the spotlight, and all lighting attribute keys affect its appearance. |
zFar As Double: The maximum distance between the light and a visible surface for casting shadows. Default 1.0.
zNear As Double: The minimum distance between the light and a visible surface for casting shadows. Default 100.0.
See the methods and property of the AppleSCNAnimatableObject class too!