Skip to content

Commit

Permalink
LineMaterial: Clean up (mrdoob#26720)
Browse files Browse the repository at this point in the history
* LineMaterial: Clean up

* Workaround setting parameters in Material and ShaderMaterial

* Fix
  • Loading branch information
LeviPesin authored Sep 14, 2023
1 parent f98f680 commit e6304f3
Showing 1 changed file with 90 additions and 156 deletions.
246 changes: 90 additions & 156 deletions examples/jsm/lines/LineMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,247 +453,181 @@ class LineMaterial extends ShaderMaterial {

this.isLineMaterial = true;

Object.defineProperties( this, {

color: {

enumerable: true,

get: function () {

return this.uniforms.diffuse.value;

},

set: function ( value ) {

this.uniforms.diffuse.value = value;

}

},

worldUnits: {

enumerable: true,

get: function () {

return 'WORLD_UNITS' in this.defines;

},

set: function ( value ) {

if ( value === true ) {

this.defines.WORLD_UNITS = '';

} else {

delete this.defines.WORLD_UNITS;

}

}

},

linewidth: {

enumerable: true,

get: function () {

return this.uniforms.linewidth.value;

},

set: function ( value ) {

this.uniforms.linewidth.value = value;

}

},

dashed: {

enumerable: true,
this.setValues( parameters );

get: function () {
}

return Boolean( 'USE_DASH' in this.defines );
get color() {

},
return this.uniforms.diffuse.value;

set( value ) {
}

if ( Boolean( value ) !== Boolean( 'USE_DASH' in this.defines ) ) {
set color( value ) {

this.needsUpdate = true;
this.uniforms.diffuse.value = value;

}
}

if ( value === true ) {
get worldUnits() {

this.defines.USE_DASH = '';
return 'WORLD_UNITS' in this.defines;

} else {
}

delete this.defines.USE_DASH;
set worldUnits( value ) {

}

}
if ( value === true ) {

},
this.defines.WORLD_UNITS = '';

dashScale: {
} else {

enumerable: true,
delete this.defines.WORLD_UNITS;

get: function () {
}

return this.uniforms.dashScale.value;
}

},
get linewidth() {

set: function ( value ) {
return this.uniforms.linewidth.value;

this.uniforms.dashScale.value = value;
}

}
set linewidth( value ) {

},
if ( ! this.uniforms.linewidth ) return;
this.uniforms.linewidth.value = value;

dashSize: {
}

enumerable: true,
get dashed() {

get: function () {
return 'USE_DASH' in this.defines;

return this.uniforms.dashSize.value;
}

},
set dashed( value ) {

set: function ( value ) {
if ( ( value === true ) !== this.dashed ) {

this.uniforms.dashSize.value = value;
this.needsUpdate = true;

}
}

},
if ( value === true ) {

dashOffset: {
this.defines.USE_DASH = '';

enumerable: true,
} else {

get: function () {
delete this.defines.USE_DASH;

return this.uniforms.dashOffset.value;
}

},
}

set: function ( value ) {
get dashScale() {

this.uniforms.dashOffset.value = value;
return this.uniforms.dashScale.value;

}
}

},
set dashScale( value ) {

gapSize: {
this.uniforms.dashScale.value = value;

enumerable: true,
}

get: function () {
get dashSize() {

return this.uniforms.gapSize.value;
return this.uniforms.dashSize.value;

},
}

set: function ( value ) {
set dashSize( value ) {

this.uniforms.gapSize.value = value;
this.uniforms.dashSize.value = value;

}
}

},
get dashOffset() {

opacity: {
return this.uniforms.dashOffset.value;

enumerable: true,
}

get: function () {
set dashOffset( value ) {

return this.uniforms.opacity.value;
this.uniforms.dashOffset.value = value;

},
}

set: function ( value ) {
get gapSize() {

this.uniforms.opacity.value = value;
return this.uniforms.gapSize.value;

}
}

},
set gapSize( value ) {

resolution: {
this.uniforms.gapSize.value = value;

enumerable: true,
}

get: function () {
get opacity() {

return this.uniforms.resolution.value;
return this.uniforms.opacity.value;

},
}

set: function ( value ) {
set opacity( value ) {

this.uniforms.resolution.value.copy( value );
if ( ! this.uniforms ) return;
this.uniforms.opacity.value = value;

}
}

},
get resolution() {

alphaToCoverage: {
return this.uniforms.resolution.value;

enumerable: true,
}

get: function () {
set resolution( value ) {

return Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines );
this.uniforms.resolution.value.copy( value );

},
}

set: function ( value ) {
get alphaToCoverage() {

if ( Boolean( value ) !== Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines ) ) {
return 'USE_ALPHA_TO_COVERAGE' in this.defines;

this.needsUpdate = true;
}

}
set alphaToCoverage( value ) {

if ( value === true ) {
if ( ! this.defines ) return;

this.defines.USE_ALPHA_TO_COVERAGE = '';
this.extensions.derivatives = true;
if ( ( value === true ) !== this.alphaToCoverage ) {

} else {
this.needsUpdate = true;

delete this.defines.USE_ALPHA_TO_COVERAGE;
this.extensions.derivatives = false;
}

}
if ( value === true ) {

}
this.defines.USE_ALPHA_TO_COVERAGE = '';
this.extensions.derivatives = true;

}
} else {

} );
delete this.defines.USE_ALPHA_TO_COVERAGE;
this.extensions.derivatives = false;

this.setValues( parameters );
}

}

Expand Down

0 comments on commit e6304f3

Please sign in to comment.