MonoBehaviour.OnPostRender 当渲染之后

发布时间:2016-12-11 6:42:58 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"MonoBehaviour.OnPostRender 当渲染之后",主要涉及到MonoBehaviour.OnPostRender 当渲染之后方面的内容,对于MonoBehaviour.OnPostRender 当渲染之后感兴趣的同学可以参考一下。

function OnPostRender () : voidDescription描述OnPostRender is called after a camera finished rendering the scene.在相机完成场景渲染之后被调用。This function is called only if the script is attached to the camera and is enabled. OnPostRender can be a co-routine, simply use the yield statement in the function.只有该脚本附于相机并启用时才会调用这个函数。OnPostRender可以是一个协同程序,在函数中调用yield语句即。OnPostRender is called after the camera renders all its objects. If you want to do something after all cameras and GUI is rendered, use WaitForEndOfFrame coroutine.OnPostRender在相机渲染完所有物体之后被调用。如果你想在相机和GUI渲染完成后做些什么,就用WaitForEndOfFrame协同程序。参见:OnPreRender , WaitForEndOfFrameC#JavaScript// When attached to a camera, will clear alpha channel // of camera's render texture to pure white. // Useful if you have camera rendering into a texture and later // want to display it in GUI. // 当附于一个相机后,将清理alpha管道为纯白色.如果你想渲染到纹理并显示在GUI上可以使用它. private var mat : Material; function OnPostRender() { // Create a shader that renders white only to alpha channel // 创建一个着色器,将alpha通道渲染为白色 if(!mat) { mat = new Material( "Shader \"Hidden/SetAlpha\" {" + "SubShader {" + " Pass {" + " ZTest Always Cull Off ZWrite Off" + " ColorMask A" + " Color (1,1,1,1)" + " }" + "}" + "}" ); } // Draw a quad over the whole screen with the above shader // 用上面的着色器绘制一个四边形覆盖整个屏幕 GL.PushMatrix (); GL.LoadOrtho (); for (var i = 0; i < mat.passCount; ++i) { mat.SetPass (i); GL.Begin( GL.QUADS ); GL.Vertex3( 0, 0, 0.1 ); GL.Vertex3( 1, 0, 0.1 ); GL.Vertex3( 1, 1, 0.1 ); GL.Vertex3( 0, 1, 0.1 ); GL.End(); } GL.PopMatrix (); } 代码无效果,望大神解答

上一篇:CV_IMIN、CV_IMAX宏以及是否只有一位为1的检验
下一篇:简单的01背包!

相关文章

相关评论