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,121 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { Vector3 } from "../../math/index.js"
|
|
3
|
-
import { assert } from "../../utils/index.js"
|
|
4
|
-
import { MeshBuilder } from "./base.js"
|
|
5
|
-
import { createMeshFromArrays } from "./geometry.js"
|
|
6
|
-
import { faceNormal, projectFaceUVs, pushTriangle } from "./utils.js"
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Shared builder for polyhedron meshes.
|
|
10
|
-
* Assign vertices, faces, and optional excluded face indices before calling build.
|
|
11
|
-
*/
|
|
12
|
-
export class PolyhedronMeshBuilder extends MeshBuilder {
|
|
13
|
-
/**
|
|
14
|
-
* @type {import("../../math/index.js").Vector3[]}
|
|
15
|
-
*/
|
|
16
|
-
vertices = []
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @type {number[][]}
|
|
20
|
-
*/
|
|
21
|
-
faces = []
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Face indices to exclude from the final mesh.
|
|
25
|
-
* @type {Set<number>}
|
|
26
|
-
*/
|
|
27
|
-
excludeFaces = new Set()
|
|
28
|
-
|
|
29
|
-
radius = 0.5
|
|
30
|
-
|
|
31
|
-
/** @override */
|
|
32
|
-
build() {
|
|
33
|
-
const scaledVertices = this.vertices.map((vertex) =>
|
|
34
|
-
vertex.clone().normalize().multiplyScalar(this.radius)
|
|
35
|
-
)
|
|
36
|
-
const includedFaces = this.faces.filter((_, faceIndex) =>
|
|
37
|
-
!this.excludeFaces.has(faceIndex)
|
|
38
|
-
)
|
|
39
|
-
/** @type {number[]} */
|
|
40
|
-
const positions = []
|
|
41
|
-
/** @type {number[]} */
|
|
42
|
-
const normals = []
|
|
43
|
-
/** @type {number[]} */
|
|
44
|
-
const uvs = []
|
|
45
|
-
/** @type {number[]} */
|
|
46
|
-
const indices = []
|
|
47
|
-
|
|
48
|
-
for (const face of includedFaces) {
|
|
49
|
-
if (face.length < 3) {
|
|
50
|
-
continue
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const faceVertices = face.map((index) => {
|
|
54
|
-
const sourceVertex = scaledVertices[index]
|
|
55
|
-
assert(sourceVertex, `Missing polyhedron vertex at index ${index}`)
|
|
56
|
-
return sourceVertex.clone()
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const faceCenter = new Vector3()
|
|
60
|
-
for (const vertex of faceVertices) {
|
|
61
|
-
faceCenter.add(vertex)
|
|
62
|
-
}
|
|
63
|
-
faceCenter.divideScalar(faceVertices.length)
|
|
64
|
-
|
|
65
|
-
let firstVertex = faceVertices[0]
|
|
66
|
-
let secondVertex = faceVertices[1]
|
|
67
|
-
let thirdVertex = faceVertices[2]
|
|
68
|
-
assert(firstVertex, "Polyhedron face requires at least three vertices")
|
|
69
|
-
assert(secondVertex, "Polyhedron face requires at least three vertices")
|
|
70
|
-
assert(thirdVertex, "Polyhedron face requires at least three vertices")
|
|
71
|
-
|
|
72
|
-
let normal = faceNormal(firstVertex, secondVertex, thirdVertex)
|
|
73
|
-
if (normal.dot(faceCenter) < 0) {
|
|
74
|
-
faceVertices.reverse()
|
|
75
|
-
firstVertex = faceVertices[0]
|
|
76
|
-
secondVertex = faceVertices[1]
|
|
77
|
-
thirdVertex = faceVertices[2]
|
|
78
|
-
assert(firstVertex, "Polyhedron face requires at least three vertices")
|
|
79
|
-
assert(secondVertex, "Polyhedron face requires at least three vertices")
|
|
80
|
-
assert(thirdVertex, "Polyhedron face requires at least three vertices")
|
|
81
|
-
normal = faceNormal(firstVertex, secondVertex, thirdVertex)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const faceUvs = projectFaceUVs(faceVertices, normal)
|
|
85
|
-
|
|
86
|
-
for (let i = 1; i < faceVertices.length - 1; i++) {
|
|
87
|
-
const currentVertex = faceVertices[i]
|
|
88
|
-
const nextVertex = faceVertices[i + 1]
|
|
89
|
-
const firstUv = faceUvs[0]
|
|
90
|
-
const currentUv = faceUvs[i]
|
|
91
|
-
const nextUv = faceUvs[i + 1]
|
|
92
|
-
assert(currentVertex, `Missing polyhedron face vertex at index ${i}`)
|
|
93
|
-
assert(nextVertex, `Missing polyhedron face vertex at index ${i + 1}`)
|
|
94
|
-
assert(firstUv, "Polyhedron face requires at least three UV coordinates")
|
|
95
|
-
assert(currentUv, `Missing polyhedron face UV at index ${i}`)
|
|
96
|
-
assert(nextUv, `Missing polyhedron face UV at index ${i + 1}`)
|
|
97
|
-
|
|
98
|
-
pushTriangle(
|
|
99
|
-
positions,
|
|
100
|
-
normals,
|
|
101
|
-
uvs,
|
|
102
|
-
indices,
|
|
103
|
-
firstVertex,
|
|
104
|
-
currentVertex,
|
|
105
|
-
nextVertex,
|
|
106
|
-
normal,
|
|
107
|
-
firstUv,
|
|
108
|
-
currentUv,
|
|
109
|
-
nextUv
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return createMeshFromArrays({
|
|
115
|
-
positions,
|
|
116
|
-
normals,
|
|
117
|
-
uvs,
|
|
118
|
-
indices
|
|
119
|
-
})
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { MeshBuilder } from "./base.js"
|
|
3
|
-
import { ExtrudeMeshBuilder } from "./extrude.js"
|
|
4
|
-
import { regularPolygonPoints } from "./geometry.js"
|
|
5
|
-
|
|
6
|
-
export class PrismMeshBuilder extends MeshBuilder {
|
|
7
|
-
sides = 6
|
|
8
|
-
radius = 0.5
|
|
9
|
-
depth = 1
|
|
10
|
-
rotation = 0
|
|
11
|
-
|
|
12
|
-
/** @override */
|
|
13
|
-
build() {
|
|
14
|
-
const builder = new ExtrudeMeshBuilder()
|
|
15
|
-
builder.contour = regularPolygonPoints(this.sides, this.radius, this.rotation)
|
|
16
|
-
builder.depth = this.depth
|
|
17
|
-
return builder.build()
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { Vector2, Vector3 } from "../../math/index.js"
|
|
3
|
-
import { MeshBuilder } from "./base.js"
|
|
4
|
-
import { createMeshFromArrays, regularPolygonPoints, signedArea2D } from "./geometry.js"
|
|
5
|
-
import { assert } from "../../utils/index.js"
|
|
6
|
-
import { faceNormal, getBounds, projectUV, pushTriangle } from "./utils.js"
|
|
7
|
-
|
|
8
|
-
export class PyramidMeshBuilder extends MeshBuilder {
|
|
9
|
-
sides = 4
|
|
10
|
-
radius = 0.5
|
|
11
|
-
height = 1
|
|
12
|
-
rotation = 0
|
|
13
|
-
|
|
14
|
-
/** @override */
|
|
15
|
-
build() {
|
|
16
|
-
const contour = regularPolygonPoints(this.sides, this.radius, this.rotation)
|
|
17
|
-
if (contour.length < 3) {
|
|
18
|
-
return createMeshFromArrays({ positions: [] })
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (signedArea2D(contour) < 0) {
|
|
22
|
-
contour.reverse()
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** @type {number[]} */
|
|
26
|
-
const positions = []
|
|
27
|
-
/** @type {number[]} */
|
|
28
|
-
const normals = []
|
|
29
|
-
/** @type {number[]} */
|
|
30
|
-
const uvs = []
|
|
31
|
-
/** @type {number[]} */
|
|
32
|
-
const indices = []
|
|
33
|
-
const halfHeight = this.height * 0.5
|
|
34
|
-
const apex = new Vector3(0, 0, halfHeight)
|
|
35
|
-
const baseCenter = new Vector3(0, 0, -halfHeight)
|
|
36
|
-
const bounds = getBounds(contour)
|
|
37
|
-
|
|
38
|
-
for (let i = 0; i < contour.length; i++) {
|
|
39
|
-
const current = contour[i]
|
|
40
|
-
assert(current, `Missing pyramid contour point at index ${i}`)
|
|
41
|
-
const next = contour[(i + 1) % contour.length]
|
|
42
|
-
assert(next, `Missing pyramid contour point at index ${(i + 1) % contour.length}`)
|
|
43
|
-
const currentTop = new Vector3(current.x, current.y, -halfHeight)
|
|
44
|
-
const nextTop = new Vector3(next.x, next.y, -halfHeight)
|
|
45
|
-
const normal = faceNormal(currentTop, nextTop, apex)
|
|
46
|
-
|
|
47
|
-
pushTriangle(
|
|
48
|
-
positions,
|
|
49
|
-
normals,
|
|
50
|
-
uvs,
|
|
51
|
-
indices,
|
|
52
|
-
currentTop,
|
|
53
|
-
nextTop,
|
|
54
|
-
apex,
|
|
55
|
-
normal,
|
|
56
|
-
projectUV(current, bounds),
|
|
57
|
-
projectUV(next, bounds),
|
|
58
|
-
new Vector2(0.5, 0.5)
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
for (let i = 0; i < contour.length; i++) {
|
|
63
|
-
const current = contour[i]
|
|
64
|
-
assert(current, `Missing pyramid contour point at index ${i}`)
|
|
65
|
-
const next = contour[(i + 1) % contour.length]
|
|
66
|
-
assert(next, `Missing pyramid contour point at index ${(i + 1) % contour.length}`)
|
|
67
|
-
|
|
68
|
-
pushTriangle(
|
|
69
|
-
positions,
|
|
70
|
-
normals,
|
|
71
|
-
uvs,
|
|
72
|
-
indices,
|
|
73
|
-
baseCenter,
|
|
74
|
-
new Vector3(next.x, next.y, -halfHeight),
|
|
75
|
-
new Vector3(current.x, current.y, -halfHeight),
|
|
76
|
-
new Vector3(0, 0, -1),
|
|
77
|
-
new Vector2(0.5, 0.5),
|
|
78
|
-
projectUV(next, bounds),
|
|
79
|
-
projectUV(current, bounds)
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return createMeshFromArrays({
|
|
84
|
-
positions,
|
|
85
|
-
normals,
|
|
86
|
-
uvs,
|
|
87
|
-
indices
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { Vector2, Vector3 } from "../../math/index.js"
|
|
3
|
-
import { MeshBuilder } from "./base.js"
|
|
4
|
-
import { createMeshFromArrays } from "./geometry.js"
|
|
5
|
-
import { pushVertex } from "./utils.js"
|
|
6
|
-
|
|
7
|
-
export class RingMeshBuilder extends MeshBuilder {
|
|
8
|
-
innerRadius = 0.25
|
|
9
|
-
outerRadius = 0.5
|
|
10
|
-
thickness = 0.1
|
|
11
|
-
radialSegments = 32
|
|
12
|
-
|
|
13
|
-
/** @override */
|
|
14
|
-
build() {
|
|
15
|
-
/** @type {number[]} */
|
|
16
|
-
const positions = []
|
|
17
|
-
/** @type {number[]} */
|
|
18
|
-
const normals = []
|
|
19
|
-
/** @type {number[]} */
|
|
20
|
-
const uvs = []
|
|
21
|
-
/** @type {number[]} */
|
|
22
|
-
const indices = []
|
|
23
|
-
const halfThickness = this.thickness * 0.5
|
|
24
|
-
const innerRadius = Math.min(this.innerRadius, this.outerRadius)
|
|
25
|
-
const outerRadius = Math.max(this.innerRadius, this.outerRadius)
|
|
26
|
-
const step = (Math.PI * 2) / this.radialSegments
|
|
27
|
-
const topNormal = new Vector3(0, 1, 0)
|
|
28
|
-
const bottomNormal = new Vector3(0, -1, 0)
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @param {Vector3} point
|
|
32
|
-
* @returns {Vector2}
|
|
33
|
-
*/
|
|
34
|
-
const topUv = (point) => new Vector2(
|
|
35
|
-
(point.x + outerRadius) / (outerRadius * 2),
|
|
36
|
-
(point.z + outerRadius) / (outerRadius * 2)
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
for (let segment = 0; segment < this.radialSegments; segment++) {
|
|
40
|
-
const angle0 = segment * step
|
|
41
|
-
const angle1 = (segment + 1) * step
|
|
42
|
-
const cos0 = Math.cos(angle0)
|
|
43
|
-
const sin0 = Math.sin(angle0)
|
|
44
|
-
const cos1 = Math.cos(angle1)
|
|
45
|
-
const sin1 = Math.sin(angle1)
|
|
46
|
-
|
|
47
|
-
const outer0Top = new Vector3(outerRadius * cos0, halfThickness, outerRadius * sin0)
|
|
48
|
-
const outer1Top = new Vector3(outerRadius * cos1, halfThickness, outerRadius * sin1)
|
|
49
|
-
const inner0Top = new Vector3(innerRadius * cos0, halfThickness, innerRadius * sin0)
|
|
50
|
-
const inner1Top = new Vector3(innerRadius * cos1, halfThickness, innerRadius * sin1)
|
|
51
|
-
|
|
52
|
-
const outer0Bottom = new Vector3(outerRadius * cos0, -halfThickness, outerRadius * sin0)
|
|
53
|
-
const outer1Bottom = new Vector3(outerRadius * cos1, -halfThickness, outerRadius * sin1)
|
|
54
|
-
const inner0Bottom = new Vector3(innerRadius * cos0, -halfThickness, innerRadius * sin0)
|
|
55
|
-
const inner1Bottom = new Vector3(innerRadius * cos1, -halfThickness, innerRadius * sin1)
|
|
56
|
-
|
|
57
|
-
const outerNormal0 = new Vector3(cos0, 0, sin0)
|
|
58
|
-
const outerNormal1 = new Vector3(cos1, 0, sin1)
|
|
59
|
-
const innerNormal0 = new Vector3(-cos0, 0, -sin0)
|
|
60
|
-
const innerNormal1 = new Vector3(-cos1, 0, -sin1)
|
|
61
|
-
|
|
62
|
-
const outerUv0 = segment / this.radialSegments
|
|
63
|
-
const outerUv1 = (segment + 1) / this.radialSegments
|
|
64
|
-
|
|
65
|
-
// Top face
|
|
66
|
-
pushVertex(positions, normals, uvs, indices, outer0Top, topNormal, topUv(outer0Top))
|
|
67
|
-
pushVertex(positions, normals, uvs, indices, inner0Top, topNormal, topUv(inner0Top))
|
|
68
|
-
pushVertex(positions, normals, uvs, indices, outer1Top, topNormal, topUv(outer1Top))
|
|
69
|
-
|
|
70
|
-
pushVertex(positions, normals, uvs, indices, outer1Top, topNormal, topUv(outer1Top))
|
|
71
|
-
pushVertex(positions, normals, uvs, indices, inner0Top, topNormal, topUv(inner0Top))
|
|
72
|
-
pushVertex(positions, normals, uvs, indices, inner1Top, topNormal, topUv(inner1Top))
|
|
73
|
-
|
|
74
|
-
// Bottom face
|
|
75
|
-
pushVertex(positions, normals, uvs, indices, outer0Bottom, bottomNormal, topUv(outer0Bottom))
|
|
76
|
-
pushVertex(positions, normals, uvs, indices, outer1Bottom, bottomNormal, topUv(outer1Bottom))
|
|
77
|
-
pushVertex(positions, normals, uvs, indices, inner0Bottom, bottomNormal, topUv(inner0Bottom))
|
|
78
|
-
|
|
79
|
-
pushVertex(positions, normals, uvs, indices, outer1Bottom, bottomNormal, topUv(outer1Bottom))
|
|
80
|
-
pushVertex(positions, normals, uvs, indices, inner1Bottom, bottomNormal, topUv(inner1Bottom))
|
|
81
|
-
pushVertex(positions, normals, uvs, indices, inner0Bottom, bottomNormal, topUv(inner0Bottom))
|
|
82
|
-
|
|
83
|
-
// Outer wall
|
|
84
|
-
pushVertex(positions, normals, uvs, indices, outer0Top, outerNormal0, new Vector2(outerUv0, 1))
|
|
85
|
-
pushVertex(positions, normals, uvs, indices, outer1Top, outerNormal1, new Vector2(outerUv1, 1))
|
|
86
|
-
pushVertex(positions, normals, uvs, indices, outer0Bottom, outerNormal0, new Vector2(outerUv0, 0))
|
|
87
|
-
|
|
88
|
-
pushVertex(positions, normals, uvs, indices, outer1Top, outerNormal1, new Vector2(outerUv1, 1))
|
|
89
|
-
pushVertex(positions, normals, uvs, indices, outer1Bottom, outerNormal1, new Vector2(outerUv1, 0))
|
|
90
|
-
pushVertex(positions, normals, uvs, indices, outer0Bottom, outerNormal0, new Vector2(outerUv0, 0))
|
|
91
|
-
|
|
92
|
-
// Inner wall
|
|
93
|
-
pushVertex(positions, normals, uvs, indices, inner0Top, innerNormal0, new Vector2(outerUv0, 1))
|
|
94
|
-
pushVertex(positions, normals, uvs, indices, inner0Bottom, innerNormal0, new Vector2(outerUv0, 0))
|
|
95
|
-
pushVertex(positions, normals, uvs, indices, inner1Top, innerNormal1, new Vector2(outerUv1, 1))
|
|
96
|
-
|
|
97
|
-
pushVertex(positions, normals, uvs, indices, inner1Top, innerNormal1, new Vector2(outerUv1, 1))
|
|
98
|
-
pushVertex(positions, normals, uvs, indices, inner0Bottom, innerNormal0, new Vector2(outerUv0, 0))
|
|
99
|
-
pushVertex(positions, normals, uvs, indices, inner1Bottom, innerNormal1, new Vector2(outerUv1, 0))
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return createMeshFromArrays({
|
|
103
|
-
positions,
|
|
104
|
-
normals,
|
|
105
|
-
uvs,
|
|
106
|
-
indices
|
|
107
|
-
})
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { Vector2, Vector3 } from "../../math/index.js"
|
|
3
|
-
import { MeshBuilder } from "./base.js"
|
|
4
|
-
import { createMeshFromArrays } from "./geometry.js"
|
|
5
|
-
|
|
6
|
-
export class TorusMeshBuilder extends MeshBuilder {
|
|
7
|
-
radius = 0.75
|
|
8
|
-
tubeRadius = 0.25
|
|
9
|
-
radialSegments = 32
|
|
10
|
-
tubularSegments = 16
|
|
11
|
-
|
|
12
|
-
/** @override */
|
|
13
|
-
build() {
|
|
14
|
-
const positions = []
|
|
15
|
-
const normals = []
|
|
16
|
-
const uvs = []
|
|
17
|
-
const indices = []
|
|
18
|
-
|
|
19
|
-
for (let tube = 0; tube <= this.tubularSegments; tube++) {
|
|
20
|
-
const v = tube / this.tubularSegments
|
|
21
|
-
const phi = v * Math.PI * 2
|
|
22
|
-
const cosphi = Math.cos(phi)
|
|
23
|
-
const sinphi = Math.sin(phi)
|
|
24
|
-
|
|
25
|
-
for (let radial = 0; radial <= this.radialSegments; radial++) {
|
|
26
|
-
const u = radial / this.radialSegments
|
|
27
|
-
const theta = u * Math.PI * 2
|
|
28
|
-
const costheta = Math.cos(theta)
|
|
29
|
-
const sintheta = Math.sin(theta)
|
|
30
|
-
|
|
31
|
-
const ringRadius = this.radius + this.tubeRadius * cosphi
|
|
32
|
-
const position = new Vector3(
|
|
33
|
-
ringRadius * costheta,
|
|
34
|
-
this.tubeRadius * sinphi,
|
|
35
|
-
ringRadius * sintheta
|
|
36
|
-
)
|
|
37
|
-
const normal = new Vector3(
|
|
38
|
-
cosphi * costheta,
|
|
39
|
-
sinphi,
|
|
40
|
-
cosphi * sintheta
|
|
41
|
-
)
|
|
42
|
-
const uv = new Vector2(1 - u, 1 - v)
|
|
43
|
-
|
|
44
|
-
positions.push(position.x, position.y, position.z)
|
|
45
|
-
normals.push(normal.x, normal.y, normal.z)
|
|
46
|
-
uvs.push(uv.x, uv.y)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
for (let tube = 0; tube < this.tubularSegments; tube++) {
|
|
51
|
-
for (let radial = 0; radial < this.radialSegments; radial++) {
|
|
52
|
-
const a = tube * (this.radialSegments + 1) + radial
|
|
53
|
-
const b = (tube + 1) * (this.radialSegments + 1) + radial
|
|
54
|
-
const c = (tube + 1) * (this.radialSegments + 1) + radial + 1
|
|
55
|
-
const d = tube * (this.radialSegments + 1) + radial + 1
|
|
56
|
-
|
|
57
|
-
indices.push(a, b, d)
|
|
58
|
-
indices.push(b, c, d)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return createMeshFromArrays({
|
|
63
|
-
positions,
|
|
64
|
-
normals,
|
|
65
|
-
uvs,
|
|
66
|
-
indices
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { Vector2, Vector3 } from "../../math/index.js"
|
|
3
|
-
import { MeshBuilder } from "./base.js"
|
|
4
|
-
import { createMeshFromArrays } from "./geometry.js"
|
|
5
|
-
|
|
6
|
-
export class TerrainMeshBuilder extends MeshBuilder {
|
|
7
|
-
width = 1
|
|
8
|
-
depth = 1
|
|
9
|
-
widthSegments = 32
|
|
10
|
-
depthSegments = 32
|
|
11
|
-
heightScale = 1
|
|
12
|
-
/**
|
|
13
|
-
* @type {(x: number, z: number) => number}
|
|
14
|
-
*/
|
|
15
|
-
sampleHeight = () => 0
|
|
16
|
-
|
|
17
|
-
/** @override */
|
|
18
|
-
build() {
|
|
19
|
-
const positions = []
|
|
20
|
-
const normals = []
|
|
21
|
-
const uvs = []
|
|
22
|
-
const indices = []
|
|
23
|
-
const widthStep = this.width / this.widthSegments
|
|
24
|
-
const depthStep = this.depth / this.depthSegments
|
|
25
|
-
const halfWidth = this.width * 0.5
|
|
26
|
-
const halfDepth = this.depth * 0.5
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {number} x
|
|
30
|
-
* @param {number} z
|
|
31
|
-
* @returns {number}
|
|
32
|
-
*/
|
|
33
|
-
const heightAt = (x, z) => this.sampleHeight(x, z) * this.heightScale
|
|
34
|
-
|
|
35
|
-
for (let zIndex = 0; zIndex <= this.depthSegments; zIndex++) {
|
|
36
|
-
const v = zIndex / this.depthSegments
|
|
37
|
-
const z = -halfDepth + v * this.depth
|
|
38
|
-
|
|
39
|
-
for (let xIndex = 0; xIndex <= this.widthSegments; xIndex++) {
|
|
40
|
-
const u = xIndex / this.widthSegments
|
|
41
|
-
const x = -halfWidth + u * this.width
|
|
42
|
-
const height = heightAt(x, z)
|
|
43
|
-
|
|
44
|
-
const hL = heightAt(x - widthStep, z)
|
|
45
|
-
const hR = heightAt(x + widthStep, z)
|
|
46
|
-
const hD = heightAt(x, z - depthStep)
|
|
47
|
-
const hU = heightAt(x, z + depthStep)
|
|
48
|
-
const normal = new Vector3(
|
|
49
|
-
(hL - hR) / (widthStep || 1),
|
|
50
|
-
2,
|
|
51
|
-
(hD - hU) / (depthStep || 1)
|
|
52
|
-
).normalize()
|
|
53
|
-
const uv = new Vector2(u, 1 - v)
|
|
54
|
-
|
|
55
|
-
positions.push(x, height, z)
|
|
56
|
-
normals.push(normal.x, normal.y, normal.z)
|
|
57
|
-
uvs.push(uv.x, uv.y)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
for (let zIndex = 0; zIndex < this.depthSegments; zIndex++) {
|
|
62
|
-
for (let xIndex = 0; xIndex < this.widthSegments; xIndex++) {
|
|
63
|
-
const a = zIndex * (this.widthSegments + 1) + xIndex
|
|
64
|
-
const b = (zIndex + 1) * (this.widthSegments + 1) + xIndex
|
|
65
|
-
const c = (zIndex + 1) * (this.widthSegments + 1) + xIndex + 1
|
|
66
|
-
const d = zIndex * (this.widthSegments + 1) + xIndex + 1
|
|
67
|
-
|
|
68
|
-
indices.push(a, b, d)
|
|
69
|
-
indices.push(b, c, d)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return createMeshFromArrays({
|
|
74
|
-
positions,
|
|
75
|
-
normals,
|
|
76
|
-
uvs,
|
|
77
|
-
indices
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { Vector3 } from "../../math/index.js"
|
|
3
|
-
import { MeshBuilder } from "./base.js"
|
|
4
|
-
import { PolyhedronMeshBuilder } from "./polyhedron.js"
|
|
5
|
-
|
|
6
|
-
const tetrahedronVertices = [
|
|
7
|
-
new Vector3(1, 1, 1),
|
|
8
|
-
new Vector3(-1, -1, 1),
|
|
9
|
-
new Vector3(-1, 1, -1),
|
|
10
|
-
new Vector3(1, -1, -1)
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
const tetrahedronFaces = [
|
|
14
|
-
[0, 2, 1],
|
|
15
|
-
[0, 1, 3],
|
|
16
|
-
[0, 3, 2],
|
|
17
|
-
[1, 2, 3]
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
export class TetrahedronMeshBuilder extends MeshBuilder {
|
|
21
|
-
radius = 0.5
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @type {Set<number>}
|
|
25
|
-
*/
|
|
26
|
-
excludeFaces = new Set()
|
|
27
|
-
|
|
28
|
-
/** @override */
|
|
29
|
-
build() {
|
|
30
|
-
const builder = new PolyhedronMeshBuilder()
|
|
31
|
-
builder.vertices = tetrahedronVertices
|
|
32
|
-
builder.faces = tetrahedronFaces
|
|
33
|
-
builder.excludeFaces = this.excludeFaces
|
|
34
|
-
builder.radius = this.radius
|
|
35
|
-
return builder.build()
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { Vector3 } from "../../math/index.js"
|
|
3
|
-
import { MeshBuilder } from "./base.js"
|
|
4
|
-
import { TubeMeshBuilder } from "./tube.js"
|
|
5
|
-
|
|
6
|
-
export class TorusKnotMeshBuilder extends MeshBuilder {
|
|
7
|
-
radius = 0.75
|
|
8
|
-
knotRadius = 0.25
|
|
9
|
-
tubeRadius = 0.08
|
|
10
|
-
p = 2
|
|
11
|
-
q = 3
|
|
12
|
-
radialSegments = 8
|
|
13
|
-
pathSegments = 256
|
|
14
|
-
|
|
15
|
-
/** @override */
|
|
16
|
-
build() {
|
|
17
|
-
/** @type {Vector3[]} */
|
|
18
|
-
const points = []
|
|
19
|
-
for (let i = 0; i < this.pathSegments; i++) {
|
|
20
|
-
const t = (i / this.pathSegments) * Math.PI * 2
|
|
21
|
-
const radial = this.radius + this.knotRadius * Math.cos(this.q * t)
|
|
22
|
-
points.push(new Vector3(
|
|
23
|
-
radial * Math.cos(this.p * t),
|
|
24
|
-
radial * Math.sin(this.p * t),
|
|
25
|
-
this.knotRadius * Math.sin(this.q * t)
|
|
26
|
-
))
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const builder = new TubeMeshBuilder()
|
|
30
|
-
builder.points = points
|
|
31
|
-
builder.radius = this.tubeRadius
|
|
32
|
-
builder.radialSegments = this.radialSegments
|
|
33
|
-
builder.closed = true
|
|
34
|
-
return builder.build()
|
|
35
|
-
}
|
|
36
|
-
}
|