本文整理汇总了C#中vec2.dot方法的典型用法代码示例。如果您正苦于以下问题:C# vec2.dot方法的具体用法?C# vec2.dot怎么用?C# vec2.dot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vec2
的用法示例。
在下文中一共展示了vec2.dot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: lookAt
/// <summary>
/// Build a look at view matrix.
/// transform object's coordinate from world's space to camera's space.
/// </summary>
/// <param name="eye">The eye.</param>
/// <param name="center">The center.</param>
/// <param name="up">Up.</param>
/// <returns></returns>
public static mat3 lookAt(vec2 eye, vec2 center, bool up)
{
// camera's back in world space coordinate system
vec2 back = (eye - center).normalize();
// camera's right in world space coordinate system
vec2 right = up.cross(back).normalize();
if (!up) { right = -right; }
mat3 viewMatrix = new mat3(1);
viewMatrix.col0.x = right.x;
viewMatrix.col1.x = right.y;
viewMatrix.col0.y = back.x;
viewMatrix.col1.y = back.y;
// Translation in world space coordinate system
viewMatrix.col3.x = -eye.dot(right);
viewMatrix.col3.y = -eye.dot(back);
return viewMatrix;
}