Open CASCADE Technology
6.9.0
|
This class defines and updates light sources. There is no limit to the number of light sources defined. Only the number of active sources is limited. More...
#include <Visual3d_Light.hxx>
Public Member Functions | |
Visual3d_Light () | |
Creates a light from default values. Light sources are created in a visualiser and are activated in one of its views. More... | |
Visual3d_Light (const Quantity_Color &Color) | |
Creates an AMBIENT light source. Light sources are created in a visualiser and are activated in one of its views. More... | |
Visual3d_Light (const Quantity_Color &Color, const Graphic3d_Vector &Direction, const Standard_Boolean Headlight=Standard_False) | |
Creates a DIRECTIONAL light source. Light sources are created in a visualiser and are activated in one of its views. Warning: Raises LightDefinitionError if <Direction> is null. More... | |
Visual3d_Light (const Quantity_Color &Color, const Graphic3d_Vertex &Position, const Standard_Real Fact1, const Standard_Real Fact2) | |
Creates a POSITIONAL light source. Light sources are created in a visualiser and are activated in one of its views. Warning: Raises LightDefinitionError if <Fact1> and <Fact2> are null. if <Fact1> is a negative value or greater than 1.0. if <Fact2> is a negative value or greater than 1.0. More... | |
Visual3d_Light (const Quantity_Color &Color, const Graphic3d_Vertex &Position, const Graphic3d_Vector &Direction, const Standard_Real Concentration, const Standard_Real Fact1, const Standard_Real Fact2, const Standard_Real AngleCone) | |
Creates a SPOT light source. Light sources are created in a visualiser and are activated in one of its views. <Concentration> specifies the intensity distribution of the light. <AngleCone> specifies the angle (radians) of the cone created by the spot. the global attenuation is equal : 1 / (Fact1 + Fact2 * (norm(ObjectPosition - LightPosition))) Warning: Raises LightDefinitionError if <Direction> is null. if <Concentration> is a negative value or greater than 1.0. if <Fact1> and <Fact2> are null. if <Fact1> is a negative value or greater than 1.0. if <Fact2> is a negative value or greater than 1.0. if <AngleCone> is a negative value or greater than PI/2. More... | |
void | SetAngle (const Standard_Real AngleCone) |
Modifies the angle (radians) of the cone created by the spot. Works only on TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_SPOT. if <AngleCone> is a negative value or greater than PI/2. More... | |
void | SetAttenuation1 (const Standard_Real Fact1) |
Modifies the attenuation factor of the light. Works only on the TOLS_POSITIONAL and TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_SPOT or TOLS_POSITIONAL. if <Fact1> is a negative value or greater than 1.0. More... | |
void | SetAttenuation2 (const Standard_Real Fact2) |
Modifies the attenuation factor of the light. Works only on the TOLS_POSITIONAL and TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_POSITIONAL or TOLS_SPOT. if <Fact2> is a negative value or greater than 1.0.. More... | |
void | SetColor (const Quantity_Color &Color) |
Modifies the colour of the light. More... | |
void | SetConcentration (const Standard_Real Concentration) |
Modifies the intensity distribution of the light. Works only on the TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_SPOT. if <Concentration> is a negative value or greater than 1.0. More... | |
void | SetDirection (const Graphic3d_Vector &Direction) |
Modifies the light direction. Works only on the TOLS_DIRECTIONAL and TOLS_SPOT lights. Default z Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_DIRECTIONAL or TOLS_SPOT. if <Direction> is null. More... | |
void | SetPosition (const Graphic3d_Vertex &Position) |
Modifies the position of the light. Works only on the TOLS_POSITIONAL and TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_POSITIONAL or TOLS_SPOT. More... | |
Standard_Boolean | Headlight () const |
Returns the headlight state of the light <me> More... | |
void | SetHeadlight (const Standard_Boolean theValue) |
Setup headlight flag. More... | |
Quantity_Color | Color () const |
Returns the colour of the light <me>. More... | |
Visual3d_TypeOfLightSource | LightType () const |
Returns the light type of <me>. More... | |
void | Values (Quantity_Color &Color) const |
Returns the definition of <me> if <me> is a light source of the TOLS_AMBIENT type. Category: Inquire methods Warning: Raises LightDefinitionError if the type of the light is not TOLS_AMBIENT. More... | |
void | Values (Quantity_Color &Color, Graphic3d_Vector &Direction) const |
Returns the definition of <me> if <me> is a light source of the TOLS_DIRECTIONAL type. Category: Inquire methods Warning: Raises LightDefinitionError if the type of the light is not TOLS_DIRECTIONAL. More... | |
void | Values (Quantity_Color &Color, Graphic3d_Vertex &Position, Standard_Real &Fact1, Standard_Real &Fact2) const |
Returns the definition of <me> if <me> is a light source of the TOLS_POSITIONAL type. Category: Inquire methods Warning: Raises LightDefinitionError if the type of the light is not TOLS_POSITIONAL. More... | |
void | Values (Quantity_Color &Color, Graphic3d_Vertex &Position, Graphic3d_Vector &Direction, Standard_Real &Concentration, Standard_Real &Fact1, Standard_Real &Fact2, Standard_Real &AngleCone) const |
Returns the definition of <me> if <me> is a light source of the TOLS_SPOT type. Category: Inquire methods Warning: Raises LightDefinitionError if the type of the light is not TOLS_SPOT. More... | |
const Graphic3d_CLight & | CLight () const |
Returns the light defintion. More... | |
Public Member Functions inherited from MMgt_TShared | |
virtual void | Delete () const |
Memory deallocator for transient classes. More... | |
Public Member Functions inherited from Standard_Transient | |
Standard_Transient () | |
Empty constructor. More... | |
Standard_Transient (const Standard_Transient &) | |
Copy constructor – does nothing. More... | |
Standard_Transient & | operator= (const Standard_Transient &) |
Assignment operator, needed to avoid copying reference counter. More... | |
virtual | ~Standard_Transient () |
Destructor must be virtual. More... | |
virtual const Handle_Standard_Type & | DynamicType () const |
Returns a type information object about this object. More... | |
Standard_Boolean | IsInstance (const Handle_Standard_Type &theType) const |
Returns a true value if this is an instance of Type. More... | |
Standard_Boolean | IsInstance (const Standard_CString theTypeName) const |
Returns a true value if this is an instance of TypeName. More... | |
Standard_Boolean | IsKind (const Handle_Standard_Type &theType) const |
Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More... | |
Standard_Boolean | IsKind (const Standard_CString theTypeName) const |
Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More... | |
virtual Handle_Standard_Transient | This () const |
Returns a Handle which references this object. Must never be called to objects created in stack. More... | |
Standard_Integer | GetRefCount () const |
Get the reference counter of this object. More... | |
This class defines and updates light sources. There is no limit to the number of light sources defined. Only the number of active sources is limited.
TypeOfLightSource = TOLS_AMBIENT TOLS_DIRECTIONAL TOLS_POSITIONAL TOLS_SPOT
Angle is a radian value. Concentration, Attenuation are in the [0,1] interval.
Visual3d_Light::Visual3d_Light | ( | ) |
Creates a light from default values. Light sources are created in a visualiser and are activated in one of its views.
Type = TOLS_AMBIENT Color = WHITE
Visual3d_Light::Visual3d_Light | ( | const Quantity_Color & | Color | ) |
Creates an AMBIENT light source. Light sources are created in a visualiser and are activated in one of its views.
Visual3d_Light::Visual3d_Light | ( | const Quantity_Color & | Color, |
const Graphic3d_Vector & | Direction, | ||
const Standard_Boolean | Headlight = Standard_False |
||
) |
Creates a DIRECTIONAL light source. Light sources are created in a visualiser and are activated in one of its views. Warning: Raises LightDefinitionError if <Direction> is null.
Visual3d_Light::Visual3d_Light | ( | const Quantity_Color & | Color, |
const Graphic3d_Vertex & | Position, | ||
const Standard_Real | Fact1, | ||
const Standard_Real | Fact2 | ||
) |
Creates a POSITIONAL light source. Light sources are created in a visualiser and are activated in one of its views. Warning: Raises LightDefinitionError if <Fact1> and <Fact2> are null. if <Fact1> is a negative value or greater than 1.0. if <Fact2> is a negative value or greater than 1.0.
Visual3d_Light::Visual3d_Light | ( | const Quantity_Color & | Color, |
const Graphic3d_Vertex & | Position, | ||
const Graphic3d_Vector & | Direction, | ||
const Standard_Real | Concentration, | ||
const Standard_Real | Fact1, | ||
const Standard_Real | Fact2, | ||
const Standard_Real | AngleCone | ||
) |
Creates a SPOT light source. Light sources are created in a visualiser and are activated in one of its views. <Concentration> specifies the intensity distribution of the light. <AngleCone> specifies the angle (radians) of the cone created by the spot. the global attenuation is equal : 1 / (Fact1 + Fact2 * (norm(ObjectPosition - LightPosition))) Warning: Raises LightDefinitionError if <Direction> is null. if <Concentration> is a negative value or greater than 1.0. if <Fact1> and <Fact2> are null. if <Fact1> is a negative value or greater than 1.0. if <Fact2> is a negative value or greater than 1.0. if <AngleCone> is a negative value or greater than PI/2.
const Graphic3d_CLight& Visual3d_Light::CLight | ( | ) | const |
Returns the light defintion.
Quantity_Color Visual3d_Light::Color | ( | ) | const |
Returns the colour of the light <me>.
Standard_Boolean Visual3d_Light::Headlight | ( | ) | const |
Returns the headlight state of the light <me>
Visual3d_TypeOfLightSource Visual3d_Light::LightType | ( | ) | const |
Returns the light type of <me>.
TypeOfLightSource = TOLS_AMBIENT TOLS_DIRECTIONAL TOLS_POSITIONAL TOLS_SPOT
void Visual3d_Light::SetAngle | ( | const Standard_Real | AngleCone | ) |
Modifies the angle (radians) of the cone created by the spot. Works only on TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_SPOT. if <AngleCone> is a negative value or greater than PI/2.
void Visual3d_Light::SetAttenuation1 | ( | const Standard_Real | Fact1 | ) |
Modifies the attenuation factor of the light. Works only on the TOLS_POSITIONAL and TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_SPOT or TOLS_POSITIONAL. if <Fact1> is a negative value or greater than 1.0.
void Visual3d_Light::SetAttenuation2 | ( | const Standard_Real | Fact2 | ) |
Modifies the attenuation factor of the light. Works only on the TOLS_POSITIONAL and TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_POSITIONAL or TOLS_SPOT. if <Fact2> is a negative value or greater than 1.0..
void Visual3d_Light::SetColor | ( | const Quantity_Color & | Color | ) |
Modifies the colour of the light.
void Visual3d_Light::SetConcentration | ( | const Standard_Real | Concentration | ) |
Modifies the intensity distribution of the light. Works only on the TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_SPOT. if <Concentration> is a negative value or greater than 1.0.
void Visual3d_Light::SetDirection | ( | const Graphic3d_Vector & | Direction | ) |
Modifies the light direction. Works only on the TOLS_DIRECTIONAL and TOLS_SPOT lights. Default z Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_DIRECTIONAL or TOLS_SPOT. if <Direction> is null.
void Visual3d_Light::SetHeadlight | ( | const Standard_Boolean | theValue | ) |
Setup headlight flag.
void Visual3d_Light::SetPosition | ( | const Graphic3d_Vertex & | Position | ) |
Modifies the position of the light. Works only on the TOLS_POSITIONAL and TOLS_SPOT lights. Category: Methods to modify the class definition Warning: Raises LightDefinitionError if the type of the light is not TOLS_POSITIONAL or TOLS_SPOT.
void Visual3d_Light::Values | ( | Quantity_Color & | Color | ) | const |
Returns the definition of <me> if <me> is a light source of the TOLS_AMBIENT type. Category: Inquire methods Warning: Raises LightDefinitionError if the type of the light is not TOLS_AMBIENT.
void Visual3d_Light::Values | ( | Quantity_Color & | Color, |
Graphic3d_Vector & | Direction | ||
) | const |
Returns the definition of <me> if <me> is a light source of the TOLS_DIRECTIONAL type. Category: Inquire methods Warning: Raises LightDefinitionError if the type of the light is not TOLS_DIRECTIONAL.
void Visual3d_Light::Values | ( | Quantity_Color & | Color, |
Graphic3d_Vertex & | Position, | ||
Standard_Real & | Fact1, | ||
Standard_Real & | Fact2 | ||
) | const |
Returns the definition of <me> if <me> is a light source of the TOLS_POSITIONAL type. Category: Inquire methods Warning: Raises LightDefinitionError if the type of the light is not TOLS_POSITIONAL.
void Visual3d_Light::Values | ( | Quantity_Color & | Color, |
Graphic3d_Vertex & | Position, | ||
Graphic3d_Vector & | Direction, | ||
Standard_Real & | Concentration, | ||
Standard_Real & | Fact1, | ||
Standard_Real & | Fact2, | ||
Standard_Real & | AngleCone | ||
) | const |
Returns the definition of <me> if <me> is a light source of the TOLS_SPOT type. Category: Inquire methods Warning: Raises LightDefinitionError if the type of the light is not TOLS_SPOT.