three.meshline
Advanced tools
Comparing version 1.0.3 to 1.1.0
{ | ||
"name": "three.meshline", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Mesh replacement for THREE.Line", | ||
@@ -5,0 +5,0 @@ "main": "src/THREE.MeshLine.js", |
@@ -28,3 +28,3 @@ # MeshLine | ||
#### Include the script | ||
#### Include the script #### | ||
@@ -79,3 +79,3 @@ Include script after THREE is included | ||
```js | ||
var material = new MeshLineMaterial(); | ||
var material = new MeshLineMaterial(OPTIONS); | ||
``` | ||
@@ -95,3 +95,5 @@ | ||
* ```alphaTest``` - cutoff value from 0 to 1 | ||
* ```dashArray``` - THREE.Vector2 to define the dashing (NOT IMPLEMENTED YET) | ||
* ```dashArray``` - the length and space between dashes. (0 - no dash) | ||
* ```dashOffset``` - defines the location where the dash will begin. Ideal to animate the line. | ||
* ```dashRatio``` - defines the ratio between that is visible or not (0 - more visible, 1 - more invisible). | ||
* ```resolution``` - ```THREE.Vector2``` specifying the canvas size (REQUIRED) | ||
@@ -118,3 +120,2 @@ * ```sizeAttenuation``` - makes the line width constant regardless distance (1 unit is 1px on screen) (0 - attenuate, 1 - don't attenuate) | ||
* Proper sizes | ||
* Support for dashArray | ||
@@ -121,0 +122,0 @@ ### Support ### |
@@ -11,3 +11,3 @@ ;(function() { | ||
if( !THREE ) | ||
throw new Error( 'EquirectangularToCubemap requires three.js' ) | ||
throw new Error( 'MeshLine requires three.js' ) | ||
@@ -342,3 +342,5 @@ function MeshLine() { | ||
'uniform float useDash;', | ||
'uniform vec2 dashArray;', | ||
'uniform float dashArray;', | ||
'uniform float dashOffset;', | ||
'uniform float dashRatio;', | ||
'uniform float visibility;', | ||
@@ -357,8 +359,8 @@ 'uniform float alphaTest;', | ||
' if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;', | ||
' if( c.a < alphaTest ) discard;', | ||
' if( useDash == 1. ){', | ||
' ', | ||
' }', | ||
' if( c.a < alphaTest ) discard;', | ||
' if( useDash == 1. ){', | ||
' c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));', | ||
' }', | ||
' gl_FragColor = c;', | ||
' gl_FragColor.a *= step(vCounters,visibility);', | ||
' gl_FragColor.a *= step(vCounters, visibility);', | ||
'}' ]; | ||
@@ -386,4 +388,6 @@ | ||
this.far = check( parameters.far, 1 ); | ||
this.dashArray = check( parameters.dashArray, [] ); | ||
this.useDash = ( this.dashArray !== [] ) ? 1 : 0; | ||
this.dashArray = check( parameters.dashArray, 0 ); | ||
this.dashOffset = check( parameters.dashOffset, 0 ); | ||
this.dashRatio = check( parameters.dashRatio, 0.5 ); | ||
this.useDash = ( this.dashArray !== 0 ) ? 1 : 0; | ||
this.visibility = check( parameters.visibility, 1 ); | ||
@@ -406,3 +410,5 @@ this.alphaTest = check( parameters.alphaTest, 0 ); | ||
far: { type: 'f', value: this.far }, | ||
dashArray: { type: 'v2', value: new THREE.Vector2( this.dashArray[ 0 ], this.dashArray[ 1 ] ) }, | ||
dashArray: { type: 'f', value: this.dashArray }, | ||
dashOffset: { type: 'f', value: this.dashOffset }, | ||
dashRatio: { type: 'f', value: this.dashRatio }, | ||
useDash: { type: 'f', value: this.useDash }, | ||
@@ -429,2 +435,4 @@ visibility: {type: 'f', value: this.visibility}, | ||
delete parameters.dashArray; | ||
delete parameters.dashOffset; | ||
delete parameters.dashRatio; | ||
delete parameters.visibility; | ||
@@ -461,2 +469,4 @@ delete parameters.alphaTest; | ||
this.dashArray.copy( source.dashArray ); | ||
this.dashOffset.copy( source.dashOffset ); | ||
this.dashRatio.copy( source.dashRatio ); | ||
this.useDash = source.useDash; | ||
@@ -484,2 +494,1 @@ this.visibility = source.visibility; | ||
}).call(this); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22000
413
139