@dcl/ecs 1.0.0-20220506152015.commit-2dd9f0a → 1.0.0-20220511175240.commit-459bc31
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 +13 -5
- package/dist/components/definitions/BoxShape.proto +2 -1
- package/dist/components/definitions/Transform.md +23 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/legacy/Transform.d.ts +3 -0
- package/dist/components/legacy/Transform.d.ts.map +1 -1
- package/dist/components/legacy/Transform.js +7 -4
- package/dist/components/legacy/Transform.js.map +1 -1
- package/dist/components/legacy/index.d.ts +1 -0
- package/dist/components/legacy/index.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ECS 7
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Installing dependencies
|
|
4
|
+
Run `make install`, this will run the `npm install` and other dependencies
|
|
5
|
+
|
|
6
|
+
## Building
|
|
7
|
+
Run `make build`
|
|
4
8
|
|
|
9
|
+
## Testing
|
|
10
|
+
Run `make test`, you can also debug the test in VS code, selecting the launch `Jest current file` or just `Jest` (this will run all test)
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
## Wishlist
|
|
13
|
+
Use this project as template for TypeScript libraries
|
|
14
|
+
- [x] as any MutableGroupOf
|
|
15
|
+
- [x] Tests for system
|
|
8
16
|
- [ ] use @dcl/ecs-math https://github.com/decentraland/ecs-math
|
|
9
17
|
- [ ] Basic Components ( Transform ) w/Tests
|
|
10
18
|
- [ ] Sync Component W/Tests
|
|
11
|
-
- [
|
|
19
|
+
- [x] CRDT System
|
|
12
20
|
- [ ] Kindof Scene Tests. Component & Systems. Maybe physics system? SolarSystem
|
|
13
21
|
- [ ] Integration with old ecs ( CRDT/Door Scene )
|
|
14
22
|
- [ ] RPC Transport. JSON { entityId, componentId, data: } vs Protocol Buffers
|
|
@@ -4,10 +4,11 @@ syntax = "proto3";
|
|
|
4
4
|
// This parameter is processed by the tool
|
|
5
5
|
|
|
6
6
|
package decentraland.ecs;
|
|
7
|
+
option csharp_namespace = "DCL.ECSComponents";
|
|
7
8
|
|
|
8
9
|
message PBBoxShape {
|
|
9
10
|
bool with_collisions = 1;
|
|
10
11
|
bool is_pointer_blocker = 2;
|
|
11
12
|
bool visible = 3;
|
|
12
13
|
repeated float uvs = 4;
|
|
13
|
-
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
# Transform
|
|
3
|
+
|
|
4
|
+
```cpp
|
|
5
|
+
// Transform length = 44
|
|
6
|
+
struct Transform {
|
|
7
|
+
float positionX;
|
|
8
|
+
float positionY;
|
|
9
|
+
float positionZ;
|
|
10
|
+
|
|
11
|
+
float rotationX;
|
|
12
|
+
float rotationY;
|
|
13
|
+
float rotationZ;
|
|
14
|
+
float rotationW;
|
|
15
|
+
|
|
16
|
+
float scaleX;
|
|
17
|
+
float scaleY;
|
|
18
|
+
float scaleZ;
|
|
19
|
+
|
|
20
|
+
uint32_t parentEntity;
|
|
21
|
+
};
|
|
22
|
+
```
|
|
23
|
+
- Serialized in big-endian
|
|
@@ -6,6 +6,7 @@ export declare function defineSdkComponents(engine: Pick<Engine, 'defineComponen
|
|
|
6
6
|
position: import("@dcl/ecs-math").Vector3.MutableVector3;
|
|
7
7
|
rotation: import("@dcl/ecs-math").Quaternion.MutableQuaternion;
|
|
8
8
|
scale: import("@dcl/ecs-math").Vector3.MutableVector3;
|
|
9
|
+
parent?: import("../engine/entity").Entity | undefined;
|
|
9
10
|
}>>;
|
|
10
11
|
};
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,cAAc,SAAS,CAAA;AAEvB,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,cAAc,SAAS,CAAA;AAEvB,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC;;;;;;;;EAI1E"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Quaternion, Vector3 } from '@dcl/ecs-math';
|
|
2
2
|
import { EcsType } from '../../built-in-types/EcsType';
|
|
3
|
+
import { Entity } from '../../engine/entity';
|
|
3
4
|
declare type Transform = {
|
|
4
5
|
position: Vector3.MutableVector3;
|
|
5
6
|
rotation: Quaternion.MutableQuaternion;
|
|
6
7
|
scale: Vector3.MutableVector3;
|
|
8
|
+
parent?: Entity;
|
|
7
9
|
};
|
|
10
|
+
export declare const TRANSFORM_LENGTH = 44;
|
|
8
11
|
export declare const Transform: EcsType<Transform>;
|
|
9
12
|
export {};
|
|
10
13
|
//# sourceMappingURL=Transform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../src/components/legacy/Transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../src/components/legacy/Transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAG5C,aAAK,SAAS,GAAG;IACf,QAAQ,EAAE,OAAO,CAAC,cAAc,CAAA;IAChC,QAAQ,EAAE,UAAU,CAAC,iBAAiB,CAAA;IACtC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAGlC,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC,SAAS,CAqCxC,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Transform = void 0;
|
|
3
|
+
exports.Transform = exports.TRANSFORM_LENGTH = void 0;
|
|
4
4
|
const ecs_math_1 = require("@dcl/ecs-math");
|
|
5
|
+
exports.TRANSFORM_LENGTH = 44;
|
|
5
6
|
// This transform can be optimized with Float32Array for example
|
|
6
7
|
exports.Transform = {
|
|
7
8
|
serialize(value, builder) {
|
|
8
|
-
const ptr = builder.incrementWriteOffset(
|
|
9
|
+
const ptr = builder.incrementWriteOffset(exports.TRANSFORM_LENGTH);
|
|
9
10
|
builder.setFloat32(ptr, value.position.x);
|
|
10
11
|
builder.setFloat32(ptr + 4, value.position.y);
|
|
11
12
|
builder.setFloat32(ptr + 8, value.position.z);
|
|
@@ -16,13 +17,15 @@ exports.Transform = {
|
|
|
16
17
|
builder.setFloat32(ptr + 28, value.scale.x);
|
|
17
18
|
builder.setFloat32(ptr + 32, value.scale.y);
|
|
18
19
|
builder.setFloat32(ptr + 36, value.scale.z);
|
|
20
|
+
builder.setUint32(ptr + 40, value.parent || 0);
|
|
19
21
|
},
|
|
20
22
|
deserialize(reader) {
|
|
21
|
-
const ptr = reader.incrementReadOffset(
|
|
23
|
+
const ptr = reader.incrementReadOffset(exports.TRANSFORM_LENGTH);
|
|
22
24
|
return {
|
|
23
25
|
position: ecs_math_1.Vector3.create(reader.getFloat32(ptr), reader.getFloat32(ptr + 4), reader.getFloat32(ptr + 8)),
|
|
24
26
|
rotation: ecs_math_1.Quaternion.create(reader.getFloat32(ptr + 12), reader.getFloat32(ptr + 16), reader.getFloat32(ptr + 20), reader.getFloat32(ptr + 24)),
|
|
25
|
-
scale: ecs_math_1.Vector3.create(reader.getFloat32(ptr + 28), reader.getFloat32(ptr + 32), reader.getFloat32(ptr + 36))
|
|
27
|
+
scale: ecs_math_1.Vector3.create(reader.getFloat32(ptr + 28), reader.getFloat32(ptr + 32), reader.getFloat32(ptr + 36)),
|
|
28
|
+
parent: reader.getUint32(ptr + 40)
|
|
26
29
|
};
|
|
27
30
|
}
|
|
28
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.js","sourceRoot":"","sources":["../../../src/components/legacy/Transform.ts"],"names":[],"mappings":";;;AAAA,4CAAmD;
|
|
1
|
+
{"version":3,"file":"Transform.js","sourceRoot":"","sources":["../../../src/components/legacy/Transform.ts"],"names":[],"mappings":";;;AAAA,4CAAmD;AAYtC,QAAA,gBAAgB,GAAG,EAAE,CAAA;AAElC,gEAAgE;AACnD,QAAA,SAAS,GAAuB;IAC3C,SAAS,CAAC,KAAgB,EAAE,OAAmB;QAC7C,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,wBAAgB,CAAC,CAAA;QAC1D,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QACzC,OAAO,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC7C,OAAO,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC7C,OAAO,CAAC,UAAU,CAAC,GAAG,GAAG,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,C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C,UAAU,CAAC,GAAG,GAAG,EAAE,CAAC,CAC5B;YACD,KAAK,EAAE,kBAAO,CAAC,MAAM,CACnB,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,EAAE,CAAC,EAC3B,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,EAAE,CAAC,EAC3B,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,EAAE,CAAC,CAC5B;YACD,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,GAAG,EAAE,CAAW;SAC7C,CAAA;IACH,CAAC;CACF,CAAA"}
|
|
@@ -5,6 +5,7 @@ export declare function defineLegacyComponents({ defineComponent }: Pick<Engine,
|
|
|
5
5
|
position: import("@dcl/ecs-math").Vector3.MutableVector3;
|
|
6
6
|
rotation: import("@dcl/ecs-math").Quaternion.MutableQuaternion;
|
|
7
7
|
scale: import("@dcl/ecs-math").Vector3.MutableVector3;
|
|
8
|
+
parent?: import("../../engine/entity").Entity | undefined;
|
|
8
9
|
}>>;
|
|
9
10
|
};
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/legacy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,wBAAgB,sBAAsB,CAAC,EACrC,eAAe,EAChB,EAAE,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/legacy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,wBAAgB,sBAAsB,CAAC,EACrC,eAAe,EAChB,EAAE,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC;;;;;;;;EAKjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-20220511175240.commit-459bc31",
|
|
4
4
|
"description": "Decentraland ECS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"files": [
|
|
42
42
|
"dist"
|
|
43
43
|
],
|
|
44
|
-
"commit": "
|
|
44
|
+
"commit": "459bc313d065cf48708becb60d5858d561e9b81d"
|
|
45
45
|
}
|