static void DiscCore(ShapesBlendMode blendMode, ThicknessSpace spaceRadius, ThicknessSpace spaceThickness, bool hollow, bool sector, Vector3 pos, Quaternion rot, float radius, float thickness, Color colorInnerStart, Color colorOuterStart, Color colorInnerEnd, Color colorOuterEnd, DashStyle dashStyle = null, float angleRadStart = 0f, float angleRadEnd = 0f, ArcEndCap arcEndCaps = ArcEndCap.None) { if (sector && Mathf.Abs(angleRadEnd - angleRadStart) < 0.0001f) { return; } Material mat = ShapesMaterialUtils.GetDiscMaterial(hollow, sector)[blendMode]; ApplyGlobalProperties(mat); mat.SetFloat(ShapesMaterialUtils.propRadius, radius); mat.SetInt(ShapesMaterialUtils.propRadiusSpace, (int)spaceRadius); mat.SetInt(ShapesMaterialUtils.propAlignment, (int)Draw.DiscGeometry); if (hollow) { mat.SetInt(ShapesMaterialUtils.propThicknessSpace, (int)spaceThickness); mat.SetFloat(ShapesMaterialUtils.propThickness, thickness); mat.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode); } if (sector) { mat.SetFloat(ShapesMaterialUtils.propAngStart, angleRadStart); mat.SetFloat(ShapesMaterialUtils.propAngEnd, angleRadEnd); if (hollow) { mat.SetFloat(ShapesMaterialUtils.propRoundCaps, (int)arcEndCaps); } } mat.SetColor(ShapesMaterialUtils.propColor, colorInnerStart); mat.SetColor(ShapesMaterialUtils.propColorOuterStart, colorOuterStart); mat.SetColor(ShapesMaterialUtils.propColorInnerEnd, colorInnerEnd); mat.SetColor(ShapesMaterialUtils.propColorOuterEnd, colorOuterEnd); bool dashed = dashStyle?.size > 0f; mat.SetFloat(ShapesMaterialUtils.propDashSize, dashed ? dashStyle.GetNetAbsoluteSize(true, thickness) : 0); if (dashed) { mat.SetInt(ShapesMaterialUtils.propDashType, (int)dashStyle.type); mat.SetInt(ShapesMaterialUtils.propDashSpace, (int)dashStyle.space); mat.SetInt(ShapesMaterialUtils.propDashSnap, (int)dashStyle.snap); mat.SetFloat(ShapesMaterialUtils.propDashOffset, dashStyle.offset); mat.SetFloat(ShapesMaterialUtils.propDashSpacing, dashStyle.GetNetAbsoluteSpacing(true, thickness)); } DrawMesh(pos, rot, ShapesMeshUtils.QuadMesh, mat); }
static void ApplyDashSettings(Material mat, DashStyle style, float thickness, bool useType = true) { bool dashed = style?.size > 0f; mat.SetFloat(ShapesMaterialUtils.propDashSize, dashed ? style.GetNetAbsoluteSize(true, thickness) : 0); if (dashed) { if (useType) { mat.SetInt(ShapesMaterialUtils.propDashType, (int)style.type); if (style.type.HasModifier()) { mat.SetInt(ShapesMaterialUtils.propDashShapeModifier, (int)style.shapeModifier); } } mat.SetInt(ShapesMaterialUtils.propDashSpace, (int)style.space); mat.SetInt(ShapesMaterialUtils.propDashSnap, (int)style.snap); mat.SetFloat(ShapesMaterialUtils.propDashOffset, style.offset); mat.SetFloat(ShapesMaterialUtils.propDashSpacing, style.GetNetAbsoluteSpacing(true, thickness)); } }
[OvldGenCallTarget] public static void Line([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode, [OvldDefault(nameof(LineGeometry))] LineGeometry geometry, [OvldDefault(nameof(LineEndCaps))] LineEndCap endCaps, [OvldDefault(nameof(LineThicknessSpace))] ThicknessSpace thicknessSpace, Vector3 start, Vector3 end, [OvldDefault(nameof(Color))] Color colorStart, [OvldDefault(nameof(Color))] Color colorEnd, [OvldDefault(nameof(LineThickness))] float thickness, [OvldDefault(nameof(LineDashStyle))] DashStyle dashStyle = null) { Material mat = ShapesMaterialUtils.GetLineMat(geometry, endCaps)[blendMode]; ApplyGlobalProperties(mat); mat.SetColor(ShapesMaterialUtils.propColor, colorStart); mat.SetColor(ShapesMaterialUtils.propColorEnd, colorEnd); mat.SetVector(ShapesMaterialUtils.propPointStart, start); mat.SetVector(ShapesMaterialUtils.propPointEnd, end); mat.SetFloat(ShapesMaterialUtils.propThickness, thickness); mat.SetInt(ShapesMaterialUtils.propAlignment, (int)geometry); mat.SetInt(ShapesMaterialUtils.propThicknessSpace, (int)thicknessSpace); mat.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode); bool dashed = dashStyle?.size > 0f; mat.SetFloat(ShapesMaterialUtils.propDashSize, dashed ? dashStyle.GetNetAbsoluteSize(true, thickness) : 0); if (dashed) { if (geometry != LineGeometry.Volumetric3D) { mat.SetInt(ShapesMaterialUtils.propDashType, (int)dashStyle.type); } mat.SetInt(ShapesMaterialUtils.propDashSpace, (int)dashStyle.space); mat.SetInt(ShapesMaterialUtils.propDashSnap, (int)dashStyle.snap); mat.SetFloat(ShapesMaterialUtils.propDashOffset, dashStyle.offset); mat.SetFloat(ShapesMaterialUtils.propDashSpacing, dashStyle.GetNetAbsoluteSpacing(true, thickness)); } DrawMesh(Vector3.zero, Quaternion.identity, ShapesMeshUtils.GetLineMesh(geometry, endCaps), mat); }