本文整理汇总了C#中Direction.ToIntVector3方法的典型用法代码示例。如果您正苦于以下问题:C# Direction.ToIntVector3方法的具体用法?C# Direction.ToIntVector3怎么用?C# Direction.ToIntVector3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direction
的用法示例。
在下文中一共展示了Direction.ToIntVector3方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFaceInfo
static CubeFaceInfo CreateFaceInfo(Direction normalDir, Direction upDir, Direction rightDir)
{
var normal = normalDir.ToIntVector3();
var up = upDir.ToIntVector3();
var right = rightDir.ToIntVector3();
var topRight = up + right;
var bottomRight = -up + right;
var bottomLeft = -up - right;
var topLeft = up - right;
var vertices =
new[] { topRight, bottomRight, bottomLeft, topLeft, }
.Select(v => v + normal) // add normal to lift from origin
.Select(v => v + new IntVector3(1, 1, 1)) // translate to [0,2]
.Select(v => v / 2) // scale to [0,1]
.ToArray();
var exposionVectors = new[] {
up,
up + right,
right,
-up + right,
-up,
-up - right,
-right,
up - right,
}.ToArray();
var occlusionVectors = exposionVectors.Select(v => v + normal).ToArray();
return new CubeFaceInfo(normal, vertices, exposionVectors, occlusionVectors);
}
示例2: ScreenToMap
public Direction ScreenToMap(Direction dir)
{
var v = dir.ToIntVector3();
v = ScreenToMap(v);
return v.ToDirection();
}