static StackObject *Ctor_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 6);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @mipCount = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Experimental.Rendering.TextureCreationFlags @flags = (UnityEngine.Experimental.Rendering.TextureCreationFlags) typeof(UnityEngine.Experimental.Rendering.TextureCreationFlags).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.Experimental.Rendering.GraphicsFormat @format = (UnityEngine.Experimental.Rendering.GraphicsFormat) typeof(UnityEngine.Experimental.Rendering.GraphicsFormat).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            System.Int32 @depth = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 5);
            System.Int32 @height = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 6);
            System.Int32 @width = ptr_of_this_method->Value;


            var result_of_this_method = new UnityEngine.Texture3D(@width, @height, @depth, @format, @flags, @mipCount);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Example #2
0
        public override void OnImportAsset(AssetImportContext ctx)
        {
            byte[]    bytes       = File.ReadAllBytes(ctx.assetPath);
            Texture2D webpTexture = Texture2DExt.CreateTexture2DFromWebP(bytes, lMipmaps: false, lLinear: Linear, lError: out Error lError, makeNoLongerReadable: false);

            if (lError != Error.Success)
            {
                Debug.LogError("Error decoding WebP texture: " + lError);
                Texture2D tex = new Texture2D(1, 1);
                tex.SetPixel(1, 1, Color.red);
                ctx.AddObjectToAsset("main", tex);
                ctx.SetMainObject(tex);
                return;
            }

            Texture2D targetTexture;

            if (Mipmap)
            {
                int width  = webpTexture.width;
                int height = webpTexture.height;
                UnityEngine.Experimental.Rendering.GraphicsFormat graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.GetGraphicsFormat(TextureFormat.RGBA32, false);
                uint mipmapSize  = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.ComputeMipmapSize(width, height, graphicsFormat);
                int  mipmapCount = (int)mipmapSize / (width * height);
                targetTexture = new Texture2D(webpTexture.width, webpTexture.height, TextureFormat, mipCount: mipmapCount, linear: Linear);
            }
            else
            {
                targetTexture = new Texture2D(webpTexture.width, webpTexture.height, TextureFormat, mipCount: -1, linear: Linear);
            }


            bool isSuccess = targetTexture.LoadImage(webpTexture.EncodeToPNG());

            if (!isSuccess)
            {
                Debug.LogError($"Error convert target texture format : {WEBP_LOAD_DEFAULT_TEXTURE_FORMAT} => {TextureFormat}");
                Texture2D tex = new Texture2D(1, 1);
                tex.SetPixel(1, 1, Color.red);
                ctx.AddObjectToAsset("main", tex);
                ctx.SetMainObject(tex);
                return;
            }

            EditorUtility.CompressTexture(targetTexture, TextureFormat, TextureCompressionQuality.Normal);
            ctx.AddObjectToAsset("main", targetTexture);
            ctx.SetMainObject(targetTexture);

            if (ShouldGenerateSprite)
            {
                Rect   spriteRect = new Rect(Vector2.zero, new Vector2(webpTexture.width, webpTexture.height));
                Sprite sprite     = Sprite.Create(targetTexture, spriteRect, Vector2.zero);
                sprite.name = Path.GetFileNameWithoutExtension(ctx.assetPath);
                ctx.AddObjectToAsset("sprite", sprite);
            }
        }
    static int _CreateUnityEngine_Texture2D(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1);
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat, UnityEngine.Experimental.Rendering.TextureCreationFlags>(L, 3))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                UnityEngine.Experimental.Rendering.GraphicsFormat       arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 3);
                UnityEngine.Experimental.Rendering.TextureCreationFlags arg3 = (UnityEngine.Experimental.Rendering.TextureCreationFlags)ToLua.ToObject(L, 4);
                UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3);
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes <UnityEngine.TextureFormat, bool>(L, 3))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.ToObject(L, 3);
                bool arg3 = LuaDLL.lua_toboolean(L, 4);
                UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3);
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else if (count == 5)
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.CheckObject(L, 3, typeof(UnityEngine.TextureFormat));
                bool arg3 = LuaDLL.luaL_checkboolean(L, 4);
                bool arg4 = LuaDLL.luaL_checkboolean(L, 5);
                UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3, arg4);
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Texture2D.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #4
0
 public static Texture2D CreateWebpTexture2D(int width, int height, bool isUseMipmap, bool isLinear)
 {
     if (isUseMipmap)
     {
         UnityEngine.Experimental.Rendering.GraphicsFormat graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.GetGraphicsFormat(TextureFormat.RGBA32, false);
         uint mipmapSize  = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.ComputeMipmapSize(width, height, graphicsFormat);
         int  mipmapCount = (int)mipmapSize / (width * height);
         return(new Texture2D(width, height, TextureFormat.RGBA32, mipCount: mipmapCount, isLinear));
     }
     else
     {
         return(new Texture2D(width, height, TextureFormat.RGBA32, mipChain: false, isLinear));
     }
 }
