@lampdotdev/lamp 0.0.0-stage → 0.35.0
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.
- package/LICENSE +21 -0
- package/README.md +357 -2
- package/Resources/Devices/roku.json +410 -0
- package/Resources/Devices/xbox-one.json +367 -0
- package/Resources/GameKit/NOTICE.md +63 -0
- package/Resources/GameKit/apple/LampPage.swift +1646 -0
- package/Resources/GameKit/apple/LampPlayer.swift +46 -0
- package/Resources/GameKit/apple/LampWebApp.swift +63 -0
- package/Resources/GameKit/apple/LampWebGame.swift +87 -0
- package/Resources/GameKit/apple/Native.swift +12 -0
- package/Resources/GameKit/build.sh +55 -0
- package/Resources/GameKit/lamp_game.h +116 -0
- package/Resources/GameKit/lamp_host.h +19 -0
- package/Resources/GameKit/lamp_kit.cpp +61 -0
- package/Resources/GameKit/lamp_sound.cpp +455 -0
- package/Resources/GameKit/lamp_xbox.cpp +374 -0
- package/Resources/GameKit/libraries/HandmadeMath.h +3940 -0
- package/Resources/GameKit/libraries/cgltf.h +7240 -0
- package/Resources/GameKit/libraries/dr_mp3.h +5430 -0
- package/Resources/GameKit/libraries/dr_wav.h +9209 -0
- package/Resources/GameKit/libraries/sokol_debugtext.h +4754 -0
- package/Resources/GameKit/libraries/sokol_gfx.h +29558 -0
- package/Resources/GameKit/libraries/sokol_gl.h +4538 -0
- package/Resources/GameKit/libraries/sokol_log.h +335 -0
- package/Resources/GameKit/libraries/sokol_shape.h +1531 -0
- package/Resources/GameKit/libraries/stb_image.h +7988 -0
- package/Resources/GameKit/libraries/stb_vorbis.c +5584 -0
- package/Resources/GameKit/scaffold/Game/game.cpp +142 -0
- package/Resources/GameKit/scaffold/Game/scene.glsl +49 -0
- package/Resources/GameKit/scaffold-web/Web/game.js +31 -0
- package/Resources/GameKit/scaffold-web/Web/index.html +13 -0
- package/Resources/GameKit/scaffold-web/Web/making.js +33 -0
- package/Resources/GameKit/scaffold-web/Web/world.js +33 -0
- package/Resources/GameKit/web/lamp-game.js +3036 -0
- package/Resources/GameKit/web/lamp-phaser.js +128 -0
- package/Resources/WebHost/App.exe +0 -0
- package/Resources/WebHost/Microsoft.Web.WebView2.Core.dll +0 -0
- package/Resources/WebHost/WebView2-LICENSE.txt +27 -0
- package/Resources/WebHost/lamp_controllers.h +1506 -0
- package/Resources/WebHost/lamp_web_host.cpp +1173 -0
- package/Resources/WebLibraries/earlier.txt +318 -0
- package/Resources/WebLibraries/phaser/LICENSE.md +20 -0
- package/Resources/WebLibraries/phaser/NOTICE.md +2 -0
- package/Resources/WebLibraries/phaser/phaser.esm.min.js +1 -0
- package/Resources/WebLibraries/qrcode/LICENSE +21 -0
- package/Resources/WebLibraries/qrcode/NOTICE.md +4 -0
- package/Resources/WebLibraries/qrcode/qrcode.js +2297 -0
- package/Resources/WebLibraries/rapier/LICENSE +201 -0
- package/Resources/WebLibraries/rapier/NOTICE.md +3 -0
- package/Resources/WebLibraries/rapier/rapier.js +2 -0
- package/Resources/WebLibraries/three/LICENSE +21 -0
- package/Resources/WebLibraries/three/NOTICE.md +4 -0
- package/Resources/WebLibraries/three/addons/animation/AnimationClipCreator.js +168 -0
- package/Resources/WebLibraries/three/addons/animation/CCDIKSolver.js +607 -0
- package/Resources/WebLibraries/three/addons/controls/ArcballControls.js +3543 -0
- package/Resources/WebLibraries/three/addons/controls/DragControls.js +452 -0
- package/Resources/WebLibraries/three/addons/controls/FirstPersonControls.js +512 -0
- package/Resources/WebLibraries/three/addons/controls/FlyControls.js +384 -0
- package/Resources/WebLibraries/three/addons/controls/MapControls.js +116 -0
- package/Resources/WebLibraries/three/addons/controls/OrbitControls.js +1985 -0
- package/Resources/WebLibraries/three/addons/controls/PointerLockControls.js +264 -0
- package/Resources/WebLibraries/three/addons/controls/TrackballControls.js +1106 -0
- package/Resources/WebLibraries/three/addons/controls/TransformControls.js +2003 -0
- package/Resources/WebLibraries/three/addons/curves/CurveExtras.js +694 -0
- package/Resources/WebLibraries/three/addons/curves/NURBSCurve.js +169 -0
- package/Resources/WebLibraries/three/addons/curves/NURBSSurface.js +98 -0
- package/Resources/WebLibraries/three/addons/curves/NURBSUtils.js +532 -0
- package/Resources/WebLibraries/three/addons/curves/NURBSVolume.js +82 -0
- package/Resources/WebLibraries/three/addons/effects/AnaglyphEffect.js +274 -0
- package/Resources/WebLibraries/three/addons/effects/AsciiEffect.js +323 -0
- package/Resources/WebLibraries/three/addons/effects/OutlineEffect.js +489 -0
- package/Resources/WebLibraries/three/addons/effects/ParallaxBarrierEffect.js +155 -0
- package/Resources/WebLibraries/three/addons/effects/StereoEffect.js +91 -0
- package/Resources/WebLibraries/three/addons/environments/ColorEnvironment.js +59 -0
- package/Resources/WebLibraries/three/addons/environments/DebugEnvironment.js +102 -0
- package/Resources/WebLibraries/three/addons/environments/RoomEnvironment.js +185 -0
- package/Resources/WebLibraries/three/addons/geometries/BoxLineGeometry.js +92 -0
- package/Resources/WebLibraries/three/addons/geometries/ConvexGeometry.js +72 -0
- package/Resources/WebLibraries/three/addons/geometries/DecalGeometry.js +420 -0
- package/Resources/WebLibraries/three/addons/geometries/LoftGeometry.js +355 -0
- package/Resources/WebLibraries/three/addons/geometries/ParametricFunctions.js +100 -0
- package/Resources/WebLibraries/three/addons/geometries/ParametricGeometry.js +172 -0
- package/Resources/WebLibraries/three/addons/geometries/RoundedBoxGeometry.js +216 -0
- package/Resources/WebLibraries/three/addons/geometries/TeapotGeometry.js +689 -0
- package/Resources/WebLibraries/three/addons/geometries/TextGeometry.js +102 -0
- package/Resources/WebLibraries/three/addons/helpers/AnimationPathHelper.js +302 -0
- package/Resources/WebLibraries/three/addons/helpers/LightProbeGridHelper.js +166 -0
- package/Resources/WebLibraries/three/addons/helpers/LightProbeGridHelperWebGL.js +221 -0
- package/Resources/WebLibraries/three/addons/helpers/LightProbeHelper.js +166 -0
- package/Resources/WebLibraries/three/addons/helpers/LightProbeHelperGPU.js +102 -0
- package/Resources/WebLibraries/three/addons/helpers/OctreeHelper.js +109 -0
- package/Resources/WebLibraries/three/addons/helpers/PositionalAudioHelper.js +169 -0
- package/Resources/WebLibraries/three/addons/helpers/RapierHelper.js +59 -0
- package/Resources/WebLibraries/three/addons/helpers/RectAreaLightHelper.js +118 -0
- package/Resources/WebLibraries/three/addons/helpers/TextureHelper.js +265 -0
- package/Resources/WebLibraries/three/addons/helpers/TextureHelperGPU.js +214 -0
- package/Resources/WebLibraries/three/addons/helpers/VertexNormalsHelper.js +155 -0
- package/Resources/WebLibraries/three/addons/helpers/VertexTangentsHelper.js +133 -0
- package/Resources/WebLibraries/three/addons/helpers/ViewHelper.js +529 -0
- package/Resources/WebLibraries/three/addons/interactive/HTMLMesh.js +617 -0
- package/Resources/WebLibraries/three/addons/interactive/InteractiveGroup.js +224 -0
- package/Resources/WebLibraries/three/addons/interactive/SelectionBox.js +324 -0
- package/Resources/WebLibraries/three/addons/interactive/SelectionHelper.js +150 -0
- package/Resources/WebLibraries/three/addons/libs/fflate.module.js +2699 -0
- package/Resources/WebLibraries/three/addons/libs/lil-gui.module.min.js +8 -0
- package/Resources/WebLibraries/three/addons/libs/meshopt_decoder.module.js +196 -0
- package/Resources/WebLibraries/three/addons/libs/potpack.module.js +125 -0
- package/Resources/WebLibraries/three/addons/libs/stats.module.js +167 -0
- package/Resources/WebLibraries/three/addons/libs/tween.module.js +876 -0
- package/Resources/WebLibraries/three/addons/lighting/ClusteredLighting.js +153 -0
- package/Resources/WebLibraries/three/addons/lighting/DynamicLighting.js +82 -0
- package/Resources/WebLibraries/three/addons/lighting/LightMapper.js +295 -0
- package/Resources/WebLibraries/three/addons/lighting/LightProbeGrid.js +923 -0
- package/Resources/WebLibraries/three/addons/lighting/LightProbeGridUtils.js +107 -0
- package/Resources/WebLibraries/three/addons/lighting/LightProbeGridWebGL.js +846 -0
- package/Resources/WebLibraries/three/addons/lighting/vxgi/VXGIConeTracer.js +243 -0
- package/Resources/WebLibraries/three/addons/lighting/vxgi/VXGIIrradiance.js +43 -0
- package/Resources/WebLibraries/three/addons/lighting/vxgi/VXGINode.js +617 -0
- package/Resources/WebLibraries/three/addons/lighting/vxgi/VXGISceneCollector.js +793 -0
- package/Resources/WebLibraries/three/addons/lighting/vxgi/VXGIVolume.js +1440 -0
- package/Resources/WebLibraries/three/addons/lights/LightProbeGenerator.js +337 -0
- package/Resources/WebLibraries/three/addons/lights/RectAreaLightTexturesLib.js +127 -0
- package/Resources/WebLibraries/three/addons/lights/RectAreaLightUniformsLib.js +40 -0
- package/Resources/WebLibraries/three/addons/lights/SunLight.js +100 -0
- package/Resources/WebLibraries/three/addons/lights/SunLightNode.js +56 -0
- package/Resources/WebLibraries/three/addons/lights/SunLightShadow.js +319 -0
- package/Resources/WebLibraries/three/addons/lights/SunShadowNode.js +312 -0
- package/Resources/WebLibraries/three/addons/lines/Line2.js +56 -0
- package/Resources/WebLibraries/three/addons/lines/LineGeometry.js +157 -0
- package/Resources/WebLibraries/three/addons/lines/LineMaterial.js +742 -0
- package/Resources/WebLibraries/three/addons/lines/LineSegments2.js +434 -0
- package/Resources/WebLibraries/three/addons/lines/LineSegmentsGeometry.js +298 -0
- package/Resources/WebLibraries/three/addons/lines/Wireframe.js +108 -0
- package/Resources/WebLibraries/three/addons/lines/WireframeGeometry2.js +49 -0
- package/Resources/WebLibraries/three/addons/lines/webgpu/Line2.js +46 -0
- package/Resources/WebLibraries/three/addons/lines/webgpu/LineSegments2.js +419 -0
- package/Resources/WebLibraries/three/addons/lines/webgpu/Wireframe.js +86 -0
- package/Resources/WebLibraries/three/addons/loaders/EXRLoader.js +3411 -0
- package/Resources/WebLibraries/three/addons/loaders/FBXLoader.js +4660 -0
- package/Resources/WebLibraries/three/addons/loaders/FontLoader.js +262 -0
- package/Resources/WebLibraries/three/addons/loaders/GLTFLoader.js +5006 -0
- package/Resources/WebLibraries/three/addons/loaders/HDRLoader.js +463 -0
- package/Resources/WebLibraries/three/addons/loaders/MTLLoader.js +601 -0
- package/Resources/WebLibraries/three/addons/loaders/OBJLoader.js +961 -0
- package/Resources/WebLibraries/three/addons/loaders/PLYLoader.js +992 -0
- package/Resources/WebLibraries/three/addons/loaders/RGBELoader.js +18 -0
- package/Resources/WebLibraries/three/addons/loaders/STLLoader.js +423 -0
- package/Resources/WebLibraries/three/addons/loaders/SVGLoader.js +3297 -0
- package/Resources/WebLibraries/three/addons/loaders/TGALoader.js +539 -0
- package/Resources/WebLibraries/three/addons/loaders/UltraHDRLoader.js +757 -0
- package/Resources/WebLibraries/three/addons/math/Capsule.js +159 -0
- package/Resources/WebLibraries/three/addons/math/ColorConverter.js +62 -0
- package/Resources/WebLibraries/three/addons/math/ColorSpaces.js +147 -0
- package/Resources/WebLibraries/three/addons/math/ConvexHull.js +1695 -0
- package/Resources/WebLibraries/three/addons/math/ImprovedNoise.js +88 -0
- package/Resources/WebLibraries/three/addons/math/Lut.js +317 -0
- package/Resources/WebLibraries/three/addons/math/MeshSurfaceSampler.js +315 -0
- package/Resources/WebLibraries/three/addons/math/OBB.js +535 -0
- package/Resources/WebLibraries/three/addons/math/Octree.js +825 -0
- package/Resources/WebLibraries/three/addons/math/SimplexNoise.js +470 -0
- package/Resources/WebLibraries/three/addons/misc/ConvexObjectBreaker.js +539 -0
- package/Resources/WebLibraries/three/addons/misc/GPUComputationRenderer.js +508 -0
- package/Resources/WebLibraries/three/addons/misc/Gyroscope.js +78 -0
- package/Resources/WebLibraries/three/addons/misc/MorphAnimMesh.js +119 -0
- package/Resources/WebLibraries/three/addons/misc/MorphBlendMesh.js +425 -0
- package/Resources/WebLibraries/three/addons/misc/ProgressiveLightMap.js +370 -0
- package/Resources/WebLibraries/three/addons/misc/ProgressiveLightMapGPU.js +322 -0
- package/Resources/WebLibraries/three/addons/misc/RollerCoaster.js +661 -0
- package/Resources/WebLibraries/three/addons/misc/Sculptor.js +1679 -0
- package/Resources/WebLibraries/three/addons/misc/SculptorMesh.js +1504 -0
- package/Resources/WebLibraries/three/addons/misc/SculptorTools.js +1180 -0
- package/Resources/WebLibraries/three/addons/misc/SculptorUtils.js +345 -0
- package/Resources/WebLibraries/three/addons/misc/TileCreasedNormalsPlugin.js +270 -0
- package/Resources/WebLibraries/three/addons/misc/TubePainter.js +611 -0
- package/Resources/WebLibraries/three/addons/misc/Volume.js +520 -0
- package/Resources/WebLibraries/three/addons/misc/VolumeSlice.js +275 -0
- package/Resources/WebLibraries/three/addons/modifiers/CurveModifier.js +374 -0
- package/Resources/WebLibraries/three/addons/modifiers/CurveModifierGPU.js +256 -0
- package/Resources/WebLibraries/three/addons/modifiers/EdgeSplitModifier.js +299 -0
- package/Resources/WebLibraries/three/addons/modifiers/TessellateModifier.js +340 -0
- package/Resources/WebLibraries/three/addons/objects/GroundedSkybox.js +69 -0
- package/Resources/WebLibraries/three/addons/objects/Lensflare.js +489 -0
- package/Resources/WebLibraries/three/addons/objects/LensflareMesh.js +376 -0
- package/Resources/WebLibraries/three/addons/objects/MarchingCubes.js +1261 -0
- package/Resources/WebLibraries/three/addons/objects/Reflector.js +390 -0
- package/Resources/WebLibraries/three/addons/objects/ReflectorForSSRPass.js +393 -0
- package/Resources/WebLibraries/three/addons/objects/Refractor.js +389 -0
- package/Resources/WebLibraries/three/addons/objects/ShadowMesh.js +130 -0
- package/Resources/WebLibraries/three/addons/objects/Sky.js +342 -0
- package/Resources/WebLibraries/three/addons/objects/SkyMesh.js +403 -0
- package/Resources/WebLibraries/three/addons/objects/Water.js +374 -0
- package/Resources/WebLibraries/three/addons/objects/Water2.js +403 -0
- package/Resources/WebLibraries/three/addons/objects/Water2Mesh.js +199 -0
- package/Resources/WebLibraries/three/addons/objects/WaterMesh.js +194 -0
- package/Resources/WebLibraries/three/addons/postprocessing/AfterimagePass.js +187 -0
- package/Resources/WebLibraries/three/addons/postprocessing/BloomPass.js +274 -0
- package/Resources/WebLibraries/three/addons/postprocessing/BokehPass.js +218 -0
- package/Resources/WebLibraries/three/addons/postprocessing/ClearPass.js +97 -0
- package/Resources/WebLibraries/three/addons/postprocessing/CubeTexturePass.js +146 -0
- package/Resources/WebLibraries/three/addons/postprocessing/DotScreenPass.js +114 -0
- package/Resources/WebLibraries/three/addons/postprocessing/EffectComposer.js +365 -0
- package/Resources/WebLibraries/three/addons/postprocessing/FXAAPass.js +40 -0
- package/Resources/WebLibraries/three/addons/postprocessing/FilmPass.js +113 -0
- package/Resources/WebLibraries/three/addons/postprocessing/GTAOPass.js +735 -0
- package/Resources/WebLibraries/three/addons/postprocessing/GlitchPass.js +177 -0
- package/Resources/WebLibraries/three/addons/postprocessing/HalftonePass.js +134 -0
- package/Resources/WebLibraries/three/addons/postprocessing/LUTPass.js +138 -0
- package/Resources/WebLibraries/three/addons/postprocessing/MaskPass.js +195 -0
- package/Resources/WebLibraries/three/addons/postprocessing/OutlinePass.js +776 -0
- package/Resources/WebLibraries/three/addons/postprocessing/OutputPass.js +148 -0
- package/Resources/WebLibraries/three/addons/postprocessing/Pass.js +191 -0
- package/Resources/WebLibraries/three/addons/postprocessing/RenderPass.js +193 -0
- package/Resources/WebLibraries/three/addons/postprocessing/RenderPixelatedPass.js +314 -0
- package/Resources/WebLibraries/three/addons/postprocessing/RenderTransitionPass.js +267 -0
- package/Resources/WebLibraries/three/addons/postprocessing/SAOPass.js +407 -0
- package/Resources/WebLibraries/three/addons/postprocessing/SMAAPass.js +230 -0
- package/Resources/WebLibraries/three/addons/postprocessing/SSAARenderPass.js +313 -0
- package/Resources/WebLibraries/three/addons/postprocessing/SSAOPass.js +527 -0
- package/Resources/WebLibraries/three/addons/postprocessing/SSRPass.js +858 -0
- package/Resources/WebLibraries/three/addons/postprocessing/SavePass.js +132 -0
- package/Resources/WebLibraries/three/addons/postprocessing/ShaderPass.js +135 -0
- package/Resources/WebLibraries/three/addons/postprocessing/TAARenderPass.js +243 -0
- package/Resources/WebLibraries/three/addons/postprocessing/TexturePass.js +131 -0
- package/Resources/WebLibraries/three/addons/postprocessing/UnrealBloomPass.js +541 -0
- package/Resources/WebLibraries/three/addons/shaders/ACESFilmicToneMappingShader.js +96 -0
- package/Resources/WebLibraries/three/addons/shaders/AfterimageShader.js +63 -0
- package/Resources/WebLibraries/three/addons/shaders/BasicShader.js +36 -0
- package/Resources/WebLibraries/three/addons/shaders/BleachBypassShader.js +68 -0
- package/Resources/WebLibraries/three/addons/shaders/BlendShader.js +56 -0
- package/Resources/WebLibraries/three/addons/shaders/BokehShader.js +151 -0
- package/Resources/WebLibraries/three/addons/shaders/BokehShader2.js +404 -0
- package/Resources/WebLibraries/three/addons/shaders/BrightnessContrastShader.js +62 -0
- package/Resources/WebLibraries/three/addons/shaders/ColorCorrectionShader.js +59 -0
- package/Resources/WebLibraries/three/addons/shaders/ColorifyShader.js +57 -0
- package/Resources/WebLibraries/three/addons/shaders/ConvolutionShader.js +74 -0
- package/Resources/WebLibraries/three/addons/shaders/CopyShader.js +52 -0
- package/Resources/WebLibraries/three/addons/shaders/DOFMipMapShader.js +63 -0
- package/Resources/WebLibraries/three/addons/shaders/DepthLimitedBlurShader.js +183 -0
- package/Resources/WebLibraries/three/addons/shaders/DigitalGlitch.js +104 -0
- package/Resources/WebLibraries/three/addons/shaders/DotScreenShader.js +75 -0
- package/Resources/WebLibraries/three/addons/shaders/ExposureShader.js +51 -0
- package/Resources/WebLibraries/three/addons/shaders/FXAAShader.js +298 -0
- package/Resources/WebLibraries/three/addons/shaders/FilmShader.js +73 -0
- package/Resources/WebLibraries/three/addons/shaders/FocusShader.js +94 -0
- package/Resources/WebLibraries/three/addons/shaders/FreiChenShader.js +103 -0
- package/Resources/WebLibraries/three/addons/shaders/GTAOShader.js +437 -0
- package/Resources/WebLibraries/three/addons/shaders/GammaCorrectionShader.js +52 -0
- package/Resources/WebLibraries/three/addons/shaders/HalftoneShader.js +332 -0
- package/Resources/WebLibraries/three/addons/shaders/HorizontalBlurShader.js +68 -0
- package/Resources/WebLibraries/three/addons/shaders/HorizontalTiltShiftShader.js +70 -0
- package/Resources/WebLibraries/three/addons/shaders/HueSaturationShader.js +74 -0
- package/Resources/WebLibraries/three/addons/shaders/KaleidoShader.js +65 -0
- package/Resources/WebLibraries/three/addons/shaders/LuminosityHighPassShader.js +68 -0
- package/Resources/WebLibraries/three/addons/shaders/LuminosityShader.js +54 -0
- package/Resources/WebLibraries/three/addons/shaders/MirrorShader.js +62 -0
- package/Resources/WebLibraries/three/addons/shaders/NormalMapShader.js +60 -0
- package/Resources/WebLibraries/three/addons/shaders/OutputShader.js +103 -0
- package/Resources/WebLibraries/three/addons/shaders/PoissonDenoiseShader.js +230 -0
- package/Resources/WebLibraries/three/addons/shaders/RGBShiftShader.js +61 -0
- package/Resources/WebLibraries/three/addons/shaders/SAOShader.js +201 -0
- package/Resources/WebLibraries/three/addons/shaders/SMAAShader.js +489 -0
- package/Resources/WebLibraries/three/addons/shaders/SSAOShader.js +331 -0
- package/Resources/WebLibraries/three/addons/shaders/SSRShader.js +396 -0
- package/Resources/WebLibraries/three/addons/shaders/SepiaShader.js +57 -0
- package/Resources/WebLibraries/three/addons/shaders/SobelOperatorShader.js +98 -0
- package/Resources/WebLibraries/three/addons/shaders/SubsurfaceScatteringShader.js +95 -0
- package/Resources/WebLibraries/three/addons/shaders/TechnicolorShader.js +51 -0
- package/Resources/WebLibraries/three/addons/shaders/ToonShader.js +349 -0
- package/Resources/WebLibraries/three/addons/shaders/TriangleBlurShader.js +79 -0
- package/Resources/WebLibraries/three/addons/shaders/UnpackDepthRGBAShader.js +60 -0
- package/Resources/WebLibraries/three/addons/shaders/VelocityShader.js +137 -0
- package/Resources/WebLibraries/three/addons/shaders/VerticalBlurShader.js +66 -0
- package/Resources/WebLibraries/three/addons/shaders/VerticalTiltShiftShader.js +70 -0
- package/Resources/WebLibraries/three/addons/shaders/VignetteShader.js +56 -0
- package/Resources/WebLibraries/three/addons/shaders/VolumeShader.js +285 -0
- package/Resources/WebLibraries/three/addons/shaders/WaterRefractionShader.js +106 -0
- package/Resources/WebLibraries/three/addons/textures/FlakesTexture.js +54 -0
- package/Resources/WebLibraries/three/addons/tsl/WebGLNodesHandler.js +607 -0
- package/Resources/WebLibraries/three/addons/tsl/display/AfterImageNode.js +256 -0
- package/Resources/WebLibraries/three/addons/tsl/display/AnaglyphPassNode.js +550 -0
- package/Resources/WebLibraries/three/addons/tsl/display/BilateralBlurNode.js +377 -0
- package/Resources/WebLibraries/three/addons/tsl/display/BleachBypass.js +33 -0
- package/Resources/WebLibraries/three/addons/tsl/display/BloomNode.js +599 -0
- package/Resources/WebLibraries/three/addons/tsl/display/CRT.js +150 -0
- package/Resources/WebLibraries/three/addons/tsl/display/ChromaticAberrationNode.js +163 -0
- package/Resources/WebLibraries/three/addons/tsl/display/DenoiseNode.js +354 -0
- package/Resources/WebLibraries/three/addons/tsl/display/DepthOfFieldNode.js +572 -0
- package/Resources/WebLibraries/three/addons/tsl/display/DotScreenNode.js +104 -0
- package/Resources/WebLibraries/three/addons/tsl/display/FSR1Node.js +481 -0
- package/Resources/WebLibraries/three/addons/tsl/display/FXAANode.js +357 -0
- package/Resources/WebLibraries/three/addons/tsl/display/FilmNode.js +101 -0
- package/Resources/WebLibraries/three/addons/tsl/display/GTAONode.js +727 -0
- package/Resources/WebLibraries/three/addons/tsl/display/GaussianBlurNode.js +412 -0
- package/Resources/WebLibraries/three/addons/tsl/display/GodraysNode.js +604 -0
- package/Resources/WebLibraries/three/addons/tsl/display/ImportanceSampledEnvironment.js +564 -0
- package/Resources/WebLibraries/three/addons/tsl/display/LensflareNode.js +282 -0
- package/Resources/WebLibraries/three/addons/tsl/display/Lut3DNode.js +109 -0
- package/Resources/WebLibraries/three/addons/tsl/display/MotionBlur.js +33 -0
- package/Resources/WebLibraries/three/addons/tsl/display/OITPassNode.js +341 -0
- package/Resources/WebLibraries/three/addons/tsl/display/OutlineNode.js +916 -0
- package/Resources/WebLibraries/three/addons/tsl/display/ParallaxBarrierPassNode.js +90 -0
- package/Resources/WebLibraries/three/addons/tsl/display/PixelationPassNode.js +227 -0
- package/Resources/WebLibraries/three/addons/tsl/display/RGBShiftNode.js +96 -0
- package/Resources/WebLibraries/three/addons/tsl/display/RecurrentDenoiseNode.js +812 -0
- package/Resources/WebLibraries/three/addons/tsl/display/RetroPassNode.js +263 -0
- package/Resources/WebLibraries/three/addons/tsl/display/SMAANode.js +729 -0
- package/Resources/WebLibraries/three/addons/tsl/display/SSAAPassNode.js +344 -0
- package/Resources/WebLibraries/three/addons/tsl/display/SSAONode.js +422 -0
- package/Resources/WebLibraries/three/addons/tsl/display/SSGINode.js +698 -0
- package/Resources/WebLibraries/three/addons/tsl/display/SSRNode.js +1430 -0
- package/Resources/WebLibraries/three/addons/tsl/display/SSSNode.js +479 -0
- package/Resources/WebLibraries/three/addons/tsl/display/Sepia.js +24 -0
- package/Resources/WebLibraries/three/addons/tsl/display/Shape.js +29 -0
- package/Resources/WebLibraries/three/addons/tsl/display/SharpenNode.js +284 -0
- package/Resources/WebLibraries/three/addons/tsl/display/SobelOperatorNode.js +168 -0
- package/Resources/WebLibraries/three/addons/tsl/display/StereoCompositePassNode.js +190 -0
- package/Resources/WebLibraries/three/addons/tsl/display/StereoPassNode.js +117 -0
- package/Resources/WebLibraries/three/addons/tsl/display/TAAUNode.js +700 -0
- package/Resources/WebLibraries/three/addons/tsl/display/TRAANode.js +609 -0
- package/Resources/WebLibraries/three/addons/tsl/display/TemporalReprojectNode.js +1024 -0
- package/Resources/WebLibraries/three/addons/tsl/display/TransitionNode.js +141 -0
- package/Resources/WebLibraries/three/addons/tsl/display/boxBlur.js +65 -0
- package/Resources/WebLibraries/three/addons/tsl/display/depthAwareBlend.js +80 -0
- package/Resources/WebLibraries/three/addons/tsl/display/depthAwareBlur.js +63 -0
- package/Resources/WebLibraries/three/addons/tsl/display/hashBlur.js +55 -0
- package/Resources/WebLibraries/three/addons/tsl/display/lensDirt.js +30 -0
- package/Resources/WebLibraries/three/addons/tsl/display/radialBlur.js +68 -0
- package/Resources/WebLibraries/three/addons/tsl/lighting/ClusteredLightsNode.js +994 -0
- package/Resources/WebLibraries/three/addons/tsl/lighting/DynamicLightsNode.js +201 -0
- package/Resources/WebLibraries/three/addons/tsl/lighting/LightProbeGridNode.js +183 -0
- package/Resources/WebLibraries/three/addons/tsl/lighting/data/AmbientLightDataNode.js +67 -0
- package/Resources/WebLibraries/three/addons/tsl/lighting/data/DirectionalLightDataNode.js +117 -0
- package/Resources/WebLibraries/three/addons/tsl/lighting/data/HemisphereLightDataNode.js +105 -0
- package/Resources/WebLibraries/three/addons/tsl/lighting/data/PointLightDataNode.js +140 -0
- package/Resources/WebLibraries/three/addons/tsl/lighting/data/SpotLightDataNode.js +167 -0
- package/Resources/WebLibraries/three/addons/tsl/math/Bayer.js +84 -0
- package/Resources/WebLibraries/three/addons/tsl/math/curlNoise.js +107 -0
- package/Resources/WebLibraries/three/addons/tsl/math/voronoiNoise.js +112 -0
- package/Resources/WebLibraries/three/addons/tsl/shadows/TileShadowNode.js +542 -0
- package/Resources/WebLibraries/three/addons/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/Resources/WebLibraries/three/addons/tsl/utils/GroundedSkybox.js +62 -0
- package/Resources/WebLibraries/three/addons/tsl/utils/RNoise.js +51 -0
- package/Resources/WebLibraries/three/addons/tsl/utils/Raymarching.js +70 -0
- package/Resources/WebLibraries/three/addons/tsl/utils/SoftParticles.js +53 -0
- package/Resources/WebLibraries/three/addons/tsl/utils/SpecularHelpers.js +302 -0
- package/Resources/WebLibraries/three/addons/tsl/utils/TAAUtils.js +184 -0
- package/Resources/WebLibraries/three/addons/utils/BufferGeometryUtils.js +1523 -0
- package/Resources/WebLibraries/three/addons/utils/CameraUtils.js +82 -0
- package/Resources/WebLibraries/three/addons/utils/ColorUtils.js +76 -0
- package/Resources/WebLibraries/three/addons/utils/GaussianSplatUtils.js +229 -0
- package/Resources/WebLibraries/three/addons/utils/GeometryCompressionUtils.js +547 -0
- package/Resources/WebLibraries/three/addons/utils/GeometryUtils.js +226 -0
- package/Resources/WebLibraries/three/addons/utils/LDrawUtils.js +211 -0
- package/Resources/WebLibraries/three/addons/utils/SceneOptimizer.js +459 -0
- package/Resources/WebLibraries/three/addons/utils/SceneUtils.js +363 -0
- package/Resources/WebLibraries/three/addons/utils/ShadowMapViewer.js +244 -0
- package/Resources/WebLibraries/three/addons/utils/ShadowMapViewerGPU.js +233 -0
- package/Resources/WebLibraries/three/addons/utils/SkeletonUtils.js +496 -0
- package/Resources/WebLibraries/three/addons/utils/SortUtils.js +175 -0
- package/Resources/WebLibraries/three/addons/utils/UVsDebug.js +173 -0
- package/Resources/WebLibraries/three/addons/utils/WebGLTextureUtils.js +115 -0
- package/Resources/WebLibraries/three/addons/utils/WebGPUTextureUtils.js +81 -0
- package/Resources/WebLibraries/three/addons/utils/WorkerPool.js +167 -0
- package/Resources/WebLibraries/three/addons/utils/unwrapUVs.js +865 -0
- package/Resources/WebLibraries/three/three.core.js +61162 -0
- package/Resources/WebLibraries/three/three.module.js +19537 -0
- package/Resources/WebLibraries/three/three.tsl.js +41903 -0
- package/Resources/WebLibraries/three/three.webgpu.js +53714 -0
- package/Resources/skills/2d-game/SKILL.md +305 -0
- package/Resources/skills/3d-game/SKILL.md +274 -0
- package/Resources/skills/accounts/SKILL.md +41 -0
- package/Resources/skills/android-design/SKILL.md +159 -0
- package/Resources/skills/app-ai/SKILL.md +154 -0
- package/Resources/skills/app-intents/SKILL.md +31 -0
- package/Resources/skills/app-kinds/SKILL.md +122 -0
- package/Resources/skills/apple-watch/SKILL.md +43 -0
- package/Resources/skills/assets/SKILL.md +183 -0
- package/Resources/skills/building-blocks/SKILL.md +97 -0
- package/Resources/skills/device-control/SKILL.md +56 -0
- package/Resources/skills/device-integrations/SKILL.md +278 -0
- package/Resources/skills/finder-files/SKILL.md +19 -0
- package/Resources/skills/game/SKILL.md +414 -0
- package/Resources/skills/game-3d/SKILL.md +12 -0
- package/Resources/skills/game-art/SKILL.md +11 -0
- package/Resources/skills/game-feel/SKILL.md +13 -0
- package/Resources/skills/game-levels/SKILL.md +12 -0
- package/Resources/skills/game-live/SKILL.md +12 -0
- package/Resources/skills/game-physics/SKILL.md +13 -0
- package/Resources/skills/game-playtest/SKILL.md +26 -0
- package/Resources/skills/game-ui/SKILL.md +278 -0
- package/Resources/skills/github-projects/SKILL.md +59 -0
- package/Resources/skills/icloud-sync/SKILL.md +30 -0
- package/Resources/skills/iphone-hardware/SKILL.md +57 -0
- package/Resources/skills/iphone-widgets/SKILL.md +53 -0
- package/Resources/skills/lg-developer-mode/SKILL.md +152 -0
- package/Resources/skills/mac-widgets/SKILL.md +60 -0
- package/Resources/skills/maps/SKILL.md +8 -0
- package/Resources/skills/menu-bar/SKILL.md +36 -0
- package/Resources/skills/more-apps/SKILL.md +53 -0
- package/Resources/skills/phone-controllers/SKILL.md +79 -0
- package/Resources/skills/phone-pages/SKILL.md +173 -0
- package/Resources/skills/roku-developer-mode/SKILL.md +106 -0
- package/Resources/skills/scene-3d/SKILL.md +27 -0
- package/Resources/skills/scripting/SKILL.md +17 -0
- package/Resources/skills/share-extension/SKILL.md +22 -0
- package/Resources/skills/tv-design/SKILL.md +72 -0
- package/Resources/skills/web-app/SKILL.md +136 -0
- package/Resources/skills/web-game/SKILL.md +95 -0
- package/Resources/skills/web-or-native/SKILL.md +103 -0
- package/Resources/skills/wish-links/SKILL.md +156 -0
- package/THIRD_PARTY_NOTICES.md +170 -0
- package/cli/android.mjs +941 -0
- package/cli/browser.mjs +268 -0
- package/cli/calls.mjs +390 -0
- package/cli/dev.mjs +773 -0
- package/cli/devices.mjs +984 -0
- package/cli/lamp.mjs +1016 -0
- package/cli/lampapp.mjs +332 -0
- package/cli/lamps/android-host/LampPageGateway.kt +345 -0
- package/cli/lamps/android-host/app/build.gradle.kts +40 -0
- package/cli/lamps/android-host/build.gradle.kts +4 -0
- package/cli/lamps/android-host/game/AndroidManifest.xml +33 -0
- package/cli/lamps/android-host/game/MainActivity.kt +173 -0
- package/cli/lamps/android-host/gradle/libs.versions.toml +39 -0
- package/cli/lamps/android-host/gradle.properties +8 -0
- package/cli/lamps/android-host/page/AndroidManifest.xml +35 -0
- package/cli/lamps/android-host/page/MainActivity.kt +193 -0
- package/cli/lamps/android-host/settings.gradle.kts +30 -0
- package/cli/lamps/android-host/tools.json +43 -0
- package/cli/lamps/lamp-controllers.js +2 -0
- package/cli/lamps/lamp-for-games.js +6863 -0
- package/cli/lamps/lamp.js +7023 -0
- package/cli/lamps/mac-starter/.lamp/meta.json +1 -0
- package/cli/lamps/mac-starter/APP.md +12 -0
- package/cli/lamps/mac-starter/Package.swift +8 -0
- package/cli/lamps/mac-starter/Sources/App.swift +11 -0
- package/cli/lamps/mac-starter/Sources/ContentView.swift +17 -0
- package/cli/lamps/mac-starter/Sources/LampSupport.swift +18097 -0
- package/cli/lamps/mac-starter/build.sh +336 -0
- package/cli/lamps/mac-starter/gitignore +3 -0
- package/cli/lamps/mac-starter/lamp-starter.json +6 -0
- package/cli/lamps/web-starter/APP.md +8 -0
- package/cli/lamps/web-starter/app.js +1 -0
- package/cli/lamps/web-starter/index.html +17 -0
- package/cli/lamps/web-starter/lamp-starter.json +5 -0
- package/cli/lamps/web-starter/lamp.js +7023 -0
- package/cli/lamps/web-starter/style.css +25 -0
- package/cli/link.mjs +138 -0
- package/cli/mac.mjs +621 -0
- package/cli/mdns.mjs +205 -0
- package/cli/msix.mjs +413 -0
- package/cli/network.mjs +209 -0
- package/cli/outside.mjs +140 -0
- package/cli/page.js +165 -0
- package/cli/place.mjs +298 -0
- package/cli/png.mjs +184 -0
- package/cli/share.mjs +202 -0
- package/cli/skill/SKILL.md +255 -0
- package/cli/skills.mjs +71 -0
- package/cli/state.mjs +173 -0
- package/cli/update.mjs +57 -0
- package/package.json +20 -4
- package/site/lib/quota.js +59 -0
- package/site/lib/shared-wishes.js +996 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Lamp's player: the one Mac app around a page (a game drawn with three.js, a screen, a web app), compiled once when
|
|
2
|
+
// Lamp is built and copied for every game and screen made on this Mac, so none of them waits on a build or needs
|
|
3
|
+
// Apple's tools. Nothing of any one game is in it: each copy reads what it is from its own bundle, which Lamp writes
|
|
4
|
+
// as it makes the copy: its name and id, what kind of page it is and where that's served (LampPlayer in Info.plist),
|
|
5
|
+
// what it's told about itself and Lamp (LampInstall, read by LampSupport.swift), its permission reasons and icon, and
|
|
6
|
+
// the page itself in Resources/Web.
|
|
7
|
+
//
|
|
8
|
+
// The same Swift as an app Lamp compiles around a page (LampWebGame.swift, LampWebApp.swift, LampPage.swift and
|
|
9
|
+
// LampSupport.swift), with what those have filled in by Lamp read here instead.
|
|
10
|
+
import SwiftUI
|
|
11
|
+
|
|
12
|
+
enum LampPlayer {
|
|
13
|
+
private static let info = Bundle.main.object(forInfoDictionaryKey: "LampPlayer") as? [String: Any] ?? [:]
|
|
14
|
+
|
|
15
|
+
/// The game's or screen's name, as Lamp wrote it.
|
|
16
|
+
static var name: String {
|
|
17
|
+
Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ?? ProcessInfo.processInfo.processName
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/// A game's window, or any other page's. A copy that says neither was made wrong: it stops, saying so, rather than
|
|
21
|
+
/// open as something it isn't.
|
|
22
|
+
static let isGame: Bool = {
|
|
23
|
+
switch info["kind"] as? String {
|
|
24
|
+
case "game": return true
|
|
25
|
+
case "page": return false
|
|
26
|
+
default: fatalError("This app's Info.plist doesn't say what kind of page it is (LampPlayer.kind).")
|
|
27
|
+
}
|
|
28
|
+
}()
|
|
29
|
+
|
|
30
|
+
/// Where a page is served, which is where what it saves is kept: its kind's own address, for good. A game's is its
|
|
31
|
+
/// own (`LampGamePage`); any other page has to name one of the addresses Lamp gives.
|
|
32
|
+
static let scheme: String = {
|
|
33
|
+
guard let scheme = info["scheme"] as? String, ["lamp-screen", "lamp-web-app"].contains(scheme) else {
|
|
34
|
+
fatalError("This app's Info.plist doesn't name the address its page is served at (LampPlayer.scheme).")
|
|
35
|
+
}
|
|
36
|
+
return scheme
|
|
37
|
+
}()
|
|
38
|
+
|
|
39
|
+
/// The size a page made at a fixed size is laid out at ("1920x1080"), or nil for the window's.
|
|
40
|
+
static var canvas: CGSize? {
|
|
41
|
+
let sides = (info["canvas"] as? String)?.split(separator: "x").compactMap { Double($0) } ?? []
|
|
42
|
+
return sides.count == 2 ? CGSize(width: sides[0], height: sides[1]) : nil
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if LampPlayer.isGame { LampGameApp.main() } else { LampWebApp.main() }
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Lamp's common app around a page, on the Mac, the iPhone and the iPad: a window (or the whole screen) that is the
|
|
2
|
+
// page in Web/, shown in a web view of its own by LampPage.swift. Lamp writes this file before every build.
|
|
3
|
+
//
|
|
4
|
+
// The page is served at {{PAGE_SCHEME}}://app/, the app's own address for good. A page laid out at a fixed size of its own
|
|
5
|
+
// is zoomed to fill the window or screen; one that isn't is laid out at the window's size, as a browser would. A change
|
|
6
|
+
// of the page goes in while the app is open (`LampPageLive`): the page opens again with what it saved.
|
|
7
|
+
import SwiftUI
|
|
8
|
+
import WebKit
|
|
9
|
+
#if os(macOS)
|
|
10
|
+
import AppKit
|
|
11
|
+
#else
|
|
12
|
+
import UIKit
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
@main
|
|
16
|
+
struct LampWebApp: SwiftUI.App {
|
|
17
|
+
var body: some SwiftUI.Scene {
|
|
18
|
+
WindowGroup("{{NAME}}") {
|
|
19
|
+
LampWebAppView()
|
|
20
|
+
.ignoresSafeArea()
|
|
21
|
+
#if os(macOS)
|
|
22
|
+
.frame(minWidth: 480, minHeight: 270)
|
|
23
|
+
#else
|
|
24
|
+
.statusBarHidden()
|
|
25
|
+
.persistentSystemOverlays(.hidden)
|
|
26
|
+
#endif
|
|
27
|
+
}
|
|
28
|
+
#if os(macOS)
|
|
29
|
+
.defaultSize(width: 1280, height: 720)
|
|
30
|
+
.commands { LampCommands() }
|
|
31
|
+
#endif
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@MainActor enum LampWebAppPage {
|
|
36
|
+
static let files = LampPageFiles(scheme: "{{PAGE_SCHEME}}")
|
|
37
|
+
static func make() -> WKWebView { LampPageView.make(files, live: true) }
|
|
38
|
+
/// The size the page is laid out at, or nil for the window's.
|
|
39
|
+
static let canvas: CGSize? = {{PAGE_CANVAS}}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
struct LampWebAppView: View {
|
|
43
|
+
var body: some View {
|
|
44
|
+
ZStack {
|
|
45
|
+
Color.black
|
|
46
|
+
LampWebAppSurface()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#if os(macOS)
|
|
52
|
+
struct LampWebAppSurface: NSViewRepresentable {
|
|
53
|
+
func makeNSView(context: Context) -> LampPageHolder { LampPageHolder(holding: LampWebAppPage.make(), canvas: LampWebAppPage.canvas) }
|
|
54
|
+
func updateNSView(_ holder: LampPageHolder, context: Context) {
|
|
55
|
+
DispatchQueue.main.async { if holder.window?.firstResponder !== holder.page { holder.window?.makeFirstResponder(holder.page) } }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
#else
|
|
59
|
+
struct LampWebAppSurface: UIViewRepresentable {
|
|
60
|
+
func makeUIView(context: Context) -> LampPageHolder { LampPageHolder(holding: LampWebAppPage.make(), canvas: LampWebAppPage.canvas) }
|
|
61
|
+
func updateUIView(_ holder: LampPageHolder, context: Context) {}
|
|
62
|
+
}
|
|
63
|
+
#endif
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Lamp's game kit: the app around a game drawn with three.js, on the Mac, the iPhone and the iPad. Lamp writes this
|
|
2
|
+
// file before every build; the game itself is the page in Web/, which this shows in a web view of its own.
|
|
3
|
+
//
|
|
4
|
+
// On the Mac it's one window with the game filling it, under a title bar with nothing in it, so Lamp's wand floats at
|
|
5
|
+
// its top right and the chat opens beside it like any app's. On an iPhone or iPad it's the whole screen, on its side.
|
|
6
|
+
// The page is served and shown by Lamp's common host for a page (LampPage.swift), at the game's own address
|
|
7
|
+
// (lamp-game://app/); what it logs goes to the app's log, and its sound plays without a tap first.
|
|
8
|
+
import SwiftUI
|
|
9
|
+
import WebKit
|
|
10
|
+
#if os(macOS)
|
|
11
|
+
import AppKit
|
|
12
|
+
#else
|
|
13
|
+
import UIKit
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
@main
|
|
17
|
+
struct LampGameApp: SwiftUI.App {
|
|
18
|
+
var body: some SwiftUI.Scene {
|
|
19
|
+
WindowGroup("{{NAME}}") {
|
|
20
|
+
LampGameScreen()
|
|
21
|
+
}
|
|
22
|
+
#if os(macOS)
|
|
23
|
+
.windowStyle(.hiddenTitleBar)
|
|
24
|
+
.defaultSize(width: 1280, height: 720)
|
|
25
|
+
.commands { LampCommands() }
|
|
26
|
+
#endif
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
struct LampGameScreen: View {
|
|
31
|
+
// How to play is the game's own to show, named for what the player holds (label() and glyph() in lamp-game.js), so
|
|
32
|
+
// nothing here lists keys that may not be the game's or the player's.
|
|
33
|
+
var body: some View {
|
|
34
|
+
ZStack {
|
|
35
|
+
Color.black
|
|
36
|
+
LampGameSurface()
|
|
37
|
+
}
|
|
38
|
+
.ignoresSafeArea()
|
|
39
|
+
#if os(macOS)
|
|
40
|
+
.frame(minWidth: 480, minHeight: 270)
|
|
41
|
+
#else
|
|
42
|
+
.statusBarHidden()
|
|
43
|
+
.persistentSystemOverlays(.hidden)
|
|
44
|
+
#endif
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// The page that is the game, served by Lamp's common host (LampPage.swift): it logs its own errors, and takes Lamp's
|
|
49
|
+
/// changes while it's open (`LampPageLive`).
|
|
50
|
+
@MainActor enum LampGamePage {
|
|
51
|
+
static let files = LampPageFiles(scheme: "lamp-game")
|
|
52
|
+
|
|
53
|
+
static func make() -> WKWebView { LampPageView.make(files, catchErrors: false, live: true) }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#if os(macOS)
|
|
57
|
+
struct LampGameSurface: NSViewRepresentable {
|
|
58
|
+
func makeNSView(context: Context) -> LampKeyCatcher { LampKeyCatcher(holding: LampGamePage.make()) }
|
|
59
|
+
func updateNSView(_ view: LampKeyCatcher, context: Context) {
|
|
60
|
+
DispatchQueue.main.async { view.window?.makeFirstResponder(view.page) }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// Holds the page and takes the keys it hands back. WebKit gives back every key the page doesn't cancel, and a game
|
|
65
|
+
/// reads its keys without cancelling most of them, so each would reach the window, which beeps for a key nothing took.
|
|
66
|
+
/// A shortcut with ⌘ goes to the menus first: the web view says it took every one, before the page has even seen it,
|
|
67
|
+
/// so macOS looks no further and ⌘Q, ⌘W and ⌘H would do nothing while the game has the keyboard.
|
|
68
|
+
final class LampKeyCatcher: LampPageHolder {
|
|
69
|
+
init(holding page: WKWebView) { super.init(holding: page) }
|
|
70
|
+
|
|
71
|
+
required init?(coder: NSCoder) { nil }
|
|
72
|
+
|
|
73
|
+
override func performKeyEquivalent(with event: NSEvent) -> Bool {
|
|
74
|
+
if event.modifierFlags.contains(.command), NSApp.mainMenu?.performKeyEquivalent(with: event) == true { return true }
|
|
75
|
+
return super.performKeyEquivalent(with: event)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
override func keyDown(with event: NSEvent) {}
|
|
79
|
+
override func keyUp(with event: NSEvent) {}
|
|
80
|
+
override func doCommand(by selector: Selector) {}
|
|
81
|
+
}
|
|
82
|
+
#else
|
|
83
|
+
struct LampGameSurface: UIViewRepresentable {
|
|
84
|
+
func makeUIView(context: Context) -> LampPageHolder { LampPageHolder(holding: LampGamePage.make()) }
|
|
85
|
+
func updateUIView(_ holder: LampPageHolder, context: Context) {}
|
|
86
|
+
}
|
|
87
|
+
#endif
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
/// What the page asks of this Mac, iPhone or iPad with `LampNative.call(name, args)` in Web/: the person's own things
|
|
4
|
+
/// the page can't reach itself (mail, calendar, reminders, contacts, photos, location…), read with Lamp's building
|
|
5
|
+
/// blocks in LampSupport.swift. Each call is registered here once, as the app opens.
|
|
6
|
+
enum Native {
|
|
7
|
+
@MainActor static func register() {
|
|
8
|
+
// LampNative.on("events") { args in
|
|
9
|
+
// try await LampCalendar.events(days: args["days"] as? Int ?? 7).map { ["title": $0.title, "start": $0.start] }
|
|
10
|
+
// }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Lamp's game kit: builds the game. Lamp writes this file before every build and runs it in the app's sandbox; don't
|
|
3
|
+
# edit it.
|
|
4
|
+
#
|
|
5
|
+
# sh Lamp/build.sh xbox the console's app: build/xbox/App.exe, and build/xbox.zip with it and Assets/
|
|
6
|
+
#
|
|
7
|
+
# The game is every .cpp and .c in Game/, and every .glsl there is a shader, compiled by sokol-shdc into
|
|
8
|
+
# build/shaders/<name>.glsl.h for the game to include. $LAMP_WINDOWS is
|
|
9
|
+
# where Lamp keeps the tools for the console: LLVM's clang-cl and lld-link, Microsoft's SDK and sokol-shdc.
|
|
10
|
+
set -e
|
|
11
|
+
cd "$(dirname "$0")/.."
|
|
12
|
+
target="${1:-xbox}"
|
|
13
|
+
tools="${LAMP_WINDOWS:?Lamp gives the build the folder with the tools for the console}"
|
|
14
|
+
mkdir -p build/shaders
|
|
15
|
+
|
|
16
|
+
# Shaders first: the build includes what they make.
|
|
17
|
+
for shader in Game/*.glsl; do
|
|
18
|
+
[ -e "$shader" ] || continue
|
|
19
|
+
name=$(basename "$shader")
|
|
20
|
+
out="build/shaders/$name.h"
|
|
21
|
+
if [ ! -f "$out" ] || [ "$shader" -nt "$out" ] || [ "$tools/bin/sokol-shdc" -nt "$out" ]; then
|
|
22
|
+
"$tools/bin/sokol-shdc" --input "$shader" --output "$out" --slang hlsl5:metal_macos >&2 || { rm -f "$out"; exit 1; }
|
|
23
|
+
fi
|
|
24
|
+
done
|
|
25
|
+
|
|
26
|
+
# Lamp's own code, compiled again only when it changed (Lamp touches kit.stamp when any of its files does): it's
|
|
27
|
+
# the slow part. The game's, every time.
|
|
28
|
+
fresh() { [ -f "$1" ] && [ "$1" -nt "$2" ] && [ "$1" -nt Lamp/kit.stamp ]; }
|
|
29
|
+
|
|
30
|
+
sdk="$tools/sdk"
|
|
31
|
+
out=build/xbox
|
|
32
|
+
mkdir -p "$out"
|
|
33
|
+
cl="$tools/llvm/bin/clang-cl"
|
|
34
|
+
# The flags as the shell's own argument list, so a folder name with a space in it (the home folder's) stays one argument.
|
|
35
|
+
set -- --target=x86_64-pc-windows-msvc /std:c++20 /EHsc /O2 /MT /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D_CRT_USE_WINAPI_FAMILY_DESKTOP_APP \
|
|
36
|
+
/DUNICODE /D_UNICODE /DNOMINMAX /DLAMP_XBOX=1 -imsvc "$sdk/crt/include" -imsvc "$sdk/sdk/include/ucrt" -imsvc "$sdk/sdk/include/um" \
|
|
37
|
+
-imsvc "$sdk/sdk/include/shared" -imsvc "$sdk/sdk/include/winrt" -imsvc "$sdk/sdk/include/cppwinrt" -ILamp -Ibuild/shaders -IGame
|
|
38
|
+
fresh "$out/lamp_kit.obj" Lamp/lamp_kit.cpp || "$cl" "$@" /DSOKOL_D3D11 -w /c Lamp/lamp_kit.cpp /Fo"$out/lamp_kit.obj"
|
|
39
|
+
fresh "$out/lamp_xbox.obj" Lamp/lamp_xbox.cpp || "$cl" "$@" -w /c Lamp/lamp_xbox.cpp /Fo"$out/lamp_xbox.obj"
|
|
40
|
+
fresh "$out/lamp_sound.obj" Lamp/lamp_sound.cpp || "$cl" "$@" -w /c Lamp/lamp_sound.cpp /Fo"$out/lamp_sound.obj"
|
|
41
|
+
objects="$out/lamp_kit.obj $out/lamp_xbox.obj $out/lamp_sound.obj"
|
|
42
|
+
for source in Game/*.cpp Game/*.c; do
|
|
43
|
+
[ -e "$source" ] || continue
|
|
44
|
+
object="$out/$(basename "$source").obj"
|
|
45
|
+
case "$source" in *.c) "$cl" "$@" /TC /c "$source" /Fo"$object" ;;
|
|
46
|
+
*) "$cl" "$@" /c "$source" /Fo"$object" ;; esac
|
|
47
|
+
objects="$objects $object"
|
|
48
|
+
done
|
|
49
|
+
# A static C++ runtime, so the console needs no package of Microsoft's beside the game's.
|
|
50
|
+
"$tools/llvm/bin/lld-link" /OUT:"$out/App.exe" /APPCONTAINER /SUBSYSTEM:WINDOWS /MACHINE:X64 /ENTRY:wWinMainCRTStartup /NODEFAULTLIB \
|
|
51
|
+
/LIBPATH:"$sdk/crt/lib/onecore/x86_64" /LIBPATH:"$sdk/sdk/lib/ucrt/x86_64" /LIBPATH:"$sdk/sdk/lib/um/x86_64" \
|
|
52
|
+
$objects libcmt.lib libvcruntime.lib libcpmt.lib ucrt.lib WindowsApp.lib d3d11.lib dxgi.lib xaudio2.lib
|
|
53
|
+
rm -f build/xbox.zip
|
|
54
|
+
( cd "$out" && zip -qX ../xbox.zip App.exe )
|
|
55
|
+
if [ -d Assets ]; then zip -qrXy build/xbox.zip Assets -x '*/.*' -x '.*'; fi
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Lamp's game kit: what a game is written against. Lamp writes this file before every build; don't edit it.
|
|
2
|
+
//
|
|
3
|
+
// The game is two functions, game_init and game_frame, drawn with sokol_gfx (sokol_gfx.h), with sokol_shape.h for
|
|
4
|
+
// boxes, spheres and the like, sokol_debugtext.h and sokol_gl.h for text and lines, HandmadeMath.h for vectors and
|
|
5
|
+
// matrices, cgltf.h for glTF models and stb_image.h for pictures, and sound through the functions below. On the Xbox
|
|
6
|
+
// the host is a full-screen app drawing with Direct3D 11 at 1920x1080, 60 frames a second, and playing the sound
|
|
7
|
+
// through XAudio2. Nothing here or in the game may call Windows or Apple APIs: everything the game needs from the
|
|
8
|
+
// machine goes through the functions below.
|
|
9
|
+
#pragma once
|
|
10
|
+
#include <stdbool.h>
|
|
11
|
+
#include <stddef.h>
|
|
12
|
+
#include <stdint.h>
|
|
13
|
+
#include "sokol_gfx.h"
|
|
14
|
+
|
|
15
|
+
#ifdef __cplusplus
|
|
16
|
+
extern "C" {
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
// The controller's buttons, as bits of LampPad.down, .pressed and .released.
|
|
20
|
+
enum {
|
|
21
|
+
LAMP_A = 1 << 0, LAMP_B = 1 << 1, LAMP_X = 1 << 2, LAMP_Y = 1 << 3,
|
|
22
|
+
LAMP_LB = 1 << 4, LAMP_RB = 1 << 5, // the bumpers
|
|
23
|
+
LAMP_MENU = 1 << 6, LAMP_VIEW = 1 << 7, // ≡ (start) and ⧉ (back)
|
|
24
|
+
LAMP_UP = 1 << 8, LAMP_DOWN = 1 << 9, LAMP_LEFT = 1 << 10, LAMP_RIGHT = 1 << 11, // the d-pad
|
|
25
|
+
LAMP_LSTICK = 1 << 12, LAMP_RSTICK = 1 << 13 // a stick pressed in
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
typedef struct LampPad {
|
|
29
|
+
bool connected;
|
|
30
|
+
float lx, ly, rx, ry; // the sticks, -1 to 1, up and right positive, with a small dead zone already taken out
|
|
31
|
+
float lt, rt; // the triggers, 0 to 1
|
|
32
|
+
uint32_t down; // buttons held now
|
|
33
|
+
uint32_t pressed; // buttons that went down since the last frame
|
|
34
|
+
uint32_t released; // buttons that came up since the last frame
|
|
35
|
+
} LampPad;
|
|
36
|
+
|
|
37
|
+
typedef struct LampSetup {
|
|
38
|
+
int width, height; // 1920x1080
|
|
39
|
+
sg_pixel_format color_format; // what the screen is drawn in: pass to sdtx/sgl/pipelines
|
|
40
|
+
sg_pixel_format depth_format;
|
|
41
|
+
int sample_count; // 1
|
|
42
|
+
} LampSetup;
|
|
43
|
+
|
|
44
|
+
typedef struct LampFrame {
|
|
45
|
+
double dt; // seconds since the last frame: 1/60 at the console's pace
|
|
46
|
+
double time; // seconds since the game started
|
|
47
|
+
uint64_t number; // frames since the game started
|
|
48
|
+
int width, height;
|
|
49
|
+
LampPad pads[4]; // pads[0] is the first controller
|
|
50
|
+
sg_swapchain swapchain; // give it to sg_begin_pass for the pass that draws the screen
|
|
51
|
+
} LampFrame;
|
|
52
|
+
|
|
53
|
+
// Written by the game.
|
|
54
|
+
void game_init(const LampSetup* setup);
|
|
55
|
+
void game_frame(const LampFrame* frame); // draw one frame: sg_begin_pass(swapchain) … sg_end_pass(); sg_commit();
|
|
56
|
+
|
|
57
|
+
// What the game reads and keeps.
|
|
58
|
+
typedef struct LampFile { void* data; size_t size; } LampFile; // data is NULL when there's nothing
|
|
59
|
+
LampFile lamp_asset(const char* path); // a file from the app's Assets/ folder ("models/ship.glb")
|
|
60
|
+
LampFile lamp_load(const char* name); // what the game saved under this name, or nothing
|
|
61
|
+
bool lamp_save(const char* name, const void* data, size_t size); // kept on the console between plays
|
|
62
|
+
void lamp_free(LampFile file);
|
|
63
|
+
|
|
64
|
+
// A line in the game's log, which Lamp reads (printf's format). Keep it to what helps: a few lines, not one a frame.
|
|
65
|
+
void lamp_log(const char* format, ...);
|
|
66
|
+
|
|
67
|
+
// Random numbers: use these, never rand() or the time, for anything random.
|
|
68
|
+
uint32_t lamp_random(void);
|
|
69
|
+
float lamp_random_float(void); // 0 up to 1
|
|
70
|
+
|
|
71
|
+
// The controller's rumble, 0 to 1 for its two motors, until called again with zeros.
|
|
72
|
+
void lamp_rumble(int pad, float low, float high);
|
|
73
|
+
|
|
74
|
+
// Sound: effects and music, mixed by the kit in stereo at 48 kHz on the console's speakers. Up to 32 effects play at
|
|
75
|
+
// once (a 33rd takes the place of the oldest) and one piece of music beside them. Nothing here waits or takes time
|
|
76
|
+
// from the frame: call these from game_init and game_frame as things happen.
|
|
77
|
+
typedef struct LampSound { uint32_t id; } LampSound; // id 0 is no sound (a file that didn't load): playing it does nothing
|
|
78
|
+
|
|
79
|
+
// An effect from Assets/ (.wav, .ogg or .mp3), decoded whole once: load each in game_init, never per frame.
|
|
80
|
+
LampSound lamp_sound_load(const char* path);
|
|
81
|
+
|
|
82
|
+
// An effect made in code, for a game with no sound files: a wave from one pitch to another under a simple envelope.
|
|
83
|
+
typedef enum LampWave { LAMP_SINE, LAMP_SQUARE, LAMP_TRIANGLE, LAMP_SAW, LAMP_NOISE } LampWave;
|
|
84
|
+
typedef struct LampTone {
|
|
85
|
+
LampWave wave;
|
|
86
|
+
float from_hz, to_hz; // the pitch at the start and at the end (the same for a steady note)
|
|
87
|
+
float attack, hold, release; // seconds: rising, at full volume, fading out
|
|
88
|
+
float volume; // 0 to 1
|
|
89
|
+
} LampTone;
|
|
90
|
+
LampSound lamp_sound_tone(LampTone tone);
|
|
91
|
+
// An effect from samples the game worked out itself: mono, -1 to 1, at `rate` a second (48000 is the mix's own).
|
|
92
|
+
LampSound lamp_sound_samples(const float* samples, int count, int rate);
|
|
93
|
+
|
|
94
|
+
// Plays an effect and gives the voice playing it (0 when it didn't play). volume 0 to 1, pan -1 (left) to 1 (right),
|
|
95
|
+
// pitch 1 as recorded (2 an octave up). lamp_play_loop plays it over and over until stopped: an engine, a hum.
|
|
96
|
+
int lamp_play(LampSound sound, float volume, float pan, float pitch);
|
|
97
|
+
int lamp_play_loop(LampSound sound, float volume, float pan, float pitch);
|
|
98
|
+
void lamp_voice_set(int voice, float volume, float pan, float pitch); // change a voice as it plays
|
|
99
|
+
void lamp_stop(int voice); // a voice that ended already: nothing
|
|
100
|
+
void lamp_stop_all(void);
|
|
101
|
+
|
|
102
|
+
// Music from Assets/ (.ogg, .mp3 or .wav), read a little at a time as it plays and played over and over; a new
|
|
103
|
+
// piece fades in over the one playing, and NULL fades it out. Keep music quiet under the effects (0.3 to 0.5).
|
|
104
|
+
void lamp_music(const char* path, float volume);
|
|
105
|
+
// Music the game made itself (lamp_sound_samples, lamp_sound_tone), played over and over as music: under the music
|
|
106
|
+
// volume, fading in over what plays. A sound of id 0 fades the music out.
|
|
107
|
+
void lamp_music_sound(LampSound sound, float volume);
|
|
108
|
+
void lamp_music_volume(float volume);
|
|
109
|
+
|
|
110
|
+
// The person's own volumes for effects and for music, 0 to 1 (0 is off): what the game's settings change, kept with
|
|
111
|
+
// lamp_save. Both start at 1.
|
|
112
|
+
void lamp_volume(float effects, float music);
|
|
113
|
+
|
|
114
|
+
#ifdef __cplusplus
|
|
115
|
+
}
|
|
116
|
+
#endif
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Lamp's game kit: what the two hosts share, not for the game. Lamp writes this file before every build.
|
|
2
|
+
#pragma once
|
|
3
|
+
#include <stdint.h>
|
|
4
|
+
#include "lamp_game.h"
|
|
5
|
+
|
|
6
|
+
#ifdef __cplusplus
|
|
7
|
+
extern "C" {
|
|
8
|
+
#endif
|
|
9
|
+
void lamp_host_seed(uint64_t seed);
|
|
10
|
+
// Sets a pad's pressed and released from what was down the frame before.
|
|
11
|
+
void lamp_host_edges(LampPad* pad, uint32_t before);
|
|
12
|
+
float lamp_host_dead_zone(float value);
|
|
13
|
+
// The mix: `frames` stereo frames at 48 kHz, interleaved, into `out`. Called by the host's sound thread on the
|
|
14
|
+
// console; it takes a lock the game's sound calls take too.
|
|
15
|
+
void lamp_host_mix(float* out, int frames);
|
|
16
|
+
void lamp_host_sokol_log(const char* tag, uint32_t level, uint32_t item, const char* message, uint32_t line, const char* file, void* user);
|
|
17
|
+
#ifdef __cplusplus
|
|
18
|
+
}
|
|
19
|
+
#endif
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Lamp's game kit: the sokol libraries' code and what both hosts share. Lamp writes this file before every build.
|
|
2
|
+
// Compiled for the Xbox's host, with SOKOL_D3D11.
|
|
3
|
+
#if defined(SOKOL_D3D11)
|
|
4
|
+
#define WIN32_LEAN_AND_MEAN
|
|
5
|
+
#include <windows.h>
|
|
6
|
+
// LoadLibraryA isn't in an app's part of the Windows API; LoadLibraryExA is, and loads the same system library
|
|
7
|
+
// (sokol_gfx loads d3dcompiler_47.dll with it to compile the shaders on the console).
|
|
8
|
+
#define LoadLibraryA(name) LoadLibraryExA(name, NULL, 0)
|
|
9
|
+
#endif
|
|
10
|
+
// The declarations first, then each library's code (sokol's headers allow being included again with SOKOL_IMPL).
|
|
11
|
+
#include "lamp_game.h"
|
|
12
|
+
#include "lamp_host.h"
|
|
13
|
+
#define SOKOL_IMPL
|
|
14
|
+
#include "sokol_gfx.h"
|
|
15
|
+
#include "sokol_log.h"
|
|
16
|
+
#include "sokol_gl.h"
|
|
17
|
+
#include "sokol_debugtext.h"
|
|
18
|
+
#include "sokol_shape.h"
|
|
19
|
+
#define HANDMADE_MATH_IMPLEMENTATION
|
|
20
|
+
#include "HandmadeMath.h"
|
|
21
|
+
#define CGLTF_IMPLEMENTATION
|
|
22
|
+
#include "cgltf.h"
|
|
23
|
+
#define STB_IMAGE_IMPLEMENTATION
|
|
24
|
+
#define STBI_NO_STDIO
|
|
25
|
+
#include "stb_image.h"
|
|
26
|
+
#include <stdlib.h>
|
|
27
|
+
|
|
28
|
+
static uint64_t lamp_seed = 0x9E3779B97F4A7C15ull;
|
|
29
|
+
|
|
30
|
+
void lamp_host_seed(uint64_t seed) { lamp_seed = seed ? seed : 0x9E3779B97F4A7C15ull; }
|
|
31
|
+
|
|
32
|
+
// xorshift64*: small, fast and the same on both hosts.
|
|
33
|
+
uint32_t lamp_random(void) {
|
|
34
|
+
lamp_seed ^= lamp_seed >> 12;
|
|
35
|
+
lamp_seed ^= lamp_seed << 25;
|
|
36
|
+
lamp_seed ^= lamp_seed >> 27;
|
|
37
|
+
return (uint32_t)((lamp_seed * 0x2545F4914F6CDD1Dull) >> 32);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
float lamp_random_float(void) { return (float)(lamp_random() >> 8) / 16777216.0f; }
|
|
41
|
+
|
|
42
|
+
void lamp_free(LampFile file) { free(file.data); }
|
|
43
|
+
|
|
44
|
+
void lamp_host_edges(LampPad* pad, uint32_t before) {
|
|
45
|
+
pad->pressed = pad->down & ~before;
|
|
46
|
+
pad->released = before & ~pad->down;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
float lamp_host_dead_zone(float value) {
|
|
50
|
+
const float zone = 0.12f;
|
|
51
|
+
if (value > zone) return (value - zone) / (1 - zone);
|
|
52
|
+
if (value < -zone) return (value + zone) / (1 - zone);
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void lamp_host_sokol_log(const char* tag, uint32_t level, uint32_t item, const char* message, uint32_t line, const char* file, void*) {
|
|
57
|
+
// Errors and warnings only: sokol's info lines would fill the log.
|
|
58
|
+
if (level > 1) return;
|
|
59
|
+
lamp_log("[%s] %s: %s (%s:%u)", tag ? tag : "sokol", level == 0 ? "panic" : "error", message ? message : "", file ? file : "", line);
|
|
60
|
+
(void)item;
|
|
61
|
+
}
|