// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-/*============================================================================*/
-/*==== Titre: Graphic3d_CLight.hxx */
-/*==== Role : The header file of primitive type "CLight" from Graphic3d */
-/*==== */
-/*==== Implementation: This is a primitive type implemented with typedef */
-/*============================================================================*/
-
#ifndef _Graphic3d_CLight_HeaderFile
#define _Graphic3d_CLight_HeaderFile
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
-typedef CALL_DEF_LIGHT Graphic3d_CLight;
+#include <Graphic3d_Vec.hxx>
+#include <Standard_Type.hxx>
-#if defined(__cplusplus) || defined(c_plusplus)
-/*==== Definition de Type ====================================================*/
+//! Light definition
+struct Graphic3d_CLight
+{
-#include <Standard_Type.hxx>
-const Handle(Standard_Type)& TYPE(Graphic3d_CLight);
-/*============================================================================*/
+public:
+
+ Graphic3d_Vec4 Color; //!< light color
+ Graphic3d_Vec4 Position; //!< light position
+ Graphic3d_Vec4 Direction; //!< direction of directional/spot light
+ Graphic3d_Vec4 Params; //!< packed light parameters
+ Standard_Integer Type; //!< Visual3d_TypeOfLightSource enumeration
+ Standard_Boolean IsHeadlight; //!< flag to mark head light
+
+ //! Const attenuation factor of positional light source
+ Standard_ShortReal ConstAttenuation() const { return Params.x(); }
+
+ //! Linear attenuation factor of positional light source
+ Standard_ShortReal LinearAttenuation() const { return Params.y(); }
+
+ //! Const, Linear attenuation factors of positional light source
+ Graphic3d_Vec2 Attenuation() const { return Params.xy(); }
+
+ //! Angle in radians of the cone created by the spot
+ Standard_ShortReal Angle() const { return Params.z(); }
+
+ //! Intensity distribution of the spot light, with 0..1 range.
+ Standard_ShortReal Concentration() const { return Params.w(); }
+
+ Standard_ShortReal& ChangeConstAttenuation() { return Params.x(); }
+ Standard_ShortReal& ChangeLinearAttenuation() { return Params.y(); }
+ Graphic3d_Vec2& ChangeAttenuation() { return Params.xy(); }
+ Standard_ShortReal& ChangeAngle() { return Params.z(); }
+ Standard_ShortReal& ChangeConcentration() { return Params.w(); }
+
+public:
+
+ //! Empty constructor
+ Graphic3d_CLight()
+ : Color (1.0f, 1.0f, 1.0f, 1.0f),
+ Position (0.0f, 0.0f, 0.0f, 1.0f),
+ Direction (0.0f, 0.0f, 0.0f, 0.0f),
+ Params (0.0f, 0.0f, 0.0f, 0.0f),
+ Type (0),
+ IsHeadlight (Standard_False)
+ {
+ //
+ }
+
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+};
-#endif
-#endif /*Graphic3d_CLight_HeaderFile*/
+#endif // Graphic3d_CLight_HeaderFile