oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,536 lines • 83.4 kB
JSON
{
"type": "File",
"start": 0,
"end": 706,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 37,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 706,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 37,
"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 * Particle system asset loader.\r\n ",
"start": 53,
"end": 95,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 97,
"end": 704,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 36,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 112,
"end": 704,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 36,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 118,
"end": 137,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 40
},
"identifierName": "ParticleSystemAsset"
},
"name": "ParticleSystemAsset",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 146,
"end": 151,
"loc": {
"start": {
"line": 6,
"column": 49
},
"end": {
"line": 6,
"column": 54
},
"identifierName": "Asset"
},
"name": "Asset"
},
"body": {
"type": "ClassBody",
"start": 152,
"end": 704,
"loc": {
"start": {
"line": 6,
"column": 55
},
"end": {
"line": 36,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 396,
"end": 472,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 20,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 403,
"end": 410,
"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": 411,
"end": 418,
"loc": {
"start": {
"line": 18,
"column": 17
},
"end": {
"line": 18,
"column": 24
}
},
"argument": {
"type": "Identifier",
"start": 414,
"end": 418,
"loc": {
"start": {
"line": 18,
"column": 20
},
"end": {
"line": 18,
"column": 24
},
"identifierName": "args"
},
"name": "args"
}
}
],
"body": {
"type": "BlockStatement",
"start": 420,
"end": 472,
"loc": {
"start": {
"line": 18,
"column": 26
},
"end": {
"line": 20,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 427,
"end": 467,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 44
}
},
"argument": {
"type": "NewExpression",
"start": 434,
"end": 466,
"loc": {
"start": {
"line": 19,
"column": 11
},
"end": {
"line": 19,
"column": 43
}
},
"callee": {
"type": "Identifier",
"start": 438,
"end": 457,
"loc": {
"start": {
"line": 19,
"column": 15
},
"end": {
"line": 19,
"column": 34
},
"identifierName": "ParticleSystemAsset"
},
"name": "ParticleSystemAsset"
},
"arguments": [
{
"type": "SpreadElement",
"start": 458,
"end": 465,
"loc": {
"start": {
"line": 19,
"column": 35
},
"end": {
"line": 19,
"column": 42
}
},
"argument": {
"type": "Identifier",
"start": 461,
"end": 465,
"loc": {
"start": {
"line": 19,
"column": 38
},
"end": {
"line": 19,
"column": 42
},
"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 {ParticleSystemAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('particles', ParticleSystemAsset.factory);\r\n ",
"start": 159,
"end": 392,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 17,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * @override\r\n ",
"start": 478,
"end": 504,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 24,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 508,
"end": 699,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 34,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 508,
"end": 512,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 6
},
"identifierName": "load"
},
"name": "load",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 515,
"end": 699,
"loc": {
"start": {
"line": 25,
"column": 9
},
"end": {
"line": 34,
"column": 3
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 522,
"end": 555,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 26,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 528,
"end": 554,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 36
}
},
"id": {
"type": "ObjectPattern",
"start": 528,
"end": 547,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 29
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 530,
"end": 538,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 20
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 530,
"end": 538,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 20
},
"identifierName": "filename"
},
"name": "filename"
},
"value": {
"type": "Identifier",
"start": 530,
"end": 538,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 20
},
"identifierName": "filename"
},
"name": "filename"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 540,
"end": 545,
"loc": {
"start": {
"line": 26,
"column": 22
},
"end": {
"line": 26,
"column": 27
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 540,
"end": 545,
"loc": {
"start": {
"line": 26,
"column": 22
},
"end": {
"line": 26,
"column": 27
},
"identifierName": "owner"
},
"name": "owner"
},
"value": {
"type": "Identifier",
"start": 540,
"end": 545,
"loc": {
"start": {
"line": 26,
"column": 22
},
"end": {
"line": 26,
"column": 27
},
"identifierName": "owner"
},
"name": "owner"
},
"extra": {
"shorthand": true
}
}
]
},
"init": {
"type": "ThisExpression",
"start": 550,
"end": 554,
"loc": {
"start": {
"line": 26,
"column": 32
},
"end": {
"line": 26,
"column": 36
}
}
}
}
],
"kind": "const"
},
{
"type": "ReturnStatement",
"start": 563,
"end": 694,
"loc": {
"start": {
"line": 28,
"column": 4
},
"end": {
"line": 33,
"column": 9
}
},
"argument": {
"type": "CallExpression",
"start": 570,
"end": 693,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 33,
"column": 8
}
},
"callee": {
"type": "MemberExpression",
"start": 570,
"end": 615,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 29,
"column": 11
}
},
"object": {
"type": "CallExpression",
"start": 570,
"end": 602,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 28,
"column": 43
}
},
"callee": {
"type": "MemberExpression",
"start": 570,
"end": 580,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 28,
"column": 21
}
},
"object": {
"type": "Identifier",
"start": 570,
"end": 575,
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 28,
"column": 16
},
"identifierName": "owner"
},
"name": "owner"
},
"property": {
"type": "Identifier",
"start": 576,
"end": 580,
"loc": {
"start": {
"line": 28,
"column": 17
},
"end": {
"line": 28,
"column": 21
},
"identifierName": "load"
},
"name": "load"
},
"computed": false
},
"arguments": [
{
"type": "TemplateLiteral",
"start": 581,
"end": 601,
"loc": {
"start": {
"line": 28,
"column": 22
},
"end": {
"line": 28,
"column": 42
}
},
"expressions": [
{
"type": "Identifier",
"start": 591,
"end": 599,
"loc": {
"start": {
"line": 28,
"column": 32
},
"end": {
"line": 28,
"column": 40
},
"identifierName": "filename"
},
"name": "filename"
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 582,
"end": 589,
"loc": {
"start": {
"line": 28,
"column": 23
},
"end": {
"line": 28,
"column": 30
}
},
"value": {
"raw": "text://",
"cooked": "text://"
},
"tail": false
},
{
"type": "TemplateElement",
"start": 600,
"end": 600,
"loc": {
"start": {
"line": 28,
"column": 41
},
"end": {
"line": 28,
"column": 41
}
},
"value": {
"raw": "",
"cooked": ""
},
"tail": true
}
]
}
]
},
"property": {
"type": "Identifier",
"start": 611,
"end": 615,
"loc": {
"start": {
"line": 29,
"column": 7
},
"end": {
"line": 29,
"column": 11
},
"identifierName": "then"
},
"name": "then"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 616,
"end": 692,
"loc": {
"start": {
"line": 29,
"column": 12
},
"end": {
"line": 33,
"column": 7
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 616,
"end": 621,
"loc": {
"start": {
"line": 29,
"column": 12
},
"end": {
"line": 29,
"column": 17
},
"identifierName": "asset"
},
"name": "asset"
}
],
"body": {
"type": "BlockStatement",
"start": 625,
"end": 692,
"loc": {
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 33,
"column": 7
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 636,
"end": 659,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 636,
"end": 658,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 636,
"end": 645,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 636,
"end": 640,
"loc": {
"start": {
"line": 30,
"column": 8
},
"end": {
"line": 30,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 641,
"end": 645,
"loc": {
"start": {
"line": 30,
"column": 13
},
"end": {
"line": 30,
"column": 17
},
"identifierName": "data"
},
"name": "data"
},
"computed": false
},
"right": {
"type": "MemberExpression",
"start": 648,
"end": 658,
"loc": {
"start": {
"line": 30,
"column": 20
},
"end": {
"line": 30,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 648,
"end": 653,
"loc": {
"start": {
"line": 30,
"column": 20
},
"end": {
"line": 30,
"column": 25
},
"identifierName": "asset"
},
"name": "asset"
},
"property": {
"type": "Identifier",
"start": 654,
"end": 658,
"loc": {
"start": {
"line": 30,
"column": 26
},
"end": {
"line": 30,
"column": 30
},
"identifierName": "data"
},
"name": "data"
},
"computed": false
}
}
},
{
"type": "ReturnStatement",
"start": 671,
"end": 683,
"loc": {
"start": {
"line": 32,
"column": 8
},
"end": {
"line": 32,
"column": 20
}
},
"argument": {
"type": "ThisExpression",
"start": 678,
"end": 682,
"loc": {
"start": {
"line": 32,
"column": 15
},
"end": {
"line": 32,
"column": 19
}
}
}
}
],
"directives": []
}
}
]
}
}
],
"directives": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * @override\r\n ",
"start": 478,
"end": 504,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 24,
"column": 5
}
}
}
]
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Particle system asset loader.\r\n ",
"start": 53,
"end": 95,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
}
],
"trailingComments": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Particle system asset loader.\r\n ",
"start": 53,
"end": 95,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": "*\r\n * Particle system asset loader.\r\n ",
"start": 53,
"end": 95,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
},
{
"type": "CommentBlock",
"value": "*\r\n * Asset factory.\r\n *\r\n * @param {*}\targs - Factory parameters.\r\n *\r\n * @return {ParticleSystemAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('particles', ParticleSystemAsset.factory);\r\n ",
"start": 159,
"end": 392,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 17,
"column": 5
}
}
},
{
"type": "CommentBlock",
"value": "*\r\n * @override\r\n ",
"start": 478,
"end": 504,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 24,
"column": 5
}
}
}
],
"tokens": [
{
"type": {
"label": "import",
"keyword": "import",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "import",
"start": 0,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Asset",
"start": 7,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 12
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "from",
"start": 13,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 17
}
}
},
{
"type": {
"label": "string",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "../systems/AssetSystem/Asset",
"start": 18,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 48
}
}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 48,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 48
},
"end": {
"line": 1,
"column": 49
}
}
},
{
"type": "CommentBlock",
"value": "*\r\n * Particle system asset loader.\r\n ",
"start": 53,
"end": 95,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 3
}
}
},
{
"type": {
"label": "export",
"keyword": "export",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "export",
"start": 97,
"end": 103,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 6
}
}
},
{
"type": {
"label": "default",
"keyword": "default",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "default",
"start": 104,
"end": 111,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 14
}
}
},
{
"type": {
"label": "class",
"keyword": "class",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "class",
"start": 112,
"end": 117,
"loc": {
"start": {
"line": 6,
"column": 15
},
"end": {
"line": 6,
"column": 20
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "ParticleSystemAsset",
"start": 118,
"end": 137,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 40
}
}
},
{
"type": {
"label": "extends",
"keyword": "extends",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "extends",
"start": 138,
"end": 145,
"loc": {
"start": {
"line": 6,
"column": 41
},
"end": {
"line": 6,
"column": 48
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Asset",
"start": 146,
"end": 151,
"loc": {
"start": {
"line": 6,
"column": 49
},
"end": {
"line": 6,
"column": 54
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 152,
"end": 153,
"loc": {
"start": {
"line": 6,
"column": 55
},
"end": {
"line": 6,
"column": 56
}
}
},
{
"type": "CommentBlock",
"value": "*\r\n * Asset factory.\r\n *\r\n * @param {*}\targs - Factory parameters.\r\n *\r\n * @return {ParticleSystemAsset} Asset instance.\r\n *\r\n * @example\r\n * system.registerProtocol('particles', ParticleSystemAsset.factory);\r\n ",
"start": 159,
"end": 392,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 17,
"column": 5
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"