forked from Orillusion/orillusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UnLitMaterial.ts
59 lines (52 loc) · 1.33 KB
/
UnLitMaterial.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { Engine3D } from '../Engine3D';
import { Texture } from '../gfx/graphics/webGpu/core/texture/Texture';
import { Color } from '../math/Color';
import { Material } from './Material';
import { UnLitShader } from '..';
/**
* Unlit Mateiral
* A non glossy surface material without specular highlights.
* @group Material
*/
export class UnLitMaterial extends Material {
/**
* @constructor
*/
constructor() {
super();
this.shader = new UnLitShader();
// default value
this.baseMap = Engine3D.res.whiteTexture;
}
public set baseMap(texture: Texture) {
this.shader.setTexture(`baseMap`, texture);
}
public get baseMap() {
return this.shader.getTexture(`baseMap`);
}
/**
* set base color (tint color)
*/
public set baseColor(color: Color) {
this.shader.setUniformColor(`baseColor`, color);
}
/**
* get base color (tint color)
*/
public get baseColor() {
return this.shader.getUniformColor("baseColor");
}
/**
* set environment texture, usually referring to cubemap
*/
public set envMap(texture: Texture) {
//not need env texture
}
/**
* @internal
* set shadow map
*/
public set shadowMap(texture: Texture) {
//not need shadowMap texture
}
}