emeraldengine 2.1.0 → 2.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/imports/Drawable.js +10 -11
- package/imports/InstancedTexture.js +28 -29
- package/package.json +2 -2
package/imports/Drawable.js
CHANGED
|
@@ -336,8 +336,12 @@ class Drawable {
|
|
|
336
336
|
objectTransformMatrix,
|
|
337
337
|
objectTransformMatrix,
|
|
338
338
|
vec3.fromValues(
|
|
339
|
-
|
|
340
|
-
|
|
339
|
+
this.pixelart
|
|
340
|
+
? Math.round(objectTransform.position.x)
|
|
341
|
+
: objectTransform.position.x,
|
|
342
|
+
this.pixelart
|
|
343
|
+
? Math.round(objectTransform.position.y)
|
|
344
|
+
: objectTransform.position.y,
|
|
341
345
|
objectTransform.position.z
|
|
342
346
|
)
|
|
343
347
|
);
|
|
@@ -430,18 +434,13 @@ class Drawable {
|
|
|
430
434
|
const col = this.currentFrame % this.framesPerRow;
|
|
431
435
|
const row = Math.floor(this.currentFrame / this.framesPerRow);
|
|
432
436
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
texLeft = ((col + 1) * this.frameWidth) / this.textureWidth - halfTexelWidth;
|
|
437
|
-
texRight = (col * this.frameWidth) / this.textureWidth + halfTexelWidth;
|
|
437
|
+
texLeft = ((col + 1) * this.frameWidth) / this.textureWidth;
|
|
438
|
+
texRight = (col * this.frameWidth) / this.textureWidth;
|
|
438
439
|
texTop =
|
|
439
440
|
(this.textureHeight - row * this.frameHeight - this.frameHeight) /
|
|
440
|
-
this.textureHeight
|
|
441
|
-
halfTexelHeight;
|
|
441
|
+
this.textureHeight;
|
|
442
442
|
texBottom =
|
|
443
|
-
(this.textureHeight - row * this.frameHeight) / this.textureHeight
|
|
444
|
-
halfTexelHeight;
|
|
443
|
+
(this.textureHeight - row * this.frameHeight) / this.textureHeight;
|
|
445
444
|
} else {
|
|
446
445
|
// Static image
|
|
447
446
|
texLeft = 1.0;
|
|
@@ -198,8 +198,12 @@ class InstancedTexture extends Drawable {
|
|
|
198
198
|
if (index >= 0 && index < this.instanceCount) {
|
|
199
199
|
const matrix = mat4.create();
|
|
200
200
|
const position = [
|
|
201
|
-
this.
|
|
202
|
-
|
|
201
|
+
this.pixelart
|
|
202
|
+
? Math.round(this.instances[index].transform.position.x)
|
|
203
|
+
: this.instances[index].transform.position.x,
|
|
204
|
+
this.pixelart
|
|
205
|
+
? Math.round(this.instances[index].transform.position.y)
|
|
206
|
+
: this.instances[index].transform.position.y,
|
|
203
207
|
this.instances[index].transform.position.z,
|
|
204
208
|
];
|
|
205
209
|
const scale = [
|
|
@@ -406,18 +410,13 @@ class InstancedTexture extends Drawable {
|
|
|
406
410
|
const col = frame % this.framesPerRow;
|
|
407
411
|
const row = Math.floor(frame / this.framesPerRow);
|
|
408
412
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
texLeft = ((col + 1) * this.frameWidth) / this.textureWidth - halfTexelWidth;
|
|
413
|
-
texRight = (col * this.frameWidth) / this.textureWidth + halfTexelWidth;
|
|
413
|
+
texLeft = ((col + 1) * this.frameWidth) / this.textureWidth;
|
|
414
|
+
texRight = (col * this.frameWidth) / this.textureWidth;
|
|
414
415
|
texTop =
|
|
415
416
|
(this.textureHeight - row * this.frameHeight - this.frameHeight) /
|
|
416
|
-
|
|
417
|
-
halfTexelHeight;
|
|
417
|
+
this.textureHeight;
|
|
418
418
|
texBottom =
|
|
419
|
-
(this.textureHeight - row * this.frameHeight) / this.textureHeight
|
|
420
|
-
halfTexelHeight;
|
|
419
|
+
(this.textureHeight - row * this.frameHeight) / this.textureHeight;
|
|
421
420
|
} else {
|
|
422
421
|
// Static image
|
|
423
422
|
texLeft = 1.0;
|
|
@@ -429,25 +428,25 @@ class InstancedTexture extends Drawable {
|
|
|
429
428
|
// Return texture coordinates (considering mirroring)
|
|
430
429
|
return this.mirrored
|
|
431
430
|
? [
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
431
|
+
texRight,
|
|
432
|
+
texBottom,
|
|
433
|
+
texLeft,
|
|
434
|
+
texBottom,
|
|
435
|
+
texRight,
|
|
436
|
+
texTop,
|
|
437
|
+
texLeft,
|
|
438
|
+
texTop,
|
|
439
|
+
]
|
|
441
440
|
: [
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
441
|
+
texLeft,
|
|
442
|
+
texBottom,
|
|
443
|
+
texRight,
|
|
444
|
+
texBottom,
|
|
445
|
+
texLeft,
|
|
446
|
+
texTop,
|
|
447
|
+
texRight,
|
|
448
|
+
texTop,
|
|
449
|
+
];
|
|
451
450
|
}
|
|
452
451
|
|
|
453
452
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emeraldengine",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "2D graphics library for Web",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -39,4 +39,4 @@
|
|
|
39
39
|
"url": "git+https://github.com/vahan-gev/emeraldengine.git"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {}
|
|
42
|
-
}
|
|
42
|
+
}
|