本文整理汇总了C#中IntVector3.ToVector3方法的典型用法代码示例。如果您正苦于以下问题:C# IntVector3.ToVector3方法的具体用法?C# IntVector3.ToVector3怎么用?C# IntVector3.ToVector3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntVector3
的用法示例。
在下文中一共展示了IntVector3.ToVector3方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialise
public void Initialise(IntVector3 position)
{
base.Initialise(GameManager.Instance.ChunkPrefab);
Position = position;
GameObject.name = "ChunkEntity " + Position;
GameObject.transform.position = position.ToVector3();
MeshFilter = GameObject.GetComponent<MeshFilter>();
}
示例2: GetPlacementRect
public Rect GetPlacementRect(IntVector3 ml)
{
// XXX
var view = m_game.Surfaces[0].Views[0];
SharpDX.Matrix matrix = view.Camera.View * view.Camera.Projection;
var p1 = ml.ToVector3();
var p2 = p1 + new SharpDX.Vector3(1, 1, 0);
SharpDX.Vector3 out1, out2;
var vp = view.ViewPort;
vp.Project(ref p1, ref matrix, out out1);
vp.Project(ref p2, ref matrix, out out2);
Rect rect = new Rect(
DeviceToPoint(new System.Windows.Point(out1.X, out1.Y)),
DeviceToPoint(new System.Windows.Point(out2.X, out2.Y)));
return rect;
}
示例3: ResolvePaintPosition
bool ResolvePaintPosition(ref Ray ray, ref IntVector3 brushPosition)
{
var brushPositionWorld = brushPosition.ToVector3();
Matrix world;
Matrix.CreateTranslation(ref brushPositionWorld, out world);
var rayDirection = ray.Direction;
rayDirection.Normalize();
for (int i = 0; i < triangleInfos.Length; i++)
{
var side = triangleInfos[i].Side;
// 面固定済みならば、それ以外の面を除外。
if (PaintStarted && lockedSide != null && side != lockedSide)
continue;
// 背面は判定から除外。
if (IsBackFace(side, ref rayDirection)) continue;
// 面と視線が交差するか否か。
if (Intersects(ref ray, triangleInfos[i], ref world))
{
var testPosition = brushPosition + side.Direction;
var blockIndex = Manager.GetBlockIndex(ref testPosition);
if (blockIndex == Block.EmptyIndex)
{
PaintPosition = testPosition;
paintSide = side;
return true;
}
}
}
return false;
}
示例4: HandleTree
static void HandleTree(VertexList<SceneryVertex> sceneryVertexList, TileData td, ref IntVector3 pos)
{
SymbolID symbol;
Color color;
switch (td.ID)
{
case TileID.Tree:
switch (td.MaterialID)
{
case MaterialID.Fir:
symbol = SymbolID.ConiferousTree;
break;
case MaterialID.Pine:
symbol = SymbolID.ConiferousTree2;
break;
case MaterialID.Birch:
symbol = SymbolID.DeciduousTree;
break;
case MaterialID.Oak:
symbol = SymbolID.DeciduousTree2;
break;
default:
throw new Exception();
}
break;
case TileID.Sapling:
switch (td.MaterialID)
{
case MaterialID.Fir:
symbol = SymbolID.ConiferousSapling;
break;
case MaterialID.Pine:
symbol = SymbolID.ConiferousSapling2;
break;
case MaterialID.Birch:
symbol = SymbolID.DeciduousSapling;
break;
case MaterialID.Oak:
symbol = SymbolID.DeciduousSapling2;
break;
default:
throw new Exception();
}
break;
case TileID.DeadTree:
symbol = SymbolID.DeadTree;
break;
default:
throw new Exception();
}
color = Color.ForestGreen;
sceneryVertexList.Add(new SceneryVertex(pos.ToVector3(), Color.LightGreen, (uint)symbol));
}
示例5: GetEyeFromLookTarget
Vector3 GetEyeFromLookTarget(IntVector3 p)
{
var v = new Vector3(-1, 8, 32.5f) / 32.5f;
return p.ToVector3() + v * (this.ViewGridAdjusterService.Height + 0.5f);
}
示例6: CameraMoveTo
public void CameraMoveTo(IntVector3 p)
{
var eye = GetEyeFromLookTarget(p);
var target = p.ToVector3();
this.CameraMoveService.Move(eye, target);
}
示例7: CameraLookAt
public void CameraLookAt(IntVector3 p)
{
var eye = GetEyeFromLookTarget(p);
var target = p.ToVector3();
this.Camera.LookAt(eye, target, Vector3.UnitZ);
}
示例8: SetPerObjectConstBuf
public void SetPerObjectConstBuf(IntVector3 offset)
{
m_objectWorldMatrixParam.SetValue(offset.ToVector3());
m_perObConstBuf.Update();
}
示例9: SetWorlMatrix
void SetWorlMatrix(IntVector3 pos, IntSize3 size, Direction dir)
{
var worldMatrix = Matrix.Identity;
worldMatrix.Transpose();
worldMatrix *= Matrix.Translation(new Vector3(-0.5f));
worldMatrix *= Matrix.RotationQuaternion(s_rotationQuaternions[(int)dir.ToDirectionOrdinal()]);
worldMatrix *= Matrix.Scaling(size.Width, size.Height, size.Depth);
worldMatrix *= Matrix.Scaling(new Vector3(0.01f) / size.ToIntVector3().ToVector3() + 1); // fix z fight
worldMatrix *= Matrix.Translation(new Vector3(0.5f));
worldMatrix *= Matrix.Translation((size.ToIntVector3().ToVector3() - new Vector3(1)) / 2);
worldMatrix *= Matrix.Translation(pos.ToVector3());
m_effect.Parameters["worldMatrix"].SetValue(ref worldMatrix);
}