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,9 +7,20 @@ export abstract class Drawable {
}
public abstract distance(target: vec2): number;
public abstract serializeToUniforms(
protected abstract getObjectToSerialize(transform2d: mat2d, transform1d: number): any;
public serializeToUniforms(
uniforms: any,
scale: number,
transform: mat2d
): void;
transform2d: mat2d,
transform1d: number
): void {
const { uniformName } = (this.constructor as typeof Drawable).descriptor;
if (!Object.prototype.hasOwnProperty.call(uniforms, uniformName)) {
uniforms[uniformName] = [];
}
uniforms[uniformName].push(this.getObjectToSerialize(transform2d, transform1d));
}
}