UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,438 lines (1,437 loc) 154 kB
{ "type": "File", "start": 0, "end": 1075, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 62, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1075, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 62, "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" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Scene asset loader.\r\n ", "start": 53, "end": 85, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 5, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 87, "end": 1073, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 61, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 102, "end": 1073, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 61, "column": 1 } }, "id": { "type": "Identifier", "start": 108, "end": 118, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 31 }, "identifierName": "SceneAsset" }, "name": "SceneAsset", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 127, "end": 132, "loc": { "start": { "line": 6, "column": 40 }, "end": { "line": 6, "column": 45 }, "identifierName": "Asset" }, "name": "Asset" }, "body": { "type": "ClassBody", "start": 133, "end": 1073, "loc": { "start": { "line": 6, "column": 46 }, "end": { "line": 61, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 355, "end": 422, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 20, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 362, "end": 369, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 16 }, "identifierName": "factory" }, "name": "factory" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 370, "end": 377, "loc": { "start": { "line": 18, "column": 17 }, "end": { "line": 18, "column": 24 } }, "argument": { "type": "Identifier", "start": 373, "end": 377, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 24 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 379, "end": 422, "loc": { "start": { "line": 18, "column": 26 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 386, "end": 417, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 35 } }, "argument": { "type": "NewExpression", "start": 393, "end": 416, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 34 } }, "callee": { "type": "Identifier", "start": 397, "end": 407, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 25 }, "identifierName": "SceneAsset" }, "name": "SceneAsset" }, "arguments": [ { "type": "SpreadElement", "start": 408, "end": 415, "loc": { "start": { "line": 19, "column": 26 }, "end": { "line": 19, "column": 33 } }, "argument": { "type": "Identifier", "start": 411, "end": 415, "loc": { "start": { "line": 19, "column": 29 }, "end": { "line": 19, "column": 33 }, "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 {SceneAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('scene', SceneAsset.factory);\r\n ", "start": 140, "end": 351, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 17, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 428, "end": 454, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 24, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 458, "end": 543, "loc": { "start": { "line": 25, "column": 2 }, "end": { "line": 29, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 458, "end": 469, "loc": { "start": { "line": 25, "column": 2 }, "end": { "line": 25, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "RestElement", "start": 470, "end": 477, "loc": { "start": { "line": 25, "column": 14 }, "end": { "line": 25, "column": 21 } }, "argument": { "type": "Identifier", "start": 473, "end": 477, "loc": { "start": { "line": 25, "column": 17 }, "end": { "line": 25, "column": 21 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 479, "end": 543, "loc": { "start": { "line": 25, "column": 23 }, "end": { "line": 29, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 486, "end": 501, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 19 } }, "expression": { "type": "CallExpression", "start": 486, "end": 500, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 18 } }, "callee": { "type": "Super", "start": 486, "end": 491, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 9 } } }, "arguments": [ { "type": "SpreadElement", "start": 492, "end": 499, "loc": { "start": { "line": 26, "column": 10 }, "end": { "line": 26, "column": 17 } }, "argument": { "type": "Identifier", "start": 495, "end": 499, "loc": { "start": { "line": 26, "column": 13 }, "end": { "line": 26, "column": 17 }, "identifierName": "args" }, "name": "args" } } ] } }, { "type": "ExpressionStatement", "start": 509, "end": 538, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 509, "end": 537, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 509, "end": 530, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 25 } }, "object": { "type": "ThisExpression", "start": 509, "end": 513, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 8 } } }, "property": { "type": "Identifier", "start": 514, "end": 530, "loc": { "start": { "line": 28, "column": 9 }, "end": { "line": 28, "column": 25 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 533, "end": 537, "loc": { "start": { "line": 28, "column": 28 }, "end": { "line": 28, "column": 32 } } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 428, "end": 454, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 24, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 549, "end": 575, "loc": { "start": { "line": 31, "column": 2 }, "end": { "line": 33, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 579, "end": 771, "loc": { "start": { "line": 34, "column": 2 }, "end": { "line": 44, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 579, "end": 586, "loc": { "start": { "line": 34, "column": 2 }, "end": { "line": 34, "column": 9 }, "identifierName": "dispose" }, "name": "dispose", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 589, "end": 771, "loc": { "start": { "line": 34, "column": 12 }, "end": { "line": 44, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 596, "end": 612, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 35, "column": 20 } }, "expression": { "type": "CallExpression", "start": 596, "end": 611, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 35, "column": 19 } }, "callee": { "type": "MemberExpression", "start": 596, "end": 609, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 35, "column": 17 } }, "object": { "type": "Super", "start": 596, "end": 601, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 35, "column": 9 } } }, "property": { "type": "Identifier", "start": 602, "end": 609, "loc": { "start": { "line": 35, "column": 10 }, "end": { "line": 35, "column": 17 }, "identifierName": "dispose" }, "name": "dispose" }, "computed": false }, "arguments": [] } }, { "type": "VariableDeclaration", "start": 620, "end": 654, "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 37, "column": 38 } }, "declarations": [ { "type": "VariableDeclarator", "start": 626, "end": 653, "loc": { "start": { "line": 37, "column": 10 }, "end": { "line": 37, "column": 37 } }, "id": { "type": "ObjectPattern", "start": 626, "end": 646, "loc": { "start": { "line": 37, "column": 10 }, "end": { "line": 37, "column": 30 } }, "properties": [ { "type": "ObjectProperty", "start": 628, "end": 644, "loc": { "start": { "line": 37, "column": 12 }, "end": { "line": 37, "column": 28 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 628, "end": 644, "loc": { "start": { "line": 37, "column": 12 }, "end": { "line": 37, "column": 28 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "value": { "type": "Identifier", "start": 628, "end": 644, "loc": { "start": { "line": 37, "column": 12 }, "end": { "line": 37, "column": 28 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "extra": { "shorthand": true } } ] }, "init": { "type": "ThisExpression", "start": 649, "end": 653, "loc": { "start": { "line": 37, "column": 33 }, "end": { "line": 37, "column": 37 } } } } ], "kind": "const" }, { "type": "IfStatement", "start": 662, "end": 729, "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 41, "column": 5 } }, "test": { "type": "UnaryExpression", "start": 666, "end": 684, "loc": { "start": { "line": 39, "column": 8 }, "end": { "line": 39, "column": 26 } }, "operator": "!", "prefix": true, "argument": { "type": "UnaryExpression", "start": 667, "end": 684, "loc": { "start": { "line": 39, "column": 9 }, "end": { "line": 39, "column": 26 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 668, "end": 684, "loc": { "start": { "line": 39, "column": 10 }, "end": { "line": 39, "column": 26 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "extra": { "parenthesizedArgument": false } }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 686, "end": 729, "loc": { "start": { "line": 39, "column": 28 }, "end": { "line": 41, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 695, "end": 722, "loc": { "start": { "line": 40, "column": 6 }, "end": { "line": 40, "column": 33 } }, "expression": { "type": "CallExpression", "start": 695, "end": 721, "loc": { "start": { "line": 40, "column": 6 }, "end": { "line": 40, "column": 32 } }, "callee": { "type": "MemberExpression", "start": 695, "end": 719, "loc": { "start": { "line": 40, "column": 6 }, "end": { "line": 40, "column": 30 } }, "object": { "type": "Identifier", "start": 695, "end": 711, "loc": { "start": { "line": 40, "column": 6 }, "end": { "line": 40, "column": 22 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "property": { "type": "Identifier", "start": 712, "end": 719, "loc": { "start": { "line": 40, "column": 23 }, "end": { "line": 40, "column": 30 }, "identifierName": "dispose" }, "name": "dispose" }, "computed": false }, "arguments": [] } } ], "directives": [] }, "alternate": null }, { "type": "ExpressionStatement", "start": 737, "end": 766, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 737, "end": 765, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 737, "end": 758, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 25 } }, "object": { "type": "ThisExpression", "start": 737, "end": 741, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 8 } } }, "property": { "type": "Identifier", "start": 742, "end": 758, "loc": { "start": { "line": 43, "column": 9 }, "end": { "line": 43, "column": 25 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 761, "end": 765, "loc": { "start": { "line": 43, "column": 28 }, "end": { "line": 43, "column": 32 } } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 549, "end": 575, "loc": { "start": { "line": 31, "column": 2 }, "end": { "line": 33, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 777, "end": 803, "loc": { "start": { "line": 46, "column": 2 }, "end": { "line": 48, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 807, "end": 1068, "loc": { "start": { "line": 49, "column": 2 }, "end": { "line": 59, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 807, "end": 811, "loc": { "start": { "line": 49, "column": 2 }, "end": { "line": 49, "column": 6 }, "identifierName": "load" }, "name": "load", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 814, "end": 1068, "loc": { "start": { "line": 49, "column": 9 }, "end": { "line": 59, "column": 3 } }, "body": [ { "type": "VariableDeclaration", "start": 821, "end": 854, "loc": { "start": { "line": 50, "column": 4 }, "end": { "line": 50, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 827, "end": 853, "loc": { "start": { "line": 50, "column": 10 }, "end": { "line": 50, "column": 36 } }, "id": { "type": "ObjectPattern", "start": 827, "end": 846, "loc": { "start": { "line": 50, "column": 10 }, "end": { "line": 50, "column": 29 } }, "properties": [ { "type": "ObjectProperty", "start": 829, "end": 837, "loc": { "start": { "line": 50, "column": 12 }, "end": { "line": 50, "column": 20 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 829, "end": 837, "loc": { "start": { "line": 50, "column": 12 }, "end": { "line": 50, "column": 20 }, "identifierName": "filename" }, "name": "filename" }, "value": { "type": "Identifier", "start": 829, "end": 837, "loc": { "start": { "line": 50, "column": 12 }, "end": { "line": 50, "column": 20 }, "identifierName": "filename" }, "name": "filename" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 839, "end": 844, "loc": { "start": { "line": 50, "column": 22 }, "end": { "line": 50, "column": 27 } }, "method": false, "shorthand": true,