OnPreCull is called before a camera culls the Scene.
Culling determines which objects are visible to the camera. OnPreCull is called just before
this process.
この関数は、この関数が記述されたスクリプトに Camera がアタッチされていて有効である場合のみ呼び出されます。
If you want to change camera's viewing parameters (e.g. Camera.fieldOfView or just transform),
this is the place to do it. Visibility of Scene objects will be determined based on camera's
parameters after OnPreCull
.
// Attach this to a camera. // Inverts the view of the camera so everything rendered by it, is flipped
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { Camera cam;
void Start() { cam = GetComponent<Camera>(); }
void OnPreCull() { cam.ResetWorldToCameraMatrix(); cam.ResetProjectionMatrix(); cam.projectionMatrix = cam.projectionMatrix * Matrix4x4.Scale(new Vector3(1, -1, 1)); }
void OnPreRender() { GL.invertCulling = true; }
void OnPostRender() { GL.invertCulling = false; } }