WIP
This commit is contained in:
parent
24cc572e47
commit
345e183e34
2 changed files with 614 additions and 173 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
export interface IProgram {
|
||||
setDrawingRectangle(topLeft: vec2, size: vec2): void;
|
||||
setDrawingRectangle(bottomLeft: vec2, size: vec2): void;
|
||||
bindAndSetUniforms(values: { [name: string]: any }): void;
|
||||
draw(): void;
|
||||
delete(): void;
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ export abstract class Program implements IProgram {
|
|||
this.setUniforms({ modelTransform: this.modelTransform, ...values });
|
||||
}
|
||||
|
||||
public setDrawingRectangle(topLeft: vec2, size: vec2) {
|
||||
public setDrawingRectangle(bottomLeft: vec2, size: vec2) {
|
||||
mat2d.invert(this.modelTransform, this.ndcToUv);
|
||||
|
||||
mat2d.translate(this.modelTransform, this.modelTransform, topLeft);
|
||||
mat2d.translate(this.modelTransform, this.modelTransform, bottomLeft);
|
||||
mat2d.scale(this.modelTransform, this.modelTransform, size);
|
||||
mat2d.multiply(this.modelTransform, this.modelTransform, this.ndcToUv);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue