private void UpdatePreview() { if ((base.PreviewGrids != null) && (base.m_visible && this.HasPreviewBBox)) { Vector4? nullable2; MyStringId id = base.m_canBePlaced ? MyGridClipboard.ID_GIZMO_DRAW_LINE : MyGridClipboard.ID_GIZMO_DRAW_LINE_RED; Color white = Color.White; foreach (MyCubeGrid local1 in base.PreviewGrids) { BoundingBoxD localAABB = local1.PositionComp.LocalAABB; MatrixD worldMatrix = local1.PositionComp.WorldMatrix; MyStringId? faceMaterial = null; MySimpleObjectDraw.DrawTransparentBox(ref worldMatrix, ref localAABB, ref white, MySimpleObjectRasterizer.Wireframe, 1, 0.04f, faceMaterial, new MyStringId?(id), false, -1, MyBillboard.BlendTypeEnum.Standard, 1f, null); } Vector4 color = new Vector4(Color.Red.ToVector3() * 0.8f, 1f); if (this.RemoveBlocksInMultiBlock.Count <= 0) { if (this.RemoveBlock != null) { nullable2 = null; MyCubeBuilder.DrawSemiTransparentBox(this.RemoveBlock.CubeGrid, this.RemoveBlock, color, false, new MyStringId?(MyGridClipboard.ID_GIZMO_DRAW_LINE_RED), nullable2); } } else { this.m_tmpBlockPositionsSet.Clear(); MyCubeBuilder.GetAllBlocksPositions(this.RemoveBlocksInMultiBlock, this.m_tmpBlockPositionsSet); foreach (Vector3I local2 in this.m_tmpBlockPositionsSet) { nullable2 = null; MyCubeBuilder.DrawSemiTransparentBox(local2, local2, this.RemoveBlock.CubeGrid, color, false, new MyStringId?(MyGridClipboard.ID_GIZMO_DRAW_LINE_RED), nullable2); } this.m_tmpBlockPositionsSet.Clear(); } } }
private void UpdatePreview() { if (PreviewGrids == null) { return; } if (m_visible == false || HasPreviewBBox == false) { return; } // Switch off shadows - does not work //foreach (var grid in PreviewGrids) //{ // grid.Render.CastShadows = false; // foreach (var block in grid.GetBlocks()) // { // if (block.FatBlock != null) // { // block.FatBlock.Render.CastShadows = false; // } // } //} string lineMaterial = m_canBePlaced ? "GizmoDrawLine" : "GizmoDrawLineRed"; Color white = Color.White; foreach (var grid in PreviewGrids) { BoundingBoxD localAABB = (BoundingBoxD)grid.PositionComp.LocalAABB; MatrixD drawMatrix = grid.PositionComp.WorldMatrix; MySimpleObjectDraw.DrawTransparentBox(ref drawMatrix, ref localAABB, ref white, MySimpleObjectRasterizer.Wireframe, 1, 0.04f, lineMaterial: lineMaterial); //foreach (var block in grid.GetBlocks()) //{ // if (block.FatBlock != null) // MyEntities.EnableEntityBoundingBoxDraw(block.FatBlock, true, color, lineWidth: 0.04f); //} } Vector4 red = new Vector4(Color.Red.ToVector3() * 0.8f, 1); if (RemoveBlocksInMultiBlock.Count > 0) { m_tmpBlockPositionsSet.Clear(); MyCubeBuilder.GetAllBlocksPositions(RemoveBlocksInMultiBlock, m_tmpBlockPositionsSet); foreach (var position in m_tmpBlockPositionsSet) { MyCubeBuilder.DrawSemiTransparentBox(position, position, RemoveBlock.CubeGrid, red, lineMaterial: "GizmoDrawLineRed"); } m_tmpBlockPositionsSet.Clear(); } else if (RemoveBlock != null) { MyCubeBuilder.DrawSemiTransparentBox(RemoveBlock.CubeGrid, RemoveBlock, red, lineMaterial: "GizmoDrawLineRed"); } }