@rings-webgpu/core 1.0.2 → 1.0.3
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/dist/rings.es.js +181 -181
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +474 -287
- package/dist/rings.umd.js +180 -180
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +485 -286
- package/package.json +1 -1
- package/dist/package.json +0 -54
- package/dist/packages/wasm-matrix/WasmMatrix.d.ts +0 -26
- package/dist/packages/wasm-matrix/WasmMatrix.js +0 -88
- package/dist/src/Engine3D.d.ts +0 -107
- package/dist/src/Engine3D.js +0 -471
- package/dist/src/assets/Fonts.d.ts +0 -20
- package/dist/src/assets/Fonts.js +0 -24
- package/dist/src/assets/Res.d.ts +0 -72
- package/dist/src/assets/Res.js +0 -299
- package/dist/src/assets/shader/ShaderLib.d.ts +0 -5
- package/dist/src/assets/shader/ShaderLib.js +0 -128
- package/dist/src/assets/shader/anim/SkeletonAnimation_shader.d.ts +0 -3
- package/dist/src/assets/shader/anim/SkeletonAnimation_shader.js +0 -51
- package/dist/src/assets/shader/cluster/ClusterBoundsSource_cs.d.ts +0 -1
- package/dist/src/assets/shader/cluster/ClusterBoundsSource_cs.js +0 -88
- package/dist/src/assets/shader/cluster/ClusterLighting_cs.d.ts +0 -1
- package/dist/src/assets/shader/cluster/ClusterLighting_cs.js +0 -127
- package/dist/src/assets/shader/compute/BRDFLUT.d.ts +0 -1
- package/dist/src/assets/shader/compute/BRDFLUT.js +0 -90
- package/dist/src/assets/shader/compute/BloomEffect_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/BloomEffect_cs.js +0 -173
- package/dist/src/assets/shader/compute/BlurEffectCreator_cs.d.ts +0 -2
- package/dist/src/assets/shader/compute/BlurEffectCreator_cs.js +0 -84
- package/dist/src/assets/shader/compute/DDGIIrradiance_Cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/DDGIIrradiance_Cs.js +0 -307
- package/dist/src/assets/shader/compute/DDGILighting_CSShader.d.ts +0 -4
- package/dist/src/assets/shader/compute/DDGILighting_CSShader.js +0 -285
- package/dist/src/assets/shader/compute/DepthOfView_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/DepthOfView_cs.js +0 -90
- package/dist/src/assets/shader/compute/ErpImage2CubeMapCreateCube_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/ErpImage2CubeMapCreateCube_cs.js +0 -64
- package/dist/src/assets/shader/compute/ErpImage2CubeMapRgbe2rgba_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/ErpImage2CubeMapRgbe2rgba_cs.js +0 -34
- package/dist/src/assets/shader/compute/GTAO_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/GTAO_cs.js +0 -133
- package/dist/src/assets/shader/compute/GodRay_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/GodRay_cs.js +0 -214
- package/dist/src/assets/shader/compute/IBLEnvMapCreator_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/IBLEnvMapCreator_cs.js +0 -164
- package/dist/src/assets/shader/compute/MergeRGBA_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/MergeRGBA_cs.js +0 -27
- package/dist/src/assets/shader/compute/MultiBouncePass_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/MultiBouncePass_cs.js +0 -169
- package/dist/src/assets/shader/compute/OutLineBlendColor_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/OutLineBlendColor_cs.js +0 -49
- package/dist/src/assets/shader/compute/OutlineCalcOutline_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/OutlineCalcOutline_cs.js +0 -95
- package/dist/src/assets/shader/compute/Outline_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/Outline_cs.js +0 -116
- package/dist/src/assets/shader/compute/Picker_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/Picker_cs.js +0 -40
- package/dist/src/assets/shader/compute/PreFilteredEnvironment_cs copy.d.ts +0 -1
- package/dist/src/assets/shader/compute/PreFilteredEnvironment_cs copy.js +0 -162
- package/dist/src/assets/shader/compute/PreFilteredEnvironment_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/PreFilteredEnvironment_cs.js +0 -201
- package/dist/src/assets/shader/compute/PreIntegratedLut.d.ts +0 -1
- package/dist/src/assets/shader/compute/PreIntegratedLut.js +0 -46
- package/dist/src/assets/shader/compute/SSAO_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/SSAO_cs.js +0 -82
- package/dist/src/assets/shader/compute/SSGI2_cs.d.ts +0 -7
- package/dist/src/assets/shader/compute/SSGI2_cs.js +0 -169
- package/dist/src/assets/shader/compute/SSR_BlendColor_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/SSR_BlendColor_cs.js +0 -53
- package/dist/src/assets/shader/compute/SSR_IS_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/SSR_IS_cs.js +0 -76
- package/dist/src/assets/shader/compute/SSR_RayTrace_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/SSR_RayTrace_cs.js +0 -289
- package/dist/src/assets/shader/compute/TAACopyTex_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/TAACopyTex_cs.js +0 -22
- package/dist/src/assets/shader/compute/TAASharpTex_cs.d.ts +0 -1
- package/dist/src/assets/shader/compute/TAASharpTex_cs.js +0 -42
- package/dist/src/assets/shader/compute/TAA_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/TAA_cs.js +0 -152
- package/dist/src/assets/shader/compute/utils/Combine_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/utils/Combine_cs.js +0 -47
- package/dist/src/assets/shader/compute/utils/Denoising_cs.d.ts +0 -4
- package/dist/src/assets/shader/compute/utils/Denoising_cs.js +0 -28
- package/dist/src/assets/shader/compute/utils/TestComputeLoadBuffer.d.ts +0 -1
- package/dist/src/assets/shader/compute/utils/TestComputeLoadBuffer.js +0 -128
- package/dist/src/assets/shader/compute/utils/TextureCompress.d.ts +0 -2
- package/dist/src/assets/shader/compute/utils/TextureCompress.js +0 -131
- package/dist/src/assets/shader/compute/utils/tw.d.ts +0 -4
- package/dist/src/assets/shader/compute/utils/tw.js +0 -43
- package/dist/src/assets/shader/core/base/Common_frag.d.ts +0 -1
- package/dist/src/assets/shader/core/base/Common_frag.js +0 -62
- package/dist/src/assets/shader/core/base/Common_vert.d.ts +0 -1
- package/dist/src/assets/shader/core/base/Common_vert.js +0 -12
- package/dist/src/assets/shader/core/common/BrdfLut_frag.d.ts +0 -1
- package/dist/src/assets/shader/core/common/BrdfLut_frag.js +0 -6
- package/dist/src/assets/shader/core/common/EnvMap_frag.d.ts +0 -1
- package/dist/src/assets/shader/core/common/EnvMap_frag.js +0 -10
- package/dist/src/assets/shader/core/common/GBufferStand.d.ts +0 -1
- package/dist/src/assets/shader/core/common/GBufferStand.js +0 -171
- package/dist/src/assets/shader/core/common/GlobalUniform.d.ts +0 -4
- package/dist/src/assets/shader/core/common/GlobalUniform.js +0 -117
- package/dist/src/assets/shader/core/common/InstanceUniform.d.ts +0 -1
- package/dist/src/assets/shader/core/common/InstanceUniform.js +0 -9
- package/dist/src/assets/shader/core/common/SHCommon_frag.d.ts +0 -1
- package/dist/src/assets/shader/core/common/SHCommon_frag.js +0 -82
- package/dist/src/assets/shader/core/common/WorldMatrixUniform.d.ts +0 -1
- package/dist/src/assets/shader/core/common/WorldMatrixUniform.js +0 -8
- package/dist/src/assets/shader/core/inline/Inline_vert.d.ts +0 -1
- package/dist/src/assets/shader/core/inline/Inline_vert.js +0 -59
- package/dist/src/assets/shader/core/pass/CastShadow_pass.d.ts +0 -4
- package/dist/src/assets/shader/core/pass/CastShadow_pass.js +0 -284
- package/dist/src/assets/shader/core/pass/FrustumCulling_cs.d.ts +0 -4
- package/dist/src/assets/shader/core/pass/FrustumCulling_cs.js +0 -91
- package/dist/src/assets/shader/core/pass/GBuffer_pass.d.ts +0 -1
- package/dist/src/assets/shader/core/pass/GBuffer_pass.js +0 -72
- package/dist/src/assets/shader/core/pass/SkyGBuffer_pass.d.ts +0 -1
- package/dist/src/assets/shader/core/pass/SkyGBuffer_pass.js +0 -34
- package/dist/src/assets/shader/core/pass/ZPassShader_cs.d.ts +0 -1
- package/dist/src/assets/shader/core/pass/ZPassShader_cs.js +0 -14
- package/dist/src/assets/shader/core/pass/ZPassShader_fs.d.ts +0 -1
- package/dist/src/assets/shader/core/pass/ZPassShader_fs.js +0 -15
- package/dist/src/assets/shader/core/pass/ZPassShader_vs.d.ts +0 -1
- package/dist/src/assets/shader/core/pass/ZPassShader_vs.js +0 -83
- package/dist/src/assets/shader/core/struct/ClusterLight.d.ts +0 -4
- package/dist/src/assets/shader/core/struct/ClusterLight.js +0 -98
- package/dist/src/assets/shader/core/struct/ColorPassFragmentOutput.d.ts +0 -1
- package/dist/src/assets/shader/core/struct/ColorPassFragmentOutput.js +0 -16
- package/dist/src/assets/shader/core/struct/FragmentOutput.d.ts +0 -1
- package/dist/src/assets/shader/core/struct/FragmentOutput.js +0 -18
- package/dist/src/assets/shader/core/struct/FragmentVarying.d.ts +0 -1
- package/dist/src/assets/shader/core/struct/FragmentVarying.js +0 -23
- package/dist/src/assets/shader/core/struct/ShadingInput.d.ts +0 -1
- package/dist/src/assets/shader/core/struct/ShadingInput.js +0 -21
- package/dist/src/assets/shader/core/struct/VertexAttributeIndexShader.d.ts +0 -1
- package/dist/src/assets/shader/core/struct/VertexAttributeIndexShader.js +0 -100
- package/dist/src/assets/shader/core/struct/VertexAttributes.d.ts +0 -1
- package/dist/src/assets/shader/core/struct/VertexAttributes.js +0 -160
- package/dist/src/assets/shader/env/ReflectionCG.d.ts +0 -1
- package/dist/src/assets/shader/env/ReflectionCG.js +0 -86
- package/dist/src/assets/shader/glsl/Quad_glsl.d.ts +0 -2
- package/dist/src/assets/shader/glsl/Quad_glsl.js +0 -55
- package/dist/src/assets/shader/lighting/BRDF_frag.d.ts +0 -4
- package/dist/src/assets/shader/lighting/BRDF_frag.js +0 -461
- package/dist/src/assets/shader/lighting/BsDF_frag.d.ts +0 -4
- package/dist/src/assets/shader/lighting/BsDF_frag.js +0 -139
- package/dist/src/assets/shader/lighting/BxDF_frag.d.ts +0 -4
- package/dist/src/assets/shader/lighting/BxDF_frag.js +0 -210
- package/dist/src/assets/shader/lighting/Hair_frag.d.ts +0 -1
- package/dist/src/assets/shader/lighting/Hair_frag.js +0 -277
- package/dist/src/assets/shader/lighting/IESProfiles_frag.d.ts +0 -1
- package/dist/src/assets/shader/lighting/IESProfiles_frag.js +0 -33
- package/dist/src/assets/shader/lighting/IrradianceVolumeData_frag.d.ts +0 -1
- package/dist/src/assets/shader/lighting/IrradianceVolumeData_frag.js +0 -40
- package/dist/src/assets/shader/lighting/Irradiance_frag.d.ts +0 -4
- package/dist/src/assets/shader/lighting/Irradiance_frag.js +0 -270
- package/dist/src/assets/shader/lighting/LightingFunction_frag.d.ts +0 -1
- package/dist/src/assets/shader/lighting/LightingFunction_frag.js +0 -203
- package/dist/src/assets/shader/lighting/UnLit_frag.d.ts +0 -1
- package/dist/src/assets/shader/lighting/UnLit_frag.js +0 -30
- package/dist/src/assets/shader/materials/ColorLitShader.d.ts +0 -1
- package/dist/src/assets/shader/materials/ColorLitShader.js +0 -22
- package/dist/src/assets/shader/materials/GIProbeShader.d.ts +0 -1
- package/dist/src/assets/shader/materials/GIProbeShader.js +0 -34
- package/dist/src/assets/shader/materials/GlassShader.d.ts +0 -1
- package/dist/src/assets/shader/materials/GlassShader.js +0 -26
- package/dist/src/assets/shader/materials/Hair_shader.d.ts +0 -2
- package/dist/src/assets/shader/materials/Hair_shader.js +0 -210
- package/dist/src/assets/shader/materials/Lambert_shader.d.ts +0 -1
- package/dist/src/assets/shader/materials/Lambert_shader.js +0 -56
- package/dist/src/assets/shader/materials/Lit_shader.d.ts +0 -1
- package/dist/src/assets/shader/materials/Lit_shader.js +0 -21
- package/dist/src/assets/shader/materials/OutlinePass.d.ts +0 -1
- package/dist/src/assets/shader/materials/OutlinePass.js +0 -73
- package/dist/src/assets/shader/materials/PBRLItShader.d.ts +0 -4
- package/dist/src/assets/shader/materials/PBRLItShader.js +0 -155
- package/dist/src/assets/shader/materials/PBRLitSSSShader.d.ts +0 -4
- package/dist/src/assets/shader/materials/PBRLitSSSShader.js +0 -192
- package/dist/src/assets/shader/materials/ReflectionShader_shader.d.ts +0 -1
- package/dist/src/assets/shader/materials/ReflectionShader_shader.js +0 -63
- package/dist/src/assets/shader/materials/UnLit.d.ts +0 -4
- package/dist/src/assets/shader/materials/UnLit.js +0 -41
- package/dist/src/assets/shader/materials/UnLitTextureArray.d.ts +0 -1
- package/dist/src/assets/shader/materials/UnLitTextureArray.js +0 -100
- package/dist/src/assets/shader/materials/program/BxdfDebug_frag.d.ts +0 -4
- package/dist/src/assets/shader/materials/program/BxdfDebug_frag.js +0 -180
- package/dist/src/assets/shader/materials/program/Clearcoat_frag.d.ts +0 -1
- package/dist/src/assets/shader/materials/program/Clearcoat_frag.js +0 -38
- package/dist/src/assets/shader/materials/program/ClusterDebug_frag.d.ts +0 -1
- package/dist/src/assets/shader/materials/program/ClusterDebug_frag.js +0 -40
- package/dist/src/assets/shader/materials/program/NormalMap_frag.d.ts +0 -4
- package/dist/src/assets/shader/materials/program/NormalMap_frag.js +0 -65
- package/dist/src/assets/shader/materials/program/ShadowMapping_frag.d.ts +0 -1
- package/dist/src/assets/shader/materials/program/ShadowMapping_frag.js +0 -210
- package/dist/src/assets/shader/materials/uniforms/PhysicMaterialUniform_frag.d.ts +0 -1
- package/dist/src/assets/shader/materials/uniforms/PhysicMaterialUniform_frag.js +0 -37
- package/dist/src/assets/shader/materials/uniforms/UnLitMaterialUniform_frag.d.ts +0 -1
- package/dist/src/assets/shader/materials/uniforms/UnLitMaterialUniform_frag.js +0 -14
- package/dist/src/assets/shader/materials/uniforms/VideoUniform_frag.d.ts +0 -1
- package/dist/src/assets/shader/materials/uniforms/VideoUniform_frag.js +0 -12
- package/dist/src/assets/shader/math/FastMathShader.d.ts +0 -1
- package/dist/src/assets/shader/math/FastMathShader.js +0 -91
- package/dist/src/assets/shader/math/MathShader.d.ts +0 -4
- package/dist/src/assets/shader/math/MathShader.js +0 -558
- package/dist/src/assets/shader/math/MatrixShader.d.ts +0 -1
- package/dist/src/assets/shader/math/MatrixShader.js +0 -104
- package/dist/src/assets/shader/post/FXAAShader.d.ts +0 -1
- package/dist/src/assets/shader/post/FXAAShader.js +0 -79
- package/dist/src/assets/shader/post/GlobalFog_shader.d.ts +0 -4
- package/dist/src/assets/shader/post/GlobalFog_shader.js +0 -191
- package/dist/src/assets/shader/quad/Quad_shader.d.ts +0 -24
- package/dist/src/assets/shader/quad/Quad_shader.js +0 -210
- package/dist/src/assets/shader/sky/AtmosphericScatteringSky_shader.d.ts +0 -6
- package/dist/src/assets/shader/sky/AtmosphericScatteringSky_shader.js +0 -312
- package/dist/src/assets/shader/sky/CubeSky_Shader.d.ts +0 -7
- package/dist/src/assets/shader/sky/CubeSky_Shader.js +0 -122
- package/dist/src/assets/shader/utils/BitUtil.d.ts +0 -1
- package/dist/src/assets/shader/utils/BitUtil.js +0 -108
- package/dist/src/assets/shader/utils/ColorUtil.d.ts +0 -1
- package/dist/src/assets/shader/utils/ColorUtil.js +0 -144
- package/dist/src/assets/shader/utils/GenerayRandomDir.d.ts +0 -1
- package/dist/src/assets/shader/utils/GenerayRandomDir.js +0 -22
- package/dist/src/components/AtmosphericComponent.d.ts +0 -28
- package/dist/src/components/AtmosphericComponent.js +0 -141
- package/dist/src/components/BillboardComponent.d.ts +0 -13
- package/dist/src/components/BillboardComponent.js +0 -30
- package/dist/src/components/ColliderComponent.d.ts +0 -15
- package/dist/src/components/ColliderComponent.js +0 -39
- package/dist/src/components/ComponentBase.d.ts +0 -43
- package/dist/src/components/ComponentBase.js +0 -141
- package/dist/src/components/IComponent.d.ts +0 -27
- package/dist/src/components/IComponent.js +0 -1
- package/dist/src/components/SkeletonAnimationComponent.d.ts +0 -52
- package/dist/src/components/SkeletonAnimationComponent.js +0 -225
- package/dist/src/components/Transform.d.ts +0 -119
- package/dist/src/components/Transform.js +0 -523
- package/dist/src/components/anim/AnimatorComponent.d.ts +0 -67
- package/dist/src/components/anim/AnimatorComponent.js +0 -411
- package/dist/src/components/anim/OAnimationEvent.d.ts +0 -6
- package/dist/src/components/anim/OAnimationEvent.js +0 -8
- package/dist/src/components/anim/curveAnim/AnimationMonitor.d.ts +0 -29
- package/dist/src/components/anim/curveAnim/AnimationMonitor.js +0 -159
- package/dist/src/components/anim/curveAnim/AttributeAnimCurve.d.ts +0 -8
- package/dist/src/components/anim/curveAnim/AttributeAnimCurve.js +0 -15
- package/dist/src/components/anim/curveAnim/PropertyAnimClip.d.ts +0 -29
- package/dist/src/components/anim/curveAnim/PropertyAnimClip.js +0 -54
- package/dist/src/components/anim/curveAnim/PropertyAnimation.d.ts +0 -31
- package/dist/src/components/anim/curveAnim/PropertyAnimation.js +0 -107
- package/dist/src/components/anim/curveAnim/PropertyAnimationEvent.d.ts +0 -14
- package/dist/src/components/anim/curveAnim/PropertyAnimationEvent.js +0 -11
- package/dist/src/components/anim/curveAnim/PropertyHelp.d.ts +0 -13
- package/dist/src/components/anim/curveAnim/PropertyHelp.js +0 -96
- package/dist/src/components/anim/morphAnim/MorphTargetBlender.d.ts +0 -18
- package/dist/src/components/anim/morphAnim/MorphTargetBlender.js +0 -81
- package/dist/src/components/anim/morphAnim/MorphTargetData.d.ts +0 -52
- package/dist/src/components/anim/morphAnim/MorphTargetData.js +0 -183
- package/dist/src/components/anim/morphAnim/MorphTargetFrame.d.ts +0 -68
- package/dist/src/components/anim/morphAnim/MorphTargetFrame.js +0 -4
- package/dist/src/components/anim/morphAnim/MorphTargetKey.d.ts +0 -58
- package/dist/src/components/anim/morphAnim/MorphTargetKey.js +0 -55
- package/dist/src/components/anim/morphAnim/MorphTarget_shader.d.ts +0 -8
- package/dist/src/components/anim/morphAnim/MorphTarget_shader.js +0 -101
- package/dist/src/components/anim/skeletonAnim/Joint.d.ts +0 -12
- package/dist/src/components/anim/skeletonAnim/Joint.js +0 -14
- package/dist/src/components/anim/skeletonAnim/JointPose.d.ts +0 -6
- package/dist/src/components/anim/skeletonAnim/JointPose.js +0 -7
- package/dist/src/components/anim/skeletonAnim/Skeleton.d.ts +0 -10
- package/dist/src/components/anim/skeletonAnim/Skeleton.js +0 -26
- package/dist/src/components/anim/skeletonAnim/SkeletonAnimationClip.d.ts +0 -22
- package/dist/src/components/anim/skeletonAnim/SkeletonAnimationClip.js +0 -70
- package/dist/src/components/anim/skeletonAnim/SkeletonAnimationClipState.d.ts +0 -21
- package/dist/src/components/anim/skeletonAnim/SkeletonAnimationClipState.js +0 -80
- package/dist/src/components/anim/skeletonAnim/SkeletonAnimationCompute.d.ts +0 -6
- package/dist/src/components/anim/skeletonAnim/SkeletonAnimationCompute.js +0 -27
- package/dist/src/components/anim/skeletonAnim/SkeletonPose.d.ts +0 -16
- package/dist/src/components/anim/skeletonAnim/SkeletonPose.js +0 -79
- package/dist/src/components/anim/skeletonAnim/buffer/SkeletonBlendComputeArgs.d.ts +0 -23
- package/dist/src/components/anim/skeletonAnim/buffer/SkeletonBlendComputeArgs.js +0 -61
- package/dist/src/components/anim/skeletonAnim/buffer/SkeletonTransformComputeArgs.d.ts +0 -23
- package/dist/src/components/anim/skeletonAnim/buffer/SkeletonTransformComputeArgs.js +0 -59
- package/dist/src/components/controller/CameraControllerBase.d.ts +0 -17
- package/dist/src/components/controller/CameraControllerBase.js +0 -33
- package/dist/src/components/controller/FirstPersonCameraController.d.ts +0 -15
- package/dist/src/components/controller/FirstPersonCameraController.js +0 -52
- package/dist/src/components/controller/FlyCameraController.d.ts +0 -36
- package/dist/src/components/controller/FlyCameraController.js +0 -180
- package/dist/src/components/controller/HoverCameraController.d.ts +0 -52
- package/dist/src/components/controller/HoverCameraController.js +0 -183
- package/dist/src/components/controller/OrbitController.d.ts +0 -170
- package/dist/src/components/controller/OrbitController.js +0 -339
- package/dist/src/components/controller/ThirdPersonCameraController.d.ts +0 -16
- package/dist/src/components/controller/ThirdPersonCameraController.js +0 -51
- package/dist/src/components/gui/GUIConfig.d.ts +0 -23
- package/dist/src/components/gui/GUIConfig.js +0 -26
- package/dist/src/components/gui/GUIExtension.d.ts +0 -5
- package/dist/src/components/gui/GUIExtension.js +0 -61
- package/dist/src/components/gui/GUIPick.d.ts +0 -36
- package/dist/src/components/gui/GUIPick.js +0 -178
- package/dist/src/components/gui/GUIPickHelper.d.ts +0 -25
- package/dist/src/components/gui/GUIPickHelper.js +0 -119
- package/dist/src/components/gui/core/GUIAtlasTexture.d.ts +0 -16
- package/dist/src/components/gui/core/GUIAtlasTexture.js +0 -22
- package/dist/src/components/gui/core/GUICanvas.d.ts +0 -21
- package/dist/src/components/gui/core/GUICanvas.js +0 -35
- package/dist/src/components/gui/core/GUIDefine.d.ts +0 -7
- package/dist/src/components/gui/core/GUIDefine.js +0 -8
- package/dist/src/components/gui/core/GUIGeometry.d.ts +0 -36
- package/dist/src/components/gui/core/GUIGeometry.js +0 -215
- package/dist/src/components/gui/core/GUIGeometryRebuild.d.ts +0 -21
- package/dist/src/components/gui/core/GUIGeometryRebuild.js +0 -105
- package/dist/src/components/gui/core/GUIMaterial.d.ts +0 -29
- package/dist/src/components/gui/core/GUIMaterial.js +0 -111
- package/dist/src/components/gui/core/GUIQuad.d.ts +0 -52
- package/dist/src/components/gui/core/GUIQuad.js +0 -154
- package/dist/src/components/gui/core/GUIRenderer.d.ts +0 -15
- package/dist/src/components/gui/core/GUIRenderer.js +0 -42
- package/dist/src/components/gui/core/GUIShader.d.ts +0 -8
- package/dist/src/components/gui/core/GUIShader.js +0 -267
- package/dist/src/components/gui/core/GUISprite.d.ts +0 -19
- package/dist/src/components/gui/core/GUISprite.js +0 -19
- package/dist/src/components/gui/core/GUITexture.d.ts +0 -12
- package/dist/src/components/gui/core/GUITexture.js +0 -25
- package/dist/src/components/gui/uiComponents/IUIInteractive.d.ts +0 -25
- package/dist/src/components/gui/uiComponents/IUIInteractive.js +0 -7
- package/dist/src/components/gui/uiComponents/TextFieldLayout.d.ts +0 -34
- package/dist/src/components/gui/uiComponents/TextFieldLayout.js +0 -265
- package/dist/src/components/gui/uiComponents/UIButton.d.ts +0 -45
- package/dist/src/components/gui/uiComponents/UIButton.js +0 -140
- package/dist/src/components/gui/uiComponents/UIComponentBase.d.ts +0 -15
- package/dist/src/components/gui/uiComponents/UIComponentBase.js +0 -33
- package/dist/src/components/gui/uiComponents/UIImage.d.ts +0 -21
- package/dist/src/components/gui/uiComponents/UIImage.js +0 -72
- package/dist/src/components/gui/uiComponents/UIImageGroup.d.ts +0 -31
- package/dist/src/components/gui/uiComponents/UIImageGroup.js +0 -87
- package/dist/src/components/gui/uiComponents/UIInteractive.d.ts +0 -25
- package/dist/src/components/gui/uiComponents/UIInteractive.js +0 -50
- package/dist/src/components/gui/uiComponents/UIPanel.d.ts +0 -38
- package/dist/src/components/gui/uiComponents/UIPanel.js +0 -173
- package/dist/src/components/gui/uiComponents/UIRenderAble.d.ts +0 -27
- package/dist/src/components/gui/uiComponents/UIRenderAble.js +0 -106
- package/dist/src/components/gui/uiComponents/UIShadow.d.ts +0 -31
- package/dist/src/components/gui/uiComponents/UIShadow.js +0 -117
- package/dist/src/components/gui/uiComponents/UITextField.d.ts +0 -36
- package/dist/src/components/gui/uiComponents/UITextField.js +0 -122
- package/dist/src/components/gui/uiComponents/UITransform.d.ts +0 -60
- package/dist/src/components/gui/uiComponents/UITransform.js +0 -243
- package/dist/src/components/gui/uiComponents/ViewPanel.d.ts +0 -9
- package/dist/src/components/gui/uiComponents/ViewPanel.js +0 -13
- package/dist/src/components/gui/uiComponents/WorldPanel.d.ts +0 -13
- package/dist/src/components/gui/uiComponents/WorldPanel.js +0 -34
- package/dist/src/components/lights/DirectLight.d.ts +0 -13
- package/dist/src/components/lights/DirectLight.js +0 -52
- package/dist/src/components/lights/GILighting.d.ts +0 -6
- package/dist/src/components/lights/GILighting.js +0 -15
- package/dist/src/components/lights/IESProfiles.d.ts +0 -14
- package/dist/src/components/lights/IESProfiles.js +0 -33
- package/dist/src/components/lights/ILight.d.ts +0 -12
- package/dist/src/components/lights/ILight.js +0 -1
- package/dist/src/components/lights/Light.d.ts +0 -32
- package/dist/src/components/lights/Light.js +0 -90
- package/dist/src/components/lights/LightBase.d.ts +0 -127
- package/dist/src/components/lights/LightBase.js +0 -238
- package/dist/src/components/lights/LightData.d.ts +0 -29
- package/dist/src/components/lights/LightData.js +0 -33
- package/dist/src/components/lights/PointLight.d.ts +0 -19
- package/dist/src/components/lights/PointLight.js +0 -67
- package/dist/src/components/lights/SpotLight.d.ts +0 -21
- package/dist/src/components/lights/SpotLight.js +0 -79
- package/dist/src/components/post/PostProcessingComponent.d.ts +0 -16
- package/dist/src/components/post/PostProcessingComponent.js +0 -52
- package/dist/src/components/renderer/GlobalIlluminationComponent.d.ts +0 -22
- package/dist/src/components/renderer/GlobalIlluminationComponent.js +0 -118
- package/dist/src/components/renderer/InstanceDrawComponent.d.ts +0 -19
- package/dist/src/components/renderer/InstanceDrawComponent.js +0 -120
- package/dist/src/components/renderer/MeshFilter.d.ts +0 -9
- package/dist/src/components/renderer/MeshFilter.js +0 -37
- package/dist/src/components/renderer/MeshRenderer.d.ts +0 -51
- package/dist/src/components/renderer/MeshRenderer.js +0 -156
- package/dist/src/components/renderer/Reflection.d.ts +0 -15
- package/dist/src/components/renderer/Reflection.js +0 -33
- package/dist/src/components/renderer/RenderNode.d.ts +0 -85
- package/dist/src/components/renderer/RenderNode.js +0 -518
- package/dist/src/components/renderer/SkinnedMeshRenderer.d.ts +0 -26
- package/dist/src/components/renderer/SkinnedMeshRenderer.js +0 -111
- package/dist/src/components/renderer/SkinnedMeshRenderer2.d.ts +0 -37
- package/dist/src/components/renderer/SkinnedMeshRenderer2.js +0 -138
- package/dist/src/components/renderer/SkyRenderer.d.ts +0 -36
- package/dist/src/components/renderer/SkyRenderer.js +0 -94
- package/dist/src/components/renderer/SphereReflection.d.ts +0 -12
- package/dist/src/components/renderer/SphereReflection.js +0 -45
- package/dist/src/components/shape/BoxColliderShape.d.ts +0 -9
- package/dist/src/components/shape/BoxColliderShape.js +0 -28
- package/dist/src/components/shape/CapsuleColliderShape.d.ts +0 -6
- package/dist/src/components/shape/CapsuleColliderShape.js +0 -9
- package/dist/src/components/shape/ColliderShape.d.ts +0 -35
- package/dist/src/components/shape/ColliderShape.js +0 -49
- package/dist/src/components/shape/MeshColliderShape.d.ts +0 -8
- package/dist/src/components/shape/MeshColliderShape.js +0 -55
- package/dist/src/components/shape/SphereColliderShape.d.ts +0 -26
- package/dist/src/components/shape/SphereColliderShape.js +0 -47
- package/dist/src/core/Camera3D.d.ts +0 -308
- package/dist/src/core/Camera3D.js +0 -534
- package/dist/src/core/CameraType.d.ts +0 -5
- package/dist/src/core/CameraType.js +0 -6
- package/dist/src/core/CubeCamera.d.ts +0 -18
- package/dist/src/core/CubeCamera.js +0 -67
- package/dist/src/core/PointShadowCubeCamera.d.ts +0 -13
- package/dist/src/core/PointShadowCubeCamera.js +0 -59
- package/dist/src/core/Scene3D.d.ts +0 -66
- package/dist/src/core/Scene3D.js +0 -88
- package/dist/src/core/View3D.d.ts +0 -85
- package/dist/src/core/View3D.js +0 -113
- package/dist/src/core/ViewQuad.d.ts +0 -19
- package/dist/src/core/ViewQuad.js +0 -84
- package/dist/src/core/bound/BoundingBox.d.ts +0 -34
- package/dist/src/core/bound/BoundingBox.js +0 -155
- package/dist/src/core/bound/BoundingSphere.d.ts +0 -34
- package/dist/src/core/bound/BoundingSphere.js +0 -71
- package/dist/src/core/bound/Frustum.d.ts +0 -17
- package/dist/src/core/bound/Frustum.js +0 -184
- package/dist/src/core/bound/IBound.d.ts +0 -19
- package/dist/src/core/bound/IBound.js +0 -1
- package/dist/src/core/csm/CSM.d.ts +0 -3
- package/dist/src/core/csm/CSM.js +0 -3
- package/dist/src/core/csm/FrustumCSM.d.ts +0 -32
- package/dist/src/core/csm/FrustumCSM.js +0 -106
- package/dist/src/core/entities/Entity.d.ts +0 -43
- package/dist/src/core/entities/Entity.js +0 -200
- package/dist/src/core/entities/InstancedMesh.d.ts +0 -11
- package/dist/src/core/entities/InstancedMesh.js +0 -32
- package/dist/src/core/entities/Object3D.d.ts +0 -66
- package/dist/src/core/entities/Object3D.js +0 -284
- package/dist/src/core/geometry/ExtrudeGeometry.d.ts +0 -31
- package/dist/src/core/geometry/ExtrudeGeometry.js +0 -156
- package/dist/src/core/geometry/GeometryBase.d.ts +0 -70
- package/dist/src/core/geometry/GeometryBase.js +0 -248
- package/dist/src/core/geometry/GeometryIndicesBuffer.d.ts +0 -15
- package/dist/src/core/geometry/GeometryIndicesBuffer.js +0 -33
- package/dist/src/core/geometry/GeometryVertexBuffer.d.ts +0 -23
- package/dist/src/core/geometry/GeometryVertexBuffer.js +0 -243
- package/dist/src/core/geometry/GeometryVertexType.d.ts +0 -5
- package/dist/src/core/geometry/GeometryVertexType.js +0 -6
- package/dist/src/core/geometry/VertexAttribute.d.ts +0 -15
- package/dist/src/core/geometry/VertexAttribute.js +0 -4
- package/dist/src/core/geometry/VertexAttributeData.d.ts +0 -5
- package/dist/src/core/geometry/VertexAttributeData.js +0 -1
- package/dist/src/core/geometry/VertexAttributeName.d.ts +0 -23
- package/dist/src/core/geometry/VertexAttributeName.js +0 -24
- package/dist/src/core/geometry/VertexAttributeSize.d.ts +0 -11
- package/dist/src/core/geometry/VertexAttributeSize.js +0 -12
- package/dist/src/core/geometry/VertexAttributeStride.d.ts +0 -15
- package/dist/src/core/geometry/VertexAttributeStride.js +0 -16
- package/dist/src/core/geometry/VertexFormat.d.ts +0 -1
- package/dist/src/core/geometry/VertexFormat.js +0 -8
- package/dist/src/core/pool/ObjectPool.d.ts +0 -11
- package/dist/src/core/pool/ObjectPool.js +0 -33
- package/dist/src/core/pool/memory/MemoryDO.d.ts +0 -14
- package/dist/src/core/pool/memory/MemoryDO.js +0 -48
- package/dist/src/core/pool/memory/MemoryInfo.d.ts +0 -83
- package/dist/src/core/pool/memory/MemoryInfo.js +0 -316
- package/dist/src/core/tree/kdTree/IKDTreeUserData.d.ts +0 -10
- package/dist/src/core/tree/kdTree/IKDTreeUserData.js +0 -9
- package/dist/src/core/tree/kdTree/KDTreeEntity.d.ts +0 -27
- package/dist/src/core/tree/kdTree/KDTreeEntity.js +0 -48
- package/dist/src/core/tree/kdTree/KDTreeNode.d.ts +0 -68
- package/dist/src/core/tree/kdTree/KDTreeNode.js +0 -257
- package/dist/src/core/tree/kdTree/KDTreeSpace.d.ts +0 -26
- package/dist/src/core/tree/kdTree/KDTreeSpace.js +0 -66
- package/dist/src/core/tree/octree/Octree.d.ts +0 -28
- package/dist/src/core/tree/octree/Octree.js +0 -133
- package/dist/src/core/tree/octree/OctreeEntity.d.ts +0 -11
- package/dist/src/core/tree/octree/OctreeEntity.js +0 -25
- package/dist/src/core/tree/quad/IQuadNode.d.ts +0 -9
- package/dist/src/core/tree/quad/IQuadNode.js +0 -1
- package/dist/src/core/tree/quad/QuadAABB.d.ts +0 -26
- package/dist/src/core/tree/quad/QuadAABB.js +0 -116
- package/dist/src/core/tree/quad/QuadRoot.d.ts +0 -14
- package/dist/src/core/tree/quad/QuadRoot.js +0 -67
- package/dist/src/core/tree/quad/QuadTree.d.ts +0 -22
- package/dist/src/core/tree/quad/QuadTree.js +0 -250
- package/dist/src/core/tree/quad/QuadTreeCell.d.ts +0 -23
- package/dist/src/core/tree/quad/QuadTreeCell.js +0 -36
- package/dist/src/event/CEvent.d.ts +0 -27
- package/dist/src/event/CEvent.js +0 -19
- package/dist/src/event/CEventDispatcher.d.ts +0 -13
- package/dist/src/event/CEventDispatcher.js +0 -129
- package/dist/src/event/CEventListener.d.ts +0 -13
- package/dist/src/event/CEventListener.js +0 -26
- package/dist/src/event/CResizeEvent.d.ts +0 -4
- package/dist/src/event/CResizeEvent.js +0 -4
- package/dist/src/event/KeyCode.d.ts +0 -110
- package/dist/src/event/KeyCode.js +0 -111
- package/dist/src/event/MouseCode.d.ts +0 -5
- package/dist/src/event/MouseCode.js +0 -6
- package/dist/src/event/eventConst/KeyEvent.d.ts +0 -6
- package/dist/src/event/eventConst/KeyEvent.js +0 -9
- package/dist/src/event/eventConst/LoaderEvent.d.ts +0 -5
- package/dist/src/event/eventConst/LoaderEvent.js +0 -5
- package/dist/src/event/eventConst/Object3DEvent.d.ts +0 -7
- package/dist/src/event/eventConst/Object3DEvent.js +0 -7
- package/dist/src/event/eventConst/PointerEvent3D.d.ts +0 -63
- package/dist/src/event/eventConst/PointerEvent3D.js +0 -54
- package/dist/src/event/eventConst/UIEvent.d.ts +0 -6
- package/dist/src/event/eventConst/UIEvent.js +0 -6
- package/dist/src/gfx/generate/BrdfLUTGenerate.d.ts +0 -7
- package/dist/src/gfx/generate/BrdfLUTGenerate.js +0 -20
- package/dist/src/gfx/generate/PassGenerate.d.ts +0 -9
- package/dist/src/gfx/generate/PassGenerate.js +0 -181
- package/dist/src/gfx/generate/convert/BlurEffectCreator.d.ts +0 -7
- package/dist/src/gfx/generate/convert/BlurEffectCreator.js +0 -79
- package/dist/src/gfx/generate/convert/ErpImage2CubeMap.d.ts +0 -9
- package/dist/src/gfx/generate/convert/ErpImage2CubeMap.js +0 -144
- package/dist/src/gfx/generate/convert/IBLEnvMapCreator.d.ts +0 -12
- package/dist/src/gfx/generate/convert/IBLEnvMapCreator.js +0 -109
- package/dist/src/gfx/generate/convert/MergeRGBACreator.d.ts +0 -5
- package/dist/src/gfx/generate/convert/MergeRGBACreator.js +0 -32
- package/dist/src/gfx/generate/convert/TextureCubeStdCreator.d.ts +0 -9
- package/dist/src/gfx/generate/convert/TextureCubeStdCreator.js +0 -117
- package/dist/src/gfx/generate/convert/TextureCubeUtils.d.ts +0 -12
- package/dist/src/gfx/generate/convert/TextureCubeUtils.js +0 -47
- package/dist/src/gfx/generate/convert/TextureScaleCompute.d.ts +0 -6
- package/dist/src/gfx/generate/convert/TextureScaleCompute.js +0 -18
- package/dist/src/gfx/graphics/webGpu/CanvasConfig.d.ts +0 -7
- package/dist/src/gfx/graphics/webGpu/CanvasConfig.js +0 -1
- package/dist/src/gfx/graphics/webGpu/Context3D.d.ts +0 -20
- package/dist/src/gfx/graphics/webGpu/Context3D.js +0 -112
- package/dist/src/gfx/graphics/webGpu/PipelinePool.d.ts +0 -5
- package/dist/src/gfx/graphics/webGpu/PipelinePool.js +0 -15
- package/dist/src/gfx/graphics/webGpu/WebGPUConst.d.ts +0 -154
- package/dist/src/gfx/graphics/webGpu/WebGPUConst.js +0 -154
- package/dist/src/gfx/graphics/webGpu/compute/PreIntegratedLutCompute.d.ts +0 -8
- package/dist/src/gfx/graphics/webGpu/compute/PreIntegratedLutCompute.js +0 -23
- package/dist/src/gfx/graphics/webGpu/compute/RenderShaderCompute.d.ts +0 -12
- package/dist/src/gfx/graphics/webGpu/compute/RenderShaderCompute.js +0 -19
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/GlobalBindGroup.d.ts +0 -18
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/GlobalBindGroup.js +0 -64
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/GlobalBindGroupLayout.d.ts +0 -4
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/GlobalBindGroupLayout.js +0 -29
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/GlobalUniformGroup.d.ts +0 -25
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/GlobalUniformGroup.js +0 -179
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/MatrixBindGroup.d.ts +0 -11
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/MatrixBindGroup.js +0 -22
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/groups/LightEntries.d.ts +0 -11
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/groups/LightEntries.js +0 -48
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/groups/ProbeEntries.d.ts +0 -10
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/groups/ProbeEntries.js +0 -41
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/groups/ReflectionEntries.d.ts +0 -12
- package/dist/src/gfx/graphics/webGpu/core/bindGroups/groups/ReflectionEntries.js +0 -21
- package/dist/src/gfx/graphics/webGpu/core/buffer/ArrayBufferData.d.ts +0 -1
- package/dist/src/gfx/graphics/webGpu/core/buffer/ArrayBufferData.js +0 -1
- package/dist/src/gfx/graphics/webGpu/core/buffer/ComputeGPUBuffer.d.ts +0 -4
- package/dist/src/gfx/graphics/webGpu/core/buffer/ComputeGPUBuffer.js +0 -11
- package/dist/src/gfx/graphics/webGpu/core/buffer/GPUBufferBase.d.ts +0 -84
- package/dist/src/gfx/graphics/webGpu/core/buffer/GPUBufferBase.js +0 -493
- package/dist/src/gfx/graphics/webGpu/core/buffer/GPUBufferType.d.ts +0 -9
- package/dist/src/gfx/graphics/webGpu/core/buffer/GPUBufferType.js +0 -10
- package/dist/src/gfx/graphics/webGpu/core/buffer/IndicesGPUBuffer.d.ts +0 -14
- package/dist/src/gfx/graphics/webGpu/core/buffer/IndicesGPUBuffer.js +0 -44
- package/dist/src/gfx/graphics/webGpu/core/buffer/MaterialDataUniformGPUBuffer.d.ts +0 -10
- package/dist/src/gfx/graphics/webGpu/core/buffer/MaterialDataUniformGPUBuffer.js +0 -46
- package/dist/src/gfx/graphics/webGpu/core/buffer/MatrixGPUBuffer.d.ts +0 -8
- package/dist/src/gfx/graphics/webGpu/core/buffer/MatrixGPUBuffer.js +0 -57
- package/dist/src/gfx/graphics/webGpu/core/buffer/StorageGPUBuffer.d.ts +0 -11
- package/dist/src/gfx/graphics/webGpu/core/buffer/StorageGPUBuffer.js +0 -16
- package/dist/src/gfx/graphics/webGpu/core/buffer/StructStorageGPUBuffer.d.ts +0 -7
- package/dist/src/gfx/graphics/webGpu/core/buffer/StructStorageGPUBuffer.js +0 -9
- package/dist/src/gfx/graphics/webGpu/core/buffer/UniformGPUBuffer.d.ts +0 -11
- package/dist/src/gfx/graphics/webGpu/core/buffer/UniformGPUBuffer.js +0 -17
- package/dist/src/gfx/graphics/webGpu/core/buffer/VertexGPUBuffer.d.ts +0 -7
- package/dist/src/gfx/graphics/webGpu/core/buffer/VertexGPUBuffer.js +0 -29
- package/dist/src/gfx/graphics/webGpu/core/texture/ITexture.d.ts +0 -18
- package/dist/src/gfx/graphics/webGpu/core/texture/ITexture.js +0 -1
- package/dist/src/gfx/graphics/webGpu/core/texture/Texture.d.ts +0 -79
- package/dist/src/gfx/graphics/webGpu/core/texture/Texture.js +0 -307
- package/dist/src/gfx/graphics/webGpu/core/texture/TextureCube.d.ts +0 -11
- package/dist/src/gfx/graphics/webGpu/core/texture/TextureCube.js +0 -51
- package/dist/src/gfx/graphics/webGpu/core/texture/TextureMipmapCompute.d.ts +0 -9
- package/dist/src/gfx/graphics/webGpu/core/texture/TextureMipmapCompute.js +0 -134
- package/dist/src/gfx/graphics/webGpu/core/texture/TextureMipmapGenerator.d.ts +0 -9
- package/dist/src/gfx/graphics/webGpu/core/texture/TextureMipmapGenerator.js +0 -163
- package/dist/src/gfx/graphics/webGpu/core/uniforms/UniformNode.d.ts +0 -34
- package/dist/src/gfx/graphics/webGpu/core/uniforms/UniformNode.js +0 -176
- package/dist/src/gfx/graphics/webGpu/descriptor/RTDescriptor.d.ts +0 -5
- package/dist/src/gfx/graphics/webGpu/descriptor/RTDescriptor.js +0 -7
- package/dist/src/gfx/graphics/webGpu/descriptor/WebGPUDescriptorCreator.d.ts +0 -8
- package/dist/src/gfx/graphics/webGpu/descriptor/WebGPUDescriptorCreator.js +0 -174
- package/dist/src/gfx/graphics/webGpu/shader/ComputeShader.d.ts +0 -28
- package/dist/src/gfx/graphics/webGpu/shader/ComputeShader.js +0 -219
- package/dist/src/gfx/graphics/webGpu/shader/RenderShaderPass.d.ts +0 -206
- package/dist/src/gfx/graphics/webGpu/shader/RenderShaderPass.js +0 -888
- package/dist/src/gfx/graphics/webGpu/shader/Shader.d.ts +0 -53
- package/dist/src/gfx/graphics/webGpu/shader/Shader.js +0 -205
- package/dist/src/gfx/graphics/webGpu/shader/ShaderPassBase.d.ts +0 -60
- package/dist/src/gfx/graphics/webGpu/shader/ShaderPassBase.js +0 -150
- package/dist/src/gfx/graphics/webGpu/shader/ShaderStage.d.ts +0 -5
- package/dist/src/gfx/graphics/webGpu/shader/ShaderStage.js +0 -6
- package/dist/src/gfx/graphics/webGpu/shader/converter/GLSLLexer.d.ts +0 -16
- package/dist/src/gfx/graphics/webGpu/shader/converter/GLSLLexer.js +0 -422
- package/dist/src/gfx/graphics/webGpu/shader/converter/GLSLLexerToken.d.ts +0 -174
- package/dist/src/gfx/graphics/webGpu/shader/converter/GLSLLexerToken.js +0 -388
- package/dist/src/gfx/graphics/webGpu/shader/converter/GLSLPreprocessor.d.ts +0 -10
- package/dist/src/gfx/graphics/webGpu/shader/converter/GLSLPreprocessor.js +0 -198
- package/dist/src/gfx/graphics/webGpu/shader/converter/GLSLSyntax.d.ts +0 -14
- package/dist/src/gfx/graphics/webGpu/shader/converter/GLSLSyntax.js +0 -106
- package/dist/src/gfx/graphics/webGpu/shader/converter/Reader.d.ts +0 -30
- package/dist/src/gfx/graphics/webGpu/shader/converter/Reader.js +0 -136
- package/dist/src/gfx/graphics/webGpu/shader/converter/ShaderConverter.d.ts +0 -47
- package/dist/src/gfx/graphics/webGpu/shader/converter/ShaderConverter.js +0 -69
- package/dist/src/gfx/graphics/webGpu/shader/converter/StatementNode.d.ts +0 -309
- package/dist/src/gfx/graphics/webGpu/shader/converter/StatementNode.js +0 -1804
- package/dist/src/gfx/graphics/webGpu/shader/converter/WGSLTranslator.d.ts +0 -50
- package/dist/src/gfx/graphics/webGpu/shader/converter/WGSLTranslator.js +0 -272
- package/dist/src/gfx/graphics/webGpu/shader/util/MorePassParser.d.ts +0 -25
- package/dist/src/gfx/graphics/webGpu/shader/util/MorePassParser.js +0 -134
- package/dist/src/gfx/graphics/webGpu/shader/util/Preprocessor.d.ts +0 -28
- package/dist/src/gfx/graphics/webGpu/shader/util/Preprocessor.js +0 -304
- package/dist/src/gfx/graphics/webGpu/shader/util/ShaderUtil.d.ts +0 -23
- package/dist/src/gfx/graphics/webGpu/shader/util/ShaderUtil.js +0 -6
- package/dist/src/gfx/graphics/webGpu/shader/value/ConstValue.d.ts +0 -1
- package/dist/src/gfx/graphics/webGpu/shader/value/ConstValue.js +0 -1
- package/dist/src/gfx/graphics/webGpu/shader/value/DefineValue.d.ts +0 -4
- package/dist/src/gfx/graphics/webGpu/shader/value/DefineValue.js +0 -1
- package/dist/src/gfx/graphics/webGpu/shader/value/ShaderReflectionInfo.d.ts +0 -57
- package/dist/src/gfx/graphics/webGpu/shader/value/ShaderReflectionInfo.js +0 -421
- package/dist/src/gfx/graphics/webGpu/shader/value/ShaderState.d.ts +0 -30
- package/dist/src/gfx/graphics/webGpu/shader/value/ShaderState.js +0 -113
- package/dist/src/gfx/graphics/webGpu/shader/value/ShaderValue.d.ts +0 -32
- package/dist/src/gfx/graphics/webGpu/shader/value/ShaderValue.js +0 -1
- package/dist/src/gfx/graphics/webGpu/shader/value/UniformValue.d.ts +0 -13
- package/dist/src/gfx/graphics/webGpu/shader/value/UniformValue.js +0 -9
- package/dist/src/gfx/renderJob/GPUContext.d.ts +0 -32
- package/dist/src/gfx/renderJob/GPUContext.js +0 -152
- package/dist/src/gfx/renderJob/collect/CollectInfo.d.ts +0 -7
- package/dist/src/gfx/renderJob/collect/CollectInfo.js +0 -10
- package/dist/src/gfx/renderJob/collect/ComponentCollect.d.ts +0 -29
- package/dist/src/gfx/renderJob/collect/ComponentCollect.js +0 -134
- package/dist/src/gfx/renderJob/collect/EntityBatchCollect.d.ts +0 -7
- package/dist/src/gfx/renderJob/collect/EntityBatchCollect.js +0 -24
- package/dist/src/gfx/renderJob/collect/EntityCollect.d.ts +0 -48
- package/dist/src/gfx/renderJob/collect/EntityCollect.js +0 -260
- package/dist/src/gfx/renderJob/collect/RenderGroup.d.ts +0 -7
- package/dist/src/gfx/renderJob/collect/RenderGroup.js +0 -1
- package/dist/src/gfx/renderJob/collect/RenderShaderCollect.d.ts +0 -9
- package/dist/src/gfx/renderJob/collect/RenderShaderCollect.js +0 -51
- package/dist/src/gfx/renderJob/collect/ShadowLightsCollect.d.ts +0 -20
- package/dist/src/gfx/renderJob/collect/ShadowLightsCollect.js +0 -182
- package/dist/src/gfx/renderJob/config/RTResourceConfig.d.ts +0 -10
- package/dist/src/gfx/renderJob/config/RTResourceConfig.js +0 -10
- package/dist/src/gfx/renderJob/config/RenderLayer.d.ts +0 -11
- package/dist/src/gfx/renderJob/config/RenderLayer.js +0 -20
- package/dist/src/gfx/renderJob/frame/GBufferFrame.d.ts +0 -19
- package/dist/src/gfx/renderJob/frame/GBufferFrame.js +0 -74
- package/dist/src/gfx/renderJob/frame/ProbeGBufferFrame.d.ts +0 -5
- package/dist/src/gfx/renderJob/frame/ProbeGBufferFrame.js +0 -37
- package/dist/src/gfx/renderJob/frame/RTFrame.d.ts +0 -17
- package/dist/src/gfx/renderJob/frame/RTFrame.js +0 -34
- package/dist/src/gfx/renderJob/frame/RTResourceMap.d.ts +0 -13
- package/dist/src/gfx/renderJob/frame/RTResourceMap.js +0 -71
- package/dist/src/gfx/renderJob/jobs/ForwardRenderJob.d.ts +0 -7
- package/dist/src/gfx/renderJob/jobs/ForwardRenderJob.js +0 -45
- package/dist/src/gfx/renderJob/jobs/RenderMap.d.ts +0 -12
- package/dist/src/gfx/renderJob/jobs/RenderMap.js +0 -29
- package/dist/src/gfx/renderJob/jobs/RendererJob.d.ts +0 -43
- package/dist/src/gfx/renderJob/jobs/RendererJob.js +0 -123
- package/dist/src/gfx/renderJob/occlusion/OcclusionSystem.d.ts +0 -16
- package/dist/src/gfx/renderJob/occlusion/OcclusionSystem.js +0 -30
- package/dist/src/gfx/renderJob/passRenderer/RenderContext.d.ts +0 -20
- package/dist/src/gfx/renderJob/passRenderer/RenderContext.js +0 -68
- package/dist/src/gfx/renderJob/passRenderer/RendererBase.d.ts +0 -40
- package/dist/src/gfx/renderJob/passRenderer/RendererBase.js +0 -155
- package/dist/src/gfx/renderJob/passRenderer/cluster/ClusterConfig.d.ts +0 -5
- package/dist/src/gfx/renderJob/passRenderer/cluster/ClusterConfig.js +0 -5
- package/dist/src/gfx/renderJob/passRenderer/cluster/ClusterLightingBuffer.d.ts +0 -10
- package/dist/src/gfx/renderJob/passRenderer/cluster/ClusterLightingBuffer.js +0 -29
- package/dist/src/gfx/renderJob/passRenderer/cluster/ClusterLightingRender.d.ts +0 -20
- package/dist/src/gfx/renderJob/passRenderer/cluster/ClusterLightingRender.js +0 -74
- package/dist/src/gfx/renderJob/passRenderer/color/ColorPassRenderer.d.ts +0 -12
- package/dist/src/gfx/renderJob/passRenderer/color/ColorPassRenderer.js +0 -97
- package/dist/src/gfx/renderJob/passRenderer/color/GUIPassRenderer.d.ts +0 -13
- package/dist/src/gfx/renderJob/passRenderer/color/GUIPassRenderer.js +0 -79
- package/dist/src/gfx/renderJob/passRenderer/cubeRenderer/ReflectionRenderer.d.ts +0 -36
- package/dist/src/gfx/renderJob/passRenderer/cubeRenderer/ReflectionRenderer.js +0 -172
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIIrradianceComputePass.d.ts +0 -18
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIIrradianceComputePass.js +0 -52
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIIrradianceGPUBufferReader.d.ts +0 -22
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIIrradianceGPUBufferReader.js +0 -68
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIIrradianceVolume.d.ts +0 -32
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIIrradianceVolume.js +0 -113
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGILightingPass.d.ts +0 -17
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGILightingPass.js +0 -47
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIMultiBouncePass.d.ts +0 -13
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIMultiBouncePass.js +0 -40
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIProbeRenderer.d.ts +0 -46
- package/dist/src/gfx/renderJob/passRenderer/ddgi/DDGIProbeRenderer.js +0 -292
- package/dist/src/gfx/renderJob/passRenderer/ddgi/Probe.d.ts +0 -6
- package/dist/src/gfx/renderJob/passRenderer/ddgi/Probe.js +0 -8
- package/dist/src/gfx/renderJob/passRenderer/post/PostRenderer.d.ts +0 -19
- package/dist/src/gfx/renderJob/passRenderer/post/PostRenderer.js +0 -61
- package/dist/src/gfx/renderJob/passRenderer/preDepth/PreDepthPassRenderer.d.ts +0 -16
- package/dist/src/gfx/renderJob/passRenderer/preDepth/PreDepthPassRenderer.js +0 -80
- package/dist/src/gfx/renderJob/passRenderer/preDepth/ZCullingCompute.d.ts +0 -12
- package/dist/src/gfx/renderJob/passRenderer/preDepth/ZCullingCompute.js +0 -26
- package/dist/src/gfx/renderJob/passRenderer/shadow/PointLightShadowRenderer.d.ts +0 -32
- package/dist/src/gfx/renderJob/passRenderer/shadow/PointLightShadowRenderer.js +0 -193
- package/dist/src/gfx/renderJob/passRenderer/shadow/ShadowMapPassRenderer.d.ts +0 -27
- package/dist/src/gfx/renderJob/passRenderer/shadow/ShadowMapPassRenderer.js +0 -224
- package/dist/src/gfx/renderJob/passRenderer/state/PassType.d.ts +0 -13
- package/dist/src/gfx/renderJob/passRenderer/state/PassType.js +0 -14
- package/dist/src/gfx/renderJob/passRenderer/state/RendererMask.d.ts +0 -18
- package/dist/src/gfx/renderJob/passRenderer/state/RendererMask.js +0 -27
- package/dist/src/gfx/renderJob/passRenderer/state/RendererPassState.d.ts +0 -27
- package/dist/src/gfx/renderJob/passRenderer/state/RendererPassState.js +0 -24
- package/dist/src/gfx/renderJob/post/BloomPost.d.ts +0 -45
- package/dist/src/gfx/renderJob/post/BloomPost.js +0 -245
- package/dist/src/gfx/renderJob/post/DepthOfFieldPost.d.ts +0 -56
- package/dist/src/gfx/renderJob/post/DepthOfFieldPost.js +0 -146
- package/dist/src/gfx/renderJob/post/FXAAPost.d.ts +0 -18
- package/dist/src/gfx/renderJob/post/FXAAPost.js +0 -34
- package/dist/src/gfx/renderJob/post/GBufferPost.d.ts +0 -35
- package/dist/src/gfx/renderJob/post/GBufferPost.js +0 -107
- package/dist/src/gfx/renderJob/post/GTAOPost.d.ts +0 -67
- package/dist/src/gfx/renderJob/post/GTAOPost.js +0 -167
- package/dist/src/gfx/renderJob/post/GlobalFog.d.ts +0 -69
- package/dist/src/gfx/renderJob/post/GlobalFog.js +0 -208
- package/dist/src/gfx/renderJob/post/GodRayPost.d.ts +0 -56
- package/dist/src/gfx/renderJob/post/GodRayPost.js +0 -126
- package/dist/src/gfx/renderJob/post/OutlinePost.d.ts +0 -93
- package/dist/src/gfx/renderJob/post/OutlinePost.js +0 -212
- package/dist/src/gfx/renderJob/post/PostBase.d.ts +0 -35
- package/dist/src/gfx/renderJob/post/PostBase.js +0 -78
- package/dist/src/gfx/renderJob/post/SSGIPost.d.ts +0 -67
- package/dist/src/gfx/renderJob/post/SSGIPost.js +0 -210
- package/dist/src/gfx/renderJob/post/SSRPost.d.ts +0 -76
- package/dist/src/gfx/renderJob/post/SSRPost.js +0 -238
- package/dist/src/gfx/renderJob/post/TAAPost.d.ts +0 -40
- package/dist/src/gfx/renderJob/post/TAAPost.js +0 -183
- package/dist/src/index.d.ts +0 -571
- package/dist/src/index.js +0 -571
- package/dist/src/io/InputSystem.d.ts +0 -49
- package/dist/src/io/InputSystem.js +0 -382
- package/dist/src/io/OutlineManager.d.ts +0 -11
- package/dist/src/io/OutlineManager.js +0 -39
- package/dist/src/io/OutlinePostData.d.ts +0 -22
- package/dist/src/io/OutlinePostData.js +0 -54
- package/dist/src/io/PickFire.d.ts +0 -32
- package/dist/src/io/PickFire.js +0 -195
- package/dist/src/io/PickResult.d.ts +0 -59
- package/dist/src/io/PickResult.js +0 -29
- package/dist/src/io/RayCastMeshDetail.d.ts +0 -32
- package/dist/src/io/RayCastMeshDetail.js +0 -119
- package/dist/src/io/TouchData.d.ts +0 -12
- package/dist/src/io/TouchData.js +0 -13
- package/dist/src/io/picker/PickCompute.d.ts +0 -14
- package/dist/src/io/picker/PickCompute.js +0 -53
- package/dist/src/loader/FileLoader.d.ts +0 -7
- package/dist/src/loader/FileLoader.js +0 -70
- package/dist/src/loader/LoaderBase.d.ts +0 -30
- package/dist/src/loader/LoaderBase.js +0 -156
- package/dist/src/loader/LoaderFunctions.d.ts +0 -7
- package/dist/src/loader/LoaderFunctions.js +0 -1
- package/dist/src/loader/LoaderManager.d.ts +0 -36
- package/dist/src/loader/LoaderManager.js +0 -83
- package/dist/src/loader/parser/AtlasParser.d.ts +0 -10
- package/dist/src/loader/parser/AtlasParser.js +0 -31
- package/dist/src/loader/parser/B3DMParser.d.ts +0 -24
- package/dist/src/loader/parser/B3DMParser.js +0 -108
- package/dist/src/loader/parser/FontParser.d.ts +0 -54
- package/dist/src/loader/parser/FontParser.js +0 -171
- package/dist/src/loader/parser/I3DMParser.d.ts +0 -7
- package/dist/src/loader/parser/I3DMParser.js +0 -17
- package/dist/src/loader/parser/OBJParser.d.ts +0 -72
- package/dist/src/loader/parser/OBJParser.js +0 -289
- package/dist/src/loader/parser/ParserBase.d.ts +0 -18
- package/dist/src/loader/parser/ParserBase.js +0 -17
- package/dist/src/loader/parser/ParserFormat.d.ts +0 -5
- package/dist/src/loader/parser/ParserFormat.js +0 -6
- package/dist/src/loader/parser/RGBEParser.d.ts +0 -40
- package/dist/src/loader/parser/RGBEParser.js +0 -248
- package/dist/src/loader/parser/b3dm/B3DMLoader.d.ts +0 -10
- package/dist/src/loader/parser/b3dm/B3DMLoader.js +0 -56
- package/dist/src/loader/parser/b3dm/B3DMLoaderBase.d.ts +0 -9
- package/dist/src/loader/parser/b3dm/B3DMLoaderBase.js +0 -31
- package/dist/src/loader/parser/b3dm/FeatureTable.d.ts +0 -14
- package/dist/src/loader/parser/b3dm/FeatureTable.js +0 -104
- package/dist/src/loader/parser/b3dm/arrayToString.d.ts +0 -1
- package/dist/src/loader/parser/b3dm/arrayToString.js +0 -4
- package/dist/src/loader/parser/b3dm/readMagicBytes.d.ts +0 -1
- package/dist/src/loader/parser/b3dm/readMagicBytes.js +0 -17
- package/dist/src/loader/parser/gis/GeoJsonParser.d.ts +0 -29
- package/dist/src/loader/parser/gis/GeoJsonParser.js +0 -15
- package/dist/src/loader/parser/gis/GeoJsonUtil.d.ts +0 -5
- package/dist/src/loader/parser/gis/GeoJsonUtil.js +0 -30
- package/dist/src/loader/parser/gltf/GLBParser.d.ts +0 -21
- package/dist/src/loader/parser/gltf/GLBParser.js +0 -133
- package/dist/src/loader/parser/gltf/GLTFInfo.d.ts +0 -137
- package/dist/src/loader/parser/gltf/GLTFInfo.js +0 -20
- package/dist/src/loader/parser/gltf/GLTFMaterial.d.ts +0 -24
- package/dist/src/loader/parser/gltf/GLTFMaterial.js +0 -2
- package/dist/src/loader/parser/gltf/GLTFParser.d.ts +0 -45
- package/dist/src/loader/parser/gltf/GLTFParser.js +0 -153
- package/dist/src/loader/parser/gltf/GLTFSubParser.d.ts +0 -47
- package/dist/src/loader/parser/gltf/GLTFSubParser.js +0 -366
- package/dist/src/loader/parser/gltf/GLTFSubParserCamera.d.ts +0 -7
- package/dist/src/loader/parser/gltf/GLTFSubParserCamera.js +0 -41
- package/dist/src/loader/parser/gltf/GLTFSubParserConverter.d.ts +0 -17
- package/dist/src/loader/parser/gltf/GLTFSubParserConverter.js +0 -416
- package/dist/src/loader/parser/gltf/GLTFSubParserMaterial.d.ts +0 -10
- package/dist/src/loader/parser/gltf/GLTFSubParserMaterial.js +0 -182
- package/dist/src/loader/parser/gltf/GLTFSubParserMesh.d.ts +0 -11
- package/dist/src/loader/parser/gltf/GLTFSubParserMesh.js +0 -170
- package/dist/src/loader/parser/gltf/GLTFSubParserSkeleton.d.ts +0 -15
- package/dist/src/loader/parser/gltf/GLTFSubParserSkeleton.js +0 -313
- package/dist/src/loader/parser/gltf/GLTFSubParserSkin.d.ts +0 -10
- package/dist/src/loader/parser/gltf/GLTFSubParserSkin.js +0 -66
- package/dist/src/loader/parser/gltf/GLTFType.d.ts +0 -22
- package/dist/src/loader/parser/gltf/GLTFType.js +0 -21
- package/dist/src/loader/parser/gltf/TypeArray.d.ts +0 -4
- package/dist/src/loader/parser/gltf/TypeArray.js +0 -98
- package/dist/src/loader/parser/gltf/extends/KHR_draco_mesh_compression.d.ts +0 -9
- package/dist/src/loader/parser/gltf/extends/KHR_draco_mesh_compression.js +0 -157
- package/dist/src/loader/parser/gltf/extends/KHR_lights_punctual.d.ts +0 -2
- package/dist/src/loader/parser/gltf/extends/KHR_lights_punctual.js +0 -2
- package/dist/src/loader/parser/gltf/extends/KHR_materials_clearcoat.d.ts +0 -7
- package/dist/src/loader/parser/gltf/extends/KHR_materials_clearcoat.js +0 -26
- package/dist/src/loader/parser/gltf/extends/KHR_materials_emissive_strength.d.ts +0 -3
- package/dist/src/loader/parser/gltf/extends/KHR_materials_emissive_strength.js +0 -17
- package/dist/src/loader/parser/gltf/extends/KHR_materials_ior.d.ts +0 -2
- package/dist/src/loader/parser/gltf/extends/KHR_materials_ior.js +0 -2
- package/dist/src/loader/parser/gltf/extends/KHR_materials_unlit.d.ts +0 -3
- package/dist/src/loader/parser/gltf/extends/KHR_materials_unlit.js +0 -12
- package/dist/src/loader/parser/i3dm/I3DMLoader.d.ts +0 -17
- package/dist/src/loader/parser/i3dm/I3DMLoader.js +0 -97
- package/dist/src/loader/parser/i3dm/I3DMLoaderBase.d.ts +0 -9
- package/dist/src/loader/parser/i3dm/I3DMLoaderBase.js +0 -40
- package/dist/src/loader/parser/prefab/PrefabAvatarParser.d.ts +0 -9
- package/dist/src/loader/parser/prefab/PrefabAvatarParser.js +0 -38
- package/dist/src/loader/parser/prefab/PrefabMaterialParser.d.ts +0 -9
- package/dist/src/loader/parser/prefab/PrefabMaterialParser.js +0 -115
- package/dist/src/loader/parser/prefab/PrefabMeshParser.d.ts +0 -10
- package/dist/src/loader/parser/prefab/PrefabMeshParser.js +0 -133
- package/dist/src/loader/parser/prefab/PrefabParser.d.ts +0 -16
- package/dist/src/loader/parser/prefab/PrefabParser.js +0 -72
- package/dist/src/loader/parser/prefab/PrefabStringUtil.d.ts +0 -12
- package/dist/src/loader/parser/prefab/PrefabStringUtil.js +0 -41
- package/dist/src/loader/parser/prefab/PrefabTextureParser.d.ts +0 -10
- package/dist/src/loader/parser/prefab/PrefabTextureParser.js +0 -32
- package/dist/src/loader/parser/prefab/mats/MaterialUtilities.d.ts +0 -8
- package/dist/src/loader/parser/prefab/mats/MaterialUtilities.js +0 -138
- package/dist/src/loader/parser/prefab/mats/shader/LitSSSShader.d.ts +0 -24
- package/dist/src/loader/parser/prefab/mats/shader/LitSSSShader.js +0 -139
- package/dist/src/loader/parser/prefab/mats/shader/LitShader.d.ts +0 -19
- package/dist/src/loader/parser/prefab/mats/shader/LitShader.js +0 -117
- package/dist/src/loader/parser/prefab/mats/shader/QuadShader.d.ts +0 -4
- package/dist/src/loader/parser/prefab/mats/shader/QuadShader.js +0 -39
- package/dist/src/loader/parser/prefab/mats/shader/ReflectionShader.d.ts +0 -19
- package/dist/src/loader/parser/prefab/mats/shader/ReflectionShader.js +0 -79
- package/dist/src/loader/parser/prefab/mats/shader/SkyShader.d.ts +0 -4
- package/dist/src/loader/parser/prefab/mats/shader/SkyShader.js +0 -35
- package/dist/src/loader/parser/prefab/mats/shader/StandShader.d.ts +0 -220
- package/dist/src/loader/parser/prefab/mats/shader/StandShader.js +0 -420
- package/dist/src/loader/parser/prefab/mats/shader/UnLitShader.d.ts +0 -19
- package/dist/src/loader/parser/prefab/mats/shader/UnLitShader.js +0 -95
- package/dist/src/loader/parser/prefab/mats/shader/UnLitTexArrayShader.d.ts +0 -19
- package/dist/src/loader/parser/prefab/mats/shader/UnLitTexArrayShader.js +0 -100
- package/dist/src/loader/parser/prefab/prefabData/BlendShapeData.d.ts +0 -11
- package/dist/src/loader/parser/prefab/prefabData/BlendShapeData.js +0 -19
- package/dist/src/loader/parser/prefab/prefabData/BlendShapePropertyData.d.ts +0 -9
- package/dist/src/loader/parser/prefab/prefabData/BlendShapePropertyData.js +0 -17
- package/dist/src/loader/parser/prefab/prefabData/KVData.d.ts +0 -9
- package/dist/src/loader/parser/prefab/prefabData/KVData.js +0 -12
- package/dist/src/loader/parser/prefab/prefabData/PrefabAvatarData.d.ts +0 -9
- package/dist/src/loader/parser/prefab/prefabData/PrefabAvatarData.js +0 -15
- package/dist/src/loader/parser/prefab/prefabData/PrefabBoneData.d.ts +0 -16
- package/dist/src/loader/parser/prefab/prefabData/PrefabBoneData.js +0 -14
- package/dist/src/loader/parser/prefab/prefabData/PrefabMeshData.d.ts +0 -19
- package/dist/src/loader/parser/prefab/prefabData/PrefabMeshData.js +0 -2
- package/dist/src/loader/parser/prefab/prefabData/PrefabNode.d.ts +0 -19
- package/dist/src/loader/parser/prefab/prefabData/PrefabNode.js +0 -40
- package/dist/src/loader/parser/prefab/prefabData/PrefabTextureData.d.ts +0 -14
- package/dist/src/loader/parser/prefab/prefabData/PrefabTextureData.js +0 -2
- package/dist/src/loader/parser/prefab/prefabData/ValueParser.d.ts +0 -16
- package/dist/src/loader/parser/prefab/prefabData/ValueParser.js +0 -117
- package/dist/src/loader/parser/prefab/prefabData/ValueType.d.ts +0 -35
- package/dist/src/loader/parser/prefab/prefabData/ValueType.js +0 -36
- package/dist/src/loader/parser/tileRenderer/TileSet.d.ts +0 -45
- package/dist/src/loader/parser/tileRenderer/TileSet.js +0 -10
- package/dist/src/loader/parser/tileRenderer/TilesRenderer.d.ts +0 -12
- package/dist/src/loader/parser/tileRenderer/TilesRenderer.js +0 -88
- package/dist/src/materials/BlendMode.d.ts +0 -58
- package/dist/src/materials/BlendMode.js +0 -132
- package/dist/src/materials/ColorLitMaterial.d.ts +0 -14
- package/dist/src/materials/ColorLitMaterial.js +0 -45
- package/dist/src/materials/GIProbeMaterial.d.ts +0 -15
- package/dist/src/materials/GIProbeMaterial.js +0 -42
- package/dist/src/materials/LambertMaterial.d.ts +0 -39
- package/dist/src/materials/LambertMaterial.js +0 -71
- package/dist/src/materials/LitMaterial.d.ts +0 -49
- package/dist/src/materials/LitMaterial.js +0 -170
- package/dist/src/materials/Material.d.ts +0 -88
- package/dist/src/materials/Material.js +0 -194
- package/dist/src/materials/MaterialRegister.d.ts +0 -9
- package/dist/src/materials/MaterialRegister.js +0 -1
- package/dist/src/materials/ReflectionMaterial.d.ts +0 -13
- package/dist/src/materials/ReflectionMaterial.js +0 -29
- package/dist/src/materials/SkyMaterial.d.ts +0 -23
- package/dist/src/materials/SkyMaterial.js +0 -56
- package/dist/src/materials/UnLitMaterial.d.ts +0 -33
- package/dist/src/materials/UnLitMaterial.js +0 -45
- package/dist/src/materials/UnLitTexArrayMaterial.d.ts +0 -20
- package/dist/src/materials/UnLitTexArrayMaterial.js +0 -32
- package/dist/src/materials/multiPass/CastPointShadowMaterialPass.d.ts +0 -4
- package/dist/src/materials/multiPass/CastPointShadowMaterialPass.js +0 -16
- package/dist/src/materials/multiPass/CastShadowMaterialPass.d.ts +0 -4
- package/dist/src/materials/multiPass/CastShadowMaterialPass.js +0 -16
- package/dist/src/materials/multiPass/DepthMaterialPass.d.ts +0 -4
- package/dist/src/materials/multiPass/DepthMaterialPass.js +0 -11
- package/dist/src/materials/multiPass/GBufferPass.d.ts +0 -5
- package/dist/src/materials/multiPass/GBufferPass.js +0 -19
- package/dist/src/materials/multiPass/SkyGBufferPass.d.ts +0 -4
- package/dist/src/materials/multiPass/SkyGBufferPass.js +0 -18
- package/dist/src/math/AnimationCurve.d.ts +0 -42
- package/dist/src/math/AnimationCurve.js +0 -191
- package/dist/src/math/AnimationCurveClip.d.ts +0 -15
- package/dist/src/math/AnimationCurveClip.js +0 -46
- package/dist/src/math/AnimationCurveT.d.ts +0 -24
- package/dist/src/math/AnimationCurveT.js +0 -105
- package/dist/src/math/BiMap.d.ts +0 -9
- package/dist/src/math/BiMap.js +0 -37
- package/dist/src/math/Color.d.ts +0 -249
- package/dist/src/math/Color.js +0 -381
- package/dist/src/math/ColorGradient.d.ts +0 -6
- package/dist/src/math/ColorGradient.js +0 -14
- package/dist/src/math/CubicBezierCurve.d.ts +0 -47
- package/dist/src/math/CubicBezierCurve.js +0 -100
- package/dist/src/math/CubicBezierPath.d.ts +0 -37
- package/dist/src/math/CubicBezierPath.js +0 -234
- package/dist/src/math/HaltonSeq.d.ts +0 -13
- package/dist/src/math/HaltonSeq.js +0 -45
- package/dist/src/math/Line.d.ts +0 -39
- package/dist/src/math/Line.js +0 -240
- package/dist/src/math/MathUtil.d.ts +0 -86
- package/dist/src/math/MathUtil.js +0 -480
- package/dist/src/math/Matrix3.d.ts +0 -183
- package/dist/src/math/Matrix3.js +0 -511
- package/dist/src/math/Matrix4.d.ts +0 -557
- package/dist/src/math/Matrix4.js +0 -2571
- package/dist/src/math/OrderMap.d.ts +0 -11
- package/dist/src/math/OrderMap.js +0 -56
- package/dist/src/math/Orientation3D.d.ts +0 -5
- package/dist/src/math/Orientation3D.js +0 -5
- package/dist/src/math/ParticleMath.d.ts +0 -22
- package/dist/src/math/ParticleMath.js +0 -26
- package/dist/src/math/ParticleSystemCurves.d.ts +0 -85
- package/dist/src/math/ParticleSystemCurves.js +0 -184
- package/dist/src/math/Plane3D.d.ts +0 -173
- package/dist/src/math/Plane3D.js +0 -191
- package/dist/src/math/PlaneClassification.d.ts +0 -32
- package/dist/src/math/PlaneClassification.js +0 -32
- package/dist/src/math/PolynomialCurve.d.ts +0 -43
- package/dist/src/math/PolynomialCurve.js +0 -236
- package/dist/src/math/Polynomials.d.ts +0 -12
- package/dist/src/math/Polynomials.js +0 -73
- package/dist/src/math/Quaternion.d.ts +0 -42
- package/dist/src/math/Quaternion.js +0 -406
- package/dist/src/math/Rand.d.ts +0 -15
- package/dist/src/math/Rand.js +0 -48
- package/dist/src/math/Random.d.ts +0 -67
- package/dist/src/math/Random.js +0 -543
- package/dist/src/math/Ray.d.ts +0 -41
- package/dist/src/math/Ray.js +0 -304
- package/dist/src/math/Rect.d.ts +0 -21
- package/dist/src/math/Rect.js +0 -108
- package/dist/src/math/TimeInterpolator.d.ts +0 -179
- package/dist/src/math/TimeInterpolator.js +0 -334
- package/dist/src/math/Triangle.d.ts +0 -33
- package/dist/src/math/Triangle.js +0 -113
- package/dist/src/math/UV.d.ts +0 -10
- package/dist/src/math/UV.js +0 -21
- package/dist/src/math/Vector2.d.ts +0 -38
- package/dist/src/math/Vector2.js +0 -166
- package/dist/src/math/Vector3.d.ts +0 -107
- package/dist/src/math/Vector3.js +0 -561
- package/dist/src/math/Vector4.d.ts +0 -34
- package/dist/src/math/Vector4.js +0 -77
- package/dist/src/math/enum/FrameCache.d.ts +0 -6
- package/dist/src/math/enum/FrameCache.js +0 -5
- package/dist/src/math/enum/Keyframe.d.ts +0 -14
- package/dist/src/math/enum/Keyframe.js +0 -27
- package/dist/src/math/enum/T/KeyframeT.d.ts +0 -18
- package/dist/src/math/enum/T/KeyframeT.js +0 -113
- package/dist/src/math/enum/T/ValueOp.d.ts +0 -4
- package/dist/src/math/enum/T/ValueOp.js +0 -32
- package/dist/src/math/enum/WrapTimeMode.d.ts +0 -5
- package/dist/src/math/enum/WrapTimeMode.js +0 -6
- package/dist/src/math/navigation/DoubleArray.d.ts +0 -11
- package/dist/src/math/navigation/DoubleArray.js +0 -44
- package/dist/src/math/navigation/Navi3DAstar.d.ts +0 -16
- package/dist/src/math/navigation/Navi3DAstar.js +0 -82
- package/dist/src/math/navigation/Navi3DConst.d.ts +0 -5
- package/dist/src/math/navigation/Navi3DConst.js +0 -8
- package/dist/src/math/navigation/Navi3DEdge.d.ts +0 -33
- package/dist/src/math/navigation/Navi3DEdge.js +0 -109
- package/dist/src/math/navigation/Navi3DFunnel.d.ts +0 -19
- package/dist/src/math/navigation/Navi3DFunnel.js +0 -254
- package/dist/src/math/navigation/Navi3DMaskType.d.ts +0 -3
- package/dist/src/math/navigation/Navi3DMaskType.js +0 -3
- package/dist/src/math/navigation/Navi3DMesh.d.ts +0 -27
- package/dist/src/math/navigation/Navi3DMesh.js +0 -122
- package/dist/src/math/navigation/Navi3DPoint.d.ts +0 -13
- package/dist/src/math/navigation/Navi3DPoint.js +0 -27
- package/dist/src/math/navigation/Navi3DPoint2D.d.ts +0 -10
- package/dist/src/math/navigation/Navi3DPoint2D.js +0 -26
- package/dist/src/math/navigation/Navi3DPointFat.d.ts +0 -11
- package/dist/src/math/navigation/Navi3DPointFat.js +0 -24
- package/dist/src/math/navigation/Navi3DRouter.d.ts +0 -29
- package/dist/src/math/navigation/Navi3DRouter.js +0 -173
- package/dist/src/math/navigation/Navi3DTriangle.d.ts +0 -44
- package/dist/src/math/navigation/Navi3DTriangle.js +0 -167
- package/dist/src/setting/EngineSetting.d.ts +0 -23
- package/dist/src/setting/EngineSetting.js +0 -1
- package/dist/src/setting/GlobalIlluminationSetting.d.ts +0 -115
- package/dist/src/setting/GlobalIlluminationSetting.js +0 -1
- package/dist/src/setting/LightSetting.d.ts +0 -3
- package/dist/src/setting/LightSetting.js +0 -1
- package/dist/src/setting/LoaderSetting.d.ts +0 -3
- package/dist/src/setting/LoaderSetting.js +0 -1
- package/dist/src/setting/MaterialSetting.d.ts +0 -5
- package/dist/src/setting/MaterialSetting.js +0 -1
- package/dist/src/setting/OcclusionQuerySetting.d.ts +0 -12
- package/dist/src/setting/OcclusionQuerySetting.js +0 -1
- package/dist/src/setting/PickSetting.d.ts +0 -5
- package/dist/src/setting/PickSetting.js +0 -1
- package/dist/src/setting/ReflectionSetting.d.ts +0 -7
- package/dist/src/setting/ReflectionSetting.js +0 -1
- package/dist/src/setting/RenderSetting.d.ts +0 -51
- package/dist/src/setting/RenderSetting.js +0 -1
- package/dist/src/setting/ShadowSetting.d.ts +0 -17
- package/dist/src/setting/ShadowSetting.js +0 -1
- package/dist/src/setting/SkySetting.d.ts +0 -8
- package/dist/src/setting/SkySetting.js +0 -1
- package/dist/src/setting/post/BloomSetting.d.ts +0 -11
- package/dist/src/setting/post/BloomSetting.js +0 -1
- package/dist/src/setting/post/DepthOfViewSetting.d.ts +0 -7
- package/dist/src/setting/post/DepthOfViewSetting.js +0 -1
- package/dist/src/setting/post/GTAOSetting.d.ts +0 -11
- package/dist/src/setting/post/GTAOSetting.js +0 -1
- package/dist/src/setting/post/GlobalFogSetting.d.ts +0 -19
- package/dist/src/setting/post/GlobalFogSetting.js +0 -1
- package/dist/src/setting/post/GodRaySetting.d.ts +0 -7
- package/dist/src/setting/post/GodRaySetting.js +0 -1
- package/dist/src/setting/post/OutlineSetting.d.ts +0 -10
- package/dist/src/setting/post/OutlineSetting.js +0 -1
- package/dist/src/setting/post/SSRSetting.d.ts +0 -12
- package/dist/src/setting/post/SSRSetting.js +0 -1
- package/dist/src/setting/post/TAASetting.d.ts +0 -9
- package/dist/src/setting/post/TAASetting.js +0 -1
- package/dist/src/shape/BoxGeometry.d.ts +0 -28
- package/dist/src/shape/BoxGeometry.js +0 -184
- package/dist/src/shape/CylinderGeometry.d.ts +0 -60
- package/dist/src/shape/CylinderGeometry.js +0 -171
- package/dist/src/shape/PlaneGeometry.d.ts +0 -11
- package/dist/src/shape/PlaneGeometry.js +0 -105
- package/dist/src/shape/SphereGeometry.d.ts +0 -25
- package/dist/src/shape/SphereGeometry.js +0 -102
- package/dist/src/shape/TorusGeometry.d.ts +0 -33
- package/dist/src/shape/TorusGeometry.js +0 -88
- package/dist/src/shape/TrailGeometry.d.ts +0 -18
- package/dist/src/shape/TrailGeometry.js +0 -68
- package/dist/src/shape/TriGeometry.d.ts +0 -13
- package/dist/src/shape/TriGeometry.js +0 -47
- package/dist/src/textures/AtmosphericScatteringSky.d.ts +0 -42
- package/dist/src/textures/AtmosphericScatteringSky.js +0 -97
- package/dist/src/textures/BitmapTexture2D.d.ts +0 -12
- package/dist/src/textures/BitmapTexture2D.js +0 -94
- package/dist/src/textures/BitmapTexture2DArray.d.ts +0 -15
- package/dist/src/textures/BitmapTexture2DArray.js +0 -87
- package/dist/src/textures/BitmapTextureCube.d.ts +0 -14
- package/dist/src/textures/BitmapTextureCube.js +0 -181
- package/dist/src/textures/Depth2DTextureArray.d.ts +0 -9
- package/dist/src/textures/Depth2DTextureArray.js +0 -43
- package/dist/src/textures/DepthCubeArrayTexture.d.ts +0 -9
- package/dist/src/textures/DepthCubeArrayTexture.js +0 -46
- package/dist/src/textures/Float16ArrayTexture.d.ts +0 -28
- package/dist/src/textures/Float16ArrayTexture.js +0 -84
- package/dist/src/textures/Float32ArrayTexture.d.ts +0 -5
- package/dist/src/textures/Float32ArrayTexture.js +0 -61
- package/dist/src/textures/HDRTexture.d.ts +0 -7
- package/dist/src/textures/HDRTexture.js +0 -52
- package/dist/src/textures/HDRTextureCube.d.ts +0 -16
- package/dist/src/textures/HDRTextureCube.js +0 -50
- package/dist/src/textures/LDRTextureCube.d.ts +0 -13
- package/dist/src/textures/LDRTextureCube.js +0 -49
- package/dist/src/textures/RenderTexture.d.ts +0 -12
- package/dist/src/textures/RenderTexture.js +0 -140
- package/dist/src/textures/SolidColorSky.d.ts +0 -11
- package/dist/src/textures/SolidColorSky.js +0 -29
- package/dist/src/textures/TextureCubeFaceData.d.ts +0 -19
- package/dist/src/textures/TextureCubeFaceData.js +0 -55
- package/dist/src/textures/Uint8ArrayTexture.d.ts +0 -6
- package/dist/src/textures/Uint8ArrayTexture.js +0 -63
- package/dist/src/textures/VirtualTexture.d.ts +0 -29
- package/dist/src/textures/VirtualTexture.js +0 -152
- package/dist/src/util/AxisObject.d.ts +0 -11
- package/dist/src/util/AxisObject.js +0 -52
- package/dist/src/util/BoundUtil.d.ts +0 -12
- package/dist/src/util/BoundUtil.js +0 -73
- package/dist/src/util/BytesArray.d.ts +0 -49
- package/dist/src/util/BytesArray.js +0 -257
- package/dist/src/util/CameraUtil.d.ts +0 -10
- package/dist/src/util/CameraUtil.js +0 -62
- package/dist/src/util/Convert.d.ts +0 -1
- package/dist/src/util/Convert.js +0 -24
- package/dist/src/util/GeometryUtil.d.ts +0 -12
- package/dist/src/util/GeometryUtil.js +0 -55
- package/dist/src/util/Global.d.ts +0 -15
- package/dist/src/util/Global.js +0 -57
- package/dist/src/util/GridObject.d.ts +0 -12
- package/dist/src/util/GridObject.js +0 -94
- package/dist/src/util/KelvinUtil.d.ts +0 -40
- package/dist/src/util/KelvinUtil.js +0 -79
- package/dist/src/util/Object3DUtil.d.ts +0 -25
- package/dist/src/util/Object3DUtil.js +0 -121
- package/dist/src/util/ProfilerUtil.d.ts +0 -49
- package/dist/src/util/ProfilerUtil.js +0 -141
- package/dist/src/util/Reference.d.ts +0 -37
- package/dist/src/util/Reference.js +0 -67
- package/dist/src/util/SerializeDecoration.d.ts +0 -9
- package/dist/src/util/SerializeDecoration.js +0 -95
- package/dist/src/util/StringUtil.d.ts +0 -23
- package/dist/src/util/StringUtil.js +0 -250
- package/dist/src/util/Time.d.ts +0 -9
- package/dist/src/util/Time.js +0 -14
- package/dist/src/util/Vector3Ex.d.ts +0 -16
- package/dist/src/util/Vector3Ex.js +0 -84
- package/dist/src/util/ZSorterUtil.d.ts +0 -13
- package/dist/src/util/ZSorterUtil.js +0 -51
- package/dist/src/util/struct/Struct.d.ts +0 -17
- package/dist/src/util/struct/Struct.js +0 -101
- package/dist/src/util/transformUtil/Object3DTransformTools.d.ts +0 -37
- package/dist/src/util/transformUtil/Object3DTransformTools.js +0 -136
- package/dist/src/util/transformUtil/RotationControlComponents.d.ts +0 -21
- package/dist/src/util/transformUtil/RotationControlComponents.js +0 -198
- package/dist/src/util/transformUtil/ScaleControlComponents.d.ts +0 -11
- package/dist/src/util/transformUtil/ScaleControlComponents.js +0 -132
- package/dist/src/util/transformUtil/TransformAxisEnum.d.ts +0 -11
- package/dist/src/util/transformUtil/TransformAxisEnum.js +0 -12
- package/dist/src/util/transformUtil/TransformControllerBaseComponent.d.ts +0 -48
- package/dist/src/util/transformUtil/TransformControllerBaseComponent.js +0 -283
- package/dist/src/util/transformUtil/TransformMode.d.ts +0 -6
- package/dist/src/util/transformUtil/TransformMode.js +0 -7
- package/dist/src/util/transformUtil/TransformSpaceMode.d.ts +0 -4
- package/dist/src/util/transformUtil/TransformSpaceMode.js +0 -5
- package/dist/src/util/transformUtil/TranslationControlComponents.d.ts +0 -12
- package/dist/src/util/transformUtil/TranslationControlComponents.js +0 -164
|
@@ -1,1804 +0,0 @@
|
|
|
1
|
-
import { TokenType } from "./GLSLLexerToken";
|
|
2
|
-
import { TranslatorContext } from "./WGSLTranslator";
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
* Statement node
|
|
6
|
-
* @group GFX
|
|
7
|
-
*/
|
|
8
|
-
export class StatementNode {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.nodes = [];
|
|
11
|
-
}
|
|
12
|
-
addNode(node) {
|
|
13
|
-
this.nodes.push(node);
|
|
14
|
-
}
|
|
15
|
-
formatToWGSL(context, depth) {
|
|
16
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
17
|
-
return "";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
* Statement node: struct
|
|
23
|
-
* @group GFX
|
|
24
|
-
*/
|
|
25
|
-
export class SN_Struct extends StatementNode {
|
|
26
|
-
constructor(name) {
|
|
27
|
-
super();
|
|
28
|
-
this.name = "";
|
|
29
|
-
this.fields = [];
|
|
30
|
-
this.name = name;
|
|
31
|
-
}
|
|
32
|
-
static parse(r) {
|
|
33
|
-
if (r.peekToken(0).Type == TokenType.IDENT &&
|
|
34
|
-
r.peekToken(1).Type == TokenType.LEFTBIG) {
|
|
35
|
-
let result = new SN_Struct(r.peekToken(0).Literal);
|
|
36
|
-
r.skipToken(2);
|
|
37
|
-
while (r.peekToken(0).Type != TokenType.RIGHTBIG) {
|
|
38
|
-
let field = SN_Declaration.parse(r);
|
|
39
|
-
result.fields.push(field);
|
|
40
|
-
}
|
|
41
|
-
if (r.peekToken(0).Type == TokenType.RIGHTBIG) {
|
|
42
|
-
r.skipToken(1);
|
|
43
|
-
}
|
|
44
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
45
|
-
r.skipToken(1);
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
throw "Error parsing structure: Unexpected character";
|
|
50
|
-
}
|
|
51
|
-
formatToWGSL(context, depth) {
|
|
52
|
-
let result = "";
|
|
53
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
54
|
-
result += prefix + "struct " + this.name + " {\r\n";
|
|
55
|
-
for (let field of this.fields) {
|
|
56
|
-
if (field.arraySize.nodes.length <= 0) {
|
|
57
|
-
result +=
|
|
58
|
-
prefix + " " + field.name + ": " + toWGSLType(field.type) + ",\r\n";
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
if (field.arraySize.nodes[0] instanceof SN_Constant) {
|
|
62
|
-
result +=
|
|
63
|
-
prefix +
|
|
64
|
-
" " +
|
|
65
|
-
field.name +
|
|
66
|
-
": array<" +
|
|
67
|
-
toWGSLType(field.type) +
|
|
68
|
-
", " +
|
|
69
|
-
field.arraySize.nodes[0].value +
|
|
70
|
-
">" +
|
|
71
|
-
",\r\n";
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
result +=
|
|
75
|
-
prefix +
|
|
76
|
-
" " +
|
|
77
|
-
field.name +
|
|
78
|
-
": array<" +
|
|
79
|
-
toWGSLType(field.type) +
|
|
80
|
-
", " +
|
|
81
|
-
field.arraySize.nodes[0].formatToWGSL(context, 0) +
|
|
82
|
-
">" +
|
|
83
|
-
",\r\n";
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
result += prefix + "};\r\n";
|
|
88
|
-
return result;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* @internal
|
|
93
|
-
* Statement node: function
|
|
94
|
-
* @group GFX
|
|
95
|
-
*/
|
|
96
|
-
export class SN_Function extends StatementNode {
|
|
97
|
-
constructor(name, args, body, returnType) {
|
|
98
|
-
super();
|
|
99
|
-
this.name = name;
|
|
100
|
-
this.args = args;
|
|
101
|
-
this.body = body;
|
|
102
|
-
this.returnType = returnType;
|
|
103
|
-
}
|
|
104
|
-
static parse(r) {
|
|
105
|
-
if ((r.peekToken(0).isBuiltinType() ||
|
|
106
|
-
r.peekToken(0).Type == TokenType.VOID) &&
|
|
107
|
-
r.peekToken(1).Type == TokenType.IDENT &&
|
|
108
|
-
r.peekToken(2).Type == TokenType.LEFTSAMLL) {
|
|
109
|
-
// Parsing return types
|
|
110
|
-
let returnType = r.peekToken(0).Literal;
|
|
111
|
-
// Parse function name
|
|
112
|
-
let name = r.peekToken(1).Literal;
|
|
113
|
-
r.skipToken(2);
|
|
114
|
-
// Parse the parameter list
|
|
115
|
-
let args = new Array();
|
|
116
|
-
if (r.peekToken(0).Type != TokenType.LEFTSAMLL) {
|
|
117
|
-
throw "Error parsing function parameter list: Unexpected character";
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
r.skipToken(1);
|
|
121
|
-
while (r.peekToken(0).Type != TokenType.EOF) {
|
|
122
|
-
if (r.peekToken(0).Type == TokenType.RIGHTSAMLL) {
|
|
123
|
-
r.skipToken(1);
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
if (r.peekToken(0).Type == TokenType.INOUT) {
|
|
127
|
-
r.skipToken(1);
|
|
128
|
-
}
|
|
129
|
-
else if (r.peekToken(0).Type == TokenType.IN) {
|
|
130
|
-
r.skipToken(1);
|
|
131
|
-
}
|
|
132
|
-
else if (r.peekToken(0).Type == TokenType.OUT) {
|
|
133
|
-
r.skipToken(1);
|
|
134
|
-
}
|
|
135
|
-
let arg = SN_Declaration.parse(r);
|
|
136
|
-
args.push(arg);
|
|
137
|
-
if (r.peekToken(0).Type == TokenType.COMMA) {
|
|
138
|
-
r.skipToken(1);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// Parse function body
|
|
143
|
-
let body = SN_CodeBlock.parse(r);
|
|
144
|
-
return new SN_Function(name, args, body, returnType);
|
|
145
|
-
}
|
|
146
|
-
throw "Error parsing function: Unexpected character";
|
|
147
|
-
}
|
|
148
|
-
formatToWGSL(context, depth) {
|
|
149
|
-
let result = "";
|
|
150
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
151
|
-
let outStructName;
|
|
152
|
-
let hasOutStruct = context.layoutsOut.length > 0 || context.builtinOut.length > 0;
|
|
153
|
-
switch (context.stage) {
|
|
154
|
-
case "compute":
|
|
155
|
-
outStructName = "ComputeOutput";
|
|
156
|
-
break;
|
|
157
|
-
case "vertex":
|
|
158
|
-
outStructName = "VertexOutput";
|
|
159
|
-
break;
|
|
160
|
-
case "fragment":
|
|
161
|
-
outStructName = "FragmentOutput";
|
|
162
|
-
break;
|
|
163
|
-
default:
|
|
164
|
-
outStructName = "StructOutput";
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
// Processing the output structure
|
|
168
|
-
if (this.name == "main" && hasOutStruct) {
|
|
169
|
-
result += "struct " + outStructName + " {\r\n";
|
|
170
|
-
for (let item of context.layoutsOut) {
|
|
171
|
-
if (item.nodes[0] instanceof SN_Declaration) {
|
|
172
|
-
let arg = item.nodes[0];
|
|
173
|
-
if (item.qualifier.size == 1 && item.qualifier.has("location")) {
|
|
174
|
-
result += " @location(" + item.qualifier.get("location") + ") ";
|
|
175
|
-
}
|
|
176
|
-
result += arg.name + ": " + toWGSLType(arg.type) + ",\r\n";
|
|
177
|
-
context.addIdentifier(arg.name, "stout." + arg.name);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
let builtinOut = context.builtinOut;
|
|
181
|
-
for (let item of builtinOut) {
|
|
182
|
-
result += " " + item + ",\r\n";
|
|
183
|
-
}
|
|
184
|
-
result += "};\r\n\r\n";
|
|
185
|
-
}
|
|
186
|
-
// Generate function header
|
|
187
|
-
let header = "";
|
|
188
|
-
if (this.name == "main") {
|
|
189
|
-
if (context.workGroupSize != undefined) {
|
|
190
|
-
header +=
|
|
191
|
-
"@" +
|
|
192
|
-
context.stage +
|
|
193
|
-
" " +
|
|
194
|
-
context.workGroupSize.formatToWGSL(context, 0) +
|
|
195
|
-
" \r\n";
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
header += "@" + context.stage + "\r\n";
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
context = new TranslatorContext(context);
|
|
202
|
-
header += prefix + "fn " + this.name + "(";
|
|
203
|
-
if (this.name != "main") {
|
|
204
|
-
for (let i = 0; i < this.args.length; i++) {
|
|
205
|
-
let arg = this.args[i];
|
|
206
|
-
if (i > 0) {
|
|
207
|
-
header += ", ";
|
|
208
|
-
}
|
|
209
|
-
header += arg.name + ": " + toWGSLType(arg.type);
|
|
210
|
-
context.addIdentifier(arg.name, arg.name);
|
|
211
|
-
}
|
|
212
|
-
header += ") -> " + toWGSLType(this.returnType);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
let layoutsIn = context.layoutsIn;
|
|
216
|
-
for (let i = 0; i < layoutsIn.length; i++) {
|
|
217
|
-
let item = layoutsIn[i];
|
|
218
|
-
if (i > 0) {
|
|
219
|
-
header += ",\r\n ";
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
header += "\r\n ";
|
|
223
|
-
}
|
|
224
|
-
if (item.nodes[0] instanceof SN_Declaration) {
|
|
225
|
-
let arg = item.nodes[0];
|
|
226
|
-
if (item.qualifier.size == 1 && item.qualifier.has("location")) {
|
|
227
|
-
header += "@location(" + item.qualifier.get("location") + ") ";
|
|
228
|
-
}
|
|
229
|
-
header += arg.name + ": " + toWGSLType(arg.type);
|
|
230
|
-
context.addIdentifier(arg.name, arg.name);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (layoutsIn.length > 0) {
|
|
234
|
-
header += ",\r\n ";
|
|
235
|
-
}
|
|
236
|
-
let builtinIn = context.builtinIn;
|
|
237
|
-
for (let item of builtinIn) {
|
|
238
|
-
header += item + ",\r\n ";
|
|
239
|
-
}
|
|
240
|
-
if (hasOutStruct) {
|
|
241
|
-
header += ") -> " + outStructName;
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
header += ") ";
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
// Generating function body
|
|
248
|
-
let bodyResult = "";
|
|
249
|
-
if (this.name == "main" && hasOutStruct) {
|
|
250
|
-
bodyResult += " var stout: " + outStructName + " ;\r\n";
|
|
251
|
-
}
|
|
252
|
-
for (let statement of this.body.nodes) {
|
|
253
|
-
bodyResult += statement.formatToWGSL(context, depth + 1);
|
|
254
|
-
if (!(statement instanceof SN_IFBranch) &&
|
|
255
|
-
!(statement instanceof SN_WhileLoop) &&
|
|
256
|
-
!(statement instanceof SN_ForLoop)) {
|
|
257
|
-
bodyResult += ";\r\n";
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
if (this.name == "main" && hasOutStruct) {
|
|
261
|
-
bodyResult += " return stout;\r\n";
|
|
262
|
-
}
|
|
263
|
-
// Result of assembly
|
|
264
|
-
result += header + " {\r\n";
|
|
265
|
-
result += bodyResult;
|
|
266
|
-
result += prefix + "}\r\n";
|
|
267
|
-
result += "\r\n";
|
|
268
|
-
return result;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* @internal
|
|
273
|
-
* Statement node: functionArg
|
|
274
|
-
* @group GFX
|
|
275
|
-
*/
|
|
276
|
-
export class SN_FunctionArgs extends StatementNode {
|
|
277
|
-
constructor() {
|
|
278
|
-
super();
|
|
279
|
-
this.args = [];
|
|
280
|
-
}
|
|
281
|
-
static parse(r) {
|
|
282
|
-
if (r.peekToken(0).Type == TokenType.LEFTSAMLL) {
|
|
283
|
-
r.skipToken(1);
|
|
284
|
-
let result = new SN_FunctionArgs();
|
|
285
|
-
while (r.peekToken(0).Type != TokenType.EOF) {
|
|
286
|
-
if (r.peekToken(0).Type == TokenType.RIGHTSAMLL) {
|
|
287
|
-
r.skipToken(1);
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
let arg = SN_Expression.parse(r);
|
|
291
|
-
result.args.push(arg);
|
|
292
|
-
if (r.peekToken(0).Type == TokenType.COMMA) {
|
|
293
|
-
r.skipToken(1);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return result;
|
|
297
|
-
}
|
|
298
|
-
throw "Error parsing function argument table: Unexpected character";
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* @internal
|
|
303
|
-
* Statement node: functionCall
|
|
304
|
-
* @group GFX
|
|
305
|
-
*/
|
|
306
|
-
export class SN_FunctionCall extends StatementNode {
|
|
307
|
-
constructor(name, args) {
|
|
308
|
-
super();
|
|
309
|
-
this.name = name;
|
|
310
|
-
this.args = args;
|
|
311
|
-
}
|
|
312
|
-
static parse(r) {
|
|
313
|
-
// a(...)
|
|
314
|
-
if (r.peekToken(0).isDataType() &&
|
|
315
|
-
r.peekToken(1).Type == TokenType.LEFTSAMLL) {
|
|
316
|
-
// Parse function name
|
|
317
|
-
let name = r.peekToken(0).Literal;
|
|
318
|
-
r.skipToken(1);
|
|
319
|
-
// Parse the argument table
|
|
320
|
-
let args = SN_FunctionArgs.parse(r);
|
|
321
|
-
return new SN_FunctionCall(name, args);
|
|
322
|
-
}
|
|
323
|
-
throw "Error parsing function argument table: Unexpected character";
|
|
324
|
-
}
|
|
325
|
-
formatToWGSL(context, depth) {
|
|
326
|
-
let result = "";
|
|
327
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
328
|
-
if (this.name == "texture" &&
|
|
329
|
-
this.args.args[0].nodes[0] instanceof SN_FunctionCall) {
|
|
330
|
-
let callNode = this.args.args[0].nodes[0];
|
|
331
|
-
if (callNode.name == "sampler2D") {
|
|
332
|
-
result += prefix + "textureSample(";
|
|
333
|
-
for (let i = 0; i < callNode.args.args.length; i++) {
|
|
334
|
-
let arg = callNode.args.args[i];
|
|
335
|
-
if (i > 0) {
|
|
336
|
-
result += ", ";
|
|
337
|
-
}
|
|
338
|
-
result += arg.formatToWGSL(context, 0);
|
|
339
|
-
}
|
|
340
|
-
for (let i = 1; i < this.args.args.length; i++) {
|
|
341
|
-
let arg = this.args.args[i];
|
|
342
|
-
if (i > 0) {
|
|
343
|
-
result += ", ";
|
|
344
|
-
}
|
|
345
|
-
result += arg.formatToWGSL(context, 0);
|
|
346
|
-
}
|
|
347
|
-
result += ")";
|
|
348
|
-
return result;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
result += prefix + toWGSLType(this.name) + "(";
|
|
352
|
-
for (let i = 0; i < this.args.args.length; i++) {
|
|
353
|
-
let arg = this.args.args[i];
|
|
354
|
-
if (i > 0) {
|
|
355
|
-
result += ", ";
|
|
356
|
-
}
|
|
357
|
-
result += arg.formatToWGSL(context, 0);
|
|
358
|
-
}
|
|
359
|
-
result += ")";
|
|
360
|
-
return result;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* @internal
|
|
365
|
-
* Statement node: declaration
|
|
366
|
-
* @group GFX
|
|
367
|
-
*/
|
|
368
|
-
export class SN_Declaration extends StatementNode {
|
|
369
|
-
constructor(type, name, arraySize = new SN_Expression()) {
|
|
370
|
-
super();
|
|
371
|
-
this.type = type;
|
|
372
|
-
this.name = name;
|
|
373
|
-
this.hasIn = false;
|
|
374
|
-
this.hasOut = false;
|
|
375
|
-
this.hasConst = false;
|
|
376
|
-
this.arraySize = arraySize;
|
|
377
|
-
}
|
|
378
|
-
static parse(r) {
|
|
379
|
-
let result = new SN_Declaration("", "");
|
|
380
|
-
let first = r.peekToken(0);
|
|
381
|
-
// const
|
|
382
|
-
if (first.Type == TokenType.CONST) {
|
|
383
|
-
r.skipToken(1);
|
|
384
|
-
result.hasConst = true;
|
|
385
|
-
}
|
|
386
|
-
// in
|
|
387
|
-
else if (first.Type == TokenType.IN) {
|
|
388
|
-
r.skipToken(1);
|
|
389
|
-
result.hasIn = true;
|
|
390
|
-
}
|
|
391
|
-
// out
|
|
392
|
-
else if (first.Type == TokenType.OUT) {
|
|
393
|
-
r.skipToken(1);
|
|
394
|
-
result.hasOut = true;
|
|
395
|
-
}
|
|
396
|
-
// inout
|
|
397
|
-
else if (first.Type == TokenType.INOUT) {
|
|
398
|
-
r.skipToken(1);
|
|
399
|
-
result.hasIn = true;
|
|
400
|
-
result.hasOut = true;
|
|
401
|
-
}
|
|
402
|
-
else if (!first.isDataType()) {
|
|
403
|
-
throw ("Error parsing declaration expression: Unexpected character(" +
|
|
404
|
-
first.Literal +
|
|
405
|
-
")");
|
|
406
|
-
}
|
|
407
|
-
first = r.peekToken(0);
|
|
408
|
-
// float[xxx] a
|
|
409
|
-
if (first.isDataType() && r.peekToken(1).Type == TokenType.LEFTMEDI) {
|
|
410
|
-
result.type = first.Literal;
|
|
411
|
-
r.skipToken(2);
|
|
412
|
-
result.arraySize = SN_Expression.parse(r);
|
|
413
|
-
if (r.peekToken(0).Type == TokenType.RIGHTMEDI) {
|
|
414
|
-
r.skipToken(1);
|
|
415
|
-
}
|
|
416
|
-
if (r.peekToken(0).Type != TokenType.IDENT) {
|
|
417
|
-
throw "Unexpected";
|
|
418
|
-
}
|
|
419
|
-
result.name = r.peekToken(0).Literal;
|
|
420
|
-
r.skipToken(1);
|
|
421
|
-
}
|
|
422
|
-
// float a[xxx]
|
|
423
|
-
else if (first.isDataType() &&
|
|
424
|
-
r.peekToken(1).Type == TokenType.IDENT &&
|
|
425
|
-
r.peekToken(2).Type == TokenType.LEFTMEDI) {
|
|
426
|
-
result.type = r.peekToken(0).Literal;
|
|
427
|
-
result.name = r.peekToken(1).Literal;
|
|
428
|
-
r.skipToken(3);
|
|
429
|
-
if (r.peekToken(0).Type == TokenType.RIGHTMEDI) {
|
|
430
|
-
r.skipToken(1);
|
|
431
|
-
}
|
|
432
|
-
else {
|
|
433
|
-
result.arraySize = SN_Expression.parse(r);
|
|
434
|
-
if (r.peekToken(0).Type == TokenType.RIGHTMEDI) {
|
|
435
|
-
r.skipToken(1);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
// float a
|
|
440
|
-
else if (first.isDataType() && r.peekToken(1).Type == TokenType.IDENT) {
|
|
441
|
-
result.type = r.peekToken(0).Literal;
|
|
442
|
-
result.name = r.peekToken(1).Literal;
|
|
443
|
-
r.skipToken(2);
|
|
444
|
-
}
|
|
445
|
-
else
|
|
446
|
-
throw ("Error parsing declaration expression: Unexpected character(" +
|
|
447
|
-
first.Literal +
|
|
448
|
-
")");
|
|
449
|
-
first = r.peekToken(0);
|
|
450
|
-
if (first.Type == TokenType.SEMICOLON) {
|
|
451
|
-
r.skipToken(1);
|
|
452
|
-
return result;
|
|
453
|
-
}
|
|
454
|
-
else if (first.Type == TokenType.RIGHTSAMLL) {
|
|
455
|
-
return result;
|
|
456
|
-
}
|
|
457
|
-
else if (first.Type == TokenType.ASSIGN) {
|
|
458
|
-
let op = r.peekToken(0);
|
|
459
|
-
r.skipToken(1);
|
|
460
|
-
let lValue = new SN_Identifier(result.name);
|
|
461
|
-
let rValue = SN_Expression.parse(r);
|
|
462
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
463
|
-
r.skipToken(1);
|
|
464
|
-
}
|
|
465
|
-
result.addNode(new SN_BinaryOperation(op, lValue, rValue));
|
|
466
|
-
return result;
|
|
467
|
-
}
|
|
468
|
-
else if (first.Type == TokenType.COMMA) {
|
|
469
|
-
// float a, b = 0, c = 1 + 2
|
|
470
|
-
while (r.peekToken(0).Type == TokenType.COMMA &&
|
|
471
|
-
r.peekToken(1).Type == TokenType.IDENT) {
|
|
472
|
-
let declaration = new SN_Declaration(result.type, r.peekToken(1).Literal);
|
|
473
|
-
result.addNode(declaration);
|
|
474
|
-
r.skipToken(2);
|
|
475
|
-
if (r.peekToken(0).Type == TokenType.ASSIGN) {
|
|
476
|
-
r.skipToken(-1);
|
|
477
|
-
declaration.addNode(SN_Expression.parse(r));
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return result;
|
|
481
|
-
}
|
|
482
|
-
throw ("Error parsing declaration expression: Unexpected character(" +
|
|
483
|
-
r.peekToken(0).Literal +
|
|
484
|
-
")");
|
|
485
|
-
}
|
|
486
|
-
formatToWGSL(context, depth) {
|
|
487
|
-
let result = "";
|
|
488
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
489
|
-
if (this.hasConst) {
|
|
490
|
-
result += prefix + "let ";
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
result += prefix + "var ";
|
|
494
|
-
}
|
|
495
|
-
context.addIdentifier(this.name, this.name);
|
|
496
|
-
if (this.arraySize.nodes.length <= 0) {
|
|
497
|
-
result += this.name + ": " + toWGSLType(this.type);
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
if (this.arraySize.nodes[0] instanceof SN_Constant) {
|
|
501
|
-
result +=
|
|
502
|
-
this.name +
|
|
503
|
-
": array<" +
|
|
504
|
-
toWGSLType(this.type) +
|
|
505
|
-
", " +
|
|
506
|
-
this.arraySize.nodes[0].value +
|
|
507
|
-
">";
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
result +=
|
|
511
|
-
this.name +
|
|
512
|
-
": array<" +
|
|
513
|
-
toWGSLType(this.type) +
|
|
514
|
-
", " +
|
|
515
|
-
this.arraySize.nodes[0].formatToWGSL(context, 0) +
|
|
516
|
-
">";
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
if (this.nodes.length > 0 && this.nodes[0] instanceof SN_BinaryOperation) {
|
|
520
|
-
result += " = " + this.nodes[0].rightValue.formatToWGSL(context, 0);
|
|
521
|
-
}
|
|
522
|
-
else if (this.nodes.length > 0 &&
|
|
523
|
-
this.nodes[0] instanceof SN_Expression &&
|
|
524
|
-
this.nodes[0].nodes[0] instanceof SN_BinaryOperation) {
|
|
525
|
-
result +=
|
|
526
|
-
" = " + this.nodes[0].nodes[0].rightValue.formatToWGSL(context, 0);
|
|
527
|
-
}
|
|
528
|
-
else if (this.nodes.length > 0 &&
|
|
529
|
-
this.nodes[0] instanceof SN_Declaration) {
|
|
530
|
-
result += ";\r\n";
|
|
531
|
-
for (let item of this.nodes) {
|
|
532
|
-
result += item.formatToWGSL(context, depth) + ";\r\n";
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
else {
|
|
536
|
-
result += ";\r\n";
|
|
537
|
-
}
|
|
538
|
-
return result;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* @internal
|
|
543
|
-
* Statement node: for
|
|
544
|
-
* @group GFX
|
|
545
|
-
*/
|
|
546
|
-
export class SN_ForLoop extends StatementNode {
|
|
547
|
-
constructor(expression1, condition, expression2, loopBody) {
|
|
548
|
-
super();
|
|
549
|
-
this.expression1 = expression1;
|
|
550
|
-
this.condition = condition;
|
|
551
|
-
this.expression2 = expression2;
|
|
552
|
-
this.loopBody = loopBody;
|
|
553
|
-
}
|
|
554
|
-
static parse(r) {
|
|
555
|
-
if (r.peekToken(0).Type == TokenType.FOR &&
|
|
556
|
-
r.peekToken(1).Type == TokenType.LEFTSAMLL) {
|
|
557
|
-
r.skipToken(2);
|
|
558
|
-
let expression1;
|
|
559
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
560
|
-
r.skipToken(1);
|
|
561
|
-
expression1 = new SN_Expression();
|
|
562
|
-
}
|
|
563
|
-
else if (r.peekToken(0).isDataType() &&
|
|
564
|
-
r.peekToken(1).Type == TokenType.IDENT &&
|
|
565
|
-
r.peekToken(2).Type == TokenType.ASSIGN) {
|
|
566
|
-
expression1 = new SN_Declaration(r.peekToken(0).Literal, r.peekToken(1).Literal);
|
|
567
|
-
r.skipToken(1);
|
|
568
|
-
expression1.addNode(SN_Expression.parse(r));
|
|
569
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
570
|
-
r.skipToken(1);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
else {
|
|
574
|
-
expression1 = SN_Expression.parse(r);
|
|
575
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
576
|
-
r.skipToken(1);
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
let condition;
|
|
580
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
581
|
-
r.skipToken(1);
|
|
582
|
-
condition = new SN_Expression();
|
|
583
|
-
}
|
|
584
|
-
else {
|
|
585
|
-
condition = SN_Expression.parse(r);
|
|
586
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
587
|
-
r.skipToken(1);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
let expression2;
|
|
591
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
592
|
-
r.skipToken(1);
|
|
593
|
-
expression2 = new SN_Expression();
|
|
594
|
-
}
|
|
595
|
-
else {
|
|
596
|
-
expression2 = SN_Expression.parse(r);
|
|
597
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
598
|
-
r.skipToken(1);
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
if (r.peekToken(0).Type == TokenType.RIGHTSAMLL) {
|
|
602
|
-
r.skipToken(1);
|
|
603
|
-
}
|
|
604
|
-
let loopBody;
|
|
605
|
-
if (r.peekToken(0).Type == TokenType.LEFTBIG) {
|
|
606
|
-
loopBody = SN_CodeBlock.parse(r);
|
|
607
|
-
}
|
|
608
|
-
else {
|
|
609
|
-
loopBody = new SN_CodeBlock();
|
|
610
|
-
}
|
|
611
|
-
return new SN_ForLoop(expression1, condition, expression2, loopBody);
|
|
612
|
-
}
|
|
613
|
-
throw "Error parsing for loop: Unexpected character";
|
|
614
|
-
}
|
|
615
|
-
formatToWGSL(context, depth) {
|
|
616
|
-
let result = "";
|
|
617
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
618
|
-
result += prefix + "for (";
|
|
619
|
-
result += this.expression1.formatToWGSL(context, 0) + "; ";
|
|
620
|
-
result += this.condition.formatToWGSL(context, 0) + "; ";
|
|
621
|
-
result += this.expression2.formatToWGSL(context, 0) + ")";
|
|
622
|
-
result += " { \r\n";
|
|
623
|
-
for (let item of this.loopBody.nodes) {
|
|
624
|
-
result += item.formatToWGSL(context, depth + 1);
|
|
625
|
-
if (!(item instanceof SN_IFBranch) &&
|
|
626
|
-
!(item instanceof SN_WhileLoop) &&
|
|
627
|
-
!(item instanceof SN_ForLoop)) {
|
|
628
|
-
result += ";\r\n";
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
result += prefix + "} \r\n";
|
|
632
|
-
return result;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* @internal
|
|
637
|
-
* Statement node: while
|
|
638
|
-
* @group GFX
|
|
639
|
-
*/
|
|
640
|
-
export class SN_WhileLoop extends StatementNode {
|
|
641
|
-
constructor(condition, loopBody) {
|
|
642
|
-
super();
|
|
643
|
-
this.conditionExpr = condition;
|
|
644
|
-
this.loopBody = loopBody;
|
|
645
|
-
}
|
|
646
|
-
static parse(r) {
|
|
647
|
-
if (r.peekToken(0).Type == TokenType.WHILE) {
|
|
648
|
-
r.skipToken(1);
|
|
649
|
-
if (r.peekToken(0).Type == TokenType.LEFTSAMLL) {
|
|
650
|
-
r.skipToken(1);
|
|
651
|
-
}
|
|
652
|
-
let condition = SN_Expression.parse(r);
|
|
653
|
-
if (r.peekToken(0).Type == TokenType.RIGHTSAMLL) {
|
|
654
|
-
r.skipToken(1);
|
|
655
|
-
}
|
|
656
|
-
let loopBody = SN_CodeBlock.parse(r);
|
|
657
|
-
return new SN_WhileLoop(condition, loopBody);
|
|
658
|
-
}
|
|
659
|
-
throw "Error parsing while loop: Unexpected character";
|
|
660
|
-
}
|
|
661
|
-
formatToWGSL(context, depth) {
|
|
662
|
-
let result = "";
|
|
663
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
664
|
-
result += prefix + "loop {\r\n";
|
|
665
|
-
result +=
|
|
666
|
-
prefix +
|
|
667
|
-
" if (" +
|
|
668
|
-
this.conditionExpr.formatToWGSL(context, 0) +
|
|
669
|
-
") { break; }\r\n\r\n";
|
|
670
|
-
for (let item of this.loopBody.nodes) {
|
|
671
|
-
result += item.formatToWGSL(context, depth + 1);
|
|
672
|
-
if (!(item instanceof SN_IFBranch) &&
|
|
673
|
-
!(item instanceof SN_WhileLoop) &&
|
|
674
|
-
!(item instanceof SN_ForLoop)) {
|
|
675
|
-
result += ";\r\n";
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
result += prefix + "}\r\n";
|
|
679
|
-
return result;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
/**
|
|
683
|
-
* @internal
|
|
684
|
-
* Statement node: do-while
|
|
685
|
-
* @group GFX
|
|
686
|
-
*/
|
|
687
|
-
export class SN_DoWhileLoop extends StatementNode {
|
|
688
|
-
constructor() {
|
|
689
|
-
super();
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* @internal
|
|
694
|
-
* Statement node: if
|
|
695
|
-
* @group GFX
|
|
696
|
-
*/
|
|
697
|
-
export class SN_IFBranch extends StatementNode {
|
|
698
|
-
constructor(condition, trueBranch, falseBranch) {
|
|
699
|
-
super();
|
|
700
|
-
this.conditionExpr = condition;
|
|
701
|
-
this.trueBranch = trueBranch;
|
|
702
|
-
this.falseBranch = falseBranch;
|
|
703
|
-
}
|
|
704
|
-
static parse(r) {
|
|
705
|
-
if (r.peekToken(0).Type == TokenType.IF) {
|
|
706
|
-
r.skipToken(1);
|
|
707
|
-
if (r.peekToken(0).Type == TokenType.LEFTSAMLL) {
|
|
708
|
-
r.skipToken(1);
|
|
709
|
-
}
|
|
710
|
-
let condition = SN_Expression.parse(r);
|
|
711
|
-
let trueBranch;
|
|
712
|
-
let falseBranch = new SN_CodeBlock();
|
|
713
|
-
if (r.peekToken(0).Type == TokenType.RIGHTSAMLL) {
|
|
714
|
-
r.skipToken(1);
|
|
715
|
-
}
|
|
716
|
-
if (r.peekToken(0).Type == TokenType.LEFTBIG) {
|
|
717
|
-
trueBranch = SN_CodeBlock.parse(r);
|
|
718
|
-
}
|
|
719
|
-
else {
|
|
720
|
-
trueBranch = new SN_CodeBlock();
|
|
721
|
-
if (r.peekToken(0).Type == TokenType.RETURN) {
|
|
722
|
-
trueBranch.addNode(SN_Return.parse(r));
|
|
723
|
-
}
|
|
724
|
-
else {
|
|
725
|
-
trueBranch.addNode(SN_Expression.parse(r));
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
if (r.peekToken(0).Type == TokenType.ELSE) {
|
|
729
|
-
r.skipToken(1);
|
|
730
|
-
if (r.peekToken(0).Type == TokenType.LEFTBIG) {
|
|
731
|
-
falseBranch = SN_CodeBlock.parse(r);
|
|
732
|
-
}
|
|
733
|
-
else
|
|
734
|
-
throw "not impl";
|
|
735
|
-
}
|
|
736
|
-
return new SN_IFBranch(condition, trueBranch, falseBranch);
|
|
737
|
-
}
|
|
738
|
-
throw "Error parsing IF branch statement: Unexpected character";
|
|
739
|
-
}
|
|
740
|
-
formatToWGSL(context, depth) {
|
|
741
|
-
let resultl = "";
|
|
742
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
743
|
-
resultl +=
|
|
744
|
-
prefix + "if (" + this.conditionExpr.formatToWGSL(context, 0) + ") {\r\n";
|
|
745
|
-
for (let item of this.trueBranch.nodes) {
|
|
746
|
-
resultl += item.formatToWGSL(context, depth + 1) + ";\r\n";
|
|
747
|
-
}
|
|
748
|
-
if (this.falseBranch.nodes.length > 0) {
|
|
749
|
-
resultl += prefix + "} else {\r\n";
|
|
750
|
-
for (let item of this.falseBranch.nodes) {
|
|
751
|
-
resultl += item.formatToWGSL(context, depth + 1) + ";\r\n";
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
resultl += prefix + "}\r\n";
|
|
755
|
-
return resultl;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* @internal
|
|
760
|
-
* Statement node: expression
|
|
761
|
-
* @group GFX
|
|
762
|
-
*/
|
|
763
|
-
export class SN_Expression extends StatementNode {
|
|
764
|
-
constructor() {
|
|
765
|
-
super();
|
|
766
|
-
}
|
|
767
|
-
static parse(r) {
|
|
768
|
-
let opStack = new Array();
|
|
769
|
-
let valueStack = new Array();
|
|
770
|
-
let nSamllCount = 0;
|
|
771
|
-
while (r.peekToken(0).Type != TokenType.EOF) {
|
|
772
|
-
let currToken = r.peekToken(0);
|
|
773
|
-
if (currToken.Type == TokenType.SEMICOLON ||
|
|
774
|
-
currToken.Type == TokenType.RIGHTMEDI) {
|
|
775
|
-
// r.SkipToken(1);
|
|
776
|
-
break;
|
|
777
|
-
}
|
|
778
|
-
if (currToken.Type == TokenType.COMMA ||
|
|
779
|
-
currToken.Type == TokenType.COLON ||
|
|
780
|
-
currToken.Type == TokenType.RIGHTBIG) {
|
|
781
|
-
break;
|
|
782
|
-
}
|
|
783
|
-
if (!currToken.isOperation()) {
|
|
784
|
-
if (currToken.Type == TokenType.LITERAL) {
|
|
785
|
-
valueStack.push(new SN_Constant(currToken.Literal));
|
|
786
|
-
r.skipToken(1);
|
|
787
|
-
continue;
|
|
788
|
-
}
|
|
789
|
-
else if (currToken.Type == TokenType.LEFTSAMLL) {
|
|
790
|
-
nSamllCount++;
|
|
791
|
-
opStack.push(currToken);
|
|
792
|
-
r.skipToken(1);
|
|
793
|
-
continue;
|
|
794
|
-
}
|
|
795
|
-
else if (currToken.Type == TokenType.RIGHTSAMLL) {
|
|
796
|
-
if (nSamllCount <= 0) {
|
|
797
|
-
break;
|
|
798
|
-
}
|
|
799
|
-
nSamllCount--;
|
|
800
|
-
while (SN_Expression.unionOperation(opStack, valueStack))
|
|
801
|
-
;
|
|
802
|
-
if (opStack[opStack.length - 1].Type == TokenType.LEFTSAMLL) {
|
|
803
|
-
opStack.pop();
|
|
804
|
-
let parenExpr = new SN_ParenExpression();
|
|
805
|
-
parenExpr.addNode(valueStack.pop());
|
|
806
|
-
valueStack.push(parenExpr);
|
|
807
|
-
}
|
|
808
|
-
r.skipToken(1);
|
|
809
|
-
continue;
|
|
810
|
-
}
|
|
811
|
-
else if (currToken.Type == TokenType.IDENT) {
|
|
812
|
-
// a++
|
|
813
|
-
if (r.peekToken(1).Type == TokenType.INC ||
|
|
814
|
-
r.peekToken(1).Type == TokenType.DEC) {
|
|
815
|
-
let op = r.peekToken(1);
|
|
816
|
-
let value = new SN_Identifier(currToken.Literal);
|
|
817
|
-
valueStack.push(new SN_UnaryOperation(op, value, undefined));
|
|
818
|
-
r.skipToken(2);
|
|
819
|
-
continue;
|
|
820
|
-
}
|
|
821
|
-
// func(...)
|
|
822
|
-
else if (r.peekToken(1).Type == TokenType.LEFTSAMLL) {
|
|
823
|
-
valueStack.push(SN_FunctionCall.parse(r));
|
|
824
|
-
continue;
|
|
825
|
-
}
|
|
826
|
-
// a.b
|
|
827
|
-
else if (r.peekToken(1).Type == TokenType.DOT) {
|
|
828
|
-
valueStack.push(SN_SelectOperation.parse(r));
|
|
829
|
-
continue;
|
|
830
|
-
}
|
|
831
|
-
// a[xxx]
|
|
832
|
-
else if (r.peekToken(1).Type == TokenType.LEFTMEDI) {
|
|
833
|
-
valueStack.push(SN_IndexOperation.parse(r));
|
|
834
|
-
continue;
|
|
835
|
-
}
|
|
836
|
-
valueStack.push(new SN_Identifier(currToken.Literal));
|
|
837
|
-
r.skipToken(1);
|
|
838
|
-
continue;
|
|
839
|
-
}
|
|
840
|
-
else {
|
|
841
|
-
// type(...)
|
|
842
|
-
if (currToken.isBuiltinType() &&
|
|
843
|
-
r.peekToken(1).Type == TokenType.LEFTSAMLL) {
|
|
844
|
-
valueStack.push(SN_FunctionCall.parse(r));
|
|
845
|
-
continue;
|
|
846
|
-
}
|
|
847
|
-
// a += xxx
|
|
848
|
-
if (currToken.isAssignOperation()) {
|
|
849
|
-
let op = currToken;
|
|
850
|
-
r.skipToken(1);
|
|
851
|
-
let lValue = valueStack.pop();
|
|
852
|
-
let rValue = SN_Expression.parse(r);
|
|
853
|
-
valueStack.push(new SN_BinaryOperation(op, lValue, rValue));
|
|
854
|
-
continue;
|
|
855
|
-
}
|
|
856
|
-
// { 1.0, 2.0, 3.0 }
|
|
857
|
-
if (currToken.Type == TokenType.LEFTBIG &&
|
|
858
|
-
(r.peekToken(1).Type == TokenType.LITERAL ||
|
|
859
|
-
(r.peekToken(1).Type == TokenType.SUB &&
|
|
860
|
-
r.peekToken(2).Type == TokenType.LITERAL))) {
|
|
861
|
-
valueStack.push(SN_ArrayConstant.parse(r));
|
|
862
|
-
continue;
|
|
863
|
-
}
|
|
864
|
-
// xx ? xx : xx
|
|
865
|
-
if (currToken.Type == TokenType.QUEMARK) {
|
|
866
|
-
if (opStack.length > 0) {
|
|
867
|
-
let opToken = opStack[opStack.length - 1];
|
|
868
|
-
if (opToken.nOperationPriorityLevel <=
|
|
869
|
-
currToken.nOperationPriorityLevel) {
|
|
870
|
-
SN_Expression.unionOperation(opStack, valueStack);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
r.skipToken(1);
|
|
874
|
-
let a = valueStack.pop();
|
|
875
|
-
let b = SN_Expression.parse(r);
|
|
876
|
-
if (r.peekToken(0).Type == TokenType.COLON) {
|
|
877
|
-
r.skipToken(1);
|
|
878
|
-
}
|
|
879
|
-
let c = SN_Expression.parse(r);
|
|
880
|
-
valueStack.push(new SN_TernaryOperation(a, b, c));
|
|
881
|
-
if (r.peekToken(-1).Type == TokenType.SEMICOLON) {
|
|
882
|
-
break;
|
|
883
|
-
}
|
|
884
|
-
continue;
|
|
885
|
-
}
|
|
886
|
-
// xxx[xxx]
|
|
887
|
-
if (currToken.Type == TokenType.LEFTMEDI) {
|
|
888
|
-
r.skipToken(1);
|
|
889
|
-
let indexValue = SN_Expression.parse(r);
|
|
890
|
-
if (r.peekToken(0).Type == TokenType.RIGHTMEDI) {
|
|
891
|
-
r.skipToken(1);
|
|
892
|
-
}
|
|
893
|
-
let lValue = valueStack.pop();
|
|
894
|
-
valueStack.push(new SN_IndexOperation(lValue, indexValue));
|
|
895
|
-
continue;
|
|
896
|
-
}
|
|
897
|
-
throw "An unexpected character";
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
else if (currToken.isOperation()) {
|
|
901
|
-
// ++a, --a
|
|
902
|
-
if (currToken.Type == TokenType.INC ||
|
|
903
|
-
currToken.Type == TokenType.DEC) {
|
|
904
|
-
let op = currToken;
|
|
905
|
-
r.skipToken(1);
|
|
906
|
-
let value = SN_Expression.parse(r);
|
|
907
|
-
valueStack.push(new SN_UnaryOperation(op, undefined, value));
|
|
908
|
-
continue;
|
|
909
|
-
}
|
|
910
|
-
else if (opStack.length > 0) {
|
|
911
|
-
let opToken = opStack[opStack.length - 1];
|
|
912
|
-
if (opToken.nOperationPriorityLevel <= currToken.nOperationPriorityLevel) {
|
|
913
|
-
SN_Expression.unionOperation(opStack, valueStack);
|
|
914
|
-
}
|
|
915
|
-
else if (opStack.length > 0 &&
|
|
916
|
-
opStack[opStack.length - 1].Literal == "-") {
|
|
917
|
-
let op = opStack.pop();
|
|
918
|
-
let v1 = valueStack.pop();
|
|
919
|
-
valueStack.push(new SN_UnaryOperation(op, undefined, v1));
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
opStack.push(currToken);
|
|
923
|
-
r.skipToken(1);
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
while (opStack.length > 0 &&
|
|
927
|
-
SN_Expression.unionOperation(opStack, valueStack))
|
|
928
|
-
;
|
|
929
|
-
if (opStack.length <= 0 && valueStack.length == 1) {
|
|
930
|
-
let expr = new SN_Expression();
|
|
931
|
-
expr.addNode(valueStack.pop());
|
|
932
|
-
return expr;
|
|
933
|
-
}
|
|
934
|
-
throw ("Error parsing expression: Unexpected character(" +
|
|
935
|
-
r.peekToken(0).Literal +
|
|
936
|
-
")");
|
|
937
|
-
}
|
|
938
|
-
formatToWGSL(context, depth) {
|
|
939
|
-
return this.nodes[0].formatToWGSL(context, depth);
|
|
940
|
-
}
|
|
941
|
-
static unionOperation(opStack, valueStack) {
|
|
942
|
-
if (opStack.length < 0 || valueStack.length < 2) {
|
|
943
|
-
if (opStack.length > 0 && opStack[opStack.length - 1].Literal == "-") {
|
|
944
|
-
let op = opStack.pop();
|
|
945
|
-
let v1 = valueStack.pop();
|
|
946
|
-
valueStack.push(new SN_UnaryOperation(op, undefined, v1));
|
|
947
|
-
return true;
|
|
948
|
-
}
|
|
949
|
-
return false;
|
|
950
|
-
}
|
|
951
|
-
if (opStack[opStack.length - 1].isOperation()) {
|
|
952
|
-
let v2 = valueStack.pop();
|
|
953
|
-
let op = opStack.pop();
|
|
954
|
-
let v1 = valueStack.pop();
|
|
955
|
-
if (op.Type == TokenType.DOT) {
|
|
956
|
-
valueStack.push(new SN_SelectOperation(v1, v2));
|
|
957
|
-
}
|
|
958
|
-
else {
|
|
959
|
-
valueStack.push(new SN_BinaryOperation(op, v1, v2));
|
|
960
|
-
}
|
|
961
|
-
return true;
|
|
962
|
-
}
|
|
963
|
-
return false;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
/**
|
|
967
|
-
* @internal
|
|
968
|
-
* Statement node: Paren expression
|
|
969
|
-
* @group GFX
|
|
970
|
-
*/
|
|
971
|
-
export class SN_ParenExpression extends StatementNode {
|
|
972
|
-
constructor() {
|
|
973
|
-
super();
|
|
974
|
-
}
|
|
975
|
-
formatToWGSL(context, depth) {
|
|
976
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
977
|
-
let result = prefix + "(" + this.nodes[0].formatToWGSL(context, 0) + ")";
|
|
978
|
-
return result;
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
/**
|
|
982
|
-
* @internal
|
|
983
|
-
* Statement node: identifier
|
|
984
|
-
* @group GFX
|
|
985
|
-
*/
|
|
986
|
-
export class SN_Identifier extends StatementNode {
|
|
987
|
-
constructor(name) {
|
|
988
|
-
super();
|
|
989
|
-
this.name = name;
|
|
990
|
-
}
|
|
991
|
-
formatToWGSL(context, depth) {
|
|
992
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
993
|
-
return prefix + context.findIdentifier(this.name);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
/**
|
|
997
|
-
* @internal
|
|
998
|
-
* Statement node: constant
|
|
999
|
-
* @group GFX
|
|
1000
|
-
*/
|
|
1001
|
-
export class SN_Constant extends StatementNode {
|
|
1002
|
-
constructor(value) {
|
|
1003
|
-
super();
|
|
1004
|
-
this.value = value;
|
|
1005
|
-
}
|
|
1006
|
-
static parse(r) {
|
|
1007
|
-
let firstToken = r.peekToken(0);
|
|
1008
|
-
// -1
|
|
1009
|
-
if (firstToken.Type == TokenType.SUB &&
|
|
1010
|
-
r.peekToken(1).Type == TokenType.LITERAL) {
|
|
1011
|
-
let result = new SN_Constant("-" + r.peekToken(1).Literal);
|
|
1012
|
-
r.skipToken(2);
|
|
1013
|
-
return result;
|
|
1014
|
-
}
|
|
1015
|
-
// 1
|
|
1016
|
-
else if (firstToken.Type == TokenType.LITERAL) {
|
|
1017
|
-
let result = new SN_Constant(firstToken.Literal);
|
|
1018
|
-
r.skipToken(1);
|
|
1019
|
-
return result;
|
|
1020
|
-
}
|
|
1021
|
-
throw ("Error parsing literal constants: Unexpected characters(" +
|
|
1022
|
-
firstToken.Literal +
|
|
1023
|
-
")");
|
|
1024
|
-
}
|
|
1025
|
-
formatToWGSL(context, depth) {
|
|
1026
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
1027
|
-
return prefix + this.value;
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
/**
|
|
1031
|
-
* @internal
|
|
1032
|
-
* Statement node: array constant
|
|
1033
|
-
* @group GFX
|
|
1034
|
-
*/
|
|
1035
|
-
export class SN_ArrayConstant extends SN_Constant {
|
|
1036
|
-
constructor(value) {
|
|
1037
|
-
super("");
|
|
1038
|
-
this.arrayValue = value;
|
|
1039
|
-
}
|
|
1040
|
-
static parse(r) {
|
|
1041
|
-
if (
|
|
1042
|
-
// { 1, 2, 3, 4 }
|
|
1043
|
-
(r.peekToken(0).Type == TokenType.LEFTBIG &&
|
|
1044
|
-
r.peekToken(1).Type == TokenType.LITERAL) ||
|
|
1045
|
-
// { -1, 2, 3, 4 }
|
|
1046
|
-
(r.peekToken(0).Type == TokenType.LEFTBIG &&
|
|
1047
|
-
r.peekToken(1).Type == TokenType.SUB &&
|
|
1048
|
-
r.peekToken(2).Type == TokenType.LITERAL)) {
|
|
1049
|
-
r.skipToken(1);
|
|
1050
|
-
let arrayValue = [];
|
|
1051
|
-
while (r.peekToken(0).Type != TokenType.RIGHTBIG) {
|
|
1052
|
-
if (r.peekToken(0).Type == TokenType.LEFTSAMLL) {
|
|
1053
|
-
arrayValue.push(SN_ArrayConstant.parse(r));
|
|
1054
|
-
continue;
|
|
1055
|
-
}
|
|
1056
|
-
arrayValue.push(SN_Constant.parse(r));
|
|
1057
|
-
if (r.peekToken(0).Type == TokenType.COMMA) {
|
|
1058
|
-
r.skipToken(1);
|
|
1059
|
-
continue;
|
|
1060
|
-
}
|
|
1061
|
-
else if (r.peekToken(0).Type == TokenType.RIGHTBIG) {
|
|
1062
|
-
r.skipToken(1);
|
|
1063
|
-
break;
|
|
1064
|
-
}
|
|
1065
|
-
else
|
|
1066
|
-
throw "Error parsing array constants: Unexpected characters";
|
|
1067
|
-
}
|
|
1068
|
-
return new SN_ArrayConstant(arrayValue);
|
|
1069
|
-
}
|
|
1070
|
-
throw "Error parsing array constants: Unexpected characters";
|
|
1071
|
-
}
|
|
1072
|
-
formatToWGSL(context, depth) {
|
|
1073
|
-
let result = "";
|
|
1074
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
1075
|
-
if (this.arrayValue[0].value.includes(".")) {
|
|
1076
|
-
result +=
|
|
1077
|
-
prefix + "array<f32, " + this.arrayValue.length.toString() + ">(";
|
|
1078
|
-
}
|
|
1079
|
-
else {
|
|
1080
|
-
result +=
|
|
1081
|
-
prefix + "array<i32, " + this.arrayValue.length.toString() + ">(";
|
|
1082
|
-
}
|
|
1083
|
-
for (let i = 0; i < this.arrayValue.length; i++) {
|
|
1084
|
-
if (i > 0) {
|
|
1085
|
-
result += ", ";
|
|
1086
|
-
}
|
|
1087
|
-
result += this.arrayValue[i].formatToWGSL(context, 0);
|
|
1088
|
-
}
|
|
1089
|
-
result += ")";
|
|
1090
|
-
return result;
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* @internal
|
|
1095
|
-
* Statement node: process control(break)
|
|
1096
|
-
* @group GFX
|
|
1097
|
-
*/
|
|
1098
|
-
export class SN_Break extends StatementNode {
|
|
1099
|
-
constructor() {
|
|
1100
|
-
super();
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* @internal
|
|
1105
|
-
* Statement node: process control(discard)
|
|
1106
|
-
* @group GFX
|
|
1107
|
-
*/
|
|
1108
|
-
export class SN_Discard extends StatementNode {
|
|
1109
|
-
constructor() {
|
|
1110
|
-
super();
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* @internal
|
|
1115
|
-
* Statement node: process control(continue)
|
|
1116
|
-
* @group GFX
|
|
1117
|
-
*/
|
|
1118
|
-
export class SN_Continue extends StatementNode {
|
|
1119
|
-
constructor() {
|
|
1120
|
-
super();
|
|
1121
|
-
}
|
|
1122
|
-
static parse(r) {
|
|
1123
|
-
if (r.peekToken(0).Type == TokenType.CONTINUE &&
|
|
1124
|
-
r.peekToken(1).Type == TokenType.SEMICOLON) {
|
|
1125
|
-
r.skipToken(2);
|
|
1126
|
-
return new SN_Continue();
|
|
1127
|
-
}
|
|
1128
|
-
throw "Error parsing continue: Unexpected character";
|
|
1129
|
-
}
|
|
1130
|
-
formatToWGSL(context, depth) {
|
|
1131
|
-
let result = "";
|
|
1132
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
1133
|
-
result += prefix + "continue";
|
|
1134
|
-
return result;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* @internal
|
|
1139
|
-
* Statement node: process control(return)
|
|
1140
|
-
* @group GFX
|
|
1141
|
-
*/
|
|
1142
|
-
export class SN_Return extends StatementNode {
|
|
1143
|
-
constructor(value) {
|
|
1144
|
-
super();
|
|
1145
|
-
this.value = value;
|
|
1146
|
-
}
|
|
1147
|
-
static parse(r) {
|
|
1148
|
-
if (r.peekToken(0).Type == TokenType.RETURN) {
|
|
1149
|
-
r.skipToken(1);
|
|
1150
|
-
let expr = SN_Expression.parse(r);
|
|
1151
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
1152
|
-
r.skipToken(1);
|
|
1153
|
-
}
|
|
1154
|
-
return new SN_Return(expr);
|
|
1155
|
-
}
|
|
1156
|
-
throw "Error parsing return expression: Unexpected character";
|
|
1157
|
-
}
|
|
1158
|
-
formatToWGSL(context, depth) {
|
|
1159
|
-
let result = "";
|
|
1160
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
1161
|
-
result += prefix + "return " + this.value.formatToWGSL(context, 0);
|
|
1162
|
-
return result;
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
/**
|
|
1166
|
-
* @internal
|
|
1167
|
-
* Statement node: unary operation
|
|
1168
|
-
* @group GFX
|
|
1169
|
-
*/
|
|
1170
|
-
export class SN_UnaryOperation extends StatementNode {
|
|
1171
|
-
constructor(op, lValue, rValue) {
|
|
1172
|
-
super();
|
|
1173
|
-
this.op = op;
|
|
1174
|
-
this.leftValue = lValue;
|
|
1175
|
-
this.rightValue = rValue;
|
|
1176
|
-
}
|
|
1177
|
-
formatToWGSL(context, depth) {
|
|
1178
|
-
let result = "";
|
|
1179
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
1180
|
-
if (this.op.Literal == "++" || this.op.Literal == "--") {
|
|
1181
|
-
if (this.leftValue != undefined) {
|
|
1182
|
-
let lValue = this.leftValue.formatToWGSL(context, 0);
|
|
1183
|
-
result +=
|
|
1184
|
-
prefix + lValue + " = " + lValue + " " + this.op.Literal[0] + " 1";
|
|
1185
|
-
}
|
|
1186
|
-
else {
|
|
1187
|
-
let rValue = this.rightValue.formatToWGSL(context, 0);
|
|
1188
|
-
result +=
|
|
1189
|
-
prefix + rValue + " = " + rValue + " " + this.op.Literal[0] + " 1";
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
else {
|
|
1193
|
-
if (this.leftValue != undefined) {
|
|
1194
|
-
result +=
|
|
1195
|
-
prefix + this.leftValue.formatToWGSL(context, 0) + this.op.Literal;
|
|
1196
|
-
}
|
|
1197
|
-
else {
|
|
1198
|
-
result +=
|
|
1199
|
-
prefix + this.op.Literal + this.rightValue.formatToWGSL(context, 0);
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
return result;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
/**
|
|
1206
|
-
* @internal
|
|
1207
|
-
* Statement node: binary operation
|
|
1208
|
-
* @group GFX
|
|
1209
|
-
*/
|
|
1210
|
-
export class SN_BinaryOperation extends StatementNode {
|
|
1211
|
-
constructor(op, lValue, rValue) {
|
|
1212
|
-
super();
|
|
1213
|
-
this.op = op;
|
|
1214
|
-
this.leftValue = lValue;
|
|
1215
|
-
this.rightValue = rValue;
|
|
1216
|
-
}
|
|
1217
|
-
formatToWGSL(context, depth) {
|
|
1218
|
-
let result = "";
|
|
1219
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
1220
|
-
result +=
|
|
1221
|
-
prefix +
|
|
1222
|
-
this.leftValue.formatToWGSL(context, 0) +
|
|
1223
|
-
" " +
|
|
1224
|
-
this.op.Literal +
|
|
1225
|
-
" " +
|
|
1226
|
-
this.rightValue.formatToWGSL(context, 0);
|
|
1227
|
-
return result;
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
* @internal
|
|
1232
|
-
* Statement node: ternary operation
|
|
1233
|
-
* @group GFX
|
|
1234
|
-
*/
|
|
1235
|
-
export class SN_TernaryOperation extends StatementNode {
|
|
1236
|
-
constructor(condition, expression1, expression2) {
|
|
1237
|
-
super();
|
|
1238
|
-
this.condition = condition;
|
|
1239
|
-
this.expression1 = expression1;
|
|
1240
|
-
this.expression2 = expression2;
|
|
1241
|
-
}
|
|
1242
|
-
static parse(r) {
|
|
1243
|
-
throw "Error parsing ternary operation expression: Unexpected character";
|
|
1244
|
-
}
|
|
1245
|
-
formatToWGSL(context, depth) {
|
|
1246
|
-
return "";
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
/**
|
|
1250
|
-
* @internal
|
|
1251
|
-
* Statement node: Expression of select(a.b)
|
|
1252
|
-
* @group GFX
|
|
1253
|
-
*/
|
|
1254
|
-
export class SN_SelectOperation extends StatementNode {
|
|
1255
|
-
constructor(lValue, rValue) {
|
|
1256
|
-
super();
|
|
1257
|
-
this.leftValue = lValue;
|
|
1258
|
-
this.rightValue = rValue;
|
|
1259
|
-
}
|
|
1260
|
-
static parse(r) {
|
|
1261
|
-
if (r.peekToken(0).Type == TokenType.IDENT &&
|
|
1262
|
-
r.peekToken(1).Type == TokenType.DOT &&
|
|
1263
|
-
r.peekToken(2).Type == TokenType.IDENT) {
|
|
1264
|
-
let lValue = new SN_Identifier(r.peekToken(0).Literal);
|
|
1265
|
-
let rValue = new SN_Identifier(r.peekToken(2).Literal);
|
|
1266
|
-
r.skipToken(3);
|
|
1267
|
-
return new SN_SelectOperation(lValue, rValue);
|
|
1268
|
-
}
|
|
1269
|
-
throw "Error parsing selection expression: Unexpected character";
|
|
1270
|
-
}
|
|
1271
|
-
formatToWGSL(context, depth) {
|
|
1272
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
1273
|
-
return (prefix +
|
|
1274
|
-
this.leftValue.formatToWGSL(context, 0) +
|
|
1275
|
-
"." +
|
|
1276
|
-
this.rightValue.formatToWGSL(context, 0));
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
/**
|
|
1280
|
-
* @internal
|
|
1281
|
-
* Statement node: Expression of index(a[b])
|
|
1282
|
-
* @group GFX
|
|
1283
|
-
*/
|
|
1284
|
-
export class SN_IndexOperation extends StatementNode {
|
|
1285
|
-
constructor(lValue, indexValue) {
|
|
1286
|
-
super();
|
|
1287
|
-
this.leftValue = lValue;
|
|
1288
|
-
this.indexValue = indexValue;
|
|
1289
|
-
}
|
|
1290
|
-
static parse(r) {
|
|
1291
|
-
if (r.peekToken(0).Type == TokenType.IDENT &&
|
|
1292
|
-
r.peekToken(1).Type == TokenType.LEFTMEDI) {
|
|
1293
|
-
let lValue = new SN_Identifier(r.peekToken(0).Literal);
|
|
1294
|
-
r.skipToken(2);
|
|
1295
|
-
let indexValue = SN_Expression.parse(r);
|
|
1296
|
-
if (r.peekToken(0).Type == TokenType.RIGHTMEDI) {
|
|
1297
|
-
r.skipToken(1);
|
|
1298
|
-
}
|
|
1299
|
-
let result = new SN_IndexOperation(lValue, indexValue);
|
|
1300
|
-
while (r.peekToken(0).Type == TokenType.LEFTMEDI) {
|
|
1301
|
-
r.skipToken(1);
|
|
1302
|
-
indexValue = SN_Expression.parse(r);
|
|
1303
|
-
if (r.peekToken(0).Type == TokenType.RIGHTMEDI) {
|
|
1304
|
-
r.skipToken(1);
|
|
1305
|
-
}
|
|
1306
|
-
result = new SN_IndexOperation(result, indexValue);
|
|
1307
|
-
}
|
|
1308
|
-
return result;
|
|
1309
|
-
}
|
|
1310
|
-
throw "Error parsing index expression: Unexpected character";
|
|
1311
|
-
}
|
|
1312
|
-
formatToWGSL(context, depth) {
|
|
1313
|
-
let prefix = depth <= 0 ? "" : " ".repeat(depth);
|
|
1314
|
-
return (prefix +
|
|
1315
|
-
this.leftValue.formatToWGSL(context, 0) +
|
|
1316
|
-
"[" +
|
|
1317
|
-
this.indexValue.formatToWGSL(context, 0) +
|
|
1318
|
-
"]");
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
/**
|
|
1322
|
-
* @internal
|
|
1323
|
-
* Statement node: code block
|
|
1324
|
-
* @group GFX
|
|
1325
|
-
*/
|
|
1326
|
-
export class SN_CodeBlock extends StatementNode {
|
|
1327
|
-
constructor() {
|
|
1328
|
-
super();
|
|
1329
|
-
}
|
|
1330
|
-
static parse(r) {
|
|
1331
|
-
if (r.peekToken(0).Type == TokenType.LEFTBIG) {
|
|
1332
|
-
r.skipToken(1);
|
|
1333
|
-
let result = new SN_CodeBlock();
|
|
1334
|
-
for (let count = 1; count > 0 && r.peekToken(0).Type != TokenType.EOF;) {
|
|
1335
|
-
let currToken = r.peekToken(0);
|
|
1336
|
-
if (currToken.Type == TokenType.LEFTBIG) {
|
|
1337
|
-
count++;
|
|
1338
|
-
r.skipToken(1);
|
|
1339
|
-
continue;
|
|
1340
|
-
}
|
|
1341
|
-
if (currToken.Type == TokenType.RIGHTBIG) {
|
|
1342
|
-
count--;
|
|
1343
|
-
r.skipToken(1);
|
|
1344
|
-
continue;
|
|
1345
|
-
}
|
|
1346
|
-
/**
|
|
1347
|
-
* nop
|
|
1348
|
-
*/
|
|
1349
|
-
if (currToken.Type == TokenType.SEMICOLON) {
|
|
1350
|
-
r.skipToken(1);
|
|
1351
|
-
continue;
|
|
1352
|
-
}
|
|
1353
|
-
/**
|
|
1354
|
-
* Declaration of variables
|
|
1355
|
-
*/
|
|
1356
|
-
if (currToken.isDataType() && r.peekToken(1).Type == TokenType.IDENT) {
|
|
1357
|
-
result.addNode(SN_Declaration.parse(r));
|
|
1358
|
-
continue;
|
|
1359
|
-
}
|
|
1360
|
-
/**
|
|
1361
|
-
* Declaration of variables
|
|
1362
|
-
*/
|
|
1363
|
-
if (currToken.Type == TokenType.CONST &&
|
|
1364
|
-
r.peekToken(1).isDataType() &&
|
|
1365
|
-
r.peekToken(2).Type == TokenType.IDENT) {
|
|
1366
|
-
result.addNode(SN_Declaration.parse(r));
|
|
1367
|
-
continue;
|
|
1368
|
-
}
|
|
1369
|
-
else if (
|
|
1370
|
-
/**
|
|
1371
|
-
* assignment expression
|
|
1372
|
-
* a = ...;
|
|
1373
|
-
*/
|
|
1374
|
-
currToken.Type == TokenType.IDENT &&
|
|
1375
|
-
r.peekToken(1).Type == TokenType.ASSIGN) {
|
|
1376
|
-
result.addNode(SN_Expression.parse(r));
|
|
1377
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
1378
|
-
r.skipToken(1);
|
|
1379
|
-
}
|
|
1380
|
-
continue;
|
|
1381
|
-
}
|
|
1382
|
-
else if (
|
|
1383
|
-
/**
|
|
1384
|
-
* Expression of index
|
|
1385
|
-
* a[...]
|
|
1386
|
-
*/
|
|
1387
|
-
currToken.Type == TokenType.IDENT &&
|
|
1388
|
-
r.peekToken(1).Type == TokenType.LEFTMEDI) {
|
|
1389
|
-
let indexOperation = SN_IndexOperation.parse(r);
|
|
1390
|
-
// a[...] = xxx;
|
|
1391
|
-
if (r.peekToken(0).Type == TokenType.ASSIGN) {
|
|
1392
|
-
let op = r.peekToken(0);
|
|
1393
|
-
r.skipToken(1);
|
|
1394
|
-
let rValue = SN_Expression.parse(r);
|
|
1395
|
-
if (r.peekToken(0).Type == TokenType.RIGHTMEDI) {
|
|
1396
|
-
r.skipToken(1);
|
|
1397
|
-
}
|
|
1398
|
-
result.addNode(new SN_BinaryOperation(op, indexOperation, rValue));
|
|
1399
|
-
continue;
|
|
1400
|
-
}
|
|
1401
|
-
result.addNode(indexOperation);
|
|
1402
|
-
continue;
|
|
1403
|
-
}
|
|
1404
|
-
else if (
|
|
1405
|
-
/**
|
|
1406
|
-
* Expression of choice
|
|
1407
|
-
* a.b
|
|
1408
|
-
*/
|
|
1409
|
-
currToken.Type == TokenType.IDENT &&
|
|
1410
|
-
r.peekToken(1).Type == TokenType.DOT) {
|
|
1411
|
-
let expr = SN_Expression.parse(r);
|
|
1412
|
-
result.addNode(expr);
|
|
1413
|
-
continue;
|
|
1414
|
-
}
|
|
1415
|
-
else if (
|
|
1416
|
-
/**
|
|
1417
|
-
* Assignment operation expression
|
|
1418
|
-
* a += ...;
|
|
1419
|
-
*/
|
|
1420
|
-
currToken.Type == TokenType.IDENT &&
|
|
1421
|
-
r.peekToken(1).isAssignOperation()) {
|
|
1422
|
-
let op = r.peekToken(1);
|
|
1423
|
-
let lValue = new SN_Identifier(currToken.Literal);
|
|
1424
|
-
r.skipToken(2);
|
|
1425
|
-
let rValue = SN_Expression.parse(r);
|
|
1426
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
1427
|
-
r.skipToken(1);
|
|
1428
|
-
}
|
|
1429
|
-
result.addNode(new SN_BinaryOperation(op, lValue, rValue));
|
|
1430
|
-
continue;
|
|
1431
|
-
}
|
|
1432
|
-
else if (
|
|
1433
|
-
/**
|
|
1434
|
-
* After the increase, after the decrease
|
|
1435
|
-
* a++;
|
|
1436
|
-
*/
|
|
1437
|
-
currToken.Type == TokenType.IDENT &&
|
|
1438
|
-
(r.peekToken(1).Type == TokenType.INC ||
|
|
1439
|
-
r.peekToken(1).Type == TokenType.DEC) &&
|
|
1440
|
-
r.peekToken(2).Type == TokenType.SEMICOLON) {
|
|
1441
|
-
let op = r.peekToken(1);
|
|
1442
|
-
result.addNode(new SN_UnaryOperation(op, new SN_Identifier(currToken.Literal), undefined));
|
|
1443
|
-
r.skipToken(3);
|
|
1444
|
-
continue;
|
|
1445
|
-
}
|
|
1446
|
-
else if (currToken.Type == TokenType.RETURN) {
|
|
1447
|
-
/**
|
|
1448
|
-
* return
|
|
1449
|
-
*/
|
|
1450
|
-
result.addNode(SN_Return.parse(r));
|
|
1451
|
-
continue;
|
|
1452
|
-
}
|
|
1453
|
-
else if (currToken.Type == TokenType.CONTINUE) {
|
|
1454
|
-
/**
|
|
1455
|
-
* continue
|
|
1456
|
-
*/
|
|
1457
|
-
result.addNode(SN_Continue.parse(r));
|
|
1458
|
-
continue;
|
|
1459
|
-
}
|
|
1460
|
-
else if (currToken.Type == TokenType.WHILE) {
|
|
1461
|
-
/**
|
|
1462
|
-
* while
|
|
1463
|
-
*/
|
|
1464
|
-
result.addNode(SN_WhileLoop.parse(r));
|
|
1465
|
-
continue;
|
|
1466
|
-
}
|
|
1467
|
-
else if (currToken.Type == TokenType.FOR) {
|
|
1468
|
-
/**
|
|
1469
|
-
* for
|
|
1470
|
-
*/
|
|
1471
|
-
result.addNode(SN_ForLoop.parse(r));
|
|
1472
|
-
continue;
|
|
1473
|
-
}
|
|
1474
|
-
else if (currToken.Type == TokenType.IF) {
|
|
1475
|
-
/**
|
|
1476
|
-
* if
|
|
1477
|
-
*/
|
|
1478
|
-
result.addNode(SN_IFBranch.parse(r));
|
|
1479
|
-
continue;
|
|
1480
|
-
}
|
|
1481
|
-
else if (
|
|
1482
|
-
/**
|
|
1483
|
-
* function call
|
|
1484
|
-
*/
|
|
1485
|
-
currToken.Type == TokenType.IDENT &&
|
|
1486
|
-
r.peekToken(1).Type == TokenType.LEFTSAMLL) {
|
|
1487
|
-
result.addNode(SN_FunctionCall.parse(r));
|
|
1488
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
1489
|
-
r.skipToken(0);
|
|
1490
|
-
}
|
|
1491
|
-
continue;
|
|
1492
|
-
}
|
|
1493
|
-
throw ("Error parsing block: Unexpected symbol(" + currToken.Literal + ")");
|
|
1494
|
-
}
|
|
1495
|
-
return result;
|
|
1496
|
-
}
|
|
1497
|
-
throw "Error parsing block: Unexpected symbol";
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
/**
|
|
1501
|
-
* @internal
|
|
1502
|
-
* Statement node: precision
|
|
1503
|
-
* @group GFX
|
|
1504
|
-
*/
|
|
1505
|
-
export class SN_Precision extends StatementNode {
|
|
1506
|
-
constructor(qualifier, type) {
|
|
1507
|
-
super();
|
|
1508
|
-
this.type = type;
|
|
1509
|
-
this.qualifier = qualifier;
|
|
1510
|
-
}
|
|
1511
|
-
static parse(r) {
|
|
1512
|
-
if (r.peekToken(0).Type == TokenType.PRECISION &&
|
|
1513
|
-
r.peekToken(1).Type == TokenType.IDENT &&
|
|
1514
|
-
r.peekToken(2).isBuiltinType()) {
|
|
1515
|
-
let result = new SN_Precision(r.peekToken(1).Literal, r.peekToken(2).Literal);
|
|
1516
|
-
r.skipToken(3);
|
|
1517
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
1518
|
-
r.skipToken(1);
|
|
1519
|
-
}
|
|
1520
|
-
return result;
|
|
1521
|
-
}
|
|
1522
|
-
throw "Error parsing precision qualifier: Unexpected character";
|
|
1523
|
-
}
|
|
1524
|
-
formatToWGSL(context, depth) {
|
|
1525
|
-
return "";
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
|
-
/**
|
|
1529
|
-
* @internal
|
|
1530
|
-
* Statement node: layout
|
|
1531
|
-
* @group GFX
|
|
1532
|
-
*/
|
|
1533
|
-
export class SN_Layout extends StatementNode {
|
|
1534
|
-
constructor() {
|
|
1535
|
-
super();
|
|
1536
|
-
this.scope = "";
|
|
1537
|
-
this.qualifier = new Map();
|
|
1538
|
-
}
|
|
1539
|
-
addQualifier(name, value = "") {
|
|
1540
|
-
this.qualifier.set(name, value);
|
|
1541
|
-
}
|
|
1542
|
-
static parse(r) {
|
|
1543
|
-
if (r.peekToken(0).Type == TokenType.LAYOUT &&
|
|
1544
|
-
r.peekToken(1).Type == TokenType.LEFTSAMLL) {
|
|
1545
|
-
let result = new SN_Layout();
|
|
1546
|
-
r.skipToken(2);
|
|
1547
|
-
do {
|
|
1548
|
-
let currToken = r.peekToken(0);
|
|
1549
|
-
if (currToken.Type == TokenType.IDENT) {
|
|
1550
|
-
if (r.peekToken(1).Type == TokenType.ASSIGN &&
|
|
1551
|
-
r.peekToken(2).Type == TokenType.LITERAL) {
|
|
1552
|
-
let name = r.peekToken(0).Literal;
|
|
1553
|
-
let value = r.peekToken(2).Literal;
|
|
1554
|
-
result.addQualifier(name, value);
|
|
1555
|
-
r.skipToken(3);
|
|
1556
|
-
if (r.peekToken(0).Type == TokenType.COMMA) {
|
|
1557
|
-
r.skipToken(1);
|
|
1558
|
-
continue;
|
|
1559
|
-
}
|
|
1560
|
-
let token = r.peekToken(0);
|
|
1561
|
-
token.Line = 0;
|
|
1562
|
-
}
|
|
1563
|
-
else if (r.peekToken(1).Type == TokenType.RIGHTSAMLL) {
|
|
1564
|
-
let name = r.peekToken(0).Literal;
|
|
1565
|
-
result.addQualifier(name, "");
|
|
1566
|
-
r.skipToken(1);
|
|
1567
|
-
break;
|
|
1568
|
-
}
|
|
1569
|
-
else if (r.peekToken(1).Type == TokenType.COMMA) {
|
|
1570
|
-
let name = r.peekToken(0).Literal;
|
|
1571
|
-
result.addQualifier(name, "");
|
|
1572
|
-
r.skipToken(2);
|
|
1573
|
-
continue;
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
} while (r.peekToken(0).Type != TokenType.RIGHTSAMLL);
|
|
1577
|
-
if (r.peekToken(0).Type == TokenType.RIGHTSAMLL) {
|
|
1578
|
-
r.skipToken(1);
|
|
1579
|
-
}
|
|
1580
|
-
// Scope of resolution
|
|
1581
|
-
result.scope = r.peekToken(0).Literal;
|
|
1582
|
-
r.skipToken(1);
|
|
1583
|
-
// Empty qualifier
|
|
1584
|
-
if (r.peekToken(0).Type == TokenType.SEMICOLON) {
|
|
1585
|
-
r.skipToken(1);
|
|
1586
|
-
return result;
|
|
1587
|
-
}
|
|
1588
|
-
// Built-in type
|
|
1589
|
-
else if (r.peekToken(0).isBuiltinType() &&
|
|
1590
|
-
r.peekToken(1).Type == TokenType.IDENT &&
|
|
1591
|
-
r.peekToken(2).Type == TokenType.SEMICOLON) {
|
|
1592
|
-
let node = new SN_Declaration(r.peekToken(0).Literal, r.peekToken(1).Literal);
|
|
1593
|
-
result.addNode(node);
|
|
1594
|
-
r.skipToken(3);
|
|
1595
|
-
return result;
|
|
1596
|
-
}
|
|
1597
|
-
// structure type
|
|
1598
|
-
else if (r.peekToken(0).Type == TokenType.IDENT &&
|
|
1599
|
-
r.peekToken(1).Type == TokenType.LEFTBIG) {
|
|
1600
|
-
let structNode = SN_Struct.parse(r);
|
|
1601
|
-
result.addNode(structNode);
|
|
1602
|
-
if (r.peekToken(0).Type == TokenType.IDENT &&
|
|
1603
|
-
r.peekToken(1).Type == TokenType.SEMICOLON) {
|
|
1604
|
-
structNode.addNode(new SN_Declaration(structNode.name, r.peekToken(0).Literal));
|
|
1605
|
-
r.skipToken(2);
|
|
1606
|
-
}
|
|
1607
|
-
return result;
|
|
1608
|
-
}
|
|
1609
|
-
else
|
|
1610
|
-
throw ("Error parsing layout qualifier type: Unexpected symbol(" +
|
|
1611
|
-
r.peekToken(0).Literal +
|
|
1612
|
-
")");
|
|
1613
|
-
}
|
|
1614
|
-
throw "Error parsing layout qualifier: Unexpected symbol";
|
|
1615
|
-
}
|
|
1616
|
-
formatToWGSL(context, depth) {
|
|
1617
|
-
let result = "";
|
|
1618
|
-
if (this.qualifier.size == 1 && this.qualifier.has("location")) {
|
|
1619
|
-
result += "@location(" + this.qualifier.get("location") + ") ";
|
|
1620
|
-
}
|
|
1621
|
-
else if (this.qualifier.size == 2 &&
|
|
1622
|
-
this.qualifier.has("set") &&
|
|
1623
|
-
this.qualifier.has("binding")) {
|
|
1624
|
-
result +=
|
|
1625
|
-
"@group(" +
|
|
1626
|
-
this.qualifier.get("set") +
|
|
1627
|
-
") @binding(" +
|
|
1628
|
-
this.qualifier.get("binding") +
|
|
1629
|
-
") ";
|
|
1630
|
-
}
|
|
1631
|
-
else if (this.qualifier.size >= 1 && this.qualifier.has("binding")) {
|
|
1632
|
-
result += "@group(0) @binding(" + this.qualifier.get("binding") + ") ";
|
|
1633
|
-
}
|
|
1634
|
-
else if (this.qualifier.size == 1 &&
|
|
1635
|
-
this.qualifier.has("push_constant")) {
|
|
1636
|
-
result += "@push_constant ";
|
|
1637
|
-
}
|
|
1638
|
-
else if (this.qualifier.size >= 1 && this.qualifier.has("local_size_x")) {
|
|
1639
|
-
result += "@workgroup_size(";
|
|
1640
|
-
result += this.qualifier.get("local_size_x") + ", ";
|
|
1641
|
-
result += this.qualifier.has("local_size_y")
|
|
1642
|
-
? this.qualifier.get("local_size_y") + ", "
|
|
1643
|
-
: "1, ";
|
|
1644
|
-
result += this.qualifier.has("local_size_z")
|
|
1645
|
-
? this.qualifier.get("local_size_z") + ""
|
|
1646
|
-
: "1";
|
|
1647
|
-
result += ")";
|
|
1648
|
-
}
|
|
1649
|
-
else if (this.nodes.length <= 0) {
|
|
1650
|
-
return "";
|
|
1651
|
-
}
|
|
1652
|
-
let item = this.nodes[0];
|
|
1653
|
-
if (item instanceof SN_Declaration) {
|
|
1654
|
-
switch (item.type) {
|
|
1655
|
-
case "sampler":
|
|
1656
|
-
case "texture2D":
|
|
1657
|
-
result += "var ";
|
|
1658
|
-
break;
|
|
1659
|
-
default:
|
|
1660
|
-
if (this.scope == "buffer") {
|
|
1661
|
-
if (context.stage == "compute") {
|
|
1662
|
-
result += "var<storage, read_write> ";
|
|
1663
|
-
}
|
|
1664
|
-
else {
|
|
1665
|
-
result += "var<storage, read> ";
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
else {
|
|
1669
|
-
result += "var<" + this.scope + "> ";
|
|
1670
|
-
}
|
|
1671
|
-
break;
|
|
1672
|
-
}
|
|
1673
|
-
context.addIdentifier(item.name, item.name);
|
|
1674
|
-
result += item.name + ": " + toWGSLType(item.type) + ";\r\n";
|
|
1675
|
-
}
|
|
1676
|
-
else if (item instanceof SN_Struct) {
|
|
1677
|
-
if (this.scope == "buffer") {
|
|
1678
|
-
if (context.stage == "compute") {
|
|
1679
|
-
result += "var<storage, read_write> ";
|
|
1680
|
-
}
|
|
1681
|
-
else {
|
|
1682
|
-
result += "var<storage, read> ";
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
else {
|
|
1686
|
-
result += "var<" + this.scope + "> ";
|
|
1687
|
-
}
|
|
1688
|
-
if (item.nodes.length <= 0) {
|
|
1689
|
-
let rename = "unif" + context.layoutUniformCount.toString();
|
|
1690
|
-
while (context.hasIdentifier(rename)) {
|
|
1691
|
-
context.layoutUniformCount++;
|
|
1692
|
-
rename = "unif" + context.layoutUniformCount.toString();
|
|
1693
|
-
}
|
|
1694
|
-
for (let field of item.fields) {
|
|
1695
|
-
context.addIdentifier(field.name, rename + "." + field.name);
|
|
1696
|
-
}
|
|
1697
|
-
result += rename + ": " + item.name + ";\r\n";
|
|
1698
|
-
context.layoutUniformCount++;
|
|
1699
|
-
}
|
|
1700
|
-
else {
|
|
1701
|
-
let declaration = item.nodes[0];
|
|
1702
|
-
result += declaration.name + ": " + declaration.type + ";\r\n";
|
|
1703
|
-
}
|
|
1704
|
-
return result;
|
|
1705
|
-
}
|
|
1706
|
-
return result;
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
/**
|
|
1710
|
-
* @internal
|
|
1711
|
-
* @param type
|
|
1712
|
-
* @returns
|
|
1713
|
-
*/
|
|
1714
|
-
function toWGSLType(type) {
|
|
1715
|
-
switch (type) {
|
|
1716
|
-
case "int":
|
|
1717
|
-
return "i32";
|
|
1718
|
-
case "int[]":
|
|
1719
|
-
return "array<i32>";
|
|
1720
|
-
case "uint":
|
|
1721
|
-
return "u32";
|
|
1722
|
-
case "uint[]":
|
|
1723
|
-
return "array<u32>";
|
|
1724
|
-
case "float":
|
|
1725
|
-
return "f32";
|
|
1726
|
-
case "float[]":
|
|
1727
|
-
return "array<f32>";
|
|
1728
|
-
case "vec2":
|
|
1729
|
-
return "vec2<f32>";
|
|
1730
|
-
case "vec3":
|
|
1731
|
-
return "vec3<f32>";
|
|
1732
|
-
case "vec4":
|
|
1733
|
-
return "vec4<f32>";
|
|
1734
|
-
case "vec2[]":
|
|
1735
|
-
return "array<vec2<f32>>";
|
|
1736
|
-
case "vec3[]":
|
|
1737
|
-
return "array<vec3<f32>>";
|
|
1738
|
-
case "vec4[]":
|
|
1739
|
-
return "array<vec4<f32>>";
|
|
1740
|
-
case "ivec2":
|
|
1741
|
-
return "vec2<i32>";
|
|
1742
|
-
case "ivec3":
|
|
1743
|
-
return "vec3<i32>";
|
|
1744
|
-
case "ivec4":
|
|
1745
|
-
return "vec4<i32>";
|
|
1746
|
-
case "ivec2[]":
|
|
1747
|
-
return "array<vec2<i32>>";
|
|
1748
|
-
case "ivec3[]":
|
|
1749
|
-
return "array<vec3<i32>>";
|
|
1750
|
-
case "ivec4[]":
|
|
1751
|
-
return "array<vec4<i32>>";
|
|
1752
|
-
case "mat2":
|
|
1753
|
-
return "mat2x2<f32>";
|
|
1754
|
-
case "mat2x2":
|
|
1755
|
-
return "mat2x2<f32>";
|
|
1756
|
-
case "mat2x3":
|
|
1757
|
-
return "mat2x3<f32>";
|
|
1758
|
-
case "mat2x4":
|
|
1759
|
-
return "mat2x4<f32>";
|
|
1760
|
-
case "mat2[]":
|
|
1761
|
-
return "array<mat2x2<f32>>";
|
|
1762
|
-
case "mat2x2[]":
|
|
1763
|
-
return "array<mat2x2<f32>>";
|
|
1764
|
-
case "mat2x3[]":
|
|
1765
|
-
return "array<mat2x3<f32>>";
|
|
1766
|
-
case "mat2x4[]":
|
|
1767
|
-
return "array<mat2x4<f32>>";
|
|
1768
|
-
case "mat3":
|
|
1769
|
-
return "mat3x3<f32>";
|
|
1770
|
-
case "mat3x2":
|
|
1771
|
-
return "mat3x2<f32>";
|
|
1772
|
-
case "mat3x3":
|
|
1773
|
-
return "mat3x3<f32>";
|
|
1774
|
-
case "mat3x4":
|
|
1775
|
-
return "mat3x4<f32>";
|
|
1776
|
-
case "mat3[]":
|
|
1777
|
-
return "array<mat3x3<f32>>";
|
|
1778
|
-
case "mat3x2[]":
|
|
1779
|
-
return "array<mat3x2<f32>>";
|
|
1780
|
-
case "mat3x3[]":
|
|
1781
|
-
return "array<mat3x3<f32>>";
|
|
1782
|
-
case "mat3x4[]":
|
|
1783
|
-
return "array<mat3x4<f32>>";
|
|
1784
|
-
case "mat4":
|
|
1785
|
-
return "mat4x4<f32>";
|
|
1786
|
-
case "mat4x2":
|
|
1787
|
-
return "mat4x2<f32>";
|
|
1788
|
-
case "mat4x3":
|
|
1789
|
-
return "mat4x3<f32>";
|
|
1790
|
-
case "mat4x4":
|
|
1791
|
-
return "mat4x4<f32>";
|
|
1792
|
-
case "mat4[]":
|
|
1793
|
-
return "array<mat4x4<f32>>";
|
|
1794
|
-
case "mat4x2[]":
|
|
1795
|
-
return "array<mat4x2<f32>>";
|
|
1796
|
-
case "mat4x3[]":
|
|
1797
|
-
return "array<mat4x3<f32>>";
|
|
1798
|
-
case "mat4x4[]":
|
|
1799
|
-
return "array<mat4x4<f32>>";
|
|
1800
|
-
case "texture2D":
|
|
1801
|
-
return "texture_2d<f32>";
|
|
1802
|
-
}
|
|
1803
|
-
return type;
|
|
1804
|
-
}
|