Example #5
0
 static int GetGraphicsFormat(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.Experimental.Rendering.DefaultFormat  arg0 = (UnityEngine.Experimental.Rendering.DefaultFormat)ToLua.CheckObject(L, 1, typeof(UnityEngine.Experimental.Rendering.DefaultFormat));
         UnityEngine.Experimental.Rendering.GraphicsFormat o    = UnityEngine.SystemInfo.GetGraphicsFormat(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #6
0
 static int IsFormatSupported(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.Experimental.Rendering.GraphicsFormat arg0 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.CheckObject(L, 1, typeof(UnityEngine.Experimental.Rendering.GraphicsFormat));
         UnityEngine.Experimental.Rendering.FormatUsage    arg1 = (UnityEngine.Experimental.Rendering.FormatUsage)ToLua.CheckObject(L, 2, typeof(UnityEngine.Experimental.Rendering.FormatUsage));
         bool o = UnityEngine.SystemInfo.IsFormatSupported(arg0, arg1);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int Resize(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3)
            {
                UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D));
                int  arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                int  arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
                bool o    = obj.Resize(arg0, arg1);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 5 && TypeChecker.CheckTypes <UnityEngine.TextureFormat, bool>(L, 4))
            {
                UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D));
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.ToObject(L, 4);
                bool arg3 = LuaDLL.lua_toboolean(L, 5);
                bool o    = obj.Resize(arg0, arg1, arg2, arg3);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 5 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat, bool>(L, 4))
            {
                UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D));
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.GraphicsFormat arg2 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4);
                bool arg3 = LuaDLL.lua_toboolean(L, 5);
                bool o    = obj.Resize(arg0, arg1, arg2, arg3);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.Resize"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #8
0
    static int get_graphicsFormat(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.Texture obj = (UnityEngine.Texture)o;
            UnityEngine.Experimental.Rendering.GraphicsFormat ret = obj.graphicsFormat;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index graphicsFormat on a nil value"));
        }
    }
Example #9
0
    static int set_graphicsFormat(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.RenderTexture obj = (UnityEngine.RenderTexture)o;
            UnityEngine.Experimental.Rendering.GraphicsFormat arg0 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.CheckObject(L, 2, typeof(UnityEngine.Experimental.Rendering.GraphicsFormat));
            obj.graphicsFormat = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index graphicsFormat on a nil value"));
        }
    }
Example #10
0
        /// <summary>
        /// Deserialize
        /// </summary>
        /// <param name="binaryReader">BinaryReader</param>
        public override void Deserialize(BinaryReader binaryReader)
        {
            base.Deserialize(binaryReader);
#if UNITY_2019_1_OR_NEWER
            m_graphicsFormat = (UnityEngine.Experimental.Rendering.GraphicsFormat)binaryReader.ReadInt32();
            m_mipmapCount    = binaryReader.ReadInt32();
#endif
            m_anisoLevel  = binaryReader.ReadInt32();
            m_dimension   = (UnityEngine.Rendering.TextureDimension)binaryReader.ReadInt32();
            m_filterMode  = (FilterMode)binaryReader.ReadInt32();
            m_height      = binaryReader.ReadInt32();
            m_isReadable  = binaryReader.ReadBoolean();
            m_mipMapBias  = binaryReader.ReadSingle();
            m_updateCount = binaryReader.ReadUInt32();
            m_width       = binaryReader.ReadInt32();
            m_wrapMode    = (TextureWrapMode)binaryReader.ReadInt32();
            m_wrapModeU   = (TextureWrapMode)binaryReader.ReadInt32();
            m_wrapModeV   = (TextureWrapMode)binaryReader.ReadInt32();
            m_wrapModeW   = (TextureWrapMode)binaryReader.ReadInt32();
        }
Example #11
0
    static int get_graphicsFormat(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Texture.graphicsFormat");
#endif
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.Texture obj = (UnityEngine.Texture)o;
            UnityEngine.Experimental.Rendering.GraphicsFormat ret = obj.graphicsFormat;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index graphicsFormat on a nil value"));
        }
    }
