Vector4.operator Vector4 运算符 四维向量

static implicit function Vector4 (v : Vector3) : Vector4

Description描述

Converts a Vector3 to a Vector4.

将一个Vector3转化成一个Vector4。

Vector3s can be implicitly converted to Vector4 (w is set to zero in the result).

三维向量能被隐式转化成Vector4(w的值被设置为0)。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void Start() {

		Vector3.one;

		renderer.material.SetVector("_SomeVariable", value);

	}

}
function Start () {



	// Shader vectors are always Vector4s.

	// Shader向量总是四维向量。

	// The value here is converted to a Vector4 from a Vector3.

	// 这的值是将一个Vector3转化为Vector4。

	

	var value : Vector3.one;

	renderer.material.SetVector("_SomeVariable", value);

}

o static implicit function Vector4 (v : Vector2) : Vector4

Description描述

Converts a Vector2 to a Vector4.

转换Vector2到一个Vector4。

Vector2s can be implicitly converted to Vector4 (z and w is set to zero in the result)

二维向量能被隐式转化成Vector4(z和w的值被设置为0)。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void Start() {

		Vector2 value = Vector2.one;

		renderer.material.SetVector("_SomeVariable", value);

	}

}
function Start () {

	// Shader vectors are always Vector4s.

	//着色器的向量总是Vector4

	// The value here is converted to a Vector4 from a Vector2.

	//该值这里从Vector2转换到Vector4。

	

	var value : Vector2 = Vector2.one;

	renderer.material.SetVector("_SomeVariable", value);

}
Page last updated: 2011-9-18