Exemplo n.º 1
0
        private static void SaveExtensionPlaneLookAndFeel(ObjectPlacementExtensionPlaneRenderSettings extensionPlaneRenderSettings, XmlTextWriter xmlWriter, int indent)
        {
            xmlWriter.WriteNewLine(indent);
            xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ExtensionPlaneLookAndFeelNode);

            int childIndent = indent + 1;

            xmlWriter.WriteNewLine(childIndent);
            xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ExtensionPlaneScaleNode);
            xmlWriter.WriteString(extensionPlaneRenderSettings.PlaneScale.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteNewLine(childIndent);
            xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ExtensionPlaneColorNode);
            xmlWriter.WriteColorString(extensionPlaneRenderSettings.PlaneColor);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteNewLine(childIndent);
            xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ExtensionPlaneBorderColorNode);
            xmlWriter.WriteColorString(extensionPlaneRenderSettings.PlaneBorderLineColor);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteNewLine(childIndent);
            xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ExtensionPlaneNormalLineLengthNode);
            xmlWriter.WriteString(extensionPlaneRenderSettings.PlaneNormalLineLength.ToString());
            xmlWriter.WriteEndElement();

            xmlWriter.WriteNewLine(childIndent);
            xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ExtensionPlaneNormalLineColorNode);
            xmlWriter.WriteColorString(extensionPlaneRenderSettings.PlaneNormalLineColor);
            xmlWriter.WriteEndElement();

            xmlWriter.WriteNewLine(indent);
            xmlWriter.WriteEndElement();
        }
        public ObjectPlacementExtensionPlaneRenderSettingsView(ObjectPlacementExtensionPlaneRenderSettings settings)
        {
            _settings = settings;

            VisibilityToggleLabel        = "Extension Plane";
            ToggleVisibilityBeforeRender = true;
            IndentContent = true;
        }
        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);
            }
        }