Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

GL.LoadPixelMatrix

マニュアルに切り替える
public static void LoadPixelMatrix();

説明

ピクセル修正レンダリングのための行列を設定します。

これは ModelView 行列や射影行列を設定し、X, Y 座標を直接画素にマップします。 (0,0) は現在のカメラのビューポートの左下隅です。 Z 座標は -1 から +1 になります。

この関数は現在のカメラのパラメーターを上書きします。なので、ほとんどの場合、 GL.PushMatrixGL.PopMatrix を使用して行列を保存と復元します。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Material mat; void OnPostRender() { if (!mat) { Debug.LogError("Please Assign a material on the inspector"); return; } GL.PushMatrix(); mat.SetPass(0); GL.LoadPixelMatrix(); GL.Color(Color.red); GL.Begin(GL.TRIANGLES); GL.Vertex3(0, 0, 0); GL.Vertex3(0, Screen.height / 2, 0); GL.Vertex3(Screen.width / 2, Screen.height / 2, 0); GL.End(); GL.PopMatrix(); } }

public static void LoadPixelMatrix(float left, float right, float bottom, float top);

パラメーター

説明

ピクセル修正レンダリングのための行列を設定します。

これは ModelView 行列や射影行列を設定し、X, Y 座標を直接画素にマップします。 (left, bottom) は、現在のカメラビューポートの左下で、 (top,right) は現在のビューポートの右上になります。 Z座標を -1 から +1 に移動します。

この関数は現在のカメラのパラメーターを上書きします。なので、ほとんどの場合、 GL.PushMatrix と GL.PopMatrix を使用して行列を保存し復元します。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Material mat; void OnPostRender() { if (!mat) { Debug.LogError("Please Assign a material on the inspector"); return; } GL.PushMatrix(); mat.SetPass(0); GL.LoadPixelMatrix(10, 20, 10, 20); GL.Color(Color.red); GL.Begin(GL.TRIANGLES); GL.Vertex3(10, 10, 0); GL.Vertex3(10, 20, 0); GL.Vertex3(20, 20, 0); GL.End(); GL.PopMatrix(); } }