Fix bugs and add improvements
This commit is contained in:
parent
555be9d602
commit
ba4dd5c470
10 changed files with 26 additions and 21 deletions
|
|
@ -74,7 +74,7 @@ export class Game {
|
|||
}
|
||||
|
||||
private async setupRenderer(): Promise<void> {
|
||||
const noiseTexture = await renderNoise([64, 1], 20, 1 / 10);
|
||||
const noiseTexture = await renderNoise([256, 256], 2, 1 / 10);
|
||||
|
||||
this.renderer = await compile(
|
||||
this.canvas,
|
||||
|
|
@ -123,6 +123,7 @@ export class Game {
|
|||
overrides: {
|
||||
maxFilter: FilteringOptions.LINEAR,
|
||||
wrapS: WrapOptions.MIRRORED_REPEAT,
|
||||
wrapT: WrapOptions.MIRRORED_REPEAT,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -135,7 +136,7 @@ export class Game {
|
|||
}
|
||||
|
||||
public displayToWorldCoordinates(p: vec2): vec2 {
|
||||
return this.renderer.displayToWorldCoordinates(p);
|
||||
return this.renderer?.displayToWorldCoordinates(p);
|
||||
}
|
||||
|
||||
public aspectRatioChanged(aspectRatio: number) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export class ProjectileView extends ProjectileBase implements ViewObject {
|
|||
constructor(id: Id, center: vec2, radius: number) {
|
||||
super(id, center, radius);
|
||||
this.circle = new Circle(center, radius / 2);
|
||||
this.light = new CircleLight(center, rgb(1, 0.5, 0), 0.35);
|
||||
this.light = new CircleLight(center, rgb(1, 0.5, 0), 0.15);
|
||||
}
|
||||
|
||||
public step(deltaTimeInMilliseconds: number): void {}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Drawable, Renderer } from 'sdf-2d';
|
||||
import { CommandExecutors, Id, StoneBase } from 'shared';
|
||||
import { CommandExecutors, Id, Random, StoneBase } from 'shared';
|
||||
import { RenderCommand } from '../commands/types/render';
|
||||
import { Polygon } from '../shapes/polygon';
|
||||
import { ViewObject } from './view-object';
|
||||
|
|
@ -14,10 +14,12 @@ export class StoneView extends StoneBase implements ViewObject {
|
|||
|
||||
constructor(id: Id, vertices: Array<vec2>) {
|
||||
super(id, vertices);
|
||||
this.shape = new Polygon(vertices);
|
||||
this.shape = new Polygon(vertices, Random.getRandom());
|
||||
}
|
||||
|
||||
public step(deltaTimeInMilliseconds: number): void {}
|
||||
public step(deltaTimeInMilliseconds: number): void {
|
||||
this.shape.randomOffset += deltaTimeInMilliseconds / 5000;
|
||||
}
|
||||
|
||||
public draw(renderer: Renderer): void {
|
||||
renderer.addDrawable(this.shape);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { PolygonFactory } from 'sdf-2d';
|
||||
import { NoisyPolygonFactory } from 'sdf-2d';
|
||||
import { settings } from 'shared';
|
||||
|
||||
export const Polygon = PolygonFactory(settings.polygonEdgeCount);
|
||||
export const Polygon = NoisyPolygonFactory(settings.polygonEdgeCount, 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue