예제 #1
0
		public Vector3 Project(Viewport viewport, Matrix projectionMatrix, Matrix viewMatrix, Matrix worldMatrix)
		{
			Vector4 src = new Vector4(this, 1);
			Vector4 dest = src * (worldMatrix * viewMatrix * projectionMatrix);

			Vector3 p = new Vector3(dest.x, dest.y, dest.z) / dest.w;
			p.x = 0.5f * p.x + 0.5f;
			p.y = 0.5f * p.y + 0.5f;
			return new Vector3(viewport.Width, viewport.Height, 1) * p;
		}
예제 #2
0
		public Vector3 Project(Viewport viewport, Matrix projectionMatrix, Matrix viewMatrix)
		{
			return Project(viewport, projectionMatrix, viewMatrix, Matrix.Identity);
		}