chorama 0.1.2 → 0.2.1
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/README.md +2 -1
- package/dist/index.module.js +32480 -15098
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +32628 -15121
- package/dist/index.umd.js.map +1 -1
- package/package.json +7 -2
- package/.configs/tsconfig.lib.json +0 -43
- package/.configs/tsconfig.website.json +0 -34
- package/.github/workflows/publish.yml +0 -24
- package/.github/workflows/static.yml +0 -57
- package/.vscode/launch.json +0 -29
- package/.vscode/tasks.json +0 -19
- package/assets/images/disappointed.jpg +0 -0
- package/assets/images/skybox/grimmnight_back.png +0 -0
- package/assets/images/skybox/grimmnight_bottom.png +0 -0
- package/assets/images/skybox/grimmnight_front.png +0 -0
- package/assets/images/skybox/grimmnight_left.png +0 -0
- package/assets/images/skybox/grimmnight_right.png +0 -0
- package/assets/images/skybox/grimmnight_top.png +0 -0
- package/assets/images/skybox/miramar_back.png +0 -0
- package/assets/images/skybox/miramar_bottom.png +0 -0
- package/assets/images/skybox/miramar_front.png +0 -0
- package/assets/images/skybox/miramar_left.png +0 -0
- package/assets/images/skybox/miramar_right.png +0 -0
- package/assets/images/skybox/miramar_top.png +0 -0
- package/assets/images/uv.jpg +0 -0
- package/assets/models/glb/AlphaBlendModeTest.glb +0 -0
- package/assets/models/glb/IridescenceLamp.glb +0 -0
- package/assets/models/glb/teapot.glb +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_GlassPlasticMat_BaseColor.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_GlassPlasticMat_Normal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_GlassPlasticMat_OcclusionRoughMetal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_LeatherPartsMat_BaseColor.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_LeatherPartsMat_Normal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_LeatherPartsMat_OcclusionRoughMetal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_LensesMat_BaseColor.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_LensesMat_Normal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_LensesMat_OcclusionRoughMetal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_MetalPartsMat_BaseColor.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_MetalPartsMat_Normal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_MetalPartsMat_OcclusionRoughMetal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_RubberWoodMat_BaseColor.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_RubberWoodMat_Normal.png +0 -0
- package/assets/models/gltf/flight_helmet/FlightHelmet_Materials_RubberWoodMat_OcclusionRoughMetal.png +0 -0
- package/assets/models/gltf/flight_helmet/index.bin +0 -0
- package/assets/models/gltf/flight_helmet/index.gltf +0 -705
- package/assets/models/gltf/object.gltf +0 -23
- package/assets/models/gltf/pirate_girl/index.bin +0 -0
- package/assets/models/gltf/pirate_girl/index.gltf +0 -2082
- package/assets/models/obj/pirate_girl/pirate_girl.obj +0 -18459
- package/assets/models/obj/pirate_girl/pirate_girl.png +0 -0
- package/astro.config.mjs +0 -33
- package/content/guide/api-map.md +0 -89
- package/content/guide/camera-and-controls.md +0 -98
- package/content/guide/first-scene.md +0 -176
- package/content/guide/index.md +0 -72
- package/content/guide/installation.md +0 -179
- package/content/guide/materials-and-lighting.md +0 -138
- package/content/guide/plugins-and-render-pipeline.md +0 -124
- package/content/guide/render-targets-and-views.md +0 -146
- package/content/guide/scene-graph-and-transforms.md +0 -113
- package/content/guide/textures-and-assets.md +0 -123
- package/content/guide/troubleshooting.md +0 -49
- package/dist/website/_astro/DocLayout.BsV7p0dY.css +0 -1
- package/dist/website/examples/camera/orthographic/example.html +0 -172
- package/dist/website/examples/camera/orthographic/index.html +0 -124
- package/dist/website/examples/camera/perspective/example.html +0 -190
- package/dist/website/examples/camera/perspective/index.html +0 -142
- package/dist/website/examples/camera/tone_mapping/example.html +0 -238
- package/dist/website/examples/camera/tone_mapping/index.html +0 -190
- package/dist/website/examples/index.html +0 -2
- package/dist/website/examples/lights/directional/example.html +0 -447
- package/dist/website/examples/lights/directional/index.html +0 -399
- package/dist/website/examples/lights/multiple_spot_lights/example.html +0 -356
- package/dist/website/examples/lights/multiple_spot_lights/index.html +0 -308
- package/dist/website/examples/lights/point/example.html +0 -387
- package/dist/website/examples/lights/point/index.html +0 -339
- package/dist/website/examples/lights/spot/example.html +0 -416
- package/dist/website/examples/lights/spot/index.html +0 -368
- package/dist/website/examples/loader/gltf/basic/example.html +0 -129
- package/dist/website/examples/loader/gltf/basic/index.html +0 -81
- package/dist/website/examples/loader/gltf/material/alpha-blend-mode/example.html +0 -131
- package/dist/website/examples/loader/gltf/material/alpha-blend-mode/index.html +0 -83
- package/dist/website/examples/loader/gltf/material/flight_helmet/example.html +0 -162
- package/dist/website/examples/loader/gltf/material/flight_helmet/index.html +0 -114
- package/dist/website/examples/loader/gltf/material/iridescence_lamp/example.html +0 -169
- package/dist/website/examples/loader/gltf/material/iridescence_lamp/index.html +0 -121
- package/dist/website/examples/loader/objloader/example.html +0 -144
- package/dist/website/examples/loader/objloader/index.html +0 -96
- package/dist/website/examples/material/cullface/example.html +0 -163
- package/dist/website/examples/material/cullface/index.html +0 -115
- package/dist/website/examples/material/materials/example.html +0 -175
- package/dist/website/examples/material/materials/index.html +0 -127
- package/dist/website/examples/material/standard/basic/example.html +0 -212
- package/dist/website/examples/material/standard/basic/index.html +0 -164
- package/dist/website/examples/material/standard/reflection_refraction/example.html +0 -241
- package/dist/website/examples/material/standard/reflection_refraction/index.html +0 -193
- package/dist/website/examples/mesh/capsule/example.html +0 -173
- package/dist/website/examples/mesh/capsule/index.html +0 -125
- package/dist/website/examples/mesh/circle/example.html +0 -173
- package/dist/website/examples/mesh/circle/index.html +0 -125
- package/dist/website/examples/mesh/cone/example.html +0 -180
- package/dist/website/examples/mesh/cone/index.html +0 -132
- package/dist/website/examples/mesh/cuboid/example.html +0 -207
- package/dist/website/examples/mesh/cuboid/index.html +0 -159
- package/dist/website/examples/mesh/cylinder/example.html +0 -195
- package/dist/website/examples/mesh/cylinder/index.html +0 -147
- package/dist/website/examples/mesh/dodecahedron/example.html +0 -158
- package/dist/website/examples/mesh/dodecahedron/index.html +0 -110
- package/dist/website/examples/mesh/ellipsoid/example.html +0 -179
- package/dist/website/examples/mesh/ellipsoid/index.html +0 -131
- package/dist/website/examples/mesh/extrude/example.html +0 -169
- package/dist/website/examples/mesh/extrude/index.html +0 -121
- package/dist/website/examples/mesh/frustum/example.html +0 -185
- package/dist/website/examples/mesh/frustum/index.html +0 -137
- package/dist/website/examples/mesh/helix/example.html +0 -184
- package/dist/website/examples/mesh/helix/index.html +0 -136
- package/dist/website/examples/mesh/icosahedron/example.html +0 -158
- package/dist/website/examples/mesh/icosahedron/index.html +0 -110
- package/dist/website/examples/mesh/icosphere/example.html +0 -163
- package/dist/website/examples/mesh/icosphere/index.html +0 -115
- package/dist/website/examples/mesh/lathe/example.html +0 -175
- package/dist/website/examples/mesh/lathe/index.html +0 -127
- package/dist/website/examples/mesh/meshTopology/example.html +0 -210
- package/dist/website/examples/mesh/meshTopology/index.html +0 -162
- package/dist/website/examples/mesh/octahedron/example.html +0 -158
- package/dist/website/examples/mesh/octahedron/index.html +0 -110
- package/dist/website/examples/mesh/plane/example.html +0 -173
- package/dist/website/examples/mesh/plane/index.html +0 -125
- package/dist/website/examples/mesh/prism/example.html +0 -173
- package/dist/website/examples/mesh/prism/index.html +0 -125
- package/dist/website/examples/mesh/pyramid/example.html +0 -172
- package/dist/website/examples/mesh/pyramid/index.html +0 -124
- package/dist/website/examples/mesh/ring/example.html +0 -173
- package/dist/website/examples/mesh/ring/index.html +0 -125
- package/dist/website/examples/mesh/skinning/example.html +0 -187
- package/dist/website/examples/mesh/skinning/index.html +0 -139
- package/dist/website/examples/mesh/terrain/example.html +0 -214
- package/dist/website/examples/mesh/terrain/index.html +0 -166
- package/dist/website/examples/mesh/tetrahedron/example.html +0 -158
- package/dist/website/examples/mesh/tetrahedron/index.html +0 -110
- package/dist/website/examples/mesh/torus/example.html +0 -173
- package/dist/website/examples/mesh/torus/index.html +0 -125
- package/dist/website/examples/mesh/torus-knot/example.html +0 -188
- package/dist/website/examples/mesh/torus-knot/index.html +0 -140
- package/dist/website/examples/mesh/tube/example.html +0 -180
- package/dist/website/examples/mesh/tube/index.html +0 -132
- package/dist/website/examples/mesh/uvsphere/example.html +0 -169
- package/dist/website/examples/mesh/uvsphere/index.html +0 -121
- package/dist/website/examples/mesh/wedge/example.html +0 -168
- package/dist/website/examples/mesh/wedge/index.html +0 -120
- package/dist/website/examples/other/rotatingCube/example.html +0 -142
- package/dist/website/examples/other/rotatingCube/index.html +0 -94
- package/dist/website/examples/other/rotatingSphere/example.html +0 -144
- package/dist/website/examples/other/rotatingSphere/index.html +0 -96
- package/dist/website/examples/rendertarget/basic_canvas/example.html +0 -178
- package/dist/website/examples/rendertarget/basic_canvas/index.html +0 -130
- package/dist/website/examples/rendertarget/depth_texture/example.html +0 -188
- package/dist/website/examples/rendertarget/depth_texture/index.html +0 -140
- package/dist/website/examples/rendertarget/image_target/example.html +0 -196
- package/dist/website/examples/rendertarget/image_target/index.html +0 -148
- package/dist/website/examples/rendertarget/multiple_views/example.html +0 -204
- package/dist/website/examples/rendertarget/multiple_views/index.html +0 -156
- package/dist/website/examples/rendertarget/render_masks/example.html +0 -222
- package/dist/website/examples/rendertarget/render_masks/index.html +0 -174
- package/dist/website/examples/rendertarget/split_screen/example.html +0 -178
- package/dist/website/examples/rendertarget/split_screen/index.html +0 -130
- package/dist/website/examples/rendertarget/split_view/example.html +0 -191
- package/dist/website/examples/rendertarget/split_view/index.html +0 -143
- package/dist/website/examples/skybox/skybox/example.html +0 -162
- package/dist/website/examples/skybox/skybox/index.html +0 -114
- package/dist/website/examples/texture/arrays/example.html +0 -204
- package/dist/website/examples/texture/arrays/index.html +0 -156
- package/dist/website/examples/texture/textureWrap/example.html +0 -169
- package/dist/website/examples/texture/textureWrap/index.html +0 -121
- package/dist/website/examples/transform/propagation/example.html +0 -141
- package/dist/website/examples/transform/propagation/index.html +0 -93
- package/dist/website/guide/api-map/index.html +0 -82
- package/dist/website/guide/camera-and-controls/index.html +0 -62
- package/dist/website/guide/first-scene/index.html +0 -119
- package/dist/website/guide/index.html +0 -58
- package/dist/website/guide/installation/index.html +0 -133
- package/dist/website/guide/materials-and-lighting/index.html +0 -90
- package/dist/website/guide/plugins-and-render-pipeline/index.html +0 -89
- package/dist/website/guide/render-targets-and-views/index.html +0 -95
- package/dist/website/guide/scene-graph-and-transforms/index.html +0 -69
- package/dist/website/guide/textures-and-assets/index.html +0 -85
- package/dist/website/guide/troubleshooting/index.html +0 -39
- package/dist/website/images/disappointed.jpg +0 -0
- package/dist/website/images/skybox/grimmnight_back.png +0 -0
- package/dist/website/images/skybox/grimmnight_bottom.png +0 -0
- package/dist/website/images/skybox/grimmnight_front.png +0 -0
- package/dist/website/images/skybox/grimmnight_left.png +0 -0
- package/dist/website/images/skybox/grimmnight_right.png +0 -0
- package/dist/website/images/skybox/grimmnight_top.png +0 -0
- package/dist/website/images/skybox/miramar_back.png +0 -0
- package/dist/website/images/skybox/miramar_bottom.png +0 -0
- package/dist/website/images/skybox/miramar_front.png +0 -0
- package/dist/website/images/skybox/miramar_left.png +0 -0
- package/dist/website/images/skybox/miramar_right.png +0 -0
- package/dist/website/images/skybox/miramar_top.png +0 -0
- package/dist/website/images/uv.jpg +0 -0
- package/dist/website/index.html +0 -157
- package/dist/website/models/glb/AlphaBlendModeTest.glb +0 -0
- package/dist/website/models/glb/IridescenceLamp.glb +0 -0
- package/dist/website/models/glb/teapot.glb +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_GlassPlasticMat_BaseColor.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_GlassPlasticMat_Normal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_GlassPlasticMat_OcclusionRoughMetal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_LeatherPartsMat_BaseColor.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_LeatherPartsMat_Normal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_LeatherPartsMat_OcclusionRoughMetal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_LensesMat_BaseColor.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_LensesMat_Normal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_LensesMat_OcclusionRoughMetal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_MetalPartsMat_BaseColor.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_MetalPartsMat_Normal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_MetalPartsMat_OcclusionRoughMetal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_RubberWoodMat_BaseColor.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_RubberWoodMat_Normal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/FlightHelmet_Materials_RubberWoodMat_OcclusionRoughMetal.png +0 -0
- package/dist/website/models/gltf/flight_helmet/index.bin +0 -0
- package/dist/website/models/gltf/flight_helmet/index.gltf +0 -705
- package/dist/website/models/gltf/object.gltf +0 -23
- package/dist/website/models/gltf/pirate_girl/index.bin +0 -0
- package/dist/website/models/gltf/pirate_girl/index.gltf +0 -2082
- package/dist/website/models/obj/pirate_girl/pirate_girl.obj +0 -18459
- package/dist/website/models/obj/pirate_girl/pirate_girl.png +0 -0
- package/env.d.ts +0 -5
- package/examples/camera/orthographic.js +0 -121
- package/examples/camera/perspective.js +0 -139
- package/examples/camera/tone_mapping.js +0 -187
- package/examples/lights/directional.js +0 -396
- package/examples/lights/multiple_spot_lights.js +0 -305
- package/examples/lights/point.js +0 -336
- package/examples/lights/spot.js +0 -365
- package/examples/loader/gltf/basic.js +0 -78
- package/examples/loader/gltf/material/alpha-blend-mode.js +0 -80
- package/examples/loader/gltf/material/flight_helmet.js +0 -111
- package/examples/loader/gltf/material/iridescence_lamp.js +0 -118
- package/examples/loader/objloader.js +0 -93
- package/examples/material/cullface.js +0 -112
- package/examples/material/materials.js +0 -124
- package/examples/material/standard/basic.js +0 -161
- package/examples/material/standard/reflection_refraction.js +0 -190
- package/examples/mesh/capsule.js +0 -122
- package/examples/mesh/circle.js +0 -122
- package/examples/mesh/cone.js +0 -129
- package/examples/mesh/cuboid.js +0 -156
- package/examples/mesh/cylinder.js +0 -144
- package/examples/mesh/dodecahedron.js +0 -107
- package/examples/mesh/ellipsoid.js +0 -128
- package/examples/mesh/extrude.js +0 -118
- package/examples/mesh/frustum.js +0 -134
- package/examples/mesh/helix.js +0 -133
- package/examples/mesh/icosahedron.js +0 -107
- package/examples/mesh/icosphere.js +0 -112
- package/examples/mesh/lathe.js +0 -124
- package/examples/mesh/meshTopology.js +0 -159
- package/examples/mesh/octahedron.js +0 -107
- package/examples/mesh/plane.js +0 -122
- package/examples/mesh/prism.js +0 -122
- package/examples/mesh/pyramid.js +0 -121
- package/examples/mesh/ring.js +0 -122
- package/examples/mesh/skinning.js +0 -136
- package/examples/mesh/terrain.js +0 -163
- package/examples/mesh/tetrahedron.js +0 -107
- package/examples/mesh/torus-knot.js +0 -137
- package/examples/mesh/torus.js +0 -122
- package/examples/mesh/tube.js +0 -129
- package/examples/mesh/uvsphere.js +0 -118
- package/examples/mesh/wedge.js +0 -117
- package/examples/other/rotatingCube.js +0 -91
- package/examples/other/rotatingSphere.js +0 -93
- package/examples/rendertarget/basic_canvas.js +0 -127
- package/examples/rendertarget/depth_texture.js +0 -137
- package/examples/rendertarget/image_target.js +0 -145
- package/examples/rendertarget/multiple_views.js +0 -153
- package/examples/rendertarget/render_masks.js +0 -171
- package/examples/rendertarget/split_screen.js +0 -127
- package/examples/rendertarget/split_view.js +0 -140
- package/examples/skybox/skybox.js +0 -111
- package/examples/texture/arrays.js +0 -153
- package/examples/texture/textureWrap.js +0 -118
- package/examples/transform/propagation.js +0 -90
- package/rollup.config.js +0 -66
- package/src/caches/cache.js +0 -359
- package/src/caches/index.js +0 -2
- package/src/caches/uniformbuffers.js +0 -93
- package/src/cameracontrols/index.js +0 -258
- package/src/constants/index.js +0 -3
- package/src/constants/mesh.js +0 -197
- package/src/constants/others.js +0 -218
- package/src/constants/texture.js +0 -183
- package/src/content.config.js +0 -1
- package/src/core/constants.js +0 -14
- package/src/core/extensions.js +0 -42
- package/src/core/index.js +0 -7
- package/src/core/layouts/bindgroup.js +0 -167
- package/src/core/layouts/index.js +0 -6
- package/src/core/layouts/meshvertex.js +0 -60
- package/src/core/layouts/pipeline.js +0 -165
- package/src/core/layouts/uniform.js +0 -21
- package/src/core/layouts/uniformbuffer.js +0 -23
- package/src/core/layouts/vertexbuffer.js +0 -43
- package/src/core/limits.js +0 -247
- package/src/core/resources/blendparams.js +0 -89
- package/src/core/resources/gpubuffer.js +0 -53
- package/src/core/resources/gpumesh.js +0 -76
- package/src/core/resources/gpusampler.js +0 -43
- package/src/core/resources/gputexture.js +0 -102
- package/src/core/resources/index.js +0 -7
- package/src/core/resources/newuniformbuffer.js +0 -58
- package/src/core/resources/webglshadermodule.js +0 -58
- package/src/core/shader.js +0 -75
- package/src/core/webgl/bindgroup.js +0 -247
- package/src/core/webgl/descriptors.js +0 -166
- package/src/core/webgl/gpuqueue.js +0 -63
- package/src/core/webgl/index.js +0 -8
- package/src/core/webgl/renderpassencoder.js +0 -783
- package/src/core/webgl/renderpipeline.js +0 -91
- package/src/core/webgl/utils.js +0 -521
- package/src/core/webgl/webglrenderdevice.js +0 -259
- package/src/function.js +0 -358
- package/src/index.js +0 -15
- package/src/loader/gltf.js +0 -2722
- package/src/loader/index.js +0 -3
- package/src/loader/loader.js +0 -174
- package/src/loader/obj.js +0 -188
- package/src/loader/texture.js +0 -138
- package/src/loader/utils.js +0 -60
- package/src/material/alphablend.js +0 -21
- package/src/material/basic.js +0 -89
- package/src/material/depth.js +0 -87
- package/src/material/index.js +0 -9
- package/src/material/lambert.js +0 -87
- package/src/material/material.js +0 -148
- package/src/material/normal.js +0 -44
- package/src/material/phong.js +0 -100
- package/src/material/raw.js +0 -71
- package/src/material/standard.js +0 -309
- package/src/math/index.js +0 -3
- package/src/math/transform.js +0 -38
- package/src/mesh/attribute/attribute.js +0 -79
- package/src/mesh/attribute/index.js +0 -1
- package/src/mesh/attributedata/index.js +0 -1
- package/src/mesh/attributedata/separate.js +0 -180
- package/src/mesh/builders/base.js +0 -41
- package/src/mesh/builders/capsule.js +0 -47
- package/src/mesh/builders/circle.js +0 -63
- package/src/mesh/builders/cone.js +0 -29
- package/src/mesh/builders/cuboid.js +0 -135
- package/src/mesh/builders/cylinder.js +0 -131
- package/src/mesh/builders/dodecahedron.js +0 -130
- package/src/mesh/builders/ellipsoid.js +0 -65
- package/src/mesh/builders/extrude.js +0 -136
- package/src/mesh/builders/frustum.js +0 -26
- package/src/mesh/builders/geometry.js +0 -121
- package/src/mesh/builders/helix.js +0 -35
- package/src/mesh/builders/icosahedron.js +0 -61
- package/src/mesh/builders/icosphere.js +0 -141
- package/src/mesh/builders/index.js +0 -28
- package/src/mesh/builders/lathe.js +0 -85
- package/src/mesh/builders/octahedron.js +0 -43
- package/src/mesh/builders/plane.js +0 -73
- package/src/mesh/builders/polyhedron.js +0 -121
- package/src/mesh/builders/prism.js +0 -19
- package/src/mesh/builders/pyramid.js +0 -90
- package/src/mesh/builders/ring.js +0 -109
- package/src/mesh/builders/surfaces.js +0 -69
- package/src/mesh/builders/terrain.js +0 -80
- package/src/mesh/builders/tetrahedron.js +0 -37
- package/src/mesh/builders/torusknot.js +0 -36
- package/src/mesh/builders/tube.js +0 -209
- package/src/mesh/builders/utils.js +0 -148
- package/src/mesh/builders/uvsphere.js +0 -80
- package/src/mesh/builders/wedge.js +0 -22
- package/src/mesh/builders/wireframe.js +0 -62
- package/src/mesh/index.js +0 -4
- package/src/mesh/mesh.js +0 -157
- package/src/objects/bone.js +0 -17
- package/src/objects/camera/camera.js +0 -159
- package/src/objects/camera/index.js +0 -2
- package/src/objects/camera/projection.js +0 -203
- package/src/objects/debug/index.js +0 -1
- package/src/objects/debug/skeleton.js +0 -28
- package/src/objects/index.js +0 -7
- package/src/objects/light/ambient.js +0 -41
- package/src/objects/light/directional.js +0 -51
- package/src/objects/light/index.js +0 -5
- package/src/objects/light/point.js +0 -56
- package/src/objects/light/shadow/index.js +0 -1
- package/src/objects/light/shadow/shadow.js +0 -67
- package/src/objects/light/spot.js +0 -82
- package/src/objects/mesh.js +0 -89
- package/src/objects/object3d.js +0 -167
- package/src/objects/skybox.js +0 -38
- package/src/plugins/camera/RenderTarget2DPool.js +0 -94
- package/src/plugins/camera/camera.js +0 -27
- package/src/plugins/camera/index.js +0 -4
- package/src/plugins/camera/nodes/canvasblit.js +0 -153
- package/src/plugins/camera/nodes/index.js +0 -5
- package/src/plugins/camera/nodes/opaquepass.js +0 -94
- package/src/plugins/camera/nodes/tonemapping.js +0 -217
- package/src/plugins/camera/nodes/transparentpass.js +0 -87
- package/src/plugins/camera/nodes/view.js +0 -72
- package/src/plugins/camera/resources/cameracolortargets.js +0 -66
- package/src/plugins/camera/resources/canvasblitpipeline.js +0 -6
- package/src/plugins/camera/resources/index.js +0 -3
- package/src/plugins/camera/resources/tonemappingpipeline.js +0 -6
- package/src/plugins/index.js +0 -6
- package/src/plugins/light/index.js +0 -2
- package/src/plugins/light/light.js +0 -19
- package/src/plugins/light/nodes/index.js +0 -1
- package/src/plugins/light/nodes/light.js +0 -127
- package/src/plugins/meshmaterial/index.js +0 -3
- package/src/plugins/meshmaterial/meshmaterial.js +0 -644
- package/src/plugins/meshmaterial/nodes/index.js +0 -1
- package/src/plugins/meshmaterial/nodes/meshmaterial.js +0 -83
- package/src/plugins/meshmaterial/resources/bonetexture.js +0 -176
- package/src/plugins/meshmaterial/resources/environmentmap.js +0 -44
- package/src/plugins/meshmaterial/resources/index.js +0 -5
- package/src/plugins/meshmaterial/resources/materialuniformbuffers.js +0 -94
- package/src/plugins/meshmaterial/resources/meshmaterialbindgroups.js +0 -40
- package/src/plugins/meshmaterial/resources/meshmaterialpipelines.js +0 -50
- package/src/plugins/shadow/index.js +0 -3
- package/src/plugins/shadow/nodes/index.js +0 -3
- package/src/plugins/shadow/nodes/occluder.js +0 -106
- package/src/plugins/shadow/nodes/opaquePass.js +0 -110
- package/src/plugins/shadow/nodes/view.js +0 -272
- package/src/plugins/shadow/resources/ShadowMap.js +0 -99
- package/src/plugins/shadow/resources/index.js +0 -2
- package/src/plugins/shadow/resources/shadowpipelines.js +0 -25
- package/src/plugins/shadow/shadow.js +0 -26
- package/src/plugins/skeletonhelper/index.js +0 -1
- package/src/plugins/skeletonhelper/skeletonhelper.js +0 -202
- package/src/plugins/skybox/index.js +0 -3
- package/src/plugins/skybox/nodes/index.js +0 -1
- package/src/plugins/skybox/nodes/skybox.js +0 -335
- package/src/plugins/skybox/resources/index.js +0 -2
- package/src/plugins/skybox/resources/skyboxmesh.js +0 -14
- package/src/plugins/skybox/resources/skyboxpipeline.js +0 -16
- package/src/plugins/skybox/skybox.js +0 -18
- package/src/renderer/core/index.js +0 -293
- package/src/renderer/graph/index.js +0 -3
- package/src/renderer/graph/nodes.js +0 -34
- package/src/renderer/graph/rendergraph.js +0 -182
- package/src/renderer/index.js +0 -5
- package/src/renderer/plugin.js +0 -16
- package/src/renderer/renderer.js +0 -195
- package/src/renderer/views.js +0 -28
- package/src/rendertarget/canvastarget.js +0 -33
- package/src/rendertarget/image.js +0 -132
- package/src/rendertarget/index.js +0 -3
- package/src/rendertarget/rendertarget.js +0 -89
- package/src/shader/basicFragment.glsl +0 -38
- package/src/shader/basicVertex.glsl +0 -98
- package/src/shader/blitFragment.glsl +0 -9
- package/src/shader/common/color.glsl +0 -7
- package/src/shader/common/common.glsl +0 -54
- package/src/shader/common/index.js +0 -5
- package/src/shader/common/light.glsl +0 -437
- package/src/shader/common/math.glsl +0 -12
- package/src/shader/common/tonemap.glsl +0 -118
- package/src/shader/debug/index.js +0 -2
- package/src/shader/debug/skeletonFragment.glsl +0 -6
- package/src/shader/debug/skeletonVertex.glsl +0 -25
- package/src/shader/depthFragment.glsl +0 -34
- package/src/shader/fullscreenVertex.glsl +0 -26
- package/src/shader/index.js +0 -14
- package/src/shader/lambertFragment.glsl +0 -134
- package/src/shader/normalFragment.glsl +0 -22
- package/src/shader/phongFragment.glsl +0 -148
- package/src/shader/skyboxFragment.glsl +0 -16
- package/src/shader/skyboxVertex.glsl +0 -21
- package/src/shader/standardFragment.glsl +0 -331
- package/src/shader/tonemappingFragment.glsl +0 -37
- package/src/texture/index.js +0 -2
- package/src/texture/sampler.js +0 -191
- package/src/texture/texture.js +0 -438
- package/src/utils/index.js +0 -129
- package/src/utils/rendergraph_gui.js +0 -583
- package/tsconfig.json +0 -11
|
@@ -1,437 +0,0 @@
|
|
|
1
|
-
struct DirectionalLight {
|
|
2
|
-
vec4 color;
|
|
3
|
-
vec3 direction;
|
|
4
|
-
float intensity;
|
|
5
|
-
int shadow_index;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
struct AmbientLight {
|
|
9
|
-
float intensity;
|
|
10
|
-
vec4 color;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
struct PointLight {
|
|
14
|
-
vec4 color;
|
|
15
|
-
vec3 position;
|
|
16
|
-
float intensity;
|
|
17
|
-
float radius;
|
|
18
|
-
float decay;
|
|
19
|
-
int shadow_index;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
struct SpotLight {
|
|
23
|
-
vec4 color;
|
|
24
|
-
vec3 position;
|
|
25
|
-
int shadow_index;
|
|
26
|
-
vec3 direction;
|
|
27
|
-
float intensity;
|
|
28
|
-
float distance;
|
|
29
|
-
float decay;
|
|
30
|
-
float innerAngle;
|
|
31
|
-
float outerAngle;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
struct Shadow {
|
|
35
|
-
mat4 space;
|
|
36
|
-
float bias;
|
|
37
|
-
float normal_bias;
|
|
38
|
-
float layer;
|
|
39
|
-
uint mode;
|
|
40
|
-
float pcf_radius;
|
|
41
|
-
float pcss_search_radius;
|
|
42
|
-
float pcss_penumbra;
|
|
43
|
-
float _padding2;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
struct DirectionalLights {
|
|
47
|
-
int count;
|
|
48
|
-
DirectionalLight lights[MAX_DIRECTIONAL_LIGHTS];
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
struct PointLights {
|
|
52
|
-
int count;
|
|
53
|
-
PointLight lights[MAX_POINT_LIGHTS];
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
struct SpotLights {
|
|
57
|
-
int count;
|
|
58
|
-
SpotLight lights[MAX_SPOT_LIGHTS];
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
float calculate_brightness(vec3 normal, vec3 dir) {
|
|
62
|
-
return max(dot(normal, dir), 0.0);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// https://lisyarus.github.io/blog/posts/point-light-attenuation.html
|
|
66
|
-
float attenuate_light_distance(float distance, float max_distance, float falloff){
|
|
67
|
-
float s = distance / max_distance;
|
|
68
|
-
|
|
69
|
-
if (s >= 1.0){
|
|
70
|
-
return 0.0;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
float s2 = sq(s);
|
|
74
|
-
return sq(1.0 - s2) / (1.0 + falloff * s2);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
float attenuate_point_light(float distance, float radius, float max_intensity, float falloff){
|
|
78
|
-
float s = distance / radius;
|
|
79
|
-
|
|
80
|
-
if (s >= 1.0){
|
|
81
|
-
return 0.0;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
float s2 = sq(s);
|
|
85
|
-
return max_intensity * sq(1.0 - s2) / (1.0 + falloff * s2);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
float attenuate_spot_light(SpotLight light, vec3 direction, float distance){
|
|
89
|
-
float factor = max(dot(light.direction, -direction), 0.0);
|
|
90
|
-
|
|
91
|
-
if(factor > light.outerAngle){
|
|
92
|
-
float cone_attenuation = smoothstep(light.outerAngle, light.innerAngle, factor);
|
|
93
|
-
float distance_attenuation = attenuate_light_distance(distance, light.distance, light.decay);
|
|
94
|
-
return cone_attenuation * distance_attenuation * light.intensity;
|
|
95
|
-
}
|
|
96
|
-
return 0.0;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
vec3 map_cube_from_array_texture_ndc(vec3 direction) {
|
|
100
|
-
vec3 absolute_direction = abs(direction);
|
|
101
|
-
|
|
102
|
-
if (absolute_direction.x >= absolute_direction.y && absolute_direction.x >= absolute_direction.z) {
|
|
103
|
-
float face = direction.x > 0.0 ? 0.0 : 1.0;
|
|
104
|
-
float inv = 1.0 / absolute_direction.x;
|
|
105
|
-
vec2 uv = vec2(
|
|
106
|
-
direction.x > 0.0 ? -direction.z : direction.z,
|
|
107
|
-
-direction.y
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
return vec3(uv * inv, face);
|
|
111
|
-
} else if (absolute_direction.y >= absolute_direction.x && absolute_direction.y >= absolute_direction.z) {
|
|
112
|
-
float face = direction.y > 0.0 ? 2.0 : 3.0;
|
|
113
|
-
float inv = 1.0 / absolute_direction.y;
|
|
114
|
-
vec2 uv = vec2(
|
|
115
|
-
direction.x,
|
|
116
|
-
direction.y > 0.0 ? direction.z : -direction.z
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
return vec3(uv * inv, face);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
float face = direction.z > 0.0 ? 4.0 : 5.0;
|
|
123
|
-
float inv = 1.0 / absolute_direction.z;
|
|
124
|
-
vec2 uv = vec2(
|
|
125
|
-
direction.z > 0.0 ? direction.x : -direction.x,
|
|
126
|
-
-direction.y
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
return vec3(uv * inv, face);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
vec3 map_cube_to_array_texture_direction(float face, vec2 uv) {
|
|
133
|
-
if (face == 0.0) {
|
|
134
|
-
return normalize(vec3(1.0, -uv.y, -uv.x));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (face == 1.0) {
|
|
138
|
-
return normalize(vec3(-1.0, -uv.y, uv.x));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (face == 2.0) {
|
|
142
|
-
return normalize(vec3(uv.x, 1.0, uv.y));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (face == 3.0) {
|
|
146
|
-
return normalize(vec3(uv.x, -1.0, -uv.y));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (face == 4.0) {
|
|
150
|
-
return normalize(vec3(uv.x, -uv.y, 1.0));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return normalize(vec3(-uv.x, -uv.y, -1.0));
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
float shadow_compare_2d(
|
|
157
|
-
Shadow shadow,
|
|
158
|
-
sampler2DArray shadow_atlas,
|
|
159
|
-
vec3 shadow_map_postion,
|
|
160
|
-
float current_depth,
|
|
161
|
-
float bias
|
|
162
|
-
){
|
|
163
|
-
float shadow_map_depth = texture(
|
|
164
|
-
shadow_atlas,
|
|
165
|
-
vec3(shadow_map_postion.xy, shadow.layer)
|
|
166
|
-
).r;
|
|
167
|
-
|
|
168
|
-
return current_depth - bias > shadow_map_depth ? 0.0 : 1.0;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
float shadow_compare_cube(
|
|
172
|
-
Shadow shadow,
|
|
173
|
-
sampler2DArray shadow_atlas,
|
|
174
|
-
vec3 direction,
|
|
175
|
-
float current_depth,
|
|
176
|
-
float bias
|
|
177
|
-
){
|
|
178
|
-
vec3 ndc_uv = map_cube_from_array_texture_ndc(direction);
|
|
179
|
-
vec2 shadow_uv = ndc_uv.xy * 0.5 + 0.5;
|
|
180
|
-
float shadow_map_depth = texture(
|
|
181
|
-
shadow_atlas,
|
|
182
|
-
vec3(shadow_uv.xy, shadow.layer + ndc_uv.z)
|
|
183
|
-
).r;
|
|
184
|
-
vec2 clip_planes = shadow.space[0].xy;
|
|
185
|
-
float near = clip_planes.x;
|
|
186
|
-
float far = clip_planes.y;
|
|
187
|
-
vec3 norm_direction = normalize(direction);
|
|
188
|
-
float scale = max(abs(norm_direction.x), max(abs(norm_direction.y), abs(norm_direction.z)));
|
|
189
|
-
float view_space_map_depth = linearize_depth(shadow_map_depth, near, far);
|
|
190
|
-
float map_depth = view_space_map_depth / (scale * far);
|
|
191
|
-
|
|
192
|
-
return current_depth - bias > map_depth ? 0.0 : 1.0;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
float shadow_pcf_2d_radius(
|
|
196
|
-
Shadow shadow,
|
|
197
|
-
sampler2DArray shadow_atlas,
|
|
198
|
-
vec3 shadow_map_postion,
|
|
199
|
-
float current_depth,
|
|
200
|
-
float radius,
|
|
201
|
-
float bias
|
|
202
|
-
){
|
|
203
|
-
vec2 texel_size = 1.0 / vec2(textureSize(shadow_atlas, 0).xy);
|
|
204
|
-
vec2 pcf_step = texel_size * radius;
|
|
205
|
-
float shadow_sum = 0.0;
|
|
206
|
-
|
|
207
|
-
for (int y = -1; y <= 1; y++) {
|
|
208
|
-
for (int x = -1; x <= 1; x++) {
|
|
209
|
-
vec2 sample_offset = vec2(float(x), float(y)) * pcf_step;
|
|
210
|
-
vec3 sample_position = vec3(shadow_map_postion.xy + sample_offset, shadow_map_postion.z);
|
|
211
|
-
shadow_sum += shadow_compare_2d(shadow, shadow_atlas, sample_position, current_depth, bias);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return shadow_sum / 9.0;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
float shadow_pcf_2d(
|
|
219
|
-
Shadow shadow,
|
|
220
|
-
sampler2DArray shadow_atlas,
|
|
221
|
-
vec3 shadow_map_postion,
|
|
222
|
-
float current_depth,
|
|
223
|
-
float bias
|
|
224
|
-
){
|
|
225
|
-
return shadow_pcf_2d_radius(
|
|
226
|
-
shadow,
|
|
227
|
-
shadow_atlas,
|
|
228
|
-
shadow_map_postion,
|
|
229
|
-
current_depth,
|
|
230
|
-
shadow.pcf_radius,
|
|
231
|
-
bias
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
float shadow_pcf_cube_radius(
|
|
236
|
-
Shadow shadow,
|
|
237
|
-
sampler2DArray shadow_atlas,
|
|
238
|
-
vec3 direction,
|
|
239
|
-
float current_depth,
|
|
240
|
-
float radius,
|
|
241
|
-
float bias
|
|
242
|
-
){
|
|
243
|
-
vec3 ndc_uv = map_cube_from_array_texture_ndc(direction);
|
|
244
|
-
vec2 texel_size = 1.0 / vec2(textureSize(shadow_atlas, 0).xy);
|
|
245
|
-
vec2 pcf_step = texel_size * radius;
|
|
246
|
-
float shadow_sum = 0.0;
|
|
247
|
-
|
|
248
|
-
for (int y = -1; y <= 1; y++) {
|
|
249
|
-
for (int x = -1; x <= 1; x++) {
|
|
250
|
-
vec2 sample_offset = vec2(float(x), float(y)) * pcf_step;
|
|
251
|
-
vec2 sample_uv = ndc_uv.xy + sample_offset;
|
|
252
|
-
vec3 sample_direction = map_cube_to_array_texture_direction(ndc_uv.z, sample_uv);
|
|
253
|
-
shadow_sum += shadow_compare_cube(shadow, shadow_atlas, sample_direction, current_depth, bias);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return shadow_sum / 9.0;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
float shadow_pcf_cube(
|
|
261
|
-
Shadow shadow,
|
|
262
|
-
sampler2DArray shadow_atlas,
|
|
263
|
-
vec3 direction,
|
|
264
|
-
float current_depth,
|
|
265
|
-
float bias
|
|
266
|
-
){
|
|
267
|
-
return shadow_pcf_cube_radius(
|
|
268
|
-
shadow,
|
|
269
|
-
shadow_atlas,
|
|
270
|
-
direction,
|
|
271
|
-
current_depth,
|
|
272
|
-
shadow.pcf_radius,
|
|
273
|
-
bias
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
float shadow_pcss_2d(
|
|
278
|
-
Shadow shadow,
|
|
279
|
-
sampler2DArray shadow_atlas,
|
|
280
|
-
vec3 shadow_map_postion,
|
|
281
|
-
float current_depth,
|
|
282
|
-
float bias
|
|
283
|
-
){
|
|
284
|
-
vec2 texel_size = 1.0 / vec2(textureSize(shadow_atlas, 0).xy);
|
|
285
|
-
vec2 search_step = texel_size * shadow.pcss_search_radius;
|
|
286
|
-
float blocker_sum = 0.0;
|
|
287
|
-
float blocker_count = 0.0;
|
|
288
|
-
|
|
289
|
-
for (int y = -1; y <= 1; y++) {
|
|
290
|
-
for (int x = -1; x <= 1; x++) {
|
|
291
|
-
vec2 sample_offset = vec2(float(x), float(y)) * search_step;
|
|
292
|
-
float sample_depth = texture(
|
|
293
|
-
shadow_atlas,
|
|
294
|
-
vec3(shadow_map_postion.xy + sample_offset, shadow.layer)
|
|
295
|
-
).r;
|
|
296
|
-
if (sample_depth < current_depth - bias) {
|
|
297
|
-
blocker_sum += sample_depth;
|
|
298
|
-
blocker_count += 1.0;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
if (blocker_count == 0.0) {
|
|
304
|
-
return 1.0;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
float blocker_depth = blocker_sum / blocker_count;
|
|
308
|
-
float penumbra = (current_depth - blocker_depth) / max(blocker_depth, 0.0001);
|
|
309
|
-
float filter_radius = clamp(
|
|
310
|
-
shadow.pcf_radius + penumbra * shadow.pcss_penumbra,
|
|
311
|
-
shadow.pcf_radius,
|
|
312
|
-
shadow.pcf_radius + 12.0
|
|
313
|
-
);
|
|
314
|
-
return shadow_pcf_2d_radius(
|
|
315
|
-
shadow,
|
|
316
|
-
shadow_atlas,
|
|
317
|
-
shadow_map_postion,
|
|
318
|
-
current_depth,
|
|
319
|
-
filter_radius,
|
|
320
|
-
bias
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
float shadow_pcss_cube(
|
|
325
|
-
Shadow shadow,
|
|
326
|
-
sampler2DArray shadow_atlas,
|
|
327
|
-
vec3 direction,
|
|
328
|
-
float current_depth,
|
|
329
|
-
float bias
|
|
330
|
-
){
|
|
331
|
-
vec3 ndc_uv = map_cube_from_array_texture_ndc(direction);
|
|
332
|
-
vec2 texel_size = 1.0 / vec2(textureSize(shadow_atlas, 0).xy);
|
|
333
|
-
vec2 search_step = texel_size * shadow.pcss_search_radius;
|
|
334
|
-
vec2 clip_planes = shadow.space[0].xy;
|
|
335
|
-
float near = clip_planes.x;
|
|
336
|
-
float far = clip_planes.y;
|
|
337
|
-
float blocker_sum = 0.0;
|
|
338
|
-
float blocker_count = 0.0;
|
|
339
|
-
|
|
340
|
-
for (int y = -1; y <= 1; y++) {
|
|
341
|
-
for (int x = -1; x <= 1; x++) {
|
|
342
|
-
vec2 sample_offset = vec2(float(x), float(y)) * search_step;
|
|
343
|
-
vec2 sample_uv = ndc_uv.xy + sample_offset;
|
|
344
|
-
vec3 sample_direction = map_cube_to_array_texture_direction(ndc_uv.z, sample_uv);
|
|
345
|
-
vec3 sample_ndc = map_cube_from_array_texture_ndc(sample_direction);
|
|
346
|
-
vec2 sample_shadow_uv = sample_ndc.xy * 0.5 + 0.5;
|
|
347
|
-
float shadow_map_depth = texture(
|
|
348
|
-
shadow_atlas,
|
|
349
|
-
vec3(sample_shadow_uv.xy, shadow.layer + sample_ndc.z)
|
|
350
|
-
).r;
|
|
351
|
-
vec3 norm_direction = normalize(sample_direction);
|
|
352
|
-
float scale = max(abs(norm_direction.x), max(abs(norm_direction.y), abs(norm_direction.z)));
|
|
353
|
-
float view_space_map_depth = linearize_depth(shadow_map_depth, near, far);
|
|
354
|
-
float map_depth = view_space_map_depth / (scale * far);
|
|
355
|
-
if (map_depth < current_depth - bias) {
|
|
356
|
-
blocker_sum += map_depth;
|
|
357
|
-
blocker_count += 1.0;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (blocker_count == 0.0) {
|
|
363
|
-
return 1.0;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
float blocker_depth = blocker_sum / blocker_count;
|
|
367
|
-
float penumbra = (current_depth - blocker_depth) / max(blocker_depth, 0.0001);
|
|
368
|
-
float filter_radius = clamp(
|
|
369
|
-
shadow.pcf_radius + penumbra * shadow.pcss_penumbra,
|
|
370
|
-
shadow.pcf_radius,
|
|
371
|
-
shadow.pcf_radius + 12.0
|
|
372
|
-
);
|
|
373
|
-
return shadow_pcf_cube_radius(
|
|
374
|
-
shadow,
|
|
375
|
-
shadow_atlas,
|
|
376
|
-
direction,
|
|
377
|
-
current_depth,
|
|
378
|
-
filter_radius,
|
|
379
|
-
bias
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
float shadow_contribution_2d(Shadow shadow, sampler2DArray shadow_atlas, vec3 position, float NdotL){
|
|
384
|
-
vec4 clipped_position = shadow.space * vec4(position, 1.0);
|
|
385
|
-
vec3 ndc_position = clipped_position.xyz / clipped_position.w;
|
|
386
|
-
vec3 shadow_map_postion = ndc_position * 0.5 + 0.5;
|
|
387
|
-
|
|
388
|
-
if(
|
|
389
|
-
shadow_map_postion.x < 0.0 || shadow_map_postion.x > 1.0 ||
|
|
390
|
-
shadow_map_postion.y < 0.0 || shadow_map_postion.y > 1.0
|
|
391
|
-
){
|
|
392
|
-
return 1.0;
|
|
393
|
-
}
|
|
394
|
-
float current_depth = shadow_map_postion.z;
|
|
395
|
-
float normal_bias = shadow.normal_bias * (1.0 - NdotL);
|
|
396
|
-
float bias = shadow.bias + normal_bias;
|
|
397
|
-
|
|
398
|
-
if (shadow.mode == 0u) {
|
|
399
|
-
return shadow_compare_2d(shadow, shadow_atlas, shadow_map_postion, current_depth, bias);
|
|
400
|
-
}
|
|
401
|
-
if (shadow.mode == 1u) {
|
|
402
|
-
return shadow_pcf_2d(shadow, shadow_atlas, shadow_map_postion, current_depth, bias);
|
|
403
|
-
}
|
|
404
|
-
if (shadow.mode == 2u) {
|
|
405
|
-
return shadow_pcss_2d(shadow, shadow_atlas, shadow_map_postion, current_depth, bias);
|
|
406
|
-
}
|
|
407
|
-
return shadow_pcf_2d(shadow, shadow_atlas, shadow_map_postion, current_depth, bias);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
float shadow_contribution_cube(Shadow shadow, sampler2DArray shadow_atlas, vec3 position, float NdotL){
|
|
411
|
-
// the clipping planes are encoded in the first column of the space matrix
|
|
412
|
-
vec2 clip_planes = shadow.space[0].xy;
|
|
413
|
-
vec3 light_position = shadow.space[3].xyz;
|
|
414
|
-
vec3 direction = position - light_position;
|
|
415
|
-
float distance = length(direction);
|
|
416
|
-
vec3 norm_distance = direction / distance;
|
|
417
|
-
float near = clip_planes.x;
|
|
418
|
-
float far = clip_planes.y;
|
|
419
|
-
float current_depth = distance / far;
|
|
420
|
-
|
|
421
|
-
vec3 ndc_uv = map_cube_from_array_texture_ndc(direction);
|
|
422
|
-
vec2 shadow_uv = ndc_uv.xy * 0.5 + 0.5;
|
|
423
|
-
|
|
424
|
-
float normal_bias = shadow.normal_bias * (1.0 - NdotL);
|
|
425
|
-
float bias = shadow.bias + normal_bias;
|
|
426
|
-
|
|
427
|
-
if (shadow.mode == 0u) {
|
|
428
|
-
return shadow_compare_cube(shadow, shadow_atlas, direction, current_depth, bias);
|
|
429
|
-
}
|
|
430
|
-
if (shadow.mode == 1u) {
|
|
431
|
-
return shadow_pcf_cube(shadow, shadow_atlas, direction, current_depth, bias);
|
|
432
|
-
}
|
|
433
|
-
if (shadow.mode == 2u) {
|
|
434
|
-
return shadow_pcss_cube(shadow, shadow_atlas, direction, current_depth, bias);
|
|
435
|
-
}
|
|
436
|
-
return shadow_pcf_cube(shadow, shadow_atlas, direction, current_depth, bias);
|
|
437
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const float PI = 3.14159265359;
|
|
2
|
-
|
|
3
|
-
// functions
|
|
4
|
-
float sq(float x) {
|
|
5
|
-
return x * x;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// https://learnopengl.com/Advanced-OpenGL/Depth-testing
|
|
9
|
-
float linearize_depth(float depth, float near, float far){
|
|
10
|
-
float ndc = depth * 2.0 - 1.0;
|
|
11
|
-
return (2.0 * near * far) / (far + near - ndc * (far - near));
|
|
12
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
vec3 reinhard_tonemapping(vec3 color, float exposure) {
|
|
2
|
-
vec3 exposed_color = color * exposure;
|
|
3
|
-
|
|
4
|
-
return exposed_color / (exposed_color + vec3(1.0));
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
vec3 aces_filmic_tonemapping(vec3 color, float exposure) {
|
|
8
|
-
vec3 exposed_color = color * exposure;
|
|
9
|
-
|
|
10
|
-
return clamp(
|
|
11
|
-
(exposed_color * (2.51 * exposed_color + vec3(0.03))) /
|
|
12
|
-
(exposed_color * (2.43 * exposed_color + vec3(0.59)) + vec3(0.14)),
|
|
13
|
-
0.0,
|
|
14
|
-
1.0
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
vec3 hable_curve(vec3 color) {
|
|
19
|
-
const float A = 0.15;
|
|
20
|
-
const float B = 0.50;
|
|
21
|
-
const float C = 0.10;
|
|
22
|
-
const float D = 0.20;
|
|
23
|
-
const float E = 0.02;
|
|
24
|
-
const float F = 0.30;
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
(color * (A * color + C * B) + D * E) /
|
|
28
|
-
(color * (A * color + B) + D * F)
|
|
29
|
-
) - E / F;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
vec3 hable_tonemapping(vec3 color, float exposure) {
|
|
33
|
-
const float white_point = 11.2;
|
|
34
|
-
|
|
35
|
-
vec3 exposed_color = color * exposure;
|
|
36
|
-
float white_scale = 1.0 / hable_curve(vec3(white_point)).r;
|
|
37
|
-
|
|
38
|
-
return clamp(hable_curve(exposed_color) * white_scale, 0.0, 1.0);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
vec3 agx_default_contrast_approx(vec3 color) {
|
|
42
|
-
vec3 color_squared = color * color;
|
|
43
|
-
vec3 color_quad = color_squared * color_squared;
|
|
44
|
-
|
|
45
|
-
return
|
|
46
|
-
15.5 * color_quad * color_squared -
|
|
47
|
-
40.14 * color_quad * color +
|
|
48
|
-
31.96 * color_quad -
|
|
49
|
-
6.868 * color_squared * color +
|
|
50
|
-
0.4298 * color_squared +
|
|
51
|
-
0.1191 * color -
|
|
52
|
-
0.00232;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
vec3 agx_tonemapping(vec3 color, float exposure) {
|
|
56
|
-
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
|
|
57
|
-
vec3(0.6274, 0.0691, 0.0164),
|
|
58
|
-
vec3(0.3293, 0.9195, 0.0880),
|
|
59
|
-
vec3(0.0433, 0.0113, 0.8956)
|
|
60
|
-
);
|
|
61
|
-
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
|
|
62
|
-
vec3(1.6605, -0.1246, -0.0182),
|
|
63
|
-
vec3(-0.5876, 1.1329, -0.1006),
|
|
64
|
-
vec3(-0.0728, -0.0083, 1.1187)
|
|
65
|
-
);
|
|
66
|
-
const mat3 AGX_INSET_MATRIX = mat3(
|
|
67
|
-
vec3(0.856627153315983, 0.137318972929847, 0.11189821299995),
|
|
68
|
-
vec3(0.0951212405381588, 0.761241990602591, 0.0767994186031903),
|
|
69
|
-
vec3(0.0482516061458583, 0.101439036467562, 0.811302368396859)
|
|
70
|
-
);
|
|
71
|
-
const mat3 AGX_OUTSET_MATRIX = mat3(
|
|
72
|
-
vec3(1.1271005818144368, -0.1413297634984383, -0.14132976349843826),
|
|
73
|
-
vec3(-0.11060664309660323, 1.157823702216272, -0.11060664309660294),
|
|
74
|
-
vec3(-0.016493938717834573, -0.016493938717834257, 1.2519364065950405)
|
|
75
|
-
);
|
|
76
|
-
const float min_ev = -12.47393;
|
|
77
|
-
const float max_ev = 4.026069;
|
|
78
|
-
|
|
79
|
-
vec3 exposed_color = color * exposure;
|
|
80
|
-
|
|
81
|
-
exposed_color = LINEAR_SRGB_TO_LINEAR_REC2020 * exposed_color;
|
|
82
|
-
exposed_color = AGX_INSET_MATRIX * exposed_color;
|
|
83
|
-
exposed_color = max(exposed_color, vec3(1e-10));
|
|
84
|
-
exposed_color = log2(exposed_color);
|
|
85
|
-
exposed_color = (exposed_color - min_ev) / (max_ev - min_ev);
|
|
86
|
-
exposed_color = clamp(exposed_color, 0.0, 1.0);
|
|
87
|
-
exposed_color = agx_default_contrast_approx(exposed_color);
|
|
88
|
-
exposed_color = AGX_OUTSET_MATRIX * exposed_color;
|
|
89
|
-
exposed_color = pow(max(vec3(0.0), exposed_color), vec3(2.2));
|
|
90
|
-
exposed_color = LINEAR_REC2020_TO_LINEAR_SRGB * exposed_color;
|
|
91
|
-
|
|
92
|
-
return clamp(exposed_color, 0.0, 1.0);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
vec3 khronos_pbr_neutral_tonemapping(vec3 color, float exposure) {
|
|
96
|
-
const float start_compression = 0.8 - 0.04;
|
|
97
|
-
const float desaturation = 0.15;
|
|
98
|
-
|
|
99
|
-
vec3 exposed_color = color * exposure;
|
|
100
|
-
float x = min(exposed_color.r, min(exposed_color.g, exposed_color.b));
|
|
101
|
-
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
|
102
|
-
|
|
103
|
-
exposed_color -= offset;
|
|
104
|
-
|
|
105
|
-
float peak = max(exposed_color.r, max(exposed_color.g, exposed_color.b));
|
|
106
|
-
if (peak < start_compression) {
|
|
107
|
-
return exposed_color;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
float d = 1.0 - start_compression;
|
|
111
|
-
float new_peak = 1.0 - d * d / (peak + d - start_compression);
|
|
112
|
-
|
|
113
|
-
exposed_color *= new_peak / peak;
|
|
114
|
-
|
|
115
|
-
float g = 1.0 - 1.0 / (desaturation * (peak - new_peak) + 1.0);
|
|
116
|
-
|
|
117
|
-
return mix(exposed_color, vec3(new_peak), g);
|
|
118
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#include <common>
|
|
2
|
-
|
|
3
|
-
uniform CameraBlock {
|
|
4
|
-
Camera camera;
|
|
5
|
-
};
|
|
6
|
-
uniform sampler2DArray transforms;
|
|
7
|
-
uniform mat4 model;
|
|
8
|
-
uniform uint parent_index;
|
|
9
|
-
uniform uint child_index;
|
|
10
|
-
|
|
11
|
-
out vec3 color;
|
|
12
|
-
|
|
13
|
-
void main() {
|
|
14
|
-
mat4 parent_matrix = get_value_from_texture(parent_index, transforms);
|
|
15
|
-
mat4 child_matrix = get_value_from_texture(child_index, transforms);
|
|
16
|
-
|
|
17
|
-
vec3 parent_position = parent_matrix[3].xyz;
|
|
18
|
-
vec3 child_position = child_matrix[3].xyz;
|
|
19
|
-
|
|
20
|
-
// Each bone line is made of two vertices.
|
|
21
|
-
vec3 world_position = (gl_VertexID % 2 == 0) ? parent_position : child_position;
|
|
22
|
-
|
|
23
|
-
color = (gl_VertexID % 2 == 0) ? vec3(0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0);
|
|
24
|
-
gl_Position = camera.projection * camera.view * model * vec4(world_position, 1.0);
|
|
25
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#include <math>
|
|
2
|
-
#include <common>
|
|
3
|
-
|
|
4
|
-
struct CameraParams {
|
|
5
|
-
float near;
|
|
6
|
-
float far;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
#ifdef VERTEX_UVS
|
|
10
|
-
in vec2 v_uv;
|
|
11
|
-
#endif
|
|
12
|
-
|
|
13
|
-
uniform MaterialBlock {
|
|
14
|
-
CameraParams params;
|
|
15
|
-
};
|
|
16
|
-
uniform sampler2D depth_texture;
|
|
17
|
-
|
|
18
|
-
out vec4 fragment_color;
|
|
19
|
-
|
|
20
|
-
void main(){
|
|
21
|
-
#ifdef VERTEX_UVS
|
|
22
|
-
float sample_depth = texture(depth_texture, v_uv).r / 1.0;
|
|
23
|
-
float linear_depth = linearize_depth(sample_depth, params.near, params.far) / params.far;
|
|
24
|
-
float visual_depth = (sample_depth - params.near) / (params.far - params.near);
|
|
25
|
-
fragment_color = vec4(
|
|
26
|
-
linear_depth,
|
|
27
|
-
linear_depth,
|
|
28
|
-
linear_depth,
|
|
29
|
-
1.0
|
|
30
|
-
);
|
|
31
|
-
#else
|
|
32
|
-
fragment_color = vec4(1.0, 0.0, 0.0, 1.0);
|
|
33
|
-
#endif
|
|
34
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
out vec2 v_uv;
|
|
2
|
-
|
|
3
|
-
// Fullscreen triangle generated from gl_VertexID.
|
|
4
|
-
//
|
|
5
|
-
// The three vertices form one oversized triangle in UV / position space:
|
|
6
|
-
//
|
|
7
|
-
// (0, 2)
|
|
8
|
-
// |\
|
|
9
|
-
// | \
|
|
10
|
-
// | \
|
|
11
|
-
// | \
|
|
12
|
-
// (0, 1)+----+(1, 1)
|
|
13
|
-
// | |\
|
|
14
|
-
// | | \
|
|
15
|
-
// | | \
|
|
16
|
-
// (0, 0)+----+---\(2, 0)
|
|
17
|
-
// (1, 0)
|
|
18
|
-
void main() {
|
|
19
|
-
vec2 position = vec2(
|
|
20
|
-
float((gl_VertexID << 1) & 2),
|
|
21
|
-
float(gl_VertexID & 2)
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
v_uv = position;
|
|
25
|
-
gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
|
|
26
|
-
}
|
package/src/shader/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from './common/index.js'
|
|
2
|
-
export * from './debug/index.js'
|
|
3
|
-
export { default as basicVertex } from './basicVertex.glsl'
|
|
4
|
-
export { default as fullscreenVertex } from './fullscreenVertex.glsl'
|
|
5
|
-
export { default as basicFragment } from './basicFragment.glsl'
|
|
6
|
-
export { default as blitFragment } from './blitFragment.glsl'
|
|
7
|
-
export { default as tonemappingFragment } from './tonemappingFragment.glsl'
|
|
8
|
-
export { default as normalFragment } from './normalFragment.glsl'
|
|
9
|
-
export { default as lambertFragment } from './lambertFragment.glsl'
|
|
10
|
-
export { default as phongFragment } from './phongFragment.glsl'
|
|
11
|
-
export { default as standardFragment } from './standardFragment.glsl'
|
|
12
|
-
export { default as skyboxVertex } from './skyboxVertex.glsl'
|
|
13
|
-
export { default as skyboxFragment } from './skyboxFragment.glsl'
|
|
14
|
-
export { default as depthFragment } from './depthFragment.glsl'
|