protected void MultilineText(Color color, float scale, string message, params object[] arguments) { if (arguments.Length > 0) { message = String.Format(message, arguments); } int lines = 0; // we want lines - 1 foreach (var c in message) { if (c == '\n') { lines++; } } message = message.Replace("\t", " "); float offset = LINE_OFFSET + LINE_BREAK_OFFSET * lines; offset *= scale; MyRenderProxy.DebugDrawText2D(new Vector2(0, m_textOffset), message, color, .6f * scale); m_textOffset += offset; }
public void UpdateBeforeSimulation() { VRage.MySimpleProfiler.Begin("Gyro"); if (m_gyrosChanged) { RecomputeGyroParameters(); } if (m_maxOverrideForce == 0.0f) { if (MyDebugDrawSettings.DEBUG_DRAW_GYROS) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "Old gyros", Color.White, 1.0f); } UpdateGyros(); return; } if (MyDebugDrawSettings.DEBUG_DRAW_GYROS) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "New gyros", Color.White, 1.0f); } if (m_grid.Physics != null) { UpdateOverriddenGyros(); } VRage.MySimpleProfiler.End("Gyro"); }
public void DebugDraw() { if (MyFakes.REPLAY_NAVMESH_GENERATION) { MyRenderProxy.DebugDrawText2D(new Vector2(500f, 10f), $"Next operation: {this.m_ctr}/{this.m_operations.Count}", Color.Red, 1f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, false); } }
public void UpdateBeforeSimulation(bool networkUpdate = false) { if (m_gyrosChanged) { RecomputeGyroParameters(); } if (m_maxOverrideForce == 0.0f) { if (MyDebugDrawSettings.DEBUG_DRAW_GYROS) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "Old gyros", Color.White, 1.0f); } UpdateGyros(networkUpdate); return; } if (MyDebugDrawSettings.DEBUG_DRAW_GYROS) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "New gyros", Color.White, 1.0f); } if (m_grid.Physics != null && networkUpdate == false) { UpdateOverriddenGyros(); } }
public void UpdateBeforeSimulation() { if (m_gyrosChanged) { RecomputeGyroParameters(); } if (m_maxOverrideForce == 0.0f) { if (MyDebugDrawSettings.DEBUG_DRAW_GYROS) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "Old gyros", Color.White, 1.0f); } UpdateBeforeSimulationOld(); return; } if (MyDebugDrawSettings.DEBUG_DRAW_GYROS) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "New gyros", Color.White, 1.0f); } if (m_grid.Physics != null) { m_grid.Physics.AngularVelocity = GetAngularVelocity(ControlTorque); } }
public override void Update() { if (!IsActive) { return; } UpdateHitEntity(); if (!m_visible) { ShowPreview(false); return; } if (PreviewGrids.Count == 0) { return; } if (m_dragDistance == 0) { SetupDragDistance(); } if (m_dragDistance > MyCubeBuilder.CubeBuilderDefinition.MaxBlockBuildingDistance) { m_dragDistance = MyCubeBuilder.CubeBuilderDefinition.MaxBlockBuildingDistance; } UpdatePastePosition(); UpdateGridTransformations(); FixSnapTransformationBase6(); if (m_calculateVelocity) { m_objectVelocity = (m_pastePosition - m_pastePositionPrevious) / VRage.Game.MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS; } m_canBePlaced = TestPlacement(); if (!m_visible) { ShowPreview(false); return; } ShowPreview(true); TestBuildingMaterials(); m_canBePlaced &= CharacterHasEnoughMaterials; UpdatePreview(); if (MyDebugDrawSettings.DEBUG_DRAW_COPY_PASTE) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "FW: " + m_pasteDirForward.ToString(), Color.Red, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 20.0f), "UP: " + m_pasteDirUp.ToString(), Color.Red, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 40.0f), "AN: " + m_pasteOrientationAngle.ToString(), Color.Red, 1.0f); } }
public void DebugDraw() { if (MyFakes.REPLAY_NAVMESH_GENERATION) { MyRenderProxy.DebugDrawText2D(new Vector2(500, 10), String.Format("Next operation: {0}/{1}", m_ctr, m_operations.Count), Color.Red, 1.0f); } }
public void Update() { if (!IsActive || !m_visible) { return; } UpdateHitEntity(); UpdatePastePosition(); UpdateFloatingObjectTransformations(); if (m_calculateVelocity) { m_objectVelocity = (m_pastePosition - m_pastePositionPrevious) / MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS; } m_canBePlaced = TestPlacement(); UpdatePreviewBBox(); if (MyDebugDrawSettings.DEBUG_DRAW_COPY_PASTE) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "FW: " + m_pasteDirForward.ToString(), Color.Red, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 20.0f), "UP: " + m_pasteDirUp.ToString(), Color.Red, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 40.0f), "AN: " + m_pasteOrientationAngle.ToString(), Color.Red, 1.0f); } }
private static void DebugDrawTexturesInfo(MyModel model, ref int row) { HashSet <string> textures = new HashSet <string>(); foreach (MyMesh mesh in model.GetMeshList()) { Debug.Assert(mesh.Material.Textures != null); if (mesh.Material.Textures == null) { continue; } foreach (string texture in mesh.Material.Textures.Values) { if (!string.IsNullOrWhiteSpace(texture)) { textures.Add(texture); } } } foreach (string texture in textures.OrderBy(s => s, StringComparer.InvariantCultureIgnoreCase)) { MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), texture, Color.White, DEBUG_SCALE); } row++; }
public override unsafe void DebugDraw(Vector2 pos, Vector2 size, List <MyBehaviorTreeNodeMemory> nodesMemory) { MyRenderProxy.DebugDrawText2D(pos, this.DebugSign, nodesMemory[base.MemoryIndex].NodeStateColor, MyBehaviorTreeNode.DEBUG_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, false); float *singlePtr1 = (float *)ref size.X; singlePtr1[0] *= MyBehaviorTreeNode.DEBUG_SCALE; Vector2 position = (this.m_children.Count > 1) ? (pos - (size * 0.5f)) : pos; float * singlePtr2 = (float *)ref position.Y; singlePtr2[0] += MyBehaviorTreeNode.DEBUG_TEXT_Y_OFFSET; float *singlePtr3 = (float *)ref size.X; singlePtr3[0] /= (float)Math.Max(this.m_children.Count - 1, 1); foreach (MyBehaviorTreeNode node in this.m_children) { Vector2 vector2 = position - pos; vector2.Normalize(); Vector2 pointTo = position - (vector2 * MyBehaviorTreeNode.DEBUG_LINE_OFFSET_MULT); Matrix? projection = null; MyRenderProxy.DebugDrawLine2D(pos + (vector2 * MyBehaviorTreeNode.DEBUG_LINE_OFFSET_MULT), pointTo, nodesMemory[node.MemoryIndex].NodeStateColor, nodesMemory[node.MemoryIndex].NodeStateColor, projection, false); node.DebugDraw(position, size, nodesMemory); float *singlePtr4 = (float *)ref position.X; singlePtr4[0] += size.X; } }
protected void Text(Color color, float scale, string message, params object[] arguments) { if (arguments.Length > 0) { message = String.Format(message, arguments); } MyRenderProxy.DebugDrawText2D(new Vector2(0, NextTextOffset(scale)), message, color, .6f * scale); }
public override unsafe void DebugDraw(Vector2 pos, Vector2 size, List <MyBehaviorTreeNodeMemory> nodesMemory) { MyRenderProxy.DebugDrawText2D(pos, "ROOT", nodesMemory[base.MemoryIndex].NodeStateColor, MyBehaviorTreeNode.DEBUG_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, false); float *singlePtr1 = (float *)ref pos.Y; singlePtr1[0] += MyBehaviorTreeNode.DEBUG_ROOT_OFFSET; this.m_child.DebugDraw(pos, size, nodesMemory); }
public void DebugDraw(MyCubeGrid grid) { foreach (var line in m_lines) { line.DebugDraw(grid); } MyRenderProxy.DebugDrawText2D(new Vector2(1.0f, 1.0f), "Conveyor lines: " + m_lines.Count, Color.Red, 1.0f); }
private void DrawWatch(MyListDictionary <MemberInfo, MemberInfo> watch) { PlotHistory(); if (watch == null) { return; } List <object> log = new CacheList <object>(watch.Values.Count); StringBuilder sb = new StringBuilder(); Vector2 pos = new Vector2(100, 50);// m_counter * 0.2f); int i = -1; foreach (var list in watch.Values) { i++; if (i < SelectedMember) { continue; } object currentInstance = SelectedEntity; foreach (var member in list) { sb.Append("."); sb.Append(member.Name); currentInstance = member.GetValue(currentInstance); } sb.Append(":"); sb.Append(currentInstance.ToString()); MyRenderProxy.DebugDrawText2D(pos, sb.ToString(), m_toPlot.Contains(i) ? m_colors[i] : Color.White, 0.55f); pos.Y += 12; sb.Clear(); log.Add(currentInstance); } pos.X = 90; foreach (var toPlot in m_toPlot) { int idx = (toPlot - SelectedMember); if (idx < 0) { continue; } pos.Y = 50 + idx * 12; MyRenderProxy.DebugDrawText2D(pos, "*", m_colors[toPlot], 0.55f); } m_history.Add(log); if (m_history.Count >= MAX_HISTORY) { m_history.RemoveAtFast(m_frame); } m_frame++; m_frame %= MAX_HISTORY; }
public override void DebugDraw() { if (MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_MISC && (this.m_tool.GetTargetGrid() != null)) { MyRenderProxy.DebugDrawText2D(new Vector2(0f, 0f), this.m_tool.TargetCube.ToString(), Color.White, 1f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, false); } if (MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_MISC) { MyRenderProxy.DebugDrawSphere(this.m_tool.GunBase.GetMuzzleWorldPosition(), 0.01f, Color.Green, 1f, false, false, true, false); } }
public override void Update() { if (!IsActive || !m_visible) { return; } // If there is no hit then hide bool hit = UpdateHitEntity(false); if (MyFakes.ENABLE_VR_BUILDING && !hit) { Hide(); return; } if (!m_visible) { Hide(); return; } Show(); if (m_dragDistance == 0) { SetupDragDistance(); } UpdatePastePosition(); UpdateGridTransformations(); if (!MyCubeBuilder.Static.DynamicMode) { FixSnapTransformationBase6(); } if (m_calculateVelocity) { m_objectVelocity = (m_pastePosition - m_pastePositionPrevious) / VRage.Game.MyEngineConstants.UPDATE_STEP_SIZE_IN_SECONDS; } m_canBePlaced = TestPlacement(); TestBuildingMaterials(); UpdatePreview(); if (MyDebugDrawSettings.DEBUG_DRAW_COPY_PASTE) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), "FW: " + m_pasteDirForward.ToString(), Color.Red, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 20.0f), "UP: " + m_pasteDirUp.ToString(), Color.Red, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 40.0f), "AN: " + m_pasteOrientationAngle.ToString(), Color.Red, 1.0f); } }
private void DebugDrawModelTextures(MyCubeBlock block, ref int row) { MyModel model = null; if (block != null) { model = block.Model; } if (model == null) { return; } row += 2; MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), "SubTypeId: " + block.BlockDefinition.Id.SubtypeName, Color.Yellow, DEBUG_SCALE); MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), "Display name: " + block.BlockDefinition.DisplayNameText, Color.Yellow, DEBUG_SCALE); if (block.SlimBlock.IsMultiBlockPart) { var multiblockInfo = block.CubeGrid.GetMultiBlockInfo(block.SlimBlock.MultiBlockId); if (multiblockInfo != null) { MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), "Multiblock: " + multiblockInfo.MultiBlockDefinition.Id.SubtypeName + " (Id:" + block.SlimBlock.MultiBlockId + ")", Color.Yellow, DEBUG_SCALE); } } if (block.BlockDefinition.IsGeneratedBlock) { MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), "Generated block: " + block.BlockDefinition.GeneratedBlockType, Color.Yellow, DEBUG_SCALE); } MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), "Asset: " + model.AssetName, Color.Yellow, DEBUG_SCALE); MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), "BlockID: " + block.EntityId, Color.Yellow, DEBUG_SCALE); // Enables to copy asset name to windows clipboard through * key in MyTomasInputComponent var lastIndex = model.AssetName.LastIndexOf("\\") + 1; if (lastIndex != -1 && lastIndex < model.AssetName.Length) { MyTomasInputComponent.ClipboardText = model.AssetName.Substring(lastIndex); } else { MyTomasInputComponent.ClipboardText = model.AssetName; } DebugDrawTexturesInfo(model, ref row); }
private void PlotHistory() { const float zeroLine = 400; int idx = 0; Vector2 b = new Vector2(100, zeroLine); Vector2 b2 = b; b2.X += 1; MyRenderProxy.DebugDrawLine2D(new Vector2(b.X, b.Y - 200), new Vector2(b.X + 1000, b.Y - 200), Color.Gray, Color.Gray); MyRenderProxy.DebugDrawLine2D(new Vector2(b.X, b.Y + 200), new Vector2(b.X + 1000, b.Y + 200), Color.Gray, Color.Gray); MyRenderProxy.DebugDrawLine2D(new Vector2(b.X, b.Y), new Vector2(b.X + 1000, b.Y), Color.Gray, Color.Gray); MyRenderProxy.DebugDrawText2D(new Vector2(90, 400 - 200), (200 / m_scale).ToString(), Color.White, 0.55f, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER); MyRenderProxy.DebugDrawText2D(new Vector2(90, 400 + 200), (-200 / m_scale).ToString(), Color.White, 0.55f, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER); for (int i = Math.Min(1000, m_history.Count); i > 0; i--) { int thisFrame = (m_frame + m_history.Count - i) % m_history.Count; var frame = m_history[thisFrame]; var frame2 = m_history[(thisFrame + 1) % m_history.Count]; idx++; foreach (var toPlot in m_toPlot) { if (frame.Count <= toPlot || frame2.Count <= toPlot) { continue; } var o = frame[toPlot]; if (o.GetType().IsPrimitive) { var v = ConvertToFloat(o); var v2 = ConvertToFloat(frame2[toPlot]); b.Y = zeroLine - v * m_scale; b2.Y = zeroLine - v2 * m_scale; if (idx == 1) { b.Y = b2.Y; } if (i < 3) { b2.Y = b.Y; } MyRenderProxy.DebugDrawLine2D(b, b2, m_colors[toPlot], m_colors[toPlot]); } } b.X += 1; b2.X += 1; } }
private static void DebugDrawBareBlockInfo(MySlimBlock block, ref int row) { row += 2; MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), String.Format("Display Name: {0}", block.BlockDefinition.DisplayNameText), Color.Yellow, DEBUG_SCALE); MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), String.Format("Cube type: {0}", block.BlockDefinition.CubeDefinition.CubeTopology), Color.Yellow, DEBUG_SCALE); foreach (string modelName in block.BlockDefinition.CubeDefinition.Model.Distinct().OrderBy(s => s, StringComparer.InvariantCultureIgnoreCase)) { MyRenderProxy.DebugDrawText2D(new Vector2(20, row++ *10), String.Format("Asset: {0}", modelName), Color.Yellow, DEBUG_SCALE); MyModel model = MyModels.GetModel(modelName); DebugDrawTexturesInfo(model, ref row); } }
public override void Draw() { base.Draw(); foreach (var line in m_lines) { MyRenderProxy.DebugDrawLine3D(line.From, line.To, line.ColorFrom, line.ColorTo, line.DepthRead); } if (ShowDebugDrawTests) { Vector3D position = new Vector3D(1000000000.0, 1000000000.0, 1000000000.0); MyRenderProxy.DebugDrawLine3D(position, position + Vector3D.Up, Color.Red, Color.Blue, true); position += Vector3D.Left; MyRenderProxy.DebugDrawLine3D(position, position + Vector3D.Up, Color.Red, Color.Blue, false); MyRenderProxy.DebugDrawLine2D(new Vector2(10, 10), new Vector2(50, 50), Color.Red, Color.Blue); position += Vector3D.Left; MyRenderProxy.DebugDrawPoint(position, Color.White, true); position += Vector3D.Left; MyRenderProxy.DebugDrawPoint(position, Color.White, false); position += Vector3D.Left; MyRenderProxy.DebugDrawSphere(position, 0.5f, Color.White, 1.0f, true); position += Vector3D.Left; MyRenderProxy.DebugDrawAABB(new BoundingBoxD(position - Vector3D.One * 0.5, position + Vector3D.One * 0.5), Color.White, 1.0f, 1.0f, true); position += Vector3D.Left; //MyRenderProxy.DebugDrawCone(position, Vector3D.Up, Vector3D.One, Color.Yellow, true); position += Vector3D.Left; MyRenderProxy.DebugDrawAxis(MatrixD.CreateFromTransformScale(Quaternion.Identity, position, Vector3D.One * 0.5), 1.0f, true); position += Vector3D.Left; MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(position, Vector3D.One * 0.5, Quaternion.Identity), Color.White, 1.0f, true, false); position += Vector3D.Left; MyRenderProxy.DebugDrawCylinder(MatrixD.CreateFromTransformScale(Quaternion.Identity, position, Vector3D.One * 0.5), Color.White, 1.0f, true, true); position += Vector3D.Left; MyRenderProxy.DebugDrawTriangle(position, position + Vector3D.Up, position + Vector3D.Left, Color.White, true, true); position += Vector3D.Left; var msg = MyRenderProxy.PrepareDebugDrawTriangles(); msg.AddTriangle(position, position + Vector3D.Up, position + Vector3D.Left); msg.AddTriangle(position, position + Vector3D.Left, position - Vector3D.Up); MyRenderProxy.DebugDrawTriangles(msg, MatrixD.Identity, Color.White, true, true); position += Vector3D.Left; MyRenderProxy.DebugDrawCapsule(position, position + Vector3D.Up, 0.5f, Color.White, true); MyRenderProxy.DebugDrawText2D(new Vector2(100, 100), "text", Color.Green, 1.0f); position += Vector3D.Left; MyRenderProxy.DebugDrawText3D(position, "3D Text", Color.Blue, 1.0f, true); } }
public void DebugDraw(float startYCoord) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, startYCoord), "Controlled group controllers:", Color.GreenYellow, 0.5f); startYCoord += 13.0f; foreach (var controller in m_groupControllers) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, startYCoord), " " + controller.ToString(), Color.LightYellow, 0.5f); startYCoord += 13.0f; } MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, startYCoord), "Controlled group grids:", Color.GreenYellow, 0.5f); startYCoord += 13.0f; foreach (var grid in m_cubeGrids) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, startYCoord), " " + grid.ToString(), Color.LightYellow, 0.5f); startYCoord += 13.0f; } }
public override void Draw() { base.Draw(); MyRenderProxy.DebugDrawText2D(new Vector2(50, 50), "LMU (ctrl *):" + MyOpenVR.LmuDebugOnOff, Color.White, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(250, 50), "2D (ctrl /):" + MyOpenVR.Debug2DImage, Color.White, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(450, 50), "SYNC (ctrl ,):" + MyOpenVR.SyncWait, Color.White, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(100, 80), "Missed frames: " + MyOpenVR.MissedFramesCount, Color.Purple, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(400, 80), "Wait ms: " + MyOpenVR.WaitTimeMs.ToString("00.00"), Color.MediumPurple, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(100, 100), "IPD (hmd wheel) =" + (MyOpenVR.Ipd_2 * 2).ToString(), Color.Green, 1.0f); //MyRenderProxy.DebugDrawText2D(new Vector2(100, 120), "height (ctrl +-) =" + MyOpenVR.FloorOffset.ToString(), Color.Green, 1.0f); Quaternion rot = Quaternion.CreateFromRotationMatrix(MyOpenVR.Controller1Matrix); Vector3 angles = MyMath.QuaternionToEuler(rot); var anglesDeg = Vector3.Multiply(angles, (float)(180f / Math.PI)); MyRenderProxy.DebugDrawText2D(new Vector2(100, 150), "C1 angles:" + anglesDeg.ToString(), Color.Gray, 1.0f); sb.Clear(); for (int i = 0; i < 64; i++) { if (MyOpenVR.Controller1State.WasButtonPressed((Valve.VR.EVRButtonId)i)) { sb.Append('+' + i.ToString() + " "); } if (MyOpenVR.Controller1State.WasButtonReleased((Valve.VR.EVRButtonId)i)) { sb.Append('-' + i.ToString() + " "); } if (MyOpenVR.Controller1State.IsButtonPressed((Valve.VR.EVRButtonId)i)) { sb.Append(MyOpenVR.GetButtonName(i)); sb.Append(" "); } } MyRenderProxy.DebugDrawText2D(new Vector2(100, 170), sb.ToString(), Color.Yellow, 1.0f); //touchpads: if (MyOpenVR.Controller1State.GetTouchpadXY(ref m_c1touch)) { MyRenderProxy.DebugDrawText2D(new Vector2(100, 190), "C1 touchpad:" + m_c1touch.X.ToString("0.00") + ", " + m_c1touch.Y.ToString("0.00"), Color.RosyBrown, 1.0f); } if (MyOpenVR.Controller2State.GetTouchpadXY(ref m_c2touch)) { MyRenderProxy.DebugDrawText2D(new Vector2(100, 210), "C2 touchpad:" + m_c2touch.X.ToString("0.00") + ", " + m_c2touch.Y.ToString("0.00"), Color.RosyBrown, 1.0f); } MyRenderProxy.DebugDrawText2D(new Vector2(100, 230), "C1 analog trigger: " + MyOpenVR.Controller1State.GetAnalogTrigger().ToString("0.00"), Color.Yellow, 1.0f); DrawFrameTiming(); }
public override void UpdateAfterSimulation() { if (MyDebugDrawSettings.ENABLE_DEBUG_DRAW && MyDebugDrawSettings.DEBUG_DRAW_SHIP_TOOLS) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), m_isActivated ? "Activated" : "Not activated", Color.Red, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 90.0f), "Activation counter: " + m_activateCounter, Color.Red, 1.0f); } base.UpdateAfterSimulation(); if (IsFunctional) { UpdateAnimationCommon(); } }
public override void Update() { if (base.IsActive) { this.UpdateHitEntity(); if (!base.m_visible) { base.ShowPreview(false); } else if (base.PreviewGrids.Count != 0) { if (base.m_dragDistance == 0f) { this.SetupDragDistance(); } if (base.m_dragDistance > MyBlockBuilderBase.CubeBuilderDefinition.MaxBlockBuildingDistance) { base.m_dragDistance = MyBlockBuilderBase.CubeBuilderDefinition.MaxBlockBuildingDistance; } this.UpdatePastePosition(); this.UpdateGridTransformations(); this.FixSnapTransformationBase6(); if (base.m_calculateVelocity) { base.m_objectVelocity = (Vector3)((base.m_pastePosition - base.m_pastePositionPrevious) / 0.01666666753590107); } base.m_canBePlaced = this.TestPlacement(); if (!base.m_visible) { base.ShowPreview(false); } else { base.ShowPreview(true); this.TestBuildingMaterials(); base.m_canBePlaced &= base.CharacterHasEnoughMaterials; this.UpdatePreview(); if (MyDebugDrawSettings.DEBUG_DRAW_COPY_PASTE) { MyRenderProxy.DebugDrawText2D(new Vector2(0f, 0f), "FW: " + base.m_pasteDirForward.ToString(), Color.Red, 1f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, false); MyRenderProxy.DebugDrawText2D(new Vector2(0f, 20f), "UP: " + base.m_pasteDirUp.ToString(), Color.Red, 1f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, false); MyRenderProxy.DebugDrawText2D(new Vector2(0f, 40f), "AN: " + base.m_pasteOrientationAngle.ToString(), Color.Red, 1f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, false); } } } } }
public override void Draw() { base.Draw(); if (MyDebugDrawSettings.DEBUG_DRAW_UPDATE_TRIGGER) { Vector2 pos = new Vector2(350, 10); StringBuilder sb = new StringBuilder(); MyRenderProxy.DebugDrawText2D(pos, "Queried Triggers", Color.White, 0.7f); foreach (var trigger in m_queriedTriggers) { pos.Y += 20; sb.Clear(); if (trigger.Entity != null && trigger.Entity.Name != null) { sb.Append("EntityName: " + trigger.Entity.Name + " "); } sb.Append("Trigger: " + trigger.Name + " radius: " + trigger.Radius); MyRenderProxy.DebugDrawText2D(pos, sb.ToString(), Color.White, 0.7f); } pos.X += 250; pos.Y = 10; MyRenderProxy.DebugDrawText2D(pos, "Selected Trigger", Color.White, 0.7f); pos.Y += 20; sb.Clear(); if (m_selectedTrigger != null) { if (m_selectedTrigger.Entity != null && m_selectedTrigger.Entity.Name != null) { sb.Append("EntityName: " + m_selectedTrigger.Entity.Name + " "); } sb.Append("Trigger: " + m_selectedTrigger.Name + " radius: " + m_selectedTrigger.Radius); MyRenderProxy.DebugDrawText2D(pos, sb.ToString(), Color.White, 0.7f); } if (m_lastCapturedCameraMatrix != MatrixD.Identity) { MyRenderProxy.DebugDrawAxis(m_lastCapturedCameraMatrix, 5f, true); } } }
private void DrawFrameTiming() { int vertPos = 250; if (!m_freezeTiming) { var ret = MyOpenVR.GetFrameTiming(ref m_timing, 0); } foreach (var field in m_timing.GetType().GetFields()) { MyRenderProxy.DebugDrawText2D(new Vector2(50, vertPos += 10), field.Name + ": " + field.GetValue(m_timing), Color.NavajoWhite, 0.5f); if (m_logTiming) { VRage.Utils.MyLog.Default.WriteLine(field.Name + ": " + field.GetValue(m_timing)); } } MyRenderProxy.DebugDrawText2D(new Vector2(50, vertPos += 10), "freeze (ctrl -): " + m_freezeTiming + " to console (ctrl +): " + m_logTiming, Color.White, 0.5f); }
private void DebugDrawInfo(Vector2 offset) { MergeData data = new MergeData(); CalculateMergeData(ref data); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 75.0f) + offset, "x = " + data.StrengthFactor.ToString(), Color.Green, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f) + offset, "Merge block strength: " + data.ConstraintStrength.ToString(), Color.Green, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 15.0f) + offset, "Merge block dist: " + (data.Distance - CubeGrid.GridSize).ToString(), data.PositionOk ? Color.Green : Color.Red, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 30.0f) + offset, "Frame counter: " + m_frameCounter.ToString(), m_frameCounter >= 6 ? Color.Green : Color.Red, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 45.0f) + offset, "Rotation difference: " + data.RotationDelta.ToString(), data.RotationOk ? Color.Green : Color.Red, 0.8f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 60.0f) + offset, "Axis difference: " + data.AxisDelta.ToString(), data.AxisOk ? Color.Green : Color.Red, 0.8f); // The quicker the ships move towards each other, the weaker the constraint strength float rvLength = data.RelativeVelocity.Length(); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 90.0f) + offset, rvLength > 0.5f ? "Quick" : "Slow", rvLength > 0.5f ? Color.Red : Color.Green, 0.8f); }
public override void Draw() { base.Draw(); if (DEBUG_SHOW_RESEARCH) { var character = MySession.Static.LocalCharacter; if (character == null) { return; } var identityId = character.GetPlayerIdentityId(); HashSet <MyDefinitionId> unlockedItems; if (!m_unlockedResearch.TryGetValue(identityId, out unlockedItems)) { return; } MyRenderProxy.DebugDrawText2D(new Vector2(10, 180), String.Format("=== {0}'s Research ===", MySession.Static.LocalHumanPlayer.DisplayName), Color.DarkViolet, 0.8f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); int yShift = 200; foreach (var defId in unlockedItems) { if (DEBUG_SHOW_RESEARCH_PRETTY) { var definition = MyDefinitionManager.Static.GetDefinition(defId); if (definition is MyResearchDefinition) { MyRenderProxy.DebugDrawText2D(new Vector2(10, yShift), String.Format("[R] {0}", definition.DisplayNameText), Color.DarkViolet, 0.7f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); } else { MyRenderProxy.DebugDrawText2D(new Vector2(10, yShift), definition.DisplayNameText, Color.DarkViolet, 0.7f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); } } else { MyRenderProxy.DebugDrawText2D(new Vector2(10, yShift), defId.ToString(), Color.DarkViolet, 0.7f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); } yShift += 16; } } }
internal unsafe void DebugDrawBots() { if (MyDebugDrawSettings.DEBUG_DRAW_BOTS) { Vector2 normalizedCoord = new Vector2(0.01f, 0.4f); for (int i = 0; i < this.m_botsQueue.Count; i++) { IMyBot bot = this.m_allBots[this.m_botsQueue[i]]; if (bot is IMyEntityBot) { IMyEntityBot bot2 = bot as IMyEntityBot; Color green = Color.Green; if ((this.m_botIndex == -1) || (i != this.m_botIndex)) { green = Color.Red; } string text = $"Bot[{i}]: {bot2.BehaviorSubtypeName}"; if (bot is MyAgentBot) { text = text + (bot as MyAgentBot).LastActions.GetLastActionsString(); } MyRenderProxy.DebugDrawText2D(MyGuiManager.GetHudPixelCoordFromNormalizedCoord(normalizedCoord), text, green, 0.5f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, false); MyCharacter botEntity = bot2.BotEntity as MyCharacter; IMyFaction faction = null; if (botEntity != null) { long identityId = botEntity.ControllerInfo.Controller.Player.Identity.IdentityId; faction = MySession.Static.Factions.TryGetPlayerFaction(identityId); } if (bot2.BotEntity != null) { Vector3D center = bot2.BotEntity.PositionComp.WorldAABB.Center; double * numPtr1 = (double *)ref center.Y; numPtr1[0] += bot2.BotEntity.PositionComp.WorldAABB.HalfExtents.Y; MyRenderProxy.DebugDrawText3D(center, $"Bot:{i}", green, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP, -1, false); MyRenderProxy.DebugDrawText3D(center - new Vector3(0f, -0.5f, 0f), (faction == null) ? "NO_FACTION" : faction.Tag, green, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP, -1, false); } float *singlePtr1 = (float *)ref normalizedCoord.Y; singlePtr1[0] += 0.02f; } } } }
public override void UpdateAfterSimulation() { if (MyDebugDrawSettings.ENABLE_DEBUG_DRAW && MyDebugDrawSettings.DEBUG_DRAW_SHIP_TOOLS) { MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 0.0f), m_isActivated ? "Activated" : "Not activated", Color.Red, 1.0f); MyRenderProxy.DebugDrawText2D(new Vector2(0.0f, 90.0f), "Activation counter: " + m_activateCounter, Color.Red, 1.0f); } base.UpdateAfterSimulation(); if (m_isActivated && MySandboxGame.TotalGamePlayTimeInMilliseconds - m_lastTimeActivate >= MyShipGrinderConstants.GRINDER_COOLDOWN_IN_MILISECONDS) { ActivateCommon(); } if (IsFunctional) { UpdateAnimationCommon(); } }