Example #12
0
        static int _m_GetGraphicsFormat_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.Experimental.Rendering.DefaultFormat _format; translator.Get(L, 1, out _format);

                    UnityEngine.Experimental.Rendering.GraphicsFormat gen_ret = UnityEngine.SystemInfo.GetGraphicsFormat(_format);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static StackObject *IsFormatSupported_57(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Experimental.Rendering.FormatUsage @usage = (UnityEngine.Experimental.Rendering.FormatUsage) typeof(UnityEngine.Experimental.Rendering.FormatUsage).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Experimental.Rendering.GraphicsFormat @format = (UnityEngine.Experimental.Rendering.GraphicsFormat) typeof(UnityEngine.Experimental.Rendering.GraphicsFormat).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = UnityEngine.SystemInfo.IsFormatSupported(@format, @usage);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
Example #14
0
    protected override void Render(ScriptableRenderContext context, Camera[] cameras)
    {
        BeginFrameRendering(context, cameras);

        foreach (Camera camera in cameras)
        {
            BeginCameraRendering(context, camera);

            //Culling
            ScriptableCullingParameters cullingParams;
            if (!camera.TryGetCullingParameters(out cullingParams))
            {
                continue;
            }
            CullingResults cull = context.Cull(ref cullingParams);

            //Camera setup some builtin variables e.g. camera projection matrices etc
            context.SetupCameraProperties(camera);

            //Get the setting from camera component
            bool drawSkyBox = camera.clearFlags == CameraClearFlags.Skybox? true : false;
            bool clearDepth = camera.clearFlags == CameraClearFlags.Nothing? false : true;
            bool clearColor = camera.clearFlags == CameraClearFlags.Color? true : false;

            //************************** Set TempRT ************************************

            CommandBuffer cmdTempId = new CommandBuffer();
            cmdTempId.name = "(" + camera.name + ")" + "Setup TempRT";

            //Color
            m_ColorFormatActive = camera.allowHDR ? m_ColorFormatHDR : m_ColorFormat;
            RenderTextureDescriptor colorRTDesc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight);
            colorRTDesc.graphicsFormat    = m_ColorFormatActive;
            colorRTDesc.depthBufferBits   = depthBufferBits;
            colorRTDesc.sRGB              = (QualitySettings.activeColorSpace == ColorSpace.Linear);
            colorRTDesc.msaaSamples       = camera.allowMSAA ? QualitySettings.antiAliasing : 1;
            colorRTDesc.enableRandomWrite = false;
            cmdTempId.GetTemporaryRT(m_ColorRTid, colorRTDesc, FilterMode.Bilinear);

            //Depth
            RenderTextureDescriptor depthRTDesc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight);
            depthRTDesc.colorFormat     = RenderTextureFormat.Depth;
            depthRTDesc.depthBufferBits = depthBufferBits;
            cmdTempId.GetTemporaryRT(m_DepthRTid, depthRTDesc, FilterMode.Bilinear);
            context.ExecuteCommandBuffer(cmdTempId);
            cmdTempId.Release();

            //************************** Setup DrawSettings and FilterSettings ************************************

            var               sortingSettings   = new SortingSettings(camera);
            DrawingSettings   drawSettings      = new DrawingSettings(m_PassName, sortingSettings);
            FilteringSettings filterSettings    = new FilteringSettings(RenderQueueRange.all);
            DrawingSettings   drawSettingsDepth = new DrawingSettings(m_PassName, sortingSettings)
            {
                perObjectData             = PerObjectData.None,
                overrideMaterial          = depthOnlyMaterial,
                overrideMaterialPassIndex = 0
            };

            //************************** Rendering depth ************************************

            //Set RenderTarget & Camera clear flag
            CommandBuffer cmdDepth = new CommandBuffer();
            cmdDepth.name = "(" + camera.name + ")" + "Depth Clear Flag";
            cmdDepth.SetRenderTarget(m_DepthRT); //Set CameraTarget to the depth texture

            cmdDepth.ClearRenderTarget(true, true, Color.black);
            //MyDebug(camera,context,m_DepthRT,colorRTDesc,null);
            context.ExecuteCommandBuffer(cmdDepth);
            //MyDebug(camera,context,m_DepthRT,colorRTDesc,null);
            cmdDepth.Release();

            //Opaque objects
            sortingSettings.criteria          = SortingCriteria.CommonOpaque;
            drawSettingsDepth.sortingSettings = sortingSettings;
            filterSettings.renderQueueRange   = RenderQueueRange.opaque;
            context.DrawRenderers(cull, ref drawSettingsDepth, ref filterSettings);

            //To let shader has _CameraDepthTexture, to make Depth of Field work
            CommandBuffer cmdDepthTexture = new CommandBuffer();
            cmdDepthTexture.name = "(" + camera.name + ")" + "Depth Texture";
            cmdDepthTexture.SetGlobalTexture(m_DepthRTid, m_DepthRT);
            context.ExecuteCommandBuffer(cmdDepthTexture);
            //MyDebug(camera,context,m_DepthRT,colorRTDesc,null);
            cmdDepthTexture.Release();

            //************************** Rendering colors ************************************

            //Set RenderTarget & Camera clear flag
            CommandBuffer cmd = new CommandBuffer();
            cmd.name = "(" + camera.name + ")" + "Clear Flag";
            cmd.SetRenderTarget(m_ColorRT); //Set CameraTarget to the color texture
            cmd.ClearRenderTarget(clearDepth, clearColor, camera.backgroundColor);
            context.ExecuteCommandBuffer(cmd);
            //MyDebug(camera,context,m_ColorRT,colorRTDesc,null);
            cmd.Release();

            //Skybox
            if (drawSkyBox)
            {
                context.DrawSkybox(camera);
            }

            AfterSkybox(camera, context);
            //************************** Rendering Opaque Objects ************************************

            sortingSettings.criteria        = SortingCriteria.CommonOpaque;
            drawSettings.sortingSettings    = sortingSettings;
            filterSettings.renderQueueRange = RenderQueueRange.opaque;
            context.DrawRenderers(cull, ref drawSettings, ref filterSettings);
            AfterOpaqueObject(camera, context);
            //************************** SetUp Post-processing ************************************

            PostProcessLayer         m_CameraPostProcessLayer   = camera.GetComponent <PostProcessLayer>();
            bool                     hasPostProcessing          = m_CameraPostProcessLayer != null;
            bool                     usePostProcessing          = false;
            bool                     hasOpaqueOnlyEffects       = false;
            PostProcessRenderContext m_PostProcessRenderContext = null;
            if (hasPostProcessing)
            {
                m_PostProcessRenderContext = new PostProcessRenderContext();
                usePostProcessing          = m_CameraPostProcessLayer.enabled;
                hasOpaqueOnlyEffects       = m_CameraPostProcessLayer.HasOpaqueOnlyEffects(m_PostProcessRenderContext);
            }

            //************************** Opaque Post-processing ************************************
            //Ambient Occlusion, Screen-spaced reflection are generally not supported for SRP
            //So this part is only for custom opaque post-processing
            if (usePostProcessing)
            {
                CommandBuffer cmdpp = new CommandBuffer();
                cmdpp.name = "(" + camera.name + ")" + "Post-processing Opaque";

                m_PostProcessRenderContext.Reset();
                m_PostProcessRenderContext.camera       = camera;
                m_PostProcessRenderContext.source       = m_ColorRT;
                m_PostProcessRenderContext.sourceFormat = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.GetRenderTextureFormat(m_ColorFormatActive);
                m_PostProcessRenderContext.destination  = m_ColorRT;
                m_PostProcessRenderContext.command      = cmdpp;
                m_PostProcessRenderContext.flip         = camera.targetTexture == null;//是否反转画面
                m_CameraPostProcessLayer.RenderOpaqueOnly(m_PostProcessRenderContext);

                context.ExecuteCommandBuffer(cmdpp);
                cmdpp.Release();
            }

            //************************** Rendering Transparent Objects ************************************

            sortingSettings.criteria        = SortingCriteria.CommonTransparent;
            drawSettings.sortingSettings    = sortingSettings;
            filterSettings.renderQueueRange = RenderQueueRange.transparent;
            context.DrawRenderers(cull, ref drawSettings, ref filterSettings);
            AfterTransparentObject(camera, context, m_DepthRTid, depthRTDesc);
            //************************** Transparent Post-processing ************************************
            //Bloom, Vignette, Grain, ColorGrading, LensDistortion, Chromatic Aberration, Auto Exposure
            if (usePostProcessing)
            {
                CommandBuffer cmdpp = new CommandBuffer();
                cmdpp.name = "(" + camera.name + ")" + "Post-processing Transparent";

                m_PostProcessRenderContext.Reset();
                m_PostProcessRenderContext.camera       = camera;
                m_PostProcessRenderContext.source       = m_ColorRT;
                m_PostProcessRenderContext.sourceFormat = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.GetRenderTextureFormat(m_ColorFormatActive);
                m_PostProcessRenderContext.destination  = BuiltinRenderTextureType.CameraTarget;
                m_PostProcessRenderContext.command      = cmdpp;
                m_PostProcessRenderContext.flip         = camera.targetTexture == null;
                m_CameraPostProcessLayer.Render(m_PostProcessRenderContext);

                context.ExecuteCommandBuffer(cmdpp);
                cmdpp.Release();
            }

            //************************** Make sure screen has the thing when Postprocessing is off ************************************
            if (!usePostProcessing)
            {
                CommandBuffer cmdBlitToCam = new CommandBuffer();
                cmdBlitToCam.name = "(" + camera.name + ")" + "Blit back to Camera";
                cmdBlitToCam.Blit(m_ColorRTid, BuiltinRenderTextureType.CameraTarget);
                //MDebug.MyDebug();
                context.ExecuteCommandBuffer(cmdBlitToCam);
                cmdBlitToCam.Release();
            }

            //************************** Clean Up ************************************
            CommandBuffer cmdclean = new CommandBuffer();
            cmdclean.name = "(" + camera.name + ")" + "Clean Up";
            cmdclean.ReleaseTemporaryRT(m_ColorRTid);
            cmdclean.ReleaseTemporaryRT(m_DepthRTid);
            context.ExecuteCommandBuffer(cmdclean);
            cmdclean.Release();

            context.Submit();

            EndCameraRendering(context, camera);
        }

        EndFrameRendering(context, cameras);
    }
