Example #1
0
        internal static void OnPaint(SceneView sceneView)
        {
            SceneDragToolManager.OnPaint();

            if (sceneView == null ||
                Event.current.type != EventType.Repaint)
            {
                return;
            }

            if (RealtimeCSG.CSGSettings.GridVisible)
            {
                RealtimeCSG.CSGGrid.RenderGrid();
            }

            if (RealtimeCSG.CSGSettings.IsWireframeShown(sceneView))
            {
                if (forceOutlineUpdate || meshGeneration != InternalCSGModelManager.MeshGeneration)
                {
                    forceOutlineUpdate = false;
                    meshGeneration     = InternalCSGModelManager.MeshGeneration;
                    lineMeshManager.Begin();
                    for (int i = 0; i < InternalCSGModelManager.Brushes.Length; i++)
                    {
                        var brush = InternalCSGModelManager.Brushes[i];
                        if (!brush)
                        {
                            continue;
                        }

                        var brush_cache = InternalCSGModelManager.GetBrushCache(brush);
                        if (brush_cache == null)
                        {
                            continue;
                        }

                        if (!brush.outlineColor.HasValue)
                        {
                            brush.outlineColor = ColorSettings.GetBrushOutlineColor(brush);
                        }

                        var brush_translation = brush_cache.compareTransformation.modelLocalPosition +
                                                brush_cache.childData.ModelTransform.position;
                        CSGRenderer.DrawSimpleOutlines(lineMeshManager, brush.brushID, brush_translation, brush.outlineColor.Value);
                    }
                    lineMeshManager.End();
                }

                MaterialUtility.LineDashMultiplier      = 1.0f;
                MaterialUtility.LineThicknessMultiplier = 1.0f;
                MaterialUtility.LineAlphaMultiplier     = 1.0f;
                lineMeshManager.Render(MaterialUtility.NoZTestGenericLine);
            }
        }
Example #2
0
        internal static void OnPaint(SceneView sceneView)
        {
            if (!sceneView)
            {
                return;
            }

            var camera = sceneView.camera;

            SceneDragToolManager.OnPaint(camera);

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            if (RealtimeCSG.CSGSettings.GridVisible)
            {
                RealtimeCSG.CSGGrid.RenderGrid(camera);
            }

            if (RealtimeCSG.CSGSettings.IsWireframeShown(sceneView))
            {
                if (forceOutlineUpdate || meshGeneration != InternalCSGModelManager.MeshGeneration)
                {
                    forceOutlineUpdate = false;
                    meshGeneration     = InternalCSGModelManager.MeshGeneration;
                    lineMeshManager.Begin();
                    for (int i = 0; i < InternalCSGModelManager.Brushes.Count; i++)
                    {
                        var brush = InternalCSGModelManager.Brushes[i];
                        if (!brush)
                        {
                            continue;
                        }

                        if (!brush.outlineColor.HasValue)
                        {
                            brush.outlineColor = ColorSettings.GetBrushOutlineColor(brush);
                        }

                        var brush_transformation = brush.compareTransformation.localToWorldMatrix;
                        CSGRenderer.DrawSimpleOutlines(lineMeshManager, brush.brushNodeID, brush_transformation, brush.outlineColor.Value);
                    }
                    lineMeshManager.End();
                }

                MaterialUtility.LineDashMultiplier      = 1.0f;
                MaterialUtility.LineThicknessMultiplier = 1.0f;
                MaterialUtility.LineAlphaMultiplier     = 1.0f;
                lineMeshManager.Render(MaterialUtility.NoZTestGenericLine);
            }
        }
Example #3
0
        internal static void OnPaint(SceneView sceneView)
        {
            if (!sceneView)
            {
                return;
            }

            SceneDragToolManager.OnPaint(sceneView);

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            if (RealtimeCSG.CSGSettings.GridVisible)
            {
                sceneView.showGrid = false;
                RealtimeCSG.CSGGrid.RenderGrid(sceneView);
            }

            if (RealtimeCSG.CSGSettings.IsWireframeShown(sceneView))
            {
                if (forceOutlineUpdate || meshGeneration != InternalCSGModelManager.MeshGeneration)
                {
                    forceOutlineUpdate = false;
                    meshGeneration     = InternalCSGModelManager.MeshGeneration;
                    lineMeshManager.Begin();
                    for (int i = 0; i < InternalCSGModelManager.Brushes.Count; i++)
                    {
                        var brush = InternalCSGModelManager.Brushes[i];

                        if (!brush)
                        {
                            continue;
                        }

                        //if (!brush.outlineColor.HasValue)
                        //                  {
                        //	//brush.outlineColor = ColorSettings.GetBrushOutlineColor(brush);
                        //	brush.outlineColor = ColorSettings.SimpleOutlineColor;
                        //}

                        var color      = Color.white;
                        var comparison = brush.OperationType;
                        var op         = brush.GetComponentInParent <CSGOperation>();
                        if (op)
                        {
                            comparison = op.OperationType;
                        }
                        switch (comparison)
                        {
                        case Foundation.CSGOperationType.Additive:
                            color = ColorSettings.SimpleOutlineAdditiveColor;
                            break;

                        case Foundation.CSGOperationType.Subtractive:
                            color = ColorSettings.SimpleOutlineSubtractiveColor;
                            break;

                        case Foundation.CSGOperationType.Intersecting:
                            color = ColorSettings.SimpleOutlineIntersectingColor;
                            break;
                        }

                        var brushTransformation = brush.compareTransformation.localToWorldMatrix;
                        CSGRenderer.DrawSimpleOutlines(lineMeshManager, brush.brushNodeID, brushTransformation, color);
                        CSGRenderer.DrawPolygonCenters(lineMeshManager, brush);
                    }
                    lineMeshManager.End();
                }

                MaterialUtility.LineDashMultiplier      = 1.0f;
                MaterialUtility.LineThicknessMultiplier = 1.0f;
                MaterialUtility.LineAlphaMultiplier     = 1.0f;
                lineMeshManager.Render(MaterialUtility.NoZTestGenericLine);
            }
        }