Explorar o código

examples/LineMaterial: add opacity in the uniforms

Louis Brunner %!s(int64=5) %!d(string=hai) anos
pai
achega
69142e75b1

+ 20 - 1
examples/js/lines/LineMaterial.js

@@ -18,7 +18,8 @@ THREE.UniformsLib.line = {
 	resolution: { value: new THREE.Vector2( 1, 1 ) },
 	dashScale: { value: 1 },
 	dashSize: { value: 1 },
-	gapSize: { value: 1 } // todo FIX - maybe change to totalSize
+	gapSize: { value: 1 }, // todo FIX - maybe change to totalSize
+	opacity: { value: 1 }
 
 };
 
@@ -346,6 +347,24 @@ THREE.LineMaterial = function ( parameters ) {
 
 		},
 
+		opacity: {
+
+			enumerable: true,
+
+			get: function () {
+
+				return this.uniforms.opacity.value;
+
+			},
+
+			set: function ( value ) {
+
+				this.uniforms.opacity.value = value;
+
+			}
+
+		},
+
 		resolution: {
 
 			enumerable: true,

+ 2 - 0
examples/jsm/lines/LineMaterial.d.ts

@@ -11,6 +11,7 @@ export interface LineMaterialParameters extends MaterialParameters {
 	dashScale?: number;
 	dashSize?: number;
 	gapSize?: number;
+	opacity?: boolean;
 	linewidth?: number;
 	resolution?: Vector2;
 }
@@ -23,6 +24,7 @@ export class LineMaterial extends ShaderMaterial {
 	dashScale: number;
 	dashSize: number;
 	gapSize: number;
+	opacity: boolean;
 	readonly isLineMaterial: true;
 	linewidth: number;
 	resolution: Vector2;

+ 20 - 1
examples/jsm/lines/LineMaterial.js

@@ -26,7 +26,8 @@ UniformsLib.line = {
 	resolution: { value: new Vector2( 1, 1 ) },
 	dashScale: { value: 1 },
 	dashSize: { value: 1 },
-	gapSize: { value: 1 } // todo FIX - maybe change to totalSize
+	gapSize: { value: 1 }, // todo FIX - maybe change to totalSize
+	opacity: { value: 1 }
 
 };
 
@@ -354,6 +355,24 @@ var LineMaterial = function ( parameters ) {
 
 		},
 
+		opacity: {
+
+			enumerable: true,
+
+			get: function () {
+
+				return this.uniforms.opacity.value;
+
+			},
+
+			set: function ( value ) {
+
+				this.uniforms.opacity.value = value;
+
+			}
+
+		},
+
 		resolution: {
 
 			enumerable: true,