Improve color handling approach
This commit is contained in:
parent
e53ca905af
commit
f29293c475
1 changed files with 259 additions and 181 deletions
|
|
@ -1,10 +1,9 @@
|
|||
import { mat2d, vec2, vec3, vec4 } from 'gl-matrix';
|
||||
import { mat2d, vec2, vec3 } from 'gl-matrix';
|
||||
import { UniversalRenderingContext } from '../graphics-library/universal-rendering-context';
|
||||
|
||||
/** @internal */
|
||||
export class UniformsProvider {
|
||||
public ambientLight!: vec3;
|
||||
public _backgroundColor!: vec4;
|
||||
public textures: { [textureName: string]: number } = {};
|
||||
|
||||
private scaleWorldLengthToNDC = 1;
|
||||
|
|
@ -21,7 +20,6 @@ export class UniformsProvider {
|
|||
...uniforms,
|
||||
...this.textures,
|
||||
ambientLight: this.ambientLight,
|
||||
backgroundColor: this._backgroundColor,
|
||||
uvToWorld: this.uvToWorld,
|
||||
worldAreaInView: this.worldAreaInView,
|
||||
squareToAspectRatio: this.squareToAspectRatio,
|
||||
|
|
@ -31,14 +29,6 @@ export class UniformsProvider {
|
|||
};
|
||||
}
|
||||
|
||||
public set backgroundColor(value: vec3 | vec4) {
|
||||
if (value.length === 3) {
|
||||
this.backgroundColor = vec4.fromValues(value[0], value[1], value[2], 1);
|
||||
} else {
|
||||
this._backgroundColor = value as vec4;
|
||||
}
|
||||
}
|
||||
|
||||
public getViewArea(): vec2 {
|
||||
return this.worldAreaInView;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue