public constructor()

in packages/sdk/src/asset/material.ts [214:255]


	public constructor(container: AssetContainer, def: AssetLike) {
		super(container, def);

		if (!def.material) {
			throw new Error("Cannot construct material from non-material definition");
		}

		this.copy(def);

		// material patching: observe the nested material properties
		// for changed values, and write them to a patch
		observe({
			target: this._color,
			targetName: 'color',
			notifyChanged: (...path: string[]) => this.materialChanged(...path)
		});
		observe({
			target: this._mainTextureOffset,
			targetName: 'mainTextureOffset',
			notifyChanged: (...path: string[]) => this.materialChanged(...path)
		});
		observe({
			target: this._mainTextureScale,
			targetName: 'mainTextureScale',
			notifyChanged: (...path: string[]) => this.materialChanged(...path)
		});
		observe({
			target: this._emissiveColor,
			targetName: 'emissiveColor',
			notifyChanged: (...path: string[]) => this.materialChanged(...path)
		});
		observe({
			target: this._emissiveTextureOffset,
			targetName: 'emissiveTextureOffset',
			notifyChanged: (...path: string[]) => this.materialChanged(...path)
		});
		observe({
			target: this._emissiveTextureScale,
			targetName: 'emissiveTextureScale',
			notifyChanged: (...path: string[]) => this.materialChanged(...path)
		});
	}