Shihuidev (#932)

* feat: 完善 demo

* style: lint style

* feat: adjust demo

* style: lint style
This commit is contained in:
YiQianYao 2022-01-13 15:37:21 +08:00 committed by GitHub
parent 2a20cd4c23
commit c4942e9c7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 10 deletions

View File

@ -108,7 +108,6 @@ export default class SimpleLineModel extends BaseModel {
]; ];
} }
protected registerBuiltinAttributes() { protected registerBuiltinAttributes() {
const c = 0;
this.styleAttributeService.registerStyleAttribute({ this.styleAttributeService.registerStyleAttribute({
name: 'distance', name: 'distance',
type: AttributeType.Attribute, type: AttributeType.Attribute,

View File

@ -25,7 +25,6 @@ void main() {
} else { // 使用 color 方法传入的颜色 } else { // 使用 color 方法传入的颜色
gl_FragColor = v_color; gl_FragColor = v_color;
} }
// anti-alias // anti-alias
// float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy)); // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
gl_FragColor.a *= opacity; // 全局透明度 gl_FragColor.a *= opacity; // 全局透明度

View File

@ -237,8 +237,7 @@ export default class ExtrudePolyline {
this.started = false; this.started = false;
this.normal = null; this.normal = null;
this.totalDistance = 0; this.totalDistance = 0;
// 去除数组里重复的点
// points = getArrayUnique(points);
const total = points.length; const total = points.length;
let count = complex.startIndex; let count = complex.startIndex;
for (let i = 1; i < total; i++) { for (let i = 1; i < total; i++) {
@ -248,6 +247,7 @@ export default class ExtrudePolyline {
const amt = this.simpleSegment(complex, count, last, cur, next as vec3); const amt = this.simpleSegment(complex, count, last, cur, next as vec3);
count += amt; count += amt;
} }
if (this.dash) { if (this.dash) {
for (let i = 0; i < complex.positions.length / 6; i++) { for (let i = 0; i < complex.positions.length / 6; i++) {
complex.positions[i * 6 + 5] = this.totalDistance; complex.positions[i * 6 + 5] = this.totalDistance;
@ -483,7 +483,6 @@ export default class ExtrudePolyline {
} }
return count; return count;
} }
private simpleSegment( private simpleSegment(
complex: any, complex: any,
index: number, index: number,
@ -513,8 +512,6 @@ export default class ExtrudePolyline {
if (!this.started) { if (!this.started) {
this.started = true; this.started = true;
// if the end cap is type square, we can just push the verts out a bit
this.extrusions( this.extrusions(
positions, positions,
normals, normals,
@ -529,7 +526,6 @@ export default class ExtrudePolyline {
if (!next) { if (!next) {
computeNormal(this.normal, lineA); computeNormal(this.normal, lineA);
this.extrusions( this.extrusions(
positions, positions,
normals, normals,
@ -539,7 +535,6 @@ export default class ExtrudePolyline {
this.totalDistance, this.totalDistance,
); );
// this.extrusions(positions, normals, cur, this.normal, this.thickness);
indices.push( indices.push(
...(this.lastFlip === 1 ...(this.lastFlip === 1
? [index, index + 2, index + 3] ? [index, index + 2, index + 3]
@ -589,7 +584,6 @@ export default class ExtrudePolyline {
// the miter is now the normal for our next join // the miter is now the normal for our next join
vec2.copy(this.normal, miter); vec2.copy(this.normal, miter);
count += 2; count += 2;
this.lastFlip = flip; this.lastFlip = flip;
} }
return count; return count;