Improve API
This commit is contained in:
parent
b2c2cfcb41
commit
78444d8cc6
24 changed files with 193 additions and 325 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue