UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,463 lines (1,462 loc) 605 kB
{ "type": "File", "start": 0, "end": 3874, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 169, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 3874, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 169, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 49, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 49 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 } }, "local": { "type": "Identifier", "start": 7, "end": 12, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 12 }, "identifierName": "Asset" }, "name": "Asset" } } ], "source": { "type": "StringLiteral", "start": 18, "end": 48, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 48 } }, "extra": { "rawValue": "../systems/AssetSystem/Asset", "raw": "'../systems/AssetSystem/Asset'" }, "value": "../systems/AssetSystem/Asset" } }, { "type": "ImportDeclaration", "start": 51, "end": 100, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 49 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 58, "end": 69, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 18 } }, "local": { "type": "Identifier", "start": 58, "end": 69, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 18 }, "identifierName": "AssetSystem" }, "name": "AssetSystem" } } ], "source": { "type": "StringLiteral", "start": 75, "end": 99, "loc": { "start": { "line": 2, "column": 24 }, "end": { "line": 2, "column": 48 } }, "extra": { "rawValue": "../systems/AssetSystem", "raw": "'../systems/AssetSystem'" }, "value": "../systems/AssetSystem" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Pack asset loader.\r\n * It serves also as fetch engine (it's subassets container).\r\n ", "start": 104, "end": 198, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 200, "end": 3872, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 168, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 215, "end": 3872, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 168, "column": 1 } }, "id": { "type": "Identifier", "start": 221, "end": 230, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 30 }, "identifierName": "PackAsset" }, "name": "PackAsset", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 239, "end": 244, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 44 }, "identifierName": "Asset" }, "name": "Asset" }, "body": { "type": "ClassBody", "start": 245, "end": 3872, "loc": { "start": { "line": 8, "column": 45 }, "end": { "line": 168, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 464, "end": 530, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 22, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 471, "end": 478, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 16 }, "identifierName": "factory" }, "name": "factory" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 479, "end": 486, "loc": { "start": { "line": 20, "column": 17 }, "end": { "line": 20, "column": 24 } }, "argument": { "type": "Identifier", "start": 482, "end": 486, "loc": { "start": { "line": 20, "column": 20 }, "end": { "line": 20, "column": 24 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 488, "end": 530, "loc": { "start": { "line": 20, "column": 26 }, "end": { "line": 22, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 495, "end": 525, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 34 } }, "argument": { "type": "NewExpression", "start": 502, "end": 524, "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 33 } }, "callee": { "type": "Identifier", "start": 506, "end": 515, "loc": { "start": { "line": 21, "column": 15 }, "end": { "line": 21, "column": 24 }, "identifierName": "PackAsset" }, "name": "PackAsset" }, "arguments": [ { "type": "SpreadElement", "start": 516, "end": 523, "loc": { "start": { "line": 21, "column": 25 }, "end": { "line": 21, "column": 32 } }, "argument": { "type": "Identifier", "start": 519, "end": 523, "loc": { "start": { "line": 21, "column": 28 }, "end": { "line": 21, "column": 32 }, "identifierName": "args" }, "name": "args" } } ] } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * Asset factory.\r\n *\r\n * @param {*}\targs - Factory parameters.\r\n *\r\n * @return {PackAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('pack', PackAsset.factory);\r\n ", "start": 252, "end": 460, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 19, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 536, "end": 562, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 26, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 566, "end": 727, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 34, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 566, "end": 577, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 27, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 578, "end": 585, "loc": { "start": { "line": 27, "column": 14 }, "end": { "line": 27, "column": 21 } }, "argument": { "type": "Identifier", "start": 581, "end": 585, "loc": { "start": { "line": 27, "column": 17 }, "end": { "line": 27, "column": 21 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 587, "end": 727, "loc": { "start": { "line": 27, "column": 23 }, "end": { "line": 34, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 594, "end": 609, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 19 } }, "expression": { "type": "CallExpression", "start": 594, "end": 608, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 18 } }, "callee": { "type": "Super", "start": 594, "end": 599, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 9 } } }, "arguments": [ { "type": "SpreadElement", "start": 600, "end": 607, "loc": { "start": { "line": 28, "column": 10 }, "end": { "line": 28, "column": 17 } }, "argument": { "type": "Identifier", "start": 603, "end": 607, "loc": { "start": { "line": 28, "column": 13 }, "end": { "line": 28, "column": 17 }, "identifierName": "args" }, "name": "args" } } ] } }, { "type": "ExpressionStatement", "start": 617, "end": 638, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 25 } }, "expression": { "type": "AssignmentExpression", "start": 617, "end": 637, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 617, "end": 633, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 20 } }, "object": { "type": "ThisExpression", "start": 617, "end": 621, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 8 } } }, "property": { "type": "Identifier", "start": 622, "end": 633, "loc": { "start": { "line": 30, "column": 9 }, "end": { "line": 30, "column": 20 }, "identifierName": "_baseOffset" }, "name": "_baseOffset" }, "computed": false }, "right": { "type": "NumericLiteral", "start": 636, "end": 637, "loc": { "start": { "line": 30, "column": 23 }, "end": { "line": 30, "column": 24 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } }, { "type": "ExpressionStatement", "start": 644, "end": 668, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 28 } }, "expression": { "type": "AssignmentExpression", "start": 644, "end": 667, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 27 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 644, "end": 660, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 20 } }, "object": { "type": "ThisExpression", "start": 644, "end": 648, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 8 } } }, "property": { "type": "Identifier", "start": 649, "end": 660, "loc": { "start": { "line": 31, "column": 9 }, "end": { "line": 31, "column": 20 }, "identifierName": "_descriptor" }, "name": "_descriptor" }, "computed": false }, "right": { "type": "NullLiteral", "start": 663, "end": 667, "loc": { "start": { "line": 31, "column": 23 }, "end": { "line": 31, "column": 27 } } } } }, { "type": "ExpressionStatement", "start": 674, "end": 691, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 21 } }, "expression": { "type": "AssignmentExpression", "start": 674, "end": 690, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 674, "end": 683, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 13 } }, "object": { "type": "ThisExpression", "start": 674, "end": 678, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 8 } } }, "property": { "type": "Identifier", "start": 679, "end": 683, "loc": { "start": { "line": 32, "column": 9 }, "end": { "line": 32, "column": 13 }, "identifierName": "_raw" }, "name": "_raw" }, "computed": false }, "right": { "type": "NullLiteral", "start": 686, "end": 690, "loc": { "start": { "line": 32, "column": 16 }, "end": { "line": 32, "column": 20 } } } } }, { "type": "ExpressionStatement", "start": 697, "end": 722, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 697, "end": 721, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 697, "end": 714, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 21 } }, "object": { "type": "ThisExpression", "start": 697, "end": 701, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 8 } } }, "property": { "type": "Identifier", "start": 702, "end": 714, "loc": { "start": { "line": 33, "column": 9 }, "end": { "line": 33, "column": 21 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 717, "end": 721, "loc": { "start": { "line": 33, "column": 24 }, "end": { "line": 33, "column": 28 } } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 536, "end": 562, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 26, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 733, "end": 759, "loc": { "start": { "line": 36, "column": 2 }, "end": { "line": 38, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 763, "end": 1019, "loc": { "start": { "line": 39, "column": 2 }, "end": { "line": 52, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 763, "end": 770, "loc": { "start": { "line": 39, "column": 2 }, "end": { "line": 39, "column": 9 }, "identifierName": "dispose" }, "name": "dispose", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 773, "end": 1019, "loc": { "start": { "line": 39, "column": 12 }, "end": { "line": 52, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 780, "end": 796, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 20 } }, "expression": { "type": "CallExpression", "start": 780, "end": 795, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 19 } }, "callee": { "type": "MemberExpression", "start": 780, "end": 793, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 17 } }, "object": { "type": "Super", "start": 780, "end": 785, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 9 } } }, "property": { "type": "Identifier", "start": 786, "end": 793, "loc": { "start": { "line": 40, "column": 10 }, "end": { "line": 40, "column": 17 }, "identifierName": "dispose" }, "name": "dispose" }, "computed": false }, "arguments": [] } }, { "type": "VariableDeclaration", "start": 804, "end": 834, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 34 } }, "declarations": [ { "type": "VariableDeclarator", "start": 810, "end": 833, "loc": { "start": { "line": 42, "column": 10 }, "end": { "line": 42, "column": 33 } }, "id": { "type": "ObjectPattern", "start": 810, "end": 826, "loc": { "start": { "line": 42, "column": 10 }, "end": { "line": 42, "column": 26 } }, "properties": [ { "type": "ObjectProperty", "start": 812, "end": 824, "loc": { "start": { "line": 42, "column": 12 }, "end": { "line": 42, "column": 24 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 812, "end": 824, "loc": { "start": { "line": 42, "column": 12 }, "end": { "line": 42, "column": 24 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "value": { "type": "Identifier", "start": 812, "end": 824, "loc": { "start": { "line": 42, "column": 12 }, "end": { "line": 42, "column": 24 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "extra": { "shorthand": true } } ] }, "init": { "type": "ThisExpression", "start": 829, "end": 833, "loc": { "start": { "line": 42, "column": 29 }, "end": { "line": 42, "column": 33 } } } } ], "kind": "const" }, { "type": "IfStatement", "start": 842, "end": 901, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 46, "column": 5 } }, "test": { "type": "UnaryExpression", "start": 846, "end": 860, "loc": { "start": { "line": 44, "column": 8 }, "end": { "line": 44, "column": 22 } }, "operator": "!", "prefix": true, "argument": { "type": "UnaryExpression", "start": 847, "end": 860, "loc": { "start": { "line": 44, "column": 9 }, "end": { "line": 44, "column": 22 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 848, "end": 860, "loc": { "start": { "line": 44, "column": 10 }, "end": { "line": 44, "column": 22 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "extra": { "parenthesizedArgument": false } }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 862, "end": 901, "loc": { "start": { "line": 44, "column": 24 }, "end": { "line": 46, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 871, "end": 894, "loc": { "start": { "line": 45, "column": 6 }, "end": { "line": 45, "column": 29 } }, "expression": { "type": "CallExpression", "start": 871, "end": 893, "loc": { "start": { "line": 45, "column": 6 }, "end": { "line": 45, "column": 28 } }, "callee": { "type": "MemberExpression", "start": 871, "end": 891, "loc": { "start": { "line": 45, "column": 6 }, "end": { "line": 45, "column": 26 } }, "object": { "type": "Identifier", "start": 871, "end": 883, "loc": { "start": { "line": 45, "column": 6 }, "end": { "line": 45, "column": 18 }, "identifierName": "_binaryAsset" }, "name": "_binaryAsset" }, "property": {