private void SetupMainLightConstants(CommandBuffer cmd, List <VisibleLight> lights, int lightIndex)
        {
            Vector4 lightPos, lightColor, lightDistanceAttenuation, lightSpotDir, lightSpotAttenuation;

            InitializeLightConstants(lights, lightIndex, out lightPos, out lightColor, out lightDistanceAttenuation, out lightSpotDir, out lightSpotAttenuation);

            if (lightIndex >= 0)
            {
                UnityEngine.LightType mainLightType = lights[lightIndex].lightType;
                Light mainLight = lights[lightIndex].light;

                if (LightweightUtils.IsSupportedCookieType(mainLightType) && mainLight.cookie != null)
                {
                    Matrix4x4 lightCookieMatrix;
                    LightweightUtils.GetLightCookieMatrix(lights[lightIndex], out lightCookieMatrix);
                    cmd.SetGlobalTexture(PerCameraBuffer._MainLightCookie, mainLight.cookie);
                    cmd.SetGlobalMatrix(PerCameraBuffer._WorldToLight, lightCookieMatrix);
                }
            }

            cmd.SetGlobalVector(PerCameraBuffer._MainLightPosition, lightPos);
            cmd.SetGlobalVector(PerCameraBuffer._MainLightColor, lightColor);
            cmd.SetGlobalVector(PerCameraBuffer._MainLightDistanceAttenuation, lightDistanceAttenuation);
            cmd.SetGlobalVector(PerCameraBuffer._MainLightSpotDir, lightSpotDir);
            cmd.SetGlobalVector(PerCameraBuffer._MainLightSpotAttenuation, lightSpotAttenuation);
        }
Esempio n. 2
0
// fields

// properties
    static void Light_type(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.Light _this = (UnityEngine.Light)vc.csObj;
            var result = _this.type;
            JSApi.setEnum((int)JSApi.SetType.Rval, (int)result);
        }
        else
        {
            UnityEngine.LightType arg0  = (UnityEngine.LightType)JSApi.getEnum((int)JSApi.GetType.Arg);
            UnityEngine.Light     _this = (UnityEngine.Light)vc.csObj;
            _this.type = arg0;
        }
    }
 public static int set_type_wrap(long L)
 {
     try
     {
         long  nThisPtr             = FCLibHelper.fc_get_inport_obj_ptr(L);
         Light ret                  = get_obj(nThisPtr);
         UnityEngine.LightType arg0 = (UnityEngine.LightType)(FCLibHelper.fc_get_int(L, 0));
         ret.type = arg0;
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
 public static int GetLights_wrap(long L)
 {
     try
     {
         UnityEngine.LightType arg0 = (UnityEngine.LightType)(FCLibHelper.fc_get_int(L, 0));
         int     arg1    = FCLibHelper.fc_get_int(L, 1);
         Light[] ret     = Light.GetLights(arg0, arg1);
         long    ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         FCCustomParam.ReturnArray(ret, ret_ptr);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
Esempio n. 5
0
// methods

    static bool Light_GetLights__LightType__Int32(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 2)
        {
            UnityEngine.LightType arg0 = (UnityEngine.LightType)JSApi.getEnum((int)JSApi.GetType.Arg);
            System.Int32          arg1 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg);
            var arrRet = UnityEngine.Light.GetLights(arg0, arg1);
            for (int i = 0; arrRet != null && i < arrRet.Length; i++)
            {
                JSMgr.datax.setObject((int)JSApi.SetType.SaveAndTempTrace, arrRet[i]);
                JSApi.moveSaveID2Arr(i);
            }
            JSApi.setArrayS((int)JSApi.SetType.Rval, (arrRet != null ? arrRet.Length : 0), true);
        }

        return(true);
    }