本文整理汇总了C#中Sandbox.Definitions.MyCubeBlockDefinition.MountPointLocalToBlockLocal方法的典型用法代码示例。如果您正苦于以下问题:C# MyCubeBlockDefinition.MountPointLocalToBlockLocal方法的具体用法?C# MyCubeBlockDefinition.MountPointLocalToBlockLocal怎么用?C# MyCubeBlockDefinition.MountPointLocalToBlockLocal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Definitions.MyCubeBlockDefinition
的用法示例。
在下文中一共展示了MyCubeBlockDefinition.MountPointLocalToBlockLocal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawMountPointsAxisHelpers
private static void DrawMountPointsAxisHelpers(MyCubeBlockDefinition def, ref MatrixD drawMatrix, float cubeSize)
{
Vector3I centerGrid = def.Center;
Vector3 centerOffset = def.Size * 0.5f;
MatrixD drawTransf = MatrixD.CreateTranslation(centerGrid - centerOffset) * MatrixD.CreateScale(cubeSize) * drawMatrix;
// Draw axis helpers for the six mount point walls
for (int i = 0; i < 6; ++i)
{
Base6Directions.Direction dir = (Base6Directions.Direction)i;
Vector3D position = Vector3D.Zero;
position.Z = -0.2f;
Vector3D normal = Vector3.Forward;
Vector3D right = Vector3.Right;
Vector3D up = Vector3.Up;
position = def.MountPointLocalToBlockLocal(position, dir);
position = Vector3D.Transform(position, drawTransf);
normal = def.MountPointLocalNormalToBlockLocal(normal, dir);
normal = Vector3D.TransformNormal(normal, drawTransf);
up = def.MountPointLocalNormalToBlockLocal(up, dir);
up = Vector3D.TransformNormal(up, drawTransf);
right = def.MountPointLocalNormalToBlockLocal(right, dir);
right = Vector3D.TransformNormal(right, drawTransf);
MatrixD rightMat = MatrixD.CreateWorld(position + right * 0.25f, normal, right);
MatrixD upMat = MatrixD.CreateWorld(position + up * 0.25f, normal, up);
Vector4 rc = Color.Red.ToVector4();
Vector4 uc = Color.Green.ToVector4();
MyRenderProxy.DebugDrawSphere(position, 0.03f * cubeSize, Color.Red.ToVector3(), 1.0f, true);
MySimpleObjectDraw.DrawTransparentCylinder(ref rightMat, 0.0f, 0.03f * cubeSize, 0.5f * cubeSize, ref rc, false, 16, 0.01f * cubeSize);
MySimpleObjectDraw.DrawTransparentCylinder(ref upMat, 0.0f, 0.03f * cubeSize, 0.5f * cubeSize, ref uc, false, 16, 0.01f * cubeSize);
MyRenderProxy.DebugDrawLine3D(position, position - normal * 0.2f, Color.Red, Color.Red, true);
float textSizeX = 0.5f * cubeSize;
float textSizeY = 0.5f * cubeSize;
float textSizeDesc = 0.5f * cubeSize;
if (MySector.MainCamera != null)
{
float distX = (float)(position + right * 0.55f - MySector.MainCamera.Position).Length();
float distY = (float)(position + up * 0.55f - MySector.MainCamera.Position).Length();
float distDesc = (float)(position + normal * 0.1f - MySector.MainCamera.Position).Length();
textSizeX = textSizeX * 6 / distX;
textSizeY = textSizeY * 6 / distY;
textSizeDesc = textSizeDesc * 6 / distDesc;
}
MyRenderProxy.DebugDrawText3D(position + right * 0.55f, "X", Color.Red, textSizeX, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
MyRenderProxy.DebugDrawText3D(position + up * 0.55f, "Y", Color.Green, textSizeY, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
MyRenderProxy.DebugDrawText3D(position + normal * 0.1f, m_mountPointSideNames[i], Color.White, textSizeDesc, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
}
// If close enough, draw a black grid spaced by tenths of a mount point unit
float dist = (float)(drawTransf.Translation - MySector.MainCamera.Position).Length();
BoundingBoxD bb = new BoundingBoxD(-def.Size * cubeSize * 0.5f, def.Size * cubeSize * 0.5f);
dist -= (float)bb.Size.Max() * 0.866f; // sqrt(3) * 0.5 - half of the solid diagonal of a cube
Color black = Color.Black;
if (dist < cubeSize * 3.0f)
MySimpleObjectDraw.DrawTransparentBox(ref drawMatrix, ref bb, ref black, MySimpleObjectRasterizer.Wireframe, def.Size * 10, 0.005f / (float)bb.Size.Max() * cubeSize, onlyFrontFaces: true);
}