Class vdLight
- Namespace
- VectorDraw.Professional.vdFigures
- Assembly
- VectorDraw.Professional.dll
Represents a renderable light source used by the VectorDraw rendering and document systems.
Lights is taking efect in 3D drawing scenes and they are ignored in 2D drawings.
You can manage the collection of lights in a document through the Lights property of the selected vdDocument.
public sealed class vdLight : vdFigure, IDisposable, IVDSerialise, IBaseObject
- Inheritance
-
vdLight
- Implements
- Inherited Members
Examples
Create a light and set it as directional light in the top of a cube and with low intensity
var lightTop = doc.Lights.Add("Top");
lightTop.SetDirectionalLight(new Vector(0, 0, -1), vdLight.LightIntensity.Low, Color.White);
lightTop.Enable = true;
doc.Lights.Default.Enable = false;
var box = new vdPolyface(doc);
box.CreateBox(new gPoint(),10, 10, 10,0);
doc.Model.Entities.AddItem(box);
//render scene at specific view and render mode
doc.RenderMode = vdRender.Mode.Shade;
doc.CommandAction.View3D("VINE");
Remarks
The vdLight class encapsulates configuration for a light that can be directional, positional or a spotlight. It stores geometric properties such as Position and Direction, visual properties such as color and intensity (Intensity / IntensityValue), and spotlight-specific parameters (SpotAngle and SpotFallOff).
Special behavior notes: - If a light is marked as a global light (GlobalLight), it behaves as a directional light and its Position is treated as (0,0,0) relative to the current view. - ApplyShadow can be true only for directional and spot lights and is ignored for global lights. - Only one light that has ApplyShadow and Enable set is used to produce shadows (the first in the lights collection with those properties). - Only the first 8 enabled lights are used in rendering, so if you have more than 8 lights make sure to set Enable=false for the ones you don't want to be rendered.
Constructors
- vdLight()
Initializes the vdLight object.
- vdLight(vdDocument)
Initializes a new instance of the vdLight object and registers it to the passed Document.
Properties
- ApplyShadow
Get/Set a boolean value indicating if the vdLight object will apply shadows in 3d drawing scene.
- BoundingBox
Gets the Bounding Box of the vdLight object in WorldCoordinate System.
- Direction
Direction vector only for directional light.
- Draw3DFlag
Get/Set a property value used when drawing an object in 3d. Not used for a vdLight object.
- Enable
Get/Set a boolean value indicating if the light is enabled.
- FadeEffect
overrides the FadeEffect
- GlobalLight
Get the default global light.
- Handle
Gets a unique object for the Document that represents the handle of the object.
- HighLight
Get/Set the value indicating if the lines of the object will be drawn as dashed.
- Intensity
Light's intensity.
- IntensityValue
Light's intensity in range 0 - 255.
- Label
Get/Set a label string for the object
- Layer
Returns the Layer of the object
- LineType
Get/Set the vdLinetype object that the vdFigure will be drawn with.
- LineTypeScale
Get/Set The Linetype scale of the object.
- LineWeight
Get/Set The LineWeight of the object.
- Name
Get/Set the name of the light.
- PenWidth
Get/Set the PenWidth in Drawing Units of the object.
- Position
Get/Set the Position in World Co-ordinate System.
- SpotAngle
Get/Set the half angle of the Spot's light cone in degrees used only for Spot light type.
- SpotDirection
This property is used for backword compatibillity.Use Direction property instead.
- SpotFallOff
Get/Set the angle in degrees that defines a ring on the outer side of a spot light where the light will fade to darkness.
- ToolTip
Get/Set a string representing the Tooltip of the object.
- TransparencyMethod
overrides the TransparencyMethod
- TypeOfLight
Get/Set the type of the light.
- URL
Get/Set a string representing the URL of the object.
- VisibleIn2d
Get/Set a boolean value indicating if the vdLight object will be drawn when in 2D mode.
- XProperties
Gets the Collection of vdXproperties of the object.
- color
Get/Set the color of the Light.
- visibility
Get/Set the visibility of the object. For a vdLight object use Enable property instead.
Methods
- DeSerialize(DeSerializer, string, object)
This Function is called foreach field name of the vdLight object when opening in vdml format.
- Draw(vdRender)
Called in order to draw the object in a specified vdRender object.
- GetCompareHash()
Returns a unique 32 bit integer value according to the object type and its properties values
- GetGripPoints()
A function returning the grip points of the object.
- GetValidGripPointsItems()
Returns the number of valid grip points of the object. Must return the same number of points as the GetGripPoints() method.
- InitializeProperties()
Resets the properties of the vdLight object to the Default values.
- MatchProperties(vdPrimary, vdDocument)
Matches all the common properties from an object and sets them to this object.
- MoveGripPointsAt(Int32Array, double, double, double)
This function is intended to be called during a grip edit of the object.
- Serialize(Serializer)
This Function is called when saving the vdLight object to vdml format.
- SetDirectionalLight(Vector, LightIntensity, Color)
Initializes a directional light with the given parameters.
- SetPositionlLight(gPoint, LightIntensity, Color)
Initializes a positional light with the given parameters.
- SetSpotLight(gPoint, Vector, double, LightIntensity, Color)
Initializes a spot light with the given parameters.
- ToString()
Gets a System.String that represents the type of the vdLight Object.
- Transformby(Matrix)
Transforms all geometrical properties of this object by the specified Matrix.