Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
namespace TSE {
export class Material {
private _name: string;
private _diffuseTextureName: string;
private _diffuseTexture: Texture;
private _tint: Color;
public constructor(name: string, diffuseTextureName: string, tint: Color = Color.white) {
this._name = name;
this._diffuseTextureName = diffuseTextureName;
this._tint = tint;
if (this._diffuseTextureName !== undefined)
this._diffuseTexture = TextureManager.getTexture(this._diffuseTextureName);
}
public get name(): string { return this._name; }
public get diffuseTextureName(): string { return this._diffuseTextureName; }
public get diffuseTexture(): Texture { return this._diffuseTexture; }
public get tint(): Color { return this._tint; }
public set diffuseTextureName(value: string) {
if (this._diffuseTexture !== undefined)
TextureManager.releaseTexture(this._diffuseTextureName);
if (value === undefined) return;
this.diffuseTextureName = value;
this._diffuseTexture = TextureManager.getTexture(this._diffuseTextureName);
}
public destroy(): void {
TextureManager.releaseTexture(this._diffuseTextureName);
this._diffuseTexture = undefined;
}
}
}