/* * public static void DrawSelectedBrush(GeometryWireframe outline, Matrix4x4 transformation, Color wireframeColor, float thickness = -1) * { * Color selectedOuterColor = wireframeColor; * Color selectedInnerColor = wireframeColor * inner_factor; * Color selectedOuterOccludedColor = selectedOuterColor * occluded_factor; * Color selectedInnerOccludedColor = selectedInnerColor * occluded_factor; * * selectedOuterOccludedColor.a *= 0.5f; * selectedInnerOccludedColor.a *= 0.5f; * * CSGRenderer.DrawOutlines(outline, transformation, selectedOuterColor, selectedOuterOccludedColor, selectedInnerColor, selectedInnerOccludedColor, thickness); * }*/ //static readonly Color emptyColor = new Color(0, 0, 0, 0); public static void DrawSelectedBrush(Int32 brushNodeID, Shape shape, Matrix4x4 transformation, Color wireframeColor, int surfaceIndex, bool selectAllSurfaces, float thickness = -1) { if (selectAllSurfaces) { Color selectedOuterColor = wireframeColor; Color selectedInnerColor = wireframeColor; Color selectedOuterOccludedColor = selectedOuterColor * occluded_factor; Color selectedInnerOccludedColor = selectedInnerColor * occluded_factor; selectedOuterOccludedColor.a *= 0.5f; selectedInnerOccludedColor.a *= 0.5f; CSGRenderer.DrawOutlines(brushNodeID, transformation, selectedOuterColor, selectedOuterOccludedColor, selectedInnerColor, selectedInnerOccludedColor, thickness); } else { Color unselectedOuterColor = wireframeColor * unselected_factor; Color unselectedInnerColor = wireframeColor * (unselected_factor * inner_factor); Color selectedOuterColor = wireframeColor; Color selectedInnerColor = wireframeColor * inner_factor; Color unselectedOuterOccludedColor = unselectedOuterColor * occluded_factor; Color unselectedInnerOccludedColor = unselectedInnerColor * occluded_factor; // Color selectedOuterOccludedColor = selectedOuterColor * occluded_factor; // Color selectedInnerOccludedColor = selectedInnerColor * occluded_factor; unselectedOuterOccludedColor.a *= 0.5f; unselectedInnerOccludedColor.a *= 0.5f; if (surfaceIndex >= 0 && surfaceIndex < shape.Surfaces.Length) { CSGRenderer.DrawSurfaceOutlines(brushNodeID, shape, transformation, surfaceIndex, selectedOuterColor, selectedInnerColor); } CSGRenderer.DrawOutlines(brushNodeID, transformation, unselectedOuterColor, unselectedOuterOccludedColor, unselectedInnerColor, unselectedInnerOccludedColor, thickness); } }
public void OnPaint(SceneView sceneView) { if (hoverOverObject != null) { return; } if (!hoverOnSelectedSurfaces) { var activetool = EditModeManager.ActiveTool as EditModeSurface; if (activetool != null) { var selectedBrushSurfaces = activetool.GetSelectedSurfaces(); for (int i = 0; i < selectedBrushSurfaces.Length; i++) { var brush = selectedBrushSurfaces[i].brush; var highlight_surface = selectedBrushSurfaces[i].surfaceIndex; var brush_transformation = brush.compareTransformation.localToWorldMatrix; CSGRenderer.DrawSurfaceOutlines(brush.brushNodeID, brush.Shape, brush_transformation, highlight_surface, ColorSettings.SurfaceInnerStateColor[2], ColorSettings.SurfaceOuterStateColor[2], GUIConstants.oldThinLineScale); } } } if (hoverBrushSurfaces != null) { for (int i = 0; i < hoverBrushSurfaces.Length; i++) { var brush = hoverBrushSurfaces[i].brush; var brush_transformation = brush.compareTransformation.localToWorldMatrix; var highlight_surface = hoverBrushSurfaces[i].surfaceIndex; if (highlight_surface == -1 || selectAllSurfaces) { CSGRenderer.DrawSelectedBrush(brush.brushNodeID, brush.Shape, brush_transformation, ColorSettings.WireframeOutline, 0, selectAllSurfaces, GUIConstants.oldLineScale); } else { CSGRenderer.DrawSelectedBrush(brush.brushNodeID, brush.Shape, brush_transformation, ColorSettings.WireframeOutline, highlight_surface, selectAllSurfaces, GUIConstants.oldLineScale); } } } }