Browse Source

Merge pull request #18135 from bastienrobert/material-define-types

Material define types
Mr.doob 5 years ago
parent
commit
3ff792c42e

+ 7 - 0
src/materials/Material.d.ts

@@ -30,6 +30,7 @@ export interface MaterialParameters {
 	clippingPlanes?: Plane[];
 	clipShadows?: boolean;
 	colorWrite?: boolean;
+	defines?: any;
 	depthFunc?: DepthModes;
 	depthTest?: boolean;
 	depthWrite?: boolean;
@@ -126,6 +127,12 @@ export class Material extends EventDispatcher {
 	 */
 	colorWrite: boolean;
 
+	/**
+	 * Custom defines to be injected into the shader. These are passed in form of an object literal, with key/value pairs. { MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }.
+	 * The pairs are defined in both vertex and fragment shaders. Default is undefined.
+	 */
+	defines: any;
+
 	/**
 	 * Which depth function to use. Default is {@link LessEqualDepth}. See the depth mode constants for all possible values.
 	 */

+ 0 - 1
src/materials/MeshPhysicalMaterial.d.ts

@@ -22,7 +22,6 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial {
 
 	constructor( parameters: MeshPhysicalMaterialParameters );
 
-	defines: any;
 	reflectivity: number;
 	clearcoat: number;
 	clearcoatRoughness: number;

+ 0 - 1
src/materials/MeshStandardMaterial.d.ts

@@ -41,7 +41,6 @@ export class MeshStandardMaterial extends Material {
 
 	constructor( parameters?: MeshStandardMaterialParameters );
 
-	defines: any;
 	color: Color;
 	roughness: number;
 	metalness: number;

+ 0 - 2
src/materials/ShaderMaterial.d.ts

@@ -12,7 +12,6 @@ import { MaterialParameters, Material } from './Material';
  */
 
 export interface ShaderMaterialParameters extends MaterialParameters {
-	defines?: any;
 	uniforms?: any;
 	vertexShader?: string;
 	fragmentShader?: string;
@@ -36,7 +35,6 @@ export class ShaderMaterial extends Material {
 
 	constructor( parameters?: ShaderMaterialParameters );
 
-	defines: any;
 	uniforms: { [uniform: string]: IUniform };
 	vertexShader: string;
 	fragmentShader: string;