@anov/3d 0.0.1 → 0.0.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/README.md +142 -1
- package/dist/core/camera.d.ts +31 -4
- package/dist/core/camera.js +62 -52
- package/dist/core/control/transformControls.d.ts +12 -0
- package/dist/core/control/transformControls.js +72 -0
- package/dist/core/cssRenderer.d.ts +17 -0
- package/dist/core/cssRenderer.js +36 -0
- package/dist/core/global/global.d.ts +27 -0
- package/dist/core/global/global.js +72 -0
- package/dist/core/global/globalControl.d.ts +17 -0
- package/dist/core/global/globalControl.js +62 -0
- package/dist/core/group.d.ts +51 -6
- package/dist/core/group.js +124 -16
- package/dist/core/line.d.ts +13 -0
- package/dist/core/line.js +83 -0
- package/dist/core/mesh.d.ts +12 -7
- package/dist/core/mesh.js +57 -56
- package/dist/core/model.d.ts +11 -3
- package/dist/core/model.js +34 -7
- package/dist/core/scene.d.ts +84 -25
- package/dist/core/scene.js +207 -53
- package/dist/core/use/useScene.d.ts +10 -0
- package/dist/core/use/useScene.js +14 -0
- package/dist/core/use/useframe.d.ts +6 -0
- package/dist/core/use/useframe.js +11 -0
- package/dist/export.d.ts +41 -0
- package/dist/export.js +37 -0
- package/dist/index.d.ts +3 -6
- package/dist/index.js +5 -6
- package/dist/threeCell.d.ts +8 -0
- package/dist/threeCell.js +16 -0
- package/dist/type.d.ts +4 -3
- package/dist/utils/createElement.d.ts +103 -0
- package/dist/utils/createElement.js +145 -0
- package/dist/utils/createLabel.d.ts +2 -0
- package/dist/utils/createLabel.js +4 -0
- package/dist/utils/index.d.ts +36 -0
- package/dist/utils/index.js +76 -0
- package/dist/utils/line.d.ts +0 -0
- package/dist/utils/line.js +0 -0
- package/dist/utils/move.d.ts +48 -0
- package/dist/utils/move.js +149 -0
- package/examples/fonts/LICENSE +13 -0
- package/examples/fonts/README.md +11 -0
- package/examples/fonts/droid/NOTICE +190 -0
- package/examples/fonts/droid/README.txt +18 -0
- package/examples/fonts/droid/droid_sans_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_regular.typeface.json +1 -0
- package/examples/fonts/gentilis_bold.typeface.json +1 -0
- package/examples/fonts/gentilis_regular.typeface.json +1 -0
- package/examples/fonts/helvetiker_bold.typeface.json +1 -0
- package/examples/fonts/helvetiker_regular.typeface.json +1 -0
- package/examples/fonts/optimer_bold.typeface.json +1 -0
- package/examples/fonts/optimer_regular.typeface.json +1 -0
- package/examples/fonts/ttf/README.md +9 -0
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/animation/AnimationClipCreator.js +116 -0
- package/examples/jsm/animation/CCDIKSolver.js +482 -0
- package/examples/jsm/animation/MMDAnimationHelper.js +1207 -0
- package/examples/jsm/animation/MMDPhysics.js +1406 -0
- package/examples/jsm/cameras/CinematicCamera.js +208 -0
- package/examples/jsm/capabilities/WebGL.js +91 -0
- package/examples/jsm/capabilities/WebGPU.js +53 -0
- package/examples/jsm/controls/ArcballControls.js +3224 -0
- package/examples/jsm/controls/DragControls.js +220 -0
- package/examples/jsm/controls/FirstPersonControls.js +325 -0
- package/examples/jsm/controls/FlyControls.js +300 -0
- package/examples/jsm/controls/MapControls.js +28 -0
- package/examples/jsm/controls/OrbitControls.js +1388 -0
- package/examples/jsm/controls/PointerLockControls.js +162 -0
- package/examples/jsm/controls/TrackballControls.js +828 -0
- package/examples/jsm/controls/TransformControls.js +1557 -0
- package/examples/jsm/csm/CSM.js +384 -0
- package/examples/jsm/csm/CSMFrustum.js +152 -0
- package/examples/jsm/csm/CSMHelper.js +193 -0
- package/examples/jsm/csm/CSMShader.js +252 -0
- package/examples/jsm/curves/CurveExtras.js +422 -0
- package/examples/jsm/curves/NURBSCurve.js +80 -0
- package/examples/jsm/curves/NURBSSurface.js +52 -0
- package/examples/jsm/curves/NURBSUtils.js +487 -0
- package/examples/jsm/effects/AnaglyphEffect.js +154 -0
- package/examples/jsm/effects/AsciiEffect.js +263 -0
- package/examples/jsm/effects/OutlineEffect.js +539 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +119 -0
- package/examples/jsm/effects/PeppersGhostEffect.js +153 -0
- package/examples/jsm/effects/StereoEffect.js +55 -0
- package/examples/jsm/environments/DebugEnvironment.js +52 -0
- package/examples/jsm/environments/RoomEnvironment.js +148 -0
- package/examples/jsm/exporters/DRACOExporter.js +267 -0
- package/examples/jsm/exporters/EXRExporter.js +501 -0
- package/examples/jsm/exporters/GLTFExporter.js +3161 -0
- package/examples/jsm/exporters/KTX2Exporter.js +292 -0
- package/examples/jsm/exporters/MMDExporter.js +217 -0
- package/examples/jsm/exporters/OBJExporter.js +284 -0
- package/examples/jsm/exporters/PLYExporter.js +528 -0
- package/examples/jsm/exporters/STLExporter.js +199 -0
- package/examples/jsm/exporters/USDZExporter.js +711 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +69 -0
- package/examples/jsm/geometries/ConvexGeometry.js +53 -0
- package/examples/jsm/geometries/DecalGeometry.js +356 -0
- package/examples/jsm/geometries/ParametricGeometries.js +254 -0
- package/examples/jsm/geometries/ParametricGeometry.js +139 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +155 -0
- package/examples/jsm/geometries/TeapotGeometry.js +704 -0
- package/examples/jsm/geometries/TextGeometry.js +57 -0
- package/examples/jsm/helpers/LightProbeHelper.js +130 -0
- package/examples/jsm/helpers/OctreeHelper.js +73 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +109 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +85 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +96 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +88 -0
- package/examples/jsm/helpers/ViewHelper.js +333 -0
- package/examples/jsm/interactive/HTMLMesh.js +565 -0
- package/examples/jsm/interactive/InteractiveGroup.js +116 -0
- package/examples/jsm/interactive/SelectionBox.js +227 -0
- package/examples/jsm/interactive/SelectionHelper.js +104 -0
- package/examples/jsm/libs/ammo.wasm.js +822 -0
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/basis/README.md +46 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +21 -0
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/chevrotain.module.min.js +141 -0
- package/examples/jsm/libs/draco/README.md +32 -0
- package/examples/jsm/libs/draco/draco_decoder.js +34 -0
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/ecsy.module.js +1792 -0
- package/examples/jsm/libs/fflate.module.js +2474 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/lottie_canvas.module.js +14844 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +178 -0
- package/examples/jsm/libs/mikktspace.module.js +128 -0
- package/examples/jsm/libs/mmdparser.module.js +11530 -0
- package/examples/jsm/libs/motion-controllers.module.js +397 -0
- package/examples/jsm/libs/opentype.module.js +14568 -0
- package/examples/jsm/libs/potpack.module.js +125 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +21 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +16 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/stats.module.js +167 -0
- package/examples/jsm/libs/tween.module.js +803 -0
- package/examples/jsm/libs/utif.module.js +1579 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/lights/IESSpotLight.js +25 -0
- package/examples/jsm/lights/LightProbeGenerator.js +252 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +79 -0
- package/examples/jsm/lines/Line2.js +19 -0
- package/examples/jsm/lines/LineGeometry.js +79 -0
- package/examples/jsm/lines/LineMaterial.js +702 -0
- package/examples/jsm/lines/LineSegments2.js +361 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +241 -0
- package/examples/jsm/lines/Wireframe.js +56 -0
- package/examples/jsm/lines/WireframeGeometry2.js +24 -0
- package/examples/jsm/loaders/3DMLoader.js +1497 -0
- package/examples/jsm/loaders/3MFLoader.js +1478 -0
- package/examples/jsm/loaders/AMFLoader.js +521 -0
- package/examples/jsm/loaders/BVHLoader.js +437 -0
- package/examples/jsm/loaders/ColladaLoader.js +4122 -0
- package/examples/jsm/loaders/DDSLoader.js +274 -0
- package/examples/jsm/loaders/DRACOLoader.js +612 -0
- package/examples/jsm/loaders/EXRLoader.js +2309 -0
- package/examples/jsm/loaders/FBXLoader.js +4142 -0
- package/examples/jsm/loaders/FontLoader.js +183 -0
- package/examples/jsm/loaders/GCodeLoader.js +261 -0
- package/examples/jsm/loaders/GLTFLoader.js +4576 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +115 -0
- package/examples/jsm/loaders/IESLoader.js +337 -0
- package/examples/jsm/loaders/KMZLoader.js +130 -0
- package/examples/jsm/loaders/KTX2Loader.js +868 -0
- package/examples/jsm/loaders/KTXLoader.js +176 -0
- package/examples/jsm/loaders/LDrawLoader.js +2464 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +151 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +153 -0
- package/examples/jsm/loaders/LWOLoader.js +1052 -0
- package/examples/jsm/loaders/LogLuvLoader.js +606 -0
- package/examples/jsm/loaders/LottieLoader.js +77 -0
- package/examples/jsm/loaders/MD2Loader.js +399 -0
- package/examples/jsm/loaders/MDDLoader.js +102 -0
- package/examples/jsm/loaders/MMDLoader.js +2273 -0
- package/examples/jsm/loaders/MTLLoader.js +567 -0
- package/examples/jsm/loaders/MaterialXLoader.js +734 -0
- package/examples/jsm/loaders/NRRDLoader.js +699 -0
- package/examples/jsm/loaders/OBJLoader.js +905 -0
- package/examples/jsm/loaders/PCDLoader.js +467 -0
- package/examples/jsm/loaders/PDBLoader.js +232 -0
- package/examples/jsm/loaders/PLYLoader.js +771 -0
- package/examples/jsm/loaders/PVRLoader.js +251 -0
- package/examples/jsm/loaders/RGBELoader.js +468 -0
- package/examples/jsm/loaders/RGBMLoader.js +1065 -0
- package/examples/jsm/loaders/STLLoader.js +403 -0
- package/examples/jsm/loaders/SVGLoader.js +3172 -0
- package/examples/jsm/loaders/TDSLoader.js +1124 -0
- package/examples/jsm/loaders/TGALoader.js +517 -0
- package/examples/jsm/loaders/TIFFLoader.js +36 -0
- package/examples/jsm/loaders/TTFLoader.js +214 -0
- package/examples/jsm/loaders/TiltLoader.js +520 -0
- package/examples/jsm/loaders/USDZLoader.js +633 -0
- package/examples/jsm/loaders/VOXLoader.js +311 -0
- package/examples/jsm/loaders/VRMLLoader.js +3533 -0
- package/examples/jsm/loaders/VTKLoader.js +1163 -0
- package/examples/jsm/loaders/XYZLoader.js +106 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1218 -0
- package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
- package/examples/jsm/materials/MeshGouraudMaterial.js +420 -0
- package/examples/jsm/math/Capsule.js +137 -0
- package/examples/jsm/math/ColorConverter.js +36 -0
- package/examples/jsm/math/ConvexHull.js +1271 -0
- package/examples/jsm/math/ImprovedNoise.js +71 -0
- package/examples/jsm/math/Lut.js +204 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +250 -0
- package/examples/jsm/math/OBB.js +423 -0
- package/examples/jsm/math/Octree.js +462 -0
- package/examples/jsm/math/SimplexNoise.js +444 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +519 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +446 -0
- package/examples/jsm/misc/Gyroscope.js +66 -0
- package/examples/jsm/misc/MD2Character.js +276 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +576 -0
- package/examples/jsm/misc/MorphAnimMesh.js +75 -0
- package/examples/jsm/misc/MorphBlendMesh.js +322 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +323 -0
- package/examples/jsm/misc/RollerCoaster.js +566 -0
- package/examples/jsm/misc/TubePainter.js +205 -0
- package/examples/jsm/misc/Volume.js +473 -0
- package/examples/jsm/misc/VolumeSlice.js +229 -0
- package/examples/jsm/modifiers/CurveModifier.js +326 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +279 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +525 -0
- package/examples/jsm/modifiers/TessellateModifier.js +307 -0
- package/examples/jsm/nodes/Nodes.js +171 -0
- package/examples/jsm/nodes/accessors/BitangentNode.js +89 -0
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +99 -0
- package/examples/jsm/nodes/accessors/BufferNode.js +30 -0
- package/examples/jsm/nodes/accessors/CameraNode.js +98 -0
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +103 -0
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +77 -0
- package/examples/jsm/nodes/accessors/InstanceNode.js +71 -0
- package/examples/jsm/nodes/accessors/MaterialNode.js +267 -0
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +39 -0
- package/examples/jsm/nodes/accessors/ModelNode.js +34 -0
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +29 -0
- package/examples/jsm/nodes/accessors/MorphNode.js +70 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +96 -0
- package/examples/jsm/nodes/accessors/Object3DNode.js +150 -0
- package/examples/jsm/nodes/accessors/PointUVNode.js +26 -0
- package/examples/jsm/nodes/accessors/PositionNode.js +104 -0
- package/examples/jsm/nodes/accessors/ReferenceNode.js +72 -0
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +35 -0
- package/examples/jsm/nodes/accessors/SceneNode.js +52 -0
- package/examples/jsm/nodes/accessors/SkinningNode.js +93 -0
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +27 -0
- package/examples/jsm/nodes/accessors/TangentNode.js +103 -0
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +94 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +271 -0
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +35 -0
- package/examples/jsm/nodes/accessors/UVNode.js +47 -0
- package/examples/jsm/nodes/accessors/UserDataNode.js +29 -0
- package/examples/jsm/nodes/code/CodeNode.js +78 -0
- package/examples/jsm/nodes/code/ExpressionNode.js +37 -0
- package/examples/jsm/nodes/code/FunctionCallNode.js +96 -0
- package/examples/jsm/nodes/code/FunctionNode.js +127 -0
- package/examples/jsm/nodes/code/ScriptableNode.js +488 -0
- package/examples/jsm/nodes/code/ScriptableValueNode.js +167 -0
- package/examples/jsm/nodes/core/ArrayUniformNode.js +26 -0
- package/examples/jsm/nodes/core/AttributeNode.js +102 -0
- package/examples/jsm/nodes/core/BypassNode.js +45 -0
- package/examples/jsm/nodes/core/CacheNode.js +46 -0
- package/examples/jsm/nodes/core/ConstNode.js +32 -0
- package/examples/jsm/nodes/core/ContextNode.js +61 -0
- package/examples/jsm/nodes/core/IndexNode.js +66 -0
- package/examples/jsm/nodes/core/InputNode.js +83 -0
- package/examples/jsm/nodes/core/LightingModel.js +15 -0
- package/examples/jsm/nodes/core/Node.js +454 -0
- package/examples/jsm/nodes/core/NodeAttribute.js +15 -0
- package/examples/jsm/nodes/core/NodeBuilder.js +1016 -0
- package/examples/jsm/nodes/core/NodeCache.js +26 -0
- package/examples/jsm/nodes/core/NodeCode.js +15 -0
- package/examples/jsm/nodes/core/NodeFrame.js +110 -0
- package/examples/jsm/nodes/core/NodeFunction.js +22 -0
- package/examples/jsm/nodes/core/NodeFunctionInput.js +17 -0
- package/examples/jsm/nodes/core/NodeKeywords.js +80 -0
- package/examples/jsm/nodes/core/NodeParser.js +11 -0
- package/examples/jsm/nodes/core/NodeUniform.js +28 -0
- package/examples/jsm/nodes/core/NodeUtils.js +212 -0
- package/examples/jsm/nodes/core/NodeVar.js +14 -0
- package/examples/jsm/nodes/core/NodeVarying.js +17 -0
- package/examples/jsm/nodes/core/PropertyNode.js +61 -0
- package/examples/jsm/nodes/core/StackNode.js +99 -0
- package/examples/jsm/nodes/core/TempNode.js +58 -0
- package/examples/jsm/nodes/core/UniformNode.js +61 -0
- package/examples/jsm/nodes/core/VarNode.js +87 -0
- package/examples/jsm/nodes/core/VaryingNode.js +69 -0
- package/examples/jsm/nodes/core/constants.js +27 -0
- package/examples/jsm/nodes/display/BlendModeNode.js +99 -0
- package/examples/jsm/nodes/display/BumpMapNode.js +77 -0
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +100 -0
- package/examples/jsm/nodes/display/ColorSpaceNode.js +108 -0
- package/examples/jsm/nodes/display/FrontFacingNode.js +27 -0
- package/examples/jsm/nodes/display/NormalMapNode.js +106 -0
- package/examples/jsm/nodes/display/PosterizeNode.js +32 -0
- package/examples/jsm/nodes/display/ToneMappingNode.js +141 -0
- package/examples/jsm/nodes/display/ViewportDepthNode.js +69 -0
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +34 -0
- package/examples/jsm/nodes/display/ViewportNode.js +115 -0
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +31 -0
- package/examples/jsm/nodes/display/ViewportTextureNode.js +75 -0
- package/examples/jsm/nodes/fog/FogExp2Node.js +35 -0
- package/examples/jsm/nodes/fog/FogNode.js +37 -0
- package/examples/jsm/nodes/fog/FogRangeNode.js +34 -0
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +40 -0
- package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +43 -0
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +29 -0
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +18 -0
- package/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +16 -0
- package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +13 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +20 -0
- package/examples/jsm/nodes/functions/PhongLightingModel.js +67 -0
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +343 -0
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +13 -0
- package/examples/jsm/nodes/functions/material/getRoughness.js +18 -0
- package/examples/jsm/nodes/geometry/RangeNode.js +104 -0
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +85 -0
- package/examples/jsm/nodes/lighting/AONode.js +27 -0
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +27 -0
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +184 -0
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +40 -0
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +191 -0
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +55 -0
- package/examples/jsm/nodes/lighting/IESSpotLightNode.js +39 -0
- package/examples/jsm/nodes/lighting/LightNode.js +57 -0
- package/examples/jsm/nodes/lighting/LightUtils.js +17 -0
- package/examples/jsm/nodes/lighting/LightingContextNode.js +102 -0
- package/examples/jsm/nodes/lighting/LightingNode.js +21 -0
- package/examples/jsm/nodes/lighting/LightsNode.js +128 -0
- package/examples/jsm/nodes/lighting/PointLightNode.js +68 -0
- package/examples/jsm/nodes/lighting/SpotLightNode.js +89 -0
- package/examples/jsm/nodes/loaders/NodeLoader.js +108 -0
- package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +59 -0
- package/examples/jsm/nodes/loaders/NodeObjectLoader.js +70 -0
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +28 -0
- package/examples/jsm/nodes/materials/Materials.js +12 -0
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +27 -0
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +34 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +40 -0
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +65 -0
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +128 -0
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +80 -0
- package/examples/jsm/nodes/materials/NodeMaterial.js +536 -0
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +49 -0
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +103 -0
- package/examples/jsm/nodes/materialx/DISCLAIMER.md +199 -0
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +68 -0
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +56 -0
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +618 -0
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +19 -0
- package/examples/jsm/nodes/math/CondNode.js +86 -0
- package/examples/jsm/nodes/math/MathNode.js +359 -0
- package/examples/jsm/nodes/math/OperatorNode.js +269 -0
- package/examples/jsm/nodes/parsers/GLSLNodeFunction.js +152 -0
- package/examples/jsm/nodes/parsers/GLSLNodeParser.js +14 -0
- package/examples/jsm/nodes/procedural/CheckerNode.js +42 -0
- package/examples/jsm/nodes/shadernode/ShaderNode.js +420 -0
- package/examples/jsm/nodes/utils/ArrayElementNode.js +33 -0
- package/examples/jsm/nodes/utils/ConvertNode.js +65 -0
- package/examples/jsm/nodes/utils/DiscardNode.js +26 -0
- package/examples/jsm/nodes/utils/EquirectUVNode.js +33 -0
- package/examples/jsm/nodes/utils/JoinNode.js +51 -0
- package/examples/jsm/nodes/utils/LoopNode.js +186 -0
- package/examples/jsm/nodes/utils/MatcapUVNode.js +30 -0
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +46 -0
- package/examples/jsm/nodes/utils/OscNode.js +81 -0
- package/examples/jsm/nodes/utils/PackingNode.js +55 -0
- package/examples/jsm/nodes/utils/RemapNode.js +42 -0
- package/examples/jsm/nodes/utils/RotateUVNode.js +43 -0
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +37 -0
- package/examples/jsm/nodes/utils/SplitNode.js +104 -0
- package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +41 -0
- package/examples/jsm/nodes/utils/TimerNode.js +94 -0
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +62 -0
- package/examples/jsm/objects/GroundProjectedSkybox.js +172 -0
- package/examples/jsm/objects/Lensflare.js +377 -0
- package/examples/jsm/objects/MarchingCubes.js +1176 -0
- package/examples/jsm/objects/Reflector.js +264 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +349 -0
- package/examples/jsm/objects/Refractor.js +324 -0
- package/examples/jsm/objects/ShadowMesh.js +80 -0
- package/examples/jsm/objects/Sky.js +219 -0
- package/examples/jsm/objects/Water.js +330 -0
- package/examples/jsm/objects/Water2.js +358 -0
- package/examples/jsm/offscreen/jank.js +45 -0
- package/examples/jsm/offscreen/offscreen.js +8 -0
- package/examples/jsm/offscreen/scene.js +86 -0
- package/examples/jsm/physics/AmmoPhysics.js +285 -0
- package/examples/jsm/physics/RapierPhysics.js +199 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +104 -0
- package/examples/jsm/postprocessing/BloomPass.js +172 -0
- package/examples/jsm/postprocessing/BokehPass.js +140 -0
- package/examples/jsm/postprocessing/ClearPass.js +46 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +85 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +65 -0
- package/examples/jsm/postprocessing/EffectComposer.js +231 -0
- package/examples/jsm/postprocessing/FilmPass.js +66 -0
- package/examples/jsm/postprocessing/GlitchPass.js +128 -0
- package/examples/jsm/postprocessing/HalftonePass.js +79 -0
- package/examples/jsm/postprocessing/LUTPass.js +173 -0
- package/examples/jsm/postprocessing/MaskPass.js +104 -0
- package/examples/jsm/postprocessing/OutlinePass.js +654 -0
- package/examples/jsm/postprocessing/OutputPass.js +91 -0
- package/examples/jsm/postprocessing/Pass.js +84 -0
- package/examples/jsm/postprocessing/RenderPass.js +81 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +235 -0
- package/examples/jsm/postprocessing/SAOPass.js +411 -0
- package/examples/jsm/postprocessing/SMAAPass.js +201 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +228 -0
- package/examples/jsm/postprocessing/SSAOPass.js +440 -0
- package/examples/jsm/postprocessing/SSRPass.js +641 -0
- package/examples/jsm/postprocessing/SavePass.js +79 -0
- package/examples/jsm/postprocessing/ShaderPass.js +77 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +189 -0
- package/examples/jsm/postprocessing/TexturePass.js +67 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +415 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +215 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +335 -0
- package/examples/jsm/renderers/Projector.js +918 -0
- package/examples/jsm/renderers/SVGRenderer.js +553 -0
- package/examples/jsm/renderers/common/Animation.js +58 -0
- package/examples/jsm/renderers/common/Attributes.js +75 -0
- package/examples/jsm/renderers/common/Backend.js +162 -0
- package/examples/jsm/renderers/common/Background.js +136 -0
- package/examples/jsm/renderers/common/Binding.js +19 -0
- package/examples/jsm/renderers/common/Bindings.js +165 -0
- package/examples/jsm/renderers/common/Buffer.js +38 -0
- package/examples/jsm/renderers/common/BufferUtils.js +33 -0
- package/examples/jsm/renderers/common/ChainMap.js +89 -0
- package/examples/jsm/renderers/common/ComputePipeline.js +17 -0
- package/examples/jsm/renderers/common/Constants.js +14 -0
- package/examples/jsm/renderers/common/CubeRenderTarget.js +65 -0
- package/examples/jsm/renderers/common/DataMap.js +54 -0
- package/examples/jsm/renderers/common/Geometries.js +215 -0
- package/examples/jsm/renderers/common/Info.js +73 -0
- package/examples/jsm/renderers/common/Pipeline.js +13 -0
- package/examples/jsm/renderers/common/Pipelines.js +370 -0
- package/examples/jsm/renderers/common/ProgrammableStage.js +18 -0
- package/examples/jsm/renderers/common/RenderContext.js +38 -0
- package/examples/jsm/renderers/common/RenderContexts.js +49 -0
- package/examples/jsm/renderers/common/RenderList.js +178 -0
- package/examples/jsm/renderers/common/RenderLists.js +38 -0
- package/examples/jsm/renderers/common/RenderObject.js +129 -0
- package/examples/jsm/renderers/common/RenderObjects.js +95 -0
- package/examples/jsm/renderers/common/RenderPipeline.js +16 -0
- package/examples/jsm/renderers/common/Renderer.js +895 -0
- package/examples/jsm/renderers/common/SampledTexture.js +80 -0
- package/examples/jsm/renderers/common/Sampler.js +18 -0
- package/examples/jsm/renderers/common/StorageBuffer.js +17 -0
- package/examples/jsm/renderers/common/Textures.js +218 -0
- package/examples/jsm/renderers/common/Uniform.js +140 -0
- package/examples/jsm/renderers/common/UniformBuffer.js +15 -0
- package/examples/jsm/renderers/common/UniformsGroup.js +299 -0
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +39 -0
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +21 -0
- package/examples/jsm/renderers/common/nodes/NodeUniform.js +135 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +330 -0
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +340 -0
- package/examples/jsm/renderers/webgl/nodes/SlotNode.js +26 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +764 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +49 -0
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +844 -0
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +32 -0
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +902 -0
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +104 -0
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeParser.js +14 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +274 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +223 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +324 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +533 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureMipmapUtils.js +163 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +964 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +92 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +87 -0
- package/examples/jsm/shaders/AfterimageShader.js +56 -0
- package/examples/jsm/shaders/BasicShader.js +27 -0
- package/examples/jsm/shaders/BleachBypassShader.js +62 -0
- package/examples/jsm/shaders/BlendShader.js +47 -0
- package/examples/jsm/shaders/BokehShader.js +143 -0
- package/examples/jsm/shaders/BokehShader2.js +393 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +54 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +50 -0
- package/examples/jsm/shaders/ColorifyShader.js +51 -0
- package/examples/jsm/shaders/ConvolutionShader.js +103 -0
- package/examples/jsm/shaders/CopyShader.js +45 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +54 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +166 -0
- package/examples/jsm/shaders/DigitalGlitch.js +101 -0
- package/examples/jsm/shaders/DotScreenShader.js +70 -0
- package/examples/jsm/shaders/ExposureShader.js +44 -0
- package/examples/jsm/shaders/FXAAShader.js +286 -0
- package/examples/jsm/shaders/FilmShader.js +102 -0
- package/examples/jsm/shaders/FocusShader.js +87 -0
- package/examples/jsm/shaders/FreiChenShader.js +94 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +43 -0
- package/examples/jsm/shaders/GodRaysShader.js +313 -0
- package/examples/jsm/shaders/HalftoneShader.js +310 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +59 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +61 -0
- package/examples/jsm/shaders/HueSaturationShader.js +65 -0
- package/examples/jsm/shaders/KaleidoShader.js +56 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +64 -0
- package/examples/jsm/shaders/LuminosityShader.js +46 -0
- package/examples/jsm/shaders/MMDToonShader.js +132 -0
- package/examples/jsm/shaders/MirrorShader.js +54 -0
- package/examples/jsm/shaders/NormalMapShader.js +53 -0
- package/examples/jsm/shaders/OutputShader.js +78 -0
- package/examples/jsm/shaders/RGBShiftShader.js +54 -0
- package/examples/jsm/shaders/SAOShader.js +188 -0
- package/examples/jsm/shaders/SMAAShader.js +460 -0
- package/examples/jsm/shaders/SSAOShader.js +288 -0
- package/examples/jsm/shaders/SSRShader.js +364 -0
- package/examples/jsm/shaders/SepiaShader.js +52 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +90 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +88 -0
- package/examples/jsm/shaders/TechnicolorShader.js +43 -0
- package/examples/jsm/shaders/ToonShader.js +326 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +72 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +45 -0
- package/examples/jsm/shaders/VelocityShader.js +128 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +59 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +61 -0
- package/examples/jsm/shaders/VignetteShader.js +51 -0
- package/examples/jsm/shaders/VolumeShader.js +289 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +93 -0
- package/examples/jsm/textures/FlakesTexture.js +40 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +1373 -0
- package/examples/jsm/utils/CameraUtils.js +73 -0
- package/examples/jsm/utils/GPUStatsPanel.js +128 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +639 -0
- package/examples/jsm/utils/GeometryUtils.js +221 -0
- package/examples/jsm/utils/LDrawUtils.js +202 -0
- package/examples/jsm/utils/PackedPhongMaterial.js +178 -0
- package/examples/jsm/utils/SceneUtils.js +254 -0
- package/examples/jsm/utils/ShadowMapViewer.js +210 -0
- package/examples/jsm/utils/SkeletonUtils.js +413 -0
- package/examples/jsm/utils/TextureUtils.js +86 -0
- package/examples/jsm/utils/UVsDebug.js +165 -0
- package/examples/jsm/utils/WorkerPool.js +102 -0
- package/examples/jsm/webxr/ARButton.js +208 -0
- package/examples/jsm/webxr/OculusHandModel.js +109 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +413 -0
- package/examples/jsm/webxr/Text2D.js +38 -0
- package/examples/jsm/webxr/VRButton.js +200 -0
- package/examples/jsm/webxr/XRButton.js +198 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +299 -0
- package/examples/jsm/webxr/XREstimatedLight.js +223 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +112 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +105 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +103 -0
- package/examples/jsm/webxr/XRPlanes.js +100 -0
- package/lib/3d.min.js +1 -0
- package/package.json +25 -12
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Object3DNode from './Object3DNode.js';
|
|
2
|
+
import { addNodeClass } from '../core/Node.js';
|
|
3
|
+
import { label } from '../core/ContextNode.js';
|
|
4
|
+
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
5
|
+
|
|
6
|
+
class CameraNode extends Object3DNode {
|
|
7
|
+
|
|
8
|
+
constructor( scope = CameraNode.POSITION ) {
|
|
9
|
+
|
|
10
|
+
super( scope );
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getNodeType( builder ) {
|
|
15
|
+
|
|
16
|
+
const scope = this.scope;
|
|
17
|
+
|
|
18
|
+
if ( scope === CameraNode.PROJECTION_MATRIX ) {
|
|
19
|
+
|
|
20
|
+
return 'mat4';
|
|
21
|
+
|
|
22
|
+
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR ) {
|
|
23
|
+
|
|
24
|
+
return 'float';
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return super.getNodeType( builder );
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
update( frame ) {
|
|
33
|
+
|
|
34
|
+
const camera = frame.camera;
|
|
35
|
+
const uniformNode = this._uniformNode;
|
|
36
|
+
const scope = this.scope;
|
|
37
|
+
|
|
38
|
+
if ( scope === CameraNode.VIEW_MATRIX ) {
|
|
39
|
+
|
|
40
|
+
uniformNode.value = camera.matrixWorldInverse;
|
|
41
|
+
|
|
42
|
+
} else if ( scope === CameraNode.PROJECTION_MATRIX ) {
|
|
43
|
+
|
|
44
|
+
uniformNode.value = camera.projectionMatrix;
|
|
45
|
+
|
|
46
|
+
} else if ( scope === CameraNode.NEAR ) {
|
|
47
|
+
|
|
48
|
+
uniformNode.value = camera.near;
|
|
49
|
+
|
|
50
|
+
} else if ( scope === CameraNode.FAR ) {
|
|
51
|
+
|
|
52
|
+
uniformNode.value = camera.far;
|
|
53
|
+
|
|
54
|
+
} else {
|
|
55
|
+
|
|
56
|
+
this.object3d = camera;
|
|
57
|
+
|
|
58
|
+
super.update( frame );
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
generate( builder ) {
|
|
65
|
+
|
|
66
|
+
const scope = this.scope;
|
|
67
|
+
|
|
68
|
+
if ( scope === CameraNode.PROJECTION_MATRIX ) {
|
|
69
|
+
|
|
70
|
+
this._uniformNode.nodeType = 'mat4';
|
|
71
|
+
|
|
72
|
+
} else if ( scope === CameraNode.NEAR || scope === CameraNode.FAR ) {
|
|
73
|
+
|
|
74
|
+
this._uniformNode.nodeType = 'float';
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return super.generate( builder );
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
CameraNode.PROJECTION_MATRIX = 'projectionMatrix';
|
|
85
|
+
CameraNode.NEAR = 'near';
|
|
86
|
+
CameraNode.FAR = 'far';
|
|
87
|
+
|
|
88
|
+
export default CameraNode;
|
|
89
|
+
|
|
90
|
+
export const cameraProjectionMatrix = label( nodeImmutable( CameraNode, CameraNode.PROJECTION_MATRIX ), 'projectionMatrix' );
|
|
91
|
+
export const cameraNear = nodeImmutable( CameraNode, CameraNode.NEAR );
|
|
92
|
+
export const cameraFar = nodeImmutable( CameraNode, CameraNode.FAR );
|
|
93
|
+
export const cameraViewMatrix = nodeImmutable( CameraNode, CameraNode.VIEW_MATRIX );
|
|
94
|
+
export const cameraNormalMatrix = nodeImmutable( CameraNode, CameraNode.NORMAL_MATRIX );
|
|
95
|
+
export const cameraWorldMatrix = nodeImmutable( CameraNode, CameraNode.WORLD_MATRIX );
|
|
96
|
+
export const cameraPosition = nodeImmutable( CameraNode, CameraNode.POSITION );
|
|
97
|
+
|
|
98
|
+
addNodeClass( CameraNode );
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import TextureNode from './TextureNode.js';
|
|
2
|
+
import UniformNode from '../core/UniformNode.js';
|
|
3
|
+
import { reflectVector } from './ReflectVectorNode.js';
|
|
4
|
+
import { addNodeClass } from '../core/Node.js';
|
|
5
|
+
import { addNodeElement, nodeProxy, vec3 } from '../shadernode/ShaderNode.js';
|
|
6
|
+
|
|
7
|
+
class CubeTextureNode extends TextureNode {
|
|
8
|
+
|
|
9
|
+
constructor( value, uvNode = null, levelNode = null ) {
|
|
10
|
+
|
|
11
|
+
super( value, uvNode, levelNode );
|
|
12
|
+
|
|
13
|
+
this.isCubeTextureNode = true;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getInputType( /*builder*/ ) {
|
|
18
|
+
|
|
19
|
+
return 'cubeTexture';
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getDefaultUV() {
|
|
24
|
+
|
|
25
|
+
return reflectVector;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
setUpdateMatrix( /*updateMatrix*/ ) { } // Ignore .updateMatrix for CubeTextureNode
|
|
30
|
+
|
|
31
|
+
generate( builder, output ) {
|
|
32
|
+
|
|
33
|
+
const { uvNode, levelNode } = builder.getNodeProperties( this );
|
|
34
|
+
|
|
35
|
+
const texture = this.value;
|
|
36
|
+
|
|
37
|
+
if ( ! texture || texture.isCubeTexture !== true ) {
|
|
38
|
+
|
|
39
|
+
throw new Error( 'CubeTextureNode: Need a three.js cube texture.' );
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const textureProperty = UniformNode.prototype.generate.call( this, builder, 'cubeTexture' );
|
|
44
|
+
|
|
45
|
+
if ( output === 'sampler' ) {
|
|
46
|
+
|
|
47
|
+
return textureProperty + '_sampler';
|
|
48
|
+
|
|
49
|
+
} else if ( builder.isReference( output ) ) {
|
|
50
|
+
|
|
51
|
+
return textureProperty;
|
|
52
|
+
|
|
53
|
+
} else {
|
|
54
|
+
|
|
55
|
+
const nodeData = builder.getDataFromNode( this );
|
|
56
|
+
|
|
57
|
+
let propertyName = nodeData.propertyName;
|
|
58
|
+
|
|
59
|
+
if ( propertyName === undefined ) {
|
|
60
|
+
|
|
61
|
+
const cubeUV = vec3( uvNode.x.negate(), uvNode.yz );
|
|
62
|
+
const uvSnippet = cubeUV.build( builder, 'vec3' );
|
|
63
|
+
|
|
64
|
+
const nodeVar = builder.getVarFromNode( this, 'vec4' );
|
|
65
|
+
|
|
66
|
+
propertyName = builder.getPropertyName( nodeVar );
|
|
67
|
+
|
|
68
|
+
let snippet = null;
|
|
69
|
+
|
|
70
|
+
if ( levelNode && levelNode.isNode === true ) {
|
|
71
|
+
|
|
72
|
+
const levelSnippet = levelNode.build( builder, 'float' );
|
|
73
|
+
|
|
74
|
+
snippet = builder.getTextureLevel( this, textureProperty, uvSnippet, levelSnippet );
|
|
75
|
+
|
|
76
|
+
} else {
|
|
77
|
+
|
|
78
|
+
snippet = builder.getTexture( this, textureProperty, uvSnippet );
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
builder.addLineFlowCode( `${propertyName} = ${snippet}` );
|
|
83
|
+
|
|
84
|
+
nodeData.snippet = snippet;
|
|
85
|
+
nodeData.propertyName = propertyName;
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return builder.format( propertyName, 'vec4', output );
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default CubeTextureNode;
|
|
98
|
+
|
|
99
|
+
export const cubeTexture = nodeProxy( CubeTextureNode );
|
|
100
|
+
|
|
101
|
+
addNodeElement( 'cubeTexture', cubeTexture );
|
|
102
|
+
|
|
103
|
+
addNodeClass( CubeTextureNode );
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// @TODO: Is this needed? Can it be moved in MaterialNode?
|
|
2
|
+
|
|
3
|
+
import MaterialNode from './MaterialNode.js';
|
|
4
|
+
import { materialReference } from './MaterialReferenceNode.js';
|
|
5
|
+
import { normalView } from './NormalNode.js';
|
|
6
|
+
import { normalMap } from '../display/NormalMapNode.js';
|
|
7
|
+
import { bumpMap } from '../display/BumpMapNode.js';
|
|
8
|
+
import { addNodeClass } from '../core/Node.js';
|
|
9
|
+
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
10
|
+
|
|
11
|
+
class ExtendedMaterialNode extends MaterialNode {
|
|
12
|
+
|
|
13
|
+
constructor( scope ) {
|
|
14
|
+
|
|
15
|
+
super( scope );
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getNodeType( builder ) {
|
|
20
|
+
|
|
21
|
+
const scope = this.scope;
|
|
22
|
+
let type = null;
|
|
23
|
+
|
|
24
|
+
if ( scope === ExtendedMaterialNode.NORMAL || scope === ExtendedMaterialNode.CLEARCOAT_NORMAL ) {
|
|
25
|
+
|
|
26
|
+
type = 'vec3';
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return type || super.getNodeType( builder );
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
construct( builder ) {
|
|
35
|
+
|
|
36
|
+
const material = builder.material;
|
|
37
|
+
const scope = this.scope;
|
|
38
|
+
|
|
39
|
+
let node = null;
|
|
40
|
+
|
|
41
|
+
if ( scope === ExtendedMaterialNode.NORMAL ) {
|
|
42
|
+
|
|
43
|
+
if ( material.normalMap ) {
|
|
44
|
+
|
|
45
|
+
node = normalMap( this.getTexture( 'normalMap' ), materialReference( 'normalScale', 'vec2' ) );
|
|
46
|
+
|
|
47
|
+
} else if ( material.bumpMap ) {
|
|
48
|
+
|
|
49
|
+
node = bumpMap( material.bumpMap, materialReference( 'bumpScale', 'float' ) );
|
|
50
|
+
|
|
51
|
+
} else {
|
|
52
|
+
|
|
53
|
+
node = normalView;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
} else if ( scope === ExtendedMaterialNode.CLEARCOAT_NORMAL ) {
|
|
58
|
+
|
|
59
|
+
node = material.clearcoatNormalMap ? normalMap( this.getTexture( 'clearcoatNormalMap' ), materialReference( 'clearcoatNormalScale', 'vec2' ) ) : normalView;
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return node || super.construct( builder );
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
ExtendedMaterialNode.NORMAL = 'normal';
|
|
70
|
+
ExtendedMaterialNode.CLEARCOAT_NORMAL = 'clearcoatNormal';
|
|
71
|
+
|
|
72
|
+
export default ExtendedMaterialNode;
|
|
73
|
+
|
|
74
|
+
export const materialNormal = nodeImmutable( ExtendedMaterialNode, ExtendedMaterialNode.NORMAL );
|
|
75
|
+
export const materialClearcoatNormal = nodeImmutable( ExtendedMaterialNode, ExtendedMaterialNode.CLEARCOAT_NORMAL );
|
|
76
|
+
|
|
77
|
+
addNodeClass( ExtendedMaterialNode );
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
|
+
import { instancedBufferAttribute, instancedDynamicBufferAttribute } from './BufferAttributeNode.js';
|
|
3
|
+
import { normalLocal } from './NormalNode.js';
|
|
4
|
+
import { positionLocal } from './PositionNode.js';
|
|
5
|
+
import { nodeProxy, vec3, mat3, mat4 } from '../shadernode/ShaderNode.js';
|
|
6
|
+
import { DynamicDrawUsage, InstancedInterleavedBuffer } from 'three';
|
|
7
|
+
|
|
8
|
+
class InstanceNode extends Node {
|
|
9
|
+
|
|
10
|
+
constructor( instanceMesh ) {
|
|
11
|
+
|
|
12
|
+
super( 'void' );
|
|
13
|
+
|
|
14
|
+
this.instanceMesh = instanceMesh;
|
|
15
|
+
|
|
16
|
+
this.instanceMatrixNode = null;
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
construct( builder ) {
|
|
21
|
+
|
|
22
|
+
let instanceMatrixNode = this.instanceMatrixNode;
|
|
23
|
+
|
|
24
|
+
if ( instanceMatrixNode === null ) {
|
|
25
|
+
|
|
26
|
+
const instanceMesh = this.instanceMesh;
|
|
27
|
+
const instanceAttribute = instanceMesh.instanceMatrix;
|
|
28
|
+
const buffer = new InstancedInterleavedBuffer( instanceAttribute.array, 16, 1 );
|
|
29
|
+
|
|
30
|
+
const bufferFn = instanceAttribute.usage === DynamicDrawUsage ? instancedDynamicBufferAttribute : instancedBufferAttribute;
|
|
31
|
+
|
|
32
|
+
const instanceBuffers = [
|
|
33
|
+
// F.Signature -> bufferAttribute( array, type, stride, offset )
|
|
34
|
+
bufferFn( buffer, 'vec4', 16, 0 ),
|
|
35
|
+
bufferFn( buffer, 'vec4', 16, 4 ),
|
|
36
|
+
bufferFn( buffer, 'vec4', 16, 8 ),
|
|
37
|
+
bufferFn( buffer, 'vec4', 16, 12 )
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
instanceMatrixNode = mat4( ...instanceBuffers );
|
|
41
|
+
|
|
42
|
+
this.instanceMatrixNode = instanceMatrixNode;
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// POSITION
|
|
47
|
+
|
|
48
|
+
const instancePosition = instanceMatrixNode.mul( positionLocal ).xyz;
|
|
49
|
+
|
|
50
|
+
// NORMAL
|
|
51
|
+
|
|
52
|
+
const m = mat3( instanceMatrixNode[ 0 ].xyz, instanceMatrixNode[ 1 ].xyz, instanceMatrixNode[ 2 ].xyz );
|
|
53
|
+
|
|
54
|
+
const transformedNormal = normalLocal.div( vec3( m[ 0 ].dot( m[ 0 ] ), m[ 1 ].dot( m[ 1 ] ), m[ 2 ].dot( m[ 2 ] ) ) );
|
|
55
|
+
|
|
56
|
+
const instanceNormal = m.mul( transformedNormal ).xyz;
|
|
57
|
+
|
|
58
|
+
// ASSIGNS
|
|
59
|
+
|
|
60
|
+
builder.stack.assign( positionLocal, instancePosition );
|
|
61
|
+
builder.stack.assign( normalLocal, instanceNormal );
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default InstanceNode;
|
|
68
|
+
|
|
69
|
+
export const instance = nodeProxy( InstanceNode );
|
|
70
|
+
|
|
71
|
+
addNodeClass( InstanceNode );
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import Node, { addNodeClass } from '../core/Node.js';
|
|
2
|
+
import { reference } from './ReferenceNode.js';
|
|
3
|
+
import { materialReference } from './MaterialReferenceNode.js';
|
|
4
|
+
import { nodeImmutable, float } from '../shadernode/ShaderNode.js';
|
|
5
|
+
|
|
6
|
+
class MaterialNode extends Node {
|
|
7
|
+
|
|
8
|
+
constructor( scope ) {
|
|
9
|
+
|
|
10
|
+
super();
|
|
11
|
+
|
|
12
|
+
this.scope = scope;
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getFloat( property ) {
|
|
17
|
+
|
|
18
|
+
//@TODO: Check if it can be cached by property name.
|
|
19
|
+
|
|
20
|
+
return materialReference( property, 'float' );
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getColor( property ) {
|
|
25
|
+
|
|
26
|
+
//@TODO: Check if it can be cached by property name.
|
|
27
|
+
|
|
28
|
+
return materialReference( property, 'color' );
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getTexture( property ) {
|
|
33
|
+
|
|
34
|
+
//@TODO: Check if it can be cached by property name.
|
|
35
|
+
|
|
36
|
+
const textureRefNode = materialReference( property, 'texture' );
|
|
37
|
+
|
|
38
|
+
return textureRefNode;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
construct( builder ) {
|
|
43
|
+
|
|
44
|
+
const material = builder.context.material;
|
|
45
|
+
const scope = this.scope;
|
|
46
|
+
|
|
47
|
+
let node = null;
|
|
48
|
+
|
|
49
|
+
if ( scope === MaterialNode.ALPHA_TEST || scope === MaterialNode.SHININESS || scope === MaterialNode.REFLECTIVITY || scope === MaterialNode.ROTATION || scope === MaterialNode.IRIDESCENCE || scope === MaterialNode.IRIDESCENCE_IOR ) {
|
|
50
|
+
|
|
51
|
+
node = this.getFloat( scope );
|
|
52
|
+
|
|
53
|
+
} else if ( scope === MaterialNode.SPECULAR_COLOR ) {
|
|
54
|
+
|
|
55
|
+
node = this.getColor( 'specular' );
|
|
56
|
+
|
|
57
|
+
} else if ( scope === MaterialNode.COLOR ) {
|
|
58
|
+
|
|
59
|
+
const colorNode = this.getColor( 'color' );
|
|
60
|
+
|
|
61
|
+
if ( material.map && material.map.isTexture === true ) {
|
|
62
|
+
|
|
63
|
+
node = colorNode.mul( this.getTexture( 'map' ) );
|
|
64
|
+
|
|
65
|
+
} else {
|
|
66
|
+
|
|
67
|
+
node = colorNode;
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
} else if ( scope === MaterialNode.OPACITY ) {
|
|
72
|
+
|
|
73
|
+
const opacityNode = this.getFloat( 'opacity' );
|
|
74
|
+
|
|
75
|
+
if ( material.alphaMap && material.alphaMap.isTexture === true ) {
|
|
76
|
+
|
|
77
|
+
node = opacityNode.mul( this.getTexture( 'alphaMap' ) );
|
|
78
|
+
|
|
79
|
+
} else {
|
|
80
|
+
|
|
81
|
+
node = opacityNode;
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
} else if ( scope === MaterialNode.SPECULAR_STRENGTH ) {
|
|
86
|
+
|
|
87
|
+
if ( material.specularMap && material.specularMap.isTexture === true ) {
|
|
88
|
+
|
|
89
|
+
node = this.getTexture( 'specularMap' ).r;
|
|
90
|
+
|
|
91
|
+
} else {
|
|
92
|
+
|
|
93
|
+
node = float( 1 );
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
} else if ( scope === MaterialNode.ROUGHNESS ) {
|
|
98
|
+
|
|
99
|
+
const roughnessNode = this.getFloat( 'roughness' );
|
|
100
|
+
|
|
101
|
+
if ( material.roughnessMap && material.roughnessMap.isTexture === true ) {
|
|
102
|
+
|
|
103
|
+
node = roughnessNode.mul( this.getTexture( 'roughnessMap' ).g );
|
|
104
|
+
|
|
105
|
+
} else {
|
|
106
|
+
|
|
107
|
+
node = roughnessNode;
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
} else if ( scope === MaterialNode.METALNESS ) {
|
|
112
|
+
|
|
113
|
+
const metalnessNode = this.getFloat( 'metalness' );
|
|
114
|
+
|
|
115
|
+
if ( material.metalnessMap && material.metalnessMap.isTexture === true ) {
|
|
116
|
+
|
|
117
|
+
node = metalnessNode.mul( this.getTexture( 'metalnessMap' ).b );
|
|
118
|
+
|
|
119
|
+
} else {
|
|
120
|
+
|
|
121
|
+
node = metalnessNode;
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
} else if ( scope === MaterialNode.EMISSIVE ) {
|
|
126
|
+
|
|
127
|
+
const emissiveNode = this.getColor( 'emissive' );
|
|
128
|
+
|
|
129
|
+
if ( material.emissiveMap && material.emissiveMap.isTexture === true ) {
|
|
130
|
+
|
|
131
|
+
node = emissiveNode.mul( this.getTexture( 'emissiveMap' ) );
|
|
132
|
+
|
|
133
|
+
} else {
|
|
134
|
+
|
|
135
|
+
node = emissiveNode;
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
} else if ( scope === MaterialNode.CLEARCOAT ) {
|
|
140
|
+
|
|
141
|
+
const clearcoatNode = this.getFloat( 'clearcoat' );
|
|
142
|
+
|
|
143
|
+
if ( material.clearcoatMap && material.clearcoatMap.isTexture === true ) {
|
|
144
|
+
|
|
145
|
+
node = clearcoatNode.mul( this.getTexture( 'clearcoatMap' ).r );
|
|
146
|
+
|
|
147
|
+
} else {
|
|
148
|
+
|
|
149
|
+
node = clearcoatNode;
|
|
150
|
+
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
} else if ( scope === MaterialNode.CLEARCOAT_ROUGHNESS ) {
|
|
154
|
+
|
|
155
|
+
const clearcoatRoughnessNode = this.getFloat( 'clearcoatRoughness' );
|
|
156
|
+
|
|
157
|
+
if ( material.clearcoatRoughnessMap && material.clearcoatRoughnessMap.isTexture === true ) {
|
|
158
|
+
|
|
159
|
+
node = clearcoatRoughnessNode.mul( this.getTexture( 'clearcoatRoughnessMap' ).r );
|
|
160
|
+
|
|
161
|
+
} else {
|
|
162
|
+
|
|
163
|
+
node = clearcoatRoughnessNode;
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
} else if ( scope === MaterialNode.SHEEN ) {
|
|
168
|
+
|
|
169
|
+
const sheenNode = this.getColor( 'sheenColor' ).mul( this.getFloat( 'sheen' ) ); // Move this mul() to CPU
|
|
170
|
+
|
|
171
|
+
if ( material.sheenColorMap && material.sheenColorMap.isTexture === true ) {
|
|
172
|
+
|
|
173
|
+
node = sheenNode.mul( this.getTexture( 'sheenColorMap' ).rgb );
|
|
174
|
+
|
|
175
|
+
} else {
|
|
176
|
+
|
|
177
|
+
node = sheenNode;
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
} else if ( scope === MaterialNode.SHEEN_ROUGHNESS ) {
|
|
182
|
+
|
|
183
|
+
const sheenRoughnessNode = this.getFloat( 'sheenRoughness' );
|
|
184
|
+
|
|
185
|
+
if ( material.sheenRoughnessMap && material.sheenRoughnessMap.isTexture === true ) {
|
|
186
|
+
|
|
187
|
+
node = sheenRoughnessNode.mul( this.getTexture( 'sheenRoughnessMap' ).a );
|
|
188
|
+
|
|
189
|
+
} else {
|
|
190
|
+
|
|
191
|
+
node = sheenRoughnessNode;
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
node = node.clamp( 0.07, 1.0 );
|
|
196
|
+
|
|
197
|
+
} else if ( scope === MaterialNode.IRIDESCENCE_THICKNESS ) {
|
|
198
|
+
|
|
199
|
+
const iridescenceThicknessMaximum = reference( 1, 'float', material.iridescenceThicknessRange );
|
|
200
|
+
|
|
201
|
+
if ( material.iridescenceThicknessMap ) {
|
|
202
|
+
|
|
203
|
+
const iridescenceThicknessMinimum = reference( 0, 'float', material.iridescenceThicknessRange );
|
|
204
|
+
|
|
205
|
+
node = iridescenceThicknessMaximum.sub( iridescenceThicknessMinimum ).mul( this.getTexture( 'iridescenceThicknessMap' ).g ).add( iridescenceThicknessMinimum );
|
|
206
|
+
|
|
207
|
+
} else {
|
|
208
|
+
|
|
209
|
+
node = iridescenceThicknessMaximum;
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
} else {
|
|
214
|
+
|
|
215
|
+
const outputType = this.getNodeType( builder );
|
|
216
|
+
|
|
217
|
+
node = materialReference( scope, outputType );
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return node;
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
MaterialNode.ALPHA_TEST = 'alphaTest';
|
|
228
|
+
MaterialNode.COLOR = 'color';
|
|
229
|
+
MaterialNode.OPACITY = 'opacity';
|
|
230
|
+
MaterialNode.SHININESS = 'shininess';
|
|
231
|
+
MaterialNode.SPECULAR = 'specular';
|
|
232
|
+
MaterialNode.SPECULAR_STRENGTH = 'specularStrength';
|
|
233
|
+
MaterialNode.REFLECTIVITY = 'reflectivity';
|
|
234
|
+
MaterialNode.ROUGHNESS = 'roughness';
|
|
235
|
+
MaterialNode.METALNESS = 'metalness';
|
|
236
|
+
MaterialNode.CLEARCOAT = 'clearcoat';
|
|
237
|
+
MaterialNode.CLEARCOAT_ROUGHNESS = 'clearcoatRoughness';
|
|
238
|
+
MaterialNode.EMISSIVE = 'emissive';
|
|
239
|
+
MaterialNode.ROTATION = 'rotation';
|
|
240
|
+
MaterialNode.SHEEN = 'sheen';
|
|
241
|
+
MaterialNode.SHEEN_ROUGHNESS = 'sheenRoughness';
|
|
242
|
+
MaterialNode.IRIDESCENCE = 'iridescence';
|
|
243
|
+
MaterialNode.IRIDESCENCE_IOR = 'iridescenceIOR';
|
|
244
|
+
MaterialNode.IRIDESCENCE_THICKNESS = 'iridescenceThickness';
|
|
245
|
+
|
|
246
|
+
export default MaterialNode;
|
|
247
|
+
|
|
248
|
+
export const materialAlphaTest = nodeImmutable( MaterialNode, MaterialNode.ALPHA_TEST );
|
|
249
|
+
export const materialColor = nodeImmutable( MaterialNode, MaterialNode.COLOR );
|
|
250
|
+
export const materialShininess = nodeImmutable( MaterialNode, MaterialNode.SHININESS );
|
|
251
|
+
export const materialEmissive = nodeImmutable( MaterialNode, MaterialNode.EMISSIVE );
|
|
252
|
+
export const materialOpacity = nodeImmutable( MaterialNode, MaterialNode.OPACITY );
|
|
253
|
+
export const materialSpecularColor = nodeImmutable( MaterialNode, MaterialNode.SPECULAR_COLOR );
|
|
254
|
+
export const materialSpecularStrength = nodeImmutable( MaterialNode, MaterialNode.SPECULAR_STRENGTH );
|
|
255
|
+
export const materialReflectivity = nodeImmutable( MaterialNode, MaterialNode.REFLECTIVITY );
|
|
256
|
+
export const materialRoughness = nodeImmutable( MaterialNode, MaterialNode.ROUGHNESS );
|
|
257
|
+
export const materialMetalness = nodeImmutable( MaterialNode, MaterialNode.METALNESS );
|
|
258
|
+
export const materialClearcoat = nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT );
|
|
259
|
+
export const materialClearcoatRoughness = nodeImmutable( MaterialNode, MaterialNode.CLEARCOAT_ROUGHNESS );
|
|
260
|
+
export const materialRotation = nodeImmutable( MaterialNode, MaterialNode.ROTATION );
|
|
261
|
+
export const materialSheen = nodeImmutable( MaterialNode, MaterialNode.SHEEN );
|
|
262
|
+
export const materialSheenRoughness = nodeImmutable( MaterialNode, MaterialNode.SHEEN_ROUGHNESS );
|
|
263
|
+
export const materialIridescence = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE );
|
|
264
|
+
export const materialIridescenceIOR = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_IOR );
|
|
265
|
+
export const materialIridescenceThickness = nodeImmutable( MaterialNode, MaterialNode.IRIDESCENCE_THICKNESS );
|
|
266
|
+
|
|
267
|
+
addNodeClass( MaterialNode );
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import ReferenceNode from './ReferenceNode.js';
|
|
2
|
+
import { addNodeClass } from '../core/Node.js';
|
|
3
|
+
import { nodeObject } from '../shadernode/ShaderNode.js';
|
|
4
|
+
|
|
5
|
+
class MaterialReferenceNode extends ReferenceNode {
|
|
6
|
+
|
|
7
|
+
constructor( property, inputType, material = null ) {
|
|
8
|
+
|
|
9
|
+
super( property, inputType, material );
|
|
10
|
+
|
|
11
|
+
this.material = material;
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
construct( builder ) {
|
|
16
|
+
|
|
17
|
+
const material = this.material !== null ? this.material : builder.material;
|
|
18
|
+
|
|
19
|
+
this.node.value = material[ this.property ];
|
|
20
|
+
|
|
21
|
+
return super.construct( builder );
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
update( frame ) {
|
|
26
|
+
|
|
27
|
+
this.object = this.material !== null ? this.material : frame.material;
|
|
28
|
+
|
|
29
|
+
super.update( frame );
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default MaterialReferenceNode;
|
|
36
|
+
|
|
37
|
+
export const materialReference = ( name, type, material ) => nodeObject( new MaterialReferenceNode( name, type, material ) );
|
|
38
|
+
|
|
39
|
+
addNodeClass( MaterialReferenceNode );
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Object3DNode from './Object3DNode.js';
|
|
2
|
+
import { addNodeClass } from '../core/Node.js';
|
|
3
|
+
import { label } from '../core/ContextNode.js';
|
|
4
|
+
import { nodeImmutable } from '../shadernode/ShaderNode.js';
|
|
5
|
+
|
|
6
|
+
class ModelNode extends Object3DNode {
|
|
7
|
+
|
|
8
|
+
constructor( scope = ModelNode.VIEW_MATRIX ) {
|
|
9
|
+
|
|
10
|
+
super( scope );
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
update( frame ) {
|
|
15
|
+
|
|
16
|
+
this.object3d = frame.object;
|
|
17
|
+
|
|
18
|
+
super.update( frame );
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default ModelNode;
|
|
25
|
+
|
|
26
|
+
export const modelDirection = nodeImmutable( ModelNode, ModelNode.DIRECTION );
|
|
27
|
+
export const modelViewMatrix = label( nodeImmutable( ModelNode, ModelNode.VIEW_MATRIX ), 'modelViewMatrix' );
|
|
28
|
+
export const modelNormalMatrix = nodeImmutable( ModelNode, ModelNode.NORMAL_MATRIX );
|
|
29
|
+
export const modelWorldMatrix = nodeImmutable( ModelNode, ModelNode.WORLD_MATRIX );
|
|
30
|
+
export const modelPosition = nodeImmutable( ModelNode, ModelNode.POSITION );
|
|
31
|
+
export const modelScale = nodeImmutable( ModelNode, ModelNode.SCALE );
|
|
32
|
+
export const modelViewPosition = nodeImmutable( ModelNode, ModelNode.VIEW_POSITION );
|
|
33
|
+
|
|
34
|
+
addNodeClass( ModelNode );
|