angry-pixel 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/ComponentTypes.d.ts +2 -0
- package/lib/component/collider/BallCollider.d.ts +26 -0
- package/lib/component/collider/Collider.d.ts +1 -1
- package/lib/component/collider/EdgeCollider.d.ts +31 -0
- package/lib/component/collider/PolygonCollider.d.ts +0 -1
- package/lib/component/colliderComponent/AbstractColliderComponent.d.ts +10 -15
- package/lib/component/colliderComponent/BoxCollider.d.ts +1 -3
- package/lib/component/colliderComponent/TilemapCollider.d.ts +0 -2
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/physics/collision/CollisionManager.d.ts +4 -4
- package/lib/physics/collision/collider/ICollider.d.ts +0 -1
- package/lib/physics/collision/collider/RectangleCollider.d.ts +1 -2
- package/lib/physics/collision/method/AABBMethod.d.ts +13 -0
- package/lib/physics/collision/method/CollisionMethod.d.ts +5 -0
- package/lib/physics/collision/method/SatMethod.d.ts +11 -0
- package/lib/physics/collision/resolver/AABBResolver.d.ts +3 -4
- package/lib/physics/collision/resolver/CircumferenceAABBResolver.d.ts +9 -0
- package/lib/physics/collision/resolver/CircumferenceCircumferenceResolver.d.ts +7 -0
- package/lib/physics/collision/resolver/CircumferencePolygonResolver.d.ts +23 -0
- package/lib/physics/collision/resolver/CircumferenceRectangleResolver.d.ts +9 -0
- package/lib/physics/collision/resolver/CircumferenceResolver.d.ts +7 -0
- package/lib/physics/collision/resolver/CollisionResolver.d.ts +7 -2
- package/lib/physics/collision/resolver/PolygonPolygonResolver.d.ts +15 -0
- package/lib/physics/collision/resolver/RectangleRectangleResolver.d.ts +11 -0
- package/lib/physics/collision/resolver/SatResolver.d.ts +6 -3
- package/lib/physics/collision/shape/Circumference.d.ts +18 -0
- package/lib/physics/collision/shape/Line.d.ts +19 -0
- package/lib/physics/collision/shape/Shape.d.ts +1 -1
- package/lib/physics/rigodBody/RigidBodyData.d.ts +1 -0
- package/lib/rendering/CullingService.d.ts +1 -1
- package/lib/rendering/context2D/Context2DRenderer.d.ts +1 -0
- package/lib/rendering/renderData/GeometricRenderData.d.ts +11 -6
- package/lib/rendering/renderData/RenderData.d.ts +3 -3
- package/lib/rendering/renderData/TilemapRenderData.d.ts +7 -1
- package/lib/rendering/webGL/renderer/GeometricRenderer.d.ts +5 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Rectangle } from "../../math/Rectangle";
|
|
2
2
|
import { ColliderData } from "./ColliderData";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CollisionMethod } from "./method/CollisionMethod";
|
|
4
|
+
import { CollisionResolution } from "./resolver/CollisionResolver";
|
|
5
5
|
export interface Collision {
|
|
6
6
|
localCollider: ColliderData;
|
|
7
7
|
remoteCollider: ColliderData;
|
|
@@ -12,12 +12,12 @@ export declare class CollisionManager {
|
|
|
12
12
|
private quadTree;
|
|
13
13
|
private bounds;
|
|
14
14
|
private fixedQuadTree;
|
|
15
|
-
private
|
|
15
|
+
private method;
|
|
16
16
|
private collisions;
|
|
17
17
|
private minBounds;
|
|
18
18
|
private maxBounds;
|
|
19
19
|
private newBounds;
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(method: CollisionMethod, quadTreeBounds: Rectangle | null, quadMaxLevel: number, collidersPerQuad: number);
|
|
21
21
|
addCollider(collider: ColliderData): void;
|
|
22
22
|
removeCollider(collider: ColliderData): void;
|
|
23
23
|
getFrameCollisionsForCollider(collider: ColliderData): Collision[];
|
|
@@ -6,7 +6,6 @@ export declare class RectangleCollider implements ICollider {
|
|
|
6
6
|
readonly gameObject: GameObject;
|
|
7
7
|
readonly shape: Rectangle;
|
|
8
8
|
readonly physics: boolean;
|
|
9
|
-
readonly updateCollisions: boolean;
|
|
10
9
|
private _position;
|
|
11
10
|
private _width;
|
|
12
11
|
private _height;
|
|
@@ -14,7 +13,7 @@ export declare class RectangleCollider implements ICollider {
|
|
|
14
13
|
private _quadVertices;
|
|
15
14
|
private _quadMaxBounds;
|
|
16
15
|
private _quadMinBounds;
|
|
17
|
-
constructor(position: Vector2, width: number, height: number, physics: boolean, gameObject: GameObject, angle?: number
|
|
16
|
+
constructor(position: Vector2, width: number, height: number, physics: boolean, gameObject: GameObject, angle?: number);
|
|
18
17
|
set position(coordinates: Vector2);
|
|
19
18
|
get position(): Vector2;
|
|
20
19
|
set width(width: number);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Shape } from "../shape/Shape";
|
|
2
|
+
import { CollisionResolution } from "../resolver/CollisionResolver";
|
|
3
|
+
import { CollisionMethod } from "./CollisionMethod";
|
|
4
|
+
import { AABBResolver } from "../resolver/AABBResolver";
|
|
5
|
+
import { CircumferenceAABBResolver } from "../resolver/CircumferenceAABBResolver";
|
|
6
|
+
import { CircumferenceResolver } from "../resolver/CircumferenceResolver";
|
|
7
|
+
export declare class AABBMethod implements CollisionMethod {
|
|
8
|
+
private readonly AABBResolver;
|
|
9
|
+
private readonly circumferenceAABBResolver;
|
|
10
|
+
private readonly circumferenceResolver;
|
|
11
|
+
constructor(AABBResolver: AABBResolver, circumferenceAABBResolver: CircumferenceAABBResolver, circumferenceResolver: CircumferenceResolver);
|
|
12
|
+
getCollisionResolution(shapeA: Shape, shapeB: Shape): CollisionResolution | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Shape } from "../shape/Shape";
|
|
2
|
+
import { CollisionResolution } from "../resolver/CollisionResolver";
|
|
3
|
+
import { CollisionMethod } from "./CollisionMethod";
|
|
4
|
+
import { CircumferenceResolver } from "../resolver/CircumferenceResolver";
|
|
5
|
+
import { SatResolver } from "../resolver/SatResolver";
|
|
6
|
+
export declare class SatMethod implements CollisionMethod {
|
|
7
|
+
private readonly circumferenceResolver;
|
|
8
|
+
private readonly satResolver;
|
|
9
|
+
constructor(circumferenceResolver: CircumferenceResolver, satResolver: SatResolver);
|
|
10
|
+
getCollisionResolution(shapeA: Shape, shapeB: Shape): CollisionResolution | null;
|
|
11
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { CollisionResolver } from "./CollisionResolver";
|
|
1
|
+
import { Rectangle } from "../shape/Rectangle";
|
|
2
|
+
import { CollisionResolution, CollisionResolver } from "./CollisionResolver";
|
|
4
3
|
export declare class AABBResolver implements CollisionResolver {
|
|
5
4
|
private overlapX;
|
|
6
5
|
private overlapY;
|
|
7
6
|
private minOverlap;
|
|
8
7
|
private direction;
|
|
9
8
|
private displacementDirection;
|
|
10
|
-
|
|
9
|
+
resolve(shapeA: Rectangle, shapeB: Rectangle): CollisionResolution | null;
|
|
11
10
|
private preventContainment;
|
|
12
11
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Circumference } from "../shape/Circumference";
|
|
2
|
+
import { Rectangle } from "../shape/Rectangle";
|
|
3
|
+
import { CollisionResolver, CollisionResolution } from "./CollisionResolver";
|
|
4
|
+
export declare class CircumferenceAABBResolver implements CollisionResolver {
|
|
5
|
+
private closestPoint;
|
|
6
|
+
private distance;
|
|
7
|
+
private direction;
|
|
8
|
+
resolve(shapeA: Circumference, shapeB: Rectangle, invert?: boolean): CollisionResolution;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Circumference } from "../shape/Circumference";
|
|
2
|
+
import { CollisionResolution, CollisionResolver } from "./CollisionResolver";
|
|
3
|
+
export declare class CircumferenceCircumferenceResolver implements CollisionResolver {
|
|
4
|
+
private distance;
|
|
5
|
+
private direction;
|
|
6
|
+
resolve(shapeA: Circumference, shapeB: Circumference): CollisionResolution;
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Circumference } from "../shape/Circumference";
|
|
2
|
+
import { Line } from "../shape/Line";
|
|
3
|
+
import { Polygon } from "../shape/Polygon";
|
|
4
|
+
import { CollisionResolution, CollisionResolver } from "./CollisionResolver";
|
|
5
|
+
export declare class CircumferencePolygonResolver implements CollisionResolver {
|
|
6
|
+
private axes;
|
|
7
|
+
private projA;
|
|
8
|
+
private projB;
|
|
9
|
+
private currentOverlap;
|
|
10
|
+
private minOverlap;
|
|
11
|
+
private displaceDirection;
|
|
12
|
+
private direction;
|
|
13
|
+
private closestVertex;
|
|
14
|
+
private distance;
|
|
15
|
+
private newDistance;
|
|
16
|
+
private circumferenceAxis;
|
|
17
|
+
private cache;
|
|
18
|
+
resolve(shapeA: Circumference, shapeB: Polygon | Line, invert?: boolean): CollisionResolution;
|
|
19
|
+
private findClosestVertex;
|
|
20
|
+
private setCircumferenceVertices;
|
|
21
|
+
private projectShapeOntoAxis;
|
|
22
|
+
private preventContainment;
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Circumference } from "../shape/Circumference";
|
|
2
|
+
import { Rectangle } from "../shape/Rectangle";
|
|
3
|
+
import { CollisionResolver, CollisionResolution } from "./CollisionResolver";
|
|
4
|
+
export declare class CircumferenceRectangleResolver implements CollisionResolver {
|
|
5
|
+
private closestPoint;
|
|
6
|
+
private distance;
|
|
7
|
+
private direction;
|
|
8
|
+
resolve(shapeA: Circumference, shapeB: Rectangle, invert?: boolean): CollisionResolution;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Circumference } from "../shape/Circumference";
|
|
2
|
+
import { CollisionResolution, CollisionResolver } from "./CollisionResolver";
|
|
3
|
+
export declare class CircumferenceResolver implements CollisionResolver {
|
|
4
|
+
private distance;
|
|
5
|
+
private direction;
|
|
6
|
+
resolve(shapeA: Circumference, shapeB: Circumference): CollisionResolution;
|
|
7
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { CollisionResolution } from "./CollisionResolution";
|
|
2
1
|
import { Shape } from "../shape/Shape";
|
|
2
|
+
import { Vector2 } from "../../../math/Vector2";
|
|
3
|
+
export interface CollisionResolution {
|
|
4
|
+
penetration: number;
|
|
5
|
+
direction: Vector2;
|
|
6
|
+
displacementDirection: Vector2;
|
|
7
|
+
}
|
|
3
8
|
export interface CollisionResolver {
|
|
4
|
-
|
|
9
|
+
resolve(shapeA: Shape, shapeB: Shape): CollisionResolution | null;
|
|
5
10
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Line } from "../shape/Line";
|
|
2
|
+
import { Polygon } from "../shape/Polygon";
|
|
3
|
+
import { CollisionResolution, CollisionResolver } from "./CollisionResolver";
|
|
4
|
+
export declare class PolygonPolygonResolver implements CollisionResolver {
|
|
5
|
+
private axes;
|
|
6
|
+
private projA;
|
|
7
|
+
private projB;
|
|
8
|
+
private currentOverlap;
|
|
9
|
+
private minOverlap;
|
|
10
|
+
private displaceDirection;
|
|
11
|
+
private direction;
|
|
12
|
+
resolve(shapeA: Polygon | Line, shapeB: Polygon | Line): CollisionResolution | null;
|
|
13
|
+
private projectShapeOntoAxis;
|
|
14
|
+
private preventContainment;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Rectangle } from "../shape/Rectangle";
|
|
2
|
+
import { CollisionResolution, CollisionResolver } from "./CollisionResolver";
|
|
3
|
+
export declare class RectangleRectangleResolver implements CollisionResolver {
|
|
4
|
+
private overlapX;
|
|
5
|
+
private overlapY;
|
|
6
|
+
private minOverlap;
|
|
7
|
+
private direction;
|
|
8
|
+
private displacementDirection;
|
|
9
|
+
resolve(shapeA: Rectangle, shapeB: Rectangle): CollisionResolution | null;
|
|
10
|
+
private preventContainment;
|
|
11
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Shape } from "../shape/Shape";
|
|
2
|
-
import { CollisionResolution } from "./
|
|
3
|
-
import { CollisionResolver } from "./CollisionResolver";
|
|
2
|
+
import { CollisionResolution, CollisionResolver } from "./CollisionResolver";
|
|
4
3
|
export declare class SatResolver implements CollisionResolver {
|
|
5
4
|
private axes;
|
|
6
5
|
private projA;
|
|
@@ -9,7 +8,11 @@ export declare class SatResolver implements CollisionResolver {
|
|
|
9
8
|
private minOverlap;
|
|
10
9
|
private displaceDirection;
|
|
11
10
|
private direction;
|
|
12
|
-
|
|
11
|
+
private distance;
|
|
12
|
+
private cache;
|
|
13
|
+
resolve(shapeA: Shape, shapeB: Shape): CollisionResolution | null;
|
|
13
14
|
private projectShapeOntoAxis;
|
|
14
15
|
private preventContainment;
|
|
16
|
+
private setCircumferenceAxis;
|
|
17
|
+
private setCircumferenceVertices;
|
|
15
18
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Rectangle } from "../../../math/Rectangle";
|
|
2
|
+
import { Vector2 } from "../../../math/Vector2";
|
|
3
|
+
import { Shape, ShapeType } from "./Shape";
|
|
4
|
+
export declare class Circumference implements Shape {
|
|
5
|
+
readonly type: ShapeType;
|
|
6
|
+
readonly vertices: Vector2[];
|
|
7
|
+
readonly projectionAxes: Vector2[];
|
|
8
|
+
readonly boundingBox: Rectangle;
|
|
9
|
+
readonly angle: number;
|
|
10
|
+
readonly vertexModel: Vector2[];
|
|
11
|
+
radius: number;
|
|
12
|
+
protected _position: Vector2;
|
|
13
|
+
constructor(radius: number);
|
|
14
|
+
set position(value: Vector2);
|
|
15
|
+
get position(): Vector2;
|
|
16
|
+
update(): void;
|
|
17
|
+
protected updateBoundingBox(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Rectangle } from "../../../math/Rectangle";
|
|
2
|
+
import { Vector2 } from "../../../math/Vector2";
|
|
3
|
+
import { Shape, ShapeType } from "./Shape";
|
|
4
|
+
export declare class Line implements Shape {
|
|
5
|
+
vertexModel: [Vector2, Vector2];
|
|
6
|
+
readonly type: ShapeType;
|
|
7
|
+
readonly vertices: Vector2[];
|
|
8
|
+
readonly projectionAxes: Vector2[];
|
|
9
|
+
readonly boundingBox: Rectangle;
|
|
10
|
+
angle: number;
|
|
11
|
+
private _position;
|
|
12
|
+
constructor(vertexModel: [Vector2, Vector2]);
|
|
13
|
+
update(): void;
|
|
14
|
+
set position(value: Vector2);
|
|
15
|
+
get position(): Vector2;
|
|
16
|
+
protected updateVertices(): void;
|
|
17
|
+
protected updateBoundingBox(): void;
|
|
18
|
+
protected updateProjectionAxes(): void;
|
|
19
|
+
}
|
|
@@ -4,7 +4,7 @@ export declare class CullingService {
|
|
|
4
4
|
applyCulling(camera: CameraData, renderDataCollection: RenderData[]): RenderData[];
|
|
5
5
|
private cullSprite;
|
|
6
6
|
private cullTilemap;
|
|
7
|
-
private
|
|
7
|
+
private cullGeometric;
|
|
8
8
|
private cullText;
|
|
9
9
|
private isTargetVisible;
|
|
10
10
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Rectangle } from "../../math/Rectangle";
|
|
2
|
+
import { Vector2 } from "../../math/Vector2";
|
|
2
3
|
import { RenderData, RenderDataType } from "./RenderData";
|
|
3
|
-
declare
|
|
4
|
-
|
|
4
|
+
export declare enum GeometricShape {
|
|
5
|
+
Polygon = 0,
|
|
6
|
+
Circumference = 1,
|
|
7
|
+
Line = 2
|
|
8
|
+
}
|
|
5
9
|
export declare class GeometricRenderData extends RenderData {
|
|
6
10
|
type: RenderDataType;
|
|
7
11
|
color: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
shape: GeometricShape;
|
|
13
|
+
vertexModel: Vector2[];
|
|
14
|
+
angle: number;
|
|
15
|
+
radius: number;
|
|
16
|
+
boundingBox: Rectangle;
|
|
11
17
|
}
|
|
12
|
-
export {};
|
|
@@ -3,9 +3,9 @@ import { Vector2 } from "../../math/Vector2";
|
|
|
3
3
|
export declare enum RenderDataType {
|
|
4
4
|
Image = 0,
|
|
5
5
|
Text = 1,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Tilemap = 2,
|
|
7
|
+
Mask = 3,
|
|
8
|
+
Geometric = 4
|
|
9
9
|
}
|
|
10
10
|
export declare abstract class RenderData {
|
|
11
11
|
abstract type: RenderDataType;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Vector2 } from "../../math/Vector2";
|
|
2
|
-
import { Tile } from "../../component/rendering/tilemap/Tile";
|
|
3
2
|
import { RenderData, RenderDataType } from "./RenderData";
|
|
3
|
+
interface Tile {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
4
9
|
export declare class TileRenderData {
|
|
5
10
|
tile: Tile;
|
|
6
11
|
position: Vector2;
|
|
@@ -20,3 +25,4 @@ export declare class TilemapRenderData extends RenderData {
|
|
|
20
25
|
textureCorrection: number;
|
|
21
26
|
tintColor: string;
|
|
22
27
|
}
|
|
28
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Rectangle } from "../../../math/Rectangle";
|
|
2
2
|
import { LastRender, WebGLContextVersion } from "../WebGLRenderer";
|
|
3
|
-
import { ColliderRenderData } from "../../renderData/ColliderRenderData";
|
|
4
3
|
import { ProgramManager } from "../ProgramManager";
|
|
4
|
+
import { GeometricRenderData } from "../../renderData/GeometricRenderData";
|
|
5
5
|
export declare class GeometricRenderer {
|
|
6
6
|
private gl;
|
|
7
7
|
private programManager;
|
|
@@ -9,12 +9,13 @@ export declare class GeometricRenderer {
|
|
|
9
9
|
private modelMatrix;
|
|
10
10
|
private textureMatrix;
|
|
11
11
|
private readonly vertices;
|
|
12
|
-
private readonly
|
|
12
|
+
private readonly circumferenceVertices;
|
|
13
13
|
private lastVertices;
|
|
14
14
|
private lastRender;
|
|
15
15
|
constructor(contextVersion: WebGLContextVersion, canvas: HTMLCanvasElement, programManager: ProgramManager);
|
|
16
|
-
|
|
17
|
-
private
|
|
16
|
+
render(viewportRect: Rectangle, renderData: GeometricRenderData, lastRender: LastRender): void;
|
|
17
|
+
private renderLines;
|
|
18
18
|
private generateVerticesKey;
|
|
19
19
|
private generatePolygonVertices;
|
|
20
|
+
private renderCircumference;
|
|
20
21
|
}
|