public void RenderGizmos() { if (IsActive && _grabSettings.ShowGrabLines) { foreach (var grabbedObject in _grabbedObjects) { GizmosEx.RenderLine(grabbedObject.GetHierarchyWorldOrientedBox().Center, _surfaceHitPoint, _grabSettings.GrabLineColor); } } }
public void Render(Vector3 pivotPoint, Color fillColor, Color borderLineColor, float sizeInPixels) { Camera camera = SceneViewCamera.Camera; Vector2 screenPoint = camera.WorldToScreenPoint(pivotPoint); Circle2D circle = new Circle2D(screenPoint, sizeInPixels * 0.5f); GizmosEx.Render2DFilledCircle(circle, fillColor); GizmosEx.Render2DCircleBorderLines(circle, borderLineColor); }
public void RenderMirroredEntityOrientedBox(Plane mirrorPlane, OrientedBox entityBox, bool mirrorRotation, Color boxColor, Color boxBorderLineColor) { if (!entityBox.IsValid()) { return; } OrientedBox mirroredEntityBox = Mirroring.MirrorOrientedBox(mirrorPlane, entityBox, mirrorRotation); GizmosEx.RenderOrientedBox(mirroredEntityBox, boxColor); GizmosEx.RenderOrientedBoxEdges(mirroredEntityBox, boxBorderLineColor); }
private void RenderPivotPointConnectionLines(ProjectedBoxFacePivotPoints projectedBoxFacePivotPoints, ObjectPivotPointsRenderSettings pivotPointsRenderSettings) { ProjectedBoxFacePivotPointsRenderSettings renderSettings = pivotPointsRenderSettings.ProjectedBoxFacePivotPointsRenderSettings; if (renderSettings.RenderPivotPointConnectionLines) { List <Vector3> pivotPointsNoCenter = projectedBoxFacePivotPoints.GetAllPointsExcludingCenter(); if (pivotPointsNoCenter.Count != 0) { GizmosEx.RenderLinesBetweenPoints(pivotPointsNoCenter, renderSettings.PivotPointConnectionLineColor); } } }
public void RenderGizmos() { if (_state != State.Inactive && _isPivotAvailable) { Circle2D circle = new Circle2D(SceneViewCamera.Camera.WorldToScreenPoint(_pivot), 6.0f); GizmosEx.Render2DCircleBorderLines(circle, Color.black); GizmosEx.Render2DFilledCircle(circle, Color.green); foreach (var parent in _selectedParents) { OrientedBox worldOOBB = parent.GetHierarchyWorldOrientedBox(); GizmosEx.RenderOrientedBoxEdges(worldOOBB, Color.yellow); } } }
private void RenderPathUnderManualConstructionWhenUsingTileConnections(ObjectPlacementPath path, ObjectPlacementPathTileConnectionSettings tileConnectionSettings) { List <ObjectPlacementPathTileConnectionGridCell> tileConnectionGridCells = path.TileConnectionGridCells; ObjectPlacementPathManualConstructionRenderSettings renderSettings = path.RenderSettings.ManualConstructionRenderSettings; var tileConnectionYOffsetVectorCalculator = new ObjectPlacementPathTileConnectionYOffsetVectorCalculator(); // Loop through all tile connection grid cells. Each cell will give us access to all the information // that we need to perform the rendering operation. foreach (ObjectPlacementPathTileConnectionGridCell tileConnectionGridCell in tileConnectionGridCells) { // Use the cell to access the tile connection stack. If the stack is overlapped by another stack // or if no boxes exist in the stack, we can move on to the next cell. ObjectPlacementBoxStack tileConnectionStack = tileConnectionGridCell.TileConnectionStack; if (tileConnectionStack.IsOverlappedByAnotherStack || tileConnectionStack.NumberOfBoxes == 0) { continue; } // Calculate the Y offset vector which applies to all tiles in the current stack and then render each // box which resides inside the stack. Vector3 tileConnectionYOffsetVector = tileConnectionYOffsetVectorCalculator.Calculate(tileConnectionSettings.GetSettingsForTileConnectionType(tileConnectionGridCell.TileConnectionType), path); for (int boxIndex = 0; boxIndex < tileConnectionStack.NumberOfBoxes; ++boxIndex) { // If the box is hidden, we can move on to the next box ObjectPlacementBox placementBox = tileConnectionStack.GetBoxByIndex(boxIndex); if (placementBox.IsHidden) { continue; } // Retrieve the box and apply the Y offset vector. The render the box. OrientedBox orientedBox = placementBox.OrientedBox; orientedBox.Center += tileConnectionYOffsetVector; GizmosEx.RenderOrientedBoxEdges(orientedBox, renderSettings.BoxBorderLineColor); } // We have to take tile connection extrusion into account, so we will need to retrieve the extrusion // boxes and render those too. List <OrientedBox> extrusionOrientedBoxes = ObjectPlacementPathTileConnectionExtrusion.GetTileConnectionExtrusionOrientedBoxes(tileConnectionGridCell); foreach (OrientedBox extrusionBox in extrusionOrientedBoxes) { GizmosEx.RenderOrientedBoxEdges(extrusionBox, renderSettings.BoxBorderLineColor); } } }
public void RenderGizmos(ObjectVertexSnapSession session, ObjectVertexSnapSessionRenderSettings renderSettings) { if (!session.IsActive) { return; } if (session.SourceGameObject != null) { if (renderSettings.RenderSourceVertex) { Vector2 vertexScreenPos = SceneViewCamera.Camera.WorldToScreenPoint(session.SourceVertex); Circle2D circle = new Circle2D(vertexScreenPos, renderSettings.SourceVertexRadiusInPixels); GizmosEx.Render2DFilledCircle(circle, renderSettings.SourceVertexFillColor); GizmosEx.Render2DCircleBorderLines(circle, renderSettings.SourceVertexBorderColor); } } }
private void RenderPivotPointProjectionLines(ProjectedBoxFacePivotPoints projectedBoxFacePivotPoints, ObjectPivotPointsRenderSettings pivotPointsRenderSettings) { ProjectedBoxFacePivotPointsRenderSettings renderSettings = pivotPointsRenderSettings.ProjectedBoxFacePivotPointsRenderSettings; if (renderSettings.RenderProjectionLines) { List <Vector3> allPivotPoints = projectedBoxFacePivotPoints.AllPoints; if (allPivotPoints.Count != 0) { Color projectionLineColor = renderSettings.ProjectionLineColor; List <Vector3> unprojectedPoints = projectedBoxFacePivotPoints.GetUnprojectedPivotPoints(); for (int pointIndex = 0; pointIndex < unprojectedPoints.Count; ++pointIndex) { GizmosEx.RenderLine(allPivotPoints[pointIndex], unprojectedPoints[pointIndex], projectionLineColor); } } } }
public void RenderGizmos(ObjectPlacementExtensionPlane extensionPlane) { ObjectPlacementExtensionPlaneRenderSettings renderSettings = extensionPlane.RenderSettings; XZOrientedQuad3D planeQuad = extensionPlane.PlaneQuad; planeQuad.SetScale(renderSettings.PlaneScale); // Note: Add a small offset to avoid Z wars when the extension plane sits on top of other objects. const float quadOffset = 0.005f; GizmosEx.RenderXZOrientedQuad(planeQuad, renderSettings.PlaneColor, quadOffset); GizmosEx.RenderXZOrientedQuadBorderLines(planeQuad, renderSettings.PlaneBorderLineColor, quadOffset); // Render the plane normals List <Vector3> quadCornerPoints = planeQuad.GetCornerPoints(); Vector3 offsetToEndOfLine = extensionPlane.Plane.normal * renderSettings.PlaneNormalLineLength; foreach (Vector3 quadCornerPoint in quadCornerPoints) { GizmosEx.RenderLine(quadCornerPoint, quadCornerPoint + offsetToEndOfLine, renderSettings.PlaneNormalLineColor); } }
public override void Render(List <GameObject> selectedObjects) { ObjectSelectionRenderSettings selectionRenderSettings = ObjectSelectionRenderSettings.Get(); ObjectSelectionBoxRenderModeSettings selectionBoxRenderModeSettings = selectionRenderSettings.BoxRenderModeSettings; ObjectSelectionBoxCornerEdgesRenderModeSettings selectionBoxCornerEdgesRenderModeSettings = selectionBoxRenderModeSettings.CornerEdgesRenderModeSettings; Color boxColor = selectionBoxRenderModeSettings.BoxColor; Color edgeColor = selectionBoxRenderModeSettings.EdgeColor; float boxScale = selectionBoxRenderModeSettings.BoxScale; bool renderBoxes = boxColor.a != 0.0f; bool renderEdges = edgeColor.a != 0.0f; if (!renderBoxes && !renderEdges) { return; } // Note: Code duplication is intentional here in order to avoid further abstractions which may hinder performance. if (selectionBoxRenderModeSettings.EdgeRenderMode == ObjectSelectionBoxEdgeRenderMode.Wire) { if (renderBoxes && renderEdges) { foreach (GameObject gameObject in selectedObjects) { if (!gameObject.activeInHierarchy) { continue; } OrientedBox worldOrientedBox = gameObject.GetWorldOrientedBox(); if (worldOrientedBox.IsValid()) { worldOrientedBox.Scale *= boxScale; GizmosEx.RenderOrientedBox(worldOrientedBox, boxColor); GizmosEx.RenderOrientedBoxEdges(worldOrientedBox, edgeColor); } } } else if (renderEdges && !renderBoxes) { foreach (GameObject gameObject in selectedObjects) { if (!gameObject.activeInHierarchy) { continue; } OrientedBox worldOrientedBox = gameObject.GetWorldOrientedBox(); if (worldOrientedBox.IsValid()) { worldOrientedBox.Scale *= boxScale; GizmosEx.RenderOrientedBoxEdges(worldOrientedBox, edgeColor); } } } else if (renderBoxes && !renderEdges) { foreach (GameObject gameObject in selectedObjects) { if (!gameObject.activeInHierarchy) { continue; } OrientedBox worldOrientedBox = gameObject.GetWorldOrientedBox(); if (worldOrientedBox.IsValid()) { worldOrientedBox.Scale *= boxScale; GizmosEx.RenderOrientedBox(worldOrientedBox, boxColor); } } } } else if (selectionBoxRenderModeSettings.EdgeRenderMode == ObjectSelectionBoxEdgeRenderMode.CornerEdges) { float cornerEdgeLengthPercentage = selectionBoxCornerEdgesRenderModeSettings.CornerEdgeLengthPercentage; if (renderBoxes && renderEdges) { foreach (GameObject gameObject in selectedObjects) { if (!gameObject.activeInHierarchy) { continue; } OrientedBox worldOrientedBox = gameObject.GetWorldOrientedBox(); if (worldOrientedBox.IsValid()) { worldOrientedBox.Scale *= boxScale; GizmosEx.RenderOrientedBox(worldOrientedBox, boxColor); GizmosEx.RenderOrientedBoxCornerEdges(worldOrientedBox, cornerEdgeLengthPercentage, edgeColor); } } } else if (renderEdges && !renderBoxes) { foreach (GameObject gameObject in selectedObjects) { if (!gameObject.activeInHierarchy) { continue; } OrientedBox worldOrientedBox = gameObject.GetWorldOrientedBox(); if (worldOrientedBox.IsValid()) { worldOrientedBox.Scale *= boxScale; GizmosEx.RenderOrientedBoxCornerEdges(worldOrientedBox, cornerEdgeLengthPercentage, edgeColor); } } } else if (renderBoxes && !renderEdges) { foreach (GameObject gameObject in selectedObjects) { if (!gameObject.activeInHierarchy) { continue; } OrientedBox worldOrientedBox = gameObject.GetWorldOrientedBox(); if (worldOrientedBox.IsValid()) { worldOrientedBox.Scale *= boxScale; GizmosEx.RenderOrientedBox(worldOrientedBox, boxColor); } } } } }
public override void RenderGizmos() { GizmosEx.RenderLinesBetweenPoints(GetRenderPoints(), RenderSettings.BorderLineColor, _ellipse.Normal * 0.03f); }