@@ -95,16 +95,6 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
9595
9696 private var activeOutlineId: Int? = null
9797
98- fun withOutline (style : OutlineStyle , block : RenderBuilder .() -> Unit ) {
99- val previousId = activeOutlineId
100- activeOutlineId = collector.registerCustomOutline(style, depthTest = depthTest)
101- try {
102- block()
103- } finally {
104- activeOutlineId = previousId
105- }
106- }
107-
10898 fun box (
10999 box : Box ,
110100 lineConfig : LineConfig ? = null,
@@ -171,7 +161,7 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
171161 fun lineGradient (
172162 startPos : Vec3d , startColor : Color ,
173163 endPos : Vec3d , endColor : Color ,
174- width : Float ,
164+ width : Float = -0.0005f ,
175165 dashStyle : LineDashStyle ? = null
176166 ) = lineGradient(
177167 startPos.x, startPos.y, startPos.z, startColor,
@@ -183,22 +173,22 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
183173 fun lineGradient (
184174 x1 : Double , y1 : Double , z1 : Double , c1 : Color ,
185175 x2 : Double , y2 : Double , z2 : Double , c2 : Color ,
186- width : Float ,
176+ width : Float = -0.0005f ,
187177 dashStyle : LineDashStyle ? = null
188178 ) = line(x1, y1, z1, x2, y2, z2, c1, c2, width, dashStyle)
189179
190180 fun line (
191181 start : Vec3d ,
192182 end : Vec3d ,
193183 color : Color ,
194- width : Float ,
184+ width : Float = -0.0005f ,
195185 dashStyle : LineDashStyle ? = null
196186 ) = line(start.x, start.y, start.z, end.x, end.y, end.z, color, color, width, dashStyle)
197187
198188 fun polyline (
199189 points : List <Vec3d >,
200190 color : Color ,
201- width : Float ,
191+ width : Float = -0.0005f ,
202192 dashStyle : LineDashStyle ? = null
203193 ) {
204194 if (points.size < 2 ) return
@@ -213,7 +203,7 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
213203 p2 : Vec3d ,
214204 color : Color ,
215205 segments : Int = 16,
216- width : Float ,
206+ width : Float = -0.0005f ,
217207 dashStyle : LineDashStyle ? = null
218208 ) {
219209 val points = CurveUtils .quadraticBezierPoints(p0, p1, p2, segments)
@@ -227,7 +217,7 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
227217 p3 : Vec3d ,
228218 color : Color ,
229219 segments : Int = 32,
230- width : Float ,
220+ width : Float = -0.0005f ,
231221 dashStyle : LineDashStyle ? = null
232222 ) {
233223 val points = CurveUtils .cubicBezierPoints(p0, p1, p2, p3, segments)
@@ -238,7 +228,7 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
238228 controlPoints : List <Vec3d >,
239229 color : Color ,
240230 segmentsPerSection : Int = 16,
241- width : Float ,
231+ width : Float = -0.0005f ,
242232 dashStyle : LineDashStyle ? = null
243233 ) {
244234 val points = CurveUtils .catmullRomSplinePoints(controlPoints, segmentsPerSection)
@@ -249,13 +239,39 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
249239 waypoints : List <Vec3d >,
250240 color : Color ,
251241 segmentsPerSection : Int = 16,
252- width : Float ,
242+ width : Float = -0.0005f ,
253243 dashStyle : LineDashStyle ? = null
254244 ) {
255245 val points = CurveUtils .smoothPath(waypoints, segmentsPerSection)
256246 polyline(points, color, width, dashStyle)
257247 }
258248
249+ fun circleLine (
250+ center : Vec3d ,
251+ radius : Double ,
252+ normal : Vec3d = Vec3d (0.0, 1.0, 0.0),
253+ color : Color ,
254+ segments : Int = 32,
255+ width : Float = -0.0005f,
256+ dashStyle : LineDashStyle ? = null
257+ ) {
258+ val up =
259+ if (kotlin.math.abs(normal.y) < 0.99 ) Vec3d (0.0 , 1.0 , 0.0 )
260+ else Vec3d (1.0 , 0.0 , 0.0 )
261+ val u = normal.crossProduct(up).normalize()
262+ val v = u.crossProduct(normal).normalize()
263+
264+ val points =
265+ (0 .. segments).map { i ->
266+ val angle = 2.0 * Math .PI * i / segments
267+ val x = cos(angle) * radius
268+ val y = sin(angle) * radius
269+ center.add(u.multiply(x)).add(v.multiply(y))
270+ }
271+
272+ polyline(points, color, width, dashStyle)
273+ }
274+
259275 @JvmName(" worldOutline1" )
260276 fun worldOutline (
261277 entity : Entity ,
@@ -284,30 +300,14 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
284300 OutlineManager .setBlockOutline(it, style, depthTest = depthTest)
285301 }
286302
287- fun circleLine (
288- center : Vec3d ,
289- radius : Double ,
290- normal : Vec3d = Vec3d (0.0, 1.0, 0.0),
291- color : Color ,
292- segments : Int = 32,
293- width : Float ,
294- dashStyle : LineDashStyle ? = null
295- ) {
296- val up =
297- if (kotlin.math.abs(normal.y) < 0.99 ) Vec3d (0.0 , 1.0 , 0.0 )
298- else Vec3d (1.0 , 0.0 , 0.0 )
299- val u = normal.crossProduct(up).normalize()
300- val v = u.crossProduct(normal).normalize()
301-
302- val points =
303- (0 .. segments).map { i ->
304- val angle = 2.0 * Math .PI * i / segments
305- val x = cos(angle) * radius
306- val y = sin(angle) * radius
307- center.add(u.multiply(x)).add(v.multiply(y))
308- }
309-
310- polyline(points, color, width, dashStyle)
303+ fun withOutline (style : OutlineStyle , block : RenderBuilder .() -> Unit ) {
304+ val previousId = activeOutlineId
305+ activeOutlineId = collector.registerCustomOutline(style, depthTest = depthTest)
306+ try {
307+ block()
308+ } finally {
309+ activeOutlineId = previousId
310+ }
311311 }
312312
313313 fun worldText (
@@ -1462,7 +1462,7 @@ class RenderBuilder(private val cameraPos: Vec3d, var depthTest: Boolean = false
14621462 x2 : Double , y2 : Double , z2 : Double ,
14631463 color1 : Color ,
14641464 color2 : Color ,
1465- width : Float ,
1465+ width : Float = -0.0005f ,
14661466 dashStyle : LineDashStyle ? = null
14671467 ) {
14681468 val rx1 = (x1 - cameraPos.x).toFloat()
0 commit comments