Add lighting shader
This commit is contained in:
parent
e88b4589d2
commit
0cd383794c
11 changed files with 144 additions and 295 deletions
|
|
@ -4,6 +4,7 @@ import { ZoomCommand } from '../../commands/types/zoom';
|
|||
import { BeforeDrawCommand } from '../../commands/types/before-draw';
|
||||
import { PrimaryActionCommand } from '../../commands/types/primary-action';
|
||||
import { vec2 } from 'gl-matrix';
|
||||
import { CursorMoveCommand } from '../../commands/types/cursor-move-command';
|
||||
|
||||
export class Camera extends GameObject {
|
||||
private inViewArea = 1920 * 1080;
|
||||
|
|
@ -14,11 +15,11 @@ export class Camera extends GameObject {
|
|||
|
||||
this.addCommandExecutor(BeforeDrawCommand, this.draw.bind(this));
|
||||
this.addCommandExecutor(MoveToCommand, this.moveTo.bind(this));
|
||||
this.addCommandExecutor(ZoomCommand, this.zoom.bind(this));
|
||||
this.addCommandExecutor(
|
||||
PrimaryActionCommand,
|
||||
CursorMoveCommand,
|
||||
this.setCursorPosition.bind(this)
|
||||
);
|
||||
this.addCommandExecutor(ZoomCommand, this.zoom.bind(this));
|
||||
}
|
||||
|
||||
private draw(c: BeforeDrawCommand) {
|
||||
|
|
@ -35,7 +36,7 @@ export class Camera extends GameObject {
|
|||
this.inViewArea *= c.factor;
|
||||
}
|
||||
|
||||
private setCursorPosition(c: PrimaryActionCommand) {
|
||||
private setCursorPosition(c: CursorMoveCommand) {
|
||||
this.cursorPosition = c.position;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ export class Dungeon extends GameObject {
|
|||
let previousRadius = 0;
|
||||
let previousEnd = vec2.create();
|
||||
|
||||
for (let i = 0; i < 5000; i += 50) {
|
||||
const height = previousEnd.y + (Math.random() - 0.5) * 200;
|
||||
for (let i = 0; i < 500000; i += 500) {
|
||||
const height = previousEnd.y + (Math.random() - 0.5) * 2000;
|
||||
const currentEnd = vec2.fromValues(i, height);
|
||||
const currentToRadius = Math.random() * 10 + 30;
|
||||
const currentToRadius = Math.random() * 10 + 300;
|
||||
|
||||
this.lines.push({
|
||||
start: previousEnd,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue