Improve API

This commit is contained in:
schmelczerandras 2020-09-16 11:31:26 +02:00
parent b2c2cfcb41
commit 78444d8cc6
24 changed files with 193 additions and 325 deletions

View file

@ -7,7 +7,7 @@ export class CircleLight extends Drawable {
public static get descriptor(): DrawableDescriptor {
return {
uniformName: 'circleLights',
countMacroName: 'circleLightCount',
uniformCountMacroName: 'CIRCLE_LIGHT_COUNT',
shaderCombinationSteps: settings.shaderCombinations.circleLightSteps,
empty: new CircleLight(vec2.fromValues(0, 0), 0, vec3.fromValues(0, 0, 0), 0),
};
@ -26,18 +26,12 @@ export class CircleLight extends Drawable {
return 0;
}
public serializeToUniforms(uniforms: any, scale: number, transform: mat2d): void {
const { uniformName } = CircleLight.descriptor;
if (!Object.prototype.hasOwnProperty.call(uniforms, uniformName)) {
uniforms[uniformName] = [];
}
uniforms[uniformName].push({
center: vec2.transformMat2d(vec2.create(), this.center, transform),
protected getObjectToSerialize(transform2d: mat2d, transform1d: number): any {
return {
center: vec2.transformMat2d(vec2.create(), this.center, transform2d),
lightDrop: this.lightDrop,
value: this.value,
});
};
}
public get value(): vec3 {