oxygen-core
Version:
Oxygen game engine (Xenon Core for browsers)
1,322 lines (1,321 loc) • 636 kB
JSON
{
"type": "File",
"start": 0,
"end": 3325,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 135,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 3325,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 135,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 30
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 13
},
"identifierName": "Sprite"
},
"name": "Sprite"
}
}
],
"source": {
"type": "StringLiteral",
"start": 19,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 29
}
},
"extra": {
"rawValue": "./Sprite",
"raw": "'./Sprite'"
},
"value": "./Sprite"
}
},
{
"type": "ImportDeclaration",
"start": 32,
"end": 71,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 39
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 39,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 39,
"end": 45,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 13
},
"identifierName": "System"
},
"name": "System"
}
}
],
"source": {
"type": "StringLiteral",
"start": 51,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 19
},
"end": {
"line": 2,
"column": 38
}
},
"extra": {
"rawValue": "../systems/System",
"raw": "'../systems/System'"
},
"value": "../systems/System"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Atlas sprite renderer.\r\n *\r\n * @example\r\n * const component = new AtlasSprite();\r\n * component.deserialize({ shader: 'shader://sprite.json', atlas: 'atlas://sheet.json:box.png' });\r\n ",
"start": 75,
"end": 268,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 10,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 270,
"end": 3323,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 134,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 285,
"end": 3323,
"loc": {
"start": {
"line": 11,
"column": 15
},
"end": {
"line": 134,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 291,
"end": 302,
"loc": {
"start": {
"line": 11,
"column": 21
},
"end": {
"line": 11,
"column": 32
},
"identifierName": "AtlasSprite"
},
"name": "AtlasSprite",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 311,
"end": 317,
"loc": {
"start": {
"line": 11,
"column": 41
},
"end": {
"line": 11,
"column": 47
},
"identifierName": "Sprite"
},
"name": "Sprite"
},
"body": {
"type": "ClassBody",
"start": 318,
"end": 3323,
"loc": {
"start": {
"line": 11,
"column": 48
},
"end": {
"line": 134,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 418,
"end": 472,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 20,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 425,
"end": 432,
"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": [],
"body": {
"type": "BlockStatement",
"start": 435,
"end": 472,
"loc": {
"start": {
"line": 18,
"column": 19
},
"end": {
"line": 20,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 442,
"end": 467,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 29
}
},
"argument": {
"type": "NewExpression",
"start": 449,
"end": 466,
"loc": {
"start": {
"line": 19,
"column": 11
},
"end": {
"line": 19,
"column": 28
}
},
"callee": {
"type": "Identifier",
"start": 453,
"end": 464,
"loc": {
"start": {
"line": 19,
"column": 15
},
"end": {
"line": 19,
"column": 26
},
"identifierName": "AtlasSprite"
},
"name": "AtlasSprite"
},
"arguments": []
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\r\n * Component factory.\r\n *\r\n * @return {AtlasSprite} Component instance.\r\n ",
"start": 325,
"end": 414,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 17,
"column": 5
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @type {*} ",
"start": 478,
"end": 494,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 22,
"column": 18
}
}
}
]
},
{
"type": "ClassMethod",
"start": 498,
"end": 1137,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 39,
"column": 3
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 509,
"end": 519,
"loc": {
"start": {
"line": 23,
"column": 13
},
"end": {
"line": 23,
"column": 23
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 522,
"end": 1137,
"loc": {
"start": {
"line": 23,
"column": 26
},
"end": {
"line": 39,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 529,
"end": 1132,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 38,
"column": 6
}
},
"argument": {
"type": "ObjectExpression",
"start": 536,
"end": 1131,
"loc": {
"start": {
"line": 24,
"column": 11
},
"end": {
"line": 38,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 545,
"end": 579,
"loc": {
"start": {
"line": 25,
"column": 6
},
"end": {
"line": 25,
"column": 40
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 545,
"end": 552,
"loc": {
"start": {
"line": 25,
"column": 6
},
"end": {
"line": 25,
"column": 13
},
"identifierName": "visible"
},
"name": "visible"
},
"value": {
"type": "MemberExpression",
"start": 554,
"end": 579,
"loc": {
"start": {
"line": 25,
"column": 15
},
"end": {
"line": 25,
"column": 40
}
},
"object": {
"type": "MemberExpression",
"start": 554,
"end": 571,
"loc": {
"start": {
"line": 25,
"column": 15
},
"end": {
"line": 25,
"column": 32
}
},
"object": {
"type": "Identifier",
"start": 554,
"end": 560,
"loc": {
"start": {
"line": 25,
"column": 15
},
"end": {
"line": 25,
"column": 21
},
"identifierName": "Sprite"
},
"name": "Sprite"
},
"property": {
"type": "Identifier",
"start": 561,
"end": 571,
"loc": {
"start": {
"line": 25,
"column": 22
},
"end": {
"line": 25,
"column": 32
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 572,
"end": 579,
"loc": {
"start": {
"line": 25,
"column": 33
},
"end": {
"line": 25,
"column": 40
},
"identifierName": "visible"
},
"name": "visible"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 588,
"end": 620,
"loc": {
"start": {
"line": 26,
"column": 6
},
"end": {
"line": 26,
"column": 38
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 588,
"end": 594,
"loc": {
"start": {
"line": 26,
"column": 6
},
"end": {
"line": 26,
"column": 12
},
"identifierName": "shader"
},
"name": "shader"
},
"value": {
"type": "MemberExpression",
"start": 596,
"end": 620,
"loc": {
"start": {
"line": 26,
"column": 14
},
"end": {
"line": 26,
"column": 38
}
},
"object": {
"type": "MemberExpression",
"start": 596,
"end": 613,
"loc": {
"start": {
"line": 26,
"column": 14
},
"end": {
"line": 26,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 596,
"end": 602,
"loc": {
"start": {
"line": 26,
"column": 14
},
"end": {
"line": 26,
"column": 20
},
"identifierName": "Sprite"
},
"name": "Sprite"
},
"property": {
"type": "Identifier",
"start": 603,
"end": 613,
"loc": {
"start": {
"line": 26,
"column": 21
},
"end": {
"line": 26,
"column": 31
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 614,
"end": 620,
"loc": {
"start": {
"line": 26,
"column": 32
},
"end": {
"line": 26,
"column": 38
},
"identifierName": "shader"
},
"name": "shader"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 629,
"end": 681,
"loc": {
"start": {
"line": 27,
"column": 6
},
"end": {
"line": 27,
"column": 58
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 629,
"end": 645,
"loc": {
"start": {
"line": 27,
"column": 6
},
"end": {
"line": 27,
"column": 22
},
"identifierName": "overrideUniforms"
},
"name": "overrideUniforms"
},
"value": {
"type": "MemberExpression",
"start": 647,
"end": 681,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 27,
"column": 58
}
},
"object": {
"type": "MemberExpression",
"start": 647,
"end": 664,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 27,
"column": 41
}
},
"object": {
"type": "Identifier",
"start": 647,
"end": 653,
"loc": {
"start": {
"line": 27,
"column": 24
},
"end": {
"line": 27,
"column": 30
},
"identifierName": "Sprite"
},
"name": "Sprite"
},
"property": {
"type": "Identifier",
"start": 654,
"end": 664,
"loc": {
"start": {
"line": 27,
"column": 31
},
"end": {
"line": 27,
"column": 41
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 665,
"end": 681,
"loc": {
"start": {
"line": 27,
"column": 42
},
"end": {
"line": 27,
"column": 58
},
"identifierName": "overrideUniforms"
},
"name": "overrideUniforms"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 690,
"end": 742,
"loc": {
"start": {
"line": 28,
"column": 6
},
"end": {
"line": 28,
"column": 58
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 690,
"end": 706,
"loc": {
"start": {
"line": 28,
"column": 6
},
"end": {
"line": 28,
"column": 22
},
"identifierName": "overrideSamplers"
},
"name": "overrideSamplers"
},
"value": {
"type": "MemberExpression",
"start": 708,
"end": 742,
"loc": {
"start": {
"line": 28,
"column": 24
},
"end": {
"line": 28,
"column": 58
}
},
"object": {
"type": "MemberExpression",
"start": 708,
"end": 725,
"loc": {
"start": {
"line": 28,
"column": 24
},
"end": {
"line": 28,
"column": 41
}
},
"object": {
"type": "Identifier",
"start": 708,
"end": 714,
"loc": {
"start": {
"line": 28,
"column": 24
},
"end": {
"line": 28,
"column": 30
},
"identifierName": "Sprite"
},
"name": "Sprite"
},
"property": {
"type": "Identifier",
"start": 715,
"end": 725,
"loc": {
"start": {
"line": 28,
"column": 31
},
"end": {
"line": 28,
"column": 41
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 726,
"end": 742,
"loc": {
"start": {
"line": 28,
"column": 42
},
"end": {
"line": 28,
"column": 58
},
"identifierName": "overrideSamplers"
},
"name": "overrideSamplers"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 751,
"end": 783,
"loc": {
"start": {
"line": 29,
"column": 6
},
"end": {
"line": 29,
"column": 38
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 751,
"end": 757,
"loc": {
"start": {
"line": 29,
"column": 6
},
"end": {
"line": 29,
"column": 12
},
"identifierName": "layers"
},
"name": "layers"
},
"value": {
"type": "MemberExpression",
"start": 759,
"end": 783,
"loc": {
"start": {
"line": 29,
"column": 14
},
"end": {
"line": 29,
"column": 38
}
},
"object": {
"type": "MemberExpression",
"start": 759,
"end": 776,
"loc": {
"start": {
"line": 29,
"column": 14
},
"end": {
"line": 29,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 759,
"end": 765,
"loc": {
"start": {
"line": 29,
"column": 14
},
"end": {
"line": 29,
"column": 20
},
"identifierName": "Sprite"
},
"name": "Sprite"
},
"property": {
"type": "Identifier",
"start": 766,
"end": 776,
"loc": {
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 29,
"column": 31
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 777,
"end": 783,
"loc": {
"start": {
"line": 29,
"column": 32
},
"end": {
"line": 29,
"column": 38
},
"identifierName": "layers"
},
"name": "layers"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 792,
"end": 826,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 40
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 792,
"end": 799,
"loc": {
"start": {
"line": 30,
"column": 6
},
"end": {
"line": 30,
"column": 13
},
"identifierName": "xOffset"
},
"name": "xOffset"
},
"value": {
"type": "MemberExpression",
"start": 801,
"end": 826,
"loc": {
"start": {
"line": 30,
"column": 15
},
"end": {
"line": 30,
"column": 40
}
},
"object": {
"type": "MemberExpression",
"start": 801,
"end": 818,
"loc": {
"start": {
"line": 30,
"column": 15
},
"end": {
"line": 30,
"column": 32
}
},
"object": {
"type": "Identifier",
"start": 801,
"end": 807,
"loc": {
"start": {
"line": 30,
"column": 15
},
"end": {
"line": 30,
"column": 21
},
"identifierName": "Sprite"
},
"name": "Sprite"
},
"property": {
"type": "Identifier",
"start": 808,
"end": 818,
"loc": {
"start": {
"line": 30,
"column": 22
},
"end": {
"line": 30,
"column": 32
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 819,
"end": 826,
"loc": {
"start": {
"line": 30,
"column": 33
},
"end": {
"line": 30,
"column": 40
},
"identifierName": "xOffset"
},
"name": "xOffset"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 835,
"end": 869,
"loc": {
"start": {
"line": 31,
"column": 6
},
"end": {
"line": 31,
"column": 40
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 835,
"end": 842,
"loc": {
"start": {
"line": 31,
"column": 6
},
"end": {
"line": 31,
"column": 13
},
"identifierName": "yOffset"
},
"name": "yOffset"
},
"value": {
"type": "MemberExpression",
"start": 844,
"end": 869,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 40
}
},
"object": {
"type": "MemberExpression",
"start": 844,
"end": 861,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 32
}
},
"object": {
"type": "Identifier",
"start": 844,
"end": 850,
"loc": {
"start": {
"line": 31,
"column": 15
},
"end": {
"line": 31,
"column": 21
},
"identifierName": "Sprite"
},
"name": "Sprite"
},
"property": {
"type": "Identifier",
"start": 851,
"end": 861,
"loc": {
"start": {
"line": 31,
"column": 22
},
"end": {
"line": 31,
"column": 32
},
"identifierName": "propsTypes"
},
"name": "propsTypes"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 862,
"end": 869,
"loc": {
"start": {
"line": 31,
"column": 33
},
"end": {
"line": 31,
"column": 40
},
"identifierName": "yOffset"
},
"name": "yOffset"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 878,
"end": 912,
"loc": {