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 Flashlight extends Drawable {
public static get descriptor(): DrawableDescriptor {
return {
uniformName: 'flashlights',
countMacroName: 'flashlightCount',
uniformCountMacroName: 'FLASHLIGHT_COUNT',
shaderCombinationSteps: settings.shaderCombinations.flashlightSteps,
empty: new Flashlight(
vec2.fromValues(0, 0),
@ -33,19 +33,13 @@ export class Flashlight extends Drawable {
return 0;
}
public serializeToUniforms(uniforms: any, scale: number, transform: mat2d): void {
const listName = Flashlight.descriptor.uniformName;
if (!Object.prototype.hasOwnProperty.call(uniforms, listName)) {
uniforms[listName] = [];
}
uniforms[listName].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),
direction: this.direction,
lightDrop: this.lightDrop,
value: this.value,
});
};
}
public get value(): vec3 {