emeraldengine 2.2.1 → 3.1.0
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/README.md +2198 -968
- package/dist/types/index.d.ts +75 -32
- package/dist/types/src/Animator.d.ts +50 -0
- package/dist/types/{BitmapText.d.ts → src/BitmapText.d.ts} +19 -21
- package/dist/types/src/Camera.d.ts +122 -0
- package/dist/types/src/CameraController.d.ts +107 -0
- package/dist/types/src/CanvasText.d.ts +91 -0
- package/dist/types/src/CollisionLayers.d.ts +58 -0
- package/dist/types/{Color.d.ts → src/Color.d.ts} +6 -6
- package/dist/types/src/Coroutine.d.ts +111 -0
- package/dist/types/src/DebugOverlay.d.ts +86 -0
- package/dist/types/src/Drawable.d.ts +271 -0
- package/dist/types/src/Easing.d.ts +22 -0
- package/dist/types/src/Emerald.d.ts +420 -0
- package/dist/types/src/EmeraldDB.d.ts +159 -0
- package/dist/types/{FPSCounter.d.ts → src/FPSCounter.d.ts} +1 -3
- package/dist/types/src/GLUtils.d.ts +4 -0
- package/dist/types/{Instance.d.ts → src/Instance.d.ts} +37 -15
- package/dist/types/{InstancedTexture.d.ts → src/InstancedTexture.d.ts} +75 -23
- package/dist/types/src/Interpolator.d.ts +66 -0
- package/dist/types/src/Material.d.ts +87 -0
- package/dist/types/src/MathUtils.d.ts +81 -0
- package/dist/types/src/ParticleEmitter.d.ts +131 -0
- package/dist/types/src/Physics.d.ts +337 -0
- package/dist/types/src/Pool.d.ts +53 -0
- package/dist/types/src/PostEffects.d.ts +68 -0
- package/dist/types/src/PostProcessor.d.ts +124 -0
- package/dist/types/src/RenderTarget.d.ts +56 -0
- package/dist/types/src/Scene.d.ts +62 -0
- package/dist/types/src/ScreenEffects.d.ts +111 -0
- package/dist/types/src/Serializer.d.ts +86 -0
- package/dist/types/src/Shaders.d.ts +2 -0
- package/dist/types/{Shapes.d.ts → src/Shapes.d.ts} +4 -6
- package/dist/types/src/SpatialGrid.d.ts +50 -0
- package/dist/types/src/SpriteBatch.d.ts +89 -0
- package/dist/types/src/StateMachine.d.ts +59 -0
- package/dist/types/src/Storage.d.ts +89 -0
- package/dist/types/{Texture.d.ts → src/Texture.d.ts} +3 -4
- package/dist/types/src/TextureAtlas.d.ts +55 -0
- package/dist/types/src/Tilemap.d.ts +91 -0
- package/dist/types/src/Time.d.ts +53 -0
- package/dist/types/src/Timer.d.ts +54 -0
- package/dist/types/src/Transform.d.ts +94 -0
- package/dist/types/src/Tween.d.ts +81 -0
- package/dist/types/src/UI.d.ts +121 -0
- package/dist/types/src/components/Behaviour.d.ts +71 -0
- package/dist/types/{components → src/components}/BoxCollider.d.ts +14 -14
- package/dist/types/src/components/BoxColliderDebug.d.ts +15 -0
- package/dist/types/{components → src/components}/CircleCollider.d.ts +14 -12
- package/dist/types/src/components/CircleColliderDebug.d.ts +15 -0
- package/dist/types/src/components/Collider.d.ts +102 -0
- package/dist/types/src/components/GameObject.d.ts +135 -0
- package/dist/types/src/components/PolygonCollider.d.ts +33 -0
- package/dist/types/src/components/RigidBody.d.ts +456 -0
- package/dist/types/src/importers/Aseprite.d.ts +79 -0
- package/dist/types/src/importers/ForgeLevel.d.ts +97 -0
- package/dist/types/src/importers/TiledMap.d.ts +62 -0
- package/dist/types/{lights → src/lights}/DirectionalLight.d.ts +7 -9
- package/dist/types/{lights → src/lights}/PointLight.d.ts +6 -9
- package/dist/types/src/managers/AssetManager.d.ts +116 -0
- package/dist/types/src/managers/AudioManager.d.ts +259 -0
- package/dist/types/{managers → src/managers}/CameraManager.d.ts +8 -8
- package/dist/types/{managers → src/managers}/EventManager.d.ts +46 -32
- package/dist/types/src/managers/GLManager.d.ts +84 -0
- package/dist/types/src/managers/GLState.d.ts +37 -0
- package/dist/types/src/managers/Gamepad.d.ts +102 -0
- package/dist/types/src/managers/IDManager.d.ts +31 -0
- package/dist/types/src/managers/InputManager.d.ts +381 -0
- package/dist/types/src/managers/NetworkManager.d.ts +93 -0
- package/dist/types/src/managers/RenderStats.d.ts +34 -0
- package/dist/types/src/managers/SceneManager.d.ts +44 -0
- package/dist/types/src/managers/ShaderManager.d.ts +55 -0
- package/dist/types/src/managers/TextureManager.d.ts +102 -0
- package/dist/types/src/particlesystem/Particle.d.ts +64 -0
- package/dist/types/{particlesystem → src/particlesystem}/ParticleSettings.d.ts +32 -24
- package/dist/types/{particlesystem → src/particlesystem}/Particles.d.ts +20 -12
- package/dist/types/src/physics/AABB.d.ts +92 -0
- package/dist/types/src/physics/Body.d.ts +435 -0
- package/dist/types/src/physics/BodyType.d.ts +6 -0
- package/dist/types/src/physics/BroadPhase.d.ts +210 -0
- package/dist/types/src/physics/Collision.d.ts +102 -0
- package/dist/types/src/physics/Contact.d.ts +206 -0
- package/dist/types/src/physics/ContactSolver.d.ts +108 -0
- package/dist/types/src/physics/Distance.d.ts +54 -0
- package/dist/types/src/physics/DistanceJoint.d.ts +90 -0
- package/dist/types/src/physics/Fixture.d.ts +221 -0
- package/dist/types/src/physics/Island.d.ts +52 -0
- package/dist/types/src/physics/Joint.d.ts +59 -0
- package/dist/types/src/physics/Math2D.d.ts +371 -0
- package/dist/types/src/physics/RevoluteJoint.d.ts +119 -0
- package/dist/types/src/physics/Settings.d.ts +22 -0
- package/dist/types/src/physics/Shapes.d.ts +207 -0
- package/dist/types/src/physics/TimeOfImpact.d.ts +22 -0
- package/dist/types/src/physics/World.d.ts +274 -0
- package/dist/types/src/physics/index.d.ts +34 -0
- package/index.js +78 -0
- package/package.json +73 -60
- package/src/Animator.js +95 -0
- package/src/BitmapText.js +6 -5
- package/src/Camera.js +183 -0
- package/src/CameraController.js +192 -0
- package/src/CanvasText.js +281 -0
- package/src/CollisionLayers.js +86 -0
- package/src/Color.js +26 -18
- package/src/Coroutine.js +259 -0
- package/src/DebugOverlay.js +246 -0
- package/src/Drawable.js +842 -582
- package/src/Easing.js +57 -0
- package/src/Emerald.js +1150 -459
- package/src/EmeraldDB.js +328 -0
- package/src/FPSCounter.js +43 -43
- package/src/GLUtils.js +60 -67
- package/src/Instance.js +41 -5
- package/src/InstancedTexture.js +308 -127
- package/src/Interpolator.js +124 -0
- package/src/Material.js +202 -0
- package/src/MathUtils.js +134 -0
- package/src/ParticleEmitter.js +284 -0
- package/src/Physics.js +431 -40
- package/src/Pool.js +85 -0
- package/src/PostEffects.js +296 -0
- package/src/PostProcessor.js +304 -0
- package/src/RenderTarget.js +134 -0
- package/src/Scene.js +115 -83
- package/src/ScreenEffects.js +266 -0
- package/src/Serializer.js +131 -0
- package/src/Shaders.js +150 -165
- package/src/Shapes.js +118 -129
- package/src/SpatialGrid.js +111 -0
- package/src/SpriteBatch.js +299 -0
- package/src/StateMachine.js +82 -0
- package/src/Storage.js +175 -47
- package/src/Texture.js +58 -67
- package/src/TextureAtlas.js +96 -0
- package/src/Tilemap.js +274 -0
- package/src/Time.js +51 -6
- package/src/Timer.js +99 -0
- package/src/Transform.js +100 -7
- package/src/Tween.js +160 -0
- package/src/UI.js +394 -0
- package/src/components/Behaviour.js +90 -0
- package/src/components/BoxCollider.js +29 -12
- package/src/components/BoxColliderDebug.js +3 -4
- package/src/components/CircleCollider.js +26 -12
- package/src/components/CircleColliderDebug.js +25 -24
- package/src/components/Collider.js +150 -34
- package/src/components/GameObject.js +130 -21
- package/src/components/PolygonCollider.js +55 -0
- package/src/components/RigidBody.js +556 -8
- package/src/importers/Aseprite.js +142 -0
- package/src/importers/ForgeLevel.js +581 -0
- package/src/importers/TiledMap.js +158 -0
- package/src/lights/DirectionalLight.js +6 -15
- package/src/lights/PointLight.js +4 -4
- package/src/managers/AssetManager.js +239 -0
- package/src/managers/AudioManager.js +565 -146
- package/src/managers/EventManager.js +488 -477
- package/src/managers/GLManager.js +57 -0
- package/src/managers/GLState.js +70 -0
- package/src/managers/Gamepad.js +126 -0
- package/src/managers/IDManager.js +24 -2
- package/src/managers/InputManager.js +905 -0
- package/src/managers/NetworkManager.js +178 -0
- package/src/managers/RenderStats.js +34 -0
- package/src/managers/SceneManager.js +30 -0
- package/src/managers/ShaderManager.js +0 -2
- package/src/managers/TextureManager.js +218 -0
- package/src/particlesystem/Particle.js +82 -7
- package/src/particlesystem/ParticleSettings.js +21 -3
- package/src/particlesystem/Particles.js +80 -31
- package/src/physics/AABB.js +207 -0
- package/src/physics/Body.js +862 -0
- package/src/physics/BodyType.js +16 -0
- package/src/physics/BroadPhase.js +641 -0
- package/src/physics/Collision.js +534 -0
- package/src/physics/Contact.js +500 -0
- package/src/physics/ContactSolver.js +526 -0
- package/src/physics/Distance.js +403 -0
- package/src/physics/DistanceJoint.js +227 -0
- package/src/physics/Fixture.js +346 -0
- package/src/physics/Island.js +203 -0
- package/src/physics/Joint.js +78 -0
- package/src/physics/Math2D.js +573 -0
- package/src/physics/RevoluteJoint.js +278 -0
- package/src/physics/Settings.js +78 -0
- package/src/physics/Shapes.js +549 -0
- package/src/physics/TimeOfImpact.js +87 -0
- package/src/physics/World.js +731 -0
- package/src/physics/index.js +79 -0
- package/dist/types/Drawable.d.ts +0 -157
- package/dist/types/Emerald.d.ts +0 -73
- package/dist/types/GLUtils.d.ts +0 -6
- package/dist/types/Physics.d.ts +0 -139
- package/dist/types/Scene.d.ts +0 -39
- package/dist/types/Shaders.d.ts +0 -4
- package/dist/types/Storage.d.ts +0 -46
- package/dist/types/Time.d.ts +0 -22
- package/dist/types/Transform.d.ts +0 -41
- package/dist/types/components/BoxColliderDebug.d.ts +0 -19
- package/dist/types/components/CircleColliderDebug.d.ts +0 -19
- package/dist/types/components/Collider.d.ts +0 -53
- package/dist/types/components/GameObject.d.ts +0 -72
- package/dist/types/components/RigidBody.d.ts +0 -104
- package/dist/types/managers/AudioManager.d.ts +0 -60
- package/dist/types/managers/GLManager.d.ts +0 -47
- package/dist/types/managers/IDManager.d.ts +0 -21
- package/dist/types/managers/SceneManager.d.ts +0 -22
- package/dist/types/particlesystem/Particle.d.ts +0 -42
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Emerald's built-in 2D rigid-body physics engine.
|
|
3
|
+
* @description A complete, dependency-free simulation: a dynamic AABB tree
|
|
4
|
+
* broadphase, SAT/GJK narrowphase, an impulse-based contact solver with warm
|
|
5
|
+
* starting and island sleeping, and conservative-advancement continuous
|
|
6
|
+
* collision detection.
|
|
7
|
+
*
|
|
8
|
+
* Everything here works in physics units (meters, radians, seconds). Games
|
|
9
|
+
* normally use {@link Physics}, {@link RigidBody}, {@link BoxCollider} and
|
|
10
|
+
* {@link CircleCollider} instead, which handle the pixel conversion; reach for
|
|
11
|
+
* this module directly only when you want a bare world.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import { World, Box, Vec2 } from "emeraldengine/src/physics/index.js";
|
|
15
|
+
* const world = new World({ gravity: new Vec2(0, -10) });
|
|
16
|
+
* const ground = world.createBody({ type: "static", position: new Vec2(0, 0) });
|
|
17
|
+
* ground.createFixture(Box(50, 1), { friction: 0.4 });
|
|
18
|
+
* const crate = world.createBody({ type: "dynamic", position: new Vec2(0, 8) });
|
|
19
|
+
* crate.createFixture(Box(0.5, 0.5), { density: 1, friction: 0.3 });
|
|
20
|
+
* world.step(1 / 60);
|
|
21
|
+
*/
|
|
22
|
+
import World from "./World.js";
|
|
23
|
+
import { Body, BodyType } from "./Body.js";
|
|
24
|
+
import { Fixture } from "./Fixture.js";
|
|
25
|
+
import { Contact, ContactManager, shouldCollide } from "./Contact.js";
|
|
26
|
+
import {
|
|
27
|
+
Shape,
|
|
28
|
+
ShapeType,
|
|
29
|
+
CircleShape,
|
|
30
|
+
PolygonShape,
|
|
31
|
+
Box,
|
|
32
|
+
Circle,
|
|
33
|
+
} from "./Shapes.js";
|
|
34
|
+
import { Vec2, Rot, Transform2, Sweep } from "./Math2D.js";
|
|
35
|
+
import AABB from "./AABB.js";
|
|
36
|
+
import Settings from "./Settings.js";
|
|
37
|
+
import { Manifold, ManifoldType, WorldManifold } from "./Collision.js";
|
|
38
|
+
import { DistanceProxy, distance, testOverlap } from "./Distance.js";
|
|
39
|
+
import { timeOfImpact, TOIState } from "./TimeOfImpact.js";
|
|
40
|
+
import { BroadPhase, DynamicTree } from "./BroadPhase.js";
|
|
41
|
+
import { Joint, JointType } from "./Joint.js";
|
|
42
|
+
import DistanceJoint from "./DistanceJoint.js";
|
|
43
|
+
import RevoluteJoint from "./RevoluteJoint.js";
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
World,
|
|
47
|
+
Body,
|
|
48
|
+
BodyType,
|
|
49
|
+
Fixture,
|
|
50
|
+
Contact,
|
|
51
|
+
ContactManager,
|
|
52
|
+
shouldCollide,
|
|
53
|
+
Shape,
|
|
54
|
+
ShapeType,
|
|
55
|
+
CircleShape,
|
|
56
|
+
PolygonShape,
|
|
57
|
+
Box,
|
|
58
|
+
Circle,
|
|
59
|
+
Vec2,
|
|
60
|
+
Rot,
|
|
61
|
+
Transform2,
|
|
62
|
+
Sweep,
|
|
63
|
+
AABB,
|
|
64
|
+
Settings,
|
|
65
|
+
Manifold,
|
|
66
|
+
ManifoldType,
|
|
67
|
+
WorldManifold,
|
|
68
|
+
DistanceProxy,
|
|
69
|
+
distance,
|
|
70
|
+
testOverlap,
|
|
71
|
+
timeOfImpact,
|
|
72
|
+
TOIState,
|
|
73
|
+
BroadPhase,
|
|
74
|
+
DynamicTree,
|
|
75
|
+
Joint,
|
|
76
|
+
JointType,
|
|
77
|
+
DistanceJoint,
|
|
78
|
+
RevoluteJoint,
|
|
79
|
+
};
|
package/dist/types/Drawable.d.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import Color from "./Color";
|
|
2
|
-
import { mat4 } from "gl-matrix";
|
|
3
|
-
import GameObject from "./components/GameObject";
|
|
4
|
-
/**
|
|
5
|
-
* @class Drawable
|
|
6
|
-
* @description A class that represents a drawable object
|
|
7
|
-
* @param {WebGLRenderingContext} gl - The WebGL rendering context
|
|
8
|
-
* @param {Object} programInfo - The program information
|
|
9
|
-
* @param {WebGLBuffer} verticesBuffer - The vertices buffer
|
|
10
|
-
* @param {WebGLBuffer} texCoordBuffer - The texture coordinate buffer
|
|
11
|
-
* @param {Array} vertices - The vertices of the object
|
|
12
|
-
* @param {boolean} useTexture - Whether to use a texture
|
|
13
|
-
* @param {string} texturePath - The path to the texture
|
|
14
|
-
* @param {number} frameWidth - The width of the frame
|
|
15
|
-
* @param {number} frameHeight - The height of the frame
|
|
16
|
-
* @param {number} framesPerRow - The number of frames per row
|
|
17
|
-
* @param {number} totalFrames - The total number of frames
|
|
18
|
-
* @param {number} animationSpeed - The speed of the animation
|
|
19
|
-
* @param {boolean} autoplay - Whether to autoplay the animation
|
|
20
|
-
* @param {boolean} pixelart - Whether to use pixel art
|
|
21
|
-
* @param {boolean} useLighting - Whether to use lighting
|
|
22
|
-
*/
|
|
23
|
-
declare class Drawable {
|
|
24
|
-
gl: WebGL2RenderingContext;
|
|
25
|
-
programInfo: any;
|
|
26
|
-
id: string;
|
|
27
|
-
verticesBuffer: WebGLBuffer;
|
|
28
|
-
texCoordBuffer: WebGLBuffer;
|
|
29
|
-
vertices: number[];
|
|
30
|
-
color: Color;
|
|
31
|
-
texturePath: string;
|
|
32
|
-
texture: WebGLTexture | null;
|
|
33
|
-
useTexture: boolean;
|
|
34
|
-
frameWidth: number;
|
|
35
|
-
frameHeight: number;
|
|
36
|
-
framesPerRow: number;
|
|
37
|
-
totalFrames: number;
|
|
38
|
-
currentFrame: number;
|
|
39
|
-
animationSpeed: number;
|
|
40
|
-
lastFrameTime: number;
|
|
41
|
-
textureWidth: number;
|
|
42
|
-
textureHeight: number;
|
|
43
|
-
isPlaying: boolean;
|
|
44
|
-
playOnce: boolean;
|
|
45
|
-
originalTexture: WebGLTexture | null;
|
|
46
|
-
mirrored: boolean;
|
|
47
|
-
animationType: string;
|
|
48
|
-
currentAnimationArray: number[];
|
|
49
|
-
currentAnimationIndex: number;
|
|
50
|
-
shouldRevertAfterPlayingOnce: boolean;
|
|
51
|
-
revertAnimation: number[];
|
|
52
|
-
parentObject: any;
|
|
53
|
-
isActive: boolean;
|
|
54
|
-
isWireframe: boolean;
|
|
55
|
-
callbackFunction: () => void;
|
|
56
|
-
pixelart: boolean;
|
|
57
|
-
useLighting: boolean;
|
|
58
|
-
constructor(gl: WebGL2RenderingContext, programInfo: any, verticesBuffer: WebGLBuffer, texCoordBuffer: WebGLBuffer, vertices: number[], useTexture: boolean, texturePath: string, frameWidth?: number, frameHeight?: number, framesPerRow?: number, totalFrames?: number, animationSpeed?: number, autoplay?: boolean, pixelart?: boolean, useLighting?: boolean);
|
|
59
|
-
/**
|
|
60
|
-
* @method setIsWireframe
|
|
61
|
-
* @description Sets the wireframe mode
|
|
62
|
-
* @param {boolean} bool - Whether to enable wireframe mode
|
|
63
|
-
*/
|
|
64
|
-
setIsWireframe(bool: boolean): void;
|
|
65
|
-
/**
|
|
66
|
-
* @method setUseLighting
|
|
67
|
-
* @description Sets the lighting mode
|
|
68
|
-
* @param {boolean} useLighting - Whether to enable lighting reaction
|
|
69
|
-
*/
|
|
70
|
-
setUseLighting(useLighting: boolean): void;
|
|
71
|
-
/**
|
|
72
|
-
* @method setIsActive
|
|
73
|
-
* @description Sets the active state
|
|
74
|
-
* @param {boolean} bool - Whether to enable the active state
|
|
75
|
-
*/
|
|
76
|
-
setIsActive(bool: boolean): void;
|
|
77
|
-
/**
|
|
78
|
-
* @method setParent
|
|
79
|
-
* @description Sets the parent object
|
|
80
|
-
* @param {Object} parent - The parent object
|
|
81
|
-
*/
|
|
82
|
-
setParent(parent: GameObject): void;
|
|
83
|
-
/**
|
|
84
|
-
* @method getParent
|
|
85
|
-
* @description Gets the parent object
|
|
86
|
-
* @returns {Object} - The parent object
|
|
87
|
-
*/
|
|
88
|
-
getParent(): GameObject | null;
|
|
89
|
-
/**
|
|
90
|
-
* @method setColor
|
|
91
|
-
* @description Sets the color of the object
|
|
92
|
-
* @param {Color} color - The color to set
|
|
93
|
-
*/
|
|
94
|
-
setColor(color: Color): void;
|
|
95
|
-
/**
|
|
96
|
-
* @method initTexture
|
|
97
|
-
* @description Initializes the texture
|
|
98
|
-
*/
|
|
99
|
-
initTexture(): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* @method updateAnimation
|
|
102
|
-
* @description Updates the animation
|
|
103
|
-
* @param {number} currentTime - The current time
|
|
104
|
-
*/
|
|
105
|
-
updateAnimation(currentTime: number): void;
|
|
106
|
-
/**
|
|
107
|
-
* @method getAnimation
|
|
108
|
-
* @description Gets the animation
|
|
109
|
-
* @returns {Array} - The animation
|
|
110
|
-
*/
|
|
111
|
-
getAnimation(): number[] | string | null;
|
|
112
|
-
/**
|
|
113
|
-
* @method playAnimation
|
|
114
|
-
* @description Plays an animation
|
|
115
|
-
* @param {Array} animation - The animation to play
|
|
116
|
-
* @param {number} animationSpeed - The speed of the animation
|
|
117
|
-
*/
|
|
118
|
-
playAnimation(animation: number[], animationSpeed?: number): void;
|
|
119
|
-
/**
|
|
120
|
-
* @method setFrame
|
|
121
|
-
* @description Sets the frame
|
|
122
|
-
* @param {number} frame - The frame to set
|
|
123
|
-
*/
|
|
124
|
-
setFrame(frame: number): void;
|
|
125
|
-
/**
|
|
126
|
-
* @method playAnimationOnce
|
|
127
|
-
* @description Plays an animation once
|
|
128
|
-
* @param {Array} animation - The animation to play
|
|
129
|
-
* @param {Array} defaultAnimation - The default animation
|
|
130
|
-
* @param {number} animationSpeed - The speed of the animation
|
|
131
|
-
* @param {function} callbackFunction - The callback function
|
|
132
|
-
*/
|
|
133
|
-
playAnimationOnce(animation: number[], defaultAnimation?: number[] | null, animationSpeed?: number, callbackFunction?: (() => void) | null): void;
|
|
134
|
-
/**
|
|
135
|
-
* @method stopAnimation
|
|
136
|
-
* @description Stops the animation
|
|
137
|
-
*/
|
|
138
|
-
stopAnimation(): void;
|
|
139
|
-
/**
|
|
140
|
-
* @method draw
|
|
141
|
-
* @description Draws the object
|
|
142
|
-
* @param {mat4} globalViewMatrix - The global view matrix
|
|
143
|
-
* @param {WebGLUniformLocation} uniformLocation - The uniform location
|
|
144
|
-
* @param {number} currentTime - The current time
|
|
145
|
-
* @param {Object} objectTransform - The object transform
|
|
146
|
-
*/
|
|
147
|
-
draw(globalViewMatrix: mat4, uniformLocation: WebGLUniformLocation, currentTime: number, objectTransform: any): void;
|
|
148
|
-
/**
|
|
149
|
-
* @method loadImage
|
|
150
|
-
* @description Loads an image
|
|
151
|
-
* @param {string} path - The path to the image
|
|
152
|
-
* @returns {Promise} - The promise
|
|
153
|
-
*/
|
|
154
|
-
loadImage: (path: string) => Promise<unknown>;
|
|
155
|
-
}
|
|
156
|
-
export default Drawable;
|
|
157
|
-
//# sourceMappingURL=Drawable.d.ts.map
|
package/dist/types/Emerald.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import Color from "./Color";
|
|
2
|
-
import { Vector3 } from "./Physics";
|
|
3
|
-
import PointLight from "./lights/PointLight";
|
|
4
|
-
import DirectionalLight from "./lights/DirectionalLight";
|
|
5
|
-
import Scene from "./Scene";
|
|
6
|
-
/**
|
|
7
|
-
* @class Emerald
|
|
8
|
-
* @description A class that represents the Emerald engine
|
|
9
|
-
* @param {HTMLCanvasElement} canvas - The canvas element
|
|
10
|
-
*/
|
|
11
|
-
declare class Emerald {
|
|
12
|
-
shaderProgram: WebGLProgram;
|
|
13
|
-
gl: WebGL2RenderingContext;
|
|
14
|
-
programInfo: any;
|
|
15
|
-
camera: any;
|
|
16
|
-
ambientLight: Vector3;
|
|
17
|
-
pointLights: PointLight[];
|
|
18
|
-
directionalLights: DirectionalLight[];
|
|
19
|
-
debugLogged: boolean;
|
|
20
|
-
backgroundColor: {
|
|
21
|
-
r: number;
|
|
22
|
-
g: number;
|
|
23
|
-
b: number;
|
|
24
|
-
a: number;
|
|
25
|
-
};
|
|
26
|
-
constructor(canvas: HTMLCanvasElement);
|
|
27
|
-
/**
|
|
28
|
-
* @method setAmbientLight
|
|
29
|
-
* @description Sets the ambient light for the scene
|
|
30
|
-
* @param {Vector3} vector3 - The ambient light color as a Vector3 instance
|
|
31
|
-
*/
|
|
32
|
-
setAmbientLight(vector3: Vector3): void;
|
|
33
|
-
/**
|
|
34
|
-
* @method resize
|
|
35
|
-
* @description Resizes the canvas
|
|
36
|
-
* @param {number} width - The width of the canvas
|
|
37
|
-
* @param {number} height - The height of the canvas
|
|
38
|
-
*/
|
|
39
|
-
resize(width: number, height: number): void;
|
|
40
|
-
/**
|
|
41
|
-
* @method addPointLight
|
|
42
|
-
* @description Adds a point light to the scene
|
|
43
|
-
* @param {PointLight} pointLight - The point light to add
|
|
44
|
-
*/
|
|
45
|
-
addPointLight(pointLight: PointLight): void;
|
|
46
|
-
/**
|
|
47
|
-
* @method addDirectionalLight
|
|
48
|
-
* @description Adds a directional light to the scene
|
|
49
|
-
* @param {DirectionalLight} directionalLight - The directional light to add
|
|
50
|
-
*/
|
|
51
|
-
addDirectionalLight(directionalLight: DirectionalLight): void;
|
|
52
|
-
/**
|
|
53
|
-
* @method removeDirectionalLight
|
|
54
|
-
* @description Removes a directional light from the scene
|
|
55
|
-
* @param {DirectionalLight} directionalLight - The directional light to remove
|
|
56
|
-
*/
|
|
57
|
-
removeDirectionalLight(directionalLight: DirectionalLight): void;
|
|
58
|
-
/**
|
|
59
|
-
* @method setBackgroundColor
|
|
60
|
-
* @description Sets the background color of the scene
|
|
61
|
-
* @param {Color} color - The background color
|
|
62
|
-
*/
|
|
63
|
-
setBackgroundColor(color: Color): void;
|
|
64
|
-
/**
|
|
65
|
-
* @method drawScene
|
|
66
|
-
* @description Draws the scene
|
|
67
|
-
* @param {Scene} scene - The scene to draw
|
|
68
|
-
* @param {number} deltaTime - The delta time
|
|
69
|
-
*/
|
|
70
|
-
drawScene(scene: Scene, deltaTime: number): void;
|
|
71
|
-
}
|
|
72
|
-
export default Emerald;
|
|
73
|
-
//# sourceMappingURL=Emerald.d.ts.map
|
package/dist/types/GLUtils.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
declare function initShaderProgram(gl: WebGL2RenderingContext, vShader: string, fShader: string): WebGLProgram | null;
|
|
2
|
-
declare function loadShader(gl: WebGL2RenderingContext, type: number, source: string): WebGLShader | null;
|
|
3
|
-
declare const initVertexBuffer: (gl: WebGL2RenderingContext, vertices: number[]) => WebGLBuffer | null;
|
|
4
|
-
declare function initInstancedBuffer(gl: WebGL2RenderingContext, data: Float32Array, itemSize: number): WebGLBuffer | null;
|
|
5
|
-
export { initShaderProgram, loadShader, initVertexBuffer, initInstancedBuffer };
|
|
6
|
-
//# sourceMappingURL=GLUtils.d.ts.map
|
package/dist/types/Physics.d.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import * as planck from "planck";
|
|
2
|
-
/**
|
|
3
|
-
* @class Physics
|
|
4
|
-
* @description Represents the physics engine
|
|
5
|
-
* @param {number} gravity - The gravity of the physics engine
|
|
6
|
-
* @param {number} scale - The scale of the physics engine
|
|
7
|
-
* @param {number} velocityThreshold - The velocity threshold of the physics engine
|
|
8
|
-
*/
|
|
9
|
-
declare class Physics {
|
|
10
|
-
world: planck.World;
|
|
11
|
-
gravity: number;
|
|
12
|
-
scale: number;
|
|
13
|
-
constructor(gravity: number, scale: number, velocityThreshold?: number);
|
|
14
|
-
/**
|
|
15
|
-
* @method createBody
|
|
16
|
-
* @description Creates a body in the physics engine
|
|
17
|
-
* @param {string} type - The type of the body
|
|
18
|
-
* @param {Vector2} position - The position of the body
|
|
19
|
-
* @param {boolean} fixedRotation - Whether the body should have a fixed rotation
|
|
20
|
-
* @param {boolean} attachFixture - Whether the body should have a fixture
|
|
21
|
-
* @param {Vector2} fixtureSize - The size of the fixture
|
|
22
|
-
* @param {number} density - The density of the fixture
|
|
23
|
-
* @param {number} friction - The friction of the fixture
|
|
24
|
-
* @param {number} restitution - The restitution of the fixture
|
|
25
|
-
* @returns {Body} - The body
|
|
26
|
-
*/
|
|
27
|
-
createBody(type: string, position?: Vector2, fixedRotation?: boolean, attachFixture?: boolean, fixtureSize?: Vector2, density?: number, friction?: number, restitution?: number): planck.Body;
|
|
28
|
-
/**
|
|
29
|
-
* @method onCollisionEnter
|
|
30
|
-
* @description Handles the collision enter event
|
|
31
|
-
* @param {Function} callback - The callback function to handle the collision enter event
|
|
32
|
-
*/
|
|
33
|
-
onCollisionEnter(callback: (bodyA: planck.Body, bodyB: planck.Body, contact: planck.Contact) => void): void;
|
|
34
|
-
/**
|
|
35
|
-
* @method onCollisionExit
|
|
36
|
-
* @description Handles the collision exit event
|
|
37
|
-
* @param {Function} callback - The callback function to handle the collision exit event
|
|
38
|
-
*/
|
|
39
|
-
onCollisionExit(callback: (bodyA: planck.Body, bodyB: planck.Body, contact: planck.Contact) => void): void;
|
|
40
|
-
/**
|
|
41
|
-
* @method process
|
|
42
|
-
* @description Processes the physics engine
|
|
43
|
-
* @param {number} dt - The delta time
|
|
44
|
-
*/
|
|
45
|
-
process(dt: number): void;
|
|
46
|
-
/**
|
|
47
|
-
* @method clear
|
|
48
|
-
* @description Clears the physics engine objects and resets the gravity
|
|
49
|
-
*/
|
|
50
|
-
clear(): void;
|
|
51
|
-
/**
|
|
52
|
-
* @method getGravity
|
|
53
|
-
* @description Returns the gravity of the physics engine
|
|
54
|
-
* @returns {number} - The gravity of the physics engine
|
|
55
|
-
*/
|
|
56
|
-
getGravity(): number;
|
|
57
|
-
/**
|
|
58
|
-
* @method getScale
|
|
59
|
-
* @description Returns the scale of the physics engine
|
|
60
|
-
* @returns {number} - The scale of the physics engine
|
|
61
|
-
*/
|
|
62
|
-
getScale(): number;
|
|
63
|
-
/**
|
|
64
|
-
* @method scheduleAction
|
|
65
|
-
* @description Schedules an action to be executed as soon as possible
|
|
66
|
-
* @param {Function} callback - The callback function to execute
|
|
67
|
-
*/
|
|
68
|
-
static scheduleAction(callback: () => void): void;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @class Vector2
|
|
72
|
-
* @description Represents a 2D vector
|
|
73
|
-
* @param {number} x - The x coordinate of the vector
|
|
74
|
-
* @param {number} y - The y coordinate of the vector
|
|
75
|
-
*/
|
|
76
|
-
declare class Vector2 {
|
|
77
|
-
x: number;
|
|
78
|
-
y: number;
|
|
79
|
-
constructor(x: number, y: number);
|
|
80
|
-
/**
|
|
81
|
-
* @method equals
|
|
82
|
-
* @description Checks if the vector is equal to another vector
|
|
83
|
-
* @param {Vector2} other - The other vector
|
|
84
|
-
* @returns {boolean} - True if the vector is equal to the other vector
|
|
85
|
-
*/
|
|
86
|
-
equals(other: Vector2): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* @method getX
|
|
89
|
-
* @description Returns the x coordinate of the vector
|
|
90
|
-
* @returns {number} - The x coordinate of the vector
|
|
91
|
-
*/
|
|
92
|
-
getX(): number;
|
|
93
|
-
/**
|
|
94
|
-
* @method getY
|
|
95
|
-
* @description Returns the y coordinate of the vector
|
|
96
|
-
* @returns {number} - The y coordinate of the vector
|
|
97
|
-
*/
|
|
98
|
-
getY(): number;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @class Vector3
|
|
102
|
-
* @description Represents a 3D vector
|
|
103
|
-
* @param {number} x - The x coordinate of the vector
|
|
104
|
-
* @param {number} y - The y coordinate of the vector
|
|
105
|
-
* @param {number} z - The z coordinate of the vector
|
|
106
|
-
*/
|
|
107
|
-
declare class Vector3 {
|
|
108
|
-
x: number;
|
|
109
|
-
y: number;
|
|
110
|
-
z: number;
|
|
111
|
-
constructor(x: number, y: number, z: number);
|
|
112
|
-
/**
|
|
113
|
-
* @method equals
|
|
114
|
-
* @description Checks if the vector is equal to another vector
|
|
115
|
-
* @param {Vector3} other - The other vector
|
|
116
|
-
* @returns {boolean} - True if the vector is equal to the other vector
|
|
117
|
-
*/
|
|
118
|
-
equals(other: Vector3): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* @method getX
|
|
121
|
-
* @description Returns the x coordinate of the vector
|
|
122
|
-
* @returns {number} - The x coordinate of the vector
|
|
123
|
-
*/
|
|
124
|
-
getX(): number;
|
|
125
|
-
/**
|
|
126
|
-
* @method getY
|
|
127
|
-
* @description Returns the y coordinate of the vector
|
|
128
|
-
* @returns {number} - The y coordinate of the vector
|
|
129
|
-
*/
|
|
130
|
-
getY(): number;
|
|
131
|
-
/**
|
|
132
|
-
* @method getZ
|
|
133
|
-
* @description Returns the z coordinate of the vector
|
|
134
|
-
* @returns {number} - The z coordinate of the vector
|
|
135
|
-
*/
|
|
136
|
-
getZ(): number;
|
|
137
|
-
}
|
|
138
|
-
export { Physics, Vector2, Vector3 };
|
|
139
|
-
//# sourceMappingURL=Physics.d.ts.map
|
package/dist/types/Scene.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import GameObject from "./components/GameObject";
|
|
2
|
-
/**
|
|
3
|
-
* @class Scene
|
|
4
|
-
* @description Represents a scene
|
|
5
|
-
* @param {Array} objects - The objects in the scene
|
|
6
|
-
*/
|
|
7
|
-
declare class Scene {
|
|
8
|
-
objects: GameObject[];
|
|
9
|
-
constructor(objects?: GameObject[]);
|
|
10
|
-
/**
|
|
11
|
-
* @method add
|
|
12
|
-
* @description Adds an object to the scene
|
|
13
|
-
* @param {GameObject} object - The object to add
|
|
14
|
-
*/
|
|
15
|
-
add(object: GameObject): void;
|
|
16
|
-
/**
|
|
17
|
-
* @method remove
|
|
18
|
-
* @description Removes an object from the scene
|
|
19
|
-
* @param {GameObject} object - The object to remove
|
|
20
|
-
*/
|
|
21
|
-
remove(object: GameObject): void;
|
|
22
|
-
/**
|
|
23
|
-
* @method setIsActive
|
|
24
|
-
* @description Sets the active state of the scene
|
|
25
|
-
* @param {boolean} bool - The active state
|
|
26
|
-
*/
|
|
27
|
-
setIsActive(bool: boolean): void;
|
|
28
|
-
/**
|
|
29
|
-
* @method setActiveRecursive
|
|
30
|
-
* @description Sets the active state of the scene recursively
|
|
31
|
-
* @param {Object} object - The object to set the active state of
|
|
32
|
-
* @param {boolean} bool - The active state
|
|
33
|
-
*/
|
|
34
|
-
setActiveRecursive(object: GameObject, bool: boolean): void;
|
|
35
|
-
[Symbol.iterator](): Iterator<GameObject>;
|
|
36
|
-
forEach(callback: (object: GameObject) => void): void;
|
|
37
|
-
}
|
|
38
|
-
export default Scene;
|
|
39
|
-
//# sourceMappingURL=Scene.d.ts.map
|
package/dist/types/Shaders.d.ts
DELETED
package/dist/types/Storage.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @class Storage
|
|
3
|
-
* @description Manages the storage of the game
|
|
4
|
-
*/
|
|
5
|
-
declare class Storage {
|
|
6
|
-
/**
|
|
7
|
-
* @method writeToLocalStorage
|
|
8
|
-
* @description Writes to local storage
|
|
9
|
-
* @param {string} key - The key to write to
|
|
10
|
-
* @param {any} value - The value to write to
|
|
11
|
-
*/
|
|
12
|
-
static writeToLocalStorage(key: string, value: any): void;
|
|
13
|
-
/**
|
|
14
|
-
* @method readFromLocalStorage
|
|
15
|
-
* @description Reads from local storage
|
|
16
|
-
* @param {string} key - The key to read from
|
|
17
|
-
* @returns {any} - The value read from local storage
|
|
18
|
-
*/
|
|
19
|
-
static readFromLocalStorage(key: string): any;
|
|
20
|
-
/**
|
|
21
|
-
* @method clearLocalStorage
|
|
22
|
-
* @description Clears local storage
|
|
23
|
-
*/
|
|
24
|
-
static clearLocalStorage(): void;
|
|
25
|
-
/**
|
|
26
|
-
* @method writeToSessionStorage
|
|
27
|
-
* @description Writes to session storage
|
|
28
|
-
* @param {string} key - The key to write to
|
|
29
|
-
* @param {any} value - The value to write to
|
|
30
|
-
*/
|
|
31
|
-
static writeToSessionStorage(key: string, value: any): void;
|
|
32
|
-
/**
|
|
33
|
-
* @method readFromSessionStorage
|
|
34
|
-
* @description Reads from session storage
|
|
35
|
-
* @param {string} key - The key to read from
|
|
36
|
-
* @returns {any} - The value read from session storage
|
|
37
|
-
*/
|
|
38
|
-
static readFromSessionStorage(key: string): any;
|
|
39
|
-
/**
|
|
40
|
-
* @method clearSessionStorage
|
|
41
|
-
* @description Clears session storage
|
|
42
|
-
*/
|
|
43
|
-
static clearSessionStorage(): void;
|
|
44
|
-
}
|
|
45
|
-
export default Storage;
|
|
46
|
-
//# sourceMappingURL=Storage.d.ts.map
|
package/dist/types/Time.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @class Time
|
|
3
|
-
* @description Represents the time
|
|
4
|
-
* @param {number} deltaTime - The delta time
|
|
5
|
-
*/
|
|
6
|
-
declare class Time {
|
|
7
|
-
static deltaTime: number;
|
|
8
|
-
/**
|
|
9
|
-
* @method getDeltaTime
|
|
10
|
-
* @description Returns the delta time
|
|
11
|
-
* @returns {number} - The delta time
|
|
12
|
-
*/
|
|
13
|
-
static getDeltaTime(): number;
|
|
14
|
-
/**
|
|
15
|
-
* @method setDeltaTime
|
|
16
|
-
* @description Sets the delta time
|
|
17
|
-
* @param {number} deltaTime - The delta time
|
|
18
|
-
*/
|
|
19
|
-
static setDeltaTime(deltaTime: number): void;
|
|
20
|
-
}
|
|
21
|
-
export default Time;
|
|
22
|
-
//# sourceMappingURL=Time.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Vector2, Vector3 } from "./Physics";
|
|
2
|
-
/**
|
|
3
|
-
* @class Transform
|
|
4
|
-
* @description Represents a transform
|
|
5
|
-
* @param {Vector3} position - The position of the transform
|
|
6
|
-
* @param {number} rotation - The rotation of the transform
|
|
7
|
-
* @param {Vector2} scale - The scale of the transform
|
|
8
|
-
*/
|
|
9
|
-
declare class Transform {
|
|
10
|
-
position: Vector3;
|
|
11
|
-
rotation: number;
|
|
12
|
-
scale: Vector2;
|
|
13
|
-
constructor(position: Vector3, rotation: number, scale: Vector2);
|
|
14
|
-
/**
|
|
15
|
-
* @method equals
|
|
16
|
-
* @description Checks if the transform is equal to another transform
|
|
17
|
-
* @param {Transform} other - The other transform
|
|
18
|
-
* @returns {boolean} - True if the transform is equal to the other transform
|
|
19
|
-
*/
|
|
20
|
-
equals(other: Transform): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* @method getPosition
|
|
23
|
-
* @description Returns the position of the transform
|
|
24
|
-
* @returns {Vector3} - The position of the transform
|
|
25
|
-
*/
|
|
26
|
-
getPosition(): Vector3;
|
|
27
|
-
/**
|
|
28
|
-
* @method getRotation
|
|
29
|
-
* @description Returns the rotation of the transform
|
|
30
|
-
* @returns {number} - The rotation of the transform
|
|
31
|
-
*/
|
|
32
|
-
getRotation(): number;
|
|
33
|
-
/**
|
|
34
|
-
* @method getScale
|
|
35
|
-
* @description Returns the scale of the transform
|
|
36
|
-
* @returns {Vector2} - The scale of the transform
|
|
37
|
-
*/
|
|
38
|
-
getScale(): Vector2;
|
|
39
|
-
}
|
|
40
|
-
export default Transform;
|
|
41
|
-
//# sourceMappingURL=Transform.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Color from "../Color";
|
|
2
|
-
import { Physics } from "../Physics";
|
|
3
|
-
import GameObject from "./GameObject";
|
|
4
|
-
import RigidBody from "./RigidBody";
|
|
5
|
-
/**
|
|
6
|
-
* @class BoxColliderDebug
|
|
7
|
-
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
8
|
-
* @param {Color} color - The color of the collider
|
|
9
|
-
*/
|
|
10
|
-
declare class BoxColliderDebug {
|
|
11
|
-
rigidbody: RigidBody;
|
|
12
|
-
physics: Physics;
|
|
13
|
-
scale: number;
|
|
14
|
-
color: Color;
|
|
15
|
-
gameObject: GameObject;
|
|
16
|
-
constructor(rigidbody: RigidBody, color?: Color | null);
|
|
17
|
-
}
|
|
18
|
-
export default BoxColliderDebug;
|
|
19
|
-
//# sourceMappingURL=BoxColliderDebug.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Color from "../Color";
|
|
2
|
-
import { Physics } from "../Physics";
|
|
3
|
-
import GameObject from "./GameObject";
|
|
4
|
-
import RigidBody from "./RigidBody";
|
|
5
|
-
/**
|
|
6
|
-
* @class CircleColliderDebug
|
|
7
|
-
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
8
|
-
* @param {Color} color - The color of the collider
|
|
9
|
-
*/
|
|
10
|
-
declare class CircleColliderDebug {
|
|
11
|
-
rigidbody: RigidBody;
|
|
12
|
-
physics: Physics;
|
|
13
|
-
scale: number;
|
|
14
|
-
color: Color;
|
|
15
|
-
gameObject: GameObject;
|
|
16
|
-
constructor(rigidbody: RigidBody, color?: Color | null);
|
|
17
|
-
}
|
|
18
|
-
export default CircleColliderDebug;
|
|
19
|
-
//# sourceMappingURL=CircleColliderDebug.d.ts.map
|