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,134 +0,0 @@
|
|
|
1
|
-
#include <math>
|
|
2
|
-
#include <common>
|
|
3
|
-
#include <light>
|
|
4
|
-
|
|
5
|
-
struct LambertMaterial {
|
|
6
|
-
vec4 color;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
in vec3 v_position;
|
|
10
|
-
#ifdef VERTEX_UVS
|
|
11
|
-
in vec2 v_uv;
|
|
12
|
-
#endif
|
|
13
|
-
#ifdef VERTEX_NORMALS
|
|
14
|
-
in vec3 v_normal;
|
|
15
|
-
#endif
|
|
16
|
-
|
|
17
|
-
uniform MaterialBlock {
|
|
18
|
-
LambertMaterial material;
|
|
19
|
-
};
|
|
20
|
-
#ifdef ALPHA_MASK_MODE
|
|
21
|
-
uniform AlphaMaskBlock {
|
|
22
|
-
float cutoff;
|
|
23
|
-
};
|
|
24
|
-
#endif
|
|
25
|
-
// Lights
|
|
26
|
-
uniform AmbientLightBlock {
|
|
27
|
-
AmbientLight ambient_light;
|
|
28
|
-
};
|
|
29
|
-
uniform DirectionalLightBlock {
|
|
30
|
-
DirectionalLights directional_lights;
|
|
31
|
-
};
|
|
32
|
-
uniform PointLightBlock {
|
|
33
|
-
PointLights point_lights;
|
|
34
|
-
};
|
|
35
|
-
uniform SpotLightBlock {
|
|
36
|
-
SpotLights spot_lights;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
40
|
-
uniform ShadowCasterBlock {
|
|
41
|
-
Shadow shadow_casters[MAX_SHADOW_CASTERS];
|
|
42
|
-
};
|
|
43
|
-
uniform sampler2DArray shadow_atlas;
|
|
44
|
-
#endif
|
|
45
|
-
uniform sampler2D mainTexture;
|
|
46
|
-
out vec4 fragment_color;
|
|
47
|
-
|
|
48
|
-
void main(){
|
|
49
|
-
vec3 base_color = material.color.rgb;
|
|
50
|
-
float opacity = material.color.a;
|
|
51
|
-
|
|
52
|
-
#ifdef VERTEX_UVS
|
|
53
|
-
vec4 sample_color = texture(mainTexture,v_uv);
|
|
54
|
-
base_color *= sample_color.rgb;
|
|
55
|
-
opacity *= sample_color.a;
|
|
56
|
-
#endif
|
|
57
|
-
#ifdef VERTEX_NORMALS
|
|
58
|
-
vec3 normal = normalize(v_normal);
|
|
59
|
-
#else
|
|
60
|
-
#error "Mesh vertex normals are required for lighting."
|
|
61
|
-
#endif
|
|
62
|
-
#ifdef ALPHA_MASK_MODE
|
|
63
|
-
if (opacity < cutoff) {
|
|
64
|
-
discard;
|
|
65
|
-
}
|
|
66
|
-
#endif
|
|
67
|
-
int directional_light_count = min(directional_lights.count,MAX_DIRECTIONAL_LIGHTS);
|
|
68
|
-
int point_light_count = min(point_lights.count,MAX_POINT_LIGHTS);
|
|
69
|
-
int spot_light_count = min(spot_lights.count,MAX_SPOT_LIGHTS);
|
|
70
|
-
|
|
71
|
-
vec3 ambient = ambient_light.color.rgb * ambient_light.intensity;
|
|
72
|
-
|
|
73
|
-
vec3 total_exitance = vec3(0.0, 0.0, 0.0);
|
|
74
|
-
for (int i = 0; i < directional_light_count; i++) {
|
|
75
|
-
DirectionalLight light = directional_lights.lights[i];
|
|
76
|
-
//Remember you set the dir to negative because direction to light is the opposite direction of dir.
|
|
77
|
-
vec3 light_direction = -light.direction;
|
|
78
|
-
float brightness = calculate_brightness(normal, light_direction);
|
|
79
|
-
vec3 irradiance = light.color.rgb * brightness * light.intensity;
|
|
80
|
-
|
|
81
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
82
|
-
if(light.shadow_index != -1){
|
|
83
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
84
|
-
|
|
85
|
-
irradiance *= shadow_contribution_2d(shadow, shadow_atlas, v_position, brightness);
|
|
86
|
-
}
|
|
87
|
-
#endif
|
|
88
|
-
total_exitance += base_color * irradiance;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
for (int i = 0; i < point_light_count; i++) {
|
|
92
|
-
PointLight light = point_lights.lights[i];
|
|
93
|
-
vec3 distance_vector = light.position - v_position;
|
|
94
|
-
float distance = length(distance_vector);
|
|
95
|
-
vec3 direction = distance_vector / distance;
|
|
96
|
-
float attenuation = attenuate_point_light(distance, light.radius, light.intensity, light.decay);
|
|
97
|
-
float brightness = calculate_brightness(normal, direction);
|
|
98
|
-
vec3 irradiance = light.color.rgb * attenuation;
|
|
99
|
-
|
|
100
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
101
|
-
if(light.shadow_index != -1){
|
|
102
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
103
|
-
|
|
104
|
-
irradiance *= shadow_contribution_cube(shadow, shadow_atlas, v_position, brightness);
|
|
105
|
-
}
|
|
106
|
-
#endif
|
|
107
|
-
|
|
108
|
-
total_exitance += base_color * brightness * irradiance;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
for (int i = 0; i < spot_light_count; i++) {
|
|
112
|
-
SpotLight light = spot_lights.lights[i];
|
|
113
|
-
vec3 distance_vector = light.position - v_position;
|
|
114
|
-
float distance = length(distance_vector);
|
|
115
|
-
vec3 direction = distance_vector / distance;
|
|
116
|
-
float attenuation = attenuate_spot_light(light, direction, distance);
|
|
117
|
-
float brightness = calculate_brightness(normal, direction);
|
|
118
|
-
vec3 irradiance = light.color.rgb * attenuation;
|
|
119
|
-
|
|
120
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
121
|
-
if(light.shadow_index != -1){
|
|
122
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
123
|
-
|
|
124
|
-
irradiance *= shadow_contribution_2d(shadow, shadow_atlas, v_position, brightness);
|
|
125
|
-
}
|
|
126
|
-
#endif
|
|
127
|
-
|
|
128
|
-
total_exitance += base_color * brightness * irradiance;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
vec3 final_color = ambient * base_color + total_exitance;
|
|
132
|
-
|
|
133
|
-
fragment_color = vec4(final_color,opacity);
|
|
134
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#include <common>
|
|
2
|
-
|
|
3
|
-
struct NormalMaterial {
|
|
4
|
-
vec4 padding;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
in vec3 v_normal;
|
|
8
|
-
|
|
9
|
-
out vec4 fragment_color;
|
|
10
|
-
|
|
11
|
-
uniform MaterialBlock {
|
|
12
|
-
NormalMaterial material;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
void main(){
|
|
16
|
-
#ifdef VERTEX_NORMALS
|
|
17
|
-
vec3 normal = normalize(v_normal);
|
|
18
|
-
#else
|
|
19
|
-
#error "Mesh vertex normals are required for lighting."
|
|
20
|
-
#endif
|
|
21
|
-
fragment_color = vec4(normal, 1.0);
|
|
22
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
#include <common>
|
|
2
|
-
#include <math>
|
|
3
|
-
#include <light>
|
|
4
|
-
|
|
5
|
-
struct PhongMaterial {
|
|
6
|
-
vec4 color;
|
|
7
|
-
float specularShininess;
|
|
8
|
-
float specularStrength;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
in vec3 v_position;
|
|
12
|
-
#ifdef VERTEX_UVS
|
|
13
|
-
in vec2 v_uv;
|
|
14
|
-
#endif
|
|
15
|
-
in vec3 v_normal;
|
|
16
|
-
in vec3 cam_direction;
|
|
17
|
-
|
|
18
|
-
uniform MaterialBlock {
|
|
19
|
-
PhongMaterial material;
|
|
20
|
-
};
|
|
21
|
-
#ifdef ALPHA_MASK_MODE
|
|
22
|
-
uniform AlphaMaskBlock {
|
|
23
|
-
float cutoff;
|
|
24
|
-
};
|
|
25
|
-
#endif
|
|
26
|
-
uniform AmbientLightBlock {
|
|
27
|
-
AmbientLight ambient_light;
|
|
28
|
-
};
|
|
29
|
-
uniform DirectionalLightBlock {
|
|
30
|
-
DirectionalLights directional_lights;
|
|
31
|
-
};
|
|
32
|
-
uniform PointLightBlock {
|
|
33
|
-
PointLights point_lights;
|
|
34
|
-
};
|
|
35
|
-
uniform SpotLightBlock {
|
|
36
|
-
SpotLights spot_lights;
|
|
37
|
-
};
|
|
38
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
39
|
-
uniform ShadowCasterBlock {
|
|
40
|
-
Shadow shadow_casters[MAX_SHADOW_CASTERS];
|
|
41
|
-
};
|
|
42
|
-
uniform sampler2DArray shadow_atlas;
|
|
43
|
-
#endif
|
|
44
|
-
uniform sampler2D mainTexture;
|
|
45
|
-
|
|
46
|
-
out vec4 fragment_color;
|
|
47
|
-
|
|
48
|
-
void main(){
|
|
49
|
-
vec3 base_color = material.color.rgb;
|
|
50
|
-
float opacity = material.color.a;
|
|
51
|
-
#ifdef VERTEX_UVS
|
|
52
|
-
vec4 sample_color = texture(mainTexture,v_uv);
|
|
53
|
-
base_color *= sample_color.rgb;
|
|
54
|
-
opacity *= sample_color.a;
|
|
55
|
-
#endif
|
|
56
|
-
#ifdef VERTEX_NORMALS
|
|
57
|
-
vec3 normal = normalize(v_normal);
|
|
58
|
-
#else
|
|
59
|
-
#error "Mesh vertex normals are required for lighting."
|
|
60
|
-
#endif
|
|
61
|
-
vec3 view_direction = normalize(cam_direction);
|
|
62
|
-
#ifdef ALPHA_MASK_MODE
|
|
63
|
-
if (opacity < cutoff) {
|
|
64
|
-
discard;
|
|
65
|
-
}
|
|
66
|
-
#endif
|
|
67
|
-
int directional_light_count = min(directional_lights.count,MAX_DIRECTIONAL_LIGHTS);
|
|
68
|
-
int point_light_count = min(point_lights.count,MAX_POINT_LIGHTS);
|
|
69
|
-
int spot_light_count = min(spot_lights.count,MAX_SPOT_LIGHTS);
|
|
70
|
-
|
|
71
|
-
vec3 total_exitance = vec3(0.0);
|
|
72
|
-
for (int i = 0; i < directional_light_count; i++) {
|
|
73
|
-
DirectionalLight light = directional_lights.lights[i];
|
|
74
|
-
vec3 reflection_direction = reflect(light.direction, normal);
|
|
75
|
-
vec3 irradiance = light.color.rgb;
|
|
76
|
-
//Remember you set the dir to negative because light direction is the opposite direction of dir.
|
|
77
|
-
float diffuse_brightness = calculate_brightness(normal,-light.direction);
|
|
78
|
-
|
|
79
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
80
|
-
if(light.shadow_index != -1){
|
|
81
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
82
|
-
|
|
83
|
-
irradiance *= shadow_contribution_2d(shadow, shadow_atlas, v_position, diffuse_brightness);
|
|
84
|
-
}
|
|
85
|
-
#endif
|
|
86
|
-
|
|
87
|
-
vec3 diffuse = base_color * irradiance * diffuse_brightness * light.intensity;
|
|
88
|
-
|
|
89
|
-
float specular_brightness = calculate_brightness(reflection_direction,view_direction);
|
|
90
|
-
vec3 specular = pow(specular_brightness,material.specularShininess) * irradiance * material.specularStrength;
|
|
91
|
-
|
|
92
|
-
total_exitance += specular + diffuse;
|
|
93
|
-
}
|
|
94
|
-
for (int i = 0; i < point_light_count; i++) {
|
|
95
|
-
PointLight light = point_lights.lights[i];
|
|
96
|
-
vec3 distance_vector = light.position - v_position;
|
|
97
|
-
float distance = length(distance_vector);
|
|
98
|
-
vec3 direction = distance_vector / distance;
|
|
99
|
-
float attenuation = attenuate_point_light(distance, light.radius, light.intensity, light.decay);
|
|
100
|
-
float brightness = calculate_brightness(normal, direction);
|
|
101
|
-
vec3 irradiance = light.color.rgb * attenuation;
|
|
102
|
-
|
|
103
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
104
|
-
if(light.shadow_index != -1){
|
|
105
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
106
|
-
|
|
107
|
-
irradiance *= shadow_contribution_cube(shadow, shadow_atlas, v_position, brightness);
|
|
108
|
-
}
|
|
109
|
-
#endif
|
|
110
|
-
|
|
111
|
-
vec3 reflection_direction = reflect(direction, normal);
|
|
112
|
-
vec3 diffuse_exitance = base_color * brightness * irradiance;
|
|
113
|
-
|
|
114
|
-
float specular_brightness = calculate_brightness(reflection_direction, -view_direction);
|
|
115
|
-
vec3 specular_exitance = pow(specular_brightness,material.specularShininess) * irradiance * material.specularStrength;
|
|
116
|
-
total_exitance += specular_exitance + diffuse_exitance;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
for (int i = 0; i < spot_light_count; i++) {
|
|
120
|
-
SpotLight light = spot_lights.lights[i];
|
|
121
|
-
vec3 distance_vector = light.position - v_position;
|
|
122
|
-
float distance = length(distance_vector);
|
|
123
|
-
vec3 direction = distance_vector / distance;
|
|
124
|
-
float attenuation = attenuate_spot_light(light, direction, distance);
|
|
125
|
-
float brightness = calculate_brightness(normal, direction);
|
|
126
|
-
vec3 irradiance = light.color.rgb * attenuation;
|
|
127
|
-
|
|
128
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
129
|
-
if(light.shadow_index != -1){
|
|
130
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
131
|
-
|
|
132
|
-
irradiance *= shadow_contribution_2d(shadow, shadow_atlas, v_position, brightness);
|
|
133
|
-
}
|
|
134
|
-
#endif
|
|
135
|
-
|
|
136
|
-
vec3 reflection_direction = reflect(direction, normal);
|
|
137
|
-
vec3 diffuse_exitance = base_color * brightness * irradiance;
|
|
138
|
-
float specular_brightness = calculate_brightness(reflection_direction, -view_direction);
|
|
139
|
-
vec3 specular_exitance = pow(specular_brightness,material.specularShininess) * irradiance * material.specularStrength;
|
|
140
|
-
|
|
141
|
-
total_exitance += specular_exitance + diffuse_exitance;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
vec3 ambient = base_color * ambient_light.color.rgb * ambient_light.intensity;
|
|
145
|
-
vec3 final_color = ambient + total_exitance;
|
|
146
|
-
|
|
147
|
-
fragment_color = vec4(final_color, opacity);
|
|
148
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#include <common>
|
|
2
|
-
|
|
3
|
-
in highp vec3 v_uv;
|
|
4
|
-
|
|
5
|
-
uniform SkyBoxBlock {
|
|
6
|
-
mat4 model;
|
|
7
|
-
float lerp;
|
|
8
|
-
};
|
|
9
|
-
uniform samplerCube day;
|
|
10
|
-
uniform samplerCube night;
|
|
11
|
-
|
|
12
|
-
out vec4 fragment_color;
|
|
13
|
-
|
|
14
|
-
void main(){
|
|
15
|
-
fragment_color = mix(texture(day, v_uv), texture(night,v_uv), lerp);
|
|
16
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#include <common>
|
|
2
|
-
|
|
3
|
-
in vec3 position;
|
|
4
|
-
|
|
5
|
-
uniform CameraBlock {
|
|
6
|
-
Camera camera;
|
|
7
|
-
};
|
|
8
|
-
uniform SkyBoxBlock {
|
|
9
|
-
mat4 model;
|
|
10
|
-
float lerp;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
out highp vec3 v_uv;
|
|
14
|
-
|
|
15
|
-
void main(){
|
|
16
|
-
mat4 view = camera.view;
|
|
17
|
-
view[3].xyz = vec3(0.0);
|
|
18
|
-
v_uv = position;
|
|
19
|
-
gl_Position = camera.projection * view * model * vec4(position.xyz, 1.0);
|
|
20
|
-
gl_Position = gl_Position.xyww;
|
|
21
|
-
}
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
#include <math>
|
|
2
|
-
#include <color>
|
|
3
|
-
#include <common>
|
|
4
|
-
#include <light>
|
|
5
|
-
|
|
6
|
-
struct PBRInput {
|
|
7
|
-
float NdotL;
|
|
8
|
-
float NdotV;
|
|
9
|
-
float NdotH;
|
|
10
|
-
float HdotV;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
struct PBRProperties {
|
|
14
|
-
vec3 normal;
|
|
15
|
-
vec3 albedo;
|
|
16
|
-
vec3 emissive;
|
|
17
|
-
float opacity;
|
|
18
|
-
float metallic;
|
|
19
|
-
float roughness;
|
|
20
|
-
float ambient_occlusion;
|
|
21
|
-
float reflection_strength;
|
|
22
|
-
float transmission;
|
|
23
|
-
float thickness;
|
|
24
|
-
float ior;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
struct StandardMaterial {
|
|
28
|
-
vec4 color;
|
|
29
|
-
float metallic;
|
|
30
|
-
float roughness;
|
|
31
|
-
float ambient_occlusion_strength;
|
|
32
|
-
vec3 emissive_color;
|
|
33
|
-
float emissive_intensity;
|
|
34
|
-
float reflection_strength;
|
|
35
|
-
float transmission;
|
|
36
|
-
float thickness;
|
|
37
|
-
float ior;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
in vec3 v_position;
|
|
41
|
-
#ifdef VERTEX_UVS
|
|
42
|
-
in vec2 v_uv;
|
|
43
|
-
#endif
|
|
44
|
-
#ifdef VERTEX_NORMALS
|
|
45
|
-
in vec3 v_normal;
|
|
46
|
-
#endif
|
|
47
|
-
#ifdef VERTEX_TANGENTS
|
|
48
|
-
in vec4 v_tangent;
|
|
49
|
-
#endif
|
|
50
|
-
in vec3 cam_direction;
|
|
51
|
-
|
|
52
|
-
uniform MaterialBlock {
|
|
53
|
-
StandardMaterial material;
|
|
54
|
-
};
|
|
55
|
-
#ifdef ALPHA_MASK_MODE
|
|
56
|
-
uniform AlphaMaskBlock {
|
|
57
|
-
float cutoff;
|
|
58
|
-
};
|
|
59
|
-
#endif
|
|
60
|
-
uniform AmbientLightBlock {
|
|
61
|
-
AmbientLight ambient_light;
|
|
62
|
-
};
|
|
63
|
-
uniform DirectionalLightBlock {
|
|
64
|
-
DirectionalLights directional_lights;
|
|
65
|
-
};
|
|
66
|
-
uniform PointLightBlock {
|
|
67
|
-
PointLights point_lights;
|
|
68
|
-
};
|
|
69
|
-
uniform SpotLightBlock {
|
|
70
|
-
SpotLights spot_lights;
|
|
71
|
-
};
|
|
72
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
73
|
-
uniform ShadowCasterBlock {
|
|
74
|
-
Shadow shadow_casters[MAX_SHADOW_CASTERS];
|
|
75
|
-
};
|
|
76
|
-
uniform sampler2DArray shadow_atlas;
|
|
77
|
-
#endif
|
|
78
|
-
uniform sampler2D mainTexture;
|
|
79
|
-
uniform sampler2D normal_texture;
|
|
80
|
-
uniform sampler2D occlusion_texture;
|
|
81
|
-
uniform sampler2D roughness_texture;
|
|
82
|
-
uniform sampler2D metallic_texture;
|
|
83
|
-
uniform sampler2D transmission_texture;
|
|
84
|
-
uniform sampler2D thickness_texture;
|
|
85
|
-
uniform sampler2D emissive_texture;
|
|
86
|
-
uniform samplerCube environment_map;
|
|
87
|
-
|
|
88
|
-
out vec4 fragment_color;
|
|
89
|
-
|
|
90
|
-
vec3 fresnel_schlick(float HdotV, vec3 F0){
|
|
91
|
-
return F0 + (1.0 - F0) * pow(clamp(1.0 - HdotV, 0.0, 1.0), 5.0);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
float environment_lod(float roughness) {
|
|
95
|
-
ivec2 env_size = textureSize(environment_map, 0);
|
|
96
|
-
float levels = max(log2(float(max(env_size.x, env_size.y))), 0.0);
|
|
97
|
-
return roughness * roughness * levels;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
vec3 sample_environment_reflection(vec3 N, vec3 V, float roughness) {
|
|
101
|
-
vec3 reflection_direction = reflect(-V, N);
|
|
102
|
-
return textureLod(environment_map, reflection_direction, environment_lod(roughness)).rgb;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
vec3 sample_environment_refraction(vec3 N, vec3 V, float roughness, float ior) {
|
|
106
|
-
vec3 refraction_direction = refract(-V, N, 1.0 / ior);
|
|
107
|
-
|
|
108
|
-
if (dot(refraction_direction, refraction_direction) <= 0.0) {
|
|
109
|
-
return vec3(0.0);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return textureLod(environment_map, refraction_direction, environment_lod(roughness)).rgb;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Also the Trowbridge-Rietz normal distribution function
|
|
116
|
-
float GGX_normal_distribution(float NdotH, float roughness){
|
|
117
|
-
float a = roughness * roughness;
|
|
118
|
-
float a2 = a * a;
|
|
119
|
-
float NdotH2 = NdotH * NdotH;
|
|
120
|
-
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
|
|
121
|
-
denom = PI * denom * denom;
|
|
122
|
-
|
|
123
|
-
return a2 / denom;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
float geometry_schlickGGX(float NdotV, float roughness){
|
|
127
|
-
float r = (roughness + 1.0);
|
|
128
|
-
float k = (r * r) / 8.0;
|
|
129
|
-
float denom = NdotV * (1.0 - k) + k;
|
|
130
|
-
|
|
131
|
-
return NdotV / denom;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
float geometry_smith(float NdotV, float NdotL, float roughness){
|
|
135
|
-
float ggx2 = geometry_schlickGGX(NdotV, roughness);
|
|
136
|
-
float ggx1 = geometry_schlickGGX(NdotL, roughness);
|
|
137
|
-
|
|
138
|
-
return ggx1 * ggx2;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
vec3 cook_torrance_BRDF(PBRProperties pbr_properties, PBRInput pbr_input){
|
|
142
|
-
vec3 F0 = mix(vec3(0.04), pbr_properties.albedo, pbr_properties.metallic);
|
|
143
|
-
vec3 F = fresnel_schlick(pbr_input.HdotV, F0);
|
|
144
|
-
|
|
145
|
-
float NDF = GGX_normal_distribution(pbr_input.NdotH, pbr_properties.roughness);
|
|
146
|
-
float G = geometry_smith(pbr_input.NdotV, pbr_input.NdotL, pbr_properties.roughness);
|
|
147
|
-
|
|
148
|
-
vec3 numerator = NDF * G * F;
|
|
149
|
-
float denominator = 4.0 * pbr_input.NdotV * pbr_input.NdotL + 0.0001;
|
|
150
|
-
vec3 specular = numerator / denominator;
|
|
151
|
-
vec3 kS = F;
|
|
152
|
-
vec3 kD = (vec3(1.0) - kS) * (1.0 - pbr_properties.metallic);
|
|
153
|
-
|
|
154
|
-
return (kD * pbr_properties.albedo / PI + specular);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
PBRInput calculate_pbr_input(vec3 N, vec3 V, vec3 L, vec3 H){
|
|
158
|
-
PBRInput pbr_input;
|
|
159
|
-
|
|
160
|
-
pbr_input.NdotV = max(dot(N, V), 0.0);
|
|
161
|
-
pbr_input.NdotL = max(dot(N, L), 0.0);
|
|
162
|
-
pbr_input.NdotH = max(dot(N, H), 0.0);
|
|
163
|
-
pbr_input.HdotV = max(dot(H, V), 0.0);
|
|
164
|
-
|
|
165
|
-
return pbr_input;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
PBRProperties calculate_pbr_properties(){
|
|
169
|
-
PBRProperties properties;
|
|
170
|
-
|
|
171
|
-
properties.albedo = material.color.rgb;
|
|
172
|
-
properties.emissive = material.emissive_color;
|
|
173
|
-
properties.opacity = material.color.a;
|
|
174
|
-
properties.metallic = material.metallic;
|
|
175
|
-
properties.roughness = material.roughness;
|
|
176
|
-
properties.ambient_occlusion = 1.0;
|
|
177
|
-
properties.reflection_strength = material.reflection_strength;
|
|
178
|
-
properties.transmission = material.transmission;
|
|
179
|
-
properties.thickness = material.thickness;
|
|
180
|
-
properties.ior = max(material.ior, 1.0);
|
|
181
|
-
|
|
182
|
-
#ifdef VERTEX_UVS
|
|
183
|
-
vec4 albedo_texture_color = texture(mainTexture,v_uv);
|
|
184
|
-
properties.albedo *= quick_sRGB_to_linear(albedo_texture_color.rgb);
|
|
185
|
-
properties.opacity *= albedo_texture_color.a;
|
|
186
|
-
|
|
187
|
-
vec4 metallic_texture_color = texture(metallic_texture,v_uv);
|
|
188
|
-
properties.metallic *= metallic_texture_color.b;
|
|
189
|
-
|
|
190
|
-
vec4 roughness_texture_color = texture(roughness_texture,v_uv);
|
|
191
|
-
properties.roughness *= roughness_texture_color.g;
|
|
192
|
-
|
|
193
|
-
vec4 occlusion_texture_color = texture(occlusion_texture,v_uv);
|
|
194
|
-
properties.ambient_occlusion = mix(1.0,occlusion_texture_color.r, material.ambient_occlusion_strength);
|
|
195
|
-
|
|
196
|
-
vec4 emissive_texture_color = texture(emissive_texture,v_uv);
|
|
197
|
-
properties.emissive *= emissive_texture_color.rgb;
|
|
198
|
-
#endif
|
|
199
|
-
|
|
200
|
-
properties.metallic = clamp(properties.metallic, 0.0, 1.0);
|
|
201
|
-
properties.roughness = clamp(properties.roughness, 0.05, 1.0);
|
|
202
|
-
properties.reflection_strength = clamp(properties.reflection_strength, 0.0, 1.0);
|
|
203
|
-
properties.transmission = clamp(properties.transmission, 0.0, 1.0) * (1.0 - properties.metallic);
|
|
204
|
-
|
|
205
|
-
#ifdef VERTEX_UVS
|
|
206
|
-
vec4 transmission_texture_color = texture(transmission_texture, v_uv);
|
|
207
|
-
properties.transmission *= transmission_texture_color.r;
|
|
208
|
-
|
|
209
|
-
vec4 thickness_texture_color = texture(thickness_texture, v_uv);
|
|
210
|
-
properties.thickness *= thickness_texture_color.r;
|
|
211
|
-
#endif
|
|
212
|
-
|
|
213
|
-
properties.transmission = clamp(properties.transmission, 0.0, 1.0);
|
|
214
|
-
properties.thickness = max(properties.thickness, 0.0);
|
|
215
|
-
|
|
216
|
-
#if defined(VERTEX_TANGENTS)
|
|
217
|
-
#ifdef VERTEX_NORMALS
|
|
218
|
-
vec3 normal = normalize(v_normal);
|
|
219
|
-
#else
|
|
220
|
-
#error "Mesh vertex normals are required for lighting."
|
|
221
|
-
#endif
|
|
222
|
-
#ifdef VERTEX_UVS
|
|
223
|
-
vec3 tangent = normalize(v_tangent.xyz);
|
|
224
|
-
vec3 bitangent = cross(normal, tangent) * v_tangent.w;
|
|
225
|
-
mat3 tangent_space = mat3(tangent, bitangent, normal);
|
|
226
|
-
vec3 surface_normal = texture(normal_texture, v_uv).rgb * 2.0 - 1.0;
|
|
227
|
-
properties.normal = tangent_space * surface_normal;
|
|
228
|
-
#else
|
|
229
|
-
properties.normal = normal;
|
|
230
|
-
#endif
|
|
231
|
-
#else
|
|
232
|
-
#ifdef VERTEX_NORMALS
|
|
233
|
-
properties.normal = v_normal;
|
|
234
|
-
#else
|
|
235
|
-
#error "Mesh vertex normals are required for lighting."
|
|
236
|
-
#endif
|
|
237
|
-
#endif
|
|
238
|
-
|
|
239
|
-
return properties;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
void main(){
|
|
243
|
-
PBRProperties pbr_properties = calculate_pbr_properties();
|
|
244
|
-
#ifdef ALPHA_MASK_MODE
|
|
245
|
-
if (pbr_properties.opacity < cutoff) {
|
|
246
|
-
discard;
|
|
247
|
-
}
|
|
248
|
-
#endif
|
|
249
|
-
vec3 N = normalize(pbr_properties.normal);
|
|
250
|
-
vec3 V = normalize(cam_direction);
|
|
251
|
-
int directional_light_count = min(directional_lights.count,MAX_DIRECTIONAL_LIGHTS);
|
|
252
|
-
int point_light_count = min(point_lights.count, MAX_POINT_LIGHTS);
|
|
253
|
-
int spot_light_count = min(spot_lights.count,MAX_SPOT_LIGHTS);
|
|
254
|
-
|
|
255
|
-
vec3 exitance = vec3(0.0);
|
|
256
|
-
for (int i = 0; i < directional_light_count; i++) {
|
|
257
|
-
DirectionalLight light = directional_lights.lights[i];
|
|
258
|
-
vec3 L = -light.direction;
|
|
259
|
-
vec3 H = normalize(L + V);
|
|
260
|
-
PBRInput pbr_input = calculate_pbr_input(N, V, L, H);
|
|
261
|
-
vec3 irradiance = light.color.rgb * light.intensity;
|
|
262
|
-
|
|
263
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
264
|
-
if(light.shadow_index != -1){
|
|
265
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
266
|
-
|
|
267
|
-
irradiance *= shadow_contribution_2d(shadow, shadow_atlas, v_position, pbr_input.NdotL);
|
|
268
|
-
}
|
|
269
|
-
#endif
|
|
270
|
-
exitance += cook_torrance_BRDF(pbr_properties, pbr_input) * irradiance * pbr_input.NdotL;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
for (int i = 0; i < point_light_count; i++) {
|
|
274
|
-
PointLight light = point_lights.lights[i];
|
|
275
|
-
vec3 normal = N;
|
|
276
|
-
vec3 distance_vector = light.position - v_position;
|
|
277
|
-
float distance = length(distance_vector);
|
|
278
|
-
vec3 L = distance_vector / distance;
|
|
279
|
-
vec3 H = normalize(L + V);
|
|
280
|
-
PBRInput pbr_input = calculate_pbr_input(N, V, L, H);
|
|
281
|
-
float attenuation = attenuate_point_light(distance, light.radius, light.intensity, light.decay);
|
|
282
|
-
vec3 irradiance = light.color.rgb * attenuation;
|
|
283
|
-
|
|
284
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
285
|
-
if(light.shadow_index != -1){
|
|
286
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
287
|
-
|
|
288
|
-
irradiance *= shadow_contribution_cube(shadow, shadow_atlas, v_position, pbr_input.NdotL);
|
|
289
|
-
}
|
|
290
|
-
#endif
|
|
291
|
-
|
|
292
|
-
exitance += cook_torrance_BRDF(pbr_properties, pbr_input) * irradiance * pbr_input.NdotL;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
for (int i = 0; i < spot_light_count; i++) {
|
|
296
|
-
SpotLight light = spot_lights.lights[i];
|
|
297
|
-
vec3 normal = N;
|
|
298
|
-
vec3 distance_vector = light.position - v_position;
|
|
299
|
-
float distance = length(distance_vector);
|
|
300
|
-
vec3 L = distance_vector / distance;
|
|
301
|
-
vec3 H = normalize(L + V);
|
|
302
|
-
PBRInput pbr_input = calculate_pbr_input(N, V, L, H);
|
|
303
|
-
float attenuation = attenuate_spot_light(light, L, distance);
|
|
304
|
-
vec3 irradiance = light.color.rgb * attenuation;
|
|
305
|
-
|
|
306
|
-
#ifdef MAX_SHADOW_CASTERS
|
|
307
|
-
if(light.shadow_index != -1){
|
|
308
|
-
Shadow shadow = shadow_casters[light.shadow_index];
|
|
309
|
-
|
|
310
|
-
irradiance *= shadow_contribution_2d(shadow, shadow_atlas, v_position, pbr_input.NdotL);
|
|
311
|
-
}
|
|
312
|
-
#endif
|
|
313
|
-
|
|
314
|
-
exitance += cook_torrance_BRDF(pbr_properties, pbr_input) * irradiance * pbr_input.NdotL;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
vec3 emissive_exitance = pbr_properties.emissive * material.emissive_intensity;
|
|
318
|
-
vec3 ambient_exitance = pbr_properties.albedo * ambient_light.color.rgb * ambient_light.intensity * pbr_properties.ambient_occlusion;
|
|
319
|
-
vec3 surface_exitance = emissive_exitance + ambient_exitance + exitance;
|
|
320
|
-
vec3 reflection_exitance = sample_environment_reflection(N, V, pbr_properties.roughness);
|
|
321
|
-
vec3 refraction_exitance = sample_environment_refraction(N, V, pbr_properties.roughness, pbr_properties.ior);
|
|
322
|
-
vec3 F0 = mix(vec3(0.04), pbr_properties.albedo, pbr_properties.metallic);
|
|
323
|
-
float NdotV = max(dot(N, V), 0.0);
|
|
324
|
-
vec3 fresnel = fresnel_schlick(NdotV, F0);
|
|
325
|
-
float reflection_mix = max(max(fresnel.r, fresnel.g), fresnel.b) * pbr_properties.reflection_strength;
|
|
326
|
-
float transmission_mix = pbr_properties.transmission * exp(-pbr_properties.thickness) * (1.0 - max(max(fresnel.r, fresnel.g), fresnel.b));
|
|
327
|
-
vec3 final_color = mix(surface_exitance, refraction_exitance, transmission_mix);
|
|
328
|
-
final_color += reflection_exitance * reflection_mix;
|
|
329
|
-
|
|
330
|
-
fragment_color = vec4(final_color, pbr_properties.opacity);
|
|
331
|
-
}
|