MonoBehaviour
- Awake
- CancelInvoke
- FixedUpdate
- InvokeRepeating
- Invoke
- IsInvoking
- LateUpdate
- OnApplicationFocus
- OnApplicationPause
- OnApplicationQuit
- OnBecameInvisible
- OnBecameVisible
- OnCollisionEnter
- OnCollisionExit
- OnCollisionStay
- OnConnectedToServer
- OnControllerColliderHit
- OnDestroy
- OnDisable
- OnDisconnectedFromServer
- OnDrawGizmosSelected
- OnDrawGizmos
- OnEnable
- OnFailedToConnectToM...
- OnFailedToConnect
- OnGUI
- OnJointBreak
- OnLevelWasLoaded
- OnMasterServerEvent
- OnMouseDown
- OnMouseDrag
- OnMouseEnter
- OnMouseExit
- OnMouseOver
- OnMouseUpAsButton
- OnMouseUp
- OnNetworkInstantiate
- OnParticleCollision
- OnPlayerConnected
- OnPlayerDisconnected
- OnPostRender
- OnPreCull
- OnPreRender
- OnRenderImage
- OnRenderObject
- OnSerializeNetworkView
- OnServerInitialized
- OnTriggerEnter
- OnTriggerExit
- OnTriggerStay
- OnWillRenderObject
- Reset
- StartCoroutine
- Start
- StopAllCoroutines
- StopCoroutine
- Update
- useGUILayout
MonoBehaviour.OnPostRender 当渲染之后
function OnPostRender () : void
Description描述
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 , WaitForEndOfFrame
还没有C#添加代码
// 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 ();
}
最后修改:2011年1月2日 Sunday 17:26