コード例 #1
0
        private void RenderGridCellLines_Obsolete(XZGrid grid, XZVisibleGridCellRange visibleCellRange)
        {
            int   minCellIndexX    = visibleCellRange.XAxisVisibleCellRange.Min;
            int   maxCellIndexX    = visibleCellRange.XAxisVisibleCellRange.Max;
            float numberOfCellsOnX = maxCellIndexX - minCellIndexX + 1.0f;

            int   minCellIndexZ    = visibleCellRange.ZAxisVisibleCellRange.Min;
            int   maxCellIndexZ    = visibleCellRange.ZAxisVisibleCellRange.Max;
            float numberOfCellsOnZ = maxCellIndexZ - minCellIndexZ + 1.0f;

            XZGridCellSizeSettings gridCellSizeSettings = grid.CellSizeSettings;
            XZGridRenderSettings   gridRenderSettings   = grid.RenderSettings;

            Vector3 startPointOnX, startPointOnZ;
            Vector3 lineCubeSize = Vector3.zero;

            // Render the grid lines which extend along the grid's X axis
            GizmosColor.Push(grid.RenderSettings.CellLineColor);
            startPointOnX  = grid.GetCellHrzStart(minCellIndexX);
            lineCubeSize.z = gridRenderSettings.CellLineThickness;
            int maxLineIndex = maxCellIndexZ + 1;

            for (int lineIndex = minCellIndexZ; lineIndex <= maxLineIndex; ++lineIndex)
            {
                startPointOnZ = grid.GetCellDepthStart(lineIndex);
                Vector3 firstPoint  = startPointOnX + startPointOnZ;
                Vector3 secondPoint = firstPoint + XZGrid.ModelSpaceRightAxis * (numberOfCellsOnX * gridCellSizeSettings.CellSizeX);

                lineCubeSize.x = (firstPoint - secondPoint).magnitude + gridRenderSettings.CellLineThickness;
                Gizmos.DrawCube((firstPoint + secondPoint) * 0.5f, lineCubeSize);
            }

            // Render the grid lines which extend along the grid's Z axis
            startPointOnZ  = grid.GetCellDepthStart(minCellIndexZ);
            lineCubeSize.x = gridRenderSettings.CellLineThickness;
            maxLineIndex   = maxCellIndexX + 1;
            for (int lineIndex = minCellIndexX; lineIndex <= maxLineIndex; ++lineIndex)
            {
                startPointOnX = grid.GetCellHrzStart(lineIndex);
                Vector3 firstPoint  = startPointOnX + startPointOnZ;
                Vector3 secondPoint = firstPoint + XZGrid.ModelSpaceLookAxis * (numberOfCellsOnZ * gridCellSizeSettings.CellSizeZ);

                lineCubeSize.z = (firstPoint - secondPoint).magnitude;
                Gizmos.DrawCube((firstPoint + secondPoint) * 0.5f, lineCubeSize);
            }
            GizmosColor.Pop();
        }
コード例 #2
0
 public XZGridRenderSettingsView(XZGridRenderSettings settings)
 {
     _settings             = settings;
     VisibilityToggleLabel = "MySettings";
 }
コード例 #3
0
        private static void SaveSnapLookAndFeel(XmlTextWriter xmlWriter, Octave3DConfigSaveLoadSettings saveSettings)
        {
            if (saveSettings.SnapLookAndFeel)
            {
                XZGridRenderSettings           xzGridRenderSettings         = ObjectSnapping.Get().XZSnapGrid.RenderSettings;
                XZGridRenderSettings           objSurfaceGridRenderSettings = ObjectSnapping.Get().RenderSettingsForColliderSnapSurfaceGrid;
                CoordinateSystemRenderSettings coordSystemRenderSettings    = ObjectSnapping.Get().XZSnapGrid.RenderableCoordinateSystem.RenderSettings;

                xmlWriter.WriteNewLine(1);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.SnapLookAndFeelNode);

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.XZGridLookAndFeelNode);

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.IsXZGridVisibleNode);
                xmlWriter.WriteString(xzGridRenderSettings.IsVisible.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.XZGridCellLineColorNode);
                xmlWriter.WriteColorString(xzGridRenderSettings.CellLineColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.XZGridCellLineThicknessNode);
                xmlWriter.WriteString(xzGridRenderSettings.CellLineThickness.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.XZGridPlaneColorNode);
                xmlWriter.WriteColorString(xzGridRenderSettings.PlaneColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.XZGridCoordSystemLookAndFeelNode);

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.IsXZGridCoordSystemVisibleNode);
                xmlWriter.WriteString(coordSystemRenderSettings.IsVisible.ToString());
                xmlWriter.WriteEndElement();

                List <CoordinateSystemAxis> allAxes = CoordinateSystemAxes.GetAll();
                foreach (var axis in allAxes)
                {
                    xmlWriter.WriteNewLine(3);
                    xmlWriter.WriteStartElement(axis.ToString());

                    xmlWriter.WriteNewLine(4);
                    xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.IsXZGridCoordSystemAxisVisibleNode);
                    xmlWriter.WriteString(coordSystemRenderSettings.IsAxisVisible(axis).ToString());
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteNewLine(4);
                    xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.IsXZGridCoordSystemAxisInfiniteNode);
                    xmlWriter.WriteString(coordSystemRenderSettings.IsAxisRenderedInfinite(axis).ToString());
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteNewLine(4);
                    xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.XZGridCoordSystemAxisFiniteSizeNode);
                    xmlWriter.WriteString(coordSystemRenderSettings.GetAxisFinitSize(axis).ToString());
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteNewLine(4);
                    xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.XZGridCoordSystemAxisColorNode);
                    xmlWriter.WriteColorString(coordSystemRenderSettings.GetAxisColor(axis));
                    xmlWriter.WriteEndElement();

                    xmlWriter.WriteNewLine(3);
                    xmlWriter.WriteEndElement();
                }

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectSnapSurfaceGridLookAndFeelNode);

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.IsObjectSnapSurfaceGridVisibleNode);
                xmlWriter.WriteString(objSurfaceGridRenderSettings.IsVisible.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectSnapSurfaceGridCellLineColorNode);
                xmlWriter.WriteColorString(objSurfaceGridRenderSettings.CellLineColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectSnapSurfaceGridCellLineThicknessNode);
                xmlWriter.WriteString(objSurfaceGridRenderSettings.CellLineThickness.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(3);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectSnapSurfaceGridPlaneColorNode);
                xmlWriter.WriteColorString(objSurfaceGridRenderSettings.PlaneColor);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(1);
                xmlWriter.WriteEndElement();
            }
        }