emeraldengine 2.2.1 → 3.0.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 +2359 -968
- package/dist/types/index.d.ts +72 -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} +5 -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} +60 -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 +80 -0
- package/dist/types/src/ParticleEmitter.d.ts +131 -0
- package/dist/types/{Physics.d.ts → src/Physics.d.ts} +88 -20
- 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 +96 -0
- package/dist/types/src/components/GameObject.d.ts +135 -0
- package/dist/types/src/components/RigidBody.d.ts +183 -0
- package/dist/types/src/importers/Aseprite.d.ts +79 -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/IDManager.d.ts +31 -0
- package/dist/types/src/managers/InputManager.d.ts +290 -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/index.js +72 -0
- package/package.json +74 -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 +18 -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 +251 -118
- package/src/Interpolator.js +124 -0
- package/src/Material.js +202 -0
- package/src/MathUtils.js +133 -0
- package/src/ParticleEmitter.js +284 -0
- package/src/Physics.js +186 -5
- 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 +22 -3
- package/src/components/CircleCollider.js +19 -3
- package/src/components/CircleColliderDebug.js +24 -24
- package/src/components/Collider.js +140 -34
- package/src/components/GameObject.js +130 -21
- package/src/components/RigidBody.js +123 -2
- package/src/importers/Aseprite.js +142 -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/IDManager.js +24 -2
- package/src/managers/InputManager.js +779 -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/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/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
|
@@ -34,8 +34,8 @@ export default class Particles {
|
|
|
34
34
|
this.rotation = this.settings.rotation;
|
|
35
35
|
this.scale = this.settings.scale;
|
|
36
36
|
this.particles = [];
|
|
37
|
-
this.duration = duration;
|
|
38
|
-
this.offset = this.settings.offset;
|
|
37
|
+
this.duration = duration;
|
|
38
|
+
this.offset = this.settings.offset;
|
|
39
39
|
this.elapsed = 0;
|
|
40
40
|
this.active = false;
|
|
41
41
|
this.instanceCount = this.settings.amount;
|
|
@@ -56,12 +56,14 @@ export default class Particles {
|
|
|
56
56
|
framesPerRow,
|
|
57
57
|
totalFrames,
|
|
58
58
|
this.settings.animation ? this.settings.animation.speed : 0,
|
|
59
|
-
this.settings.animation ? true : false
|
|
59
|
+
this.settings.animation ? true : false
|
|
60
60
|
);
|
|
61
|
-
this.instancedTexture.clearInstances();
|
|
61
|
+
this.instancedTexture.clearInstances();
|
|
62
62
|
this.gameObject.addComponent(this.instancedTexture);
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
|
|
64
|
+
/** @private */
|
|
65
|
+
this._pool = [];
|
|
66
|
+
|
|
65
67
|
this.particles = [];
|
|
66
68
|
this.active = false;
|
|
67
69
|
this.elapsed = 0;
|
|
@@ -85,10 +87,8 @@ export default class Particles {
|
|
|
85
87
|
this.stopped = false;
|
|
86
88
|
this.lastEmitPosition = newPosition;
|
|
87
89
|
if (this.settings.emissionRate === Infinity) {
|
|
88
|
-
// One-shot: emit all at once
|
|
89
90
|
this.emitParticles(this.settings.amount, newPosition);
|
|
90
91
|
}
|
|
91
|
-
// For continuous, particles will be emitted in update()
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
@@ -113,27 +113,78 @@ export default class Particles {
|
|
|
113
113
|
x: Math.cos(finalAngle) * speed,
|
|
114
114
|
y: Math.sin(finalAngle) * speed,
|
|
115
115
|
};
|
|
116
|
-
const
|
|
116
|
+
const spawn = this._spawnOffset(finalAngle);
|
|
117
117
|
const pos = new Vector3(
|
|
118
|
-
position.x +
|
|
119
|
-
position.y +
|
|
118
|
+
position.x + spawn.x,
|
|
119
|
+
position.y + spawn.y,
|
|
120
120
|
position.z
|
|
121
121
|
);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
if (this.particles.length < this.instanceCount) {
|
|
123
|
+
let particle = this._pool.pop();
|
|
124
|
+
if (particle) {
|
|
125
|
+
particle.reset(
|
|
126
|
+
this.instancedTexture,
|
|
127
|
+
pos,
|
|
128
|
+
this.rotation,
|
|
129
|
+
this.scale,
|
|
130
|
+
this.settings,
|
|
131
|
+
velocity
|
|
132
|
+
);
|
|
133
|
+
} else {
|
|
134
|
+
particle = new Particle(
|
|
135
|
+
this.instancedTexture,
|
|
136
|
+
pos,
|
|
137
|
+
this.rotation,
|
|
138
|
+
this.scale,
|
|
139
|
+
this.settings,
|
|
140
|
+
velocity
|
|
141
|
+
);
|
|
142
|
+
}
|
|
134
143
|
this.particles.push(particle);
|
|
135
144
|
}
|
|
136
|
-
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @method _spawnOffset
|
|
150
|
+
* @description Returns a spawn offset { x, y } from the emitter center based on
|
|
151
|
+
* the configured emitter shape.
|
|
152
|
+
* @param {number} finalAngle - The chosen emission angle (for the cone shape)
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
_spawnOffset(finalAngle) {
|
|
156
|
+
const s = this.settings;
|
|
157
|
+
const radius = s.shapeRadius || 0;
|
|
158
|
+
switch (s.shape) {
|
|
159
|
+
case "point":
|
|
160
|
+
return { x: 0, y: 0 };
|
|
161
|
+
case "circle": {
|
|
162
|
+
const a = Math.random() * Math.PI * 2;
|
|
163
|
+
const r = Math.sqrt(Math.random()) * radius;
|
|
164
|
+
return { x: Math.cos(a) * r, y: Math.sin(a) * r };
|
|
165
|
+
}
|
|
166
|
+
case "ring": {
|
|
167
|
+
const a = Math.random() * Math.PI * 2;
|
|
168
|
+
return { x: Math.cos(a) * radius, y: Math.sin(a) * radius };
|
|
169
|
+
}
|
|
170
|
+
case "box": {
|
|
171
|
+
const w = s.shapeSize ? s.shapeSize.x : 0;
|
|
172
|
+
const h = s.shapeSize ? s.shapeSize.y : 0;
|
|
173
|
+
return {
|
|
174
|
+
x: (Math.random() - 0.5) * w,
|
|
175
|
+
y: (Math.random() - 0.5) * h,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
case "cone":
|
|
179
|
+
default: {
|
|
180
|
+
const baseOffset = this.offset || 0;
|
|
181
|
+
const offsetVariation = (Math.random() - 0.5) * baseOffset * 0.5;
|
|
182
|
+
const dist = baseOffset + offsetVariation;
|
|
183
|
+
return {
|
|
184
|
+
x: Math.cos(finalAngle) * dist,
|
|
185
|
+
y: Math.sin(finalAngle) * dist,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
137
188
|
}
|
|
138
189
|
}
|
|
139
190
|
|
|
@@ -145,7 +196,6 @@ export default class Particles {
|
|
|
145
196
|
update(deltaTime) {
|
|
146
197
|
if (!this.active || this.stopped) return;
|
|
147
198
|
this.elapsed += deltaTime;
|
|
148
|
-
// Continuous emission
|
|
149
199
|
if (
|
|
150
200
|
this.settings.emissionRate !== Infinity &&
|
|
151
201
|
this.elapsed <= this.duration
|
|
@@ -164,25 +214,24 @@ export default class Particles {
|
|
|
164
214
|
this.emittedParticles += toEmit;
|
|
165
215
|
}
|
|
166
216
|
}
|
|
167
|
-
// Update all particles and remove dead ones
|
|
168
217
|
this.particles = this.particles.filter((particle) => {
|
|
169
218
|
particle.update(deltaTime);
|
|
170
219
|
if (!particle.isAlive()) {
|
|
171
220
|
particle.destroy();
|
|
221
|
+
this._pool.push(particle);
|
|
172
222
|
return false;
|
|
173
223
|
}
|
|
174
224
|
return true;
|
|
175
225
|
});
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.settings.emissionRate !== Infinity
|
|
179
|
-
) {
|
|
226
|
+
const pastDuration = this.elapsed >= this.duration;
|
|
227
|
+
if (pastDuration && this.settings.emissionRate !== Infinity) {
|
|
180
228
|
this.stopped = true;
|
|
181
229
|
}
|
|
182
|
-
if (this.stopped && this.particles.length === 0) {
|
|
230
|
+
if ((this.stopped || pastDuration) && this.particles.length === 0) {
|
|
183
231
|
this.instancedTexture.clearInstances();
|
|
184
232
|
this.particles = [];
|
|
185
233
|
this.active = false;
|
|
234
|
+
this.stopped = true;
|
|
186
235
|
}
|
|
187
236
|
}
|
|
188
237
|
|
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/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
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Vector2 } from "../Physics";
|
|
2
|
-
import GameObject from "./GameObject";
|
|
3
|
-
import RigidBody from "./RigidBody";
|
|
4
|
-
import * as planck from "planck";
|
|
5
|
-
/**
|
|
6
|
-
* @class Collider
|
|
7
|
-
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
8
|
-
* @param {boolean} isSensor - Whether the collider is a sensor
|
|
9
|
-
* @param {GameObject} parentObject - The parent object of the collider
|
|
10
|
-
*/
|
|
11
|
-
declare class Collider {
|
|
12
|
-
rigidbody: RigidBody;
|
|
13
|
-
parentObject: GameObject | null;
|
|
14
|
-
isSensor: boolean;
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
collider: planck.Fixture | null;
|
|
18
|
-
fixtureSize: Vector2 | null;
|
|
19
|
-
radius: number | null;
|
|
20
|
-
constructor(rigidbody: RigidBody, isSensor?: boolean, parentObject?: GameObject | null);
|
|
21
|
-
/**
|
|
22
|
-
* @method getRigidBody
|
|
23
|
-
* @description Returns the rigidbody of the collider
|
|
24
|
-
*/
|
|
25
|
-
getRigidBody(): RigidBody;
|
|
26
|
-
/**
|
|
27
|
-
* @method setParent
|
|
28
|
-
* @description Sets the parent object of the collider
|
|
29
|
-
*/
|
|
30
|
-
setParent(parent: GameObject): void;
|
|
31
|
-
/**
|
|
32
|
-
* @method getCollider
|
|
33
|
-
* @description Returns the collider
|
|
34
|
-
*/
|
|
35
|
-
getCollider(): planck.Fixture | null;
|
|
36
|
-
/**
|
|
37
|
-
* @method getFixtureSize
|
|
38
|
-
* @description Returns the size of the collider
|
|
39
|
-
*/
|
|
40
|
-
getFixtureSize(): Vector2 | null;
|
|
41
|
-
/**
|
|
42
|
-
* @method getRadius
|
|
43
|
-
* @description Returns the radius of the collider
|
|
44
|
-
*/
|
|
45
|
-
getRadius(): number | null;
|
|
46
|
-
/**
|
|
47
|
-
* @method getParent
|
|
48
|
-
* @description Returns the parent object of the collider
|
|
49
|
-
*/
|
|
50
|
-
getParent(): GameObject | null;
|
|
51
|
-
}
|
|
52
|
-
export default Collider;
|
|
53
|
-
//# sourceMappingURL=Collider.d.ts.map
|