spoint 0.1.0 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +134 -209
  2. package/SKILL.md +95 -0
  3. package/apps/environment/index.js +200 -1
  4. package/apps/environment/models/decorative/.gitkeep +0 -0
  5. package/apps/environment/models/hazards/.gitkeep +0 -0
  6. package/apps/environment/models/interactive/.gitkeep +0 -0
  7. package/apps/environment/models/structures/.gitkeep +0 -0
  8. package/apps/environment/smartObjects.js +114 -0
  9. package/apps/interactable/index.js +155 -0
  10. package/apps/physics-crate/index.js +15 -9
  11. package/apps/power-crate/index.js +18 -12
  12. package/apps/tps-game/$GDUPI.vrm +0 -0
  13. package/apps/tps-game/Cleetus.vrm +0 -0
  14. package/apps/tps-game/index.js +185 -27
  15. package/apps/world/index.js +68 -22
  16. package/bin/create-app.js +337 -0
  17. package/client/ARControls.js +301 -0
  18. package/client/LoadingManager.js +117 -0
  19. package/client/MobileControls.js +1122 -0
  20. package/client/anim-lib.glb +0 -0
  21. package/client/animation.js +306 -0
  22. package/client/app.js +1341 -65
  23. package/client/camera.js +191 -33
  24. package/client/createLoadingScreen.js +69 -0
  25. package/client/editor/bridge.js +113 -0
  26. package/client/editor/css/main.css +794 -0
  27. package/client/editor/images/rotate.svg +4 -0
  28. package/client/editor/images/scale.svg +4 -0
  29. package/client/editor/images/translate.svg +4 -0
  30. package/client/editor/index.html +103 -0
  31. package/client/editor/js/Command.js +41 -0
  32. package/client/editor/js/Config.js +81 -0
  33. package/client/editor/js/Editor.js +785 -0
  34. package/client/editor/js/EditorControls.js +438 -0
  35. package/client/editor/js/History.js +321 -0
  36. package/client/editor/js/Loader.js +987 -0
  37. package/client/editor/js/LoaderUtils.js +90 -0
  38. package/client/editor/js/Menubar.Add.js +510 -0
  39. package/client/editor/js/Menubar.Edit.js +145 -0
  40. package/client/editor/js/Menubar.File.js +466 -0
  41. package/client/editor/js/Menubar.Help.js +73 -0
  42. package/client/editor/js/Menubar.Status.js +51 -0
  43. package/client/editor/js/Menubar.View.js +183 -0
  44. package/client/editor/js/Menubar.js +27 -0
  45. package/client/editor/js/Player.js +53 -0
  46. package/client/editor/js/Resizer.js +58 -0
  47. package/client/editor/js/Script.js +503 -0
  48. package/client/editor/js/Selector.js +102 -0
  49. package/client/editor/js/Sidebar.Geometry.BoxGeometry.js +121 -0
  50. package/client/editor/js/Sidebar.Geometry.BufferGeometry.js +115 -0
  51. package/client/editor/js/Sidebar.Geometry.CapsuleGeometry.js +97 -0
  52. package/client/editor/js/Sidebar.Geometry.CircleGeometry.js +97 -0
  53. package/client/editor/js/Sidebar.Geometry.CylinderGeometry.js +121 -0
  54. package/client/editor/js/Sidebar.Geometry.DodecahedronGeometry.js +73 -0
  55. package/client/editor/js/Sidebar.Geometry.ExtrudeGeometry.js +196 -0
  56. package/client/editor/js/Sidebar.Geometry.IcosahedronGeometry.js +73 -0
  57. package/client/editor/js/Sidebar.Geometry.LatheGeometry.js +98 -0
  58. package/client/editor/js/Sidebar.Geometry.Modifiers.js +73 -0
  59. package/client/editor/js/Sidebar.Geometry.OctahedronGeometry.js +74 -0
  60. package/client/editor/js/Sidebar.Geometry.PlaneGeometry.js +97 -0
  61. package/client/editor/js/Sidebar.Geometry.RingGeometry.js +121 -0
  62. package/client/editor/js/Sidebar.Geometry.ShapeGeometry.js +76 -0
  63. package/client/editor/js/Sidebar.Geometry.SphereGeometry.js +133 -0
  64. package/client/editor/js/Sidebar.Geometry.TetrahedronGeometry.js +74 -0
  65. package/client/editor/js/Sidebar.Geometry.TorusGeometry.js +109 -0
  66. package/client/editor/js/Sidebar.Geometry.TorusKnotGeometry.js +121 -0
  67. package/client/editor/js/Sidebar.Geometry.TubeGeometry.js +135 -0
  68. package/client/editor/js/Sidebar.Geometry.js +332 -0
  69. package/client/editor/js/Sidebar.Material.BooleanProperty.js +60 -0
  70. package/client/editor/js/Sidebar.Material.ColorProperty.js +87 -0
  71. package/client/editor/js/Sidebar.Material.ConstantProperty.js +62 -0
  72. package/client/editor/js/Sidebar.Material.MapProperty.js +249 -0
  73. package/client/editor/js/Sidebar.Material.NumberProperty.js +60 -0
  74. package/client/editor/js/Sidebar.Material.Program.js +73 -0
  75. package/client/editor/js/Sidebar.Material.RangeValueProperty.js +63 -0
  76. package/client/editor/js/Sidebar.Material.js +751 -0
  77. package/client/editor/js/Sidebar.Object.Animation.js +102 -0
  78. package/client/editor/js/Sidebar.Object.js +898 -0
  79. package/client/editor/js/Sidebar.Project.App.js +165 -0
  80. package/client/editor/js/Sidebar.Project.Image.js +225 -0
  81. package/client/editor/js/Sidebar.Project.Materials.js +82 -0
  82. package/client/editor/js/Sidebar.Project.Renderer.js +144 -0
  83. package/client/editor/js/Sidebar.Project.Video.js +242 -0
  84. package/client/editor/js/Sidebar.Project.js +31 -0
  85. package/client/editor/js/Sidebar.Properties.js +73 -0
  86. package/client/editor/js/Sidebar.Scene.js +585 -0
  87. package/client/editor/js/Sidebar.Script.js +129 -0
  88. package/client/editor/js/Sidebar.Settings.History.js +146 -0
  89. package/client/editor/js/Sidebar.Settings.Shortcuts.js +175 -0
  90. package/client/editor/js/Sidebar.Settings.js +60 -0
  91. package/client/editor/js/Sidebar.js +41 -0
  92. package/client/editor/js/Storage.js +98 -0
  93. package/client/editor/js/Strings.js +2028 -0
  94. package/client/editor/js/Toolbar.js +84 -0
  95. package/client/editor/js/Viewport.Controls.js +92 -0
  96. package/client/editor/js/Viewport.Info.js +136 -0
  97. package/client/editor/js/Viewport.Pathtracer.js +91 -0
  98. package/client/editor/js/Viewport.ViewHelper.js +39 -0
  99. package/client/editor/js/Viewport.XR.js +222 -0
  100. package/client/editor/js/Viewport.js +900 -0
  101. package/client/editor/js/commands/AddObjectCommand.js +68 -0
  102. package/client/editor/js/commands/AddScriptCommand.js +75 -0
  103. package/client/editor/js/commands/Commands.js +23 -0
  104. package/client/editor/js/commands/MoveObjectCommand.js +111 -0
  105. package/client/editor/js/commands/MultiCmdsCommand.js +85 -0
  106. package/client/editor/js/commands/RemoveObjectCommand.js +88 -0
  107. package/client/editor/js/commands/RemoveScriptCommand.js +81 -0
  108. package/client/editor/js/commands/SetColorCommand.js +73 -0
  109. package/client/editor/js/commands/SetGeometryCommand.js +87 -0
  110. package/client/editor/js/commands/SetGeometryValueCommand.js +70 -0
  111. package/client/editor/js/commands/SetMaterialColorCommand.js +86 -0
  112. package/client/editor/js/commands/SetMaterialCommand.js +79 -0
  113. package/client/editor/js/commands/SetMaterialMapCommand.js +143 -0
  114. package/client/editor/js/commands/SetMaterialRangeCommand.js +91 -0
  115. package/client/editor/js/commands/SetMaterialValueCommand.js +90 -0
  116. package/client/editor/js/commands/SetMaterialVectorCommand.js +79 -0
  117. package/client/editor/js/commands/SetPositionCommand.js +84 -0
  118. package/client/editor/js/commands/SetRotationCommand.js +84 -0
  119. package/client/editor/js/commands/SetScaleCommand.js +84 -0
  120. package/client/editor/js/commands/SetSceneCommand.js +103 -0
  121. package/client/editor/js/commands/SetScriptValueCommand.js +80 -0
  122. package/client/editor/js/commands/SetShadowValueCommand.js +73 -0
  123. package/client/editor/js/commands/SetUuidCommand.js +70 -0
  124. package/client/editor/js/commands/SetValueCommand.js +75 -0
  125. package/client/editor/js/libs/acorn/acorn.js +3236 -0
  126. package/client/editor/js/libs/acorn/acorn_loose.js +1299 -0
  127. package/client/editor/js/libs/acorn/walk.js +344 -0
  128. package/client/editor/js/libs/app/index.html +57 -0
  129. package/client/editor/js/libs/app.js +251 -0
  130. package/client/editor/js/libs/codemirror/addon/dialog.css +32 -0
  131. package/client/editor/js/libs/codemirror/addon/dialog.js +163 -0
  132. package/client/editor/js/libs/codemirror/addon/show-hint.css +36 -0
  133. package/client/editor/js/libs/codemirror/addon/show-hint.js +529 -0
  134. package/client/editor/js/libs/codemirror/addon/tern.css +87 -0
  135. package/client/editor/js/libs/codemirror/addon/tern.js +750 -0
  136. package/client/editor/js/libs/codemirror/codemirror.css +344 -0
  137. package/client/editor/js/libs/codemirror/codemirror.js +9849 -0
  138. package/client/editor/js/libs/codemirror/mode/glsl.js +233 -0
  139. package/client/editor/js/libs/codemirror/mode/javascript.js +959 -0
  140. package/client/editor/js/libs/codemirror/theme/monokai.css +41 -0
  141. package/client/editor/js/libs/esprima.js +6401 -0
  142. package/client/editor/js/libs/jsonlint.js +453 -0
  143. package/client/editor/js/libs/signals.min.js +14 -0
  144. package/client/editor/js/libs/tern-threejs/threejs.js +5031 -0
  145. package/client/editor/js/libs/ternjs/comment.js +87 -0
  146. package/client/editor/js/libs/ternjs/def.js +588 -0
  147. package/client/editor/js/libs/ternjs/doc_comment.js +401 -0
  148. package/client/editor/js/libs/ternjs/infer.js +1635 -0
  149. package/client/editor/js/libs/ternjs/polyfill.js +80 -0
  150. package/client/editor/js/libs/ternjs/signal.js +26 -0
  151. package/client/editor/js/libs/ternjs/tern.js +993 -0
  152. package/client/editor/js/libs/ui.js +1346 -0
  153. package/client/editor/js/libs/ui.three.js +855 -0
  154. package/client/facial-animation.js +455 -0
  155. package/client/index.html +7 -4
  156. package/client/loading.css +147 -0
  157. package/client/loading.html +25 -0
  158. package/client/style.css +251 -0
  159. package/package.json +7 -3
  160. package/server.js +9 -1
  161. package/src/apps/AppContext.js +1 -1
  162. package/src/apps/AppLoader.js +50 -37
  163. package/src/apps/AppRuntime.js +32 -8
  164. package/src/client/InputHandler.js +233 -0
  165. package/src/client/JitterBuffer.js +207 -0
  166. package/src/client/KalmanFilter.js +125 -0
  167. package/src/client/MessageHandler.js +101 -0
  168. package/src/client/PhysicsNetworkClient.js +141 -68
  169. package/src/client/ReconnectManager.js +62 -0
  170. package/src/client/SmoothInterpolation.js +127 -0
  171. package/src/client/SnapshotProcessor.js +144 -0
  172. package/src/connection/ConnectionManager.js +21 -3
  173. package/src/connection/SessionStore.js +13 -3
  174. package/src/index.client.js +4 -6
  175. package/src/netcode/EventLog.js +29 -15
  176. package/src/netcode/LagCompensator.js +25 -26
  177. package/src/netcode/NetworkState.js +4 -1
  178. package/src/netcode/PhysicsIntegration.js +20 -6
  179. package/src/netcode/PlayerManager.js +10 -2
  180. package/src/netcode/SnapshotEncoder.js +66 -19
  181. package/src/netcode/TickSystem.js +13 -4
  182. package/src/physics/World.js +66 -13
  183. package/src/protocol/msgpack.js +90 -63
  184. package/src/sdk/ReloadHandlers.js +12 -2
  185. package/src/sdk/ReloadManager.js +5 -0
  186. package/src/sdk/ServerHandlers.js +50 -11
  187. package/src/sdk/StaticHandler.js +22 -6
  188. package/src/sdk/TickHandler.js +101 -34
  189. package/src/sdk/scaffold.js +31 -0
  190. package/src/sdk/server.js +59 -33
  191. package/src/shared/movement.js +2 -1
  192. package/src/spatial/Octree.js +5 -0
  193. package/apps/interactive-door/index.js +0 -33
  194. package/apps/patrol-npc/index.js +0 -37
  195. package/src/connection/QualityMonitor.js +0 -46
  196. package/src/debug/StateInspector.js +0 -42
  197. package/src/index.js +0 -1
  198. package/src/index.server.js +0 -27
  199. package/src/protocol/Codec.js +0 -60
  200. package/src/protocol/SequenceTracker.js +0 -71
  201. package/src/sdk/ClientMessageHandler.js +0 -80
  202. package/src/sdk/client.js +0 -122
  203. package/world/kaira.glb +0 -0
  204. package/world/schwust.glb +0 -0
