Exemplo n.º 1
0
        /// <summary>
        /// Set IES Object for Point, Spot or Rectangular light.
        /// </summary>
        /// <param name="light">The light to modify.</param>
        /// <param name="profile">The IES profile to set.</param>
        public static void SetIESProfile(Light light, IESObject profile)
        {
            if (!light.TryGetComponent <HDAdditionalLightData>(out var additionalData))
            {
                return;
            }

            string guid;
            long   localID;

            AssetDatabase.TryGetGUIDAndLocalFileIdentifier(profile, out guid, out localID);
            string path = AssetDatabase.GUIDToAssetPath(guid);

            UnityEngine.Object[] textures = AssetDatabase.LoadAllAssetRepresentationsAtPath(path);
            foreach (var subAsset in textures)
            {
                if (AssetDatabase.IsSubAsset(subAsset) && subAsset.name.EndsWith("-Cube-IES"))
                {
                    additionalData.IESPoint = subAsset as Texture;
                }
                else if (AssetDatabase.IsSubAsset(subAsset) && subAsset.name.EndsWith("-2D-IES"))
                {
                    additionalData.IESSpot = subAsset as Texture;
                }
            }
        }
Exemplo n.º 2
0
 public static T Cast <T>(this IESObject obj)
 {
     try {
         return((T)obj);
     } catch (Exception e) {
         throw new InvalidOperationException(obj.ToString(), e);
     }
 }
Exemplo n.º 3
0
        public static IESObject[] ToVirtuals(object[] objs, int count)
        {
            if (count == 0)
            {
                return(_0Vtrs);
            }
            var arr = new IESObject[count];

            if (objs == null || objs.Length == 0)
            {
                return(arr);
            }
            var len = Math.Min(objs.Length, count);

            for (var i = 0; i < len; i++)
            {
                arr[i] = ToVirtual(objs[i]);
            }
            return(arr);
        }
Exemplo n.º 4
0
 public void SetValue(IESObject value)
 {
     _table[_key] = value;
 }
Exemplo n.º 5
0
 IESObject IESIndex.this[IESObject index] {
     get { return(GetValue <IESIndex>()[index]); }
     set { GetValue <IESIndex>()[index] = value; }
 }
Exemplo n.º 6
0
 public void SetValue(ESDomain domain, IESObject value)
 {
     GetProperty(domain).SetValue(value);
 }
Exemplo n.º 7
0
 public static float GetNumber(this IESObject obj)
 {
     return(obj.Cast <IESNumber>().Value);
 }
Exemplo n.º 8
0
 public static int GetInteger(this IESObject obj)
 {
     return(obj.Cast <IESInteger>().Value);
 }
Exemplo n.º 9
0
 public EIL(ILType type, IESObject target)
 {
     this.type   = type;
     this.target = target;
 }
Exemplo n.º 10
0
 public void SetValue(ESDomain domain, IESObject value)
 {
     domain.SetValue(_value, value);
 }
Exemplo n.º 11
0
 public void SetValue(IESObject value)
 {
     _value = value.ToObject();
 }
Exemplo n.º 12
0
 public void SetValue(ESDomain domain, IESObject value)
 {
     _target.GetValue <IESIndex>(domain)[_value.GetValue(domain)] = value;
 }
Exemplo n.º 13
0
 public void SetValue(ESContext context, IESObject value)
 {
     _target.GetValue <IESIndex>(context)[_value.GetValue(context)] = value;
 }
Exemplo n.º 14
0
 public void SetValue(ESContext context, IESObject value)
 {
     context.SetValue(_value, value);
 }
Exemplo n.º 15
0
 public void SetValue(IESObject value)
 {
     SetValue(value.ToObject());
 }
Exemplo n.º 16
0
 public void SetValue(ESContext context, IESObject value)
 {
     GetProperty(context).SetValue(value);
 }
Exemplo n.º 17
0
 public static T Cast <T>(this IESObject obj)
 {
     return((T)obj);
 }
Exemplo n.º 18
0
 public static string GetString(this IESObject obj)
 {
     return(obj.Cast <IESString>().Value);
 }
Exemplo n.º 19
0
 public EIL(string name, ILType type, IESObject target)
 {
     this.name   = name;
     this.type   = type;
     this.target = target;
 }