internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FDatasmithFacadeAreaLight obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
        private static FDatasmithFacadeActorLight SetupLightActor(RhinoSceneHierarchyNodeInfo HierarchyNodeInfo, Light RhinoLight)
        {
            LightObject RhinoLightObject = HierarchyNodeInfo.RhinoModelComponent as LightObject;
            string      HashedName       = FDatasmithFacadeElement.GetStringHash(HierarchyNodeInfo.Name);
            FDatasmithFacadeActorLight LightElement;

            switch (RhinoLight.LightStyle)
            {
            case LightStyle.CameraSpot:
            case LightStyle.WorldSpot:
                FDatasmithFacadeSpotLight SpotLightElement = new FDatasmithFacadeSpotLight(HashedName);
                LightElement = SpotLightElement;
                double OuterSpotAngle = FDatasmithRhinoUtilities.RadianToDegree(RhinoLight.SpotAngleRadians);
                double InnerSpotAngle = RhinoLight.HotSpot * OuterSpotAngle;

                SpotLightElement.SetOuterConeAngle((float)OuterSpotAngle);
                SpotLightElement.SetInnerConeAngle((float)InnerSpotAngle);
                break;

            case LightStyle.WorldLinear:
            case LightStyle.WorldRectangular:
                FDatasmithFacadeAreaLight AreaLightElement = new FDatasmithFacadeAreaLight(HashedName);
                LightElement = AreaLightElement;
                double Length = RhinoLight.Length.Length;
                AreaLightElement.SetLength((float)Length);

                if (RhinoLight.IsRectangularLight)
                {
                    double Width = RhinoLight.Width.Length;

                    AreaLightElement.SetWidth((float)Width);
                    AreaLightElement.SetLightShape(FDatasmithFacadeAreaLight.EAreaLightShape.Rectangle);
                    AreaLightElement.SetLightType(FDatasmithFacadeAreaLight.EAreaLightType.Rect);
                }
                else
                {
                    AreaLightElement.SetWidth((float)(0.01f * Length));
                    AreaLightElement.SetLightShape(FDatasmithFacadeAreaLight.EAreaLightShape.Cylinder);
                    AreaLightElement.SetLightType(FDatasmithFacadeAreaLight.EAreaLightType.Point);
                    // The light in Rhino doesn't have attenuation, but the attenuation radius was found by testing in Unreal to obtain a visual similar to Rhino
                    float DocumentScale = (float)Rhino.RhinoMath.UnitScale(Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem, UnitSystem.Centimeters);
                    AreaLightElement.SetAttenuationRadius(1800f / DocumentScale);
                }
                break;

            case LightStyle.CameraDirectional:
            case LightStyle.WorldDirectional:
                LightElement = new FDatasmithFacadeDirectionalLight(HashedName);

                break;

            case LightStyle.CameraPoint:
            case LightStyle.WorldPoint:
                LightElement = new FDatasmithFacadePointLight(HashedName);
                break;

            case LightStyle.Ambient:                     // not supported as light
            default:
                LightElement = null;
                break;
            }

            if (LightElement != null)
            {
                System.Drawing.Color DiffuseColor = RhinoLight.Diffuse;
                LightElement.SetColor(DiffuseColor.R, DiffuseColor.G, DiffuseColor.B, DiffuseColor.A);
                LightElement.SetIntensity(RhinoLight.Intensity * 100f);
                LightElement.SetEnabled(RhinoLight.IsEnabled);
                LightElement.SetLabel(HierarchyNodeInfo.Label);

                FDatasmithFacadePointLight PointLightElement = LightElement as FDatasmithFacadePointLight;
                if (PointLightElement != null)
                {
                    PointLightElement.SetIntensityUnits(FDatasmithFacadePointLight.EPointLightIntensityUnit.Candelas);
                }
            }

            return(LightElement);
        }