@@ -0,0 +1,233 @@
1
+ // Full source:
2
+ //
3
+ // https://github.com/hughsk/glsl-editor
4
+ //
5
+ // (C) Copyright Hugh Kennedy
6
+ //
7
+ // This software is released under the MIT license:
8
+ //
9
+ // Permission is hereby granted, free of charge, to any person obtaining a
10
+ // copy of this software and associated documentation files (the "Software"),
11
+ // to deal in the Software without restriction, including without limitation
12
+ // the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ // and/or sell copies of the Software, and to permit persons to whom the
14
+ // Software is furnished to do so, subject to the following conditions:
15
+ //
16
+ // The above copyright notice and this permission notice shall be included in
17
+ // all copies or substantial portions of the Software.
18
+ //
19
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22
+ // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL-
25
+ // INGS IN THE SOFTWARE.
26
+
27
+ // The original source code has been slightly modified for the purpose of
28
+ // integration (tschw).
29
+
30
+ (function(mod) {
31
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
32
+ mod(require("../../lib/codemirror"));
33
+ else if (typeof define == "function" && define.amd) // AMD
34
+ define(["../../lib/codemirror"], mod);
35
+ else // Plain browser env
36
+ mod(CodeMirror);
37
+ })(function(CodeMirror) {
38
+ "use strict";
39
+
40
+ CodeMirror.defineMode("glsl", function(config, parserConfig) {
41
+ var indentUnit = config.indentUnit,
42
+ keywords = parserConfig.keywords || words(glslKeywords),
43
+ builtins = parserConfig.builtins || words(glslBuiltins),
44
+ blockKeywords = parserConfig.blockKeywords || words("case do else for if switch while struct"),
45
+ atoms = parserConfig.atoms || words("null"),
46
+ hooks = parserConfig.hooks || {},
47
+ multiLineStrings = parserConfig.multiLineStrings;
48
+ var isOperatorChar = /[+\-*&%=<>!?|\/]/;
49
+
50
+ var curPunc;
51
+
52
+ function tokenBase(stream, state) {
53
+ var ch = stream.next();
54
+ if (hooks[ch]) {
55
+ var result = hooks[ch](stream, state);
56
+ if (result !== false) return result;
57
+ }
58
+ if (ch == '"' || ch == "'") {
59
+ state.tokenize = tokenString(ch);
60
+ return state.tokenize(stream, state);
61
+ }
62
+ if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
63
+ curPunc = ch;
64
+ return "bracket";
65
+ }
66
+ if (/\d/.test(ch)) {
67
+ stream.eatWhile(/[\w\.]/);
68
+ return "number";
69
+ }
70
+ if (ch == "/") {
71
+ if (stream.eat("*")) {
72
+ state.tokenize = tokenComment;
73
+ return tokenComment(stream, state);
74
+ }
75
+ if (stream.eat("/")) {
76
+ stream.skipToEnd();
77
+ return "comment";
78
+ }
79
+ }
80
+ if (ch == "#") {
81
+ stream.eatWhile(/[\S]+/);
82
+ stream.eatWhile(/[\s]+/);
83
+ stream.eatWhile(/[\S]+/);
84
+ stream.eatWhile(/[\s]+/);
85
+ return "comment";
86
+ }
87
+ if (isOperatorChar.test(ch)) {
88
+ stream.eatWhile(isOperatorChar);
89
+ return "operator";
90
+ }
91
+ stream.eatWhile(/[\w\$_]/);
92
+ var cur = stream.current();
93
+ if (keywords.propertyIsEnumerable(cur)) {
94
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
95
+ return "keyword";
96
+ }
97
+ if (builtins.propertyIsEnumerable(cur)) {
98
+ return "builtin";
99
+ }
100
+ if (atoms.propertyIsEnumerable(cur)) return "atom";
101
+ return "word";
102
+ }
103
+
104
+ function tokenString(quote) {
105
+ return function(stream, state) {
106
+ var escaped = false, next, end = false;
107
+ while ((next = stream.next()) != null) {
108
+ if (next == quote && !escaped) {end = true; break;}
109
+ escaped = !escaped && next == "\\";
110
+ }
111
+ if (end || !(escaped || multiLineStrings))
112
+ state.tokenize = tokenBase;
113
+ return "string";
114
+ };
115
+ }
116
+
117
+ function tokenComment(stream, state) {
118
+ var maybeEnd = false, ch;
119
+ while (ch = stream.next()) {
120
+ if (ch == "/" && maybeEnd) {
121
+ state.tokenize = tokenBase;
122
+ break;
123
+ }
124
+ maybeEnd = (ch == "*");
125
+ }
126
+ return "comment";
127
+ }
128
+
129
+ function Context(indented, column, type, align, prev) {
130
+ this.indented = indented;
131
+ this.column = column;
132
+ this.type = type;
133
+ this.align = align;
134
+ this.prev = prev;
135
+ }
136
+ function pushContext(state, col, type) {
137
+ return state.context = new Context(state.indented, col, type, null, state.context);
138
+ }
139
+ function popContext(state) {
140
+ var t = state.context.type;
141
+ if (t == ")" || t == "]" || t == "}")
142
+ state.indented = state.context.indented;
143
+ return state.context = state.context.prev;
144
+ }
145
+
146
+ // Interface
147
+
148
+ return {
149
+ startState: function(basecolumn) {
150
+ return {
151
+ tokenize: null,
152
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
153
+ indented: 0,
154
+ startOfLine: true
155
+ };
156
+ },
157
+
158
+ token: function(stream, state) {
159
+ var ctx = state.context;
160
+ if (stream.sol()) {
161
+ if (ctx.align == null) ctx.align = false;
162
+ state.indented = stream.indentation();
163
+ state.startOfLine = true;
164
+ }
165
+ if (stream.eatSpace()) return null;
166
+ curPunc = null;
167
+ var style = (state.tokenize || tokenBase)(stream, state);
168
+ if (style == "comment" || style == "meta") return style;
169
+ if (ctx.align == null) ctx.align = true;
170
+
171
+ if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
172
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
173
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
174
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
175
+ else if (curPunc == "}") {
176
+ while (ctx.type == "statement") ctx = popContext(state);
177
+ if (ctx.type == "}") ctx = popContext(state);
178
+ while (ctx.type == "statement") ctx = popContext(state);
179
+ }
180
+ else if (curPunc == ctx.type) popContext(state);
181
+ else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
182
+ pushContext(state, stream.column(), "statement");
183
+ state.startOfLine = false;
184
+ return style;
185
+ },
186
+
187
+ indent: function(state, textAfter) {
188
+ if (state.tokenize != tokenBase && state.tokenize != null) return 0;
189
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type;
190
+ if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
191
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
192
+ else return ctx.indented + (closing ? 0 : indentUnit);
193
+ },
194
+
195
+ electricChars: "{}"
196
+ };
197
+ });
198
+
199
+ function words(str) {
200
+ var obj = {}, words = str.split(" ");
201
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
202
+ return obj;
203
+ }
204
+ var glslKeywords = "attribute const uniform varying break continue " +
205
+ "do for while if else in out inout float int void bool true false " +
206
+ "lowp mediump highp precision invariant discard return mat2 mat3 " +
207
+ "mat4 vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 sampler2D " +
208
+ "samplerCube struct gl_FragCoord gl_FragColor gl_Position";
209
+ var glslBuiltins = "radians degrees sin cos tan asin acos atan pow " +
210
+ "exp log exp2 log2 sqrt inversesqrt abs sign floor ceil fract mod " +
211
+ "min max clamp mix step smoothstep length distance dot cross " +
212
+ "normalize faceforward reflect refract matrixCompMult lessThan " +
213
+ "lessThanEqual greaterThan greaterThanEqual equal notEqual any all " +
214
+ "not dFdx dFdy fwidth texture2D texture2DProj texture2DLod " +
215
+ "texture2DProjLod textureCube textureCubeLod require export";
216
+
217
+ function cppHook(stream, state) {
218
+ if (!state.startOfLine) return false;
219
+ stream.skipToEnd();
220
+ return "meta";
221
+ }
222
+
223
+ ;(function() {
224
+ CodeMirror.defineMIME("text/x-glsl", {
225
+ name: "glsl",
226
+ keywords: words(glslKeywords),
227
+ builtins: words(glslBuiltins),
228
+ blockKeywords: words("case do else for if switch while struct"),
229
+ atoms: words("null"),
230
+ hooks: {"#": cppHook}
231
+ });
232
+ }());
233
+ });