UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,438 lines (1,437 loc) 637 kB
{ "type": "File", "start": 0, "end": 3352, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 141, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 3352, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 141, "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": "VariableDeclaration", "start": 53, "end": 106, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 53 } }, "declarations": [ { "type": "VariableDeclarator", "start": 59, "end": 105, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 52 } }, "id": { "type": "Identifier", "start": 59, "end": 73, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 20 }, "identifierName": "includePattern" }, "name": "includePattern" }, "init": { "type": "RegExpLiteral", "start": 76, "end": 105, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 52 } }, "extra": { "raw": "/\\#include\\s+\\\"([\\w/.-]+)\\\"/g" }, "pattern": "\\#include\\s+\\\"([\\w/.-]+)\\\"", "flags": "g" } } ], "kind": "const", "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * Shader asset loader.\r\n ", "start": 110, "end": 143, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 145, "end": 3350, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 140, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 160, "end": 3350, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 140, "column": 1 } }, "id": { "type": "Identifier", "start": 166, "end": 177, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 32 }, "identifierName": "ShaderAsset" }, "name": "ShaderAsset", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 186, "end": 191, "loc": { "start": { "line": 8, "column": 41 }, "end": { "line": 8, "column": 46 }, "identifierName": "Asset" }, "name": "Asset" }, "body": { "type": "ClassBody", "start": 192, "end": 3350, "loc": { "start": { "line": 8, "column": 47 }, "end": { "line": 140, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 417, "end": 485, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 22, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 424, "end": 431, "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": 432, "end": 439, "loc": { "start": { "line": 20, "column": 17 }, "end": { "line": 20, "column": 24 } }, "argument": { "type": "Identifier", "start": 435, "end": 439, "loc": { "start": { "line": 20, "column": 20 }, "end": { "line": 20, "column": 24 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 441, "end": 485, "loc": { "start": { "line": 20, "column": 26 }, "end": { "line": 22, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 448, "end": 480, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 36 } }, "argument": { "type": "NewExpression", "start": 455, "end": 479, "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 35 } }, "callee": { "type": "Identifier", "start": 459, "end": 470, "loc": { "start": { "line": 21, "column": 15 }, "end": { "line": 21, "column": 26 }, "identifierName": "ShaderAsset" }, "name": "ShaderAsset" }, "arguments": [ { "type": "SpreadElement", "start": 471, "end": 478, "loc": { "start": { "line": 21, "column": 27 }, "end": { "line": 21, "column": 34 } }, "argument": { "type": "Identifier", "start": 474, "end": 478, "loc": { "start": { "line": 21, "column": 30 }, "end": { "line": 21, "column": 34 }, "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 {ShaderAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('shader', ShaderAsset.factory);\r\n ", "start": 199, "end": 413, "loc": { "start": { "line": 10, "column": 2 }, "end": { "line": 19, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 491, "end": 517, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 26, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 521, "end": 698, "loc": { "start": { "line": 27, "column": 2 }, "end": { "line": 34, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 521, "end": 532, "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": 533, "end": 540, "loc": { "start": { "line": 27, "column": 14 }, "end": { "line": 27, "column": 21 } }, "argument": { "type": "Identifier", "start": 536, "end": 540, "loc": { "start": { "line": 27, "column": 17 }, "end": { "line": 27, "column": 21 }, "identifierName": "args" }, "name": "args" } } ], "body": { "type": "BlockStatement", "start": 542, "end": 698, "loc": { "start": { "line": 27, "column": 23 }, "end": { "line": 34, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 549, "end": 564, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 19 } }, "expression": { "type": "CallExpression", "start": 549, "end": 563, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 18 } }, "callee": { "type": "Super", "start": 549, "end": 554, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 9 } } }, "arguments": [ { "type": "SpreadElement", "start": 555, "end": 562, "loc": { "start": { "line": 28, "column": 10 }, "end": { "line": 28, "column": 17 } }, "argument": { "type": "Identifier", "start": 558, "end": 562, "loc": { "start": { "line": 28, "column": 13 }, "end": { "line": 28, "column": 17 }, "identifierName": "args" }, "name": "args" } } ] } }, { "type": "ExpressionStatement", "start": 572, "end": 601, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 572, "end": 600, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 572, "end": 593, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 25 } }, "object": { "type": "ThisExpression", "start": 572, "end": 576, "loc": { "start": { "line": 30, "column": 4 }, "end": { "line": 30, "column": 8 } } }, "property": { "type": "Identifier", "start": 577, "end": 593, "loc": { "start": { "line": 30, "column": 9 }, "end": { "line": 30, "column": 25 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 596, "end": 600, "loc": { "start": { "line": 30, "column": 28 }, "end": { "line": 30, "column": 32 } } } } }, { "type": "ExpressionStatement", "start": 607, "end": 632, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 607, "end": 631, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 607, "end": 624, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 21 } }, "object": { "type": "ThisExpression", "start": 607, "end": 611, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 8 } } }, "property": { "type": "Identifier", "start": 612, "end": 624, "loc": { "start": { "line": 31, "column": 9 }, "end": { "line": 31, "column": 21 }, "identifierName": "_vertexAsset" }, "name": "_vertexAsset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 627, "end": 631, "loc": { "start": { "line": 31, "column": 24 }, "end": { "line": 31, "column": 28 } } } } }, { "type": "ExpressionStatement", "start": 638, "end": 665, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 638, "end": 664, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 638, "end": 657, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 23 } }, "object": { "type": "ThisExpression", "start": 638, "end": 642, "loc": { "start": { "line": 32, "column": 4 }, "end": { "line": 32, "column": 8 } } }, "property": { "type": "Identifier", "start": 643, "end": 657, "loc": { "start": { "line": 32, "column": 9 }, "end": { "line": 32, "column": 23 }, "identifierName": "_fragmentAsset" }, "name": "_fragmentAsset" }, "computed": false }, "right": { "type": "NullLiteral", "start": 660, "end": 664, "loc": { "start": { "line": 32, "column": 26 }, "end": { "line": 32, "column": 30 } } } } }, { "type": "ExpressionStatement", "start": 671, "end": 693, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 671, "end": 692, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 671, "end": 685, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 18 } }, "object": { "type": "ThisExpression", "start": 671, "end": 675, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 8 } } }, "property": { "type": "Identifier", "start": 676, "end": 685, "loc": { "start": { "line": 33, "column": 9 }, "end": { "line": 33, "column": 18 }, "identifierName": "_includes" }, "name": "_includes" }, "computed": false }, "right": { "type": "NullLiteral", "start": 688, "end": 692, "loc": { "start": { "line": 33, "column": 21 }, "end": { "line": 33, "column": 25 } } } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 491, "end": 517, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 26, "column": 5 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\r\n * @override\r\n ", "start": 704, "end": 730, "loc": { "start": { "line": 36, "column": 2 }, "end": { "line": 38, "column": 5 } } } ] }, { "type": "ClassMethod", "start": 734, "end": 1330, "loc": { "start": { "line": 39, "column": 2 }, "end": { "line": 68, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 734, "end": 741, "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": 744, "end": 1330, "loc": { "start": { "line": 39, "column": 12 }, "end": { "line": 68, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 751, "end": 767, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 20 } }, "expression": { "type": "CallExpression", "start": 751, "end": 766, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 19 } }, "callee": { "type": "MemberExpression", "start": 751, "end": 764, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 17 } }, "object": { "type": "Super", "start": 751, "end": 756, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 9 } } }, "property": { "type": "Identifier", "start": 757, "end": 764, "loc": { "start": { "line": 40, "column": 10 }, "end": { "line": 40, "column": 17 }, "identifierName": "dispose" }, "name": "dispose" }, "computed": false }, "arguments": [] } }, { "type": "VariableDeclaration", "start": 775, "end": 883, "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 47, "column": 13 } }, "declarations": [ { "type": "VariableDeclarator", "start": 781, "end": 882, "loc": { "start": { "line": 42, "column": 10 }, "end": { "line": 47, "column": 12 } }, "id": { "type": "ObjectPattern", "start": 781, "end": 875, "loc": { "start": { "line": 42, "column": 10 }, "end": { "line": 47, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 790, "end": 806, "loc": { "start": { "line": 43, "column": 6 }, "end": { "line": 43, "column": 22 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 790, "end": 806, "loc": { "start": { "line": 43, "column": 6 }, "end": { "line": 43, "column": 22 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "value": { "type": "Identifier", "start": 790, "end": 806, "loc": { "start": { "line": 43, "column": 6 }, "end": { "line": 43, "column": 22 }, "identifierName": "_descriptorAsset" }, "name": "_descriptorAsset" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 815, "end": 827, "loc": { "start": { "line": 44, "column": 6 }, "end": { "line": 44, "column": 18 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 815, "end": 827, "loc": { "start": { "line": 44, "column": 6 }, "end": { "line": 44, "column": 18 }, "identifierName": "_vertexAsset" }, "name": "_vertexAsset" }, "value": { "type": "Identifier", "start": 815, "end": 827, "loc": { "start": { "line": 44, "column": 6 }, "end": { "line": 44, "column": 18 }, "identifierName": "_vertexAsset" }, "name": "_vertexAsset" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 836, "end": 850, "loc": { "start": { "line": 45, "column": 6 }, "end": { "line": 45, "column": 20 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 836, "end": 850, "loc": { "start": { "line": 45, "column": 6 }, "end": { "line": 45, "column": 20 }, "identifierName": "_fragmentAsset" }, "name": "_fragmentAsset" }, "value": { "type": "Identifier", "start": 836, "end": 850, "loc": { "start": { "line": 45, "column": 6 }, "end": { "line": 45, "column": 20 }, "identifierName": "_fragmentAsset" }, "name": "_fragmentAsset" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 859, "end": 868, "loc": { "start": { "line": 46, "column": 6 }, "end": { "line": 46, "column": 15 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 859, "end": 868, "loc": { "start": { "line": 46, "column": 6 }, "end": { "line": 46, "column": 15 }, "identifierName": "_includes" }, "name": "_includes" }, "value": { "type": "Identifier",