UNPKG

awv3

Version:
1,349 lines (1,348 loc) 157 kB
{ "type": "File", "start": 0, "end": 762, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 25, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 762, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 25, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 31, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 31 } }, "specifiers": [ { "type": "ImportNamespaceSpecifier", "start": 7, "end": 17, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 } }, "local": { "type": "Identifier", "start": 12, "end": 17, "loc": { "start": { "line": 1, "column": 12 }, "end": { "line": 1, "column": 17 }, "identifierName": "THREE" }, "name": "THREE" } } ], "source": { "type": "StringLiteral", "start": 23, "end": 30, "loc": { "start": { "line": 1, "column": 23 }, "end": { "line": 1, "column": 30 } }, "extra": { "rawValue": "three", "raw": "'three'" }, "value": "three" } }, { "type": "ExportDefaultDeclaration", "start": 33, "end": 761, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 24, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 48, "end": 761, "loc": { "start": { "line": 3, "column": 15 }, "end": { "line": 24, "column": 1 } }, "id": { "type": "Identifier", "start": 54, "end": 67, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 34 }, "identifierName": "InfinitePlane" }, "name": "InfinitePlane" }, "superClass": { "type": "MemberExpression", "start": 76, "end": 90, "loc": { "start": { "line": 3, "column": 43 }, "end": { "line": 3, "column": 57 } }, "object": { "type": "Identifier", "start": 76, "end": 81, "loc": { "start": { "line": 3, "column": 43 }, "end": { "line": 3, "column": 48 }, "identifierName": "THREE" }, "name": "THREE" }, "property": { "type": "Identifier", "start": 82, "end": 90, "loc": { "start": { "line": 3, "column": 49 }, "end": { "line": 3, "column": 57 }, "identifierName": "Object3D" }, "name": "Object3D" }, "computed": false }, "body": { "type": "ClassBody", "start": 91, "end": 761, "loc": { "start": { "line": 3, "column": 58 }, "end": { "line": 24, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 97, "end": 212, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 8, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 97, "end": 108, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 15 }, "identifierName": "constructor" }, "name": "constructor" }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 111, "end": 212, "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 8, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 121, "end": 129, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 16 } }, "expression": { "type": "CallExpression", "start": 121, "end": 128, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 15 } }, "callee": { "type": "Super", "start": 121, "end": 126, "loc": { "start": { "line": 5, "column": 8 }, "end": { "line": 5, "column": 13 } } }, "arguments": [] } }, { "type": "ExpressionStatement", "start": 138, "end": 166, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 36 } }, "expression": { "type": "AssignmentExpression", "start": 138, "end": 165, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 138, "end": 147, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 17 } }, "object": { "type": "ThisExpression", "start": 138, "end": 142, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 12 } } }, "property": { "type": "Identifier", "start": 143, "end": 147, "loc": { "start": { "line": 6, "column": 13 }, "end": { "line": 6, "column": 17 }, "identifierName": "type" }, "name": "type" }, "computed": false }, "right": { "type": "StringLiteral", "start": 150, "end": 165, "loc": { "start": { "line": 6, "column": 20 }, "end": { "line": 6, "column": 35 } }, "extra": { "rawValue": "InfinitePlane", "raw": "'InfinitePlane'" }, "value": "InfinitePlane" } } }, { "type": "ExpressionStatement", "start": 175, "end": 206, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 39 } }, "expression": { "type": "AssignmentExpression", "start": 175, "end": 205, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 38 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 175, "end": 185, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 18 } }, "object": { "type": "ThisExpression", "start": 175, "end": 179, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 12 } } }, "property": { "type": "Identifier", "start": 180, "end": 185, "loc": { "start": { "line": 7, "column": 13 }, "end": { "line": 7, "column": 18 }, "identifierName": "plane" }, "name": "plane" }, "computed": false }, "right": { "type": "NewExpression", "start": 188, "end": 205, "loc": { "start": { "line": 7, "column": 21 }, "end": { "line": 7, "column": 38 } }, "callee": { "type": "MemberExpression", "start": 192, "end": 203, "loc": { "start": { "line": 7, "column": 25 }, "end": { "line": 7, "column": 36 } }, "object": { "type": "Identifier", "start": 192, "end": 197, "loc": { "start": { "line": 7, "column": 25 }, "end": { "line": 7, "column": 30 }, "identifierName": "THREE" }, "name": "THREE" }, "property": { "type": "Identifier", "start": 198, "end": 203, "loc": { "start": { "line": 7, "column": 31 }, "end": { "line": 7, "column": 36 }, "identifierName": "Plane" }, "name": "Plane" }, "computed": false }, "arguments": [] } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 218, "end": 759, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 23, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 218, "end": 225, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 11 }, "identifierName": "raycast" }, "name": "raycast" }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 226, "end": 235, "loc": { "start": { "line": 10, "column": 12 }, "end": { "line": 10, "column": 21 }, "identifierName": "raycaster" }, "name": "raycaster" }, { "type": "Identifier", "start": 237, "end": 247, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 33 }, "identifierName": "intersects" }, "name": "intersects" } ], "body": { "type": "BlockStatement", "start": 249, "end": 759, "loc": { "start": { "line": 10, "column": 35 }, "end": { "line": 23, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 259, "end": 330, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 79 } }, "declarations": [ { "type": "VariableDeclarator", "start": 265, "end": 329, "loc": { "start": { "line": 11, "column": 14 }, "end": { "line": 11, "column": 78 } }, "id": { "type": "Identifier", "start": 265, "end": 278, "loc": { "start": { "line": 11, "column": 14 }, "end": { "line": 11, "column": 27 }, "identifierName": "inverseMatrix" }, "name": "inverseMatrix" }, "init": { "type": "CallExpression", "start": 281, "end": 329, "loc": { "start": { "line": 11, "column": 30 }, "end": { "line": 11, "column": 78 } }, "callee": { "type": "MemberExpression", "start": 281, "end": 311, "loc": { "start": { "line": 11, "column": 30 }, "end": { "line": 11, "column": 60 } }, "object": { "type": "NewExpression", "start": 281, "end": 300, "loc": { "start": { "line": 11, "column": 30 }, "end": { "line": 11, "column": 49 } }, "callee": { "type": "MemberExpression", "start": 285, "end": 298, "loc": { "start": { "line": 11, "column": 34 }, "end": { "line": 11, "column": 47 } }, "object": { "type": "Identifier", "start": 285, "end": 290, "loc": { "start": { "line": 11, "column": 34 }, "end": { "line": 11, "column": 39 }, "identifierName": "THREE" }, "name": "THREE" }, "property": { "type": "Identifier", "start": 291, "end": 298, "loc": { "start": { "line": 11, "column": 40 }, "end": { "line": 11, "column": 47 }, "identifierName": "Matrix4" }, "name": "Matrix4" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 301, "end": 311, "loc": { "start": { "line": 11, "column": 50 }, "end": { "line": 11, "column": 60 }, "identifierName": "getInverse" }, "name": "getInverse" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 312, "end": 328, "loc": { "start": { "line": 11, "column": 61 }, "end": { "line": 11, "column": 77 } }, "object": { "type": "ThisExpression", "start": 312, "end": 316, "loc": { "start": { "line": 11, "column": 61 }, "end": { "line": 11, "column": 65 } } }, "property": { "type": "Identifier", "start": 317, "end": 328, "loc": { "start": { "line": 11, "column": 66 }, "end": { "line": 11, "column": 77 }, "identifierName": "matrixWorld" }, "name": "matrixWorld" }, "computed": false } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 339, "end": 401, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 70 } }, "declarations": [ { "type": "VariableDeclarator", "start": 345, "end": 400, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 69 } }, "id": { "type": "Identifier", "start": 345, "end": 348, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 17 }, "identifierName": "ray" }, "name": "ray" }, "init": { "type": "CallExpression", "start": 351, "end": 400, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 69 } }, "callee": { "type": "MemberExpression", "start": 351, "end": 385, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 54 } }, "object": { "type": "CallExpression", "start": 351, "end": 372, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 41 } }, "callee": { "type": "MemberExpression", "start": 351, "end": 370, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 39 } }, "object": { "type": "MemberExpression", "start": 351, "end": 364, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 33 } }, "object": { "type": "Identifier", "start": 351, "end": 360, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 29 }, "identifierName": "raycaster" }, "name": "raycaster" }, "property": { "type": "Identifier", "start": 361, "end": 364, "loc": { "start": { "line": 12, "column": 30 }, "end": { "line": 12, "column": 33 }, "identifierName": "ray" }, "name": "ray" }, "computed": false }, "property": { "type": "Identifier", "start": 365, "end": 370, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 12, "column": 39 }, "identifierName": "clone" }, "name": "clone" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 373, "end": 385, "loc": { "start": { "line": 12, "column": 42 }, "end": { "line": 12, "column": 54 }, "identifierName": "applyMatrix4" }, "name": "applyMatrix4" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 386, "end": 399, "loc": { "start": { "line": 12, "column": 55 }, "end": { "line": 12, "column": 68 }, "identifierName": "inverseMatrix" }, "name": "inverseMatrix" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 410, "end": 459, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 57 } }, "declarations": [ { "type": "VariableDeclarator", "start": 416, "end": 458, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 56 } }, "id": { "type": "Identifier", "start": 416, "end": 424, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 22 }, "identifierName": "distance" }, "name": "distance" }, "init": { "type": "CallExpression", "start": 427, "end": 458, "loc": { "start": { "line": 13, "column": 25 }, "end": { "line": 13, "column": 56 } }, "callee": { "type": "MemberExpression", "start": 427, "end": 446, "loc": { "start": { "line": 13, "column": 25 }, "end": { "line": 13, "column": 44 } }, "object": { "type": "Identifier", "start": 427, "end": 430, "loc": { "start": { "line": 13, "column": 25 }, "end": { "line": 13, "column": 28 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 431, "end": 446, "loc": { "start": { "line": 13, "column": 29 }, "end": { "line": 13, "column": 44 }, "identifierName": "distanceToPlane" }, "name": "distanceToPlane" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 447, "end": 457, "loc": { "start": { "line": 13, "column": 45 }, "end": { "line": 13, "column": 55 } }, "object": { "type": "ThisExpression", "start": 447, "end": 451, "loc": { "start": { "line": 13, "column": 45 }, "end": { "line": 13, "column": 49 } } }, "property": { "type": "Identifier", "start": 452, "end": 457, "loc": { "start": { "line": 13, "column": 50 }, "end": { "line": 13, "column": 55 }, "identifierName": "plane" }, "name": "plane" }, "computed": false } ] } } ], "kind": "const" }, { "type": "IfStatement", "start": 468, "end": 555, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 95 } }, "test": { "type": "LogicalExpression", "start": 472, "end": 546, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 86 } }, "left": { "type": "LogicalExpression", "start": 472, "end": 518, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 58 } }, "left": { "type": "BinaryExpression", "start": 472, "end": 489, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 29 } }, "left": { "type": "Identifier", "start": 472, "end": 480, "loc": { "start": { "line": 14, "column": 12 }, "end": { "line": 14, "column": 20 }, "identifierName": "distance" }, "name": "distance" }, "operator": "===", "right": { "type": "NullLiteral", "start": 485, "end": 489, "loc": { "start": { "line": 14, "column": 25 }, "end": { "line": 14, "column": 29 } } } }, "operator": "||", "right": { "type": "BinaryExpression", "start": 493, "end": 518, "loc": { "start": { "line": 14, "column": 33 }, "end": { "line": 14, "column": 58 } }, "left": { "type": "Identifier",