Example #15
0
    protected override void Render(ScriptableRenderContext context, Camera[] cameras)
    {
        BeginFrameRendering(context, cameras);

        foreach (Camera camera in cameras)
        {
            BeginCameraRendering(context, camera);

            //Culling
            ScriptableCullingParameters cullingParams;
            if (!camera.TryGetCullingParameters(out cullingParams))
            {
                continue;
            }
            CullingResults cull = context.Cull(ref cullingParams);

            //Camera setup some builtin variables e.g. camera projection matrices etc
            context.SetupCameraProperties(camera);

            //Get the setting from camera component
            bool drawSkyBox = camera.clearFlags == CameraClearFlags.Skybox? true : false;
            bool clearDepth = camera.clearFlags == CameraClearFlags.Nothing? false : true;
            bool clearColor = camera.clearFlags == CameraClearFlags.Color? true : false;

            //************************** Set TempRT ************************************

            CommandBuffer cmdTempId = new CommandBuffer();
            cmdTempId.name = "(" + camera.name + ")" + "Setup TempRT";

            //Color
            m_ColorFormatActive = camera.allowHDR ? m_ColorFormatHDR : m_ColorFormat;
            RenderTextureDescriptor colorRTDesc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight);
            colorRTDesc.graphicsFormat  = m_ColorFormatActive;
            colorRTDesc.depthBufferBits = depthBufferBits;
            //colorRTDesc.sRGB = ;
            colorRTDesc.msaaSamples       = camera.allowMSAA ? QualitySettings.antiAliasing : 1;
            colorRTDesc.enableRandomWrite = false;
            cmdTempId.GetTemporaryRT(m_ColorRTid, colorRTDesc, FilterMode.Bilinear);

            //Depth
            RenderTextureDescriptor depthRTDesc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight);
            depthRTDesc.colorFormat     = RenderTextureFormat.Depth;
            depthRTDesc.depthBufferBits = depthBufferBits;
            cmdTempId.GetTemporaryRT(m_DepthRTid, depthRTDesc, FilterMode.Bilinear);

            //MotionVector
            RenderTextureDescriptor motionvectorRTDesc = new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight);
            motionvectorRTDesc.graphicsFormat  = UnityEngine.Experimental.Rendering.GraphicsFormat.R16G16_SFloat;
            motionvectorRTDesc.depthBufferBits = depthBufferBits;
            //colorRTDesc.sRGB = ;
            motionvectorRTDesc.msaaSamples       = 1;
            motionvectorRTDesc.enableRandomWrite = false;
            cmdTempId.GetTemporaryRT(m_MotionVectorRTid, motionvectorRTDesc, FilterMode.Bilinear);

            context.ExecuteCommandBuffer(cmdTempId);

            cmdTempId.Release();

            //************************** Setup DrawSettings and FilterSettings ************************************

            camera.depthTextureMode |= DepthTextureMode.MotionVectors | DepthTextureMode.Depth;

            var sortingSettings = new SortingSettings(camera);

            DrawingSettings   drawSettings   = new DrawingSettings(m_PassName, sortingSettings);
            FilteringSettings filterSettings = new FilteringSettings(RenderQueueRange.all);

            DrawingSettings drawSettingsMotionVector = new DrawingSettings(m_PassName, sortingSettings)
            {
                perObjectData             = PerObjectData.MotionVectors,
                overrideMaterial          = motionVectorMaterial,
                overrideMaterialPassIndex = 0
            };
            FilteringSettings filterSettingsMotionVector = new FilteringSettings(RenderQueueRange.all)
            {
                excludeMotionVectorObjects = false
            };

            DrawingSettings drawSettingsDepth = new DrawingSettings(m_PassName, sortingSettings)
            {
                //perObjectData = PerObjectData.None,
                overrideMaterial          = depthOnlyMaterial,
                overrideMaterialPassIndex = 0,
            };
            FilteringSettings filterSettingsDepth = new FilteringSettings(RenderQueueRange.all);

            //************************** Rendering depth ************************************

            //Set RenderTarget & Camera clear flag
            CommandBuffer cmdDepth = new CommandBuffer();
            cmdDepth.name = "(" + camera.name + ")" + "Depth Clear Flag";
            cmdDepth.SetRenderTarget(m_DepthRT); //Set CameraTarget to the depth texture
            cmdDepth.ClearRenderTarget(true, true, Color.black);
            context.ExecuteCommandBuffer(cmdDepth);
            cmdDepth.Release();

            //Opaque objects
            sortingSettings.criteria             = SortingCriteria.CommonOpaque;
            drawSettingsDepth.sortingSettings    = sortingSettings;
            filterSettingsDepth.renderQueueRange = RenderQueueRange.opaque;
            context.DrawRenderers(cull, ref drawSettingsDepth, ref filterSettingsDepth);

            //To let shader has _CameraDepthTexture
            CommandBuffer cmdDepthTexture = new CommandBuffer();
            cmdDepthTexture.name = "(" + camera.name + ")" + "Depth Texture";
            cmdDepthTexture.SetGlobalTexture(m_DepthRTid, m_DepthRT);
            context.ExecuteCommandBuffer(cmdDepthTexture);
            cmdDepthTexture.Release();

            //************************** Rendering motion vectors ************************************

            //Camera clear flag
            CommandBuffer cmdMotionvector = new CommandBuffer();
            cmdMotionvector.SetRenderTarget(m_MotionVectorRT); //Set CameraTarget to the motion vector texture
            cmdMotionvector.ClearRenderTarget(true, true, Color.black);
            context.ExecuteCommandBuffer(cmdMotionvector);
            cmdMotionvector.Release();

            //Opaque objects
            sortingSettings.criteria = SortingCriteria.CommonOpaque;
            drawSettingsMotionVector.sortingSettings    = sortingSettings;
            filterSettingsMotionVector.renderQueueRange = RenderQueueRange.opaque;
            context.DrawRenderers(cull, ref drawSettingsMotionVector, ref filterSettingsMotionVector);

            //Camera motion vector
            CommandBuffer cmdCameraMotionVector = new CommandBuffer();
            cmdCameraMotionVector.name = "(" + camera.name + ")" + "Camera MotionVector";
            _NonJitteredVP             = camera.nonJitteredProjectionMatrix * camera.worldToCameraMatrix;
            cmdCameraMotionVector.SetGlobalMatrix("_CamPrevViewProjMatrix", _PreviousVP);
            cmdCameraMotionVector.SetGlobalMatrix("_CamNonJitteredViewProjMatrix", _NonJitteredVP);
            cmdCameraMotionVector.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity);
            cmdCameraMotionVector.DrawMesh(fullscreenMesh, Matrix4x4.identity, motionVectorMaterial, 0, 1, null);  // draw full screen quad to make Camera motion
            cmdCameraMotionVector.SetViewProjectionMatrices(camera.worldToCameraMatrix, camera.projectionMatrix);
            context.ExecuteCommandBuffer(cmdCameraMotionVector);
            cmdCameraMotionVector.Release();

            //To let shader has MotionVectorTexture
            CommandBuffer cmdMotionVectorTexture = new CommandBuffer();
            cmdMotionVectorTexture.name = "(" + camera.name + ")" + "MotionVector Texture";
            cmdMotionVectorTexture.SetGlobalTexture(m_MotionVectorRTid, m_MotionVectorRT);
            context.ExecuteCommandBuffer(cmdMotionVectorTexture);
            cmdMotionVectorTexture.Release();

            //************************** Rendering color ************************************

            //Camera clear flag
            CommandBuffer cmd = new CommandBuffer();
            cmd.SetRenderTarget(m_ColorRT); //Set CameraTarget to the color texture
            cmd.ClearRenderTarget(clearDepth, clearColor, camera.backgroundColor);
            context.ExecuteCommandBuffer(cmd);
            cmd.Release();

            //Skybox
            if (drawSkyBox)
            {
                context.DrawSkybox(camera);
            }

            //Opaque objects
            sortingSettings.criteria        = SortingCriteria.CommonOpaque;
            drawSettings.sortingSettings    = sortingSettings;
            filterSettings.renderQueueRange = RenderQueueRange.opaque;
            context.DrawRenderers(cull, ref drawSettings, ref filterSettings);

            //************************** SetUp Post-processing ************************************

            PostProcessLayer m_CameraPostProcessLayer = camera.GetComponent <PostProcessLayer>();
            bool             hasPostProcessing        = m_CameraPostProcessLayer != null;
            bool             usePostProcessing        = false;
            //bool hasOpaqueOnlyEffects = false;
            PostProcessRenderContext m_PostProcessRenderContext = null;
            if (hasPostProcessing)
            {
                m_PostProcessRenderContext = new PostProcessRenderContext();
                usePostProcessing          = m_CameraPostProcessLayer.enabled;
                //hasOpaqueOnlyEffects = m_CameraPostProcessLayer.HasOpaqueOnlyEffects(m_PostProcessRenderContext);
            }

            //************************** Opaque Post-processing ************************************
            //Ambient Occlusion, Screen-spaced reflection are generally not supported for SRP
            //So this part is only for custom opaque post-processing
            // if(usePostProcessing)
            // {
            //     CommandBuffer cmdpp = new CommandBuffer();
            //     cmdpp.name = "("+camera.name+")"+ "Post-processing Opaque";

            //     m_PostProcessRenderContext.Reset();
            //     m_PostProcessRenderContext.camera = camera;
            //     m_PostProcessRenderContext.source = m_ColorRT;
            //     m_PostProcessRenderContext.sourceFormat = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.GetRenderTextureFormat(m_ColorFormatActive);
            //     m_PostProcessRenderContext.destination = m_ColorRT;
            //     m_PostProcessRenderContext.command = cmdpp;
            //     m_PostProcessRenderContext.flip = camera.targetTexture == null;
            //     m_CameraPostProcessLayer.RenderOpaqueOnly(m_PostProcessRenderContext);

            //     context.ExecuteCommandBuffer(cmdpp);
            //     cmdpp.Release();
            // }

            //************************** Rendering Transparent Objects ************************************

            sortingSettings.criteria        = SortingCriteria.CommonTransparent;
            drawSettings.sortingSettings    = sortingSettings;
            filterSettings.renderQueueRange = RenderQueueRange.transparent;
            context.DrawRenderers(cull, ref drawSettings, ref filterSettings);

            //************************** Transparent Post-processing ************************************
            //Bloom, Vignette, Grain, ColorGrading, LensDistortion, Chromatic Aberration, Auto Exposure, Motion Blur
            if (usePostProcessing)
            {
                CommandBuffer cmdpp = new CommandBuffer();
                cmdpp.name = "(" + camera.name + ")" + "Post-processing Transparent";

                m_PostProcessRenderContext.Reset();
                m_PostProcessRenderContext.camera       = camera;
                m_PostProcessRenderContext.source       = m_ColorRT;
                m_PostProcessRenderContext.sourceFormat = UnityEngine.Experimental.Rendering.GraphicsFormatUtility.GetRenderTextureFormat(m_ColorFormatActive);
                m_PostProcessRenderContext.destination  = BuiltinRenderTextureType.CameraTarget;
                m_PostProcessRenderContext.command      = cmdpp;
                m_PostProcessRenderContext.flip         = camera.targetTexture == null;
                m_CameraPostProcessLayer.Render(m_PostProcessRenderContext);

                context.ExecuteCommandBuffer(cmdpp);
                cmdpp.Release();
            }
            else
            {
                //Make sure screen has the thing when Postprocessing is off
                CommandBuffer cmdBlitToCam = new CommandBuffer();
                cmdBlitToCam.name = "(" + camera.name + ")" + "Blit back to Camera";
                cmdBlitToCam.Blit(m_ColorRTid, BuiltinRenderTextureType.CameraTarget);
                context.ExecuteCommandBuffer(cmdBlitToCam);
                cmdBlitToCam.Release();
            }

            //************************** Debug ************************************

            if (_motionVectorDebug)
            {
                CommandBuffer cmdDebug = new CommandBuffer();
                RenderTexture rt;
                rt = new RenderTexture(colorRTDesc);
                cmdDebug.Blit(BuiltinRenderTextureType.CameraTarget, BuiltinRenderTextureType.CameraTarget, motionVectorDebugMaterial);
                cmdDebug.Blit(BuiltinRenderTextureType.CameraTarget, rt, motionVectorDebugMaterial);
                //MyDebug(camera, context, rt, colorRTDesc, cmdDebug);
                context.ExecuteCommandBuffer(cmdDebug);
                cmdDebug.Release();
                rt.Release();
            }

            //************************** Clean Up ************************************

            CommandBuffer cmdclean = new CommandBuffer();
            cmdclean.name = "(" + camera.name + ")" + "Clean Up";
            cmdclean.ReleaseTemporaryRT(m_ColorRTid);
            cmdclean.ReleaseTemporaryRT(m_DepthRTid);
            cmdclean.ReleaseTemporaryRT(m_MotionVectorRTid);
            context.ExecuteCommandBuffer(cmdclean);
            cmdclean.Release();

            context.Submit();

            //For camera motion vector
            _PreviousVP = _NonJitteredVP;

            EndCameraRendering(context, camera);
        }

        EndFrameRendering(context, cameras);
    }
