UNPKG

oxygen-core

Version:

Oxygen game engine (Xenon Core for browsers)

1,486 lines (1,485 loc) 475 kB
{ "type": "File", "start": 0, "end": 2551, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 125, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2551, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 125, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 28, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 28 } }, "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": "Shape" }, "name": "Shape" } } ], "source": { "type": "StringLiteral", "start": 18, "end": 27, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 27 } }, "extra": { "rawValue": "./Shape", "raw": "'./Shape'" }, "value": "./Shape" } }, { "type": "ImportDeclaration", "start": 30, "end": 72, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 42 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 39, "end": 43, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 13 } }, "imported": { "type": "Identifier", "start": 39, "end": 43, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 13 }, "identifierName": "vec2" }, "name": "vec2" }, "local": { "type": "Identifier", "start": 39, "end": 43, "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 13 }, "identifierName": "vec2" }, "name": "vec2" } } ], "source": { "type": "StringLiteral", "start": 51, "end": 71, "loc": { "start": { "line": 2, "column": 21 }, "end": { "line": 2, "column": 41 } }, "extra": { "rawValue": "../utils/gl-matrix", "raw": "'../utils/gl-matrix'" }, "value": "../utils/gl-matrix" } }, { "type": "VariableDeclaration", "start": 76, "end": 109, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 82, "end": 108, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 32 } }, "id": { "type": "Identifier", "start": 82, "end": 92, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 16 }, "identifierName": "cachedVec2" }, "name": "cachedVec2" }, "init": { "type": "CallExpression", "start": 95, "end": 108, "loc": { "start": { "line": 4, "column": 19 }, "end": { "line": 4, "column": 32 } }, "callee": { "type": "MemberExpression", "start": 95, "end": 106, "loc": { "start": { "line": 4, "column": 19 }, "end": { "line": 4, "column": 30 } }, "object": { "type": "Identifier", "start": 95, "end": 99, "loc": { "start": { "line": 4, "column": 19 }, "end": { "line": 4, "column": 23 }, "identifierName": "vec2" }, "name": "vec2" }, "property": { "type": "Identifier", "start": 100, "end": 106, "loc": { "start": { "line": 4, "column": 24 }, "end": { "line": 4, "column": 30 }, "identifierName": "create" }, "name": "create" }, "computed": false }, "arguments": [] } } ], "kind": "const" }, { "type": "ExportDefaultDeclaration", "start": 113, "end": 2549, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 124, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 128, "end": 2549, "loc": { "start": { "line": 6, "column": 15 }, "end": { "line": 124, "column": 1 } }, "id": { "type": "Identifier", "start": 134, "end": 148, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 35 }, "identifierName": "RectangleShape" }, "name": "RectangleShape" }, "superClass": { "type": "Identifier", "start": 157, "end": 162, "loc": { "start": { "line": 6, "column": 44 }, "end": { "line": 6, "column": 49 }, "identifierName": "Shape" }, "name": "Shape" }, "body": { "type": "ClassBody", "start": 163, "end": 2549, "loc": { "start": { "line": 6, "column": 50 }, "end": { "line": 124, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 170, "end": 227, "loc": { "start": { "line": 8, "column": 2 }, "end": { "line": 10, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 177, "end": 184, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 16 }, "identifierName": "factory" }, "name": "factory" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 187, "end": 227, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 10, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 194, "end": 222, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 32 } }, "argument": { "type": "NewExpression", "start": 201, "end": 221, "loc": { "start": { "line": 9, "column": 11 }, "end": { "line": 9, "column": 31 } }, "callee": { "type": "Identifier", "start": 205, "end": 219, "loc": { "start": { "line": 9, "column": 15 }, "end": { "line": 9, "column": 29 }, "identifierName": "RectangleShape" }, "name": "RectangleShape" }, "arguments": [] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 233, "end": 465, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 22, "column": 3 } }, "static": true, "computed": false, "key": { "type": "Identifier", "start": 244, "end": 254, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 23 }, "identifierName": "propsTypes" }, "name": "propsTypes" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 257, "end": 465, "loc": { "start": { "line": 12, "column": 26 }, "end": { "line": 22, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 264, "end": 460, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 21, "column": 6 } }, "argument": { "type": "ObjectExpression", "start": 271, "end": 459, "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 21, "column": 5 } }, "properties": [ { "type": "SpreadProperty", "start": 280, "end": 299, "loc": { "start": { "line": 14, "column": 6 }, "end": { "line": 14, "column": 25 } }, "argument": { "type": "MemberExpression", "start": 283, "end": 299, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 25 } }, "object": { "type": "Identifier", "start": 283, "end": 288, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 14 }, "identifierName": "Shape" }, "name": "Shape" }, "property": { "type": "Identifier", "start": 289, "end": 299, "loc": { "start": { "line": 14, "column": 15 }, "end": { "line": 14, "column": 25 }, "identifierName": "propsTypes" }, "name": "propsTypes" }, "computed": false } }, { "type": "ObjectProperty", "start": 308, "end": 323, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 21 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 308, "end": 313, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 11 }, "identifierName": "width" }, "name": "width" }, "value": { "type": "StringLiteral", "start": 315, "end": 323, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 21 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" } }, { "type": "ObjectProperty", "start": 332, "end": 348, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 332, "end": 338, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 12 }, "identifierName": "height" }, "name": "height" }, "value": { "type": "StringLiteral", "start": 340, "end": 348, "loc": { "start": { "line": 16, "column": 14 }, "end": { "line": 16, "column": 22 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" } }, { "type": "ObjectProperty", "start": 357, "end": 374, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 23 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 357, "end": 364, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 13 }, "identifierName": "xOffset" }, "name": "xOffset" }, "value": { "type": "StringLiteral", "start": 366, "end": 374, "loc": { "start": { "line": 17, "column": 15 }, "end": { "line": 17, "column": 23 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" } }, { "type": "ObjectProperty", "start": 383, "end": 400, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 23 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 383, "end": 390, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 13 }, "identifierName": "yOffset" }, "name": "yOffset" }, "value": { "type": "StringLiteral", "start": 392, "end": 400, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 23 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" } }, { "type": "ObjectProperty", "start": 409, "end": 426, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 23 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 409, "end": 416, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 13 }, "identifierName": "xOrigin" }, "name": "xOrigin" }, "value": { "type": "StringLiteral", "start": 418, "end": 426, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 23 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" } }, { "type": "ObjectProperty", "start": 435, "end": 452, "loc": { "start": { "line": 20, "column": 6 }, "end": { "line": 20, "column": 23 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 435, "end": 442, "loc": { "start": { "line": 20, "column": 6 }, "end": { "line": 20, "column": 13 }, "identifierName": "yOrigin" }, "name": "yOrigin" }, "value": { "type": "StringLiteral", "start": 444, "end": 452, "loc": { "start": { "line": 20, "column": 15 }, "end": { "line": 20, "column": 23 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" } } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 471, "end": 514, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 26, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 475, "end": 480, "loc": { "start": { "line": 24, "column": 6 }, "end": { "line": 24, "column": 11 }, "identifierName": "width" }, "name": "width" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 483, "end": 514, "loc": { "start": { "line": 24, "column": 14 }, "end": { "line": 26, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 490, "end": 509, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 23 } }, "argument": { "type": "MemberExpression", "start": 497, "end": 508, "loc": { "start": { "line": 25, "column": 11 }, "end": { "line": 25, "column": 22 } }, "object": { "type": "ThisExpression", "start": 497, "end": 501, "loc": { "start": { "line": 25, "column": 11 }, "end": { "line": 25, "column": 15 } } }, "property": { "type": "Identifier", "start": 502, "end": 508, "loc": { "start": { "line": 25, "column": 16 }, "end": { "line": 25, "column": 22 }, "identifierName": "_width" }, "name": "_width" }, "computed": false } } ], "directives": [] } }, { "type": "ClassMethod", "start": 520, "end": 674, "loc": { "start": { "line": 28, "column": 2 }, "end": { "line": 34, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 524, "end": 529, "loc": { "start": { "line": 28, "column": 6 }, "end": { "line": 28, "column": 11 }, "identifierName": "width" }, "name": "width" }, "kind": "set", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 530, "end": 535, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 17 }, "identifierName": "value" }, "name": "value" } ], "body": { "type": "BlockStatement", "start": 537, "end": 674, "loc": { "start": { "line": 28, "column": 19 }, "end": { "line": 34, "column": 3 } }, "body": [ { "type": "IfStatement", "start": 544, "end": 641, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 31, "column": 5 } }, "test": { "type": "BinaryExpression", "start": 548, "end": 573, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 33 } }, "left": { "type": "UnaryExpression", "start": 548, "end": 560, "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 20 } }, "operator": "typeof", "prefix": true, "argument": { "type": "Identifier", "start": 555, "end": 560, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 20 }, "identifierName": "value" }, "name": "value" }, "extra": { "parenthesizedArgument": false } }, "operator": "!==", "right": { "type": "StringLiteral", "start": 565, "end": 573, "loc": { "start": { "line": 29, "column": 25 }, "end": { "line": 29, "column": 33 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" } }, "consequent": { "type": "BlockStatement", "start": 575, "end": 641, "loc": { "start": { "line": 29, "column": 35 }, "end": { "line": 31, "column": 5 } }, "body": [ { "type": "ThrowStatement", "start": 584, "end": 634, "loc": { "start": { "line": 30, "column": 6 }, "end": { "line": 30, "column": 56 } }, "argument": { "type": "NewExpression", "start": 590, "end": 633, "loc": { "start": { "line": 30, "column": 12 }, "end": { "line": 30, "column": 55 } }, "callee": { "type": "Identifier", "start": 594, "end": 599, "loc": { "start": { "line": 30, "column": 16 }, "end": { "line": 30, "column": 21 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 600, "end": 632, "loc": { "start": { "line": 30, "column": 22 }, "end": { "line": 30, "column": 54 } }, "extra": { "rawValue": "`value` is not type of Number!", "raw": "'`value` is not type of Number!'" }, "value": "`value` is not type of Number!" } ] } } ], "directives": [] }, "alternate": null }, { "type": "ExpressionStatement", "start": 649, "end": 669, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 24 } }, "expression": { "type": "AssignmentExpression", "start": 649, "end": 668, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 649, "end": 660, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 15 } }, "object": { "type": "ThisExpression", "start": 649, "end": 653, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 8 } } }, "property": { "type": "Identifier", "start": 654, "end": 660, "loc": { "start": { "line": 33, "column": 9 }, "end": { "line": 33, "column": 15 }, "identifierName": "_width" }, "name": "_width" }, "computed": false }, "right": { "type": "Identifier", "start": 663, "end": 668, "loc": { "start": { "line": 33, "column": 18 }, "end": { "line": 33, "column": 23 }, "identifierName": "value" }, "name": "value" } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 680, "end": 725, "loc": { "start": { "line": 36, "column": 2 }, "end": { "line": 38, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 684, "end": 690, "loc": { "start": { "line": 36, "column": 6 }, "end": { "line": 36, "column": 12 }, "identifierName": "height" }, "name": "height" }, "kind": "get", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 693, "end": 725, "loc": { "start": { "line": 36, "column": 15