用户工具

站点工具


侧边栏

script:unityengine:classes:gl:gl.loadprojectionmatrix

GL.LoadProjectionMatrix 加载投影矩阵

JavaScript ⇒ public static function LoadProjectionMatrix(mat: Matrix4x4): void;
C# ⇒ public static void LoadProjectionMatrix(Matrix4x4 mat);

Description 描述

Load an arbitrary matrix to the current projection matrix.

加载一个任意的矩阵到当前的投影矩阵。(矩阵的运算在脚本中很少用到。大部分可以用Transform 类更直接)

This function overrides current camera's projection parameters, so most often you want to save and restore projection matrix using GL.PushMatrix and GL.PopMatrix.

这个函数覆盖当前的 Camera投影参数,许多情况下你需要用到GL.PushMatrix 和GL.PopMatrix矩阵函数来保存和恢复。

JavaScript:

	var projMtrx : Matrix4x4 = Matrix4x4.identity;
 
	function OnPostRender() {
		GL.PushMatrix();
		GL.LoadProjectionMatrix(projMtrx);
		// Do your drawing here...
		GL.PopMatrix();
	}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public Matrix4x4 projMtrx = Matrix4x4.identity;
    void OnPostRender() {
        GL.PushMatrix();
        GL.LoadProjectionMatrix(projMtrx);
        GL.PopMatrix();
    }
}

GL

script/unityengine/classes/gl/gl.loadprojectionmatrix.txt · 最后更改: 2016/08/02 05:24 (外部编辑)