Comparing version 3.1.6 to 3.1.7
@@ -112,3 +112,7 @@ var __defProp = Object.defineProperty; | ||
} else { | ||
v = this.copyV3(0); | ||
v = [ | ||
this.positions[0] - (this.positions[6] - this.positions[0]), | ||
this.positions[1] - (this.positions[6 + 1] - this.positions[1]), | ||
this.positions[2] - (this.positions[6 + 2] - this.positions[2]) | ||
]; | ||
} | ||
@@ -145,7 +149,11 @@ this.previous.push(v[0], v[1], v[2]); | ||
} else { | ||
v = this.copyV3(l - 1); | ||
v = [ | ||
this.positions[l - 1] + (this.positions[l - 1] - this.positions[l - 1 - 6]), | ||
this.positions[l - 2] + (this.positions[l - 2] - this.positions[l - 2 - 6]), | ||
this.positions[l - 3] + (this.positions[l - 3] - this.positions[l - 3 - 6]) | ||
]; | ||
} | ||
this.next.push(v[0], v[1], v[2]); | ||
this.next.push(v[0], v[1], v[2]); | ||
if (!this._attributes || this._attributes.position.count !== this.positions.length) { | ||
if (!this._attributes || this._attributes.position.count !== this.counters.length) { | ||
this._attributes = { | ||
@@ -264,15 +272,10 @@ position: new THREE.BufferAttribute(new Float32Array(this.positions), 3), | ||
vec2 dir; | ||
if (nextP == currentP) dir = normalize(currentP - prevP); | ||
else if (prevP == currentP) dir = normalize(nextP - currentP); | ||
else { | ||
vec2 dir1 = normalize(currentP - prevP); | ||
vec2 dir2 = normalize(nextP - currentP); | ||
dir = normalize(dir1 + dir2); | ||
vec2 dir1 = normalize(currentP - prevP); | ||
vec2 dir2 = normalize(nextP - currentP); | ||
vec2 dir = normalize(dir1 + dir2); | ||
vec2 perp = vec2(-dir1.y, dir1.x); | ||
vec2 miter = vec2(-dir.y, dir.x); | ||
//w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width); | ||
vec2 perp = vec2(-dir1.y, dir1.x); | ||
vec2 miter = vec2(-dir.y, dir.x); | ||
//w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width); | ||
} | ||
//vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy; | ||
@@ -301,2 +304,3 @@ vec4 normal = vec4(-dir.y, dir.x, 0., 1.); | ||
uniform sampler2D alphaMap; | ||
uniform float useGradient; | ||
uniform float useMap; | ||
@@ -311,2 +315,3 @@ uniform float useAlphaMap; | ||
uniform vec2 repeat; | ||
uniform vec3 gradient[2]; | ||
@@ -320,2 +325,3 @@ varying vec2 vUV; | ||
vec4 c = vColor; | ||
if (useGradient == 1.) c = vec4(mix(gradient[0], gradient[1], vCounters), 1.0); | ||
if (useMap == 1.) c *= texture2D(map, vUV * repeat); | ||
@@ -345,2 +351,3 @@ if (useAlphaMap == 1.) c.a *= texture2D(alphaMap, vUV * repeat).a; | ||
color: { value: new THREE.Color(16777215) }, | ||
gradient: { value: [new THREE.Color(16711680), new THREE.Color(65280)] }, | ||
opacity: { value: 1 }, | ||
@@ -353,2 +360,3 @@ resolution: { value: new THREE.Vector2(1, 1) }, | ||
useDash: { value: 0 }, | ||
useGradient: { value: 0 }, | ||
visibility: { value: 1 }, | ||
@@ -367,2 +375,3 @@ alphaTest: { value: 0 }, | ||
__publicField(this, "color"); | ||
__publicField(this, "gradient"); | ||
__publicField(this, "resolution"); | ||
@@ -374,2 +383,3 @@ __publicField(this, "sizeAttenuation"); | ||
__publicField(this, "useDash"); | ||
__publicField(this, "useGradient"); | ||
__publicField(this, "visibility"); | ||
@@ -433,2 +443,11 @@ __publicField(this, "repeat"); | ||
}, | ||
gradient: { | ||
enumerable: true, | ||
get() { | ||
return this.uniforms.gradient.value; | ||
}, | ||
set(value) { | ||
this.uniforms.gradient.value = value; | ||
} | ||
}, | ||
opacity: { | ||
@@ -498,2 +517,11 @@ enumerable: true, | ||
}, | ||
useGradient: { | ||
enumerable: true, | ||
get() { | ||
return this.uniforms.useGradient.value; | ||
}, | ||
set(value) { | ||
this.uniforms.useGradient.value = value; | ||
} | ||
}, | ||
visibility: { | ||
@@ -537,2 +565,3 @@ enumerable: true, | ||
this.color.copy(source.color); | ||
this.gradient = source.gradient; | ||
this.opacity = source.opacity; | ||
@@ -545,2 +574,3 @@ this.resolution.copy(source.resolution); | ||
this.useDash = source.useDash; | ||
this.useGradient = source.useGradient; | ||
this.visibility = source.visibility; | ||
@@ -547,0 +577,0 @@ this.alphaTest = source.alphaTest; |
@@ -9,2 +9,3 @@ import * as THREE from 'three'; | ||
color?: string | THREE.Color | number; | ||
gradient?: string[] | THREE.Color[] | number[]; | ||
opacity?: number; | ||
@@ -17,2 +18,3 @@ resolution: THREE.Vector2; | ||
useDash?: number; | ||
useGradient?: number; | ||
visibility?: number; | ||
@@ -29,2 +31,3 @@ alphaTest?: number; | ||
color: THREE.Color; | ||
gradient: THREE.Color[]; | ||
opacity: number; | ||
@@ -37,2 +40,3 @@ resolution: THREE.Vector2; | ||
useDash: number; | ||
useGradient: number; | ||
visibility: number; | ||
@@ -39,0 +43,0 @@ alphaTest: number; |
{ | ||
"name": "meshline", | ||
"version": "3.1.6", | ||
"version": "3.1.7", | ||
"author": "Jaume Sanchez <the.spite@gmail.com> (https://www.clicktorelease.com)", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -112,3 +112,3 @@ # MeshLine | ||
extend({ MeshLine, MeshLineMaterial }) | ||
extend({ MeshLineGeometry, MeshLineMaterial }) | ||
@@ -115,0 +115,0 @@ function App() { |
Sorry, the diff of this file is not supported yet
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
50938
1320