chorama 0.0.0 → 0.1.2
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/.github/workflows/publish.yml +24 -0
- package/.github/workflows/static.yml +22 -53
- package/README.md +3 -1
- 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/astro.config.mjs +9 -21
- package/content/guide/render-targets-and-views.md +3 -4
- package/content/guide/textures-and-assets.md +5 -2
- package/dist/index.module.js +23334 -0
- package/dist/index.module.js.map +1 -0
- package/dist/index.umd.js +23610 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/website/_astro/DocLayout.BsV7p0dY.css +1 -0
- package/dist/website/examples/camera/orthographic/example.html +172 -0
- package/dist/website/examples/camera/orthographic/index.html +124 -0
- package/dist/website/examples/camera/perspective/example.html +190 -0
- package/dist/website/examples/camera/perspective/index.html +142 -0
- package/dist/website/examples/camera/tone_mapping/example.html +238 -0
- package/dist/website/examples/camera/tone_mapping/index.html +190 -0
- package/dist/website/examples/index.html +2 -0
- package/dist/website/examples/lights/directional/example.html +447 -0
- package/dist/website/examples/lights/directional/index.html +399 -0
- package/dist/website/examples/lights/multiple_spot_lights/example.html +356 -0
- package/dist/website/examples/lights/multiple_spot_lights/index.html +308 -0
- package/dist/website/examples/lights/point/example.html +387 -0
- package/dist/website/examples/lights/point/index.html +339 -0
- package/dist/website/examples/lights/spot/example.html +416 -0
- package/dist/website/examples/lights/spot/index.html +368 -0
- package/dist/website/examples/loader/gltf/basic/example.html +129 -0
- package/dist/website/examples/loader/gltf/basic/index.html +81 -0
- package/dist/website/examples/loader/gltf/material/alpha-blend-mode/example.html +131 -0
- package/dist/website/examples/loader/gltf/material/alpha-blend-mode/index.html +83 -0
- package/dist/website/examples/loader/gltf/material/flight_helmet/example.html +162 -0
- package/dist/website/examples/loader/gltf/material/flight_helmet/index.html +114 -0
- package/dist/website/examples/loader/gltf/material/iridescence_lamp/example.html +169 -0
- package/dist/website/examples/loader/gltf/material/iridescence_lamp/index.html +121 -0
- package/dist/website/examples/loader/objloader/example.html +144 -0
- package/dist/website/examples/loader/objloader/index.html +96 -0
- package/dist/website/examples/material/cullface/example.html +163 -0
- package/dist/website/examples/material/cullface/index.html +115 -0
- package/dist/website/examples/material/materials/example.html +175 -0
- package/dist/website/examples/material/materials/index.html +127 -0
- package/dist/website/examples/material/standard/basic/example.html +212 -0
- package/dist/website/examples/material/standard/basic/index.html +164 -0
- package/dist/website/examples/material/standard/reflection_refraction/example.html +241 -0
- package/dist/website/examples/material/standard/reflection_refraction/index.html +193 -0
- package/dist/website/examples/mesh/capsule/example.html +173 -0
- package/dist/website/examples/mesh/capsule/index.html +125 -0
- package/dist/website/examples/mesh/circle/example.html +173 -0
- package/dist/website/examples/mesh/circle/index.html +125 -0
- package/dist/website/examples/mesh/cone/example.html +180 -0
- package/dist/website/examples/mesh/cone/index.html +132 -0
- package/dist/website/examples/mesh/cuboid/example.html +207 -0
- package/dist/website/examples/mesh/cuboid/index.html +159 -0
- package/dist/website/examples/mesh/cylinder/example.html +195 -0
- package/dist/website/examples/mesh/cylinder/index.html +147 -0
- package/dist/website/examples/mesh/dodecahedron/example.html +158 -0
- package/dist/website/examples/mesh/dodecahedron/index.html +110 -0
- package/dist/website/examples/mesh/ellipsoid/example.html +179 -0
- package/dist/website/examples/mesh/ellipsoid/index.html +131 -0
- package/dist/website/examples/mesh/extrude/example.html +169 -0
- package/dist/website/examples/mesh/extrude/index.html +121 -0
- package/dist/website/examples/mesh/frustum/example.html +185 -0
- package/dist/website/examples/mesh/frustum/index.html +137 -0
- package/dist/website/examples/mesh/helix/example.html +184 -0
- package/dist/website/examples/mesh/helix/index.html +136 -0
- package/dist/website/examples/mesh/icosahedron/example.html +158 -0
- package/dist/website/examples/mesh/icosahedron/index.html +110 -0
- package/dist/website/examples/mesh/icosphere/example.html +163 -0
- package/dist/website/examples/mesh/icosphere/index.html +115 -0
- package/dist/website/examples/mesh/lathe/example.html +175 -0
- package/dist/website/examples/mesh/lathe/index.html +127 -0
- package/dist/website/examples/mesh/meshTopology/example.html +210 -0
- package/dist/website/examples/mesh/meshTopology/index.html +162 -0
- package/dist/website/examples/mesh/octahedron/example.html +158 -0
- package/dist/website/examples/mesh/octahedron/index.html +110 -0
- package/dist/website/examples/mesh/plane/example.html +173 -0
- package/dist/website/examples/mesh/plane/index.html +125 -0
- package/dist/website/examples/mesh/prism/example.html +173 -0
- package/dist/website/examples/mesh/prism/index.html +125 -0
- package/dist/website/examples/mesh/pyramid/example.html +172 -0
- package/dist/website/examples/mesh/pyramid/index.html +124 -0
- package/dist/website/examples/mesh/ring/example.html +173 -0
- package/dist/website/examples/mesh/ring/index.html +125 -0
- package/dist/website/examples/mesh/skinning/example.html +187 -0
- package/dist/website/examples/mesh/skinning/index.html +139 -0
- package/dist/website/examples/mesh/terrain/example.html +214 -0
- package/dist/website/examples/mesh/terrain/index.html +166 -0
- package/dist/website/examples/mesh/tetrahedron/example.html +158 -0
- package/dist/website/examples/mesh/tetrahedron/index.html +110 -0
- package/dist/website/examples/mesh/torus/example.html +173 -0
- package/dist/website/examples/mesh/torus/index.html +125 -0
- package/dist/website/examples/mesh/torus-knot/example.html +188 -0
- package/dist/website/examples/mesh/torus-knot/index.html +140 -0
- package/dist/website/examples/mesh/tube/example.html +180 -0
- package/dist/website/examples/mesh/tube/index.html +132 -0
- package/dist/website/examples/mesh/uvsphere/example.html +169 -0
- package/dist/website/examples/mesh/uvsphere/index.html +121 -0
- package/dist/website/examples/mesh/wedge/example.html +168 -0
- package/dist/website/examples/mesh/wedge/index.html +120 -0
- package/dist/website/examples/other/rotatingCube/example.html +142 -0
- package/dist/website/examples/other/rotatingCube/index.html +94 -0
- package/dist/website/examples/other/rotatingSphere/example.html +144 -0
- package/dist/website/examples/other/rotatingSphere/index.html +96 -0
- package/dist/website/examples/rendertarget/basic_canvas/example.html +178 -0
- package/dist/website/examples/rendertarget/basic_canvas/index.html +130 -0
- package/dist/website/examples/rendertarget/depth_texture/example.html +188 -0
- package/dist/website/examples/rendertarget/depth_texture/index.html +140 -0
- package/dist/website/examples/rendertarget/image_target/example.html +196 -0
- package/dist/website/examples/rendertarget/image_target/index.html +148 -0
- package/dist/website/examples/rendertarget/multiple_views/example.html +204 -0
- package/dist/website/examples/rendertarget/multiple_views/index.html +156 -0
- package/dist/website/examples/rendertarget/render_masks/example.html +222 -0
- package/dist/website/examples/rendertarget/render_masks/index.html +174 -0
- package/dist/website/examples/rendertarget/split_screen/example.html +178 -0
- package/dist/website/examples/rendertarget/split_screen/index.html +130 -0
- package/dist/website/examples/rendertarget/split_view/example.html +191 -0
- package/dist/website/examples/rendertarget/split_view/index.html +143 -0
- package/dist/website/examples/skybox/skybox/example.html +162 -0
- package/dist/website/examples/skybox/skybox/index.html +114 -0
- package/dist/website/examples/texture/arrays/example.html +204 -0
- package/dist/website/examples/texture/arrays/index.html +156 -0
- package/dist/website/examples/texture/textureWrap/example.html +169 -0
- package/dist/website/examples/texture/textureWrap/index.html +121 -0
- package/dist/website/examples/transform/propagation/example.html +141 -0
- package/dist/website/examples/transform/propagation/index.html +93 -0
- package/dist/website/guide/api-map/index.html +82 -0
- package/dist/website/guide/camera-and-controls/index.html +62 -0
- package/dist/website/guide/first-scene/index.html +119 -0
- package/dist/website/guide/index.html +58 -0
- package/dist/website/guide/installation/index.html +133 -0
- package/dist/website/guide/materials-and-lighting/index.html +90 -0
- package/dist/website/guide/plugins-and-render-pipeline/index.html +89 -0
- package/dist/website/guide/render-targets-and-views/index.html +95 -0
- package/dist/website/guide/scene-graph-and-transforms/index.html +69 -0
- package/dist/website/guide/textures-and-assets/index.html +85 -0
- package/dist/website/guide/troubleshooting/index.html +39 -0
- 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 +157 -0
- 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 +705 -0
- package/dist/website/models/gltf/object.gltf +23 -0
- package/dist/website/models/gltf/pirate_girl/index.bin +0 -0
- package/dist/website/models/gltf/pirate_girl/index.gltf +2082 -0
- package/dist/website/models/obj/pirate_girl/pirate_girl.obj +18459 -0
- package/dist/website/models/obj/pirate_girl/pirate_girl.png +0 -0
- package/env.d.ts +0 -14
- package/examples/camera/orthographic.js +2 -1
- package/examples/camera/perspective.js +2 -1
- package/examples/camera/tone_mapping.js +187 -0
- package/examples/lights/directional.js +2 -3
- package/examples/lights/multiple_spot_lights.js +2 -1
- package/examples/lights/point.js +2 -3
- package/examples/lights/spot.js +2 -3
- package/examples/loader/{gltfloader.js → gltf/basic.js} +8 -8
- package/examples/loader/gltf/material/alpha-blend-mode.js +80 -0
- package/examples/loader/{gltf_material.js → gltf/material/flight_helmet.js} +8 -8
- package/examples/loader/gltf/material/iridescence_lamp.js +118 -0
- package/examples/loader/objloader.js +9 -11
- package/examples/material/cullface.js +8 -7
- package/examples/material/materials.js +9 -11
- package/examples/material/standard/basic.js +3 -6
- package/examples/material/standard/reflection_refraction.js +190 -0
- package/examples/mesh/capsule.js +122 -0
- package/examples/mesh/circle.js +11 -6
- package/examples/mesh/cone.js +129 -0
- package/examples/mesh/cuboid.js +11 -6
- package/examples/mesh/cylinder.js +11 -6
- package/examples/mesh/dodecahedron.js +107 -0
- package/examples/mesh/ellipsoid.js +128 -0
- package/examples/mesh/extrude.js +118 -0
- package/examples/mesh/frustum.js +134 -0
- package/examples/mesh/helix.js +133 -0
- package/examples/mesh/icosahedron.js +107 -0
- package/examples/mesh/icosphere.js +112 -0
- package/examples/mesh/lathe.js +124 -0
- package/examples/mesh/meshTopology.js +64 -8
- package/examples/mesh/octahedron.js +107 -0
- package/examples/mesh/plane.js +11 -6
- package/examples/mesh/prism.js +122 -0
- package/examples/mesh/pyramid.js +121 -0
- package/examples/mesh/ring.js +122 -0
- package/examples/mesh/skinning.js +8 -8
- package/examples/mesh/terrain.js +163 -0
- package/examples/mesh/tetrahedron.js +107 -0
- package/examples/mesh/torus-knot.js +137 -0
- package/examples/mesh/torus.js +122 -0
- package/examples/mesh/tube.js +129 -0
- package/examples/mesh/uvsphere.js +11 -6
- package/examples/mesh/wedge.js +117 -0
- package/examples/other/rotatingCube.js +9 -11
- package/examples/other/rotatingSphere.js +9 -12
- package/examples/rendertarget/basic_canvas.js +5 -8
- package/examples/rendertarget/depth_texture.js +18 -11
- package/examples/rendertarget/image_target.js +19 -14
- package/examples/rendertarget/multiple_views.js +11 -16
- package/examples/rendertarget/render_masks.js +3 -5
- package/examples/rendertarget/split_screen.js +18 -14
- package/examples/rendertarget/split_view.js +12 -9
- package/examples/skybox/skybox.js +8 -8
- package/examples/texture/arrays.js +9 -12
- package/examples/texture/textureWrap.js +8 -8
- package/examples/transform/propagation.js +9 -11
- package/package.json +18 -12
- package/src/caches/cache.js +121 -182
- package/src/caches/uniformbuffers.js +42 -53
- package/src/constants/texture.js +1 -1
- package/src/content.config.js +1 -0
- package/src/core/layouts/bindgroup.js +167 -0
- package/src/core/layouts/index.js +3 -1
- package/src/core/layouts/pipeline.js +165 -0
- package/src/core/layouts/uniformbuffer.js +11 -3
- package/src/core/resources/gpubuffer.js +23 -2
- package/src/core/resources/gpumesh.js +37 -4
- package/src/core/resources/gpusampler.js +43 -0
- package/src/core/resources/gputexture.js +31 -2
- package/src/core/resources/index.js +4 -2
- package/src/core/resources/newuniformbuffer.js +58 -0
- package/src/core/resources/webglshadermodule.js +58 -0
- package/src/core/shader.js +24 -11
- package/src/core/webgl/bindgroup.js +200 -42
- package/src/core/webgl/descriptors.js +87 -25
- package/src/core/webgl/gpuqueue.js +63 -0
- package/src/core/webgl/index.js +3 -0
- package/src/core/webgl/renderpassencoder.js +703 -16
- package/src/core/webgl/renderpipeline.js +38 -1
- package/src/core/webgl/utils.js +207 -57
- package/src/core/webgl/webglrenderdevice.js +77 -53
- package/src/loader/gltf.js +716 -166
- package/src/loader/texture.js +69 -16
- package/src/loader/utils.js +44 -0
- package/src/material/alphablend.js +21 -0
- package/src/material/basic.js +15 -1
- package/src/material/depth.js +15 -1
- package/src/material/index.js +1 -0
- package/src/material/lambert.js +15 -1
- package/src/material/material.js +49 -7
- package/src/material/normal.js +14 -0
- package/src/material/phong.js +16 -2
- package/src/material/raw.js +21 -2
- package/src/material/standard.js +90 -2
- package/src/mesh/attribute/attribute.js +2 -2
- package/src/mesh/attributedata/separate.js +2 -2
- package/src/mesh/builders/capsule.js +47 -0
- package/src/mesh/builders/cone.js +29 -0
- package/src/mesh/builders/dodecahedron.js +130 -0
- package/src/mesh/builders/ellipsoid.js +65 -0
- package/src/mesh/builders/extrude.js +136 -0
- package/src/mesh/builders/frustum.js +26 -0
- package/src/mesh/builders/geometry.js +121 -0
- package/src/mesh/builders/helix.js +35 -0
- package/src/mesh/builders/icosahedron.js +61 -0
- package/src/mesh/builders/icosphere.js +141 -0
- package/src/mesh/builders/index.js +22 -1
- package/src/mesh/builders/lathe.js +85 -0
- package/src/mesh/builders/octahedron.js +43 -0
- package/src/mesh/builders/polyhedron.js +121 -0
- package/src/mesh/builders/prism.js +19 -0
- package/src/mesh/builders/pyramid.js +90 -0
- package/src/mesh/builders/ring.js +109 -0
- package/src/mesh/builders/surfaces.js +69 -0
- package/src/mesh/builders/terrain.js +80 -0
- package/src/mesh/builders/tetrahedron.js +37 -0
- package/src/mesh/builders/torusknot.js +36 -0
- package/src/mesh/builders/tube.js +209 -0
- package/src/mesh/builders/utils.js +130 -2
- package/src/mesh/builders/wedge.js +22 -0
- package/src/mesh/mesh.js +12 -4
- package/src/objects/camera/camera.js +104 -1
- package/src/objects/light/ambient.js +22 -1
- package/src/objects/light/directional.js +23 -1
- package/src/objects/light/point.js +25 -1
- package/src/objects/light/spot.js +27 -1
- package/src/objects/mesh.js +1 -53
- package/src/plugins/camera/RenderTarget2DPool.js +94 -0
- package/src/plugins/camera/camera.js +14 -6
- package/src/plugins/camera/index.js +2 -0
- package/src/plugins/camera/nodes/canvasblit.js +153 -0
- package/src/plugins/camera/nodes/index.js +4 -1
- package/src/plugins/camera/nodes/opaquepass.js +48 -33
- package/src/plugins/camera/nodes/tonemapping.js +217 -0
- package/src/plugins/camera/nodes/transparentpass.js +87 -0
- package/src/plugins/camera/nodes/{cameraview.js → view.js} +27 -1
- package/src/plugins/camera/resources/cameracolortargets.js +66 -0
- package/src/plugins/camera/resources/canvasblitpipeline.js +6 -0
- package/src/plugins/camera/resources/index.js +3 -0
- package/src/plugins/camera/resources/tonemappingpipeline.js +6 -0
- package/src/plugins/light/light.js +0 -4
- package/src/plugins/meshmaterial/meshmaterial.js +433 -170
- package/src/plugins/meshmaterial/nodes/meshmaterial.js +39 -6
- package/src/plugins/meshmaterial/resources/bonetexture.js +176 -0
- package/src/plugins/meshmaterial/resources/environmentmap.js +44 -0
- package/src/plugins/meshmaterial/resources/index.js +4 -0
- package/src/plugins/meshmaterial/resources/materialuniformbuffers.js +94 -0
- package/src/plugins/meshmaterial/resources/meshmaterialbindgroups.js +40 -0
- package/src/plugins/shadow/nodes/index.js +3 -3
- package/src/plugins/shadow/nodes/{shadowOccluder.js → occluder.js} +13 -19
- package/src/plugins/shadow/nodes/opaquePass.js +110 -0
- package/src/plugins/shadow/shadow.js +0 -5
- package/src/plugins/skeletonhelper/skeletonhelper.js +111 -69
- package/src/plugins/skybox/nodes/skybox.js +230 -38
- package/src/plugins/skybox/resources/skyboxpipeline.js +10 -0
- package/src/plugins/skybox/skybox.js +0 -119
- package/src/renderer/core/index.js +135 -21
- package/src/renderer/plugin.js +0 -20
- package/src/renderer/renderer.js +28 -12
- package/src/rendertarget/canvastarget.js +8 -5
- package/src/rendertarget/image.js +3 -3
- package/src/shader/basicFragment.glsl +12 -4
- package/src/shader/basicVertex.glsl +26 -15
- package/src/shader/blitFragment.glsl +9 -0
- package/src/shader/common/common.glsl +35 -6
- package/src/shader/common/index.js +1 -0
- package/src/shader/common/tonemap.glsl +118 -0
- package/src/shader/debug/skeletonFragment.glsl +0 -2
- package/src/shader/debug/skeletonVertex.glsl +1 -3
- package/src/shader/depthFragment.glsl +0 -3
- package/src/shader/fullscreenVertex.glsl +26 -0
- package/src/shader/index.js +3 -0
- package/src/shader/lambertFragment.glsl +12 -4
- package/src/shader/normalFragment.glsl +0 -3
- package/src/shader/phongFragment.glsl +12 -4
- package/src/shader/skyboxFragment.glsl +5 -5
- package/src/shader/skyboxVertex.glsl +5 -4
- package/src/shader/standardFragment.glsl +74 -17
- package/src/shader/tonemappingFragment.glsl +37 -0
- package/src/texture/sampler.js +101 -21
- package/src/texture/texture.js +252 -48
- package/src/utils/index.js +15 -1
- package/{examples/addons → src/utils}/rendergraph_gui.js +5 -2
- package/examples/mesh/geometries.js +0 -108
- package/scripts/stage-chorama.mjs +0 -29
- package/src/core/resources/framebuffer.js +0 -127
- package/src/plugins/shadow/nodes/shadowOpaquePass.js +0 -73
- package/website/config/index.ts +0 -1
- package/website/config/navigation.ts +0 -53
- package/website/content.config.ts +0 -92
- package/website/layouts/DocLayout.astro +0 -501
- package/website/layouts/Example.astro +0 -91
- package/website/pages/examples/[...slug].astro +0 -77
- package/website/pages/examples/index.astro +0 -98
- package/website/pages/examples/samples/[...slug].astro +0 -17
- package/website/pages/guide/[slug].astro +0 -30
- package/website/pages/guide/index.astro +0 -21
- package/website/pages/index.astro +0 -9
- package/website/plugins/remark-link-base.js +0 -23
- package/website/utils/url.ts +0 -30
- /package/src/plugins/shadow/nodes/{shadow.js → view.js} +0 -0
|
Binary file
|
package/env.d.ts
CHANGED
|
@@ -3,17 +3,3 @@ declare module "*.glsl" {
|
|
|
3
3
|
|
|
4
4
|
export default source;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
// Assisted by ChatGPT 5.3 Codex
|
|
8
|
-
declare module "@examples/rendergraph_gui" {
|
|
9
|
-
export function addRenderGraphGuiAddon(options: {
|
|
10
|
-
gui: import("dat.gui").GUI
|
|
11
|
-
renderer: import("chorama").WebGLRenderer
|
|
12
|
-
title?: string
|
|
13
|
-
position?: { x: number; y: number }
|
|
14
|
-
width?: number
|
|
15
|
-
}): {
|
|
16
|
-
refresh: () => void
|
|
17
|
-
dispose: () => void
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GUI } from "dat.gui"
|
|
2
|
-
import { addRenderGraphGuiAddon } from "
|
|
2
|
+
import { addRenderGraphGuiAddon } from "chorama"
|
|
3
3
|
import {
|
|
4
4
|
MeshMaterial3D,
|
|
5
5
|
WebGLRenderer,
|
|
@@ -93,6 +93,7 @@ function updateView() {
|
|
|
93
93
|
canvas.height = innerHeight * devicePixelRatio
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
// demo-only GUI controls
|
|
96
97
|
const controls = new GUI()
|
|
97
98
|
const cameraFolder = controls.addFolder("Camera")
|
|
98
99
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GUI } from "dat.gui"
|
|
2
|
-
import { addRenderGraphGuiAddon } from "
|
|
2
|
+
import { addRenderGraphGuiAddon } from "chorama"
|
|
3
3
|
import {
|
|
4
4
|
MeshMaterial3D,
|
|
5
5
|
WebGLRenderer,
|
|
@@ -116,6 +116,7 @@ function updateView() {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
// demo-only GUI controls
|
|
119
120
|
const controls = new GUI()
|
|
120
121
|
const cameraFolder = controls.addFolder("Camera")
|
|
121
122
|
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { GUI } from "dat.gui"
|
|
2
|
+
import Stats from "stats.js"
|
|
3
|
+
import {
|
|
4
|
+
ACESFilmicTonemapping,
|
|
5
|
+
AgXTonemapping,
|
|
6
|
+
AmbientLight,
|
|
7
|
+
Camera,
|
|
8
|
+
CameraPlugin,
|
|
9
|
+
CanvasTarget,
|
|
10
|
+
DirectionalLight,
|
|
11
|
+
GLTFLoader,
|
|
12
|
+
HableTonemapping,
|
|
13
|
+
KhronosPBRNeutralTonemapping,
|
|
14
|
+
LightPlugin,
|
|
15
|
+
MeshMaterialPlugin,
|
|
16
|
+
OrbitCameraControls,
|
|
17
|
+
PerspectiveProjection,
|
|
18
|
+
ReinhardToneMapping,
|
|
19
|
+
SkyBox,
|
|
20
|
+
SkyboxPlugin,
|
|
21
|
+
TextureLoader,
|
|
22
|
+
TextureType,
|
|
23
|
+
WebGLRenderDevice,
|
|
24
|
+
WebGLRenderer,
|
|
25
|
+
} from "chorama"
|
|
26
|
+
|
|
27
|
+
const canvas = document.createElement("canvas")
|
|
28
|
+
const renderTarget = new CanvasTarget(canvas)
|
|
29
|
+
const renderDevice = new WebGLRenderDevice(canvas)
|
|
30
|
+
const renderer = new WebGLRenderer({
|
|
31
|
+
plugins: [
|
|
32
|
+
new CameraPlugin(),
|
|
33
|
+
new LightPlugin(),
|
|
34
|
+
new SkyboxPlugin(),
|
|
35
|
+
new MeshMaterialPlugin(),
|
|
36
|
+
]
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const camera = new Camera(renderTarget)
|
|
40
|
+
const cameraControls = new OrbitCameraControls(camera, canvas)
|
|
41
|
+
const textureLoader = new TextureLoader()
|
|
42
|
+
const gltfLoader = new GLTFLoader()
|
|
43
|
+
|
|
44
|
+
const day = textureLoader.load({
|
|
45
|
+
paths: [
|
|
46
|
+
"/images/skybox/miramar_right.png",
|
|
47
|
+
"/images/skybox/miramar_left.png",
|
|
48
|
+
"/images/skybox/miramar_top.png",
|
|
49
|
+
"/images/skybox/miramar_bottom.png",
|
|
50
|
+
"/images/skybox/miramar_back.png",
|
|
51
|
+
"/images/skybox/miramar_front.png",
|
|
52
|
+
],
|
|
53
|
+
type: TextureType.TextureCubeMap,
|
|
54
|
+
})
|
|
55
|
+
const skyBox = new SkyBox({
|
|
56
|
+
day
|
|
57
|
+
})
|
|
58
|
+
skyBox.transform.orientation.rotateY(Math.PI)
|
|
59
|
+
|
|
60
|
+
const model = gltfLoader.load({
|
|
61
|
+
paths: ["/models/gltf/flight_helmet/index.gltf"]
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const ambientLight = new AmbientLight()
|
|
65
|
+
ambientLight.intensity = 0.18
|
|
66
|
+
|
|
67
|
+
const directionalLight = new DirectionalLight()
|
|
68
|
+
directionalLight.intensity = 28
|
|
69
|
+
directionalLight.transform.orientation
|
|
70
|
+
.rotateX(-Math.PI / 4)
|
|
71
|
+
.rotateZ(-Math.PI / 4)
|
|
72
|
+
|
|
73
|
+
const toneMappingOptions = {
|
|
74
|
+
None: "none",
|
|
75
|
+
Reinhard: "reinhard",
|
|
76
|
+
Hable: "hable",
|
|
77
|
+
"ACES Filmic": "aces_filmic",
|
|
78
|
+
AgX: "agx",
|
|
79
|
+
"Khronos PBR Neutral": "khronos_pbr_neutral",
|
|
80
|
+
}
|
|
81
|
+
const settings = {
|
|
82
|
+
toneMapping: toneMappingOptions.Reinhard,
|
|
83
|
+
exposure: 1,
|
|
84
|
+
ambientLight: ambientLight.intensity,
|
|
85
|
+
directionalLight: directionalLight.intensity,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
cameraControls.distance = 0.8
|
|
89
|
+
cameraControls.offset.y = 0.5
|
|
90
|
+
applyToneMapping()
|
|
91
|
+
|
|
92
|
+
if (camera.projection instanceof PerspectiveProjection) {
|
|
93
|
+
camera.projection.fov = Math.PI / 180 * 75
|
|
94
|
+
camera.projection.aspect = innerWidth / innerHeight
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
document.body.append(canvas)
|
|
98
|
+
addEventListener("resize", updateView)
|
|
99
|
+
updateView()
|
|
100
|
+
createControls()
|
|
101
|
+
requestAnimationFrame(update)
|
|
102
|
+
|
|
103
|
+
function update() {
|
|
104
|
+
stats.begin()
|
|
105
|
+
cameraControls.update()
|
|
106
|
+
renderer.render([model, skyBox, ambientLight, directionalLight, camera], renderDevice)
|
|
107
|
+
stats.end()
|
|
108
|
+
requestAnimationFrame(update)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function updateView() {
|
|
112
|
+
canvas.style.width = innerWidth + "px"
|
|
113
|
+
canvas.style.height = innerHeight + "px"
|
|
114
|
+
canvas.width = innerWidth * devicePixelRatio
|
|
115
|
+
canvas.height = innerHeight * devicePixelRatio
|
|
116
|
+
|
|
117
|
+
if (camera.projection instanceof PerspectiveProjection) {
|
|
118
|
+
camera.projection.aspect = innerWidth / innerHeight
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function createControls() {
|
|
123
|
+
const controls = new GUI()
|
|
124
|
+
const cameraFolder = controls.addFolder("Camera")
|
|
125
|
+
const lightingFolder = controls.addFolder("Lighting")
|
|
126
|
+
|
|
127
|
+
cameraFolder
|
|
128
|
+
.add(settings, "toneMapping", toneMappingOptions)
|
|
129
|
+
.name("Tone Mapping")
|
|
130
|
+
.onChange(applyToneMapping)
|
|
131
|
+
cameraFolder
|
|
132
|
+
.add(settings, "exposure", 0.1, 5, 0.01)
|
|
133
|
+
.name("Exposure")
|
|
134
|
+
.onChange(applyExposure)
|
|
135
|
+
cameraFolder.open()
|
|
136
|
+
|
|
137
|
+
lightingFolder
|
|
138
|
+
.add(settings, "ambientLight", 0, 2, 0.01)
|
|
139
|
+
.name("Ambient")
|
|
140
|
+
.onChange((value) => {
|
|
141
|
+
ambientLight.intensity = value
|
|
142
|
+
})
|
|
143
|
+
lightingFolder
|
|
144
|
+
.add(settings, "directionalLight", 0, 80, 0.1)
|
|
145
|
+
.name("Directional")
|
|
146
|
+
.onChange((value) => {
|
|
147
|
+
directionalLight.intensity = value
|
|
148
|
+
})
|
|
149
|
+
lightingFolder.open()
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function applyToneMapping() {
|
|
153
|
+
switch (settings.toneMapping) {
|
|
154
|
+
case toneMappingOptions.None:
|
|
155
|
+
camera.toneMapping = undefined
|
|
156
|
+
break
|
|
157
|
+
case toneMappingOptions.Hable:
|
|
158
|
+
camera.toneMapping = new HableTonemapping({ exposure: settings.exposure })
|
|
159
|
+
break
|
|
160
|
+
case toneMappingOptions["ACES Filmic"]:
|
|
161
|
+
camera.toneMapping = new ACESFilmicTonemapping({ exposure: settings.exposure })
|
|
162
|
+
break
|
|
163
|
+
case toneMappingOptions.AgX:
|
|
164
|
+
camera.toneMapping = new AgXTonemapping({ exposure: settings.exposure })
|
|
165
|
+
break
|
|
166
|
+
case toneMappingOptions["Khronos PBR Neutral"]:
|
|
167
|
+
camera.toneMapping = new KhronosPBRNeutralTonemapping({ exposure: settings.exposure })
|
|
168
|
+
break
|
|
169
|
+
case toneMappingOptions.Reinhard:
|
|
170
|
+
default:
|
|
171
|
+
camera.toneMapping = new ReinhardToneMapping({ exposure: settings.exposure })
|
|
172
|
+
break
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function applyExposure() {
|
|
177
|
+
if (camera.toneMapping) {
|
|
178
|
+
camera.toneMapping.exposure = settings.exposure
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// demo-only performance monitor
|
|
183
|
+
const stats = new Stats()
|
|
184
|
+
stats.showPanel(1)
|
|
185
|
+
document.body.append(stats.dom)
|
|
186
|
+
stats.dom.removeAttribute("style")
|
|
187
|
+
stats.dom.classList.add("performance-monitor")
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
CameraPlugin
|
|
32
32
|
} from "chorama"
|
|
33
33
|
import { GUI } from "dat.gui"
|
|
34
|
-
import { addRenderGraphGuiAddon } from "
|
|
34
|
+
import { addRenderGraphGuiAddon } from "chorama"
|
|
35
35
|
|
|
36
36
|
const canvas = document.createElement('canvas')
|
|
37
37
|
const renderTarget = new CanvasTarget(canvas)
|
|
@@ -198,8 +198,7 @@ function updateView() {
|
|
|
198
198
|
camera.projection.aspect = innerWidth / innerHeight
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
|
|
202
|
-
// gui controls
|
|
201
|
+
// demo-only GUI controls
|
|
203
202
|
const options = [
|
|
204
203
|
'LAMBERT',
|
|
205
204
|
'PHONG',
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
CameraPlugin
|
|
32
32
|
} from "chorama"
|
|
33
33
|
import { GUI } from "dat.gui"
|
|
34
|
-
import { addRenderGraphGuiAddon } from "
|
|
34
|
+
import { addRenderGraphGuiAddon } from "chorama"
|
|
35
35
|
|
|
36
36
|
const canvas = document.createElement('canvas')
|
|
37
37
|
const renderTarget = new CanvasTarget(canvas)
|
|
@@ -223,6 +223,7 @@ const shadowFilterSettings = {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
+
// demo-only GUI controls
|
|
226
227
|
const controls = new GUI()
|
|
227
228
|
const shadowFolder = controls.addFolder("Shadows")
|
|
228
229
|
/**
|
package/examples/lights/point.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
CameraPlugin
|
|
29
29
|
} from "chorama"
|
|
30
30
|
import { GUI } from "dat.gui"
|
|
31
|
-
import { addRenderGraphGuiAddon } from "
|
|
31
|
+
import { addRenderGraphGuiAddon } from "chorama"
|
|
32
32
|
|
|
33
33
|
const canvas = document.createElement('canvas')
|
|
34
34
|
const renderTarget = new CanvasTarget(canvas)
|
|
@@ -184,8 +184,7 @@ function updateView() {
|
|
|
184
184
|
camera.projection.aspect = innerWidth / innerHeight
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
// gui controls
|
|
187
|
+
// demo-only GUI controls
|
|
189
188
|
const options = [
|
|
190
189
|
'LAMBERT',
|
|
191
190
|
'PHONG',
|
package/examples/lights/spot.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
CameraPlugin
|
|
32
32
|
} from "chorama"
|
|
33
33
|
import { GUI } from "dat.gui"
|
|
34
|
-
import { addRenderGraphGuiAddon } from "
|
|
34
|
+
import { addRenderGraphGuiAddon } from "chorama"
|
|
35
35
|
|
|
36
36
|
const canvas = document.createElement('canvas')
|
|
37
37
|
const renderTarget = new CanvasTarget(canvas)
|
|
@@ -192,8 +192,7 @@ function updateView() {
|
|
|
192
192
|
camera.projection.aspect = innerWidth / innerHeight
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
|
|
196
|
-
// gui controls
|
|
195
|
+
// demo-only GUI controls
|
|
197
196
|
const options = [
|
|
198
197
|
'LAMBERT',
|
|
199
198
|
'PHONG',
|
|
@@ -13,13 +13,6 @@ import {
|
|
|
13
13
|
CameraPlugin
|
|
14
14
|
} from 'chorama';
|
|
15
15
|
|
|
16
|
-
// performance monitor
|
|
17
|
-
const stats = new Stats()
|
|
18
|
-
stats.showPanel(1)
|
|
19
|
-
document.body.append(stats.dom)
|
|
20
|
-
stats.dom.removeAttribute('style')
|
|
21
|
-
stats.dom.classList.add('performance-monitor')
|
|
22
|
-
|
|
23
16
|
const canvas = document.createElement('canvas')
|
|
24
17
|
const renderTarget = new CanvasTarget(canvas)
|
|
25
18
|
const renderDevice = new WebGLRenderDevice(canvas,{
|
|
@@ -75,4 +68,11 @@ function updateView() {
|
|
|
75
68
|
if (camera.projection instanceof PerspectiveProjection) {
|
|
76
69
|
camera.projection.aspect = innerWidth / innerHeight
|
|
77
70
|
}
|
|
78
|
-
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// demo-only performance monitor
|
|
74
|
+
const stats = new Stats()
|
|
75
|
+
stats.showPanel(1)
|
|
76
|
+
document.body.append(stats.dom)
|
|
77
|
+
stats.dom.removeAttribute('style')
|
|
78
|
+
stats.dom.classList.add('performance-monitor')
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Stats from "stats.js";
|
|
2
|
+
import {
|
|
3
|
+
WebGLRenderer,
|
|
4
|
+
PerspectiveProjection,
|
|
5
|
+
GLTFLoader,
|
|
6
|
+
Camera,
|
|
7
|
+
WebGLRenderDevice,
|
|
8
|
+
OrbitCameraControls,
|
|
9
|
+
LightPlugin,
|
|
10
|
+
AmbientLight,
|
|
11
|
+
MeshMaterialPlugin,
|
|
12
|
+
CanvasTarget,
|
|
13
|
+
CameraPlugin
|
|
14
|
+
} from "chorama";
|
|
15
|
+
|
|
16
|
+
const canvas = document.createElement('canvas')
|
|
17
|
+
const renderTarget = new CanvasTarget(canvas)
|
|
18
|
+
const renderDevice = new WebGLRenderDevice(canvas,{
|
|
19
|
+
depth:true
|
|
20
|
+
})
|
|
21
|
+
const renderer = new WebGLRenderer({
|
|
22
|
+
plugins: [
|
|
23
|
+
new CameraPlugin(),
|
|
24
|
+
new LightPlugin(),
|
|
25
|
+
new MeshMaterialPlugin(),
|
|
26
|
+
]
|
|
27
|
+
})
|
|
28
|
+
const camera = new Camera(renderTarget)
|
|
29
|
+
const cameraControls = new OrbitCameraControls(camera, canvas)
|
|
30
|
+
|
|
31
|
+
// lighting
|
|
32
|
+
const ambientLight = new AmbientLight()
|
|
33
|
+
|
|
34
|
+
ambientLight.intensity = 0.5
|
|
35
|
+
|
|
36
|
+
const loader = new GLTFLoader()
|
|
37
|
+
const model = loader.load({
|
|
38
|
+
paths: ["/models/glb/AlphaBlendModeTest.glb"]
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
cameraControls.distance = 2
|
|
42
|
+
cameraControls.offset.y = 0.8
|
|
43
|
+
cameraControls.azimuth = -Math.PI / 3
|
|
44
|
+
cameraControls.elevation = 0.25
|
|
45
|
+
|
|
46
|
+
if (camera.projection instanceof PerspectiveProjection) {
|
|
47
|
+
camera.projection.fov = Math.PI / 180 * 75
|
|
48
|
+
camera.projection.aspect = innerWidth / innerHeight
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
document.body.append(canvas)
|
|
52
|
+
updateView()
|
|
53
|
+
addEventListener("resize", updateView)
|
|
54
|
+
requestAnimationFrame(update)
|
|
55
|
+
|
|
56
|
+
function update() {
|
|
57
|
+
stats.begin()
|
|
58
|
+
cameraControls.update()
|
|
59
|
+
renderer.render([model, ambientLight, camera], renderDevice)
|
|
60
|
+
stats.end()
|
|
61
|
+
requestAnimationFrame(update)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function updateView() {
|
|
65
|
+
canvas.style.width = innerWidth + "px"
|
|
66
|
+
canvas.style.height = innerHeight + "px"
|
|
67
|
+
canvas.width = innerWidth * devicePixelRatio
|
|
68
|
+
canvas.height = innerHeight * devicePixelRatio
|
|
69
|
+
|
|
70
|
+
if (camera.projection instanceof PerspectiveProjection) {
|
|
71
|
+
camera.projection.aspect = innerWidth / innerHeight
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// demo-only performance monitor
|
|
76
|
+
const stats = new Stats()
|
|
77
|
+
stats.showPanel(1)
|
|
78
|
+
document.body.append(stats.dom)
|
|
79
|
+
stats.dom.removeAttribute('style')
|
|
80
|
+
stats.dom.classList.add('performance-monitor')
|
|
@@ -18,13 +18,6 @@ import {
|
|
|
18
18
|
CameraPlugin
|
|
19
19
|
} from 'chorama';
|
|
20
20
|
|
|
21
|
-
// performance monitor
|
|
22
|
-
const stats = new Stats()
|
|
23
|
-
stats.showPanel(1)
|
|
24
|
-
document.body.append(stats.dom)
|
|
25
|
-
stats.dom.removeAttribute('style')
|
|
26
|
-
stats.dom.classList.add('performance-monitor')
|
|
27
|
-
|
|
28
21
|
const canvas = document.createElement('canvas')
|
|
29
22
|
const renderTarget = new CanvasTarget(canvas)
|
|
30
23
|
const renderDevice = new WebGLRenderDevice(canvas,{
|
|
@@ -108,4 +101,11 @@ function updateView() {
|
|
|
108
101
|
if (camera.projection instanceof PerspectiveProjection) {
|
|
109
102
|
camera.projection.aspect = innerWidth / innerHeight
|
|
110
103
|
}
|
|
111
|
-
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// demo-only performance monitor
|
|
107
|
+
const stats = new Stats()
|
|
108
|
+
stats.showPanel(1)
|
|
109
|
+
document.body.append(stats.dom)
|
|
110
|
+
stats.dom.removeAttribute('style')
|
|
111
|
+
stats.dom.classList.add('performance-monitor')
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import Stats from "stats.js";
|
|
2
|
+
import {
|
|
3
|
+
WebGLRenderer,
|
|
4
|
+
PerspectiveProjection,
|
|
5
|
+
GLTFLoader,
|
|
6
|
+
Camera,
|
|
7
|
+
WebGLRenderDevice,
|
|
8
|
+
MeshMaterialPlugin,
|
|
9
|
+
OrbitCameraControls,
|
|
10
|
+
TextureType,
|
|
11
|
+
SkyBox,
|
|
12
|
+
TextureLoader,
|
|
13
|
+
DirectionalLight,
|
|
14
|
+
LightPlugin,
|
|
15
|
+
AmbientLight,
|
|
16
|
+
CanvasTarget,
|
|
17
|
+
SkyboxPlugin,
|
|
18
|
+
CameraPlugin,
|
|
19
|
+
EnvironmentMap
|
|
20
|
+
} from "chorama";
|
|
21
|
+
|
|
22
|
+
const canvas = document.createElement("canvas")
|
|
23
|
+
const renderTarget = new CanvasTarget(canvas)
|
|
24
|
+
const renderDevice = new WebGLRenderDevice(canvas, {
|
|
25
|
+
depth: true
|
|
26
|
+
})
|
|
27
|
+
const renderer = new WebGLRenderer({
|
|
28
|
+
plugins: [
|
|
29
|
+
new CameraPlugin(),
|
|
30
|
+
new LightPlugin(),
|
|
31
|
+
new SkyboxPlugin(),
|
|
32
|
+
new MeshMaterialPlugin(),
|
|
33
|
+
]
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const environmentMap = renderer.getResource(EnvironmentMap)
|
|
37
|
+
|
|
38
|
+
// lighting
|
|
39
|
+
const ambientLight = new AmbientLight()
|
|
40
|
+
const directionalLight = new DirectionalLight()
|
|
41
|
+
|
|
42
|
+
directionalLight.transform.orientation
|
|
43
|
+
.rotateX(-Math.PI / 4)
|
|
44
|
+
.rotateZ(-Math.PI / 4)
|
|
45
|
+
directionalLight.intensity = 18
|
|
46
|
+
ambientLight.intensity = 0.18
|
|
47
|
+
|
|
48
|
+
// camera and camera controls
|
|
49
|
+
const camera = new Camera(renderTarget)
|
|
50
|
+
const cameraControls = new OrbitCameraControls(camera, canvas)
|
|
51
|
+
document.body.append(canvas)
|
|
52
|
+
updateView()
|
|
53
|
+
|
|
54
|
+
const textureLoader = new TextureLoader()
|
|
55
|
+
const gltfLoader = new GLTFLoader()
|
|
56
|
+
|
|
57
|
+
const day = textureLoader.load({
|
|
58
|
+
paths: [
|
|
59
|
+
"/images/skybox/miramar_right.png",
|
|
60
|
+
"/images/skybox/miramar_left.png",
|
|
61
|
+
"/images/skybox/miramar_top.png",
|
|
62
|
+
"/images/skybox/miramar_bottom.png",
|
|
63
|
+
"/images/skybox/miramar_back.png",
|
|
64
|
+
"/images/skybox/miramar_front.png",
|
|
65
|
+
],
|
|
66
|
+
type: TextureType.TextureCubeMap,
|
|
67
|
+
generateMipmaps: true,
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
environmentMap?.set(day)
|
|
71
|
+
|
|
72
|
+
const skyBox = new SkyBox({
|
|
73
|
+
day
|
|
74
|
+
})
|
|
75
|
+
skyBox.transform.orientation.rotateY(Math.PI)
|
|
76
|
+
|
|
77
|
+
// The glTF model
|
|
78
|
+
const model = gltfLoader.load({
|
|
79
|
+
paths: ["/models/glb/IridescenceLamp.glb"]
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
cameraControls.distance = 2.8
|
|
83
|
+
cameraControls.offset.y = 0.35
|
|
84
|
+
if (camera.projection instanceof PerspectiveProjection) {
|
|
85
|
+
camera.projection.fov = Math.PI / 180 * 75
|
|
86
|
+
camera.projection.aspect = innerWidth / innerHeight
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
updateView()
|
|
90
|
+
addEventListener("resize", updateView)
|
|
91
|
+
requestAnimationFrame(update)
|
|
92
|
+
|
|
93
|
+
function update() {
|
|
94
|
+
stats.begin()
|
|
95
|
+
model.transform.orientation.rotateY(Math.PI / 4000)
|
|
96
|
+
renderer.render([model, skyBox, ambientLight, directionalLight, camera], renderDevice)
|
|
97
|
+
cameraControls.update()
|
|
98
|
+
stats.end()
|
|
99
|
+
requestAnimationFrame(update)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function updateView() {
|
|
103
|
+
canvas.style.width = innerWidth + "px"
|
|
104
|
+
canvas.style.height = innerHeight + "px"
|
|
105
|
+
canvas.width = innerWidth * devicePixelRatio
|
|
106
|
+
canvas.height = innerHeight * devicePixelRatio
|
|
107
|
+
|
|
108
|
+
if (camera.projection instanceof PerspectiveProjection) {
|
|
109
|
+
camera.projection.aspect = innerWidth / innerHeight
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// demo-only performance monitor
|
|
114
|
+
const stats = new Stats()
|
|
115
|
+
stats.showPanel(1)
|
|
116
|
+
document.body.append(stats.dom)
|
|
117
|
+
stats.dom.removeAttribute("style")
|
|
118
|
+
stats.dom.classList.add("performance-monitor")
|
|
@@ -16,13 +16,6 @@ import {
|
|
|
16
16
|
CameraPlugin
|
|
17
17
|
} from 'chorama';
|
|
18
18
|
|
|
19
|
-
// performance monitor
|
|
20
|
-
const stats = new Stats()
|
|
21
|
-
stats.showPanel(1)
|
|
22
|
-
document.body.append(stats.dom)
|
|
23
|
-
stats.dom.removeAttribute('style')
|
|
24
|
-
stats.dom.classList.add('performance-monitor')
|
|
25
|
-
|
|
26
19
|
const canvas = document.createElement('canvas')
|
|
27
20
|
const renderTarget = new CanvasTarget(canvas)
|
|
28
21
|
const renderDevice = new WebGLRenderDevice(canvas,{
|
|
@@ -39,9 +32,7 @@ const textureLoader = new TextureLoader()
|
|
|
39
32
|
const loader = new OBJLoader()
|
|
40
33
|
const texture = textureLoader.load({
|
|
41
34
|
paths: ["/models/obj/pirate_girl/pirate_girl.png"],
|
|
42
|
-
|
|
43
|
-
flipY:true
|
|
44
|
-
}
|
|
35
|
+
flipY: true
|
|
45
36
|
})
|
|
46
37
|
const model = loader.load({
|
|
47
38
|
paths: ["/models/obj/pirate_girl/pirate_girl.obj"],
|
|
@@ -92,4 +83,11 @@ function updateView() {
|
|
|
92
83
|
if (camera.projection instanceof PerspectiveProjection) {
|
|
93
84
|
camera.projection.aspect = innerWidth / innerHeight
|
|
94
85
|
}
|
|
95
|
-
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// demo-only performance monitor
|
|
89
|
+
const stats = new Stats()
|
|
90
|
+
stats.showPanel(1)
|
|
91
|
+
document.body.append(stats.dom)
|
|
92
|
+
stats.dom.removeAttribute('style')
|
|
93
|
+
stats.dom.classList.add('performance-monitor')
|
|
@@ -14,12 +14,6 @@ import {
|
|
|
14
14
|
CanvasTarget,
|
|
15
15
|
CameraPlugin
|
|
16
16
|
} from "chorama"
|
|
17
|
-
// performance monitor
|
|
18
|
-
const stats = new Stats()
|
|
19
|
-
stats.showPanel(1)
|
|
20
|
-
document.body.append(stats.dom)
|
|
21
|
-
stats.dom.removeAttribute('style')
|
|
22
|
-
stats.dom.classList.add('performance-monitor')
|
|
23
17
|
|
|
24
18
|
const canvas = document.createElement('canvas')
|
|
25
19
|
const renderTarget = new CanvasTarget(canvas)
|
|
@@ -108,4 +102,11 @@ function updateView() {
|
|
|
108
102
|
if (camera.projection instanceof PerspectiveProjection) {
|
|
109
103
|
camera.projection.aspect = innerWidth / innerHeight
|
|
110
104
|
}
|
|
111
|
-
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// demo-only performance monitor
|
|
108
|
+
const stats = new Stats()
|
|
109
|
+
stats.showPanel(1)
|
|
110
|
+
document.body.append(stats.dom)
|
|
111
|
+
stats.dom.removeAttribute('style')
|
|
112
|
+
stats.dom.classList.add('performance-monitor')
|
|
@@ -21,13 +21,6 @@ import {
|
|
|
21
21
|
CameraPlugin
|
|
22
22
|
} from "chorama"
|
|
23
23
|
|
|
24
|
-
// performance monitor
|
|
25
|
-
const stats = new Stats()
|
|
26
|
-
stats.showPanel(1)
|
|
27
|
-
document.body.append(stats.dom)
|
|
28
|
-
stats.dom.removeAttribute('style')
|
|
29
|
-
stats.dom.classList.add('performance-monitor')
|
|
30
|
-
|
|
31
24
|
const canvas = document.createElement('canvas')
|
|
32
25
|
const renderTarget = new CanvasTarget(canvas)
|
|
33
26
|
const renderDevice = new WebGLRenderDevice(canvas,{
|
|
@@ -54,9 +47,7 @@ ambientLight.intensity = 0.15
|
|
|
54
47
|
const textureLoader = new TextureLoader()
|
|
55
48
|
const texture = textureLoader.load({
|
|
56
49
|
paths: ["/images/uv.jpg"],
|
|
57
|
-
|
|
58
|
-
flipY: true
|
|
59
|
-
}
|
|
50
|
+
flipY: true
|
|
60
51
|
})
|
|
61
52
|
const mesh1 = new CuboidMeshBuilder().build()
|
|
62
53
|
const mesh2 = new UVSphereMeshBuilder().build()
|
|
@@ -123,4 +114,11 @@ function updateView() {
|
|
|
123
114
|
if (camera.projection instanceof PerspectiveProjection) {
|
|
124
115
|
camera.projection.aspect = innerWidth / innerHeight
|
|
125
116
|
}
|
|
126
|
-
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// demo-only performance monitor
|
|
120
|
+
const stats = new Stats()
|
|
121
|
+
stats.showPanel(1)
|
|
122
|
+
document.body.append(stats.dom)
|
|
123
|
+
stats.dom.removeAttribute('style')
|
|
124
|
+
stats.dom.classList.add('performance-monitor')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GUI } from "dat.gui"
|
|
2
|
-
import { addRenderGraphGuiAddon } from "
|
|
2
|
+
import { addRenderGraphGuiAddon } from "chorama"
|
|
3
3
|
import {
|
|
4
4
|
MeshMaterial3D,
|
|
5
5
|
DirectionalLight,
|
|
@@ -51,9 +51,7 @@ ambientLight.intensity = 0.3
|
|
|
51
51
|
const textureLoader = new TextureLoader()
|
|
52
52
|
const texture = textureLoader.load({
|
|
53
53
|
paths: ["/images/uv.jpg"],
|
|
54
|
-
|
|
55
|
-
flipY: true
|
|
56
|
-
}
|
|
54
|
+
flipY: true
|
|
57
55
|
})
|
|
58
56
|
const day = textureLoader.load({
|
|
59
57
|
paths: [
|
|
@@ -115,8 +113,7 @@ function updateView() {
|
|
|
115
113
|
camera.projection.aspect = innerWidth / innerHeight
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
|
-
|
|
119
|
-
// gui controls
|
|
116
|
+
// demo-only GUI controls
|
|
120
117
|
const settings = {
|
|
121
118
|
dummy: {
|
|
122
119
|
r: 0,
|