Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Camera.OnPreCull 在消隐之前
# [Camera](Camera.html).OnPreCull 在消隐之前 function *CopyFrom* (*other* : [Camera](Camera.html)) : void *Description* 描述 OnPreCull is called before a camera culls the scene. OnPreCull 在相机开始裁剪场景之前调用。 Culling determines which objects are visible to the camera. OnPreCull is called just before this process. This message is sent to all scripts attached to the camera. 裁剪决定哪个物体对于相机来说是可见的。OnPreCull 仅仅在这个过程之间被调用,这个消息被发送到所有附加的相机的脚本。 If you want to change camera's viewing parameters (e.g. [fieldOfView](Camera.fieldOfView.html) or just transform), this is the place to do it. Visibility of scene objects will be determined based on camera's parameters after OnPreCull. 如果你想改变相机的视觉参数(例如: [fieldOfView](Camera.fieldOfView.html) 或者仅仅是变换),就在这里做这个,场景物体的可见性将基于相机的参数在 OnPreCull 之后确定。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { void OnPreCull() { camera.ResetWorldToCameraMatrix(); camera.ResetProjectionMatrix(); camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(new Vector3(1, -1, 1)); } void OnPreRender() { GL.SetRevertBackfacing(true); } void OnPostRender() { GL.SetRevertBackfacing(false); } } ``` ``` // Attach this to a camera. 附加这个到相机 // Inverts the vie of the camera so everything rendered by it, is flipped //反转相机中的物体,因此每个被渲染的物体是反的 // This will only work on Unity - PRO 仅工作在Unity专业版 function OnPreCull () { camera.ResetWorldToCameraMatrix (); camera.ResetProjectionMatrix (); camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(Vector3 (1, -1, 1)); } // Set it to true so we can watch the flipped Objects //设置为true,因此可以看到翻转的物体 function OnPreRender () { GL.SetRevertBackfacing (true); } // Set it to false again because we dont want to affect all other cammeras. //设置为false,因为不想影响所有其他相机 function OnPostRender () { GL.SetRevertBackfacing (false); } ```
da
2022年5月17日 13:27
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码