@@ -217,8 +217,8 @@ class PenSkin extends Skin {
217
217
218
218
this . _drawLineOnBuffer (
219
219
penAttributes ,
220
- x0 + offset , - y0 + offset ,
221
- x1 + offset , - y1 + offset
220
+ x0 + offset , y0 + offset ,
221
+ x1 + offset , y1 + offset
222
222
) ;
223
223
224
224
this . _silhouetteDirty = true ;
@@ -297,28 +297,6 @@ class PenSkin extends Skin {
297
297
298
298
this . _renderer . enterDrawRegion ( this . _lineOnBufferDrawRegionId ) ;
299
299
300
- const diameter = penAttributes . diameter || DefaultPenAttributes . diameter ;
301
- const radius = diameter / 2 ;
302
- // Expand line bounds by sqrt(2) / 2 each side-- this ensures that all antialiased pixels
303
- // fall within the quad, even at a 45-degree diagonal
304
- const expandedRadius = radius + 1.4142135623730951 ;
305
-
306
- const lineLength = Math . hypot ( x1 - x0 , y1 - y0 ) ;
307
- const lineAngle = Math . atan2 ( y1 - y0 , x1 - x0 ) ;
308
-
309
- const halfWidth = this . _bounds . width * 0.5 ;
310
- const halfHeight = this . _bounds . height * 0.5 ;
311
-
312
- const transformMatrix = __modelMatrix ;
313
- twgl . m4 . identity ( transformMatrix ) ;
314
- // Apply view transform to matrix
315
- twgl . m4 . scale ( transformMatrix , [ 1 / halfWidth , 1 / halfHeight , 1 ] , transformMatrix ) ;
316
-
317
- twgl . m4 . translate ( transformMatrix , [ x0 , y0 , 0 ] , transformMatrix ) ;
318
- twgl . m4 . rotateZ ( transformMatrix , lineAngle , transformMatrix ) ;
319
- twgl . m4 . translate ( transformMatrix , [ - expandedRadius , - expandedRadius , 0 ] , transformMatrix ) ;
320
- twgl . m4 . scale ( transformMatrix , [ lineLength + ( expandedRadius * 2 ) , ( expandedRadius * 2 ) , 1 ] , transformMatrix ) ;
321
-
322
300
// Premultiply pen color by pen transparency
323
301
const penColor = penAttributes . color4f || DefaultPenAttributes . color4f ;
324
302
__premultipliedColor [ 0 ] = penColor [ 0 ] * penColor [ 3 ] ;
@@ -327,10 +305,9 @@ class PenSkin extends Skin {
327
305
__premultipliedColor [ 3 ] = penColor [ 3 ] ;
328
306
329
307
const uniforms = {
330
- u_modelMatrix : transformMatrix ,
331
308
u_lineColor : __premultipliedColor ,
332
- u_lineThickness : diameter ,
333
- u_penPoints : [ x0 + halfWidth , y0 + halfHeight , x1 + halfWidth , y1 + halfHeight ] ,
309
+ u_lineThickness : penAttributes . diameter || DefaultPenAttributes . diameter ,
310
+ u_penPoints : [ x0 , - y0 , x1 , - y1 ] ,
334
311
u_stageSize : this . size
335
312
} ;
336
313
0 commit comments