Example #16
0
    static int _CreateUnityEngine_RenderTexture(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes <UnityEngine.RenderTextureDescriptor>(L, 1))
            {
                UnityEngine.RenderTextureDescriptor arg0 = StackTraits <UnityEngine.RenderTextureDescriptor> .To(L, 1);

                UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0);
                ToLua.Push(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes <UnityEngine.RenderTexture>(L, 1))
            {
                UnityEngine.RenderTexture arg0 = (UnityEngine.RenderTexture)ToLua.ToObject(L, 1);
                UnityEngine.RenderTexture obj  = new UnityEngine.RenderTexture(arg0);
                ToLua.Push(L, obj);
                return(1);
            }
            else if (count == 3)
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2);
                ToLua.Push(L, obj);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.DefaultFormat>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.DefaultFormat arg3 = (UnityEngine.Experimental.Rendering.DefaultFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3);
                ToLua.Push(L, obj);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3);
                ToLua.Push(L, obj);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes <UnityEngine.RenderTextureFormat>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTexture       obj  = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3);
                ToLua.Push(L, obj);
                return(1);
            }
            else if (count == 5 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat, int>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4);
                int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
                UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3, arg4);
                ToLua.Push(L, obj);
                return(1);
            }
            else if (count == 5 && TypeChecker.CheckTypes <UnityEngine.RenderTextureFormat, int>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4);
                int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
                UnityEngine.RenderTexture obj = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3, arg4);
                ToLua.Push(L, obj);
                return(1);
            }
            else if (count == 5 && TypeChecker.CheckTypes <UnityEngine.RenderTextureFormat, UnityEngine.RenderTextureReadWrite>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat    arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5);
                UnityEngine.RenderTexture          obj  = new UnityEngine.RenderTexture(arg0, arg1, arg2, arg3, arg4);
                ToLua.Push(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.RenderTexture.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #17
0
    static int GetTemporary(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                UnityEngine.RenderTextureDescriptor arg0 = StackTraits <UnityEngine.RenderTextureDescriptor> .Check(L, 1);

                UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2)
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes <UnityEngine.RenderTextureFormat>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTexture       o    = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 5 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat, int>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4);
                int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
                UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 5 && TypeChecker.CheckTypes <UnityEngine.RenderTextureFormat, UnityEngine.RenderTextureReadWrite>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat    arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5);
                UnityEngine.RenderTexture          o    = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 6 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat, int, UnityEngine.RenderTextureMemoryless>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4);
                int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
                UnityEngine.RenderTextureMemoryless arg5 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 6);
                UnityEngine.RenderTexture           o    = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 6 && TypeChecker.CheckTypes <UnityEngine.RenderTextureFormat, UnityEngine.RenderTextureReadWrite, int>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat    arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5);
                int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
                UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 7 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat, int, UnityEngine.RenderTextureMemoryless, UnityEngine.VRTextureUsage>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4);
                int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
                UnityEngine.RenderTextureMemoryless arg5 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 6);
                UnityEngine.VRTextureUsage          arg6 = (UnityEngine.VRTextureUsage)ToLua.ToObject(L, 7);
                UnityEngine.RenderTexture           o    = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 7 && TypeChecker.CheckTypes <UnityEngine.RenderTextureFormat, UnityEngine.RenderTextureReadWrite, int, UnityEngine.RenderTextureMemoryless>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat    arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5);
                int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
                UnityEngine.RenderTextureMemoryless arg6 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 7);
                UnityEngine.RenderTexture           o    = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 8 && TypeChecker.CheckTypes <UnityEngine.Experimental.Rendering.GraphicsFormat, int, UnityEngine.RenderTextureMemoryless, UnityEngine.VRTextureUsage, bool>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.Experimental.Rendering.GraphicsFormat arg3 = (UnityEngine.Experimental.Rendering.GraphicsFormat)ToLua.ToObject(L, 4);
                int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
                UnityEngine.RenderTextureMemoryless arg5 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 6);
                UnityEngine.VRTextureUsage          arg6 = (UnityEngine.VRTextureUsage)ToLua.ToObject(L, 7);
                bool arg7 = LuaDLL.lua_toboolean(L, 8);
                UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 8 && TypeChecker.CheckTypes <UnityEngine.RenderTextureFormat, UnityEngine.RenderTextureReadWrite, int, UnityEngine.RenderTextureMemoryless, UnityEngine.VRTextureUsage>(L, 4))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat    arg3 = (UnityEngine.RenderTextureFormat)ToLua.ToObject(L, 4);
                UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.ToObject(L, 5);
                int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
                UnityEngine.RenderTextureMemoryless arg6 = (UnityEngine.RenderTextureMemoryless)ToLua.ToObject(L, 7);
                UnityEngine.VRTextureUsage          arg7 = (UnityEngine.VRTextureUsage)ToLua.ToObject(L, 8);
                UnityEngine.RenderTexture           o    = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 9)
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                int arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
                int arg2 = (int)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.RenderTextureFormat    arg3 = (UnityEngine.RenderTextureFormat)ToLua.CheckObject(L, 4, typeof(UnityEngine.RenderTextureFormat));
                UnityEngine.RenderTextureReadWrite arg4 = (UnityEngine.RenderTextureReadWrite)ToLua.CheckObject(L, 5, typeof(UnityEngine.RenderTextureReadWrite));
                int arg5 = (int)LuaDLL.luaL_checknumber(L, 6);
                UnityEngine.RenderTextureMemoryless arg6 = (UnityEngine.RenderTextureMemoryless)ToLua.CheckObject(L, 7, typeof(UnityEngine.RenderTextureMemoryless));
                UnityEngine.VRTextureUsage          arg7 = (UnityEngine.VRTextureUsage)ToLua.CheckObject(L, 8, typeof(UnityEngine.VRTextureUsage));
                bool arg8 = LuaDLL.luaL_checkboolean(L, 9);
                UnityEngine.RenderTexture o = UnityEngine.RenderTexture.GetTemporary(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.RenderTexture.GetTemporary"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }