Represents a light that shines in the modeling space.
Constructors
Light
#Protected constructor used in serialization.
Parameters:
| info (SerializationInfo) | Serialization data. |
| context (StreamingContext) | Serialization stream. |
Fields
Properties
Get the type of attenuation for this light.
Gets or Sets the attenuation vector.
Gets a value, determined by LightStyle, that explains whether the camera directions are relative to World or Camera spaces.
Gets or sets the vector direction of the camera.
Disposed
Indicates if this object has been disposed or the document it originally belonged to has been disposed.
HasBrepForm
Returns true if the Brep.TryConvertBrep function will be successful for this object
HasUserData
Gets true if this class has any custom information attached to it through UserData.
The hot spot setting runs from 0.0 to 1.0 and is used to provides a linear interface for controlling the focus or concentration of a spotlight. A hot spot setting of 0.0 corresponds to a spot exponent of 128. A hot spot setting of 1.0 corresponds to a spot exponent of 0.0.
IsDeformable
true if object can be accurately modified with "squishy" transformations like projections, shears, and non-uniform scaling.
Gets a value indicating whether the light style is LightStyle CameraDirectional or WorldDirectional.
IsDocumentControlled
If true this object may not be modified. Any properties or functions that attempt to modify this object when it is set to "IsReadOnly" will throw a NotSupportedException.
Overrides: CommonObject.IsDocumentControlled
Gets or sets a value that defines if the light is turned on (true) or off (false).
Gets a value indicating whether the light style is LightStyle WorldLinear.
Gets a value indicating whether the light style is LightStyle CameraPoint or WorldPoint.
Gets a value indicating whether the light style is LightStyle WorldRectangular.
IsShallowDuplicate
Is this instance a 'shallow copy'. Shallow copies are no different than regular instances with the exception that they will convert to complete independent 'deep' copies if a non const operation is perform on the instance (something that mutates the internal data)
Gets a value indicating whether the light style is LightStyle CameraSpot or WorldSpot.
Gets a value indicating whether this object is a Sun light.
Gets or sets the height in linear and rectangular lights.
(ignored for non-linear/rectangular lights.)
Gets or sets a light style on this camera.
Gets or sets the light or 3D position or location.
ObjectType
Useful for switch statements that need to differentiate between basic object types like points, curves, surfaces, and so on.
Gets a perpendicular vector to the camera direction.
Gets or sets the light power in candelas (cd).
Gets or sets the light power in lumens (lm).
Gets or sets the light power in watts (W).
Gets or sets the emitter radius (of the emitting sphere, in model units) for point and spot lights.
Ignored for other light types; linear light radius is derived from Width.
Gets or sets the shadow intensity for the light.
Gets or sets the spot angle in radians.
Ignored for non-spot lights.
angle = 0 to pi/2 (0 to 90 degrees).
The spot exponent varies from 0.0 to 128.0 and provides an exponential interface for controlling the focus or concentration of a spotlight (like the OpenGL GL_SPOT_EXPONENT parameter). The spot exponent and hot spot parameters are linked; changing one will change the other. A hot spot setting of 0.0 corresponds to a spot exponent of 128. A hot spot setting of 1.0 corresponds to a spot exponent of 0.0.
obsoleteUse ShadowIntensity
Gets or sets the spot light shadow intensity.
(ignored for non-spot lights.)
UserData
List of custom information that is attached to this class.
UserDictionary
Dictionary of custom information attached to this class. The dictionary is actually user data provided as an easy to use shareable set of information.
Methods
ComponentIndex
If this piece of geometry is a component in something larger, like a BrepEdge in a Brep, then this function returns the component index.
Returns: This object's component index. If this object is not a sub-piece of a larger geometric entity, then the returned index has m_type = ComponentIndex.InvalidType and m_index = -1.
ConstructConstObject
Assigns a parent object and a sub-object index to this.
public static Light CreateSunLight(double northAngleDegrees, DateTime when, double latitudeDegrees, double longitudeDegrees)
Constructs a light which simulates the Sun based on a given time and location on Earth.
Parameters:
| northAngleDegrees (double) | The angle of North in degrees. North is the angle between positive World X axis and model North, as measured on World XY plane. |
| when (DateTime) | The time of the measurement. The Kind property of DateTime specifies whether this is in local or universal time. Local and Undefined date-time kinds in this argument are considered local. |
| latitudeDegrees (double) | The latitude, in degrees, of the location on Earth. |
| longitudeDegrees (double) | The longitude, in degrees, of the location on Earth. |
Returns: A newly constructed light object.
Exceptions:
| RdkNotLoadedException | If the RDK is not loaded. |
public static Light CreateSunLight(double northAngleDegrees, double azimuthDegrees, double altitudeDegrees)
Constructs a light that represents the Sun.
Parameters:
| northAngleDegrees (double) | The angle of North in degrees. North is the angle between positive World X axis and model North, as measured on World XY plane. |
| azimuthDegrees (double) | The Azimuth angle value in degrees. Azimuth is the compass angle from North. |
| altitudeDegrees (double) | The Altitude angle in degrees. Altitude is the angle above the ground plane. |
Returns: A new sun light.
Exceptions:
| RdkNotLoadedException | If the RDK is not loaded. |
Constructs a light which simulates a Sun.
Parameters:
| sun (Sun) | A Sun object from the Rhino.Render namespace. |
Returns: A light.
DataCRC
Returns a CRC calculated from the information that defines the object. This CRC can be used as a quick way to see if two objects are not identical.
Parameters:
| currentRemainder (uint) | The current remainder value. |
Returns: CRC of the information the defines the object.
DeleteAllUserStrings
public void DeleteAllUserStrings()
Parameters:
| key (string) |
Dispose
public void Dispose()
Actively reclaims unmanaged resources that this instance uses.
Dispose
Overridden in order to destroy local display cache information
Parameters:
| disposing (bool) |
Overrides: CommonObject.Dispose
Returns: An object of the same type as this, with the same properties and behavior.
DuplicateShallow
Constructs a light copy of this object. By "light", it is meant that the same underlying data is used until something is done to attempt to change it. For example, you could have a shallow copy of a very heavy mesh object and the same underlying data will be used when doing things like inspecting the number of faces on the mesh. If you modify the location of one of the mesh vertices, the shallow copy will create a full duplicate of the underlying mesh data and the shallow copy will become a deep copy.
Returns: An object of the same type as this object.
This behavior is overridden by implementing classes.
EnsurePrivateCopy
public void EnsurePrivateCopy()
If you want to keep a copy of this class around by holding onto it in a variable after a command completes, call EnsurePrivateCopy to make sure that this class is not tied to the document. You can call this function as many times as you want.
Gets the attenuation settings (ignored for "directional" and "ambient" lights).
attenuation = 1/(a0 + d*a1 + d^2*a2) where d = distance to light.
Parameters:
| d (double) | The distance to evaluate. |
Returns: 0 if a0 + d*a1 + d^2*a2 <= 0.
GetBoundingBox
Bounding box solver. Gets the world axis aligned bounding box for the geometry.
Parameters:
| accurate (bool) | If true, a physically accurate bounding box will be computed. If not, a bounding box estimate will be computed. For some geometry types there is no difference between the estimate and the accurate bounding box. Estimated bounding boxes can be computed much (much) faster than accurate (or "tight") bounding boxes. Estimated bounding boxes are always similar to or larger than accurate bounding boxes. |
Returns: The bounding box of the geometry in world coordinates or BoundingBox.Empty if not bounding box could be found.
GetBoundingBox
Aligned Bounding box solver. Gets the plane aligned bounding box.
GetBoundingBox
Aligned Bounding box solver. Gets the plane aligned bounding box.
Parameters:
| plane (Plane) | Orientation plane for BoundingBox. |
Returns: A BoundingBox in plane coordinates.
GetBoundingBox
Aligned Bounding box solver. Gets the world axis aligned bounding box for the transformed geometry.
Parameters:
| xform (Transform) | Transformation to apply to object prior to the BoundingBox computation. The geometry itself is not modified. |
Returns: The accurate bounding box of the transformed geometry in world coordinates or BoundingBox.Empty if not bounding box could be found.
GetObjectData
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
Parameters:
| info (SerializationInfo) | The System.Runtime.Serialization.SerializationInfo to populate with data. |
| context (StreamingContext) | The destination (see System.Runtime.Serialization.StreamingContext) for this serialization. |
Gets the spot light radii.
Parameters:
| key (string) | id used to retrieve the string. |
Returns: string associated with the key if successful. null if no key was found.
GetUserStrings
Gets a copy of all (user key string, user value string) pairs attached to this geometry.
Returns: A new collection.
IsValidWithLog
Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
Parameters:
| log (out string) | A textual log. This out parameter is assigned during this call. |
Returns: true if this object is valid; false otherwise.
MakeDeformable
If possible, converts the object into a form that can be accurately modified with "squishy" transformations like projections, shears, an non-uniform scaling.
Returns: false if object cannot be converted to a deformable object. true if object was already deformable or was converted into a deformable object.
MemoryEstimate
Computes an estimate of the number of bytes that this object is using in memory.
Returns: An estimated memory footprint.
NonConstOperation
protected override void NonConstOperation()
Destroy cache handle
Overrides: CommonObject.NonConstOperation
OnSwitchToNonConst
protected override void OnSwitchToNonConst()
Is called when a non-constant operation occurs.
Overrides: CommonObject.OnSwitchToNonConst
Rotate
Rotates the object about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule).
Scale
Scales the object by the specified factor. The scale is centered at the origin.
Parameters:
| scaleFactor (double) | The uniform scaling factor. |
Returns: true if geometry successfully scaled.
Sets the attenuation settings (ignored for "directional" and "ambient" lights).
attenuation = 1/(a0 + d*a1 + d^2*a2) where d = distance to light.
SetUserString
Attach a user string (key,value combination) to this geometry.
ToJSON
Create a JSON string representation of this object
Parameters:
| options (SerializationOptions) |
Transform
Transforms the geometry. If the input Transform has a SimilarityType of OrientationReversing, you may want to consider flipping the transformed geometry after calling this function when it makes sense. For example, you may want to call Flip() on a Brep after transforming it.
Parameters:
| xform (Transform) | Transformation to apply to geometry. |
Returns: true if geometry successfully transformed.
Translate
Translates the object along the specified vector.
Translate
Translates the object along the specified vector.
Parameters:
| translationVector (Vector3d) | A moving vector. |
Returns: true if geometry successfully translated.