Material getters and setters

This commit is contained in:
Szymon Nowakowski 2023-08-06 21:47:05 +02:00
parent 3ca88ca9bf
commit 256e5db1c7
1 changed files with 72 additions and 2 deletions

View File

@ -7,8 +7,6 @@
import { Color, ColorObject } from ".";
import { Texture2D } from "../resources";
export const UNIFORM_BUFFER_SIZE = 64;
export interface MaterialProps {
name?: string;
@ -105,6 +103,78 @@ export class Material {
this._transparent = transparent;
this._doubleSided = doubleSided;
}
set name(value: string) { this._name = value; }
get name(): string { return this._name; }
setBaseColor(value: ColorObject): Material {
this._baseColor.setObject(value);
return this;
}
getBaseColor(res: Color): Color {
return res.setObject(this._baseColor);
}
set partialCoverage(value: number) { this._partialCoverage = value; }
get partialCoverage(): number { return this._partialCoverage; }
set occlusionTextureStrength(value: number) { this._occlusionTextureStrength = value; }
get occlusionTextureStrength(): number { return this._occlusionTextureStrength; }
set metallic(value: number) { this._metallic = value; }
get metallic(): number { return this._metallic; }
set roughness(value: number) { this._roughness = value; }
get roughness(): number { return this._roughness; }
set normalScale(value: number) { this._normalScale = value; }
get normalScale(): number { return this._normalScale; }
setEmissive(value: ColorObject): Material {
this._emissive.setObject(value);
return this;
}
getEmissive(res: Color): Color {
return res.setObject(this._emissive);
}
setTransmission(value: ColorObject): Material {
this._transmission.setObject(value);
return this;
}
getTransmission(res: Color): Color {
return res.setObject(this._transmission);
}
set collimation(value: number) { this._collimation = value; }
get collimation(): number { return this._collimation; }
set ior(value: number) { this._ior = value; }
get ior(): number { return this._ior; }
set baseColorPartialCoverageTexture(value: Texture2D | null) { this._baseColorPartialCoverageTexture = value;}
get baseColorPartialCoverageTexture(): Texture2D | null { return this._baseColorPartialCoverageTexture; }
set occlusionTexture(value: Texture2D | null) { this._occlusionTexture = value;}
get occlusionTexture(): Texture2D | null { return this._occlusionTexture; }
set roughnessMetallicTexture(value: Texture2D | null) { this._roughnessMetallicTexture = value;}
get roughnessMetallicTexture(): Texture2D | null { return this._roughnessMetallicTexture; }
set normalTexture(value: Texture2D | null) { this._normalTexture = value;}
get normalTexture(): Texture2D | null { return this._normalTexture; }
set emissiveTexture(value: Texture2D | null) { this._emissiveTexture = value;}
get emissiveTexture(): Texture2D | null { return this._emissiveTexture; }
set transmissionCollimationTexture(value: Texture2D | null) { this._transmissionCollimationTexture = value;}
get transmissionCollimationTexture(): Texture2D | null { return this._transmissionCollimationTexture; }
set transparent(value: boolean) { this._transparent = value; }
get transparent(): boolean { return this._transparent; }
set doubleSided(value: boolean) { this._doubleSided = value; }
get doubleSided(): boolean { return this._doubleSided; }
}
Object.defineProperty(Material.prototype, "type", { value: "Material" });