diff --git a/wiki/TSL.md b/docs/TSL.md similarity index 100% rename from wiki/TSL.md rename to docs/TSL.md diff --git a/docs/llms-full.txt b/docs/llms-full.txt new file mode 100644 index 00000000000000..bd6cb381ffd596 --- /dev/null +++ b/docs/llms-full.txt @@ -0,0 +1,2617 @@ +# Three.js + +> Three.js is a cross-browser JavaScript library for creating 3D graphics using WebGL and WebGPU. + +## Instructions for Large Language Models + +When generating Three.js code, follow these guidelines: + +### 1. Use Import Maps (Not Old CDN Patterns) + +WRONG - outdated pattern: +```html + +``` + +CORRECT - modern pattern (always use latest version): +```html + + +``` + +### 2. Choosing Between WebGLRenderer and WebGPURenderer + +Three.js maintains both renderers: + +**Use WebGLRenderer** (default, mature): +- Maximum browser compatibility +- Well-established, many years of development +- Most examples and tutorials use this + +```js +import * as THREE from 'three'; +const renderer = new THREE.WebGLRenderer(); +``` + +**Use WebGPURenderer** when you need: +- Custom shaders/materials using TSL (Three.js Shading Language) +- Compute shaders +- Advanced node-based materials + +```js +import * as THREE from 'three/webgpu'; +const renderer = new THREE.WebGPURenderer(); +await renderer.init(); +``` + +### 3. TSL (Three.js Shading Language) + +When using WebGPURenderer, use TSL instead of raw GLSL for custom materials: + +```js +import { texture, uv, color } from 'three/tsl'; + +const material = new THREE.MeshStandardNodeMaterial(); +material.colorNode = texture( myTexture ).mul( color( 0xff0000 ) ); +``` + +TSL benefits: +- Works with both WebGL and WebGPU backends +- No string manipulation or onBeforeCompile hacks +- Type-safe, composable shader nodes +- Automatic optimization + +### 4. NodeMaterial Classes (for WebGPU/TSL) + +When using TSL, use node-based materials: +- MeshBasicNodeMaterial +- MeshStandardNodeMaterial +- MeshPhysicalNodeMaterial +- LineBasicNodeMaterial +- SpriteNodeMaterial + +--- + +## Complete Code Examples + +### Basic Scene with WebGLRenderer + +```html + + + + + Three.js Basic Scene + + + + + + + +``` + +### Basic Scene with WebGPURenderer and TSL + +```html + + + + + Three.js WebGPU Scene + + + + + + + +``` + +### Loading a GLTF Model + +```js +import * as THREE from 'three'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +const loader = new GLTFLoader(); + +loader.load( + 'model.glb', + ( gltf ) => { + scene.add( gltf.scene ); + }, + ( progress ) => { + console.log( ( progress.loaded / progress.total * 100 ) + '% loaded' ); + }, + ( error ) => { + console.error( 'Error loading model:', error ); + } +); +``` + +--- + +# TSL (Three.js Shading Language) - Complete Reference + +## TSL Specification + +An Approach to Productive and Maintainable Shader Creation. + +- [Introduction](#introduction) + - [Why TSL?](#why-tsl) + - [Example](#example) + - [Architecture](#architecture) +- [Learning TSL](#learning-tsl) +- [Constants and explicit conversions](#constants-and-explicit-conversions) +- [Conversions](#conversions) +- [Uniform](#uniform) + - [onUpdate](#uniformonupdate) +- [Swizzle](#swizzle) +- [Operators](#operators) +- [Function](#function) +- [Variables](#variables) +- [Array](#array) + - [Uniform](#array-uniform) +- [Varying](#varying) +- [Conditional](#conditional) + - [If-else](#if-else) + - [Switch-case](#switch-case) + - [Ternary](#ternary) +- [Loop](#loop) +- [Math](#math) +- [Method chaining](#method-chaining) +- [Texture](#texture) +- [Attributes](#attributes) +- [Position](#position) +- [Normal](#normal) +- [Tangent](#tangent) +- [Bitangent](#bitangent) +- [Camera](#camera) +- [Model](#model) +- [Screen](#screen) +- [Viewport](#viewport) +- [Blend Modes](#blend-modes) +- [Reflect](#reflect) +- [UV Utils](#uv-utils) +- [Interpolation](#interpolation) +- [Random](#random) +- [Rotate](#rotate) +- [Oscillator](#oscillator) +- [Timer](#timer) +- [Packing](#packing) +- [Post-Processing](#post-processing) +- [Render Pass](#render-pass) +- [Compute](#compute) +- [Storage](#storage) +- [Struct](#struct) +- [Flow Control](#flow-control) +- [Fog](#fog) +- [Color Adjustments](#color-adjustments) +- [Utilities](#utilities) +- [NodeMaterial](#nodematerial) + - [LineDashedNodeMaterial](#linedashednodematerial) + - [MeshPhongNodeMaterial](#meshphongnodematerial) + - [MeshStandardNodeMaterial](#meshstandardnodematerial) + - [MeshPhysicalNodeMaterial](#meshphysicalnodematerial) + - [SpriteNodeMaterial](#spritenodematerial) +- [Transitioning common GLSL properties to TSL](#transitioning-common-glsl-properties-to-tsl) + +## Introduction + +### Why TSL? + +Creating shaders has always been an advanced step for most developers; many game developers have never created GLSL code from scratch. The shader graph solution adopted today by the industry has allowed developers more focused on dynamics to create the necessary graphic effects to meet the demands of their projects. + +The aim of the project is to create an easy-to-use environment for shader creation. Even if for this we need to create complexity behind it, this happened initially with `Renderer` and now with the `TSL`. + +Other benefits that TSL brings besides simplifying shading creation are keeping the `renderer agnostic`, while all the complexity of a material can be imported into different modules and use `tree shaking` without breaking during the process. + +### Example + +A `detail map` makes things look more real in games. It adds tiny details like cracks or bumps to surfaces. In this example we will scale uv to improve details when seen up close and multiply with a base texture. + +#### Old + +This is how we would achieve that using `.onBeforeCompile()`: + +```js +const material = new THREE.MeshStandardMaterial(); +material.map = colorMap; +material.onBeforeCompile = ( shader ) => { + + shader.uniforms.detailMap = { value: detailMap }; + + let token = '#define STANDARD'; + + let insert = /* glsl */` + uniform sampler2D detailMap; + `; + + shader.fragmentShader = shader.fragmentShader.replace( token, token + insert ); + + token = '#include '; + + insert = /* glsl */` + diffuseColor *= texture2D( detailMap, vMapUv * 10.0 ); + `; + + shader.fragmentShader = shader.fragmentShader.replace( token, token + insert ); + +}; +``` + +Any simple change from this makes the code increasingly complicated using `.onBeforeCompile`, the result we have today in the community are countless types of parametric materials that do not communicate with each other, and that need to be updated periodically to be operating, limiting the creativity to create unique materials reusing modules in a simple way. + +#### New + +With `TSL` the code would look like this: + +```js +import { texture, uv } from 'three/tsl'; + +const detail = texture( detailMap, uv().mul( 10 ) ); + +const material = new THREE.MeshStandardNodeMaterial(); +material.colorNode = texture( colorMap ).mul( detail ); +``` + +`TSL` is also capable of encoding code into different outputs such as `WGSL`/`GLSL` - `WebGPU`/`WebGL`, in addition to optimizing the shader graph automatically and through codes that can be inserted within each `Node`. This allows the developer to focus on productivity and leave the graphical management part to the `Node System`. + +Another important feature of a graph shader is that we will no longer need to care about the sequence in which components are created, because the `Node System` will only declare and include it once. + +Let's say that you import `positionWorld` into your code, even if another component uses it, the calculations performed to obtain `position world` will only be performed once, as is the case with any other node such as: `normalWorld`, `modelPosition`, etc. + +### Architecture + +All `TSL` components are extended from `Node` class. The `Node` allows it to communicate with any other, value conversions can be automatic or manual, a `Node` can receive the output value expected by the parent `Node` and modify its own output snippet. It's possible to modulate them using `tree shaking` in the shader construction process, the `Node` will have important information such as `geometry`, `material`, `renderer` as well as the `backend`, which can influence the type and value of output. + +The main class responsible for creating the code is `NodeBuilder`. This class can be extended to any output programming language, so you can use TSL for a third language if you wish. Currently `NodeBuilder` has two extended classes, the `WGSLNodeBuilder` aimed at WebGPU and `GLSLNodeBuilder` aimed at WebGL2. + +The build process is based on three pillars: `setup`, `analyze` and `generate`. + +| | | +| -- | -- | +| `setup` | Use `TSL` to create a completely customized code for the `Node` output. The `Node` can use many others within itself, have countless inputs, but there will always be a single output. | +| `analyze` | This proccess will check the `nodes` that were created in order to create useful information for `generate` the snippet, such as the need to create or not a cache/variable for optimizing a node. | +| `generate` | An output of `string` will be returned from each `node`. Any node will also be able to create code in the flow of shader, supporting multiple lines. | + +`Node` also have a native update process invoked by the `update()` function, these events be called by `frame`, `render call` and `object draw`. + +It is also possible to serialize or deserialize a `Node` using `serialize()` and `deserialize()` functions. + +## Learning TSL + +TSL is a Node-based shader abstraction, written in JavaScript. TSL's functions are inspired by GLSL, but follow a very different concept. WGSL and GLSL are focused on creating GPU programs, in TSL this is one of the features. + +### Seamless Integration with JavaScript/TypeScript + +- Unified Code + - Write shader logic directly in JS/TS, eliminating the need to manipulate strings. + - Create and manipulate render objects just like any other JavaScript logic inside a TSL function. + - Advanced events to control a Node before and after the object is rendered. +- JS Ecosystem + - Use native **import/export**, **NPM**, and integrate **JS/TS** components directly into your shader logic. +- Typing + - Benefit from better type checking (especially with **TypeScript** and **[@three-types](https://github.com/three-types/three-ts-types)**), increasing code robustness. + +### Shader-Graph Inspired Structure + +- Focus on Intent + - Build materials by connecting nodes through: [positionWorld](#position), [normalWorld](#normal), [screenUV](#screen), [attribute()](#attributes), etc. +More declarative("what") vs. imperative("how"). +- Composition & High-Level Concepts + - Work with high-level concepts for Node Material like [colorNode](#basic), [roughnessNode](#standard), [metalnessNode](#standard), [positionNode](#basic), etc. This preserves the integrity of the lighting model while allowing customizations, helping to avoid mistakes from incorrect setups. +- Keeping an eye on software exchange + - Modern 3D authoring software uses Shader-Graph based material composition to exchange between other software. TSL already has its own MaterialX integration. +- Easier Migration + - Many functions are directly inspired by GLSL to smooth the learning curve for those with prior experience. + +### Rendering Manipulation + +- Control rendering steps and create new render-passes per individual TSL functions. + - Implement complex effects is easily with nodes using a single function call either in post-processing and in materials allowing the node itself to manage the rendering process as it needs. + - `gaussianBlur()`: Double render-pass gaussian blur node. It can be used in the material or in post-processing through a single function. + - Easy access to renderer buffers using TSL functions like: + - `viewportSharedTexture()`: Accesses the beauty what has already been rendered, preserving the render-order. + - `viewportLinearDepth()`: Accesses the depth what has already been rendered, preserving the render-order. + - Integrated Compute Shaders + - Perform calculations on buffers using compute stage directly during an object's rendering. + - TSL allows dynamic manipulation of renderer functions, which makes it more customizable than intermediate languages ​​that would have to use flags in fixed pipelines for this. + - You just need to use the events of a Node for the renderer manipulations, without needing to modify the core. + +### Automatic Optimization and Workarounds + +- Your TSL code automatically benefits from optimizations and workarounds implemented in the Three.js compiler with each new version. + - Simplifications + - Automatic type conversions. + - Execute a block of code in vertex-stage and get it in fragment-stage just using `vertexStage( node )`. + - Automatically choose interpolation method for varyings depending on type. + - Don't worry about collisions of global variables internally when using Nodes. + - Polyfills + - e.g: `textureSample()` function in the vertex shader (not natively supported in WGSL) is correctly transpiled to work. + - e.g: Automatic correction for the `pow()` function, which didn't accept negative bases on Windows/DirectX using WGSL. + - Optimizations + - Repeated expressions: TSL can automatically create temporary variables to avoid redundant calculations. + - Automatic reuse of uniforms and attributes. + - Creating varying only if necessary. Otherwise they are replaced by simple variables. + +### Target audience + - Beginners users + - You only need one line to create your first custom shader. + - Advanced users + - Makes creating shaders simple but not limited. Example: https://www.youtube.com/watch?v=C2gDL9Qk_vo + - If you don't like fixed pipelines and low level, you'll love this. + +### Share everything + +#### TSL is based on Nodes, so don’t worry about sharing your **functions** and **uniforms** across materials and post-processing. + +```js +// Shared the same uniform with various materials + +const sharedColor = uniform( new THREE.Color() ); + +materialA.colorNode = sharedColor.div( 2 ); +materialB.colorNode = sharedColor.mul( .5 ); +materialC.colorNode = sharedColor.add( .5 ); +``` + +#### Deferred Function: High level of customization, goodby **#defines** + +Access **material**, **geometry**, **object**, **camera**, **scene**, **renderer** and more directly from a TSL function. Function calls are only performed at the time of building the shader allowing you to customize the function according to the object's setup. + +```js +// Returns an uniform of the material's custom color if it exists + +const customColor = Fn( ( { material, geometry, object } ) => { + + if ( material.userData.customColor !== undefined ) { + + return uniform( material.userData.customColor ); + + } + + return vec3( 0 ); + +} ); + +// + +material.colorNode = customColor(); + +``` + +#### Load a texture-based matrix inside a TSL function + +This can be used for any other JS and Three.js ecosystem needs. You can manipulate your assets according to the needs of a function. This can work for creating buffers, attributes, uniforms and any other JavaScript operation. + +```js +let bayer16Texture = null; + +export const bayer16 = Fn( ( [ uv ] ) => { + + if ( bayer16Texture === null ) { + + const bayer16Base64 = 'data:image/png;base64,...=='; + + bayer16Texture = new TextureLoader().load( bayer16Base64 ); + + } + + return textureLoad( bayer16Texture, ivec2( uv ).mod( int( 16 ) ) ); + +} ); + +// + +material.colorNode = bayer16( screenCoordinate ); + +``` + +#### The node architecture allows the creation of instances of custom attributes and buffers through simple functions. + +```js +// Range values node example + +const randomColor = range( new THREE.Color( 0x000000 ), new THREE.Color( 0xFFFFFF ) ); + +material.colorNode = randomColor; + +//... + +const mesh = new THREE.InstancedMesh( geometry, material, count ); +``` + +#### TSL loves JavaScript + +TSL syntax follows JavaScript style because they are the same thing, so if you come from GLSL you can explore new possibilities. + +```js +// A simple example of Function closure + +const mainTask = Fn( () => { + + const task2 = Fn( ( [ a, b ] ) => { + + return a.add( b ).mul( 0.5 ); + + } ); + + + return task2( color( 0x00ff00 ), color( 0x0000ff ) ); + +} ); + +// + +material.colorNode = mainTask(); +``` + +#### Simplification + +Double render-pass `gaussianBlur()` node. It can be used in the material or in post-processing through a single function. + +```js +// Applies a double render-pass gaussianBlur and then a grayscale filter before the object with the material is rendered. + +const myTexture = texture( map ); + +material.colorNode = grayscale( gaussianBlur( myTexture, 4 ) ); +``` + +Accesses what has already been rendered, preserving the render-order for easy refraction effects, avoiding multiple render-pass and manual sorts. + +```js +// Leaving the back in grayscale. + +material.colorNode = grayscale( viewportSharedTexture( screenUV ) ); +material.transparent = true; +``` + +#### Extend the TSL + +You no longer need to create a Material for each desired effect, instead create Nodes. A Node can have access to the Material and can be used in many ways. Extend the TSL from Nodes and let the user use it in creative ways. + +A great example of this is [TSL-Textures](https://boytchev.github.io/tsl-textures/). + +```js +import * as THREE from 'three'; +import { simplexNoise } from 'tsl-textures'; + +material.colorNode = simplexNoise ( { + scale: 2, + balance: 0, + contrast: 0, + color: new THREE.Color(16777215), + background: new THREE.Color(0), + seed: 0 +} ); + +``` + +## Constants and explicit conversions + +Input functions can be used to create contants and do explicit conversions. +> Conversions are also performed automatically if the output and input are of different types. + +| Name | Returns a constant or convertion of type: | +| -- | -- | +| `float( node\|number )` | `float` | +| `int( node\|number )` | `int` | +| `uint( node\|number )` | `uint` | +| `bool( node\|value )` | `boolean` | +| `color( node\|hex\|r,g,b )` | `color` | +| `vec2( node\|Vector2\|x,y )` | `vec2` | +| `vec3( node\|Vector3\|x,y,z )` | `vec3` | +| `vec4( node\|Vector4\|x,y,z,w )` | `vec4` | +| `mat2( node\|Matrix2\|a,b,c,d )` | `mat2` | +| `mat3( node\|Matrix3\|a,b,c,d,e,f,g,h,i )` | `mat3` | +| `mat4( node\|Matrix4\|a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p )` | `mat4` | +| `ivec2( node\|x,y )` | `ivec2` | +| `ivec3( node\|x,y,z )` | `ivec3` | +| `ivec4( node\|x,y,z,w )` | `ivec4` | +| `uvec2( node\|x,y )` | `uvec2` | +| `uvec3( node\|x,y,z )` | `uvec3` | +| `uvec4( node\|x,y,z,w )` | `uvec4` | +| `bvec2( node\|x,y )` | `bvec2` | +| `bvec3( node\|x,y,z )` | `bvec3` | +| `bvec4( node\|x,y,z,w )` | `bvec4` | + +Example: + +```js +import { color, vec2, positionWorld } from 'three/tsl'; + +// constant +material.colorNode = color( 0x0066ff ); + +// conversion +material.colorNode = vec2( positionWorld ); // result positionWorld.xy +``` + +## Conversions + +It is also possible to perform conversions using the `method chaining`: + +| Name | Returns a constant or conversion of type: | +| -- | -- | +| `.toFloat()` | `float` | +| `.toInt()` | `int` | +| `.toUint()` | `uint` | +| `.toBool()` | `boolean` | +| `.toColor()` | `color` | +| `.toVec2()` | `vec2` | +| `.toVec3()` | `vec3` | +| `.toVec4()` | `vec4` | +| `.toMat2()` | `mat2` | +| `.toMat3()` | `mat3` | +| `.toMat4()` | `mat4` | +| | | +| `.toIVec2()` | `ivec2` | +| `.toIVec3()` | `ivec3` | +| `.toIVec4()` | `ivec4` | +| `.toUVec2()` | `uvec2` | +| `.toUVec3()` | `uvec3` | +| `.toUVec4()` | `uvec4` | +| `.toBVec2()` | `bvec2` | +| `.toBVec3()` | `bvec3` | +| `.toBVec4()` | `bvec4` | + +Example: + +```js +import { positionWorld } from 'three/tsl'; + +// conversion +material.colorNode = positionWorld.toVec2(); // result positionWorld.xy +``` + +## Uniform + +Uniforms are useful to update values of variables like colors, lighting, or transformations without having to recreate the shader program. They are the true variables from a GPU's point of view. + +| Name | Description | +| -- | -- | +| `uniform( boolean \| number \| Color \| Vector2 \| Vector3 \| Vector4 \| Matrix3 \| Matrix4, type = null )` | Dynamic values. | + +Example: + +```js +const myColor = uniform( new THREE.Color( 0x0066FF ) ); + +material.colorNode = myColor; +``` + +### `uniform.on*Update()` + +It is also possible to create update events on `uniforms`, which can be defined by the user: + +| Name | Description | +| -- | -- | +| `.onObjectUpdate( function )` | It will be updated every time an object like `Mesh` is rendered with this `node` in `Material`. | +| `.onRenderUpdate( function )` | It will be updated once per render, common and shared materials, fog, tone mapping, etc. | +| `.onFrameUpdate( function )` | It will be updated only once per frame, recommended for values ​​that will be updated only once per frame, regardless of when `render-pass` the frame has, cases like `time` for example. | + +Example: + +```js +const posY = uniform( 0 ); // it's possible use uniform( 'float' ) + +// or using event to be done automatically +// { object } will be the current rendering object +posY.onObjectUpdate( ( { object } ) => object.position.y ); + +// you can also update manually using the .value property +posY.value = object.position.y; + +material.colorNode = posY; +``` + +## Swizzle + +Swizzling is the technique that allows you to access, reorder, or duplicate the components of a vector using a specific notation within TSL. This is done by combining the identifiers: + +```js +const original = vec3( 1.0, 2.0, 3.0 ); // (x, y, z) +const swizzled = original.zyx; // swizzled = (3.0, 2.0, 1.0) +``` + +It's possible use `xyzw`, `rgba` or `stpq`. + +## Operators + +| Name | Description | +| -- | -- | +| `.add( node \| value, ... )` | Return the addition of two or more value. | +| `.sub( node \| value )` | Return the subraction of two or more value. | +| `.mul( node \| value )` | Return the multiplication of two or more value. | +| `.div( node \| value )` | Return the division of two or more value. | +| `.mod( node \| value )` | Computes the remainder of dividing the first node by the second. | +| `.equal( node \| value )` | Checks if two nodes are equal. | +| `.notEqual( node \| value )` | Checks if two nodes are not equal. | +| `.lessThan( node \| value )` | Checks if the first node is less than the second. | +| `.greaterThan( node \| value )` | Checks if the first node is greater than the second. | +| `.lessThanEqual( node \| value )` | Checks if the first node is less than or equal to the second. | +| `.greaterThanEqual( node \| value )` | Checks if the first node is greater than or equal to the second. | +| `.and( node \| value )` | Performs logical AND on two nodes. | +| `.or( node \| value )` | Performs logical OR on two nodes. | +| `.not( node \| value )` | Performs logical NOT on a node. | +| `.xor( node \| value )` | Performs logical XOR on two nodes. | +| `.bitAnd( node \| value )` | Performs bitwise AND on two nodes. | +| `.bitNot( node \| value )` | Performs bitwise NOT on a node. | +| `.bitOr( node \| value )` | Performs bitwise OR on two nodes. | +| `.bitXor( node \| value )` | Performs bitwise XOR on two nodes. | +| `.shiftLeft( node \| value )` | Shifts a node to the left. | +| `.shiftRight( node \| value )` | Shifts a node to the right. | +| | | +| `.assign( node \| value )` | Assign one or more value to a and return the same. | +| `.addAssign( node \| value )` | Adds a value and assigns the result. | +| `.subAssign( node \| value )` | Subtracts a value and assigns the result. | +| `.mulAssign( node \| value )` | Multiplies a value and assigns the result. | +| `.divAssign( node \| value )` | Divides a value and assigns the result. | + +```js +const a = float( 1 ); +const b = float( 2 ); + +const result = a.add( b ); // output: 3 +``` + +## Function + +### `Fn( function, layout = null )` + +It is possible to use classic JS functions or a `Fn()` interface. The main difference is that `Fn()` creates a controllable environment, allowing the use of `stack` where you can use `assign` and `conditional`, while the classic function only allows inline approaches. + +Example: + +```js +// tsl function +const oscSine = Fn( ( [ t = time ] ) => { + + return t.add( 0.75 ).mul( Math.PI * 2 ).sin().mul( 0.5 ).add( 0.5 ); + +} ); + +// inline function +export const oscSine = ( t = time ) => t.add( 0.75 ).mul( Math.PI * 2 ).sin().mul( 0.5 ).add( 0.5 ); +``` +> Both above can be called with `oscSin( value )`. + +TSL allows the entry of parameters as object, this is useful in functions that have many optional arguments. + +Example: + +```js +const oscSine = Fn( ( { timer = time } ) => { + + return timer.add( 0.75 ).mul( Math.PI * 2 ).sin().mul( 0.5 ).add( 0.5 ); + +} ); + +const value = oscSine( { timer: value } ); +``` + +Parameters as object also allows traditional calls as an array, enabling different types of usage. + +```js +const col = Fn( ( { r, g, b } ) => { + + return vec3( r, g, b ); + +} ); + + +// Any of the options below will return a green color. + +material.colorNode = col( 0, 1, 0 ); // option 1 +material.colorNode = col( { r: 0, g: 1, b: 0 } ); // option 2 +``` + +If you want to use an export function compatible with `tree shaking`, remember to use `/*@__PURE__*/` + +```js +export const oscSawtooth = /*@__PURE__*/ Fn( ( [ timer = time ] ) => timer.fract() ); +``` + +The second parameter of the function, if there are any parameters, will always be the first if there are none, and is dedicated to `NodeBuilder`. In `NodeBuilder` you can find out details about the current construction process and also obtain objects related to the shader construction, such as `material`, `geometry`, `object`, `camera`, etc. + +[See an example](#deferred-function-high-level-of-customization-goodby-defines) + +## Variables + +Functions used to declare variables. + +| Name | Description | +| -- | -- | +| `.toVar( node, name = null )` or `Var( node, name = null )` | Converts a node into a reusable variable in the shader. | +| `.toConst( node, name = null )` or `Const( node, name = null )` | Converts a node into an inline constant. | +| `property( type, name = null )` | Declares an property but does not assign an initial value. | + +The name is optional; if set to `null`, the node system will generate one automatically. +Creating a variable, constant, or property can help optimize the shader graph manually or assist in debugging. + +```js +const uvScaled = uv().mul( 10 ).toVar(); + +material.colorNode = texture( map, uvScaled ); +``` + +*** + +## Array + +The array() function in TSL allows creating constant or dynamic value arrays; there are many ways to create arrays in TSL. + +#### The standard way + +```js +const colors = array( [ + vec3( 1, 0, 0 ), + vec3( 0, 1, 0 ), + vec3( 0, 0, 1 ) +] ); + +const greenColor = colors.element( 1 ); + +// greenColor: vec3( 0, 1, 0 ) +``` + +#### Fixed size + +```js +const a = array( 'vec3', 2 ); + +// a: [ vec3( 0, 0, 0 ), vec3( 0, 0, 0 ) ] +``` + +#### Fill with a default value + +```js +const a = vec3( 0, 0, 1 ).toArray( 2 ); + +// a: [ vec3( 0, 0, 1 ), vec3( 0, 0, 1 ) ] +``` + +#### Define a type explicitly + +```js +const a = array( [ 0, 1, 2 ], 'uint' ); +const value = a.element( 1 ); + +// value: 1u +``` + +### Array Uniform + +It is possible to use the same array logic for uniforms using Three.js native components or primitive values. + +```js +const tintColors = uniformArray( [ + new Color( 1, 0, 0 ), + new Color( 0, 1, 0 ), + new Color( 0, 0, 1 ) +], 'color' ); + +const redColor = tintColors.element( 0 ); +``` + +#### Accessing values + +To access the values you can use `a[ 1 ]` or `a.element( 1 )`. The difference is that `a[ 1 ]` only allows constant values, while `a.element( 1 )` allows the use of dynamic values such as `a.element( index )` where index is a node. + +### Array Storage + +It is possible to create arrays that can be used in compute shaders and storage operations. + +| Name | Description | +| -- | -- | +| `instancedArray( array, type )` | Creates an instanced buffer attribute array. | +| `attributeArray( array, type )` | Creates a buffer attribute array. | + +## Varying + +Functions used to declare varying. + +| Name | Description | +| -- | -- | +| `vertexStage( node )` | Computes the node in the vertex stage. | +| `varying( node, name = null )` | Computes the node in the vertex stage and passes interpolated values to the fragment shader. | +| `varyingProperty( type, name = null )` | Declares an varying property but does not assign an initial value. | + +Let's suppose you want to optimize some calculation in the `vertex stage` but are using it in a slot like `material.colorNode`. + +For example: + +```js +// multiplication will be executed in vertex stage +const normalView = vertexStage( modelNormalMatrix.mul( normalLocal ) ); + +// normalize will be computed in fragment stage while `normalView` is computed on vertex stage +material.colorNode = normalView.normalize(); +``` + +The first parameter of `vertexStage()` `modelNormalMatrix.mul( normalLocal )` will be computed in `vertex stage`, and the return from `vertexStage()` will be a `varying` as we are used in WGSL/GLSL, this can optimize extra calculations in the `fragment stage`. The second parameter of `varying()` allows you to add a custom name in code generation. + +If `varying()` is added only to `material.positionNode`, it will only return a simple variable and varying will not be created because `material.positionNode` is one of the only node material input that are computed at the vertex stage. + +## Conditional + +### If-else + +`If-else` conditionals can be used within `Fn()`. Conditionals in `TSL` are built using the `If` function: + +```js +If( conditional, function ) +.ElseIf( conditional, function ) +.Else( function ) +``` +> Notice here the `i` in `If` is capitalized. + +Example: + +In this example below, we will limit the y position of the geometry to 10. + +```js +const limitPosition = Fn( ( { position } ) => { + + const limit = 10; + + const result = vec3( position ); + + If( result.y.greaterThan( limit ), () => { + + result.y = limit; + + } ); + + return result; + +} ); + +material.positionNode = limitPosition( { position: positionLocal } ); +``` + +Example using `elseif`: + +```js +const limitPosition = Fn( ( { position } ) => { + + const limit = 10; + + const result = vec3( position ); + + If( result.y.greaterThan( limit ), () => { + + result.y = limit; + + } ).ElseIf( result.y.lessThan( limit ), () => { + + result.y = limit; + + } ); + + return result; + +} ); + +material.positionNode = limitPosition( { position: positionLocal } ); +``` +### Switch-Case + +A Switch-Case statement is an alternative way to express conditional logic compared to If-Else. + +```js +const col = color(); + +Switch( 0 ) + .Case( 0, () => { + + col.assign( color( 1, 0, 0 ) ); + + } ).Case( 1, () => { + + col.assign( color( 0, 1, 0 ) ); + + } ).Case( 2, 3, () => { + + col.assign( color( 0, 0, 1 ) ); + + } ).Default( () => { + + col.assign( color( 1, 1, 1 ) ); + + } ); +``` +Notice that there are some rules when using this syntax which differentiate TSL from JavaScript: + +- There is no fallthrough support. So each `Case()` statement has an implicit break. +- A `Case()` statement can hold multiple values (selectors) for testing. + +### Ternary + +Different from `if-else`, a ternary conditional will return a value and can be used outside of `Fn()`. + +```js +const result = select( value.greaterThan( 1 ), 1.0, value ); +``` +> Equivalent in JavaScript should be: `value > 1 ? 1.0 : value` + +## Loop + +This module offers a variety of ways to implement loops in TSL. In it's basic form it's: +```js +Loop( count, ( { i } ) => { + +} ); +``` +However, it is also possible to define a start and end ranges, data types and loop conditions: +```js +Loop( { start: int( 0 ), end: int( 10 ), type: 'int', condition: '<', name: 'i' }, ( { i } ) => { + +} ); +``` +Nested loops can be defined in a compacted form: +```js +Loop( 10, 5, ( { i, j } ) => { + +} ); +``` +Loops that should run backwards can be defined like so: +```js +Loop( { start: 10 }, () => {} ); +``` +It is possible to execute with boolean values, similar to the `while` syntax. +```js +const value = float( 0 ); + +Loop( value.lessThan( 10 ), () => { + + value.addAssign( 1 ); + +} ); +``` +The module also provides `Break()` and `Continue()` TSL expression for loop control. + +## Math + +| Name | Description | +| -- | -- | +| `EPSILON` | A small value used to handle floating-point precision errors. | +| `INFINITY` | Represent infinity. | +| `PI` | The mathematical constant π (pi). | +| `TWO_PI` | Two times π (2π). | +| `HALF_PI` | Half of π (π/2). | +| | | +| `abs( x )` | Return the absolute value of the parameter. | +| `acos( x )` | Return the arccosine of the parameter. | +| `all( x )` | Return true if all components of x are true. | +| `any( x )` | Return true if any component of x is true. | +| `asin( x )` | Return the arcsine of the parameter. | +| `atan( y, x )` | Return the arc-tangent of the parameters. | +| `bitcast( x, y )` | Reinterpret the bits of a value as a different type. | +| `cbrt( x )` | Return the cube root of the parameter. | +| `ceil( x )` | Find the nearest integer that is greater than or equal to the parameter. | +| `clamp( x, min, max )` | Constrain a value to lie between two further values. | +| `cos( x )` | Return the cosine of the parameter. | +| `cross( x, y )` | Calculate the cross product of two vectors. | +| `dFdx( p )` | Return the partial derivative of an argument with respect to x. | +| `dFdy( p )` | Return the partial derivative of an argument with respect to y. | +| `degrees( radians )` | Convert a quantity in radians to degrees. | +| `difference( x, y )` | Calculate the absolute difference between two values. | +| `distance( x, y )` | Calculate the distance between two points. | +| `dot( x, y )` | Calculate the dot product of two vectors. | +| `equals( x, y )` | Return true if x equals y. | +| `exp( x )` | Return the natural exponentiation of the parameter. | +| `exp2( x )` | Return 2 raised to the power of the parameter. | +| `faceforward( N, I, Nref )` | Return a vector pointing in the same direction as another. | +| `floor( x )` | Find the nearest integer less than or equal to the parameter. | +| `fract( x )` | Compute the fractional part of the argument. | +| `fwidth( x )` | Return the sum of the absolute derivatives in x and y. | +| `inverseSqrt( x )` | Return the inverse of the square root of the parameter. | +| `length( x )` | Calculate the length of a vector. | +| `lengthSq( x )` | Calculate the squared length of a vector. | +| `log( x )` | Return the natural logarithm of the parameter. | +| `log2( x )` | Return the base 2 logarithm of the parameter. | +| `max( x, y )` | Return the greater of two values. | +| `min( x, y )` | Return the lesser of two values. | +| `mix( x, y, a )` | Linearly interpolate between two values. | +| `negate( x )` | Negate the value of the parameter ( -x ). | +| `normalize( x )` | Calculate the unit vector in the same direction as the original vector. | +| `oneMinus( x )` | Return 1 minus the parameter. | +| `pow( x, y )` | Return the value of the first parameter raised to the power of the second. | +| `pow2( x )` | Return the square of the parameter. | +| `pow3( x )` | Return the cube of the parameter. | +| `pow4( x )` | Return the fourth power of the parameter. | +| `radians( degrees )` | Convert a quantity in degrees to radians. | +| `reciprocal( x )` | Return the reciprocal of the parameter (1/x). | +| `reflect( I, N )` | Calculate the reflection direction for an incident vector. | +| `refract( I, N, eta )` | Calculate the refraction direction for an incident vector. | +| `round( x )` | Round the parameter to the nearest integer. | +| `saturate( x )` | Constrain a value between 0 and 1. | +| `sign( x )` | Extract the sign of the parameter. | +| `sin( x )` | Return the sine of the parameter. | +| `smoothstep( e0, e1, x )` | Perform Hermite interpolation between two values. | +| `sqrt( x )` | Return the square root of the parameter. | +| `step( edge, x )` | Generate a step function by comparing two values. | +| `tan( x )` | Return the tangent of the parameter. | +| `transformDirection( dir, matrix )` | Transform the direction of a vector by a matrix and then normalize the result. | +| `trunc( x )` | Truncate the parameter, removing the fractional part. | + +```js +const value = float( -1 ); + +// It's possible use `value.abs()` too. +const positiveValue = abs( value ); // output: 1 +``` + +## Method chaining + +`Method chaining` will only be including operators, converters, math and some core functions. These functions, however, can be used on any `node`. + +Example: + +`oneMinus()` is a mathematical function like `abs()`, `sin()`. This example uses `.oneMinus()` as a built-in function in the class that returns a new node instead of classic C function like `oneMinus( texture( map ).rgb )`. + +```js +// it will invert the texture color +material.colorNode = texture( map ).rgb.oneMinus(); +``` + +You can use mathematical operators on any node, e.g: + +```js +const contrast = .5; +const brightness = .5; + +material.colorNode = texture( map ).mul( contrast ).add( brightness ); +``` + +## Texture + +| Name | Description | Type | +| -- | -- | -- | +| `texture( texture, uv = uv(), level = null )` | Retrieves texels from a texture. | `vec4` | +| `textureLoad( texture, uv, level = null )` | Fetches/loads texels without interpolation. | `vec4` | +| `textureStore( texture, uv, value )` | Stores a value into a storage texture. | `void` | +| `textureSize( texture, level = null )` | Returns the size of a texture. | `ivec2` | +| `textureBicubic( textureNode, strength = null )` | Applies mipped bicubic texture filtering. | `vec4` | +| `cubeTexture( texture, uvw = reflectVector, level = null )` | Retrieves texels from a cube texture. | `vec4` | +| `texture3D( texture, uvw = null, level = null )` | Retrieves texels from a 3D texture. | `vec4` | +| `triplanarTexture( textureX, textureY = null, textureZ = null, scale = float( 1 ), position = positionLocal, normal = normalLocal )` | Computes texture using triplanar mapping based on provided parameters. | `vec4` | + +## Attributes + +| Name | Description | Type | +| -- | -- | -- | +| `attribute( name, type = null )` | Getting geometry attribute using name and type. | `any` | +| `uv( index = 0 )` | UV attribute named `uv + index`. | `vec2` | +| `vertexColor( index = 0 )` | Vertex color node for the specified index. | `color` | +| `instanceIndex` | The index of the current instance. | `uint` | +| `vertexIndex` | The index of a vertex within a mesh. | `uint` | +| `drawIndex` | The draw index when using multi-draw. | `uint` | +| `batch( batchMesh )` | Creates a batch node for BatchedMesh. | `BatchNode` | +| `instance( instancedMesh )` | Creates an instance node for InstancedMesh. | `InstanceNode` | + +## Position + +The transformed term reflects the modifications applied by processes such as `skinning`, `morphing`, and similar techniques. + +| Name | Description | Type | +| -- | -- | -- | +| `positionGeometry` | Position attribute of geometry. | `vec3` | +| `positionLocal` | Transformed local position. | `vec3` | +| `positionWorld` | Transformed world position. | `vec3` | +| `positionWorldDirection` | Normalized world direction. | `vec3` | +| `positionView` | View position. | `vec3` | +| `positionViewDirection` | Normalized view direction. | `vec3` | + +## Normal + +The term transformed here also includes following the correct orientation of the face, so that the normals are inverted inside the geometry. + +| Name | Description | Type | +| -- | -- | -- | +| `normalGeometry` | Normal attribute of geometry. | `vec3` | +| `normalLocal` | Local variable for normal. | `vec3` | +| `normalView` | Normalized transformed view normal. | `vec3` | +| `normalViewGeometry` | Normalized view normal. | `vec3` | +| `normalWorld` | Normalized transformed world normal. | `vec3` | +| `normalWorldGeometry` | Normalized world normal. | `vec3` | + +## Tangent + +| Name | Description | Type | +| -- | -- | -- | +| `tangentGeometry` | Tangent attribute of geometry. | `vec4` | +| `tangentLocal` | Local variable for tangent. | `vec3` | +| `tangentView` | Normalized transformed view tangent. | `vec3` | +| `tangentWorld` | Normalized transformed world tangent. | `vec3` | + +### Bitangent + +| Name | Description | Type | +| -- | -- | -- | +| `bitangentGeometry` | Normalized bitangent in geometry space. | `vec3` | +| `bitangentLocal` | Normalized bitangent in local space. | `vec3` | +| `bitangentView` | Normalized transformed bitangent in view space. | `vec3` | +| `bitangentWorld` | Normalized transformed bitangent in world space. | `vec3` | + +## Camera + +| Name | Description | Type | +| -- | -- | -- | +| `cameraNear` | Near plane distance of the camera. | `float` | +| `cameraFar` | Far plane distance of the camera. | `float` | +| `cameraProjectionMatrix` | Projection matrix of the camera. | `mat4` | +| `cameraProjectionMatrixInverse` | Inverse projection matrix of the camera. | `mat4` | +| `cameraViewMatrix` | View matrix of the camera. | `mat4` | +| `cameraWorldMatrix` | World matrix of the camera. | `mat4` | +| `cameraNormalMatrix` | Normal matrix of the camera. | `mat3` | +| `cameraPosition` | World position of the camera. | `vec3` | + +## Model + +| Name | Description | Type | +| -- | -- | -- | +| `modelDirection` | Direction of the model. | `vec3` | +| `modelViewMatrix` | View-space matrix of the model. | `mat4` | +| `modelNormalMatrix` | View-space matrix of the model. | `mat3` | +| `modelWorldMatrix` | World-space matrix of the model. | `mat4` | +| `modelPosition` | Position of the model. | `vec3` | +| `modelScale` | Scale of the model. | `vec3` | +| `modelViewPosition` | View-space position of the model. | `vec3` | +| `modelWorldMatrixInverse` | Inverse world matrix of the model. | `mat4` | +| | | +| `highpModelViewMatrix` | View-space matrix of the model computed on CPU using 64-bit. | `mat4` | +| `highpModelNormalViewMatrix` | View-space normal matrix of the model computed on CPU using 64-bit. | `mat3` | + +## Screen + +Screen nodes will return the values related to the current `frame buffer`, either normalized or in `physical pixel units` considering the current `Pixel Ratio`. + +| Variable | Description | Type | +| -- | -- | -- | +| `screenUV` | Returns the normalized frame buffer coordinate. | `vec2` | +| `screenCoordinate` | Returns the frame buffer coordinate in physical pixel units. | `vec2` | +| `screenSize` | Returns the frame buffer size in physical pixel units. | `vec2` | +| `screenDPR` | Returns the device pixel ratio (DPR). | `float` | + +## Viewport + +`viewport` is influenced by the area defined in `renderer.setViewport()`, different of the values ​​defined in the renderer that are `logical pixel units`, it use `physical pixel units` considering the current `Pixel Ratio`. + +| Variable | Description | Type | +| -- | -- | -- | +| `viewportUV` | Returns the normalized viewport coordinate. | `vec2` | +| `viewport` | Returns the viewport dimension in physical pixel units. | `vec4` | +| `viewportCoordinate` | Returns the viewport coordinate in physical pixel units. | `vec2` | +| `viewportSize` | Returns the viewport size in physical pixel units. | `vec2` | +| `viewportSharedTexture( uvNode = screenUV, levelNode = null )` | Accesses what has already been rendered, preserving render-order. | `vec4` | +| `viewportDepthTexture( uvNode = screenUV, levelNode = null )` | Returns the depth texture of the viewport. | `float` | +| `viewportLinearDepth` | Returns the linear (orthographic) depth value of the current fragment. | `float` | +| `viewportMipTexture( uvNode = screenUV, levelNode = null, framebufferTexture = null )` | Returns a viewport texture with mipmap generation enabled. | `vec4` | +| `viewportSafeUV( uv = screenUV )` | Returns safe UV coordinates for refraction purposes. | `vec2` | + +## Blend Modes + +| Variable | Description | Type | +| -- | -- | -- | +| `blendBurn( a, b )` | Returns the burn blend mode. | `color` | +| `blendDodge( a, b )` | Returns the dodge blend mode. | `color` | +| `blendOverlay( a, b )` | Returns the overlay blend mode. | `color` | +| `blendScreen( a, b )` | Returns the screen blend mode. | `color` | +| `blendColor( a, b )` | Returns the (normal) color blend mode. | `color` | + +## Reflect + +| Name | Description | Type | +| -- | -- | -- | +| `reflectView` | Computes reflection direction in view space. | `vec3` | +| `reflectVector` | Transforms the reflection direction to world space. | `vec3` | + +## UV Utils + +| Name | Description | Type | +| -- | -- | -- | +| `matcapUV` | UV coordinates for matcap texture. | `vec2` | +| `rotateUV( uv, rotation, centerNode = vec2( 0.5 ) )` | Rotates UV coordinates around a center point. | `vec2` | +| `spherizeUV( uv, strength, centerNode = vec2( 0.5 ) )` | Distorts UV coordinates with a spherical effect around a center point. | `vec2` | +| `spritesheetUV( count, uv = uv(), frame = float( 0 ) )` | Computes UV coordinates for a sprite sheet based on the number of frames, UV coordinates, and frame index. | `vec2` | +| `equirectUV( direction = positionWorldDirection )` | Computes UV coordinates for equirectangular mapping based on the direction vector. | `vec2` | + +```js +import { texture, matcapUV } from 'three/tsl'; + +const matcap = texture( matcapMap, matcapUV ); +``` + +## Interpolation + +| Variable | Description | Type | +| -- | -- | -- | +| `remap( node, inLow, inHigh, outLow = float( 0 ), outHigh = float( 1 ) )` | Remaps a value from one range to another. | `any` | +| `remapClamp( node, inLow, inHigh, outLow = float( 0 ), outHigh = float( 1 ) )` | Remaps a value from one range to another, with clamping. | `any` | + +## Random + +| Variable | Description | Type | +| -- | -- | -- | +| `hash( seed )` | Generates a hash value in the range [ 0, 1 ] from the given seed. | `float` | +| `range( min, max )` | Generates a range `attribute` of values between min and max. Attribute randomization is useful when you want to randomize values ​​between instances and not between pixels. | `any` | + +## Rotate + +| Name | Description | Type | +| -- | -- | -- | +| `rotate( position, rotation )` | Applies a rotation to the given position node. Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. | `vec2`, `vec3` + +## Oscillator + +| Variable | Description | Type | +| -- | -- | -- | +| `oscSine( timer = time )` | Generates a sine wave oscillation based on a timer. | `float` | +| `oscSquare( timer = time )` | Generates a square wave oscillation based on a timer. | `float` | +| `oscTriangle( timer = time )` | Generates a triangle wave oscillation based on a timer. | `float` | +| `oscSawtooth( timer = time )` | Generates a sawtooth wave oscillation based on a timer. | `float` | + +## Timer + +| Variable | Description | Type | +| -- | -- | -- | +| `time` | Represents the elapsed time in seconds. | `float` | +| `deltaTime` | Represents the delta time in seconds. | `float` | + +## Packing + +| Variable | Description | Type | +| -- | -- | -- | +| `directionToColor( value )` | Converts direction vector to color. | `color` | +| `colorToDirection( value )` | Converts color to direction vector. | `vec3` | + +## Post-Processing + +TSL utilities for post-processing effects. They can be used in materials or post-processing passes. + +| Name | Description | +| -- | -- | +| `afterImage( node, damp = 0.96 )` | Creates an after image effect. | +| `anamorphic( node, threshold = 0.9, scale = 3, samples = 32 )` | Creates an anamorphic flare effect. | +| `bloom( node, strength = 1, radius = 0, threshold = 0 )` | Creates a bloom effect. | +| `boxBlur( textureNode, options = {} )` | Applies a box blur effect. | +| `chromaticAberration( node, strength = 1.0, center = null, scale = 1.1 )` | Creates a chromatic aberration effect. | +| `denoise( node, depthNode, normalNode, camera )` | Creates a denoise effect. | +| `dof( node, viewZNode, focusDistance, focalLength, bokehScale )` | Creates a depth-of-field effect. | +| `dotScreen( node, angle = 1.57, scale = 1 )` | Creates a dot-screen effect. | +| `film( inputNode, intensityNode = null, uvNode = null )` | Creates a film grain effect. | +| `fxaa( node )` | Creates a FXAA anti-aliasing effect. | +| `gaussianBlur( node, directionNode, sigma, options = {} )` | Creates a gaussian blur effect. | +| `grayscale( color )` | Converts color to grayscale. | +| `hashBlur( textureNode, bluramount = float( 0.1 ), options = {} )` | Applies a hash blur effect. | +| `lut3D( node, lut, size, intensity )` | Creates a LUT color grading effect. | +| `motionBlur( inputNode, velocity, numSamples = int( 16 ) )` | Creates a motion blur effect. | +| `outline( scene, camera, params )` | Creates an outline effect around selected objects. | +| `rgbShift( node, amount = 0.005, angle = 0 )` | Creates an RGB shift effect. | +| `sepia( color )` | Applies a sepia effect. | +| `smaa( node )` | Creates a SMAA anti-aliasing effect. | +| `sobel( node )` | Creates a sobel edge detection effect. | +| `ssr( colorNode, depthNode, normalNode, metalnessNode, roughnessNode = null, camera = null )` | Creates screen space reflections. | +| `ssgi( beautyNode, depthNode, normalNode, camera )` | Creates a SSGI effect. | +| `ao( depthNode, normalNode, camera )` | Creates a Ground Truth Ambient Occlusion (GTAO) effect. | +| `transition( nodeA, nodeB, mixTextureNode, mixRatio, threshold, useTexture )` | Creates a transition effect between two scenes. | +| `traa( beautyNode, depthNode, velocityNode, camera )` | Creates a TRAA temporal anti-aliasing effect. | + +Example: + +```js +import { gaussianBlur, grayscale, pass } from 'three/tsl'; + +// Post-processing +const scenePass = pass( scene, camera ); +const beauty = scenePass.getTextureNode(); + +postProcessing.outputNode = grayscale( gaussianBlur( beauty, 4 ) ); +``` + +## Render Pass + +Functions for creating and managing render passes. + +| Name | Description | +| -- | -- | +| `pass( scene, camera, options = {} )` | Creates a pass node for rendering a scene. | +| `passTexture( pass, texture )` | Creates a pass texture node. | +| `depthPass( scene, camera, options = {} )` | Creates a depth pass node. | +| `mrt( outputNodes )` | Creates a Multiple Render Targets (MRT) node. | +| `renderOutput( node, targetColorSpace, targetToneMapping )` | Creates a render output node. | + +Example: + +```js +import { pass, mrt, output, emissive } from 'three/tsl'; + +const scenePass = pass( scene, camera ); + +// Setup MRT +scenePass.setMRT( mrt( { + output: output, + emissive: emissive +} ) ); + +const outputNode = scenePass.getTextureNode( 'output' ); +const emissiveNode = scenePass.getTextureNode( 'emissive' ); +``` + +## Compute + +Compute shaders allow general-purpose GPU computations. TSL provides functions for creating and managing compute operations. + +| Name | Description | +| -- | -- | +| `compute( node, count = null, workgroupSize = [ 64 ] )` | Creates a compute node. | +| `atomicAdd( node, value )` | Performs an atomic addition. | +| `atomicSub( node, value )` | Performs an atomic subtraction. | +| `atomicMax( node, value )` | Performs an atomic max operation. | +| `atomicMin( node, value )` | Performs an atomic min operation. | +| `atomicAnd( node, value )` | Performs an atomic AND operation. | +| `atomicOr( node, value )` | Performs an atomic OR operation. | +| `atomicXor( node, value )` | Performs an atomic XOR operation. | +| `atomicStore( node, value )` | Stores a value atomically. | +| `atomicLoad( node )` | Loads a value atomically. | +| `workgroupBarrier()` | Creates a workgroup barrier. | +| `storageBarrier()` | Creates a storage barrier. | +| `textureBarrier()` | Creates a texture barrier. | +| `barrier()` | Creates a memory barrier. | +| `workgroupId` | The workgroup ID. | +| `localId` | The local invocation ID within the workgroup. | +| `globalId` | The global invocation ID. | +| `numWorkgroups` | The number of workgroups. | +| `subgroupSize` | The size of the subgroup. | + +Example: + +```js +import { Fn, instancedArray, instanceIndex, deltaTime } from 'three/tsl'; + +const count = 1000; +const positionArray = instancedArray( count, 'vec3' ); + +// create a compute function + +const computeShader = Fn( () => { + + const position = positionArray.element( instanceIndex ); + + position.x.addAssign( deltaTime ); + +} )().compute( count ); + +// + +renderer.compute( computeShader ); +``` + +## Storage + +Storage functions allow reading and writing to GPU buffers. + +| Name | Description | +| -- | -- | +| `storage( attribute, type, count )` | Creates a storage buffer. | +| `storageTexture( texture )` | Creates a storage texture for read/write operations. | + +## Struct + +Structs allow you to create custom data types with multiple members. They can be used to organize related data in shaders, define structures for attributes and uniforms. + +| Name | Description | +| -- | -- | +| `struct( membersLayout, name = null )` | Creates a struct type with the specified member layout. | +| `outputStruct( ...members )` | Creates an output struct node for returning multiple values. | + +Example: + +```js +import { struct, vec3 } from 'three/tsl'; + +// Define a custom struct +const BoundingBox = struct( { min: 'vec3', max: 'vec3' } ); + +// Create a new instance of the struct +const bb = BoundingBox( vec3( 0 ), vec3( 1 ) ); // style 1 +const bb2 = BoundingBox( { min: vec3( 0 ), max: vec3( 1 ) } ); // style 2 + +// Access the struct members +const min = bb.get( 'min' ); + +// Assign a new value to a member +min.assign( vec3( -1, -1, -1 ) ); +``` + +## Flow Control + +Functions for controlling shader flow. + +| Name | Description | +| -- | -- | +| `Discard()` | Discards the current fragment. | +| `Return()` | Returns from the current function. | +| `Break()` | Breaks out of a loop. | +| `Continue()` | Continues to the next iteration of a loop. | + +Example: + +```js +import { Fn, If, Discard, uv } from 'three/tsl'; + +const customFragment = Fn( () => { + + If( uv().x.lessThan( 0.5 ), () => { + + Discard(); + + } ); + + return vec4( 1, 0, 0, 1 ); + +} ); + +material.colorNode = customFragment(); +``` + +## Fog + +Functions for creating fog effects in the scene. Assign the fog node to `scene.fogNode`. + +| Name | Description | Type | +| -- | -- | -- | +| `fog( color, factor )` | Creates a fog node with specified color and fog factor. | `FogNode` | +| `rangeFogFactor( near, far )` | Creates a linear fog factor based on distance from camera. | `float` | +| `densityFogFactor( density )` | Creates an exponential squared fog factor for denser fog. | `float` | + +Example: + +```js +import { fog, rangeFogFactor, densityFogFactor, color } from 'three/tsl'; + +// Linear fog (starts at 10 units, fully opaque at 100 units) +scene.fogNode = fog( color( 0x000000 ), rangeFogFactor( 10, 100 ) ); + +// Exponential fog (density-based) +scene.fogNode = fog( color( 0xcccccc ), densityFogFactor( 0.02 ) ); +``` + +## Color Adjustments + +Functions for adjusting and manipulating colors. + +| Name | Description | Type | +| -- | -- | -- | +| `luminance( node )` | Calculates the luminance (perceived brightness) of a color. | `float` | +| `saturation( node, adjustment = 1 )` | Adjusts the saturation of a color. Values > 1 increase saturation, < 1 decrease. | `color` | +| `vibrance( node, adjustment = 1 )` | Selectively enhances less saturated colors while preserving already saturated ones. | `color` | +| `hue( node, adjustment = 0 )` | Rotates the hue of a color. Value is in radians. | `color` | +| `posterize( node, steps )` | Reduces the number of color levels, creating a poster-like effect. | `color` | + +Example: + +```js +import { texture, saturation, hue, posterize } from 'three/tsl'; + +// Increase saturation +material.colorNode = saturation( texture( map ), 1.5 ); + +// Rotate hue by 90 degrees +material.colorNode = hue( texture( map ), Math.PI / 2 ); + +// Posterize to 4 color levels +material.colorNode = posterize( texture( map ), 4 ); +``` + +## Utilities + +Utility functions for common shader tasks. + +| Name | Description | Type | +| -- | -- | -- | +| `billboarding( { position, horizontal, vertical } )` | Orients flat meshes always towards the camera. `position`: vertex positions in world space (default: `null`). `horizontal`: follow camera horizontally (default: `true`). `vertical`: follow camera vertically (default: `false`). | `vec3` | +| `checker( coord )` | Creates a 2x2 checkerboard pattern. | `float` | + +Example: + +```js +import { billboarding } from 'three/tsl'; + +// Full billboarding (like particles) - faces camera in all directions +material.vertexNode = billboarding(); + +// Horizontal only (like trees) - rotates around Y axis only +material.vertexNode = billboarding( { horizontal: true, vertical: false } ); +``` + +## NodeMaterial + +Check below for more details about `NodeMaterial` inputs. + +#### Core + +| Name | Description | Type | +|--|--|--| +| `.fragmentNode` | Replaces the built-in material logic used in the fragment stage. | `vec4` | +| `.vertexNode` | Replaces the built-in material logic used in the vertex stage. | `vec4` | +| `.geometryNode` | Allows you to execute a TSL function to deal with Geometry. | `Fn()` | + +#### Basic + +| Name | Description | Reference | Type | +|--|--|--|--| +| `.colorNode` | Replace the logic of `material.color * material.map`. | `materialColor` | `vec4` | +| `.depthNode` | Customize the `depth` output. | `depth` | `float` | +| `.opacityNode` | Replace the logic of `material.opacity * material.alphaMap`. | `materialOpacity` | `float` | +| `.alphaTestNode` | Sets a threshold to discard pixels with low opacity. | `materialAlphaTest` | `float` | +| `.positionNode` | Represents the vertex positions in local-space. Replace the logic of `material.displacementMap * material.displacementScale + material.displacementBias`. | `positionLocal` | `vec3` | + +#### Lighting + +| Name | Description | Reference | Type | +|--|--|--|--| +| `.emissiveNode` | Replace the logic of `material.emissive * material.emissiveIntensity * material.emissiveMap`. | `materialEmissive` | `color` | +| `.normalNode` | Represents the normals direction in view-space. Replace the logic of `material.normalMap * material.normalScale` and `material.bumpMap * material.bumpScale`. | `materialNormal` | `vec3` | +| `.lightsNode` | Defines the lights and lighting model that will be used by the material. | | `lights()` | +| `.envNode` | Replace the logic of `material.envMap * material.envMapRotation * material.envMapIntensity`. | | `color` | + +#### Backdrop + +| Name | Description | Type | +|--|--|--| +| `.backdropNode` | Set the current render color to be used before applying `Specular`, useful for `transmission` and `refraction` effects. | `color` | +| `.backdropAlphaNode` | Define the alpha of `backdropNode`. | `float` | + +#### Shadows + +| Name | Description | Reference | Type | +|--|--|--|--| +| `.castShadowNode` | Control the `color` and `opacity` of the shadow that will be projected by the material. | | `vec4` | +| `.maskShadowNode` | Define a custom mask for the shadow. | | `bool` | +| `.receivedShadowNode` | Handle the shadow cast on the material. | | `Fn()` | +| `.receivedShadowPositionNode` | Define the shadow projection position in world-space. | `shadowPositionWorld` | `vec3` | +| `.aoNode` | Replace the logic of `material.aoMap * aoMapIntensity`. | `materialAO` | `float` | + +#### Output + +| Name | Description | Reference | Type | +|--|--|--|--| +| `.maskNode` | Define the material's mask. Unlike opacity, it is discarded at the beginning of rendering, optimizing the process. | | `bool` | +| `.mrtNode` | Define a different MRT than the one defined in `pass()`. | | `mrt()` | +| `.outputNode` | Defines the material's final output. | `output` | `vec4` | + +## LineDashedNodeMaterial + +| Name | Description | Reference | Type | +|--|--|--|--| +| `.dashScaleNode` | Replace the logic of `material.scale`. | `materialLineScale` | `float` | +| `.dashSizeNode` | Replace the logic of `material.dashSize`. | `materialLineDashSize` | `float` | +| `.gapSizeNode` | Replace the logic of `material.gapSize`. | `materialLineGapSize` | `float` | +| `.offsetNode` | Replace the logic of `material.dashOffset`. | `materialLineDashOffset` | `float` | + +## MeshPhongNodeMaterial + +| Name | Description | Reference | Type | +|--|--|--|--| +| `.shininessNode` | Replace the logic of `material.shininess`. | `materialShininess` | `float` | +| `.specularNode` | Replace the logic of `material.specular`. | `materialSpecular` | `color` | + +## MeshStandardNodeMaterial + +| Name | Description | Reference | Type | +|--|--|--|--| +| `.metalnessNode` | Replace the logic of `material.metalness * material.metalnessMap`. | `materialMetalness` | `float` | +| `.roughnessNode` | Replace the logic of `material.roughness * material.roughnessMap`. | `materialRoughness` | `float` | + +## MeshPhysicalNodeMaterial + +| Name | Description | Reference | Type | +|--|--|--|--| +| `.clearcoatNode` | Replace the logic of `material.clearcoat * material.clearcoatMap`. | `materialClearcoat` | `float` | +| `.clearcoatRoughnessNode` | Replace the logic of `material.clearcoatRoughness * material.clearcoatRoughnessMap`. | `materialClearcoatRoughness` | `float` | +| `.clearcoatNormalNode` | Replace the logic of `material.clearcoatNormalMap * material.clearcoatNormalMapScale`. | `materialClearcoatNormal` | `vec3` | +| `.sheenNode` | Replace the logic of `material.sheenColor * material.sheenColorMap`. | `materialSheen` | `color` | +| `.iridescenceNode` | Replace the logic of `material.iridescence`. | `materialIridescence` | `float` | +| `.iridescenceIORNode` | Replace the logic of `material.iridescenceIOR`. | `materialIridescenceIOR` | `float` | +| `.iridescenceThicknessNode` | Replace the logic of `material.iridescenceThicknessRange * material.iridescenceThicknessMap`. | `materialIridescenceThickness` | `float` | +| `.specularIntensityNode` | Replace the logic of `material.specularIntensity * material.specularIntensityMap`. | `materialSpecularIntensity` | `float` | +| `.specularColorNode` | Replace the logic of `material.specularColor * material.specularColorMap`. | `materialSpecularColor` | `color` | +| `.iorNode` | Replace the logic of `material.ior`. | `materialIOR` | `float` | +| `.transmissionNode` | Replace the logic of `material.transmission * material.transmissionMap`. | `materialTransmission` | `color` | +| `.thicknessNode` | Replace the logic of `material.thickness * material.thicknessMap`. | `materialTransmission` | `float` | +| `.attenuationDistanceNode` | Replace the logic of `material.attenuationDistance`. | `materialAttenuationDistance` | `float` | +| `.attenuationColorNode` | Replace the logic of `material.attenuationColor`. | `materialAttenuationColor` | `color` | +| `.dispersionNode` | Replace the logic of `material.dispersion`. | `materialDispersion` | `float` | +| `.anisotropyNode` | Replace the logic of `material.anisotropy * material.anisotropyMap`. | `materialAnisotropy` | `vec2` | + +## SpriteNodeMaterial + +| Name | Description | Type | +|--|--|--| +| `.positionNode` | Defines the position. | `vec3` | +| `.rotationNode` | Defines the rotation. | `float` | +| `.scaleNode` | Defines the scale. | `vec2` | + +## Transitioning common GLSL properties to TSL + +| GLSL | TSL | Type | +| -- | -- | -- | +| `position` | `positionGeometry` | `vec3` | +| `transformed` | `positionLocal` | `vec3` | +| `transformedNormal` | `normalLocal` | `vec3` | +| `vWorldPosition` | `positionWorld` | `vec3` | +| `vColor` | `vertexColor()` | `vec3` | +| `vUv` \| `uv` | `uv()` | `vec2` | +| `vNormal` | `normalView` | `vec3` | +| `viewMatrix` | `cameraViewMatrix` | `mat4` | +| `modelMatrix` | `modelWorldMatrix` | `mat4` | +| `modelViewMatrix` | `modelViewMatrix` | `mat4` | +| `projectionMatrix` | `cameraProjectionMatrix` | `mat4` | +| `diffuseColor` | `material.colorNode` | `vec4` | +| `gl_FragColor` | `material.fragmentNode` | `vec4` | + + + +--- + +## Available Documentation + +The following documentation pages are available in markdown format at `https://threejs.org/docs/pages/{Name}.html.md`: + +### Core + +- [ARButton](https://threejs.org/docs/pages/ARButton.html.md) +- [AmmoPhysics](https://threejs.org/docs/pages/AmmoPhysics.html.md) +- [BasicLightingModel](https://threejs.org/docs/pages/BasicLightingModel.html.md) +- [BatchedMesh](https://threejs.org/docs/pages/BatchedMesh.html.md) +- [BitonicSort_BitonicSort](https://threejs.org/docs/pages/BitonicSort_BitonicSort.html.md) +- [Bone](https://threejs.org/docs/pages/Bone.html.md) +- [BooleanKeyframeTrack](https://threejs.org/docs/pages/BooleanKeyframeTrack.html.md) +- [BufferAttribute](https://threejs.org/docs/pages/BufferAttribute.html.md) +- [BundleGroup](https://threejs.org/docs/pages/BundleGroup.html.md) +- [CCDIKSolver](https://threejs.org/docs/pages/CCDIKSolver.html.md) +- [CSM](https://threejs.org/docs/pages/CSM.html.md) +- [CSMFrustum](https://threejs.org/docs/pages/CSMFrustum.html.md) +- [CSS2DObject](https://threejs.org/docs/pages/CSS2DObject.html.md) +- [CSS2DRenderer](https://threejs.org/docs/pages/CSS2DRenderer.html.md) +- [CSS3DObject](https://threejs.org/docs/pages/CSS3DObject.html.md) +- [CSS3DRenderer](https://threejs.org/docs/pages/CSS3DRenderer.html.md) +- [CSS3DSprite](https://threejs.org/docs/pages/CSS3DSprite.html.md) +- [Cache](https://threejs.org/docs/pages/Cache.html.md) +- [CanvasTarget](https://threejs.org/docs/pages/CanvasTarget.html.md) +- [Capsule](https://threejs.org/docs/pages/Capsule.html.md) +- [CinquefoilKnot](https://threejs.org/docs/pages/CinquefoilKnot.html.md) +- [ClippingGroup](https://threejs.org/docs/pages/ClippingGroup.html.md) +- [Clock](https://threejs.org/docs/pages/Clock.html.md) +- [ColorConverter](https://threejs.org/docs/pages/ColorConverter.html.md) +- [ColorKeyframeTrack](https://threejs.org/docs/pages/ColorKeyframeTrack.html.md) +- [ConvexHull](https://threejs.org/docs/pages/ConvexHull.html.md) +- [ConvexObjectBreaker](https://threejs.org/docs/pages/ConvexObjectBreaker.html.md) +- [CubeRenderTarget](https://threejs.org/docs/pages/CubeRenderTarget.html.md) +- [CubicInterpolant](https://threejs.org/docs/pages/CubicInterpolant.html.md) +- [Cylindrical](https://threejs.org/docs/pages/Cylindrical.html.md) +- [DRACOExporter](https://threejs.org/docs/pages/DRACOExporter.html.md) +- [DataUtils](https://threejs.org/docs/pages/DataUtils.html.md) +- [DebugEnvironment](https://threejs.org/docs/pages/DebugEnvironment.html.md) +- [DecoratedTorusKnot4a](https://threejs.org/docs/pages/DecoratedTorusKnot4a.html.md) +- [DecoratedTorusKnot4b](https://threejs.org/docs/pages/DecoratedTorusKnot4b.html.md) +- [DecoratedTorusKnot5a](https://threejs.org/docs/pages/DecoratedTorusKnot5a.html.md) +- [DecoratedTorusKnot5c](https://threejs.org/docs/pages/DecoratedTorusKnot5c.html.md) +- [DirectionalLightShadow](https://threejs.org/docs/pages/DirectionalLightShadow.html.md) +- [DiscreteInterpolant](https://threejs.org/docs/pages/DiscreteInterpolant.html.md) +- [Earcut](https://threejs.org/docs/pages/Earcut.html.md) +- [EdgeSplitModifier](https://threejs.org/docs/pages/EdgeSplitModifier.html.md) +- [EffectComposer](https://threejs.org/docs/pages/EffectComposer.html.md) +- [EventDispatcher](https://threejs.org/docs/pages/EventDispatcher.html.md) +- [FigureEightPolynomialKnot](https://threejs.org/docs/pages/FigureEightPolynomialKnot.html.md) +- [Float16BufferAttribute](https://threejs.org/docs/pages/Float16BufferAttribute.html.md) +- [Float32BufferAttribute](https://threejs.org/docs/pages/Float32BufferAttribute.html.md) +- [Flow](https://threejs.org/docs/pages/Flow.html.md) +- [Fog](https://threejs.org/docs/pages/Fog.html.md) +- [FogExp2](https://threejs.org/docs/pages/FogExp2.html.md) +- [Font](https://threejs.org/docs/pages/Font.html.md) +- [FullScreenQuad](https://threejs.org/docs/pages/FullScreenQuad.html.md) +- [GLBufferAttribute](https://threejs.org/docs/pages/GLBufferAttribute.html.md) +- [GLSLNodeBuilder](https://threejs.org/docs/pages/GLSLNodeBuilder.html.md) +- [GLSLNodeFunction](https://threejs.org/docs/pages/GLSLNodeFunction.html.md) +- [GLSLNodeParser](https://threejs.org/docs/pages/GLSLNodeParser.html.md) +- [GLTFExporter](https://threejs.org/docs/pages/GLTFExporter.html.md) +- [GPUComputationRenderer](https://threejs.org/docs/pages/GPUComputationRenderer.html.md) +- [GrannyKnot](https://threejs.org/docs/pages/GrannyKnot.html.md) +- [GroundedSkybox](https://threejs.org/docs/pages/GroundedSkybox.html.md) +- [Group](https://threejs.org/docs/pages/Group.html.md) +- [Gyroscope](https://threejs.org/docs/pages/Gyroscope.html.md) +- [HTMLMesh](https://threejs.org/docs/pages/HTMLMesh.html.md) +- [ImageUtils](https://threejs.org/docs/pages/ImageUtils.html.md) +- [ImprovedNoise](https://threejs.org/docs/pages/ImprovedNoise.html.md) +- [IndirectStorageBufferAttribute](https://threejs.org/docs/pages/IndirectStorageBufferAttribute.html.md) +- [Info](https://threejs.org/docs/pages/Info.html.md) +- [InspectorBase](https://threejs.org/docs/pages/InspectorBase.html.md) +- [InstancedBufferAttribute](https://threejs.org/docs/pages/InstancedBufferAttribute.html.md) +- [InstancedFlow](https://threejs.org/docs/pages/InstancedFlow.html.md) +- [InstancedInterleavedBuffer](https://threejs.org/docs/pages/InstancedInterleavedBuffer.html.md) +- [InstancedMesh](https://threejs.org/docs/pages/InstancedMesh.html.md) +- [Int16BufferAttribute](https://threejs.org/docs/pages/Int16BufferAttribute.html.md) +- [Int32BufferAttribute](https://threejs.org/docs/pages/Int32BufferAttribute.html.md) +- [Int8BufferAttribute](https://threejs.org/docs/pages/Int8BufferAttribute.html.md) +- [InteractiveGroup](https://threejs.org/docs/pages/InteractiveGroup.html.md) +- [InterleavedBuffer](https://threejs.org/docs/pages/InterleavedBuffer.html.md) +- [InterleavedBufferAttribute](https://threejs.org/docs/pages/InterleavedBufferAttribute.html.md) +- [Interpolant](https://threejs.org/docs/pages/Interpolant.html.md) +- [JoltPhysics](https://threejs.org/docs/pages/JoltPhysics.html.md) +- [KTX2Exporter](https://threejs.org/docs/pages/KTX2Exporter.html.md) +- [KeyframeTrack](https://threejs.org/docs/pages/KeyframeTrack.html.md) +- [LDrawUtils](https://threejs.org/docs/pages/LDrawUtils.html.md) +- [LOD](https://threejs.org/docs/pages/LOD.html.md) +- [Layers](https://threejs.org/docs/pages/Layers.html.md) +- [Lensflare](https://threejs.org/docs/pages/Lensflare.html.md) +- [LensflareElement](https://threejs.org/docs/pages/LensflareElement.html.md) +- [LensflareMesh](https://threejs.org/docs/pages/LensflareMesh.html.md) +- [LightProbe](https://threejs.org/docs/pages/LightProbe.html.md) +- [LightProbeGenerator](https://threejs.org/docs/pages/LightProbeGenerator.html.md) +- [LightShadow](https://threejs.org/docs/pages/LightShadow.html.md) +- [LightingModel](https://threejs.org/docs/pages/LightingModel.html.md) +- [Line](https://threejs.org/docs/pages/Line.html.md) +- [Line2](https://threejs.org/docs/pages/Line2.html.md) +- [Line3](https://threejs.org/docs/pages/Line3.html.md) +- [LineLoop](https://threejs.org/docs/pages/LineLoop.html.md) +- [LineSegments](https://threejs.org/docs/pages/LineSegments.html.md) +- [LineSegments2](https://threejs.org/docs/pages/LineSegments2.html.md) +- [LinearInterpolant](https://threejs.org/docs/pages/LinearInterpolant.html.md) +- [LoaderUtils](https://threejs.org/docs/pages/LoaderUtils.html.md) +- [LoadingManager](https://threejs.org/docs/pages/LoadingManager.html.md) +- [Lut](https://threejs.org/docs/pages/Lut.html.md) +- [MD2Character](https://threejs.org/docs/pages/MD2Character.html.md) +- [MD2CharacterComplex](https://threejs.org/docs/pages/MD2CharacterComplex.html.md) +- [MarchingCubes](https://threejs.org/docs/pages/MarchingCubes.html.md) +- [MathUtils](https://threejs.org/docs/pages/MathUtils.html.md) +- [Mesh](https://threejs.org/docs/pages/Mesh.html.md) +- [MeshSurfaceSampler](https://threejs.org/docs/pages/MeshSurfaceSampler.html.md) +- [MorphAnimMesh](https://threejs.org/docs/pages/MorphAnimMesh.html.md) +- [MorphBlendMesh](https://threejs.org/docs/pages/MorphBlendMesh.html.md) +- [NURBSSurface](https://threejs.org/docs/pages/NURBSSurface.html.md) +- [NURBSVolume](https://threejs.org/docs/pages/NURBSVolume.html.md) +- [NodeAttribute](https://threejs.org/docs/pages/NodeAttribute.html.md) +- [NodeBuilder](https://threejs.org/docs/pages/NodeBuilder.html.md) +- [NodeCache](https://threejs.org/docs/pages/NodeCache.html.md) +- [NodeCode](https://threejs.org/docs/pages/NodeCode.html.md) +- [NodeFrame](https://threejs.org/docs/pages/NodeFrame.html.md) +- [NodeFunction](https://threejs.org/docs/pages/NodeFunction.html.md) +- [NodeFunctionInput](https://threejs.org/docs/pages/NodeFunctionInput.html.md) +- [NodeMaterialObserver](https://threejs.org/docs/pages/NodeMaterialObserver.html.md) +- [NodeParser](https://threejs.org/docs/pages/NodeParser.html.md) +- [NodeUniform](https://threejs.org/docs/pages/NodeUniform.html.md) +- [NodeVar](https://threejs.org/docs/pages/NodeVar.html.md) +- [NodeVarying](https://threejs.org/docs/pages/NodeVarying.html.md) +- [NumberKeyframeTrack](https://threejs.org/docs/pages/NumberKeyframeTrack.html.md) +- [OBB](https://threejs.org/docs/pages/OBB.html.md) +- [OBJExporter](https://threejs.org/docs/pages/OBJExporter.html.md) +- [Object3D](https://threejs.org/docs/pages/Object3D.html.md) +- [Octree](https://threejs.org/docs/pages/Octree.html.md) +- [OculusHandModel](https://threejs.org/docs/pages/OculusHandModel.html.md) +- [OculusHandPointerModel](https://threejs.org/docs/pages/OculusHandPointerModel.html.md) +- [PLYExporter](https://threejs.org/docs/pages/PLYExporter.html.md) +- [PMREMGenerator](https://threejs.org/docs/pages/PMREMGenerator.html.md) +- [Path](https://threejs.org/docs/pages/Path.html.md) +- [PhongLightingModel](https://threejs.org/docs/pages/PhongLightingModel.html.md) +- [PhysicalLightingModel](https://threejs.org/docs/pages/PhysicalLightingModel.html.md) +- [PointLightShadow](https://threejs.org/docs/pages/PointLightShadow.html.md) +- [Points](https://threejs.org/docs/pages/Points.html.md) +- [PostProcessing](https://threejs.org/docs/pages/PostProcessing.html.md) +- [ProgressiveLightMap](https://threejs.org/docs/pages/ProgressiveLightMap.html.md) +- [Projector](https://threejs.org/docs/pages/Projector.html.md) +- [PropertyBinding](https://threejs.org/docs/pages/PropertyBinding.html.md) +- [PropertyMixer](https://threejs.org/docs/pages/PropertyMixer.html.md) +- [QuadMesh](https://threejs.org/docs/pages/QuadMesh.html.md) +- [RapierPhysics](https://threejs.org/docs/pages/RapierPhysics.html.md) +- [RectAreaLightTexturesLib](https://threejs.org/docs/pages/RectAreaLightTexturesLib.html.md) +- [RectAreaLightUniformsLib](https://threejs.org/docs/pages/RectAreaLightUniformsLib.html.md) +- [Reflector](https://threejs.org/docs/pages/Reflector.html.md) +- [Refractor](https://threejs.org/docs/pages/Refractor.html.md) +- [RenderTarget](https://threejs.org/docs/pages/RenderTarget.html.md) +- [RenderTarget3D](https://threejs.org/docs/pages/RenderTarget3D.html.md) +- [Renderer](https://threejs.org/docs/pages/Renderer.html.md) +- [Resources](https://threejs.org/docs/pages/Resources.html.md) +- [RoomEnvironment](https://threejs.org/docs/pages/RoomEnvironment.html.md) +- [SSSLightingModel](https://threejs.org/docs/pages/SSSLightingModel.html.md) +- [STLExporter](https://threejs.org/docs/pages/STLExporter.html.md) +- [SVGObject](https://threejs.org/docs/pages/SVGObject.html.md) +- [SVGRenderer](https://threejs.org/docs/pages/SVGRenderer.html.md) +- [Scene](https://threejs.org/docs/pages/Scene.html.md) +- [SceneOptimizer](https://threejs.org/docs/pages/SceneOptimizer.html.md) +- [SelectionBox](https://threejs.org/docs/pages/SelectionBox.html.md) +- [ShadowMapViewer](https://threejs.org/docs/pages/ShadowMapViewer.html.md) +- [ShadowMaskModel](https://threejs.org/docs/pages/ShadowMaskModel.html.md) +- [ShadowMesh](https://threejs.org/docs/pages/ShadowMesh.html.md) +- [Shape](https://threejs.org/docs/pages/Shape.html.md) +- [ShapePath](https://threejs.org/docs/pages/ShapePath.html.md) +- [ShapeUtils](https://threejs.org/docs/pages/ShapeUtils.html.md) +- [SimplexNoise](https://threejs.org/docs/pages/SimplexNoise.html.md) +- [SimplifyModifier](https://threejs.org/docs/pages/SimplifyModifier.html.md) +- [Skeleton](https://threejs.org/docs/pages/Skeleton.html.md) +- [SkinnedMesh](https://threejs.org/docs/pages/SkinnedMesh.html.md) +- [Sky](https://threejs.org/docs/pages/Sky.html.md) +- [SkyMesh](https://threejs.org/docs/pages/SkyMesh.html.md) +- [Source](https://threejs.org/docs/pages/Source.html.md) +- [Spherical](https://threejs.org/docs/pages/Spherical.html.md) +- [SphericalHarmonics3](https://threejs.org/docs/pages/SphericalHarmonics3.html.md) +- [SpotLightShadow](https://threejs.org/docs/pages/SpotLightShadow.html.md) +- [Sprite](https://threejs.org/docs/pages/Sprite.html.md) +- [StorageBufferAttribute](https://threejs.org/docs/pages/StorageBufferAttribute.html.md) +- [StorageInstancedBufferAttribute](https://threejs.org/docs/pages/StorageInstancedBufferAttribute.html.md) +- [StringKeyframeTrack](https://threejs.org/docs/pages/StringKeyframeTrack.html.md) +- [TSL](https://threejs.org/docs/pages/TSL.html.md) +- [Tab](https://threejs.org/docs/pages/Tab.html.md) +- [TessellateModifier](https://threejs.org/docs/pages/TessellateModifier.html.md) +- [TextureUtils](https://threejs.org/docs/pages/TextureUtils.html.md) +- [TiledLighting](https://threejs.org/docs/pages/TiledLighting.html.md) +- [Timer](https://threejs.org/docs/pages/Timer.html.md) +- [TimestampQueryPool](https://threejs.org/docs/pages/TimestampQueryPool.html.md) +- [ToonLightingModel](https://threejs.org/docs/pages/ToonLightingModel.html.md) +- [TorusKnot](https://threejs.org/docs/pages/TorusKnot.html.md) +- [Transpiler](https://threejs.org/docs/pages/Transpiler.html.md) +- [TrefoilKnot](https://threejs.org/docs/pages/TrefoilKnot.html.md) +- [TrefoilPolynomialKnot](https://threejs.org/docs/pages/TrefoilPolynomialKnot.html.md) +- [TubePainter](https://threejs.org/docs/pages/TubePainter.html.md) +- [USDZExporter](https://threejs.org/docs/pages/USDZExporter.html.md) +- [Uint16BufferAttribute](https://threejs.org/docs/pages/Uint16BufferAttribute.html.md) +- [Uint32BufferAttribute](https://threejs.org/docs/pages/Uint32BufferAttribute.html.md) +- [Uint8BufferAttribute](https://threejs.org/docs/pages/Uint8BufferAttribute.html.md) +- [Uint8ClampedBufferAttribute](https://threejs.org/docs/pages/Uint8ClampedBufferAttribute.html.md) +- [Uniform](https://threejs.org/docs/pages/Uniform.html.md) +- [UniformsGroup](https://threejs.org/docs/pages/UniformsGroup.html.md) +- [VOXMesh](https://threejs.org/docs/pages/VOXMesh.html.md) +- [VRButton](https://threejs.org/docs/pages/VRButton.html.md) +- [Volume](https://threejs.org/docs/pages/Volume.html.md) +- [VolumeSlice](https://threejs.org/docs/pages/VolumeSlice.html.md) +- [VolumetricLightingModel](https://threejs.org/docs/pages/VolumetricLightingModel.html.md) +- [WGSLNodeBuilder](https://threejs.org/docs/pages/WGSLNodeBuilder.html.md) +- [WGSLNodeFunction](https://threejs.org/docs/pages/WGSLNodeFunction.html.md) +- [WGSLNodeParser](https://threejs.org/docs/pages/WGSLNodeParser.html.md) +- [Water](https://threejs.org/docs/pages/Water.html.md) +- [WaterMesh](https://threejs.org/docs/pages/WaterMesh.html.md) +- [WebGL](https://threejs.org/docs/pages/WebGL.html.md) +- [WebGL3DRenderTarget](https://threejs.org/docs/pages/WebGL3DRenderTarget.html.md) +- [WebGLArrayRenderTarget](https://threejs.org/docs/pages/WebGLArrayRenderTarget.html.md) +- [WebGLCubeRenderTarget](https://threejs.org/docs/pages/WebGLCubeRenderTarget.html.md) +- [WebGLRenderTarget](https://threejs.org/docs/pages/WebGLRenderTarget.html.md) +- [WebGLRenderer](https://threejs.org/docs/pages/WebGLRenderer.html.md) +- [WebGLTimestampQueryPool](https://threejs.org/docs/pages/WebGLTimestampQueryPool.html.md) +- [WebGPU](https://threejs.org/docs/pages/WebGPU.html.md) +- [WebGPURenderer](https://threejs.org/docs/pages/WebGPURenderer.html.md) +- [WebGPUTimestampQueryPool](https://threejs.org/docs/pages/WebGPUTimestampQueryPool.html.md) +- [Wireframe](https://threejs.org/docs/pages/Wireframe.html.md) +- [WireframeGeometry2](https://threejs.org/docs/pages/WireframeGeometry2.html.md) +- [WorkerPool](https://threejs.org/docs/pages/WorkerPool.html.md) + +### Cameras + +- [ArrayCamera](https://threejs.org/docs/pages/ArrayCamera.html.md) +- [Camera](https://threejs.org/docs/pages/Camera.html.md) +- [CubeCamera](https://threejs.org/docs/pages/CubeCamera.html.md) +- [OrthographicCamera](https://threejs.org/docs/pages/OrthographicCamera.html.md) +- [PerspectiveCamera](https://threejs.org/docs/pages/PerspectiveCamera.html.md) +- [StereoCamera](https://threejs.org/docs/pages/StereoCamera.html.md) + +### Lights + +- [AmbientLight](https://threejs.org/docs/pages/AmbientLight.html.md) +- [DirectionalLight](https://threejs.org/docs/pages/DirectionalLight.html.md) +- [HemisphereLight](https://threejs.org/docs/pages/HemisphereLight.html.md) +- [IESSpotLight](https://threejs.org/docs/pages/IESSpotLight.html.md) +- [Light](https://threejs.org/docs/pages/Light.html.md) +- [PointLight](https://threejs.org/docs/pages/PointLight.html.md) +- [ProjectorLight](https://threejs.org/docs/pages/ProjectorLight.html.md) +- [RectAreaLight](https://threejs.org/docs/pages/RectAreaLight.html.md) +- [SpotLight](https://threejs.org/docs/pages/SpotLight.html.md) +- [XREstimatedLight](https://threejs.org/docs/pages/XREstimatedLight.html.md) + +### Materials + +- [LDrawConditionalLineMaterial](https://threejs.org/docs/pages/LDrawConditionalLineMaterial.html.md) +- [Line2NodeMaterial](https://threejs.org/docs/pages/Line2NodeMaterial.html.md) +- [LineBasicMaterial](https://threejs.org/docs/pages/LineBasicMaterial.html.md) +- [LineBasicNodeMaterial](https://threejs.org/docs/pages/LineBasicNodeMaterial.html.md) +- [LineDashedMaterial](https://threejs.org/docs/pages/LineDashedMaterial.html.md) +- [LineDashedNodeMaterial](https://threejs.org/docs/pages/LineDashedNodeMaterial.html.md) +- [LineMaterial](https://threejs.org/docs/pages/LineMaterial.html.md) +- [Material](https://threejs.org/docs/pages/Material.html.md) +- [MeshBasicMaterial](https://threejs.org/docs/pages/MeshBasicMaterial.html.md) +- [MeshBasicNodeMaterial](https://threejs.org/docs/pages/MeshBasicNodeMaterial.html.md) +- [MeshDepthMaterial](https://threejs.org/docs/pages/MeshDepthMaterial.html.md) +- [MeshDistanceMaterial](https://threejs.org/docs/pages/MeshDistanceMaterial.html.md) +- [MeshLambertMaterial](https://threejs.org/docs/pages/MeshLambertMaterial.html.md) +- [MeshLambertNodeMaterial](https://threejs.org/docs/pages/MeshLambertNodeMaterial.html.md) +- [MeshMatcapMaterial](https://threejs.org/docs/pages/MeshMatcapMaterial.html.md) +- [MeshMatcapNodeMaterial](https://threejs.org/docs/pages/MeshMatcapNodeMaterial.html.md) +- [MeshNormalMaterial](https://threejs.org/docs/pages/MeshNormalMaterial.html.md) +- [MeshNormalNodeMaterial](https://threejs.org/docs/pages/MeshNormalNodeMaterial.html.md) +- [MeshPhongMaterial](https://threejs.org/docs/pages/MeshPhongMaterial.html.md) +- [MeshPhongNodeMaterial](https://threejs.org/docs/pages/MeshPhongNodeMaterial.html.md) +- [MeshPhysicalMaterial](https://threejs.org/docs/pages/MeshPhysicalMaterial.html.md) +- [MeshPhysicalNodeMaterial](https://threejs.org/docs/pages/MeshPhysicalNodeMaterial.html.md) +- [MeshPostProcessingMaterial](https://threejs.org/docs/pages/MeshPostProcessingMaterial.html.md) +- [MeshSSSNodeMaterial](https://threejs.org/docs/pages/MeshSSSNodeMaterial.html.md) +- [MeshStandardMaterial](https://threejs.org/docs/pages/MeshStandardMaterial.html.md) +- [MeshStandardNodeMaterial](https://threejs.org/docs/pages/MeshStandardNodeMaterial.html.md) +- [MeshToonMaterial](https://threejs.org/docs/pages/MeshToonMaterial.html.md) +- [MeshToonNodeMaterial](https://threejs.org/docs/pages/MeshToonNodeMaterial.html.md) +- [NodeMaterial](https://threejs.org/docs/pages/NodeMaterial.html.md) +- [PointsMaterial](https://threejs.org/docs/pages/PointsMaterial.html.md) +- [PointsNodeMaterial](https://threejs.org/docs/pages/PointsNodeMaterial.html.md) +- [RawShaderMaterial](https://threejs.org/docs/pages/RawShaderMaterial.html.md) +- [ShaderMaterial](https://threejs.org/docs/pages/ShaderMaterial.html.md) +- [ShadowMaterial](https://threejs.org/docs/pages/ShadowMaterial.html.md) +- [ShadowNodeMaterial](https://threejs.org/docs/pages/ShadowNodeMaterial.html.md) +- [SpriteMaterial](https://threejs.org/docs/pages/SpriteMaterial.html.md) +- [SpriteNodeMaterial](https://threejs.org/docs/pages/SpriteNodeMaterial.html.md) +- [VolumeNodeMaterial](https://threejs.org/docs/pages/VolumeNodeMaterial.html.md) +- [WoodNodeMaterial](https://threejs.org/docs/pages/WoodNodeMaterial.html.md) + +### Geometries + +- [BoxGeometry](https://threejs.org/docs/pages/BoxGeometry.html.md) +- [BoxLineGeometry](https://threejs.org/docs/pages/BoxLineGeometry.html.md) +- [BufferGeometry](https://threejs.org/docs/pages/BufferGeometry.html.md) +- [CapsuleGeometry](https://threejs.org/docs/pages/CapsuleGeometry.html.md) +- [CircleGeometry](https://threejs.org/docs/pages/CircleGeometry.html.md) +- [ConeGeometry](https://threejs.org/docs/pages/ConeGeometry.html.md) +- [ConvexGeometry](https://threejs.org/docs/pages/ConvexGeometry.html.md) +- [CylinderGeometry](https://threejs.org/docs/pages/CylinderGeometry.html.md) +- [DecalGeometry](https://threejs.org/docs/pages/DecalGeometry.html.md) +- [DodecahedronGeometry](https://threejs.org/docs/pages/DodecahedronGeometry.html.md) +- [EdgesGeometry](https://threejs.org/docs/pages/EdgesGeometry.html.md) +- [ExtrudeGeometry](https://threejs.org/docs/pages/ExtrudeGeometry.html.md) +- [IcosahedronGeometry](https://threejs.org/docs/pages/IcosahedronGeometry.html.md) +- [InstancedBufferGeometry](https://threejs.org/docs/pages/InstancedBufferGeometry.html.md) +- [LatheGeometry](https://threejs.org/docs/pages/LatheGeometry.html.md) +- [LineGeometry](https://threejs.org/docs/pages/LineGeometry.html.md) +- [LineSegmentsGeometry](https://threejs.org/docs/pages/LineSegmentsGeometry.html.md) +- [OctahedronGeometry](https://threejs.org/docs/pages/OctahedronGeometry.html.md) +- [ParametricGeometry](https://threejs.org/docs/pages/ParametricGeometry.html.md) +- [PlaneGeometry](https://threejs.org/docs/pages/PlaneGeometry.html.md) +- [PolyhedronGeometry](https://threejs.org/docs/pages/PolyhedronGeometry.html.md) +- [RingGeometry](https://threejs.org/docs/pages/RingGeometry.html.md) +- [RollerCoasterGeometry](https://threejs.org/docs/pages/RollerCoasterGeometry.html.md) +- [RollerCoasterLiftersGeometry](https://threejs.org/docs/pages/RollerCoasterLiftersGeometry.html.md) +- [RollerCoasterShadowGeometry](https://threejs.org/docs/pages/RollerCoasterShadowGeometry.html.md) +- [RoundedBoxGeometry](https://threejs.org/docs/pages/RoundedBoxGeometry.html.md) +- [ShapeGeometry](https://threejs.org/docs/pages/ShapeGeometry.html.md) +- [SkyGeometry](https://threejs.org/docs/pages/SkyGeometry.html.md) +- [SphereGeometry](https://threejs.org/docs/pages/SphereGeometry.html.md) +- [TeapotGeometry](https://threejs.org/docs/pages/TeapotGeometry.html.md) +- [TetrahedronGeometry](https://threejs.org/docs/pages/TetrahedronGeometry.html.md) +- [TextGeometry](https://threejs.org/docs/pages/TextGeometry.html.md) +- [TorusGeometry](https://threejs.org/docs/pages/TorusGeometry.html.md) +- [TorusKnotGeometry](https://threejs.org/docs/pages/TorusKnotGeometry.html.md) +- [TreesGeometry](https://threejs.org/docs/pages/TreesGeometry.html.md) +- [TubeGeometry](https://threejs.org/docs/pages/TubeGeometry.html.md) +- [WireframeGeometry](https://threejs.org/docs/pages/WireframeGeometry.html.md) + +### Textures + +- [CanvasTexture](https://threejs.org/docs/pages/CanvasTexture.html.md) +- [CompressedArrayTexture](https://threejs.org/docs/pages/CompressedArrayTexture.html.md) +- [CompressedCubeTexture](https://threejs.org/docs/pages/CompressedCubeTexture.html.md) +- [CompressedTexture](https://threejs.org/docs/pages/CompressedTexture.html.md) +- [CubeDepthTexture](https://threejs.org/docs/pages/CubeDepthTexture.html.md) +- [CubeTexture](https://threejs.org/docs/pages/CubeTexture.html.md) +- [Data3DTexture](https://threejs.org/docs/pages/Data3DTexture.html.md) +- [DataArrayTexture](https://threejs.org/docs/pages/DataArrayTexture.html.md) +- [DataTexture](https://threejs.org/docs/pages/DataTexture.html.md) +- [DepthTexture](https://threejs.org/docs/pages/DepthTexture.html.md) +- [ExternalTexture](https://threejs.org/docs/pages/ExternalTexture.html.md) +- [FlakesTexture](https://threejs.org/docs/pages/FlakesTexture.html.md) +- [FramebufferTexture](https://threejs.org/docs/pages/FramebufferTexture.html.md) +- [Storage3DTexture](https://threejs.org/docs/pages/Storage3DTexture.html.md) +- [StorageArrayTexture](https://threejs.org/docs/pages/StorageArrayTexture.html.md) +- [StorageTexture](https://threejs.org/docs/pages/StorageTexture.html.md) +- [Texture](https://threejs.org/docs/pages/Texture.html.md) +- [VOXData3DTexture](https://threejs.org/docs/pages/VOXData3DTexture.html.md) +- [VideoFrameTexture](https://threejs.org/docs/pages/VideoFrameTexture.html.md) +- [VideoTexture](https://threejs.org/docs/pages/VideoTexture.html.md) + +### Loaders + +- [AMFLoader](https://threejs.org/docs/pages/AMFLoader.html.md) +- [AnimationLoader](https://threejs.org/docs/pages/AnimationLoader.html.md) +- [AudioLoader](https://threejs.org/docs/pages/AudioLoader.html.md) +- [BVHLoader](https://threejs.org/docs/pages/BVHLoader.html.md) +- [BufferGeometryLoader](https://threejs.org/docs/pages/BufferGeometryLoader.html.md) +- [ColladaLoader](https://threejs.org/docs/pages/ColladaLoader.html.md) +- [CompressedTextureLoader](https://threejs.org/docs/pages/CompressedTextureLoader.html.md) +- [CubeTextureLoader](https://threejs.org/docs/pages/CubeTextureLoader.html.md) +- [DDSLoader](https://threejs.org/docs/pages/DDSLoader.html.md) +- [DRACOLoader](https://threejs.org/docs/pages/DRACOLoader.html.md) +- [DataTextureLoader](https://threejs.org/docs/pages/DataTextureLoader.html.md) +- [EXRLoader](https://threejs.org/docs/pages/EXRLoader.html.md) +- [FBXLoader](https://threejs.org/docs/pages/FBXLoader.html.md) +- [FileLoader](https://threejs.org/docs/pages/FileLoader.html.md) +- [FontLoader](https://threejs.org/docs/pages/FontLoader.html.md) +- [GCodeLoader](https://threejs.org/docs/pages/GCodeLoader.html.md) +- [GLTFLoader](https://threejs.org/docs/pages/GLTFLoader.html.md) +- [HDRCubeTextureLoader](https://threejs.org/docs/pages/HDRCubeTextureLoader.html.md) +- [HDRLoader](https://threejs.org/docs/pages/HDRLoader.html.md) +- [IESLoader](https://threejs.org/docs/pages/IESLoader.html.md) +- [ImageBitmapLoader](https://threejs.org/docs/pages/ImageBitmapLoader.html.md) +- [ImageLoader](https://threejs.org/docs/pages/ImageLoader.html.md) +- [KMZLoader](https://threejs.org/docs/pages/KMZLoader.html.md) +- [KTX2Loader](https://threejs.org/docs/pages/KTX2Loader.html.md) +- [KTXLoader](https://threejs.org/docs/pages/KTXLoader.html.md) +- [LDrawLoader](https://threejs.org/docs/pages/LDrawLoader.html.md) +- [LUT3dlLoader](https://threejs.org/docs/pages/LUT3dlLoader.html.md) +- [LUTCubeLoader](https://threejs.org/docs/pages/LUTCubeLoader.html.md) +- [LUTImageLoader](https://threejs.org/docs/pages/LUTImageLoader.html.md) +- [LWOLoader](https://threejs.org/docs/pages/LWOLoader.html.md) +- [Loader](https://threejs.org/docs/pages/Loader.html.md) +- [LottieLoader](https://threejs.org/docs/pages/LottieLoader.html.md) +- [MD2Loader](https://threejs.org/docs/pages/MD2Loader.html.md) +- [MDDLoader](https://threejs.org/docs/pages/MDDLoader.html.md) +- [MTLLoader](https://threejs.org/docs/pages/MTLLoader.html.md) +- [MaterialLoader](https://threejs.org/docs/pages/MaterialLoader.html.md) +- [MaterialXLoader](https://threejs.org/docs/pages/MaterialXLoader.html.md) +- [NRRDLoader](https://threejs.org/docs/pages/NRRDLoader.html.md) +- [NodeLoader](https://threejs.org/docs/pages/NodeLoader.html.md) +- [NodeMaterialLoader](https://threejs.org/docs/pages/NodeMaterialLoader.html.md) +- [NodeObjectLoader](https://threejs.org/docs/pages/NodeObjectLoader.html.md) +- [OBJLoader](https://threejs.org/docs/pages/OBJLoader.html.md) +- [ObjectLoader](https://threejs.org/docs/pages/ObjectLoader.html.md) +- [PCDLoader](https://threejs.org/docs/pages/PCDLoader.html.md) +- [PDBLoader](https://threejs.org/docs/pages/PDBLoader.html.md) +- [PLYLoader](https://threejs.org/docs/pages/PLYLoader.html.md) +- [PVRLoader](https://threejs.org/docs/pages/PVRLoader.html.md) +- [Rhino3dmLoader](https://threejs.org/docs/pages/Rhino3dmLoader.html.md) +- [STLLoader](https://threejs.org/docs/pages/STLLoader.html.md) +- [SVGLoader](https://threejs.org/docs/pages/SVGLoader.html.md) +- [TDSLoader](https://threejs.org/docs/pages/TDSLoader.html.md) +- [TGALoader](https://threejs.org/docs/pages/TGALoader.html.md) +- [TIFFLoader](https://threejs.org/docs/pages/TIFFLoader.html.md) +- [TTFLoader](https://threejs.org/docs/pages/TTFLoader.html.md) +- [TextureLoader](https://threejs.org/docs/pages/TextureLoader.html.md) +- [ThreeMFLoader](https://threejs.org/docs/pages/ThreeMFLoader.html.md) +- [USDLoader](https://threejs.org/docs/pages/USDLoader.html.md) +- [UltraHDRLoader](https://threejs.org/docs/pages/UltraHDRLoader.html.md) +- [VOXLoader](https://threejs.org/docs/pages/VOXLoader.html.md) +- [VRMLLoader](https://threejs.org/docs/pages/VRMLLoader.html.md) +- [VTKLoader](https://threejs.org/docs/pages/VTKLoader.html.md) +- [XYZLoader](https://threejs.org/docs/pages/XYZLoader.html.md) + +### Controls + +- [ArcballControls](https://threejs.org/docs/pages/ArcballControls.html.md) +- [Controls](https://threejs.org/docs/pages/Controls.html.md) +- [DragControls](https://threejs.org/docs/pages/DragControls.html.md) +- [FirstPersonControls](https://threejs.org/docs/pages/FirstPersonControls.html.md) +- [FlyControls](https://threejs.org/docs/pages/FlyControls.html.md) +- [MapControls](https://threejs.org/docs/pages/MapControls.html.md) +- [OrbitControls](https://threejs.org/docs/pages/OrbitControls.html.md) +- [PointerLockControls](https://threejs.org/docs/pages/PointerLockControls.html.md) +- [TrackballControls](https://threejs.org/docs/pages/TrackballControls.html.md) +- [TransformControls](https://threejs.org/docs/pages/TransformControls.html.md) + +### Helpers + +- [ArrowHelper](https://threejs.org/docs/pages/ArrowHelper.html.md) +- [AxesHelper](https://threejs.org/docs/pages/AxesHelper.html.md) +- [Box3Helper](https://threejs.org/docs/pages/Box3Helper.html.md) +- [BoxHelper](https://threejs.org/docs/pages/BoxHelper.html.md) +- [CCDIKHelper](https://threejs.org/docs/pages/CCDIKHelper.html.md) +- [CSMHelper](https://threejs.org/docs/pages/CSMHelper.html.md) +- [CameraHelper](https://threejs.org/docs/pages/CameraHelper.html.md) +- [DirectionalLightHelper](https://threejs.org/docs/pages/DirectionalLightHelper.html.md) +- [GridHelper](https://threejs.org/docs/pages/GridHelper.html.md) +- [HemisphereLightHelper](https://threejs.org/docs/pages/HemisphereLightHelper.html.md) +- [LightProbeHelper](https://threejs.org/docs/pages/LightProbeHelper.html.md) +- [OctreeHelper](https://threejs.org/docs/pages/OctreeHelper.html.md) +- [PlaneHelper](https://threejs.org/docs/pages/PlaneHelper.html.md) +- [PointLightHelper](https://threejs.org/docs/pages/PointLightHelper.html.md) +- [PolarGridHelper](https://threejs.org/docs/pages/PolarGridHelper.html.md) +- [PositionalAudioHelper](https://threejs.org/docs/pages/PositionalAudioHelper.html.md) +- [RapierHelper](https://threejs.org/docs/pages/RapierHelper.html.md) +- [RectAreaLightHelper](https://threejs.org/docs/pages/RectAreaLightHelper.html.md) +- [SelectionHelper](https://threejs.org/docs/pages/SelectionHelper.html.md) +- [SkeletonHelper](https://threejs.org/docs/pages/SkeletonHelper.html.md) +- [SpotLightHelper](https://threejs.org/docs/pages/SpotLightHelper.html.md) +- [TextureHelper](https://threejs.org/docs/pages/TextureHelper.html.md) +- [TileShadowNodeHelper](https://threejs.org/docs/pages/TileShadowNodeHelper.html.md) +- [VertexNormalsHelper](https://threejs.org/docs/pages/VertexNormalsHelper.html.md) +- [VertexTangentsHelper](https://threejs.org/docs/pages/VertexTangentsHelper.html.md) +- [ViewHelper](https://threejs.org/docs/pages/ViewHelper.html.md) + +### Animation + +- [AnimationAction](https://threejs.org/docs/pages/AnimationAction.html.md) +- [AnimationClip](https://threejs.org/docs/pages/AnimationClip.html.md) +- [AnimationClipCreator](https://threejs.org/docs/pages/AnimationClipCreator.html.md) +- [AnimationMixer](https://threejs.org/docs/pages/AnimationMixer.html.md) +- [AnimationObjectGroup](https://threejs.org/docs/pages/AnimationObjectGroup.html.md) +- [AnimationUtils](https://threejs.org/docs/pages/AnimationUtils.html.md) + +### Audio + +- [Audio](https://threejs.org/docs/pages/Audio.html.md) +- [AudioAnalyser](https://threejs.org/docs/pages/AudioAnalyser.html.md) +- [AudioContext](https://threejs.org/docs/pages/AudioContext.html.md) +- [AudioListener](https://threejs.org/docs/pages/AudioListener.html.md) +- [PositionalAudio](https://threejs.org/docs/pages/PositionalAudio.html.md) + +### Math + +- [Box2](https://threejs.org/docs/pages/Box2.html.md) +- [Box3](https://threejs.org/docs/pages/Box3.html.md) +- [Color](https://threejs.org/docs/pages/Color.html.md) +- [Euler](https://threejs.org/docs/pages/Euler.html.md) +- [Frustum](https://threejs.org/docs/pages/Frustum.html.md) +- [FrustumArray](https://threejs.org/docs/pages/FrustumArray.html.md) +- [Matrix2](https://threejs.org/docs/pages/Matrix2.html.md) +- [Matrix3](https://threejs.org/docs/pages/Matrix3.html.md) +- [Matrix4](https://threejs.org/docs/pages/Matrix4.html.md) +- [Plane](https://threejs.org/docs/pages/Plane.html.md) +- [Quaternion](https://threejs.org/docs/pages/Quaternion.html.md) +- [QuaternionKeyframeTrack](https://threejs.org/docs/pages/QuaternionKeyframeTrack.html.md) +- [QuaternionLinearInterpolant](https://threejs.org/docs/pages/QuaternionLinearInterpolant.html.md) +- [Ray](https://threejs.org/docs/pages/Ray.html.md) +- [Raycaster](https://threejs.org/docs/pages/Raycaster.html.md) +- [Sphere](https://threejs.org/docs/pages/Sphere.html.md) +- [Triangle](https://threejs.org/docs/pages/Triangle.html.md) +- [Vector2](https://threejs.org/docs/pages/Vector2.html.md) +- [Vector3](https://threejs.org/docs/pages/Vector3.html.md) +- [Vector4](https://threejs.org/docs/pages/Vector4.html.md) +- [VectorKeyframeTrack](https://threejs.org/docs/pages/VectorKeyframeTrack.html.md) + +### Curves + +- [ArcCurve](https://threejs.org/docs/pages/ArcCurve.html.md) +- [CatmullRomCurve3](https://threejs.org/docs/pages/CatmullRomCurve3.html.md) +- [CubicBezierCurve](https://threejs.org/docs/pages/CubicBezierCurve.html.md) +- [CubicBezierCurve3](https://threejs.org/docs/pages/CubicBezierCurve3.html.md) +- [Curve](https://threejs.org/docs/pages/Curve.html.md) +- [CurvePath](https://threejs.org/docs/pages/CurvePath.html.md) +- [EllipseCurve](https://threejs.org/docs/pages/EllipseCurve.html.md) +- [HeartCurve](https://threejs.org/docs/pages/HeartCurve.html.md) +- [HelixCurve](https://threejs.org/docs/pages/HelixCurve.html.md) +- [KnotCurve](https://threejs.org/docs/pages/KnotCurve.html.md) +- [LineCurve](https://threejs.org/docs/pages/LineCurve.html.md) +- [LineCurve3](https://threejs.org/docs/pages/LineCurve3.html.md) +- [NURBSCurve](https://threejs.org/docs/pages/NURBSCurve.html.md) +- [QuadraticBezierCurve](https://threejs.org/docs/pages/QuadraticBezierCurve.html.md) +- [QuadraticBezierCurve3](https://threejs.org/docs/pages/QuadraticBezierCurve3.html.md) +- [SplineCurve](https://threejs.org/docs/pages/SplineCurve.html.md) +- [VivianiCurve](https://threejs.org/docs/pages/VivianiCurve.html.md) + +### Effects + +- [AnaglyphEffect](https://threejs.org/docs/pages/AnaglyphEffect.html.md) +- [AsciiEffect](https://threejs.org/docs/pages/AsciiEffect.html.md) +- [OutlineEffect](https://threejs.org/docs/pages/OutlineEffect.html.md) +- [ParallaxBarrierEffect](https://threejs.org/docs/pages/ParallaxBarrierEffect.html.md) +- [StereoEffect](https://threejs.org/docs/pages/StereoEffect.html.md) + +### Post-Processing + +- [AfterimagePass](https://threejs.org/docs/pages/AfterimagePass.html.md) +- [AnaglyphPassNode](https://threejs.org/docs/pages/AnaglyphPassNode.html.md) +- [BloomPass](https://threejs.org/docs/pages/BloomPass.html.md) +- [BokehPass](https://threejs.org/docs/pages/BokehPass.html.md) +- [ClearMaskPass](https://threejs.org/docs/pages/ClearMaskPass.html.md) +- [ClearPass](https://threejs.org/docs/pages/ClearPass.html.md) +- [CubeTexturePass](https://threejs.org/docs/pages/CubeTexturePass.html.md) +- [DotScreenPass](https://threejs.org/docs/pages/DotScreenPass.html.md) +- [FXAAPass](https://threejs.org/docs/pages/FXAAPass.html.md) +- [FilmPass](https://threejs.org/docs/pages/FilmPass.html.md) +- [GTAOPass](https://threejs.org/docs/pages/GTAOPass.html.md) +- [GlitchPass](https://threejs.org/docs/pages/GlitchPass.html.md) +- [HalftonePass](https://threejs.org/docs/pages/HalftonePass.html.md) +- [LUTPass](https://threejs.org/docs/pages/LUTPass.html.md) +- [MaskPass](https://threejs.org/docs/pages/MaskPass.html.md) +- [OutlinePass](https://threejs.org/docs/pages/OutlinePass.html.md) +- [OutputPass](https://threejs.org/docs/pages/OutputPass.html.md) +- [ParallaxBarrierPassNode](https://threejs.org/docs/pages/ParallaxBarrierPassNode.html.md) +- [Pass](https://threejs.org/docs/pages/Pass.html.md) +- [PassNode](https://threejs.org/docs/pages/PassNode.html.md) +- [PixelationPassNode](https://threejs.org/docs/pages/PixelationPassNode.html.md) +- [ReflectorForSSRPass](https://threejs.org/docs/pages/ReflectorForSSRPass.html.md) +- [RenderPass](https://threejs.org/docs/pages/RenderPass.html.md) +- [RenderPixelatedPass](https://threejs.org/docs/pages/RenderPixelatedPass.html.md) +- [RenderTransitionPass](https://threejs.org/docs/pages/RenderTransitionPass.html.md) +- [SAOPass](https://threejs.org/docs/pages/SAOPass.html.md) +- [SMAAPass](https://threejs.org/docs/pages/SMAAPass.html.md) +- [SSAAPassNode](https://threejs.org/docs/pages/SSAAPassNode.html.md) +- [SSAARenderPass](https://threejs.org/docs/pages/SSAARenderPass.html.md) +- [SSAOPass](https://threejs.org/docs/pages/SSAOPass.html.md) +- [SSRPass](https://threejs.org/docs/pages/SSRPass.html.md) +- [SavePass](https://threejs.org/docs/pages/SavePass.html.md) +- [ShaderPass](https://threejs.org/docs/pages/ShaderPass.html.md) +- [StereoCompositePassNode](https://threejs.org/docs/pages/StereoCompositePassNode.html.md) +- [StereoPassNode](https://threejs.org/docs/pages/StereoPassNode.html.md) +- [TAARenderPass](https://threejs.org/docs/pages/TAARenderPass.html.md) +- [TexturePass](https://threejs.org/docs/pages/TexturePass.html.md) +- [ToonOutlinePassNode](https://threejs.org/docs/pages/ToonOutlinePassNode.html.md) +- [UnrealBloomPass](https://threejs.org/docs/pages/UnrealBloomPass.html.md) + +### Nodes (TSL) + +- [AONode](https://threejs.org/docs/pages/AONode.html.md) +- [AfterImageNode](https://threejs.org/docs/pages/AfterImageNode.html.md) +- [AmbientLightNode](https://threejs.org/docs/pages/AmbientLightNode.html.md) +- [AnalyticLightNode](https://threejs.org/docs/pages/AnalyticLightNode.html.md) +- [AnamorphicNode](https://threejs.org/docs/pages/AnamorphicNode.html.md) +- [ArrayElementNode](https://threejs.org/docs/pages/ArrayElementNode.html.md) +- [ArrayNode](https://threejs.org/docs/pages/ArrayNode.html.md) +- [AssignNode](https://threejs.org/docs/pages/AssignNode.html.md) +- [AtomicFunctionNode](https://threejs.org/docs/pages/AtomicFunctionNode.html.md) +- [AttributeNode](https://threejs.org/docs/pages/AttributeNode.html.md) +- [BarrierNode](https://threejs.org/docs/pages/BarrierNode.html.md) +- [BasicEnvironmentNode](https://threejs.org/docs/pages/BasicEnvironmentNode.html.md) +- [BasicLightMapNode](https://threejs.org/docs/pages/BasicLightMapNode.html.md) +- [BatchNode](https://threejs.org/docs/pages/BatchNode.html.md) +- [BitcastNode](https://threejs.org/docs/pages/BitcastNode.html.md) +- [BitcountNode](https://threejs.org/docs/pages/BitcountNode.html.md) +- [BloomNode](https://threejs.org/docs/pages/BloomNode.html.md) +- [BufferAttributeNode](https://threejs.org/docs/pages/BufferAttributeNode.html.md) +- [BufferNode](https://threejs.org/docs/pages/BufferNode.html.md) +- [BuiltinNode](https://threejs.org/docs/pages/BuiltinNode.html.md) +- [BumpMapNode](https://threejs.org/docs/pages/BumpMapNode.html.md) +- [BypassNode](https://threejs.org/docs/pages/BypassNode.html.md) +- [CSMShadowNode](https://threejs.org/docs/pages/CSMShadowNode.html.md) +- [ChromaticAberrationNode](https://threejs.org/docs/pages/ChromaticAberrationNode.html.md) +- [ClippingNode](https://threejs.org/docs/pages/ClippingNode.html.md) +- [CodeNode](https://threejs.org/docs/pages/CodeNode.html.md) +- [ColorSpaceNode](https://threejs.org/docs/pages/ColorSpaceNode.html.md) +- [ComputeBuiltinNode](https://threejs.org/docs/pages/ComputeBuiltinNode.html.md) +- [ComputeNode](https://threejs.org/docs/pages/ComputeNode.html.md) +- [ConditionalNode](https://threejs.org/docs/pages/ConditionalNode.html.md) +- [ConstNode](https://threejs.org/docs/pages/ConstNode.html.md) +- [ContextNode](https://threejs.org/docs/pages/ContextNode.html.md) +- [ConvertNode](https://threejs.org/docs/pages/ConvertNode.html.md) +- [CubeMapNode](https://threejs.org/docs/pages/CubeMapNode.html.md) +- [CubeTextureNode](https://threejs.org/docs/pages/CubeTextureNode.html.md) +- [DenoiseNode](https://threejs.org/docs/pages/DenoiseNode.html.md) +- [DepthOfFieldNode](https://threejs.org/docs/pages/DepthOfFieldNode.html.md) +- [DirectionalLightNode](https://threejs.org/docs/pages/DirectionalLightNode.html.md) +- [DotScreenNode](https://threejs.org/docs/pages/DotScreenNode.html.md) +- [EnvironmentNode](https://threejs.org/docs/pages/EnvironmentNode.html.md) +- [EventNode](https://threejs.org/docs/pages/EventNode.html.md) +- [ExpressionNode](https://threejs.org/docs/pages/ExpressionNode.html.md) +- [FXAANode](https://threejs.org/docs/pages/FXAANode.html.md) +- [FilmNode](https://threejs.org/docs/pages/FilmNode.html.md) +- [FlipNode](https://threejs.org/docs/pages/FlipNode.html.md) +- [FrontFacingNode](https://threejs.org/docs/pages/FrontFacingNode.html.md) +- [FunctionCallNode](https://threejs.org/docs/pages/FunctionCallNode.html.md) +- [FunctionNode](https://threejs.org/docs/pages/FunctionNode.html.md) +- [FunctionOverloadingNode](https://threejs.org/docs/pages/FunctionOverloadingNode.html.md) +- [GTAONode](https://threejs.org/docs/pages/GTAONode.html.md) +- [GaussianBlurNode](https://threejs.org/docs/pages/GaussianBlurNode.html.md) +- [HemisphereLightNode](https://threejs.org/docs/pages/HemisphereLightNode.html.md) +- [IESSpotLightNode](https://threejs.org/docs/pages/IESSpotLightNode.html.md) +- [IndexNode](https://threejs.org/docs/pages/IndexNode.html.md) +- [InputNode](https://threejs.org/docs/pages/InputNode.html.md) +- [InspectorNode](https://threejs.org/docs/pages/InspectorNode.html.md) +- [InstanceNode](https://threejs.org/docs/pages/InstanceNode.html.md) +- [InstancedMeshNode](https://threejs.org/docs/pages/InstancedMeshNode.html.md) +- [IrradianceNode](https://threejs.org/docs/pages/IrradianceNode.html.md) +- [IsolateNode](https://threejs.org/docs/pages/IsolateNode.html.md) +- [JoinNode](https://threejs.org/docs/pages/JoinNode.html.md) +- [LensflareNode](https://threejs.org/docs/pages/LensflareNode.html.md) +- [LightProbeNode](https://threejs.org/docs/pages/LightProbeNode.html.md) +- [LightingContextNode](https://threejs.org/docs/pages/LightingContextNode.html.md) +- [LightingNode](https://threejs.org/docs/pages/LightingNode.html.md) +- [LightsNode](https://threejs.org/docs/pages/LightsNode.html.md) +- [LoopNode](https://threejs.org/docs/pages/LoopNode.html.md) +- [Lut3DNode](https://threejs.org/docs/pages/Lut3DNode.html.md) +- [MRTNode](https://threejs.org/docs/pages/MRTNode.html.md) +- [MaterialNode](https://threejs.org/docs/pages/MaterialNode.html.md) +- [MaterialReferenceNode](https://threejs.org/docs/pages/MaterialReferenceNode.html.md) +- [MathNode](https://threejs.org/docs/pages/MathNode.html.md) +- [MaxMipLevelNode](https://threejs.org/docs/pages/MaxMipLevelNode.html.md) +- [MemberNode](https://threejs.org/docs/pages/MemberNode.html.md) +- [ModelNode](https://threejs.org/docs/pages/ModelNode.html.md) +- [MorphNode](https://threejs.org/docs/pages/MorphNode.html.md) +- [Node](https://threejs.org/docs/pages/Node.html.md) +- [NormalMapNode](https://threejs.org/docs/pages/NormalMapNode.html.md) +- [Object3DNode](https://threejs.org/docs/pages/Object3DNode.html.md) +- [OperatorNode](https://threejs.org/docs/pages/OperatorNode.html.md) +- [OutlineNode](https://threejs.org/docs/pages/OutlineNode.html.md) +- [OutputStructNode](https://threejs.org/docs/pages/OutputStructNode.html.md) +- [PMREMNode](https://threejs.org/docs/pages/PMREMNode.html.md) +- [PackFloatNode](https://threejs.org/docs/pages/PackFloatNode.html.md) +- [ParameterNode](https://threejs.org/docs/pages/ParameterNode.html.md) +- [PassMultipleTextureNode](https://threejs.org/docs/pages/PassMultipleTextureNode.html.md) +- [PassTextureNode](https://threejs.org/docs/pages/PassTextureNode.html.md) +- [PixelationNode](https://threejs.org/docs/pages/PixelationNode.html.md) +- [PointLightNode](https://threejs.org/docs/pages/PointLightNode.html.md) +- [PointShadowNode](https://threejs.org/docs/pages/PointShadowNode.html.md) +- [PointUVNode](https://threejs.org/docs/pages/PointUVNode.html.md) +- [PosterizeNode](https://threejs.org/docs/pages/PosterizeNode.html.md) +- [ProjectorLightNode](https://threejs.org/docs/pages/ProjectorLightNode.html.md) +- [PropertyNode](https://threejs.org/docs/pages/PropertyNode.html.md) +- [RGBShiftNode](https://threejs.org/docs/pages/RGBShiftNode.html.md) +- [RTTNode](https://threejs.org/docs/pages/RTTNode.html.md) +- [RangeNode](https://threejs.org/docs/pages/RangeNode.html.md) +- [RectAreaLightNode](https://threejs.org/docs/pages/RectAreaLightNode.html.md) +- [ReferenceBaseNode](https://threejs.org/docs/pages/ReferenceBaseNode.html.md) +- [ReferenceElementNode](https://threejs.org/docs/pages/ReferenceElementNode.html.md) +- [ReferenceNode](https://threejs.org/docs/pages/ReferenceNode.html.md) +- [ReflectorNode](https://threejs.org/docs/pages/ReflectorNode.html.md) +- [RemapNode](https://threejs.org/docs/pages/RemapNode.html.md) +- [RenderOutputNode](https://threejs.org/docs/pages/RenderOutputNode.html.md) +- [RendererReferenceNode](https://threejs.org/docs/pages/RendererReferenceNode.html.md) +- [RotateNode](https://threejs.org/docs/pages/RotateNode.html.md) +- [SMAANode](https://threejs.org/docs/pages/SMAANode.html.md) +- [SSGINode](https://threejs.org/docs/pages/SSGINode.html.md) +- [SSRNode](https://threejs.org/docs/pages/SSRNode.html.md) +- [SSSNode](https://threejs.org/docs/pages/SSSNode.html.md) +- [SampleNode](https://threejs.org/docs/pages/SampleNode.html.md) +- [SceneNode](https://threejs.org/docs/pages/SceneNode.html.md) +- [ScreenNode](https://threejs.org/docs/pages/ScreenNode.html.md) +- [ScriptableNode](https://threejs.org/docs/pages/ScriptableNode.html.md) +- [ScriptableValueNode](https://threejs.org/docs/pages/ScriptableValueNode.html.md) +- [SetNode](https://threejs.org/docs/pages/SetNode.html.md) +- [ShadowBaseNode](https://threejs.org/docs/pages/ShadowBaseNode.html.md) +- [ShadowNode](https://threejs.org/docs/pages/ShadowNode.html.md) +- [SkinningNode](https://threejs.org/docs/pages/SkinningNode.html.md) +- [SobelOperatorNode](https://threejs.org/docs/pages/SobelOperatorNode.html.md) +- [SplitNode](https://threejs.org/docs/pages/SplitNode.html.md) +- [SpotLightNode](https://threejs.org/docs/pages/SpotLightNode.html.md) +- [SpriteSheetUVNode](https://threejs.org/docs/pages/SpriteSheetUVNode.html.md) +- [StackNode](https://threejs.org/docs/pages/StackNode.html.md) +- [StorageArrayElementNode](https://threejs.org/docs/pages/StorageArrayElementNode.html.md) +- [StorageBufferNode](https://threejs.org/docs/pages/StorageBufferNode.html.md) +- [StorageTextureNode](https://threejs.org/docs/pages/StorageTextureNode.html.md) +- [StructNode](https://threejs.org/docs/pages/StructNode.html.md) +- [StructTypeNode](https://threejs.org/docs/pages/StructTypeNode.html.md) +- [SubBuildNode](https://threejs.org/docs/pages/SubBuildNode.html.md) +- [SubgroupFunctionNode](https://threejs.org/docs/pages/SubgroupFunctionNode.html.md) +- [TRAANode](https://threejs.org/docs/pages/TRAANode.html.md) +- [TempNode](https://threejs.org/docs/pages/TempNode.html.md) +- [Texture3DNode](https://threejs.org/docs/pages/Texture3DNode.html.md) +- [TextureNode](https://threejs.org/docs/pages/TextureNode.html.md) +- [TextureSizeNode](https://threejs.org/docs/pages/TextureSizeNode.html.md) +- [TileShadowNode](https://threejs.org/docs/pages/TileShadowNode.html.md) +- [TiledLightsNode](https://threejs.org/docs/pages/TiledLightsNode.html.md) +- [ToneMappingNode](https://threejs.org/docs/pages/ToneMappingNode.html.md) +- [TransitionNode](https://threejs.org/docs/pages/TransitionNode.html.md) +- [UniformArrayElementNode](https://threejs.org/docs/pages/UniformArrayElementNode.html.md) +- [UniformArrayNode](https://threejs.org/docs/pages/UniformArrayNode.html.md) +- [UniformGroupNode](https://threejs.org/docs/pages/UniformGroupNode.html.md) +- [UniformNode](https://threejs.org/docs/pages/UniformNode.html.md) +- [UnpackFloatNode](https://threejs.org/docs/pages/UnpackFloatNode.html.md) +- [UserDataNode](https://threejs.org/docs/pages/UserDataNode.html.md) +- [VarNode](https://threejs.org/docs/pages/VarNode.html.md) +- [VaryingNode](https://threejs.org/docs/pages/VaryingNode.html.md) +- [VelocityNode](https://threejs.org/docs/pages/VelocityNode.html.md) +- [VertexColorNode](https://threejs.org/docs/pages/VertexColorNode.html.md) +- [ViewportDepthNode](https://threejs.org/docs/pages/ViewportDepthNode.html.md) +- [ViewportDepthTextureNode](https://threejs.org/docs/pages/ViewportDepthTextureNode.html.md) +- [ViewportSharedTextureNode](https://threejs.org/docs/pages/ViewportSharedTextureNode.html.md) +- [ViewportTextureNode](https://threejs.org/docs/pages/ViewportTextureNode.html.md) +- [WorkgroupInfoElementNode](https://threejs.org/docs/pages/WorkgroupInfoElementNode.html.md) +- [WorkgroupInfoNode](https://threejs.org/docs/pages/WorkgroupInfoNode.html.md) + +### WebXR + +- [EXRExporter](https://threejs.org/docs/pages/EXRExporter.html.md) +- [WebXRDepthSensing](https://threejs.org/docs/pages/WebXRDepthSensing.html.md) +- [WebXRManager](https://threejs.org/docs/pages/WebXRManager.html.md) +- [XRButton](https://threejs.org/docs/pages/XRButton.html.md) +- [XRControllerModel](https://threejs.org/docs/pages/XRControllerModel.html.md) +- [XRControllerModelFactory](https://threejs.org/docs/pages/XRControllerModelFactory.html.md) +- [XRHandMeshModel](https://threejs.org/docs/pages/XRHandMeshModel.html.md) +- [XRHandModel](https://threejs.org/docs/pages/XRHandModel.html.md) +- [XRHandModelFactory](https://threejs.org/docs/pages/XRHandModelFactory.html.md) +- [XRHandPrimitiveModel](https://threejs.org/docs/pages/XRHandPrimitiveModel.html.md) +- [XRManager](https://threejs.org/docs/pages/XRManager.html.md) +- [XRPlanes](https://threejs.org/docs/pages/XRPlanes.html.md) + +### Shader Modules + +- [module-ACESFilmicToneMappingShader](https://threejs.org/docs/pages/module-ACESFilmicToneMappingShader.html.md) +- [module-AfterimageShader](https://threejs.org/docs/pages/module-AfterimageShader.html.md) +- [module-BasicShader](https://threejs.org/docs/pages/module-BasicShader.html.md) +- [module-Bayer](https://threejs.org/docs/pages/module-Bayer.html.md) +- [module-BleachBypassShader](https://threejs.org/docs/pages/module-BleachBypassShader.html.md) +- [module-BlendShader](https://threejs.org/docs/pages/module-BlendShader.html.md) +- [module-BokehShader](https://threejs.org/docs/pages/module-BokehShader.html.md) +- [module-BokehShader2](https://threejs.org/docs/pages/module-BokehShader2.html.md) +- [module-BrightnessContrastShader](https://threejs.org/docs/pages/module-BrightnessContrastShader.html.md) +- [module-BufferGeometryUtils](https://threejs.org/docs/pages/module-BufferGeometryUtils.html.md) +- [module-CSMShader](https://threejs.org/docs/pages/module-CSMShader.html.md) +- [module-CameraUtils](https://threejs.org/docs/pages/module-CameraUtils.html.md) +- [module-ColorCorrectionShader](https://threejs.org/docs/pages/module-ColorCorrectionShader.html.md) +- [module-ColorSpaces](https://threejs.org/docs/pages/module-ColorSpaces.html.md) +- [module-ColorifyShader](https://threejs.org/docs/pages/module-ColorifyShader.html.md) +- [module-ConvolutionShader](https://threejs.org/docs/pages/module-ConvolutionShader.html.md) +- [module-CopyShader](https://threejs.org/docs/pages/module-CopyShader.html.md) +- [module-DOFMipMapShader](https://threejs.org/docs/pages/module-DOFMipMapShader.html.md) +- [module-DepthLimitedBlurShader](https://threejs.org/docs/pages/module-DepthLimitedBlurShader.html.md) +- [module-DigitalGlitch](https://threejs.org/docs/pages/module-DigitalGlitch.html.md) +- [module-DotScreenShader](https://threejs.org/docs/pages/module-DotScreenShader.html.md) +- [module-ExposureShader](https://threejs.org/docs/pages/module-ExposureShader.html.md) +- [module-FXAAShader](https://threejs.org/docs/pages/module-FXAAShader.html.md) +- [module-FilmShader](https://threejs.org/docs/pages/module-FilmShader.html.md) +- [module-FocusShader](https://threejs.org/docs/pages/module-FocusShader.html.md) +- [module-FreiChenShader](https://threejs.org/docs/pages/module-FreiChenShader.html.md) +- [module-GTAOShader](https://threejs.org/docs/pages/module-GTAOShader.html.md) +- [module-GammaCorrectionShader](https://threejs.org/docs/pages/module-GammaCorrectionShader.html.md) +- [module-GeometryCompressionUtils](https://threejs.org/docs/pages/module-GeometryCompressionUtils.html.md) +- [module-GeometryUtils](https://threejs.org/docs/pages/module-GeometryUtils.html.md) +- [module-GodRaysShader](https://threejs.org/docs/pages/module-GodRaysShader.html.md) +- [module-HalftoneShader](https://threejs.org/docs/pages/module-HalftoneShader.html.md) +- [module-HorizontalBlurShader](https://threejs.org/docs/pages/module-HorizontalBlurShader.html.md) +- [module-HorizontalTiltShiftShader](https://threejs.org/docs/pages/module-HorizontalTiltShiftShader.html.md) +- [module-HueSaturationShader](https://threejs.org/docs/pages/module-HueSaturationShader.html.md) +- [module-Interpolations](https://threejs.org/docs/pages/module-Interpolations.html.md) +- [module-KaleidoShader](https://threejs.org/docs/pages/module-KaleidoShader.html.md) +- [module-LuminosityHighPassShader](https://threejs.org/docs/pages/module-LuminosityHighPassShader.html.md) +- [module-LuminosityShader](https://threejs.org/docs/pages/module-LuminosityShader.html.md) +- [module-MirrorShader](https://threejs.org/docs/pages/module-MirrorShader.html.md) +- [module-NURBSUtils](https://threejs.org/docs/pages/module-NURBSUtils.html.md) +- [module-NormalMapShader](https://threejs.org/docs/pages/module-NormalMapShader.html.md) +- [module-OutputShader](https://threejs.org/docs/pages/module-OutputShader.html.md) +- [module-ParametricFunctions](https://threejs.org/docs/pages/module-ParametricFunctions.html.md) +- [module-PoissonDenoiseShader](https://threejs.org/docs/pages/module-PoissonDenoiseShader.html.md) +- [module-RGBShiftShader](https://threejs.org/docs/pages/module-RGBShiftShader.html.md) +- [module-Raymarching](https://threejs.org/docs/pages/module-Raymarching.html.md) +- [module-SAOShader](https://threejs.org/docs/pages/module-SAOShader.html.md) +- [module-SMAAShader](https://threejs.org/docs/pages/module-SMAAShader.html.md) +- [module-SSAOShader](https://threejs.org/docs/pages/module-SSAOShader.html.md) +- [module-SSRShader](https://threejs.org/docs/pages/module-SSRShader.html.md) +- [module-SceneUtils](https://threejs.org/docs/pages/module-SceneUtils.html.md) +- [module-SepiaShader](https://threejs.org/docs/pages/module-SepiaShader.html.md) +- [module-SkeletonUtils](https://threejs.org/docs/pages/module-SkeletonUtils.html.md) +- [module-SobelOperatorShader](https://threejs.org/docs/pages/module-SobelOperatorShader.html.md) +- [module-SortUtils](https://threejs.org/docs/pages/module-SortUtils.html.md) +- [module-SubsurfaceScatteringShader](https://threejs.org/docs/pages/module-SubsurfaceScatteringShader.html.md) +- [module-Text2D](https://threejs.org/docs/pages/module-Text2D.html.md) +- [module-TriangleBlurShader](https://threejs.org/docs/pages/module-TriangleBlurShader.html.md) +- [module-UVsDebug](https://threejs.org/docs/pages/module-UVsDebug.html.md) +- [module-UniformsUtils](https://threejs.org/docs/pages/module-UniformsUtils.html.md) +- [module-UnpackDepthRGBAShader](https://threejs.org/docs/pages/module-UnpackDepthRGBAShader.html.md) +- [module-VelocityShader](https://threejs.org/docs/pages/module-VelocityShader.html.md) +- [module-VerticalBlurShader](https://threejs.org/docs/pages/module-VerticalBlurShader.html.md) +- [module-VerticalTiltShiftShader](https://threejs.org/docs/pages/module-VerticalTiltShiftShader.html.md) +- [module-VignetteShader](https://threejs.org/docs/pages/module-VignetteShader.html.md) +- [module-VolumeShader](https://threejs.org/docs/pages/module-VolumeShader.html.md) +- [module-WaterRefractionShader](https://threejs.org/docs/pages/module-WaterRefractionShader.html.md) +- [module-WebGLTextureUtils](https://threejs.org/docs/pages/module-WebGLTextureUtils.html.md) +- [module-WebGPUTextureUtils](https://threejs.org/docs/pages/module-WebGPUTextureUtils.html.md) diff --git a/docs/llms.txt b/docs/llms.txt new file mode 100644 index 00000000000000..8f52da57d52578 --- /dev/null +++ b/docs/llms.txt @@ -0,0 +1,158 @@ +# Three.js + +> Three.js is a cross-browser JavaScript library for creating 3D graphics using WebGL and WebGPU. + +## Instructions for Large Language Models + +When generating Three.js code, follow these guidelines: + +### 1. Use Import Maps (Not Old CDN Patterns) + +WRONG - outdated pattern: +```html + +``` + +CORRECT - modern pattern (always use latest version): +```html + + +``` + +### 2. Choosing Between WebGLRenderer and WebGPURenderer + +Three.js maintains both renderers: + +**Use WebGLRenderer** (default, mature): +- Maximum browser compatibility +- Well-established, many years of development +- Most examples and tutorials use this + +```js +import * as THREE from 'three'; +const renderer = new THREE.WebGLRenderer(); +``` + +**Use WebGPURenderer** when you need: +- Custom shaders/materials using TSL (Three.js Shading Language) +- Compute shaders +- Advanced node-based materials + +```js +import * as THREE from 'three/webgpu'; +const renderer = new THREE.WebGPURenderer(); +await renderer.init(); +``` + +### 3. TSL (Three.js Shading Language) + +When using WebGPURenderer, use TSL instead of raw GLSL for custom materials: + +```js +import { texture, uv, color } from 'three/tsl'; + +const material = new THREE.MeshStandardNodeMaterial(); +material.colorNode = texture( myTexture ).mul( color( 0xff0000 ) ); +``` + +TSL benefits: +- Works with both WebGL and WebGPU backends +- No string manipulation or onBeforeCompile hacks +- Type-safe, composable shader nodes +- Automatic optimization + +### 4. NodeMaterial Classes (for WebGPU/TSL) + +When using TSL, use node-based materials: +- MeshBasicNodeMaterial +- MeshStandardNodeMaterial +- MeshPhysicalNodeMaterial +- LineBasicNodeMaterial +- SpriteNodeMaterial + +## Getting Started + +- [Installation](https://threejs.org/manual/#en/installation) +- [Creating a Scene](https://threejs.org/manual/#en/creating-a-scene) +- [Fundamentals](https://threejs.org/manual/#en/fundamentals) +- [Responsive Design](https://threejs.org/manual/#en/responsive) + +## Renderer Guides + +- [WebGPURenderer](https://threejs.org/manual/#en/webgpurenderer) + +## Core Concepts + +- [TSL Specification](https://threejs.org/docs/#api/en/nodes/TSL): Complete shader language reference +- [Animation System](https://threejs.org/manual/#en/animation-system) +- [Loading 3D Models](https://threejs.org/manual/#en/loading-3d-models) +- [Scene Graph](https://threejs.org/manual/#en/scenegraph) +- [Materials](https://threejs.org/manual/#en/materials) +- [Textures](https://threejs.org/manual/#en/textures) +- [Lights](https://threejs.org/manual/#en/lights) +- [Cameras](https://threejs.org/manual/#en/cameras) +- [Shadows](https://threejs.org/manual/#en/shadows) + +## Essential API + +### Core +- [Object3D](https://threejs.org/docs/#api/en/core/Object3D) +- [BufferGeometry](https://threejs.org/docs/#api/en/core/BufferGeometry) +- [BufferAttribute](https://threejs.org/docs/#api/en/core/BufferAttribute) + +### Scenes +- [Scene](https://threejs.org/docs/#api/en/scenes/Scene) + +### Cameras +- [PerspectiveCamera](https://threejs.org/docs/#api/en/cameras/PerspectiveCamera) +- [OrthographicCamera](https://threejs.org/docs/#api/en/cameras/OrthographicCamera) + +### Renderers +- [WebGLRenderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) +- [WebGPURenderer](https://threejs.org/docs/#api/en/renderers/webgpu/WebGPURenderer) + +### Objects +- [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) +- [InstancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh) +- [Group](https://threejs.org/docs/#api/en/objects/Group) + +### Materials +- [MeshBasicMaterial](https://threejs.org/docs/#api/en/materials/MeshBasicMaterial) +- [MeshStandardMaterial](https://threejs.org/docs/#api/en/materials/MeshStandardMaterial) +- [MeshPhysicalMaterial](https://threejs.org/docs/#api/en/materials/MeshPhysicalMaterial) + +### Geometries +- [BoxGeometry](https://threejs.org/docs/#api/en/geometries/BoxGeometry) +- [SphereGeometry](https://threejs.org/docs/#api/en/geometries/SphereGeometry) +- [PlaneGeometry](https://threejs.org/docs/#api/en/geometries/PlaneGeometry) + +### Lights +- [AmbientLight](https://threejs.org/docs/#api/en/lights/AmbientLight) +- [DirectionalLight](https://threejs.org/docs/#api/en/lights/DirectionalLight) +- [PointLight](https://threejs.org/docs/#api/en/lights/PointLight) +- [SpotLight](https://threejs.org/docs/#api/en/lights/SpotLight) + +### Loaders +- [TextureLoader](https://threejs.org/docs/#api/en/loaders/TextureLoader) +- [GLTFLoader](https://threejs.org/docs/#examples/en/loaders/GLTFLoader) + +### Controls +- [OrbitControls](https://threejs.org/docs/#examples/en/controls/OrbitControls) +- [TransformControls](https://threejs.org/docs/#examples/en/controls/TransformControls) + +### Math +- [Vector2](https://threejs.org/docs/#api/en/math/Vector2) +- [Vector3](https://threejs.org/docs/#api/en/math/Vector3) +- [Matrix4](https://threejs.org/docs/#api/en/math/Matrix4) +- [Quaternion](https://threejs.org/docs/#api/en/math/Quaternion) +- [Color](https://threejs.org/docs/#api/en/math/Color) diff --git a/docs/pages/AMFLoader.html.md b/docs/pages/AMFLoader.html.md new file mode 100644 index 00000000000000..fb4700738ac1df --- /dev/null +++ b/docs/pages/AMFLoader.html.md @@ -0,0 +1,73 @@ +*Inheritance: Loader →* + +# AMFLoader + +A loader for the AMF format. + +The loader supports materials, color and ZIP compressed files. No constellation support (yet). + +## Code Example + +```js +const loader = new AMFLoader(); +const object = await loader.loadAsync( './models/amf/rook.amf' ); +scene.add( object ); +``` + +## Import + +AMFLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { AMFLoader } from 'three/addons/loaders/AMFLoader.js'; +``` + +## Constructor + +### new AMFLoader( manager : LoadingManager ) + +Constructs a new AMF loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded AMF asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : Group + +Parses the given AMF data and returns the resulting group. + +**data** + +The raw AMF asset data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** A group representing the parsed asset. + +## Source + +[examples/jsm/loaders/AMFLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/AMFLoader.js) \ No newline at end of file diff --git a/docs/pages/AONode.html.md b/docs/pages/AONode.html.md new file mode 100644 index 00000000000000..73d2f4bb6cc3e2 --- /dev/null +++ b/docs/pages/AONode.html.md @@ -0,0 +1,29 @@ +*Inheritance: EventDispatcher → Node → LightingNode →* + +# AONode + +A generic class that can be used by nodes which contribute ambient occlusion to the scene. E.g. an ambient occlusion map node can be used as input for this module. Used in [NodeMaterial](NodeMaterial.html). + +## Constructor + +### new AONode( aoNode : Node. ) + +Constructs a new AO node. + +**aoNode** + +The ambient occlusion node. + +Default is `null`. + +## Properties + +### .aoNode : Node. + +The ambient occlusion node. + +Default is `null`. + +## Source + +[src/nodes/lighting/AONode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/AONode.js) \ No newline at end of file diff --git a/docs/pages/ARButton.html.md b/docs/pages/ARButton.html.md new file mode 100644 index 00000000000000..2f190e000a3a8b --- /dev/null +++ b/docs/pages/ARButton.html.md @@ -0,0 +1,37 @@ +# ARButton + +A utility class for creating a button that allows to initiate immersive AR sessions based on WebXR. The button can be created with a factory method and then appended ot the website's DOM. + +## Code Example + +```js +document.body.appendChild( ARButton.createButton( renderer ) ); +``` + +## Import + +ARButton is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ARButton } from 'three/addons/webxr/ARButton.js'; +``` + +## Static Methods + +### .createButton( renderer : WebGLRenderer | WebGPURenderer, sessionInit : XRSessionInit ) : HTMLElement + +Constructs a new AR button. + +**renderer** + +The renderer. + +**sessionInit** + +The a configuration object for the AR session. + +**Returns:** The button or an error message if `immersive-ar` isn't supported. + +## Source + +[examples/jsm/webxr/ARButton.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/ARButton.js) \ No newline at end of file diff --git a/docs/pages/AfterImageNode.html.md b/docs/pages/AfterImageNode.html.md new file mode 100644 index 00000000000000..f122ff2caf9332 --- /dev/null +++ b/docs/pages/AfterImageNode.html.md @@ -0,0 +1,97 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# AfterImageNode + +Post processing node for creating an after image effect. + +## Import + +AfterImageNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js'; +``` + +## Constructor + +### new AfterImageNode( textureNode : TextureNode, damp : Node. ) + +Constructs a new after image node. + +**textureNode** + +The texture node that represents the input of the effect. + +**damp** + +The damping intensity. A higher value means a stronger after image effect. + +Default is `0.96`. + +## Properties + +### .damp : Node. + +How quickly the after-image fades. A higher value means the after-image persists longer, while a lower value means it fades faster. Should be in the range `[0, 1]`. + +### .textureNode : TextureNode + +The texture node that represents the input of the effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/AfterImageNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/AfterImageNode.js) \ No newline at end of file diff --git a/docs/pages/AfterimagePass.html.md b/docs/pages/AfterimagePass.html.md new file mode 100644 index 00000000000000..7b8366a8079c7f --- /dev/null +++ b/docs/pages/AfterimagePass.html.md @@ -0,0 +1,106 @@ +*Inheritance: Pass →* + +# AfterimagePass + +Pass for a basic after image effect. + +## Code Example + +```js +const afterimagePass = new AfterimagePass( 0.9 ); +composer.addPass( afterimagePass ); +``` + +## Import + +AfterimagePass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { AfterimagePass } from 'three/addons/postprocessing/AfterimagePass.js'; +``` + +## Constructor + +### new AfterimagePass( damp : number ) + +Constructs a new after image pass. + +**damp** + +The damping intensity. A higher value means a stronger after image effect. + +Default is `0.96`. + +## Properties + +### .compFsMaterial : ShaderMaterial + +The composition material. + +### .copyFsMaterial : ShaderMaterial + +The copy material. + +### .damp : number + +The damping intensity, from 0.0 to 1.0. A higher value means a stronger after image effect. + +### .uniforms : Object + +The pass uniforms. Use this object if you want to update the `damp` value at runtime. + +```js +pass.uniforms.damp.value = 0.9; +``` + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the after image pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/AfterimagePass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/AfterimagePass.js) \ No newline at end of file diff --git a/docs/pages/AmbientLight.html.md b/docs/pages/AmbientLight.html.md new file mode 100644 index 00000000000000..83155f7ba57bb5 --- /dev/null +++ b/docs/pages/AmbientLight.html.md @@ -0,0 +1,44 @@ +*Inheritance: EventDispatcher → Object3D → Light →* + +# AmbientLight + +This light globally illuminates all objects in the scene equally. + +It cannot be used to cast shadows as it does not have a direction. + +## Code Example + +```js +const light = new THREE.AmbientLight( 0x404040 ); // soft white light +scene.add( light ); +``` + +## Constructor + +### new AmbientLight( color : number | Color | string, intensity : number ) + +Constructs a new ambient light. + +**color** + +The light's color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity. + +Default is `1`. + +## Properties + +### .isAmbientLight : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/lights/AmbientLight.js](https://github.com/mrdoob/three.js/blob/master/src/lights/AmbientLight.js) \ No newline at end of file diff --git a/docs/pages/AmbientLightNode.html.md b/docs/pages/AmbientLightNode.html.md new file mode 100644 index 00000000000000..bc317576e38c39 --- /dev/null +++ b/docs/pages/AmbientLightNode.html.md @@ -0,0 +1,21 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode →* + +# AmbientLightNode + +Module for representing ambient lights as nodes. + +## Constructor + +### new AmbientLightNode( light : AmbientLight ) + +Constructs a new ambient light node. + +**light** + +The ambient light source. + +Default is `null`. + +## Source + +[src/nodes/lighting/AmbientLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/AmbientLightNode.js) \ No newline at end of file diff --git a/docs/pages/AmmoPhysics.html.md b/docs/pages/AmmoPhysics.html.md new file mode 100644 index 00000000000000..60c4049ab99c54 --- /dev/null +++ b/docs/pages/AmmoPhysics.html.md @@ -0,0 +1,79 @@ +# AmmoPhysics + +Can be used to include Ammo.js as a Physics engine into `three.js` apps. Make sure to include `ammo.wasm.js` first: + +It is then possible to initialize the API via: + +```js +const physics = await AmmoPhysics(); +``` + +## Code Example + +```js + +``` + +## Import + +AmmoPhysics is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { AmmoPhysics } from 'three/addons/physics/AmmoPhysics.js'; +``` + +## Methods + +### .addMesh( mesh : Mesh, mass : number, restitution : number ) + +Adds the given mesh to this physics simulation. + +**mesh** + +The mesh to add. + +**mass** + +The mass in kg of the mesh. + +Default is `0`. + +**restitution** + +The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. + +Default is `0`. + +### .addScene( scene : Object3D ) + +Adds the given scene to this physics simulation. Only meshes with a `physics` object in their [Object3D#userData](Object3D.html#userData) field will be honored. The object can be used to store the mass of the mesh. E.g.: + +```js +box.userData.physics = { mass: 1 }; +``` + +**scene** + +The scene or any type of 3D object to add. + +### .setMeshPosition( mesh : Mesh, position : Vector3, index : number ) + +Set the position of the given mesh which is part of the physics simulation. Calling this method will reset the current simulated velocity of the mesh. + +**mesh** + +The mesh to update the position for. + +**position** + +The new position. + +**index** + +If the mesh is instanced, the index represents the instanced ID. + +Default is `0`. + +## Source + +[examples/jsm/physics/AmmoPhysics.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/physics/AmmoPhysics.js) \ No newline at end of file diff --git a/docs/pages/AnaglyphEffect.html.md b/docs/pages/AnaglyphEffect.html.md new file mode 100644 index 00000000000000..c4fa6aa5d17ba4 --- /dev/null +++ b/docs/pages/AnaglyphEffect.html.md @@ -0,0 +1,69 @@ +# AnaglyphEffect + +A class that creates an anaglyph effect. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [AnaglyphPassNode](AnaglyphPassNode.html). + +## Import + +AnaglyphEffect is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js'; +``` + +## Constructor + +### new AnaglyphEffect( renderer : WebGLRenderer, width : number, height : number ) + +Constructs a new anaglyph effect. + +**renderer** + +The renderer. + +**width** + +The width of the effect in physical pixels. + +Default is `512`. + +**height** + +The height of the effect in physical pixels. + +Default is `512`. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +### .render( scene : Object3D, camera : Camera ) + +When using this effect, this method should be called instead of the default [WebGLRenderer#render](WebGLRenderer.html#render). + +**scene** + +The scene to render. + +**camera** + +The camera. + +### .setSize( width : number, height : number ) + +Resizes the effect. + +**width** + +The width of the effect in logical pixels. + +**height** + +The height of the effect in logical pixels. + +## Source + +[examples/jsm/effects/AnaglyphEffect.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/effects/AnaglyphEffect.js) \ No newline at end of file diff --git a/docs/pages/AnaglyphPassNode.html.md b/docs/pages/AnaglyphPassNode.html.md new file mode 100644 index 00000000000000..795e1d0b2a0ecb --- /dev/null +++ b/docs/pages/AnaglyphPassNode.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → Node → TempNode → PassNode → StereoCompositePassNode →* + +# AnaglyphPassNode + +A render pass node that creates an anaglyph effect. + +## Import + +AnaglyphPassNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { anaglyphPass } from 'three/addons/tsl/display/AnaglyphPassNode.js'; +``` + +## Constructor + +### new AnaglyphPassNode( scene : Scene, camera : Camera ) + +Constructs a new anaglyph pass node. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +## Properties + +### .isAnaglyphPassNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [StereoCompositePassNode#setup](StereoCompositePassNode.html#setup) + +## Source + +[examples/jsm/tsl/display/AnaglyphPassNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/AnaglyphPassNode.js) \ No newline at end of file diff --git a/docs/pages/AnalyticLightNode.html.md b/docs/pages/AnalyticLightNode.html.md new file mode 100644 index 00000000000000..10b918f4d456b7 --- /dev/null +++ b/docs/pages/AnalyticLightNode.html.md @@ -0,0 +1,139 @@ +*Inheritance: EventDispatcher → Node → LightingNode →* + +# AnalyticLightNode + +Base class for analytic light nodes. + +## Constructor + +### new AnalyticLightNode( light : Light ) + +Constructs a new analytic light node. + +**light** + +The light source. + +Default is `null`. + +## Properties + +### .baseColorNode : Node + +This property is used to retain a reference to the original value of [AnalyticLightNode#colorNode](AnalyticLightNode.html#colorNode). The final color node is represented by a different node when using shadows. + +Default is `null`. + +### .color : Color + +The light's color value. + +### .colorNode : Node + +The light's color node. Points to `colorNode` of the light source, if set. Otherwise it creates a uniform node based on [AnalyticLightNode#color](AnalyticLightNode.html#color). + +### .isAnalyticLightNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .light : Light + +The light source. + +Default is `null`. + +### .shadowColorNode : Node + +Represents the light's shadow color. + +Default is `null`. + +### .shadowNode : ShadowNode + +Represents the light's shadow. + +Default is `null`. + +### .updateType : string + +Overwritten since analytic light nodes are updated once per frame. + +Default is `'frame'`. + +**Overrides:** [LightingNode#updateType](LightingNode.html#updateType) + +## Methods + +### .disposeShadow() + +Frees internal resources related to shadows. + +### .getLightVector( builder : NodeBuilder ) : Node. + +Returns a node representing a direction vector which points from the current position in view space to the light's position in view space. + +**builder** + +The builder object used for setting up the light. + +**Returns:** The light vector node. + +### .setup( builder : NodeBuilder ) + +Unlike most other nodes, lighting nodes do not return a output node in [Node#setup](Node.html#setup). The main purpose of lighting nodes is to configure the current [LightingModel](LightingModel.html) and/or invocate the respective interface methods. + +**builder** + +The current node builder. + +**Overrides:** [LightingNode#setup](LightingNode.html#setup) + +### .setupDirect( builder : NodeBuilder ) : Object | undefined (abstract) + +Sets up the direct lighting for the analytic light node. + +**builder** + +The builder object used for setting up the light. + +**Returns:** The direct light data (color and direction). + +### .setupDirectRectArea( builder : NodeBuilder ) : Object | undefined (abstract) + +Sets up the direct rect area lighting for the analytic light node. + +**builder** + +The builder object used for setting up the light. + +**Returns:** The direct rect area light data. + +### .setupShadow( builder : NodeBuilder ) + +Setups the shadow for this light. This method is only executed if the light cast shadows and the current build object receives shadows. It incorporates shadows into the lighting computation. + +**builder** + +The current node builder. + +### .setupShadowNode() : ShadowNode + +Setups the shadow node for this light. The method exists so concrete light classes can setup different types of shadow nodes. + +**Returns:** The created shadow node. + +### .update( frame : NodeFrame ) + +The update method is used to update light uniforms per frame. Potentially overwritten in concrete light nodes to update light specific uniforms. + +**frame** + +A reference to the current node frame. + +**Overrides:** [LightingNode#update](LightingNode.html#update) + +## Source + +[src/nodes/lighting/AnalyticLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/AnalyticLightNode.js) \ No newline at end of file diff --git a/docs/pages/AnamorphicNode.html.md b/docs/pages/AnamorphicNode.html.md new file mode 100644 index 00000000000000..513c182fd1f7fb --- /dev/null +++ b/docs/pages/AnamorphicNode.html.md @@ -0,0 +1,127 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# AnamorphicNode + +Post processing node for adding an anamorphic flare effect. + +## Import + +AnamorphicNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { anamorphic } from 'three/addons/tsl/display/AnamorphicNode.js'; +``` + +## Constructor + +### new AnamorphicNode( textureNode : TextureNode, thresholdNode : Node., scaleNode : Node., samples : number ) + +Constructs a new anamorphic node. + +**textureNode** + +The texture node that represents the input of the effect. + +**thresholdNode** + +The threshold is one option to control the intensity and size of the effect. + +**scaleNode** + +Defines the vertical scale of the flares. + +**samples** + +More samples result in larger flares and a more expensive runtime behavior. + +## Properties + +### .colorNode : Node. + +The color of the flares. + +### .resolution : Vector2 + +The resolution scale. + +Default is `{(1,1)}`. + +**Deprecated:** Yes + +### .resolutionScale : number + +The resolution scale. + +### .samples : Node. + +More samples result in larger flares and a more expensive runtime behavior. + +### .scaleNode : Node. + +Defines the vertical scale of the flares. + +### .textureNode : TextureNode + +The texture node that represents the input of the effect. + +### .thresholdNode : Node. + +The threshold is one option to control the intensity and size of the effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/AnamorphicNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/AnamorphicNode.js) \ No newline at end of file diff --git a/docs/pages/AnimationAction.html.md b/docs/pages/AnimationAction.html.md new file mode 100644 index 00000000000000..83a50774142259 --- /dev/null +++ b/docs/pages/AnimationAction.html.md @@ -0,0 +1,337 @@ +# AnimationAction + +An instance of `AnimationAction` schedules the playback of an animation which is stored in [AnimationClip](AnimationClip.html). + +## Constructor + +### new AnimationAction( mixer : AnimationMixer, clip : AnimationClip, localRoot : Object3D, blendMode : NormalAnimationBlendMode | AdditiveAnimationBlendMode ) + +Constructs a new animation action. + +**mixer** + +The mixer that is controlled by this action. + +**clip** + +The animation clip that holds the actual keyframes. + +**localRoot** + +The root object on which this action is performed. + +Default is `null`. + +**blendMode** + +The blend mode. + +## Properties + +### .blendMode : NormalAnimationBlendMode | AdditiveAnimationBlendMode + +Defines how the animation is blended/combined when two or more animations are simultaneously played. + +### .clampWhenFinished : boolean + +If set to true the animation will automatically be paused on its last frame. + +If set to false, [AnimationAction#enabled](AnimationAction.html#enabled) will automatically be switched to `false` when the last loop of the action has finished, so that this action has no further impact. + +Note: This member has no impact if the action is interrupted (it has only an effect if its last loop has really finished). + +Default is `false`. + +### .enabled : boolean + +If set to `false`, the action is disabled so it has no impact. + +When the action is re-enabled, the animation continues from its current time (setting `enabled` to `false` doesn't reset the action). + +Default is `true`. + +### .loop : LoopRepeat | LoopOnce | LoopPingPong + +The loop mode, set via [AnimationAction#setLoop](AnimationAction.html#setLoop). + +Default is `LoopRepeat`. + +### .paused : boolean + +If set to `true`, the playback of the action is paused. + +Default is `false`. + +### .repetitions : number + +The number of repetitions of the performed clip over the course of this action. Can be set via [AnimationAction#setLoop](AnimationAction.html#setLoop). + +Setting this number has no effect if [AnimationAction#loop](AnimationAction.html#loop) is set to `THREE:LoopOnce`. + +Default is `Infinity`. + +### .time : number + +The local time of this action (in seconds, starting with `0`). + +The value gets clamped or wrapped to `[0,clip.duration]` (according to the loop state). + +Default is `Infinity`. + +### .timeScale : number + +Scaling factor for the [AnimationAction#time](AnimationAction.html#time). A value of `0` causes the animation to pause. Negative values cause the animation to play backwards. + +Default is `1`. + +### .weight : number + +The degree of influence of this action (in the interval `[0, 1]`). Values between `0` (no impact) and `1` (full impact) can be used to blend between several actions. + +Default is `1`. + +### .zeroSlopeAtEnd : boolean + +Enables smooth interpolation without separate clips for start, loop and end. + +Default is `true`. + +### .zeroSlopeAtStart : boolean + +Enables smooth interpolation without separate clips for start, loop and end. + +Default is `true`. + +## Methods + +### .crossFadeFrom( fadeOutAction : AnimationAction, duration : number, warp : boolean ) : AnimationAction + +Causes this action to fade in and the given action to fade out, within the passed time interval. + +**fadeOutAction** + +The animation action to fade out. + +**duration** + +The duration of the fade. + +**warp** + +Whether warping should be used or not. + +Default is `false`. + +**Returns:** A reference to this animation action. + +### .crossFadeTo( fadeInAction : AnimationAction, duration : number, warp : boolean ) : AnimationAction + +Causes this action to fade out and the given action to fade in, within the passed time interval. + +**fadeInAction** + +The animation action to fade in. + +**duration** + +The duration of the fade. + +**warp** + +Whether warping should be used or not. + +Default is `false`. + +**Returns:** A reference to this animation action. + +### .fadeIn( duration : number ) : AnimationAction + +Fades the animation in by increasing its weight gradually from `0` to `1`, within the passed time interval. + +**duration** + +The duration of the fade. + +**Returns:** A reference to this animation action. + +### .fadeOut( duration : number ) : AnimationAction + +Fades the animation out by decreasing its weight gradually from `1` to `0`, within the passed time interval. + +**duration** + +The duration of the fade. + +**Returns:** A reference to this animation action. + +### .getClip() : AnimationClip + +Returns the animation clip of this animation action. + +**Returns:** The animation clip. + +### .getEffectiveTimeScale() : number + +Returns the effective time scale of this action. + +**Returns:** The effective time scale. + +### .getEffectiveWeight() : number + +Returns the effective weight of this action. + +**Returns:** The effective weight. + +### .getMixer() : AnimationMixer + +Returns the animation mixer of this animation action. + +**Returns:** The animation mixer. + +### .getRoot() : Object3D + +Returns the root object of this animation action. + +**Returns:** The root object. + +### .halt( duration : number ) : AnimationAction + +Decelerates this animation's speed to `0` within the passed time interval. + +**duration** + +The duration. + +**Returns:** A reference to this animation action. + +### .isRunning() : boolean + +Returns `true` if the animation is running. + +**Returns:** Whether the animation is running or not. + +### .isScheduled() : boolean + +Returns `true` when [AnimationAction#play](AnimationAction.html#play) has been called. + +**Returns:** Whether the animation is scheduled or not. + +### .play() : AnimationAction + +Starts the playback of the animation. + +**Returns:** A reference to this animation action. + +### .reset() : AnimationAction + +Resets the playback of the animation. + +**Returns:** A reference to this animation action. + +### .setDuration( duration : number ) : AnimationAction + +Sets the duration for a single loop of this action. + +**duration** + +The duration to set. + +**Returns:** A reference to this animation action. + +### .setEffectiveTimeScale( timeScale : number ) : AnimationAction + +Sets the effective time scale of this action. + +An action has no effect and thus an effective time scale of zero when the action is paused. + +**timeScale** + +The time scale to set. + +**Returns:** A reference to this animation action. + +### .setEffectiveWeight( weight : number ) : AnimationAction + +Sets the effective weight of this action. + +An action has no effect and thus an effective weight of zero when the action is disabled. + +**weight** + +The weight to set. + +**Returns:** A reference to this animation action. + +### .setLoop( mode : LoopRepeat | LoopOnce | LoopPingPong, repetitions : number ) : AnimationAction + +Configures the loop settings for this action. + +**mode** + +The loop mode. + +**repetitions** + +The number of repetitions. + +**Returns:** A reference to this animation action. + +### .startAt( time : number ) : AnimationAction + +Defines the time when the animation should start. + +**time** + +The start time in seconds. + +**Returns:** A reference to this animation action. + +### .stop() : AnimationAction + +Stops the playback of the animation. + +**Returns:** A reference to this animation action. + +### .stopFading() : AnimationAction + +Stops any fading which is applied to this action. + +**Returns:** A reference to this animation action. + +### .stopWarping() : AnimationAction + +Stops any scheduled warping which is applied to this action. + +**Returns:** A reference to this animation action. + +### .syncWith( action : AnimationAction ) : AnimationAction + +Synchronizes this action with the passed other action. + +**action** + +The action to sync with. + +**Returns:** A reference to this animation action. + +### .warp( startTimeScale : number, endTimeScale : number, duration : number ) : AnimationAction + +Changes the playback speed, within the passed time interval, by modifying [AnimationAction#timeScale](AnimationAction.html#timeScale) gradually from `startTimeScale` to `endTimeScale`. + +**startTimeScale** + +The start time scale. + +**endTimeScale** + +The end time scale. + +**duration** + +The duration. + +**Returns:** A reference to this animation action. + +## Source + +[src/animation/AnimationAction.js](https://github.com/mrdoob/three.js/blob/master/src/animation/AnimationAction.js) \ No newline at end of file diff --git a/docs/pages/AnimationClip.html.md b/docs/pages/AnimationClip.html.md new file mode 100644 index 00000000000000..f95aa02dc4b65e --- /dev/null +++ b/docs/pages/AnimationClip.html.md @@ -0,0 +1,197 @@ +# AnimationClip + +A reusable set of keyframe tracks which represent an animation. + +## Constructor + +### new AnimationClip( name : string, duration : number, tracks : Array., blendMode : NormalAnimationBlendMode | AdditiveAnimationBlendMode ) + +Constructs a new animation clip. + +Note: Instead of instantiating an AnimationClip directly with the constructor, you can use the static interface of this class for creating clips. In most cases though, animation clips will automatically be created by loaders when importing animated 3D assets. + +**name** + +The clip's name. + +Default is `''`. + +**duration** + +The clip's duration in seconds. If a negative value is passed, the duration will be calculated from the passed keyframes. + +Default is `-1`. + +**tracks** + +An array of keyframe tracks. + +**blendMode** + +Defines how the animation is blended/combined when two or more animations are simultaneously played. + +Default is `NormalAnimationBlendMode`. + +## Properties + +### .blendMode : NormalAnimationBlendMode | AdditiveAnimationBlendMode + +Defines how the animation is blended/combined when two or more animations are simultaneously played. + +### .duration : number + +The clip's duration in seconds. + +### .name : string + +The clip's name. + +### .tracks : Array. + +An array of keyframe tracks. + +### .userData : Object + +An object that can be used to store custom data about the animation clip. It should not hold references to functions as these will not be cloned. + +### .uuid : string (readonly) + +The UUID of the animation clip. + +## Methods + +### .clone() : AnimationClip + +Returns a new animation clip with copied values from this instance. + +**Returns:** A clone of this instance. + +### .optimize() : AnimationClip + +Optimizes each track by removing equivalent sequential keys (which are common in morph target sequences). + +**Returns:** A reference to this animation clip. + +### .resetDuration() : AnimationClip + +Sets the duration of this clip to the duration of its longest keyframe track. + +**Returns:** A reference to this animation clip. + +### .toJSON() : Object + +Serializes this animation clip into JSON. + +**Returns:** The JSON object. + +### .trim() : AnimationClip + +Trims all tracks to the clip's duration. + +**Returns:** A reference to this animation clip. + +### .validate() : boolean + +Performs minimal validation on each track in the clip. Returns `true` if all tracks are valid. + +**Returns:** Whether the clip's keyframes are valid or not. + +## Static Methods + +### .CreateClipsFromMorphTargetSequences( morphTargets : Array., fps : number, noLoop : boolean ) : Array. + +Returns an array of new AnimationClips created from the morph target sequences of a geometry, trying to sort morph target names into animation-group-based patterns like "Walk\_001, Walk\_002, Run\_001, Run\_002...". + +See [MD2Loader#parse](MD2Loader.html#parse) as an example for how the method should be used. + +**morphTargets** + +A sequence of morph targets. + +**fps** + +The Frames-Per-Second value. + +**noLoop** + +Whether the clip should be no loop or not. + +**Returns:** An array of new animation clips. + +### .CreateFromMorphTargetSequence( name : string, morphTargetSequence : Array., fps : number, noLoop : boolean ) : AnimationClip + +Returns a new animation clip from the passed morph targets array of a geometry, taking a name and the number of frames per second. + +Note: The fps parameter is required, but the animation speed can be overridden via [AnimationAction#setDuration](AnimationAction.html#setDuration). + +**name** + +The name of the animation clip. + +**morphTargetSequence** + +A sequence of morph targets. + +**fps** + +The Frames-Per-Second value. + +**noLoop** + +Whether the clip should be no loop or not. + +**Returns:** The new animation clip. + +### .findByName( objectOrClipArray : Array. | Object3D, name : string ) : AnimationClip + +Searches for an animation clip by name, taking as its first parameter either an array of clips, or a mesh or geometry that contains an array named "animations" property. + +**objectOrClipArray** + +The array or object to search through. + +**name** + +The name to search for. + +**Returns:** The found animation clip. Returns `null` if no clip has been found. + +### .parse( json : Object ) : AnimationClip + +Factory method for creating an animation clip from the given JSON. + +**json** + +The serialized animation clip. + +**Returns:** The new animation clip. + +### .parseAnimation( animation : Object, bones : Array. ) : AnimationClip + +Parses the `animation.hierarchy` format and returns a new animation clip. + +**animation** + +A serialized animation clip as JSON. + +**bones** + +An array of bones. + +**Deprecated:** since r175. + +**Returns:** The new animation clip. + +### .toJSON( clip : AnimationClip ) : Object + +Serializes the given animation clip into JSON. + +**clip** + +The animation clip to serialize. + +**Returns:** The JSON object. + +## Source + +[src/animation/AnimationClip.js](https://github.com/mrdoob/three.js/blob/master/src/animation/AnimationClip.js) \ No newline at end of file diff --git a/docs/pages/AnimationClipCreator.html.md b/docs/pages/AnimationClipCreator.html.md new file mode 100644 index 00000000000000..eed1f2d02198a4 --- /dev/null +++ b/docs/pages/AnimationClipCreator.html.md @@ -0,0 +1,101 @@ +# AnimationClipCreator + +A utility class with factory methods for creating basic animation clips. + +## Import + +AnimationClipCreator is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { AnimationClipCreator } from 'three/addons/animation/AnimationClipCreator.js'; +``` + +## Static Methods + +### .CreateMaterialColorAnimation( duration : number, colors : Array. ) : AnimationClip + +Creates an animation clip that animates the `color` property of a 3D object's material. + +**duration** + +The duration of the animation. + +**colors** + +An array of colors that should be sequentially animated. + +**Returns:** The created animation clip. + +### .CreatePulsationAnimation( duration : number, pulseScale : number ) : AnimationClip + +Creates an animation clip that scales a 3D object in a pulse pattern in the given period. + +**duration** + +The duration of the animation. + +**pulseScale** + +The scale of the pulse. + +**Returns:** The created animation clip. + +### .CreateRotationAnimation( period : number, axis : 'x' | 'y' | 'z' ) : AnimationClip + +Creates an animation clip that rotates a 3D object 360 degrees in the given period of time around the given axis. + +**period** + +The duration of the animation. + +**axis** + +The axis of rotation. + +Default is `'x'`. + +**Returns:** The created animation clip. + +### .CreateScaleAxisAnimation( period : number, axis : 'x' | 'y' | 'z' ) : AnimationClip + +Creates an animation clip that scales a 3D object from `0` to `1` in the given period of time along the given axis. + +**period** + +The duration of the animation. + +**axis** + +The axis to scale the 3D object along. + +Default is `'x'`. + +**Returns:** The created animation clip. + +### .CreateShakeAnimation( duration : number, shakeScale : Vector3 ) : AnimationClip + +Creates an animation clip that translates a 3D object in a shake pattern in the given period. + +**duration** + +The duration of the animation. + +**shakeScale** + +The scale of the shake. + +**Returns:** The created animation clip. + +### .CreateVisibilityAnimation( duration : number ) : AnimationClip + +Creates an animation clip that toggles the visibility of a 3D object. + +**duration** + +The duration of the animation. + +**Returns:** The created animation clip. + +## Source + +[examples/jsm/animation/AnimationClipCreator.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/AnimationClipCreator.js) \ No newline at end of file diff --git a/docs/pages/AnimationLoader.html.md b/docs/pages/AnimationLoader.html.md new file mode 100644 index 00000000000000..a6db992ab18801 --- /dev/null +++ b/docs/pages/AnimationLoader.html.md @@ -0,0 +1,62 @@ +*Inheritance: Loader →* + +# AnimationLoader + +Class for loading animation clips in the JSON format. The files are internally loaded via [FileLoader](FileLoader.html). + +## Code Example + +```js +const loader = new THREE.AnimationLoader(); +const animations = await loader.loadAsync( 'animations/animation.js' ); +``` + +## Constructor + +### new AnimationLoader( manager : LoadingManager ) + +Constructs a new animation loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and pass the loaded animations as an array holding instances of [AnimationClip](AnimationClip.html) to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( json : Object ) : Array. + +Parses the given JSON object and returns an array of animation clips. + +**json** + +The serialized animation clips. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed animation clips. + +## Source + +[src/loaders/AnimationLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/AnimationLoader.js) \ No newline at end of file diff --git a/docs/pages/AnimationMixer.html.md b/docs/pages/AnimationMixer.html.md new file mode 100644 index 00000000000000..6b1f379c05a79a --- /dev/null +++ b/docs/pages/AnimationMixer.html.md @@ -0,0 +1,133 @@ +# AnimationMixer + +`AnimationMixer` is a player for animations on a particular object in the scene. When multiple objects in the scene are animated independently, one `AnimationMixer` may be used for each object. + +## Constructor + +### new AnimationMixer( root : Object3D ) + +Constructs a new animation mixer. + +**root** + +The object whose animations shall be played by this mixer. + +## Properties + +### .time : number + +The global mixer time (in seconds; starting with `0` on the mixer's creation). + +Default is `0`. + +### .timeScale : number + +A scaling factor for the global time. + +Note: Setting this member to `0` and later back to `1` is a possibility to pause/unpause all actions that are controlled by this mixer. + +Default is `1`. + +## Methods + +### .clipAction( clip : AnimationClip | string, optionalRoot : Object3D, blendMode : NormalAnimationBlendMode | AdditiveAnimationBlendMode ) : AnimationAction + +Returns an instance of [AnimationAction](AnimationAction.html) for the passed clip. + +If an action fitting the clip and root parameters doesn't yet exist, it will be created by this method. Calling this method several times with the same clip and root parameters always returns the same action. + +**clip** + +An animation clip or alternatively the name of the animation clip. + +**optionalRoot** + +An alternative root object. + +**blendMode** + +The blend mode. + +**Returns:** The animation action. + +### .existingAction( clip : AnimationClip | string, optionalRoot : Object3D ) : AnimationAction + +Returns an existing animation action for the passed clip. + +**clip** + +An animation clip or alternatively the name of the animation clip. + +**optionalRoot** + +An alternative root object. + +**Returns:** The animation action. Returns `null` if no action was found. + +### .getRoot() : Object3D + +Returns this mixer's root object. + +**Returns:** The mixer's root object. + +### .setTime( time : number ) : AnimationMixer + +Sets the global mixer to a specific time and updates the animation accordingly. + +This is useful when you need to jump to an exact time in an animation. The input parameter will be scaled by [AnimationMixer#timeScale](AnimationMixer.html#timeScale) + +**time** + +The time to set in seconds. + +**Returns:** A reference to this animation mixer. + +### .stopAllAction() : AnimationMixer + +Deactivates all previously scheduled actions on this mixer. + +**Returns:** A reference to this animation mixer. + +### .uncacheAction( clip : AnimationClip | string, optionalRoot : Object3D ) + +Deallocates all memory resources for an action. The action is identified by the given clip and an optional root object. Before using this method make sure to call [AnimationAction#stop](AnimationAction.html#stop) to deactivate the action. + +**clip** + +An animation clip or alternatively the name of the animation clip. + +**optionalRoot** + +An alternative root object. + +### .uncacheClip( clip : AnimationClip ) + +Deallocates all memory resources for a clip. Before using this method make sure to call [AnimationAction#stop](AnimationAction.html#stop) for all related actions. + +**clip** + +The clip to uncache. + +### .uncacheRoot( root : Object3D ) + +Deallocates all memory resources for a root object. Before using this method make sure to call [AnimationAction#stop](AnimationAction.html#stop) for all related actions or alternatively [AnimationMixer#stopAllAction](AnimationMixer.html#stopAllAction) when the mixer operates on a single root. + +**root** + +The root object to uncache. + +### .update( deltaTime : number ) : AnimationMixer + +Advances the global mixer time and updates the animation. + +This is usually done in the render loop by passing the delta time from [Clock](Clock.html) or [Timer](Timer.html). + +**deltaTime** + +The delta time in seconds. + +**Returns:** A reference to this animation mixer. + +## Source + +[src/animation/AnimationMixer.js](https://github.com/mrdoob/three.js/blob/master/src/animation/AnimationMixer.js) \ No newline at end of file diff --git a/docs/pages/AnimationObjectGroup.html.md b/docs/pages/AnimationObjectGroup.html.md new file mode 100644 index 00000000000000..eb09d74248bfa2 --- /dev/null +++ b/docs/pages/AnimationObjectGroup.html.md @@ -0,0 +1,70 @@ +# AnimationObjectGroup + +A group of objects that receives a shared animation state. + +Usage: + +* Add objects you would otherwise pass as 'root' to the constructor or the .clipAction method of AnimationMixer. +* Instead pass this object as 'root'. +* You can also add and remove objects later when the mixer is running. + +Note: + +* Objects of this class appear as one object to the mixer, so cache control of the individual objects must be done on the group. + +Limitation: + +* The animated properties must be compatible among the all objects in the group. +* A single property can either be controlled through a target group or directly, but not both. + +## Constructor + +### new AnimationObjectGroup( …arguments : Object3D ) + +Constructs a new animation group. + +**arguments** + +An arbitrary number of 3D objects that share the same animation state. + +## Properties + +### .isAnimationObjectGroup : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .uuid : string (readonly) + +The UUID of the 3D object. + +## Methods + +### .add( …arguments : Object3D ) + +Adds an arbitrary number of objects to this animation group. + +**arguments** + +The 3D objects to add. + +### .remove( …arguments : Object3D ) + +Removes an arbitrary number of objects to this animation group + +**arguments** + +The 3D objects to remove. + +### .uncache( …arguments : Object3D ) + +Deallocates all memory resources for the passed 3D objects of this animation group. + +**arguments** + +The 3D objects to uncache. + +## Source + +[src/animation/AnimationObjectGroup.js](https://github.com/mrdoob/three.js/blob/master/src/animation/AnimationObjectGroup.js) \ No newline at end of file diff --git a/docs/pages/AnimationUtils.html.md b/docs/pages/AnimationUtils.html.md new file mode 100644 index 00000000000000..8566fbf7a36807 --- /dev/null +++ b/docs/pages/AnimationUtils.html.md @@ -0,0 +1,137 @@ +# AnimationUtils + +A class with various methods to assist with animations. + +## Static Methods + +### .convertArray( array : TypedArray | Array, type : TypedArray.constructor ) : TypedArray + +Converts an array to a specific type + +**array** + +The array to convert. + +**type** + +The constructor of a type array. + +**Returns:** The converted array + +### .flattenJSON( jsonKeys : Array., times : Array., values : Array., valuePropertyName : string ) + +Used for parsing AOS keyframe formats. + +**jsonKeys** + +A list of JSON keyframes. + +**times** + +This array will be filled with keyframe times by this method. + +**values** + +This array will be filled with keyframe values by this method. + +**valuePropertyName** + +The name of the property to use. + +### .getKeyframeOrder( times : Array. ) : Array. + +Returns an array by which times and values can be sorted. + +**times** + +The keyframe time values. + +**Returns:** The array. + +### .isTypedArray( object : any ) : boolean + +Returns `true` if the given object is a typed array. + +**object** + +The object to check. + +**Returns:** Whether the given object is a typed array. + +### .makeClipAdditive( targetClip : AnimationClip, referenceFrame : number, referenceClip : AnimationClip, fps : number ) : AnimationClip + +Converts the keyframes of the given animation clip to an additive format. + +**targetClip** + +The clip to make additive. + +**referenceFrame** + +The reference frame. + +Default is `0`. + +**referenceClip** + +The reference clip. + +Default is `targetClip`. + +**fps** + +The FPS. + +Default is `30`. + +**Returns:** The updated clip which is now additive. + +### .sortedArray( values : Array., stride : number, order : Array. ) : Array. + +Sorts the given array by the previously computed order via `getKeyframeOrder()`. + +**values** + +The values to sort. + +**stride** + +The stride. + +**order** + +The sort order. + +**Returns:** The sorted values. + +### .subclip( sourceClip : AnimationClip, name : string, startFrame : number, endFrame : number, fps : number ) : AnimationClip + +Creates a new clip, containing only the segment of the original clip between the given frames. + +**sourceClip** + +The values to sort. + +**name** + +The name of the clip. + +**startFrame** + +The start frame. + +**endFrame** + +The end frame. + +**fps** + +The FPS. + +Default is `30`. + +**Returns:** The new sub clip. + +## Source + +[src/animation/AnimationUtils.js](https://github.com/mrdoob/three.js/blob/master/src/animation/AnimationUtils.js) \ No newline at end of file diff --git a/docs/pages/ArcCurve.html.md b/docs/pages/ArcCurve.html.md new file mode 100644 index 00000000000000..c43979bfa9e24a --- /dev/null +++ b/docs/pages/ArcCurve.html.md @@ -0,0 +1,59 @@ +*Inheritance: Curve → EllipseCurve →* + +# ArcCurve + +A curve representing an arc. + +## Constructor + +### new ArcCurve( aX : number, aY : number, aRadius : number, aStartAngle : number, aEndAngle : number, aClockwise : boolean ) + +Constructs a new arc curve. + +**aX** + +The X center of the ellipse. + +Default is `0`. + +**aY** + +The Y center of the ellipse. + +Default is `0`. + +**aRadius** + +The radius of the ellipse in the x direction. + +Default is `1`. + +**aStartAngle** + +The start angle of the curve in radians starting from the positive X axis. + +Default is `0`. + +**aEndAngle** + +The end angle of the curve in radians starting from the positive X axis. + +Default is `Math.PI*2`. + +**aClockwise** + +Whether the ellipse is drawn clockwise or not. + +Default is `false`. + +## Properties + +### .isArcCurve : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/extras/curves/ArcCurve.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/ArcCurve.js) \ No newline at end of file diff --git a/docs/pages/ArcballControls.html.md b/docs/pages/ArcballControls.html.md new file mode 100644 index 00000000000000..56a46bb7d8b956 --- /dev/null +++ b/docs/pages/ArcballControls.html.md @@ -0,0 +1,307 @@ +*Inheritance: EventDispatcher → Controls →* + +# ArcballControls + +Arcball controls allow the camera to be controlled by a virtual trackball with full touch support and advanced navigation functionality. Cursor/finger positions and movements are mapped over a virtual trackball surface represented by a gizmo and mapped in intuitive and consistent camera movements. Dragging cursor/fingers will cause camera to orbit around the center of the trackball in a conservative way (returning to the starting point will make the camera return to its starting orientation). + +In addition to supporting pan, zoom and pinch gestures, Arcball controls provide focus< functionality with a double click/tap for intuitively moving the object's point of interest in the center of the virtual trackball. Focus allows a much better inspection and navigation in complex environment. Moreover Arcball controls allow FOV manipulation (in a vertigo-style method) and z-rotation. Saving and restoring of Camera State is supported also through clipboard (use ctrl+c and ctrl+v shortcuts for copy and paste the state). + +Unlike [OrbitControls](OrbitControls.html) and [TrackballControls](TrackballControls.html), `ArcballControls` doesn't require `update()` to be called externally in an animation loop when animations are on. + +## Import + +ArcballControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ArcballControls } from 'three/addons/controls/ArcballControls.js'; +``` + +## Constructor + +### new ArcballControls( camera : Camera, domElement : HTMLElement, scene : Scene ) + +Constructs a new controls instance. + +**camera** + +The camera to be controlled. The camera must not be a child of another object, unless that object is the scene itself. + +**domElement** + +The HTML element used for event listeners. + +Default is `null`. + +**scene** + +The scene rendered by the camera. If not given, gizmos cannot be shown. + +Default is `null`. + +## Properties + +### .adjustNearFar : boolean + +If set to `true`, the camera's near and far values will be adjusted every time zoom is performed trying to maintain the same visible portion given by initial near and far values. Only works with perspective cameras. + +Default is `false`. + +### .cursorZoom : boolean + +Set to `true` to make zoom become cursor centered. + +Default is `false`. + +### .dampingFactor : number + +The damping inertia used if 'enableAnimations`is set to`true\`. + +Default is `25`. + +### .enableAnimations : boolean + +Set to `true` to enable animations for rotation (damping) and focus operation. + +Default is `true`. + +### .enableFocus : boolean + +Enable or disable camera focusing on double-tap (or click) operations. + +Default is `true`. + +### .enableGizmos : boolean + +Enable or disable gizmos. + +Default is `true`. + +### .enableGrid : boolean + +If set to `true`, a grid will appear when panning operation is being performed (desktop interaction only). + +Default is `false`. + +### .enablePan : boolean + +Enable or disable camera panning. + +Default is `true`. + +### .enableRotate : boolean + +Enable or disable camera rotation. + +Default is `true`. + +### .enableZoom : boolean + +Enable or disable camera zoom. + +Default is `true`. + +### .focusAnimationTime : number + +Duration of focus animations in ms. + +Default is `500`. + +### .maxDistance : number + +How far you can dolly out. For perspective cameras only. + +Default is `Infinity`. + +### .maxFov : number + +The maximum FOV in degrees. + +Default is `90`. + +### .maxZoom : number + +How far you can zoom out. For orthographic cameras only. + +Default is `Infinity`. + +### .minDistance : number + +How far you can dolly in. For perspective cameras only. + +Default is `0`. + +### .minFov : number + +The minimum FOV in degrees. + +Default is `5`. + +### .minZoom : number + +How far you can zoom in. For orthographic cameras only. + +Default is `0`. + +### .mouseActions : Array. + +Holds the mouse actions of this controls. This property is maintained by the methods `setMouseAction()` and `unsetMouseAction()`. + +### .radiusFactor : number + +The size of the gizmo relative to the screen width and height. + +Default is `0.67`. + +### .rotateSpeed : number + +Speed of rotation. + +Default is `1`. + +### .scaleFactor : number + +The scaling factor used when performing zoom operation. + +Default is `1.1`. + +### .scene : Scene + +The scene rendered by the camera. If not given, gizmos cannot be shown. + +Default is `null`. + +### .target : Vector3 + +The control's focus point. + +### .wMax : number + +Maximum angular velocity allowed on rotation animation start. + +Default is `20`. + +## Methods + +### .activateGizmos( isActive : boolean ) + +Makes rotation gizmos more or less visible. + +**isActive** + +If set to `true`, gizmos are more visible. + +### .copyState() + +Copy the current state to clipboard (as a readable JSON text). + +### .disposeGrid() + +Removes the grid from the scene. + +### .getRaycaster() : Raycaster + +Returns the raycaster that is used for user interaction. This object is shared between all instances of `ArcballControls`. + +**Returns:** The internal raycaster. + +### .pasteState() + +Set the controls state from the clipboard, assumes that the clipboard stores a JSON text as saved from `copyState()`. + +### .reset() + +Resets the controls. + +### .saveState() + +Saves the current state of the control. This can later be recover with `reset()`. + +### .setCamera( camera : Camera ) + +Sets the camera to be controlled. Must be called in order to set a new camera to be controlled. + +**camera** + +The camera to be controlled. + +### .setGizmosVisible( value : boolean ) + +Sets gizmos visibility. + +**value** + +Value of gizmos visibility. + +### .setMouseAction( operation : 'PAN' | 'ROTATE' | 'ZOOM' | 'FOV', mouse : 0 | 1 | 2 | 'WHEEL', key : 'CTRL' | 'SHIFT' ) : boolean + +Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one. + +**operation** + +The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV'). + +**mouse** + +A mouse button (0, 1, 2) or 'WHEEL' for wheel notches. + +**key** + +The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed. + +Default is `null`. + +**Returns:** `true` if the mouse action has been successfully added, `false` otherwise. + +### .setTbRadius( value : number ) + +Sets gizmos radius factor and redraws gizmos. + +**value** + +Value of radius factor. + +### .unsetMouseAction( mouse : 0 | 1 | 2 | 'WHEEL', key : 'CTRL' | 'SHIFT' ) : boolean + +Remove a mouse action by specifying its mouse/key combination. + +**mouse** + +A mouse button (0, 1, 2) or 'WHEEL' for wheel notches. + +**key** + +The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed. + +Default is `null`. + +**Returns:** `true` if the operation has been successfully removed, `false` otherwise. + +## Events + +### .change + +Fires when the camera has been transformed by the controls. + +##### Type: + +* Object + +### .end + +Fires when an interaction has finished. + +##### Type: + +* Object + +### .start + +Fires when an interaction was initiated. + +##### Type: + +* Object + +## Source + +[examples/jsm/controls/ArcballControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/ArcballControls.js) \ No newline at end of file diff --git a/docs/pages/ArrayCamera.html.md b/docs/pages/ArrayCamera.html.md new file mode 100644 index 00000000000000..f86b115a2d3215 --- /dev/null +++ b/docs/pages/ArrayCamera.html.md @@ -0,0 +1,41 @@ +*Inheritance: EventDispatcher → Object3D → Camera → PerspectiveCamera →* + +# ArrayCamera + +This type of camera can be used in order to efficiently render a scene with a predefined set of cameras. This is an important performance aspect for rendering VR scenes. + +An instance of `ArrayCamera` always has an array of sub cameras. It's mandatory to define for each sub camera the `viewport` property which determines the part of the viewport that is rendered with this camera. + +## Constructor + +### new ArrayCamera( array : Array. ) + +Constructs a new array camera. + +**array** + +An array of perspective sub cameras. + +Default is `[]`. + +## Properties + +### .cameras : Array. + +An array of perspective sub cameras. + +### .isArrayCamera : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .isMultiViewCamera : boolean (readonly) + +Whether this camera is used with multiview rendering or not. + +Default is `false`. + +## Source + +[src/cameras/ArrayCamera.js](https://github.com/mrdoob/three.js/blob/master/src/cameras/ArrayCamera.js) \ No newline at end of file diff --git a/docs/pages/ArrayElementNode.html.md b/docs/pages/ArrayElementNode.html.md new file mode 100644 index 00000000000000..5fd7f290784b25 --- /dev/null +++ b/docs/pages/ArrayElementNode.html.md @@ -0,0 +1,69 @@ +*Inheritance: EventDispatcher → Node →* + +# ArrayElementNode + +Base class for representing element access on an array-like node data structures. + +## Constructor + +### new ArrayElementNode( node : Node, indexNode : Node ) + +Constructs an array element node. + +**node** + +The array-like node. + +**indexNode** + +The index node that defines the element access. + +## Properties + +### .indexNode : Node + +The index node that defines the element access. + +### .isArrayElementNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .node : Node + +The array-like node. + +## Methods + +### .getMemberType( builder : NodeBuilder, name : string ) : string + +This method is overwritten since the member type is inferred from the array-like node. + +**builder** + +The current node builder. + +**name** + +The member name. + +**Overrides:** [Node#getMemberType](Node.html#getMemberType) + +**Returns:** The member type. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from the array-like node. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/utils/ArrayElementNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/ArrayElementNode.js) \ No newline at end of file diff --git a/docs/pages/ArrayNode.html.md b/docs/pages/ArrayNode.html.md new file mode 100644 index 00000000000000..e4514d0765ae36 --- /dev/null +++ b/docs/pages/ArrayNode.html.md @@ -0,0 +1,122 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# ArrayNode + +ArrayNode represents a collection of nodes, typically created using the [array](TSL.html#array) function. + +## Code Example + +```js +const colors = array( [ + vec3( 1, 0, 0 ), + vec3( 0, 1, 0 ), + vec3( 0, 0, 1 ) +] ); +const redColor = tintColors.element( 0 ); +``` + +## Constructor + +### new ArrayNode( nodeType : string, count : number, values : Array. ) + +Constructs a new array node. + +**nodeType** + +The data type of the elements. + +**count** + +Size of the array. + +**values** + +Array default values. + +Default is `null`. + +## Properties + +### .count : number + +Array size. + +### .isArrayNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .values : Array. + +Array default values. + +## Methods + +### .generate( builder : NodeBuilder ) : string + +This method builds the output node and returns the resulting array as a shader string. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#generate](TempNode.html#generate) + +**Returns:** The generated shader string. + +### .getArrayCount( builder : NodeBuilder ) : number + +Returns the number of elements in the node array. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getArrayCount](TempNode.html#getArrayCount) + +**Returns:** The number of elements in the node array. + +### .getElementType( builder : NodeBuilder ) : string + +Returns the node's type. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getElementType](TempNode.html#getElementType) + +**Returns:** The type of the node. + +### .getMemberType( builder : NodeBuilder, name : string ) : string + +Returns the type of a member variable. + +**builder** + +The current node builder. + +**name** + +The name of the member variable. + +**Overrides:** [TempNode#getMemberType](TempNode.html#getMemberType) + +**Returns:** The type of the member variable. + +### .getNodeType( builder : NodeBuilder ) : string + +Returns the node's type. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getNodeType](TempNode.html#getNodeType) + +**Returns:** The type of the node. + +## Source + +[src/nodes/core/ArrayNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/ArrayNode.js) \ No newline at end of file diff --git a/docs/pages/ArrowHelper.html.md b/docs/pages/ArrowHelper.html.md new file mode 100644 index 00000000000000..6511dc4f224377 --- /dev/null +++ b/docs/pages/ArrowHelper.html.md @@ -0,0 +1,116 @@ +*Inheritance: EventDispatcher → Object3D →* + +# ArrowHelper + +An 3D arrow object for visualizing directions. + +## Code Example + +```js +const dir = new THREE.Vector3( 1, 2, 0 ); +//normalize the direction vector (convert to vector of length 1) +dir.normalize(); +const origin = new THREE.Vector3( 0, 0, 0 ); +const length = 1; +const hex = 0xffff00; +const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex ); +scene.add( arrowHelper ); +``` + +## Constructor + +### new ArrowHelper( dir : Vector3, origin : Vector3, length : number, color : number | Color | string, headLength : number, headWidth : number ) + +Constructs a new arrow helper. + +**dir** + +The (normalized) direction vector. + +Default is `(0, 0, 1)`. + +**origin** + +Point at which the arrow starts. + +Default is `(0, 0, 0)`. + +**length** + +Length of the arrow in world units. + +Default is `1`. + +**color** + +Color of the arrow. + +Default is `0xffff00`. + +**headLength** + +The length of the head of the arrow. + +Default is `length*0.2`. + +**headWidth** + +The width of the head of the arrow. + +Default is `headLength*0.2`. + +## Properties + +### .cone : Mesh + +The cone part of the arrow helper. + +### .line : Line + +The line part of the arrow helper. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .setColor( color : number | Color | string ) + +Sets the color of the helper. + +**color** + +The color to set. + +### .setDirection( dir : Vector3 ) + +Sets the direction of the helper. + +**dir** + +The normalized direction vector. + +### .setLength( length : number, headLength : number, headWidth : number ) + +Sets the length of the helper. + +**length** + +Length of the arrow in world units. + +**headLength** + +The length of the head of the arrow. + +Default is `length*0.2`. + +**headWidth** + +The width of the head of the arrow. + +Default is `headLength*0.2`. + +## Source + +[src/helpers/ArrowHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/ArrowHelper.js) \ No newline at end of file diff --git a/docs/pages/AsciiEffect.html.md b/docs/pages/AsciiEffect.html.md new file mode 100644 index 00000000000000..0453fa44f9c683 --- /dev/null +++ b/docs/pages/AsciiEffect.html.md @@ -0,0 +1,124 @@ +# AsciiEffect + +A class that creates an ASCII effect. + +The ASCII generation is based on [jsascii](https://github.com/hassadee/jsascii/blob/master/jsascii.js). + +## Import + +AsciiEffect is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { AsciiEffect } from 'three/addons/effects/AsciiEffect.js'; +``` + +## Constructor + +### new AsciiEffect( renderer : WebGLRenderer, charSet : string, options : AsciiEffect~Options ) + +Constructs a new ASCII effect. + +**renderer** + +The renderer. + +**charSet** + +The char set. + +Default is `' .:-=+*#%@'`. + +**options** + +The configuration parameter. + +## Properties + +### .domElement : HTMLDivElement + +The DOM element of the effect. This element must be used instead of the default [WebGLRenderer#domElement](WebGLRenderer.html#domElement). + +## Methods + +### .render( scene : Object3D, camera : Camera ) + +When using this effect, this method should be called instead of the default [WebGLRenderer#render](WebGLRenderer.html#render). + +**scene** + +The scene to render. + +**camera** + +The camera. + +### .setSize( w : number, h : number ) + +Resizes the effect. + +**w** + +The width of the effect in logical pixels. + +**h** + +The height of the effect in logical pixels. + +## Type Definitions + +### .Options + +This type represents configuration settings of `AsciiEffect`. + +**resolution** +number + +A higher value leads to more details. + +Default is `0.15`. + +**scale** +number + +The scale of the effect. + +Default is `1`. + +**color** +boolean + +Whether colors should be enabled or not. Better quality but slows down rendering. + +Default is `false`. + +**alpha** +boolean + +Whether transparency should be enabled or not. + +Default is `false`. + +**block** +boolean + +Whether blocked characters should be enabled or not. + +Default is `false`. + +**invert** +boolean + +Whether colors should be inverted or not. + +Default is `false`. + +**strResolution** +'low' | 'medium' | 'high' + +The string resolution. + +Default is `'low'`. + +## Source + +[examples/jsm/effects/AsciiEffect.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/effects/AsciiEffect.js) \ No newline at end of file diff --git a/docs/pages/AssignNode.html.md b/docs/pages/AssignNode.html.md new file mode 100644 index 00000000000000..eecb1e51f919dc --- /dev/null +++ b/docs/pages/AssignNode.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# AssignNode + +These node represents an assign operation. Meaning a node is assigned to another node. + +## Constructor + +### new AssignNode( targetNode : Node, sourceNode : Node ) + +Constructs a new assign node. + +**targetNode** + +The target node. + +**sourceNode** + +The source type. + +## Properties + +### .isAssignNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .sourceNode : Node + +The source node. + +### .targetNode : Node + +The target node. + +## Methods + +### .hasDependencies() : boolean + +Whether this node is used more than once in context of other nodes. This method is overwritten since it always returns `false` (assigns are unique). + +**Overrides:** [TempNode#hasDependencies](TempNode.html#hasDependencies) + +**Returns:** A flag that indicates if there is more than one dependency to other nodes. Always `false`. + +### .needsSplitAssign( builder : NodeBuilder ) : boolean + +Whether a split is required when assigning source to target. This can happen when the component length of target and source data type does not match. + +**builder** + +The current node builder. + +**Returns:** Whether a split is required when assigning source to target. + +## Source + +[src/nodes/core/AssignNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/AssignNode.js) \ No newline at end of file diff --git a/docs/pages/AtomicFunctionNode.html.md b/docs/pages/AtomicFunctionNode.html.md new file mode 100644 index 00000000000000..4d3c75e9944a88 --- /dev/null +++ b/docs/pages/AtomicFunctionNode.html.md @@ -0,0 +1,75 @@ +*Inheritance: EventDispatcher → Node →* + +# AtomicFunctionNode + +`AtomicFunctionNode` represents any function that can operate on atomic variable types within a shader. In an atomic function, any modification to an atomic variable will occur as an indivisible step with a defined order relative to other modifications. Accordingly, even if multiple atomic functions are modifying an atomic variable at once atomic operations will not interfere with each other. + +This node can only be used with a WebGPU backend. + +## Constructor + +### new AtomicFunctionNode( method : string, pointerNode : Node, valueNode : Node ) + +Constructs a new atomic function node. + +**method** + +The signature of the atomic function to construct. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +## Properties + +### .method : string + +The signature of the atomic function to construct. + +### .parents : boolean + +Creates a list of the parents for this node for detecting if the node needs to return a value. + +Default is `true`. + +**Overrides:** [Node#parents](Node.html#parents) + +### .pointerNode : Node + +An atomic variable or element of an atomic buffer. + +### .valueNode : Node + +A value that modifies the atomic variable. + +## Methods + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation to return the type of the pointer node. + +**builder** + +The current node builder. + +**Returns:** The input type. + +### .getNodeType( builder : NodeBuilder ) : string + +Overwritten since the node type is inferred from the input type. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/gpgpu/AtomicFunctionNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/gpgpu/AtomicFunctionNode.js) \ No newline at end of file diff --git a/docs/pages/AttributeNode.html.md b/docs/pages/AttributeNode.html.md new file mode 100644 index 00000000000000..d5b36d120a0353 --- /dev/null +++ b/docs/pages/AttributeNode.html.md @@ -0,0 +1,57 @@ +*Inheritance: EventDispatcher → Node →* + +# AttributeNode + +Base class for representing shader attributes as nodes. + +## Constructor + +### new AttributeNode( attributeName : string, nodeType : string ) + +Constructs a new attribute node. + +**attributeName** + +The name of the attribute. + +**nodeType** + +The node type. + +Default is `null`. + +## Properties + +### .global : boolean + +`AttributeNode` sets this property to `true` by default. + +Default is `true`. + +**Overrides:** [Node#global](Node.html#global) + +## Methods + +### .getAttributeName( builder : NodeBuilder ) : string + +Returns the attribute name of this node. The method can be overwritten in derived classes if the final name must be computed analytically. + +**builder** + +The current node builder. + +**Returns:** The attribute name. + +### .setAttributeName( attributeName : string ) : AttributeNode + +Sets the attribute name to the given value. The method can be overwritten in derived classes if the final name must be computed analytically. + +**attributeName** + +The name of the attribute. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/core/AttributeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/AttributeNode.js) \ No newline at end of file diff --git a/docs/pages/Audio.html.md b/docs/pages/Audio.html.md new file mode 100644 index 00000000000000..7fc915cd4a7776 --- /dev/null +++ b/docs/pages/Audio.html.md @@ -0,0 +1,383 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Audio + +Represents a non-positional ( global ) audio object. + +This and related audio modules make use of the [Web Audio API](https://www.w3.org/TR/webaudio-1.1/). + +## Code Example + +```js +// create an AudioListener and add it to the camera +const listener = new THREE.AudioListener(); +camera.add( listener ); +// create a global audio source +const sound = new THREE.Audio( listener ); +// load a sound and set it as the Audio object's buffer +const audioLoader = new THREE.AudioLoader(); +audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { + sound.setBuffer( buffer ); + sound.setLoop( true ); + sound.setVolume( 0.5 ); + sound.play(); +}); +``` + +## Constructor + +### new Audio( listener : AudioListener ) + +Constructs a new audio. + +**listener** + +The global audio listener. + +## Properties + +### .autoplay : boolean + +Whether to start playback automatically or not. + +Default is `false`. + +### .buffer : AudioBuffer (readonly) + +A reference to an audio buffer. + +Defined via [Audio#setBuffer](Audio.html#setBuffer). + +Default is `null`. + +### .context : AudioContext (readonly) + +The audio context. + +### .detune : number (readonly) + +Modify pitch, measured in cents. +/- 100 is a semitone. +/- 1200 is an octave. + +Defined via [Audio#setDetune](Audio.html#setDetune). + +Default is `0`. + +### .duration : undefined | number + +Overrides the default duration of the audio. + +Default is `undefined`. + +### .filters : Array. (readonly) + +Can be used to apply a variety of low-order filters to create more complex sound effects e.g. via `BiquadFilterNode`. + +The property is automatically set by [Audio#setFilters](Audio.html#setFilters). + +### .gain : GainNode (readonly) + +The gain node used for volume control. + +### .hasPlaybackControl : boolean (readonly) + +Indicates whether the audio playback can be controlled with method like [Audio#play](Audio.html#play) or [Audio#pause](Audio.html#pause). + +This flag will be automatically set when audio sources are defined. + +Default is `true`. + +### .isPlaying : boolean (readonly) + +Indicates whether the audio is playing or not. + +This flag will be automatically set when using [Audio#play](Audio.html#play), [Audio#pause](Audio.html#pause), [Audio#stop](Audio.html#stop). + +Default is `false`. + +### .listener : AudioListener (readonly) + +The global audio listener. + +### .loop : boolean (readonly) + +Whether the audio should loop or not. + +Defined via [Audio#setLoop](Audio.html#setLoop). + +Default is `false`. + +### .loopEnd : number + +Defines where in the audio buffer the replay should stop, in seconds. + +Default is `0`. + +### .loopStart : number + +Defines where in the audio buffer the replay should start, in seconds. + +Default is `0`. + +### .offset : number + +An offset to the time within the audio buffer the playback should begin, in seconds. + +Default is `0`. + +### .playbackRate : number (readonly) + +The playback speed. + +Defined via [Audio#setPlaybackRate](Audio.html#setPlaybackRate). + +Default is `1`. + +### .source : AudioNode (readonly) + +Holds a reference to the current audio source. + +The property is automatically by one of the `set*()` methods. + +Default is `null`. + +### .sourceType : 'empty' | 'audioNode' | 'mediaNode' | 'mediaStreamNode' | 'buffer' (readonly) + +Defines the source type. + +The property is automatically set by one of the `set*()` methods. + +Default is `'empty'`. + +## Methods + +### .connect() : Audio + +Connects to the audio source. This is used internally on initialisation and when setting / removing filters. + +**Returns:** A reference to this instance. + +### .disconnect() : Audio | undefined + +Disconnects to the audio source. This is used internally on initialisation and when setting / removing filters. + +**Returns:** A reference to this instance. + +### .getDetune() : number + +Returns the detuning of oscillation in cents. + +**Returns:** The detuning of oscillation in cents. + +### .getFilter() : AudioNode | undefined + +Returns the first filter in the list of filters. + +**Returns:** The first filter in the list of filters. + +### .getFilters() : Array. + +Returns the current set filters. + +**Returns:** The list of filters. + +### .getLoop() : boolean + +Returns the loop flag. + +Can only be used with compatible audio sources that allow playback control. + +**Returns:** Whether the audio should loop or not. + +### .getOutput() : GainNode + +Returns the output audio node. + +**Returns:** The output node. + +### .getPlaybackRate() : number + +Returns the current playback rate. + +**Returns:** The playback rate. + +### .getVolume() : number + +Returns the volume. + +**Returns:** The volume. + +### .onEnded() + +Automatically called when playback finished. + +### .pause() : Audio | undefined + +Pauses the playback of the audio. + +Can only be used with compatible audio sources that allow playback control. + +**Returns:** A reference to this instance. + +### .play( delay : number ) : Audio | undefined + +Starts the playback of the audio. + +Can only be used with compatible audio sources that allow playback control. + +**delay** + +The delay, in seconds, at which the audio should start playing. + +Default is `0`. + +**Returns:** A reference to this instance. + +### .setBuffer( audioBuffer : AudioBuffer ) : Audio + +Sets the given audio buffer as the source of this instance. + +[Audio#sourceType](Audio.html#sourceType) is set to `buffer` and [Audio#hasPlaybackControl](Audio.html#hasPlaybackControl) to `true`. + +**audioBuffer** + +The audio buffer. + +**Returns:** A reference to this instance. + +### .setDetune( value : number ) : Audio + +Defines the detuning of oscillation in cents. + +**value** + +The detuning of oscillation in cents. + +**Returns:** A reference to this instance. + +### .setFilter( filter : AudioNode ) : Audio + +Applies a single filter node to the audio. + +**filter** + +The filter to set. + +**Returns:** A reference to this instance. + +### .setFilters( value : Array. ) : Audio + +Sets an array of filters and connects them with the audio source. + +**value** + +A list of filters. + +**Returns:** A reference to this instance. + +### .setLoop( value : boolean ) : Audio | undefined + +Sets the loop flag. + +Can only be used with compatible audio sources that allow playback control. + +**value** + +Whether the audio should loop or not. + +**Returns:** A reference to this instance. + +### .setLoopEnd( value : number ) : Audio + +Sets the loop end value which defines where in the audio buffer the replay should stop, in seconds. + +**value** + +The loop end value. + +**Returns:** A reference to this instance. + +### .setLoopStart( value : number ) : Audio + +Sets the loop start value which defines where in the audio buffer the replay should start, in seconds. + +**value** + +The loop start value. + +**Returns:** A reference to this instance. + +### .setMediaElementSource( mediaElement : HTMLMediaElement ) : Audio + +Sets the given media element as the source of this instance. + +[Audio#sourceType](Audio.html#sourceType) is set to `mediaNode` and [Audio#hasPlaybackControl](Audio.html#hasPlaybackControl) to `false`. + +**mediaElement** + +The media element. + +**Returns:** A reference to this instance. + +### .setMediaStreamSource( mediaStream : MediaStream ) : Audio + +Sets the given media stream as the source of this instance. + +[Audio#sourceType](Audio.html#sourceType) is set to `mediaStreamNode` and [Audio#hasPlaybackControl](Audio.html#hasPlaybackControl) to `false`. + +**mediaStream** + +The media stream. + +**Returns:** A reference to this instance. + +### .setNodeSource( audioNode : AudioNode ) : Audio + +Sets the given audio node as the source of this instance. + +[Audio#sourceType](Audio.html#sourceType) is set to `audioNode` and [Audio#hasPlaybackControl](Audio.html#hasPlaybackControl) to `false`. + +**audioNode** + +The audio node like an instance of `OscillatorNode`. + +**Returns:** A reference to this instance. + +### .setPlaybackRate( value : number ) : Audio | undefined + +Sets the playback rate. + +Can only be used with compatible audio sources that allow playback control. + +**value** + +The playback rate to set. + +**Returns:** A reference to this instance. + +### .setVolume( value : number ) : Audio + +Sets the volume. + +**value** + +The volume to set. + +**Returns:** A reference to this instance. + +### .stop( delay : number ) : Audio | undefined + +Stops the playback of the audio. + +Can only be used with compatible audio sources that allow playback control. + +**delay** + +The delay, in seconds, at which the audio should stop playing. + +Default is `0`. + +**Returns:** A reference to this instance. + +## Source + +[src/audio/Audio.js](https://github.com/mrdoob/three.js/blob/master/src/audio/Audio.js) \ No newline at end of file diff --git a/docs/pages/AudioAnalyser.html.md b/docs/pages/AudioAnalyser.html.md new file mode 100644 index 00000000000000..44e161d8126b7c --- /dev/null +++ b/docs/pages/AudioAnalyser.html.md @@ -0,0 +1,71 @@ +# AudioAnalyser + +This class can be used to analyse audio data. + +## Code Example + +```js +// create an AudioListener and add it to the camera +const listener = new THREE.AudioListener(); +camera.add( listener ); +// create an Audio source +const sound = new THREE.Audio( listener ); +// load a sound and set it as the Audio object's buffer +const audioLoader = new THREE.AudioLoader(); +audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { + sound.setBuffer( buffer ); + sound.setLoop(true); + sound.setVolume(0.5); + sound.play(); +}); +// create an AudioAnalyser, passing in the sound and desired fftSize +const analyser = new THREE.AudioAnalyser( sound, 32 ); +// get the average frequency of the sound +const data = analyser.getAverageFrequency(); +``` + +## Constructor + +### new AudioAnalyser( audio : Audio, fftSize : number ) + +Constructs a new audio analyzer. + +**audio** + +The audio to analyze. + +**fftSize** + +The window size in samples that is used when performing a Fast Fourier Transform (FFT) to get frequency domain data. + +Default is `2048`. + +## Properties + +### .analyser : AnalyserNode + +The global audio listener. + +### .data : Uint8Array + +Holds the analyzed data. + +## Methods + +### .getAverageFrequency() : number + +Returns the average of the frequencies returned by [AudioAnalyser#getFrequencyData](AudioAnalyser.html#getFrequencyData). + +**Returns:** The average frequency. + +### .getFrequencyData() : Uint8Array + +Returns an array with frequency data of the audio. + +Each item in the array represents the decibel value for a specific frequency. The frequencies are spread linearly from 0 to 1/2 of the sample rate. For example, for 48000 sample rate, the last item of the array will represent the decibel value for 24000 Hz. + +**Returns:** The frequency data. + +## Source + +[src/audio/AudioAnalyser.js](https://github.com/mrdoob/three.js/blob/master/src/audio/AudioAnalyser.js) \ No newline at end of file diff --git a/docs/pages/AudioContext.html.md b/docs/pages/AudioContext.html.md new file mode 100644 index 00000000000000..626b645489030b --- /dev/null +++ b/docs/pages/AudioContext.html.md @@ -0,0 +1,23 @@ +# AudioContext + +Manages the global audio context in the engine. + +## Static Methods + +### .getContext() : AudioContext + +Returns the global native audio context. + +**Returns:** The native audio context. + +### .setContext( value : AudioContext ) + +Allows to set the global native audio context from outside. + +**value** + +The native context to set. + +## Source + +[src/audio/AudioContext.js](https://github.com/mrdoob/three.js/blob/master/src/audio/AudioContext.js) \ No newline at end of file diff --git a/docs/pages/AudioListener.html.md b/docs/pages/AudioListener.html.md new file mode 100644 index 00000000000000..8701f6c08ca97f --- /dev/null +++ b/docs/pages/AudioListener.html.md @@ -0,0 +1,89 @@ +*Inheritance: EventDispatcher → Object3D →* + +# AudioListener + +The class represents a virtual listener of the all positional and non-positional audio effects in the scene. A three.js application usually creates a single listener. It is a mandatory constructor parameter for audios entities like [Audio](Audio.html) and [PositionalAudio](PositionalAudio.html). + +In most cases, the listener object is a child of the camera. So the 3D transformation of the camera represents the 3D transformation of the listener. + +## Constructor + +### new AudioListener() + +Constructs a new audio listener. + +## Properties + +### .context : AudioContext (readonly) + +The native audio context. + +### .filter : AudioNode (readonly) + +An optional filter. + +Defined via [AudioListener#setFilter](AudioListener.html#setFilter). + +Default is `null`. + +### .gain : GainNode (readonly) + +The gain node used for volume control. + +### .timeDelta : number (readonly) + +Time delta values required for `linearRampToValueAtTime()` usage. + +Default is `0`. + +## Methods + +### .getFilter() : AudioNode + +Returns the current set filter. + +**Returns:** The filter. + +### .getInput() : GainNode + +Returns the listener's input node. + +This method is used by other audio nodes to connect to this listener. + +**Returns:** The input node. + +### .getMasterVolume() : number + +Returns the applications master volume. + +**Returns:** The master volume. + +### .removeFilter() : AudioListener + +Removes the current filter from this listener. + +**Returns:** A reference to this listener. + +### .setFilter( value : AudioNode ) : AudioListener + +Sets the given filter to this listener. + +**value** + +The filter to set. + +**Returns:** A reference to this listener. + +### .setMasterVolume( value : number ) : AudioListener + +Sets the applications master volume. This volume setting affects all audio nodes in the scene. + +**value** + +The master volume to set. + +**Returns:** A reference to this listener. + +## Source + +[src/audio/AudioListener.js](https://github.com/mrdoob/three.js/blob/master/src/audio/AudioListener.js) \ No newline at end of file diff --git a/docs/pages/AudioLoader.html.md b/docs/pages/AudioLoader.html.md new file mode 100644 index 00000000000000..33ca04992365a3 --- /dev/null +++ b/docs/pages/AudioLoader.html.md @@ -0,0 +1,54 @@ +*Inheritance: Loader →* + +# AudioLoader + +Class for loading audio buffers. Audios are internally loaded via [FileLoader](FileLoader.html). + +## Code Example + +```js +const audioListener = new THREE.AudioListener(); +const ambientSound = new THREE.Audio( audioListener ); +const loader = new THREE.AudioLoader(); +const audioBuffer = await loader.loadAsync( 'audio/ambient_ocean.ogg' ); +ambientSound.setBuffer( audioBuffer ); +ambientSound.play(); +``` + +## Constructor + +### new AudioLoader( manager : LoadingManager ) + +Constructs a new audio loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded audio buffer to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +## Source + +[src/loaders/AudioLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/AudioLoader.js) \ No newline at end of file diff --git a/docs/pages/AxesHelper.html.md b/docs/pages/AxesHelper.html.md new file mode 100644 index 00000000000000..e22f5a9f445daf --- /dev/null +++ b/docs/pages/AxesHelper.html.md @@ -0,0 +1,52 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# AxesHelper + +An axis object to visualize the 3 axes in a simple way. The X axis is red. The Y axis is green. The Z axis is blue. + +## Code Example + +```js +const axesHelper = new THREE.AxesHelper( 5 ); +scene.add( axesHelper ); +``` + +## Constructor + +### new AxesHelper( size : number ) + +Constructs a new axes helper. + +**size** + +Size of the lines representing the axes. + +Default is `1`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .setColors( xAxisColor : number | Color | string, yAxisColor : number | Color | string, zAxisColor : number | Color | string ) : AxesHelper + +Defines the colors of the axes helper. + +**xAxisColor** + +The color for the x axis. + +**yAxisColor** + +The color for the y axis. + +**zAxisColor** + +The color for the z axis. + +**Returns:** A reference to this axes helper. + +## Source + +[src/helpers/AxesHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/AxesHelper.js) \ No newline at end of file diff --git a/docs/pages/BVHLoader.html.md b/docs/pages/BVHLoader.html.md new file mode 100644 index 00000000000000..6e0beeb62e718b --- /dev/null +++ b/docs/pages/BVHLoader.html.md @@ -0,0 +1,93 @@ +*Inheritance: Loader →* + +# BVHLoader + +A loader for the BVH format. + +Imports BVH files and outputs a single [Skeleton](Skeleton.html) and [AnimationClip](AnimationClip.html). The loader only supports BVH files containing a single root right now. + +## Code Example + +```js +const loader = new BVHLoader(); +const result = await loader.loadAsync( 'models/bvh/pirouette.bvh' ); +// visualize skeleton +const skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] ); +scene.add( result.skeleton.bones[ 0 ] ); +scene.add( skeletonHelper ); +// play animation clip +mixer = new THREE.AnimationMixer( result.skeleton.bones[ 0 ] ); +mixer.clipAction( result.clip ).play(); +``` + +## Import + +BVHLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BVHLoader } from 'three/addons/loaders/BVHLoader.js'; +``` + +## Constructor + +### new BVHLoader( manager : LoadingManager ) + +Constructs a new BVH loader. + +**manager** + +The loading manager. + +## Properties + +### .animateBonePositions : boolean + +Whether to animate bone positions or not. + +Default is `true`. + +### .animateBoneRotations : boolean + +Whether to animate bone rotations or not. + +Default is `true`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded BVH asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string ) : Object + +Parses the given BVH data and returns the resulting data. + +**text** + +The raw BVH data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** An object representing the parsed asset. + +## Source + +[examples/jsm/loaders/BVHLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/BVHLoader.js) \ No newline at end of file diff --git a/docs/pages/BarrierNode.html.md b/docs/pages/BarrierNode.html.md new file mode 100644 index 00000000000000..a02afb3af7e7ad --- /dev/null +++ b/docs/pages/BarrierNode.html.md @@ -0,0 +1,21 @@ +*Inheritance: EventDispatcher → Node →* + +# BarrierNode + +Represents a GPU control barrier that synchronizes compute operations within a given scope. + +This node can only be used with a WebGPU backend. + +## Constructor + +### new BarrierNode( scope : string ) + +Constructs a new barrier node. + +**scope** + +The scope defines the behavior of the node. + +## Source + +[src/nodes/gpgpu/BarrierNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/gpgpu/BarrierNode.js) \ No newline at end of file diff --git a/docs/pages/BasicEnvironmentNode.html.md b/docs/pages/BasicEnvironmentNode.html.md new file mode 100644 index 00000000000000..6837ef842641d5 --- /dev/null +++ b/docs/pages/BasicEnvironmentNode.html.md @@ -0,0 +1,29 @@ +*Inheritance: EventDispatcher → Node → LightingNode →* + +# BasicEnvironmentNode + +Represents a basic model for Image-based lighting (IBL). The environment is defined via environment maps in the equirectangular or cube map format. `BasicEnvironmentNode` is intended for non-PBR materials like [MeshBasicNodeMaterial](MeshBasicNodeMaterial.html) or [MeshPhongNodeMaterial](MeshPhongNodeMaterial.html). + +## Constructor + +### new BasicEnvironmentNode( envNode : Node ) + +Constructs a new basic environment node. + +**envNode** + +A node representing the environment. + +Default is `null`. + +## Properties + +### .envNode : Node + +A node representing the environment. + +Default is `null`. + +## Source + +[src/nodes/lighting/BasicEnvironmentNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/BasicEnvironmentNode.js) \ No newline at end of file diff --git a/docs/pages/BasicLightMapNode.html.md b/docs/pages/BasicLightMapNode.html.md new file mode 100644 index 00000000000000..2d8bc671fb9d85 --- /dev/null +++ b/docs/pages/BasicLightMapNode.html.md @@ -0,0 +1,27 @@ +*Inheritance: EventDispatcher → Node → LightingNode →* + +# BasicLightMapNode + +A specific version of [IrradianceNode](IrradianceNode.html) that is only relevant for [MeshBasicNodeMaterial](MeshBasicNodeMaterial.html). Since the material is unlit, it requires a special scaling factor for the light map. + +## Constructor + +### new BasicLightMapNode( lightMapNode : Node. ) + +Constructs a new basic light map node. + +**lightMapNode** + +The light map node. + +Default is `null`. + +## Properties + +### .lightMapNode : Node. + +The light map node. + +## Source + +[src/nodes/lighting/BasicLightMapNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/BasicLightMapNode.js) \ No newline at end of file diff --git a/docs/pages/BasicLightingModel.html.md b/docs/pages/BasicLightingModel.html.md new file mode 100644 index 00000000000000..d285d8db317da8 --- /dev/null +++ b/docs/pages/BasicLightingModel.html.md @@ -0,0 +1,37 @@ +*Inheritance: LightingModel →* + +# BasicLightingModel + +Represents the lighting model for unlit materials. The only light contribution is baked indirect lighting modulated with ambient occlusion and the material's diffuse color. Environment mapping is supported. Used in [MeshBasicNodeMaterial](MeshBasicNodeMaterial.html). + +## Constructor + +### new BasicLightingModel() + +Constructs a new basic lighting model. + +## Methods + +### .finish( builder : NodeBuilder ) + +Implements the environment mapping. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#finish](LightingModel.html#finish) + +### .indirect( builder : NodeBuilder ) + +Implements the baked indirect lighting with its modulation. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#indirect](LightingModel.html#indirect) + +## Source + +[src/nodes/functions/BasicLightingModel.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/functions/BasicLightingModel.js) \ No newline at end of file diff --git a/docs/pages/BatchNode.html.md b/docs/pages/BatchNode.html.md new file mode 100644 index 00000000000000..47e2452c793af4 --- /dev/null +++ b/docs/pages/BatchNode.html.md @@ -0,0 +1,43 @@ +*Inheritance: EventDispatcher → Node →* + +# BatchNode + +This node implements the vertex shader logic which is required when rendering 3D objects via batching. `BatchNode` must be used with instances of [BatchedMesh](BatchedMesh.html). + +## Constructor + +### new BatchNode( batchMesh : BatchedMesh ) + +Constructs a new batch node. + +**batchMesh** + +A reference to batched mesh. + +## Properties + +### .batchMesh : BatchedMesh + +A reference to batched mesh. + +### .batchingIdNode : IndexNode + +The batching index node. + +Default is `null`. + +## Methods + +### .setup( builder : NodeBuilder ) + +Setups the internal buffers and nodes and assigns the transformed vertex data to predefined node variables for accumulation. That follows the same patterns like with morph and skinning nodes. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +## Source + +[src/nodes/accessors/BatchNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/BatchNode.js) \ No newline at end of file diff --git a/docs/pages/BatchedMesh.html.md b/docs/pages/BatchedMesh.html.md new file mode 100644 index 00000000000000..0dc601dcc0a4b2 --- /dev/null +++ b/docs/pages/BatchedMesh.html.md @@ -0,0 +1,388 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# BatchedMesh + +A special version of a mesh with multi draw batch rendering support. Use this class if you have to render a large number of objects with the same material but with different geometries or world transformations. The usage of `BatchedMesh` will help you to reduce the number of draw calls and thus improve the overall rendering performance in your application. + +## Code Example + +```js +const box = new THREE.BoxGeometry( 1, 1, 1 ); +const sphere = new THREE.SphereGeometry( 1, 12, 12 ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +// initialize and add geometries into the batched mesh +const batchedMesh = new BatchedMesh( 10, 5000, 10000, material ); +const boxGeometryId = batchedMesh.addGeometry( box ); +const sphereGeometryId = batchedMesh.addGeometry( sphere ); +// create instances of those geometries +const boxInstancedId1 = batchedMesh.addInstance( boxGeometryId ); +const boxInstancedId2 = batchedMesh.addInstance( boxGeometryId ); +const sphereInstancedId1 = batchedMesh.addInstance( sphereGeometryId ); +const sphereInstancedId2 = batchedMesh.addInstance( sphereGeometryId ); +// position the geometries +batchedMesh.setMatrixAt( boxInstancedId1, boxMatrix1 ); +batchedMesh.setMatrixAt( boxInstancedId2, boxMatrix2 ); +batchedMesh.setMatrixAt( sphereInstancedId1, sphereMatrix1 ); +batchedMesh.setMatrixAt( sphereInstancedId2, sphereMatrix2 ); +scene.add( batchedMesh ); +``` + +## Constructor + +### new BatchedMesh( maxInstanceCount : number, maxVertexCount : number, maxIndexCount : number, material : Material | Array. ) + +Constructs a new batched mesh. + +**maxInstanceCount** + +The maximum number of individual instances planned to be added and rendered. + +**maxVertexCount** + +The maximum number of vertices to be used by all unique geometries. + +**maxIndexCount** + +The maximum number of indices to be used by all unique geometries + +Default is `maxVertexCount*2`. + +**material** + +The mesh material. + +## Properties + +### .boundingBox : Box3 + +The bounding box of the batched mesh. Can be computed via [BatchedMesh#computeBoundingBox](BatchedMesh.html#computeBoundingBox). + +Default is `null`. + +### .boundingSphere : Sphere + +The bounding sphere of the batched mesh. Can be computed via [BatchedMesh#computeBoundingSphere](BatchedMesh.html#computeBoundingSphere). + +Default is `null`. + +### .customSort : function + +Takes a sort a function that is run before render. The function takes a list of instances to sort and a camera. The objects in the list include a "z" field to perform a depth-ordered sort with. + +Default is `null`. + +### .instanceCount : number (readonly) + +The instance count. + +### .isBatchedMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .maxInstanceCount : number (readonly) + +The maximum number of individual instances that can be stored in the batch. + +### .perObjectFrustumCulled : boolean + +When set ot `true`, the individual objects of a batch are frustum culled. + +Default is `true`. + +### .sortObjects : boolean + +When set to `true`, the individual objects of a batch are sorted to improve overdraw-related artifacts. If the material is marked as "transparent" objects are rendered back to front and if not then they are rendered front to back. + +Default is `true`. + +### .unusedIndexCount : number (readonly) + +The number of unused indices. + +### .unusedVertexCount : number (readonly) + +The number of unused vertices. + +## Methods + +### .addGeometry( geometry : BufferGeometry, reservedVertexCount : number, reservedIndexCount : number ) : number + +Adds the given geometry to the batch and returns the associated geometry id referring to it to be used in other functions. + +**geometry** + +The geometry to add. + +**reservedVertexCount** + +Optional parameter specifying the amount of vertex buffer space to reserve for the added geometry. This is necessary if it is planned to set a new geometry at this index at a later time that is larger than the original geometry. Defaults to the length of the given geometry vertex buffer. + +Default is `-1`. + +**reservedIndexCount** + +Optional parameter specifying the amount of index buffer space to reserve for the added geometry. This is necessary if it is planned to set a new geometry at this index at a later time that is larger than the original geometry. Defaults to the length of the given geometry index buffer. + +Default is `-1`. + +**Returns:** The geometry ID. + +### .addInstance( geometryId : number ) : number + +Adds a new instance to the batch using the geometry of the given ID and returns a new id referring to the new instance to be used by other functions. + +**geometryId** + +The ID of a previously added geometry via [BatchedMesh#addGeometry](BatchedMesh.html#addGeometry). + +**Returns:** The instance ID. + +### .computeBoundingBox() + +Computes the bounding box, updating [BatchedMesh#boundingBox](BatchedMesh.html#boundingBox). Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`. + +### .computeBoundingSphere() + +Computes the bounding sphere, updating [BatchedMesh#boundingSphere](BatchedMesh.html#boundingSphere). Bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`. + +### .deleteGeometry( geometryId : number ) : BatchedMesh + +Deletes the geometry defined by the given ID from this batch. Any instances referencing this geometry will also be removed as a side effect. + +**geometryId** + +The ID of the geometry to remove from the batch. + +**Returns:** A reference to this batched mesh. + +### .deleteInstance( instanceId : number ) : BatchedMesh + +Deletes an existing instance from the batch using the given ID. + +**instanceId** + +The ID of the instance to remove from the batch. + +**Returns:** A reference to this batched mesh. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .getBoundingBoxAt( geometryId : number, target : Box3 ) : Box3 + +Returns the bounding box for the given geometry. + +**geometryId** + +The ID of the geometry to return the bounding box for. + +**target** + +The target object that is used to store the method's result. + +**Returns:** The geometry's bounding box. Returns `null` if no geometry has been found for the given ID. + +### .getBoundingSphereAt( geometryId : number, target : Sphere ) : Sphere + +Returns the bounding sphere for the given geometry. + +**geometryId** + +The ID of the geometry to return the bounding sphere for. + +**target** + +The target object that is used to store the method's result. + +**Returns:** The geometry's bounding sphere. Returns `null` if no geometry has been found for the given ID. + +### .getColorAt( instanceId : number, color : Color ) : Color + +Returns the color of the defined instance. + +**instanceId** + +The ID of an instance to get the color of. + +**color** + +The target object that is used to store the method's result. + +**Returns:** The instance's color. + +### .getGeometryIdAt( instanceId : number ) : number + +Returns the geometry ID of the defined instance. + +**instanceId** + +The ID of an instance to get the geometry ID of. + +**Returns:** The instance's geometry ID. + +### .getGeometryRangeAt( geometryId : number, target : Object ) : Object + +Get the range representing the subset of triangles related to the attached geometry, indicating the starting offset and count, or `null` if invalid. + +**geometryId** + +The id of the geometry to get the range of. + +**target** + +The target object that is used to store the method's result. + +**Returns:** The result object with range data. + +### .getMatrixAt( instanceId : number, matrix : Matrix4 ) : Matrix4 + +Returns the local transformation matrix of the defined instance. + +**instanceId** + +The ID of an instance to get the matrix of. + +**matrix** + +The target object that is used to store the method's result. + +**Returns:** The instance's local transformation matrix. + +### .getVisibleAt( instanceId : number ) : boolean + +Returns the visibility state of the defined instance. + +**instanceId** + +The ID of an instance to get the visibility state of. + +**Returns:** Whether the instance is visible or not. + +### .optimize() : BatchedMesh + +Repacks the sub geometries in BatchedMesh to remove any unused space remaining from previously deleted geometry, freeing up space to add new geometry. + +**Returns:** A reference to this batched mesh. + +### .setColorAt( instanceId : number, color : Color ) : BatchedMesh + +Sets the given color to the defined instance. + +**instanceId** + +The ID of an instance to set the color of. + +**color** + +The color to set the instance to. + +**Returns:** A reference to this batched mesh. + +### .setCustomSort( func : function ) : BatchedMesh + +Takes a sort a function that is run before render. The function takes a list of instances to sort and a camera. The objects in the list include a "z" field to perform a depth-ordered sort with. + +**func** + +The custom sort function. + +**Returns:** A reference to this batched mesh. + +### .setGeometryAt( geometryId : number, geometry : BufferGeometry ) : number + +Replaces the geometry at the given ID with the provided geometry. Throws an error if there is not enough space reserved for geometry. Calling this will change all instances that are rendering that geometry. + +**geometryId** + +The ID of the geometry that should be replaced with the given geometry. + +**geometry** + +The new geometry. + +**Returns:** The geometry ID. + +### .setGeometryIdAt( instanceId : number, geometryId : number ) : BatchedMesh + +Sets the geometry ID of the instance at the given index. + +**instanceId** + +The ID of the instance to set the geometry ID of. + +**geometryId** + +The geometry ID to be use by the instance. + +**Returns:** A reference to this batched mesh. + +### .setGeometrySize( maxVertexCount : number, maxIndexCount : number ) + +Resizes the available space in the batch's vertex and index buffer attributes to the provided sizes. If the provided arguments shrink the geometry buffers but there is not enough unused space at the end of the geometry attributes then an error is thrown. + +**maxVertexCount** + +The maximum number of vertices to be used by all unique geometries to resize to. + +**maxIndexCount** + +The maximum number of indices to be used by all unique geometries to resize to. + +### .setInstanceCount( maxInstanceCount : number ) + +Resizes the necessary buffers to support the provided number of instances. If the provided arguments shrink the number of instances but there are not enough unused Ids at the end of the list then an error is thrown. + +**maxInstanceCount** + +The max number of individual instances that can be added and rendered by the batch. + +### .setMatrixAt( instanceId : number, matrix : Matrix4 ) : BatchedMesh + +Sets the given local transformation matrix to the defined instance. Negatively scaled matrices are not supported. + +**instanceId** + +The ID of an instance to set the matrix of. + +**matrix** + +A 4x4 matrix representing the local transformation of a single instance. + +**Returns:** A reference to this batched mesh. + +### .setVisibleAt( instanceId : number, visible : boolean ) : BatchedMesh + +Sets the visibility of the instance. + +**instanceId** + +The id of the instance to set the visibility of. + +**visible** + +Whether the instance is visible or not. + +**Returns:** A reference to this batched mesh. + +### .validateGeometryId( geometryId : number ) + +Validates the geometry defined by the given ID. + +**geometryId** + +The geometry to validate. + +### .validateInstanceId( instanceId : number ) + +Validates the instance defined by the given ID. + +**instanceId** + +The instance to validate. + +## Source + +[src/objects/BatchedMesh.js](https://github.com/mrdoob/three.js/blob/master/src/objects/BatchedMesh.js) \ No newline at end of file diff --git a/docs/pages/BitcastNode.html.md b/docs/pages/BitcastNode.html.md new file mode 100644 index 00000000000000..5a1c365b1419b7 --- /dev/null +++ b/docs/pages/BitcastNode.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# BitcastNode + +This node represents an operation that reinterprets the bit representation of a value in one type as a value in another type. + +## Constructor + +### new BitcastNode( valueNode : Node, conversionType : string, inputType : string ) + +Constructs a new bitcast node. + +**valueNode** + +The value to convert. + +**conversionType** + +The type to convert to. + +**inputType** + +The expected input data type of the bitcast operation. + +Default is `null`. + +## Properties + +### .conversionType : string + +The type the value will be converted to. + +### .inputType : string + +The expected input data type of the bitcast operation. + +Default is `null`. + +### .isBitcastNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .valueNode : Node + +The data to bitcast to a new type. + +## Source + +[src/nodes/math/BitcastNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/math/BitcastNode.js) \ No newline at end of file diff --git a/docs/pages/BitcountNode.html.md b/docs/pages/BitcountNode.html.md new file mode 100644 index 00000000000000..65d1b7db0afd8c --- /dev/null +++ b/docs/pages/BitcountNode.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → Node → TempNode → MathNode →* + +# BitcountNode + +This node represents an operation that counts the bits of a piece of shader data. + +## Constructor + +### new BitcountNode( method : 'countTrailingZeros' | 'countLeadingZeros' | 'countOneBits', aNode : Node ) + +Constructs a new math node. + +**method** + +The method name. + +**aNode** + +The first input. + +## Properties + +### .isBitcountNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/nodes/math/BitcountNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/math/BitcountNode.js) \ No newline at end of file diff --git a/docs/pages/BitonicSort_BitonicSort.html.md b/docs/pages/BitonicSort_BitonicSort.html.md new file mode 100644 index 00000000000000..0a86a70d4e2f8f --- /dev/null +++ b/docs/pages/BitonicSort_BitonicSort.html.md @@ -0,0 +1,23 @@ +# BitonicSort + +### new BitonicSort( renderer : Renderer, dataBuffer : StorageBufferNode, options : Object ) + +Constructs a new light probe helper. + +**renderer** + +The current scene's renderer. + +**dataBuffer** + +The data buffer to sort. + +**options** + +Options that modify the bitonic sort. + +Default is `{}`. + +## Source + +[examples/jsm/gpgpu/BitonicSort.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/gpgpu/BitonicSort.js) \ No newline at end of file diff --git a/docs/pages/BloomNode.html.md b/docs/pages/BloomNode.html.md new file mode 100644 index 00000000000000..1fa7cfc9b28f0d --- /dev/null +++ b/docs/pages/BloomNode.html.md @@ -0,0 +1,146 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# BloomNode + +Post processing node for creating a bloom effect. + +By default, the node affects the entire image. For a selective bloom, use the `emissive` material property to control which objects should contribute to bloom or not. This can be achieved via MRT. + +```js +const postProcessing = new THREE.PostProcessing( renderer ); +const scenePass = pass( scene, camera ); +scenePass.setMRT( mrt( { + output, + emissive +} ) ); +const scenePassColor = scenePass.getTextureNode( 'output' ); +const emissivePass = scenePass.getTextureNode( 'emissive' ); +const bloomPass = bloom( emissivePass ); +postProcessing.outputNode = scenePassColor.add( bloomPass ); +``` + +## Code Example + +```js +const postProcessing = new THREE.PostProcessing( renderer ); +const scenePass = pass( scene, camera ); +const scenePassColor = scenePass.getTextureNode( 'output' ); +const bloomPass = bloom( scenePassColor ); +postProcessing.outputNode = scenePassColor.add( bloomPass ); +``` + +## Import + +BloomNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; +``` + +## Constructor + +### new BloomNode( inputNode : Node., strength : number, radius : number, threshold : number ) + +Constructs a new bloom node. + +**inputNode** + +The node that represents the input of the effect. + +**strength** + +The strength of the bloom. + +Default is `1`. + +**radius** + +The radius of the bloom. + +Default is `0`. + +**threshold** + +The luminance threshold limits which bright areas contribute to the bloom effect. + +Default is `0`. + +## Properties + +### .inputNode : Node. + +The node that represents the input of the effect. + +### .radius : UniformNode. + +The radius of the bloom. Must be in the range `[0,1]`. + +### .smoothWidth : UniformNode. + +Can be used to tweak the extracted luminance from the scene. + +### .strength : UniformNode. + +The strength of the bloom. + +### .threshold : UniformNode. + +The luminance threshold limits which bright areas contribute to the bloom effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/BloomNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/BloomNode.js) \ No newline at end of file diff --git a/docs/pages/BloomPass.html.md b/docs/pages/BloomPass.html.md new file mode 100644 index 00000000000000..9f61fd67783ee8 --- /dev/null +++ b/docs/pages/BloomPass.html.md @@ -0,0 +1,124 @@ +*Inheritance: Pass →* + +# BloomPass + +A pass for a basic Bloom effect. + +[UnrealBloomPass](UnrealBloomPass.html) produces a more advanced Bloom but is also more expensive. + +## Code Example + +```js +const effectBloom = new BloomPass( 0.75 ); +composer.addPass( effectBloom ); +``` + +## Import + +BloomPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; +``` + +## Constructor + +### new BloomPass( strength : number, kernelSize : number, sigma : number ) + +Constructs a new Bloom pass. + +**strength** + +The Bloom strength. + +Default is `1`. + +**kernelSize** + +The kernel size. + +Default is `25`. + +**sigma** + +The sigma. + +Default is `4`. + +## Properties + +### .combineUniforms : Object + +The combine pass uniforms. + +### .convolutionUniforms : Object + +The convolution pass uniforms. + +### .materialCombine : ShaderMaterial + +The combine pass material. + +### .materialConvolution : ShaderMaterial + +The convolution pass material. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the Bloom pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/BloomPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/BloomPass.js) \ No newline at end of file diff --git a/docs/pages/BokehPass.html.md b/docs/pages/BokehPass.html.md new file mode 100644 index 00000000000000..fac33728468fad --- /dev/null +++ b/docs/pages/BokehPass.html.md @@ -0,0 +1,145 @@ +*Inheritance: Pass →* + +# BokehPass + +Pass for creating depth of field (DOF) effect. + +## Code Example + +```js +const bokehPass = new BokehPass( scene, camera, { + focus: 500 + aperture: 5, + maxblur: 0.01 +} ); +composer.addPass( bokehPass ); +``` + +## Import + +BokehPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BokehPass } from 'three/addons/postprocessing/BokehPass.js'; +``` + +## Constructor + +### new BokehPass( scene : Scene, camera : Camera, params : BokehPass~Options ) + +Constructs a new Bokeh pass. + +**scene** + +The scene to render the DOF for. + +**camera** + +The camera. + +**params** + +The pass options. + +## Properties + +### .camera : Camera + +The camera. + +### .materialBokeh : ShaderMaterial + +The pass bokeh material. + +### .scene : Scene + +The scene to render the DOF for. + +### .uniforms : Object + +The pass uniforms. Use this object if you want to update the `focus`, `aperture` or `maxblur` values at runtime. + +```js +pass.uniforms.focus.value = focus; +pass.uniforms.aperture.value = aperture; +pass.uniforms.maxblur.value = maxblur; +``` + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the Bokeh pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Type Definitions + +### .Options + +Constructor options of `BokehPass`. + +**focus** +number + +Defines the effect's focus which is the distance along the camera's look direction in world units. + +Default is `1`. + +**aperture** +number + +Defines the effect's aperture. + +Default is `0.025`. + +**maxblur** +number + +Defines the effect's maximum blur. + +Default is `1`. + +## Source + +[examples/jsm/postprocessing/BokehPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/BokehPass.js) \ No newline at end of file diff --git a/docs/pages/Bone.html.md b/docs/pages/Bone.html.md new file mode 100644 index 00000000000000..2e1b0f180179b9 --- /dev/null +++ b/docs/pages/Bone.html.md @@ -0,0 +1,32 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Bone + +A bone which is part of a [Skeleton](Skeleton.html). The skeleton in turn is used by the [SkinnedMesh](SkinnedMesh.html). + +## Code Example + +```js +const root = new THREE.Bone(); +const child = new THREE.Bone(); +root.add( child ); +child.position.y = 5; +``` + +## Constructor + +### new Bone() + +Constructs a new bone. + +## Properties + +### .isBone : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/objects/Bone.js](https://github.com/mrdoob/three.js/blob/master/src/objects/Bone.js) \ No newline at end of file diff --git a/docs/pages/BooleanKeyframeTrack.html.md b/docs/pages/BooleanKeyframeTrack.html.md new file mode 100644 index 00000000000000..60ef85cf1828bb --- /dev/null +++ b/docs/pages/BooleanKeyframeTrack.html.md @@ -0,0 +1,55 @@ +*Inheritance: KeyframeTrack →* + +# BooleanKeyframeTrack + +A track for boolean keyframe values. + +## Constructor + +### new BooleanKeyframeTrack( name : string, times : Array., values : Array. ) + +Constructs a new boolean keyframe track. + +This keyframe track type has no `interpolation` parameter because the interpolation is always discrete. + +**name** + +The keyframe track's name. + +**times** + +A list of keyframe times. + +**values** + +A list of keyframe values. + +## Properties + +### .DefaultInterpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth + +The default interpolation type of this keyframe track. + +Default is `InterpolateDiscrete`. + +**Overrides:** [KeyframeTrack#DefaultInterpolation](KeyframeTrack.html#DefaultInterpolation) + +### .ValueBufferType : TypedArray | Array + +The value buffer type of this keyframe track. + +Default is `Array.constructor`. + +**Overrides:** [KeyframeTrack#ValueBufferType](KeyframeTrack.html#ValueBufferType) + +### .ValueTypeName : string + +The value type name. + +Default is `'bool'`. + +**Overrides:** [KeyframeTrack#ValueTypeName](KeyframeTrack.html#ValueTypeName) + +## Source + +[src/animation/tracks/BooleanKeyframeTrack.js](https://github.com/mrdoob/three.js/blob/master/src/animation/tracks/BooleanKeyframeTrack.js) \ No newline at end of file diff --git a/docs/pages/Box2.html.md b/docs/pages/Box2.html.md new file mode 100644 index 00000000000000..f50135f2ddddd3 --- /dev/null +++ b/docs/pages/Box2.html.md @@ -0,0 +1,267 @@ +# Box2 + +Represents an axis-aligned bounding box (AABB) in 2D space. + +## Constructor + +### new Box2( min : Vector2, max : Vector2 ) + +Constructs a new bounding box. + +**min** + +A vector representing the lower boundary of the box. + +Default is `(Infinity,Infinity)`. + +**max** + +A vector representing the upper boundary of the box. + +Default is `(-Infinity,-Infinity)`. + +## Properties + +### .isBox2 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .max : Vector2 + +The upper boundary of the box. + +### .min : Vector2 + +The lower boundary of the box. + +## Methods + +### .clampPoint( point : Vector2, target : Vector2 ) : Vector2 + +Clamps the given point within the bounds of this box. + +**point** + +The point to clamp. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The clamped point. + +### .clone() : Box2 + +Returns a new box with copied values from this instance. + +**Returns:** A clone of this instance. + +### .containsBox( box : Box2 ) : boolean + +Returns `true` if this bounding box includes the entirety of the given bounding box. If this box and the given one are identical, this function also returns `true`. + +**box** + +The bounding box to test. + +**Returns:** Whether the bounding box contains the given bounding box or not. + +### .containsPoint( point : Vector2 ) : boolean + +Returns `true` if the given point lies within or on the boundaries of this box. + +**point** + +The point to test. + +**Returns:** Whether the bounding box contains the given point or not. + +### .copy( box : Box2 ) : Box2 + +Copies the values of the given box to this instance. + +**box** + +The box to copy. + +**Returns:** A reference to this bounding box. + +### .distanceToPoint( point : Vector2 ) : number + +Returns the euclidean distance from any edge of this box to the specified point. If the given point lies inside of this box, the distance will be `0`. + +**point** + +The point to compute the distance to. + +**Returns:** The euclidean distance. + +### .equals( box : Box2 ) : boolean + +Returns `true` if this bounding box is equal with the given one. + +**box** + +The box to test for equality. + +**Returns:** Whether this bounding box is equal with the given one. + +### .expandByPoint( point : Vector2 ) : Box2 + +Expands the boundaries of this box to include the given point. + +**point** + +The point that should be included by the bounding box. + +**Returns:** A reference to this bounding box. + +### .expandByScalar( scalar : number ) : Box2 + +Expands each dimension of the box by the given scalar. If negative, the dimensions of the box will be contracted. + +**scalar** + +The scalar value that should expand the bounding box. + +**Returns:** A reference to this bounding box. + +### .expandByVector( vector : Vector2 ) : Box2 + +Expands this box equilaterally by the given vector. The width of this box will be expanded by the x component of the vector in both directions. The height of this box will be expanded by the y component of the vector in both directions. + +**vector** + +The vector that should expand the bounding box. + +**Returns:** A reference to this bounding box. + +### .getCenter( target : Vector2 ) : Vector2 + +Returns the center point of this box. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The center point. + +### .getParameter( point : Vector2, target : Vector2 ) : Vector2 + +Returns a point as a proportion of this box's width and height. + +**point** + +A point in 2D space. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** A point as a proportion of this box's width and height. + +### .getSize( target : Vector2 ) : Vector2 + +Returns the dimensions of this box. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The size. + +### .intersect( box : Box2 ) : Box2 + +Computes the intersection of this bounding box and the given one, setting the upper bound of this box to the lesser of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' lower bounds. If there's no overlap, makes this box empty. + +**box** + +The bounding box to intersect with. + +**Returns:** A reference to this bounding box. + +### .intersectsBox( box : Box2 ) : boolean + +Returns `true` if the given bounding box intersects with this bounding box. + +**box** + +The bounding box to test. + +**Returns:** Whether the given bounding box intersects with this bounding box. + +### .isEmpty() : boolean + +Returns true if this box includes zero points within its bounds. Note that a box with equal lower and upper bounds still includes one point, the one both bounds share. + +**Returns:** Whether this box is empty or not. + +### .makeEmpty() : Box2 + +Makes this box empty which means in encloses a zero space in 2D. + +**Returns:** A reference to this bounding box. + +### .set( min : Vector2, max : Vector2 ) : Box2 + +Sets the lower and upper boundaries of this box. Please note that this method only copies the values from the given objects. + +**min** + +The lower boundary of the box. + +**max** + +The upper boundary of the box. + +**Returns:** A reference to this bounding box. + +### .setFromCenterAndSize( center : Vector2, size : Vector2 ) : Box2 + +Centers this box on the given center vector and sets this box's width, height and depth to the given size values. + +**center** + +The center of the box. + +**size** + +The x and y dimensions of the box. + +**Returns:** A reference to this bounding box. + +### .setFromPoints( points : Array. ) : Box2 + +Sets the upper and lower bounds of this box so it encloses the position data in the given array. + +**points** + +An array holding 2D position data as instances of [Vector2](Vector2.html). + +**Returns:** A reference to this bounding box. + +### .translate( offset : Vector2 ) : Box2 + +Adds the given offset to both the upper and lower bounds of this bounding box, effectively moving it in 2D space. + +**offset** + +The offset that should be used to translate the bounding box. + +**Returns:** A reference to this bounding box. + +### .union( box : Box2 ) : Box2 + +Computes the union of this box and another and the given one, setting the upper bound of this box to the greater of the two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' lower bounds. + +**box** + +The bounding box that will be unioned with this instance. + +**Returns:** A reference to this bounding box. + +## Source + +[src/math/Box2.js](https://github.com/mrdoob/three.js/blob/master/src/math/Box2.js) \ No newline at end of file diff --git a/docs/pages/Box3.html.md b/docs/pages/Box3.html.md new file mode 100644 index 00000000000000..c69e04cb22c25f --- /dev/null +++ b/docs/pages/Box3.html.md @@ -0,0 +1,385 @@ +# Box3 + +Represents an axis-aligned bounding box (AABB) in 3D space. + +## Constructor + +### new Box3( min : Vector3, max : Vector3 ) + +Constructs a new bounding box. + +**min** + +A vector representing the lower boundary of the box. + +Default is `(Infinity,Infinity,Infinity)`. + +**max** + +A vector representing the upper boundary of the box. + +Default is `(-Infinity,-Infinity,-Infinity)`. + +## Properties + +### .isBox3 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .max : Vector3 + +The upper boundary of the box. + +### .min : Vector3 + +The lower boundary of the box. + +## Methods + +### .applyMatrix4( matrix : Matrix4 ) : Box3 + +Transforms this bounding box by the given 4x4 transformation matrix. + +**matrix** + +The transformation matrix. + +**Returns:** A reference to this bounding box. + +### .clampPoint( point : Vector3, target : Vector3 ) : Vector3 + +Clamps the given point within the bounds of this box. + +**point** + +The point to clamp. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The clamped point. + +### .clone() : Box3 + +Returns a new box with copied values from this instance. + +**Returns:** A clone of this instance. + +### .containsBox( box : Box3 ) : boolean + +Returns `true` if this bounding box includes the entirety of the given bounding box. If this box and the given one are identical, this function also returns `true`. + +**box** + +The bounding box to test. + +**Returns:** Whether the bounding box contains the given bounding box or not. + +### .containsPoint( point : Vector3 ) : boolean + +Returns `true` if the given point lies within or on the boundaries of this box. + +**point** + +The point to test. + +**Returns:** Whether the bounding box contains the given point or not. + +### .copy( box : Box3 ) : Box3 + +Copies the values of the given box to this instance. + +**box** + +The box to copy. + +**Returns:** A reference to this bounding box. + +### .distanceToPoint( point : Vector3 ) : number + +Returns the euclidean distance from any edge of this box to the specified point. If the given point lies inside of this box, the distance will be `0`. + +**point** + +The point to compute the distance to. + +**Returns:** The euclidean distance. + +### .equals( box : Box3 ) : boolean + +Returns `true` if this bounding box is equal with the given one. + +**box** + +The box to test for equality. + +**Returns:** Whether this bounding box is equal with the given one. + +### .expandByObject( object : Object3D, precise : boolean ) : Box3 + +Expands the boundaries of this box to include the given 3D object and its children, accounting for the object's, and children's, world transforms. The function may result in a larger box than strictly necessary (unless the precise parameter is set to true). + +**object** + +The 3D object that should expand the bounding box. + +**precise** + +If set to `true`, the method expands the bounding box as little as necessary at the expense of more computation. + +Default is `false`. + +**Returns:** A reference to this bounding box. + +### .expandByPoint( point : Vector3 ) : Box3 + +Expands the boundaries of this box to include the given point. + +**point** + +The point that should be included by the bounding box. + +**Returns:** A reference to this bounding box. + +### .expandByScalar( scalar : number ) : Box3 + +Expands each dimension of the box by the given scalar. If negative, the dimensions of the box will be contracted. + +**scalar** + +The scalar value that should expand the bounding box. + +**Returns:** A reference to this bounding box. + +### .expandByVector( vector : Vector3 ) : Box3 + +Expands this box equilaterally by the given vector. The width of this box will be expanded by the x component of the vector in both directions. The height of this box will be expanded by the y component of the vector in both directions. The depth of this box will be expanded by the z component of the vector in both directions. + +**vector** + +The vector that should expand the bounding box. + +**Returns:** A reference to this bounding box. + +### .fromJSON( json : Object ) : Box3 + +Returns a serialized structure of the bounding box. + +**json** + +The serialized json to set the box from. + +**Returns:** A reference to this bounding box. + +### .getBoundingSphere( target : Sphere ) : Sphere + +Returns a bounding sphere that encloses this bounding box. + +**target** + +The target sphere that is used to store the method's result. + +**Returns:** The bounding sphere that encloses this bounding box. + +### .getCenter( target : Vector3 ) : Vector3 + +Returns the center point of this box. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The center point. + +### .getParameter( point : Vector3, target : Vector3 ) : Vector3 + +Returns a point as a proportion of this box's width, height and depth. + +**point** + +A point in 3D space. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** A point as a proportion of this box's width, height and depth. + +### .getSize( target : Vector3 ) : Vector3 + +Returns the dimensions of this box. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The size. + +### .intersect( box : Box3 ) : Box3 + +Computes the intersection of this bounding box and the given one, setting the upper bound of this box to the lesser of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' lower bounds. If there's no overlap, makes this box empty. + +**box** + +The bounding box to intersect with. + +**Returns:** A reference to this bounding box. + +### .intersectsBox( box : Box3 ) : boolean + +Returns `true` if the given bounding box intersects with this bounding box. + +**box** + +The bounding box to test. + +**Returns:** Whether the given bounding box intersects with this bounding box. + +### .intersectsPlane( plane : Plane ) : boolean + +Returns `true` if the given plane intersects with this bounding box. + +**plane** + +The plane to test. + +**Returns:** Whether the given plane intersects with this bounding box. + +### .intersectsSphere( sphere : Sphere ) : boolean + +Returns `true` if the given bounding sphere intersects with this bounding box. + +**sphere** + +The bounding sphere to test. + +**Returns:** Whether the given bounding sphere intersects with this bounding box. + +### .intersectsTriangle( triangle : Triangle ) : boolean + +Returns `true` if the given triangle intersects with this bounding box. + +**triangle** + +The triangle to test. + +**Returns:** Whether the given triangle intersects with this bounding box. + +### .isEmpty() : boolean + +Returns true if this box includes zero points within its bounds. Note that a box with equal lower and upper bounds still includes one point, the one both bounds share. + +**Returns:** Whether this box is empty or not. + +### .makeEmpty() : Box3 + +Makes this box empty which means in encloses a zero space in 3D. + +**Returns:** A reference to this bounding box. + +### .set( min : Vector3, max : Vector3 ) : Box3 + +Sets the lower and upper boundaries of this box. Please note that this method only copies the values from the given objects. + +**min** + +The lower boundary of the box. + +**max** + +The upper boundary of the box. + +**Returns:** A reference to this bounding box. + +### .setFromArray( array : Array. ) : Box3 + +Sets the upper and lower bounds of this box so it encloses the position data in the given array. + +**array** + +An array holding 3D position data. + +**Returns:** A reference to this bounding box. + +### .setFromBufferAttribute( attribute : BufferAttribute ) : Box3 + +Sets the upper and lower bounds of this box so it encloses the position data in the given buffer attribute. + +**attribute** + +A buffer attribute holding 3D position data. + +**Returns:** A reference to this bounding box. + +### .setFromCenterAndSize( center : Vector3, size : Vector3 ) : Box3 + +Centers this box on the given center vector and sets this box's width, height and depth to the given size values. + +**center** + +The center of the box. + +**size** + +The x, y and z dimensions of the box. + +**Returns:** A reference to this bounding box. + +### .setFromObject( object : Object3D, precise : boolean ) : Box3 + +Computes the world-axis-aligned bounding box for the given 3D object (including its children), accounting for the object's, and children's, world transforms. The function may result in a larger box than strictly necessary. + +**object** + +The 3D object to compute the bounding box for. + +**precise** + +If set to `true`, the method computes the smallest world-axis-aligned bounding box at the expense of more computation. + +Default is `false`. + +**Returns:** A reference to this bounding box. + +### .setFromPoints( points : Array. ) : Box3 + +Sets the upper and lower bounds of this box so it encloses the position data in the given array. + +**points** + +An array holding 3D position data as instances of [Vector3](Vector3.html). + +**Returns:** A reference to this bounding box. + +### .toJSON() : Object + +Returns a serialized structure of the bounding box. + +**Returns:** Serialized structure with fields representing the object state. + +### .translate( offset : Vector3 ) : Box3 + +Adds the given offset to both the upper and lower bounds of this bounding box, effectively moving it in 3D space. + +**offset** + +The offset that should be used to translate the bounding box. + +**Returns:** A reference to this bounding box. + +### .union( box : Box3 ) : Box3 + +Computes the union of this box and another and the given one, setting the upper bound of this box to the greater of the two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' lower bounds. + +**box** + +The bounding box that will be unioned with this instance. + +**Returns:** A reference to this bounding box. + +## Source + +[src/math/Box3.js](https://github.com/mrdoob/three.js/blob/master/src/math/Box3.js) \ No newline at end of file diff --git a/docs/pages/Box3Helper.html.md b/docs/pages/Box3Helper.html.md new file mode 100644 index 00000000000000..f589fd23b73350 --- /dev/null +++ b/docs/pages/Box3Helper.html.md @@ -0,0 +1,46 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# Box3Helper + +A helper object to visualize an instance of [Box3](Box3.html). + +## Code Example + +```js +const box = new THREE.Box3(); +box.setFromCenterAndSize( new THREE.Vector3( 1, 1, 1 ), new THREE.Vector3( 2, 1, 3 ) ); +const helper = new THREE.Box3Helper( box, 0xffff00 ); +scene.add( helper ) +``` + +## Constructor + +### new Box3Helper( box : Box3, color : number | Color | string ) + +Constructs a new box3 helper. + +**box** + +The box to visualize. + +**color** + +The box's color. + +Default is `0xffff00`. + +## Properties + +### .box : Box3 + +The box being visualized. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[src/helpers/Box3Helper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/Box3Helper.js) \ No newline at end of file diff --git a/docs/pages/BoxGeometry.html.md b/docs/pages/BoxGeometry.html.md new file mode 100644 index 00000000000000..e3ea836c048019 --- /dev/null +++ b/docs/pages/BoxGeometry.html.md @@ -0,0 +1,78 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# BoxGeometry + +A geometry class for a rectangular cuboid with a given width, height, and depth. On creation, the cuboid is centred on the origin, with each edge parallel to one of the axes. + +## Code Example + +```js +const geometry = new THREE.BoxGeometry( 1, 1, 1 ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +const cube = new THREE.Mesh( geometry, material ); +scene.add( cube ); +``` + +## Constructor + +### new BoxGeometry( width : number, height : number, depth : number, widthSegments : number, heightSegments : number, depthSegments : number ) + +Constructs a new box geometry. + +**width** + +The width. That is, the length of the edges parallel to the X axis. + +Default is `1`. + +**height** + +The height. That is, the length of the edges parallel to the Y axis. + +Default is `1`. + +**depth** + +The depth. That is, the length of the edges parallel to the Z axis. + +Default is `1`. + +**widthSegments** + +Number of segmented rectangular faces along the width of the sides. + +Default is `1`. + +**heightSegments** + +Number of segmented rectangular faces along the height of the sides. + +Default is `1`. + +**depthSegments** + +Number of segmented rectangular faces along the depth of the sides. + +Default is `1`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : BoxGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/BoxGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/BoxGeometry.js) \ No newline at end of file diff --git a/docs/pages/BoxHelper.html.md b/docs/pages/BoxHelper.html.md new file mode 100644 index 00000000000000..1d9267fe06a422 --- /dev/null +++ b/docs/pages/BoxHelper.html.md @@ -0,0 +1,60 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# BoxHelper + +Helper object to graphically show the world-axis-aligned bounding box around an object. The actual bounding box is handled with [Box3](Box3.html), this is just a visual helper for debugging. It can be automatically resized with [BoxHelper#update](BoxHelper.html#update) when the object it's created from is transformed. Note that the object must have a geometry for this to work, so it won't work with sprites. + +## Code Example + +```js +const sphere = new THREE.SphereGeometry(); +const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) ); +const box = new THREE.BoxHelper( object, 0xffff00 ); +scene.add( box ); +``` + +## Constructor + +### new BoxHelper( object : Object3D, color : number | Color | string ) + +Constructs a new box helper. + +**object** + +The 3D object to show the world-axis-aligned bounding box. + +**color** + +The box's color. + +Default is `0xffff00`. + +## Properties + +### .object : Object3D + +The 3D object being visualized. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .setFromObject( object : Object3D ) : BoxHelper + +Updates the wireframe box for the passed object. + +**object** + +The 3D object to create the helper for. + +**Returns:** A reference to this instance. + +### .update() + +Updates the helper's geometry to match the dimensions of the object, including any children. + +## Source + +[src/helpers/BoxHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/BoxHelper.js) \ No newline at end of file diff --git a/docs/pages/BoxLineGeometry.html.md b/docs/pages/BoxLineGeometry.html.md new file mode 100644 index 00000000000000..beef9828182989 --- /dev/null +++ b/docs/pages/BoxLineGeometry.html.md @@ -0,0 +1,68 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# BoxLineGeometry + +A special type of box geometry intended for [LineSegments](LineSegments.html). + +## Code Example + +```js +const geometry = new THREE.BoxLineGeometry(); +const material = new THREE.LineBasicMaterial( { color: 0x00ff00 } ); +const lines = new THREE.LineSegments( geometry, material ); +scene.add( lines ); +``` + +## Import + +BoxLineGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js'; +``` + +## Constructor + +### new BoxLineGeometry( width : number, height : number, depth : number, widthSegments : number, heightSegments : number, depthSegments : number ) + +Constructs a new box line geometry. + +**width** + +The width. That is, the length of the edges parallel to the X axis. + +Default is `1`. + +**height** + +The height. That is, the length of the edges parallel to the Y axis. + +Default is `1`. + +**depth** + +The depth. That is, the length of the edges parallel to the Z axis. + +Default is `1`. + +**widthSegments** + +Number of segmented rectangular sections along the width of the sides. + +Default is `1`. + +**heightSegments** + +Number of segmented rectangular sections along the height of the sides. + +Default is `1`. + +**depthSegments** + +Number of segmented rectangular sections along the depth of the sides. + +Default is `1`. + +## Source + +[examples/jsm/geometries/BoxLineGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/BoxLineGeometry.js) \ No newline at end of file diff --git a/docs/pages/BufferAttribute.html.md b/docs/pages/BufferAttribute.html.md new file mode 100644 index 00000000000000..e3378fb7457d08 --- /dev/null +++ b/docs/pages/BufferAttribute.html.md @@ -0,0 +1,433 @@ +# BufferAttribute + +This class stores data for an attribute (such as vertex positions, face indices, normals, colors, UVs, and any custom attributes ) associated with a geometry, which allows for more efficient passing of data to the GPU. + +When working with vector-like data, the `fromBufferAttribute( attribute, index )` helper methods on vector and color class might be helpful. E.g. [Vector3#fromBufferAttribute](Vector3.html#fromBufferAttribute). + +## Constructor + +### new BufferAttribute( array : TypedArray, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Properties + +### .array : TypedArray + +The array holding the attribute data. It should have `itemSize * numVertices` elements, where `numVertices` is the number of vertices in the associated geometry. + +### .count : number (readonly) + +Represents the number of items this buffer attribute stores. It is internally computed by dividing the `array` length by the `itemSize`. + +### .gpuType : FloatType | IntType + +Configures the bound GPU type for use in shaders. + +Note: this only has an effect for integer arrays and is not configurable for float arrays. For lower precision float types, use `Float16BufferAttribute`. + +Default is `FloatType`. + +### .id : number (readonly) + +The ID of the buffer attribute. + +### .isBufferAttribute : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .itemSize : number + +The number of values of the array that should be associated with a particular vertex. For instance, if this attribute is storing a 3-component vector (such as a position, normal, or color), then the value should be `3`. + +### .name : string + +The name of the buffer attribute. + +### .needsUpdate : number + +Flag to indicate that this attribute has changed and should be re-sent to the GPU. Set this to `true` when you modify the value of the array. + +Default is `false`. + +### .normalized : boolean + +Applies to integer data only. Indicates how the underlying data in the buffer maps to the values in the GLSL code. For instance, if `array` is an instance of `UInt16Array`, and `normalized` is `true`, the values `0 - +65535` in the array data will be mapped to `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted to floats unmodified, i.e. `65535` becomes `65535.0f`. + +### .updateRanges : Array. + +This can be used to only update some components of stored vectors (for example, just the component related to color). Use the `addUpdateRange()` function to add ranges to this array. + +### .usage : StaticDrawUsage | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage + +Defines the intended usage pattern of the data store for optimization purposes. + +Note: After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render. + +Default is `StaticDrawUsage`. + +### .version : number + +A version number, incremented every time the `needsUpdate` is set to `true`. + +## Methods + +### .addUpdateRange( start : number, count : number ) + +Adds a range of data in the data array to be updated on the GPU. + +**start** + +Position at which to start update. + +**count** + +The number of components to update. + +### .applyMatrix3( m : Matrix3 ) : BufferAttribute + +Applies the given 3x3 matrix to the given attribute. Works with item size `2` and `3`. + +**m** + +The matrix to apply. + +**Returns:** A reference to this instance. + +### .applyMatrix4( m : Matrix4 ) : BufferAttribute + +Applies the given 4x4 matrix to the given attribute. Only works with item size `3`. + +**m** + +The matrix to apply. + +**Returns:** A reference to this instance. + +### .applyNormalMatrix( m : Matrix3 ) : BufferAttribute + +Applies the given 3x3 normal matrix to the given attribute. Only works with item size `3`. + +**m** + +The normal matrix to apply. + +**Returns:** A reference to this instance. + +### .clearUpdateRanges() + +Clears the update ranges. + +### .clone() : BufferAttribute + +Returns a new buffer attribute with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( source : BufferAttribute ) : BufferAttribute + +Copies the values of the given buffer attribute to this instance. + +**source** + +The buffer attribute to copy. + +**Returns:** A reference to this instance. + +### .copyArray( array : TypedArray | Array ) : BufferAttribute + +Copies the given array data into this buffer attribute. + +**array** + +The array to copy. + +**Returns:** A reference to this instance. + +### .copyAt( index1 : number, attribute : BufferAttribute, index2 : number ) : BufferAttribute + +Copies a vector from the given buffer attribute to this one. The start and destination position in the attribute buffers are represented by the given indices. + +**index1** + +The destination index into this buffer attribute. + +**attribute** + +The buffer attribute to copy from. + +**index2** + +The source index into the given buffer attribute. + +**Returns:** A reference to this instance. + +### .getComponent( index : number, component : number ) : number + +Returns the given component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**component** + +The component index. + +**Returns:** The returned value. + +### .getW( index : number ) : number + +Returns the w component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**Returns:** The w component. + +### .getX( index : number ) : number + +Returns the x component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**Returns:** The x component. + +### .getY( index : number ) : number + +Returns the y component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**Returns:** The y component. + +### .getZ( index : number ) : number + +Returns the z component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**Returns:** The z component. + +### .onUpload( callback : function ) : BufferAttribute + +Sets the given callback function that is executed after the Renderer has transferred the attribute array data to the GPU. Can be used to perform clean-up operations after the upload when attribute data are not needed anymore on the CPU side. + +**callback** + +The `onUpload()` callback. + +**Returns:** A reference to this instance. + +### .onUploadCallback() + +A callback function that is executed after the renderer has transferred the attribute array data to the GPU. + +### .set( value : TypedArray | Array, offset : number ) : BufferAttribute + +Sets the given array data in the buffer attribute. + +**value** + +The array data to set. + +**offset** + +The offset in this buffer attribute's array. + +Default is `0`. + +**Returns:** A reference to this instance. + +### .setComponent( index : number, component : number, value : number ) : BufferAttribute + +Sets the given value to the given component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**component** + +The component index. + +**value** + +The value to set. + +**Returns:** A reference to this instance. + +### .setUsage( value : StaticDrawUsage | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage ) : BufferAttribute + +Sets the usage of this buffer attribute. + +**value** + +The usage to set. + +**Returns:** A reference to this buffer attribute. + +### .setW( index : number, w : number ) : BufferAttribute + +Sets the w component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**w** + +The value to set. + +**Returns:** A reference to this instance. + +### .setX( index : number, x : number ) : BufferAttribute + +Sets the x component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**x** + +The value to set. + +**Returns:** A reference to this instance. + +### .setXY( index : number, x : number, y : number ) : BufferAttribute + +Sets the x and y component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**x** + +The value for the x component to set. + +**y** + +The value for the y component to set. + +**Returns:** A reference to this instance. + +### .setXYZ( index : number, x : number, y : number, z : number ) : BufferAttribute + +Sets the x, y and z component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**x** + +The value for the x component to set. + +**y** + +The value for the y component to set. + +**z** + +The value for the z component to set. + +**Returns:** A reference to this instance. + +### .setXYZW( index : number, x : number, y : number, z : number, w : number ) : BufferAttribute + +Sets the x, y, z and w component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**x** + +The value for the x component to set. + +**y** + +The value for the y component to set. + +**z** + +The value for the z component to set. + +**w** + +The value for the w component to set. + +**Returns:** A reference to this instance. + +### .setY( index : number, y : number ) : BufferAttribute + +Sets the y component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**y** + +The value to set. + +**Returns:** A reference to this instance. + +### .setZ( index : number, z : number ) : BufferAttribute + +Sets the z component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**z** + +The value to set. + +**Returns:** A reference to this instance. + +### .toJSON() : Object + +Serializes the buffer attribute into JSON. + +**Returns:** A JSON object representing the serialized buffer attribute. + +### .transformDirection( m : Matrix4 ) : BufferAttribute + +Applies the given 4x4 matrix to the given attribute. Only works with item size `3` and with direction vectors. + +**m** + +The matrix to apply. + +**Returns:** A reference to this instance. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/BufferAttributeNode.html.md b/docs/pages/BufferAttributeNode.html.md new file mode 100644 index 00000000000000..186ea131e7d068 --- /dev/null +++ b/docs/pages/BufferAttributeNode.html.md @@ -0,0 +1,187 @@ +*Inheritance: EventDispatcher → Node → InputNode →* + +# BufferAttributeNode + +In earlier `three.js` versions it was only possible to define attribute data on geometry level. With `BufferAttributeNode`, it is also possible to do this on the node level. + +This new approach is especially interesting when geometry data are generated via compute shaders. The below line converts a storage buffer into an attribute node. + +```js +material.positionNode = positionBuffer.toAttribute(); +``` + +## Code Example + +```js +const geometry = new THREE.PlaneGeometry(); +const positionAttribute = geometry.getAttribute( 'position' ); +const colors = []; +for ( let i = 0; i < position.count; i ++ ) { + colors.push( 1, 0, 0 ); +} +material.colorNode = bufferAttribute( new THREE.Float32BufferAttribute( colors, 3 ) ); +``` + +## Constructor + +### new BufferAttributeNode( value : BufferAttribute | InterleavedBuffer | TypedArray, bufferType : string, bufferStride : number, bufferOffset : number ) + +Constructs a new buffer attribute node. + +**value** + +The attribute data. + +**bufferType** + +The buffer type (e.g. `'vec3'`). + +Default is `null`. + +**bufferStride** + +The buffer stride. + +Default is `0`. + +**bufferOffset** + +The buffer offset. + +Default is `0`. + +## Properties + +### .attribute : BufferAttribute + +A reference to the buffer attribute. + +Default is `null`. + +### .bufferOffset : number + +The buffer offset. + +Default is `0`. + +### .bufferStride : number + +The buffer stride. + +Default is `0`. + +### .bufferType : string + +The buffer type (e.g. `'vec3'`). + +Default is `null`. + +### .global : boolean + +`BufferAttributeNode` sets this property to `true` by default. + +Default is `true`. + +**Overrides:** [InputNode#global](InputNode.html#global) + +### .instanced : boolean + +Whether the attribute is instanced or not. + +Default is `false`. + +### .isBufferNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .usage : number + +The usage property. Set this to `THREE.DynamicDrawUsage` via `.setUsage()`, if you are planning to update the attribute data per frame. + +Default is `StaticDrawUsage`. + +## Methods + +### .generate( builder : NodeBuilder ) : string + +Generates the code snippet of the buffer attribute node. + +**builder** + +The current node builder. + +**Overrides:** [InputNode#generate](InputNode.html#generate) + +**Returns:** The generated code snippet. + +### .getHash( builder : NodeBuilder ) : string + +This method is overwritten since the attribute data might be shared and thus the hash should be shared as well. + +**builder** + +The current node builder. + +**Overrides:** [InputNode#getHash](InputNode.html#getHash) + +**Returns:** The hash. + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation to return a fixed value `'bufferAttribute'`. + +**builder** + +The current node builder. + +**Overrides:** [InputNode#getInputType](InputNode.html#getInputType) + +**Returns:** The input type. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from the buffer attribute. + +**builder** + +The current node builder. + +**Overrides:** [InputNode#getNodeType](InputNode.html#getNodeType) + +**Returns:** The node type. + +### .setInstanced( value : boolean ) : BufferAttributeNode + +Sets the `instanced` property to the given value. + +**value** + +The value to set. + +**Returns:** A reference to this node. + +### .setUsage( value : number ) : BufferAttributeNode + +Sets the `usage` property to the given value. + +**value** + +The usage to set. + +**Returns:** A reference to this node. + +### .setup( builder : NodeBuilder ) + +Depending on which value was passed to the node, `setup()` behaves differently. If no instance of `BufferAttribute` was passed, the method creates an internal attribute and configures it respectively. + +**builder** + +The current node builder. + +**Overrides:** [InputNode#setup](InputNode.html#setup) + +## Source + +[src/nodes/accessors/BufferAttributeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/BufferAttributeNode.js) \ No newline at end of file diff --git a/docs/pages/BufferGeometry.html.md b/docs/pages/BufferGeometry.html.md new file mode 100644 index 00000000000000..b160aa2c52f7bc --- /dev/null +++ b/docs/pages/BufferGeometry.html.md @@ -0,0 +1,411 @@ +*Inheritance: EventDispatcher →* + +# BufferGeometry + +A representation of mesh, line, or point geometry. Includes vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of passing all this data to the GPU. + +## Code Example + +```js +const geometry = new THREE.BufferGeometry(); +// create a simple square shape. We duplicate the top left and bottom right +// vertices because each vertex needs to appear once per triangle. +const vertices = new Float32Array( [ + -1.0, -1.0, 1.0, // v0 + 1.0, -1.0, 1.0, // v1 + 1.0, 1.0, 1.0, // v2 + 1.0, 1.0, 1.0, // v3 + -1.0, 1.0, 1.0, // v4 + -1.0, -1.0, 1.0 // v5 +] ); +// itemSize = 3 because there are 3 values (components) per vertex +geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); +const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); +const mesh = new THREE.Mesh( geometry, material ); +``` + +## Constructor + +### new BufferGeometry() + +Constructs a new geometry. + +## Properties + +### .attributes : Object. + +This dictionary has as id the name of the attribute to be set and as value the buffer attribute to set it to. Rather than accessing this property directly, use `setAttribute()` and `getAttribute()` to access attributes of this geometry. + +### .boundingBox : Box3 + +Bounding box for the geometry which can be calculated with `computeBoundingBox()`. + +Default is `null`. + +### .boundingSphere : Sphere + +Bounding sphere for the geometry which can be calculated with `computeBoundingSphere()`. + +Default is `null`. + +### .drawRange : Object + +Determines the part of the geometry to render. This should not be set directly, instead use `setDrawRange()`. + +### .groups : Array. + +Split the geometry into groups, each of which will be rendered in a separate draw call. This allows an array of materials to be used with the geometry. + +Use `addGroup()` and `clearGroups()` to edit groups, rather than modifying this array directly. + +Every vertex and index must belong to exactly one group — groups must not share vertices or indices, and must not leave vertices or indices unused. + +### .id : number (readonly) + +The ID of the geometry. + +### .index : BufferAttribute + +Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles". Each triangle is associated with the indices of three vertices. This attribute therefore stores the index of each vertex for each triangular face. If this attribute is not set, the renderer assumes that each three contiguous positions represent a single triangle. + +Default is `null`. + +### .indirect : BufferAttribute + +A (storage) buffer attribute which was generated with a compute shader and now defines indirect draw calls. + +Can only be used with [WebGPURenderer](WebGPURenderer.html) and a WebGPU backend. + +Default is `null`. + +### .indirectOffset : number | Array. + +The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset. + +Can only be used with [WebGPURenderer](WebGPURenderer.html) and a WebGPU backend. + +Default is `0`. + +### .isBufferGeometry : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .morphAttributes : Object + +This dictionary holds the morph targets of the geometry. + +Note: Once the geometry has been rendered, the morph attribute data cannot be changed. You will have to call `dispose()`, and create a new geometry instance. + +### .morphTargetsRelative : boolean + +Used to control the morph target behavior; when set to `true`, the morph target data is treated as relative offsets, rather than as absolute positions/normals. + +Default is `false`. + +### .name : string + +The name of the geometry. + +### .userData : Object + +An object that can be used to store custom data about the geometry. It should not hold references to functions as these will not be cloned. + +### .uuid : string (readonly) + +The UUID of the geometry. + +## Methods + +### .addGroup( start : number, count : number, materialIndex : number ) + +Adds a group to this geometry. + +**start** + +The first element in this draw call. That is the first vertex for non-indexed geometry, otherwise the first triangle index. + +**count** + +Specifies how many vertices (or indices) are part of this group. + +**materialIndex** + +The material array index to use. + +Default is `0`. + +### .applyMatrix4( matrix : Matrix4 ) : BufferGeometry + +Applies the given 4x4 transformation matrix to the geometry. + +**matrix** + +The matrix to apply. + +**Returns:** A reference to this instance. + +### .applyQuaternion( q : Quaternion ) : BufferGeometry + +Applies the rotation represented by the Quaternion to the geometry. + +**q** + +The Quaternion to apply. + +**Returns:** A reference to this instance. + +### .center() : BufferGeometry + +Center the geometry based on its bounding box. + +**Returns:** A reference to this instance. + +### .clearGroups() + +Clears all groups. + +### .clone() : BufferGeometry + +Returns a new geometry with copied values from this instance. + +**Returns:** A clone of this instance. + +### .computeBoundingBox() + +Computes the bounding box of the geometry, and updates the `boundingBox` member. The bounding box is not computed by the engine; it must be computed by your app. You may need to recompute the bounding box if the geometry vertices are modified. + +### .computeBoundingSphere() + +Computes the bounding sphere of the geometry, and updates the `boundingSphere` member. The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. You may need to recompute the bounding sphere if the geometry vertices are modified. + +### .computeTangents() + +Calculates and adds a tangent attribute to this geometry. + +The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by BufferGeometryUtils#computeMikkTSpaceTangents instead. + +### .computeVertexNormals() + +Computes vertex normals for the given vertex data. For indexed geometries, the method sets each vertex normal to be the average of the face normals of the faces that share that vertex. For non-indexed geometries, vertices are not shared, and the method sets each vertex normal to be the same as the face normal. + +### .copy( source : BufferGeometry ) : BufferGeometry + +Copies the values of the given geometry to this instance. + +**source** + +The geometry to copy. + +**Returns:** A reference to this instance. + +### .deleteAttribute( name : string ) : BufferGeometry + +Deletes the attribute for the given name. + +**name** + +The attribute name to delete. + +**Returns:** A reference to this instance. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +##### Fires: + +* BufferGeometry#event:dispose + +### .getAttribute( name : string ) : BufferAttribute | InterleavedBufferAttribute | undefined + +Returns the buffer attribute for the given name. + +**name** + +The attribute name. + +**Returns:** The buffer attribute. Returns `undefined` if not attribute has been found. + +### .getIndex() : BufferAttribute + +Returns the index of this geometry. + +**Returns:** The index. Returns `null` if no index is defined. + +### .getIndirect() : BufferAttribute + +Returns the indirect attribute of this geometry. + +**Returns:** The indirect attribute. Returns `null` if no indirect attribute is defined. + +### .hasAttribute( name : string ) : boolean + +Returns `true` if this geometry has an attribute for the given name. + +**name** + +The attribute name. + +**Returns:** Whether this geometry has an attribute for the given name or not. + +### .lookAt( vector : Vector3 ) : BufferGeometry + +Rotates the geometry to face a point in 3D space. This is typically done as a one time operation, and not during a loop. Use [Object3D#lookAt](Object3D.html#lookAt) for typical real-time mesh rotation. + +**vector** + +The target point. + +**Returns:** A reference to this instance. + +### .normalizeNormals() + +Ensures every normal vector in a geometry will have a magnitude of `1`. This will correct lighting on the geometry surfaces. + +### .rotateX( angle : number ) : BufferGeometry + +Rotates the geometry about the X axis. This is typically done as a one time operation, and not during a loop. Use [Object3D#rotation](Object3D.html#rotation) for typical real-time mesh rotation. + +**angle** + +The angle in radians. + +**Returns:** A reference to this instance. + +### .rotateY( angle : number ) : BufferGeometry + +Rotates the geometry about the Y axis. This is typically done as a one time operation, and not during a loop. Use [Object3D#rotation](Object3D.html#rotation) for typical real-time mesh rotation. + +**angle** + +The angle in radians. + +**Returns:** A reference to this instance. + +### .rotateZ( angle : number ) : BufferGeometry + +Rotates the geometry about the Z axis. This is typically done as a one time operation, and not during a loop. Use [Object3D#rotation](Object3D.html#rotation) for typical real-time mesh rotation. + +**angle** + +The angle in radians. + +**Returns:** A reference to this instance. + +### .scale( x : number, y : number, z : number ) : BufferGeometry + +Scales the geometry. This is typically done as a one time operation, and not during a loop. Use [Object3D#scale](Object3D.html#scale) for typical real-time mesh rotation. + +**x** + +The x scale. + +**y** + +The y scale. + +**z** + +The z scale. + +**Returns:** A reference to this instance. + +### .setAttribute( name : string, attribute : BufferAttribute | InterleavedBufferAttribute ) : BufferGeometry + +Sets the given attribute for the given name. + +**name** + +The attribute name. + +**attribute** + +The attribute to set. + +**Returns:** A reference to this instance. + +### .setDrawRange( start : number, count : number ) + +Sets the draw range for this geometry. + +**start** + +The first vertex for non-indexed geometry, otherwise the first triangle index. + +**count** + +For non-indexed BufferGeometry, `count` is the number of vertices to render. For indexed BufferGeometry, `count` is the number of indices to render. + +### .setFromPoints( points : Array. | Array. ) : BufferGeometry + +Defines a geometry by creating a `position` attribute based on the given array of points. The array can hold 2D or 3D vectors. When using two-dimensional data, the `z` coordinate for all vertices is set to `0`. + +If the method is used with an existing `position` attribute, the vertex data are overwritten with the data from the array. The length of the array must match the vertex count. + +**points** + +The points. + +**Returns:** A reference to this instance. + +### .setIndex( index : Array. | BufferAttribute ) : BufferGeometry + +Sets the given index to this geometry. + +**index** + +The index to set. + +**Returns:** A reference to this instance. + +### .setIndirect( indirect : BufferAttribute, indirectOffset : number | Array. ) : BufferGeometry + +Sets the given indirect attribute to this geometry. + +**indirect** + +The attribute holding indirect draw calls. + +**indirectOffset** + +The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset. + +Default is `0`. + +**Returns:** A reference to this instance. + +### .toJSON() : Object + +Serializes the geometry into JSON. + +**Returns:** A JSON object representing the serialized geometry. + +### .toNonIndexed() : BufferGeometry + +Return a new non-index version of this indexed geometry. If the geometry is already non-indexed, the method is a NOOP. + +**Returns:** The non-indexed version of this indexed geometry. + +### .translate( x : number, y : number, z : number ) : BufferGeometry + +Translates the geometry. This is typically done as a one time operation, and not during a loop. Use [Object3D#position](Object3D.html#position) for typical real-time mesh rotation. + +**x** + +The x offset. + +**y** + +The y offset. + +**z** + +The z offset. + +**Returns:** A reference to this instance. + +## Source + +[src/core/BufferGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferGeometry.js) \ No newline at end of file diff --git a/docs/pages/BufferGeometryLoader.html.md b/docs/pages/BufferGeometryLoader.html.md new file mode 100644 index 00000000000000..3bd8bc3c990529 --- /dev/null +++ b/docs/pages/BufferGeometryLoader.html.md @@ -0,0 +1,65 @@ +*Inheritance: Loader →* + +# BufferGeometryLoader + +Class for loading geometries. The files are internally loaded via [FileLoader](FileLoader.html). + +## Code Example + +```js +const loader = new THREE.BufferGeometryLoader(); +const geometry = await loader.loadAsync( 'models/json/pressure.json' ); +const material = new THREE.MeshBasicMaterial( { color: 0xF5F5F5 } ); +const object = new THREE.Mesh( geometry, material ); +scene.add( object ); +``` + +## Constructor + +### new BufferGeometryLoader( manager : LoadingManager ) + +Constructs a new geometry loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and pass the loaded geometry to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( json : Object ) : BufferGeometry + +Parses the given JSON object and returns a geometry. + +**json** + +The serialized geometry. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed geometry. + +## Source + +[src/loaders/BufferGeometryLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/BufferGeometryLoader.js) \ No newline at end of file diff --git a/docs/pages/BufferNode.html.md b/docs/pages/BufferNode.html.md new file mode 100644 index 00000000000000..f5cf929b46d3ed --- /dev/null +++ b/docs/pages/BufferNode.html.md @@ -0,0 +1,102 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode →* + +# BufferNode + +A special type of uniform node which represents array-like data as uniform buffers. The access usually happens via `element()` which returns an instance of [ArrayElementNode](ArrayElementNode.html). For example: + +In general, it is recommended to use the more managed [UniformArrayNode](UniformArrayNode.html) since it handles more input types and automatically cares about buffer paddings. + +## Code Example + +```js +const bufferNode = buffer( array, 'mat4', count ); +const matrixNode = bufferNode.element( index ); // access a matrix from the buffer +``` + +## Constructor + +### new BufferNode( value : Array., bufferType : string, bufferCount : number ) + +Constructs a new buffer node. + +**value** + +Array-like buffer data. + +**bufferType** + +The data type of the buffer. + +**bufferCount** + +The count of buffer elements. + +Default is `0`. + +## Properties + +### .bufferCount : number + +The uniform node that holds the value of the reference node. + +Default is `0`. + +### .bufferType : string + +The data type of the buffer. + +### .isBufferNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .updateRanges : Array.<{start: number, count: number}> + +An array of update ranges. + +## Methods + +### .addUpdateRange( start : number, count : number ) + +Adds a range of data in the data array to be updated on the GPU. + +**start** + +Position at which to start update. + +**count** + +The number of components to update. + +### .clearUpdateRanges() + +Clears the update ranges. + +### .getElementType( builder : NodeBuilder ) : string + +The data type of the buffer elements. + +**builder** + +The current node builder. + +**Overrides:** [UniformNode#getElementType](UniformNode.html#getElementType) + +**Returns:** The element type. + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation to return a fixed value `'buffer'`. + +**builder** + +The current node builder. + +**Overrides:** [UniformNode#getInputType](UniformNode.html#getInputType) + +**Returns:** The input type. + +## Source + +[src/nodes/accessors/BufferNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/BufferNode.js) \ No newline at end of file diff --git a/docs/pages/BuiltinNode.html.md b/docs/pages/BuiltinNode.html.md new file mode 100644 index 00000000000000..3174271b0c305f --- /dev/null +++ b/docs/pages/BuiltinNode.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Node →* + +# BuiltinNode + +The node allows to set values for built-in shader variables. That is required for features like hardware-accelerated vertex clipping. + +## Constructor + +### new BuiltinNode( name : string ) + +Constructs a new builtin node. + +**name** + +The name of the built-in shader variable. + +## Properties + +### .isBuiltinNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the built-in shader variable. + +**Overrides:** [Node#name](Node.html#name) + +## Methods + +### .generate( builder : NodeBuilder ) : string + +Generates the code snippet of the builtin node. + +**builder** + +The current node builder. + +**Overrides:** [Node#generate](Node.html#generate) + +**Returns:** The generated code snippet. + +## Source + +[src/nodes/accessors/BuiltinNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/BuiltinNode.js) \ No newline at end of file diff --git a/docs/pages/BumpMapNode.html.md b/docs/pages/BumpMapNode.html.md new file mode 100644 index 00000000000000..d7995656202b2a --- /dev/null +++ b/docs/pages/BumpMapNode.html.md @@ -0,0 +1,43 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# BumpMapNode + +This class can be used for applying bump maps to materials. + +## Code Example + +```js +material.normalNode = bumpMap( texture( bumpTex ) ); +``` + +## Constructor + +### new BumpMapNode( textureNode : Node., scaleNode : Node. ) + +Constructs a new bump map node. + +**textureNode** + +Represents the bump map data. + +**scaleNode** + +Controls the intensity of the bump effect. + +Default is `null`. + +## Properties + +### .scaleNode : Node. + +Controls the intensity of the bump effect. + +Default is `null`. + +### .textureNode : Node. + +Represents the bump map data. + +## Source + +[src/nodes/display/BumpMapNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/BumpMapNode.js) \ No newline at end of file diff --git a/docs/pages/BundleGroup.html.md b/docs/pages/BundleGroup.html.md new file mode 100644 index 00000000000000..2849a49c7c5c13 --- /dev/null +++ b/docs/pages/BundleGroup.html.md @@ -0,0 +1,53 @@ +*Inheritance: EventDispatcher → Object3D → Group →* + +# BundleGroup + +A specialized group which enables applications access to the Render Bundle API of WebGPU. The group with all its descendant nodes are considered as one render bundle and processed as such by the renderer. + +This module is only fully supported by `WebGPURenderer` with a WebGPU backend. With a WebGL backend, the group can technically be rendered but without any performance improvements. + +## Constructor + +### new BundleGroup() + +Constructs a new bundle group. + +## Properties + +### .isBundleGroup : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .needsUpdate : boolean + +Set this property to `true` when the bundle group has changed. + +Default is `false`. + +### .static : boolean + +Whether the bundle is static or not. When set to `true`, the structure is assumed to be static and does not change. E.g. no new objects are added to the group + +If a change is required, an update can still be forced by setting the `needsUpdate` flag to `true`. + +Default is `true`. + +### .type : string (readonly) + +This property is only relevant for detecting types during serialization/deserialization. It should always match the class name. + +Default is `'BundleGroup'`. + +**Overrides:** [Group#type](Group.html#type) + +### .version : number (readonly) + +The bundle group's version. + +Default is `0`. + +## Source + +[src/renderers/common/BundleGroup.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/BundleGroup.js) \ No newline at end of file diff --git a/docs/pages/BypassNode.html.md b/docs/pages/BypassNode.html.md new file mode 100644 index 00000000000000..eb6b72921aafcf --- /dev/null +++ b/docs/pages/BypassNode.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Node →* + +# BypassNode + +The class generates the code of a given node but returns another node in the output. This can be used to call a method or node that does not return a value, i.e. type `void` on an input where returning a value is required. Example: + +## Code Example + +```js +material.colorNode = myColor.bypass( runVoidFn() ) +``` + +## Constructor + +### new BypassNode( outputNode : Node, callNode : Node ) + +Constructs a new bypass node. + +**outputNode** + +The output node. + +**callNode** + +The call node. + +## Properties + +### .callNode : Node + +The call node. + +### .isBypassNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .outputNode : Node + +The output node. + +## Source + +[src/nodes/core/BypassNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/BypassNode.js) \ No newline at end of file diff --git a/docs/pages/CCDIKHelper.html.md b/docs/pages/CCDIKHelper.html.md new file mode 100644 index 00000000000000..f303ac97e99d48 --- /dev/null +++ b/docs/pages/CCDIKHelper.html.md @@ -0,0 +1,73 @@ +*Inheritance: EventDispatcher → Object3D →* + +# CCDIKHelper + +Helper for visualizing IK bones. + +## Import + +CCDIKHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CCDIKHelper } from 'three/addons/animation/CCDIKSolver.js'; +``` + +## Constructor + +### new CCDIKHelper( mesh : SkinnedMesh, iks : Array., sphereSize : number ) + +**mesh** + +The skinned mesh. + +**iks** + +The IK objects. + +Default is `[]`. + +**sphereSize** + +The sphere size. + +Default is `0.25`. + +## Properties + +### .effectorSphereMaterial : MeshBasicMaterial + +The material for the effector spheres. + +### .iks : Array. + +The IK objects. + +### .lineMaterial : LineBasicMaterial + +A global line material. + +### .linkSphereMaterial : MeshBasicMaterial + +The material for the link spheres. + +### .root : SkinnedMesh + +The skinned mesh this helper refers to. + +### .sphereGeometry : SkinnedMesh + +The helpers sphere geometry. + +### .targetSphereMaterial : MeshBasicMaterial + +The material for the target spheres. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[examples/jsm/animation/CCDIKSolver.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/CCDIKSolver.js) \ No newline at end of file diff --git a/docs/pages/CCDIKSolver.html.md b/docs/pages/CCDIKSolver.html.md new file mode 100644 index 00000000000000..3ad1b4672a7e5e --- /dev/null +++ b/docs/pages/CCDIKSolver.html.md @@ -0,0 +1,155 @@ +# CCDIKSolver + +This class solves the Inverse Kinematics Problem with a [CCD Algorithm](https://web.archive.org/web/20221206080850/https://sites.google.com/site/auraliusproject/ccd-algorithm). + +`CCDIKSolver` is designed to work with instances of [SkinnedMesh](SkinnedMesh.html). + +## Import + +CCDIKSolver is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CCDIKSolver } from 'three/addons/animation/CCDIKSolver.js'; +``` + +## Constructor + +### new CCDIKSolver( mesh : SkinnedMesh, iks : Array. ) + +**mesh** + +The skinned mesh. + +**iks** + +The IK objects. + +Default is `[]`. + +## Properties + +### .iks : SkinnedMesh + +The IK objects. + +### .mesh : SkinnedMesh + +The skinned mesh. + +## Methods + +### .createHelper( sphereSize : number ) : CCDIKHelper + +Creates a helper for visualizing the CCDIK. + +**sphereSize** + +The sphere size. + +**Returns:** The created helper. + +### .update( globalBlendFactor : number ) : CCDIKSolver + +Updates all IK bones by solving the CCD algorithm. + +**globalBlendFactor** + +Blend factor applied if an IK chain doesn't have its own .blendFactor. + +Default is `1.0`. + +**Returns:** A reference to this instance. + +### .updateOne( ik : CCDIKSolver~IK, overrideBlend : number ) : CCDIKSolver + +Updates one IK bone solving the CCD algorithm. + +**ik** + +The IK to update. + +**overrideBlend** + +If the IK object does not define `blendFactor`, this value is used. + +Default is `1.0`. + +**Returns:** A reference to this instance. + +## Type Definitions + +### .BoneLink + +This type represents bone links. + +**index** +number + +The index of a linked bone which refers to a bone in the `Skeleton.bones` array. + +**limitation** +number + +Rotation axis. + +**rotationMin** +number + +Rotation minimum limit. + +**rotationMax** +number + +Rotation maximum limit. + +**enabled** +boolean + +Whether the link is enabled or not. + +Default is `true`. + +### .IK + +This type represents IK configuration objects. + +**target** +number + +The target bone index which refers to a bone in the `Skeleton.bones` array. + +**effector** +number + +The effector bone index which refers to a bone in the `Skeleton.bones` array. + +**links** +Array.<[CCDIKSolver~BoneLink](CCDIKSolver.html#~BoneLink)\> + +An array of bone links. + +**iteration** +number + +Iteration number of calculation. Smaller is faster but less precise. + +Default is `1`. + +**minAngle** +number + +Minimum rotation angle in a step in radians. + +**maxAngle** +number + +Minimum rotation angle in a step in radians. + +**blendFactor** +number + +The blend factor. + +## Source + +[examples/jsm/animation/CCDIKSolver.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/CCDIKSolver.js) \ No newline at end of file diff --git a/docs/pages/CSM.html.md b/docs/pages/CSM.html.md new file mode 100644 index 00000000000000..418b999176d97d --- /dev/null +++ b/docs/pages/CSM.html.md @@ -0,0 +1,244 @@ +# CSM + +An implementation of Cascade Shadow Maps (CSM). + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [CSMShadowNode](CSMShadowNode.html) instead. + +## Import + +CSM is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSM } from 'three/addons/csm/CSM.js'; +``` + +## Constructor + +### new CSM( data : CSM~Data ) + +Constructs a new CSM instance. + +**data** + +The CSM data. + +## Classes + +[CSM](CSM.html) + +## Properties + +### .breaks : Array. + +An array of numbers in the range `[0,1]` the defines how the mainCSM frustum should be split up. + +### .camera : Camera + +The scene's camera. + +### .cascades : number + +The number of cascades. + +Default is `3`. + +### .customSplitsCallback : function + +Custom split callback when using `mode='custom'`. + +### .fade : boolean + +Whether to fade between cascades or not. + +Default is `false`. + +### .frustums : Array. + +An array of frustums representing the cascades. + +### .lightDirection : Vector3 + +The light direction. + +### .lightFar : number + +The light far value. + +Default is `2000`. + +### .lightIntensity : number + +The light intensity. + +Default is `3`. + +### .lightMargin : number + +The light margin. + +Default is `200`. + +### .lightNear : number + +The light near value. + +Default is `1`. + +### .lights : Array. + +An array of directional lights which cast the shadows for the different cascades. There is one directional light for each cascade. + +### .mainFrustum : CSMFrustum + +The main frustum. + +### .maxFar : number + +The maximum far value. + +Default is `100000`. + +### .mode : 'practical' | 'uniform' | 'logarithmic' | 'custom' + +The frustum split mode. + +Default is `'practical'`. + +### .parent : Object3D + +The parent object, usually the scene. + +### .shaders : Map. + +A Map holding enhanced material shaders. + +### .shadowBias : number + +The shadow bias. + +Default is `0.000001`. + +### .shadowMapSize : number + +The shadow map size. + +Default is `2048`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .remove() + +Applications must call this method when they remove the CSM usage from their scene. + +### .setupMaterial( material : Material ) + +Applications must call this method for all materials that should be affected by CSM. + +**material** + +The material to setup for CSM support. + +### .update() + +Updates the CSM. This method must be called in your animation loop before calling `renderer.render()`. + +### .updateFrustums() + +Applications must call this method every time they change camera or CSM settings. + +## Type Definitions + +### .Data + +Constructor data of `CSM`. + +**camera** +[Camera](Camera.html) + +The scene's camera. + +**parent** +[Object3D](Object3D.html) + +The parent object, usually the scene. + +**cascades** +number + +The number of cascades. + +Default is `3`. + +**maxFar** +number + +The maximum far value. + +Default is `100000`. + +**mode** +'practical' | 'uniform' | 'logarithmic' | 'custom' + +The frustum split mode. + +Default is `'practical'`. + +**customSplitsCallback** +function + +Custom split callback when using `mode='custom'`. + +**shadowMapSize** +number + +The shadow map size. + +Default is `2048`. + +**shadowBias** +number + +The shadow bias. + +Default is `0.000001`. + +**lightDirection** +[Vector3](Vector3.html) + +The light direction. + +**lightIntensity** +number + +The light intensity. + +Default is `3`. + +**lightNear** +number + +The light near value. + +Default is `1`. + +**lightNear** +number + +The light far value. + +Default is `2000`. + +**lightMargin** +number + +The light margin. + +Default is `200`. + +## Source + +[examples/jsm/csm/CSM.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/csm/CSM.js) \ No newline at end of file diff --git a/docs/pages/CSMFrustum.html.md b/docs/pages/CSMFrustum.html.md new file mode 100644 index 00000000000000..70a1102af29af0 --- /dev/null +++ b/docs/pages/CSMFrustum.html.md @@ -0,0 +1,96 @@ +# CSMFrustum + +Represents the frustum of a CSM instance. + +## Import + +CSMFrustum is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSMFrustum } from 'three/addons/csm/CSMFrustum.js'; +``` + +## Constructor + +### new CSMFrustum( data : CSMFrustum~Data ) + +Constructs a new CSM frustum. + +**data** + +The CSM data. + +## Properties + +### .vertices : Object + +An object representing the vertices of the near and far plane in view space. + +### .zNear : number + +The zNear value. This value depends on whether the CSM is used with WebGL or WebGPU. Both API use different conventions for their projection matrices. + +## Methods + +### .setFromProjectionMatrix( projectionMatrix : Matrix4, maxFar : number ) : Object + +Setups this CSM frustum from the given projection matrix and max far value. + +**projectionMatrix** + +The projection matrix, usually of the scene's camera. + +**maxFar** + +The maximum far value. + +**Returns:** An object representing the vertices of the near and far plane in view space. + +### .split( breaks : Array., target : Array. ) + +Splits the CSM frustum by the given array. The new CSM frustum are pushed into the given target array. + +**breaks** + +An array of numbers in the range `[0,1]` the defines how the CSM frustum should be split up. + +**target** + +The target array that holds the new CSM frustums. + +### .toSpace( cameraMatrix : Matrix4, target : CSMFrustum ) + +Transforms the given target CSM frustum into the different coordinate system defined by the given camera matrix. + +**cameraMatrix** + +The matrix that defines the new coordinate system. + +**target** + +The CSM to convert. + +## Type Definitions + +### .Data + +Constructor data of `CSMFrustum`. + +**webGL** +boolean + +Whether this CSM frustum is used with WebGL or WebGPU. + +**projectionMatrix** +[Matrix4](Matrix4.html) + +A projection matrix usually of the scene's camera. + +**maxFar** +number + +The maximum far value. + +## Source + +[examples/jsm/csm/CSMFrustum.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/csm/CSMFrustum.js) \ No newline at end of file diff --git a/docs/pages/CSMHelper.html.md b/docs/pages/CSMHelper.html.md new file mode 100644 index 00000000000000..c67e1f138b2112 --- /dev/null +++ b/docs/pages/CSMHelper.html.md @@ -0,0 +1,65 @@ +*Inheritance: EventDispatcher → Object3D → Group →* + +# CSMHelper + +A helper for visualizing the cascades of a CSM instance. + +## Import + +CSMHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSMHelper } from 'three/addons/csm/CSMHelper.js'; +``` + +## Constructor + +### new CSMHelper( csm : CSM | CSMShadowNode ) + +Constructs a new CSM helper. + +**csm** + +The CSM instance to visualize. + +## Properties + +### .csm : CSM | CSMShadowNode + +The CSM instance to visualize. + +### .displayFrustum : boolean + +Whether to display the CSM frustum or not. + +Default is `true`. + +### .displayPlanes : boolean + +Whether to display the cascade planes or not. + +Default is `true`. + +### .displayShadowBounds : boolean + +Whether to display the shadow bounds or not. + +Default is `true`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the helper. This method should be called in the app's animation loop. + +### .updateVisibility() + +This method must be called if one of the `display*` properties is changed at runtime. + +## Source + +[examples/jsm/csm/CSMHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/csm/CSMHelper.js) \ No newline at end of file diff --git a/docs/pages/CSMShadowNode.html.md b/docs/pages/CSMShadowNode.html.md new file mode 100644 index 00000000000000..ef1e11e1650d3c --- /dev/null +++ b/docs/pages/CSMShadowNode.html.md @@ -0,0 +1,146 @@ +*Inheritance: EventDispatcher → Node → ShadowBaseNode →* + +# CSMShadowNode + +An implementation of Cascade Shadow Maps (CSM). + +This module can only be used with [WebGPURenderer](WebGPURenderer.html). When using [WebGLRenderer](WebGLRenderer.html), use [CSM](CSM.html) instead. + +## Import + +CSMShadowNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSMShadowNode } from 'three/addons/csm/CSMShadowNode.js'; +``` + +## Constructor + +### new CSMShadowNode( light : DirectionalLight, data : CSMShadowNode~Data ) + +Constructs a new CSM shadow node. + +**light** + +The CSM light. + +**data** + +The CSM data. + +Default is `{}`. + +## Properties + +### .breaks : Array. + +An array of numbers in the range `[0,1]` the defines how the mainCSM frustum should be split up. + +### .camera : Camera + +The scene's camera. + +Default is `null`. + +### .cascades : number + +The number of cascades. + +Default is `3`. + +### .customSplitsCallback : function + +Custom split callback when using `mode='custom'`. + +### .fade : boolean + +Whether to fade between cascades or not. + +Default is `false`. + +### .frustums : Array. + +An array of frustums representing the cascades. + +### .lightMargin : number + +The light margin. + +Default is `200`. + +### .lights : Array. + +An array of directional lights which cast the shadows for the different cascades. There is one directional light for each cascade. + +### .mainFrustum : CSMFrustum + +The main frustum. + +Default is `null`. + +### .maxFar : number + +The maximum far value. + +Default is `100000`. + +### .mode : 'practical' | 'uniform' | 'logarithmic' | 'custom' + +The frustum split mode. + +Default is `'practical'`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +**Overrides:** [ShadowBaseNode#dispose](ShadowBaseNode.html#dispose) + +### .updateFrustums() + +Applications must call this method every time they change camera or CSM settings. + +## Type Definitions + +### .Data + +Constructor data of `CSMShadowNode`. + +**cascades** +number + +The number of cascades. + +Default is `3`. + +**maxFar** +number + +The maximum far value. + +Default is `100000`. + +**mode** +'practical' | 'uniform' | 'logarithmic' | 'custom' + +The frustum split mode. + +Default is `'practical'`. + +**customSplitsCallback** +function + +Custom split callback when using `mode='custom'`. + +**lightMargin** +number + +The light margin. + +Default is `200`. + +## Source + +[examples/jsm/csm/CSMShadowNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/csm/CSMShadowNode.js) \ No newline at end of file diff --git a/docs/pages/CSS2DObject.html.md b/docs/pages/CSS2DObject.html.md new file mode 100644 index 00000000000000..900ed6e7faec80 --- /dev/null +++ b/docs/pages/CSS2DObject.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Object3D →* + +# CSS2DObject + +The only type of 3D object that is supported by [CSS2DRenderer](CSS2DRenderer.html). + +## Import + +CSS2DObject is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; +``` + +## Constructor + +### new CSS2DObject( element : HTMLElement ) + +Constructs a new CSS2D object. + +**element** + +The DOM element. + +## Properties + +### .center : Vector2 + +The 3D objects center point. `( 0, 0 )` is the lower left, `( 1, 1 )` is the top right. + +Default is `(0.5,0.5)`. + +### .element : HTMLElement (readonly) + +The DOM element which defines the appearance of this 3D object. + +Default is `true`. + +### .isCSS2DObject : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[examples/jsm/renderers/CSS2DRenderer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/CSS2DRenderer.js) \ No newline at end of file diff --git a/docs/pages/CSS2DRenderer.html.md b/docs/pages/CSS2DRenderer.html.md new file mode 100644 index 00000000000000..0f5b032386992a --- /dev/null +++ b/docs/pages/CSS2DRenderer.html.md @@ -0,0 +1,84 @@ +# CSS2DRenderer + +This renderer is a simplified version of [CSS3DRenderer](CSS3DRenderer.html). The only transformation that is supported is translation. + +The renderer is very useful if you want to combine HTML based labels with 3D objects. Here too, the respective DOM elements are wrapped into an instance of [CSS2DObject](CSS2DObject.html) and added to the scene graph. All other types of renderable 3D objects (like meshes or point clouds) are ignored. + +`CSS2DRenderer` only supports 100% browser and display zoom. + +## Import + +CSS2DRenderer is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js'; +``` + +## Constructor + +### new CSS2DRenderer( parameters : CSS2DRenderer~Parameters ) + +Constructs a new CSS2D renderer. + +**parameters** + +The parameters. + +## Properties + +### .domElement : HTMLElement + +The DOM where the renderer appends its child-elements. + +### .sortObjects : boolean + +Controls whether the renderer assigns `z-index` values to CSS2DObject DOM elements. If set to `true`, z-index values are assigned first based on the `renderOrder` and secondly - the distance to the camera. If set to `false`, no z-index values are assigned. + +Default is `true`. + +## Methods + +### .getSize() : Object + +Returns an object containing the width and height of the renderer. + +**Returns:** The size of the renderer. + +### .render( scene : Object3D, camera : Camera ) + +Renders the given scene using the given camera. + +**scene** + +A scene or any other type of 3D object. + +**camera** + +The camera. + +### .setSize( width : number, height : number ) + +Resizes the renderer to the given width and height. + +**width** + +The width of the renderer. + +**height** + +The height of the renderer. + +## Type Definitions + +### .Parameters + +Constructor parameters of `CSS2DRenderer`. + +**element** +HTMLElement + +A DOM element where the renderer appends its child-elements. If not passed in here, a new div element will be created. + +## Source + +[examples/jsm/renderers/CSS2DRenderer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/CSS2DRenderer.js) \ No newline at end of file diff --git a/docs/pages/CSS3DObject.html.md b/docs/pages/CSS3DObject.html.md new file mode 100644 index 00000000000000..956d40423eff60 --- /dev/null +++ b/docs/pages/CSS3DObject.html.md @@ -0,0 +1,41 @@ +*Inheritance: EventDispatcher → Object3D →* + +# CSS3DObject + +The base 3D object that is supported by [CSS3DRenderer](CSS3DRenderer.html). + +## Import + +CSS3DObject is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; +``` + +## Constructor + +### new CSS3DObject( element : HTMLElement ) + +Constructs a new CSS3D object. + +**element** + +The DOM element. + +## Properties + +### .element : HTMLElement (readonly) + +The DOM element which defines the appearance of this 3D object. + +Default is `true`. + +### .isCSS3DObject : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[examples/jsm/renderers/CSS3DRenderer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/CSS3DRenderer.js) \ No newline at end of file diff --git a/docs/pages/CSS3DRenderer.html.md b/docs/pages/CSS3DRenderer.html.md new file mode 100644 index 00000000000000..37d0fb0aad1117 --- /dev/null +++ b/docs/pages/CSS3DRenderer.html.md @@ -0,0 +1,82 @@ +# CSS3DRenderer + +This renderer can be used to apply hierarchical 3D transformations to DOM elements via the CSS3 [transform](https://www.w3schools.com/cssref/css3_pr_transform.asp) property. `CSS3DRenderer` is particularly interesting if you want to apply 3D effects to a website without canvas based rendering. It can also be used in order to combine DOM elements with WebGLcontent. + +There are, however, some important limitations: + +* It's not possible to use the material system of _three.js_. +* It's also not possible to use geometries. +* The renderer only supports 100% browser and display zoom. + +So `CSS3DRenderer` is just focused on ordinary DOM elements. These elements are wrapped into special 3D objects ([CSS3DObject](CSS3DObject.html) or [CSS3DSprite](CSS3DSprite.html)) and then added to the scene graph. + +## Import + +CSS3DRenderer is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSS3DRenderer } from 'three/addons/renderers/CSS3DRenderer.js'; +``` + +## Constructor + +### new CSS3DRenderer( parameters : CSS3DRenderer~Parameters ) + +Constructs a new CSS3D renderer. + +**parameters** + +The parameters. + +## Properties + +### .domElement : HTMLElement + +The DOM where the renderer appends its child-elements. + +## Methods + +### .getSize() : Object + +Returns an object containing the width and height of the renderer. + +**Returns:** The size of the renderer. + +### .render( scene : Object3D, camera : Camera ) + +Renders the given scene using the given camera. + +**scene** + +A scene or any other type of 3D object. + +**camera** + +The camera. + +### .setSize( width : number, height : number ) + +Resizes the renderer to the given width and height. + +**width** + +The width of the renderer. + +**height** + +The height of the renderer. + +## Type Definitions + +### .Parameters + +Constructor parameters of `CSS3DRenderer`. + +**element** +HTMLElement + +A DOM element where the renderer appends its child-elements. If not passed in here, a new div element will be created. + +## Source + +[examples/jsm/renderers/CSS3DRenderer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/CSS3DRenderer.js) \ No newline at end of file diff --git a/docs/pages/CSS3DSprite.html.md b/docs/pages/CSS3DSprite.html.md new file mode 100644 index 00000000000000..e1021880f176a8 --- /dev/null +++ b/docs/pages/CSS3DSprite.html.md @@ -0,0 +1,41 @@ +*Inheritance: EventDispatcher → Object3D → CSS3DObject →* + +# CSS3DSprite + +A specialized version of [CSS3DObject](CSS3DObject.html) that represents DOM elements as sprites. + +## Import + +CSS3DSprite is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js'; +``` + +## Constructor + +### new CSS3DSprite( element : HTMLElement ) + +Constructs a new CSS3D sprite object. + +**element** + +The DOM element. + +## Properties + +### .isCSS3DSprite : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .rotation2D : number + +The sprite's rotation in radians. + +Default is `0`. + +## Source + +[examples/jsm/renderers/CSS3DRenderer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/CSS3DRenderer.js) \ No newline at end of file diff --git a/docs/pages/Cache.html.md b/docs/pages/Cache.html.md new file mode 100644 index 00000000000000..e07912080bca14 --- /dev/null +++ b/docs/pages/Cache.html.md @@ -0,0 +1,55 @@ +# Cache + +A simple caching system, used internally by [FileLoader](FileLoader.html). To enable caching across all loaders that use [FileLoader](FileLoader.html), add `THREE.Cache.enabled = true.` once in your app. + +## Properties + +### .enabled : boolean + +Whether caching is enabled or not. + +Default is `false`. + +### .files : Object. + +A dictionary that holds cached files. + +## Static Methods + +### .add( key : string, file : Object ) + +Adds a cache entry with a key to reference the file. If this key already holds a file, it is overwritten. + +**key** + +The key to reference the cached file. + +**file** + +The file to be cached. + +### .clear() + +Remove all values from the cache. + +### .get( key : string ) : Object | undefined + +Gets the cached value for the given key. + +**key** + +The key to reference the cached file. + +**Returns:** The cached file. If the key does not exist `undefined` is returned. + +### .remove( key : string ) + +Removes the cached file associated with the given key. + +**key** + +The key to reference the cached file. + +## Source + +[src/loaders/Cache.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/Cache.js) \ No newline at end of file diff --git a/docs/pages/Camera.html.md b/docs/pages/Camera.html.md new file mode 100644 index 00000000000000..ba2ef91a4a86ac --- /dev/null +++ b/docs/pages/Camera.html.md @@ -0,0 +1,61 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Camera + +Abstract base class for cameras. This class should always be inherited when you build a new camera. + +## Constructor + +### new Camera() (abstract) + +Constructs a new camera. + +## Properties + +### .coordinateSystem : WebGLCoordinateSystem | WebGPUCoordinateSystem + +The coordinate system in which the camera is used. + +### .isCamera : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .matrixWorldInverse : Matrix4 + +The inverse of the camera's world matrix. + +### .projectionMatrix : Matrix4 + +The camera's projection matrix. + +### .projectionMatrixInverse : Matrix4 + +The inverse of the camera's projection matrix. + +### .reversedDepth : boolean + +The flag that indicates whether the camera uses a reversed depth buffer. + +Default is `false`. + +## Methods + +### .getWorldDirection( target : Vector3 ) : Vector3 + +Returns a vector representing the ("look") direction of the 3D object in world space. + +This method is overwritten since cameras have a different forward vector compared to other 3D objects. A camera looks down its local, negative z-axis by default. + +**target** + +The target vector the result is stored to. + +**Overrides:** [Object3D#getWorldDirection](Object3D.html#getWorldDirection) + +**Returns:** The 3D object's direction in world space. + +## Source + +[src/cameras/Camera.js](https://github.com/mrdoob/three.js/blob/master/src/cameras/Camera.js) \ No newline at end of file diff --git a/docs/pages/CameraHelper.html.md b/docs/pages/CameraHelper.html.md new file mode 100644 index 00000000000000..3bcba112516227 --- /dev/null +++ b/docs/pages/CameraHelper.html.md @@ -0,0 +1,77 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# CameraHelper + +This helps with visualizing what a camera contains in its frustum. It visualizes the frustum of a camera using a line segments. + +Based on frustum visualization in [lightgl.js shadowmap example](https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html). + +`CameraHelper` must be a child of the scene. + +## Code Example + +```js +const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); +const helper = new THREE.CameraHelper( camera ); +scene.add( helper ); +``` + +## Constructor + +### new CameraHelper( camera : Camera ) + +Constructs a new arrow helper. + +**camera** + +The camera to visualize. + +## Properties + +### .camera : Camera + +The camera being visualized. + +### .pointMap : Object.> + +This contains the points used to visualize the camera. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .setColors( frustum : Color, cone : Color, up : Color, target : Color, cross : Color ) : CameraHelper + +Defines the colors of the helper. + +**frustum** + +The frustum line color. + +**cone** + +The cone line color. + +**up** + +The up line color. + +**target** + +The target line color. + +**cross** + +The cross line color. + +**Returns:** A reference to this helper. + +### .update() + +Updates the helper based on the projection matrix of the camera. + +## Source + +[src/helpers/CameraHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/CameraHelper.js) \ No newline at end of file diff --git a/docs/pages/CanvasTarget.html.md b/docs/pages/CanvasTarget.html.md new file mode 100644 index 00000000000000..f166ef5c6fd5f1 --- /dev/null +++ b/docs/pages/CanvasTarget.html.md @@ -0,0 +1,204 @@ +*Inheritance: EventDispatcher →* + +# CanvasTarget + +CanvasTarget is a class that represents the final output destination of the renderer. + +## Constructor + +### new CanvasTarget( domElement : HTMLCanvasElement | OffscreenCanvas ) + +Constructs a new CanvasTarget. + +**domElement** + +The canvas element to render to. + +## Properties + +### .colorTexture : FramebufferTexture + +The color texture of the default framebuffer. + +### .depthTexture : DepthTexture + +The depth texture of the default framebuffer. + +### .domElement : HTMLCanvasElement | OffscreenCanvas + +A reference to the canvas element the renderer is drawing to. This value of this property will automatically be created by the renderer. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +##### Fires: + +* RenderTarget#event:dispose + +### .getDrawingBufferSize( target : Vector2 ) : Vector2 + +Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + +**target** + +The method writes the result in this target object. + +**Returns:** The drawing buffer size. + +### .getPixelRatio() : number + +Returns the pixel ratio. + +**Returns:** The pixel ratio. + +### .getScissor( target : Vector4 ) : Vector4 + +Returns the scissor rectangle. + +**target** + +The method writes the result in this target object. + +**Returns:** The scissor rectangle. + +### .getScissorTest() : boolean + +Returns the scissor test value. + +**Returns:** Whether the scissor test should be enabled or not. + +### .getSize( target : Vector2 ) : Vector2 + +Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + +**target** + +The method writes the result in this target object. + +**Returns:** The renderer's size in logical pixels. + +### .getViewport( target : Vector4 ) : Vector4 + +Returns the viewport definition. + +**target** + +The method writes the result in this target object. + +**Returns:** The viewport definition. + +### .setDrawingBufferSize( width : number, height : number, pixelRatio : number ) + +This method allows to define the drawing buffer size by specifying width, height and pixel ratio all at once. The size of the drawing buffer is computed with this formula: + +```js +size.x = width * pixelRatio; +size.y = height * pixelRatio; +``` + +**width** + +The width in logical pixels. + +**height** + +The height in logical pixels. + +**pixelRatio** + +The pixel ratio. + +### .setPixelRatio( value : number ) + +Sets the given pixel ratio and resizes the canvas if necessary. + +**value** + +The pixel ratio. + +Default is `1`. + +### .setScissor( x : number | Vector4, y : number, width : number, height : number ) + +Defines the scissor rectangle. + +**x** + +The horizontal coordinate for the lower left corner of the box in logical pixel unit. Instead of passing four arguments, the method also works with a single four-dimensional vector. + +**y** + +The vertical coordinate for the lower left corner of the box in logical pixel unit. + +**width** + +The width of the scissor box in logical pixel unit. + +**height** + +The height of the scissor box in logical pixel unit. + +### .setScissorTest( boolean : boolean ) + +Defines the scissor test. + +**boolean** + +Whether the scissor test should be enabled or not. + +### .setSize( width : number, height : number, updateStyle : boolean ) + +Sets the size of the renderer. + +**width** + +The width in logical pixels. + +**height** + +The height in logical pixels. + +**updateStyle** + +Whether to update the `style` attribute of the canvas or not. + +Default is `true`. + +### .setViewport( x : number | Vector4, y : number, width : number, height : number, minDepth : number, maxDepth : number ) + +Defines the viewport. + +**x** + +The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + +**y** + +The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + +**width** + +The width of the viewport in logical pixel unit. + +**height** + +The height of the viewport in logical pixel unit. + +**minDepth** + +The minimum depth value of the viewport. WebGPU only. + +Default is `0`. + +**maxDepth** + +The maximum depth value of the viewport. WebGPU only. + +Default is `1`. + +## Source + +[src/renderers/common/CanvasTarget.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/CanvasTarget.js) \ No newline at end of file diff --git a/docs/pages/CanvasTexture.html.md b/docs/pages/CanvasTexture.html.md new file mode 100644 index 00000000000000..c3a4ad7609a778 --- /dev/null +++ b/docs/pages/CanvasTexture.html.md @@ -0,0 +1,77 @@ +*Inheritance: EventDispatcher → Texture →* + +# CanvasTexture + +Creates a texture from a canvas element. + +This is almost the same as the base texture class, except that it sets [Texture#needsUpdate](Texture.html#needsUpdate) to `true` immediately since a canvas can directly be used for rendering. + +## Constructor + +### new CanvasTexture( canvas : HTMLCanvasElement, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, format : number, type : number, anisotropy : number ) + +Constructs a new texture. + +**canvas** + +The HTML canvas element. + +**mapping** + +The texture mapping. + +Default is `Texture.DEFAULT_MAPPING`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `LinearFilter`. + +**minFilter** + +The min filter value. + +Default is `LinearMipmapLinearFilter`. + +**format** + +The texture format. + +Default is `RGBAFormat`. + +**type** + +The texture type. + +Default is `UnsignedByteType`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +## Properties + +### .isCanvasTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/textures/CanvasTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/CanvasTexture.js) \ No newline at end of file diff --git a/docs/pages/Capsule.html.md b/docs/pages/Capsule.html.md new file mode 100644 index 00000000000000..883c16056d1569 --- /dev/null +++ b/docs/pages/Capsule.html.md @@ -0,0 +1,119 @@ +# Capsule + +A capsule is essentially a cylinder with hemispherical caps at both ends. It can be thought of as a swept sphere, where a sphere is moved along a line segment. + +Capsules are often used as bounding volumes (next to AABBs and bounding spheres). + +## Import + +Capsule is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Capsule } from 'three/addons/math/Capsule.js'; +``` + +## Constructor + +### new Capsule( start : Vector3, end : Vector3, radius : number ) + +Constructs a new capsule. + +**start** + +The start vector. + +**end** + +The end vector. + +**radius** + +The capsule's radius. + +Default is `1`. + +## Properties + +### .end : Vector3 + +The end vector. + +### .radius : number + +The capsule's radius. + +Default is `1`. + +### .start : Vector3 + +The start vector. + +## Methods + +### .clone() : Capsule + +Returns a new capsule with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( capsule : Capsule ) : Capsule + +Copies the values of the given capsule to this instance. + +**capsule** + +The capsule to copy. + +**Returns:** A reference to this capsule. + +### .getCenter( target : Vector3 ) : Vector3 + +Returns the center point of this capsule. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The center point. + +### .intersectsBox( box : Box3 ) : boolean + +Returns `true` if the given bounding box intersects with this capsule. + +**box** + +The bounding box to test. + +**Returns:** Whether the given bounding box intersects with this capsule. + +### .set( start : Vector3, end : Vector3, radius : number ) : Capsule + +Sets the capsule components to the given values. Please note that this method only copies the values from the given objects. + +**start** + +The start vector. + +**end** + +The end vector + +**radius** + +The capsule's radius. + +**Returns:** A reference to this capsule. + +### .translate( v : Vector3 ) : Capsule + +Adds the given offset to this capsule, effectively moving it in 3D space. + +**v** + +The offset that should be used to translate the capsule. + +**Returns:** A reference to this capsule. + +## Source + +[examples/jsm/math/Capsule.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Capsule.js) \ No newline at end of file diff --git a/docs/pages/CapsuleGeometry.html.md b/docs/pages/CapsuleGeometry.html.md new file mode 100644 index 00000000000000..3f5d7a88facab0 --- /dev/null +++ b/docs/pages/CapsuleGeometry.html.md @@ -0,0 +1,72 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# CapsuleGeometry + +A geometry class for representing a capsule. + +## Code Example + +```js +const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8, 1 ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +const capsule = new THREE.Mesh( geometry, material ); +scene.add( capsule ); +``` + +## Constructor + +### new CapsuleGeometry( radius : number, height : number, capSegments : number, radialSegments : number, heightSegments : number ) + +Constructs a new capsule geometry. + +**radius** + +Radius of the capsule. + +Default is `1`. + +**height** + +Height of the middle section. + +Default is `1`. + +**capSegments** + +Number of curve segments used to build each cap. + +Default is `4`. + +**radialSegments** + +Number of segmented faces around the circumference of the capsule. Must be an integer >= 3. + +Default is `8`. + +**heightSegments** + +Number of rows of faces along the height of the middle section. Must be an integer >= 1. + +Default is `1`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : CapsuleGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/CapsuleGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/CapsuleGeometry.js) \ No newline at end of file diff --git a/docs/pages/CatmullRomCurve3.html.md b/docs/pages/CatmullRomCurve3.html.md new file mode 100644 index 00000000000000..b6cbda73eab88b --- /dev/null +++ b/docs/pages/CatmullRomCurve3.html.md @@ -0,0 +1,103 @@ +*Inheritance: Curve →* + +# CatmullRomCurve3 + +A curve representing a Catmull-Rom spline. + +## Code Example + +```js +//Create a closed wavey loop +const curve = new THREE.CatmullRomCurve3( [ + new THREE.Vector3( -10, 0, 10 ), + new THREE.Vector3( -5, 5, 5 ), + new THREE.Vector3( 0, 0, 0 ), + new THREE.Vector3( 5, -5, 5 ), + new THREE.Vector3( 10, 0, 10 ) +] ); +const points = curve.getPoints( 50 ); +const geometry = new THREE.BufferGeometry().setFromPoints( points ); +const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); +// Create the final object to add to the scene +const curveObject = new THREE.Line( geometry, material ); +``` + +## Constructor + +### new CatmullRomCurve3( points : Array., closed : boolean, curveType : 'centripetal' | 'chordal' | 'catmullrom', tension : number ) + +Constructs a new Catmull-Rom curve. + +**points** + +An array of 3D points defining the curve. + +**closed** + +Whether the curve is closed or not. + +Default is `false`. + +**curveType** + +The curve type. + +Default is `'centripetal'`. + +**tension** + +Tension of the curve. + +Default is `0.5`. + +## Properties + +### .closed : boolean + +Whether the curve is closed or not. + +Default is `false`. + +### .curveType : 'centripetal' | 'chordal' | 'catmullrom' + +The curve type. + +Default is `'centripetal'`. + +### .isCatmullRomCurve3 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .points : Array. + +An array of 3D points defining the curve. + +### .tension : number + +Tension of the curve. + +Default is `0.5`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +Returns a point on the curve. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[src/extras/curves/CatmullRomCurve3.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CatmullRomCurve3.js) \ No newline at end of file diff --git a/docs/pages/ChromaticAberrationNode.html.md b/docs/pages/ChromaticAberrationNode.html.md new file mode 100644 index 00000000000000..f11218280d1f92 --- /dev/null +++ b/docs/pages/ChromaticAberrationNode.html.md @@ -0,0 +1,87 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# ChromaticAberrationNode + +Post processing node for applying chromatic aberration effect. This effect simulates the color fringing that occurs in real camera lenses by separating and offsetting the red, green, and blue channels. + +## Import + +ChromaticAberrationNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { chromaticAberration } from 'three/addons/tsl/display/ChromaticAberrationNode.js'; +``` + +## Constructor + +### new ChromaticAberrationNode( textureNode : TextureNode, strengthNode : Node, centerNode : Node, scaleNode : Node ) + +Constructs a new chromatic aberration node. + +**textureNode** + +The texture node that represents the input of the effect. + +**strengthNode** + +The strength of the chromatic aberration effect as a node. + +**centerNode** + +The center point of the effect as a node. + +**scaleNode** + +The scale factor for stepped scaling from center as a node. + +## Properties + +### .centerNode : Node + +A node holding the center point of the effect. + +### .scaleNode : Node + +A node holding the scale factor for stepped scaling. + +### .strengthNode : Node + +A node holding the strength of the effect. + +### .textureNode : texture + +The texture node that represents the input of the effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node updates its internal uniforms once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to update the effect's uniforms once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/ChromaticAberrationNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/ChromaticAberrationNode.js) \ No newline at end of file diff --git a/docs/pages/CinquefoilKnot.html.md b/docs/pages/CinquefoilKnot.html.md new file mode 100644 index 00000000000000..259cbfa8ba5867 --- /dev/null +++ b/docs/pages/CinquefoilKnot.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# CinquefoilKnot + +A Cinquefoil Knot. + +## Import + +CinquefoilKnot is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CinquefoilKnot } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new CinquefoilKnot( scale : number ) + +Constructs a new Cinquefoil Knot. + +**scale** + +The curve's scale. + +Default is `10`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `10`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/CircleGeometry.html.md b/docs/pages/CircleGeometry.html.md new file mode 100644 index 00000000000000..1480b407a1c997 --- /dev/null +++ b/docs/pages/CircleGeometry.html.md @@ -0,0 +1,66 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# CircleGeometry + +A simple shape of Euclidean geometry. It is constructed from a number of triangular segments that are oriented around a central point and extend as far out as a given radius. It is built counter-clockwise from a start angle and a given central angle. It can also be used to create regular polygons, where the number of segments determines the number of sides. + +## Code Example + +```js +const geometry = new THREE.CircleGeometry( 5, 32 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const circle = new THREE.Mesh( geometry, material ); +scene.add( circle ) +``` + +## Constructor + +### new CircleGeometry( radius : number, segments : number, thetaStart : number, thetaLength : number ) + +Constructs a new circle geometry. + +**radius** + +Radius of the circle. + +Default is `1`. + +**segments** + +Number of segments (triangles), minimum = `3`. + +Default is `32`. + +**thetaStart** + +Start angle for first segment in radians. + +Default is `0`. + +**thetaLength** + +The central angle, often called theta, of the circular sector in radians. The default value results in a complete circle. + +Default is `Math.PI*2`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : CircleGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/CircleGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/CircleGeometry.js) \ No newline at end of file diff --git a/docs/pages/ClearMaskPass.html.md b/docs/pages/ClearMaskPass.html.md new file mode 100644 index 00000000000000..53032c04fdd53d --- /dev/null +++ b/docs/pages/ClearMaskPass.html.md @@ -0,0 +1,60 @@ +*Inheritance: Pass →* + +# ClearMaskPass + +This pass can be used to clear a mask previously defined with [MaskPass](MaskPass.html). + +## Code Example + +```js +const clearPass = new ClearMaskPass(); +composer.addPass( clearPass ); +``` + +## Constructor + +### new ClearMaskPass() + +Constructs a new clear mask pass. + +## Properties + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +## Methods + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the clear of the currently defined mask. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/MaskPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/MaskPass.js) \ No newline at end of file diff --git a/docs/pages/ClearPass.html.md b/docs/pages/ClearPass.html.md new file mode 100644 index 00000000000000..36e338e8eebdcb --- /dev/null +++ b/docs/pages/ClearPass.html.md @@ -0,0 +1,92 @@ +*Inheritance: Pass →* + +# ClearPass + +This class can be used to force a clear operation for the current read or default framebuffer (when rendering to screen). + +## Code Example + +```js +const clearPass = new ClearPass(); +composer.addPass( clearPass ); +``` + +## Import + +ClearPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ClearPass } from 'three/addons/postprocessing/ClearPass.js'; +``` + +## Constructor + +### new ClearPass( clearColor : number | Color | string, clearAlpha : number ) + +Constructs a new clear pass. + +**clearColor** + +The clear color. + +Default is `0x000000`. + +**clearAlpha** + +The clear alpha. + +Default is `0`. + +## Properties + +### .clearAlpha : number + +The clear alpha. + +Default is `0`. + +### .clearColor : number | Color | string + +The clear color. + +Default is `0x000000`. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +## Methods + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the clear operation. This affects the current read or the default framebuffer. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/ClearPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/ClearPass.js) \ No newline at end of file diff --git a/docs/pages/ClippingGroup.html.md b/docs/pages/ClippingGroup.html.md new file mode 100644 index 00000000000000..18f6fc069fb285 --- /dev/null +++ b/docs/pages/ClippingGroup.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Object3D → Group →* + +# ClippingGroup + +In earlier three.js versions, clipping was defined globally on the renderer or on material level. This special version of `THREE.Group` allows to encode the clipping state into the scene graph. Meaning if you create an instance of this group, all descendant 3D objects will be affected by the respective clipping planes. + +Note: `ClippingGroup` can only be used with `WebGPURenderer`. + +## Constructor + +### new ClippingGroup() + +Constructs a new clipping group. + +## Properties + +### .clipIntersection : boolean + +Whether the intersection of the clipping planes is used to clip objects, rather than their union. + +Default is `false`. + +### .clipShadows : boolean + +Whether shadows should be clipped or not. + +Default is `false`. + +### .clippingPlanes : Array. + +An array with clipping planes. + +### .enabled : boolean + +Whether clipping should be enabled or not. + +Default is `true`. + +### .isClippingGroup : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/objects/ClippingGroup.js](https://github.com/mrdoob/three.js/blob/master/src/objects/ClippingGroup.js) \ No newline at end of file diff --git a/docs/pages/ClippingNode.html.md b/docs/pages/ClippingNode.html.md new file mode 100644 index 00000000000000..695db7540cbb5c --- /dev/null +++ b/docs/pages/ClippingNode.html.md @@ -0,0 +1,83 @@ +*Inheritance: EventDispatcher → Node →* + +# ClippingNode + +This node is used in [NodeMaterial](NodeMaterial.html) to setup the clipping which can happen hardware-accelerated (if supported) and optionally use alpha-to-coverage for anti-aliasing clipped edges. + +## Constructor + +### new ClippingNode( scope : 'default' | 'hardware' | 'alphaToCoverage' ) + +Constructs a new clipping node. + +**scope** + +The node's scope. Similar to other nodes, the selected scope influences the behavior of the node and what type of code is generated. + +Default is `'default'`. + +## Properties + +### .scope : 'default' | 'hardware' | 'alphaToCoverage' + +The node's scope. Similar to other nodes, the selected scope influences the behavior of the node and what type of code is generated. + +## Methods + +### .setup( builder : NodeBuilder ) : Node + +Setups the node depending on the selected scope. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The result node. + +### .setupAlphaToCoverage( intersectionPlanes : Array., unionPlanes : Array. ) : Node + +Setups alpha to coverage. + +**intersectionPlanes** + +The intersection planes. + +**unionPlanes** + +The union planes. + +**Returns:** The result node. + +### .setupDefault( intersectionPlanes : Array., unionPlanes : Array. ) : Node + +Setups the default clipping. + +**intersectionPlanes** + +The intersection planes. + +**unionPlanes** + +The union planes. + +**Returns:** The result node. + +### .setupHardwareClipping( unionPlanes : Array., builder : NodeBuilder ) : Node + +Setups hardware clipping. + +**unionPlanes** + +The union planes. + +**builder** + +The current node builder. + +**Returns:** The result node. + +## Source + +[src/nodes/accessors/ClippingNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/ClippingNode.js) \ No newline at end of file diff --git a/docs/pages/Clock.html.md b/docs/pages/Clock.html.md new file mode 100644 index 00000000000000..d18bad81e5e5ac --- /dev/null +++ b/docs/pages/Clock.html.md @@ -0,0 +1,73 @@ +# Clock + +Class for keeping track of time. + +## Constructor + +### new Clock( autoStart : boolean ) + +Constructs a new clock. + +**autoStart** + +Whether to automatically start the clock when `getDelta()` is called for the first time. + +Default is `true`. + +## Properties + +### .autoStart : boolean + +If set to `true`, the clock starts automatically when `getDelta()` is called for the first time. + +Default is `true`. + +### .elapsedTime : number + +Keeps track of the total time that the clock has been running. + +Default is `0`. + +### .oldTime : number + +Holds the time at which the clock's `start()`, `getElapsedTime()` or `getDelta()` methods were last called. + +Default is `0`. + +### .running : boolean + +Whether the clock is running or not. + +Default is `true`. + +### .startTime : number + +Holds the time at which the clock's `start()` method was last called. + +Default is `0`. + +## Methods + +### .getDelta() : number + +Returns the delta time in seconds. + +**Returns:** The delta time. + +### .getElapsedTime() : number + +Returns the elapsed time in seconds. + +**Returns:** The elapsed time. + +### .start() + +Starts the clock. When `autoStart` is set to `true`, the method is automatically called by the class. + +### .stop() + +Stops the clock. + +## Source + +[src/core/Clock.js](https://github.com/mrdoob/three.js/blob/master/src/core/Clock.js) \ No newline at end of file diff --git a/docs/pages/CodeNode.html.md b/docs/pages/CodeNode.html.md new file mode 100644 index 00000000000000..6c094e2199d789 --- /dev/null +++ b/docs/pages/CodeNode.html.md @@ -0,0 +1,89 @@ +*Inheritance: EventDispatcher → Node →* + +# CodeNode + +This class represents native code sections. It is the base class for modules like [FunctionNode](FunctionNode.html) which allows to implement functions with native shader languages. + +## Constructor + +### new CodeNode( code : string, includes : Array., language : 'js' | 'wgsl' | 'glsl' ) + +Constructs a new code node. + +**code** + +The native code. + +Default is `''`. + +**includes** + +An array of includes. + +Default is `[]`. + +**language** + +The used language. + +Default is `''`. + +## Properties + +### .code : string + +The native code. + +Default is `''`. + +### .global : boolean + +This flag is used for global cache. + +Default is `true`. + +**Overrides:** [Node#global](Node.html#global) + +### .includes : Array. + +An array of includes + +Default is `[]`. + +### .isCodeNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .language : 'js' | 'wgsl' | 'glsl' + +The used language. + +Default is `''`. + +## Methods + +### .getIncludes( builder : NodeBuilder ) : Array. + +Returns the includes of this code node. + +**builder** + +The current node builder. + +**Returns:** The includes. + +### .setIncludes( includes : Array. ) : CodeNode + +Sets the includes of this code node. + +**includes** + +The includes to set. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/code/CodeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/code/CodeNode.js) \ No newline at end of file diff --git a/docs/pages/ColladaLoader.html.md b/docs/pages/ColladaLoader.html.md new file mode 100644 index 00000000000000..cd0281e2f3e214 --- /dev/null +++ b/docs/pages/ColladaLoader.html.md @@ -0,0 +1,73 @@ +*Inheritance: Loader →* + +# ColladaLoader + +A loader for the Collada format. + +The Collada format is very complex so this loader only supports a subset of what is defined in the [official specification](https://www.khronos.org/files/collada_spec_1_5.pdf). + +Assets with a Z-UP coordinate system are transformed it into Y-UP by a simple rotation. The vertex data are not converted. + +## Code Example + +```js +const loader = new ColladaLoader(); +const result = await loader.loadAsync( './models/collada/elf/elf.dae' ); +scene.add( result.scene ); +``` + +## Import + +ColladaLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ColladaLoader } from 'three/addons/loaders/ColladaLoader.js'; +``` + +## Constructor + +### new ColladaLoader() + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded Collada asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string, path : string ) : Object + +Parses the given Collada data and returns a result object holding the parsed scene, an array of animation clips and kinematics. + +**text** + +The raw Collada data as a string. + +**path** + +The asset path. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** An object representing the parsed asset. + +## Source + +[examples/jsm/loaders/ColladaLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/ColladaLoader.js) \ No newline at end of file diff --git a/docs/pages/Color.html.md b/docs/pages/Color.html.md new file mode 100644 index 00000000000000..dd2a85d5ad1260 --- /dev/null +++ b/docs/pages/Color.html.md @@ -0,0 +1,554 @@ +# Color + +A Color instance is represented by RGB components in the linear _working color space_, which defaults to `LinearSRGBColorSpace`. Inputs conventionally using `SRGBColorSpace` (such as hexadecimals and CSS strings) are converted to the working color space automatically. + +Source color spaces may be specified explicitly, to ensure correct conversions. + +```js +// assumed already LinearSRGBColorSpace; no conversion +const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5 ); +// converted explicitly from SRGBColorSpace to LinearSRGBColorSpace +const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5, SRGBColorSpace ); +``` + +If THREE.ColorManagement is disabled, no conversions occur. For details, see _Color management_. Iterating through a Color instance will yield its components (r, g, b) in the corresponding order. A Color can be initialised in any of the following ways: + +```js +//empty constructor - will default white +const color1 = new THREE.Color(); +//Hexadecimal color (recommended) +const color2 = new THREE.Color( 0xff0000 ); +//RGB string +const color3 = new THREE.Color("rgb(255, 0, 0)"); +const color4 = new THREE.Color("rgb(100%, 0%, 0%)"); +//X11 color name - all 140 color names are supported. +//Note the lack of CamelCase in the name +const color5 = new THREE.Color( 'skyblue' ); +//HSL string +const color6 = new THREE.Color("hsl(0, 100%, 50%)"); +//Separate RGB values between 0 and 1 +const color7 = new THREE.Color( 1, 0, 0 ); +``` + +## Code Example + +```js +// converted automatically from SRGBColorSpace to LinearSRGBColorSpace +const color = new THREE.Color().setHex( 0x112233 ); +``` + +## Constructor + +### new Color( r : number | string | Color, g : number, b : number ) + +Constructs a new color. + +Note that standard method of specifying color in three.js is with a hexadecimal triplet, and that method is used throughout the rest of the documentation. + +**r** + +The red component of the color. If `g` and `b` are not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance. + +**g** + +The green component. + +**b** + +The blue component. + +## Properties + +### .b : number + +The blue component. + +Default is `1`. + +### .g : number + +The green component. + +Default is `1`. + +### .isColor : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .r : number + +The red component. + +Default is `1`. + +### .NAMES : Object + +A dictionary with X11 color names. + +Note that multiple words such as Dark Orange become the string 'darkorange'. + +## Methods + +### .add( color : Color ) : Color + +Adds the RGB values of the given color to the RGB values of this color. + +**color** + +The color to add. + +**Returns:** A reference to this color. + +### .addColors( color1 : Color, color2 : Color ) : Color + +Adds the RGB values of the given colors and stores the result in this instance. + +**color1** + +The first color. + +**color2** + +The second color. + +**Returns:** A reference to this color. + +### .addScalar( s : number ) : Color + +Adds the given scalar value to the RGB values of this color. + +**s** + +The scalar to add. + +**Returns:** A reference to this color. + +### .applyMatrix3( m : Matrix3 ) : Color + +Transforms this color with the given 3x3 matrix. + +**m** + +The matrix. + +**Returns:** A reference to this color. + +### .clone() : Color + +Returns a new color with copied values from this instance. + +**Returns:** A clone of this instance. + +### .convertLinearToSRGB() : Color + +Converts this color from `LinearSRGBColorSpace` to `SRGBColorSpace`. + +**Returns:** A reference to this color. + +### .convertSRGBToLinear() : Color + +Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`. + +**Returns:** A reference to this color. + +### .copy( color : Color ) : Color + +Copies the values of the given color to this instance. + +**color** + +The color to copy. + +**Returns:** A reference to this color. + +### .copyLinearToSRGB( color : Color ) : Color + +Copies the given color into this color, and then converts this color from `LinearSRGBColorSpace` to `SRGBColorSpace`. + +**color** + +The color to copy/convert. + +**Returns:** A reference to this color. + +### .copySRGBToLinear( color : Color ) : Color + +Copies the given color into this color, and then converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`. + +**color** + +The color to copy/convert. + +**Returns:** A reference to this color. + +### .equals( c : Color ) : boolean + +Returns `true` if this color is equal with the given one. + +**c** + +The color to test for equality. + +**Returns:** Whether this bounding color is equal with the given one. + +### .fromArray( array : Array., offset : number ) : Color + +Sets this color's RGB components from the given array. + +**array** + +An array holding the RGB values. + +**offset** + +The offset into the array. + +Default is `0`. + +**Returns:** A reference to this color. + +### .fromBufferAttribute( attribute : BufferAttribute, index : number ) : Color + +Sets the components of this color from the given buffer attribute. + +**attribute** + +The buffer attribute holding color data. + +**index** + +The index into the attribute. + +**Returns:** A reference to this color. + +### .getHSL( target : Object, colorSpace : string ) : Object + +Converts the colors RGB values into the HSL format and stores them into the given target object. + +**target** + +The target object that is used to store the method's result. + +**colorSpace** + +The color space. + +Default is `ColorManagement.workingColorSpace`. + +**Returns:** The HSL representation of this color. + +### .getHex( colorSpace : string ) : number + +Returns the hexadecimal value of this color. + +**colorSpace** + +The color space. + +Default is `SRGBColorSpace`. + +**Returns:** The hexadecimal value. + +### .getHexString( colorSpace : string ) : string + +Returns the hexadecimal value of this color as a string (for example, 'FFFFFF'). + +**colorSpace** + +The color space. + +Default is `SRGBColorSpace`. + +**Returns:** The hexadecimal value as a string. + +### .getRGB( target : Color, colorSpace : string ) : Color + +Returns the RGB values of this color and stores them into the given target object. + +**target** + +The target color that is used to store the method's result. + +**colorSpace** + +The color space. + +Default is `ColorManagement.workingColorSpace`. + +**Returns:** The RGB representation of this color. + +### .getStyle( colorSpace : string ) : string + +Returns the value of this color as a CSS style string. Example: `rgb(255,0,0)`. + +**colorSpace** + +The color space. + +Default is `SRGBColorSpace`. + +**Returns:** The CSS representation of this color. + +### .lerp( color : Color, alpha : number ) : Color + +Linearly interpolates this color's RGB values toward the RGB values of the given color. The alpha argument can be thought of as the ratio between the two colors, where `0.0` is this color and `1.0` is the first argument. + +**color** + +The color to converge on. + +**alpha** + +The interpolation factor in the closed interval `[0,1]`. + +**Returns:** A reference to this color. + +### .lerpColors( color1 : Color, color2 : Color, alpha : number ) : Color + +Linearly interpolates between the given colors and stores the result in this instance. The alpha argument can be thought of as the ratio between the two colors, where `0.0` is the first and `1.0` is the second color. + +**color1** + +The first color. + +**color2** + +The second color. + +**alpha** + +The interpolation factor in the closed interval `[0,1]`. + +**Returns:** A reference to this color. + +### .lerpHSL( color : Color, alpha : number ) : Color + +Linearly interpolates this color's HSL values toward the HSL values of the given color. It differs from [Color#lerp](Color.html#lerp) by not interpolating straight from one color to the other, but instead going through all the hues in between those two colors. The alpha argument can be thought of as the ratio between the two colors, where 0.0 is this color and 1.0 is the first argument. + +**color** + +The color to converge on. + +**alpha** + +The interpolation factor in the closed interval `[0,1]`. + +**Returns:** A reference to this color. + +### .multiply( color : Color ) : Color + +Multiplies the RGB values of the given color with the RGB values of this color. + +**color** + +The color to multiply. + +**Returns:** A reference to this color. + +### .multiplyScalar( s : number ) : Color + +Multiplies the given scalar value with the RGB values of this color. + +**s** + +The scalar to multiply. + +**Returns:** A reference to this color. + +### .offsetHSL( h : number, s : number, l : number ) : Color + +Adds the given HSL values to this color's values. Internally, this converts the color's RGB values to HSL, adds HSL and then converts the color back to RGB. + +**h** + +Hue value between `0.0` and `1.0`. + +**s** + +Saturation value between `0.0` and `1.0`. + +**l** + +Lightness value between `0.0` and `1.0`. + +**Returns:** A reference to this color. + +### .set( r : number | string | Color, g : number, b : number ) : Color + +Sets the colors's components from the given values. + +**r** + +The red component of the color. If `g` and `b` are not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance. + +**g** + +The green component. + +**b** + +The blue component. + +**Returns:** A reference to this color. + +### .setColorName( style : string, colorSpace : string ) : Color + +Sets this color from a color name. Faster than [Color#setStyle](Color.html#setStyle) if you don't need the other CSS-style formats. + +For convenience, the list of names is exposed in `Color.NAMES` as a hash. + +```js +Color.NAMES.aliceblue // returns 0xF0F8FF +``` + +**style** + +The color name. + +**colorSpace** + +The color space. + +Default is `SRGBColorSpace`. + +**Returns:** A reference to this color. + +### .setFromVector3( v : Vector3 ) : Color + +Sets the color's RGB components from the given 3D vector. + +**v** + +The vector to set. + +**Returns:** A reference to this color. + +### .setHSL( h : number, s : number, l : number, colorSpace : string ) : Color + +Sets this color from RGB values. + +**h** + +Hue value between `0.0` and `1.0`. + +**s** + +Saturation value between `0.0` and `1.0`. + +**l** + +Lightness value between `0.0` and `1.0`. + +**colorSpace** + +The color space. + +Default is `ColorManagement.workingColorSpace`. + +**Returns:** A reference to this color. + +### .setHex( hex : number, colorSpace : string ) : Color + +Sets this color from a hexadecimal value. + +**hex** + +The hexadecimal value. + +**colorSpace** + +The color space. + +Default is `SRGBColorSpace`. + +**Returns:** A reference to this color. + +### .setRGB( r : number, g : number, b : number, colorSpace : string ) : Color + +Sets this color from RGB values. + +**r** + +Red channel value between `0.0` and `1.0`. + +**g** + +Green channel value between `0.0` and `1.0`. + +**b** + +Blue channel value between `0.0` and `1.0`. + +**colorSpace** + +The color space. + +Default is `ColorManagement.workingColorSpace`. + +**Returns:** A reference to this color. + +### .setScalar( scalar : number ) : Color + +Sets the colors's components to the given scalar value. + +**scalar** + +The scalar value. + +**Returns:** A reference to this color. + +### .setStyle( style : string, colorSpace : string ) : Color + +Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`, `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or any [X11 color name](https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart) - all 140 color names are supported). + +**style** + +Color as a CSS-style string. + +**colorSpace** + +The color space. + +Default is `SRGBColorSpace`. + +**Returns:** A reference to this color. + +### .sub( color : Color ) : Color + +Subtracts the RGB values of the given color from the RGB values of this color. + +**color** + +The color to subtract. + +**Returns:** A reference to this color. + +### .toArray( array : Array., offset : number ) : Array. + +Writes the RGB components of this color to the given array. If no array is provided, the method returns a new instance. + +**array** + +The target array holding the color components. + +Default is `[]`. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** The color components. + +### .toJSON() : number + +This methods defines the serialization result of this class. Returns the color as a hexadecimal value. + +**Returns:** The hexadecimal value. + +## Source + +[src/math/Color.js](https://github.com/mrdoob/three.js/blob/master/src/math/Color.js) \ No newline at end of file diff --git a/docs/pages/ColorConverter.html.md b/docs/pages/ColorConverter.html.md new file mode 100644 index 00000000000000..a54d5fc364cdf8 --- /dev/null +++ b/docs/pages/ColorConverter.html.md @@ -0,0 +1,53 @@ +# ColorConverter + +A utility class with helper functions for color conversion. + +## Import + +ColorConverter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ColorConverter } from 'three/addons/math/ColorConverter.js'; +``` + +## Static Methods + +### .getHSV( color : Color, target : Object ) : Object + +Returns a HSV color representation of the given color object. + +**color** + +The color to get HSV values from. + +**target** + +The target object that is used to store the method's result. + +**Returns:** The HSV color. + +### .setHSV( color : Color, h : number, s : number, v : number ) : Color + +Sets the given HSV color definition to the given color object. + +**color** + +The color to set. + +**h** + +The hue. + +**s** + +The saturation. + +**v** + +The value. + +**Returns:** The update color. + +## Source + +[examples/jsm/math/ColorConverter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/ColorConverter.js) \ No newline at end of file diff --git a/docs/pages/ColorKeyframeTrack.html.md b/docs/pages/ColorKeyframeTrack.html.md new file mode 100644 index 00000000000000..17c2816796e4df --- /dev/null +++ b/docs/pages/ColorKeyframeTrack.html.md @@ -0,0 +1,41 @@ +*Inheritance: KeyframeTrack →* + +# ColorKeyframeTrack + +A track for color keyframe values. + +## Constructor + +### new ColorKeyframeTrack( name : string, times : Array., values : Array., interpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth ) + +Constructs a new color keyframe track. + +**name** + +The keyframe track's name. + +**times** + +A list of keyframe times. + +**values** + +A list of keyframe values. + +**interpolation** + +The interpolation type. + +## Properties + +### .ValueTypeName : string + +The value type name. + +Default is `'color'`. + +**Overrides:** [KeyframeTrack#ValueTypeName](KeyframeTrack.html#ValueTypeName) + +## Source + +[src/animation/tracks/ColorKeyframeTrack.js](https://github.com/mrdoob/three.js/blob/master/src/animation/tracks/ColorKeyframeTrack.js) \ No newline at end of file diff --git a/docs/pages/ColorSpaceNode.html.md b/docs/pages/ColorSpaceNode.html.md new file mode 100644 index 00000000000000..5690a9f7a4e6a7 --- /dev/null +++ b/docs/pages/ColorSpaceNode.html.md @@ -0,0 +1,57 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# ColorSpaceNode + +This node represents a color space conversion. Meaning it converts a color value from a source to a target color space. + +## Constructor + +### new ColorSpaceNode( colorNode : Node, source : string, target : string ) + +Constructs a new color space node. + +**colorNode** + +Represents the color to convert. + +**source** + +The source color space. + +**target** + +The target color space. + +## Properties + +### .colorNode : Node + +Represents the color to convert. + +### .source : string + +The source color space. + +### .target : string + +The target color space. + +## Methods + +### .resolveColorSpace( builder : NodeBuilder, colorSpace : string ) : string + +This method resolves the constants `WORKING_COLOR_SPACE` and `OUTPUT_COLOR_SPACE` based on the current configuration of the color management and renderer. + +**builder** + +The current node builder. + +**colorSpace** + +The color space to resolve. + +**Returns:** The resolved color space. + +## Source + +[src/nodes/display/ColorSpaceNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/ColorSpaceNode.js) \ No newline at end of file diff --git a/docs/pages/CompressedArrayTexture.html.md b/docs/pages/CompressedArrayTexture.html.md new file mode 100644 index 00000000000000..6ca0431ef99a2b --- /dev/null +++ b/docs/pages/CompressedArrayTexture.html.md @@ -0,0 +1,83 @@ +*Inheritance: EventDispatcher → Texture → CompressedTexture →* + +# CompressedArrayTexture + +Creates a texture 2D array based on data in compressed form. + +These texture are usually loaded with [CompressedTextureLoader](CompressedTextureLoader.html). + +## Constructor + +### new CompressedArrayTexture( mipmaps : Array., width : number, height : number, depth : number, format : number, type : number ) + +Constructs a new compressed array texture. + +**mipmaps** + +This array holds for all mipmaps (including the bases mip) the data and dimensions. + +**width** + +The width of the texture. + +**height** + +The height of the texture. + +**depth** + +The depth of the texture. + +**format** + +The min filter value. + +Default is `RGBAFormat`. + +**type** + +The min filter value. + +Default is `UnsignedByteType`. + +## Properties + +### .image : Object + +The image property of a compressed texture just defines its dimensions. + +**Overrides:** [CompressedTexture#image](CompressedTexture.html#image) + +### .isCompressedArrayTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .layerUpdates : Set. + +A set of all layers which need to be updated in the texture. + +### .wrapR : RepeatWrapping | ClampToEdgeWrapping | MirroredRepeatWrapping + +This defines how the texture is wrapped in the depth and corresponds to _W_ in UVW mapping. + +Default is `ClampToEdgeWrapping`. + +## Methods + +### .addLayerUpdate( layerIndex : number ) + +Describes that a specific layer of the texture needs to be updated. Normally when [Texture#needsUpdate](Texture.html#needsUpdate) is set to `true`, the entire compressed texture array is sent to the GPU. Marking specific layers will only transmit subsets of all mipmaps associated with a specific depth in the array which is often much more performant. + +**layerIndex** + +The layer index that should be updated. + +### .clearLayerUpdates() + +Resets the layer updates registry. + +## Source + +[src/textures/CompressedArrayTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/CompressedArrayTexture.js) \ No newline at end of file diff --git a/docs/pages/CompressedCubeTexture.html.md b/docs/pages/CompressedCubeTexture.html.md new file mode 100644 index 00000000000000..56487bb1761e96 --- /dev/null +++ b/docs/pages/CompressedCubeTexture.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Texture → CompressedTexture →* + +# CompressedCubeTexture + +Creates a cube texture based on data in compressed form. + +These texture are usually loaded with [CompressedTextureLoader](CompressedTextureLoader.html). + +## Constructor + +### new CompressedCubeTexture( images : Array., format : number, type : number ) + +Constructs a new compressed texture. + +**images** + +An array of compressed textures. + +**format** + +The texture format. + +Default is `RGBAFormat`. + +**type** + +The texture type. + +Default is `UnsignedByteType`. + +## Properties + +### .isCompressedCubeTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .isCubeTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/textures/CompressedCubeTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/CompressedCubeTexture.js) \ No newline at end of file diff --git a/docs/pages/CompressedTexture.html.md b/docs/pages/CompressedTexture.html.md new file mode 100644 index 00000000000000..2be9bf6ba90216 --- /dev/null +++ b/docs/pages/CompressedTexture.html.md @@ -0,0 +1,123 @@ +*Inheritance: EventDispatcher → Texture →* + +# CompressedTexture + +Creates a texture based on data in compressed form. + +These texture are usually loaded with [CompressedTextureLoader](CompressedTextureLoader.html). + +## Constructor + +### new CompressedTexture( mipmaps : Array., width : number, height : number, format : number, type : number, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, anisotropy : number, colorSpace : string ) + +Constructs a new compressed texture. + +**mipmaps** + +This array holds for all mipmaps (including the bases mip) the data and dimensions. + +**width** + +The width of the texture. + +**height** + +The height of the texture. + +**format** + +The texture format. + +Default is `RGBAFormat`. + +**type** + +The texture type. + +Default is `UnsignedByteType`. + +**mapping** + +The texture mapping. + +Default is `Texture.DEFAULT_MAPPING`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `LinearFilter`. + +**minFilter** + +The min filter value. + +Default is `LinearMipmapLinearFilter`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +**colorSpace** + +The color space. + +Default is `NoColorSpace`. + +## Properties + +### .flipY : boolean (readonly) + +If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + +Overwritten and set to `false` by default since it is not possible to flip compressed textures. + +Default is `false`. + +**Overrides:** [Texture#flipY](Texture.html#flipY) + +### .generateMipmaps : boolean (readonly) + +Whether to generate mipmaps (if possible) for a texture. + +Overwritten and set to `false` by default since it is not possible to generate mipmaps for compressed data. Mipmaps must be embedded in the compressed texture file. + +Default is `false`. + +**Overrides:** [Texture#generateMipmaps](Texture.html#generateMipmaps) + +### .image : Object + +The image property of a compressed texture just defines its dimensions. + +**Overrides:** [Texture#image](Texture.html#image) + +### .isCompressedTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .mipmaps : Array. + +This array holds for all mipmaps (including the bases mip) the data and dimensions. + +**Overrides:** [Texture#mipmaps](Texture.html#mipmaps) + +## Source + +[src/textures/CompressedTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/CompressedTexture.js) \ No newline at end of file diff --git a/docs/pages/CompressedTextureLoader.html.md b/docs/pages/CompressedTextureLoader.html.md new file mode 100644 index 00000000000000..3023d2657a735f --- /dev/null +++ b/docs/pages/CompressedTextureLoader.html.md @@ -0,0 +1,83 @@ +*Inheritance: Loader →* + +# CompressedTextureLoader + +Abstract base class for loading compressed texture formats S3TC, ASTC or ETC. Textures are internally loaded via [FileLoader](FileLoader.html). + +Derived classes have to implement the `parse()` method which holds the parsing for the respective format. + +## Constructor + +### new CompressedTextureLoader( manager : LoadingManager ) (abstract) + +Constructs a new compressed texture loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : CompressedTexture + +Starts loading from the given URL and passes the loaded compressed texture to the `onLoad()` callback. The method also returns a new texture object which can directly be used for material creation. If you do it this way, the texture may pop up in your scene once the respective loading process is finished. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The compressed texture. + +## Type Definitions + +### .TexData + +Represents the result object type of the `parse()` method. + +**width** +number + +The width of the base mip. + +**height** +number + +The width of the base mip. + +**isCubemap** +boolean + +Whether the data represent a cubemap or not. + +**mipmapCount** +number + +The mipmap count. + +**mipmaps** +Array.<{data:TypedArray, width:number, height:number}> + +An array holding the mipmaps. Each entry holds the data and the dimensions for each level. + +**format** +number + +The texture format. + +## Source + +[src/loaders/CompressedTextureLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/CompressedTextureLoader.js) \ No newline at end of file diff --git a/docs/pages/ComputeBuiltinNode.html.md b/docs/pages/ComputeBuiltinNode.html.md new file mode 100644 index 00000000000000..8b7a743a9a2367 --- /dev/null +++ b/docs/pages/ComputeBuiltinNode.html.md @@ -0,0 +1,81 @@ +*Inheritance: EventDispatcher → Node →* + +# ComputeBuiltinNode + +`ComputeBuiltinNode` represents a compute-scope builtin value that expose information about the currently running dispatch and/or the device it is running on. + +This node can only be used with a WebGPU backend. + +## Constructor + +### new ComputeBuiltinNode( builtinName : string, nodeType : string ) + +Constructs a new compute builtin node. + +**builtinName** + +The built-in name. + +**nodeType** + +The node type. + +## Methods + +### .getBuiltinName( builder : NodeBuilder ) : string + +Returns the builtin name. + +**builder** + +The current node builder. + +**Returns:** The builtin name. + +### .getHash( builder : NodeBuilder ) : string + +This method is overwritten since hash is derived from the built-in name. + +**builder** + +The current node builder. + +**Overrides:** [Node#getHash](Node.html#getHash) + +**Returns:** The hash. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is simply derived from `nodeType`.. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .hasBuiltin( builder : NodeBuilder ) : boolean + +Whether the current node builder has the builtin or not. + +**builder** + +The current node builder. + +**Returns:** Whether the builder has the builtin or not. + +### .setBuiltinName( builtinName : string ) : ComputeBuiltinNode + +Sets the builtin name. + +**builtinName** + +The built-in name. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/gpgpu/ComputeBuiltinNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/gpgpu/ComputeBuiltinNode.js) \ No newline at end of file diff --git a/docs/pages/ComputeNode.html.md b/docs/pages/ComputeNode.html.md new file mode 100644 index 00000000000000..0773c6e2e8da35 --- /dev/null +++ b/docs/pages/ComputeNode.html.md @@ -0,0 +1,133 @@ +*Inheritance: EventDispatcher → Node →* + +# ComputeNode + +TODO + +## Constructor + +### new ComputeNode( computeNode : Node, workgroupSize : Array. ) + +Constructs a new compute node. + +**computeNode** + +TODO + +**workgroupSize** + +TODO. + +## Properties + +### .computeNode : Node + +TODO + +### .count : number | Array. + +TODO + +### .isComputeNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name or label of the uniform. + +Default is `''`. + +**Overrides:** [Node#name](Node.html#name) + +### .onInitFunction : function + +TODO + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.OBJECT` since [ComputeNode#updateBefore](ComputeNode.html#updateBefore) is executed once per object by default. + +Default is `'object'`. + +**Overrides:** [Node#updateBeforeType](Node.html#updateBeforeType) + +### .version : number + +TODO + +**Overrides:** [Node#version](Node.html#version) + +### .workgroupSize : Array. + +TODO + +Default is `[ 64 ]`. + +## Methods + +### .dispose() + +Executes the `dispose` event for this node. + +**Overrides:** [Node#dispose](Node.html#dispose) + +### .getCount() : number | Array. + +TODO + +### .label( name : string ) : ComputeNode + +Sets the [ComputeNode#name](ComputeNode.html#name) property. + +**name** + +The name of the uniform. + +**Deprecated:** Yes + +**Returns:** A reference to this node. + +### .onInit( callback : function ) : ComputeNode + +TODO + +**callback** + +TODO. + +**Returns:** A reference to this node. + +### .setCount( count : number | Array. ) : ComputeNode + +TODO + +**count** + +Array with \[ x, y, z \] values for dispatch or a single number for the count + +### .setName( name : string ) : ComputeNode + +Sets the [ComputeNode#name](ComputeNode.html#name) property. + +**name** + +The name of the uniform. + +**Returns:** A reference to this node. + +### .updateBefore( frame : NodeFrame ) + +The method execute the compute for this node. + +**frame** + +A reference to the current node frame. + +**Overrides:** [Node#updateBefore](Node.html#updateBefore) + +## Source + +[src/nodes/gpgpu/ComputeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/gpgpu/ComputeNode.js) \ No newline at end of file diff --git a/docs/pages/ConditionalNode.html.md b/docs/pages/ConditionalNode.html.md new file mode 100644 index 00000000000000..6d6ad1e5ffd879 --- /dev/null +++ b/docs/pages/ConditionalNode.html.md @@ -0,0 +1,69 @@ +*Inheritance: EventDispatcher → Node →* + +# ConditionalNode + +Represents a logical `if/else` statement. Can be used as an alternative to the `If()`/`Else()` syntax. + +The corresponding TSL `select()` looks like so: + +The `select()` method is called in a chaining fashion on a condition. The parameter nodes of `select()` determine the outcome of the entire statement. + +## Code Example + +```js +velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity ); +``` + +## Constructor + +### new ConditionalNode( condNode : Node, ifNode : Node, elseNode : Node ) + +Constructs a new conditional node. + +**condNode** + +The node that defines the condition. + +**ifNode** + +The node that is evaluate when the condition ends up `true`. + +**elseNode** + +The node that is evaluate when the condition ends up `false`. + +Default is `null`. + +## Properties + +### .condNode : Node + +The node that defines the condition. + +### .elseNode : Node + +The node that is evaluate when the condition ends up `false`. + +Default is `null`. + +### .ifNode : Node + +The node that is evaluate when the condition ends up `true`. + +## Methods + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from the if/else nodes. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/math/ConditionalNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/math/ConditionalNode.js) \ No newline at end of file diff --git a/docs/pages/ConeGeometry.html.md b/docs/pages/ConeGeometry.html.md new file mode 100644 index 00000000000000..cdafdc391a0117 --- /dev/null +++ b/docs/pages/ConeGeometry.html.md @@ -0,0 +1,86 @@ +*Inheritance: EventDispatcher → BufferGeometry → CylinderGeometry →* + +# ConeGeometry + +A geometry class for representing a cone. + +## Code Example + +```js +const geometry = new THREE.ConeGeometry( 5, 20, 32 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const cone = new THREE.Mesh(geometry, material ); +scene.add( cone ); +``` + +## Constructor + +### new ConeGeometry( radius : number, height : number, radialSegments : number, heightSegments : number, openEnded : boolean, thetaStart : number, thetaLength : number ) + +Constructs a new cone geometry. + +**radius** + +Radius of the cone base. + +Default is `1`. + +**height** + +Height of the cone. + +Default is `1`. + +**radialSegments** + +Number of segmented faces around the circumference of the cone. + +Default is `32`. + +**heightSegments** + +Number of rows of faces along the height of the cone. + +Default is `1`. + +**openEnded** + +Whether the base of the cone is open or capped. + +Default is `false`. + +**thetaStart** + +Start angle for first segment, in radians. + +Default is `0`. + +**thetaLength** + +The central angle, often called theta, of the circular sector, in radians. The default value results in a complete cone. + +Default is `Math.PI*2`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +**Overrides:** [CylinderGeometry#parameters](CylinderGeometry.html#parameters) + +## Static Methods + +### .fromJSON( data : Object ) : ConeGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/ConeGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/ConeGeometry.js) \ No newline at end of file diff --git a/docs/pages/ConstNode.html.md b/docs/pages/ConstNode.html.md new file mode 100644 index 00000000000000..83c1001999f162 --- /dev/null +++ b/docs/pages/ConstNode.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Node → InputNode →* + +# ConstNode + +Class for representing a constant value in the shader. + +## Constructor + +### new ConstNode( value : any, nodeType : string ) + +Constructs a new input node. + +**value** + +The value of this node. Usually a JS primitive or three.js object (vector, matrix, color). + +**nodeType** + +The node type. If no explicit type is defined, the node tries to derive the type from its value. + +Default is `null`. + +## Properties + +### .isConstNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .generateConst( builder : NodeBuilder ) : string + +Generates the shader string of the value with the current node builder. + +**builder** + +The current node builder. + +**Returns:** The generated value as a shader string. + +## Source + +[src/nodes/core/ConstNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/ConstNode.js) \ No newline at end of file diff --git a/docs/pages/ContextNode.html.md b/docs/pages/ContextNode.html.md new file mode 100644 index 00000000000000..b95ac27e66b85b --- /dev/null +++ b/docs/pages/ContextNode.html.md @@ -0,0 +1,101 @@ +*Inheritance: EventDispatcher → Node →* + +# ContextNode + +This node can be used as a context management component for another node. [NodeBuilder](NodeBuilder.html) performs its node building process in a specific context and this node allows the modify the context. A typical use case is to overwrite `getUV()` e.g.: + +## Code Example + +```js +node.context( { getUV: () => customCoord } ); +\// or +material.contextNode = context( { getUV: () => customCoord } ); +\// or +renderer.contextNode = context( { getUV: () => customCoord } ); +\// or +scenePass.contextNode = context( { getUV: () => customCoord } ); +``` + +## Constructor + +### new ContextNode( node : Node, value : Object ) + +Constructs a new context node. + +**node** + +The node whose context should be modified. + +Default is `null`. + +**value** + +The modified context data. + +Default is `{}`. + +## Properties + +### .isContextNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .node : Node + +The node whose context should be modified. + +### .value : Object + +The modified context data. + +Default is `{}`. + +## Methods + +### .getFlowContextData() : Object + +Gathers the context data from all parent context nodes. + +**Returns:** The gathered context data. + +### .getMemberType( builder : NodeBuilder, name : string ) : string + +This method is overwritten to ensure it returns the member type of [ContextNode#node](ContextNode.html#node). + +**builder** + +The current node builder. + +**name** + +The member name. + +**Overrides:** [Node#getMemberType](Node.html#getMemberType) + +**Returns:** The member type. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten to ensure it returns the type of [ContextNode#node](ContextNode.html#node). + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .getScope() : Node + +This method is overwritten to ensure it returns the reference to [ContextNode#node](ContextNode.html#node). + +**Overrides:** [Node#getScope](Node.html#getScope) + +**Returns:** A reference to [ContextNode#node](ContextNode.html#node). + +## Source + +[src/nodes/core/ContextNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/ContextNode.js) \ No newline at end of file diff --git a/docs/pages/Controls.html.md b/docs/pages/Controls.html.md new file mode 100644 index 00000000000000..66371c2a260194 --- /dev/null +++ b/docs/pages/Controls.html.md @@ -0,0 +1,87 @@ +*Inheritance: EventDispatcher →* + +# Controls + +Abstract base class for controls. + +## Constructor + +### new Controls( object : Object3D, domElement : HTMLElement ) (abstract) + +Constructs a new controls instance. + +**object** + +The object that is managed by the controls. + +**domElement** + +The HTML element used for event listeners. + +Default is `null`. + +## Properties + +### .domElement : HTMLElement + +The HTML element used for event listeners. + +Default is `null`. + +### .enabled : boolean + +Whether the controls responds to user input or not. + +Default is `true`. + +### .keys : Object + +This object defines the keyboard input of the controls. + +### .mouseButtons : Object + +This object defines what type of actions are assigned to the available mouse buttons. It depends on the control implementation what kind of mouse buttons and actions are supported. + +### .object : Object3D + +The object that is managed by the controls. + +### .state : number + +The internal state of the controls. + +Default is `-1`. + +### .touches : Object + +This object defines what type of actions are assigned to what kind of touch interaction. It depends on the control implementation what kind of touch interaction and actions are supported. + +## Methods + +### .connect( element : HTMLElement ) + +Connects the controls to the DOM. This method has so called "side effects" since it adds the module's event listeners to the DOM. + +**element** + +The DOM element to connect to. + +### .disconnect() + +Disconnects the controls from the DOM. + +### .dispose() + +Call this method if you no longer want use to the controls. It frees all internal resources and removes all event listeners. + +### .update( delta : number ) + +Controls should implement this method if they have to update their internal state per simulation step. + +**delta** + +The time delta in seconds. + +## Source + +[src/extras/Controls.js](https://github.com/mrdoob/three.js/blob/master/src/extras/Controls.js) \ No newline at end of file diff --git a/docs/pages/ConvertNode.html.md b/docs/pages/ConvertNode.html.md new file mode 100644 index 00000000000000..ba10d6c2fc2c39 --- /dev/null +++ b/docs/pages/ConvertNode.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Node →* + +# ConvertNode + +This module is part of the TSL core and usually not used in app level code. It represents a convert operation during the shader generation process meaning it converts the data type of a node to a target data type. + +## Constructor + +### new ConvertNode( node : Node, convertTo : string ) + +Constructs a new convert node. + +**node** + +The node which type should be converted. + +**convertTo** + +The target node type. Multiple types can be defined by separating them with a `|` sign. + +## Properties + +### .convertTo : string + +The target node type. Multiple types can be defined by separating them with a `|` sign. + +### .node : Node + +The node which type should be converted. + +## Methods + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the implementation tries to infer the best matching type from the [ConvertNode#convertTo](ConvertNode.html#convertTo) property. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/utils/ConvertNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/ConvertNode.js) \ No newline at end of file diff --git a/docs/pages/ConvexGeometry.html.md b/docs/pages/ConvexGeometry.html.md new file mode 100644 index 00000000000000..9ca48846e2f062 --- /dev/null +++ b/docs/pages/ConvexGeometry.html.md @@ -0,0 +1,36 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# ConvexGeometry + +This class can be used to generate a convex hull for a given array of 3D points. The average time complexity for this task is considered to be O(nlog(n)). + +## Code Example + +```js +const geometry = new ConvexGeometry( points ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +const mesh = new THREE.Mesh( geometry, material ); +scene.add( mesh ); +``` + +## Import + +ConvexGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ConvexGeometry } from 'three/addons/geometries/ConvexGeometry.js'; +``` + +## Constructor + +### new ConvexGeometry( points : Array. ) + +Constructs a new convex geometry. + +**points** + +An array of points in 3D space which should be enclosed by the convex hull. + +## Source + +[examples/jsm/geometries/ConvexGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/ConvexGeometry.js) \ No newline at end of file diff --git a/docs/pages/ConvexHull.html.md b/docs/pages/ConvexHull.html.md new file mode 100644 index 00000000000000..1b29988e7ce91a --- /dev/null +++ b/docs/pages/ConvexHull.html.md @@ -0,0 +1,85 @@ +# ConvexHull + +Can be used to compute the convex hull in 3D space for a given set of points. It is primarily intended for [ConvexGeometry](ConvexGeometry.html). + +This Quickhull 3D implementation is a port of [quickhull3d](https://github.com/maurizzzio/quickhull3d/) by Mauricio Poppe. + +## Import + +ConvexHull is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ConvexHull } from 'three/addons/math/ConvexHull.js'; +``` + +## Constructor + +### new ConvexHull() + +Constructs a new convex hull. + +## Methods + +### .containsPoint( point : Vector3 ) : boolean + +Returns `true` if the given point lies in the convex hull. + +**point** + +The point to test. + +**Returns:** Whether the given point lies in the convex hull or not. + +### .intersectRay( ray : Ray, target : Vector3 ) : Vector3 + +Computes the intersections point of the given ray and this convex hull. + +**ray** + +The ray to test. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The intersection point. Returns `null` if not intersection was detected. + +### .intersectsRay( ray : Ray ) : boolean + +Returns `true` if the given ray intersects with this convex hull. + +**ray** + +The ray to test. + +**Returns:** Whether the given ray intersects with this convex hull or not. + +### .makeEmpty() : ConvexHull + +Makes the convex hull empty. + +**Returns:** A reference to this convex hull. + +### .setFromObject( object : Object3D ) : ConvexHull + +Computes the convex hull of the given 3D object (including its descendants), accounting for the world transforms of both the 3D object and its descendants. + +**object** + +The 3D object to compute the convex hull for. + +**Returns:** A reference to this convex hull. + +### .setFromPoints( points : Array. ) : ConvexHull + +Computes to convex hull for the given array of points. + +**points** + +The array of points in 3D space. + +**Returns:** A reference to this convex hull. + +## Source + +[examples/jsm/math/ConvexHull.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/ConvexHull.js) \ No newline at end of file diff --git a/docs/pages/ConvexObjectBreaker.html.md b/docs/pages/ConvexObjectBreaker.html.md new file mode 100644 index 00000000000000..2f6d1b73b47cae --- /dev/null +++ b/docs/pages/ConvexObjectBreaker.html.md @@ -0,0 +1,113 @@ +# ConvexObjectBreaker + +This class can be used to subdivide a convex Geometry object into pieces. + +Use the function prepareBreakableObject to prepare a Mesh object to be broken. Then, call the various functions to subdivide the object (subdivideByImpact, cutByPlane). Sub-objects that are product of subdivision don't need prepareBreakableObject to be called on them. + +Requisites for the object: + +* Mesh object must have a buffer geometry and a material. +* Vertex normals must be planar (not smoothed). +* The geometry must be convex (this is not checked in the library). You can create convex geometries with [ConvexGeometry](ConvexGeometry.html). The [BoxGeometry](BoxGeometry.html), [SphereGeometry](SphereGeometry.html) and other convex primitives can also be used. + +Note: This lib adds member variables to object's userData member (see prepareBreakableObject function) Use with caution and read the code when using with other libs. + +## Import + +ConvexObjectBreaker is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ConvexObjectBreaker } from 'three/addons/misc/ConvexObjectBreaker.js'; +``` + +## Constructor + +### new ConvexObjectBreaker( minSizeForBreak : number, smallDelta : number ) + +Constructs a new convex object breaker. + +**minSizeForBreak** + +Min size a debris can have to break. + +Default is `1.4`. + +**smallDelta** + +Max distance to consider that a point belongs to a plane. + +Default is `0.0001`. + +## Methods + +### .cutByPlane( object : Object3D, plane : Plane, output : Object ) : number + +Subdivides the given 3D object into pieces by a plane. + +**object** + +The 3D object to subdivide. + +**plane** + +The plane to cut the 3D object. + +**output** + +An object that stores the pieces. + +**Returns:** The number of pieces. + +### .prepareBreakableObject( object : Object3D, mass : number, velocity : Vector3, angularVelocity : Vector3, breakable : boolean ) + +Must be called for all 3D objects that should be breakable. + +**object** + +The 3D object. It must have a convex geometry. + +**mass** + +The 3D object's mass in kg. Must be greater than `0`. + +**velocity** + +The 3D object's velocity. + +**angularVelocity** + +The 3D object's angular velocity. + +**breakable** + +Whether the 3D object is breakable or not. + +### .subdivideByImpact( object : Object3D, pointOfImpact : Vector3, normal : Vector3, maxRadialIterations : number, maxRandomIterations : number ) : Array. + +Subdivides the given 3D object into pieces by an impact (meaning another object hits the given 3D object at a certain surface point). + +**object** + +The 3D object to subdivide. + +**pointOfImpact** + +The point of impact. + +**normal** + +The impact normal. + +**maxRadialIterations** + +Iterations for radial cuts. + +**maxRandomIterations** + +Max random iterations for not-radial cuts. + +**Returns:** The array of pieces. + +## Source + +[examples/jsm/misc/ConvexObjectBreaker.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/ConvexObjectBreaker.js) \ No newline at end of file diff --git a/docs/pages/CubeCamera.html.md b/docs/pages/CubeCamera.html.md new file mode 100644 index 00000000000000..7168bd9dad79ce --- /dev/null +++ b/docs/pages/CubeCamera.html.md @@ -0,0 +1,84 @@ +*Inheritance: EventDispatcher → Object3D →* + +# CubeCamera + +A special type of camera that is positioned in 3D space to render its surroundings into a cube render target. The render target can then be used as an environment map for rendering realtime reflections in your scene. + +## Code Example + +```js +// Create cube render target +const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 256, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } ); +// Create cube camera +const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget ); +scene.add( cubeCamera ); +// Create car +const chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeRenderTarget.texture } ); +const car = new THREE.Mesh( carGeometry, chromeMaterial ); +scene.add( car ); +// Update the render target cube +car.visible = false; +cubeCamera.position.copy( car.position ); +cubeCamera.update( renderer, scene ); +// Render the scene +car.visible = true; +renderer.render( scene, camera ); +``` + +## Constructor + +### new CubeCamera( near : number, far : number, renderTarget : WebGLCubeRenderTarget ) + +Constructs a new cube camera. + +**near** + +The camera's near plane. + +**far** + +The camera's far plane. + +**renderTarget** + +The cube render target. + +## Properties + +### .activeMipmapLevel : number + +The current active mipmap level + +Default is `0`. + +### .coordinateSystem : WebGLCoordinateSystem | WebGPUCoordinateSystem + +The current active coordinate system. + +Default is `null`. + +### .renderTarget : WebGLCubeRenderTarget + +A reference to the cube render target. + +## Methods + +### .update( renderer : Renderer | WebGLRenderer, scene : Scene ) + +Calling this method will render the given scene with the given renderer into the cube render target of the camera. + +**renderer** + +The renderer. + +**scene** + +The scene to render. + +### .updateCoordinateSystem() + +Must be called when the coordinate system of the cube camera is changed. + +## Source + +[src/cameras/CubeCamera.js](https://github.com/mrdoob/three.js/blob/master/src/cameras/CubeCamera.js) \ No newline at end of file diff --git a/docs/pages/CubeDepthTexture.html.md b/docs/pages/CubeDepthTexture.html.md new file mode 100644 index 00000000000000..cd8e1ad83a4120 --- /dev/null +++ b/docs/pages/CubeDepthTexture.html.md @@ -0,0 +1,85 @@ +*Inheritance: EventDispatcher → Texture → DepthTexture →* + +# CubeDepthTexture + +This class can be used to automatically save the depth information of a cube rendering into a cube texture with depth format. Used for PointLight shadows. + +## Constructor + +### new CubeDepthTexture( size : number, type : number, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, anisotropy : number, format : number ) + +Constructs a new cube depth texture. + +**size** + +The size (width and height) of each cube face. + +**type** + +The texture type. + +Default is `UnsignedIntType`. + +**mapping** + +The texture mapping. + +Default is `CubeReflectionMapping`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `NearestFilter`. + +**minFilter** + +The min filter value. + +Default is `NearestFilter`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +**format** + +The texture format. + +Default is `DepthFormat`. + +## Properties + +### .images : Array. + +Alias for [CubeDepthTexture#image](CubeDepthTexture.html#image). + +### .isCubeDepthTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .isCubeTexture : boolean (readonly) + +Set to true for cube texture handling in WebGLTextures. + +Default is `true`. + +## Source + +[src/textures/CubeDepthTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/CubeDepthTexture.js) \ No newline at end of file diff --git a/docs/pages/CubeMapNode.html.md b/docs/pages/CubeMapNode.html.md new file mode 100644 index 00000000000000..a0ddb995781255 --- /dev/null +++ b/docs/pages/CubeMapNode.html.md @@ -0,0 +1,33 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# CubeMapNode + +This node can be used to automatically convert environment maps in the equirectangular format into the cube map format. + +## Constructor + +### new CubeMapNode( envNode : Node ) + +Constructs a new cube map node. + +**envNode** + +The node representing the environment map. + +## Properties + +### .envNode : Node + +The node representing the environment map. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.RENDER` since the node updates the texture once per render in its [CubeMapNode#updateBefore](CubeMapNode.html#updateBefore) method. + +Default is `'render'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Source + +[src/nodes/utils/CubeMapNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/CubeMapNode.js) \ No newline at end of file diff --git a/docs/pages/CubeRenderTarget.html.md b/docs/pages/CubeRenderTarget.html.md new file mode 100644 index 00000000000000..30f0920411af30 --- /dev/null +++ b/docs/pages/CubeRenderTarget.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → RenderTarget → WebGLRenderTarget → WebGLCubeRenderTarget →* + +# CubeRenderTarget + +This class represents a cube render target. It is a special version of `WebGLCubeRenderTarget` which is compatible with `WebGPURenderer`. + +## Constructor + +### new CubeRenderTarget( size : number, options : RenderTarget~Options ) + +Constructs a new cube render target. + +**size** + +The size of the render target. + +Default is `1`. + +**options** + +The configuration object. + +## Properties + +### .isCubeRenderTarget : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .fromEquirectangularTexture( renderer : Renderer, texture : Texture ) : CubeRenderTarget + +Converts the given equirectangular texture to a cube map. + +**renderer** + +The renderer. + +**texture** + +The equirectangular texture. + +**Overrides:** [WebGLCubeRenderTarget#fromEquirectangularTexture](WebGLCubeRenderTarget.html#fromEquirectangularTexture) + +**Returns:** A reference to this cube render target. + +## Source + +[src/renderers/common/CubeRenderTarget.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/CubeRenderTarget.js) \ No newline at end of file diff --git a/docs/pages/CubeTexture.html.md b/docs/pages/CubeTexture.html.md new file mode 100644 index 00000000000000..a2a18baef46e2a --- /dev/null +++ b/docs/pages/CubeTexture.html.md @@ -0,0 +1,108 @@ +*Inheritance: EventDispatcher → Texture →* + +# CubeTexture + +Creates a cube texture made up of six images. + +## Code Example + +```js +const loader = new THREE.CubeTextureLoader(); +loader.setPath( 'textures/cube/pisa/' ); +const textureCube = loader.load( [ + 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' +] ); +const material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } ); +``` + +## Constructor + +### new CubeTexture( images : Array., mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, format : number, type : number, anisotropy : number, colorSpace : string ) + +Constructs a new cube texture. + +**images** + +An array holding a image for each side of a cube. + +Default is `[]`. + +**mapping** + +The texture mapping. + +Default is `CubeReflectionMapping`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `LinearFilter`. + +**minFilter** + +The min filter value. + +Default is `LinearMipmapLinearFilter`. + +**format** + +The texture format. + +Default is `RGBAFormat`. + +**type** + +The texture type. + +Default is `UnsignedByteType`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +**colorSpace** + +The color space value. + +Default is `NoColorSpace`. + +## Properties + +### .flipY : boolean + +If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#flipY](Texture.html#flipY) + +### .images : Array. + +Alias for [CubeTexture#image](CubeTexture.html#image). + +### .isCubeTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/textures/CubeTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/CubeTexture.js) \ No newline at end of file diff --git a/docs/pages/CubeTextureLoader.html.md b/docs/pages/CubeTextureLoader.html.md new file mode 100644 index 00000000000000..879f39c7b5881f --- /dev/null +++ b/docs/pages/CubeTextureLoader.html.md @@ -0,0 +1,61 @@ +*Inheritance: Loader →* + +# CubeTextureLoader + +Class for loading cube textures. Images are internally loaded via [ImageLoader](ImageLoader.html). + +The loader returns an instance of [CubeTexture](CubeTexture.html) and expects the cube map to be defined as six separate images representing the sides of a cube. Other cube map definitions like vertical and horizontal cross, column and row layouts are not supported. + +Note that, by convention, cube maps are specified in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words, using a left-handed coordinate system. Since three.js uses a right-handed coordinate system, environment maps used in three.js will have pos-x and neg-x swapped. + +The loaded cube texture is in sRGB color space. Meaning [Texture#colorSpace](Texture.html#colorSpace) is set to `SRGBColorSpace` by default. + +## Code Example + +```js +const loader = new THREE.CubeTextureLoader().setPath( 'textures/cubeMaps/' ); +const cubeTexture = await loader.loadAsync( [ + 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' +] ); +scene.background = cubeTexture; +``` + +## Constructor + +### new CubeTextureLoader( manager : LoadingManager ) + +Constructs a new cube texture loader. + +**manager** + +The loading manager. + +## Methods + +### .load( urls : Array., onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : CubeTexture + +Starts loading from the given URL and pass the fully loaded cube texture to the `onLoad()` callback. The method also returns a new cube texture object which can directly be used for material creation. If you do it this way, the cube texture may pop up in your scene once the respective loading process is finished. + +**urls** + +Array of 6 URLs to images, one for each side of the cube texture. The urls should be specified in the following order: pos-x, neg-x, pos-y, neg-y, pos-z, neg-z. An array of data URIs are allowed as well. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Unsupported in this loader. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The cube texture. + +## Source + +[src/loaders/CubeTextureLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/CubeTextureLoader.js) \ No newline at end of file diff --git a/docs/pages/CubeTextureNode.html.md b/docs/pages/CubeTextureNode.html.md new file mode 100644 index 00000000000000..c4bf1594c43fb6 --- /dev/null +++ b/docs/pages/CubeTextureNode.html.md @@ -0,0 +1,109 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode →* + +# CubeTextureNode + +This type of uniform node represents a cube texture. + +## Constructor + +### new CubeTextureNode( value : CubeTexture, uvNode : Node., levelNode : Node., biasNode : Node. ) + +Constructs a new cube texture node. + +**value** + +The cube texture. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +**biasNode** + +The bias node. + +Default is `null`. + +## Properties + +### .isCubeTextureNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .generateUV( builder : NodeBuilder, cubeUV : Node ) : string + +Generates the uv code snippet. + +**builder** + +The current node builder. + +**cubeUV** + +The uv node to generate code for. + +**Overrides:** [TextureNode#generateUV](TextureNode.html#generateUV) + +**Returns:** The generated code snippet. + +### .getDefaultUV() : Node. + +Returns a default uvs based on the mapping type of the cube texture. + +**Overrides:** [TextureNode#getDefaultUV](TextureNode.html#getDefaultUV) + +**Returns:** The default uv attribute. + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation to return the appropriate cube texture type. + +**builder** + +The current node builder. + +**Overrides:** [TextureNode#getInputType](TextureNode.html#getInputType) + +**Returns:** The input type. + +### .setUpdateMatrix( value : boolean ) + +Overwritten with an empty implementation since the `updateMatrix` flag is ignored for cube textures. The uv transformation matrix is not applied to cube textures. + +**value** + +The update toggle. + +**Overrides:** [TextureNode#setUpdateMatrix](TextureNode.html#setUpdateMatrix) + +### .setupUV( builder : NodeBuilder, uvNode : Node ) : Node + +Setups the uv node. Depending on the backend as well as the texture type, it might be necessary to modify the uv node for correct sampling. + +**builder** + +The current node builder. + +**uvNode** + +The uv node to setup. + +**Overrides:** [TextureNode#setupUV](TextureNode.html#setupUV) + +**Returns:** The updated uv node. + +## Source + +[src/nodes/accessors/CubeTextureNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/CubeTextureNode.js) \ No newline at end of file diff --git a/docs/pages/CubeTexturePass.html.md b/docs/pages/CubeTexturePass.html.md new file mode 100644 index 00000000000000..03e19491d8538d --- /dev/null +++ b/docs/pages/CubeTexturePass.html.md @@ -0,0 +1,103 @@ +*Inheritance: Pass →* + +# CubeTexturePass + +This pass can be used to render a cube texture over the entire screen. + +## Code Example + +```js +const cubeMap = new THREE.CubeTextureLoader().load( urls ); +const cubeTexturePass = new CubeTexturePass( camera, cubemap ); +composer.addPass( cubeTexturePass ); +``` + +## Import + +CubeTexturePass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CubeTexturePass } from 'three/addons/postprocessing/CubeTexturePass.js'; +``` + +## Constructor + +### new CubeTexturePass( camera : PerspectiveCamera, tCube : CubeTexture, opacity : number ) + +Constructs a new cube texture pass. + +**camera** + +The camera. + +**tCube** + +The cube texture to render. + +**opacity** + +The opacity. + +Default is `1`. + +## Properties + +### .camera : PerspectiveCamera + +The camera. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +### .opacity : number + +The opacity. + +Default is `1`. + +### .tCube : CubeTexture + +The cube texture to render. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the cube texture pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/CubeTexturePass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/CubeTexturePass.js) \ No newline at end of file diff --git a/docs/pages/CubicBezierCurve.html.md b/docs/pages/CubicBezierCurve.html.md new file mode 100644 index 00000000000000..2ba81bf2111817 --- /dev/null +++ b/docs/pages/CubicBezierCurve.html.md @@ -0,0 +1,89 @@ +*Inheritance: Curve →* + +# CubicBezierCurve + +A curve representing a 2D Cubic Bezier curve. + +## Code Example + +```js +const curve = new THREE.CubicBezierCurve( + new THREE.Vector2( - 0, 0 ), + new THREE.Vector2( - 5, 15 ), + new THREE.Vector2( 20, 15 ), + new THREE.Vector2( 10, 0 ) +); +const points = curve.getPoints( 50 ); +const geometry = new THREE.BufferGeometry().setFromPoints( points ); +const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); +// Create the final object to add to the scene +const curveObject = new THREE.Line( geometry, material ); +``` + +## Constructor + +### new CubicBezierCurve( v0 : Vector2, v1 : Vector2, v2 : Vector2, v3 : Vector2 ) + +Constructs a new Cubic Bezier curve. + +**v0** + +The start point. + +**v1** + +The first control point. + +**v2** + +The second control point. + +**v3** + +The end point. + +## Properties + +### .isCubicBezierCurve : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .v0 : Vector2 + +The start point. + +### .v1 : Vector2 + +The first control point. + +### .v2 : Vector2 + +The second control point. + +### .v3 : Vector2 + +The end point. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector2 ) : Vector2 + +Returns a point on the curve. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[src/extras/curves/CubicBezierCurve.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CubicBezierCurve.js) \ No newline at end of file diff --git a/docs/pages/CubicBezierCurve3.html.md b/docs/pages/CubicBezierCurve3.html.md new file mode 100644 index 00000000000000..e78f3a42144bc2 --- /dev/null +++ b/docs/pages/CubicBezierCurve3.html.md @@ -0,0 +1,73 @@ +*Inheritance: Curve →* + +# CubicBezierCurve3 + +A curve representing a 3D Cubic Bezier curve. + +## Constructor + +### new CubicBezierCurve3( v0 : Vector3, v1 : Vector3, v2 : Vector3, v3 : Vector3 ) + +Constructs a new Cubic Bezier curve. + +**v0** + +The start point. + +**v1** + +The first control point. + +**v2** + +The second control point. + +**v3** + +The end point. + +## Properties + +### .isCubicBezierCurve3 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .v0 : Vector3 + +The start point. + +### .v1 : Vector3 + +The first control point. + +### .v2 : Vector3 + +The second control point. + +### .v3 : Vector3 + +The end point. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +Returns a point on the curve. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[src/extras/curves/CubicBezierCurve3.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/CubicBezierCurve3.js) \ No newline at end of file diff --git a/docs/pages/CubicInterpolant.html.md b/docs/pages/CubicInterpolant.html.md new file mode 100644 index 00000000000000..b5c394a2c457c4 --- /dev/null +++ b/docs/pages/CubicInterpolant.html.md @@ -0,0 +1,33 @@ +*Inheritance: Interpolant →* + +# CubicInterpolant + +Fast and simple cubic spline interpolant. + +It was derived from a Hermitian construction setting the first derivative at each sample position to the linear slope between neighboring positions over their parameter interval. + +## Constructor + +### new CubicInterpolant( parameterPositions : TypedArray, sampleValues : TypedArray, sampleSize : number, resultBuffer : TypedArray ) + +Constructs a new cubic interpolant. + +**parameterPositions** + +The parameter positions hold the interpolation factors. + +**sampleValues** + +The sample values. + +**sampleSize** + +The sample size + +**resultBuffer** + +The result buffer. + +## Source + +[src/math/interpolants/CubicInterpolant.js](https://github.com/mrdoob/three.js/blob/master/src/math/interpolants/CubicInterpolant.js) \ No newline at end of file diff --git a/docs/pages/Curve.html.md b/docs/pages/Curve.html.md new file mode 100644 index 00000000000000..834cb0a6e934fb --- /dev/null +++ b/docs/pages/Curve.html.md @@ -0,0 +1,207 @@ +# Curve + +An abstract base class for creating an analytic curve object that contains methods for interpolation. + +## Constructor + +### new Curve() (abstract) + +Constructs a new curve. + +## Properties + +### .arcLengthDivisions : number + +This value determines the amount of divisions when calculating the cumulative segment lengths of a curve via [Curve#getLengths](Curve.html#getLengths). To ensure precision when using methods like [Curve#getSpacedPoints](Curve.html#getSpacedPoints), it is recommended to increase the value of this property if the curve is very large. + +Default is `200`. + +### .needsUpdate : boolean + +Must be set to `true` if the curve parameters have changed. + +Default is `false`. + +### .type : string (readonly) + +The type property is used for detecting the object type in context of serialization/deserialization. + +## Methods + +### .clone() : Curve + +Returns a new curve with copied values from this instance. + +**Returns:** A clone of this instance. + +### .computeFrenetFrames( segments : number, closed : boolean ) : Object + +Generates the Frenet Frames. Requires a curve definition in 3D space. Used in geometries like [TubeGeometry](TubeGeometry.html) or [ExtrudeGeometry](ExtrudeGeometry.html). + +**segments** + +The number of segments. + +**closed** + +Whether the curve is closed or not. + +Default is `false`. + +**Returns:** The Frenet Frames. + +### .copy( source : Curve ) : Curve + +Copies the values of the given curve to this instance. + +**source** + +The curve to copy. + +**Returns:** A reference to this curve. + +### .fromJSON( json : Object ) : Curve + +Deserializes the curve from the given JSON. + +**json** + +The JSON holding the serialized curve. + +**Returns:** A reference to this curve. + +### .getLength() : number + +Returns the total arc length of the curve. + +**Returns:** The length of the curve. + +### .getLengths( divisions : number ) : Array. + +Returns an array of cumulative segment lengths of the curve. + +**divisions** + +The number of divisions. + +Default is `this.arcLengthDivisions`. + +**Returns:** An array holding the cumulative segment lengths. + +### .getPoint( t : number, optionalTarget : Vector2 | Vector3 ) : Vector2 | Vector3 (abstract) + +This method returns a vector in 2D or 3D space (depending on the curve definition) for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Returns:** The position on the curve. It can be a 2D or 3D vector depending on the curve definition. + +### .getPointAt( u : number, optionalTarget : Vector2 | Vector3 ) : Vector2 | Vector3 + +This method returns a vector in 2D or 3D space (depending on the curve definition) for the given interpolation factor. Unlike [Curve#getPoint](Curve.html#getPoint), this method honors the length of the curve which equidistant samples. + +**u** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Returns:** The position on the curve. It can be a 2D or 3D vector depending on the curve definition. + +### .getPoints( divisions : number ) : Array.<(Vector2|Vector3)> + +This method samples the curve via [Curve#getPoint](Curve.html#getPoint) and returns an array of points representing the curve shape. + +**divisions** + +The number of divisions. + +Default is `5`. + +**Returns:** An array holding the sampled curve values. The number of points is `divisions + 1`. + +### .getSpacedPoints( divisions : number ) : Array.<(Vector2|Vector3)> + +This method samples the curve via [Curve#getPointAt](Curve.html#getPointAt) and returns an array of points representing the curve shape. Unlike [Curve#getPoints](Curve.html#getPoints), this method returns equi-spaced points across the entire curve. + +**divisions** + +The number of divisions. + +Default is `5`. + +**Returns:** An array holding the sampled curve values. The number of points is `divisions + 1`. + +### .getTangent( t : number, optionalTarget : Vector2 | Vector3 ) : Vector2 | Vector3 + +Returns a unit vector tangent for the given interpolation factor. If the derived curve does not implement its tangent derivation, two points a small delta apart will be used to find its gradient which seems to give a reasonable approximation. + +**t** + +The interpolation factor. + +**optionalTarget** + +The optional target vector the result is written to. + +**Returns:** The tangent vector. + +### .getTangentAt( u : number, optionalTarget : Vector2 | Vector3 ) : Vector2 | Vector3 + +Same as [Curve#getTangent](Curve.html#getTangent) but with equidistant samples. + +**u** + +The interpolation factor. + +**optionalTarget** + +The optional target vector the result is written to. + +See: + +* [Curve#getPointAt](Curve.html#getPointAt) + +**Returns:** The tangent vector. + +### .getUtoTmapping( u : number, distance : number ) : number + +Given an interpolation factor in the range `[0,1]`, this method returns an updated interpolation factor in the same range that can be ued to sample equidistant points from a curve. + +**u** + +The interpolation factor. + +**distance** + +An optional distance on the curve. + +Default is `null`. + +**Returns:** The updated interpolation factor. + +### .toJSON() : Object + +Serializes the curve into JSON. + +See: + +* [ObjectLoader#parse](ObjectLoader.html#parse) + +**Returns:** A JSON object representing the serialized curve. + +### .updateArcLengths() + +Update the cumulative segment distance cache. The method must be called every time curve parameters are changed. If an updated curve is part of a composed curve like [CurvePath](CurvePath.html), this method must be called on the composed curve, too. + +## Source + +[src/extras/core/Curve.js](https://github.com/mrdoob/three.js/blob/master/src/extras/core/Curve.js) \ No newline at end of file diff --git a/docs/pages/CurvePath.html.md b/docs/pages/CurvePath.html.md new file mode 100644 index 00000000000000..e81ee8164d46dc --- /dev/null +++ b/docs/pages/CurvePath.html.md @@ -0,0 +1,65 @@ +*Inheritance: Curve →* + +# CurvePath + +A base class extending [Curve](Curve.html). `CurvePath` is simply an array of connected curves, but retains the API of a curve. + +## Constructor + +### new CurvePath() + +Constructs a new curve path. + +## Properties + +### .autoClose : boolean + +Whether the path should automatically be closed by a line curve. + +Default is `false`. + +### .curves : Array. + +An array of curves defining the path. + +## Methods + +### .add( curve : Curve ) + +Adds a curve to this curve path. + +**curve** + +The curve to add. + +### .closePath() : CurvePath + +Adds a line curve to close the path. + +**Returns:** A reference to this curve path. + +### .getCurveLengths() : Array. + +Returns list of cumulative curve lengths of the defined curves. + +**Returns:** The curve lengths. + +### .getPoint( t : number, optionalTarget : Vector2 | Vector3 ) : Vector2 | Vector3 + +This method returns a vector in 2D or 3D space (depending on the curve definitions) for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. It can be a 2D or 3D vector depending on the curve definition. + +## Source + +[src/extras/core/CurvePath.js](https://github.com/mrdoob/three.js/blob/master/src/extras/core/CurvePath.js) \ No newline at end of file diff --git a/docs/pages/CylinderGeometry.html.md b/docs/pages/CylinderGeometry.html.md new file mode 100644 index 00000000000000..b328d75ed5cf3c --- /dev/null +++ b/docs/pages/CylinderGeometry.html.md @@ -0,0 +1,90 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# CylinderGeometry + +A geometry class for representing a cylinder. + +## Code Example + +```js +const geometry = new THREE.CylinderGeometry( 5, 5, 20, 32 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const cylinder = new THREE.Mesh( geometry, material ); +scene.add( cylinder ); +``` + +## Constructor + +### new CylinderGeometry( radiusTop : number, radiusBottom : number, height : number, radialSegments : number, heightSegments : number, openEnded : boolean, thetaStart : number, thetaLength : number ) + +Constructs a new cylinder geometry. + +**radiusTop** + +Radius of the cylinder at the top. + +Default is `1`. + +**radiusBottom** + +Radius of the cylinder at the bottom. + +Default is `1`. + +**height** + +Height of the cylinder. + +Default is `1`. + +**radialSegments** + +Number of segmented faces around the circumference of the cylinder. + +Default is `32`. + +**heightSegments** + +Number of rows of faces along the height of the cylinder. + +Default is `1`. + +**openEnded** + +Whether the base of the cylinder is open or capped. + +Default is `false`. + +**thetaStart** + +Start angle for first segment, in radians. + +Default is `0`. + +**thetaLength** + +The central angle, often called theta, of the circular sector, in radians. The default value results in a complete cylinder. + +Default is `Math.PI*2`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : CylinderGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/CylinderGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/CylinderGeometry.js) \ No newline at end of file diff --git a/docs/pages/Cylindrical.html.md b/docs/pages/Cylindrical.html.md new file mode 100644 index 00000000000000..62884737442414 --- /dev/null +++ b/docs/pages/Cylindrical.html.md @@ -0,0 +1,115 @@ +# Cylindrical + +This class can be used to represent points in 3D space as [Cylindrical coordinates](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system). + +## Constructor + +### new Cylindrical( radius : number, theta : number, y : number ) + +Constructs a new cylindrical. + +**radius** + +The distance from the origin to a point in the x-z plane. + +Default is `1`. + +**theta** + +A counterclockwise angle in the x-z plane measured in radians from the positive z-axis. + +Default is `0`. + +**y** + +The height above the x-z plane. + +Default is `0`. + +## Properties + +### .radius : number + +The distance from the origin to a point in the x-z plane. + +Default is `1`. + +### .theta : number + +A counterclockwise angle in the x-z plane measured in radians from the positive z-axis. + +Default is `0`. + +### .y : number + +The height above the x-z plane. + +Default is `0`. + +## Methods + +### .clone() : Cylindrical + +Returns a new cylindrical with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( other : Cylindrical ) : Cylindrical + +Copies the values of the given cylindrical to this instance. + +**other** + +The cylindrical to copy. + +**Returns:** A reference to this cylindrical. + +### .set( radius : number, theta : number, y : number ) : Cylindrical + +Sets the cylindrical components by copying the given values. + +**radius** + +The radius. + +**theta** + +The theta angle. + +**y** + +The height value. + +**Returns:** A reference to this cylindrical. + +### .setFromCartesianCoords( x : number, y : number, z : number ) : Cylindrical + +Sets the cylindrical components from the given Cartesian coordinates. + +**x** + +The x value. + +**y** + +The x value. + +**z** + +The x value. + +**Returns:** A reference to this cylindrical. + +### .setFromVector3( v : Vector3 ) : Cylindrical + +Sets the cylindrical components from the given vector which is assumed to hold Cartesian coordinates. + +**v** + +The vector to set. + +**Returns:** A reference to this cylindrical. + +## Source + +[src/math/Cylindrical.js](https://github.com/mrdoob/three.js/blob/master/src/math/Cylindrical.js) \ No newline at end of file diff --git a/docs/pages/DDSLoader.html.md b/docs/pages/DDSLoader.html.md new file mode 100644 index 00000000000000..013f0f01152b4c --- /dev/null +++ b/docs/pages/DDSLoader.html.md @@ -0,0 +1,53 @@ +*Inheritance: Loader → CompressedTextureLoader →* + +# DDSLoader + +A loader for the S3TC texture compression format. + +## Code Example + +```js +const loader = new DDSLoader(); +const map = loader.load( 'textures/compressed/disturb_dxt1_nomip.dds' ); +map.colorSpace = THREE.SRGBColorSpace; // only for color textures +``` + +## Import + +DDSLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DDSLoader } from 'three/addons/loaders/DDSLoader.js'; +``` + +## Constructor + +### new DDSLoader( manager : LoadingManager ) + +Constructs a new DDS loader. + +**manager** + +The loading manager. + +## Methods + +### .parse( buffer : ArrayBuffer, loadMipmaps : boolean ) : CompressedTextureLoader~TexData + +Parses the given S3TC texture data. + +**buffer** + +The raw texture data. + +**loadMipmaps** + +Whether to load mipmaps or not. + +**Overrides:** [CompressedTextureLoader#parse](CompressedTextureLoader.html#parse) + +**Returns:** An object representing the parsed texture data. + +## Source + +[examples/jsm/loaders/DDSLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/DDSLoader.js) \ No newline at end of file diff --git a/docs/pages/DRACOExporter.html.md b/docs/pages/DRACOExporter.html.md new file mode 100644 index 00000000000000..8c03e8ff560014 --- /dev/null +++ b/docs/pages/DRACOExporter.html.md @@ -0,0 +1,115 @@ +# DRACOExporter + +An exporter to compress geometry with the Draco library. + +[Draco](https://google.github.io/draco/) is an open source library for compressing and decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller, at the cost of additional decoding time on the client device. + +Standalone Draco files have a `.drc` extension, and contain vertex positions, normals, colors, and other attributes. Draco files _do not_ contain materials, textures, animation, or node hierarchies – to use these features, embed Draco geometry inside of a glTF file. A normal glTF file can be converted to a Draco-compressed glTF file using [glTF-Pipeline](https://github.com/AnalyticalGraphicsInc/gltf-pipeline). + +## Code Example + +```js +const exporter = new DRACOExporter(); +const data = exporter.parse( mesh, options ); +``` + +## Import + +DRACOExporter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js'; +``` + +## Constructor + +### new DRACOExporter() + +## Properties + +### .MESH_EDGEBREAKER_ENCODING : number (constant) + +Edgebreaker encoding. + +Default is `1`. + +### .MESH_SEQUENTIAL_ENCODING : number (constant) + +Sequential encoding. + +Default is `0`. + +## Methods + +### .parse( object : Mesh | Points, options : DRACOExporter~Options ) : Int8Array + +Parses the given mesh or point cloud and generates the Draco output. + +**object** + +The mesh or point cloud to export. + +**options** + +The export options. + +**Returns:** The exported Draco. + +## Type Definitions + +### .Options + +Export options of `DRACOExporter`. + +**decodeSpeed** +number + +Indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality). + +Default is `5`. + +**encodeSpeed** +number + +Indicates how to tune the encoder parameters (0 gives better speed but worst quality). + +Default is `5`. + +**encoderMethod** +number + +Either sequential (very little compression) or Edgebreaker. Edgebreaker traverses the triangles of the mesh in a deterministic, spiral-like way which provides most of the benefits of this data format. + +Default is `1`. + +**quantization** +Array. + +Indicates the precision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX\_COORD, GENERIC). + +Default is `[ 16, 8, 8, 8, 8 ]`. + +**exportUvs** +boolean + +Whether to export UVs or not. + +Default is `true`. + +**exportNormals** +boolean + +Whether to export normals or not. + +Default is `true`. + +**exportColor** +boolean + +Whether to export colors or not. + +Default is `false`. + +## Source + +[examples/jsm/exporters/DRACOExporter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/DRACOExporter.js) \ No newline at end of file diff --git a/docs/pages/DRACOLoader.html.md b/docs/pages/DRACOLoader.html.md new file mode 100644 index 00000000000000..ee9fc49b6f23b8 --- /dev/null +++ b/docs/pages/DRACOLoader.html.md @@ -0,0 +1,117 @@ +*Inheritance: Loader →* + +# DRACOLoader + +A loader for the Draco format. + +[Draco](https://google.github.io/draco/) is an open source library for compressing and decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller, at the cost of additional decoding time on the client device. + +Standalone Draco files have a `.drc` extension, and contain vertex positions, normals, colors, and other attributes. Draco files do not contain materials, textures, animation, or node hierarchies – to use these features, embed Draco geometry inside of a glTF file. A normal glTF file can be converted to a Draco-compressed glTF file using [glTF-Pipeline](https://github.com/CesiumGS/gltf-pipeline). When using Draco with glTF, an instance of `DRACOLoader` will be used internally by [GLTFLoader](GLTFLoader.html). + +It is recommended to create one DRACOLoader instance and reuse it to avoid loading and creating multiple decoder instances. + +`DRACOLoader` will automatically use either the JS or the WASM decoding library, based on browser capabilities. + +## Code Example + +```js +const loader = new DRACOLoader(); +loader.setDecoderPath( '/examples/jsm/libs/draco/' ); +const geometry = await dracoLoader.loadAsync( 'models/draco/bunny.drc' ); +geometry.computeVertexNormals(); // optional +dracoLoader.dispose(); +``` + +## Import + +DRACOLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; +``` + +## Constructor + +### new DRACOLoader( manager : LoadingManager ) + +Constructs a new Draco loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded Draco asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( buffer : ArrayBuffer, onLoad : function, onError : onErrorCallback ) + +Parses the given Draco data. + +**buffer** + +The raw Draco data as an array buffer. + +**onLoad** + +Executed when the loading/parsing process has been finished. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#parse](Loader.html#parse) + +### .setDecoderConfig( config : Object ) : DRACOLoader + +Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins. + +**config** + +The decoder config. + +**Returns:** A reference to this loader. + +### .setDecoderPath( path : string ) : DRACOLoader + +Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins. + +**path** + +The decoder path. + +**Returns:** A reference to this loader. + +### .setWorkerLimit( workerLimit : number ) : DRACOLoader + +Sets the maximum number of Web Workers to be used during decoding. A lower limit may be preferable if workers are also for other tasks in the application. + +**workerLimit** + +The worker limit. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/DRACOLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/DRACOLoader.js) \ No newline at end of file diff --git a/docs/pages/Data3DTexture.html.md b/docs/pages/Data3DTexture.html.md new file mode 100644 index 00000000000000..227564401b853f --- /dev/null +++ b/docs/pages/Data3DTexture.html.md @@ -0,0 +1,109 @@ +*Inheritance: EventDispatcher → Texture →* + +# Data3DTexture + +Creates a three-dimensional texture from raw data, with parameters to divide it into width, height, and depth. + +## Constructor + +### new Data3DTexture( data : TypedArray, width : number, height : number, depth : number ) + +Constructs a new data array texture. + +**data** + +The buffer data. + +Default is `null`. + +**width** + +The width of the texture. + +Default is `1`. + +**height** + +The height of the texture. + +Default is `1`. + +**depth** + +The depth of the texture. + +Default is `1`. + +## Properties + +### .flipY : boolean + +If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#flipY](Texture.html#flipY) + +### .generateMipmaps : boolean + +Whether to generate mipmaps (if possible) for a texture. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#generateMipmaps](Texture.html#generateMipmaps) + +### .image : Object + +The image definition of a data texture. + +**Overrides:** [Texture#image](Texture.html#image) + +### .isData3DTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .magFilter : NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | LinearFilter | LinearMipmapNearestFilter | LinearMipmapLinearFilter + +How the texture is sampled when a texel covers more than one pixel. + +Overwritten and set to `NearestFilter` by default. + +Default is `NearestFilter`. + +**Overrides:** [Texture#magFilter](Texture.html#magFilter) + +### .minFilter : NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | LinearFilter | LinearMipmapNearestFilter | LinearMipmapLinearFilter + +How the texture is sampled when a texel covers less than one pixel. + +Overwritten and set to `NearestFilter` by default. + +Default is `NearestFilter`. + +**Overrides:** [Texture#minFilter](Texture.html#minFilter) + +### .unpackAlignment : boolean + +Specifies the alignment requirements for the start of each pixel row in memory. + +Overwritten and set to `1` by default. + +Default is `1`. + +**Overrides:** [Texture#unpackAlignment](Texture.html#unpackAlignment) + +### .wrapR : RepeatWrapping | ClampToEdgeWrapping | MirroredRepeatWrapping + +This defines how the texture is wrapped in the depth and corresponds to _W_ in UVW mapping. + +Default is `ClampToEdgeWrapping`. + +## Source + +[src/textures/Data3DTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/Data3DTexture.js) \ No newline at end of file diff --git a/docs/pages/DataArrayTexture.html.md b/docs/pages/DataArrayTexture.html.md new file mode 100644 index 00000000000000..b294fc99356e2e --- /dev/null +++ b/docs/pages/DataArrayTexture.html.md @@ -0,0 +1,127 @@ +*Inheritance: EventDispatcher → Texture →* + +# DataArrayTexture + +Creates an array of textures directly from raw buffer data. + +## Constructor + +### new DataArrayTexture( data : TypedArray, width : number, height : number, depth : number ) + +Constructs a new data array texture. + +**data** + +The buffer data. + +Default is `null`. + +**width** + +The width of the texture. + +Default is `1`. + +**height** + +The height of the texture. + +Default is `1`. + +**depth** + +The depth of the texture. + +Default is `1`. + +## Properties + +### .flipY : boolean + +If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#flipY](Texture.html#flipY) + +### .generateMipmaps : boolean + +Whether to generate mipmaps (if possible) for a texture. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#generateMipmaps](Texture.html#generateMipmaps) + +### .image : Object + +The image definition of a data texture. + +**Overrides:** [Texture#image](Texture.html#image) + +### .isDataArrayTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .layerUpdates : Set. + +A set of all layers which need to be updated in the texture. + +### .magFilter : NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | LinearFilter | LinearMipmapNearestFilter | LinearMipmapLinearFilter + +How the texture is sampled when a texel covers more than one pixel. + +Overwritten and set to `NearestFilter` by default. + +Default is `NearestFilter`. + +**Overrides:** [Texture#magFilter](Texture.html#magFilter) + +### .minFilter : NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | LinearFilter | LinearMipmapNearestFilter | LinearMipmapLinearFilter + +How the texture is sampled when a texel covers less than one pixel. + +Overwritten and set to `NearestFilter` by default. + +Default is `NearestFilter`. + +**Overrides:** [Texture#minFilter](Texture.html#minFilter) + +### .unpackAlignment : boolean + +Specifies the alignment requirements for the start of each pixel row in memory. + +Overwritten and set to `1` by default. + +Default is `1`. + +**Overrides:** [Texture#unpackAlignment](Texture.html#unpackAlignment) + +### .wrapR : RepeatWrapping | ClampToEdgeWrapping | MirroredRepeatWrapping + +This defines how the texture is wrapped in the depth and corresponds to _W_ in UVW mapping. + +Default is `ClampToEdgeWrapping`. + +## Methods + +### .addLayerUpdate( layerIndex : number ) + +Describes that a specific layer of the texture needs to be updated. Normally when [Texture#needsUpdate](Texture.html#needsUpdate) is set to `true`, the entire data texture array is sent to the GPU. Marking specific layers will only transmit subsets of all mipmaps associated with a specific depth in the array which is often much more performant. + +**layerIndex** + +The layer index that should be updated. + +### .clearLayerUpdates() + +Resets the layer updates registry. + +## Source + +[src/textures/DataArrayTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/DataArrayTexture.js) \ No newline at end of file diff --git a/docs/pages/DataTexture.html.md b/docs/pages/DataTexture.html.md new file mode 100644 index 00000000000000..7002705cf05012 --- /dev/null +++ b/docs/pages/DataTexture.html.md @@ -0,0 +1,133 @@ +*Inheritance: EventDispatcher → Texture →* + +# DataTexture + +Creates a texture directly from raw buffer data. + +The interpretation of the data depends on type and format: If the type is `UnsignedByteType`, a `Uint8Array` will be useful for addressing the texel data. If the format is `RGBAFormat`, data needs four values for one texel; Red, Green, Blue and Alpha (typically the opacity). + +## Constructor + +### new DataTexture( data : TypedArray, width : number, height : number, format : number, type : number, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, anisotropy : number, colorSpace : string ) + +Constructs a new data texture. + +**data** + +The buffer data. + +Default is `null`. + +**width** + +The width of the texture. + +Default is `1`. + +**height** + +The height of the texture. + +Default is `1`. + +**format** + +The texture format. + +Default is `RGBAFormat`. + +**type** + +The texture type. + +Default is `UnsignedByteType`. + +**mapping** + +The texture mapping. + +Default is `Texture.DEFAULT_MAPPING`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `NearestFilter`. + +**minFilter** + +The min filter value. + +Default is `NearestFilter`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +**colorSpace** + +The color space. + +Default is `NoColorSpace`. + +## Properties + +### .flipY : boolean + +If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#flipY](Texture.html#flipY) + +### .generateMipmaps : boolean + +Whether to generate mipmaps (if possible) for a texture. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#generateMipmaps](Texture.html#generateMipmaps) + +### .image : Object + +The image definition of a data texture. + +**Overrides:** [Texture#image](Texture.html#image) + +### .isDataTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .unpackAlignment : boolean + +Specifies the alignment requirements for the start of each pixel row in memory. + +Overwritten and set to `1` by default. + +Default is `1`. + +**Overrides:** [Texture#unpackAlignment](Texture.html#unpackAlignment) + +## Source + +[src/textures/DataTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/DataTexture.js) \ No newline at end of file diff --git a/docs/pages/DataTextureLoader.html.md b/docs/pages/DataTextureLoader.html.md new file mode 100644 index 00000000000000..eff5fffc2ce9dc --- /dev/null +++ b/docs/pages/DataTextureLoader.html.md @@ -0,0 +1,134 @@ +*Inheritance: Loader →* + +# DataTextureLoader + +Abstract base class for loading binary texture formats RGBE, EXR or TGA. Textures are internally loaded via [FileLoader](FileLoader.html). + +Derived classes have to implement the `parse()` method which holds the parsing for the respective format. + +## Constructor + +### new DataTextureLoader( manager : LoadingManager ) (abstract) + +Constructs a new data texture loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : DataTexture + +Starts loading from the given URL and passes the loaded data texture to the `onLoad()` callback. The method also returns a new texture object which can directly be used for material creation. If you do it this way, the texture may pop up in your scene once the respective loading process is finished. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The data texture. + +## Type Definitions + +### .TexData + +Represents the result object type of the `parse()` method. + +**image** +Object + +An object holding width, height and the texture data. + +**width** +number + +The width of the base mip. + +**height** +number + +The width of the base mip. + +**data** +TypedArray + +The texture data. + +**format** +number + +The texture format. + +**type** +number + +The texture type. + +**flipY** +boolean + +If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + +**wrapS** +number + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** +number + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**anisotropy** +number + +The anisotropy value. + +Default is `1`. + +**generateMipmaps** +boolean + +Whether to generate mipmaps or not. + +**colorSpace** +string + +The color space. + +**magFilter** +number + +The mag filter. + +**minFilter** +number + +The min filter. + +**mipmaps** +Array. + +The mipmaps. + +## Source + +[src/loaders/DataTextureLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/DataTextureLoader.js) \ No newline at end of file diff --git a/docs/pages/DataUtils.html.md b/docs/pages/DataUtils.html.md new file mode 100644 index 00000000000000..561a39916bf06b --- /dev/null +++ b/docs/pages/DataUtils.html.md @@ -0,0 +1,29 @@ +# DataUtils + +A class containing utility functions for data. + +## Static Methods + +### .fromHalfFloat( val : number ) : number + +Returns a single precision floating point value (FP32) from the given half precision floating point value (FP16). + +**val** + +A half precision floating point value. + +**Returns:** The FP32 value. + +### .toHalfFloat( val : number ) : number + +Returns a half precision floating point value (FP16) from the given single precision floating point value (FP32). + +**val** + +A single precision floating point value. + +**Returns:** The FP16 value. + +## Source + +[src/extras/DataUtils.js](https://github.com/mrdoob/three.js/blob/master/src/extras/DataUtils.js) \ No newline at end of file diff --git a/docs/pages/DebugEnvironment.html.md b/docs/pages/DebugEnvironment.html.md new file mode 100644 index 00000000000000..d2bbaf5220c286 --- /dev/null +++ b/docs/pages/DebugEnvironment.html.md @@ -0,0 +1,40 @@ +*Inheritance: EventDispatcher → Object3D → Scene →* + +# DebugEnvironment + +This class represents a scene with a very basic room setup that can be used as input for [PMREMGenerator#fromScene](PMREMGenerator.html#fromScene). The resulting PMREM represents the room's lighting and can be used for Image Based Lighting by assigning it to [Scene#environment](Scene.html#environment) or directly as an environment map to PBR materials. + +This class uses a simple room setup and should only be used for development purposes. A more appropriate setup for production is [RoomEnvironment](RoomEnvironment.html). + +## Code Example + +```js +const environment = new DebugEnvironment(); +const pmremGenerator = new THREE.PMREMGenerator( renderer ); +const envMap = pmremGenerator.fromScene( environment ).texture; +scene.environment = envMap; +``` + +## Import + +DebugEnvironment is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DebugEnvironment } from 'three/addons/environments/DebugEnvironment.js'; +``` + +## Constructor + +### new DebugEnvironment() + +Constructs a new debug environment. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the environment is no longer required. + +## Source + +[examples/jsm/environments/DebugEnvironment.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/environments/DebugEnvironment.js) \ No newline at end of file diff --git a/docs/pages/DecalGeometry.html.md b/docs/pages/DecalGeometry.html.md new file mode 100644 index 00000000000000..658f3049735efd --- /dev/null +++ b/docs/pages/DecalGeometry.html.md @@ -0,0 +1,52 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# DecalGeometry + +This class can be used to create a decal mesh that serves different kinds of purposes e.g. adding unique details to models, performing dynamic visual environmental changes or covering seams. + +Please not that decal projections can be distorted when used around corners. More information at this GitHub issue: [Decal projections without distortions](https://github.com/mrdoob/three.js/issues/21187). + +Reference: [How to project decals](http://blog.wolfire.com/2009/06/how-to-project-decals/) + +## Code Example + +```js +const geometry = new DecalGeometry( mesh, position, orientation, size ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +const mesh = new THREE.Mesh( geometry, material ); +scene.add( mesh ); +``` + +## Import + +DecalGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js'; +``` + +## Constructor + +### new DecalGeometry( mesh : Mesh, position : Vector3, orientation : Euler, size : Vector3 ) + +Constructs a new decal geometry. + +**mesh** + +The base mesh the decal should be projected on. + +**position** + +The position of the decal projector. + +**orientation** + +The orientation of the decal projector. + +**size** + +The scale of the decal projector. + +## Source + +[examples/jsm/geometries/DecalGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/DecalGeometry.js) \ No newline at end of file diff --git a/docs/pages/DecoratedTorusKnot4a.html.md b/docs/pages/DecoratedTorusKnot4a.html.md new file mode 100644 index 00000000000000..99bda830b4be5c --- /dev/null +++ b/docs/pages/DecoratedTorusKnot4a.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# DecoratedTorusKnot4a + +A Decorated Torus Knot 4a. + +## Import + +DecoratedTorusKnot4a is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DecoratedTorusKnot4a } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new DecoratedTorusKnot4a( scale : number ) + +Constructs a new Decorated Torus Knot 4a. + +**scale** + +The curve's scale. + +Default is `1`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `40`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/DecoratedTorusKnot4b.html.md b/docs/pages/DecoratedTorusKnot4b.html.md new file mode 100644 index 00000000000000..cd54a4d8181ccf --- /dev/null +++ b/docs/pages/DecoratedTorusKnot4b.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# DecoratedTorusKnot4b + +A Decorated Torus Knot 4b. + +## Import + +DecoratedTorusKnot4b is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DecoratedTorusKnot4b } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new DecoratedTorusKnot4b( scale : number ) + +Constructs a new Decorated Torus Knot 4b. + +**scale** + +The curve's scale. + +Default is `1`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `40`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/DecoratedTorusKnot5a.html.md b/docs/pages/DecoratedTorusKnot5a.html.md new file mode 100644 index 00000000000000..2f9c6d7ebacabd --- /dev/null +++ b/docs/pages/DecoratedTorusKnot5a.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# DecoratedTorusKnot5a + +A Decorated Torus Knot 5a. + +## Import + +DecoratedTorusKnot5a is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DecoratedTorusKnot5a } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new DecoratedTorusKnot5a( scale : number ) + +Constructs a new Decorated Torus Knot 5a. + +**scale** + +The curve's scale. + +Default is `1`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `40`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/DecoratedTorusKnot5c.html.md b/docs/pages/DecoratedTorusKnot5c.html.md new file mode 100644 index 00000000000000..5e80c45a371d50 --- /dev/null +++ b/docs/pages/DecoratedTorusKnot5c.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# DecoratedTorusKnot5c + +A Decorated Torus Knot 5c. + +## Import + +DecoratedTorusKnot5c is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DecoratedTorusKnot5c } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new DecoratedTorusKnot5c( scale : number ) + +Constructs a new Decorated Torus Knot 5c. + +**scale** + +The curve's scale. + +Default is `1`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `40`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/DenoiseNode.html.md b/docs/pages/DenoiseNode.html.md new file mode 100644 index 00000000000000..2b12c8a74994b4 --- /dev/null +++ b/docs/pages/DenoiseNode.html.md @@ -0,0 +1,109 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# DenoiseNode + +Post processing node for denoising data like raw screen-space ambient occlusion output. Denoise can noticeably improve the quality of ambient occlusion but also add quite some overhead to the post processing setup. It's best to make its usage optional (e.g. via graphic settings). + +Reference: [https://openaccess.thecvf.com/content/WACV2021/papers/Khademi\_Self-Supervised\_Poisson-Gaussian\_Denoising\_WACV\_2021\_paper.pdf](https://openaccess.thecvf.com/content/WACV2021/papers/Khademi_Self-Supervised_Poisson-Gaussian_Denoising_WACV_2021_paper.pdf). + +## Import + +DenoiseNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { denoise } from 'three/addons/tsl/display/DenoiseNode.js'; +``` + +## Constructor + +### new DenoiseNode( textureNode : TextureNode, depthNode : Node., normalNode : Node., camera : Camera ) + +Constructs a new denoise node. + +**textureNode** + +The texture node that represents the input of the effect (e.g. AO). + +**depthNode** + +A node that represents the scene's depth. + +**normalNode** + +A node that represents the scene's normals. + +**camera** + +The camera the scene is rendered with. + +## Properties + +### .depthNode : Node. + +A node that represents the scene's depth. + +### .depthPhi : UniformNode. + +The depth Phi value. + +### .index : UniformNode. + +The index. + +### .lumaPhi : UniformNode. + +The luma Phi value. + +### .noiseNode : TextureNode + +The node represents the internal noise texture. + +### .normalNode : Node. + +A node that represents the scene's normals. If no normals are passed to the constructor (because MRT is not available), normals can be automatically reconstructed from depth values in the shader. + +### .normalPhi : UniformNode. + +The normal Phi value. + +### .radius : UniformNode. + +The radius. + +### .textureNode : TextureNode + +The texture node that represents the input of the effect (e.g. AO). + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node updates its internal uniforms once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to update internal uniforms once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/DenoiseNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/DenoiseNode.js) \ No newline at end of file diff --git a/docs/pages/DepthOfFieldNode.html.md b/docs/pages/DepthOfFieldNode.html.md new file mode 100644 index 00000000000000..a463f6519c795d --- /dev/null +++ b/docs/pages/DepthOfFieldNode.html.md @@ -0,0 +1,124 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# DepthOfFieldNode + +Post processing node for creating depth of field (DOF) effect. + +References: + +* [https://pixelmischiefblog.wordpress.com/2016/11/25/bokeh-depth-of-field/](https://pixelmischiefblog.wordpress.com/2016/11/25/bokeh-depth-of-field/) +* [https://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/](https://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/) + +## Import + +DepthOfFieldNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js'; +``` + +## Constructor + +### new DepthOfFieldNode( textureNode : TextureNode, viewZNode : Node., focusDistanceNode : Node., focalLengthNode : Node., bokehScaleNode : Node. ) + +Constructs a new DOF node. + +**textureNode** + +The texture node that represents the input of the effect. + +**viewZNode** + +Represents the viewZ depth values of the scene. + +**focusDistanceNode** + +Defines the effect's focus which is the distance along the camera's look direction in world units. + +**focalLengthNode** + +How far an object can be from the focal plane before it goes completely out-of-focus in world units. + +**bokehScaleNode** + +A unitless value for artistic purposes to adjust the size of the bokeh. + +## Properties + +### .bokehScaleNode : Node. + +A unitless value for artistic purposes to adjust the size of the bokeh. + +### .focalLengthNode : Node. + +How far an object can be from the focal plane before it goes completely out-of-focus in world units. + +### .focusDistanceNode : Node. + +Defines the effect's focus which is the distance along the camera's look direction in world units. + +### .textureNode : TextureNode + +The texture node that represents the input of the effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node updates its internal uniforms once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +### .viewZNode : Node. + +Represents the viewZ depth values of the scene. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to update the effect's uniforms once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/DepthOfFieldNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/DepthOfFieldNode.js) \ No newline at end of file diff --git a/docs/pages/DepthTexture.html.md b/docs/pages/DepthTexture.html.md new file mode 100644 index 00000000000000..0dca0006257cd2 --- /dev/null +++ b/docs/pages/DepthTexture.html.md @@ -0,0 +1,111 @@ +*Inheritance: EventDispatcher → Texture →* + +# DepthTexture + +This class can be used to automatically save the depth information of a rendering into a texture. + +## Constructor + +### new DepthTexture( width : number, height : number, type : number, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, anisotropy : number, format : number, depth : number ) + +Constructs a new depth texture. + +**width** + +The width of the texture. + +**height** + +The height of the texture. + +**type** + +The texture type. + +Default is `UnsignedIntType`. + +**mapping** + +The texture mapping. + +Default is `Texture.DEFAULT_MAPPING`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `LinearFilter`. + +**minFilter** + +The min filter value. + +Default is `LinearFilter`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +**format** + +The texture format. + +Default is `DepthFormat`. + +**depth** + +The depth of the texture. + +Default is `1`. + +## Properties + +### .compareFunction : NeverCompare | LessCompare | EqualCompare | LessEqualCompare | GreaterCompare | NotEqualCompare | GreaterEqualCompare | AlwaysCompare + +Code corresponding to the depth compare function. + +Default is `null`. + +### .flipY : boolean + +If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#flipY](Texture.html#flipY) + +### .generateMipmaps : boolean + +Whether to generate mipmaps (if possible) for a texture. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#generateMipmaps](Texture.html#generateMipmaps) + +### .isDepthTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/textures/DepthTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/DepthTexture.js) \ No newline at end of file diff --git a/docs/pages/DirectionalLight.html.md b/docs/pages/DirectionalLight.html.md new file mode 100644 index 00000000000000..98bc6e0c13b08c --- /dev/null +++ b/docs/pages/DirectionalLight.html.md @@ -0,0 +1,61 @@ +*Inheritance: EventDispatcher → Object3D → Light →* + +# DirectionalLight + +A light that gets emitted in a specific direction. This light will behave as though it is infinitely far away and the rays produced from it are all parallel. The common use case for this is to simulate daylight; the sun is far enough away that its position can be considered to be infinite, and all light rays coming from it are parallel. + +A common point of confusion for directional lights is that setting the rotation has no effect. This is because three.js's DirectionalLight is the equivalent to what is often called a 'Target Direct Light' in other applications. + +This means that its direction is calculated as pointing from the light's [Object3D#position](Object3D.html#position) to the [DirectionalLight#target](DirectionalLight.html#target) position (as opposed to a 'Free Direct Light' that just has a rotation component). + +This light can cast shadows - see the [DirectionalLightShadow](DirectionalLightShadow.html) for details. + +## Code Example + +```js +// White directional light at half intensity shining from the top. +const directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); +scene.add( directionalLight ); +``` + +## Constructor + +### new DirectionalLight( color : number | Color | string, intensity : number ) + +Constructs a new directional light. + +**color** + +The light's color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity. + +Default is `1`. + +## Properties + +### .isDirectionalLight : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .shadow : DirectionalLightShadow + +This property holds the light's shadow configuration. + +### .target : Object3D + +The directional light points from its position to the target's position. + +For the target's position to be changed to anything other than the default, it must be added to the scene. + +It is also possible to set the target to be another 3D object in the scene. The light will now track the target object. + +## Source + +[src/lights/DirectionalLight.js](https://github.com/mrdoob/three.js/blob/master/src/lights/DirectionalLight.js) \ No newline at end of file diff --git a/docs/pages/DirectionalLightHelper.html.md b/docs/pages/DirectionalLightHelper.html.md new file mode 100644 index 00000000000000..4bfae85b54a831 --- /dev/null +++ b/docs/pages/DirectionalLightHelper.html.md @@ -0,0 +1,66 @@ +*Inheritance: EventDispatcher → Object3D →* + +# DirectionalLightHelper + +Helper object to assist with visualizing a [DirectionalLight](DirectionalLight.html)'s effect on the scene. This consists of plane and a line representing the light's position and direction. + +## Code Example + +```js +const light = new THREE.DirectionalLight( 0xFFFFFF ); +scene.add( light ); +const helper = new THREE.DirectionalLightHelper( light, 5 ); +scene.add( helper ); +``` + +## Constructor + +### new DirectionalLightHelper( light : DirectionalLight, size : number, color : number | Color | string ) + +Constructs a new directional light helper. + +**light** + +The light to be visualized. + +**size** + +The dimensions of the plane. + +Default is `1`. + +**color** + +The helper's color. If not set, the helper will take the color of the light. + +## Properties + +### .color : number | Color | string + +The color parameter passed in the constructor. If not set, the helper will take the color of the light. + +### .light : DirectionalLight + +The light being visualized. + +### .lightPlane : Line + +Contains the line showing the location of the directional light. + +### .targetLine : Line + +Represents the target line of the directional light. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the helper to match the position and direction of the light being visualized. + +## Source + +[src/helpers/DirectionalLightHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/DirectionalLightHelper.js) \ No newline at end of file diff --git a/docs/pages/DirectionalLightNode.html.md b/docs/pages/DirectionalLightNode.html.md new file mode 100644 index 00000000000000..820d8fcd272cbe --- /dev/null +++ b/docs/pages/DirectionalLightNode.html.md @@ -0,0 +1,21 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode →* + +# DirectionalLightNode + +Module for representing directional lights as nodes. + +## Constructor + +### new DirectionalLightNode( light : DirectionalLight ) + +Constructs a new directional light node. + +**light** + +The directional light source. + +Default is `null`. + +## Source + +[src/nodes/lighting/DirectionalLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/DirectionalLightNode.js) \ No newline at end of file diff --git a/docs/pages/DirectionalLightShadow.html.md b/docs/pages/DirectionalLightShadow.html.md new file mode 100644 index 00000000000000..0bea08788e7c39 --- /dev/null +++ b/docs/pages/DirectionalLightShadow.html.md @@ -0,0 +1,23 @@ +*Inheritance: LightShadow →* + +# DirectionalLightShadow + +Represents the shadow configuration of directional lights. + +## Constructor + +### new DirectionalLightShadow() + +Constructs a new directional light shadow. + +## Properties + +### .isDirectionalLightShadow : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/lights/DirectionalLightShadow.js](https://github.com/mrdoob/three.js/blob/master/src/lights/DirectionalLightShadow.js) \ No newline at end of file diff --git a/docs/pages/DiscreteInterpolant.html.md b/docs/pages/DiscreteInterpolant.html.md new file mode 100644 index 00000000000000..e1a93fdf5c528a --- /dev/null +++ b/docs/pages/DiscreteInterpolant.html.md @@ -0,0 +1,31 @@ +*Inheritance: Interpolant →* + +# DiscreteInterpolant + +Interpolant that evaluates to the sample value at the position preceding the parameter. + +## Constructor + +### new DiscreteInterpolant( parameterPositions : TypedArray, sampleValues : TypedArray, sampleSize : number, resultBuffer : TypedArray ) + +Constructs a new discrete interpolant. + +**parameterPositions** + +The parameter positions hold the interpolation factors. + +**sampleValues** + +The sample values. + +**sampleSize** + +The sample size + +**resultBuffer** + +The result buffer. + +## Source + +[src/math/interpolants/DiscreteInterpolant.js](https://github.com/mrdoob/three.js/blob/master/src/math/interpolants/DiscreteInterpolant.js) \ No newline at end of file diff --git a/docs/pages/DodecahedronGeometry.html.md b/docs/pages/DodecahedronGeometry.html.md new file mode 100644 index 00000000000000..8538648a7fbc37 --- /dev/null +++ b/docs/pages/DodecahedronGeometry.html.md @@ -0,0 +1,56 @@ +*Inheritance: EventDispatcher → BufferGeometry → PolyhedronGeometry →* + +# DodecahedronGeometry + +A geometry class for representing a dodecahedron. + +## Code Example + +```js +const geometry = new THREE.DodecahedronGeometry(); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const dodecahedron = new THREE.Mesh( geometry, material ); +scene.add( dodecahedron ); +``` + +## Constructor + +### new DodecahedronGeometry( radius : number, detail : number ) + +Constructs a new dodecahedron geometry. + +**radius** + +Radius of the dodecahedron. + +Default is `1`. + +**detail** + +Setting this to a value greater than `0` adds vertices making it no longer a dodecahedron. + +Default is `0`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +**Overrides:** [PolyhedronGeometry#parameters](PolyhedronGeometry.html#parameters) + +## Static Methods + +### .fromJSON( data : Object ) : DodecahedronGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/DodecahedronGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/DodecahedronGeometry.js) \ No newline at end of file diff --git a/docs/pages/DotScreenNode.html.md b/docs/pages/DotScreenNode.html.md new file mode 100644 index 00000000000000..583e2cfa3542ce --- /dev/null +++ b/docs/pages/DotScreenNode.html.md @@ -0,0 +1,65 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# DotScreenNode + +Post processing node for creating dot-screen effect. + +## Import + +DotScreenNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { dotScreen } from 'three/addons/tsl/display/DotScreenNode.js'; +``` + +## Constructor + +### new DotScreenNode( inputNode : Node, angle : number, scale : number ) + +Constructs a new dot screen node. + +**inputNode** + +The node that represents the input of the effect. + +**angle** + +The rotation of the effect in radians. + +Default is `1.57`. + +**scale** + +The scale of the effect. A higher value means smaller dots. + +Default is `1`. + +## Properties + +### .angle : UniformNode. + +A uniform node that represents the rotation of the effect in radians. + +### .inputNode : Node + +The node that represents the input of the effect. + +### .scale : UniformNode. + +A uniform node that represents the scale of the effect. A higher value means smaller dots. + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +## Source + +[examples/jsm/tsl/display/DotScreenNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/DotScreenNode.js) \ No newline at end of file diff --git a/docs/pages/DotScreenPass.html.md b/docs/pages/DotScreenPass.html.md new file mode 100644 index 00000000000000..cb4cada546f273 --- /dev/null +++ b/docs/pages/DotScreenPass.html.md @@ -0,0 +1,92 @@ +*Inheritance: Pass →* + +# DotScreenPass + +Pass for creating a dot-screen effect. + +## Code Example + +```js +const pass = new DotScreenPass( new THREE.Vector2( 0, 0 ), 0.5, 0.8 ); +composer.addPass( pass ); +``` + +## Import + +DotScreenPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DotScreenPass } from 'three/addons/postprocessing/DotScreenPass.js'; +``` + +## Constructor + +### new DotScreenPass( center : Vector2, angle : number, scale : number ) + +Constructs a new dot screen pass. + +**center** + +The center point. + +**angle** + +The rotation of the effect in radians. + +**scale** + +The scale of the effect. A higher value means smaller dots. + +## Properties + +### .material : ShaderMaterial + +The pass material. + +### .uniforms : Object + +The pass uniforms. Use this object if you want to update the `center`, `angle` or `scale` values at runtime. + +```js +pass.uniforms.center.value.copy( center ); +pass.uniforms.angle.value = 0; +pass.uniforms.scale.value = 0.5; +``` + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the dot screen pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/DotScreenPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/DotScreenPass.js) \ No newline at end of file diff --git a/docs/pages/DragControls.html.md b/docs/pages/DragControls.html.md new file mode 100644 index 00000000000000..2d47c112aa37d9 --- /dev/null +++ b/docs/pages/DragControls.html.md @@ -0,0 +1,112 @@ +*Inheritance: EventDispatcher → Controls →* + +# DragControls + +This class can be used to provide a drag'n'drop interaction. + +## Code Example + +```js +const controls = new DragControls( objects, camera, renderer.domElement ); +// add event listener to highlight dragged objects +controls.addEventListener( 'dragstart', function ( event ) { + event.object.material.emissive.set( 0xaaaaaa ); +} ); +controls.addEventListener( 'dragend', function ( event ) { + event.object.material.emissive.set( 0x000000 ); +} ); +``` + +## Import + +DragControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DragControls } from 'three/addons/controls/DragControls.js'; +``` + +## Constructor + +### new DragControls( objects : Array., camera : Camera, domElement : HTMLElement ) + +Constructs a new controls instance. + +**objects** + +An array of draggable 3D objects. + +**camera** + +The camera of the rendered scene. + +**domElement** + +The HTML DOM element used for event listeners. + +Default is `null`. + +## Properties + +### .objects : Array. + +An array of draggable 3D objects. + +### .raycaster : Raycaster + +The raycaster used for detecting 3D objects. + +### .recursive : boolean + +Whether children of draggable objects can be dragged independently from their parent. + +Default is `true`. + +### .rotateSpeed : number + +The speed at which the object will rotate when dragged in `rotate` mode. The higher the number the faster the rotation. + +Default is `1`. + +### .transformGroup : boolean + +This option only works if the `objects` array contains a single draggable group object. If set to `true`, the controls does not transform individual objects but the entire group. + +Default is `false`. + +## Events + +### .drag + +Fires when the user drags a 3D object. + +##### Type: + +* Object + +### .dragend + +Fires when the user has finished dragging a 3D object. + +##### Type: + +* Object + +### .hoveroff + +Fires when the pointer is moved out of a 3D object. + +##### Type: + +* Object + +### .hoveron + +Fires when the pointer is moved onto a 3D object, or onto one of its children. + +##### Type: + +* Object + +## Source + +[examples/jsm/controls/DragControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/DragControls.js) \ No newline at end of file diff --git a/docs/pages/EXRExporter.html.md b/docs/pages/EXRExporter.html.md new file mode 100644 index 00000000000000..1023d55fc93ecd --- /dev/null +++ b/docs/pages/EXRExporter.html.md @@ -0,0 +1,71 @@ +# EXRExporter + +An exporter for EXR. + +EXR ( Extended Dynamic Range) is an [open format specification](https://github.com/AcademySoftwareFoundation/openexr) for professional-grade image storage format of the motion picture industry. The purpose of format is to accurately and efficiently represent high-dynamic-range scene-linear image data and associated metadata. The library is widely used in host application software where accuracy is critical, such as photorealistic rendering, texture access, image compositing, deep compositing, and DI. + +## Code Example + +```js +const exporter = new EXRExporter(); +const result = await exporter.parse( renderer, options ); +``` + +## Import + +EXRExporter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { EXRExporter } from 'three/addons/exporters/EXRExporter.js'; +``` + +## Constructor + +### new EXRExporter() + +## Methods + +### .parse( arg1 : DataTexture | WebGPURenderer | WebGLRenderer, arg2 : EXRExporter~Options | RenderTarget, arg3 : EXRExporter~Options ) : Promise. (async) + +This method has two variants. + +* When exporting a data texture, it receives two parameters. The texture and the exporter options. +* When exporting a render target (e.g. a PMREM), it receives three parameters. The renderer, the render target and the exporter options. + +**arg1** + +The data texture to export or a renderer. + +**arg2** + +The exporter options or a render target. + +**arg3** + +The exporter options. + +**Returns:** A Promise that resolves with the exported EXR. + +## Type Definitions + +### .Options + +Export options of `EXRExporter`. + +**type** +[HalfFloatType](global.html#HalfFloatType) | [FloatType](global.html#FloatType) + +Output data type. + +Default is `HalfFloatType`. + +**type** +NO\_COMPRESSION | ZIP\_COMPRESSION | ZIPS\_COMPRESSION + +The compression algorithm. + +Default is `ZIP_COMPRESSION`. + +## Source + +[examples/jsm/exporters/EXRExporter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/EXRExporter.js) \ No newline at end of file diff --git a/docs/pages/EXRLoader.html.md b/docs/pages/EXRLoader.html.md new file mode 100644 index 00000000000000..7cc7f36ff30c01 --- /dev/null +++ b/docs/pages/EXRLoader.html.md @@ -0,0 +1,84 @@ +*Inheritance: Loader → DataTextureLoader →* + +# EXRLoader + +A loader for the OpenEXR texture format. + +`EXRLoader` currently supports uncompressed, ZIP(S), RLE, PIZ and DWA/B compression. Supports reading as UnsignedByte, HalfFloat and Float type data texture. + +## Code Example + +```js +const loader = new EXRLoader(); +const texture = await loader.loadAsync( 'textures/memorial.exr' ); +``` + +## Import + +EXRLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { EXRLoader } from 'three/addons/loaders/EXRLoader.js'; +``` + +## Constructor + +### new EXRLoader( manager : LoadingManager ) + +Constructs a new EXR loader. + +**manager** + +The loading manager. + +## Properties + +### .outputFormat : RGBAFormat | RGFormat | RedFormat + +Texture output format. + +Default is `RGBAFormat`. + +### .type : HalfFloatType | FloatType + +The texture type. + +Default is `HalfFloatType`. + +## Methods + +### .parse( buffer : ArrayBuffer ) : DataTextureLoader~TexData + +Parses the given EXR texture data. + +**buffer** + +The raw texture data. + +**Overrides:** [DataTextureLoader#parse](DataTextureLoader.html#parse) + +**Returns:** An object representing the parsed texture data. + +### .setDataType( value : HalfFloatType | FloatType ) : EXRLoader + +Sets the texture type. + +**value** + +The texture type to set. + +**Returns:** A reference to this loader. + +### .setOutputFormat( value : RGBAFormat | RGFormat | RedFormat ) : EXRLoader + +Sets texture output format. Defaults to `RGBAFormat`. + +**value** + +Texture output format. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/EXRLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/EXRLoader.js) \ No newline at end of file diff --git a/docs/pages/Earcut.html.md b/docs/pages/Earcut.html.md new file mode 100644 index 00000000000000..e159a7c7b4acb6 --- /dev/null +++ b/docs/pages/Earcut.html.md @@ -0,0 +1,37 @@ +# Earcut + +An implementation of the earcut polygon triangulation algorithm. The code is a port of [mapbox/earcut](https://github.com/mapbox/earcut). + +## Constructor + +### new Earcut() + +See: + +* [https://github.com/mapbox/earcut](https://github.com/mapbox/earcut) + +## Static Methods + +### .triangulate( data : Array., holeIndices : Array., dim : number ) : Array. + +Triangulates the given shape definition by returning an array of triangles. + +**data** + +An array with 2D points. + +**holeIndices** + +An array with indices defining holes. + +**dim** + +The number of coordinates per vertex in the input array. + +Default is `2`. + +**Returns:** An array representing the triangulated faces. Each face is defined by three consecutive numbers representing vertex indices. + +## Source + +[src/extras/Earcut.js](https://github.com/mrdoob/three.js/blob/master/src/extras/Earcut.js) \ No newline at end of file diff --git a/docs/pages/EdgeSplitModifier.html.md b/docs/pages/EdgeSplitModifier.html.md new file mode 100644 index 00000000000000..19c9625ea94654 --- /dev/null +++ b/docs/pages/EdgeSplitModifier.html.md @@ -0,0 +1,48 @@ +# EdgeSplitModifier + +The modifier can be used to split faces at sharp edges. This allows to compute normals without smoothing the edges which can lead to an improved visual result. + +## Code Example + +```js +const modifier = new EdgeSplitModifier(); +geometry = modifier.modify( geometry, Math.PI * 0.4 ); +``` + +## Import + +EdgeSplitModifier is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { EdgeSplitModifier } from 'three/addons/modifiers/EdgeSplitModifier.js'; +``` + +## Constructor + +### new EdgeSplitModifier() + +## Methods + +### .modify( geometry : BufferGeometry, cutOffAngle : number, tryKeepNormals : boolean ) : BufferGeometry + +Returns a new, modified version of the given geometry by applying an edge-split operation. Please note that the resulting geometry is always indexed. + +**geometry** + +The geometry to modify. + +**cutOffAngle** + +The cut off angle in radians. + +**tryKeepNormals** + +Whether to try to keep normals or not. + +Default is `true`. + +**Returns:** A new, modified geometry. + +## Source + +[examples/jsm/modifiers/EdgeSplitModifier.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/modifiers/EdgeSplitModifier.js) \ No newline at end of file diff --git a/docs/pages/EdgesGeometry.html.md b/docs/pages/EdgesGeometry.html.md new file mode 100644 index 00000000000000..2693e2cd73e410 --- /dev/null +++ b/docs/pages/EdgesGeometry.html.md @@ -0,0 +1,44 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# EdgesGeometry + +Can be used as a helper object to view the edges of a geometry. + +Note: It is not yet possible to serialize/deserialize instances of this class. + +## Code Example + +```js +const geometry = new THREE.BoxGeometry(); +const edges = new THREE.EdgesGeometry( geometry ); +const line = new THREE.LineSegments( edges ); +scene.add( line ); +``` + +## Constructor + +### new EdgesGeometry( geometry : BufferGeometry, thresholdAngle : number ) + +Constructs a new edges geometry. + +**geometry** + +The geometry. + +Default is `null`. + +**thresholdAngle** + +An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. + +Default is `1`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Source + +[src/geometries/EdgesGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/EdgesGeometry.js) \ No newline at end of file diff --git a/docs/pages/EffectComposer.html.md b/docs/pages/EffectComposer.html.md new file mode 100644 index 00000000000000..a7add40144949f --- /dev/null +++ b/docs/pages/EffectComposer.html.md @@ -0,0 +1,155 @@ +# EffectComposer + +Used to implement post-processing effects in three.js. The class manages a chain of post-processing passes to produce the final visual result. Post-processing passes are executed in order of their addition/insertion. The last pass is automatically rendered to screen. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). + +## Code Example + +```js +const composer = new EffectComposer( renderer ); +// adding some passes +const renderPass = new RenderPass( scene, camera ); +composer.addPass( renderPass ); +const glitchPass = new GlitchPass(); +composer.addPass( glitchPass ); +const outputPass = new OutputPass() +composer.addPass( outputPass ); +function animate() { + composer.render(); // instead of renderer.render() +} +``` + +## Import + +EffectComposer is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +``` + +## Constructor + +### new EffectComposer( renderer : WebGLRenderer, renderTarget : WebGLRenderTarget ) + +Constructs a new effect composer. + +**renderer** + +The renderer. + +**renderTarget** + +This render target and a clone will be used as the internal read and write buffers. If not given, the composer creates the buffers automatically. + +## Properties + +### .passes : Array. + +An array representing the (ordered) chain of post-processing passes. + +### .readBuffer : WebGLRenderTarget + +A reference to the internal read buffer. Passes usually read the previous render result from this buffer. + +### .renderToScreen : boolean + +Whether the final pass is rendered to the screen (default framebuffer) or not. + +Default is `true`. + +### .renderer : WebGLRenderer + +The renderer. + +### .writeBuffer : WebGLRenderTarget + +A reference to the internal write buffer. Passes usually write their result into this buffer. + +## Methods + +### .addPass( pass : Pass ) + +Adds the given pass to the pass chain. + +**pass** + +The pass to add. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the composer is no longer used in your app. + +### .insertPass( pass : Pass, index : number ) + +Inserts the given pass at a given index. + +**pass** + +The pass to insert. + +**index** + +The index into the pass chain. + +### .isLastEnabledPass( passIndex : number ) : boolean + +Returns `true` if the pass for the given index is the last enabled pass in the pass chain. + +**passIndex** + +The pass index. + +**Returns:** Whether the pass for the given index is the last pass in the pass chain. + +### .removePass( pass : Pass ) + +Removes the given pass from the pass chain. + +**pass** + +The pass to remove. + +### .render( deltaTime : number ) + +Executes all enabled post-processing passes in order to produce the final frame. + +**deltaTime** + +The delta time in seconds. If not given, the composer computes its own time delta value. + +### .reset( renderTarget : WebGLRenderTarget ) + +Resets the internal state of the EffectComposer. + +**renderTarget** + +This render target has the same purpose like the one from the constructor. If set, it is used to setup the read and write buffers. + +### .setPixelRatio( pixelRatio : number ) + +Sets device pixel ratio. This is usually used for HiDPI device to prevent blurring output. Setting the pixel ratio will automatically resize the composer. + +**pixelRatio** + +The pixel ratio to set. + +### .setSize( width : number, height : number ) + +Resizes the internal read and write buffers as well as all passes. Similar to [WebGLRenderer#setSize](WebGLRenderer.html#setSize), this method honors the current pixel ration. + +**width** + +The width in logical pixels. + +**height** + +The height in logical pixels. + +### .swapBuffers() + +Swaps the internal read/write buffers. + +## Source + +[examples/jsm/postprocessing/EffectComposer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/EffectComposer.js) \ No newline at end of file diff --git a/docs/pages/EllipseCurve.html.md b/docs/pages/EllipseCurve.html.md new file mode 100644 index 00000000000000..fa2f2697b47e4f --- /dev/null +++ b/docs/pages/EllipseCurve.html.md @@ -0,0 +1,154 @@ +*Inheritance: Curve →* + +# EllipseCurve + +A curve representing an ellipse. + +## Code Example + +```js +const curve = new THREE.EllipseCurve( + 0, 0, + 10, 10, + 0, 2 * Math.PI, + false, + 0 +); +const points = curve.getPoints( 50 ); +const geometry = new THREE.BufferGeometry().setFromPoints( points ); +const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); +// Create the final object to add to the scene +const ellipse = new THREE.Line( geometry, material ); +``` + +## Constructor + +### new EllipseCurve( aX : number, aY : number, xRadius : number, yRadius : number, aStartAngle : number, aEndAngle : number, aClockwise : boolean, aRotation : number ) + +Constructs a new ellipse curve. + +**aX** + +The X center of the ellipse. + +Default is `0`. + +**aY** + +The Y center of the ellipse. + +Default is `0`. + +**xRadius** + +The radius of the ellipse in the x direction. + +Default is `1`. + +**yRadius** + +The radius of the ellipse in the y direction. + +Default is `1`. + +**aStartAngle** + +The start angle of the curve in radians starting from the positive X axis. + +Default is `0`. + +**aEndAngle** + +The end angle of the curve in radians starting from the positive X axis. + +Default is `Math.PI*2`. + +**aClockwise** + +Whether the ellipse is drawn clockwise or not. + +Default is `false`. + +**aRotation** + +The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. + +Default is `0`. + +## Properties + +### .aClockwise : boolean + +Whether the ellipse is drawn clockwise or not. + +Default is `false`. + +### .aEndAngle : number + +The end angle of the curve in radians starting from the positive X axis. + +Default is `Math.PI*2`. + +### .aRotation : number + +The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. + +Default is `0`. + +### .aStartAngle : number + +The start angle of the curve in radians starting from the positive X axis. + +Default is `0`. + +### .aX : number + +The X center of the ellipse. + +Default is `0`. + +### .aY : number + +The Y center of the ellipse. + +Default is `0`. + +### .isEllipseCurve : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .xRadius : number + +The radius of the ellipse in the x direction. Setting the this value equal to the [EllipseCurve#yRadius](EllipseCurve.html#yRadius) will result in a circle. + +Default is `1`. + +### .yRadius : number + +The radius of the ellipse in the y direction. Setting the this value equal to the [EllipseCurve#xRadius](EllipseCurve.html#xRadius) will result in a circle. + +Default is `1`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector2 ) : Vector2 + +Returns a point on the curve. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[src/extras/curves/EllipseCurve.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/EllipseCurve.js) \ No newline at end of file diff --git a/docs/pages/EnvironmentNode.html.md b/docs/pages/EnvironmentNode.html.md new file mode 100644 index 00000000000000..99f0f087113250 --- /dev/null +++ b/docs/pages/EnvironmentNode.html.md @@ -0,0 +1,29 @@ +*Inheritance: EventDispatcher → Node → LightingNode →* + +# EnvironmentNode + +Represents a physical model for Image-based lighting (IBL). The environment is defined via environment maps in the equirectangular, cube map or cubeUV (PMREM) format. `EnvironmentNode` is intended for PBR materials like [MeshStandardNodeMaterial](MeshStandardNodeMaterial.html). + +## Constructor + +### new EnvironmentNode( envNode : Node ) + +Constructs a new environment node. + +**envNode** + +A node representing the environment. + +Default is `null`. + +## Properties + +### .envNode : Node + +A node representing the environment. + +Default is `null`. + +## Source + +[src/nodes/lighting/EnvironmentNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/EnvironmentNode.js) \ No newline at end of file diff --git a/docs/pages/Euler.html.md b/docs/pages/Euler.html.md new file mode 100644 index 00000000000000..18e48935bfd855 --- /dev/null +++ b/docs/pages/Euler.html.md @@ -0,0 +1,231 @@ +# Euler + +A class representing Euler angles. + +Euler angles describe a rotational transformation by rotating an object on its various axes in specified amounts per axis, and a specified axis order. + +Iterating through an instance will yield its components (x, y, z, order) in the corresponding order. + +## Code Example + +```js +const a = new THREE.Euler( 0, 1, 1.57, 'XYZ' ); +const b = new THREE.Vector3( 1, 0, 1 ); +b.applyEuler(a); +``` + +## Constructor + +### new Euler( x : number, y : number, z : number, order : string ) + +Constructs a new euler instance. + +**x** + +The angle of the x axis in radians. + +Default is `0`. + +**y** + +The angle of the y axis in radians. + +Default is `0`. + +**z** + +The angle of the z axis in radians. + +Default is `0`. + +**order** + +A string representing the order that the rotations are applied. + +Default is `Euler.DEFAULT_ORDER`. + +## Properties + +### .isEuler : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .order : string + +A string representing the order that the rotations are applied. + +Default is `'XYZ'`. + +### .x : number + +The angle of the x axis in radians. + +Default is `0`. + +### .y : number + +The angle of the y axis in radians. + +Default is `0`. + +### .z : number + +The angle of the z axis in radians. + +Default is `0`. + +### .DEFAULT_ORDER : string + +The default Euler angle order. + +Default is `'XYZ'`. + +## Methods + +### .clone() : Euler + +Returns a new Euler instance with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( euler : Euler ) : Euler + +Copies the values of the given Euler instance to this instance. + +**euler** + +The Euler instance to copy. + +**Returns:** A reference to this Euler instance. + +### .equals( euler : Euler ) : boolean + +Returns `true` if this Euler instance is equal with the given one. + +**euler** + +The Euler instance to test for equality. + +**Returns:** Whether this Euler instance is equal with the given one. + +### .fromArray( array : Array. ) : Euler + +Sets this Euler instance's components to values from the given array. The first three entries of the array are assign to the x,y and z components. An optional fourth entry defines the Euler order. + +**array** + +An array holding the Euler component values. + +**Returns:** A reference to this Euler instance. + +### .reorder( newOrder : string ) : Euler + +Resets the euler angle with a new order by creating a quaternion from this euler angle and then setting this euler angle with the quaternion and the new order. + +Warning: This discards revolution information. + +**newOrder** + +A string representing the new order that the rotations are applied. + +**Returns:** A reference to this Euler instance. + +### .set( x : number, y : number, z : number, order : string ) : Euler + +Sets the Euler components. + +**x** + +The angle of the x axis in radians. + +**y** + +The angle of the y axis in radians. + +**z** + +The angle of the z axis in radians. + +**order** + +A string representing the order that the rotations are applied. + +**Returns:** A reference to this Euler instance. + +### .setFromQuaternion( q : Quaternion, order : string, update : boolean ) : Euler + +Sets the angles of this Euler instance from a normalized quaternion. + +**q** + +A normalized Quaternion. + +**order** + +A string representing the order that the rotations are applied. + +**update** + +Whether the internal `onChange` callback should be executed or not. + +Default is `true`. + +**Returns:** A reference to this Euler instance. + +### .setFromRotationMatrix( m : Matrix4, order : string, update : boolean ) : Euler + +Sets the angles of this Euler instance from a pure rotation matrix. + +**m** + +A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled). + +**order** + +A string representing the order that the rotations are applied. + +**update** + +Whether the internal `onChange` callback should be executed or not. + +Default is `true`. + +**Returns:** A reference to this Euler instance. + +### .setFromVector3( v : Vector3, order : string ) : Euler + +Sets the angles of this Euler instance from the given vector. + +**v** + +The vector. + +**order** + +A string representing the order that the rotations are applied. + +**Returns:** A reference to this Euler instance. + +### .toArray( array : Array., offset : number ) : Array. + +Writes the components of this Euler instance to the given array. If no array is provided, the method returns a new instance. + +**array** + +The target array holding the Euler components. + +Default is `[]`. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** The Euler components. + +## Source + +[src/math/Euler.js](https://github.com/mrdoob/three.js/blob/master/src/math/Euler.js) \ No newline at end of file diff --git a/docs/pages/EventDispatcher.html.md b/docs/pages/EventDispatcher.html.md new file mode 100644 index 00000000000000..9633696a3fdc38 --- /dev/null +++ b/docs/pages/EventDispatcher.html.md @@ -0,0 +1,79 @@ +# EventDispatcher + +This modules allows to dispatch event objects on custom JavaScript objects. + +Main repository: [eventdispatcher.js](https://github.com/mrdoob/eventdispatcher.js/) + +Code Example: + +## Code Example + +```js +class Car extends EventDispatcher { + start() { + this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } ); + } +}; +// Using events with the custom object +const car = new Car(); +car.addEventListener( 'start', function ( event ) { + alert( event.message ); +} ); +car.start(); +``` + +## Constructor + +### new EventDispatcher() + +## Methods + +### .addEventListener( type : string, listener : function ) + +Adds the given event listener to the given event type. + +**type** + +The type of event to listen to. + +**listener** + +The function that gets called when the event is fired. + +### .dispatchEvent( event : Object ) + +Dispatches an event object. + +**event** + +The event that gets fired. + +### .hasEventListener( type : string, listener : function ) : boolean + +Returns `true` if the given event listener has been added to the given event type. + +**type** + +The type of event. + +**listener** + +The listener to check. + +**Returns:** Whether the given event listener has been added to the given event type. + +### .removeEventListener( type : string, listener : function ) + +Removes the given event listener from the given event type. + +**type** + +The type of event. + +**listener** + +The listener to remove. + +## Source + +[src/core/EventDispatcher.js](https://github.com/mrdoob/three.js/blob/master/src/core/EventDispatcher.js) \ No newline at end of file diff --git a/docs/pages/EventNode.html.md b/docs/pages/EventNode.html.md new file mode 100644 index 00000000000000..cbe893cbeb79c3 --- /dev/null +++ b/docs/pages/EventNode.html.md @@ -0,0 +1,23 @@ +*Inheritance: EventDispatcher → Node →* + +# EventNode + +EventNode is a node that executes a callback during specific update phases. + +## Constructor + +### new EventNode( eventType : string, callback : function ) + +Creates an EventNode. + +**eventType** + +The type of event + +**callback** + +The callback to execute on update. + +## Source + +[src/nodes/utils/EventNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/EventNode.js) \ No newline at end of file diff --git a/docs/pages/ExpressionNode.html.md b/docs/pages/ExpressionNode.html.md new file mode 100644 index 00000000000000..fd9f2a43eab823 --- /dev/null +++ b/docs/pages/ExpressionNode.html.md @@ -0,0 +1,35 @@ +*Inheritance: EventDispatcher → Node →* + +# ExpressionNode + +This class can be used to implement basic expressions in shader code. Basic examples for that are `return`, `continue` or `discard` statements. + +## Constructor + +### new ExpressionNode( snippet : string, nodeType : string ) + +Constructs a new expression node. + +**snippet** + +The native code snippet. + +Default is `''`. + +**nodeType** + +The node type. + +Default is `'void'`. + +## Properties + +### .snippet : string + +The native code snippet. + +Default is `''`. + +## Source + +[src/nodes/code/ExpressionNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/code/ExpressionNode.js) \ No newline at end of file diff --git a/docs/pages/ExternalTexture.html.md b/docs/pages/ExternalTexture.html.md new file mode 100644 index 00000000000000..f21c493278e5ac --- /dev/null +++ b/docs/pages/ExternalTexture.html.md @@ -0,0 +1,39 @@ +*Inheritance: EventDispatcher → Texture →* + +# ExternalTexture + +Represents a texture created externally with the same renderer context. + +This may be a texture from a protected media stream, device camera feed, or other data feeds like a depth sensor. + +Note that this class is only supported in [WebGLRenderer](WebGLRenderer.html), and in the [WebGPURenderer](WebGPURenderer.html) WebGPU backend. + +## Constructor + +### new ExternalTexture( sourceTexture : WebGLTexture | GPUTexture ) + +Creates a new raw texture. + +**sourceTexture** + +The external texture. + +Default is `null`. + +## Properties + +### .isExternalTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .sourceTexture : WebGLTexture | GPUTexture + +The external source texture. + +Default is `null`. + +## Source + +[src/textures/ExternalTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/ExternalTexture.js) \ No newline at end of file diff --git a/docs/pages/ExtrudeGeometry.html.md b/docs/pages/ExtrudeGeometry.html.md new file mode 100644 index 00000000000000..68e77b9df38653 --- /dev/null +++ b/docs/pages/ExtrudeGeometry.html.md @@ -0,0 +1,135 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# ExtrudeGeometry + +Creates extruded geometry from a path shape. + +## Code Example + +```js +const length = 12, width = 8; +const shape = new THREE.Shape(); +shape.moveTo( 0,0 ); +shape.lineTo( 0, width ); +shape.lineTo( length, width ); +shape.lineTo( length, 0 ); +shape.lineTo( 0, 0 ); +const geometry = new THREE.ExtrudeGeometry( shape ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +const mesh = new THREE.Mesh( geometry, material ) ; +scene.add( mesh ); +``` + +## Constructor + +### new ExtrudeGeometry( shapes : Shape | Array., options : ExtrudeGeometry~Options ) + +Constructs a new extrude geometry. + +**shapes** + +A shape or an array of shapes. + +**options** + +The extrude settings. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object, shapes : Array. ) : ExtrudeGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**shapes** + +An array of shapes. + +**Returns:** A new instance. + +## Type Definitions + +### .Options + +Represents the `options` type of the geometry's constructor. + +**curveSegments** +number + +Number of points on the curves. + +Default is `12`. + +**steps** +number + +Number of points used for subdividing segments along the depth of the extruded spline. + +Default is `1`. + +**depth** +number + +Depth to extrude the shape. + +Default is `1`. + +**bevelEnabled** +boolean + +Whether to beveling to the shape or not. + +Default is `true`. + +**bevelThickness** +number + +How deep into the original shape the bevel goes. + +Default is `0.2`. + +**bevelSize** +number + +Distance from the shape outline that the bevel extends. + +Default is `bevelThickness-0.1`. + +**bevelOffset** +number + +Distance from the shape outline that the bevel starts. + +Default is `0`. + +**bevelSegments** +number + +Number of bevel layers. + +Default is `3`. + +**extrudePath** +[Curve](Curve.html) + +A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion. + +Default is `null`. + +**UVGenerator** +Object + +An object that provides UV generator functions for custom UV generation. + +## Source + +[src/geometries/ExtrudeGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/ExtrudeGeometry.js) \ No newline at end of file diff --git a/docs/pages/FBXLoader.html.md b/docs/pages/FBXLoader.html.md new file mode 100644 index 00000000000000..754d0859b16cc6 --- /dev/null +++ b/docs/pages/FBXLoader.html.md @@ -0,0 +1,89 @@ +*Inheritance: Loader →* + +# FBXLoader + +A loader for the FBX format. + +Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format. Versions lower than this may load but will probably have errors. + +Needs Support: + +* Morph normals / blend shape normals + +FBX format references: + +* [C++ SDK reference](https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html) + +Binary format specification: + +* [FBX binary file format specification](https://code.blender.org/2013/08/fbx-binary-file-format-specification/) + +## Code Example + +```js +const loader = new FBXLoader(); +const object = await loader.loadAsync( 'models/fbx/stanford-bunny.fbx' ); +scene.add( object ); +``` + +## Import + +FBXLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; +``` + +## Constructor + +### new FBXLoader( manager : LoadingManager ) + +Constructs a new FBX loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded FBX asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( FBXBuffer : ArrayBuffer, path : string ) : Group + +Parses the given FBX data and returns the resulting group. + +**FBXBuffer** + +The raw FBX data as an array buffer. + +**path** + +The URL base path. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** An object representing the parsed asset. + +## Source + +[examples/jsm/loaders/FBXLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/FBXLoader.js) \ No newline at end of file diff --git a/docs/pages/FXAANode.html.md b/docs/pages/FXAANode.html.md new file mode 100644 index 00000000000000..fca67b44361c68 --- /dev/null +++ b/docs/pages/FXAANode.html.md @@ -0,0 +1,63 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# FXAANode + +Post processing node for applying FXAA. This node requires sRGB input so tone mapping and color space conversion must happen before the anti-aliasing. + +## Import + +FXAANode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; +``` + +## Constructor + +### new FXAANode( textureNode : TextureNode ) + +Constructs a new FXAA node. + +**textureNode** + +The texture node that represents the input of the effect. + +## Properties + +### .textureNode : TextureNode + +The texture node that represents the input of the effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node updates its internal uniforms once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to update the effect's uniforms once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/FXAANode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/FXAANode.js) \ No newline at end of file diff --git a/docs/pages/FXAAPass.html.md b/docs/pages/FXAAPass.html.md new file mode 100644 index 00000000000000..d20ec0f6392289 --- /dev/null +++ b/docs/pages/FXAAPass.html.md @@ -0,0 +1,46 @@ +*Inheritance: Pass → ShaderPass →* + +# FXAAPass + +A pass for applying FXAA. + +## Code Example + +```js +const fxaaPass = new FXAAPass(); +composer.addPass( fxaaPass ); +``` + +## Import + +FXAAPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FXAAPass } from 'three/addons/postprocessing/FXAAPass.js'; +``` + +## Constructor + +### new FXAAPass() + +Constructs a new FXAA pass. + +## Methods + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [ShaderPass#setSize](ShaderPass.html#setSize) + +## Source + +[examples/jsm/postprocessing/FXAAPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/FXAAPass.js) \ No newline at end of file diff --git a/docs/pages/FigureEightPolynomialKnot.html.md b/docs/pages/FigureEightPolynomialKnot.html.md new file mode 100644 index 00000000000000..5c9e389cfaceda --- /dev/null +++ b/docs/pages/FigureEightPolynomialKnot.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# FigureEightPolynomialKnot + +A Figure Eight Polynomial Knot. + +## Import + +FigureEightPolynomialKnot is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FigureEightPolynomialKnot } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new FigureEightPolynomialKnot( scale : number ) + +Constructs a new Figure Eight Polynomial Knot. + +**scale** + +The curve's scale. + +Default is `1`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `1`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/FileLoader.html.md b/docs/pages/FileLoader.html.md new file mode 100644 index 00000000000000..03d12177ba5f1a --- /dev/null +++ b/docs/pages/FileLoader.html.md @@ -0,0 +1,94 @@ +*Inheritance: Loader →* + +# FileLoader + +A low level class for loading resources with the Fetch API, used internally by most loaders. It can also be used directly to load any file type that does not have a loader. + +This loader supports caching. If you want to use it, add `THREE.Cache.enabled = true;` once to your application. + +## Code Example + +```js +const loader = new THREE.FileLoader(); +const data = await loader.loadAsync( 'example.txt' ); +``` + +## Constructor + +### new FileLoader( manager : LoadingManager ) + +Constructs a new file loader. + +**manager** + +The loading manager. + +## Properties + +### .mimeType : string + +The expected mime type. Valid values can be found [here](hhttps://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype) + +### .responseType : 'arraybuffer' | 'blob' | 'document' | 'json' | '' + +The expected response type. + +Default is `''`. + +## Methods + +### .abort() : FileLoader + +Aborts ongoing fetch requests. + +**Overrides:** [Loader#abort](Loader.html#abort) + +**Returns:** A reference to this instance. + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : any | undefined + +Starts loading from the given URL and pass the loaded response to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The cached resource if available. + +### .setMimeType( value : string ) : FileLoader + +Sets the expected mime type of the loaded file. + +**value** + +The mime type. + +**Returns:** A reference to this file loader. + +### .setResponseType( value : 'arraybuffer' | 'blob' | 'document' | 'json' | '' ) : FileLoader + +Sets the expected response type. + +**value** + +The response type. + +**Returns:** A reference to this file loader. + +## Source + +[src/loaders/FileLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/FileLoader.js) \ No newline at end of file diff --git a/docs/pages/FilmNode.html.md b/docs/pages/FilmNode.html.md new file mode 100644 index 00000000000000..ec1df1ac55f517 --- /dev/null +++ b/docs/pages/FilmNode.html.md @@ -0,0 +1,69 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# FilmNode + +Post processing node for creating a film grain effect. + +## Import + +FilmNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { film } from 'three/addons/tsl/display/FilmNode.js'; +``` + +## Constructor + +### new FilmNode( inputNode : Node, intensityNode : Node., uvNode : Node. ) + +Constructs a new film node. + +**inputNode** + +The node that represents the input of the effect. + +**intensityNode** + +A node that represents the effect's intensity. + +Default is `null`. + +**uvNode** + +A node that allows to pass custom (e.g. animated) uv data. + +Default is `null`. + +## Properties + +### .inputNode : Node + +The node that represents the input of the effect. + +### .intensityNode : Node. + +A node that represents the effect's intensity. + +Default is `null`. + +### .uvNode : Node. + +A node that allows to pass custom (e.g. animated) uv data. + +Default is `null`. + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +## Source + +[examples/jsm/tsl/display/FilmNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/FilmNode.js) \ No newline at end of file diff --git a/docs/pages/FilmPass.html.md b/docs/pages/FilmPass.html.md new file mode 100644 index 00000000000000..3d96a5e52d5990 --- /dev/null +++ b/docs/pages/FilmPass.html.md @@ -0,0 +1,91 @@ +*Inheritance: Pass →* + +# FilmPass + +This pass can be used to create a film grain effect. + +## Code Example + +```js +const filmPass = new FilmPass(); +composer.addPass( filmPass ); +``` + +## Import + +FilmPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FilmPass } from 'three/addons/postprocessing/FilmPass.js'; +``` + +## Constructor + +### new FilmPass( intensity : number, grayscale : boolean ) + +Constructs a new film pass. + +**intensity** + +The grain intensity in the range `[0,1]` (0 = no effect, 1 = full effect). + +Default is `0.5`. + +**grayscale** + +Whether to apply a grayscale effect or not. + +Default is `false`. + +## Properties + +### .material : ShaderMaterial + +The pass material. + +### .uniforms : Object + +The pass uniforms. Use this object if you want to update the `intensity` or `grayscale` values at runtime. + +```js +pass.uniforms.intensity.value = 1; +pass.uniforms.grayscale.value = true; +``` + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the film pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/FilmPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/FilmPass.js) \ No newline at end of file diff --git a/docs/pages/FirstPersonControls.html.md b/docs/pages/FirstPersonControls.html.md new file mode 100644 index 00000000000000..fe740cd21315f3 --- /dev/null +++ b/docs/pages/FirstPersonControls.html.md @@ -0,0 +1,137 @@ +*Inheritance: EventDispatcher → Controls →* + +# FirstPersonControls + +This class is an alternative implementation of [FlyControls](FlyControls.html). + +## Import + +FirstPersonControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +``` + +## Constructor + +### new FirstPersonControls( object : Object3D, domElement : HTMLElement ) + +Constructs a new controls instance. + +**object** + +The object that is managed by the controls. + +**domElement** + +The HTML element used for event listeners. + +Default is `null`. + +## Properties + +### .activeLook : boolean + +Whether it's possible to look around or not. + +Default is `true`. + +### .autoForward : boolean + +Whether the camera is automatically moved forward or not. + +Default is `false`. + +### .constrainVertical : boolean + +Whether or not looking around is vertically constrained by `verticalMin` and `verticalMax`. + +Default is `false`. + +### .heightCoef : number + +Determines how much faster the camera moves when it's y-component is near `heightMax`. + +Default is `1`. + +### .heightMax : number + +Upper camera height limit used for movement speed adjustment. + +Default is `1`. + +### .heightMin : number + +Lower camera height limit used for movement speed adjustment. + +Default is `0`. + +### .heightSpeed : boolean + +Whether or not the camera's height influences the forward movement speed. Use the properties `heightCoef`, `heightMin` and `heightMax` for configuration. + +Default is `false`. + +### .lookSpeed : number + +The look around speed. + +Default is `0.005`. + +### .lookVertical : boolean + +Whether it's possible to vertically look around or not. + +Default is `true`. + +### .mouseDragOn : boolean (readonly) + +Whether the mouse is pressed down or not. + +Default is `false`. + +### .movementSpeed : number + +The movement speed. + +Default is `1`. + +### .verticalMax : number + +How far you can vertically look around, upper limit. Range is `0` to `Math.PI` in radians. + +Default is `0`. + +### .verticalMin : number + +How far you can vertically look around, lower limit. Range is `0` to `Math.PI` in radians. + +Default is `0`. + +## Methods + +### .handleResize() + +Must be called if the application window is resized. + +### .lookAt( x : number | Vector3, y : number, z : number ) : FirstPersonControls + +Rotates the camera towards the defined target position. + +**x** + +The x coordinate of the target position or alternatively a vector representing the target position. + +**y** + +The y coordinate of the target position. + +**z** + +The z coordinate of the target position. + +**Returns:** A reference to this controls. + +## Source + +[examples/jsm/controls/FirstPersonControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/FirstPersonControls.js) \ No newline at end of file diff --git a/docs/pages/FlakesTexture.html.md b/docs/pages/FlakesTexture.html.md new file mode 100644 index 00000000000000..d362e687015e4a --- /dev/null +++ b/docs/pages/FlakesTexture.html.md @@ -0,0 +1,35 @@ +# FlakesTexture + +Utility class for generating a flakes texture image. This image might be used as a normal map to produce a car paint like effect. + +## Import + +FlakesTexture is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; +``` + +## Constructor + +### new FlakesTexture( width : number, height : number ) : HTMLCanvasElement + +Generates a new flakes texture image. The result is a canvas that can be used as an input for [CanvasTexture](CanvasTexture.html). + +**width** + +The width of the image. + +Default is `512`. + +**height** + +The height of the image. + +Default is `512`. + +**Returns:** The generated image. + +## Source + +[examples/jsm/textures/FlakesTexture.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/textures/FlakesTexture.js) \ No newline at end of file diff --git a/docs/pages/FlipNode.html.md b/docs/pages/FlipNode.html.md new file mode 100644 index 00000000000000..187022e3138449 --- /dev/null +++ b/docs/pages/FlipNode.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# FlipNode + +This module is part of the TSL core and usually not used in app level code. It represents a flip operation during the shader generation process meaning it flips normalized values with the following formula: + +`FlipNode` is internally used to implement any `flipXYZW()`, `flipRGBA()` and `flipSTPQ()` method invocations on node objects. For example: + +```js +uvNode = uvNode.flipY(); +``` + +## Code Example + +```js +x = 1 - x; +``` + +## Constructor + +### new FlipNode( sourceNode : Node, components : string ) + +Constructs a new flip node. + +**sourceNode** + +The node which component(s) should be flipped. + +**components** + +The components that should be flipped e.g. `'x'` or `'xy'`. + +## Properties + +### .components : string + +The components that should be flipped e.g. `'x'` or `'xy'`. + +### .sourceNode : Node + +The node which component(s) should be flipped. + +## Methods + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from the source node. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getNodeType](TempNode.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/utils/FlipNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/FlipNode.js) \ No newline at end of file diff --git a/docs/pages/Float16BufferAttribute.html.md b/docs/pages/Float16BufferAttribute.html.md new file mode 100644 index 00000000000000..6ab8174a25ae03 --- /dev/null +++ b/docs/pages/Float16BufferAttribute.html.md @@ -0,0 +1,31 @@ +*Inheritance: BufferAttribute →* + +# Float16BufferAttribute + +Convenient class that can be used when creating a `Float16` buffer attribute with a plain `Array` instance. + +This class automatically converts to and from FP16 via `Uint16Array` since `Float16Array` browser support is still problematic. + +## Constructor + +### new Float16BufferAttribute( array : Array. | Uint16Array, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Float32BufferAttribute.html.md b/docs/pages/Float32BufferAttribute.html.md new file mode 100644 index 00000000000000..f9b4dfcc94ab3e --- /dev/null +++ b/docs/pages/Float32BufferAttribute.html.md @@ -0,0 +1,29 @@ +*Inheritance: BufferAttribute →* + +# Float32BufferAttribute + +Convenient class that can be used when creating a `Float32` buffer attribute with a plain `Array` instance. + +## Constructor + +### new Float32BufferAttribute( array : Array. | Float32Array, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Flow.html.md b/docs/pages/Flow.html.md new file mode 100644 index 00000000000000..7d6ad25707dd23 --- /dev/null +++ b/docs/pages/Flow.html.md @@ -0,0 +1,59 @@ +# Flow + +A modifier for making meshes bend around curves. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import the class from `CurveModifierGPU.js`. + +## Import + +Flow is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Flow } from 'three/addons/modifiers/CurveModifier.js'; +``` + +## Constructor + +### new Flow( mesh : Mesh, numberOfCurves : number ) + +Constructs a new Flow instance. + +**mesh** + +The mesh to clone and modify to bend around the curve. + +**numberOfCurves** + +The amount of space that should preallocated for additional curves. + +Default is `1`. + +## Classes + +[Flow](Flow.html) + +## Methods + +### .moveAlongCurve( amount : number ) + +Moves the mesh along the curve. + +**amount** + +The offset. + +### .updateCurve( index : number, curve : Curve ) + +Updates the curve for the given curve index. + +**index** + +The curve index. + +**curve** + +The curve that should be used to bend the mesh. + +## Source + +[examples/jsm/modifiers/CurveModifier.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/modifiers/CurveModifier.js) \ No newline at end of file diff --git a/docs/pages/FlyControls.html.md b/docs/pages/FlyControls.html.md new file mode 100644 index 00000000000000..17f0e285da7517 --- /dev/null +++ b/docs/pages/FlyControls.html.md @@ -0,0 +1,69 @@ +*Inheritance: EventDispatcher → Controls →* + +# FlyControls + +This class enables a navigation similar to fly modes in DCC tools like Blender. You can arbitrarily transform the camera in 3D space without any limitations (e.g. focus on a specific target). + +## Import + +FlyControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FlyControls } from 'three/addons/controls/FlyControls.js'; +``` + +## Constructor + +### new FlyControls( object : Object3D, domElement : HTMLElement ) + +Constructs a new controls instance. + +**object** + +The object that is managed by the controls. + +**domElement** + +The HTML element used for event listeners. + +Default is `null`. + +## Properties + +### .autoForward : boolean + +If set to `true`, the camera automatically moves forward (and does not stop) when initially translated. + +Default is `false`. + +### .dragToLook : boolean + +If set to `true`, you can only look around by performing a drag interaction. + +Default is `false`. + +### .movementSpeed : number + +The movement speed. + +Default is `1`. + +### .rollSpeed : number + +The rotation speed. + +Default is `0.005`. + +## Events + +### .change + +Fires when the camera has been transformed by the controls. + +##### Type: + +* Object + +## Source + +[examples/jsm/controls/FlyControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/FlyControls.js) \ No newline at end of file diff --git a/docs/pages/Fog.html.md b/docs/pages/Fog.html.md new file mode 100644 index 00000000000000..b972aef8cade75 --- /dev/null +++ b/docs/pages/Fog.html.md @@ -0,0 +1,82 @@ +# Fog + +This class can be used to define a linear fog that grows linearly denser with the distance. + +## Code Example + +```js +const scene = new THREE.Scene(); +scene.fog = new THREE.Fog( 0xcccccc, 10, 15 ); +``` + +## Constructor + +### new Fog( color : number | Color, near : number, far : number ) + +Constructs a new fog. + +**color** + +The fog's color. + +**near** + +The minimum distance to start applying fog. + +Default is `1`. + +**far** + +The maximum distance at which fog stops being calculated and applied. + +Default is `1000`. + +## Properties + +### .color : Color + +The fog's color. + +### .far : number + +The maximum distance at which fog stops being calculated and applied. Objects that are more than `far` units away from the active camera won't be affected by fog. + +Default is `1000`. + +### .isFog : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the fog. + +### .near : number + +The minimum distance to start applying fog. Objects that are less than `near` units from the active camera won't be affected by fog. + +Default is `1`. + +## Methods + +### .clone() : Fog + +Returns a new fog with copied values from this instance. + +**Returns:** A clone of this instance. + +### .toJSON( meta : Object | string ) : Object + +Serializes the fog into JSON. + +**meta** + +An optional value holding meta information about the serialization. + +**Returns:** A JSON object representing the serialized fog + +## Source + +[src/scenes/Fog.js](https://github.com/mrdoob/three.js/blob/master/src/scenes/Fog.js) \ No newline at end of file diff --git a/docs/pages/FogExp2.html.md b/docs/pages/FogExp2.html.md new file mode 100644 index 00000000000000..a610b4325563eb --- /dev/null +++ b/docs/pages/FogExp2.html.md @@ -0,0 +1,70 @@ +# FogExp2 + +This class can be used to define an exponential squared fog, which gives a clear view near the camera and a faster than exponentially densening fog farther from the camera. + +## Code Example + +```js +const scene = new THREE.Scene(); +scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 ); +``` + +## Constructor + +### new FogExp2( color : number | Color, density : number ) + +Constructs a new fog. + +**color** + +The fog's color. + +**density** + +Defines how fast the fog will grow dense. + +Default is `0.00025`. + +## Properties + +### .color : Color + +The fog's color. + +### .density : number + +Defines how fast the fog will grow dense. + +Default is `0.00025`. + +### .isFogExp2 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the fog. + +## Methods + +### .clone() : FogExp2 + +Returns a new fog with copied values from this instance. + +**Returns:** A clone of this instance. + +### .toJSON( meta : Object | string ) : Object + +Serializes the fog into JSON. + +**meta** + +An optional value holding meta information about the serialization. + +**Returns:** A JSON object representing the serialized fog + +## Source + +[src/scenes/FogExp2.js](https://github.com/mrdoob/three.js/blob/master/src/scenes/FogExp2.js) \ No newline at end of file diff --git a/docs/pages/Font.html.md b/docs/pages/Font.html.md new file mode 100644 index 00000000000000..22b6e4ebb5b226 --- /dev/null +++ b/docs/pages/Font.html.md @@ -0,0 +1,53 @@ +# Font + +Class representing a font. + +## Constructor + +### new Font( data : Object ) + +Constructs a new font. + +**data** + +The font data as JSON. + +## Properties + +### .data : Object + +The font data as JSON. + +### .isFont : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .generateShapes( text : string, size : number, direction : string ) : Array. + +Generates geometry shapes from the given text and size. The result of this method should be used with [ShapeGeometry](ShapeGeometry.html) to generate the actual geometry data. + +**text** + +The text. + +**size** + +The text size. + +Default is `100`. + +**direction** + +Char direction: ltr(left to right), rtl(right to left) & tb(top bottom). + +Default is `'ltr'`. + +**Returns:** An array of shapes representing the text. + +## Source + +[examples/jsm/loaders/FontLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/FontLoader.js) \ No newline at end of file diff --git a/docs/pages/FontLoader.html.md b/docs/pages/FontLoader.html.md new file mode 100644 index 00000000000000..699299d20b6ab2 --- /dev/null +++ b/docs/pages/FontLoader.html.md @@ -0,0 +1,72 @@ +*Inheritance: Loader →* + +# FontLoader + +A loader for loading fonts. + +You can convert fonts online using [facetype.js](https://gero3.github.io/facetype.js/). + +## Code Example + +```js +const loader = new FontLoader(); +const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' ); +``` + +## Import + +FontLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +``` + +## Constructor + +### new FontLoader( manager : LoadingManager ) + +Constructs a new font loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded font to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( json : Object ) : Font + +Parses the given font data and returns the resulting font. + +**json** + +The raw font data as a JSON object. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The font. + +## Source + +[examples/jsm/loaders/FontLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/FontLoader.js) \ No newline at end of file diff --git a/docs/pages/FramebufferTexture.html.md b/docs/pages/FramebufferTexture.html.md new file mode 100644 index 00000000000000..fd4abf8228e180 --- /dev/null +++ b/docs/pages/FramebufferTexture.html.md @@ -0,0 +1,76 @@ +*Inheritance: EventDispatcher → Texture →* + +# FramebufferTexture + +This class can only be used in combination with `copyFramebufferToTexture()` methods of renderers. It extracts the contents of the current bound framebuffer and provides it as a texture for further usage. + +## Code Example + +```js +const pixelRatio = window.devicePixelRatio; +const textureSize = 128 * pixelRatio; +const frameTexture = new FramebufferTexture( textureSize, textureSize ); +// calculate start position for copying part of the frame data +const vector = new Vector2(); +vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 ); +vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 ); +renderer.render( scene, camera ); +// copy part of the rendered frame into the framebuffer texture +renderer.copyFramebufferToTexture( frameTexture, vector ); +``` + +## Constructor + +### new FramebufferTexture( width : number, height : number ) + +Constructs a new framebuffer texture. + +**width** + +The width of the texture. + +**height** + +The height of the texture. + +## Properties + +### .generateMipmaps : boolean + +Whether to generate mipmaps (if possible) for a texture. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#generateMipmaps](Texture.html#generateMipmaps) + +### .isFramebufferTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .magFilter : NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | LinearFilter | LinearMipmapNearestFilter | LinearMipmapLinearFilter + +How the texture is sampled when a texel covers more than one pixel. + +Overwritten and set to `NearestFilter` by default to disable filtering. + +Default is `NearestFilter`. + +**Overrides:** [Texture#magFilter](Texture.html#magFilter) + +### .minFilter : NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | LinearFilter | LinearMipmapNearestFilter | LinearMipmapLinearFilter + +How the texture is sampled when a texel covers less than one pixel. + +Overwritten and set to `NearestFilter` by default to disable filtering. + +Default is `NearestFilter`. + +**Overrides:** [Texture#minFilter](Texture.html#minFilter) + +## Source + +[src/textures/FramebufferTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/FramebufferTexture.js) \ No newline at end of file diff --git a/docs/pages/FrontFacingNode.html.md b/docs/pages/FrontFacingNode.html.md new file mode 100644 index 00000000000000..84f674aaa428bb --- /dev/null +++ b/docs/pages/FrontFacingNode.html.md @@ -0,0 +1,23 @@ +*Inheritance: EventDispatcher → Node →* + +# FrontFacingNode + +This node can be used to evaluate whether a primitive is front or back facing. + +## Constructor + +### new FrontFacingNode() + +Constructs a new front facing node. + +## Properties + +### .isFrontFacingNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/nodes/display/FrontFacingNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/FrontFacingNode.js) \ No newline at end of file diff --git a/docs/pages/Frustum.html.md b/docs/pages/Frustum.html.md new file mode 100644 index 00000000000000..ed655c56cc86cf --- /dev/null +++ b/docs/pages/Frustum.html.md @@ -0,0 +1,165 @@ +# Frustum + +Frustums are used to determine what is inside the camera's field of view. They help speed up the rendering process - objects which lie outside a camera's frustum can safely be excluded from rendering. + +This class is mainly intended for use internally by a renderer. + +## Constructor + +### new Frustum( p0 : Plane, p1 : Plane, p2 : Plane, p3 : Plane, p4 : Plane, p5 : Plane ) + +Constructs a new frustum. + +**p0** + +The first plane that encloses the frustum. + +**p1** + +The second plane that encloses the frustum. + +**p2** + +The third plane that encloses the frustum. + +**p3** + +The fourth plane that encloses the frustum. + +**p4** + +The fifth plane that encloses the frustum. + +**p5** + +The sixth plane that encloses the frustum. + +## Properties + +### .planes : Array. + +This array holds the planes that enclose the frustum. + +## Methods + +### .clone() : Frustum + +Returns a new frustum with copied values from this instance. + +**Returns:** A clone of this instance. + +### .containsPoint( point : Vector3 ) : boolean + +Returns `true` if the given point lies within the frustum. + +**point** + +The point to test. + +**Returns:** Whether the point lies within this frustum or not. + +### .copy( frustum : Frustum ) : Frustum + +Copies the values of the given frustum to this instance. + +**frustum** + +The frustum to copy. + +**Returns:** A reference to this frustum. + +### .intersectsBox( box : Box3 ) : boolean + +Returns `true` if the given bounding box is intersecting this frustum. + +**box** + +The bounding box to test. + +**Returns:** Whether the bounding box is intersecting this frustum or not. + +### .intersectsObject( object : Object3D ) : boolean + +Returns `true` if the 3D object's bounding sphere is intersecting this frustum. + +Note that the 3D object must have a geometry so that the bounding sphere can be calculated. + +**object** + +The 3D object to test. + +**Returns:** Whether the 3D object's bounding sphere is intersecting this frustum or not. + +### .intersectsSphere( sphere : Sphere ) : boolean + +Returns `true` if the given bounding sphere is intersecting this frustum. + +**sphere** + +The bounding sphere to test. + +**Returns:** Whether the bounding sphere is intersecting this frustum or not. + +### .intersectsSprite( sprite : Sprite ) : boolean + +Returns `true` if the given sprite is intersecting this frustum. + +**sprite** + +The sprite to test. + +**Returns:** Whether the sprite is intersecting this frustum or not. + +### .set( p0 : Plane, p1 : Plane, p2 : Plane, p3 : Plane, p4 : Plane, p5 : Plane ) : Frustum + +Sets the frustum planes by copying the given planes. + +**p0** + +The first plane that encloses the frustum. + +**p1** + +The second plane that encloses the frustum. + +**p2** + +The third plane that encloses the frustum. + +**p3** + +The fourth plane that encloses the frustum. + +**p4** + +The fifth plane that encloses the frustum. + +**p5** + +The sixth plane that encloses the frustum. + +**Returns:** A reference to this frustum. + +### .setFromProjectionMatrix( m : Matrix4, coordinateSystem : WebGLCoordinateSystem | WebGPUCoordinateSystem, reversedDepth : boolean ) : Frustum + +Sets the frustum planes from the given projection matrix. + +**m** + +The projection matrix. + +**coordinateSystem** + +The coordinate system. + +**reversedDepth** + +Whether to use a reversed depth. + +Default is `false`. + +**Returns:** A reference to this frustum. + +## Source + +[src/math/Frustum.js](https://github.com/mrdoob/three.js/blob/master/src/math/Frustum.js) \ No newline at end of file diff --git a/docs/pages/FrustumArray.html.md b/docs/pages/FrustumArray.html.md new file mode 100644 index 00000000000000..a7d437ec41db98 --- /dev/null +++ b/docs/pages/FrustumArray.html.md @@ -0,0 +1,99 @@ +# FrustumArray + +FrustumArray is used to determine if an object is visible in at least one camera from an array of cameras. This is particularly useful for multi-view renderers. + +## Constructor + +### new FrustumArray() + +Constructs a new frustum array. + +## Properties + +### .coordinateSystem : WebGLCoordinateSystem | WebGPUCoordinateSystem + +The coordinate system to use. + +Default is `WebGLCoordinateSystem`. + +## Methods + +### .clone() : FrustumArray + +Returns a new frustum array with copied values from this instance. + +**Returns:** A clone of this instance. + +### .containsPoint( point : Vector3, cameraArray : Object ) : boolean + +Returns `true` if the given point lies within any frustum from the camera array. + +**point** + +The point to test. + +**cameraArray** + +An object with a cameras property containing an array of cameras. + +**Returns:** Whether the point is visible in any camera. + +### .intersectsBox( box : Box3, cameraArray : Object ) : boolean + +Returns `true` if the given bounding box is intersecting any frustum from the camera array. + +**box** + +The bounding box to test. + +**cameraArray** + +An object with a cameras property containing an array of cameras. + +**Returns:** Whether the box is visible in any camera. + +### .intersectsObject( object : Object3D, cameraArray : Object ) : boolean + +Returns `true` if the 3D object's bounding sphere is intersecting any frustum from the camera array. + +**object** + +The 3D object to test. + +**cameraArray** + +An object with a cameras property containing an array of cameras. + +**Returns:** Whether the 3D object is visible in any camera. + +### .intersectsSphere( sphere : Sphere, cameraArray : Object ) : boolean + +Returns `true` if the given bounding sphere is intersecting any frustum from the camera array. + +**sphere** + +The bounding sphere to test. + +**cameraArray** + +An object with a cameras property containing an array of cameras. + +**Returns:** Whether the sphere is visible in any camera. + +### .intersectsSprite( sprite : Sprite, cameraArray : Object ) : boolean + +Returns `true` if the given sprite is intersecting any frustum from the camera array. + +**sprite** + +The sprite to test. + +**cameraArray** + +An object with a cameras property containing an array of cameras. + +**Returns:** Whether the sprite is visible in any camera. + +## Source + +[src/math/FrustumArray.js](https://github.com/mrdoob/three.js/blob/master/src/math/FrustumArray.js) \ No newline at end of file diff --git a/docs/pages/FullScreenQuad.html.md b/docs/pages/FullScreenQuad.html.md new file mode 100644 index 00000000000000..602453a97e9329 --- /dev/null +++ b/docs/pages/FullScreenQuad.html.md @@ -0,0 +1,53 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# FullScreenQuad + +This module is a helper for passes which need to render a full screen effect which is quite common in context of post processing. + +The intended usage is to reuse a single full screen quad for rendering subsequent passes by just reassigning the `material` reference. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). + +## Import + +FullScreenQuad is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js'; +``` + +## Constructor + +### new FullScreenQuad( material : Material ) + +Constructs a new full screen quad. + +**material** + +The material to render te full screen quad with. + +## Properties + +### .material : Material + +The quad's material. + +**Overrides:** [Mesh#material](Mesh.html#material) + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the instance is no longer used in your app. + +### .render( renderer : WebGLRenderer ) + +Renders the full screen quad. + +**renderer** + +The renderer. + +## Source + +[examples/jsm/postprocessing/Pass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/Pass.js) \ No newline at end of file diff --git a/docs/pages/FunctionCallNode.html.md b/docs/pages/FunctionCallNode.html.md new file mode 100644 index 00000000000000..278d36ae6b3c78 --- /dev/null +++ b/docs/pages/FunctionCallNode.html.md @@ -0,0 +1,87 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# FunctionCallNode + +This module represents the call of a [FunctionNode](FunctionNode.html). Developers are usually not confronted with this module since they use the predefined TSL syntax `wgslFn` and `glslFn` which encapsulate this logic. + +## Constructor + +### new FunctionCallNode( functionNode : FunctionNode, parameters : Object. ) + +Constructs a new function call node. + +**functionNode** + +The function node. + +Default is `null`. + +**parameters** + +The parameters for the function call. + +Default is `{}`. + +## Properties + +### .functionNode : FunctionNode + +The function node. + +Default is `null`. + +### .parameters : Object. + +The parameters of the function call. + +Default is `{}`. + +## Methods + +### .getMemberType( builder : NodeBuilder, name : string ) : string + +Returns the function node of this function call node. + +**builder** + +The current node builder. + +**name** + +The name of the member. + +**Overrides:** [TempNode#getMemberType](TempNode.html#getMemberType) + +**Returns:** The type of the member. + +### .getNodeType( builder : NodeBuilder ) : string + +Returns the type of this function call node. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getNodeType](TempNode.html#getNodeType) + +**Returns:** The type of this node. + +### .getParameters() : Object. + +Returns the parameters of the function call node. + +**Returns:** The parameters of this node. + +### .setParameters( parameters : Object. ) : FunctionCallNode + +Sets the parameters of the function call node. + +**parameters** + +The parameters to set. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/code/FunctionCallNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/code/FunctionCallNode.js) \ No newline at end of file diff --git a/docs/pages/FunctionNode.html.md b/docs/pages/FunctionNode.html.md new file mode 100644 index 00000000000000..e58e29dd8f514a --- /dev/null +++ b/docs/pages/FunctionNode.html.md @@ -0,0 +1,105 @@ +*Inheritance: EventDispatcher → Node → CodeNode →* + +# FunctionNode + +This class represents a native shader function. It can be used to implement certain aspects of a node material with native shader code. There are two predefined TSL functions for easier usage. + +* `wgslFn`: Creates a WGSL function node. +* `glslFn`: Creates a GLSL function node. + +A basic example with one include looks like so: + +## Code Example + +```js +const desaturateWGSLFn = wgslFn( ` + fn desaturate( color:vec3 ) -> vec3 { + let lum = vec3( 0.299, 0.587, 0.114 ); + return vec3( dot( lum, color ) ); + }` +); +const someWGSLFn = wgslFn( ` + fn someFn( color:vec3 ) -> vec3 { + return desaturate( color ); + } +`, [ desaturateWGSLFn ] ); +material.colorNode = someWGSLFn( { color: texture( map ) } ); +``` + +## Constructor + +### new FunctionNode( code : string, includes : Array., language : 'js' | 'wgsl' | 'glsl' ) + +Constructs a new function node. + +**code** + +The native code. + +Default is `''`. + +**includes** + +An array of includes. + +Default is `[]`. + +**language** + +The used language. + +Default is `''`. + +## Methods + +### .getInputs( builder : NodeBuilder ) : Array. + +Returns the inputs of this function node. + +**builder** + +The current node builder. + +**Returns:** The inputs. + +### .getMemberType( builder : NodeBuilder, name : string ) : string + +Returns the type of a member of this function node. + +**builder** + +The current node builder. + +**name** + +The name of the member. + +**Overrides:** [CodeNode#getMemberType](CodeNode.html#getMemberType) + +**Returns:** The type of the member. + +### .getNodeFunction( builder : NodeBuilder ) : NodeFunction + +Returns the node function for this function node. + +**builder** + +The current node builder. + +**Returns:** The node function. + +### .getNodeType( builder : NodeBuilder ) : string + +Returns the type of this function node. + +**builder** + +The current node builder. + +**Overrides:** [CodeNode#getNodeType](CodeNode.html#getNodeType) + +**Returns:** The type. + +## Source + +[src/nodes/code/FunctionNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/code/FunctionNode.js) \ No newline at end of file diff --git a/docs/pages/FunctionOverloadingNode.html.md b/docs/pages/FunctionOverloadingNode.html.md new file mode 100644 index 00000000000000..a96599e173fa9f --- /dev/null +++ b/docs/pages/FunctionOverloadingNode.html.md @@ -0,0 +1,77 @@ +*Inheritance: EventDispatcher → Node →* + +# FunctionOverloadingNode + +This class allows to define multiple overloaded versions of the same function. Depending on the parameters of the function call, the node picks the best-fit overloaded version. + +## Constructor + +### new FunctionOverloadingNode( functionNodes : Array., …parametersNodes : Node ) + +Constructs a new function overloading node. + +**functionNodes** + +Array of `Fn` function definitions. + +**parametersNodes** + +A list of parameter nodes. + +## Properties + +### .functionNodes : Array. + +Array of `Fn` function definitions. + +### .global : boolean + +This node is marked as global. + +Default is `true`. + +**Overrides:** [Node#global](Node.html#global) + +### .parametersNodes : Array. + +A list of parameter nodes. + +## Methods + +### .getCandidateFn( builder : NodeBuilder ) : FunctionNode + +Returns the candidate function for the current parameters. + +**builder** + +The current node builder. + +**Returns:** The candidate function. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from the function's return type. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .setup( builder : NodeBuilder ) : Node + +Sets up the node for the current parameters. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The setup node. + +## Source + +[src/nodes/utils/FunctionOverloadingNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/FunctionOverloadingNode.js) \ No newline at end of file diff --git a/docs/pages/GCodeLoader.html.md b/docs/pages/GCodeLoader.html.md new file mode 100644 index 00000000000000..68f2b8271592db --- /dev/null +++ b/docs/pages/GCodeLoader.html.md @@ -0,0 +1,81 @@ +*Inheritance: Loader →* + +# GCodeLoader + +A loader for the GCode format. + +GCode files are usually used for 3D printing or CNC applications. + +## Code Example + +```js +const loader = new GCodeLoader(); +const object = await loader.loadAsync( 'models/gcode/benchy.gcode' ); +scene.add( object ); +``` + +## Import + +GCodeLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GCodeLoader } from 'three/addons/loaders/GCodeLoader.js'; +``` + +## Constructor + +### new GCodeLoader( manager : LoadingManager ) + +Constructs a new GCode loader. + +**manager** + +The loading manager. + +## Properties + +### .splitLayer : boolean + +Whether to split layers or not. + +Default is `false`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded GCode asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : string ) : Group + +Parses the given GCode data and returns a group with lines. + +**data** + +The raw Gcode data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed GCode asset. + +## Source + +[examples/jsm/loaders/GCodeLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/GCodeLoader.js) \ No newline at end of file diff --git a/docs/pages/GLBufferAttribute.html.md b/docs/pages/GLBufferAttribute.html.md new file mode 100644 index 00000000000000..ce75395bf04713 --- /dev/null +++ b/docs/pages/GLBufferAttribute.html.md @@ -0,0 +1,137 @@ +# GLBufferAttribute + +An alternative version of a buffer attribute with more control over the VBO. + +The renderer does not construct a VBO for this kind of attribute. Instead, it uses whatever VBO is passed in constructor and can later be altered via the `buffer` property. + +The most common use case for this class is when some kind of GPGPU calculation interferes or even produces the VBOs in question. + +Notice that this class can only be used with [WebGLRenderer](WebGLRenderer.html). + +## Constructor + +### new GLBufferAttribute( buffer : WebGLBuffer, type : number, itemSize : number, elementSize : number, count : number, normalized : boolean ) + +Constructs a new GL buffer attribute. + +**buffer** + +The native WebGL buffer. + +**type** + +The native data type (e.g. `gl.FLOAT`). + +**itemSize** + +The item size. + +**elementSize** + +The corresponding size (in bytes) for the given `type` parameter. + +**count** + +The expected number of vertices in VBO. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Properties + +### .buffer : WebGLBuffer + +The native WebGL buffer. + +### .count : number + +The expected number of vertices in VBO. + +### .elementSize : number + +The corresponding size (in bytes) for the given `type` parameter. + +### .isGLBufferAttribute : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .itemSize : number + +The item size, see [BufferAttribute#itemSize](BufferAttribute.html#itemSize). + +### .name : string + +The name of the buffer attribute. + +### .needsUpdate : number + +Flag to indicate that this attribute has changed and should be re-sent to the GPU. Set this to `true` when you modify the value of the array. + +Default is `false`. + +### .normalized : boolean + +Applies to integer data only. Indicates how the underlying data in the buffer maps to the values in the GLSL code. For instance, if `buffer` contains data of `gl.UNSIGNED_SHORT`, and `normalized` is `true`, the values `0 - +65535` in the buffer data will be mapped to `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted to floats unmodified, i.e. `65535` becomes `65535.0f`. + +### .type : number + +The native data type. + +### .version : number + +A version number, incremented every time the `needsUpdate` is set to `true`. + +## Methods + +### .setBuffer( buffer : WebGLBuffer ) : BufferAttribute + +Sets the given native WebGL buffer. + +**buffer** + +The buffer to set. + +**Returns:** A reference to this instance. + +### .setCount( count : number ) : BufferAttribute + +Sets the count (the expected number of vertices in VBO). + +**count** + +The count. + +**Returns:** A reference to this instance. + +### .setItemSize( itemSize : number ) : BufferAttribute + +Sets the item size. + +**itemSize** + +The item size. + +**Returns:** A reference to this instance. + +### .setType( type : number, elementSize : number ) : BufferAttribute + +Sets the given native data type and element size. + +**type** + +The native data type (e.g. `gl.FLOAT`). + +**elementSize** + +The corresponding size (in bytes) for the given `type` parameter. + +**Returns:** A reference to this instance. + +## Source + +[src/core/GLBufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/GLBufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/GLSLNodeBuilder.html.md b/docs/pages/GLSLNodeBuilder.html.md new file mode 100644 index 00000000000000..8c37c16121f58b --- /dev/null +++ b/docs/pages/GLSLNodeBuilder.html.md @@ -0,0 +1,615 @@ +*Inheritance: NodeBuilder →* + +# GLSLNodeBuilder + +A node builder targeting GLSL. + +This module generates GLSL shader code from node materials and also generates the respective bindings and vertex buffer definitions. These data are later used by the renderer to create render and compute pipelines for render objects. + +## Constructor + +### new GLSLNodeBuilder( object : Object3D, renderer : Renderer ) + +Constructs a new GLSL node builder renderer. + +**object** + +The 3D object. + +**renderer** + +The renderer. + +## Properties + +### .builtins : Object.> + +A dictionary that holds for each shader stage an Array of used builtins. + +### .extensions : Object.> + +A dictionary that holds for each shader stage a Map of used extensions. + +### .transforms : Array.> + +An array that holds objects defining the varying and attribute data in context of Transform Feedback. + +### .uniformGroups : Object.> + +A dictionary holds for each shader stage ('vertex', 'fragment', 'compute') another dictionary which manages UBOs per group ('render','frame','object'). + +## Methods + +### .buildCode() + +Controls the code build of the shader stages. + +**Overrides:** [NodeBuilder#buildCode](NodeBuilder.html#buildCode) + +### .buildFunctionCode( shaderNode : ShaderNodeInternal ) : string + +Builds the given shader node. + +**shaderNode** + +The shader node. + +**Overrides:** [NodeBuilder#buildFunctionCode](NodeBuilder.html#buildFunctionCode) + +**Returns:** The GLSL function code. + +### .enableExtension( name : string, behavior : string, shaderStage : string ) + +Enables the given extension. + +**name** + +The extension name. + +**behavior** + +The extension behavior. + +**shaderStage** + +The shader stage. + +Default is `this.shaderStage`. + +### .enableHardwareClipping( planeCount : string ) + +Enables hardware clipping. + +**planeCount** + +The clipping plane count. + +### .enableMultiview() + +Enables multiview. + +### .generatePBO( storageArrayElementNode : StorageArrayElementNode ) : string + +Setups the Pixel Buffer Object (PBO) for the given storage buffer node. + +**storageArrayElementNode** + +The storage array element node. + +**Returns:** The property name. + +### .generateTexture( texture : Texture, textureProperty : string, uvSnippet : string, depthSnippet : string, offsetSnippet : string ) : string + +Generates the GLSL snippet for sampling/loading the given texture. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A GLSL snippet that represents texture coordinates used for sampling. + +**depthSnippet** + +A GLSL snippet that represents the 0-based texture array index to sample. + +**offsetSnippet** + +A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**Overrides:** [NodeBuilder#generateTexture](NodeBuilder.html#generateTexture) + +**Returns:** The GLSL snippet. + +### .generateTextureBias( texture : Texture, textureProperty : string, uvSnippet : string, biasSnippet : string, offsetSnippet : string ) : string + +Generates the GLSL snippet when sampling textures with a bias to the mip level. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A GLSL snippet that represents texture coordinates used for sampling. + +**biasSnippet** + +A GLSL snippet that represents the bias to apply to the mip level before sampling. + +**offsetSnippet** + +A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**Returns:** The GLSL snippet. + +### .generateTextureCompare( texture : Texture, textureProperty : string, uvSnippet : string, compareSnippet : string, depthSnippet : string, offsetSnippet : string, shaderStage : string ) : string + +Generates the GLSL snippet for sampling a depth texture and comparing the sampled depth values against a reference value. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A GLSL snippet that represents texture coordinates used for sampling. + +**compareSnippet** + +A GLSL snippet that represents the reference value. + +**depthSnippet** + +A GLSL snippet that represents 0-based texture array index to sample. + +**offsetSnippet** + +A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Returns:** The GLSL snippet. + +### .generateTextureGrad( texture : Texture, textureProperty : string, uvSnippet : string, gradSnippet : Array., offsetSnippet : string ) : string + +Generates the GLSL snippet for sampling/loading the given texture using explicit gradients. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A GLSL snippet that represents texture coordinates used for sampling. + +**gradSnippet** + +An array holding both gradient GLSL snippets. + +**offsetSnippet** + +A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**Returns:** The GLSL snippet. + +### .generateTextureLevel( texture : Texture, textureProperty : string, uvSnippet : string, levelSnippet : string, offsetSnippet : string ) : string + +Generates the GLSL snippet when sampling textures with explicit mip level. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A GLSL snippet that represents texture coordinates used for sampling. + +**levelSnippet** + +A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + +**offsetSnippet** + +A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**Returns:** The GLSL snippet. + +### .generateTextureLoad( texture : Texture, textureProperty : string, uvIndexSnippet : string, levelSnippet : string, depthSnippet : string, offsetSnippet : string ) : string + +Generates the GLSL snippet that reads a single texel from a texture without sampling or filtering. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvIndexSnippet** + +A GLSL snippet that represents texture coordinates used for sampling. + +**levelSnippet** + +A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + +**depthSnippet** + +A GLSL snippet that represents the 0-based texture array index to sample. + +**offsetSnippet** + +A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**Returns:** The GLSL snippet. + +### .getAttributes( shaderStage : string ) : string + +Returns the shader attributes of the given shader stage as a GLSL string. + +**shaderStage** + +The shader stage. + +**Overrides:** [NodeBuilder#getAttributes](NodeBuilder.html#getAttributes) + +**Returns:** The GLSL snippet that defines the shader attributes. + +### .getBitcastMethod( type : string, inputType : string ) : string + +Returns the bitcast method name for a given input and outputType. + +**type** + +The output type to bitcast to. + +**inputType** + +The input type of the. + +**Returns:** The resolved WGSL bitcast invocation. + +### .getClipDistance() : string + +Returns the clip distances builtin. + +**Returns:** The clip distances builtin. + +### .getDrawIndex() : string + +Returns the draw index builtin. + +**Overrides:** [NodeBuilder#getDrawIndex](NodeBuilder.html#getDrawIndex) + +**Returns:** The drawIndex shader string. Returns `null` if `WEBGL_multi_draw` isn't supported by the device. + +### .getExtensions( shaderStage : string ) : string + +Returns the enabled extensions of the given shader stage as a GLSL string. + +**shaderStage** + +The shader stage. + +**Returns:** The GLSL snippet that defines the enabled extensions. + +### .getFloatPackingMethod( encoding : string ) : string + +Returns the float packing method name for a given numeric encoding. + +**encoding** + +The numeric encoding that describes how the float values are mapped to the integer range. + +**Returns:** The resolved GLSL float packing method name. + +### .getFloatUnpackingMethod( encoding : string ) : string + +Returns the float unpacking method name for a given numeric encoding. + +**encoding** + +The numeric encoding that describes how the integer values are mapped to the float range. + +**Returns:** The resolved GLSL float unpacking method name. + +### .getFragCoord() : string + +Returns the frag coord builtin. + +**Overrides:** [NodeBuilder#getFragCoord](NodeBuilder.html#getFragCoord) + +**Returns:** The frag coord builtin. + +### .getFragDepth() : string + +Returns the frag depth builtin. + +**Returns:** The frag depth builtin. + +### .getFrontFacing() : string + +Returns the front facing builtin. + +**Overrides:** [NodeBuilder#getFrontFacing](NodeBuilder.html#getFrontFacing) + +**Returns:** The front facing builtin. + +### .getInstanceIndex() : string + +Contextually returns either the vertex stage instance index builtin or the linearized index of an compute invocation within a grid of workgroups. + +**Overrides:** [NodeBuilder#getInstanceIndex](NodeBuilder.html#getInstanceIndex) + +**Returns:** The instance index. + +### .getInvocationLocalIndex() : string + +Returns a builtin representing the index of an invocation within its workgroup. + +**Returns:** The invocation local index. + +### .getInvocationSubgroupIndex() + +Returns a builtin representing the index of an invocation within its subgroup. + +### .getMethod( method : string ) : string + +Returns the native shader method name for a given generic name. + +**method** + +The method name to resolve. + +**Overrides:** [NodeBuilder#getMethod](NodeBuilder.html#getMethod) + +**Returns:** The resolved GLSL method name. + +### .getOutputStructName() : string + +Returns the output struct name. Not relevant for GLSL. + +**Overrides:** [NodeBuilder#getOutputStructName](NodeBuilder.html#getOutputStructName) + +### .getPropertyName( node : Node, shaderStage : string ) : string + +Returns a GLSL snippet that represents the property name of the given node. + +**node** + +The node. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Overrides:** [NodeBuilder#getPropertyName](NodeBuilder.html#getPropertyName) + +**Returns:** The property name. + +### .getStructMembers( struct : StructTypeNode ) : string + +Returns the members of the given struct type node as a GLSL string. + +**struct** + +The struct type node. + +**Returns:** The GLSL snippet that defines the struct members. + +### .getStructs( shaderStage : string ) : string + +Returns the structs of the given shader stage as a GLSL string. + +**shaderStage** + +The shader stage. + +**Returns:** The GLSL snippet that defines the structs. + +### .getSubgroupIndex() + +Returns a builtin representing the index of the current invocation's subgroup within its workgroup. + +### .getSubgroupSize() + +Returns a builtin representing the size of a subgroup within the current shader. + +### .getTernary( condSnippet : string, ifSnippet : string, elseSnippet : string ) : string + +Returns the native snippet for a ternary operation. + +**condSnippet** + +The condition determining which expression gets resolved. + +**ifSnippet** + +The expression to resolve to if the condition is true. + +**elseSnippet** + +The expression to resolve to if the condition is false. + +**Overrides:** [NodeBuilder#getTernary](NodeBuilder.html#getTernary) + +**Returns:** The resolved method name. + +### .getTransforms( shaderStage : string ) : string + +Returns the transforms of the given shader stage as a GLSL string. + +**shaderStage** + +The shader stage. + +**Returns:** The GLSL snippet that defines the transforms. + +### .getTypeFromAttribute( attribute : BufferAttribute ) : string + +Returns the type for a given buffer attribute. + +**attribute** + +The buffer attribute. + +**Overrides:** [NodeBuilder#getTypeFromAttribute](NodeBuilder.html#getTypeFromAttribute) + +**Returns:** The type. + +### .getUniformFromNode( node : UniformNode, type : string, shaderStage : string, name : string ) : NodeUniform + +This method is one of the more important ones since it's responsible for generating a matching binding instance for the given uniform node. + +These bindings are later used in the renderer to create bind groups and layouts. + +**node** + +The uniform node. + +**type** + +The node data type. + +**shaderStage** + +The shader stage. + +**name** + +An optional uniform name. + +Default is `null`. + +**Overrides:** [NodeBuilder#getUniformFromNode](NodeBuilder.html#getUniformFromNode) + +**Returns:** The node uniform object. + +### .getUniforms( shaderStage : string ) : string + +Returns the uniforms of the given shader stage as a GLSL string. + +**shaderStage** + +The shader stage. + +**Overrides:** [NodeBuilder#getUniforms](NodeBuilder.html#getUniforms) + +**Returns:** The GLSL snippet that defines the uniforms. + +### .getVars( shaderStage : string ) : string + +Returns the variables of the given shader stage as a GLSL string. + +**shaderStage** + +The shader stage. + +**Overrides:** [NodeBuilder#getVars](NodeBuilder.html#getVars) + +**Returns:** The GLSL snippet that defines the variables. + +### .getVaryings( shaderStage : string ) : string + +Returns the varyings of the given shader stage as a GLSL string. + +**shaderStage** + +The shader stage. + +**Overrides:** [NodeBuilder#getVaryings](NodeBuilder.html#getVaryings) + +**Returns:** The GLSL snippet that defines the varyings. + +### .getVertexIndex() : string + +Returns the vertex index builtin. + +**Overrides:** [NodeBuilder#getVertexIndex](NodeBuilder.html#getVertexIndex) + +**Returns:** The vertex index. + +### .isAvailable( name : string ) : boolean + +Whether the requested feature is available or not. + +**name** + +The requested feature. + +**Overrides:** [NodeBuilder#isAvailable](NodeBuilder.html#isAvailable) + +**Returns:** Whether the requested feature is supported or not. + +### .isFlipY() : boolean + +Whether to flip texture data along its vertical axis or not. + +**Overrides:** [NodeBuilder#isFlipY](NodeBuilder.html#isFlipY) + +**Returns:** Returns always `true` in context of GLSL. + +### .needsToWorkingColorSpace( texture : Texture ) : boolean + +Checks if the given texture requires a manual conversion to the working color space. + +**texture** + +The texture to check. + +**Overrides:** [NodeBuilder#needsToWorkingColorSpace](NodeBuilder.html#needsToWorkingColorSpace) + +**Returns:** Whether the given texture requires a conversion to working color space or not. + +### .registerTransform( varyingName : string, attributeNode : AttributeNode ) + +Registers a transform in context of Transform Feedback. + +**varyingName** + +The varying name. + +**attributeNode** + +The attribute node. + +### .setupPBO( storageBufferNode : StorageBufferNode ) + +Setups the Pixel Buffer Object (PBO) for the given storage buffer node. + +**storageBufferNode** + +The storage buffer node. + +## Source + +[src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js) \ No newline at end of file diff --git a/docs/pages/GLSLNodeFunction.html.md b/docs/pages/GLSLNodeFunction.html.md new file mode 100644 index 00000000000000..38bdf98a93a74a --- /dev/null +++ b/docs/pages/GLSLNodeFunction.html.md @@ -0,0 +1,35 @@ +*Inheritance: NodeFunction →* + +# GLSLNodeFunction + +This class represents a GLSL node function. + +## Constructor + +### new GLSLNodeFunction( source : string ) + +Constructs a new GLSL node function. + +**source** + +The GLSL source. + +## Methods + +### .getCode( name : string ) : string + +This method returns the GLSL code of the node function. + +**name** + +The function's name. + +Default is `this.name`. + +**Overrides:** [NodeFunction#getCode](NodeFunction.html#getCode) + +**Returns:** The shader code. + +## Source + +[src/nodes/parsers/GLSLNodeFunction.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/parsers/GLSLNodeFunction.js) \ No newline at end of file diff --git a/docs/pages/GLSLNodeParser.html.md b/docs/pages/GLSLNodeParser.html.md new file mode 100644 index 00000000000000..448855b329ade8 --- /dev/null +++ b/docs/pages/GLSLNodeParser.html.md @@ -0,0 +1,27 @@ +*Inheritance: NodeParser →* + +# GLSLNodeParser + +A GLSL node parser. + +## Constructor + +### new GLSLNodeParser() + +## Methods + +### .parseFunction( source : string ) : GLSLNodeFunction + +The method parses the given GLSL code an returns a node function. + +**source** + +The GLSL code. + +**Overrides:** [NodeParser#parseFunction](NodeParser.html#parseFunction) + +**Returns:** A node function. + +## Source + +[src/nodes/parsers/GLSLNodeParser.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/parsers/GLSLNodeParser.js) \ No newline at end of file diff --git a/docs/pages/GLTFExporter.html.md b/docs/pages/GLTFExporter.html.md new file mode 100644 index 00000000000000..ea80c0a3e967ab --- /dev/null +++ b/docs/pages/GLTFExporter.html.md @@ -0,0 +1,192 @@ +# GLTFExporter + +An exporter for `glTF` 2.0. + +glTF (GL Transmission Format) is an [open format specification](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0) for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb) format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights, and/or cameras. + +GLTFExporter supports the [glTF 2.0 extensions](https://github.com/KhronosGroup/glTF/tree/master/extensions/): + +* KHR\_lights\_punctual +* KHR\_materials\_clearcoat +* KHR\_materials\_dispersion +* KHR\_materials\_emissive\_strength +* KHR\_materials\_ior +* KHR\_materials\_iridescence +* KHR\_materials\_specular +* KHR\_materials\_sheen +* KHR\_materials\_transmission +* KHR\_materials\_unlit +* KHR\_materials\_volume +* KHR\_mesh\_quantization +* KHR\_texture\_transform +* EXT\_materials\_bump +* EXT\_mesh\_gpu\_instancing + +The following glTF 2.0 extension is supported by an external user plugin: + +* [KHR\_materials\_variants](https://github.com/takahirox/three-gltf-extensions) + +## Code Example + +```js +const exporter = new GLTFExporter(); +const data = await exporter.parseAsync( scene, options ); +``` + +## Import + +GLTFExporter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js'; +``` + +## Constructor + +### new GLTFExporter() + +Constructs a new glTF exporter. + +## Properties + +### .textureUtils : WebGLTextureUtils | WebGPUTextureUtils + +A reference to a texture utils module. + +Default is `null`. + +## Methods + +### .parse( input : Scene | Array., onDone : GLTFExporter~OnDone, onError : GLTFExporter~OnError, options : GLTFExporter~Options ) + +Parses the given scenes and generates the glTF output. + +**input** + +A scene or an array of scenes. + +**onDone** + +A callback function that is executed when the export has finished. + +**onError** + +A callback function that is executed when an error happens. + +**options** + +options + +### .parseAsync( input : Scene | Array., options : GLTFExporter~Options ) : Promise.<(ArrayBuffer|string)> + +Async version of [GLTFExporter#parse](GLTFExporter.html#parse). + +**input** + +A scene or an array of scenes. + +**options** + +options. + +**Returns:** A Promise that resolved with the exported glTF data. + +### .register( callback : function ) : GLTFExporter + +Registers a plugin callback. This API is internally used to implement the various glTF extensions but can also used by third-party code to add additional logic to the exporter. + +**callback** + +The callback function to register. + +**Returns:** A reference to this exporter. + +### .setTextureUtils( utils : WebGLTextureUtils | WebGPUTextureUtils ) : GLTFExporter + +Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported. + +Depending on whether you use [WebGLRenderer](WebGLRenderer.html) or [WebGPURenderer](WebGPURenderer.html), you must inject the corresponding texture utils [WebGLTextureUtils](WebGLTextureUtils.html) or [WebGPUTextureUtils](WebGPUTextureUtils.html). + +**utils** + +The texture utils. + +**Returns:** A reference to this exporter. + +### .unregister( callback : function ) : GLTFExporter + +Unregisters a plugin callback. + +**callback** + +The callback function to unregister. + +**Returns:** A reference to this exporter. + +## Type Definitions + +### .OnDone( result : ArrayBuffer | string ) + +onDone callback of `GLTFExporter`. + +**result** + +The generated .gltf (JSON) or .glb (binary). + +### .OnError( error : Error ) + +onError callback of `GLTFExporter`. + +**error** + +The error object. + +### .Options + +Export options of `GLTFExporter`. + +**trs** +boolean + +Export position, rotation and scale instead of matrix per node. + +Default is `false`. + +**onlyVisible** +boolean + +Export only visible 3D objects. + +Default is `true`. + +**binary** +boolean + +Export in binary (.glb) format, returning an ArrayBuffer. + +Default is `false`. + +**maxTextureSize** +number + +Restricts the image maximum size (both width and height) to the given value. + +Default is `Infinity`. + +**animations** +Array.<[AnimationClip](AnimationClip.html)\> + +List of animations to be included in the export. + +Default is `[]`. + +**includeCustomExtensions** +boolean + +Export custom glTF extensions defined on an object's `userData.gltfExtensions` property. + +Default is `false`. + +## Source + +[examples/jsm/exporters/GLTFExporter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/GLTFExporter.js) \ No newline at end of file diff --git a/docs/pages/GLTFLoader.html.md b/docs/pages/GLTFLoader.html.md new file mode 100644 index 00000000000000..4f5ed7945d9a01 --- /dev/null +++ b/docs/pages/GLTFLoader.html.md @@ -0,0 +1,218 @@ +*Inheritance: Loader →* + +# GLTFLoader + +A loader for the glTF 2.0 format. + +\[glTF\](https://www.khronos.org/gltf/} (GL Transmission Format) is an [open format specification](https://github.com/KhronosGroup/glTF/tree/main/specification/2.0\)) whenever possible. Be advised that image bitmaps are not automatically GC-collected when they are no longer referenced, and they require special handling during the disposal process. + +`GLTFLoader` supports the following glTF 2.0 extensions: + +* KHR\_draco\_mesh\_compression +* KHR\_materials\_clearcoat +* KHR\_materials\_dispersion +* KHR\_materials\_ior +* KHR\_materials\_specular +* KHR\_materials\_transmission +* KHR\_materials\_iridescence +* KHR\_materials\_unlit +* KHR\_materials\_volume +* KHR\_mesh\_quantization +* KHR\_lights\_punctual +* KHR\_texture\_basisu +* KHR\_texture\_transform +* EXT\_texture\_webp +* EXT\_meshopt\_compression +* EXT\_mesh\_gpu\_instancing + +The following glTF 2.0 extension is supported by an external user plugin: + +* [KHR\_materials\_variants](https://github.com/takahirox/three-gltf-extensions) +* [MSFT\_texture\_dds](https://github.com/takahirox/three-gltf-extensions) +* [KHR\_animation\_pointer](https://github.com/needle-tools/three-animation-pointer) +* [NEEDLE\_progressive](https://github.com/needle-tools/gltf-progressive) + +## Code Example + +```js +const loader = new GLTFLoader(); +// Optional: Provide a DRACOLoader instance to decode compressed mesh data +const dracoLoader = new DRACOLoader(); +dracoLoader.setDecoderPath( '/examples/jsm/libs/draco/' ); +loader.setDRACOLoader( dracoLoader ); +const gltf = await loader.loadAsync( 'models/gltf/duck/duck.gltf' ); +scene.add( gltf.scene ); +``` + +## Import + +GLTFLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +``` + +## Constructor + +### new GLTFLoader( manager : LoadingManager ) + +Constructs a new glTF loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded glTF asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : string | ArrayBuffer, path : string, onLoad : function, onError : onErrorCallback ) + +Parses the given FBX data and returns the resulting group. + +**data** + +The raw glTF data. + +**path** + +The URL base path. + +**onLoad** + +Executed when the loading process has been finished. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#parse](Loader.html#parse) + +### .parseAsync( data : string | ArrayBuffer, path : string ) : Promise. (async) + +Async version of [GLTFLoader#parse](GLTFLoader.html#parse). + +**data** + +The raw glTF data. + +**path** + +The URL base path. + +**Returns:** A Promise that resolves with the loaded glTF when the parsing has been finished. + +### .register( callback : function ) : GLTFLoader + +Registers a plugin callback. This API is internally used to implement the various glTF extensions but can also used by third-party code to add additional logic to the loader. + +**callback** + +The callback function to register. + +**Returns:** A reference to this loader. + +### .setDRACOLoader( dracoLoader : DRACOLoader ) : GLTFLoader + +Sets the given Draco loader to this loader. Required for decoding assets compressed with the `KHR_draco_mesh_compression` extension. + +**dracoLoader** + +The Draco loader to set. + +**Returns:** A reference to this loader. + +### .setKTX2Loader( ktx2Loader : KTX2Loader ) : GLTFLoader + +Sets the given KTX2 loader to this loader. Required for loading KTX2 compressed textures. + +**ktx2Loader** + +The KTX2 loader to set. + +**Returns:** A reference to this loader. + +### .setMeshoptDecoder( meshoptDecoder : Object ) : GLTFLoader + +Sets the given meshopt decoder. Required for decoding assets compressed with the `EXT_meshopt_compression` extension. + +**meshoptDecoder** + +The meshopt decoder to set. + +**Returns:** A reference to this loader. + +### .unregister( callback : function ) : GLTFLoader + +Unregisters a plugin callback. + +**callback** + +The callback function to unregister. + +**Returns:** A reference to this loader. + +## Type Definitions + +### .LoadObject + +Loader result of `GLTFLoader`. + +**animations** +Array.<[AnimationClip](AnimationClip.html)\> + +An array of animation clips. + +**asset** +Object + +Meta data about the loaded asset. + +**cameras** +Array.<[Camera](Camera.html)\> + +An array of cameras. + +**parser** +GLTFParser + +A reference to the internal parser. + +**scene** +[Group](Group.html) + +The default scene. + +**scenes** +Array.<[Group](Group.html)\> + +glTF assets might define multiple scenes. + +**userData** +Object + +Additional data. + +## Source + +[examples/jsm/loaders/GLTFLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/GLTFLoader.js) \ No newline at end of file diff --git a/docs/pages/GPUComputationRenderer.html.md b/docs/pages/GPUComputationRenderer.html.md new file mode 100644 index 00000000000000..596b70ab93a1c8 --- /dev/null +++ b/docs/pages/GPUComputationRenderer.html.md @@ -0,0 +1,243 @@ +# GPUComputationRenderer + +GPUComputationRenderer, based on SimulationRenderer by @zz85. + +The GPUComputationRenderer uses the concept of variables. These variables are RGBA float textures that hold 4 floats for each compute element (texel). + +Each variable has a fragment shader that defines the computation made to obtain the variable in question. You can use as many variables you need, and make dependencies so you can use textures of other variables in the shader (the sampler uniforms are added automatically) Most of the variables will need themselves as dependency. + +The renderer has actually two render targets per variable, to make ping-pong. Textures from the current frame are used as inputs to render the textures of the next frame. + +The render targets of the variables can be used as input textures for your visualization shaders. + +Variable names should be valid identifiers and should not collide with THREE GLSL used identifiers. a common approach could be to use 'texture' prefixing the variable name; i.e texturePosition, textureVelocity... + +The size of the computation (sizeX \* sizeY) is defined as 'resolution' automatically in the shader. For example: + +Basic use: + +```js +// Initialization... +// Create computation renderer +const gpuCompute = new GPUComputationRenderer( 1024, 1024, renderer ); +// Create initial state float textures +const pos0 = gpuCompute.createTexture(); +const vel0 = gpuCompute.createTexture(); +// and fill in here the texture data... +// Add texture variables +const velVar = gpuCompute.addVariable( "textureVelocity", fragmentShaderVel, vel0 ); +const posVar = gpuCompute.addVariable( "texturePosition", fragmentShaderPos, pos0 ); +// Add variable dependencies +gpuCompute.setVariableDependencies( velVar, [ velVar, posVar ] ); +gpuCompute.setVariableDependencies( posVar, [ velVar, posVar ] ); +// Add custom uniforms +velVar.material.uniforms.time = { value: 0.0 }; +// Check for completeness +const error = gpuCompute.init(); +if ( error !== null ) { + console.error( error ); +} +// In each frame... +// Compute! +gpuCompute.compute(); +// Update texture uniforms in your visualization materials with the gpu renderer output +myMaterial.uniforms.myTexture.value = gpuCompute.getCurrentRenderTarget( posVar ).texture; +// Do your rendering +renderer.render( myScene, myCamera ); +``` + +Also, you can use utility functions to create ShaderMaterial and perform computations (rendering between textures) Note that the shaders can have multiple input textures. + +```js +const myFilter1 = gpuCompute.createShaderMaterial( myFilterFragmentShader1, { theTexture: { value: null } } ); +const myFilter2 = gpuCompute.createShaderMaterial( myFilterFragmentShader2, { theTexture: { value: null } } ); +const inputTexture = gpuCompute.createTexture(); +// Fill in here inputTexture... +myFilter1.uniforms.theTexture.value = inputTexture; +const myRenderTarget = gpuCompute.createRenderTarget(); +myFilter2.uniforms.theTexture.value = myRenderTarget.texture; +const outputRenderTarget = gpuCompute.createRenderTarget(); +// Now use the output texture where you want: +myMaterial.uniforms.map.value = outputRenderTarget.texture; +// And compute each frame, before rendering to screen: +gpuCompute.doRenderTarget( myFilter1, myRenderTarget ); +gpuCompute.doRenderTarget( myFilter2, outputRenderTarget ); +``` + +## Code Example + +```js +#DEFINE resolution vec2( 1024.0, 1024.0 ) +``` + +## Import + +GPUComputationRenderer is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; +``` + +## Constructor + +### new GPUComputationRenderer( sizeX : number, sizeY : number, renderer : WebGLRenderer ) + +Constructs a new GPU computation renderer. + +**sizeX** + +Computation problem size is always 2d: sizeX \* sizeY elements. + +**sizeY** + +Computation problem size is always 2d: sizeX \* sizeY elements. + +**renderer** + +The renderer. + +## Properties + +### .addResolutionDefine + +Adds a resolution defined for the given material shader. + +## Methods + +### .addVariable( variableName : string, computeFragmentShader : string, initialValueTexture : Texture ) : Object + +Adds a compute variable to the renderer. + +**variableName** + +The variable name. + +**computeFragmentShader** + +The compute (fragment) shader source. + +**initialValueTexture** + +The initial value texture. + +**Returns:** The compute variable. + +### .compute() + +Executes the compute. This method is usually called in the animation loop. + +### .createRenderTarget( sizeXTexture : number, sizeYTexture : number, wrapS : number, wrapT : number, minFilter : number, magFilter : number ) : WebGLRenderTarget + +Creates a new render target from the given parameters. + +**sizeXTexture** + +The width of the render target. + +**sizeYTexture** + +The height of the render target. + +**wrapS** + +The wrapS value. + +**wrapT** + +The wrapS value. + +**minFilter** + +The minFilter value. + +**magFilter** + +The magFilter value. + +**Returns:** The new render target. + +### .createTexture() : DataTexture + +Creates a new data texture. + +**Returns:** The new data texture. + +### .dispose() + +Frees all internal resources. Call this method if you don't need the renderer anymore. + +### .doRenderTarget( material : Material, output : WebGLRenderTarget ) + +Renders the given material into the given render target with a full-screen pass. + +**material** + +The material. + +**output** + +The output. + +### .getAlternateRenderTarget( variable : Object ) : WebGLRenderTarget + +Returns the alternate render target for the given compute variable. + +**variable** + +The compute variable. + +**Returns:** The alternate render target. + +### .getCurrentRenderTarget( variable : Object ) : WebGLRenderTarget + +Returns the current render target for the given compute variable. + +**variable** + +The compute variable. + +**Returns:** The current render target. + +### .init() : string + +Initializes the renderer. + +**Returns:** Returns `null` if no errors are detected. Otherwise returns the error message. + +### .renderTexture( input : Texture, output : WebGLRenderTarget ) + +Renders the given texture into the given render target. + +**input** + +The input. + +**output** + +The output. + +### .setDataType( type : FloatType | HalfFloatType ) : GPUComputationRenderer + +Sets the data type of the internal textures. + +**type** + +The type to set. + +**Returns:** A reference to this renderer. + +### .setVariableDependencies( variable : Object, dependencies : Array. ) + +Sets variable dependencies. + +**variable** + +The compute variable. + +**dependencies** + +Other compute variables that represents the dependencies. + +## Source + +[examples/jsm/misc/GPUComputationRenderer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/GPUComputationRenderer.js) \ No newline at end of file diff --git a/docs/pages/GTAONode.html.md b/docs/pages/GTAONode.html.md new file mode 100644 index 00000000000000..dcd757c81398a9 --- /dev/null +++ b/docs/pages/GTAONode.html.md @@ -0,0 +1,159 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# GTAONode + +Post processing node for applying Ground Truth Ambient Occlusion (GTAO) to a scene. + +Reference: [Practical Real-Time Strategies for Accurate Indirect Occlusion](https://www.activision.com/cdn/research/Practical_Real_Time_Strategies_for_Accurate_Indirect_Occlusion_NEW%20VERSION_COLOR.pdf). + +## Code Example + +```js +const postProcessing = new THREE.PostProcessing( renderer ); +const scenePass = pass( scene, camera ); +scenePass.setMRT( mrt( { + output: output, + normal: normalView +} ) ); +const scenePassColor = scenePass.getTextureNode( 'output' ); +const scenePassNormal = scenePass.getTextureNode( 'normal' ); +const scenePassDepth = scenePass.getTextureNode( 'depth' ); +const aoPass = ao( scenePassDepth, scenePassNormal, camera ); +postProcessing.outputNod = aoPass.getTextureNode().mul( scenePassColor ); +``` + +## Import + +GTAONode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ao } from 'three/addons/tsl/display/GTAONode.js'; +``` + +## Constructor + +### new GTAONode( depthNode : Node., normalNode : Node., camera : Camera ) + +Constructs a new GTAO node. + +**depthNode** + +A node that represents the scene's depth. + +**normalNode** + +A node that represents the scene's normals. + +**camera** + +The camera the scene is rendered with. + +## Properties + +### .depthNode : Node. + +A node that represents the scene's depth. + +### .distanceExponent : UniformNode. + +Another option to tweak the occlusion. The recommended range is `[1,2]` for attenuating the AO. + +### .distanceFallOff : UniformNode. + +The distance fall off value of the ambient occlusion. A lower value leads to a larger AO effect. The value should lie in the range `[0,1]`. + +### .normalNode : Node. + +A node that represents the scene's normals. If no normals are passed to the constructor (because MRT is not available), normals can be automatically reconstructed from depth values in the shader. + +### .radius : UniformNode. + +The radius of the ambient occlusion. + +### .resolution : UniformNode. + +The resolution of the effect. Can be scaled via `resolutionScale`. + +### .resolutionScale : number + +The resolution scale. By default the effect is rendered in full resolution for best quality but a value of `0.5` should be sufficient for most scenes. + +Default is `1`. + +### .samples : UniformNode. + +How many samples are used to compute the AO. A higher value results in better quality but also in a more expensive runtime behavior. + +### .scale : UniformNode. + +The scale of the ambient occlusion. + +### .thickness : UniformNode. + +The thickness of the ambient occlusion. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +### .useTemporalFiltering : boolean + +Whether to use temporal filtering or not. Setting this property to `true` requires the usage of `TRAANode`. This will help to reduce noise although it introduces typical TAA artifacts like ghosting and temporal instabilities. + +If setting this property to `false`, a manual denoise via `DenoiseNode` might be required. + +Default is `false`. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/GTAONode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/GTAONode.js) \ No newline at end of file diff --git a/docs/pages/GTAOPass.html.md b/docs/pages/GTAOPass.html.md new file mode 100644 index 00000000000000..1cf6cbfeb3ff96 --- /dev/null +++ b/docs/pages/GTAOPass.html.md @@ -0,0 +1,213 @@ +*Inheritance: Pass →* + +# GTAOPass + +A pass for an GTAO effect. + +`GTAOPass` provides better quality than [SSAOPass](SSAOPass.html) but is also more expensive. + +## Code Example + +```js +const gtaoPass = new GTAOPass( scene, camera, width, height ); +gtaoPass.output = GTAOPass.OUTPUT.Denoise; +composer.addPass( gtaoPass ); +``` + +## Import + +GTAOPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GTAOPass } from 'three/addons/postprocessing/GTAOPass.js'; +``` + +## Constructor + +### new GTAOPass( scene : Scene, camera : Camera, width : number, height : number, parameters : Object, aoParameters : Object, pdParameters : Object ) + +Constructs a new GTAO pass. + +**scene** + +The scene to compute the AO for. + +**camera** + +The camera. + +**width** + +The width of the effect. + +Default is `512`. + +**height** + +The height of the effect. + +Default is `512`. + +**parameters** + +The pass parameters. + +**aoParameters** + +The AO parameters. + +**pdParameters** + +The denoise parameters. + +## Properties + +### .blendIntensity : number + +The AO blend intensity. + +Default is `1`. + +### .camera : Camera + +The camera. + +### .clear : boolean + +Overwritten to perform a clear operation by default. + +Default is `true`. + +**Overrides:** [Pass#clear](Pass.html#clear) + +### .gtaoMap : Texture (readonly) + +A texture holding the computed AO. + +### .height : number + +The height of the effect. + +Default is `512`. + +### .output : number + +The output configuration. + +Default is `0`. + +### .pdRadiusExponent : number + +The Poisson Denoise radius exponent. + +Default is `2`. + +### .pdRings : number + +The number of Poisson Denoise rings. + +Default is `2`. + +### .pdSamples : number + +The Poisson Denoise sample count. + +Default is `16`. + +### .scene : Scene + +The scene to render the AO for. + +### .width : number + +The width of the effect. + +Default is `512`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the GTAO pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setGBuffer( depthTexture : DepthTexture, normalTexture : DepthTexture ) + +Configures the GBuffer of this pass. If no arguments are passed, the pass creates an internal render target for holding depth and normal data. + +**depthTexture** + +The depth texture. + +**normalTexture** + +The normal texture. + +### .setSceneClipBox( box : Box3 ) + +Configures the clip box of the GTAO shader with the given AABB. + +**box** + +The AABB enclosing the scene that should receive AO. When passing `null`, to clip box is used. + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +### .updateGtaoMaterial( parameters : Object ) + +Updates the GTAO material from the given parameter object. + +**parameters** + +The GTAO material parameters. + +### .updatePdMaterial( parameters : Object ) + +Updates the Denoise material from the given parameter object. + +**parameters** + +The denoise parameters. + +## Source + +[examples/jsm/postprocessing/GTAOPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/GTAOPass.js) \ No newline at end of file diff --git a/docs/pages/GaussianBlurNode.html.md b/docs/pages/GaussianBlurNode.html.md new file mode 100644 index 00000000000000..3778612840dbc1 --- /dev/null +++ b/docs/pages/GaussianBlurNode.html.md @@ -0,0 +1,145 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# GaussianBlurNode + +Post processing node for creating a gaussian blur effect. + +## Import + +GaussianBlurNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { gaussianBlur, premultipliedGaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; +``` + +## Constructor + +### new GaussianBlurNode( textureNode : TextureNode, directionNode : Node.<(vec2|float)>, sigma : number, options : Object ) + +Constructs a new gaussian blur node. + +**textureNode** + +The texture node that represents the input of the effect. + +**directionNode** + +Defines the direction and radius of the blur. + +Default is `null`. + +**sigma** + +Controls the kernel of the blur filter. Higher values mean a wider blur radius. + +Default is `4`. + +**options** + +Additional options for the gaussian blur effect. + +Default is `{}`. + +**premultipliedAlpha** + +Whether to use premultiplied alpha for the blur effect. + +Default is `false`. + +**resolutionScale** + +The resolution of the effect. 0.5 means half the resolution of the texture node. + +Default is `1`. + +## Properties + +### .directionNode : Node.<(vec2|float)> + +Defines the direction and radius of the blur. + +### .premultipliedAlpha : boolean + +Whether the effect should use premultiplied alpha or not. Set this to `true` if you are going to blur texture input with transparency. + +Default is `false`. + +### .resolution : Vector2 + +The resolution scale. + +Default is `{(1,1)}`. + +**Deprecated:** Yes + +### .resolutionScale : number + +The resolution scale. + +Default is `(1)`. + +### .sigma : number + +Controls the kernel of the blur filter. Higher values mean a wider blur radius. + +### .textureNode : TextureNode + +The texture node that represents the input of the effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/GaussianBlurNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/GaussianBlurNode.js) \ No newline at end of file diff --git a/docs/pages/GlitchPass.html.md b/docs/pages/GlitchPass.html.md new file mode 100644 index 00000000000000..c1be4fbaabc55e --- /dev/null +++ b/docs/pages/GlitchPass.html.md @@ -0,0 +1,86 @@ +*Inheritance: Pass →* + +# GlitchPass + +Pass for creating a glitch effect. + +## Code Example + +```js +const glitchPass = new GlitchPass(); +composer.addPass( glitchPass ); +``` + +## Import + +GlitchPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GlitchPass } from 'three/addons/postprocessing/GlitchPass.js'; +``` + +## Constructor + +### new GlitchPass( dt_size : number ) + +Constructs a new glitch pass. + +**dt\_size** + +The size of the displacement texture for digital glitch squares. + +Default is `64`. + +## Properties + +### .goWild : boolean + +Whether to noticeably increase the effect intensity or not. + +Default is `false`. + +### .material : ShaderMaterial + +The pass material. + +### .uniforms : Object + +The pass uniforms. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the glitch pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/GlitchPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/GlitchPass.js) \ No newline at end of file diff --git a/docs/pages/GrannyKnot.html.md b/docs/pages/GrannyKnot.html.md new file mode 100644 index 00000000000000..39bbed015da2ce --- /dev/null +++ b/docs/pages/GrannyKnot.html.md @@ -0,0 +1,39 @@ +*Inheritance: Curve →* + +# GrannyKnot + +A Granny Knot curve. + +## Import + +GrannyKnot is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GrannyKnot } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new GrannyKnot() + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/GridHelper.html.md b/docs/pages/GridHelper.html.md new file mode 100644 index 00000000000000..be970461b431ef --- /dev/null +++ b/docs/pages/GridHelper.html.md @@ -0,0 +1,54 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# GridHelper + +The helper is an object to define grids. Grids are two-dimensional arrays of lines. + +## Code Example + +```js +const size = 10; +const divisions = 10; +const gridHelper = new THREE.GridHelper( size, divisions ); +scene.add( gridHelper ); +``` + +## Constructor + +### new GridHelper( size : number, divisions : number, color1 : number | Color | string, color2 : number | Color | string ) + +Constructs a new grid helper. + +**size** + +The size of the grid. + +Default is `10`. + +**divisions** + +The number of divisions across the grid. + +Default is `10`. + +**color1** + +The color of the center line. + +Default is `0x444444`. + +**color2** + +The color of the lines of the grid. + +Default is `0x888888`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[src/helpers/GridHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/GridHelper.js) \ No newline at end of file diff --git a/docs/pages/GroundedSkybox.html.md b/docs/pages/GroundedSkybox.html.md new file mode 100644 index 00000000000000..a619fa8bea76d0 --- /dev/null +++ b/docs/pages/GroundedSkybox.html.md @@ -0,0 +1,52 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# GroundedSkybox + +A ground-projected skybox. + +By default the object is centered at the camera, so it is often helpful to set `skybox.position.y = height` to put the ground at the origin. + +## Code Example + +```js +const height = 15, radius = 100; +const skybox = new GroundedSkybox( envMap, height, radius ); +skybox.position.y = height; +scene.add( skybox ); +``` + +## Import + +GroundedSkybox is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GroundedSkybox } from 'three/addons/objects/GroundedSkybox.js'; +``` + +## Constructor + +### new GroundedSkybox( map : Texture, height : number, radius : number, resolution : number ) + +Constructs a new ground-projected skybox. + +**map** + +The environment map to use. + +**height** + +The height is how far the camera that took the photo was above the ground. A larger value will magnify the downward part of the image. + +**radius** + +The radius of the skybox. Must be large enough to ensure the scene's camera stays inside. + +**resolution** + +The geometry resolution of the skybox. + +Default is `128`. + +## Source + +[examples/jsm/objects/GroundedSkybox.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/GroundedSkybox.js) \ No newline at end of file diff --git a/docs/pages/Group.html.md b/docs/pages/Group.html.md new file mode 100644 index 00000000000000..fe4e575f18346e --- /dev/null +++ b/docs/pages/Group.html.md @@ -0,0 +1,32 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Group + +This is almost identical to an [Object3D](Object3D.html). Its purpose is to make working with groups of objects syntactically clearer. + +## Code Example + +```js +// Create a group and add the two cubes. +// These cubes can now be rotated / scaled etc as a group. +const group = new THREE.Group(); +group.add( meshA ); +group.add( meshB ); +scene.add( group ); +``` + +## Constructor + +### new Group() + +## Properties + +### .isGroup : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/objects/Group.js](https://github.com/mrdoob/three.js/blob/master/src/objects/Group.js) \ No newline at end of file diff --git a/docs/pages/Gyroscope.html.md b/docs/pages/Gyroscope.html.md new file mode 100644 index 00000000000000..b37dcc6c0a3e7a --- /dev/null +++ b/docs/pages/Gyroscope.html.md @@ -0,0 +1,23 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Gyroscope + +A special type of 3D object that takes a position from the scene graph hierarchy but uses its local rotation as world rotation. It works like real-world gyroscope - you can move it around using hierarchy while its orientation stays fixed with respect to the world. + +## Import + +Gyroscope is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Gyroscope } from 'three/addons/misc/Gyroscope.js'; +``` + +## Constructor + +### new Gyroscope() + +Constructs a new gyroscope. + +## Source + +[examples/jsm/misc/Gyroscope.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/Gyroscope.js) \ No newline at end of file diff --git a/docs/pages/HDRCubeTextureLoader.html.md b/docs/pages/HDRCubeTextureLoader.html.md new file mode 100644 index 00000000000000..aee8ef1289fece --- /dev/null +++ b/docs/pages/HDRCubeTextureLoader.html.md @@ -0,0 +1,85 @@ +*Inheritance: Loader →* + +# HDRCubeTextureLoader + +A loader for loading HDR cube textures. + +## Code Example + +```js +const loader = new HDRCubeTextureLoader(); +loader.setPath( 'textures/cube/pisaHDR/' ); +const cubeTexture = await loader.loadAsync( [ 'px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr' ] ); +scene.background = cubeTexture; +scene.environment = cubeTexture; +``` + +## Import + +HDRCubeTextureLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; +``` + +## Constructor + +### new HDRCubeTextureLoader( manager : LoadingManager ) + +Constructs a new HDR cube texture loader. + +**manager** + +The loading manager. + +## Properties + +### .hdrLoader : HDRLoader + +The internal HDR loader that loads the individual textures for each cube face. + +### .type : HalfFloatType | FloatType + +The texture type. + +Default is `HalfFloatType`. + +## Methods + +### .load( urls : Array., onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : CubeTexture + +Starts loading from the given URLs and passes the loaded HDR cube texture to the `onLoad()` callback. + +**urls** + +The paths/URLs of the files to be loaded. This can also be a data URIs. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The HDR cube texture. + +### .setDataType( value : HalfFloatType | FloatType ) : HDRCubeTextureLoader + +Sets the texture type. + +**value** + +The texture type to set. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/HDRCubeTextureLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/HDRCubeTextureLoader.js) \ No newline at end of file diff --git a/docs/pages/HDRLoader.html.md b/docs/pages/HDRLoader.html.md new file mode 100644 index 00000000000000..849d2a6737f4f6 --- /dev/null +++ b/docs/pages/HDRLoader.html.md @@ -0,0 +1,68 @@ +*Inheritance: Loader → DataTextureLoader →* + +# HDRLoader + +A loader for the RGBE HDR texture format. + +## Code Example + +```js +const loader = new HDRLoader(); +const envMap = await loader.loadAsync( 'textures/equirectangular/blouberg_sunrise_2_1k.hdr' ); +envMap.mapping = THREE.EquirectangularReflectionMapping; +scene.environment = envMap; +``` + +## Import + +HDRLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +``` + +## Constructor + +### new HDRLoader( manager : LoadingManager ) + +Constructs a new RGBE/HDR loader. + +**manager** + +The loading manager. + +## Properties + +### .type : HalfFloatType | FloatType + +The texture type. + +Default is `HalfFloatType`. + +## Methods + +### .parse( buffer : ArrayBuffer ) : DataTextureLoader~TexData + +Parses the given RGBE texture data. + +**buffer** + +The raw texture data. + +**Overrides:** [DataTextureLoader#parse](DataTextureLoader.html#parse) + +**Returns:** An object representing the parsed texture data. + +### .setDataType( value : HalfFloatType | FloatType ) : HDRLoader + +Sets the texture type. + +**value** + +The texture type to set. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/HDRLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/HDRLoader.js) \ No newline at end of file diff --git a/docs/pages/HTMLMesh.html.md b/docs/pages/HTMLMesh.html.md new file mode 100644 index 00000000000000..8450df02e93bbb --- /dev/null +++ b/docs/pages/HTMLMesh.html.md @@ -0,0 +1,43 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# HTMLMesh + +This class can be used to render a DOM element onto a canvas and use it as a texture for a plane mesh. + +A typical use case for this class is to render the GUI of `lil-gui` as a texture so it is compatible for VR. + +## Code Example + +```js +const gui = new GUI( { width: 300 } ); // create lil-gui instance +const mesh = new HTMLMesh( gui.domElement ); +scene.add( mesh ); +``` + +## Import + +HTMLMesh is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js'; +``` + +## Constructor + +### new HTMLMesh( dom : HTMLElement ) + +Constructs a new HTML mesh. + +**dom** + +The DOM element to display as a plane mesh. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance and removes all event listeners. Call this method whenever this instance is no longer used in your app. + +## Source + +[examples/jsm/interactive/HTMLMesh.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/interactive/HTMLMesh.js) \ No newline at end of file diff --git a/docs/pages/HalftonePass.html.md b/docs/pages/HalftonePass.html.md new file mode 100644 index 00000000000000..b38b4132020044 --- /dev/null +++ b/docs/pages/HalftonePass.html.md @@ -0,0 +1,104 @@ +*Inheritance: Pass →* + +# HalftonePass + +Pass for creating a RGB halftone effect. + +## Code Example + +```js +const params = { + shape: 1, + radius: 4, + rotateR: Math.PI / 12, + rotateB: Math.PI / 12 * 2, + rotateG: Math.PI / 12 * 3, + scatter: 0, + blending: 1, + blendingMode: 1, + greyscale: false, + disable: false +}; +const halftonePass = new HalftonePass( params ); +composer.addPass( halftonePass ); +``` + +## Import + +HalftonePass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HalftonePass } from 'three/addons/postprocessing/HalftonePass.js'; +``` + +## Constructor + +### new HalftonePass( params : Object ) + +Constructs a new halftone pass. + +**params** + +The halftone shader parameter. + +## Properties + +### .material : ShaderMaterial + +The pass material. + +### .uniforms : Object + +The pass uniforms. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the halftone pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/HalftonePass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/HalftonePass.js) \ No newline at end of file diff --git a/docs/pages/HeartCurve.html.md b/docs/pages/HeartCurve.html.md new file mode 100644 index 00000000000000..daf367cf0f97c0 --- /dev/null +++ b/docs/pages/HeartCurve.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# HeartCurve + +A heart curve. + +## Import + +HeartCurve is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HeartCurve } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new HeartCurve( scale : number ) + +Constructs a new heart curve. + +**scale** + +The curve's scale. + +Default is `5`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `5`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/HelixCurve.html.md b/docs/pages/HelixCurve.html.md new file mode 100644 index 00000000000000..431088035d829d --- /dev/null +++ b/docs/pages/HelixCurve.html.md @@ -0,0 +1,39 @@ +*Inheritance: Curve →* + +# HelixCurve + +A helix curve. + +## Import + +HelixCurve is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HelixCurve } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new HelixCurve() + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/HemisphereLight.html.md b/docs/pages/HemisphereLight.html.md new file mode 100644 index 00000000000000..a670ed1a01cbc5 --- /dev/null +++ b/docs/pages/HemisphereLight.html.md @@ -0,0 +1,54 @@ +*Inheritance: EventDispatcher → Object3D → Light →* + +# HemisphereLight + +A light source positioned directly above the scene, with color fading from the sky color to the ground color. + +This light cannot be used to cast shadows. + +## Code Example + +```js +const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 ); +scene.add( light ); +``` + +## Constructor + +### new HemisphereLight( skyColor : number | Color | string, groundColor : number | Color | string, intensity : number ) + +Constructs a new hemisphere light. + +**skyColor** + +The light's sky color. + +Default is `0xffffff`. + +**groundColor** + +The light's ground color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity. + +Default is `1`. + +## Properties + +### .groundColor : Color + +The light's ground color. + +### .isHemisphereLight : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/lights/HemisphereLight.js](https://github.com/mrdoob/three.js/blob/master/src/lights/HemisphereLight.js) \ No newline at end of file diff --git a/docs/pages/HemisphereLightHelper.html.md b/docs/pages/HemisphereLightHelper.html.md new file mode 100644 index 00000000000000..25f455bc7d86b1 --- /dev/null +++ b/docs/pages/HemisphereLightHelper.html.md @@ -0,0 +1,57 @@ +*Inheritance: EventDispatcher → Object3D →* + +# HemisphereLightHelper + +Creates a visual aid consisting of a spherical mesh for a given [HemisphereLight](HemisphereLight.html). + +## Code Example + +```js +const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 ); +const helper = new THREE.HemisphereLightHelper( light, 5 ); +scene.add( helper ); +``` + +## Constructor + +### new HemisphereLightHelper( light : HemisphereLight, size : number, color : number | Color | string ) + +Constructs a new hemisphere light helper. + +**light** + +The light to be visualized. + +**size** + +The size of the mesh used to visualize the light. + +Default is `1`. + +**color** + +The helper's color. If not set, the helper will take the color of the light. + +## Properties + +### .color : number | Color | string + +The color parameter passed in the constructor. If not set, the helper will take the color of the light. + +### .light : HemisphereLight + +The light being visualized. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the helper to match the position and direction of the light being visualized. + +## Source + +[src/helpers/HemisphereLightHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/HemisphereLightHelper.js) \ No newline at end of file diff --git a/docs/pages/HemisphereLightNode.html.md b/docs/pages/HemisphereLightNode.html.md new file mode 100644 index 00000000000000..61e523f81070c5 --- /dev/null +++ b/docs/pages/HemisphereLightNode.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode →* + +# HemisphereLightNode + +Module for representing hemisphere lights as nodes. + +## Constructor + +### new HemisphereLightNode( light : HemisphereLight ) + +Constructs a new hemisphere light node. + +**light** + +The hemisphere light source. + +Default is `null`. + +## Properties + +### .groundColorNode : UniformNode. + +Uniform node representing the light's ground color. + +### .lightDirectionNode : Node. + +A node representing the light's direction. + +### .lightPositionNode : UniformNode. + +Uniform node representing the light's position. + +## Methods + +### .update( frame : NodeFrame ) + +Overwritten to updated hemisphere light specific uniforms. + +**frame** + +A reference to the current node frame. + +**Overrides:** [AnalyticLightNode#update](AnalyticLightNode.html#update) + +## Source + +[src/nodes/lighting/HemisphereLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/HemisphereLightNode.js) \ No newline at end of file diff --git a/docs/pages/IESLoader.html.md b/docs/pages/IESLoader.html.md new file mode 100644 index 00000000000000..0189fa83dea2d1 --- /dev/null +++ b/docs/pages/IESLoader.html.md @@ -0,0 +1,82 @@ +*Inheritance: Loader →* + +# IESLoader + +A loader for the IES format. + +The loaded texture should be assigned to [IESSpotLight#map](IESSpotLight.html#map). + +## Code Example + +```js +const loader = new IESLoader(); +const texture = await loader.loadAsync( 'ies/007cfb11e343e2f42e3b476be4ab684e.ies' ); +const spotLight = new THREE.IESSpotLight( 0xff0000, 500 ); +spotLight.iesMap = texture; +``` + +## Import + +IESLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { IESLoader } from 'three/addons/loaders/IESLoader.js'; +``` + +## Constructor + +### new IESLoader( manager : LoadingManager ) + +Constructs a new IES loader. + +**manager** + +The loading manager. + +## Properties + +### .type : HalfFloatType | FloatType + +The texture type. + +Default is `HalfFloatType`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded IES texture to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string ) : DataTexture + +Parses the given IES data. + +**text** + +The raw IES data. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** THE IES data as a texture. + +## Source + +[examples/jsm/loaders/IESLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/IESLoader.js) \ No newline at end of file diff --git a/docs/pages/IESSpotLight.html.md b/docs/pages/IESSpotLight.html.md new file mode 100644 index 00000000000000..80e383bd9e4c93 --- /dev/null +++ b/docs/pages/IESSpotLight.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Object3D → Light → SpotLight →* + +# IESSpotLight + +A IES version of [SpotLight](SpotLight.html). Can only be used with [WebGPURenderer](WebGPURenderer.html). + +## Constructor + +### new IESSpotLight( color : number | Color | string, intensity : number, distance : number, angle : number, penumbra : number, decay : number ) + +Constructs a new IES spot light. + +**color** + +The light's color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity measured in candela (cd). + +Default is `1`. + +**distance** + +Maximum range of the light. `0` means no limit. + +Default is `0`. + +**angle** + +Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`. + +Default is `Math.PI/3`. + +**penumbra** + +Percent of the spotlight cone that is attenuated due to penumbra. Value range is `[0,1]`. + +Default is `0`. + +**decay** + +The amount the light dims along the distance of the light. + +Default is `2`. + +## Properties + +### .iesMap : Texture + +TODO + +Default is `null`. + +## Source + +[src/lights/webgpu/IESSpotLight.js](https://github.com/mrdoob/three.js/blob/master/src/lights/webgpu/IESSpotLight.js) \ No newline at end of file diff --git a/docs/pages/IESSpotLightNode.html.md b/docs/pages/IESSpotLightNode.html.md new file mode 100644 index 00000000000000..f22172618c8ea1 --- /dev/null +++ b/docs/pages/IESSpotLightNode.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode → SpotLightNode →* + +# IESSpotLightNode + +An IES version of the default spot light node. + +## Constructor + +### new IESSpotLightNode() + +## Methods + +### .getSpotAttenuation( builder : NodeBuilder, angleCosine : Node. ) : Node. + +Overwrites the default implementation to compute an IES conform spot attenuation. + +**builder** + +The node builder. + +**angleCosine** + +The angle to compute the spot attenuation for. + +**Overrides:** [SpotLightNode#getSpotAttenuation](SpotLightNode.html#getSpotAttenuation) + +**Returns:** The spot attenuation. + +## Source + +[src/nodes/lighting/IESSpotLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/IESSpotLightNode.js) \ No newline at end of file diff --git a/docs/pages/IcosahedronGeometry.html.md b/docs/pages/IcosahedronGeometry.html.md new file mode 100644 index 00000000000000..d02c40963724ed --- /dev/null +++ b/docs/pages/IcosahedronGeometry.html.md @@ -0,0 +1,56 @@ +*Inheritance: EventDispatcher → BufferGeometry → PolyhedronGeometry →* + +# IcosahedronGeometry + +A geometry class for representing an icosahedron. + +## Code Example + +```js +const geometry = new THREE.IcosahedronGeometry(); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const icosahedron = new THREE.Mesh( geometry, material ); +scene.add( icosahedron ); +``` + +## Constructor + +### new IcosahedronGeometry( radius : number, detail : number ) + +Constructs a new icosahedron geometry. + +**radius** + +Radius of the icosahedron. + +Default is `1`. + +**detail** + +Setting this to a value greater than `0` adds vertices making it no longer a icosahedron. + +Default is `0`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +**Overrides:** [PolyhedronGeometry#parameters](PolyhedronGeometry.html#parameters) + +## Static Methods + +### .fromJSON( data : Object ) : IcosahedronGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/IcosahedronGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/IcosahedronGeometry.js) \ No newline at end of file diff --git a/docs/pages/ImageBitmapLoader.html.md b/docs/pages/ImageBitmapLoader.html.md new file mode 100644 index 00000000000000..73cebb788b597a --- /dev/null +++ b/docs/pages/ImageBitmapLoader.html.md @@ -0,0 +1,97 @@ +*Inheritance: Loader →* + +# ImageBitmapLoader + +A loader for loading images as an [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap). An `ImageBitmap` provides an asynchronous and resource efficient pathway to prepare textures for rendering. + +Note that [Texture#flipY](Texture.html#flipY) and [Texture#premultiplyAlpha](Texture.html#premultiplyAlpha) are ignored with image bitmaps. These options need to be configured via [ImageBitmapLoader#setOptions](ImageBitmapLoader.html#setOptions) prior to loading, unlike regular images which can be configured on the Texture to set these options on GPU upload instead. + +To match the default behaviour of [Texture](Texture.html), the following options are needed: + +Also note that unlike [FileLoader](FileLoader.html), this loader will only avoid multiple concurrent requests to the same URL if [Cache](Cache.html) is enabled. + +```js +const loader = new THREE.ImageBitmapLoader(); +loader.setOptions( { imageOrientation: 'flipY' } ); // set options if needed +const imageBitmap = await loader.loadAsync( 'image.png' ); +const texture = new THREE.Texture( imageBitmap ); +texture.needsUpdate = true; +``` + +## Code Example + +```js +{ imageOrientation: 'flipY', premultiplyAlpha: 'none' } +``` + +## Constructor + +### new ImageBitmapLoader( manager : LoadingManager ) + +Constructs a new image bitmap loader. + +**manager** + +The loading manager. + +## Properties + +### .isImageBitmapLoader : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .options : Object + +Represents the loader options. + +Default is `{premultiplyAlpha:'none'}`. + +## Methods + +### .abort() : ImageBitmapLoader + +Aborts ongoing fetch requests. + +**Overrides:** [Loader#abort](Loader.html#abort) + +**Returns:** A reference to this instance. + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : ImageBitmap | undefined + +Starts loading from the given URL and pass the loaded image bitmap to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Unsupported in this loader. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The image bitmap. + +### .setOptions( options : Object ) : ImageBitmapLoader + +Sets the given loader options. The structure of the object must match the `options` parameter of [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap). + +**options** + +The loader options to set. + +**Returns:** A reference to this image bitmap loader. + +## Source + +[src/loaders/ImageBitmapLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/ImageBitmapLoader.js) \ No newline at end of file diff --git a/docs/pages/ImageLoader.html.md b/docs/pages/ImageLoader.html.md new file mode 100644 index 00000000000000..272a6cb395b28b --- /dev/null +++ b/docs/pages/ImageLoader.html.md @@ -0,0 +1,54 @@ +*Inheritance: Loader →* + +# ImageLoader + +A loader for loading images. The class loads images with the HTML `Image` API. + +Please note that `ImageLoader` has dropped support for progress events in `r84`. For an `ImageLoader` that supports progress events, see [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639). + +## Code Example + +```js +const loader = new THREE.ImageLoader(); +const image = await loader.loadAsync( 'image.png' ); +``` + +## Constructor + +### new ImageLoader( manager : LoadingManager ) + +Constructs a new image loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : Image + +Starts loading from the given URL and passes the loaded image to the `onLoad()` callback. The method also returns a new `Image` object which can directly be used for texture creation. If you do it this way, the texture may pop up in your scene once the respective loading process is finished. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Unsupported in this loader. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The image. + +## Source + +[src/loaders/ImageLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/ImageLoader.js) \ No newline at end of file diff --git a/docs/pages/ImageUtils.html.md b/docs/pages/ImageUtils.html.md new file mode 100644 index 00000000000000..a17638f3b42ae4 --- /dev/null +++ b/docs/pages/ImageUtils.html.md @@ -0,0 +1,35 @@ +# ImageUtils + +A class containing utility functions for images. + +## Static Methods + +### .getDataURL( image : HTMLImageElement | HTMLCanvasElement, type : string ) : string + +Returns a data URI containing a representation of the given image. + +**image** + +The image object. + +**type** + +Indicates the image format. + +Default is `'image/png'`. + +**Returns:** The data URI. + +### .sRGBToLinear( image : HTMLImageElement | HTMLCanvasElement | ImageBitmap | Object ) : HTMLCanvasElement | Object + +Converts the given sRGB image data to linear color space. + +**image** + +The image object. + +**Returns:** The converted image. + +## Source + +[src/extras/ImageUtils.js](https://github.com/mrdoob/three.js/blob/master/src/extras/ImageUtils.js) \ No newline at end of file diff --git a/docs/pages/ImprovedNoise.html.md b/docs/pages/ImprovedNoise.html.md new file mode 100644 index 00000000000000..5ee85ba3152a01 --- /dev/null +++ b/docs/pages/ImprovedNoise.html.md @@ -0,0 +1,41 @@ +# ImprovedNoise + +A utility class providing a 3D noise function. + +The code is based on [IMPROVED NOISE](https://cs.nyu.edu/~perlin/noise/) by Ken Perlin, 2002. + +## Import + +ImprovedNoise is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; +``` + +## Constructor + +### new ImprovedNoise() + +## Methods + +### .noise( x : number, y : number, z : number ) : number + +Returns a noise value for the given parameters. + +**x** + +The x coordinate. + +**y** + +The y coordinate. + +**z** + +The z coordinate. + +**Returns:** The noise value. + +## Source + +[examples/jsm/math/ImprovedNoise.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/ImprovedNoise.js) \ No newline at end of file diff --git a/docs/pages/IndexNode.html.md b/docs/pages/IndexNode.html.md new file mode 100644 index 00000000000000..d1799cdadc1249 --- /dev/null +++ b/docs/pages/IndexNode.html.md @@ -0,0 +1,38 @@ +*Inheritance: EventDispatcher → Node →* + +# IndexNode + +This class represents shader indices of different types. The following predefined node objects cover frequent use cases: + +* `vertexIndex`: The index of a vertex within a mesh. +* `instanceIndex`: The index of either a mesh instance or an invocation of a compute shader. +* `drawIndex`: The index of a draw call. +* `invocationLocalIndex`: The index of a compute invocation within the scope of a workgroup load. +* `invocationSubgroupIndex`: The index of a compute invocation within the scope of a subgroup. +* `subgroupIndex`: The index of a compute invocation's subgroup within its workgroup. + +## Constructor + +### new IndexNode( scope : 'vertex' | 'instance' | 'subgroup' | 'invocationLocal' | 'invocationGlobal' | 'invocationSubgroup' | 'draw' ) + +Constructs a new index node. + +**scope** + +The scope of the index node. + +## Properties + +### .isIndexNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .scope : string + +The scope of the index node. + +## Source + +[src/nodes/core/IndexNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/IndexNode.js) \ No newline at end of file diff --git a/docs/pages/IndirectStorageBufferAttribute.html.md b/docs/pages/IndirectStorageBufferAttribute.html.md new file mode 100644 index 00000000000000..a8c1cf85e6c800 --- /dev/null +++ b/docs/pages/IndirectStorageBufferAttribute.html.md @@ -0,0 +1,33 @@ +*Inheritance: BufferAttribute → StorageBufferAttribute →* + +# IndirectStorageBufferAttribute + +This special type of buffer attribute is intended for compute shaders. It can be used to encode draw parameters for indirect draw calls. + +Note: This type of buffer attribute can only be used with `WebGPURenderer` and a WebGPU backend. + +## Constructor + +### new IndirectStorageBufferAttribute( count : number | Uint32Array, itemSize : number ) + +Constructs a new storage buffer attribute. + +**count** + +The item count. It is also valid to pass a `Uint32Array` as an argument. The subsequent parameter is then obsolete. + +**itemSize** + +The item size. + +## Properties + +### .isIndirectStorageBufferAttribute : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/renderers/common/IndirectStorageBufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/IndirectStorageBufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Info.html.md b/docs/pages/Info.html.md new file mode 100644 index 00000000000000..3a538a6a29a7c4 --- /dev/null +++ b/docs/pages/Info.html.md @@ -0,0 +1,131 @@ +# Info + +This renderer module provides a series of statistical information about the GPU memory and the rendering process. Useful for debugging and monitoring. + +## Constructor + +### new Info() + +Constructs a new info component. + +## Properties + +### .autoReset : boolean + +Whether frame related metrics should automatically be resetted or not. This property should be set to `false` by apps which manage their own animation loop. They must then call `renderer.info.reset()` once per frame manually. + +Default is `true`. + +### .calls : number (readonly) + +The number of render calls since the app has been started. + +Default is `0`. + +### .compute : Object (readonly) + +Compute related metrics. + +**calls** +number + +The number of compute calls since the app has been started. + +**frameCalls** +number + +The number of compute calls of the current frame. + +**timestamp** +number + +The timestamp of the frame when using `renderer.computeAsync()`. + +### .frame : number (readonly) + +The current frame ID. This ID is managed by `NodeFrame`. + +Default is `0`. + +### .memory : Object (readonly) + +Memory related metrics. + +**geometries** +number + +The number of active geometries. + +**frameCalls** +number + +The number of active textures. + +### .render : Object (readonly) + +Render related metrics. + +**calls** +number + +The number of render calls since the app has been started. + +**frameCalls** +number + +The number of render calls of the current frame. + +**drawCalls** +number + +The number of draw calls of the current frame. + +**triangles** +number + +The number of rendered triangle primitives of the current frame. + +**points** +number + +The number of rendered point primitives of the current frame. + +**lines** +number + +The number of rendered line primitives of the current frame. + +**timestamp** +number + +The timestamp of the frame. + +## Methods + +### .dispose() + +Performs a complete reset of the object. + +### .reset() + +Resets frame related metrics. + +### .update( object : Object3D, count : number, instanceCount : number ) + +This method should be executed per draw call and updates the corresponding metrics. + +**object** + +The 3D object that is going to be rendered. + +**count** + +The vertex or index count. + +**instanceCount** + +The instance count. + +## Source + +[src/renderers/common/Info.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/Info.js) \ No newline at end of file diff --git a/docs/pages/InputNode.html.md b/docs/pages/InputNode.html.md new file mode 100644 index 00000000000000..c71bea1226c8ea --- /dev/null +++ b/docs/pages/InputNode.html.md @@ -0,0 +1,67 @@ +*Inheritance: EventDispatcher → Node →* + +# InputNode + +Base class for representing data input nodes. + +## Constructor + +### new InputNode( value : any, nodeType : string ) + +Constructs a new input node. + +**value** + +The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). + +**nodeType** + +The node type. If no explicit type is defined, the node tries to derive the type from its value. + +Default is `null`. + +## Properties + +### .isInputNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .precision : 'low' | 'medium' | 'high' + +The precision of the value in the shader. + +Default is `null`. + +### .value : any + +The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). + +## Methods + +### .getInputType( builder : NodeBuilder ) : string + +Returns the input type of the node which is by default the node type. Derived modules might overwrite this method and use a fixed type or compute one analytically. + +A typical example for different input and node types are textures. The input type of a normal RGBA texture is `texture` whereas its node type is `vec4`. + +**builder** + +The current node builder. + +**Returns:** The input type. + +### .setPrecision( precision : 'low' | 'medium' | 'high' ) : InputNode + +Sets the precision to the given value. The method can be overwritten in derived classes if the final precision must be computed analytically. + +**precision** + +The precision of the input value in the shader. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/core/InputNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/InputNode.js) \ No newline at end of file diff --git a/docs/pages/InspectorBase.html.md b/docs/pages/InspectorBase.html.md new file mode 100644 index 00000000000000..0e66f24825b642 --- /dev/null +++ b/docs/pages/InspectorBase.html.md @@ -0,0 +1,281 @@ +# InspectorBase + +### new InspectorBase() + +InspectorBase is the base class for all inspectors. + +## Properties + +### .currentFrame : Object + +The current frame being processed. + +### .nodeFrame + +Returns the node frame for the current renderer. + +## Methods + +### .begin() + +Called when a frame begins. + +### .beginCompute( uid : string, computeNode : ComputeNode ) + +Called when a compute operation begins. + +**uid** + +A unique identifier for the render context. + +**computeNode** + +The compute node being executed. + +### .beginRender( uid : string, scene : Scene, camera : Camera, renderTarget : WebGLRenderTarget ) + +Called when a render operation begins. + +**uid** + +A unique identifier for the render context. + +**scene** + +The scene being rendered. + +**camera** + +The camera being used for rendering. + +**renderTarget** + +The render target, if any. + +### .computeAsync( computeNode : ComputeNode, dispatchSizeOrCount : number | Array. ) + +When a compute operation is performed. + +**computeNode** + +The compute node being executed. + +**dispatchSizeOrCount** + +The dispatch size or count. + +### .copyFramebufferToTexture( framebufferTexture : Texture ) + +Called when a framebuffer copy operation is performed. + +**framebufferTexture** + +The texture associated with the framebuffer. + +### .copyTextureToTexture( srcTexture : Texture, dstTexture : Texture ) + +Called when a texture copy operation is performed. + +**srcTexture** + +The source texture. + +**dstTexture** + +The destination texture. + +### .finish() + +Called when a frame ends. + +### .finishCompute( uid : string, computeNode : ComputeNode ) + +Called when a compute operation ends. + +**uid** + +A unique identifier for the render context. + +**computeNode** + +The compute node being executed. + +### .finishRender( uid : string ) + +Called when an animation loop ends. + +**uid** + +A unique identifier for the render context. + +### .getRenderer() : WebGLRenderer + +Returns the renderer associated with this inspector. + +**Returns:** The associated renderer. + +### .init() + +Initializes the inspector. + +### .inspect( node : Node ) + +Inspects a node. + +**node** + +The node to inspect. + +### .setRenderer( renderer : WebGLRenderer ) : InspectorBase + +Sets the renderer for this inspector. + +**renderer** + +The renderer to associate with this inspector. + +**Returns:** This inspector instance. + +## Source + +[src/renderers/common/InspectorBase.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/InspectorBase.js) + +### new InspectorBase() + +Creates a new InspectorBase. + +## Properties + +### .currentFrame : Object + +The current frame being processed. + +### .nodeFrame + +Returns the node frame for the current renderer. + +## Methods + +### .begin() + +Called when a frame begins. + +### .beginCompute( uid : string, computeNode : ComputeNode ) + +Called when a compute operation begins. + +**uid** + +A unique identifier for the render context. + +**computeNode** + +The compute node being executed. + +### .beginRender( uid : string, scene : Scene, camera : Camera, renderTarget : WebGLRenderTarget ) + +Called when a render operation begins. + +**uid** + +A unique identifier for the render context. + +**scene** + +The scene being rendered. + +**camera** + +The camera being used for rendering. + +**renderTarget** + +The render target, if any. + +### .computeAsync( computeNode : ComputeNode, dispatchSizeOrCount : number | Array. ) + +When a compute operation is performed. + +**computeNode** + +The compute node being executed. + +**dispatchSizeOrCount** + +The dispatch size or count. + +### .copyFramebufferToTexture( framebufferTexture : Texture ) + +Called when a framebuffer copy operation is performed. + +**framebufferTexture** + +The texture associated with the framebuffer. + +### .copyTextureToTexture( srcTexture : Texture, dstTexture : Texture ) + +Called when a texture copy operation is performed. + +**srcTexture** + +The source texture. + +**dstTexture** + +The destination texture. + +### .finish() + +Called when a frame ends. + +### .finishCompute( uid : string, computeNode : ComputeNode ) + +Called when a compute operation ends. + +**uid** + +A unique identifier for the render context. + +**computeNode** + +The compute node being executed. + +### .finishRender( uid : string ) + +Called when an animation loop ends. + +**uid** + +A unique identifier for the render context. + +### .getRenderer() : WebGLRenderer + +Returns the renderer associated with this inspector. + +**Returns:** The associated renderer. + +### .init() + +Initializes the inspector. + +### .inspect( node : Node ) + +Inspects a node. + +**node** + +The node to inspect. + +### .setRenderer( renderer : WebGLRenderer ) : InspectorBase + +Sets the renderer for this inspector. + +**renderer** + +The renderer to associate with this inspector. + +**Returns:** This inspector instance. + +## Source + +[src/renderers/common/InspectorBase.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/InspectorBase.js) \ No newline at end of file diff --git a/docs/pages/InspectorNode.html.md b/docs/pages/InspectorNode.html.md new file mode 100644 index 00000000000000..d233147b42c6d1 --- /dev/null +++ b/docs/pages/InspectorNode.html.md @@ -0,0 +1,75 @@ +*Inheritance: EventDispatcher → Node →* + +# InspectorNode + +InspectorNode is a wrapper node that allows inspection of node values during rendering. It can be used to debug or analyze node outputs in the rendering pipeline. + +## Constructor + +### new InspectorNode( node : Node, name : string, callback : function | null ) + +Creates an InspectorNode. + +**node** + +The node to inspect. + +**name** + +Optional name for the inspector node. + +Default is `''`. + +**callback** + +Optional callback to modify the node during setup. + +Default is `null`. + +## Properties + +### .type + +Returns the type of the node. + +## Methods + +### .getName() : string + +Returns the name of the inspector node. + +### .getNodeType( builder : NodeBuilder ) : string + +Returns the type of the wrapped node. + +**builder** + +The node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +### .setup( builder : NodeBuilder ) : Node + +Sets up the inspector node. + +**builder** + +The node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The setup node. + +### .update( frame : NodeFrame ) + +Updates the inspector node, allowing inspection of the wrapped node. + +**frame** + +A reference to the current node frame. + +**Overrides:** [Node#update](Node.html#update) + +## Source + +[src/nodes/core/InspectorNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/InspectorNode.js) \ No newline at end of file diff --git a/docs/pages/InstanceNode.html.md b/docs/pages/InstanceNode.html.md new file mode 100644 index 00000000000000..6b7f7b78f6b771 --- /dev/null +++ b/docs/pages/InstanceNode.html.md @@ -0,0 +1,115 @@ +*Inheritance: EventDispatcher → Node →* + +# InstanceNode + +This node implements the vertex shader logic which is required when rendering 3D objects via instancing. The code makes sure vertex positions, normals and colors can be modified via instanced data. + +## Constructor + +### new InstanceNode( count : number, instanceMatrix : InstancedBufferAttribute | StorageInstancedBufferAttribute, instanceColor : InstancedBufferAttribute | StorageInstancedBufferAttribute ) + +Constructs a new instance node. + +**count** + +The number of instances. + +**instanceMatrix** + +Instanced buffer attribute representing the instance transformations. + +**instanceColor** + +Instanced buffer attribute representing the instance colors. + +Default is `null`. + +## Properties + +### .buffer : InstancedInterleavedBuffer + +A reference to a buffer that is used by `instanceMatrixNode`. + +### .bufferColor : InstancedBufferAttribute + +A reference to a buffer that is used by `instanceColorNode`. + +### .count : number + +The number of instances. + +### .instanceColor : InstancedBufferAttribute + +Instanced buffer attribute representing the color of instances. + +### .instanceColorNode : Node + +The node that represents the instance color data. + +Default is `null`. + +### .instanceMatrix : InstancedBufferAttribute + +Instanced buffer attribute representing the transformation of instances. + +### .instanceMatrixNode : Node + +The node that represents the instance matrix data. + +### .isStorageColor : boolean + +Tracks whether the color data is provided via a storage buffer. + +### .isStorageMatrix : boolean + +Tracks whether the matrix data is provided via a storage buffer. + +### .previousInstanceMatrixNode : Node + +The previous instance matrices. Required for computing motion vectors. + +Default is `null`. + +### .updateType : string + +The update type is set to `frame` since an update of instanced buffer data must be checked per frame. + +Default is `'frame'`. + +**Overrides:** [Node#updateType](Node.html#updateType) + +## Methods + +### .getPreviousInstancedPosition( builder : NodeBuilder ) : Node. + +Computes the transformed/instanced vertex position of the previous frame. + +**builder** + +The current node builder. + +**Returns:** The instanced position from the previous frame. + +### .setup( builder : NodeBuilder ) + +Setups the internal buffers and nodes and assigns the transformed vertex data to predefined node variables for accumulation. That follows the same patterns like with morph and skinning nodes. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +### .update( frame : NodeFrame ) + +Checks if the internal buffers require an update. + +**frame** + +The current node frame. + +**Overrides:** [Node#update](Node.html#update) + +## Source + +[src/nodes/accessors/InstanceNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/InstanceNode.js) \ No newline at end of file diff --git a/docs/pages/InstancedBufferAttribute.html.md b/docs/pages/InstancedBufferAttribute.html.md new file mode 100644 index 00000000000000..6fc2dcd51b9bba --- /dev/null +++ b/docs/pages/InstancedBufferAttribute.html.md @@ -0,0 +1,49 @@ +*Inheritance: BufferAttribute →* + +# InstancedBufferAttribute + +An instanced version of a buffer attribute. + +## Constructor + +### new InstancedBufferAttribute( array : TypedArray, itemSize : number, normalized : boolean, meshPerAttribute : number ) + +Constructs a new instanced buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +**meshPerAttribute** + +How often a value of this buffer attribute should be repeated. + +Default is `1`. + +## Properties + +### .isInstancedBufferAttribute : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .meshPerAttribute : number + +Defines how often a value of this buffer attribute should be repeated. A value of one means that each value of the instanced attribute is used for a single instance. A value of two means that each value is used for two consecutive instances (and so on). + +Default is `1`. + +## Source + +[src/core/InstancedBufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/InstancedBufferGeometry.html.md b/docs/pages/InstancedBufferGeometry.html.md new file mode 100644 index 00000000000000..9bef66ead10f2b --- /dev/null +++ b/docs/pages/InstancedBufferGeometry.html.md @@ -0,0 +1,27 @@ +# InstancedBufferGeometry + +An instanced version of a geometry. + +## Constructor + +### new InstancedBufferGeometry() + +Constructs a new instanced buffer geometry. + +## Properties + +### .instanceCount : number + +The instance count. + +Default is `Infinity`. + +### .isInstancedBufferGeometry : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/core/InstancedBufferGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/core/InstancedBufferGeometry.js) \ No newline at end of file diff --git a/docs/pages/InstancedFlow.html.md b/docs/pages/InstancedFlow.html.md new file mode 100644 index 00000000000000..54fcc0a8f7555c --- /dev/null +++ b/docs/pages/InstancedFlow.html.md @@ -0,0 +1,79 @@ +*Inheritance: Flow →* + +# InstancedFlow + +An instanced version of [Flow](Flow.html) for making meshes bend around curves, where the instances are placed on the curve. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). + +## Import + +InstancedFlow is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { InstancedFlow } from 'three/addons/modifiers/CurveModifier.js'; +``` + +## Constructor + +### new InstancedFlow( count : number, curveCount : number, geometry : Geometry, material : Material ) + +Constructs a new InstancedFlow instance. + +**count** + +The number of instanced elements. + +**curveCount** + +The number of curves to preallocate for. + +**geometry** + +The geometry to use for the instanced mesh. + +**material** + +The material to use for the instanced mesh. + +## Classes + +[InstancedFlow](InstancedFlow.html) + +## Methods + +### .moveIndividualAlongCurve( index : number, offset : number ) + +Move an individual element along the curve by a specific amount. + +**index** + +Which element to update. + +**offset** + +The offset. + +### .setCurve( index : number, curveNo : number ) + +Select which curve to use for an element. + +**index** + +The index of the instanced element to update. + +**curveNo** + +The index of the curve it should use. + +### .writeChanges( index : number ) + +The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects This writes that information to the matrix and marks it as needing update. + +**index** + +The index of tge instanced element to update. + +## Source + +[examples/jsm/modifiers/CurveModifier.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/modifiers/CurveModifier.js) \ No newline at end of file diff --git a/docs/pages/InstancedInterleavedBuffer.html.md b/docs/pages/InstancedInterleavedBuffer.html.md new file mode 100644 index 00000000000000..c624ce4c0ffdf4 --- /dev/null +++ b/docs/pages/InstancedInterleavedBuffer.html.md @@ -0,0 +1,43 @@ +*Inheritance: InterleavedBuffer →* + +# InstancedInterleavedBuffer + +An instanced version of an interleaved buffer. + +## Constructor + +### new InstancedInterleavedBuffer( array : TypedArray, stride : number, meshPerAttribute : number ) + +Constructs a new instanced interleaved buffer. + +**array** + +A typed array with a shared buffer storing attribute data. + +**stride** + +The number of typed-array elements per vertex. + +**meshPerAttribute** + +Defines how often a value of this interleaved buffer should be repeated. + +Default is `1`. + +## Properties + +### .isInstancedInterleavedBuffer : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .meshPerAttribute : number + +Defines how often a value of this buffer attribute should be repeated, see [InstancedBufferAttribute#meshPerAttribute](InstancedBufferAttribute.html#meshPerAttribute). + +Default is `1`. + +## Source + +[src/core/InstancedInterleavedBuffer.js](https://github.com/mrdoob/three.js/blob/master/src/core/InstancedInterleavedBuffer.js) \ No newline at end of file diff --git a/docs/pages/InstancedMesh.html.md b/docs/pages/InstancedMesh.html.md new file mode 100644 index 00000000000000..66e5934c830ec6 --- /dev/null +++ b/docs/pages/InstancedMesh.html.md @@ -0,0 +1,161 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# InstancedMesh + +A special version of a mesh with instanced rendering support. Use this class if you have to render a large number of objects with the same geometry and material(s) but with different world transformations. The usage of 'InstancedMesh' will help you to reduce the number of draw calls and thus improve the overall rendering performance in your application. + +## Constructor + +### new InstancedMesh( geometry : BufferGeometry, material : Material | Array., count : number ) + +Constructs a new instanced mesh. + +**geometry** + +The mesh geometry. + +**material** + +The mesh material. + +**count** + +The number of instances. + +## Properties + +### .boundingBox : Box3 + +The bounding box of the instanced mesh. Can be computed via [InstancedMesh#computeBoundingBox](InstancedMesh.html#computeBoundingBox). + +Default is `null`. + +### .boundingSphere : Sphere + +The bounding sphere of the instanced mesh. Can be computed via [InstancedMesh#computeBoundingSphere](InstancedMesh.html#computeBoundingSphere). + +Default is `null`. + +### .count : number + +The number of instances. + +**Overrides:** [Mesh#count](Mesh.html#count) + +### .instanceColor : InstancedBufferAttribute + +Represents the color of all instances. You have to set its [BufferAttribute#needsUpdate](BufferAttribute.html#needsUpdate) flag to true if you modify instanced data via [InstancedMesh#setColorAt](InstancedMesh.html#setColorAt). + +Default is `null`. + +### .instanceMatrix : InstancedBufferAttribute + +Represents the local transformation of all instances. You have to set its [BufferAttribute#needsUpdate](BufferAttribute.html#needsUpdate) flag to true if you modify instanced data via [InstancedMesh#setMatrixAt](InstancedMesh.html#setMatrixAt). + +### .isInstancedMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .morphTexture : DataTexture + +Represents the morph target weights of all instances. You have to set its [Texture#needsUpdate](Texture.html#needsUpdate) flag to true if you modify instanced data via [InstancedMesh#setMorphAt](InstancedMesh.html#setMorphAt). + +Default is `null`. + +### .previousInstanceMatrix : InstancedBufferAttribute + +Represents the local transformation of all instances of the previous frame. Required for computing velocity. Maintained in [InstanceNode](InstanceNode.html). + +Default is `null`. + +## Methods + +### .computeBoundingBox() + +Computes the bounding box of the instanced mesh, and updates [InstancedMesh#boundingBox](InstancedMesh.html#boundingBox). The bounding box is not automatically computed by the engine; this method must be called by your app. You may need to recompute the bounding box if an instance is transformed via [InstancedMesh#setMatrixAt](InstancedMesh.html#setMatrixAt). + +### .computeBoundingSphere() + +Computes the bounding sphere of the instanced mesh, and updates [InstancedMesh#boundingSphere](InstancedMesh.html#boundingSphere) The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. You may need to recompute the bounding sphere if an instance is transformed via [InstancedMesh#setMatrixAt](InstancedMesh.html#setMatrixAt). + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .getColorAt( index : number, color : Color ) + +Gets the color of the defined instance. + +**index** + +The instance index. + +**color** + +The target object that is used to store the method's result. + +### .getMatrixAt( index : number, matrix : Matrix4 ) + +Gets the local transformation matrix of the defined instance. + +**index** + +The instance index. + +**matrix** + +The target object that is used to store the method's result. + +### .getMorphAt( index : number, object : Mesh ) + +Gets the morph target weights of the defined instance. + +**index** + +The instance index. + +**object** + +The target object that is used to store the method's result. + +### .setColorAt( index : number, color : Color ) + +Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of [InstancedMesh#instanceColor](InstancedMesh.html#instanceColor) to `true` after updating all the colors. + +**index** + +The instance index. + +**color** + +The instance color. + +### .setMatrixAt( index : number, matrix : Matrix4 ) + +Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of [InstancedMesh#instanceMatrix](InstancedMesh.html#instanceMatrix) to `true` after updating all the colors. + +**index** + +The instance index. + +**matrix** + +The local transformation. + +### .setMorphAt( index : number, object : Mesh ) + +Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of [InstancedMesh#morphTexture](InstancedMesh.html#morphTexture) to `true` after updating all the influences. + +**index** + +The instance index. + +**object** + +A mesh which `morphTargetInfluences` property containing the morph target weights of a single instance. + +## Source + +[src/objects/InstancedMesh.js](https://github.com/mrdoob/three.js/blob/master/src/objects/InstancedMesh.js) \ No newline at end of file diff --git a/docs/pages/InstancedMeshNode.html.md b/docs/pages/InstancedMeshNode.html.md new file mode 100644 index 00000000000000..dddddc0695d141 --- /dev/null +++ b/docs/pages/InstancedMeshNode.html.md @@ -0,0 +1,25 @@ +*Inheritance: EventDispatcher → Node → InstanceNode →* + +# InstancedMeshNode + +This is a special version of `InstanceNode` which requires the usage of [InstancedMesh](InstancedMesh.html). It allows an easier setup of the instance node. + +## Constructor + +### new InstancedMeshNode( instancedMesh : InstancedMesh ) + +Constructs a new instanced mesh node. + +**instancedMesh** + +The instanced mesh. + +## Properties + +### .instancedMesh : InstancedMesh + +A reference to the instanced mesh. + +## Source + +[src/nodes/accessors/InstancedMeshNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/InstancedMeshNode.js) \ No newline at end of file diff --git a/docs/pages/Int16BufferAttribute.html.md b/docs/pages/Int16BufferAttribute.html.md new file mode 100644 index 00000000000000..3153da6acaf9a0 --- /dev/null +++ b/docs/pages/Int16BufferAttribute.html.md @@ -0,0 +1,29 @@ +*Inheritance: BufferAttribute →* + +# Int16BufferAttribute + +Convenient class that can be used when creating a `Int16` buffer attribute with a plain `Array` instance. + +## Constructor + +### new Int16BufferAttribute( array : Array. | Int16Array, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Int32BufferAttribute.html.md b/docs/pages/Int32BufferAttribute.html.md new file mode 100644 index 00000000000000..7750d8da64d021 --- /dev/null +++ b/docs/pages/Int32BufferAttribute.html.md @@ -0,0 +1,29 @@ +*Inheritance: BufferAttribute →* + +# Int32BufferAttribute + +Convenient class that can be used when creating a `Int32` buffer attribute with a plain `Array` instance. + +## Constructor + +### new Int32BufferAttribute( array : Array. | Int32Array, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Int8BufferAttribute.html.md b/docs/pages/Int8BufferAttribute.html.md new file mode 100644 index 00000000000000..98abdcb79bbea2 --- /dev/null +++ b/docs/pages/Int8BufferAttribute.html.md @@ -0,0 +1,29 @@ +*Inheritance: BufferAttribute →* + +# Int8BufferAttribute + +Convenient class that can be used when creating a `Int8` buffer attribute with a plain `Array` instance. + +## Constructor + +### new Int8BufferAttribute( array : Array. | Int8Array, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/InteractiveGroup.html.md b/docs/pages/InteractiveGroup.html.md new file mode 100644 index 00000000000000..8b194bfa72ba29 --- /dev/null +++ b/docs/pages/InteractiveGroup.html.md @@ -0,0 +1,89 @@ +*Inheritance: EventDispatcher → Object3D → Group →* + +# InteractiveGroup + +This class can be used to group 3D objects in an interactive group. The group itself can listen to Pointer, Mouse or XR controller events to detect selections of descendant 3D objects. If a 3D object is selected, the respective event is going to dispatched to it. + +## Code Example + +```js +const group = new InteractiveGroup(); +group.listenToPointerEvents( renderer, camera ); +group.listenToXRControllerEvents( controller1 ); +group.listenToXRControllerEvents( controller2 ); +scene.add( group ); +// now add objects that should be interactive +group.add( mesh1, mesh2, mesh3 ); +``` + +## Import + +InteractiveGroup is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js'; +``` + +## Constructor + +### new InteractiveGroup() + +## Properties + +### .camera : Camera + +The camera used for raycasting. + +Default is `null`. + +### .controllers : Array. + +An array of XR controllers. + +### .element : HTMLElement + +The internal raycaster. + +Default is `null`. + +### .raycaster : Raycaster + +The internal raycaster. + +## Methods + +### .disconnect() + +Disconnects this interactive group from the DOM and all XR controllers. + +### .disconnectXrControllerEvents() + +Disconnects this interactive group from all XR controllers. + +### .disconnectionPointerEvents() + +Disconnects this interactive group from all Pointer and Mouse Events. + +### .listenToPointerEvents( renderer : WebGPURenderer | WebGLRenderer, camera : Camera ) + +Calling this method makes sure the interactive group listens to Pointer and Mouse events. The target is the `domElement` of the given renderer. The camera is required for the internal raycasting so 3D objects can be detected based on the events. + +**renderer** + +The renderer. + +**camera** + +The camera. + +### .listenToXRControllerEvents( controller : Group ) + +Calling this method makes sure the interactive group listens to events of the given XR controller. + +**controller** + +The XR controller. + +## Source + +[examples/jsm/interactive/InteractiveGroup.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/interactive/InteractiveGroup.js) \ No newline at end of file diff --git a/docs/pages/InterleavedBuffer.html.md b/docs/pages/InterleavedBuffer.html.md new file mode 100644 index 00000000000000..a27cf3d9c3301a --- /dev/null +++ b/docs/pages/InterleavedBuffer.html.md @@ -0,0 +1,175 @@ +# InterleavedBuffer + +"Interleaved" means that multiple attributes, possibly of different types, (e.g., position, normal, uv, color) are packed into a single array buffer. + +An introduction into interleaved arrays can be found here: [Interleaved array basics](https://blog.tojicode.com/2011/05/interleaved-array-basics.html) + +## Constructor + +### new InterleavedBuffer( array : TypedArray, stride : number ) + +Constructs a new interleaved buffer. + +**array** + +A typed array with a shared buffer storing attribute data. + +**stride** + +The number of typed-array elements per vertex. + +## Properties + +### .array : TypedArray + +A typed array with a shared buffer storing attribute data. + +### .count : number (readonly) + +The total number of elements in the array + +### .isInterleavedBuffer : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .needsUpdate : number + +Flag to indicate that this attribute has changed and should be re-sent to the GPU. Set this to `true` when you modify the value of the array. + +Default is `false`. + +### .stride : number + +The number of typed-array elements per vertex. + +### .updateRanges : Array. + +This can be used to only update some components of stored vectors (for example, just the component related to color). Use the `addUpdateRange()` function to add ranges to this array. + +### .usage : StaticDrawUsage | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage + +Defines the intended usage pattern of the data store for optimization purposes. + +Note: After the initial use of a buffer, its usage cannot be changed. Instead, instantiate a new one and set the desired usage before the next render. + +Default is `StaticDrawUsage`. + +### .uuid : string (readonly) + +The UUID of the interleaved buffer. + +### .version : number + +A version number, incremented every time the `needsUpdate` is set to `true`. + +## Methods + +### .addUpdateRange( start : number, count : number ) + +Adds a range of data in the data array to be updated on the GPU. + +**start** + +Position at which to start update. + +**count** + +The number of components to update. + +### .clearUpdateRanges() + +Clears the update ranges. + +### .clone( data : Object ) : InterleavedBuffer + +Returns a new interleaved buffer with copied values from this instance. + +**data** + +An object with shared array buffers that allows to retain shared structures. + +**Returns:** A clone of this instance. + +### .copy( source : InterleavedBuffer ) : InterleavedBuffer + +Copies the values of the given interleaved buffer to this instance. + +**source** + +The interleaved buffer to copy. + +**Returns:** A reference to this instance. + +### .copyAt( index1 : number, interleavedBuffer : InterleavedBuffer, index2 : number ) : InterleavedBuffer + +Copies a vector from the given interleaved buffer to this one. The start and destination position in the attribute buffers are represented by the given indices. + +**index1** + +The destination index into this interleaved buffer. + +**interleavedBuffer** + +The interleaved buffer to copy from. + +**index2** + +The source index into the given interleaved buffer. + +**Returns:** A reference to this instance. + +### .onUpload( callback : function ) : InterleavedBuffer + +Sets the given callback function that is executed after the Renderer has transferred the array data to the GPU. Can be used to perform clean-up operations after the upload when data are not needed anymore on the CPU side. + +**callback** + +The `onUpload()` callback. + +**Returns:** A reference to this instance. + +### .onUploadCallback() + +A callback function that is executed after the renderer has transferred the attribute array data to the GPU. + +### .set( value : TypedArray | Array, offset : number ) : InterleavedBuffer + +Sets the given array data in the interleaved buffer. + +**value** + +The array data to set. + +**offset** + +The offset in this interleaved buffer's array. + +Default is `0`. + +**Returns:** A reference to this instance. + +### .setUsage( value : StaticDrawUsage | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage ) : InterleavedBuffer + +Sets the usage of this interleaved buffer. + +**value** + +The usage to set. + +**Returns:** A reference to this interleaved buffer. + +### .toJSON( data : Object ) : Object + +Serializes the interleaved buffer into JSON. + +**data** + +An optional value holding meta information about the serialization. + +**Returns:** A JSON object representing the serialized interleaved buffer. + +## Source + +[src/core/InterleavedBuffer.js](https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBuffer.js) \ No newline at end of file diff --git a/docs/pages/InterleavedBufferAttribute.html.md b/docs/pages/InterleavedBufferAttribute.html.md new file mode 100644 index 00000000000000..44a631fc4a639a --- /dev/null +++ b/docs/pages/InterleavedBufferAttribute.html.md @@ -0,0 +1,323 @@ +# InterleavedBufferAttribute + +An alternative version of a buffer attribute with interleaved data. Interleaved attributes share a common interleaved data storage ([InterleavedBuffer](InterleavedBuffer.html)) and refer with different offsets into the buffer. + +## Constructor + +### new InterleavedBufferAttribute( interleavedBuffer : InterleavedBuffer, itemSize : number, offset : number, normalized : boolean ) + +Constructs a new interleaved buffer attribute. + +**interleavedBuffer** + +The buffer holding the interleaved data. + +**itemSize** + +The item size. + +**offset** + +The attribute offset into the buffer. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Properties + +### .array : TypedArray + +The array holding the interleaved buffer attribute data. + +### .count : number (readonly) + +The item count of this buffer attribute. + +### .data : InterleavedBuffer + +The buffer holding the interleaved data. + +### .isInterleavedBufferAttribute : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .itemSize : number + +The item size, see [BufferAttribute#itemSize](BufferAttribute.html#itemSize). + +### .name : string + +The name of the buffer attribute. + +### .needsUpdate : number + +Flag to indicate that this attribute has changed and should be re-sent to the GPU. Set this to `true` when you modify the value of the array. + +Default is `false`. + +### .normalized : InterleavedBuffer + +Whether the data are normalized or not, see [BufferAttribute#normalized](BufferAttribute.html#normalized) + +### .offset : number + +The attribute offset into the buffer. + +## Methods + +### .applyMatrix4( m : Matrix4 ) : InterleavedBufferAttribute + +Applies the given 4x4 matrix to the given attribute. Only works with item size `3`. + +**m** + +The matrix to apply. + +**Returns:** A reference to this instance. + +### .applyNormalMatrix( m : Matrix3 ) : InterleavedBufferAttribute + +Applies the given 3x3 normal matrix to the given attribute. Only works with item size `3`. + +**m** + +The normal matrix to apply. + +**Returns:** A reference to this instance. + +### .clone( data : Object ) : BufferAttribute | InterleavedBufferAttribute + +Returns a new buffer attribute with copied values from this instance. + +If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data. + +**data** + +An object with interleaved buffers that allows to retain the interleaved property. + +**Returns:** A clone of this instance. + +### .getComponent( index : number, component : number ) : number + +Returns the given component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**component** + +The component index. + +**Returns:** The returned value. + +### .getW( index : number ) : number + +Returns the w component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**Returns:** The w component. + +### .getX( index : number ) : number + +Returns the x component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**Returns:** The x component. + +### .getY( index : number ) : number + +Returns the y component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**Returns:** The y component. + +### .getZ( index : number ) : number + +Returns the z component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**Returns:** The z component. + +### .setComponent( index : number, component : number, value : number ) : InterleavedBufferAttribute + +Sets the given value to the given component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**component** + +The component index. + +**value** + +The value to set. + +**Returns:** A reference to this instance. + +### .setW( index : number, w : number ) : InterleavedBufferAttribute + +Sets the w component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**w** + +The value to set. + +**Returns:** A reference to this instance. + +### .setX( index : number, x : number ) : InterleavedBufferAttribute + +Sets the x component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**x** + +The value to set. + +**Returns:** A reference to this instance. + +### .setXY( index : number, x : number, y : number ) : InterleavedBufferAttribute + +Sets the x and y component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**x** + +The value for the x component to set. + +**y** + +The value for the y component to set. + +**Returns:** A reference to this instance. + +### .setXYZ( index : number, x : number, y : number, z : number ) : InterleavedBufferAttribute + +Sets the x, y and z component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**x** + +The value for the x component to set. + +**y** + +The value for the y component to set. + +**z** + +The value for the z component to set. + +**Returns:** A reference to this instance. + +### .setXYZW( index : number, x : number, y : number, z : number, w : number ) : InterleavedBufferAttribute + +Sets the x, y, z and w component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**x** + +The value for the x component to set. + +**y** + +The value for the y component to set. + +**z** + +The value for the z component to set. + +**w** + +The value for the w component to set. + +**Returns:** A reference to this instance. + +### .setY( index : number, y : number ) : InterleavedBufferAttribute + +Sets the y component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**y** + +The value to set. + +**Returns:** A reference to this instance. + +### .setZ( index : number, z : number ) : InterleavedBufferAttribute + +Sets the z component of the vector at the given index. + +**index** + +The index into the buffer attribute. + +**z** + +The value to set. + +**Returns:** A reference to this instance. + +### .toJSON( data : Object ) : Object + +Serializes the buffer attribute into JSON. + +If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data. + +**data** + +An optional value holding meta information about the serialization. + +**Returns:** A JSON object representing the serialized buffer attribute. + +### .transformDirection( m : Matrix4 ) : InterleavedBufferAttribute + +Applies the given 4x4 matrix to the given attribute. Only works with item size `3` and with direction vectors. + +**m** + +The matrix to apply. + +**Returns:** A reference to this instance. + +## Source + +[src/core/InterleavedBufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/InterleavedBufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Interpolant.html.md b/docs/pages/Interpolant.html.md new file mode 100644 index 00000000000000..74fbf81d17fa40 --- /dev/null +++ b/docs/pages/Interpolant.html.md @@ -0,0 +1,133 @@ +# Interpolant + +Abstract base class of interpolants over parametric samples. + +The parameter domain is one dimensional, typically the time or a path along a curve defined by the data. + +The sample values can have any dimensionality and derived classes may apply special interpretations to the data. + +This class provides the interval seek in a Template Method, deferring the actual interpolation to derived classes. + +Time complexity is O(1) for linear access crossing at most two points and O(log N) for random access, where N is the number of positions. + +References: [http://www.oodesign.com/template-method-pattern.html](http://www.oodesign.com/template-method-pattern.html) + +## Constructor + +### new Interpolant( parameterPositions : TypedArray, sampleValues : TypedArray, sampleSize : number, resultBuffer : TypedArray ) (abstract) + +Constructs a new interpolant. + +**parameterPositions** + +The parameter positions hold the interpolation factors. + +**sampleValues** + +The sample values. + +**sampleSize** + +The sample size + +**resultBuffer** + +The result buffer. + +## Properties + +### .DefaultSettings_ : Object + +The default settings object. + +### .parameterPositions : TypedArray + +The parameter positions. + +### .resultBuffer : TypedArray + +The result buffer. + +### .sampleValues : TypedArray + +The sample values. + +### .settings : Object + +The interpolation settings. + +Default is `null`. + +### .valueSize : TypedArray + +The value size. + +## Methods + +### .copySampleValue_( index : number ) : TypedArray + +Copies a sample value to the result buffer. + +**index** + +An index into the sample value buffer. + +**Returns:** The result buffer. + +### .evaluate( t : number ) : TypedArray + +Evaluate the interpolant at position `t`. + +**t** + +The interpolation factor. + +**Returns:** The result buffer. + +### .getSettings_() : Object + +Returns the interpolation settings. + +**Returns:** The interpolation settings. + +### .interpolate_( i1 : number, t0 : number, t : number, t1 : number ) : TypedArray (abstract) + +Copies a sample value to the result buffer. + +**i1** + +An index into the sample value buffer. + +**t0** + +The previous interpolation factor. + +**t** + +The current interpolation factor. + +**t1** + +The next interpolation factor. + +**Returns:** The result buffer. + +### .intervalChanged_( i1 : number, t0 : number, t : number ) + +Optional method that is executed when the interval has changed. + +**i1** + +An index into the sample value buffer. + +**t0** + +The previous interpolation factor. + +**t** + +The current interpolation factor. + +## Source + +[src/math/Interpolant.js](https://github.com/mrdoob/three.js/blob/master/src/math/Interpolant.js) \ No newline at end of file diff --git a/docs/pages/IrradianceNode.html.md b/docs/pages/IrradianceNode.html.md new file mode 100644 index 00000000000000..ef368c12c3e86e --- /dev/null +++ b/docs/pages/IrradianceNode.html.md @@ -0,0 +1,25 @@ +*Inheritance: EventDispatcher → Node → LightingNode →* + +# IrradianceNode + +A generic class that can be used by nodes which contribute irradiance to the scene. E.g. a light map node can be used as input for this module. Used in [NodeMaterial](NodeMaterial.html). + +## Constructor + +### new IrradianceNode( node : Node. ) + +Constructs a new irradiance node. + +**node** + +A node contributing irradiance. + +## Properties + +### .node : Node. + +A node contributing irradiance. + +## Source + +[src/nodes/lighting/IrradianceNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/IrradianceNode.js) \ No newline at end of file diff --git a/docs/pages/IsolateNode.html.md b/docs/pages/IsolateNode.html.md new file mode 100644 index 00000000000000..80515acf024a2f --- /dev/null +++ b/docs/pages/IsolateNode.html.md @@ -0,0 +1,43 @@ +*Inheritance: EventDispatcher → Node →* + +# IsolateNode + +This node can be used as a cache management component for another node. Caching is in general used by default in [NodeBuilder](NodeBuilder.html) but this node allows the usage of a shared parent cache during the build process. + +## Constructor + +### new IsolateNode( node : Node, parent : boolean ) + +Constructs a new cache node. + +**node** + +The node that should be cached. + +**parent** + +Whether this node refers to a shared parent cache or not. + +Default is `true`. + +## Properties + +### .isIsolateNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .node : Node + +The node that should be cached. + +### .parent : boolean + +Whether this node refers to a shared parent cache or not. + +Default is `true`. + +## Source + +[src/nodes/core/IsolateNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/IsolateNode.js) \ No newline at end of file diff --git a/docs/pages/JoinNode.html.md b/docs/pages/JoinNode.html.md new file mode 100644 index 00000000000000..078c44c54adf76 --- /dev/null +++ b/docs/pages/JoinNode.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# JoinNode + +This module is part of the TSL core and usually not used in app level code. It represents a join operation during the shader generation process. For example in can compose/join two single floats into a `vec2` type. + +## Constructor + +### new JoinNode( nodes : Array., nodeType : string ) + +Constructs a new join node. + +**nodes** + +An array of nodes that should be joined. + +**nodeType** + +The node type. + +Default is `null`. + +## Properties + +### .nodes : Array. + +An array of nodes that should be joined. + +## Methods + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type must be inferred from the joined data length if not explicitly defined. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getNodeType](TempNode.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/utils/JoinNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/JoinNode.js) \ No newline at end of file diff --git a/docs/pages/JoltPhysics.html.md b/docs/pages/JoltPhysics.html.md new file mode 100644 index 00000000000000..d0b0786a21ee08 --- /dev/null +++ b/docs/pages/JoltPhysics.html.md @@ -0,0 +1,75 @@ +# JoltPhysics + +Can be used to include Jolt as a Physics engine into `three.js` apps. The API can be initialized via: + +The component automatically imports Jolt from a CDN so make sure to use the component with an active Internet connection. + +## Code Example + +```js +const physics = await JoltPhysics(); +``` + +## Import + +JoltPhysics is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { JoltPhysics } from 'three/addons/physics/JoltPhysics.js'; +``` + +## Methods + +### .addMesh( mesh : Mesh, mass : number, restitution : number ) + +Adds the given mesh to this physics simulation. + +**mesh** + +The mesh to add. + +**mass** + +The mass in kg of the mesh. + +Default is `0`. + +**restitution** + +The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. + +Default is `0`. + +### .addScene( scene : Object3D ) + +Adds the given scene to this physics simulation. Only meshes with a `physics` object in their [Object3D#userData](Object3D.html#userData) field will be honored. The object can be used to store the mass and restitution of the mesh. E.g.: + +```js +box.userData.physics = { mass: 1, restitution: 0 }; +``` + +**scene** + +The scene or any type of 3D object to add. + +### .setMeshPosition( mesh : Mesh, position : Vector3, index : number ) + +Set the position of the given mesh which is part of the physics simulation. Calling this method will reset the current simulated velocity of the mesh. + +**mesh** + +The mesh to update the position for. + +**position** + +The new position. + +**index** + +If the mesh is instanced, the index represents the instanced ID. + +Default is `0`. + +## Source + +[examples/jsm/physics/JoltPhysics.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/physics/JoltPhysics.js) \ No newline at end of file diff --git a/docs/pages/KMZLoader.html.md b/docs/pages/KMZLoader.html.md new file mode 100644 index 00000000000000..6098b02962c81b --- /dev/null +++ b/docs/pages/KMZLoader.html.md @@ -0,0 +1,71 @@ +*Inheritance: Loader →* + +# KMZLoader + +A loader for the KMZ format. + +## Code Example + +```js +const loader = new KMZLoader(); +const kmz = await loader.loadAsync( './models/kmz/Box.kmz' ); +scene.add( kmz.scene ); +``` + +## Import + +KMZLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { KMZLoader } from 'three/addons/loaders/KMZLoader.js'; +``` + +## Constructor + +### new KMZLoader( manager : LoadingManager ) + +Constructs a new KMZ loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded KMZ asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : Object + +Parses the given KMZ data and returns an object holding the scene. + +**data** + +The raw KMZ data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed KMZ asset. + +## Source + +[examples/jsm/loaders/KMZLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/KMZLoader.js) \ No newline at end of file diff --git a/docs/pages/KTX2Exporter.html.md b/docs/pages/KTX2Exporter.html.md new file mode 100644 index 00000000000000..ab45cb3d7c39b4 --- /dev/null +++ b/docs/pages/KTX2Exporter.html.md @@ -0,0 +1,45 @@ +# KTX2Exporter + +An exporter for KTX2. + +## Code Example + +```js +const exporter = new KTX2Exporter(); +const result = await exporter.parse( dataTexture ); +``` + +## Import + +KTX2Exporter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { KTX2Exporter } from 'three/addons/exporters/KTX2Exporter.js'; +``` + +## Constructor + +### new KTX2Exporter() + +## Methods + +### .parse( arg1 : DataTexture | Data3DTexture | WebGPURenderer | WebGLRenderer, arg2 : RenderTarget ) : Promise. (async) + +This method has two variants. + +* When exporting a data texture, it receives one parameter. The data or 3D data texture. +* When exporting a render target (e.g. a PMREM), it receives two parameters. The renderer and the render target. + +**arg1** + +The data texture to export or a renderer. + +**arg2** + +The render target that should be exported + +**Returns:** A Promise that resolves with the exported KTX2. + +## Source + +[examples/jsm/exporters/KTX2Exporter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/KTX2Exporter.js) \ No newline at end of file diff --git a/docs/pages/KTX2Loader.html.md b/docs/pages/KTX2Loader.html.md new file mode 100644 index 00000000000000..a20c003e5fa0ba --- /dev/null +++ b/docs/pages/KTX2Loader.html.md @@ -0,0 +1,140 @@ +*Inheritance: Loader →* + +# KTX2Loader + +A loader for KTX 2.0 GPU Texture containers. + +KTX 2.0 is a container format for various GPU texture formats. The loader supports Basis Universal GPU textures, which can be quickly transcoded to a wide variety of GPU texture compression formats. While KTX 2.0 also allows other hardware-specific formats, this loader does not yet parse them. + +This loader parses the KTX 2.0 container and transcodes to a supported GPU compressed texture format. The required WASM transcoder and JS wrapper are available from the `examples/jsm/libs/basis` directory. + +This loader relies on Web Assembly which is not supported in older browsers. + +References: + +* [KTX specification](http://github.khronos.org/KTX-Specification/) +* [DFD](https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor) +* [BasisU HDR](https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0) + +## Code Example + +```js +const loader = new KTX2Loader(); +loader.setTranscoderPath( 'examples/jsm/libs/basis/' ); +loader.detectSupport( renderer ); +const texture = loader.loadAsync( 'diffuse.ktx2' ); +``` + +## Import + +KTX2Loader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; +``` + +## Constructor + +### new KTX2Loader( manager : LoadingManager ) + +Constructs a new KTX2 loader. + +**manager** + +The loading manager. + +## Methods + +### .detectSupport( renderer : WebGPURenderer | WebGLRenderer ) : KTX2Loader + +Detects hardware support for available compressed texture formats, to determine the output format for the transcoder. Must be called before loading a texture. + +**renderer** + +The renderer. + +**Returns:** A reference to this loader. + +### .detectSupportAsync( renderer : WebGPURenderer ) : Promise (async) + +Async version of [KTX2Loader#detectSupport](KTX2Loader.html#detectSupport). + +**renderer** + +The renderer. + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the support has been detected. + +### .dispose() + +Frees internal resources. This method should be called when the loader is no longer required. + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded KTX2 texture to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( buffer : ArrayBuffer, onLoad : function, onError : onErrorCallback ) : Promise + +Parses the given KTX2 data. + +**buffer** + +The raw KTX2 data as an array buffer. + +**onLoad** + +Executed when the loading/parsing process has been finished. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** A Promise that resolves when the parsing has been finished. + +### .setTranscoderPath( path : string ) : KTX2Loader + +Sets the transcoder path. + +The WASM transcoder and JS wrapper are available from the `examples/jsm/libs/basis` directory. + +**path** + +The transcoder path to set. + +**Returns:** A reference to this loader. + +### .setWorkerLimit( workerLimit : number ) : KTX2Loader + +Sets the maximum number of Web Workers to be allocated by this instance. + +**workerLimit** + +The worker limit. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/KTX2Loader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/KTX2Loader.js) \ No newline at end of file diff --git a/docs/pages/KTXLoader.html.md b/docs/pages/KTXLoader.html.md new file mode 100644 index 00000000000000..2d0df2632e118b --- /dev/null +++ b/docs/pages/KTXLoader.html.md @@ -0,0 +1,58 @@ +*Inheritance: Loader → CompressedTextureLoader →* + +# KTXLoader + +A loader for the KTX texture compression format. + +References: + +* [The KTX File Format and Tools](https://www.khronos.org/opengles/sdk/tools/KTX/) +* [Babylon.JS khronosTextureContainer.ts](https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts) + +## Code Example + +```js +const loader = new KTXLoader(); +const map = loader.load( 'textures/compressed/lensflare_ASTC8x8.ktx' ) +map.colorSpace = THREE.SRGBColorSpace; // only for color textures +``` + +## Import + +KTXLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { KTXLoader } from 'three/addons/loaders/KTXLoader.js'; +``` + +## Constructor + +### new KTXLoader( manager : LoadingManager ) + +Constructs a new KTX loader. + +**manager** + +The loading manager. + +## Methods + +### .parse( buffer : ArrayBuffer, loadMipmaps : boolean ) : CompressedTextureLoader~TexData + +Parses the given KTX texture data. + +**buffer** + +The raw texture data. + +**loadMipmaps** + +Whether to load mipmaps or not. + +**Overrides:** [CompressedTextureLoader#parse](CompressedTextureLoader.html#parse) + +**Returns:** An object representing the parsed texture data. + +## Source + +[examples/jsm/loaders/KTXLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/KTXLoader.js) \ No newline at end of file diff --git a/docs/pages/KeyframeTrack.html.md b/docs/pages/KeyframeTrack.html.md new file mode 100644 index 00000000000000..389ff318c0db05 --- /dev/null +++ b/docs/pages/KeyframeTrack.html.md @@ -0,0 +1,187 @@ +# KeyframeTrack + +Represents s a timed sequence of keyframes, which are composed of lists of times and related values, and which are used to animate a specific property of an object. + +## Constructor + +### new KeyframeTrack( name : string, times : Array., values : Array.<(number|string|boolean)>, interpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth ) + +Constructs a new keyframe track. + +**name** + +The keyframe track's name. + +**times** + +A list of keyframe times. + +**values** + +A list of keyframe values. + +**interpolation** + +The interpolation type. + +## Properties + +### .DefaultInterpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth + +The default interpolation type of this keyframe track. + +Default is `InterpolateLinear`. + +### .TimeBufferType : TypedArray | Array + +The time buffer type of this keyframe track. + +Default is `Float32Array.constructor`. + +### .ValueBufferType : TypedArray | Array + +The value buffer type of this keyframe track. + +Default is `Float32Array.constructor`. + +### .ValueTypeName : string + +The value type name. + +Default is `''`. + +### .name : string + +The track's name can refer to morph targets or bones or possibly other values within an animated object. See PropertyBinding#parseTrackName for the forms of strings that can be parsed for property binding. + +### .times : Float32Array + +The keyframe times. + +### .values : Float32Array + +The keyframe values. + +## Methods + +### .InterpolantFactoryMethodDiscrete( result : TypedArray ) : DiscreteInterpolant + +Factory method for creating a new discrete interpolant. + +**result** + +The result buffer. + +**Returns:** The new interpolant. + +### .InterpolantFactoryMethodLinear( result : TypedArray ) : LinearInterpolant + +Factory method for creating a new linear interpolant. + +**result** + +The result buffer. + +**Returns:** The new interpolant. + +### .InterpolantFactoryMethodSmooth( result : TypedArray ) : CubicInterpolant + +Factory method for creating a new smooth interpolant. + +**result** + +The result buffer. + +**Returns:** The new interpolant. + +### .clone() : KeyframeTrack + +Returns a new keyframe track with copied values from this instance. + +**Returns:** A clone of this instance. + +### .getInterpolation() : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth + +Returns the current interpolation type. + +**Returns:** The interpolation type. + +### .getValueSize() : number + +Returns the value size. + +**Returns:** The value size. + +### .optimize() : AnimationClip + +Optimizes this keyframe track by removing equivalent sequential keys (which are common in morph target sequences). + +**Returns:** A reference to this animation clip. + +### .scale( timeScale : number ) : KeyframeTrack + +Scale all keyframe times by a factor (useful for frame - seconds conversions). + +**timeScale** + +The time scale. + +**Returns:** A reference to this keyframe track. + +### .setInterpolation( interpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth ) : KeyframeTrack + +Defines the interpolation factor method for this keyframe track. + +**interpolation** + +The interpolation type. + +**Returns:** A reference to this keyframe track. + +### .shift( timeOffset : number ) : KeyframeTrack + +Moves all keyframes either forward or backward in time. + +**timeOffset** + +The offset to move the time values. + +**Returns:** A reference to this keyframe track. + +### .trim( startTime : number, endTime : number ) : KeyframeTrack + +Removes keyframes before and after animation without changing any values within the defined time range. + +Note: The method does not shift around keys to the start of the track time, because for interpolated keys this will change their values + +**startTime** + +The start time. + +**endTime** + +The end time. + +**Returns:** A reference to this keyframe track. + +### .validate() : boolean + +Performs minimal validation on the keyframe track. Returns `true` if the values are valid. + +**Returns:** Whether the keyframes are valid or not. + +## Static Methods + +### .toJSON( track : KeyframeTrack ) : Object + +Converts the keyframe track to JSON. + +**track** + +The keyframe track to serialize. + +**Returns:** The serialized keyframe track as JSON. + +## Source + +[src/animation/KeyframeTrack.js](https://github.com/mrdoob/three.js/blob/master/src/animation/KeyframeTrack.js) \ No newline at end of file diff --git a/docs/pages/KnotCurve.html.md b/docs/pages/KnotCurve.html.md new file mode 100644 index 00000000000000..405b82ac940bc4 --- /dev/null +++ b/docs/pages/KnotCurve.html.md @@ -0,0 +1,39 @@ +*Inheritance: Curve →* + +# KnotCurve + +A knot curve. + +## Import + +KnotCurve is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { KnotCurve } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new KnotCurve() + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/LDrawConditionalLineMaterial.html.md b/docs/pages/LDrawConditionalLineMaterial.html.md new file mode 100644 index 00000000000000..c3c9d1190f6212 --- /dev/null +++ b/docs/pages/LDrawConditionalLineMaterial.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → Material → ShaderMaterial →* + +# LDrawConditionalLineMaterial + +A special line material for meshes loaded via [LDrawLoader](LDrawLoader.html). + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import the class from `LDrawConditionalLineNodeMaterial.js`. + +## Import + +LDrawConditionalLineMaterial is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LDrawConditionalLineMaterial } from 'three/addons/materials/LDrawConditionalLineMaterial.js'; +``` + +## Constructor + +### new LDrawConditionalLineMaterial( parameters : Object ) + +Constructs a new conditional line material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .color : Color + +The material's color. + +Default is `(1,1,1)`. + +### .isLDrawConditionalLineMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .opacity : number + +The material's opacity. + +Default is `1`. + +**Overrides:** [ShaderMaterial#opacity](ShaderMaterial.html#opacity) + +## Source + +[examples/jsm/materials/LDrawConditionalLineMaterial.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/materials/LDrawConditionalLineMaterial.js) \ No newline at end of file diff --git a/docs/pages/LDrawLoader.html.md b/docs/pages/LDrawLoader.html.md new file mode 100644 index 00000000000000..5ebb127cb1b44a --- /dev/null +++ b/docs/pages/LDrawLoader.html.md @@ -0,0 +1,199 @@ +*Inheritance: Loader →* + +# LDrawLoader + +A loader for the LDraw format. + +\[LDraw\](https://ldraw.org/} (LEGO Draw) is an [open format specification](https://ldraw.org/article/218.html) for describing LEGO and other construction set 3D models. + +An LDraw asset (a text file usually with extension .ldr, .dat or .txt) can describe just a single construction piece, or an entire model. In the case of a model the LDraw file can reference other LDraw files, which are loaded from a library path set with `setPartsLibraryPath`. You usually download the LDraw official parts library, extract to a folder and point setPartsLibraryPath to it. + +Library parts will be loaded by trial and error in subfolders 'parts', 'p' and 'models'. These file accesses are not optimal for web environment, so a script tool has been made to pack an LDraw file with all its dependencies into a single file, which loads much faster. See section 'Packing LDraw models'. The LDrawLoader example loads several packed files. The official parts library is not included due to its large size. + +`LDrawLoader` supports the following extensions: + +* !COLOUR: Color and surface finish declarations. +* BFC: Back Face Culling specification. +* !CATEGORY: Model/part category declarations. +* !KEYWORDS: Model/part keywords declarations. + +## Code Example + +```js +const loader = new LDrawLoader(); +loader.setConditionalLineMaterial( LDrawConditionalLineMaterial ); // the type of line material depends on the used renderer +const object = await loader.loadAsync( 'models/ldraw/officialLibrary/models/car.ldr_Packed.mpd' ); +scene.add( object ); +``` + +## Import + +LDrawLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LDrawLoader } from 'three/addons/loaders/LDrawLoader.js'; +``` + +## Constructor + +### new LDrawLoader( manager : LoadingManager ) + +Constructs a new LDraw loader. + +**manager** + +The loading manager. + +## Methods + +### .addDefaultMaterials() : LDrawLoader + +Initializes the loader with default materials. + +**Returns:** A reference to this loader. + +### .addMaterial( material : Material ) : LDrawLoader + +Adds a single material to the loader's material library. + +**material** + +The material to add. + +**Returns:** A reference to this loader. + +### .addMaterials( materials : Array. ) : LDrawLoader + +Adds a list of materials to the loader's material library. + +**materials** + +The materials to add. + +**Returns:** A reference to this loader. + +### .clearMaterials() : LDrawLoader + +Clears the loader's material library. + +**Returns:** A reference to this loader. + +### .getMainEdgeMaterial() : Material + +Returns the material for the edges main LDraw color. + +**Returns:** The material. Returns `null` if no material has been found. + +### .getMainMaterial() : Material + +Returns the Material for the main LDraw color. + +For an already loaded LDraw asset, returns the Material associated with the main color code. This method can be useful to modify the main material of a model or part that exposes it. + +The main color code is the standard way to color an LDraw part. It is '16' for triangles and '24' for edges. Usually a complete model will not expose the main color (that is, no part uses the code '16' at the top level, because they are assigned other specific colors) An LDraw part file on the other hand will expose the code '16' to be colored, and can have additional fixed colors. + +**Returns:** The material. Returns `null` if no material has been found. + +### .getMaterial( colorCode : string ) : Material + +Returns a material for the given color code. + +**colorCode** + +The color code. + +**Returns:** The material. Returns `null` if no material has been found. + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded LDraw asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string, onLoad : function, onError : onErrorCallback ) + +Parses the given LDraw data and returns the resulting group. + +**text** + +The raw VRML data as a string. + +**onLoad** + +Executed when the loading/parsing process has been finished. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#parse](Loader.html#parse) + +### .preloadMaterials( url : string ) : Promise (async) + +This async method preloads materials from a single LDraw file. In the official parts library there is a special file which is loaded always the first (LDConfig.ldr) and contains all the standard color codes. This method is intended to be used with not packed files, for example in an editor where materials are preloaded and parts are loaded on demand. + +**url** + +Path of the LDraw materials asset. + +**Returns:** A Promise that resolves when the preload has finished. + +### .setConditionalLineMaterial( type : LDrawConditionalLineMaterial.constructor | LDrawConditionalLineNodeMaterial.constructor ) : LDrawLoader + +Sets the conditional line material type which depends on the used renderer. Use [LDrawConditionalLineMaterial](LDrawConditionalLineMaterial.html) when using `WebGLRenderer` and LDrawConditionalLineNodeMaterial when using `WebGPURenderer`. + +**type** + +The conditional line material type. + +**Returns:** A reference to this loader. + +### .setFileMap( fileMap : Object. ) : LDrawLoader + +Sets a map which maps referenced library filenames to new filenames. If a fileMap is not specified (the default), library parts will be accessed by trial and error in subfolders 'parts', 'p' and 'models'. + +**fileMap** + +The file map to set. + +**Returns:** A reference to this loader. + +### .setMaterials( materials : Array. ) : LDrawLoader + +Sets the loader's material library. This method clears existing material definitions. + +**materials** + +The materials to set. + +**Returns:** A reference to this loader. + +### .setPartsLibraryPath( path : string ) : LDrawLoader + +This method must be called prior to `load()` unless the model to load does not reference library parts (usually it will be a model with all its parts packed in a single file). + +**path** + +Path to library parts files to load referenced parts from. This is different from Loader.setPath, which indicates the path to load the main asset from. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/LDrawLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/LDrawLoader.js) \ No newline at end of file diff --git a/docs/pages/LDrawUtils.html.md b/docs/pages/LDrawUtils.html.md new file mode 100644 index 00000000000000..666780482857d1 --- /dev/null +++ b/docs/pages/LDrawUtils.html.md @@ -0,0 +1,31 @@ +# LDrawUtils + +Utility class for LDraw models. + +## Import + +LDrawUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LDrawUtils } from 'three/addons/utils/LDrawUtils.js'; +``` + +## Constructor + +### new LDrawUtils() + +## Static Methods + +### .mergeObject( object : Object3D ) : Group + +Merges geometries in the given object by materials and returns a new group object. Use on not indexed geometries. The object buffers reference the old object ones. Special treatment is done to the conditional lines generated by LDrawLoader. + +**object** + +The object to merge. + +**Returns:** The merged object. + +## Source + +[examples/jsm/utils/LDrawUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/LDrawUtils.js) \ No newline at end of file diff --git a/docs/pages/LOD.html.md b/docs/pages/LOD.html.md new file mode 100644 index 00000000000000..36bdc6a26c3e66 --- /dev/null +++ b/docs/pages/LOD.html.md @@ -0,0 +1,121 @@ +*Inheritance: EventDispatcher → Object3D →* + +# LOD + +A component for providing a basic Level of Detail (LOD) mechanism. + +Every LOD level is associated with an object, and rendering can be switched between them at the distances specified. Typically you would create, say, three meshes, one for far away (low detail), one for mid range (medium detail) and one for close up (high detail). + +## Code Example + +```js +const lod = new THREE.LOD(); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +//Create spheres with 3 levels of detail and create new LOD levels for them +for( let i = 0; i < 3; i++ ) { + const geometry = new THREE.IcosahedronGeometry( 10, 3 - i ); + const mesh = new THREE.Mesh( geometry, material ); + lod.addLevel( mesh, i * 75 ); +} +scene.add( lod ); +``` + +## Constructor + +### new LOD() + +Constructs a new LOD. + +## Properties + +### .autoUpdate : boolean + +Whether the LOD object is updated automatically by the renderer per frame or not. If set to `false`, you have to call [LOD#update](LOD.html#update) in the render loop by yourself. + +Default is `true`. + +### .isLOD : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .levels : Array.<{object:Object3D, distance:number, hysteresis:number}> + +This array holds the LOD levels. + +## Methods + +### .addLevel( object : Object3D, distance : number, hysteresis : number ) : LOD + +Adds a mesh that will display at a certain distance and greater. Typically the further away the distance, the lower the detail on the mesh. + +**object** + +The 3D object to display at this level. + +**distance** + +The distance at which to display this level of detail. + +Default is `0`. + +**hysteresis** + +Threshold used to avoid flickering at LOD boundaries, as a fraction of distance. + +Default is `0`. + +**Returns:** A reference to this instance. + +### .getCurrentLevel() : number + +Returns the currently active LOD level index. + +**Returns:** The current active LOD level index. + +### .getObjectForDistance( distance : number ) : Object3D + +Returns a reference to the first 3D object that is greater than the given distance. + +**distance** + +The LOD distance. + +**Returns:** The found 3D object. `null` if no 3D object has been found. + +### .raycast( raycaster : Raycaster, intersects : Array. ) + +Computes intersection points between a casted ray and this LOD. + +**raycaster** + +The raycaster. + +**intersects** + +The target array that holds the intersection points. + +**Overrides:** [Object3D#raycast](Object3D.html#raycast) + +### .removeLevel( distance : number ) : boolean + +Removes an existing level, based on the distance from the camera. Returns `true` when the level has been removed. Otherwise `false`. + +**distance** + +Distance of the level to remove. + +**Returns:** Whether the level has been removed or not. + +### .update( camera : Camera ) + +Updates the LOD by computing which LOD level should be visible according to the current distance of the given camera. + +**camera** + +The camera the scene is rendered with. + +## Source + +[src/objects/LOD.js](https://github.com/mrdoob/three.js/blob/master/src/objects/LOD.js) \ No newline at end of file diff --git a/docs/pages/LUT3dlLoader.html.md b/docs/pages/LUT3dlLoader.html.md new file mode 100644 index 00000000000000..95b369de487b37 --- /dev/null +++ b/docs/pages/LUT3dlLoader.html.md @@ -0,0 +1,97 @@ +*Inheritance: Loader →* + +# LUT3dlLoader + +A loader for the 3DL LUT format. + +References: + +* [3D LUTs](http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492) +* [Format Spec for .3dl](https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258) + +## Code Example + +```js +const loader = new LUT3dlLoader(); +const map = loader.loadAsync( 'luts/Presetpro-Cinematic.3dl' ); +``` + +## Import + +LUT3dlLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LUT3dlLoader } from 'three/addons/loaders/LUT3dlLoader.js'; +``` + +## Constructor + +### new LUT3dlLoader( manager : LoadingManager ) + +Constructs a new 3DL LUT loader. + +**manager** + +The loading manager. + +## Classes + +[LUT3dlLoader](LUT3dlLoader.html) + +## Properties + +### .type : UnsignedByteType | FloatType + +The texture type. + +Default is `UnsignedByteType`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded 3DL LUT asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( input : string ) : Object + +Parses the given 3DL LUT data and returns the resulting 3D data texture. + +**input** + +The raw 3DL LUT data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed 3DL LUT. + +### .setType( type : UnsignedByteType | FloatType ) : LUT3dlLoader + +Sets the texture type. + +**type** + +The texture type to set. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/LUT3dlLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/LUT3dlLoader.js) \ No newline at end of file diff --git a/docs/pages/LUTCubeLoader.html.md b/docs/pages/LUTCubeLoader.html.md new file mode 100644 index 00000000000000..8677cf013df83c --- /dev/null +++ b/docs/pages/LUTCubeLoader.html.md @@ -0,0 +1,96 @@ +*Inheritance: Loader →* + +# LUTCubeLoader + +A loader for the Cube LUT format. + +References: + +* [Cube LUT Specification](https://web.archive.org/web/20220220033515/https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf) + +## Code Example + +```js +const loader = new LUTCubeLoader(); +const map = loader.loadAsync( 'luts/Bourbon 64.CUBE' ); +``` + +## Import + +LUTCubeLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LUTCubeLoader } from 'three/addons/loaders/LUTCubeLoader.js'; +``` + +## Constructor + +### new LUTCubeLoader( manager : LoadingManager ) + +Constructs a new Cube LUT loader. + +**manager** + +The loading manager. + +## Classes + +[LUTCubeLoader](LUTCubeLoader.html) + +## Properties + +### .type : UnsignedByteType | FloatType + +The texture type. + +Default is `UnsignedByteType`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded Cube LUT asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( input : string ) : Object + +Parses the given Cube LUT data and returns the resulting 3D data texture. + +**input** + +The raw Cube LUT data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed Cube LUT. + +### .setType( type : UnsignedByteType | FloatType ) : LUTCubeLoader + +Sets the texture type. + +**type** + +The texture type to set. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/LUTCubeLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/LUTCubeLoader.js) \ No newline at end of file diff --git a/docs/pages/LUTImageLoader.html.md b/docs/pages/LUTImageLoader.html.md new file mode 100644 index 00000000000000..e165130ed14b58 --- /dev/null +++ b/docs/pages/LUTImageLoader.html.md @@ -0,0 +1,88 @@ +*Inheritance: Loader →* + +# LUTImageLoader + +A loader for loading LUT images. + +## Code Example + +```js +const loader = new LUTImageLoader(); +const map = loader.loadAsync( 'luts/NeutralLUT.png' ); +``` + +## Import + +LUTImageLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LUTImageLoader } from 'three/addons/loaders/LUTImageLoader.js'; +``` + +## Constructor + +### new LUTImageLoader( manager : LoadingManager ) + +Constructs a new LUT loader. + +**manager** + +The loading manager. + +## Classes + +[LUTImageLoader](LUTImageLoader.html) + +## Properties + +### .flip : boolean + +Whether to vertically flip the LUT or not. + +Depending on the LUT's origin, the texture has green at the bottom (e.g. for Unreal) or green at the top (e.g. for Unity URP Color Lookup). If you're using lut image strips from a Unity pipeline, then set this property to `true`. + +Default is `false`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded LUT to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( dataArray : Uint8ClampedArray, size : number ) : Object + +Parses the given LUT data and returns the resulting 3D data texture. + +**dataArray** + +The raw LUT data. + +**size** + +The LUT size. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** An object representing the parsed LUT. + +## Source + +[examples/jsm/loaders/LUTImageLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/LUTImageLoader.js) \ No newline at end of file diff --git a/docs/pages/LUTPass.html.md b/docs/pages/LUTPass.html.md new file mode 100644 index 00000000000000..595bbb3376dabb --- /dev/null +++ b/docs/pages/LUTPass.html.md @@ -0,0 +1,50 @@ +*Inheritance: Pass → ShaderPass →* + +# LUTPass + +Pass for color grading via lookup tables. + +## Code Example + +```js +const lutPass = new LUTPass( { lut: lut.texture3D } ); +composer.addPass( lutPass ); +``` + +## Import + +LUTPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LUTPass } from 'three/addons/postprocessing/LUTPass.js'; +``` + +## Constructor + +### new LUTPass( options : Object ) + +Constructs a LUT pass. + +**options** + +The pass options. + +Default is `{}`. + +## Properties + +### .intensity : number + +The intensity. + +Default is `1`. + +### .lut : Data3DTexture + +The LUT as a 3D texture. + +Default is `null`. + +## Source + +[examples/jsm/postprocessing/LUTPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/LUTPass.js) \ No newline at end of file diff --git a/docs/pages/LWOLoader.html.md b/docs/pages/LWOLoader.html.md new file mode 100644 index 00000000000000..fa8cc1f439d8c3 --- /dev/null +++ b/docs/pages/LWOLoader.html.md @@ -0,0 +1,87 @@ +*Inheritance: Loader →* + +# LWOLoader + +A loader for the LWO format. + +LWO3 and LWO2 formats are supported. + +References: + +* [LWO3 format specification](https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo3.html) +* [LWO2 format specification](https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo2.html) + +## Code Example + +```js +const loader = new LWOLoader(); +const lwoData = await loader.loadAsync( 'models/lwo/Objects/LWO3/Demo.lwo' ); +const mesh = object.meshes[ 0 ]; +scene.add( mesh ); +``` + +## Import + +LWOLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LWOLoader } from 'three/addons/loaders/LWOLoader.js'; +``` + +## Constructor + +### new LWOLoader( manager : LoadingManager ) + +Constructs a new LWO loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded LWO asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( iffBuffer : ArrayBuffer, path : string, modelName : string ) : Object + +Parses the given LWO data and returns the resulting meshes and materials. + +**iffBuffer** + +The raw LWO data as an array buffer. + +**path** + +The URL base path. + +**modelName** + +The model name. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** An object holding the parse meshes and materials. + +## Source + +[examples/jsm/loaders/LWOLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/LWOLoader.js) \ No newline at end of file diff --git a/docs/pages/LatheGeometry.html.md b/docs/pages/LatheGeometry.html.md new file mode 100644 index 00000000000000..09b6ac4dbcf82d --- /dev/null +++ b/docs/pages/LatheGeometry.html.md @@ -0,0 +1,68 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# LatheGeometry + +Creates meshes with axial symmetry like vases. The lathe rotates around the Y axis. + +## Code Example + +```js +const points = []; +for ( let i = 0; i < 10; i ++ ) { + points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 10 + 5, ( i - 5 ) * 2 ) ); +} +const geometry = new THREE.LatheGeometry( points ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const lathe = new THREE.Mesh( geometry, material ); +scene.add( lathe ); +``` + +## Constructor + +### new LatheGeometry( points : Array.<(Vector2|Vector3)>, segments : number, phiStart : number, phiLength : number ) + +Constructs a new lathe geometry. + +**points** + +An array of points in 2D space. The x-coordinate of each point must be greater than zero. + +**segments** + +The number of circumference segments to generate. + +Default is `12`. + +**phiStart** + +The starting angle in radians. + +Default is `0`. + +**phiLength** + +The radian (0 to 2PI) range of the lathed section 2PI is a closed lathe, less than 2PI is a portion. + +Default is `Math.PI*2`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : LatheGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/LatheGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/LatheGeometry.js) \ No newline at end of file diff --git a/docs/pages/Layers.html.md b/docs/pages/Layers.html.md new file mode 100644 index 00000000000000..28caa7e53c424f --- /dev/null +++ b/docs/pages/Layers.html.md @@ -0,0 +1,85 @@ +# Layers + +A layers object assigns an 3D object to 1 or more of 32 layers numbered `0` to `31` - internally the layers are stored as a bit mask\], and by default all 3D objects are a member of layer `0`. + +This can be used to control visibility - an object must share a layer with a camera to be visible when that camera's view is rendered. + +All classes that inherit from [Object3D](Object3D.html) have an `layers` property which is an instance of this class. + +## Constructor + +### new Layers() + +Constructs a new layers instance, with membership initially set to layer `0`. + +## Properties + +### .mask : number + +A bit mask storing which of the 32 layers this layers object is currently a member of. + +## Methods + +### .disable( layer : number ) + +Removes membership of the given layer. + +**layer** + +The layer to enable. + +### .disableAll() + +Removes the membership from all layers. + +### .enable( layer : number ) + +Adds membership of the given layer. + +**layer** + +The layer to enable. + +### .enableAll() + +Adds membership to all layers. + +### .isEnabled( layer : number ) : boolean + +Returns `true` if the given layer is enabled. + +**layer** + +The layer to test. + +**Returns:** Whether the given layer is enabled or not. + +### .set( layer : number ) + +Sets membership to the given layer, and remove membership all other layers. + +**layer** + +The layer to set. + +### .test( layers : Layers ) : boolean + +Returns `true` if this and the given layers object have at least one layer in common. + +**layers** + +The layers to test. + +**Returns:** Whether this and the given layers object have at least one layer in common or not. + +### .toggle( layer : number ) + +Toggles the membership of the given layer. + +**layer** + +The layer to toggle. + +## Source + +[src/core/Layers.js](https://github.com/mrdoob/three.js/blob/master/src/core/Layers.js) \ No newline at end of file diff --git a/docs/pages/Lensflare.html.md b/docs/pages/Lensflare.html.md new file mode 100644 index 00000000000000..1f552320f7ee04 --- /dev/null +++ b/docs/pages/Lensflare.html.md @@ -0,0 +1,74 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# Lensflare + +Creates a simulated lens flare that tracks a light. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [LensflareMesh](LensflareMesh.html). + +## Code Example + +```js +const light = new THREE.PointLight( 0xffffff, 1.5, 2000 ); +const lensflare = new Lensflare(); +lensflare.addElement( new LensflareElement( textureFlare0, 512, 0 ) ); +lensflare.addElement( new LensflareElement( textureFlare1, 512, 0 ) ); +lensflare.addElement( new LensflareElement( textureFlare2, 60, 0.6 ) ); +light.add( lensflare ); +``` + +## Import + +Lensflare is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Lensflare } from 'three/addons/objects/Lensflare.js'; +``` + +## Constructor + +### new Lensflare() + +Constructs a new lensflare. + +## Properties + +### .frustumCulled : boolean + +Overwritten to disable view-frustum culling by default. + +Default is `false`. + +**Overrides:** [Mesh#frustumCulled](Mesh.html#frustumCulled) + +### .isLensflare : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .renderOrder : number + +Overwritten to make sure lensflares a rendered last. + +Default is `Infinity`. + +**Overrides:** [Mesh#renderOrder](Mesh.html#renderOrder) + +## Methods + +### .addElement( element : LensflareElement ) + +Adds the given lensflare element to this instance. + +**element** + +The element to add. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[examples/jsm/objects/Lensflare.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Lensflare.js) \ No newline at end of file diff --git a/docs/pages/LensflareElement.html.md b/docs/pages/LensflareElement.html.md new file mode 100644 index 00000000000000..d266c784f8202a --- /dev/null +++ b/docs/pages/LensflareElement.html.md @@ -0,0 +1,65 @@ +# LensflareElement + +Represents a single flare that can be added to a [Lensflare](Lensflare.html) container. + +## Import + +LensflareElement is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LensflareElement } from 'three/addons/objects/Lensflare.js'; +``` + +## Constructor + +### new LensflareElement( texture : Texture, size : number, distance : number, color : Color ) + +Constructs a new lensflare element. + +**texture** + +The flare's texture. + +**size** + +The size in pixels. + +Default is `1`. + +**distance** + +The normalized distance (`[0,1]`) from the light source. A value of `0` means the flare is located at light source. + +Default is `0`. + +**color** + +The flare's color + +## Properties + +### .color : Color + +The flare's color + +Default is `(1,1,1)`. + +### .distance : number + +The normalized distance (`[0,1]`) from the light source. A value of `0` means the flare is located at light source. + +Default is `0`. + +### .size : number + +The size in pixels. + +Default is `1`. + +### .texture : Texture + +The flare's texture. + +## Source + +[examples/jsm/objects/Lensflare.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Lensflare.js) \ No newline at end of file diff --git a/docs/pages/LensflareMesh.html.md b/docs/pages/LensflareMesh.html.md new file mode 100644 index 00000000000000..dc510ce6212139 --- /dev/null +++ b/docs/pages/LensflareMesh.html.md @@ -0,0 +1,74 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# LensflareMesh + +Creates a simulated lens flare that tracks a light. + +Note that this class can only be used with [WebGPURenderer](WebGPURenderer.html). When using [WebGLRenderer](WebGLRenderer.html), use [Lensflare](Lensflare.html). + +## Code Example + +```js +const light = new THREE.PointLight( 0xffffff, 1.5, 2000 ); +const lensflare = new LensflareMesh(); +lensflare.addElement( new LensflareElement( textureFlare0, 512, 0 ) ); +lensflare.addElement( new LensflareElement( textureFlare1, 512, 0 ) ); +lensflare.addElement( new LensflareElement( textureFlare2, 60, 0.6 ) ); +light.add( lensflare ); +``` + +## Import + +LensflareMesh is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LensflareMesh } from 'three/addons/objects/LensflareMesh.js'; +``` + +## Constructor + +### new LensflareMesh() + +Constructs a new lensflare mesh. + +## Properties + +### .frustumCulled : boolean + +Overwritten to disable view-frustum culling by default. + +Default is `false`. + +**Overrides:** [Mesh#frustumCulled](Mesh.html#frustumCulled) + +### .isLensflareMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .renderOrder : number + +Overwritten to make sure lensflares a rendered last. + +Default is `Infinity`. + +**Overrides:** [Mesh#renderOrder](Mesh.html#renderOrder) + +## Methods + +### .addElement( element : LensflareElement ) + +Adds the given lensflare element to this instance. + +**element** + +The element to add. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[examples/jsm/objects/LensflareMesh.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/LensflareMesh.js) \ No newline at end of file diff --git a/docs/pages/LensflareNode.html.md b/docs/pages/LensflareNode.html.md new file mode 100644 index 00000000000000..23af54562e84b6 --- /dev/null +++ b/docs/pages/LensflareNode.html.md @@ -0,0 +1,156 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# LensflareNode + +Post processing node for adding a bloom-based lens flare effect. This effect requires that you extract the bloom of the scene via a bloom pass first. + +References: + +* [https://john-chapman-graphics.blogspot.com/2013/02/pseudo-lens-flare.html](https://john-chapman-graphics.blogspot.com/2013/02/pseudo-lens-flare.html). +* [https://john-chapman.github.io/2017/11/05/pseudo-lens-flare.html](https://john-chapman.github.io/2017/11/05/pseudo-lens-flare.html). + +## Import + +LensflareNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { lensflare } from 'three/addons/tsl/display/LensflareNode.js'; +``` + +## Constructor + +### new LensflareNode( textureNode : TextureNode, params : Object ) + +Constructs a new lens flare node. + +**textureNode** + +The texture node that represents the scene's bloom. + +**params** + +The parameter object for configuring the effect. + +**ghostTint** + +Defines the tint of the flare/ghosts. + +Default is `vec3(1, 1, 1)`. + +**threshold** + +Controls the size and strength of the effect. A higher threshold results in smaller flares. + +Default is `float(0.5)`. + +**ghostSamples** + +Represents the number of flares/ghosts per bright spot which pivot around the center. + +Default is `float(4)`. + +**ghostSpacing** + +Defines the spacing of the flares/ghosts. + +Default is `float(0.25)`. + +**ghostAttenuationFactor** + +Defines the attenuation factor of flares/ghosts. + +Default is `float(25)`. + +**downSampleRatio** + +Defines how downsampling since the effect is usually not rendered at full resolution. + +Default is `4`. + +## Properties + +### .downSampleRatio : number + +Defines how downsampling since the effect is usually not rendered at full resolution. + +### .ghostAttenuationFactorNode : Node. + +Defines the attenuation factor of flares/ghosts. + +### .ghostSamplesNode : Node. + +Represents the number of flares/ghosts per bright spot which pivot around the center. + +### .ghostSpacingNode : Node. + +Defines the spacing of the flares/ghosts. + +### .ghostTintNode : Node. + +Defines the tint of the flare/ghosts. + +### .textureNode : TextureNode + +The texture node that represents the scene's bloom. + +### .thresholdNode : Node. + +Controls the size and strength of the effect. A higher threshold results in smaller flares. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/LensflareNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/LensflareNode.js) \ No newline at end of file diff --git a/docs/pages/Light.html.md b/docs/pages/Light.html.md new file mode 100644 index 00000000000000..22a58526cd9c63 --- /dev/null +++ b/docs/pages/Light.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Light + +Abstract base class for lights - all other light types inherit the properties and methods described here. + +## Constructor + +### new Light( color : number | Color | string, intensity : number ) (abstract) + +Constructs a new light. + +**color** + +The light's color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity. + +Default is `1`. + +## Properties + +### .color : Color + +The light's color. + +### .intensity : number + +The light's intensity. + +Default is `1`. + +### .isLight : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[src/lights/Light.js](https://github.com/mrdoob/three.js/blob/master/src/lights/Light.js) \ No newline at end of file diff --git a/docs/pages/LightProbe.html.md b/docs/pages/LightProbe.html.md new file mode 100644 index 00000000000000..7440063bc1d82c --- /dev/null +++ b/docs/pages/LightProbe.html.md @@ -0,0 +1,41 @@ +*Inheritance: EventDispatcher → Object3D → Light →* + +# LightProbe + +Light probes are an alternative way of adding light to a 3D scene. Unlike classical light sources (e.g. directional, point or spot lights), light probes do not emit light. Instead they store information about light passing through 3D space. During rendering, the light that hits a 3D object is approximated by using the data from the light probe. + +Light probes are usually created from (radiance) environment maps. The class [LightProbeGenerator](LightProbeGenerator.html) can be used to create light probes from cube textures or render targets. However, light estimation data could also be provided in other forms e.g. by WebXR. This enables the rendering of augmented reality content that reacts to real world lighting. + +The current probe implementation in three.js supports so-called diffuse light probes. This type of light probe is functionally equivalent to an irradiance environment map. + +## Constructor + +### new LightProbe( sh : SphericalHarmonics3, intensity : number ) + +Constructs a new light probe. + +**sh** + +The spherical harmonics which represents encoded lighting information. + +**intensity** + +The light's strength/intensity. + +Default is `1`. + +## Properties + +### .isLightProbe : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .sh : SphericalHarmonics3 + +A light probe uses spherical harmonics to encode lighting information. + +## Source + +[src/lights/LightProbe.js](https://github.com/mrdoob/three.js/blob/master/src/lights/LightProbe.js) \ No newline at end of file diff --git a/docs/pages/LightProbeGenerator.html.md b/docs/pages/LightProbeGenerator.html.md new file mode 100644 index 00000000000000..1f8dd74187f4d0 --- /dev/null +++ b/docs/pages/LightProbeGenerator.html.md @@ -0,0 +1,43 @@ +# LightProbeGenerator + +Utility class for creating instances of [LightProbe](LightProbe.html). + +## Import + +LightProbeGenerator is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; +``` + +## Static Methods + +### .fromCubeRenderTarget( renderer : WebGPURenderer | WebGLRenderer, cubeRenderTarget : CubeRenderTarget | WebGLCubeRenderTarget ) : Promise. (async) + +Creates a light probe from the given (radiance) environment map. The method expects that the environment map is represented as a cube render target. + +The cube render target must be in RGBA so `cubeRenderTarget.texture.format` must be set to [RGBAFormat](global.html#RGBAFormat). + +**renderer** + +The renderer. + +**cubeRenderTarget** + +The environment map. + +**Returns:** A Promise that resolves with the created light probe. + +### .fromCubeTexture( cubeTexture : CubeTexture ) : LightProbe + +Creates a light probe from the given (radiance) environment map. The method expects that the environment map is represented as a cube texture. + +**cubeTexture** + +The environment map. + +**Returns:** The created light probe. + +## Source + +[examples/jsm/lights/LightProbeGenerator.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lights/LightProbeGenerator.js) \ No newline at end of file diff --git a/docs/pages/LightProbeHelper.html.md b/docs/pages/LightProbeHelper.html.md new file mode 100644 index 00000000000000..47e6304c4bf365 --- /dev/null +++ b/docs/pages/LightProbeHelper.html.md @@ -0,0 +1,60 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# LightProbeHelper + +Renders a sphere to visualize a light probe in the scene. + +This helper can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import from `LightProbeHelperGPU.js`. + +## Code Example + +```js +const helper = new LightProbeHelper( lightProbe ); +scene.add( helper ); +``` + +## Import + +LightProbeHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js'; +``` + +## Constructor + +### new LightProbeHelper( lightProbe : LightProbe, size : number ) + +Constructs a new light probe helper. + +**lightProbe** + +The light probe to visualize. + +**size** + +The size of the helper. + +Default is `1`. + +## Properties + +### .lightProbe : LightProbe + +The light probe to visualize. + +### .size : number + +The size of the helper. + +Default is `1`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[examples/jsm/helpers/LightProbeHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/LightProbeHelper.js) \ No newline at end of file diff --git a/docs/pages/LightProbeNode.html.md b/docs/pages/LightProbeNode.html.md new file mode 100644 index 00000000000000..1b4c61a6650a79 --- /dev/null +++ b/docs/pages/LightProbeNode.html.md @@ -0,0 +1,39 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode →* + +# LightProbeNode + +Module for representing light probes as nodes. + +## Constructor + +### new LightProbeNode( light : LightProbe ) + +Constructs a new light probe node. + +**light** + +The light probe. + +Default is `null`. + +## Properties + +### .lightProbe : UniformArrayNode + +Light probe represented as a uniform of spherical harmonics. + +## Methods + +### .update( frame : NodeFrame ) + +Overwritten to updated light probe specific uniforms. + +**frame** + +A reference to the current node frame. + +**Overrides:** [AnalyticLightNode#update](AnalyticLightNode.html#update) + +## Source + +[src/nodes/lighting/LightProbeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/LightProbeNode.js) \ No newline at end of file diff --git a/docs/pages/LightShadow.html.md b/docs/pages/LightShadow.html.md new file mode 100644 index 00000000000000..16a950f3e9d0a4 --- /dev/null +++ b/docs/pages/LightShadow.html.md @@ -0,0 +1,165 @@ +# LightShadow + +Abstract base class for light shadow classes. These classes represent the shadow configuration for different light types. + +## Constructor + +### new LightShadow( camera : Camera ) (abstract) + +Constructs a new light shadow. + +**camera** + +The light's view of the world. + +## Properties + +### .autoUpdate : boolean + +Enables automatic updates of the light's shadow. If you do not require dynamic lighting / shadows, you may set this to `false`. + +Default is `true`. + +### .bias : number + +Shadow map bias, how much to add or subtract from the normalized depth when deciding whether a surface is in shadow. + +The default is `0`. Very tiny adjustments here (in the order of `0.0001`) may help reduce artifacts in shadows. + +Default is `0`. + +### .blurSamples : number + +The amount of samples to use when blurring a VSM shadow map. + +Default is `8`. + +### .camera : Camera + +The light's view of the world. + +### .intensity : number + +The intensity of the shadow. The default is `1`. Valid values are in the range `[0, 1]`. + +Default is `1`. + +### .map : RenderTarget + +The depth map generated using the internal camera; a location beyond a pixel's depth is in shadow. Computed internally during rendering. + +Default is `null`. + +### .mapPass : RenderTarget + +The distribution map generated using the internal camera; an occlusion is calculated based on the distribution of depths. Computed internally during rendering. + +Default is `null`. + +### .mapSize : Vector2 + +Defines the width and height of the shadow map. Higher values give better quality shadows at the cost of computation time. Values must be powers of two. + +Default is `(512,512)`. + +### .mapType : number + +The type of shadow texture. The default is `UnsignedByteType`. + +Default is `UnsignedByteType`. + +### .matrix : Matrix4 + +Model to shadow camera space, to compute location and depth in shadow map. This is computed internally during rendering. + +### .needsUpdate : boolean + +When set to `true`, shadow maps will be updated in the next `render` call. If you have set [LightShadow#autoUpdate](LightShadow.html#autoUpdate) to `false`, you will need to set this property to `true` and then make a render call to update the light's shadow. + +Default is `false`. + +### .normalBias : number + +Defines how much the position used to query the shadow map is offset along the object normal. The default is `0`. Increasing this value can be used to reduce shadow acne especially in large scenes where light shines onto geometry at a shallow angle. The cost is that shadows may appear distorted. + +Default is `0`. + +### .radius : number + +Setting this to values greater than 1 will blur the edges of the shadow. High values will cause unwanted banding effects in the shadows - a greater map size will allow for a higher value to be used here before these effects become visible. + +The property has no effect when the shadow map type is `BasicShadowMap`. + +Default is `1`. + +## Methods + +### .clone() : LightShadow + +Returns a new light shadow instance with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( source : LightShadow ) : LightShadow + +Copies the values of the given light shadow instance to this instance. + +**source** + +The light shadow to copy. + +**Returns:** A reference to this light shadow instance. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .getFrameExtents() : Vector2 + +Returns the frame extends. + +**Returns:** The frame extends. + +### .getFrustum() : Frustum + +Gets the shadow cameras frustum. Used internally by the renderer to cull objects. + +**Returns:** The shadow camera frustum. + +### .getViewport( viewportIndex : number ) : Vector4 + +Returns a viewport definition for the given viewport index. + +**viewportIndex** + +The viewport index. + +**Returns:** The viewport. + +### .getViewportCount() : number + +Used internally by the renderer to get the number of viewports that need to be rendered for this shadow. + +**Returns:** The viewport count. + +### .toJSON() : Object + +Serializes the light shadow into JSON. + +See: + +* [ObjectLoader#parse](ObjectLoader.html#parse) + +**Returns:** A JSON object representing the serialized light shadow. + +### .updateMatrices( light : Light ) + +Update the matrices for the camera and shadow, used internally by the renderer. + +**light** + +The light for which the shadow is being rendered. + +## Source + +[src/lights/LightShadow.js](https://github.com/mrdoob/three.js/blob/master/src/lights/LightShadow.js) \ No newline at end of file diff --git a/docs/pages/LightingContextNode.html.md b/docs/pages/LightingContextNode.html.md new file mode 100644 index 00000000000000..c266122542beb2 --- /dev/null +++ b/docs/pages/LightingContextNode.html.md @@ -0,0 +1,65 @@ +*Inheritance: EventDispatcher → Node → ContextNode →* + +# LightingContextNode + +`LightingContextNode` represents an extension of the [ContextNode](ContextNode.html) module by adding lighting specific context data. It represents the runtime context of [LightsNode](LightsNode.html). + +## Constructor + +### new LightingContextNode( lightsNode : LightsNode, lightingModel : LightingModel, backdropNode : Node., backdropAlphaNode : Node. ) + +Constructs a new lighting context node. + +**lightsNode** + +The lights node. + +**lightingModel** + +The current lighting model. + +Default is `null`. + +**backdropNode** + +A backdrop node. + +Default is `null`. + +**backdropAlphaNode** + +A backdrop alpha node. + +Default is `null`. + +## Properties + +### .backdropAlphaNode : Node. + +A backdrop alpha node. + +Default is `null`. + +### .backdropNode : Node. + +A backdrop node. + +Default is `null`. + +### .lightingModel : LightingModel + +The current lighting model. + +Default is `null`. + +## Methods + +### .getContext() : Object + +Returns a lighting context object. + +**Returns:** The lighting context object. + +## Source + +[src/nodes/lighting/LightingContextNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/LightingContextNode.js) \ No newline at end of file diff --git a/docs/pages/LightingModel.html.md b/docs/pages/LightingModel.html.md new file mode 100644 index 00000000000000..da386870399a1f --- /dev/null +++ b/docs/pages/LightingModel.html.md @@ -0,0 +1,69 @@ +# LightingModel + +Abstract class for implementing lighting models. The module defines multiple methods that concrete lighting models can implement. These methods are executed at different points during the light evaluation process. + +## Constructor + +### new LightingModel() + +## Methods + +### .ambientOcclusion( builder : NodeBuilder ) (abstract) + +This method is intended for implementing the ambient occlusion term. Unlike other methods, this method must be called manually by the lighting model in its indirect term. + +**builder** + +The current node builder. + +### .direct( lightData : Object, builder : NodeBuilder ) (abstract) + +This method is intended for implementing the direct light term and executed during the build process of directional, point and spot light nodes. + +**lightData** + +The light data. + +**builder** + +The current node builder. + +### .directRectArea( lightData : Object, builder : NodeBuilder ) (abstract) + +This method is intended for implementing the direct light term for rect area light nodes. + +**lightData** + +The light data. + +**builder** + +The current node builder. + +### .finish( builder : NodeBuilder ) (abstract) + +This method is intended for executing final tasks like final updates to the outgoing light. + +**builder** + +The current node builder. + +### .indirect( builder : NodeBuilder ) (abstract) + +This method is intended for implementing the indirect light term. + +**builder** + +The current node builder. + +### .start( builder : NodeBuilder ) (abstract) + +This method is intended for setting up lighting model and context data which are later used in the evaluation process. + +**builder** + +The current node builder. + +## Source + +[src/nodes/core/LightingModel.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/LightingModel.js) \ No newline at end of file diff --git a/docs/pages/LightingNode.html.md b/docs/pages/LightingNode.html.md new file mode 100644 index 00000000000000..d58ab93db989b1 --- /dev/null +++ b/docs/pages/LightingNode.html.md @@ -0,0 +1,23 @@ +*Inheritance: EventDispatcher → Node →* + +# LightingNode + +Base class for lighting nodes. + +## Constructor + +### new LightingNode() + +Constructs a new lighting node. + +## Properties + +### .isLightingNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/nodes/lighting/LightingNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/LightingNode.js) \ No newline at end of file diff --git a/docs/pages/LightsNode.html.md b/docs/pages/LightsNode.html.md new file mode 100644 index 00000000000000..2f190fceec0932 --- /dev/null +++ b/docs/pages/LightsNode.html.md @@ -0,0 +1,127 @@ +*Inheritance: EventDispatcher → Node →* + +# LightsNode + +This node represents the scene's lighting and manages the lighting model's life cycle for the current build 3D object. It is responsible for computing the total outgoing light in a given lighting context. + +## Constructor + +### new LightsNode() + +Constructs a new lights node. + +## Properties + +### .global : boolean + +`LightsNode` sets this property to `true` by default. + +Default is `true`. + +**Overrides:** [Node#global](Node.html#global) + +### .hasLights : boolean + +Whether the scene has lights or not. + +### .outgoingLightNode : Node. + +A node representing the outgoing light. + +### .totalDiffuseNode : Node. + +A node representing the total diffuse light. + +### .totalSpecularNode : Node. + +A node representing the total specular light. + +## Methods + +### .customCacheKey() : number + +Overwrites the default [Node#customCacheKey](Node.html#customCacheKey) implementation by including light data into the cache key. + +**Overrides:** [Node#customCacheKey](Node.html#customCacheKey) + +**Returns:** The custom cache key. + +### .getHash( builder : NodeBuilder ) : string + +Computes a hash value for identifying the current light nodes setup. + +**builder** + +A reference to the current node builder. + +**Overrides:** [Node#getHash](Node.html#getHash) + +**Returns:** The computed hash. + +### .getLights() : Array. + +Returns an array of the scene's lights. + +**Returns:** The scene's lights. + +### .setLights( lights : Array. ) : LightsNode + +Configures this node with an array of lights. + +**lights** + +An array of lights. + +**Returns:** A reference to this node. + +### .setup( builder : NodeBuilder ) : Node. + +The implementation makes sure that for each light in the scene there is a corresponding light node. By building the light nodes and evaluating the lighting model the outgoing light is computed. + +**builder** + +A reference to the current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** A node representing the outgoing light. + +### .setupDirectLight( builder : Object, lightNode : Object, lightData : Object ) + +Sets up a direct light in the lighting model. + +**builder** + +The builder object containing the context and stack. + +**lightNode** + +The light node. + +**lightData** + +The light object containing color and direction properties. + +### .setupLights( builder : NodeBuilder, lightNodes : Array. ) + +Setups the internal lights by building all respective light nodes. + +**builder** + +A reference to the current node builder. + +**lightNodes** + +An array of lighting nodes. + +### .setupLightsNode( builder : NodeBuilder ) + +Creates lighting nodes for each scene light. This makes it possible to further process lights in the node system. + +**builder** + +A reference to the current node builder. + +## Source + +[src/nodes/lighting/LightsNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/LightsNode.js) \ No newline at end of file diff --git a/docs/pages/Line.html.md b/docs/pages/Line.html.md new file mode 100644 index 00000000000000..f6cf708b04eba9 --- /dev/null +++ b/docs/pages/Line.html.md @@ -0,0 +1,92 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Line + +A continuous line. The line are rendered by connecting consecutive vertices with straight lines. + +## Code Example + +```js +const material = new THREE.LineBasicMaterial( { color: 0x0000ff } ); +const points = []; +points.push( new THREE.Vector3( - 10, 0, 0 ) ); +points.push( new THREE.Vector3( 0, 10, 0 ) ); +points.push( new THREE.Vector3( 10, 0, 0 ) ); +const geometry = new THREE.BufferGeometry().setFromPoints( points ); +const line = new THREE.Line( geometry, material ); +scene.add( line ); +``` + +## Constructor + +### new Line( geometry : BufferGeometry, material : Material | Array. ) + +Constructs a new line. + +**geometry** + +The line geometry. + +**material** + +The line material. + +## Properties + +### .geometry : BufferGeometry + +The line geometry. + +### .isLine : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .material : Material | Array. + +The line material. + +Default is `LineBasicMaterial`. + +### .morphTargetDictionary : Object. | undefined + +A dictionary representing the morph targets in the geometry. The key is the morph targets name, the value its attribute index. This member is `undefined` by default and only set when morph targets are detected in the geometry. + +Default is `undefined`. + +### .morphTargetInfluences : Array. | undefined + +An array of weights typically in the range `[0,1]` that specify how much of the morph is applied. This member is `undefined` by default and only set when morph targets are detected in the geometry. + +Default is `undefined`. + +## Methods + +### .computeLineDistances() : Line + +Computes an array of distance values which are necessary for rendering dashed lines. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line. + +**Returns:** A reference to this line. + +### .raycast( raycaster : Raycaster, intersects : Array. ) + +Computes intersection points between a casted ray and this line. + +**raycaster** + +The raycaster. + +**intersects** + +The target array that holds the intersection points. + +**Overrides:** [Object3D#raycast](Object3D.html#raycast) + +### .updateMorphTargets() + +Sets the values of [Line#morphTargetDictionary](Line.html#morphTargetDictionary) and [Line#morphTargetInfluences](Line.html#morphTargetInfluences) to make sure existing morph targets can influence this 3D object. + +## Source + +[src/objects/Line.js](https://github.com/mrdoob/three.js/blob/master/src/objects/Line.js) \ No newline at end of file diff --git a/docs/pages/Line2.html.md b/docs/pages/Line2.html.md new file mode 100644 index 00000000000000..eee2f3c4b7d366 --- /dev/null +++ b/docs/pages/Line2.html.md @@ -0,0 +1,54 @@ +*Inheritance: EventDispatcher → Object3D → Mesh → LineSegments2 →* + +# Line2 + +A polyline drawn between vertices. + +This adds functionality beyond [Line](Line.html), like arbitrary line width and changing width to be in world units.It extends [LineSegments2](LineSegments2.html), simplifying constructing segments from a chain of points. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import the class from `lines/webgpu/Line2.js`. + +## Code Example + +```js +const geometry = new LineGeometry(); +geometry.setPositions( positions ); +geometry.setColors( colors ); +const material = new LineMaterial( { linewidth: 5, vertexColors: true } }; +const line = new Line2( geometry, material ); +scene.add( line ); +``` + +## Import + +Line2 is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Line2 } from 'three/addons/lines/Line2.js'; +``` + +## Constructor + +### new Line2( geometry : LineGeometry, material : LineMaterial ) + +Constructs a new wide line. + +**geometry** + +The line geometry. + +**material** + +The line material. + +## Properties + +### .isLine2 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[examples/jsm/lines/Line2.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/Line2.js) \ No newline at end of file diff --git a/docs/pages/Line2NodeMaterial.html.md b/docs/pages/Line2NodeMaterial.html.md new file mode 100644 index 00000000000000..7e4691f3d6aa34 --- /dev/null +++ b/docs/pages/Line2NodeMaterial.html.md @@ -0,0 +1,111 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# Line2NodeMaterial + +This node material can be used to render lines with a size larger than one by representing them as instanced meshes. + +## Constructor + +### new Line2NodeMaterial( parameters : Object ) + +Constructs a new node material for wide line rendering. + +**parameters** + +The configuration parameter. + +Default is `{}`. + +## Properties + +### .alphaToCoverage : boolean + +Whether alpha to coverage should be used or not. + +Default is `true`. + +**Overrides:** [NodeMaterial#alphaToCoverage](NodeMaterial.html#alphaToCoverage) + +### .blending : number + +Blending is set to `NoBlending` since transparency is not supported, yet. + +Default is `0`. + +**Overrides:** [NodeMaterial#blending](NodeMaterial.html#blending) + +### .dashOffset : number + +The dash offset. + +Default is `0`. + +### .dashScaleNode : Node. + +Defines the dash scale. + +Default is `null`. + +### .dashSizeNode : Node. + +Defines the dash size. + +Default is `null`. + +### .dashed : boolean + +Whether the lines should be dashed or not. + +Default is `false`. + +### .gapSizeNode : Node. + +Defines the gap size. + +Default is `null`. + +### .isLine2NodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lineColorNode : Node. + +Defines the lines color. + +Default is `null`. + +### .offsetNode : Node. + +Defines the offset. + +Default is `null`. + +### .useColor : boolean + +Whether vertex colors should be used or not. + +Default is `false`. + +### .worldUnits : boolean + +Whether the lines should sized in world units or not. When set to `false` the unit is pixel. + +Default is `false`. + +## Methods + +### .setup( builder : NodeBuilder ) + +Setups the vertex and fragment stage of this node material. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setup](NodeMaterial.html#setup) + +## Source + +[src/materials/nodes/Line2NodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/Line2NodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/Line3.html.md b/docs/pages/Line3.html.md new file mode 100644 index 00000000000000..f96ada828b9595 --- /dev/null +++ b/docs/pages/Line3.html.md @@ -0,0 +1,183 @@ +# Line3 + +An analytical line segment in 3D space represented by a start and end point. + +## Constructor + +### new Line3( start : Vector3, end : Vector3 ) + +Constructs a new line segment. + +**start** + +Start of the line segment. + +Default is `(0,0,0)`. + +**end** + +End of the line segment. + +Default is `(0,0,0)`. + +## Properties + +### .end : Vector3 + +End of the line segment. + +### .start : Vector3 + +Start of the line segment. + +## Methods + +### .applyMatrix4( matrix : Matrix4 ) : Line3 + +Applies a 4x4 transformation matrix to this line segment. + +**matrix** + +The transformation matrix. + +**Returns:** A reference to this line segment. + +### .at( t : number, target : Vector3 ) : Vector3 + +Returns a vector at a certain position along the line segment. + +**t** + +A value between `[0,1]` to represent a position along the line segment. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The delta vector. + +### .clone() : Line3 + +Returns a new line segment with copied values from this instance. + +**Returns:** A clone of this instance. + +### .closestPointToPoint( point : Vector3, clampToLine : boolean, target : Vector3 ) : Vector3 + +Returns the closest point on the line for a given point. + +**point** + +The point to compute the closest point on the line for. + +**clampToLine** + +Whether to clamp the result to the range `[0,1]` or not. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The closest point on the line. + +### .closestPointToPointParameter( point : Vector3, clampToLine : boolean ) : number + +Returns a point parameter based on the closest point as projected on the line segment. + +**point** + +The point for which to return a point parameter. + +**clampToLine** + +Whether to clamp the result to the range `[0,1]` or not. + +**Returns:** The point parameter. + +### .copy( line : Line3 ) : Line3 + +Copies the values of the given line segment to this instance. + +**line** + +The line segment to copy. + +**Returns:** A reference to this line segment. + +### .delta( target : Vector3 ) : Vector3 + +Returns the delta vector of the line segment's start and end point. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The delta vector. + +### .distance() : number + +Returns the Euclidean distance between the line' start and end point. + +**Returns:** The Euclidean distance. + +### .distanceSq() : number + +Returns the squared Euclidean distance between the line' start and end point. + +**Returns:** The squared Euclidean distance. + +### .distanceSqToLine3( line : Line3, c1 : Vector3, c2 : Vector3 ) : number + +Returns the closest squared distance between this line segment and the given one. + +**line** + +The line segment to compute the closest squared distance to. + +**c1** + +The closest point on this line segment. + +**c2** + +The closest point on the given line segment. + +**Returns:** The squared distance between this line segment and the given one. + +### .equals( line : Line3 ) : boolean + +Returns `true` if this line segment is equal with the given one. + +**line** + +The line segment to test for equality. + +**Returns:** Whether this line segment is equal with the given one. + +### .getCenter( target : Vector3 ) : Vector3 + +Returns the center of the line segment. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The center point. + +### .set( start : Vector3, end : Vector3 ) : Line3 + +Sets the start and end values by copying the given vectors. + +**start** + +The start point. + +**end** + +The end point. + +**Returns:** A reference to this line segment. + +## Source + +[src/math/Line3.js](https://github.com/mrdoob/three.js/blob/master/src/math/Line3.js) \ No newline at end of file diff --git a/docs/pages/LineBasicMaterial.html.md b/docs/pages/LineBasicMaterial.html.md new file mode 100644 index 00000000000000..f00e2afae9942a --- /dev/null +++ b/docs/pages/LineBasicMaterial.html.md @@ -0,0 +1,77 @@ +*Inheritance: EventDispatcher → Material →* + +# LineBasicMaterial + +A material for rendering line primitives. + +Materials define the appearance of renderable 3D objects. + +## Code Example + +```js +const material = new THREE.LineBasicMaterial( { color: 0xffffff } ); +``` + +## Constructor + +### new LineBasicMaterial( parameters : Object ) + +Constructs a new line basic material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isLineBasicMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .linecap : 'butt' | 'round' | 'square' + +Defines appearance of line ends. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .linejoin : 'round' | 'bevel' | 'miter' + +Defines appearance of line joints. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .linewidth : number + +Controls line thickness or lines. + +Can only be used with [SVGRenderer](SVGRenderer.html). WebGL and WebGPU ignore this setting and always render line primitives with a width of one pixel. + +Default is `1`. + +### .map : Texture + +Sets the color of the lines using data from a texture. The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +## Source + +[src/materials/LineBasicMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/LineBasicMaterial.js) \ No newline at end of file diff --git a/docs/pages/LineBasicNodeMaterial.html.md b/docs/pages/LineBasicNodeMaterial.html.md new file mode 100644 index 00000000000000..7fb05104119ece --- /dev/null +++ b/docs/pages/LineBasicNodeMaterial.html.md @@ -0,0 +1,27 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# LineBasicNodeMaterial + +Node material version of [LineBasicMaterial](LineBasicMaterial.html). + +## Constructor + +### new LineBasicNodeMaterial( parameters : Object ) + +Constructs a new line basic node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isLineBasicNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/materials/nodes/LineBasicNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/LineBasicNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/LineCurve.html.md b/docs/pages/LineCurve.html.md new file mode 100644 index 00000000000000..33d65385fcfdf7 --- /dev/null +++ b/docs/pages/LineCurve.html.md @@ -0,0 +1,57 @@ +*Inheritance: Curve →* + +# LineCurve + +A curve representing a 2D line segment. + +## Constructor + +### new LineCurve( v1 : Vector2, v2 : Vector2 ) + +Constructs a new line curve. + +**v1** + +The start point. + +**v2** + +The end point. + +## Properties + +### .isLineCurve : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .v1 : Vector2 + +The start point. + +### .v2 : Vector2 + +The end point. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector2 ) : Vector2 + +Returns a point on the line. + +**t** + +A interpolation factor representing a position on the line. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the line. + +## Source + +[src/extras/curves/LineCurve.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/LineCurve.js) \ No newline at end of file diff --git a/docs/pages/LineCurve3.html.md b/docs/pages/LineCurve3.html.md new file mode 100644 index 00000000000000..823c2c8d722fbf --- /dev/null +++ b/docs/pages/LineCurve3.html.md @@ -0,0 +1,57 @@ +*Inheritance: Curve →* + +# LineCurve3 + +A curve representing a 3D line segment. + +## Constructor + +### new LineCurve3( v1 : Vector3, v2 : Vector3 ) + +Constructs a new line curve. + +**v1** + +The start point. + +**v2** + +The end point. + +## Properties + +### .isLineCurve3 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .v1 : Vector3 + +The start point. + +### .v2 : Vector2 + +The end point. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +Returns a point on the line. + +**t** + +A interpolation factor representing a position on the line. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the line. + +## Source + +[src/extras/curves/LineCurve3.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/LineCurve3.js) \ No newline at end of file diff --git a/docs/pages/LineDashedMaterial.html.md b/docs/pages/LineDashedMaterial.html.md new file mode 100644 index 00000000000000..8ad70084069ecd --- /dev/null +++ b/docs/pages/LineDashedMaterial.html.md @@ -0,0 +1,58 @@ +*Inheritance: EventDispatcher → Material → LineBasicMaterial →* + +# LineDashedMaterial + +A material for rendering line primitives. + +Materials define the appearance of renderable 3D objects. + +## Code Example + +```js +const material = new THREE.LineDashedMaterial( { + color: 0xffffff, + scale: 1, + dashSize: 3, + gapSize: 1, +} ); +``` + +## Constructor + +### new LineDashedMaterial( parameters : Object ) + +Constructs a new line dashed material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .dashSize : number + +The size of the dash. This is both the gap with the stroke. + +Default is `3`. + +### .gapSize : number + +The size of the gap. + +Default is `1`. + +### .isLineDashedMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .scale : number + +The scale of the dashed part of a line. + +Default is `1`. + +## Source + +[src/materials/LineDashedMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/LineDashedMaterial.js) \ No newline at end of file diff --git a/docs/pages/LineDashedNodeMaterial.html.md b/docs/pages/LineDashedNodeMaterial.html.md new file mode 100644 index 00000000000000..7e2f1e51f6e193 --- /dev/null +++ b/docs/pages/LineDashedNodeMaterial.html.md @@ -0,0 +1,77 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# LineDashedNodeMaterial + +Node material version of [LineDashedMaterial](LineDashedMaterial.html). + +## Constructor + +### new LineDashedNodeMaterial( parameters : Object ) + +Constructs a new line dashed node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .dashOffset : number + +The dash offset. + +Default is `0`. + +### .dashScaleNode : Node. + +The scale of dash materials is by default inferred from the `scale` property. This node property allows to overwrite the default and define the scale with a node instead. + +If you don't want to overwrite the scale but modify the existing value instead, use [materialLineScale](TSL.html#materialLineScale). + +Default is `null`. + +### .dashSizeNode : Node. + +The dash size of dash materials is by default inferred from the `dashSize` property. This node property allows to overwrite the default and define the dash size with a node instead. + +If you don't want to overwrite the dash size but modify the existing value instead, use [materialLineDashSize](TSL.html#materialLineDashSize). + +Default is `null`. + +### .gapSizeNode : Node. + +The gap size of dash materials is by default inferred from the `gapSize` property. This node property allows to overwrite the default and define the gap size with a node instead. + +If you don't want to overwrite the gap size but modify the existing value instead, use [materialLineGapSize](TSL.html#materialLineGapSize). + +Default is `null`. + +### .isLineDashedNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .offsetNode : Node. + +The offset of dash materials is by default inferred from the `dashOffset` property. This node property allows to overwrite the default and define the offset with a node instead. + +If you don't want to overwrite the offset but modify the existing value instead, use [materialLineDashOffset](TSL.html#materialLineDashOffset). + +Default is `null`. + +## Methods + +### .setupVariants( builder : NodeBuilder ) + +Setups the dash specific node variables. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupVariants](NodeMaterial.html#setupVariants) + +## Source + +[src/materials/nodes/LineDashedNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/LineDashedNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/LineGeometry.html.md b/docs/pages/LineGeometry.html.md new file mode 100644 index 00000000000000..9fa795116a2206 --- /dev/null +++ b/docs/pages/LineGeometry.html.md @@ -0,0 +1,91 @@ +*Inheritance: InstancedBufferGeometry → LineSegmentsGeometry →* + +# LineGeometry + +A chain of vertices, forming a polyline. + +This is used in [Line2](Line2.html) to describe the shape. + +## Code Example + +```js +const points = [ + new THREE.Vector3( - 10, 0, 0 ), + new THREE.Vector3( 0, 5, 0 ), + new THREE.Vector3( 10, 0, 0 ), +]; +const geometry = new LineGeometry(); +geometry.setFromPoints( points ); +``` + +## Import + +LineGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LineLineGeometry2 } from 'three/addons/lines/LineGeometry.js'; +``` + +## Constructor + +### new LineGeometry() + +Constructs a new line geometry. + +## Properties + +### .isLineGeometry : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .fromLine( line : Line ) : LineGeometry + +Setups this line segments geometry from the given line. + +**line** + +The line that should be used as a data source for this geometry. + +**Returns:** A reference to this geometry. + +### .setColors( array : Float32Array | Array. ) : LineGeometry + +Sets the given line colors for this geometry. + +**array** + +The position data to set. + +**Overrides:** [LineSegmentsGeometry#setColors](LineSegmentsGeometry.html#setColors) + +**Returns:** A reference to this geometry. + +### .setFromPoints( points : Array.<(Vector3|Vector2)> ) : LineGeometry + +Setups this line segments geometry from the given sequence of points. + +**points** + +An array of points in 2D or 3D space. + +**Returns:** A reference to this geometry. + +### .setPositions( array : Float32Array | Array. ) : LineGeometry + +Sets the given line positions for this geometry. + +**array** + +The position data to set. + +**Overrides:** [LineSegmentsGeometry#setPositions](LineSegmentsGeometry.html#setPositions) + +**Returns:** A reference to this geometry. + +## Source + +[examples/jsm/lines/LineGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineGeometry.js) \ No newline at end of file diff --git a/docs/pages/LineLoop.html.md b/docs/pages/LineLoop.html.md new file mode 100644 index 00000000000000..b54f3e6a4400db --- /dev/null +++ b/docs/pages/LineLoop.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → Object3D → Line →* + +# LineLoop + +A continuous line. This is nearly the same as [Line](Line.html) the only difference is that the last vertex is connected with the first vertex in order to close the line to form a loop. + +## Constructor + +### new LineLoop( geometry : BufferGeometry, material : Material | Array. ) + +Constructs a new line loop. + +**geometry** + +The line geometry. + +**material** + +The line material. + +## Properties + +### .isLineLoop : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/objects/LineLoop.js](https://github.com/mrdoob/three.js/blob/master/src/objects/LineLoop.js) \ No newline at end of file diff --git a/docs/pages/LineMaterial.html.md b/docs/pages/LineMaterial.html.md new file mode 100644 index 00000000000000..ef2976bce414a4 --- /dev/null +++ b/docs/pages/LineMaterial.html.md @@ -0,0 +1,107 @@ +*Inheritance: EventDispatcher → Material → ShaderMaterial →* + +# LineMaterial + +A material for drawing wireframe-style geometries. + +Unlike [LineBasicMaterial](LineBasicMaterial.html), it supports arbitrary line widths and allows using world units instead of screen space units. This material is used with [LineSegments2](LineSegments2.html) and [Line2](Line2.html). + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [Line2NodeMaterial](Line2NodeMaterial.html). + +## Import + +LineMaterial is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; +``` + +## Constructor + +### new LineMaterial( parameters : Object ) + +Constructs a new line segments geometry. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaToCoverage : boolean + +Whether to use alphaToCoverage or not. When enabled, this can improve the anti-aliasing of line edges when using MSAA. + +**Overrides:** [ShaderMaterial#alphaToCoverage](ShaderMaterial.html#alphaToCoverage) + +### .color : Color + +The material's color. + +Default is `(1,1,1)`. + +### .dashOffset : number + +Where in the dash cycle the dash starts. + +Default is `0`. + +### .dashScale : number + +The scale of the dashes and gaps. + +Default is `1`. + +### .dashSize : number + +The size of the dash. + +Default is `1`. + +### .dashed : boolean + +Whether the line is dashed, or solid. + +Default is `false`. + +### .gapSize : number + +The size of the gap. + +Default is `0`. + +### .isLineMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .linewidth : number + +Controls line thickness in CSS pixel units when `worldUnits` is `false` (default), or in world units when `worldUnits` is `true`. + +Default is `1`. + +**Overrides:** [ShaderMaterial#linewidth](ShaderMaterial.html#linewidth) + +### .opacity : number + +The opacity. + +Default is `1`. + +**Overrides:** [ShaderMaterial#opacity](ShaderMaterial.html#opacity) + +### .resolution : Vector2 + +The size of the viewport, in screen pixels. This must be kept updated to make screen-space rendering accurate.The `LineSegments2.onBeforeRender` callback performs the update for visible objects. + +### .worldUnits : boolean + +Whether the material's sizes (width, dash gaps) are in world units. + +Default is `false`. + +## Source + +[examples/jsm/lines/LineMaterial.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineMaterial.js) \ No newline at end of file diff --git a/docs/pages/LineSegments.html.md b/docs/pages/LineSegments.html.md new file mode 100644 index 00000000000000..b5aa02bac0b114 --- /dev/null +++ b/docs/pages/LineSegments.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → Object3D → Line →* + +# LineSegments + +A series of lines drawn between pairs of vertices. + +## Constructor + +### new LineSegments( geometry : BufferGeometry, material : Material | Array. ) + +Constructs a new line segments. + +**geometry** + +The line geometry. + +**material** + +The line material. + +## Properties + +### .isLineSegments : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/objects/LineSegments.js](https://github.com/mrdoob/three.js/blob/master/src/objects/LineSegments.js) \ No newline at end of file diff --git a/docs/pages/LineSegments2.html.md b/docs/pages/LineSegments2.html.md new file mode 100644 index 00000000000000..398de9b2ff2a1b --- /dev/null +++ b/docs/pages/LineSegments2.html.md @@ -0,0 +1,76 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# LineSegments2 + +A series of lines drawn between pairs of vertices. + +This adds functionality beyond [LineSegments](LineSegments.html), like arbitrary line width and changing width to be in world units. [Line2](Line2.html) extends this object, forming a polyline instead of individual segments. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import the class from `lines/webgpu/LineSegments2.js`. + +## Code Example + +```js +const geometry = new LineSegmentsGeometry(); +geometry.setPositions( positions ); +geometry.setColors( colors ); +const material = new LineMaterial( { linewidth: 5, vertexColors: true } }; +const lineSegments = new LineSegments2( geometry, material ); +scene.add( lineSegments ); +``` + +## Import + +LineSegments2 is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LineSegments2 } from 'three/addons/lines/LineSegments2.js'; +``` + +## Constructor + +### new LineSegments2( geometry : LineSegmentsGeometry, material : LineMaterial ) + +Constructs a new wide line. + +**geometry** + +The line geometry. + +**material** + +The line material. + +## Properties + +### .isLineSegments2 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .computeLineDistances() : LineSegments2 + +Computes an array of distance values which are necessary for rendering dashed lines. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line. + +**Returns:** A reference to this instance. + +### .raycast( raycaster : Raycaster, intersects : Array. ) + +Computes intersection points between a casted ray and this instance. + +**raycaster** + +The raycaster. + +**intersects** + +The target array that holds the intersection points. + +**Overrides:** [Mesh#raycast](Mesh.html#raycast) + +## Source + +[examples/jsm/lines/LineSegments2.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineSegments2.js) \ No newline at end of file diff --git a/docs/pages/LineSegmentsGeometry.html.md b/docs/pages/LineSegmentsGeometry.html.md new file mode 100644 index 00000000000000..abff2964c43c5a --- /dev/null +++ b/docs/pages/LineSegmentsGeometry.html.md @@ -0,0 +1,105 @@ +*Inheritance: InstancedBufferGeometry →* + +# LineSegmentsGeometry + +A series of vertex pairs, forming line segments. + +This is used in [LineSegments2](LineSegments2.html) to describe the shape. + +## Import + +LineSegmentsGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; +``` + +## Constructor + +### new LineSegmentsGeometry() + +Constructs a new line segments geometry. + +## Properties + +### .isLineSegmentsGeometry : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .applyMatrix4( matrix : Matrix4 ) : LineSegmentsGeometry + +Applies the given 4x4 transformation matrix to the geometry. + +**matrix** + +The matrix to apply. + +**Returns:** A reference to this instance. + +### .fromEdgesGeometry( geometry : EdgesGeometry ) : LineSegmentsGeometry + +Setups this line segments geometry from the given edges geometry. + +**geometry** + +The geometry that should be used as a data source for this geometry. + +**Returns:** A reference to this geometry. + +### .fromLineSegments( lineSegments : LineSegments ) : LineSegmentsGeometry + +Setups this line segments geometry from the given line segments. + +**lineSegments** + +The line segments that should be used as a data source for this geometry. Assumes the source geometry is not using indices. + +**Returns:** A reference to this geometry. + +### .fromMesh( mesh : Mesh ) : LineSegmentsGeometry + +Setups this line segments geometry from the given mesh. + +**mesh** + +The mesh geometry that should be used as a data source for this geometry. + +**Returns:** A reference to this geometry. + +### .fromWireframeGeometry( geometry : WireframeGeometry ) : LineSegmentsGeometry + +Setups this line segments geometry from the given wireframe geometry. + +**geometry** + +The geometry that should be used as a data source for this geometry. + +**Returns:** A reference to this geometry. + +### .setColors( array : Float32Array | Array. ) : LineSegmentsGeometry + +Sets the given line colors for this geometry. The length must be a multiple of six since each line segment is defined by a start end color in the pattern `(rgb rgb)`. + +**array** + +The position data to set. + +**Returns:** A reference to this geometry. + +### .setPositions( array : Float32Array | Array. ) : LineSegmentsGeometry + +Sets the given line positions for this geometry. The length must be a multiple of six since each line segment is defined by a start end vertex in the pattern `(xyz xyz)`. + +**array** + +The position data to set. + +**Returns:** A reference to this geometry. + +## Source + +[examples/jsm/lines/LineSegmentsGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineSegmentsGeometry.js) \ No newline at end of file diff --git a/docs/pages/LinearInterpolant.html.md b/docs/pages/LinearInterpolant.html.md new file mode 100644 index 00000000000000..6f42cc5fe9cab7 --- /dev/null +++ b/docs/pages/LinearInterpolant.html.md @@ -0,0 +1,31 @@ +*Inheritance: Interpolant →* + +# LinearInterpolant + +A basic linear interpolant. + +## Constructor + +### new LinearInterpolant( parameterPositions : TypedArray, sampleValues : TypedArray, sampleSize : number, resultBuffer : TypedArray ) + +Constructs a new linear interpolant. + +**parameterPositions** + +The parameter positions hold the interpolation factors. + +**sampleValues** + +The sample values. + +**sampleSize** + +The sample size + +**resultBuffer** + +The result buffer. + +## Source + +[src/math/interpolants/LinearInterpolant.js](https://github.com/mrdoob/three.js/blob/master/src/math/interpolants/LinearInterpolant.js) \ No newline at end of file diff --git a/docs/pages/Loader.html.md b/docs/pages/Loader.html.md new file mode 100644 index 00000000000000..26fb565095c3f3 --- /dev/null +++ b/docs/pages/Loader.html.md @@ -0,0 +1,159 @@ +# Loader + +Abstract base class for loaders. + +## Constructor + +### new Loader( manager : LoadingManager ) (abstract) + +Constructs a new loader. + +**manager** + +The loading manager. + +## Properties + +### .crossOrigin : string + +The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. + +Default is `'anonymous'`. + +### .manager : LoadingManager + +The loading manager. + +Default is `DefaultLoadingManager`. + +### .path : string + +The base path from which the asset will be loaded. + +### .requestHeader : Object. + +The [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header) used in HTTP request. + +### .resourcePath : string + +The base path from which additional resources like textures will be loaded. + +### .withCredentials : boolean + +Whether the XMLHttpRequest uses credentials. + +Default is `false`. + +### .DEFAULT_MATERIAL_NAME : string + +The default material name that is used by loaders when creating materials for loaded 3D objects. + +Note: Not all loaders might honor this setting. + +Default is `'__DEFAULT'`. + +## Methods + +### .abort() : Loader (abstract) + +This method can be implemented in loaders for aborting ongoing requests. + +**Returns:** A reference to this instance. + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) (abstract) + +This method needs to be implemented by all concrete loaders. It holds the logic for loading assets from the backend. + +**url** + +The path/URL of the file to be loaded. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +### .loadAsync( url : string, onProgress : onProgressCallback ) : Promise + +A async version of [Loader#load](Loader.html#load). + +**url** + +The path/URL of the file to be loaded. + +**onProgress** + +Executed while the loading is in progress. + +**Returns:** A Promise that resolves when the asset has been loaded. + +### .parse( data : any ) (abstract) + +This method needs to be implemented by all concrete loaders. It holds the logic for parsing the asset into three.js entities. + +**data** + +The data to parse. + +### .setCrossOrigin( crossOrigin : string ) : Loader + +Sets the `crossOrigin` String to implement CORS for loading the URL from a different domain that allows CORS. + +**crossOrigin** + +The `crossOrigin` value. + +**Returns:** A reference to this instance. + +### .setPath( path : string ) : Loader + +Sets the base path for the asset. + +**path** + +The base path. + +**Returns:** A reference to this instance. + +### .setRequestHeader( requestHeader : Object ) : Loader + +Sets the given request header. + +**requestHeader** + +A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header) for configuring the HTTP request. + +**Returns:** A reference to this instance. + +### .setResourcePath( resourcePath : string ) : Loader + +Sets the base path for dependent resources like textures. + +**resourcePath** + +The resource path. + +**Returns:** A reference to this instance. + +### .setWithCredentials( value : boolean ) : Loader + +Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials). + +Note: This setting has no effect if you are loading files locally or from the same domain. + +**value** + +The `withCredentials` value. + +**Returns:** A reference to this instance. + +## Source + +[src/loaders/Loader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/Loader.js) \ No newline at end of file diff --git a/docs/pages/LoaderUtils.html.md b/docs/pages/LoaderUtils.html.md new file mode 100644 index 00000000000000..754bbf30a60182 --- /dev/null +++ b/docs/pages/LoaderUtils.html.md @@ -0,0 +1,37 @@ +# LoaderUtils + +A class with loader utility functions. + +## Constructor + +### new LoaderUtils() + +## Static Methods + +### .extractUrlBase( url : string ) : string + +Extracts the base URL from the given URL. + +**url** + +The URL to extract the base URL from. + +**Returns:** The extracted base URL. + +### .resolveURL( url : string, path : string ) : string + +Resolves relative URLs against the given path. Absolute paths, data urls, and blob URLs will be returned as is. Invalid URLs will return an empty string. + +**url** + +The URL to resolve. + +**path** + +The base path for relative URLs to be resolved against. + +**Returns:** The resolved URL. + +## Source + +[src/loaders/LoaderUtils.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/LoaderUtils.js) \ No newline at end of file diff --git a/docs/pages/LoadingManager.html.md b/docs/pages/LoadingManager.html.md new file mode 100644 index 00000000000000..b69dc86b1ca192 --- /dev/null +++ b/docs/pages/LoadingManager.html.md @@ -0,0 +1,175 @@ +# LoadingManager + +Handles and keeps track of loaded and pending data. A default global instance of this class is created and used by loaders if not supplied manually. + +In general that should be sufficient, however there are times when it can be useful to have separate loaders - for example if you want to show separate loading bars for objects and textures. + +## Code Example + +```js +const manager = new THREE.LoadingManager(); +manager.onLoad = () => console.log( 'Loading complete!' ); +const loader1 = new OBJLoader( manager ); +const loader2 = new ColladaLoader( manager ); +``` + +## Constructor + +### new LoadingManager( onLoad : function, onProgress : function, onError : function ) + +Constructs a new loading manager. + +**onLoad** + +Executes when all items have been loaded. + +**onProgress** + +Executes when single items have been loaded. + +**onError** + +Executes when an error occurs. + +## Properties + +### .abortController : AbortController + +Used for aborting ongoing requests in loaders using this manager. + +### .onError : function | undefined + +Executes when an error occurs. + +Default is `undefined`. + +### .onLoad : function | undefined + +Executes when all items have been loaded. + +Default is `undefined`. + +### .onProgress : function | undefined + +Executes when single items have been loaded. + +Default is `undefined`. + +### .onStart : function | undefined + +Executes when an item starts loading. + +Default is `undefined`. + +## Methods + +### .abort() : LoadingManager + +Can be used to abort ongoing loading requests in loaders using this manager. The abort only works if the loaders implement [Loader#abort](Loader.html#abort) and `AbortSignal.any()` is supported in the browser. + +**Returns:** A reference to this loading manager. + +### .addHandler( regex : string, loader : Loader ) : LoadingManager + +Registers a loader with the given regular expression. Can be used to define what loader should be used in order to load specific files. A typical use case is to overwrite the default loader for textures. + +```js +// add handler for TGA textures +manager.addHandler( /\.tga$/i, new TGALoader() ); +``` + +**regex** + +A regular expression. + +**loader** + +A loader that should handle matched cases. + +**Returns:** A reference to this loading manager. + +### .getHandler( file : string ) : Loader + +Can be used to retrieve the registered loader for the given file path. + +**file** + +The file path. + +**Returns:** The registered loader. Returns `null` if no loader was found. + +### .itemEnd( url : string ) + +This should be called by any loader using the manager when the loader ended loading an item. + +**url** + +The URL of the loaded item. + +### .itemError( url : string ) + +This should be called by any loader using the manager when the loader encounters an error when loading an item. + +**url** + +The URL of the item that produces an error. + +### .itemStart( url : string ) + +This should be called by any loader using the manager when the loader starts loading an item. + +**url** + +The URL to load. + +### .removeHandler( regex : string ) : LoadingManager + +Removes the loader for the given regular expression. + +**regex** + +A regular expression. + +**Returns:** A reference to this loading manager. + +### .resolveURL( url : string ) : string + +Given a URL, uses the URL modifier callback (if any) and returns a resolved URL. If no URL modifier is set, returns the original URL. + +**url** + +The URL to load. + +**Returns:** The resolved URL. + +### .setURLModifier( transform : function ) : LoadingManager + +If provided, the callback will be passed each resource URL before a request is sent. The callback may return the original URL, or a new URL to override loading behavior. This behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs. + +```js +const blobs = {'fish.gltf': blob1, 'diffuse.png': blob2, 'normal.png': blob3}; +const manager = new THREE.LoadingManager(); +// Initialize loading manager with URL callback. +const objectURLs = []; +manager.setURLModifier( ( url ) => { + url = URL.createObjectURL( blobs[ url ] ); + objectURLs.push( url ); + return url; +} ); +// Load as usual, then revoke the blob URLs. +const loader = new GLTFLoader( manager ); +loader.load( 'fish.gltf', (gltf) => { + scene.add( gltf.scene ); + objectURLs.forEach( ( url ) => URL.revokeObjectURL( url ) ); +} ); +``` + +**transform** + +URL modifier callback. Called with an URL and must return a resolved URL. + +**Returns:** A reference to this loading manager. + +## Source + +[src/loaders/LoadingManager.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js) \ No newline at end of file diff --git a/docs/pages/LoopNode.html.md b/docs/pages/LoopNode.html.md new file mode 100644 index 00000000000000..26120d1474bf6c --- /dev/null +++ b/docs/pages/LoopNode.html.md @@ -0,0 +1,79 @@ +*Inheritance: EventDispatcher → Node →* + +# LoopNode + +This module offers a variety of ways to implement loops in TSL. In it's basic form it's: + +However, it is also possible to define a start and end ranges, data types and loop conditions: + +```js +Loop( { start: int( 0 ), end: int( 10 ), type: 'int', condition: '<' }, ( { i } ) => { +} ); +``` + +Nested loops can be defined in a compacted form: + +```js +Loop( 10, 5, ( { i, j } ) => { +} ); +``` + +Loops that should run backwards can be defined like so: + +```js +Loop( { start: 10 }, () => {} ); +``` + +It is possible to execute with boolean values, similar to the `while` syntax. + +```js +const value = float( 0 ).toVar(); +Loop( value.lessThan( 10 ), () => { + value.addAssign( 1 ); +} ); +``` + +The module also provides `Break()` and `Continue()` TSL expression for loop control. + +## Code Example + +```js +Loop( count, ( { i } ) => { +} ); +``` + +## Constructor + +### new LoopNode( params : Array. ) + +Constructs a new loop node. + +**params** + +Depending on the loop type, array holds different parameterization values for the loop. + +## Methods + +### .getProperties( builder : NodeBuilder ) : Object + +Returns properties about this node. + +**builder** + +The current node builder. + +**Returns:** The node properties. + +### .getVarName( index : number ) : string + +Returns a loop variable name based on an index. The pattern is `0` = `i`, `1`\= `j`, `2`\= `k` and so on. + +**index** + +The index. + +**Returns:** The loop variable name. + +## Source + +[src/nodes/utils/LoopNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/LoopNode.js) \ No newline at end of file diff --git a/docs/pages/LottieLoader.html.md b/docs/pages/LottieLoader.html.md new file mode 100644 index 00000000000000..6e2e719f51eb3a --- /dev/null +++ b/docs/pages/LottieLoader.html.md @@ -0,0 +1,80 @@ +*Inheritance: Loader →* + +# LottieLoader + +A loader for the Lottie texture animation format. + +The loader returns an instance of [CanvasTexture](CanvasTexture.html) to represent the animated texture. Two additional properties are added to each texture: + +* `animation`: The return value of `lottie.loadAnimation()` which is an object with an API for controlling the animation's playback. +* `image`: The image container. + +## Code Example + +```js +const loader = new LottieLoader(); +loader.setQuality( 2 ); +const texture = await loader.loadAsync( 'textures/lottie/24017-lottie-logo-animation.json' ); +const geometry = new THREE.BoxGeometry(); +const material = new THREE.MeshBasicMaterial( { map: texture } ); +const mesh = new THREE.Mesh( geometry, material ); +scene.add( mesh ); +``` + +## Import + +LottieLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LottieLoader } from 'three/addons/loaders/LottieLoader.js'; +``` + +## Constructor + +### new LottieLoader( manager : LoadingManager ) + +Constructs a new Lottie loader. + +**manager** + +The loading manager. + +**Deprecated:** The loader has been deprecated and will be removed with r186. Use lottie-web instead and create your animated texture manually. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : CanvasTexture + +Starts loading from the given URL and passes the loaded Lottie asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The Lottie texture. + +### .setQuality( value : number ) + +Sets the texture quality. + +**value** + +The texture quality. + +## Source + +[examples/jsm/loaders/LottieLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/LottieLoader.js) \ No newline at end of file diff --git a/docs/pages/Lut.html.md b/docs/pages/Lut.html.md new file mode 100644 index 00000000000000..c8e1c4670d7e05 --- /dev/null +++ b/docs/pages/Lut.html.md @@ -0,0 +1,172 @@ +# Lut + +Represents a lookup table for colormaps. It is used to determine the color values from a range of data values. + +## Code Example + +```js +const lut = new Lut( 'rainbow', 512 ); +const color = lut.getColor( 0.5 ); +``` + +## Import + +Lut is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Lut } from 'three/addons/math/Lut.js'; +``` + +## Constructor + +### new Lut( colormap : 'rainbow' | 'cooltowarm' | 'blackbody' | 'grayscale', count : number ) + +Constructs a new Lut. + +**colormap** + +Sets a colormap from predefined list of colormaps. + +Default is `'rainbow'`. + +**count** + +Sets the number of colors used to represent the data array. + +Default is `32`. + +## Properties + +### .isLut : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lut : Array. + +The lookup table for the selected color map + +### .map : Array.> + +The currently selected color map. + +### .maxV : number + +The maximum value to be represented with the lookup table. + +Default is `1`. + +### .minV : number + +The minimum value to be represented with the lookup table. + +Default is `0`. + +### .n : number + +The number of colors of the current selected color map. + +Default is `32`. + +## Methods + +### .addColorMap( name : string, arrayOfColors : Array.> ) : Lut + +Adds a color map to this Lut instance. + +**name** + +The name of the color map. + +**arrayOfColors** + +An array of color values. Each value is an array holding a threshold and the actual color value as a hexadecimal number. + +**Returns:** A reference to this LUT. + +### .copy( lut : Lut ) : Lut + +Copies the given lut. + +**lut** + +The LUT to copy. + +**Returns:** A reference to this LUT. + +### .createCanvas() : HTMLCanvasElement + +Creates a canvas in order to visualize the lookup table as a texture. + +**Returns:** The created canvas. + +### .getColor( alpha : number ) : Color + +Returns an instance of Color for the given data value. + +**alpha** + +The value to lookup. + +**Returns:** The color from the LUT. + +### .set( value : Lut ) : Lut + +Sets the given LUT. + +**value** + +The LUT to set. + +**Returns:** A reference to this LUT. + +### .setColorMap( colormap : string, count : number ) : Lut + +Configure the lookup table for the given color map and number of colors. + +**colormap** + +The name of the color map. + +**count** + +The number of colors. + +Default is `32`. + +**Returns:** A reference to this LUT. + +### .setMax( max : number ) : Lut + +Sets the maximum value to be represented with this LUT. + +**max** + +The maximum value to be represented with the lookup table. + +**Returns:** A reference to this LUT. + +### .setMin( min : number ) : Lut + +Sets the minimum value to be represented with this LUT. + +**min** + +The minimum value to be represented with the lookup table. + +**Returns:** A reference to this LUT. + +### .updateCanvas( canvas : HTMLCanvasElement ) : HTMLCanvasElement + +Updates the given canvas with the Lut's data. + +**canvas** + +The canvas to update. + +**Returns:** The updated canvas. + +## Source + +[examples/jsm/math/Lut.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Lut.js) \ No newline at end of file diff --git a/docs/pages/Lut3DNode.html.md b/docs/pages/Lut3DNode.html.md new file mode 100644 index 00000000000000..69fec6727dfa5f --- /dev/null +++ b/docs/pages/Lut3DNode.html.md @@ -0,0 +1,69 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# Lut3DNode + +A post processing node for color grading via lookup tables. + +## Import + +Lut3DNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { lut3D } from 'three/addons/tsl/display/Lut3DNode.js'; +``` + +## Constructor + +### new Lut3DNode( inputNode : Node, lutNode : TextureNode, size : number, intensityNode : Node. ) + +Constructs a new LUT node. + +**inputNode** + +The node that represents the input of the effect. + +**lutNode** + +A texture node that represents the lookup table. + +**size** + +The size of the lookup table. + +**intensityNode** + +Controls the intensity of the effect. + +## Properties + +### .inputNode : Node + +The node that represents the input of the effect. + +### .intensityNode : Node. + +Controls the intensity of the effect. + +### .lutNode : TextureNode + +A texture node that represents the lookup table. + +### .size : UniformNode. + +The size of the lookup table. + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +## Source + +[examples/jsm/tsl/display/Lut3DNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/Lut3DNode.js) \ No newline at end of file diff --git a/docs/pages/MD2Character.html.md b/docs/pages/MD2Character.html.md new file mode 100644 index 00000000000000..e215076ffc7139 --- /dev/null +++ b/docs/pages/MD2Character.html.md @@ -0,0 +1,141 @@ +# MD2Character + +This class represents a management component for animated MD2 character assets. + +## Import + +MD2Character is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MD2Character } from 'three/addons/misc/MD2Character.js'; +``` + +## Constructor + +### new MD2Character() + +Constructs a new MD2 character. + +## Properties + +### .activeAnimationClipName : string + +The name of the active animation clip. + +Default is `null`. + +### .animationFPS : number + +The FPS + +Default is `6`. + +### .meshBody : Mesh + +The body mesh. + +Default is `null`. + +### .meshWeapon : Mesh + +The weapon mesh. + +Default is `null`. + +### .mixer : AnimationMixer + +The animation mixer. + +Default is `null`. + +### .root : Object3D + +The root 3D object + +### .scale : number + +The mesh scale. + +Default is `1`. + +### .skinsBody : Array. + +The body skins. + +### .skinsWeapon : Array. + +The weapon skins. + +### .weapons : Array. + +The weapon meshes. + +## Methods + +### .loadParts( config : Object ) + +Loads the character model for the given config. + +**config** + +The config which defines the model and textures paths. + +### .onLoadComplete() + +The `onLoad` callback function. + +### .setAnimation( clipName : string ) + +Sets the defined animation clip as the active animation. + +**clipName** + +The name of the animation clip. + +### .setPlaybackRate( rate : number ) + +Sets the animation playback rate. + +**rate** + +The playback rate to set. + +### .setSkin( index : number ) + +Sets the skin defined by the given skin index. This will result in a different texture for the body mesh. + +**index** + +The skin index. + +### .setWeapon( index : number ) + +Sets the weapon defined by the given weapon index. This will result in a different weapon hold by the character. + +**index** + +The weapon index. + +### .setWireframe( wireframeEnabled : boolean ) + +Sets the wireframe material flag. + +**wireframeEnabled** + +Whether to enable wireframe rendering or not. + +### .syncWeaponAnimation() + +Synchronizes the weapon with the body animation. + +### .update( delta : number ) + +Updates the animations of the mesh. Must be called inside the animation loop. + +**delta** + +The delta time in seconds. + +## Source + +[examples/jsm/misc/MD2Character.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/MD2Character.js) \ No newline at end of file diff --git a/docs/pages/MD2CharacterComplex.html.md b/docs/pages/MD2CharacterComplex.html.md new file mode 100644 index 00000000000000..4cf0f87dbe034a --- /dev/null +++ b/docs/pages/MD2CharacterComplex.html.md @@ -0,0 +1,211 @@ +# MD2CharacterComplex + +This class represents a management component for animated MD2 character assets. It provides a larger API compared to [MD2Character](MD2Character.html). + +## Import + +MD2CharacterComplex is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MD2CharacterComplex } from 'three/addons/misc/MD2CharacterComplex.js'; +``` + +## Constructor + +### new MD2CharacterComplex() + +Constructs a new MD2 character. + +## Properties + +### .angularSpeed : number + +The character's angular speed. + +Default is `2.5`. + +### .animationFPS : number + +The FPS + +Default is `6`. + +### .backAcceleration : number + +The character's back acceleration. + +Default is `600`. + +### .controls : Object + +The movement controls. + +Default is `null`. + +### .currentSkin : Texture + +The current skin. + +Default is `undefined`. + +### .frontAcceleration : number + +The character's front acceleration. + +Default is `600`. + +### .frontDeceleration : number + +The character's front deceleration. + +Default is `600`. + +### .maxReverseSpeed : number + +The character's maximum reverse speed. + +Default is `- 275`. + +### .maxSpeed : number + +The character's maximum speed. + +Default is `275`. + +### .meshBody : Mesh + +The body mesh. + +Default is `null`. + +### .meshWeapon : Mesh + +The weapon mesh. + +Default is `null`. + +### .root : Object3D + +The root 3D object + +### .scale : number + +The mesh scale. + +Default is `1`. + +### .skinsBody : Array. + +The body skins. + +### .skinsWeapon : Array. + +The weapon skins. + +### .transitionFrames : number + +The transition frames. + +Default is `15`. + +### .weapons : Array. + +The weapon meshes. + +## Methods + +### .enableShadows( enable : boolean ) + +Toggles shadow casting and receiving on the character's meshes. + +**enable** + +Whether to enable shadows or not. + +### .loadParts( config : Object ) + +Loads the character model for the given config. + +**config** + +The config which defines the model and textures paths. + +### .setAnimation( animationName : string ) + +Sets the defined animation clip as the active animation. + +**animationName** + +The name of the animation clip. + +### .setPlaybackRate( rate : number ) + +Sets the animation playback rate. + +**rate** + +The playback rate to set. + +### .setSkin( index : number ) + +Sets the skin defined by the given skin index. This will result in a different texture for the body mesh. + +**index** + +The skin index. + +### .setVisible( enable : boolean ) + +Toggles visibility on the character's meshes. + +**enable** + +Whether the character is visible or not. + +### .setWeapon( index : number ) + +Sets the weapon defined by the given weapon index. This will result in a different weapon hold by the character. + +**index** + +The weapon index. + +### .setWireframe( wireframeEnabled : boolean ) + +Sets the wireframe material flag. + +**wireframeEnabled** + +Whether to enable wireframe rendering or not. + +### .shareParts( original : MD2CharacterComplex ) + +Shares certain resources from a different character model. + +**original** + +The original MD2 character. + +### .updateAnimations( delta : number ) + +Updates the animations of the mesh. Must be called inside the animation loop. + +**delta** + +The delta time in seconds. + +### .updateBehaviors() + +Updates the animation state based on the control inputs. + +### .updateMovementModel( delta : number ) + +Transforms the character model based on the control input. + +**delta** + +The delta time in seconds. + +## Source + +[examples/jsm/misc/MD2CharacterComplex.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/MD2CharacterComplex.js) \ No newline at end of file diff --git a/docs/pages/MD2Loader.html.md b/docs/pages/MD2Loader.html.md new file mode 100644 index 00000000000000..83edf8cb3be603 --- /dev/null +++ b/docs/pages/MD2Loader.html.md @@ -0,0 +1,73 @@ +*Inheritance: Loader →* + +# MD2Loader + +A loader for the MD2 format. + +The loader represents the animations of the MD2 asset as an array of animation clips and stores them in the `animations` property of the geometry. + +## Code Example + +```js +const loader = new MD2Loader(); +const geometry = await loader.loadAsync( './models/md2/ogro/ogro.md2' ); +const animations = geometry.animations; +``` + +## Import + +MD2Loader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MD2Loader } from 'three/addons/loaders/MD2Loader.js'; +``` + +## Constructor + +### new MD2Loader( manager : LoadingManager ) + +Constructs a new MD2 loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded MD2 asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( buffer : ArrayBuffer ) : BufferGeometry + +Parses the given MD2 data and returns a geometry. + +**buffer** + +The raw MD2 data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed geometry data. + +## Source + +[examples/jsm/loaders/MD2Loader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/MD2Loader.js) \ No newline at end of file diff --git a/docs/pages/MDDLoader.html.md b/docs/pages/MDDLoader.html.md new file mode 100644 index 00000000000000..69592ab2ef0802 --- /dev/null +++ b/docs/pages/MDDLoader.html.md @@ -0,0 +1,89 @@ +*Inheritance: Loader →* + +# MDDLoader + +A loader for the MDD format. + +MDD stores a position for every vertex in a model for every frame in an animation. Similar to BVH, it can be used to transfer animation data between different 3D applications or engines. + +MDD stores its data in binary format (big endian) in the following way: + +* number of frames (a single uint32) +* number of vertices (a single uint32) +* time values for each frame (sequence of float32) +* vertex data for each frame (sequence of float32) + +## Code Example + +```js +const loader = new MDDLoader(); +const result = await loader.loadAsync( 'models/mdd/cube.mdd' ); +const morphTargets = result.morphTargets; +const clip = result.clip; +// clip.optimize(); // optional +const geometry = new THREE.BoxGeometry(); +geometry.morphAttributes.position = morphTargets; // apply morph targets (vertex data must match) +const material = new THREE.MeshBasicMaterial(); +const mesh = new THREE.Mesh( geometry, material ); +scene.add( mesh ); +const mixer = new THREE.AnimationMixer( mesh ); +mixer.clipAction( clip ).play(); +``` + +## Import + +MDDLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MDDLoader } from 'three/addons/loaders/MDDLoader.js'; +``` + +## Constructor + +### new MDDLoader( manager : LoadingManager ) + +Constructs a new MDD loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded MDD asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : Object + +Parses the given MDD data and returns an object holding the animation clip and the respective morph targets. + +**data** + +The raw XYZ data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The result object. + +## Source + +[examples/jsm/loaders/MDDLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/MDDLoader.js) \ No newline at end of file diff --git a/docs/pages/MRTNode.html.md b/docs/pages/MRTNode.html.md new file mode 100644 index 00000000000000..a1d505b04b0ba0 --- /dev/null +++ b/docs/pages/MRTNode.html.md @@ -0,0 +1,74 @@ +*Inheritance: EventDispatcher → Node → OutputStructNode →* + +# MRTNode + +This node can be used setup a MRT context for rendering. A typical MRT setup for post-processing is shown below: + +The MRT output is defined as a dictionary. + +## Code Example + +```js +const mrtNode = mrt( { + output: output, + normal: normalView +} ) ; +``` + +## Constructor + +### new MRTNode( outputNodes : Object. ) + +Constructs a new output struct node. + +**outputNodes** + +The MRT outputs. + +## Properties + +### .isMRTNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .outputNodes : Object. + +A dictionary representing the MRT outputs. The key is the name of the output, the value the node which produces the output result. + +## Methods + +### .get( name : string ) : Node + +Returns the output node for the given name. + +**name** + +The name of the output. + +**Returns:** The output node. + +### .has( name : string ) : NodeBuilder + +Returns `true` if the MRT node has an output with the given name. + +**name** + +The name of the output. + +**Returns:** Whether the MRT node has an output for the given name or not. + +### .merge( mrtNode : MRTNode ) : MRTNode + +Merges the outputs of the given MRT node with the outputs of this node. + +**mrtNode** + +The MRT to merge. + +**Returns:** A new MRT node with merged outputs.. + +## Source + +[src/nodes/core/MRTNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/MRTNode.js) \ No newline at end of file diff --git a/docs/pages/MTLLoader.html.md b/docs/pages/MTLLoader.html.md new file mode 100644 index 00000000000000..67b6b180632e7a --- /dev/null +++ b/docs/pages/MTLLoader.html.md @@ -0,0 +1,116 @@ +*Inheritance: Loader →* + +# MTLLoader + +A loader for the MTL format. + +The Material Template Library format (MTL) or .MTL File Format is a companion file format to OBJ that describes surface shading (material) properties of objects within one or more OBJ files. + +## Code Example + +```js +const loader = new MTLLoader(); +const materials = await loader.loadAsync( 'models/obj/male02/male02.mtl' ); +const objLoader = new OBJLoader(); +objLoader.setMaterials( materials ); +``` + +## Import + +MTLLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MTLLoader } from 'three/addons/loaders/MTLLoader.js'; +``` + +## Constructor + +### new MTLLoader() + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded MTL asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string, path : string ) : MaterialCreator + +Parses the given MTL data and returns the resulting material creator. + +**text** + +The raw MTL data as a string. + +**path** + +The URL base path. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The material creator. + +### .setMaterialOptions( value : MTLLoader~MaterialOptions ) : MTLLoader + +Sets the material options. + +**value** + +The material options. + +**Returns:** A reference to this loader. + +## Type Definitions + +### .MaterialOptions + +Material options of `MTLLoader`. + +**side** +[FrontSide](global.html#FrontSide) | [BackSide](global.html#BackSide) | [DoubleSide](global.html#DoubleSide) + +Which side to apply the material. + +Default is `FrontSide`. + +**wrap** +[RepeatWrapping](global.html#RepeatWrapping) | [ClampToEdgeWrapping](global.html#ClampToEdgeWrapping) | [MirroredRepeatWrapping](global.html#MirroredRepeatWrapping) + +What type of wrapping to apply for textures. + +Default is `RepeatWrapping`. + +**normalizeRGB** +boolean + +Whether RGB colors should be normalized to `0-1` from `0-255`. + +Default is `false`. + +**ignoreZeroRGBs** +boolean + +Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. + +Default is `false`. + +## Source + +[examples/jsm/loaders/MTLLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/MTLLoader.js) \ No newline at end of file diff --git a/docs/pages/MapControls.html.md b/docs/pages/MapControls.html.md new file mode 100644 index 00000000000000..72a8834e1a7efc --- /dev/null +++ b/docs/pages/MapControls.html.md @@ -0,0 +1,62 @@ +*Inheritance: EventDispatcher → Controls → OrbitControls →* + +# MapControls + +This class is intended for transforming a camera over a map from bird's eye perspective. The class shares its implementation with [OrbitControls](OrbitControls.html) but uses a specific preset for mouse/touch interaction and disables screen space panning by default. + +* Orbit: Right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate. +* Zoom: Middle mouse, or mousewheel / touch: two-finger spread or squish. +* Pan: Left mouse, or arrow keys / touch: one-finger move. + +## Import + +MapControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MapControls } from 'three/addons/controls/MapControls.js'; +``` + +## Constructor + +### new MapControls() + +## Properties + +### .mouseButtons : Object + +This object contains references to the mouse actions used by the controls. + +```js +controls.mouseButtons = { + LEFT: THREE.MOUSE.PAN, + MIDDLE: THREE.MOUSE.DOLLY, + RIGHT: THREE.MOUSE.ROTATE +} +``` + +**Overrides:** [OrbitControls#mouseButtons](OrbitControls.html#mouseButtons) + +### .screenSpacePanning : boolean + +Overwritten and set to `false` to pan orthogonal to world-space direction `camera.up`. + +Default is `false`. + +**Overrides:** [OrbitControls#screenSpacePanning](OrbitControls.html#screenSpacePanning) + +### .touches : Object + +This object contains references to the touch actions used by the controls. + +```js +controls.mouseButtons = { + ONE: THREE.TOUCH.PAN, + TWO: THREE.TOUCH.DOLLY_ROTATE +} +``` + +**Overrides:** [OrbitControls#touches](OrbitControls.html#touches) + +## Source + +[examples/jsm/controls/MapControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/MapControls.js) \ No newline at end of file diff --git a/docs/pages/MarchingCubes.html.md b/docs/pages/MarchingCubes.html.md new file mode 100644 index 00000000000000..9e0cd71f284c02 --- /dev/null +++ b/docs/pages/MarchingCubes.html.md @@ -0,0 +1,191 @@ +# MarchingCubes + +A marching cubes implementation. + +Port of: [http://webglsamples.org/blob/blob.html](http://webglsamples.org/blob/blob.html) + +## Import + +MarchingCubes is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MarchingCubes } from 'three/addons/objects/MarchingCubes.js'; +``` + +## Constructor + +### new MarchingCubes( resolution : number, material : Material, enableUvs : boolean, enableColors : boolean, maxPolyCount : number ) + +Constructs a new marching cubes instance. + +**resolution** + +The effect's resolution. + +**material** + +The cube's material. + +**enableUvs** + +Whether texture coordinates should be animated or not. + +Default is `false`. + +**enableColors** + +Whether colors should be animated or not. + +Default is `false`. + +**maxPolyCount** + +The maximum size of the geometry buffers. + +Default is `10000`. + +## Properties + +### .enableColors : boolean + +Whether colors should be animated or not. + +Default is `false`. + +### .enableUvs : boolean + +Whether texture coordinates should be animated or not. + +Default is `false`. + +### .isMarchingCubes : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .addBall( ballx : number, bally : number, ballz : number, strength : number, subtract : number, colors : Color ) + +Adds a reciprocal ball (nice and blobby) that, to be fast, fades to zero after a fixed distance, determined by strength and subtract. + +**ballx** + +The x-coordinate of the ball. + +**bally** + +The y-coordinate of the ball. + +**ballz** + +The z-coordinate of the ball. + +**strength** + +The strength factor. + +**subtract** + +The subtract factor. + +**colors** + +The color. + +### .addPlaneX( strength : number, subtract : number ) + +Adds a plane along the x-axis. + +**strength** + +The strength factor. + +**subtract** + +The subtract factor. + +### .addPlaneY( strength : number, subtract : number ) + +Adds a plane along the y-axis. + +**strength** + +The strength factor. + +**subtract** + +The subtract factor. + +### .addPlaneZ( strength : number, subtract : number ) + +Adds a plane along the z-axis. + +**strength** + +The strength factor. + +**subtract** + +The subtract factor. + +### .blur( intensity : number ) + +Applies a blur with the given intensity. + +**intensity** + +The intensity of the blur. + +Default is `1`. + +### .getCell( x : number, y : number, z : number ) : number + +Returns the cell value for the given coordinates. + +**x** + +The x value. + +**y** + +The y value. + +**z** + +The z value. + +**Returns:** The value. + +### .reset() + +Resets the effect. + +### .setCell( x : number, y : number, z : number, value : number ) + +Sets the cell value for the given coordinates. + +**x** + +The x value. + +**y** + +The y value. + +**z** + +The z value. + +**value** + +The value to set. + +### .update() + +Updates the effect. + +## Source + +[examples/jsm/objects/MarchingCubes.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/MarchingCubes.js) \ No newline at end of file diff --git a/docs/pages/MaskPass.html.md b/docs/pages/MaskPass.html.md new file mode 100644 index 00000000000000..673bf46fa27714 --- /dev/null +++ b/docs/pages/MaskPass.html.md @@ -0,0 +1,98 @@ +*Inheritance: Pass →* + +# MaskPass + +This pass can be used to define a mask during post processing. Meaning only areas of subsequent post processing are affected which lie in the masking area of this pass. Internally, the masking is implemented with the stencil buffer. + +## Code Example + +```js +const maskPass = new MaskPass( scene, camera ); +composer.addPass( maskPass ); +``` + +## Import + +MaskPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MaskPass } from 'three/addons/postprocessing/MaskPass.js'; +``` + +## Constructor + +### new MaskPass( scene : Scene, camera : Camera ) + +Constructs a new mask pass. + +**scene** + +The 3D objects in this scene will define the mask. + +**camera** + +The camera. + +## Properties + +### .camera : Camera + +The camera. + +### .clear : boolean + +Overwritten to perform a clear operation by default. + +Default is `true`. + +**Overrides:** [Pass#clear](Pass.html#clear) + +### .inverse : boolean + +Whether to inverse the mask or not. + +Default is `false`. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +### .scene : Scene + +The scene that defines the mask. + +## Methods + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs a mask pass with the configured scene and camera. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/MaskPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/MaskPass.js) \ No newline at end of file diff --git a/docs/pages/Material.html.md b/docs/pages/Material.html.md new file mode 100644 index 00000000000000..df7a60bac0b3ec --- /dev/null +++ b/docs/pages/Material.html.md @@ -0,0 +1,445 @@ +*Inheritance: EventDispatcher →* + +# Material + +Abstract base class for materials. + +Materials define the appearance of renderable 3D objects. + +## Constructor + +### new Material() (abstract) + +Constructs a new material. + +## Properties + +### .allowOverride : boolean + +Whether it's possible to override the material with [Scene#overrideMaterial](Scene.html#overrideMaterial) or not. + +Default is `true`. + +### .alphaHash : boolean + +Enables alpha hashed transparency, an alternative to [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The material will not be rendered if opacity is lower than a random threshold. Randomization introduces some grain or noise, but approximates alpha blending without the associated problems of sorting. Using TAA can reduce the resulting noise. + +Default is `false`. + +### .alphaTest : number (readonly) + +Sets the alpha value to be used when running an alpha test. The material will not be rendered if the opacity is lower than this value. + +Default is `0`. + +### .alphaToCoverage : boolean + +Whether alpha to coverage should be enabled or not. Can only be used with MSAA-enabled contexts (meaning when the renderer was created with _antialias_ parameter set to `true`). Enabling this will smooth aliasing on clip plane edges and alphaTest-clipped edges. + +Default is `false`. + +### .blendAlpha : number + +Represents the alpha value of the constant blend color. + +This property has only an effect when using custom blending with `ConstantAlpha` or `OneMinusConstantAlpha`. + +Default is `0`. + +### .blendColor : Color + +Represents the RGB values of the constant blend color. + +This property has only an effect when using custom blending with `ConstantColor` or `OneMinusConstantColor`. + +Default is `(0,0,0)`. + +### .blendDst : ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | SrcAlphaFactor | OneMinusSrcAlphaFactor | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor + +Defines the blending destination factor. + +Default is `OneMinusSrcAlphaFactor`. + +### .blendDstAlpha : ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | SrcAlphaFactor | OneMinusSrcAlphaFactor | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor + +Defines the blending destination alpha factor. + +Default is `null`. + +### .blendEquation : AddEquation | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation + +Defines the blending equation. + +Default is `AddEquation`. + +### .blendEquationAlpha : AddEquation | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation + +Defines the blending equation of the alpha channel. + +Default is `null`. + +### .blendSrc : ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | SrcAlphaFactor | OneMinusSrcAlphaFactor | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor + +Defines the blending source factor. + +Default is `SrcAlphaFactor`. + +### .blendSrcAlpha : ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | SrcAlphaFactor | OneMinusSrcAlphaFactor | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor + +Defines the blending source alpha factor. + +Default is `null`. + +### .blending : NoBlending | NormalBlending | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending + +Defines the blending type of the material. + +It must be set to `CustomBlending` if custom blending properties like [Material#blendSrc](Material.html#blendSrc), [Material#blendDst](Material.html#blendDst) or [Material#blendEquation](Material.html#blendEquation) should have any effect. + +Default is `NormalBlending`. + +### .clipIntersection : boolean + +Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. + +Default is `false`. + +### .clipShadows : boolean + +Defines whether to clip shadows according to the clipping planes specified on this material. + +Default is `false`. + +### .clippingPlanes : Array. + +User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered). This requires [WebGLRenderer#localClippingEnabled](WebGLRenderer.html#localClippingEnabled) to be `true`. + +Default is `null`. + +### .colorWrite : boolean + +Whether to render the material's color. + +This can be used in conjunction with Object3D#renderOder to create invisible objects that occlude other objects. + +Default is `true`. + +### .depthFunc : NeverDepth | AlwaysDepth | LessDepth | LessEqualDepth | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth + +Defines the depth function. + +Default is `LessEqualDepth`. + +### .depthTest : boolean + +Whether to have depth test enabled when rendering this material. When the depth test is disabled, the depth write will also be implicitly disabled. + +Default is `true`. + +### .depthWrite : boolean + +Whether rendering this material has any effect on the depth buffer. + +When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts. + +Default is `true`. + +### .dithering : boolean + +Whether to apply dithering to the color to remove the appearance of banding. + +Default is `false`. + +### .forceSinglePass : boolean + +Whether double-sided, transparent objects should be rendered with a single pass or not. + +The engine renders double-sided, transparent objects with two draw calls (back faces first, then front faces) to mitigate transparency artifacts. There are scenarios however where this approach produces no quality gains but still doubles draw calls e.g. when rendering flat vegetation like grass sprites. In these cases, set the `forceSinglePass` flag to `true` to disable the two pass rendering to avoid performance issues. + +Default is `false`. + +### .id : number (readonly) + +The ID of the material. + +### .isMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the material. + +### .needsUpdate : boolean + +Setting this property to `true` indicates the engine the material needs to be recompiled. + +Default is `false`. + +### .opacity : number + +Defines how transparent the material is. A value of `0.0` indicates fully transparent, `1.0` is fully opaque. + +If the [Material#transparent](Material.html#transparent) is not set to `true`, the material will remain fully opaque and this value will only affect its color. + +Default is `1`. + +### .polygonOffset : boolean + +Whether to use polygon offset or not. When enabled, each fragment's depth value will be offset after it is interpolated from the depth values of the appropriate vertices. The offset is added before the depth test is performed and before the value is written into the depth buffer. + +Can be useful for rendering hidden-line images, for applying decals to surfaces, and for rendering solids with highlighted edges. + +Default is `false`. + +### .polygonOffsetFactor : number + +Specifies a scale factor that is used to create a variable depth offset for each polygon. + +Default is `0`. + +### .polygonOffsetUnits : number + +Is multiplied by an implementation-specific value to create a constant depth offset. + +Default is `0`. + +### .precision : 'highp' | 'mediump' | 'lowp' + +Override the renderer's default precision for this material. + +Default is `null`. + +### .premultipliedAlpha : boolean + +Whether to premultiply the alpha (transparency) value. + +Default is `false`. + +### .shadowSide : FrontSide | BackSide | DoubleSide + +Defines which side of faces cast shadows. If `null`, the side casting shadows is determined as follows: + +* When [Material#side](Material.html#side) is set to `FrontSide`, the back side cast shadows. +* When [Material#side](Material.html#side) is set to `BackSide`, the front side cast shadows. +* When [Material#side](Material.html#side) is set to `DoubleSide`, both sides cast shadows. + +Default is `null`. + +### .side : FrontSide | BackSide | DoubleSide + +Defines which side of faces will be rendered - front, back or both. + +Default is `FrontSide`. + +### .stencilFail : ZeroStencilOp | KeepStencilOp | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp + +Which stencil operation to perform when the comparison function returns `false`. + +Default is `KeepStencilOp`. + +### .stencilFunc : NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | AlwaysStencilFunc + +The stencil comparison function to use. + +Default is `AlwaysStencilFunc`. + +### .stencilFuncMask : number + +The bit mask to use when comparing against the stencil buffer. + +Default is `0xff`. + +### .stencilRef : number + +The value to use when performing stencil comparisons or stencil operations. + +Default is `0`. + +### .stencilWrite : boolean + +Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be `true`. + +Default is `false`. + +### .stencilWriteMask : number + +The bit mask to use when writing to the stencil buffer. + +Default is `0xff`. + +### .stencilZFail : ZeroStencilOp | KeepStencilOp | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp + +Which stencil operation to perform when the comparison function returns `true` but the depth test fails. + +Default is `KeepStencilOp`. + +### .stencilZPass : ZeroStencilOp | KeepStencilOp | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp + +Which stencil operation to perform when the comparison function returns `true` and the depth test passes. + +Default is `KeepStencilOp`. + +### .toneMapped : boolean + +Defines whether this material is tone mapped according to the renderer's tone mapping setting. + +It is ignored when rendering to a render target or using post processing or when using `WebGPURenderer`. In all these cases, all materials are honored by tone mapping. + +Default is `true`. + +### .transparent : boolean + +Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects. + +When set to true, the extent to which the material is transparent is controlled by [Material#opacity](Material.html#opacity). + +Default is `false`. + +### .type : string (readonly) + +The type property is used for detecting the object type in context of serialization/deserialization. + +### .userData : Object + +An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned. + +### .uuid : string (readonly) + +The UUID of the material. + +### .version : number (readonly) + +This starts at `0` and counts how many times [Material#needsUpdate](Material.html#needsUpdate) is set to `true`. + +Default is `0`. + +### .vertexColors : boolean + +If set to `true`, vertex colors should be used. + +The engine supports RGB and RGBA vertex colors depending on whether a three (RGB) or four (RGBA) component color buffer attribute is used. + +Default is `false`. + +### .visible : boolean + +Defines whether 3D objects using this material are visible. + +Default is `true`. + +## Methods + +### .clone() : Material + +Returns a new material with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( source : Material ) : Material + +Copies the values of the given material to this instance. + +**source** + +The material to copy. + +**Returns:** A reference to this instance. + +### .customProgramCacheKey() : string + +In case [Material#onBeforeCompile](Material.html#onBeforeCompile) is used, this callback can be used to identify values of settings used in `onBeforeCompile()`, so three.js can reuse a cached shader or recompile the shader for this material as needed. + +This method can only be used when rendering with [WebGLRenderer](WebGLRenderer.html). + +**Returns:** The custom program cache key. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +##### Fires: + +* [Material#event:dispose](Material.html#event:dispose) + +### .onBeforeCompile( shaderobject : Object, renderer : WebGLRenderer ) + +An optional callback that is executed immediately before the shader program is compiled. This function is called with the shader source code as a parameter. Useful for the modification of built-in materials. + +This method can only be used when rendering with [WebGLRenderer](WebGLRenderer.html). The recommended approach when customizing materials is to use `WebGPURenderer` with the new Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language). + +**shaderobject** + +The object holds the uniforms and the vertex and fragment shader source. + +**renderer** + +A reference to the renderer. + +### .onBeforeRender( renderer : WebGLRenderer, scene : Scene, camera : Camera, geometry : BufferGeometry, object : Object3D, group : Object ) + +An optional callback that is executed immediately before the material is used to render a 3D object. + +This method can only be used when rendering with [WebGLRenderer](WebGLRenderer.html). + +**renderer** + +The renderer. + +**scene** + +The scene. + +**camera** + +The camera that is used to render the scene. + +**geometry** + +The 3D object's geometry. + +**object** + +The 3D object. + +**group** + +The geometry group data. + +### .setValues( values : Object ) + +This method can be used to set default values from parameter objects. It is a generic implementation so it can be used with different types of materials. + +**values** + +The material values to set. + +### .toJSON( meta : Object | string ) : Object + +Serializes the material into JSON. + +**meta** + +An optional value holding meta information about the serialization. + +See: + +* [ObjectLoader#parse](ObjectLoader.html#parse) + +**Returns:** A JSON object representing the serialized material. + +## Events + +### .dispose + +Fires when the material has been disposed of. + +##### Type: + +* Object + +## Source + +[src/materials/Material.js](https://github.com/mrdoob/three.js/blob/master/src/materials/Material.js) \ No newline at end of file diff --git a/docs/pages/MaterialLoader.html.md b/docs/pages/MaterialLoader.html.md new file mode 100644 index 00000000000000..408a99c02246f9 --- /dev/null +++ b/docs/pages/MaterialLoader.html.md @@ -0,0 +1,102 @@ +*Inheritance: Loader →* + +# MaterialLoader + +Class for loading materials. The files are internally loaded via [FileLoader](FileLoader.html). + +This loader does not support node materials. Use [NodeMaterialLoader](NodeMaterialLoader.html) instead. + +## Code Example + +```js +const loader = new THREE.MaterialLoader(); +const material = await loader.loadAsync( 'material.json' ); +``` + +## Constructor + +### new MaterialLoader( manager : LoadingManager ) + +Constructs a new material loader. + +**manager** + +The loading manager. + +## Properties + +### .textures : Object. + +A dictionary holding textures used by the material. + +## Methods + +### .createMaterialFromType( type : string ) : Material + +Creates a material for the given type. + +**type** + +The material type. + +**Returns:** The new material. + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and pass the loaded material to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( json : Object ) : Material + +Parses the given JSON object and returns a material. + +**json** + +The serialized material. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed material. + +### .setTextures( value : Object ) : MaterialLoader + +Textures are not embedded in the material JSON so they have to be injected before the loading process starts. + +**value** + +A dictionary holding textures for material properties. + +**Returns:** A reference to this material loader. + +## Static Methods + +### .createMaterialFromType( type : string ) : Material + +Creates a material for the given type. + +**type** + +The material type. + +**Returns:** The new material. + +## Source + +[src/loaders/MaterialLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/MaterialLoader.js) \ No newline at end of file diff --git a/docs/pages/MaterialNode.html.md b/docs/pages/MaterialNode.html.md new file mode 100644 index 00000000000000..6b51ce4f84a9a4 --- /dev/null +++ b/docs/pages/MaterialNode.html.md @@ -0,0 +1,83 @@ +*Inheritance: EventDispatcher → Node →* + +# MaterialNode + +This class should simplify the node access to material properties. It internal uses reference nodes to make sure changes to material properties are automatically reflected to predefined TSL objects like e.g. `materialColor`. + +## Constructor + +### new MaterialNode( scope : string ) + +Constructs a new material node. + +**scope** + +The scope defines what kind of material property is referred by the node. + +## Properties + +### .scope : string + +The scope defines what material property is referred by the node. + +## Methods + +### .getCache( property : string, type : string ) : MaterialReferenceNode + +Returns a cached reference node for the given property and type. + +**property** + +The name of the material property. + +**type** + +The uniform type of the property. + +**Returns:** A material reference node representing the property access. + +### .getColor( property : string ) : MaterialReferenceNode. + +Returns a color-typed material reference node for the given property name. + +**property** + +The name of the material property. + +**Returns:** A material reference node representing the property access. + +### .getFloat( property : string ) : MaterialReferenceNode. + +Returns a float-typed material reference node for the given property name. + +**property** + +The name of the material property. + +**Returns:** A material reference node representing the property access. + +### .getTexture( property : string ) : MaterialReferenceNode + +Returns a texture-typed material reference node for the given property name. + +**property** + +The name of the material property. + +**Returns:** A material reference node representing the property access. + +### .setup( builder : NodeBuilder ) : Node + +The node setup is done depending on the selected scope. Multiple material properties might be grouped into a single node composition if they logically belong together. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The node representing the selected scope. + +## Source + +[src/nodes/accessors/MaterialNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/MaterialNode.js) \ No newline at end of file diff --git a/docs/pages/MaterialReferenceNode.html.md b/docs/pages/MaterialReferenceNode.html.md new file mode 100644 index 00000000000000..9b36490f5ce1dc --- /dev/null +++ b/docs/pages/MaterialReferenceNode.html.md @@ -0,0 +1,65 @@ +*Inheritance: EventDispatcher → Node → ReferenceNode →* + +# MaterialReferenceNode + +This node is a special type of reference node which is intended for linking material properties with node values. + +When changing `material.opacity`, the node value of `opacityNode` will automatically be updated. + +## Code Example + +```js +const opacityNode = materialReference( 'opacity', 'float', material ); +``` + +## Constructor + +### new MaterialReferenceNode( property : string, inputType : string, material : Material ) + +Constructs a new material reference node. + +**property** + +The name of the property the node refers to. + +**inputType** + +The uniform type that should be used to represent the property value. + +**material** + +The material the property belongs to. When no material is set, the node refers to the material of the current rendered object. + +Default is `null`. + +## Properties + +### .isMaterialReferenceNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .material : Material + +The material the property belongs to. When no material is set, the node refers to the material of the current rendered object. + +Default is `null`. + +## Methods + +### .updateReference( state : NodeFrame | NodeBuilder ) : Object + +Updates the reference based on the given state. The state is only evaluated [MaterialReferenceNode#material](MaterialReferenceNode.html#material) is not set. + +**state** + +The current state. + +**Overrides:** [ReferenceNode#updateReference](ReferenceNode.html#updateReference) + +**Returns:** The updated reference. + +## Source + +[src/nodes/accessors/MaterialReferenceNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/MaterialReferenceNode.js) \ No newline at end of file diff --git a/docs/pages/MaterialXLoader.html.md b/docs/pages/MaterialXLoader.html.md new file mode 100644 index 00000000000000..3f9c6e87f88f49 --- /dev/null +++ b/docs/pages/MaterialXLoader.html.md @@ -0,0 +1,91 @@ +*Inheritance: Loader →* + +# MaterialXLoader + +A loader for the MaterialX format. + +The node materials loaded with this loader can only be used with [WebGPURenderer](WebGPURenderer.html). + +## Code Example + +```js +const loader = new MaterialXLoader().setPath( SAMPLE_PATH ); +const materials = await loader.loadAsync( 'standard_surface_brass_tiled.mtlx' ); +``` + +## Import + +MaterialXLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MaterialXLoader } from 'three/addons/loaders/MaterialXLoader.js'; +``` + +## Constructor + +### new MaterialXLoader( manager : LoadingManager ) + +Constructs a new MaterialX loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : MaterialXLoader + +Starts loading from the given URL and passes the loaded MaterialX asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** A reference to this loader. + +### .parse( text : string ) : Object. + +Parses the given MaterialX data and returns the resulting materials. + +Supported standard\_surface inputs: + +* base, base\_color: Base color/albedo +* opacity: Alpha/transparency +* specular\_roughness: Surface roughness +* metalness: Metallic property +* specular: Specular reflection intensity +* specular\_color: Specular reflection color +* ior: Index of refraction +* specular\_anisotropy, specular\_rotation: Anisotropic reflection +* transmission, transmission\_color: Transmission properties +* thin\_film\_thickness, thin\_film\_ior: Thin film interference +* sheen, sheen\_color, sheen\_roughness: Sheen properties +* normal: Normal map +* coat, coat\_roughness, coat\_color: Clearcoat properties +* emission, emissionColor: Emission properties + +**text** + +The raw MaterialX data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** A dictionary holding the parse node materials. + +## Source + +[examples/jsm/loaders/MaterialXLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/MaterialXLoader.js) \ No newline at end of file diff --git a/docs/pages/MathNode.html.md b/docs/pages/MathNode.html.md new file mode 100644 index 00000000000000..1fbfd940fba6e2 --- /dev/null +++ b/docs/pages/MathNode.html.md @@ -0,0 +1,91 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# MathNode + +This node represents a variety of mathematical methods available in shaders. They are divided into three categories: + +* Methods with one input like `sin`, `cos` or `normalize`. +* Methods with two inputs like `dot`, `cross` or `pow`. +* Methods with three inputs like `mix`, `clamp` or `smoothstep`. + +## Constructor + +### new MathNode( method : string, aNode : Node, bNode : Node, cNode : Node ) + +Constructs a new math node. + +**method** + +The method name. + +**aNode** + +The first input. + +**bNode** + +The second input. + +Default is `null`. + +**cNode** + +The third input. + +Default is `null`. + +## Properties + +### .aNode : Node + +The first input. + +### .bNode : Node + +The second input. + +Default is `null`. + +### .cNode : Node + +The third input. + +Default is `null`. + +### .isMathNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .method : string + +The method name. + +## Methods + +### .getInputType( builder : NodeBuilder ) : string + +The input type is inferred from the node types of the input nodes. + +**builder** + +The current node builder. + +**Returns:** The input type. + +### .getNodeType( builder : NodeBuilder ) : string + +The selected method as well as the input type determine the node type of this node. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getNodeType](TempNode.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/math/MathNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/math/MathNode.js) \ No newline at end of file diff --git a/docs/pages/MathUtils.html.md b/docs/pages/MathUtils.html.md new file mode 100644 index 00000000000000..2aad9d4341b016 --- /dev/null +++ b/docs/pages/MathUtils.html.md @@ -0,0 +1,337 @@ +# MathUtils + +A collection of math utility functions. + +## Static Methods + +### .ceilPowerOfTwo( value : number ) : number + +Returns the smallest power of two that is greater than or equal to the given number. + +**value** + +The value to find a POT for. + +**Returns:** The smallest power of two that is greater than or equal to the given number. + +### .clamp( value : number, min : number, max : number ) : number + +Clamps the given value between min and max. + +**value** + +The value to clamp. + +**min** + +The min value. + +**max** + +The max value. + +**Returns:** The clamped value. + +### .damp( x : number, y : number, lambda : number, dt : number ) : number + +Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta time to maintain frame rate independent movement. For details, see [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/). + +**x** + +The current point. + +**y** + +The target point. + +**lambda** + +A higher lambda value will make the movement more sudden, and a lower value will make the movement more gradual. + +**dt** + +Delta time in seconds. + +**Returns:** The interpolated value. + +### .degToRad( degrees : number ) : number + +Converts degrees to radians. + +**degrees** + +A value in degrees. + +**Returns:** The converted value in radians. + +### .denormalize( value : number, array : TypedArray ) : number + +Denormalizes the given value according to the given typed array. + +**value** + +The value to denormalize. + +**array** + +The typed array that defines the data type of the value. + +**Returns:** The denormalize (float) value in the range `[0,1]`. + +### .euclideanModulo( n : number, m : number ) : number + +Computes the Euclidean modulo of the given parameters that is `( ( n % m ) + m ) % m`. + +**n** + +The first parameter. + +**m** + +The second parameter. + +**Returns:** The Euclidean modulo. + +### .floorPowerOfTwo( value : number ) : number + +Returns the largest power of two that is less than or equal to the given number. + +**value** + +The value to find a POT for. + +**Returns:** The largest power of two that is less than or equal to the given number. + +### .generateUUID() : string + +Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) (universally unique identifier). + +**Returns:** The UUID. + +### .inverseLerp( x : number, y : number, value : number ) : number + +Returns the percentage in the closed interval `[0, 1]` of the given value between the start and end point. + +**x** + +The start point + +**y** + +The end point. + +**value** + +A value between start and end. + +**Returns:** The interpolation factor. + +### .isPowerOfTwo( value : number ) : boolean + +Returns `true` if the given number is a power of two. + +**value** + +The value to check. + +**Returns:** Whether the given number is a power of two or not. + +### .lerp( x : number, y : number, t : number ) : number + +Returns a value linearly interpolated from two known points based on the given interval - `t = 0` will return `x` and `t = 1` will return `y`. + +**x** + +The start point + +**y** + +The end point. + +**t** + +The interpolation factor in the closed interval `[0, 1]`. + +**Returns:** The interpolated value. + +### .mapLinear( x : number, a1 : number, a2 : number, b1 : number, b2 : number ) : number + +Performs a linear mapping from range `` to range `` for the given value. + +**x** + +The value to be mapped. + +**a1** + +Minimum value for range A. + +**a2** + +Maximum value for range A. + +**b1** + +Minimum value for range B. + +**b2** + +Maximum value for range B. + +**Returns:** The mapped value. + +### .normalize( value : number, array : TypedArray ) : number + +Normalizes the given value according to the given typed array. + +**value** + +The float value in the range `[0,1]` to normalize. + +**array** + +The typed array that defines the data type of the value. + +**Returns:** The normalize value. + +### .pingpong( x : number, length : number ) : number + +Returns a value that alternates between `0` and the given `length` parameter. + +**x** + +The value to pingpong. + +**length** + +The positive value the function will pingpong to. + +Default is `1`. + +**Returns:** The alternated value. + +### .radToDeg( radians : number ) : number + +Converts radians to degrees. + +**radians** + +A value in radians. + +**Returns:** The converted value in degrees. + +### .randFloat( low : number, high : number ) : number + +Returns a random float from `` interval. + +**low** + +The lower value boundary. + +**high** + +The upper value boundary + +**Returns:** A random float. + +### .randFloatSpread( range : number ) : number + +Returns a random integer from `<-range/2, range/2>` interval. + +**range** + +Defines the value range. + +**Returns:** A random float. + +### .randInt( low : number, high : number ) : number + +Returns a random integer from `` interval. + +**low** + +The lower value boundary. + +**high** + +The upper value boundary + +**Returns:** A random integer. + +### .seededRandom( s : number ) : number + +Returns a deterministic pseudo-random float in the interval `[0, 1]`. + +**s** + +The integer seed. + +**Returns:** A random float. + +### .setQuaternionFromProperEuler( q : Quaternion, a : number, b : number, c : number, order : 'XYX' | 'XZX' | 'YXY' | 'YZY' | 'ZXZ' | 'ZYZ' ) + +Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles) defined by the given angles and order. + +Rotations are applied to the axes in the order specified by order: rotation by angle `a` is applied first, then by angle `b`, then by angle `c`. + +**q** + +The quaternion to set. + +**a** + +The rotation applied to the first axis, in radians. + +**b** + +The rotation applied to the second axis, in radians. + +**c** + +The rotation applied to the third axis, in radians. + +**order** + +A string specifying the axes order. + +### .smootherstep( x : number, min : number, max : number ) : number + +A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations) that has zero 1st and 2nd order derivatives at x=0 and x=1. + +**x** + +The value to evaluate based on its position between min and max. + +**min** + +The min value. Any x value below min will be `0`. + +**max** + +The max value. Any x value above max will be `1`. + +**Returns:** The alternated value. + +### .smoothstep( x : number, min : number, max : number ) : number + +Returns a value in the range `[0,1]` that represents the percentage that `x` has moved between `min` and `max`, but smoothed or slowed down the closer `x` is to the `min` and `max`. + +See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details. + +**x** + +The value to evaluate based on its position between min and max. + +**min** + +The min value. Any x value below min will be `0`. + +**max** + +The max value. Any x value above max will be `1`. + +**Returns:** The alternated value. + +## Source + +[src/math/MathUtils.js](https://github.com/mrdoob/three.js/blob/master/src/math/MathUtils.js) \ No newline at end of file diff --git a/docs/pages/Matrix2.html.md b/docs/pages/Matrix2.html.md new file mode 100644 index 00000000000000..a2aafb6a29ce38 --- /dev/null +++ b/docs/pages/Matrix2.html.md @@ -0,0 +1,112 @@ +# Matrix2 + +Represents a 2x2 matrix. + +A Note on Row-Major and Column-Major Ordering: + +The constructor and [Matrix2#set](Matrix2.html#set) method take arguments in [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) order, while internally they are stored in the [Matrix2#elements](Matrix2.html#elements) array in column-major order. This means that calling: + +will result in the elements array containing: + +```js +m.elements = [ 11, 21, + 12, 22 ]; +``` + +and internally all calculations are performed using column-major ordering. However, as the actual ordering makes no difference mathematically and most people are used to thinking about matrices in row-major order, the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source code, you'll have to take the transpose of any matrices outlined here to make sense of the calculations. + +## Code Example + +```js +const m = new THREE.Matrix2(); +m.set( 11, 12, + 21, 22 ); +``` + +## Constructor + +### new Matrix2( n11 : number, n12 : number, n21 : number, n22 : number ) + +Constructs a new 2x2 matrix. The arguments are supposed to be in row-major order. If no arguments are provided, the constructor initializes the matrix as an identity matrix. + +**n11** + +1-1 matrix element. + +**n12** + +1-2 matrix element. + +**n21** + +2-1 matrix element. + +**n22** + +2-2 matrix element. + +## Classes + +[Matrix2](Matrix2.html) + +## Properties + +### .elements : Array. + +A column-major list of matrix values. + +### .isMatrix2 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .fromArray( array : Array., offset : number ) : Matrix2 + +Sets the elements of the matrix from the given array. + +**array** + +The matrix elements in column-major order. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** A reference to this matrix. + +### .identity() : Matrix2 + +Sets this matrix to the 2x2 identity matrix. + +**Returns:** A reference to this matrix. + +### .set( n11 : number, n12 : number, n21 : number, n22 : number ) : Matrix2 + +Sets the elements of the matrix.The arguments are supposed to be in row-major order. + +**n11** + +1-1 matrix element. + +**n12** + +1-2 matrix element. + +**n21** + +2-1 matrix element. + +**n22** + +2-2 matrix element. + +**Returns:** A reference to this matrix. + +## Source + +[src/math/Matrix2.js](https://github.com/mrdoob/three.js/blob/master/src/math/Matrix2.js) \ No newline at end of file diff --git a/docs/pages/Matrix3.html.md b/docs/pages/Matrix3.html.md new file mode 100644 index 00000000000000..cff2301982eaa4 --- /dev/null +++ b/docs/pages/Matrix3.html.md @@ -0,0 +1,414 @@ +# Matrix3 + +Represents a 3x3 matrix. + +A Note on Row-Major and Column-Major Ordering: + +The constructor and [Matrix3#set](Matrix3.html#set) method take arguments in [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) order, while internally they are stored in the [Matrix3#elements](Matrix3.html#elements) array in column-major order. This means that calling: + +will result in the elements array containing: + +```js +m.elements = [ 11, 21, 31, + 12, 22, 32, + 13, 23, 33 ]; +``` + +and internally all calculations are performed using column-major ordering. However, as the actual ordering makes no difference mathematically and most people are used to thinking about matrices in row-major order, the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source code, you'll have to take the transpose of any matrices outlined here to make sense of the calculations. + +## Code Example + +```js +const m = new THREE.Matrix(); +m.set( 11, 12, 13, + 21, 22, 23, + 31, 32, 33 ); +``` + +## Constructor + +### new Matrix3( n11 : number, n12 : number, n13 : number, n21 : number, n22 : number, n23 : number, n31 : number, n32 : number, n33 : number ) + +Constructs a new 3x3 matrix. The arguments are supposed to be in row-major order. If no arguments are provided, the constructor initializes the matrix as an identity matrix. + +**n11** + +1-1 matrix element. + +**n12** + +1-2 matrix element. + +**n13** + +1-3 matrix element. + +**n21** + +2-1 matrix element. + +**n22** + +2-2 matrix element. + +**n23** + +2-3 matrix element. + +**n31** + +3-1 matrix element. + +**n32** + +3-2 matrix element. + +**n33** + +3-3 matrix element. + +## Properties + +### .elements : Array. + +A column-major list of matrix values. + +### .isMatrix3 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .clone() : Matrix3 + +Returns a matrix with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( m : Matrix3 ) : Matrix3 + +Copies the values of the given matrix to this instance. + +**m** + +The matrix to copy. + +**Returns:** A reference to this matrix. + +### .determinant() : number + +Computes and returns the determinant of this matrix. + +**Returns:** The determinant. + +### .equals( matrix : Matrix3 ) : boolean + +Returns `true` if this matrix is equal with the given one. + +**matrix** + +The matrix to test for equality. + +**Returns:** Whether this matrix is equal with the given one. + +### .extractBasis( xAxis : Vector3, yAxis : Vector3, zAxis : Vector3 ) : Matrix3 + +Extracts the basis of this matrix into the three axis vectors provided. + +**xAxis** + +The basis's x axis. + +**yAxis** + +The basis's y axis. + +**zAxis** + +The basis's z axis. + +**Returns:** A reference to this matrix. + +### .fromArray( array : Array., offset : number ) : Matrix3 + +Sets the elements of the matrix from the given array. + +**array** + +The matrix elements in column-major order. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** A reference to this matrix. + +### .getNormalMatrix( matrix4 : Matrix4 ) : Matrix3 + +Computes the normal matrix which is the inverse transpose of the upper left 3x3 portion of the given 4x4 matrix. + +**matrix4** + +The 4x4 matrix. + +**Returns:** A reference to this matrix. + +### .identity() : Matrix3 + +Sets this matrix to the 3x3 identity matrix. + +**Returns:** A reference to this matrix. + +### .invert() : Matrix3 + +Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution). You can not invert with a determinant of zero. If you attempt this, the method produces a zero matrix instead. + +**Returns:** A reference to this matrix. + +### .makeRotation( theta : number ) : Matrix3 + +Sets this matrix as a 2D rotational transformation. + +**theta** + +The rotation in radians. + +**Returns:** A reference to this matrix. + +### .makeScale( x : number, y : number ) : Matrix3 + +Sets this matrix as a 2D scale transform. + +**x** + +The amount to scale in the X axis. + +**y** + +The amount to scale in the Y axis. + +**Returns:** A reference to this matrix. + +### .makeTranslation( x : number | Vector2, y : number ) : Matrix3 + +Sets this matrix as a 2D translation transform. + +**x** + +The amount to translate in the X axis or alternatively a translation vector. + +**y** + +The amount to translate in the Y axis. + +**Returns:** A reference to this matrix. + +### .multiply( m : Matrix3 ) : Matrix3 + +Post-multiplies this matrix by the given 3x3 matrix. + +**m** + +The matrix to multiply with. + +**Returns:** A reference to this matrix. + +### .multiplyMatrices( a : Matrix3, b : Matrix3 ) : Matrix3 + +Multiples the given 3x3 matrices and stores the result in this matrix. + +**a** + +The first matrix. + +**b** + +The second matrix. + +**Returns:** A reference to this matrix. + +### .multiplyScalar( s : number ) : Matrix3 + +Multiplies every component of the matrix by the given scalar. + +**s** + +The scalar. + +**Returns:** A reference to this matrix. + +### .premultiply( m : Matrix3 ) : Matrix3 + +Pre-multiplies this matrix by the given 3x3 matrix. + +**m** + +The matrix to multiply with. + +**Returns:** A reference to this matrix. + +### .rotate( theta : number ) : Matrix3 + +Rotates this matrix by the given angle. + +**theta** + +The rotation in radians. + +**Returns:** A reference to this matrix. + +### .scale( sx : number, sy : number ) : Matrix3 + +Scales this matrix with the given scalar values. + +**sx** + +The amount to scale in the X axis. + +**sy** + +The amount to scale in the Y axis. + +**Returns:** A reference to this matrix. + +### .set( n11 : number, n12 : number, n13 : number, n21 : number, n22 : number, n23 : number, n31 : number, n32 : number, n33 : number ) : Matrix3 + +Sets the elements of the matrix.The arguments are supposed to be in row-major order. + +**n11** + +1-1 matrix element. + +**n12** + +1-2 matrix element. + +**n13** + +1-3 matrix element. + +**n21** + +2-1 matrix element. + +**n22** + +2-2 matrix element. + +**n23** + +2-3 matrix element. + +**n31** + +3-1 matrix element. + +**n32** + +3-2 matrix element. + +**n33** + +3-3 matrix element. + +**Returns:** A reference to this matrix. + +### .setFromMatrix4( m : Matrix4 ) : Matrix3 + +Set this matrix to the upper 3x3 matrix of the given 4x4 matrix. + +**m** + +The 4x4 matrix. + +**Returns:** A reference to this matrix. + +### .setUvTransform( tx : number, ty : number, sx : number, sy : number, rotation : number, cx : number, cy : number ) : Matrix3 + +Sets the UV transform matrix from offset, repeat, rotation, and center. + +**tx** + +Offset x. + +**ty** + +Offset y. + +**sx** + +Repeat x. + +**sy** + +Repeat y. + +**rotation** + +Rotation, in radians. Positive values rotate counterclockwise. + +**cx** + +Center x of rotation. + +**cy** + +Center y of rotation + +**Returns:** A reference to this matrix. + +### .toArray( array : Array., offset : number ) : Array. + +Writes the elements of this matrix to the given array. If no array is provided, the method returns a new instance. + +**array** + +The target array holding the matrix elements in column-major order. + +Default is `[]`. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** The matrix elements in column-major order. + +### .translate( tx : number, ty : number ) : Matrix3 + +Translates this matrix by the given scalar values. + +**tx** + +The amount to translate in the X axis. + +**ty** + +The amount to translate in the Y axis. + +**Returns:** A reference to this matrix. + +### .transpose() : Matrix3 + +Transposes this matrix in place. + +**Returns:** A reference to this matrix. + +### .transposeIntoArray( r : Array. ) : Matrix3 + +Transposes this matrix into the supplied array, and returns itself unchanged. + +**r** + +An array to store the transposed matrix elements. + +**Returns:** A reference to this matrix. + +## Source + +[src/math/Matrix3.js](https://github.com/mrdoob/three.js/blob/master/src/math/Matrix3.js) \ No newline at end of file diff --git a/docs/pages/Matrix4.html.md b/docs/pages/Matrix4.html.md new file mode 100644 index 00000000000000..f8cbdd6c5d1b86 --- /dev/null +++ b/docs/pages/Matrix4.html.md @@ -0,0 +1,694 @@ +# Matrix4 + +Represents a 4x4 matrix. + +The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix. For an introduction to transformation matrices as used in WebGL, check out [this tutorial](https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices) + +This allows a 3D vector representing a point in 3D space to undergo transformations such as translation, rotation, shear, scale, reflection, orthogonal or perspective projection and so on, by being multiplied by the matrix. This is known as `applying` the matrix to the vector. + +A Note on Row-Major and Column-Major Ordering: + +The constructor and [Matrix3#set](Matrix3.html#set) method take arguments in [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) order, while internally they are stored in the [Matrix3#elements](Matrix3.html#elements) array in column-major order. This means that calling: + +will result in the elements array containing: + +```js +m.elements = [ 11, 21, 31, 41, + 12, 22, 32, 42, + 13, 23, 33, 43, + 14, 24, 34, 44 ]; +``` + +and internally all calculations are performed using column-major ordering. However, as the actual ordering makes no difference mathematically and most people are used to thinking about matrices in row-major order, the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source code, you'll have to take the transpose of any matrices outlined here to make sense of the calculations. + +## Code Example + +```js +const m = new THREE.Matrix4(); +m.set( 11, 12, 13, 14, + 21, 22, 23, 24, + 31, 32, 33, 34, + 41, 42, 43, 44 ); +``` + +## Constructor + +### new Matrix4( n11 : number, n12 : number, n13 : number, n14 : number, n21 : number, n22 : number, n23 : number, n24 : number, n31 : number, n32 : number, n33 : number, n34 : number, n41 : number, n42 : number, n43 : number, n44 : number ) + +Constructs a new 4x4 matrix. The arguments are supposed to be in row-major order. If no arguments are provided, the constructor initializes the matrix as an identity matrix. + +**n11** + +1-1 matrix element. + +**n12** + +1-2 matrix element. + +**n13** + +1-3 matrix element. + +**n14** + +1-4 matrix element. + +**n21** + +2-1 matrix element. + +**n22** + +2-2 matrix element. + +**n23** + +2-3 matrix element. + +**n24** + +2-4 matrix element. + +**n31** + +3-1 matrix element. + +**n32** + +3-2 matrix element. + +**n33** + +3-3 matrix element. + +**n34** + +3-4 matrix element. + +**n41** + +4-1 matrix element. + +**n42** + +4-2 matrix element. + +**n43** + +4-3 matrix element. + +**n44** + +4-4 matrix element. + +## Properties + +### .elements : Array. + +A column-major list of matrix values. + +### .isMatrix4 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .clone() : Matrix4 + +Returns a matrix with copied values from this instance. + +**Returns:** A clone of this instance. + +### .compose( position : Vector3, quaternion : Quaternion, scale : Vector3 ) : Matrix4 + +Sets this matrix to the transformation composed of the given position, rotation (Quaternion) and scale. + +**position** + +The position vector. + +**quaternion** + +The rotation as a Quaternion. + +**scale** + +The scale vector. + +**Returns:** A reference to this matrix. + +### .copy( m : Matrix4 ) : Matrix4 + +Copies the values of the given matrix to this instance. + +**m** + +The matrix to copy. + +**Returns:** A reference to this matrix. + +### .copyPosition( m : Matrix4 ) : Matrix4 + +Copies the translation component of the given matrix into this matrix's translation component. + +**m** + +The matrix to copy the translation component. + +**Returns:** A reference to this matrix. + +### .decompose( position : Vector3, quaternion : Quaternion, scale : Vector3 ) : Matrix4 + +Decomposes this matrix into its position, rotation and scale components and provides the result in the given objects. + +Note: Not all matrices are decomposable in this way. For example, if an object has a non-uniformly scaled parent, then the object's world matrix may not be decomposable, and this method may not be appropriate. + +**position** + +The position vector. + +**quaternion** + +The rotation as a Quaternion. + +**scale** + +The scale vector. + +**Returns:** A reference to this matrix. + +### .determinant() : number + +Computes and returns the determinant of this matrix. + +Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html). + +**Returns:** The determinant. + +### .equals( matrix : Matrix4 ) : boolean + +Returns `true` if this matrix is equal with the given one. + +**matrix** + +The matrix to test for equality. + +**Returns:** Whether this matrix is equal with the given one. + +### .extractBasis( xAxis : Vector3, yAxis : Vector3, zAxis : Vector3 ) : Matrix4 + +Extracts the basis of this matrix into the three axis vectors provided. + +**xAxis** + +The basis's x axis. + +**yAxis** + +The basis's y axis. + +**zAxis** + +The basis's z axis. + +**Returns:** A reference to this matrix. + +### .extractRotation( m : Matrix4 ) : Matrix4 + +Extracts the rotation component of the given matrix into this matrix's rotation component. + +Note: This method does not support reflection matrices. + +**m** + +The matrix. + +**Returns:** A reference to this matrix. + +### .fromArray( array : Array., offset : number ) : Matrix4 + +Sets the elements of the matrix from the given array. + +**array** + +The matrix elements in column-major order. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** A reference to this matrix. + +### .getMaxScaleOnAxis() : number + +Gets the maximum scale value of the three axes. + +**Returns:** The maximum scale. + +### .identity() : Matrix4 + +Sets this matrix to the 4x4 identity matrix. + +**Returns:** A reference to this matrix. + +### .invert() : Matrix4 + +Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution). You can not invert with a determinant of zero. If you attempt this, the method produces a zero matrix instead. + +**Returns:** A reference to this matrix. + +### .lookAt( eye : Vector3, target : Vector3, up : Vector3 ) : Matrix4 + +Sets the rotation component of the transformation matrix, looking from `eye` towards `target`, and oriented by the up-direction. + +**eye** + +The eye vector. + +**target** + +The target vector. + +**up** + +The up vector. + +**Returns:** A reference to this matrix. + +### .makeBasis( xAxis : Vector3, yAxis : Vector3, zAxis : Vector3 ) : Matrix4 + +Sets the given basis vectors to this matrix. + +**xAxis** + +The basis's x axis. + +**yAxis** + +The basis's y axis. + +**zAxis** + +The basis's z axis. + +**Returns:** A reference to this matrix. + +### .makeOrthographic( left : number, right : number, top : number, bottom : number, near : number, far : number, coordinateSystem : WebGLCoordinateSystem | WebGPUCoordinateSystem, reversedDepth : boolean ) : Matrix4 + +Creates a orthographic projection matrix. This is used internally by [OrthographicCamera#updateProjectionMatrix](OrthographicCamera.html#updateProjectionMatrix). + +**left** + +Left boundary of the viewing frustum at the near plane. + +**right** + +Right boundary of the viewing frustum at the near plane. + +**top** + +Top boundary of the viewing frustum at the near plane. + +**bottom** + +Bottom boundary of the viewing frustum at the near plane. + +**near** + +The distance from the camera to the near plane. + +**far** + +The distance from the camera to the far plane. + +**coordinateSystem** + +The coordinate system. + +Default is `WebGLCoordinateSystem`. + +**reversedDepth** + +Whether to use a reversed depth. + +Default is `false`. + +**Returns:** A reference to this matrix. + +### .makePerspective( left : number, right : number, top : number, bottom : number, near : number, far : number, coordinateSystem : WebGLCoordinateSystem | WebGPUCoordinateSystem, reversedDepth : boolean ) : Matrix4 + +Creates a perspective projection matrix. This is used internally by [PerspectiveCamera#updateProjectionMatrix](PerspectiveCamera.html#updateProjectionMatrix). + +**left** + +Left boundary of the viewing frustum at the near plane. + +**right** + +Right boundary of the viewing frustum at the near plane. + +**top** + +Top boundary of the viewing frustum at the near plane. + +**bottom** + +Bottom boundary of the viewing frustum at the near plane. + +**near** + +The distance from the camera to the near plane. + +**far** + +The distance from the camera to the far plane. + +**coordinateSystem** + +The coordinate system. + +Default is `WebGLCoordinateSystem`. + +**reversedDepth** + +Whether to use a reversed depth. + +Default is `false`. + +**Returns:** A reference to this matrix. + +### .makeRotationAxis( axis : Vector3, angle : number ) : Matrix4 + +Sets this matrix as a rotational transformation around the given axis by the given angle. + +This is a somewhat controversial but mathematically sound alternative to rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199). + +**axis** + +The normalized rotation axis. + +**angle** + +The rotation in radians. + +**Returns:** A reference to this matrix. + +### .makeRotationFromEuler( euler : Euler ) : Matrix4 + +Sets the rotation component (the upper left 3x3 matrix) of this matrix to the rotation specified by the given Euler angles. The rest of the matrix is set to the identity. Depending on the [Euler#order](Euler.html#order), there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix) for a complete list. + +**euler** + +The Euler angles. + +**Returns:** A reference to this matrix. + +### .makeRotationFromQuaternion( q : Quaternion ) : Matrix4 + +Sets the rotation component of this matrix to the rotation specified by the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion) The rest of the matrix is set to the identity. + +**q** + +The Quaternion. + +**Returns:** A reference to this matrix. + +### .makeRotationX( theta : number ) : Matrix4 + +Sets this matrix as a rotational transformation around the X axis by the given angle. + +**theta** + +The rotation in radians. + +**Returns:** A reference to this matrix. + +### .makeRotationY( theta : number ) : Matrix4 + +Sets this matrix as a rotational transformation around the Y axis by the given angle. + +**theta** + +The rotation in radians. + +**Returns:** A reference to this matrix. + +### .makeRotationZ( theta : number ) : Matrix4 + +Sets this matrix as a rotational transformation around the Z axis by the given angle. + +**theta** + +The rotation in radians. + +**Returns:** A reference to this matrix. + +### .makeScale( x : number, y : number, z : number ) : Matrix4 + +Sets this matrix as a scale transformation. + +**x** + +The amount to scale in the X axis. + +**y** + +The amount to scale in the Y axis. + +**z** + +The amount to scale in the Z axis. + +**Returns:** A reference to this matrix. + +### .makeShear( xy : number, xz : number, yx : number, yz : number, zx : number, zy : number ) : Matrix4 + +Sets this matrix as a shear transformation. + +**xy** + +The amount to shear X by Y. + +**xz** + +The amount to shear X by Z. + +**yx** + +The amount to shear Y by X. + +**yz** + +The amount to shear Y by Z. + +**zx** + +The amount to shear Z by X. + +**zy** + +The amount to shear Z by Y. + +**Returns:** A reference to this matrix. + +### .makeTranslation( x : number | Vector3, y : number, z : number ) : Matrix4 + +Sets this matrix as a translation transform from the given vector. + +**x** + +The amount to translate in the X axis or alternatively a translation vector. + +**y** + +The amount to translate in the Y axis. + +**z** + +The amount to translate in the z axis. + +**Returns:** A reference to this matrix. + +### .multiply( m : Matrix4 ) : Matrix4 + +Post-multiplies this matrix by the given 4x4 matrix. + +**m** + +The matrix to multiply with. + +**Returns:** A reference to this matrix. + +### .multiplyMatrices( a : Matrix4, b : Matrix4 ) : Matrix4 + +Multiples the given 4x4 matrices and stores the result in this matrix. + +**a** + +The first matrix. + +**b** + +The second matrix. + +**Returns:** A reference to this matrix. + +### .multiplyScalar( s : number ) : Matrix4 + +Multiplies every component of the matrix by the given scalar. + +**s** + +The scalar. + +**Returns:** A reference to this matrix. + +### .premultiply( m : Matrix4 ) : Matrix4 + +Pre-multiplies this matrix by the given 4x4 matrix. + +**m** + +The matrix to multiply with. + +**Returns:** A reference to this matrix. + +### .scale( v : Vector3 ) : Matrix4 + +Multiplies the columns of this matrix by the given vector. + +**v** + +The scale vector. + +**Returns:** A reference to this matrix. + +### .set( n11 : number, n12 : number, n13 : number, n14 : number, n21 : number, n22 : number, n23 : number, n24 : number, n31 : number, n32 : number, n33 : number, n34 : number, n41 : number, n42 : number, n43 : number, n44 : number ) : Matrix4 + +Sets the elements of the matrix.The arguments are supposed to be in row-major order. + +**n11** + +1-1 matrix element. + +**n12** + +1-2 matrix element. + +**n13** + +1-3 matrix element. + +**n14** + +1-4 matrix element. + +**n21** + +2-1 matrix element. + +**n22** + +2-2 matrix element. + +**n23** + +2-3 matrix element. + +**n24** + +2-4 matrix element. + +**n31** + +3-1 matrix element. + +**n32** + +3-2 matrix element. + +**n33** + +3-3 matrix element. + +**n34** + +3-4 matrix element. + +**n41** + +4-1 matrix element. + +**n42** + +4-2 matrix element. + +**n43** + +4-3 matrix element. + +**n44** + +4-4 matrix element. + +**Returns:** A reference to this matrix. + +### .setFromMatrix3( m : Matrix3 ) : Matrix4 + +Set the upper 3x3 elements of this matrix to the values of given 3x3 matrix. + +**m** + +The 3x3 matrix. + +**Returns:** A reference to this matrix. + +### .setPosition( x : number | Vector3, y : number, z : number ) : Matrix4 + +Sets the position component for this matrix from the given vector, without affecting the rest of the matrix. + +**x** + +The x component of the vector or alternatively the vector object. + +**y** + +The y component of the vector. + +**z** + +The z component of the vector. + +**Returns:** A reference to this matrix. + +### .toArray( array : Array., offset : number ) : Array. + +Writes the elements of this matrix to the given array. If no array is provided, the method returns a new instance. + +**array** + +The target array holding the matrix elements in column-major order. + +Default is `[]`. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** The matrix elements in column-major order. + +### .transpose() : Matrix4 + +Transposes this matrix in place. + +**Returns:** A reference to this matrix. + +## Source + +[src/math/Matrix4.js](https://github.com/mrdoob/three.js/blob/master/src/math/Matrix4.js) \ No newline at end of file diff --git a/docs/pages/MaxMipLevelNode.html.md b/docs/pages/MaxMipLevelNode.html.md new file mode 100644 index 00000000000000..98f95561ba4531 --- /dev/null +++ b/docs/pages/MaxMipLevelNode.html.md @@ -0,0 +1,43 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode →* + +# MaxMipLevelNode + +A special type of uniform node that computes the maximum mipmap level for a given texture node. + +## Code Example + +```js +const level = maxMipLevel( textureNode ); +``` + +## Constructor + +### new MaxMipLevelNode( textureNode : TextureNode ) + +Constructs a new max mip level node. + +**textureNode** + +The texture node to compute the max mip level for. + +## Properties + +### .texture : Texture (readonly) + +The texture. + +### .textureNode : TextureNode (readonly) + +The texture node to compute the max mip level for. + +### .updateType : string + +The `updateType` is set to `NodeUpdateType.FRAME` since the node updates the texture once per frame in its [MaxMipLevelNode#update](MaxMipLevelNode.html#update) method. + +Default is `'frame'`. + +**Overrides:** [UniformNode#updateType](UniformNode.html#updateType) + +## Source + +[src/nodes/utils/MaxMipLevelNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/MaxMipLevelNode.js) \ No newline at end of file diff --git a/docs/pages/MemberNode.html.md b/docs/pages/MemberNode.html.md new file mode 100644 index 00000000000000..2961efca9a59ac --- /dev/null +++ b/docs/pages/MemberNode.html.md @@ -0,0 +1,39 @@ +*Inheritance: EventDispatcher → Node →* + +# MemberNode + +Base class for representing member access on an object-like node data structures. + +## Constructor + +### new MemberNode( structNode : Node, property : string ) + +Constructs a member node. + +**structNode** + +The struct node. + +**property** + +The property name. + +## Properties + +### .isMemberNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .property : Node + +The property name. + +### .structNode : Node + +The struct node. + +## Source + +[src/nodes/utils/MemberNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/MemberNode.js) \ No newline at end of file diff --git a/docs/pages/Mesh.html.md b/docs/pages/Mesh.html.md new file mode 100644 index 00000000000000..16f8ca3e4282dd --- /dev/null +++ b/docs/pages/Mesh.html.md @@ -0,0 +1,102 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Mesh + +Class representing triangular polygon mesh based objects. + +## Code Example + +```js +const geometry = new THREE.BoxGeometry( 1, 1, 1 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const mesh = new THREE.Mesh( geometry, material ); +scene.add( mesh ); +``` + +## Constructor + +### new Mesh( geometry : BufferGeometry, material : Material | Array. ) + +Constructs a new mesh. + +**geometry** + +The mesh geometry. + +**material** + +The mesh material. + +## Properties + +### .count : number + +The number of instances of this mesh. Can only be used with [WebGPURenderer](WebGPURenderer.html). + +Default is `1`. + +### .geometry : BufferGeometry + +The mesh geometry. + +### .isMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .material : Material | Array. + +The mesh material. + +Default is `MeshBasicMaterial`. + +### .morphTargetDictionary : Object. | undefined + +A dictionary representing the morph targets in the geometry. The key is the morph targets name, the value its attribute index. This member is `undefined` by default and only set when morph targets are detected in the geometry. + +Default is `undefined`. + +### .morphTargetInfluences : Array. | undefined + +An array of weights typically in the range `[0,1]` that specify how much of the morph is applied. This member is `undefined` by default and only set when morph targets are detected in the geometry. + +Default is `undefined`. + +## Methods + +### .getVertexPosition( index : number, target : Vector3 ) : Vector3 + +Returns the local-space position of the vertex at the given index, taking into account the current animation state of both morph targets and skinning. + +**index** + +The vertex index. + +**target** + +The target object that is used to store the method's result. + +**Returns:** The vertex position in local space. + +### .raycast( raycaster : Raycaster, intersects : Array. ) + +Computes intersection points between a casted ray and this line. + +**raycaster** + +The raycaster. + +**intersects** + +The target array that holds the intersection points. + +**Overrides:** [Object3D#raycast](Object3D.html#raycast) + +### .updateMorphTargets() + +Sets the values of [Mesh#morphTargetDictionary](Mesh.html#morphTargetDictionary) and [Mesh#morphTargetInfluences](Mesh.html#morphTargetInfluences) to make sure existing morph targets can influence this 3D object. + +## Source + +[src/objects/Mesh.js](https://github.com/mrdoob/three.js/blob/master/src/objects/Mesh.js) \ No newline at end of file diff --git a/docs/pages/MeshBasicMaterial.html.md b/docs/pages/MeshBasicMaterial.html.md new file mode 100644 index 00000000000000..4337d8fdc7deea --- /dev/null +++ b/docs/pages/MeshBasicMaterial.html.md @@ -0,0 +1,147 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshBasicMaterial + +A material for drawing geometries in a simple shaded (flat or wireframe) way. + +This material is not affected by lights. + +## Constructor + +### new MeshBasicMaterial( parameters : Object ) + +Constructs a new mesh basic material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .aoMap : Texture + +The red channel of this texture is used as the ambient occlusion map. Requires a second set of UVs. + +Default is `null`. + +### .aoMapIntensity : number + +Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` disables ambient occlusion. Where intensity is `1` and the AO map's red channel is also `1`, ambient light is fully occluded on a surface. + +Default is `1`. + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .combine : MultiplyOperation | MixOperation | AddOperation + +How to combine the result of the surface's color with the environment map, if any. + +When set to `MixOperation`, the [MeshBasicMaterial#reflectivity](MeshBasicMaterial.html#reflectivity) is used to blend between the two colors. + +Default is `MultiplyOperation`. + +### .envMap : Texture + +The environment map. + +Default is `null`. + +### .envMapRotation : Euler + +The rotation of the environment map in radians. + +Default is `(0,0,0)`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isMeshBasicMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lightMap : Texture + +The light map. Requires a second set of UVs. + +Default is `null`. + +### .lightMapIntensity : number + +Intensity of the baked light. + +Default is `1`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +### .reflectivity : number + +How much the environment map affects the surface. The valid range is between `0` (no reflections) and `1` (full reflections). + +Default is `1`. + +### .refractionRatio : number + +The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of the material. It is used with environment mapping modes [CubeRefractionMapping](global.html#CubeRefractionMapping) and [EquirectangularRefractionMapping](global.html#EquirectangularRefractionMapping). The refraction ratio should not exceed `1`. + +Default is `0.98`. + +### .specularMap : Texture + +Specular map used by the material. + +Default is `null`. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinecap : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe ends. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinejoin : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe joints. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `1`. + +## Source + +[src/materials/MeshBasicMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshBasicMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshBasicNodeMaterial.html.md b/docs/pages/MeshBasicNodeMaterial.html.md new file mode 100644 index 00000000000000..e59f28456c43b7 --- /dev/null +++ b/docs/pages/MeshBasicNodeMaterial.html.md @@ -0,0 +1,85 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# MeshBasicNodeMaterial + +Node material version of [MeshBasicMaterial](MeshBasicMaterial.html). + +## Constructor + +### new MeshBasicNodeMaterial( parameters : Object ) + +Constructs a new mesh basic node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isMeshBasicNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lights : boolean + +Although the basic material is by definition unlit, we set this property to `true` since we use a lighting model to compute the outgoing light of the fragment shader. + +Default is `true`. + +**Overrides:** [NodeMaterial#lights](NodeMaterial.html#lights) + +## Methods + +### .setupEnvironment( builder : NodeBuilder ) : BasicEnvironmentNode. + +Overwritten since this type of material uses [BasicEnvironmentNode](BasicEnvironmentNode.html) to implement the default environment mapping. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupEnvironment](NodeMaterial.html#setupEnvironment) + +**Returns:** The environment node. + +### .setupLightMap( builder : NodeBuilder ) : BasicLightMapNode. + +This method must be overwritten since light maps are evaluated with a special scaling factor for basic materials. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupLightMap](NodeMaterial.html#setupLightMap) + +**Returns:** The light map node. + +### .setupLightingModel() : BasicLightingModel + +Setups the lighting model. + +**Overrides:** [NodeMaterial#setupLightingModel](NodeMaterial.html#setupLightingModel) + +**Returns:** The lighting model. + +### .setupNormal() : Node. + +Basic materials are not affected by normal and bump maps so we return by default [normalViewGeometry](TSL.html#normalViewGeometry). + +**Overrides:** [NodeMaterial#setupNormal](NodeMaterial.html#setupNormal) + +**Returns:** The normal node. + +### .setupOutgoingLight() : Node. + +The material overwrites this method because `lights` is set to `true` but we still want to return the diffuse color as the outgoing light. + +**Overrides:** [NodeMaterial#setupOutgoingLight](NodeMaterial.html#setupOutgoingLight) + +**Returns:** The outgoing light node. + +## Source + +[src/materials/nodes/MeshBasicNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshBasicNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshDepthMaterial.html.md b/docs/pages/MeshDepthMaterial.html.md new file mode 100644 index 00000000000000..b045ca57ec518f --- /dev/null +++ b/docs/pages/MeshDepthMaterial.html.md @@ -0,0 +1,79 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshDepthMaterial + +A material for drawing geometry by depth. Depth is based off of the camera near and far plane. White is nearest, black is farthest. + +## Constructor + +### new MeshDepthMaterial( parameters : Object ) + +Constructs a new mesh depth material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .depthPacking : BasicDepthPacking | RGBADepthPacking | RGBDepthPacking | RGDepthPacking + +Type for depth packing. + +Default is `BasicDepthPacking`. + +### .displacementBias : number + +The offset of the displacement map's values on the mesh's vertices. The bias is added to the scaled sample of the displacement map. Without a displacement map set, this value is not applied. + +Default is `0`. + +### .displacementMap : Texture + +The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh. + +Default is `null`. + +### .displacementScale : number + +How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. + +Default is `0`. + +### .isMeshDepthMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). + +Default is `null`. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +WebGL and WebGPU ignore this property and always render 1 pixel wide lines. + +Default is `1`. + +## Source + +[src/materials/MeshDepthMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshDepthMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshDistanceMaterial.html.md b/docs/pages/MeshDistanceMaterial.html.md new file mode 100644 index 00000000000000..ac824e7b5c460c --- /dev/null +++ b/docs/pages/MeshDistanceMaterial.html.md @@ -0,0 +1,61 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshDistanceMaterial + +A material used internally for implementing shadow mapping with point lights. + +Can also be used to customize the shadow casting of an object by assigning an instance of `MeshDistanceMaterial` to [Object3D#customDistanceMaterial](Object3D.html#customDistanceMaterial). The following examples demonstrates this approach in order to ensure transparent parts of objects do not cast shadows. + +## Constructor + +### new MeshDistanceMaterial( parameters : Object ) + +Constructs a new mesh distance material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .displacementBias : number + +The offset of the displacement map's values on the mesh's vertices. The bias is added to the scaled sample of the displacement map. Without a displacement map set, this value is not applied. + +Default is `0`. + +### .displacementMap : Texture + +The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh. + +Default is `null`. + +### .displacementScale : number + +How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. + +Default is `0`. + +### .isMeshDistanceMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). + +Default is `null`. + +## Source + +[src/materials/MeshDistanceMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshDistanceMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshLambertMaterial.html.md b/docs/pages/MeshLambertMaterial.html.md new file mode 100644 index 00000000000000..d92376509e8898 --- /dev/null +++ b/docs/pages/MeshLambertMaterial.html.md @@ -0,0 +1,221 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshLambertMaterial + +A material for non-shiny surfaces, without specular highlights. + +The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance) model for calculating reflectance. This can simulate some surfaces (such as untreated wood or stone) well, but cannot simulate shiny surfaces with specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment shading. + +Due to the simplicity of the reflectance and illumination models, performance will be greater when using this material over the [MeshPhongMaterial](MeshPhongMaterial.html), [MeshStandardMaterial](MeshStandardMaterial.html) or [MeshPhysicalMaterial](MeshPhysicalMaterial.html), at the cost of some graphical accuracy. + +## Constructor + +### new MeshLambertMaterial( parameters : Object ) + +Constructs a new mesh lambert material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .aoMap : Texture + +The red channel of this texture is used as the ambient occlusion map. Requires a second set of UVs. + +Default is `null`. + +### .aoMapIntensity : number + +Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` disables ambient occlusion. Where intensity is `1` and the AO map's red channel is also `1`, ambient light is fully occluded on a surface. + +Default is `1`. + +### .bumpMap : Texture + +The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights. Bump doesn't actually affect the geometry of the object, only the lighting. If a normal map is defined this will be ignored. + +Default is `null`. + +### .bumpScale : number + +How much the bump map affects the material. Typical range is `[0,1]`. + +Default is `1`. + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .combine : MultiplyOperation | MixOperation | AddOperation + +How to combine the result of the surface's color with the environment map, if any. + +When set to `MixOperation`, the [MeshBasicMaterial#reflectivity](MeshBasicMaterial.html#reflectivity) is used to blend between the two colors. + +Default is `MultiplyOperation`. + +### .displacementBias : number + +The offset of the displacement map's values on the mesh's vertices. The bias is added to the scaled sample of the displacement map. Without a displacement map set, this value is not applied. + +Default is `0`. + +### .displacementMap : Texture + +The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh. + +Default is `null`. + +### .displacementScale : number + +How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. + +Default is `0`. + +### .emissive : Color + +Emissive (light) color of the material, essentially a solid color unaffected by other lighting. + +Default is `(0,0,0)`. + +### .emissiveIntensity : number + +Intensity of the emissive light. Modulates the emissive color. + +Default is `1`. + +### .emissiveMap : Texture + +Set emissive (glow) map. The emissive map color is modulated by the emissive color and the emissive intensity. If you have an emissive map, be sure to set the emissive color to something other than black. + +Default is `null`. + +### .envMap : Texture + +The environment map. + +Default is `null`. + +### .envMapRotation : Euler + +The rotation of the environment map in radians. + +Default is `(0,0,0)`. + +### .flatShading : boolean + +Whether the material is rendered with flat shading or not. + +Default is `false`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isMeshLambertMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lightMap : Texture + +The light map. Requires a second set of UVs. + +Default is `null`. + +### .lightMapIntensity : number + +Intensity of the baked light. + +Default is `1`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +### .normalMap : Texture + +The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting. In case the material has a normal map authored using the left handed convention, the `y` component of `normalScale` should be negated to compensate for the different handedness. + +Default is `null`. + +### .normalMapType : TangentSpaceNormalMap | ObjectSpaceNormalMap + +The type of normal map. + +Default is `TangentSpaceNormalMap`. + +### .normalScale : Vector2 + +How much the normal map affects the material. Typical value range is `[0,1]`. + +Default is `(1,1)`. + +### .reflectivity : number + +How much the environment map affects the surface. The valid range is between `0` (no reflections) and `1` (full reflections). + +Default is `1`. + +### .refractionRatio : number + +The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of the material. It is used with environment mapping modes [CubeRefractionMapping](global.html#CubeRefractionMapping) and [EquirectangularRefractionMapping](global.html#EquirectangularRefractionMapping). The refraction ratio should not exceed `1`. + +Default is `0.98`. + +### .specularMap : Texture + +Specular map used by the material. + +Default is `null`. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinecap : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe ends. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinejoin : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe joints. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `1`. + +## Source + +[src/materials/MeshLambertMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshLambertMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshLambertNodeMaterial.html.md b/docs/pages/MeshLambertNodeMaterial.html.md new file mode 100644 index 00000000000000..b772284d1eb53d --- /dev/null +++ b/docs/pages/MeshLambertNodeMaterial.html.md @@ -0,0 +1,57 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# MeshLambertNodeMaterial + +Node material version of [MeshLambertMaterial](MeshLambertMaterial.html). + +## Constructor + +### new MeshLambertNodeMaterial( parameters : Object ) + +Constructs a new mesh lambert node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isMeshLambertNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lights : boolean + +Set to `true` because lambert materials react on lights. + +Default is `true`. + +**Overrides:** [NodeMaterial#lights](NodeMaterial.html#lights) + +## Methods + +### .setupEnvironment( builder : NodeBuilder ) : BasicEnvironmentNode. + +Overwritten since this type of material uses [BasicEnvironmentNode](BasicEnvironmentNode.html) to implement the default environment mapping. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupEnvironment](NodeMaterial.html#setupEnvironment) + +**Returns:** The environment node. + +### .setupLightingModel() : PhongLightingModel + +Setups the lighting model. + +**Overrides:** [NodeMaterial#setupLightingModel](NodeMaterial.html#setupLightingModel) + +**Returns:** The lighting model. + +## Source + +[src/materials/nodes/MeshLambertNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshLambertNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshMatcapMaterial.html.md b/docs/pages/MeshMatcapMaterial.html.md new file mode 100644 index 00000000000000..5b31ab9cc1c012 --- /dev/null +++ b/docs/pages/MeshMatcapMaterial.html.md @@ -0,0 +1,129 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshMatcapMaterial + +This material is defined by a MatCap (or Lit Sphere) texture, which encodes the material color and shading. + +`MeshMatcapMaterial` does not respond to lights since the matcap image file encodes baked lighting. It will cast a shadow onto an object that receives shadows (and shadow clipping works), but it will not self-shadow or receive shadows. + +## Constructor + +### new MeshMatcapMaterial( parameters : Object ) + +Constructs a new mesh matcap material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .bumpMap : Texture + +The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights. Bump doesn't actually affect the geometry of the object, only the lighting. If a normal map is defined this will be ignored. + +Default is `null`. + +### .bumpScale : number + +How much the bump map affects the material. Typical range is `[0,1]`. + +Default is `1`. + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .displacementBias : number + +The offset of the displacement map's values on the mesh's vertices. The bias is added to the scaled sample of the displacement map. Without a displacement map set, this value is not applied. + +Default is `0`. + +### .displacementMap : Texture + +The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh. + +Default is `null`. + +### .displacementScale : number + +How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. + +Default is `0`. + +### .flatShading : boolean + +Whether the material is rendered with flat shading or not. + +Default is `false`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isMeshMatcapMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +### .matcap : Texture + +The matcap map. + +Default is `null`. + +### .normalMap : Texture + +The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting. In case the material has a normal map authored using the left handed convention, the `y` component of `normalScale` should be negated to compensate for the different handedness. + +Default is `null`. + +### .normalMapType : TangentSpaceNormalMap | ObjectSpaceNormalMap + +The type of normal map. + +Default is `TangentSpaceNormalMap`. + +### .normalScale : Vector2 + +How much the normal map affects the material. Typical value range is `[0,1]`. + +Default is `(1,1)`. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `1`. + +## Source + +[src/materials/MeshMatcapMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshMatcapMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshMatcapNodeMaterial.html.md b/docs/pages/MeshMatcapNodeMaterial.html.md new file mode 100644 index 00000000000000..fb6203e64f7efe --- /dev/null +++ b/docs/pages/MeshMatcapNodeMaterial.html.md @@ -0,0 +1,39 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# MeshMatcapNodeMaterial + +Node material version of [MeshMatcapMaterial](MeshMatcapMaterial.html). + +## Constructor + +### new MeshMatcapNodeMaterial( parameters : Object ) + +Constructs a new mesh normal node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isMeshMatcapNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .setupVariants( builder : NodeBuilder ) + +Setups the matcap specific node variables. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupVariants](NodeMaterial.html#setupVariants) + +## Source + +[src/materials/nodes/MeshMatcapNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshMatcapNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshNormalMaterial.html.md b/docs/pages/MeshNormalMaterial.html.md new file mode 100644 index 00000000000000..0e69fd7cbd1a12 --- /dev/null +++ b/docs/pages/MeshNormalMaterial.html.md @@ -0,0 +1,95 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshNormalMaterial + +A material that maps the normal vectors to RGB colors. + +## Constructor + +### new MeshNormalMaterial( parameters : Object ) + +Constructs a new mesh normal material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .bumpMap : Texture + +The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights. Bump doesn't actually affect the geometry of the object, only the lighting. If a normal map is defined this will be ignored. + +Default is `null`. + +### .bumpScale : number + +How much the bump map affects the material. Typical range is `[0,1]`. + +Default is `1`. + +### .displacementBias : number + +The offset of the displacement map's values on the mesh's vertices. The bias is added to the scaled sample of the displacement map. Without a displacement map set, this value is not applied. + +Default is `0`. + +### .displacementMap : Texture + +The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh. + +Default is `null`. + +### .displacementScale : number + +How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. + +Default is `0`. + +### .flatShading : boolean + +Whether the material is rendered with flat shading or not. + +Default is `false`. + +### .isMeshNormalMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .normalMap : Texture + +The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting. In case the material has a normal map authored using the left handed convention, the `y` component of `normalScale` should be negated to compensate for the different handedness. + +Default is `null`. + +### .normalMapType : TangentSpaceNormalMap | ObjectSpaceNormalMap + +The type of normal map. + +Default is `TangentSpaceNormalMap`. + +### .normalScale : Vector2 + +How much the normal map affects the material. Typical value range is `[0,1]`. + +Default is `(1,1)`. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +WebGL and WebGPU ignore this property and always render 1 pixel wide lines. + +Default is `1`. + +## Source + +[src/materials/MeshNormalMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshNormalMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshNormalNodeMaterial.html.md b/docs/pages/MeshNormalNodeMaterial.html.md new file mode 100644 index 00000000000000..c4147a99a6a273 --- /dev/null +++ b/docs/pages/MeshNormalNodeMaterial.html.md @@ -0,0 +1,35 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# MeshNormalNodeMaterial + +Node material version of [MeshNormalMaterial](MeshNormalMaterial.html). + +## Constructor + +### new MeshNormalNodeMaterial( parameters : Object ) + +Constructs a new mesh normal node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isMeshNormalNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .setupDiffuseColor() + +Overwrites the default implementation by computing the diffuse color based on the normal data. + +**Overrides:** [NodeMaterial#setupDiffuseColor](NodeMaterial.html#setupDiffuseColor) + +## Source + +[src/materials/nodes/MeshNormalNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshNormalNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshPhongMaterial.html.md b/docs/pages/MeshPhongMaterial.html.md new file mode 100644 index 00000000000000..604250aec275b1 --- /dev/null +++ b/docs/pages/MeshPhongMaterial.html.md @@ -0,0 +1,233 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshPhongMaterial + +A material for shiny surfaces with specular highlights. + +The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model) model for calculating reflectance. Unlike the Lambertian model used in the [MeshLambertMaterial](MeshLambertMaterial.html) this can simulate shiny surfaces with specular highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading. + +Performance will generally be greater when using this material over the [MeshStandardMaterial](MeshStandardMaterial.html) or [MeshPhysicalMaterial](MeshPhysicalMaterial.html), at the cost of some graphical accuracy. + +## Constructor + +### new MeshPhongMaterial( parameters : Object ) + +Constructs a new mesh phong material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .aoMap : Texture + +The red channel of this texture is used as the ambient occlusion map. Requires a second set of UVs. + +Default is `null`. + +### .aoMapIntensity : number + +Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` disables ambient occlusion. Where intensity is `1` and the AO map's red channel is also `1`, ambient light is fully occluded on a surface. + +Default is `1`. + +### .bumpMap : Texture + +The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights. Bump doesn't actually affect the geometry of the object, only the lighting. If a normal map is defined this will be ignored. + +Default is `null`. + +### .bumpScale : number + +How much the bump map affects the material. Typical range is `[0,1]`. + +Default is `1`. + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .combine : MultiplyOperation | MixOperation | AddOperation + +How to combine the result of the surface's color with the environment map, if any. + +When set to `MixOperation`, the [MeshBasicMaterial#reflectivity](MeshBasicMaterial.html#reflectivity) is used to blend between the two colors. + +Default is `MultiplyOperation`. + +### .displacementBias : number + +The offset of the displacement map's values on the mesh's vertices. The bias is added to the scaled sample of the displacement map. Without a displacement map set, this value is not applied. + +Default is `0`. + +### .displacementMap : Texture + +The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh. + +Default is `null`. + +### .displacementScale : number + +How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. + +Default is `0`. + +### .emissive : Color + +Emissive (light) color of the material, essentially a solid color unaffected by other lighting. + +Default is `(0,0,0)`. + +### .emissiveIntensity : number + +Intensity of the emissive light. Modulates the emissive color. + +Default is `1`. + +### .emissiveMap : Texture + +Set emissive (glow) map. The emissive map color is modulated by the emissive color and the emissive intensity. If you have an emissive map, be sure to set the emissive color to something other than black. + +Default is `null`. + +### .envMap : Texture + +The environment map. + +Default is `null`. + +### .envMapRotation : Euler + +The rotation of the environment map in radians. + +Default is `(0,0,0)`. + +### .flatShading : boolean + +Whether the material is rendered with flat shading or not. + +Default is `false`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isMeshPhongMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lightMap : Texture + +The light map. Requires a second set of UVs. + +Default is `null`. + +### .lightMapIntensity : number + +Intensity of the baked light. + +Default is `1`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +### .normalMap : Texture + +The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting. In case the material has a normal map authored using the left handed convention, the `y` component of `normalScale` should be negated to compensate for the different handedness. + +Default is `null`. + +### .normalMapType : TangentSpaceNormalMap | ObjectSpaceNormalMap + +The type of normal map. + +Default is `TangentSpaceNormalMap`. + +### .normalScale : Vector2 + +How much the normal map affects the material. Typical value range is `[0,1]`. + +Default is `(1,1)`. + +### .reflectivity : number + +How much the environment map affects the surface. The valid range is between `0` (no reflections) and `1` (full reflections). + +Default is `1`. + +### .refractionRatio : number + +The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of the material. It is used with environment mapping modes [CubeRefractionMapping](global.html#CubeRefractionMapping) and [EquirectangularRefractionMapping](global.html#EquirectangularRefractionMapping). The refraction ratio should not exceed `1`. + +Default is `0.98`. + +### .shininess : number + +How shiny the specular highlight is; a higher value gives a sharper highlight. + +Default is `30`. + +### .specular : Color + +Specular color of the material. The default color is set to `0x111111` (very dark grey) + +This defines how shiny the material is and the color of its shine. + +### .specularMap : Texture + +The specular map value affects both how much the specular surface highlight contributes and how much of the environment map affects the surface. + +Default is `null`. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinecap : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe ends. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinejoin : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe joints. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `1`. + +## Source + +[src/materials/MeshPhongMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshPhongMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshPhongNodeMaterial.html.md b/docs/pages/MeshPhongNodeMaterial.html.md new file mode 100644 index 00000000000000..332434417caa56 --- /dev/null +++ b/docs/pages/MeshPhongNodeMaterial.html.md @@ -0,0 +1,83 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# MeshPhongNodeMaterial + +Node material version of [MeshPhongMaterial](MeshPhongMaterial.html). + +## Constructor + +### new MeshPhongNodeMaterial( parameters : Object ) + +Constructs a new mesh lambert node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isMeshPhongNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lights : boolean + +Set to `true` because phong materials react on lights. + +Default is `true`. + +**Overrides:** [NodeMaterial#lights](NodeMaterial.html#lights) + +### .shininessNode : Node. + +The shininess of phong materials is by default inferred from the `shininess` property. This node property allows to overwrite the default and define the shininess with a node instead. + +If you don't want to overwrite the shininess but modify the existing value instead, use [materialShininess](TSL.html#materialShininess). + +Default is `null`. + +### .specularNode : Node. + +The specular color of phong materials is by default inferred from the `specular` property. This node property allows to overwrite the default and define the specular color with a node instead. + +If you don't want to overwrite the specular color but modify the existing value instead, use [materialSpecular](TSL.html#materialSpecular). + +Default is `null`. + +## Methods + +### .setupEnvironment( builder : NodeBuilder ) : BasicEnvironmentNode. + +Overwritten since this type of material uses [BasicEnvironmentNode](BasicEnvironmentNode.html) to implement the default environment mapping. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupEnvironment](NodeMaterial.html#setupEnvironment) + +**Returns:** The environment node. + +### .setupLightingModel() : PhongLightingModel + +Setups the lighting model. + +**Overrides:** [NodeMaterial#setupLightingModel](NodeMaterial.html#setupLightingModel) + +**Returns:** The lighting model. + +### .setupVariants( builder : NodeBuilder ) + +Setups the phong specific node variables. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupVariants](NodeMaterial.html#setupVariants) + +## Source + +[src/materials/nodes/MeshPhongNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshPhongNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshPhysicalMaterial.html.md b/docs/pages/MeshPhysicalMaterial.html.md new file mode 100644 index 00000000000000..53c54f15df97f7 --- /dev/null +++ b/docs/pages/MeshPhysicalMaterial.html.md @@ -0,0 +1,238 @@ +*Inheritance: EventDispatcher → Material → MeshStandardMaterial →* + +# MeshPhysicalMaterial + +An extension of the [MeshStandardMaterial](MeshStandardMaterial.html), providing more advanced physically-based rendering properties: + +* Anisotropy: Ability to represent the anisotropic property of materials as observable with brushed metals. +* Clearcoat: Some materials — like car paints, carbon fiber, and wet surfaces — require a clear, reflective layer on top of another layer that may be irregular or rough. Clearcoat approximates this effect, without the need for a separate transparent surface. +* Iridescence: Allows to render the effect where hue varies depending on the viewing angle and illumination angle. This can be seen on soap bubbles, oil films, or on the wings of many insects. +* Physically-based transparency: One limitation of [Material#opacity](Material.html#opacity) is that highly transparent materials are less reflective. Physically-based transmission provides a more realistic option for thin, transparent surfaces like glass. +* Advanced reflectivity: More flexible reflectivity for non-metallic materials. +* Sheen: Can be used for representing cloth and fabric materials. + +As a result of these complex shading features, `MeshPhysicalMaterial` has a higher performance cost, per pixel, than other three.js materials. Most effects are disabled by default, and add cost as they are enabled. For best results, always specify an environment map when using this material. + +## Constructor + +### new MeshPhysicalMaterial( parameters : Object ) + +Constructs a new mesh physical material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .anisotropy : number + +The anisotropy strength, from `0.0` to `1.0`. + +Default is `0`. + +### .anisotropyMap : Texture + +Red and green channels represent the anisotropy direction in `[-1, 1]` tangent, bitangent space, to be rotated by `anisotropyRotation`. The blue channel contains strength as `[0, 1]` to be multiplied by `anisotropy`. + +Default is `null`. + +### .anisotropyRotation : number + +The rotation of the anisotropy in tangent, bitangent space, measured in radians counter-clockwise from the tangent. When `anisotropyMap` is present, this property provides additional rotation to the vectors in the texture. + +Default is `1`. + +### .attenuationColor : Color + +The color that white light turns into due to absorption when reaching the attenuation distance. + +Default is `(1,1,1)`. + +### .attenuationDistance : number + +Density of the medium given as the average distance that light travels in the medium before interacting with a particle. The value is given in world space units, and must be greater than zero. + +Default is `Infinity`. + +### .clearcoat : number + +Represents the intensity of the clear coat layer, from `0.0` to `1.0`. Use clear coat related properties to enable multilayer materials that have a thin translucent layer over the base layer. + +Default is `0`. + +### .clearcoatMap : Texture + +The red channel of this texture is multiplied against `clearcoat`, for per-pixel control over a coating's intensity. + +Default is `null`. + +### .clearcoatNormalMap : Texture + +Can be used to enable independent normals for the clear coat layer. + +Default is `null`. + +### .clearcoatNormalScale : Vector2 + +How much `clearcoatNormalMap` affects the clear coat layer, from `(0,0)` to `(1,1)`. + +Default is `(1,1)`. + +### .clearcoatRoughness : number + +Roughness of the clear coat layer, from `0.0` to `1.0`. + +Default is `0`. + +### .clearcoatRoughnessMap : Texture + +The green channel of this texture is multiplied against `clearcoatRoughness`, for per-pixel control over a coating's roughness. + +Default is `null`. + +### .dispersion : number + +Defines the strength of the angular separation of colors (chromatic aberration) transmitting through a relatively clear volume. Any value zero or larger is valid, the typical range of realistic values is `[0, 1]`. This property can be only be used with transmissive objects. + +Default is `0`. + +### .ior : number + +Index-of-refraction for non-metallic materials, from `1.0` to `2.333`. + +Default is `1.5`. + +### .iridescence : number + +The intensity of the iridescence layer, simulating RGB color shift based on the angle between the surface and the viewer, from `0.0` to `1.0`. + +Default is `0`. + +### .iridescenceIOR : number + +Strength of the iridescence RGB color shift effect, represented by an index-of-refraction. Between `1.0` to `2.333`. + +Default is `1.3`. + +### .iridescenceMap : Texture + +The red channel of this texture is multiplied against `iridescence`, for per-pixel control over iridescence. + +Default is `null`. + +### .iridescenceThicknessMap : Texture + +A texture that defines the thickness of the iridescence layer, stored in the green channel. Minimum and maximum values of thickness are defined by `iridescenceThicknessRange` array: + +* `0.0` in the green channel will result in thickness equal to first element of the array. +* `1.0` in the green channel will result in thickness equal to second element of the array. +* Values in-between will linearly interpolate between the elements of the array. + +Default is `null`. + +### .iridescenceThicknessRange : Array. + +Array of exactly 2 elements, specifying minimum and maximum thickness of the iridescence layer. Thickness of iridescence layer has an equivalent effect of the one `thickness` has on `ior`. + +Default is `[100,400]`. + +### .isMeshPhysicalMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .reflectivity : number + +Degree of reflectivity, from `0.0` to `1.0`. Default is `0.5`, which corresponds to an index-of-refraction of `1.5`. + +This models the reflectivity of non-metallic materials. It has no effect when `metalness` is `1.0` + +Default is `0.5`. + +### .sheen : number + +The intensity of the sheen layer, from `0.0` to `1.0`. + +Default is `0`. + +### .sheenColor : Color + +The sheen tint. + +Default is `(0,0,0)`. + +### .sheenColorMap : Texture + +The RGB channels of this texture are multiplied against `sheenColor`, for per-pixel control over sheen tint. + +Default is `null`. + +### .sheenRoughness : number + +Roughness of the sheen layer, from `0.0` to `1.0`. + +Default is `1`. + +### .sheenRoughnessMap : Texture + +The alpha channel of this texture is multiplied against `sheenRoughness`, for per-pixel control over sheen roughness. + +Default is `null`. + +### .specularColor : Color + +Tints the specular reflection at normal incidence for non-metals only. + +Default is `(1,1,1)`. + +### .specularColorMap : Texture + +The RGB channels of this texture are multiplied against `specularColor`, for per-pixel control over specular color. + +Default is `null`. + +### .specularIntensity : number + +A float that scales the amount of specular reflection for non-metals only. When set to zero, the model is effectively Lambertian. From `0.0` to `1.0`. + +Default is `1`. + +### .specularIntensityMap : Texture + +The alpha channel of this texture is multiplied against `specularIntensity`, for per-pixel control over specular intensity. + +Default is `null`. + +### .thickness : number + +The thickness of the volume beneath the surface. The value is given in the coordinate space of the mesh. If the value is `0` the material is thin-walled. Otherwise the material is a volume boundary. + +Default is `0`. + +### .thicknessMap : Texture + +A texture that defines the thickness, stored in the green channel. This will be multiplied by `thickness`. + +Default is `null`. + +### .transmission : number + +Degree of transmission (or optical transparency), from `0.0` to `1.0`. + +Thin, transparent or semitransparent, plastic or glass materials remain largely reflective even if they are fully transmissive. The transmission property can be used to model these materials. + +When transmission is non-zero, `opacity` should be set to `1`. + +Default is `0`. + +### .transmissionMap : Texture + +The red channel of this texture is multiplied against `transmission`, for per-pixel control over optical transparency. + +Default is `null`. + +## Source + +[src/materials/MeshPhysicalMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshPhysicalMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshPhysicalNodeMaterial.html.md b/docs/pages/MeshPhysicalNodeMaterial.html.md new file mode 100644 index 00000000000000..1597e224df768d --- /dev/null +++ b/docs/pages/MeshPhysicalNodeMaterial.html.md @@ -0,0 +1,231 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial → MeshStandardNodeMaterial →* + +# MeshPhysicalNodeMaterial + +Node material version of [MeshPhysicalMaterial](MeshPhysicalMaterial.html). + +## Constructor + +### new MeshPhysicalNodeMaterial( parameters : Object ) + +Constructs a new mesh physical node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .anisotropyNode : Node. + +The anisotropy of physical materials is by default inferred from the `anisotropy` property. This node property allows to overwrite the default and define the anisotropy with a node instead. + +If you don't want to overwrite the anisotropy but modify the existing value instead, use [materialAnisotropy](TSL.html#materialAnisotropy). + +Default is `null`. + +### .attenuationColorNode : Node. + +The attenuation color of physical materials is by default inferred from the `attenuationColor` property. This node property allows to overwrite the default and define the attenuation color with a node instead. + +If you don't want to overwrite the attenuation color but modify the existing value instead, use [materialAttenuationColor](TSL.html#materialAttenuationColor). + +Default is `null`. + +### .attenuationDistanceNode : Node. + +The attenuation distance of physical materials is by default inferred from the `attenuationDistance` property. This node property allows to overwrite the default and define the attenuation distance with a node instead. + +If you don't want to overwrite the attenuation distance but modify the existing value instead, use [materialAttenuationDistance](TSL.html#materialAttenuationDistance). + +Default is `null`. + +### .clearcoatNode : Node. + +The clearcoat of physical materials is by default inferred from the `clearcoat` and `clearcoatMap` properties. This node property allows to overwrite the default and define the clearcoat with a node instead. + +If you don't want to overwrite the clearcoat but modify the existing value instead, use [materialClearcoat](TSL.html#materialClearcoat). + +Default is `null`. + +### .clearcoatNormalNode : Node. + +The clearcoat normal of physical materials is by default inferred from the `clearcoatNormalMap` property. This node property allows to overwrite the default and define the clearcoat normal with a node instead. + +If you don't want to overwrite the clearcoat normal but modify the existing value instead, use [materialClearcoatNormal](TSL.html#materialClearcoatNormal). + +Default is `null`. + +### .clearcoatRoughnessNode : Node. + +The clearcoat roughness of physical materials is by default inferred from the `clearcoatRoughness` and `clearcoatRoughnessMap` properties. This node property allows to overwrite the default and define the clearcoat roughness with a node instead. + +If you don't want to overwrite the clearcoat roughness but modify the existing value instead, use [materialClearcoatRoughness](TSL.html#materialClearcoatRoughness). + +Default is `null`. + +### .dispersionNode : Node. + +The dispersion of physical materials is by default inferred from the `dispersion` property. This node property allows to overwrite the default and define the dispersion with a node instead. + +If you don't want to overwrite the dispersion but modify the existing value instead, use [materialDispersion](TSL.html#materialDispersion). + +Default is `null`. + +### .iorNode : Node. + +The ior of physical materials is by default inferred from the `ior` property. This node property allows to overwrite the default and define the ior with a node instead. + +If you don't want to overwrite the ior but modify the existing value instead, use [materialIOR](TSL.html#materialIOR). + +Default is `null`. + +### .iridescenceIORNode : Node. + +The iridescence IOR of physical materials is by default inferred from the `iridescenceIOR` property. This node property allows to overwrite the default and define the iridescence IOR with a node instead. + +If you don't want to overwrite the iridescence IOR but modify the existing value instead, use [materialIridescenceIOR](TSL.html#materialIridescenceIOR). + +Default is `null`. + +### .iridescenceNode : Node. + +The iridescence of physical materials is by default inferred from the `iridescence` property. This node property allows to overwrite the default and define the iridescence with a node instead. + +If you don't want to overwrite the iridescence but modify the existing value instead, use [materialIridescence](TSL.html#materialIridescence). + +Default is `null`. + +### .iridescenceThicknessNode : Node. + +The iridescence thickness of physical materials is by default inferred from the `iridescenceThicknessRange` and `iridescenceThicknessMap` properties. This node property allows to overwrite the default and define the iridescence thickness with a node instead. + +If you don't want to overwrite the iridescence thickness but modify the existing value instead, use [materialIridescenceThickness](TSL.html#materialIridescenceThickness). + +Default is `null`. + +### .isMeshPhysicalNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .sheenNode : Node. + +The sheen of physical materials is by default inferred from the `sheen`, `sheenColor` and `sheenColorMap` properties. This node property allows to overwrite the default and define the sheen with a node instead. + +If you don't want to overwrite the sheen but modify the existing value instead, use [materialSheen](TSL.html#materialSheen). + +Default is `null`. + +### .sheenRoughnessNode : Node. + +The sheen roughness of physical materials is by default inferred from the `sheenRoughness` and `sheenRoughnessMap` properties. This node property allows to overwrite the default and define the sheen roughness with a node instead. + +If you don't want to overwrite the sheen roughness but modify the existing value instead, use [materialSheenRoughness](TSL.html#materialSheenRoughness). + +Default is `null`. + +### .specularColorNode : Node. + +The specular color of physical materials is by default inferred from the `specularColor` and `specularColorMap` properties. This node property allows to overwrite the default and define the specular color with a node instead. + +If you don't want to overwrite the specular color but modify the existing value instead, use [materialSpecularColor](TSL.html#materialSpecularColor). + +Default is `null`. + +### .specularIntensityNode : Node. + +The specular intensity of physical materials is by default inferred from the `specularIntensity` and `specularIntensityMap` properties. This node property allows to overwrite the default and define the specular intensity with a node instead. + +If you don't want to overwrite the specular intensity but modify the existing value instead, use [materialSpecularIntensity](TSL.html#materialSpecularIntensity). + +Default is `null`. + +### .thicknessNode : Node. + +The thickness of physical materials is by default inferred from the `thickness` and `thicknessMap` properties. This node property allows to overwrite the default and define the thickness with a node instead. + +If you don't want to overwrite the thickness but modify the existing value instead, use [materialThickness](TSL.html#materialThickness). + +Default is `null`. + +### .transmissionNode : Node. + +The transmission of physical materials is by default inferred from the `transmission` and `transmissionMap` properties. This node property allows to overwrite the default and define the transmission with a node instead. + +If you don't want to overwrite the transmission but modify the existing value instead, use [materialTransmission](TSL.html#materialTransmission). + +Default is `null`. + +### .useAnisotropy : boolean + +Whether the lighting model should use anisotropy or not. + +Default is `true`. + +### .useClearcoat : boolean + +Whether the lighting model should use clearcoat or not. + +Default is `true`. + +### .useDispersion : boolean + +Whether the lighting model should use dispersion or not. + +Default is `true`. + +### .useIridescence : boolean + +Whether the lighting model should use iridescence or not. + +Default is `true`. + +### .useSheen : boolean + +Whether the lighting model should use sheen or not. + +Default is `true`. + +### .useTransmission : boolean + +Whether the lighting model should use transmission or not. + +Default is `true`. + +## Methods + +### .setupClearcoatNormal() : Node. + +Setups the clearcoat normal node. + +**Returns:** The clearcoat normal. + +### .setupLightingModel() : PhysicalLightingModel + +Setups the lighting model. + +**Overrides:** [MeshStandardNodeMaterial#setupLightingModel](MeshStandardNodeMaterial.html#setupLightingModel) + +**Returns:** The lighting model. + +### .setupSpecular() + +Setups the specular related node variables. + +**Overrides:** [MeshStandardNodeMaterial#setupSpecular](MeshStandardNodeMaterial.html#setupSpecular) + +### .setupVariants( builder : NodeBuilder ) + +Setups the physical specific node variables. + +**builder** + +The current node builder. + +**Overrides:** [MeshStandardNodeMaterial#setupVariants](MeshStandardNodeMaterial.html#setupVariants) + +## Source + +[src/materials/nodes/MeshPhysicalNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshPhysicalNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshPostProcessingMaterial.html.md b/docs/pages/MeshPostProcessingMaterial.html.md new file mode 100644 index 00000000000000..575351d971050e --- /dev/null +++ b/docs/pages/MeshPostProcessingMaterial.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Material → MeshStandardMaterial → MeshPhysicalMaterial →* + +# MeshPostProcessingMaterial + +The aim of this mesh material is to use information from a post processing pass in the diffuse color pass. This material is based on the MeshPhysicalMaterial. + +In the current state, only the information of a screen space AO pass can be used in the material. Actually, the output of any screen space AO (SSAO, GTAO) can be used, as it is only necessary to provide the AO in one color channel of a texture, however the AO pass must be rendered prior to the color pass, which makes the post-processing pass somewhat of a pre-processing pass. Fot this purpose a new map (`aoPassMap`) is added to the material. The value of the map is used the same way as the `aoMap` value. + +Motivation to use the outputs AO pass directly in the material: The incident light of a fragment is composed of ambient light, direct light and indirect light Ambient Occlusion only occludes ambient light and environment light, but not direct light. Direct light is only occluded by geometry that casts shadows. And of course the emitted light should not be darkened by ambient occlusion either. This cannot be achieved if the AO post processing pass is simply blended with the diffuse render pass. + +Further extension work might be to use the output of an SSR pass or an HBIL pass from a previous frame. This would then create the possibility of SSR and IR depending on material properties such as `roughness`, `metalness` and `reflectivity`. + +## Import + +MeshPostProcessingMaterial is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MeshPostProcessingMaterial } from 'three/addons/materials/MeshPostProcessingMaterial.js'; +``` + +## Constructor + +### new MeshPostProcessingMaterial( parameters : Object ) + +Constructs a new conditional line material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .aoPassMap : Texture + +A texture representing the AO pass. + +### .aoPassMapScale : number + +The scale of the AO pass. + +Default is `1`. + +## Source + +[examples/jsm/materials/MeshPostProcessingMaterial.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/materials/MeshPostProcessingMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshSSSNodeMaterial.html.md b/docs/pages/MeshSSSNodeMaterial.html.md new file mode 100644 index 00000000000000..94945981420e08 --- /dev/null +++ b/docs/pages/MeshSSSNodeMaterial.html.md @@ -0,0 +1,63 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial → MeshStandardNodeMaterial → MeshPhysicalNodeMaterial →* + +# MeshSSSNodeMaterial + +This node material is an experimental extension of [MeshPhysicalNodeMaterial](MeshPhysicalNodeMaterial.html) that implements a Subsurface scattering (SSS) term. + +## Constructor + +### new MeshSSSNodeMaterial( parameters : Object ) + +Constructs a new mesh SSS node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .thicknessAmbientNode : Node. + +Represents the thickness ambient factor. + +### .thicknessAttenuationNode : Node. + +Represents the thickness attenuation. + +### .thicknessColorNode : Node. + +Represents the thickness color. + +Default is `null`. + +### .thicknessDistortionNode : Node. + +Represents the distortion factor. + +### .thicknessPowerNode : Node. + +Represents the thickness power. + +### .thicknessScaleNode : Node. + +Represents the thickness scale. + +### .useSSS : boolean + +Whether the lighting model should use SSS or not. + +Default is `true`. + +## Methods + +### .setupLightingModel() : SSSLightingModel + +Setups the lighting model. + +**Overrides:** [MeshPhysicalNodeMaterial#setupLightingModel](MeshPhysicalNodeMaterial.html#setupLightingModel) + +**Returns:** The lighting model. + +## Source + +[src/materials/nodes/MeshSSSNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshSSSNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshStandardMaterial.html.md b/docs/pages/MeshStandardMaterial.html.md new file mode 100644 index 00000000000000..cedd26ef176e57 --- /dev/null +++ b/docs/pages/MeshStandardMaterial.html.md @@ -0,0 +1,236 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshStandardMaterial + +A standard physically based material, using Metallic-Roughness workflow. + +Physically based rendering (PBR) has recently become the standard in many 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/), [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017). + +This approach differs from older approaches in that instead of using approximations for the way in which light interacts with a surface, a physically correct model is used. The idea is that, instead of tweaking materials to look good under specific lighting, a material can be created that will react 'correctly' under all lighting scenarios. + +In practice this gives a more accurate and realistic looking result than the [MeshLambertMaterial](MeshLambertMaterial.html) or [MeshPhongMaterial](MeshPhongMaterial.html), at the cost of being somewhat more computationally expensive. `MeshStandardMaterial` uses per-fragment shading. + +Note that for best results you should always specify an environment map when using this material. + +For a non-technical introduction to the concept of PBR and how to set up a PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co): + +* [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/) +* [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/) + +Technical details of the approach used in three.js (and most other PBR systems) can be found is this [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf) (pdf), by Brent Burley. + +## Constructor + +### new MeshStandardMaterial( parameters : Object ) + +Constructs a new mesh standard material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .aoMap : Texture + +The red channel of this texture is used as the ambient occlusion map. Requires a second set of UVs. + +Default is `null`. + +### .aoMapIntensity : number + +Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` disables ambient occlusion. Where intensity is `1` and the AO map's red channel is also `1`, ambient light is fully occluded on a surface. + +Default is `1`. + +### .bumpMap : Texture + +The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights. Bump doesn't actually affect the geometry of the object, only the lighting. If a normal map is defined this will be ignored. + +Default is `null`. + +### .bumpScale : number + +How much the bump map affects the material. Typical range is `[0,1]`. + +Default is `1`. + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .displacementBias : number + +The offset of the displacement map's values on the mesh's vertices. The bias is added to the scaled sample of the displacement map. Without a displacement map set, this value is not applied. + +Default is `0`. + +### .displacementMap : Texture + +The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh. + +Default is `null`. + +### .displacementScale : number + +How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. + +Default is `0`. + +### .emissive : Color + +Emissive (light) color of the material, essentially a solid color unaffected by other lighting. + +Default is `(0,0,0)`. + +### .emissiveIntensity : number + +Intensity of the emissive light. Modulates the emissive color. + +Default is `1`. + +### .emissiveMap : Texture + +Set emissive (glow) map. The emissive map color is modulated by the emissive color and the emissive intensity. If you have an emissive map, be sure to set the emissive color to something other than black. + +Default is `null`. + +### .envMap : Texture + +The environment map. To ensure a physically correct rendering, environment maps are internally pre-processed with [PMREMGenerator](PMREMGenerator.html). + +Default is `null`. + +### .envMapIntensity : number + +Scales the effect of the environment map by multiplying its color. + +Default is `1`. + +### .envMapRotation : Euler + +The rotation of the environment map in radians. + +Default is `(0,0,0)`. + +### .flatShading : boolean + +Whether the material is rendered with flat shading or not. + +Default is `false`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isMeshStandardMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lightMap : Texture + +The light map. Requires a second set of UVs. + +Default is `null`. + +### .lightMapIntensity : number + +Intensity of the baked light. + +Default is `1`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +### .metalness : number + +How much the material is like a metal. Non-metallic materials such as wood or stone use `0.0`, metallic use `1.0`, with nothing (usually) in between. A value between `0.0` and `1.0` could be used for a rusty metal look. If `metalnessMap` is also provided, both values are multiplied. + +Default is `0`. + +### .metalnessMap : Texture + +The blue channel of this texture is used to alter the metalness of the material. + +Default is `null`. + +### .normalMap : Texture + +The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting. In case the material has a normal map authored using the left handed convention, the `y` component of `normalScale` should be negated to compensate for the different handedness. + +Default is `null`. + +### .normalMapType : TangentSpaceNormalMap | ObjectSpaceNormalMap + +The type of normal map. + +Default is `TangentSpaceNormalMap`. + +### .normalScale : Vector2 + +How much the normal map affects the material. Typical value range is `[0,1]`. + +Default is `(1,1)`. + +### .roughness : number + +How rough the material appears. `0.0` means a smooth mirror reflection, `1.0` means fully diffuse. If `roughnessMap` is also provided, both values are multiplied. + +Default is `1`. + +### .roughnessMap : Texture + +The green channel of this texture is used to alter the roughness of the material. + +Default is `null`. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinecap : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe ends. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinejoin : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe joints. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `1`. + +## Source + +[src/materials/MeshStandardMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshStandardMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshStandardNodeMaterial.html.md b/docs/pages/MeshStandardNodeMaterial.html.md new file mode 100644 index 00000000000000..a901ffa4af76d1 --- /dev/null +++ b/docs/pages/MeshStandardNodeMaterial.html.md @@ -0,0 +1,95 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# MeshStandardNodeMaterial + +Node material version of [MeshStandardMaterial](MeshStandardMaterial.html). + +## Constructor + +### new MeshStandardNodeMaterial( parameters : Object ) + +Constructs a new mesh standard node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .emissiveNode : Node. + +The emissive color of standard materials is by default inferred from the `emissive`, `emissiveIntensity` and `emissiveMap` properties. This node property allows to overwrite the default and define the emissive color with a node instead. + +If you don't want to overwrite the emissive color but modify the existing value instead, use [materialEmissive](TSL.html#materialEmissive). + +Default is `null`. + +### .isMeshStandardNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lights : boolean + +Set to `true` because standard materials react on lights. + +Default is `true`. + +**Overrides:** [NodeMaterial#lights](NodeMaterial.html#lights) + +### .metalnessNode : Node. + +The metalness of standard materials is by default inferred from the `metalness`, and `metalnessMap` properties. This node property allows to overwrite the default and define the metalness with a node instead. + +If you don't want to overwrite the metalness but modify the existing value instead, use [materialMetalness](TSL.html#materialMetalness). + +Default is `null`. + +### .roughnessNode : Node. + +The roughness of standard materials is by default inferred from the `roughness`, and `roughnessMap` properties. This node property allows to overwrite the default and define the roughness with a node instead. + +If you don't want to overwrite the roughness but modify the existing value instead, use [materialRoughness](TSL.html#materialRoughness). + +Default is `null`. + +## Methods + +### .setupEnvironment( builder : NodeBuilder ) : EnvironmentNode. + +Overwritten since this type of material uses [EnvironmentNode](EnvironmentNode.html) to implement the PBR (PMREM based) environment mapping. Besides, the method honors `Scene.environment`. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupEnvironment](NodeMaterial.html#setupEnvironment) + +**Returns:** The environment node. + +### .setupLightingModel() : PhysicalLightingModel + +Setups the lighting model. + +**Overrides:** [NodeMaterial#setupLightingModel](NodeMaterial.html#setupLightingModel) + +**Returns:** The lighting model. + +### .setupSpecular() + +Setups the specular related node variables. + +### .setupVariants( builder : NodeBuilder ) + +Setups the standard specific node variables. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupVariants](NodeMaterial.html#setupVariants) + +## Source + +[src/materials/nodes/MeshStandardNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshStandardNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshSurfaceSampler.html.md b/docs/pages/MeshSurfaceSampler.html.md new file mode 100644 index 00000000000000..07a2b445dfd4e0 --- /dev/null +++ b/docs/pages/MeshSurfaceSampler.html.md @@ -0,0 +1,102 @@ +# MeshSurfaceSampler + +Utility class for sampling weighted random points on the surface of a mesh. + +Building the sampler is a one-time O(n) operation. Once built, any number of random samples may be selected in O(logn) time. Memory usage is O(n). + +References: + +* [http://www.joesfer.com/?p=84](http://www.joesfer.com/?p=84) +* [https://stackoverflow.com/a/4322940/1314762](https://stackoverflow.com/a/4322940/1314762) + +## Code Example + +```js +const sampler = new MeshSurfaceSampler( surfaceMesh ) + .setWeightAttribute( 'color' ) + .build(); +const mesh = new THREE.InstancedMesh( sampleGeometry, sampleMaterial, 100 ); +const position = new THREE.Vector3(); +const matrix = new THREE.Matrix4(); +// Sample randomly from the surface, creating an instance of the sample geometry at each sample point. +for ( let i = 0; i < 100; i ++ ) { + sampler.sample( position ); + matrix.makeTranslation( position.x, position.y, position.z ); + mesh.setMatrixAt( i, matrix ); +} +scene.add( mesh ); +``` + +## Import + +MeshSurfaceSampler is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MeshSurfaceSampler } from 'three/addons/math/MeshSurfaceSampler.js'; +``` + +## Constructor + +### new MeshSurfaceSampler( mesh : Mesh ) + +Constructs a mesh surface sampler. + +**mesh** + +Surface mesh from which to sample. + +## Methods + +### .build() : MeshSurfaceSampler + +Processes the input geometry and prepares to return samples. Any configuration of the geometry or sampler must occur before this method is called. Time complexity is O(n) for a surface with n faces. + +**Returns:** A reference to this sampler. + +### .sample( targetPosition : Vector3, targetNormal : Vector3, targetColor : Color, targetUV : Vector2 ) : MeshSurfaceSampler + +Selects a random point on the surface of the input geometry, returning the position and optionally the normal vector, color and UV Coordinate at that point. Time complexity is O(log n) for a surface with n faces. + +**targetPosition** + +The target object holding the sampled position. + +**targetNormal** + +The target object holding the sampled normal. + +**targetColor** + +The target object holding the sampled color. + +**targetUV** + +The target object holding the sampled uv coordinates. + +**Returns:** A reference to this sampler. + +### .setRandomGenerator( randomFunction : function ) : MeshSurfaceSampler + +Allows to set a custom random number generator. Default is `Math.random()`. + +**randomFunction** + +A random number generator. + +**Returns:** A reference to this sampler. + +### .setWeightAttribute( name : string ) : MeshSurfaceSampler + +Specifies a vertex attribute to be used as a weight when sampling from the surface. Faces with higher weights are more likely to be sampled, and those with weights of zero will not be sampled at all. For vector attributes, only .x is used in sampling. + +If no weight attribute is selected, sampling is randomly distributed by area. + +**name** + +The attribute name. + +**Returns:** A reference to this sampler. + +## Source + +[examples/jsm/math/MeshSurfaceSampler.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/MeshSurfaceSampler.js) \ No newline at end of file diff --git a/docs/pages/MeshToonMaterial.html.md b/docs/pages/MeshToonMaterial.html.md new file mode 100644 index 00000000000000..ad808048970f42 --- /dev/null +++ b/docs/pages/MeshToonMaterial.html.md @@ -0,0 +1,179 @@ +*Inheritance: EventDispatcher → Material →* + +# MeshToonMaterial + +A material implementing toon shading. + +## Constructor + +### new MeshToonMaterial( parameters : Object ) + +Constructs a new mesh toon material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .aoMap : Texture + +The red channel of this texture is used as the ambient occlusion map. Requires a second set of UVs. + +Default is `null`. + +### .aoMapIntensity : number + +Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` disables ambient occlusion. Where intensity is `1` and the AO map's red channel is also `1`, ambient light is fully occluded on a surface. + +Default is `1`. + +### .bumpMap : Texture + +The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights. Bump doesn't actually affect the geometry of the object, only the lighting. If a normal map is defined this will be ignored. + +Default is `null`. + +### .bumpScale : number + +How much the bump map affects the material. Typical range is `[0,1]`. + +Default is `1`. + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .displacementBias : number + +The offset of the displacement map's values on the mesh's vertices. The bias is added to the scaled sample of the displacement map. Without a displacement map set, this value is not applied. + +Default is `0`. + +### .displacementMap : Texture + +The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry. The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh. + +Default is `null`. + +### .displacementScale : number + +How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. + +Default is `0`. + +### .emissive : Color + +Emissive (light) color of the material, essentially a solid color unaffected by other lighting. + +Default is `(0,0,0)`. + +### .emissiveIntensity : number + +Intensity of the emissive light. Modulates the emissive color. + +Default is `1`. + +### .emissiveMap : Texture + +Set emissive (glow) map. The emissive map color is modulated by the emissive color and the emissive intensity. If you have an emissive map, be sure to set the emissive color to something other than black. + +Default is `null`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .gradientMap : Texture + +Gradient map for toon shading. It's required to set [Texture#minFilter](Texture.html#minFilter) and [Texture#magFilter](Texture.html#magFilter) to {@linkNearestFilter} when using this type of texture. + +Default is `null`. + +### .isMeshToonMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lightMap : Texture + +The light map. Requires a second set of UVs. + +Default is `null`. + +### .lightMapIntensity : number + +Intensity of the baked light. + +Default is `1`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +### .normalMap : Texture + +The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting. In case the material has a normal map authored using the left handed convention, the `y` component of `normalScale` should be negated to compensate for the different handedness. + +Default is `null`. + +### .normalMapType : TangentSpaceNormalMap | ObjectSpaceNormalMap + +The type of normal map. + +Default is `TangentSpaceNormalMap`. + +### .normalScale : Vector2 + +How much the normal map affects the material. Typical value range is `[0,1]`. + +Default is `(1,1)`. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinecap : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe ends. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinejoin : 'round' | 'bevel' | 'miter' + +Defines appearance of wireframe joints. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `'round'`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +Can only be used with [SVGRenderer](SVGRenderer.html). + +Default is `1`. + +## Source + +[src/materials/MeshToonMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/MeshToonMaterial.js) \ No newline at end of file diff --git a/docs/pages/MeshToonNodeMaterial.html.md b/docs/pages/MeshToonNodeMaterial.html.md new file mode 100644 index 00000000000000..5107606e7efdb8 --- /dev/null +++ b/docs/pages/MeshToonNodeMaterial.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# MeshToonNodeMaterial + +Node material version of [MeshToonMaterial](MeshToonMaterial.html). + +## Constructor + +### new MeshToonNodeMaterial( parameters : Object ) + +Constructs a new mesh toon node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isMeshToonNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lights : boolean + +Set to `true` because toon materials react on lights. + +Default is `true`. + +**Overrides:** [NodeMaterial#lights](NodeMaterial.html#lights) + +## Methods + +### .setupLightingModel() : ToonLightingModel + +Setups the lighting model. + +**Overrides:** [NodeMaterial#setupLightingModel](NodeMaterial.html#setupLightingModel) + +**Returns:** The lighting model. + +## Source + +[src/materials/nodes/MeshToonNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshToonNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/ModelNode.html.md b/docs/pages/ModelNode.html.md new file mode 100644 index 00000000000000..7334167cf093f0 --- /dev/null +++ b/docs/pages/ModelNode.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → Node → Object3DNode →* + +# ModelNode + +This type of node is a specialized version of `Object3DNode` with larger set of model related metrics. Unlike `Object3DNode`, `ModelNode` extracts the reference to the 3D object from the current node frame state. + +## Constructor + +### new ModelNode( scope : 'position' | 'viewPosition' | 'direction' | 'scale' | 'worldMatrix' ) + +Constructs a new object model node. + +**scope** + +The node represents a different type of transformation depending on the scope. + +## Methods + +### .update( frame : NodeFrame ) + +Extracts the model reference from the frame state and then updates the uniform value depending on the scope. + +**frame** + +The current node frame. + +**Overrides:** [Object3DNode#update](Object3DNode.html#update) + +## Source + +[src/nodes/accessors/ModelNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/ModelNode.js) \ No newline at end of file diff --git a/docs/pages/MorphAnimMesh.html.md b/docs/pages/MorphAnimMesh.html.md new file mode 100644 index 00000000000000..cf680b1c6fa9b9 --- /dev/null +++ b/docs/pages/MorphAnimMesh.html.md @@ -0,0 +1,73 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# MorphAnimMesh + +A special type of an animated mesh with a simple interface for animation playback. It allows to playback just one animation without any transitions or fading between animation changes. + +## Import + +MorphAnimMesh is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MorphAnimMesh } from 'three/addons/misc/MorphAnimMesh.js'; +``` + +## Constructor + +### new MorphAnimMesh( geometry : BufferGeometry, material : Material | Array. ) + +Constructs a new morph anim mesh. + +**geometry** + +The mesh geometry. + +**material** + +The mesh material. + +## Properties + +### .activeAction : AnimationAction + +The current active animation action. + +Default is `null`. + +### .mixer : AnimationMixer + +The internal animation mixer. + +## Methods + +### .playAnimation( label : string, fps : number ) + +Plays the defined animation clip. The implementation assumes the animation clips are stored in [Object3D#animations](Object3D.html#animations) or the geometry. + +**label** + +The name of the animation clip. + +**fps** + +The FPS of the animation clip. + +### .setDirectionBackward() + +Sets the animation playback direction to "backward". + +### .setDirectionForward() + +Sets the animation playback direction to "forward". + +### .updateAnimation( delta : number ) + +Updates the animations of the mesh. Must be called inside the animation loop. + +**delta** + +The delta time in seconds. + +## Source + +[examples/jsm/misc/MorphAnimMesh.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/MorphAnimMesh.js) \ No newline at end of file diff --git a/docs/pages/MorphBlendMesh.html.md b/docs/pages/MorphBlendMesh.html.md new file mode 100644 index 00000000000000..7093275b7f31ad --- /dev/null +++ b/docs/pages/MorphBlendMesh.html.md @@ -0,0 +1,179 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# MorphBlendMesh + +A special type of an animated mesh with a more advanced interface for animation playback. Unlike [MorphAnimMesh](MorphAnimMesh.html). It allows to playback more than one morph animation at the same time but without fading options. + +## Import + +MorphBlendMesh is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MorphBlendMesh } from 'three/addons/misc/MorphBlendMesh.js'; +``` + +## Constructor + +### new MorphBlendMesh( geometry : BufferGeometry, material : Material | Array. ) + +Constructs a new morph blend mesh. + +**geometry** + +The mesh geometry. + +**material** + +The mesh material. + +## Properties + +### .animationsList : Array. + +A list of animations. + +### .animationsMap : Object. + +A dictionary of animations. + +## Methods + +### .autoCreateAnimations( fps : number ) + +Automatically creates animations based on the values in [Mesh#morphTargetDictionary](Mesh.html#morphTargetDictionary). + +**fps** + +The FPS of all animations. + +### .createAnimation( name : string, start : number, end : number, fps : number ) + +Creates a new animation. + +**name** + +The animation name. + +**start** + +The start time. + +**end** + +The end time. + +**fps** + +The FPS. + +### .getAnimationDuration( name : string ) : number + +Returns the duration for the defined animation. + +**name** + +The animation name. + +**Returns:** The duration. + +### .getAnimationTime( name : string ) : number + +Returns the time for the defined animation. + +**name** + +The animation name. + +**Returns:** The time. + +### .playAnimation( name : string ) + +Plays the defined animation. + +**name** + +The animation name. + +### .setAnimationDirectionBackward( name : string ) + +Sets the animation playback direction to "backward" for the defined animation. + +**name** + +The animation name. + +### .setAnimationDirectionForward( name : string ) + +Sets the animation playback direction to "forward" for the defined animation. + +**name** + +The animation name. + +### .setAnimationDuration( name : string, duration : number ) + +Sets the duration to the given value for the defined animation. + +**name** + +The animation name. + +**duration** + +The duration to set. + +### .setAnimationFPS( name : string, fps : number ) + +Sets the FPS to the given value for the defined animation. + +**name** + +The animation name. + +**fps** + +The FPS to set. + +### .setAnimationTime( name : string, time : number ) + +Sets the time to the given value for the defined animation. + +**name** + +The animation name. + +**time** + +The time to set. + +### .setAnimationWeight( name : string, weight : number ) + +Sets the weight to the given value for the defined animation. + +**name** + +The animation name. + +**weight** + +The weight to set. + +### .stopAnimation( name : string ) + +Stops the defined animation. + +**name** + +The animation name. + +### .update( delta : number ) + +Updates the animations of the mesh. + +**delta** + +The delta time in seconds. + +## Source + +[examples/jsm/misc/MorphBlendMesh.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/MorphBlendMesh.js) \ No newline at end of file diff --git a/docs/pages/MorphNode.html.md b/docs/pages/MorphNode.html.md new file mode 100644 index 00000000000000..1dcf4a96b03059 --- /dev/null +++ b/docs/pages/MorphNode.html.md @@ -0,0 +1,57 @@ +*Inheritance: EventDispatcher → Node →* + +# MorphNode + +This node implements the vertex transformation shader logic which is required for morph target animation. + +## Constructor + +### new MorphNode( mesh : Mesh ) + +Constructs a new morph node. + +**mesh** + +The mesh holding the morph targets. + +## Properties + +### .mesh : Mesh + +The mesh holding the morph targets. + +### .morphBaseInfluence : UniformNode. + +A uniform node which represents the morph base influence value. + +### .updateType : string + +The update type overwritten since morph nodes are updated per object. + +**Overrides:** [Node#updateType](Node.html#updateType) + +## Methods + +### .setup( builder : NodeBuilder ) + +Setups the morph node by assigning the transformed vertex data to predefined node variables. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +### .update( frame : NodeFrame ) + +Updates the state of the morphed mesh by updating the base influence. + +**frame** + +The current node frame. + +**Overrides:** [Node#update](Node.html#update) + +## Source + +[src/nodes/accessors/MorphNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/MorphNode.js) \ No newline at end of file diff --git a/docs/pages/NRRDLoader.html.md b/docs/pages/NRRDLoader.html.md new file mode 100644 index 00000000000000..100538147504a6 --- /dev/null +++ b/docs/pages/NRRDLoader.html.md @@ -0,0 +1,78 @@ +*Inheritance: Loader →* + +# NRRDLoader + +A loader for the NRRD format. + +## Code Example + +```js +const loader = new NRRDLoader(); +const volume = await loader.loadAsync( 'models/nrrd/I.nrrd' ); +``` + +## Import + +NRRDLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { NRRDLoader } from 'three/addons/loaders/NRRDLoader.js'; +``` + +## Constructor + +### new NRRDLoader( manager : LoadingManager ) + +Constructs a new NRRD loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded NRRD asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : Volume + +Parses the given NRRD data and returns the resulting volume data. + +**data** + +The raw NRRD data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed volume. + +### .setSegmentation( segmentation : boolean ) + +Toggles the segmentation mode. + +**segmentation** + +Whether to use segmentation mode or not. + +## Source + +[examples/jsm/loaders/NRRDLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/NRRDLoader.js) \ No newline at end of file diff --git a/docs/pages/NURBSCurve.html.md b/docs/pages/NURBSCurve.html.md new file mode 100644 index 00000000000000..9e9466d2b774fe --- /dev/null +++ b/docs/pages/NURBSCurve.html.md @@ -0,0 +1,101 @@ +*Inheritance: Curve →* + +# NURBSCurve + +This class represents a NURBS curve. + +Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. + +## Import + +NURBSCurve is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { NURBSCurve } from 'three/addons/curves/NURBSCurve.js'; +``` + +## Constructor + +### new NURBSCurve( degree : number, knots : Array., controlPoints : Array.<(Vector2|Vector3|Vector4)>, startKnot : number, endKnot : number ) + +Constructs a new NURBS curve. + +**degree** + +The NURBS degree. + +**knots** + +The knots as a flat array of numbers. + +**controlPoints** + +An array holding control points. + +**startKnot** + +Index of the start knot into the `knots` array. + +**endKnot** + +Index of the end knot into the `knots` array. + +## Properties + +### .controlPoints : Array. + +An array of control points. + +### .degree : number + +The NURBS degree. + +### .endKnot : number + +Index of the end knot into the `knots` array. + +### .knots : Array. + +The knots as a flat array of numbers. + +### .startKnot : number + +Index of the start knot into the `knots` array. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +### .getTangent( t : number, optionalTarget : Vector3 ) : Vector3 + +Returns a unit vector tangent for the given interpolation factor. + +**t** + +The interpolation factor. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getTangent](Curve.html#getTangent) + +**Returns:** The tangent vector. + +## Source + +[examples/jsm/curves/NURBSCurve.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/NURBSCurve.js) \ No newline at end of file diff --git a/docs/pages/NURBSSurface.html.md b/docs/pages/NURBSSurface.html.md new file mode 100644 index 00000000000000..679525a70dc0ae --- /dev/null +++ b/docs/pages/NURBSSurface.html.md @@ -0,0 +1,83 @@ +# NURBSSurface + +This class represents a NURBS surface. + +Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. + +## Import + +NURBSSurface is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { NURBSSurface } from 'three/addons/curves/NURBSSurface.js'; +``` + +## Constructor + +### new NURBSSurface( degree1 : number, degree2 : number, knots1 : Array., knots2 : Array., controlPoints : Array.> ) + +Constructs a new NURBS surface. + +**degree1** + +The first NURBS degree. + +**degree2** + +The second NURBS degree. + +**knots1** + +The first knots as a flat array of numbers. + +**knots2** + +The second knots as a flat array of numbers. + +**controlPoints** + +An array^2 holding control points. + +## Properties + +### .controlPoints : Array.> + +An array holding arrays of control points. + +### .degree1 : number + +The first NURBS degree. + +### .degree2 : number + +The second NURBS degree. + +### .knots1 : Array. + +The first knots as a flat array of numbers. + +### .knots2 : Array. + +The second knots as a flat array of numbers. + +## Methods + +### .getPoint( t1 : number, t2 : number, target : Vector3 ) + +This method returns a vector in 3D space for the given interpolation factor. This vector lies on the NURBS surface. + +**t1** + +The first interpolation factor representing the `u` position on the surface. Must be in the range `[0,1]`. + +**t2** + +The second interpolation factor representing the `v` position on the surface. Must be in the range `[0,1]`. + +**target** + +The target vector the result is written to. + +## Source + +[examples/jsm/curves/NURBSSurface.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/NURBSSurface.js) \ No newline at end of file diff --git a/docs/pages/NURBSVolume.html.md b/docs/pages/NURBSVolume.html.md new file mode 100644 index 00000000000000..16c550ece4b6ef --- /dev/null +++ b/docs/pages/NURBSVolume.html.md @@ -0,0 +1,73 @@ +# NURBSVolume + +This class represents a NURBS volume. + +Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. + +## Import + +NURBSVolume is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { NURBSVolume } from 'three/addons/curves/NURBSVolume.js'; +``` + +## Constructor + +### new NURBSVolume( degree1 : number, degree2 : number, degree3 : number, knots1 : Array., knots2 : Array., knots3 : Array., controlPoints : Array.>> ) + +Constructs a new NURBS surface. + +**degree1** + +The first NURBS degree. + +**degree2** + +The second NURBS degree. + +**degree3** + +The third NURBS degree. + +**knots1** + +The first knots as a flat array of numbers. + +**knots2** + +The second knots as a flat array of numbers. + +**knots3** + +The third knots as a flat array of numbers. + +**controlPoints** + +An array^3 holding control points. + +## Methods + +### .getPoint( t1 : number, t2 : number, t3 : number, target : Vector3 ) + +This method returns a vector in 3D space for the given interpolation factor. This vector lies within the NURBS volume. + +**t1** + +The first interpolation factor representing the `u` position within the volume. Must be in the range `[0,1]`. + +**t2** + +The second interpolation factor representing the `v` position within the volume. Must be in the range `[0,1]`. + +**t3** + +The third interpolation factor representing the `w` position within the volume. Must be in the range `[0,1]`. + +**target** + +The target vector the result is written to. + +## Source + +[examples/jsm/curves/NURBSVolume.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/NURBSVolume.js) \ No newline at end of file diff --git a/docs/pages/Node.html.md b/docs/pages/Node.html.md new file mode 100644 index 00000000000000..17f7564a09311b --- /dev/null +++ b/docs/pages/Node.html.md @@ -0,0 +1,419 @@ +*Inheritance: EventDispatcher →* + +# Node + +Base class for all nodes. + +## Constructor + +### new Node( nodeType : string ) + +Constructs a new node. + +**nodeType** + +The node type. + +Default is `null`. + +## Properties + +### .global : boolean + +Whether this node is global or not. This property is relevant for the internal node caching system. All nodes which should be declared just once should set this flag to `true` (a typical example is [AttributeNode](AttributeNode.html)). + +Default is `false`. + +### .isNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the node. + +Default is `''`. + +### .needsUpdate : boolean + +Set this property to `true` when the node should be regenerated. + +Default is `false`. + +### .nodeType : string + +The node type. This represents the result type of the node (e.g. `float` or `vec3`). + +Default is `null`. + +### .parents : boolean + +Create a list of parents for this node during the build process. + +Default is `false`. + +### .type : string (readonly) + +The type of the class. The value is usually the constructor name. + +### .updateAfterType : string + +The update type of the node's [Node#updateAfter](Node.html#updateAfter) method. Possible values are listed in [NodeUpdateType](global.html#NodeUpdateType). + +Default is `'none'`. + +### .updateBeforeType : string + +The update type of the node's [Node#updateBefore](Node.html#updateBefore) method. Possible values are listed in [NodeUpdateType](global.html#NodeUpdateType). + +Default is `'none'`. + +### .updateType : string + +The update type of the node's [Node#update](Node.html#update) method. Possible values are listed in [NodeUpdateType](global.html#NodeUpdateType). + +Default is `'none'`. + +### .uuid : string (readonly) + +The UUID of the node. + +### .version : number (readonly) + +The version of the node. The version automatically is increased when [Node#needsUpdate](Node.html#needsUpdate) is set to `true`. + +Default is `0`. + +## Methods + +### .analyze( builder : NodeBuilder, output : Node ) + +Represents the analyze stage which is the second step of the build process, see [Node#build](Node.html#build) method. This stage analyzes the node hierarchy and ensures descendent nodes are built. + +**builder** + +The current node builder. + +**output** + +The target output node. + +Default is `null`. + +### .build( builder : NodeBuilder, output : string | Node ) : Node | string + +This method performs the build of a node. The behavior and return value depend on the current build stage: + +* **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant. +* **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`. +* **generate**: Generates the shader code for the node. Returns the generated shader string. + +**builder** + +The current node builder. + +**output** + +Can be used to define the output type. + +Default is `null`. + +**Returns:** The result of the build process, depending on the build stage. + +### .customCacheKey() : number + +Generate a custom cache key for this node. + +**Returns:** The cache key of the node. + +### .deserialize( json : Object ) + +Deserializes the node from the given JSON. + +**json** + +The JSON object. + +### .dispose() + +Calling this method dispatches the `dispose` event. This event can be used to register event listeners for clean up tasks. + +### .generate( builder : NodeBuilder, output : string ) : string + +Represents the generate stage which is the third step of the build process, see [Node#build](Node.html#build) method. This state builds the output node and returns the resulting shader string. + +**builder** + +The current node builder. + +**output** + +Can be used to define the output type. + +**Returns:** The generated shader string. + +### .getArrayCount( builder : NodeBuilder ) : number + +Returns the number of elements in the node array. + +**builder** + +The current node builder. + +**Returns:** The number of elements in the node array. + +### .getCacheKey( force : boolean, ignores : Set. ) : number + +Returns the cache key for this node. + +**force** + +When set to `true`, a recomputation of the cache key is forced. + +Default is `false`. + +**ignores** + +A set of nodes to ignore during the computation of the cache key. + +Default is `null`. + +**Returns:** The cache key of the node. + +### .getChildren() : Node (generator) + +Generator function that can be used to iterate over the child nodes. + +##### Yields: + +A child node. + +### .getElementType( builder : NodeBuilder ) : string + +Certain types are composed of multiple elements. For example a `vec3` is composed of three `float` values. This method returns the type of these elements. + +**builder** + +The current node builder. + +**Returns:** The type of the node. + +### .getHash( builder : NodeBuilder ) : string + +Returns the hash of the node which is used to identify the node. By default it's the [Node#uuid](Node.html#uuid) however derived node classes might have to overwrite this method depending on their implementation. + +**builder** + +The current node builder. + +**Returns:** The hash. + +### .getMemberType( builder : NodeBuilder, name : string ) : string + +Returns the node member type for the given name. + +**builder** + +The current node builder. + +**name** + +The name of the member. + +**Returns:** The type of the node. + +### .getNodeType( builder : NodeBuilder ) : string + +Returns the node's type. + +**builder** + +The current node builder. + +**Returns:** The type of the node. + +### .getScope() : Node + +Returns the references to this node which is by default `this`. + +**Returns:** A reference to this node. + +### .getSerializeChildren() : Generator. + +Returns the child nodes as a JSON object. + +**Returns:** An iterable list of serialized child objects as JSON. + +### .getShared( builder : NodeBuilder ) : Node + +This method is used during the build process of a node and ensures equal nodes are not built multiple times but just once. For example if `attribute( 'uv' )` is used multiple times by the user, the build process makes sure to process just the first node. + +**builder** + +The current node builder. + +**Returns:** The shared node if possible. Otherwise `this` is returned. + +### .getUpdateAfterType() : NodeUpdateType + +Returns the update type of [Node#updateAfter](Node.html#updateAfter). + +**Returns:** The update type. + +### .getUpdateBeforeType() : NodeUpdateType + +Returns the update type of [Node#updateBefore](Node.html#updateBefore). + +**Returns:** The update type. + +### .getUpdateType() : NodeUpdateType + +Returns the update type of [Node#update](Node.html#update). + +**Returns:** The update type. + +### .isGlobal( builder : NodeBuilder ) : boolean + +By default this method returns the value of the [Node#global](Node.html#global) flag. This method can be overwritten in derived classes if an analytical way is required to determine the global cache referring to the current shader-stage. + +**builder** + +The current node builder. + +**Returns:** Whether this node is global or not. + +### .onFrameUpdate( callback : function ) : Node + +Convenient method for defining [Node#update](Node.html#update). Similar to [Node#onUpdate](Node.html#onUpdate), but this method automatically sets the update type to `FRAME`. + +**callback** + +The update method. + +**Returns:** A reference to this node. + +### .onObjectUpdate( callback : function ) : Node + +Convenient method for defining [Node#update](Node.html#update). Similar to [Node#onUpdate](Node.html#onUpdate), but this method automatically sets the update type to `OBJECT`. + +**callback** + +The update method. + +**Returns:** A reference to this node. + +### .onReference( callback : function ) : Node + +Convenient method for defining [Node#updateReference](Node.html#updateReference). + +**callback** + +The update method. + +**Returns:** A reference to this node. + +### .onRenderUpdate( callback : function ) : Node + +Convenient method for defining [Node#update](Node.html#update). Similar to [Node#onUpdate](Node.html#onUpdate), but this method automatically sets the update type to `RENDER`. + +**callback** + +The update method. + +**Returns:** A reference to this node. + +### .onUpdate( callback : function, updateType : string ) : Node + +Convenient method for defining [Node#update](Node.html#update). + +**callback** + +The update method. + +**updateType** + +The update type. + +**Returns:** A reference to this node. + +### .serialize( json : Object ) + +Serializes the node to JSON. + +**json** + +The output JSON object. + +### .setup( builder : NodeBuilder ) : Node + +Represents the setup stage which is the first step of the build process, see [Node#build](Node.html#build) method. This method is often overwritten in derived modules to prepare the node which is used as a node's output/result. If an output node is prepared, then it must be returned in the `return` statement of the derived module's setup function. + +**builder** + +The current node builder. + +**Returns:** The output node. + +### .toJSON( meta : Object ) : Object + +Serializes the node into the three.js JSON Object/Scene format. + +**meta** + +An optional JSON object that already holds serialized data from other scene objects. + +**Returns:** The serialized node. + +### .traverse( callback : traverseCallback ) + +Can be used to traverse through the node's hierarchy. + +**callback** + +A callback that is executed per node. + +### .update( frame : NodeFrame ) : boolean (abstract) + +The method can be implemented to update the node's internal state when it is used to render an object. The [Node#updateType](Node.html#updateType) property defines how often the update is executed. + +**frame** + +A reference to the current node frame. + +**Returns:** An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + +### .updateAfter( frame : NodeFrame ) : boolean (abstract) + +The method can be implemented to update the node's internal state after it was used to render an object. The [Node#updateAfterType](Node.html#updateAfterType) property defines how often the update is executed. + +**frame** + +A reference to the current node frame. + +**Returns:** An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + +### .updateBefore( frame : NodeFrame ) : boolean (abstract) + +The method can be implemented to update the node's internal state before it is used to render an object. The [Node#updateBeforeType](Node.html#updateBeforeType) property defines how often the update is executed. + +**frame** + +A reference to the current node frame. + +**Returns:** An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + +### .updateReference( state : any ) : any + +Nodes might refer to other objects like materials. This method allows to dynamically update the reference to such objects based on a given state (e.g. the current node frame or builder). + +**state** + +This method can be invocated in different contexts so `state` can refer to any object type. + +**Returns:** The updated reference. + +## Source + +[src/nodes/core/Node.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/Node.js) \ No newline at end of file diff --git a/docs/pages/NodeAttribute.html.md b/docs/pages/NodeAttribute.html.md new file mode 100644 index 00000000000000..a2965fbc8fe464 --- /dev/null +++ b/docs/pages/NodeAttribute.html.md @@ -0,0 +1,49 @@ +# NodeAttribute + +[NodeBuilder](NodeBuilder.html) is going to create instances of this class during the build process of nodes. They represent the final shader attributes that are going to be generated by the builder. Arrays of node attributes is maintained in [NodeBuilder#attributes](NodeBuilder.html#attributes) and [NodeBuilder#bufferAttributes](NodeBuilder.html#bufferAttributes) for this purpose. + +## Constructor + +### new NodeAttribute( name : string, type : string, node : Node ) + +Constructs a new node attribute. + +**name** + +The name of the attribute. + +**type** + +The type of the attribute. + +**node** + +An optional reference to the node. + +Default is `null`. + +## Properties + +### .isNodeAttribute : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the attribute. + +### .node : Node + +An optional reference to the node. + +Default is `null`. + +### .type : string + +The type of the attribute. + +## Source + +[src/nodes/core/NodeAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeAttribute.js) \ No newline at end of file diff --git a/docs/pages/NodeBuilder.html.md b/docs/pages/NodeBuilder.html.md new file mode 100644 index 00000000000000..4fc420e8a595b2 --- /dev/null +++ b/docs/pages/NodeBuilder.html.md @@ -0,0 +1,1627 @@ +# NodeBuilder + +Base class for builders which generate a shader program based on a 3D object and its node material definition. + +## Constructor + +### new NodeBuilder( object : Object3D, renderer : Renderer, parser : NodeParser ) + +Constructs a new node builder. + +**object** + +The 3D object. + +**renderer** + +The current renderer. + +**parser** + +A reference to a node parser. + +## Properties + +### .activeStacks : Array. + +The active stack nodes. + +### .attributes : Array. + +This array holds the node attributes of this builder created via [AttributeNode](AttributeNode.html). + +### .bindGroups : Array. + +Reference to the array of bind groups. + +### .bindings : Object + +This dictionary holds the bindings for each shader stage. + +### .bindingsIndexes : Object + +This dictionary maintains the binding indices per bind group. + +### .bufferAttributes : Array. + +This array holds the node attributes of this builder created via [BufferAttributeNode](BufferAttributeNode.html). + +### .buildStage : 'setup' | 'analyze' | 'generate' + +The current build stage. + +### .cache : NodeCache + +The builder's cache. + +### .camera : Camera + +The camera the 3D object is rendered with. + +Default is `null`. + +### .chaining : Array. + +A chain of nodes. Used to check recursive calls in node-graph. + +### .clippingContext : ClippingContext + +The current clipping context. + +### .codes : Object.> + +This dictionary holds the (native) node codes of this builder. The codes are maintained in an array for each shader stage. + +### .computeShader : string + +The generated compute shader. + +### .context : Object + +The builder's context. + +### .currentFunctionNode : FunctionNode + +Reference to the current function node. + +Default is `null`. + +### .currentNode : Node + +A reference the current node which is the last node in the chain of nodes. + +### .declarations : Object + +This dictionary holds the declarations for each shader stage. + +### .environmentNode : Node + +A reference to the current environment node. + +Default is `null`. + +### .flow : Object + +Current code flow. All code generated in this stack will be stored in `.flow`. + +### .flowCode : Object. + +Nodes code from `.flowNodes`. + +### .flowNodes : Object.> + +Nodes used in the primary flow of code generation. + +### .fnCall : Node + +The current TSL function(Fn) call node. + +Default is `null`. + +### .fogNode : Node + +A reference to the current fog node. + +Default is `null`. + +### .fragmentShader : string + +The generated fragment shader. + +### .geometry : BufferGeometry + +The geometry of the 3D object. + +### .globalCache : NodeCache + +Since the [NodeBuilder#cache](NodeBuilder.html#cache) might be temporarily overwritten by other caches, this member retains the reference to the builder's own cache. + +Default is `this.cache`. + +### .hashNodes : Object. + +A dictionary that assigns each node to a unique hash. + +### .lightsNode : LightsNode + +A reference to the current lights node. + +Default is `null`. + +### .material : Material + +The material of the 3D object. + +### .nodes : Array. + +A list of all nodes the builder is processing for this 3D object. + +### .object : Object3D + +The 3D object. + +### .observer : NodeMaterialObserver + +A reference to a node material observer. + +Default is `null`. + +### .parser : NodeParser + +A reference to a node parser. + +### .renderer : Renderer + +The current renderer. + +### .scene : Scene + +The scene the 3D object belongs to. + +Default is `null`. + +### .sequentialNodes : Array. + +A list of all sequential nodes. + +### .shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' + +The current shader stage. + +### .stack : StackNode + +The current stack. This reflects the current process in the code block hierarchy, it is useful to know if the current process is inside a conditional for example. + +### .stacks : Array. + +List of stack nodes. The current stack hierarchy is stored in an array. + +### .structs : Object + +This dictionary holds the output structs of the builder. The structs are maintained in an array for each shader stage. + +### .subBuild + +Returns the current sub-build layer. + +### .subBuildFn : string + +The current sub-build TSL function(Fn). + +Default is `null`. + +### .subBuildLayers : Array. + +The sub-build layers. + +Default is `[]`. + +### .tab : string + +A tab value. Used for shader string generation. + +Default is `'\t'`. + +### .types : Object + +This dictionary holds the types of the builder. + +### .uniforms : Object + +This dictionary holds the node uniforms of the builder. The uniforms are maintained in an array for each shader stage. + +### .updateAfterNodes : Array. + +A list of all nodes which [Node#updateAfter](Node.html#updateAfter) method should be executed. + +### .updateBeforeNodes : Array. + +A list of all nodes which [Node#updateBefore](Node.html#updateBefore) method should be executed. + +### .updateNodes : Array. + +A list of all nodes which [Node#update](Node.html#update) method should be executed. + +### .vars : Object.|number)> + +This dictionary holds the node variables of this builder. The variables are maintained in an array for each shader stage. This dictionary is also used to count the number of variables according to their type (const, vars). + +### .varyings : Array. + +This array holds the node varyings of this builder. + +### .vertexShader : string + +The generated vertex shader. + +## Methods + +### .addChain( node : Node ) + +Adds the given node to the internal node chain. This is used to check recursive calls in node-graph. + +**node** + +The node to add. + +### .addContext( context : Object ) : Object + +Adds context data to the builder's current context. + +**context** + +The context to add. + +**Returns:** The previous context. + +### .addFlow( shaderStage : 'vertex' | 'fragment' | 'compute', node : Node ) : Node + +Adds the Node to a target flow so that it can generate code in the 'generate' process. + +**shaderStage** + +The shader stage. + +**node** + +The node to add. + +**Returns:** The node. + +### .addFlowCode( code : string ) : NodeBuilder + +Adds a code to the current code flow. + +**code** + +Shader code. + +**Returns:** A reference to this node builder. + +### .addFlowCodeHierarchy( node : Node, nodeBlock : Node ) + +Adds a code flow based on the code-block hierarchy. This is used so that code-blocks like If,Else create their variables locally if the Node is only used inside one of these conditionals in the current shader stage. + +**node** + +The node to add. + +**nodeBlock** + +Node-based code-block. Usually 'ConditionalNode'. + +### .addFlowTab() : NodeBuilder + +Add tab in the code that will be generated so that other snippets respect the current tabulation. Typically used in codes with If,Else. + +**Returns:** A reference to this node builder. + +### .addInclude( node : Node ) : void + +Includes a node in the current function node. + +**node** + +The node to include. + +### .addLineFlowCode( code : string, node : Node ) : NodeBuilder + +Add a inline-code to the current flow. + +**code** + +The code to add. + +**node** + +Optional Node, can help the system understand if the Node is part of a code-block. + +Default is `null`. + +**Returns:** A reference to this node builder. + +### .addLineFlowCodeBlock( node : Node, code : string, nodeBlock : Node ) + +Add a inline-code to the current flow code-block. + +**node** + +The node to add. + +**code** + +The code to add. + +**nodeBlock** + +Current ConditionalNode + +### .addNode( node : Node ) + +Adds a node to this builder. + +**node** + +The node to add. + +### .addSequentialNode( node : Node ) + +It is used to add Nodes that will be used as FRAME and RENDER events, and need to follow a certain sequence in the calls to work correctly. This function should be called after 'setup()' in the 'build()' process to ensure that the child nodes are processed first. + +**node** + +The node to add. + +### .addStack() : StackNode + +Adds a stack node to the internal stack. + +**Returns:** The added stack node. + +### .addSubBuild( subBuild : SubBuildNode ) + +Adds a sub-build layer to the node builder. + +**subBuild** + +The sub-build layer to add. + +### .build() : NodeBuilder + +Central build method which controls the build for the given object. + +**Returns:** A reference to this node builder. + +### .buildCode() (abstract) + +Controls the code build of the shader stages. + +### .buildFunctionCode( shaderNode : ShaderNodeInternal ) : string (abstract) + +Builds the given shader node. + +**shaderNode** + +The shader node. + +**Returns:** The function code. + +### .buildFunctionNode( shaderNode : ShaderNodeInternal ) : FunctionNode + +Returns the native shader operator name for a given generic name. It is a similar type of method like [NodeBuilder#getMethod](NodeBuilder.html#getMethod). + +**shaderNode** + +The shader node to build the function node with. + +**Returns:** The build function node. + +### .buildUpdateNodes() + +Checks the update types of nodes + +### .changeComponentType( type : string, newComponentType : string ) : string + +For a given type this method changes the component type to the given value. E.g. `vec4` should be changed to the new component type `uint` which results in `uvec4`. + +**type** + +The type. + +**newComponentType** + +The new component type. + +**Returns:** The new type. + +### .createCubeRenderTarget( size : number, options : Object ) : CubeRenderTarget + +Factory method for creating an instance of [CubeRenderTarget](CubeRenderTarget.html) with the given dimensions and options. + +**size** + +The size of the cube render target. + +**options** + +The options of the cube render target. + +**Returns:** The cube render target. + +### .createRenderTarget( width : number, height : number, options : Object ) : RenderTarget + +Factory method for creating an instance of [RenderTarget](RenderTarget.html) with the given dimensions and options. + +**width** + +The width of the render target. + +**height** + +The height of the render target. + +**options** + +The options of the render target. + +**Returns:** The render target. + +### .flowBuildStage( node : Node, buildStage : string, output : Node | string ) : Node | string + +Executes the node in a specific build stage. + +This function can be used to arbitrarily execute the specified build stage outside of the standard build process. For instance, if a node's type depends on properties created by the 'setup' stage, then flowBuildStage(node, 'setup') can be used to execute the setup build stage and access its generated nodes before the standard build process begins. + +**node** + +The node to execute. + +**buildStage** + +The build stage to execute the node in. + +**output** + +Expected output type. For example 'vec3'. + +Default is `null`. + +**Returns:** The result of the node build. + +### .flowChildNode( node : Node, output : string ) : Object + +Generates a code flow based on a child Node. + +**node** + +The node to execute. + +**output** + +Expected output type. For example 'vec3'. + +Default is `null`. + +**Returns:** The code flow. + +### .flowNode( node : Node ) : Object + +Executes the node flow based on a root node to generate the final shader code. + +**node** + +The node to execute. + +**Returns:** The code flow. + +### .flowNodeFromShaderStage( shaderStage : 'vertex' | 'fragment' | 'compute' | 'any', node : Node, output : string, propertyName : string ) : Object | Node + +Executes a flow of code in a different stage. + +Some nodes like `varying()` have the ability to compute code in vertex-stage and return the value in fragment-stage even if it is being executed in an input fragment. + +**shaderStage** + +The shader stage. + +**node** + +The node to execute. + +**output** + +Expected output type. For example 'vec3'. + +Default is `null`. + +**propertyName** + +The property name to assign the result. + +Default is `null`. + +**Returns:** The code flow or node.build() result. + +### .flowShaderNode( shaderNode : ShaderNodeInternal ) : Object + +Generates a code flow based on a TSL function: Fn(). + +**shaderNode** + +A function code will be generated based on the input. + +### .flowStagesNode( node : Node, output : string ) : Object + +Runs the node flow through all the steps of creation, 'setup', 'analyze', 'generate'. + +**node** + +The node to execute. + +**output** + +Expected output type. For example 'vec3'. + +Default is `null`. + +### .format( snippet : string, fromType : string, toType : string ) : string + +Formats the given shader snippet from a given type into another one. E.g. this method might be used to convert a simple float string `"1.0"` into a `vec3` representation: `"vec3( 1.0 )"`. + +**snippet** + +The shader snippet. + +**fromType** + +The source type. + +**toType** + +The target type. + +**Returns:** The updated shader string. + +### .generateArray( type : string, count : number, values : Array. ) : string + +Generates the array shader string for the given type and value. + +**type** + +The type. + +**count** + +The count. + +**values** + +The default values. + +Default is `null`. + +**Returns:** The generated value as a shader string. + +### .generateArrayDeclaration( type : string, count : number ) : string + +Generates the array declaration string. + +**type** + +The type. + +**count** + +The count. + +**Returns:** The generated value as a shader string. + +### .generateConst( type : string, value : any ) : string + +Generates the shader string for the given type and value. + +**type** + +The type. + +**value** + +The value. + +Default is `null`. + +**Returns:** The generated value as a shader string. + +### .generateStruct( type : string, membersLayout : Array., values : Array. ) : string + +Generates the struct shader string. + +**type** + +The type. + +**membersLayout** + +The count. + +**values** + +The default values. + +Default is `null`. + +**Returns:** The generated value as a shader string. + +### .generateTexture( texture : Texture, textureProperty : string, uvSnippet : string ) : string (abstract) + +Generates a texture sample shader string for the given texture data. + +**texture** + +The texture. + +**textureProperty** + +The texture property name. + +**uvSnippet** + +Snippet defining the texture coordinates. + +**Returns:** The generated shader string. + +### .generateTextureLod( texture : Texture, textureProperty : string, uvSnippet : string, depthSnippet : string, levelSnippet : string ) : string (abstract) + +Generates a texture LOD shader string for the given texture data. + +**texture** + +The texture. + +**textureProperty** + +The texture property name. + +**uvSnippet** + +Snippet defining the texture coordinates. + +**depthSnippet** + +Snippet defining the 0-based texture array index to sample. + +**levelSnippet** + +Snippet defining the mip level. + +**Returns:** The generated shader string. + +### .getActiveStack() : StackNode + +Returns the active stack. + +**Returns:** The active stack. + +### .getAttribute( name : string, type : string ) : NodeAttribute + +Returns a node attribute for the given name and type. + +**name** + +The attribute's name. + +**type** + +The attribute's type. + +**Returns:** The node attribute. + +### .getAttributes( shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : string (abstract) + +Returns the attribute definitions as a shader string for the given shader stage. + +**shaderStage** + +The shader stage. + +**Returns:** The attribute code section. + +### .getAttributesArray() : Array. + +Returns an array holding all node attributes of this node builder. + +**Returns:** The node attributes of this builder. + +### .getBaseStack() : StackNode + +Returns the base stack. + +**Returns:** The base stack. + +### .getBindGroupArray( groupName : string, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : Array. + +Returns an array of node uniform groups for the given group name and shader stage. + +**groupName** + +The group name. + +**shaderStage** + +The shader stage. + +**Returns:** The array of node uniform groups. + +### .getBindGroupsCache() : ChainMap + +Returns the bind groups of the current renderer. + +**Returns:** The cache. + +### .getBindings() : Array. + +Returns a list bindings of all shader stages separated by groups. + +**Returns:** The list of bindings. + +### .getBufferAttributeFromNode( node : BufferAttributeNode, type : string ) : NodeAttribute + +Returns an instance of [NodeAttribute](NodeAttribute.html) for the given buffer attribute node. + +**node** + +The buffer attribute node. + +**type** + +The node type. + +**Returns:** The node attribute. + +### .getBuildStage() : 'setup' | 'analyze' | 'generate' + +Returns the current build stage. + +**Returns:** The current build stage. + +### .getCache() : NodeCache + +Returns the builder's current cache. + +**Returns:** The builder's current cache. + +### .getCacheFromNode( node : Node, parent : boolean ) : NodeCache + +Returns a cache for the given node. + +**node** + +The node. + +**parent** + +Whether this node refers to a shared parent cache or not. + +Default is `true`. + +**Returns:** The cache. + +### .getClosestSubBuild( data : Node | Set. | Array. ) : string + +Returns the closest sub-build layer for the given data. + +**data** + +The data to get the closest sub-build layer from. + +**Returns:** The closest sub-build name or null if none found. + +### .getCodeFromNode( node : CodeNode, type : string, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : NodeCode + +Returns an instance of [NodeCode](NodeCode.html) for the given code node. + +**node** + +The code node. + +**type** + +The node type. + +**shaderStage** + +The shader stage. + +Default is `this.shaderStage`. + +**Returns:** The node code. + +### .getCodes( shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : string + +Returns the native code definitions as a shader string for the given shader stage. + +**shaderStage** + +The shader stage. + +**Returns:** The native code section. + +### .getComponentType( type : string ) : string + +Returns the component type for a given type. + +**type** + +The type. + +**Returns:** The component type. + +### .getComponentTypeFromTexture( texture : Texture ) : string + +Returns the component type of a given texture. + +**texture** + +The texture. + +**Returns:** The component type. + +### .getContext() : Object + +Returns the builder's current context. + +**Returns:** The builder's current context. + +### .getDataFromNode( node : Node, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any', cache : NodeCache ) : Object + +The builder maintains (cached) data for each node during the building process. This method can be used to get these data for a specific shader stage and cache. + +**node** + +The node to get the data for. + +**shaderStage** + +The shader stage. + +Default is `this.shaderStage`. + +**cache** + +An optional cache. + +Default is `null`. + +**Returns:** The node data. + +### .getDrawIndex() : string (abstract) + +Returns the drawIndex input variable as a native shader string. Only relevant for WebGL and its `WEBGL_multi_draw` extension. + +**Returns:** The drawIndex shader string. + +### .getElementType( type : string ) : string + +Returns the element type for a given type. + +**type** + +The type. + +**Returns:** The element type. + +### .getFlowData( node : Node, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : Object + +Gets the current flow data based on a Node. + +**node** + +Node that the flow was started. + +**shaderStage** + +The shader stage. + +**Returns:** The flow data. + +### .getFragCoord() : string (abstract) + +Returns the fragCoord input variable as a native shader string. + +**Returns:** The fragCoord shader string. + +### .getFrontFacing() : string (abstract) + +Returns the frontFacing input variable as a native shader string. + +**Returns:** The frontFacing shader string. + +### .getFunctionOperator( op : string ) : string (abstract) + +Returns the native shader operator name for a given generic name. It is a similar type of method like [NodeBuilder#getMethod](NodeBuilder.html#getMethod). + +**op** + +The operator name to resolve. + +**Returns:** The resolved operator name. + +### .getHash() : string + +Returns the hash of this node builder. + +**Returns:** The hash. + +### .getInstanceIndex() : string (abstract) + +Contextually returns either the vertex stage instance index builtin or the linearized index of an compute invocation within a grid of workgroups. + +**Returns:** The instanceIndex shader string. + +### .getIntegerType( type : string ) : string + +Returns the integer type pendant for the given type. + +**type** + +The type. + +**Returns:** The integer type. + +### .getMethod( method : string ) : string (abstract) + +Returns the native shader method name for a given generic name. E.g. the method name `textureDimensions` matches the WGSL name but must be resolved to `textureSize` in GLSL. + +**method** + +The method name to resolve. + +**Returns:** The resolved method name. + +### .getNodeFromHash( hash : number ) : Node + +Returns a node for the given hash, see [NodeBuilder#setHashNode](NodeBuilder.html#setHashNode). + +**hash** + +The hash of the node. + +**Returns:** The found node. + +### .getNodeProperties( node : Node, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : Object + +Returns the properties for the given node and shader stage. + +Properties are typically used within a build stage to reference a node's child node or nodes manually assigned to the properties in a separate build stage. A typical usage pattern for defining nodes manually would be assigning dependency nodes to the current node's properties in the setup stage and building those properties in the generate stage. + +**node** + +The node to get the properties for. + +**shaderStage** + +The shader stage. + +Default is `'any'`. + +**Returns:** The node properties. + +### .getNodeUniform( uniformNode : NodeUniform, type : string ) : Uniform + +Returns a uniform representation which is later used for UBO generation and rendering. + +**uniformNode** + +The uniform node. + +**type** + +The requested type. + +**Returns:** The uniform. + +### .getOutputStructName() : string (abstract) + +Returns the output struct name which is required by [OutputStructNode](OutputStructNode.html). + +**Returns:** The name of the output struct. + +### .getOutputStructTypeFromNode( node : OutputStructNode, membersLayout : Array. ) : StructType + +Returns an instance of StructType for the given output struct node. + +**node** + +The output struct node. + +**membersLayout** + +The output struct types. + +**Returns:** The struct type attribute. + +### .getPropertyName( node : Node, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : string + +Returns for the given node and shader stage the property name for the shader. + +**node** + +The node. + +**shaderStage** + +The shader stage. + +**Returns:** The property name. + +### .getShaderStage() : 'vertex' | 'fragment' | 'compute' | 'any' + +Returns the current shader stage. + +**Returns:** The current shader stage. + +### .getSharedContext() : Object + +Gets a context used in shader construction that can be shared across different materials. This is necessary since the renderer cache can reuse shaders generated in one material and use them in another. + +**Returns:** The builder's current context without material. + +### .getSharedDataFromNode( node : Node ) : Object + +Returns shared data object for the given node. + +**node** + +The node to get shared data from. + +**Returns:** The shared data. + +### .getSignature() : string + +Returns a signature with the engine's current revision. + +**Returns:** The signature. + +### .getStructTypeFromNode( node : OutputStructNode, membersLayout : Array., name : string, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : StructType + +Returns an instance of StructType for the given output struct node. + +**node** + +The output struct node. + +**membersLayout** + +The output struct types. + +**name** + +The name of the struct. + +Default is `null`. + +**shaderStage** + +The shader stage. + +Default is `this.shaderStage`. + +**Returns:** The struct type attribute. + +### .getStructTypeNode( name : string, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : StructType + +Returns an instance of StructType for the given struct name and shader stage or null if not found. + +**name** + +The name of the struct. + +**shaderStage** + +The shader stage. + +Default is `this.shaderStage`. + +**Returns:** The struct type or null if not found. + +### .getSubBuildOutput( node : Node ) : string + +Returns the output node of a sub-build layer. + +**node** + +The node to get the output from. + +**Returns:** The output node name. + +### .getSubBuildProperty( property : string, node : Node ) : string + +Returns the sub-build property name for the given property and node. + +**property** + +The property name. + +Default is `''`. + +**node** + +The node to get the sub-build from. + +Default is `null`. + +**Returns:** The sub-build property name. + +### .getTernary( condSnippet : string, ifSnippet : string, elseSnippet : string ) : string (abstract) + +Returns the native snippet for a ternary operation. E.g. GLSL would output a ternary op as `cond ? x : y` whereas WGSL would output it as `select(y, x, cond)` + +**condSnippet** + +The condition determining which expression gets resolved. + +**ifSnippet** + +The expression to resolve to if the condition is true. + +**elseSnippet** + +The expression to resolve to if the condition is false. + +**Returns:** The resolved method name. + +### .getType( type : string ) : string + +It might be necessary to convert certain data types to different ones so this method can be used to hide the conversion. + +**type** + +The type. + +**Returns:** The updated type. + +### .getTypeFromArray( array : TypedArray ) : string + +Returns the type for a given typed array. + +**array** + +The typed array. + +**Returns:** The type. + +### .getTypeFromAttribute( attribute : BufferAttribute ) : string + +Returns the type for a given buffer attribute. + +**attribute** + +The buffer attribute. + +**Returns:** The type. + +### .getTypeFromLength( length : number, componentType : string ) : string + +Returns the data type for the given the length and component type. + +**length** + +The length. + +**componentType** + +The component type. + +Default is `'float'`. + +**Returns:** The type. + +### .getTypeLength( type : string ) : number + +Returns the length for the given data type. + +**type** + +The data type. + +**Returns:** The length. + +### .getUniformFromNode( node : UniformNode, type : string, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any', name : string ) : NodeUniform + +Returns an instance of [NodeUniform](NodeUniform.html) for the given uniform node. + +**node** + +The uniform node. + +**type** + +The uniform type. + +**shaderStage** + +The shader stage. + +Default is `this.shaderStage`. + +**name** + +The name of the uniform. + +Default is `null`. + +**Returns:** The node uniform. + +### .getUniforms( shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : string (abstract) + +Returns the uniform definitions as a shader string for the given shader stage. + +**shaderStage** + +The shader stage. + +**Returns:** The uniform code section. + +### .getVar( type : string, name : string, count : number ) : string + +Returns a single variable definition as a shader string for the given variable type and name. + +**type** + +The variable's type. + +**name** + +The variable's name. + +**count** + +The array length. + +Default is `null`. + +**Returns:** The shader string. + +### .getVarFromNode( node : VarNode, name : string, type : string, shaderStage : 'vertex' | 'fragment' | 'compute' | 'any', readOnly : boolean ) : NodeVar + +Returns an instance of [NodeVar](NodeVar.html) for the given variable node. + +**node** + +The variable node. + +**name** + +The variable's name. + +Default is `null`. + +**type** + +The variable's type. + +Default is `node.getNodeType( this )`. + +**shaderStage** + +The shader stage. + +Default is `this.shaderStage`. + +**readOnly** + +Whether the variable is read-only or not. + +Default is `false`. + +**Returns:** The node variable. + +### .getVars( shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : string + +Returns the variable definitions as a shader string for the given shader stage. + +**shaderStage** + +The shader stage. + +**Returns:** The variable code section. + +### .getVaryingFromNode( node : VaryingNode | PropertyNode, name : string, type : string, interpolationType : string, interpolationSampling : string ) : NodeVar + +Returns an instance of [NodeVarying](NodeVarying.html) for the given varying node. + +**node** + +The varying node. + +**name** + +The varying's name. + +Default is `null`. + +**type** + +The varying's type. + +Default is `node.getNodeType( this )`. + +**interpolationType** + +The interpolation type of the varying. + +Default is `null`. + +**interpolationSampling** + +The interpolation sampling type of the varying. + +Default is `null`. + +**Returns:** The node varying. + +### .getVaryings( shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) : string (abstract) + +Returns the varying definitions as a shader string for the given shader stage. + +**shaderStage** + +The shader stage. + +**Returns:** The varying code section. + +### .getVectorFromMatrix( type : string ) : string + +Returns the vector type for a given matrix type. + +**type** + +The matrix type. + +**Returns:** The vector type. + +### .getVectorType( type : string ) : string + +Returns the vector type for a given type. + +**type** + +The type. + +**Returns:** The vector type. + +### .getVertexIndex() : string (abstract) + +Returns the vertexIndex input variable as a native shader string. + +**Returns:** The instanceIndex shader string. + +### .hasGeometryAttribute( name : string ) : boolean + +Whether the given attribute name is defined in the geometry or not. + +**name** + +The attribute name. + +**Returns:** Whether the given attribute name is defined in the geometry. + +### .includes( node : Node ) : boolean + +Whether the given node is included in the internal array of nodes or not. + +**node** + +The node to test. + +**Returns:** Whether the given node is included in the internal array of nodes or not. + +### .increaseUsage( node : Node ) : number + +Calling this method increases the usage count for the given node by one. + +**node** + +The node to increase the usage count for. + +**Returns:** The updated usage count. + +### .isAvailable( name : string ) : boolean (abstract) + +Whether the requested feature is available or not. + +**name** + +The requested feature. + +**Returns:** Whether the requested feature is supported or not. + +### .isDeterministic( node : Node ) : boolean + +Returns whether a Node or its flow is deterministic, useful for use in `const`. + +**node** + +The varying node. + +**Returns:** Returns true if deterministic. + +### .isFilteredTexture( texture : Texture ) : boolean + +Whether the given texture is filtered or not. + +**texture** + +The texture to check. + +**Returns:** Whether the given texture is filtered or not. + +### .isFlipY() : boolean (abstract) + +Whether to flip texture data along its vertical axis or not. WebGL needs this method evaluate to `true`, WebGPU to `false`. + +**Returns:** Whether to flip texture data along its vertical axis or not. + +### .isInteger( type : string ) : boolean + +Returns the type is an integer type. + +**type** + +The type. + +**Returns:** Whether the type is an integer type or not. + +### .isMatrix( type : string ) : boolean + +Whether the given type is a matrix type or not. + +**type** + +The type to check. + +**Returns:** Whether the given type is a matrix type or not. + +### .isOpaque() : boolean + +Whether the material is opaque or not. + +**Returns:** Whether the material is opaque or not. + +### .isReference( type : string ) : boolean + +Whether the given type is a reference type or not. + +**type** + +The type to check. + +**Returns:** Whether the given type is a reference type or not. + +### .isVector( type : string ) : boolean + +Whether the given type is a vector type or not. + +**type** + +The type to check. + +**Returns:** Whether the given type is a vector type or not. + +### .needsPreviousData() : boolean + +Returns `true` if data from the previous frame are required. Relevant when computing motion vectors with [VelocityNode](VelocityNode.html). + +**Returns:** Whether data from the previous frame are required or not. + +### .needsToWorkingColorSpace( texture : Texture ) : boolean (abstract) + +Checks if the given texture requires a manual conversion to the working color space. + +**texture** + +The texture to check. + +**Returns:** Whether the given texture requires a conversion to working color space or not. + +### .registerDeclaration( node : Object ) + +Registers a node declaration in the current shader stage. + +**node** + +The node to be registered. + +### .removeActiveStack( stack : StackNode ) + +Removes the active stack from the internal stack. + +**stack** + +The stack node to remove. + +### .removeChain( node : Node ) + +Removes the given node from the internal node chain. + +**node** + +The node to remove. + +### .removeFlowTab() : NodeBuilder + +Removes a tab. + +**Returns:** A reference to this node builder. + +### .removeStack() : StackNode + +Removes the last stack node from the internal stack. + +**Returns:** The removed stack node. + +### .removeSubBuild() : SubBuildNode + +Removes the last sub-build layer from the node builder. + +**Returns:** The removed sub-build layer. + +### .setActiveStack( stack : StackNode ) + +Adds an active stack to the internal stack. + +**stack** + +The stack node to add. + +### .setBuildStage( buildStage : 'setup' | 'analyze' | 'generate' ) + +Sets the current build stage. + +**buildStage** + +The build stage to set. + +### .setCache( cache : NodeCache ) + +Sets builder's cache. + +**cache** + +The cache to set. + +### .setContext( context : Object ) + +Sets builder's context. + +**context** + +The context to set. + +### .setHashNode( node : Node, hash : number ) + +The builder maintains each node in a hash-based dictionary. This method sets the given node (value) with the given hash (key) into this dictionary. + +**node** + +The node to add. + +**hash** + +The hash of the node. + +### .setShaderStage( shaderStage : 'vertex' | 'fragment' | 'compute' | 'any' ) + +Sets the current shader stage. + +**shaderStage** + +The shader stage to set. + +### .sortBindingGroups() + +Sorts the bind groups and updates [NodeBuilder#bindingsIndexes](NodeBuilder.html#bindingsIndexes). + +## Source + +[src/nodes/core/NodeBuilder.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeBuilder.js) \ No newline at end of file diff --git a/docs/pages/NodeCache.html.md b/docs/pages/NodeCache.html.md new file mode 100644 index 00000000000000..d0ea38f58dad14 --- /dev/null +++ b/docs/pages/NodeCache.html.md @@ -0,0 +1,59 @@ +# NodeCache + +This utility class is used in [NodeBuilder](NodeBuilder.html) as an internal cache data structure for node data. + +## Constructor + +### new NodeCache( parent : NodeCache ) + +Constructs a new node cache. + +**parent** + +A reference to a parent cache. + +Default is `null`. + +## Properties + +### .id : number (readonly) + +The id of the cache. + +### .nodesData : WeakMap. + +A weak map for managing node data. + +### .parent : NodeCache + +Reference to a parent node cache. + +Default is `null`. + +## Methods + +### .getData( node : Node ) : Object + +Returns the data for the given node. + +**node** + +The node. + +**Returns:** The data for the node. + +### .setData( node : Node, data : Object ) + +Sets the data for a given node. + +**node** + +The node. + +**data** + +The data that should be cached. + +## Source + +[src/nodes/core/NodeCache.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeCache.js) \ No newline at end of file diff --git a/docs/pages/NodeCode.html.md b/docs/pages/NodeCode.html.md new file mode 100644 index 00000000000000..554e7461aa2f71 --- /dev/null +++ b/docs/pages/NodeCode.html.md @@ -0,0 +1,43 @@ +# NodeCode + +[NodeBuilder](NodeBuilder.html) is going to create instances of this class during the build process of nodes. They represent user-defined, native shader code portions that are going to be injected by the builder. A dictionary of node codes is maintained in [NodeBuilder#codes](NodeBuilder.html#codes) for this purpose. + +## Constructor + +### new NodeCode( name : string, type : string, code : string ) + +Constructs a new code node. + +**name** + +The name of the code. + +**type** + +The node type. + +**code** + +The native shader code. + +Default is `''`. + +## Properties + +### .code : string + +The native shader code. + +Default is `''`. + +### .name : string + +The name of the code. + +### .type : string + +The node type. + +## Source + +[src/nodes/core/NodeCode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeCode.js) \ No newline at end of file diff --git a/docs/pages/NodeFrame.html.md b/docs/pages/NodeFrame.html.md new file mode 100644 index 00000000000000..0e165924af1bba --- /dev/null +++ b/docs/pages/NodeFrame.html.md @@ -0,0 +1,111 @@ +# NodeFrame + +Management class for updating nodes. The module tracks metrics like the elapsed time, delta time, the render and frame ID to correctly call the node update methods [Node#updateBefore](Node.html#updateBefore), [Node#update](Node.html#update) and [Node#updateAfter](Node.html#updateAfter) depending on the node's configuration. + +## Constructor + +### new NodeFrame() + +Constructs a new node fame. + +## Properties + +### .camera : Camera + +A reference to the current camera. + +Default is `null`. + +### .deltaTime : number + +The delta time in seconds. + +Default is `0`. + +### .frameId : number + +The frame ID. + +Default is `0`. + +### .material : Material + +A reference to the current material. + +Default is `null`. + +### .object : Object3D + +A reference to the current 3D object. + +Default is `null`. + +### .renderId : number + +The render ID. + +Default is `0`. + +### .renderer : Renderer + +A reference to the current renderer. + +Default is `null`. + +### .scene : Scene + +A reference to the current scene. + +Default is `null`. + +### .time : number + +The elapsed time in seconds. + +Default is `0`. + +### .updateAfterMap : WeakMap. + +Used to control the [Node#updateAfter](Node.html#updateAfter) call. + +### .updateBeforeMap : WeakMap. + +Used to control the [Node#updateBefore](Node.html#updateBefore) call. + +### .updateMap : WeakMap. + +Used to control the [Node#update](Node.html#update) call. + +## Methods + +### .update() + +Updates the internal state of the node frame. This method is called by the renderer in its internal animation loop. + +### .updateAfterNode( node : Node ) + +This method executes the [Node#updateAfter](Node.html#updateAfter) for the given node. It makes sure [Node#updateAfterType](Node.html#updateAfterType) is honored meaning the update is only executed once per frame, render or object depending on the update type. + +**node** + +The node that should be updated. + +### .updateBeforeNode( node : Node ) + +This method executes the [Node#updateBefore](Node.html#updateBefore) for the given node. It makes sure [Node#updateBeforeType](Node.html#updateBeforeType) is honored meaning the update is only executed once per frame, render or object depending on the update type. + +**node** + +The node that should be updated. + +### .updateNode( node : Node ) + +This method executes the [Node#update](Node.html#update) for the given node. It makes sure [Node#updateType](Node.html#updateType) is honored meaning the update is only executed once per frame, render or object depending on the update type. + +**node** + +The node that should be updated. + +## Source + +[src/nodes/core/NodeFrame.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeFrame.js) \ No newline at end of file diff --git a/docs/pages/NodeFunction.html.md b/docs/pages/NodeFunction.html.md new file mode 100644 index 00000000000000..9d70d9005fffbe --- /dev/null +++ b/docs/pages/NodeFunction.html.md @@ -0,0 +1,67 @@ +# NodeFunction + +Base class for node functions. A derived module must be implemented for each supported native shader language. Similar to other `Node*` modules, this class is only relevant during the building process and not used in user-level code. + +## Constructor + +### new NodeFunction( type : string, inputs : Array., name : string, precision : string ) + +Constructs a new node function. + +**type** + +The node type. This type is the return type of the node function. + +**inputs** + +The function's inputs. + +**name** + +The function's name. + +Default is `''`. + +**precision** + +The precision qualifier. + +Default is `''`. + +## Properties + +### .inputs : Array. + +The function's inputs. + +### .name : string + +The name of the uniform. + +Default is `''`. + +### .precision : string + +The precision qualifier. + +Default is `''`. + +### .type : string + +The node type. This type is the return type of the node function. + +## Methods + +### .getCode( name : string ) : string (abstract) + +This method returns the native code of the node function. + +**name** + +The function's name. + +**Returns:** A shader code. + +## Source + +[src/nodes/core/NodeFunction.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeFunction.js) \ No newline at end of file diff --git a/docs/pages/NodeFunctionInput.html.md b/docs/pages/NodeFunctionInput.html.md new file mode 100644 index 00000000000000..1afbae98926400 --- /dev/null +++ b/docs/pages/NodeFunctionInput.html.md @@ -0,0 +1,67 @@ +# NodeFunctionInput + +Describes the input of a [NodeFunction](NodeFunction.html). + +## Constructor + +### new NodeFunctionInput( type : string, name : string, count : number, qualifier : 'in' | 'out' | 'inout', isConst : boolean ) + +Constructs a new node function input. + +**type** + +The input type. + +**name** + +The input name. + +**count** + +If the input is an Array, count will be the length. + +Default is `null`. + +**qualifier** + +The parameter qualifier (only relevant for GLSL). + +Default is `''`. + +**isConst** + +Whether the input uses a const qualifier or not (only relevant for GLSL). + +Default is `false`. + +## Properties + +### .count : number + +If the input is an Array, count will be the length. + +Default is `null`. + +### .isConst : boolean + +Whether the input uses a const qualifier or not (only relevant for GLSL). + +Default is `false`. + +### .name : string + +The input name. + +### .qualifier : 'in' | 'out' | 'inout' + +The parameter qualifier (only relevant for GLSL). + +Default is `''`. + +### .type : string + +The input type. + +## Source + +[src/nodes/core/NodeFunctionInput.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeFunctionInput.js) \ No newline at end of file diff --git a/docs/pages/NodeLoader.html.md b/docs/pages/NodeLoader.html.md new file mode 100644 index 00000000000000..fb0c303b54dbe3 --- /dev/null +++ b/docs/pages/NodeLoader.html.md @@ -0,0 +1,121 @@ +*Inheritance: Loader →* + +# NodeLoader + +A loader for loading node objects in the three.js JSON Object/Scene format. + +## Constructor + +### new NodeLoader( manager : LoadingManager ) + +Constructs a new node loader. + +**manager** + +A reference to a loading manager. + +## Properties + +### .nodes : Object. + +Represents a dictionary of node types. + +### .textures : Object. + +Represents a dictionary of textures. + +## Methods + +### .createNodeFromType( type : string ) : Node + +Creates a node object from the given type. + +**type** + +The node type. + +**Returns:** The created node instance. + +### .load( url : string, onLoad : function, onProgress : function, onError : function ) + +Loads the node definitions from the given URL. + +**url** + +The path/URL of the file to be loaded. + +**onLoad** + +Will be called when load completes. + +**onProgress** + +Will be called while load progresses. + +**onError** + +Will be called when errors are thrown during the loading process. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( json : Object ) : Node + +Parses the node from the given JSON. + +**json** + +The JSON definition + +**type** + +The node type. + +**uuid** + +The node UUID. + +**nodes** + +The node dependencies. + +**meta** + +The meta data. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed node. + +### .parseNodes( json : Array. ) : Object. + +Parse the node dependencies for the loaded node. + +**json** + +The JSON definition + +**Returns:** A dictionary with node dependencies. + +### .setNodes( value : Object. ) : NodeLoader + +Defines the dictionary of node types. + +**value** + +The node library defined as ``. + +**Returns:** A reference to this loader. + +### .setTextures( value : Object. ) : NodeLoader + +Defines the dictionary of textures. + +**value** + +The texture library defines as ``. + +**Returns:** A reference to this loader. + +## Source + +[src/loaders/nodes/NodeLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/nodes/NodeLoader.js) \ No newline at end of file diff --git a/docs/pages/NodeMaterial.html.md b/docs/pages/NodeMaterial.html.md new file mode 100644 index 00000000000000..5d97cd673f9c1e --- /dev/null +++ b/docs/pages/NodeMaterial.html.md @@ -0,0 +1,511 @@ +*Inheritance: EventDispatcher → Material →* + +# NodeMaterial + +Base class for all node materials. + +## Constructor + +### new NodeMaterial() + +Constructs a new node material. + +## Properties + +### .alphaTestNode : Node. + +The alpha test of node materials is by default inferred from the `alphaTest` property. This node property allows to overwrite the default and define the alpha test with a node instead. + +If you don't want to overwrite the alpha test but modify the existing value instead, use [materialAlphaTest](TSL.html#materialAlphaTest). + +Default is `null`. + +### .aoNode : Node. + +The lighting of node materials might be influenced by ambient occlusion. The default AO is inferred from an ambient occlusion map assigned to `aoMap` and the respective `aoMapIntensity`. This node property allows to overwrite the default and define the ambient occlusion with a custom node instead. + +If you don't want to overwrite the diffuse color but modify the existing values instead, use [materialAO](TSL.html#materialAO). + +Default is `null`. + +### .backdropAlphaNode : Node. + +This node allows to modulate the influence of `backdropNode` to the outgoing light. + +Default is `null`. + +### .backdropNode : Node. + +This node can be used to implement a variety of filter-like effects. The idea is to store the current rendering into a texture e.g. via `viewportSharedTexture()`, use it to create an arbitrary effect and then assign the node composition to this property. Everything behind the object using this material will now be affected by a filter. + +```js +const material = new NodeMaterial() +material.transparent = true; +// everything behind the object will be monochromatic +material.backdropNode = saturation( viewportSharedTexture().rgb, 0 ); +``` + +Backdrop computations are part of the lighting so only lit materials can use this property. + +Default is `null`. + +### .castShadowNode : Node. + +This node can be used to influence how an object using this node material casts shadows. To apply a color to shadows, you can simply do: + +```js +material.castShadowNode = vec4( 1, 0, 0, 1 ); +``` + +Which can be nice to fake colored shadows of semi-transparent objects. It is also common to use the property with `Fn` function so checks are performed per fragment. + +```js +materialCustomShadow.castShadowNode = Fn( () => { + hash( vertexIndex ).greaterThan( 0.5 ).discard(); + return materialColor; +} )(); +``` + +Default is `null`. + +### .castShadowPositionNode : Node. + +Allows to overwrite the geometry position used for shadow map projection which is by default [positionLocal](TSL.html#positionLocal), the vertex position in local space. + +Default is `null`. + +### .colorNode : Node. + +The diffuse color of node materials is by default inferred from the `color` and `map` properties. This node property allows to overwrite the default and define the diffuse color with a node instead. + +```js +material.colorNode = color( 0xff0000 ); // define red color +``` + +If you don't want to overwrite the diffuse color but modify the existing values instead, use [materialColor](TSL.html#materialColor). + +```js +material.colorNode = materialColor.mul( color( 0xff0000 ) ); // give diffuse colors a red tint +``` + +Default is `null`. + +### .contextNode : ContextNode + +This node can be used as a global context management component for this material. + +Default is `null`. + +### .depthNode : Node. + +Allows to overwrite depth values in the fragment shader. + +Default is `null`. + +### .envNode : Node. + +The environment of node materials can be defined by an environment map assigned to the `envMap` property or by `Scene.environment` if the node material is a PBR material. This node property allows to overwrite the default behavior and define the environment with a custom node. + +```js +material.envNode = pmremTexture( renderTarget.texture ); +``` + +Default is `null`. + +### .fog : boolean + +Whether this material is affected by fog or not. + +Default is `true`. + +### .fragmentNode : Node. + +This node property can be used if you need complete freedom in implementing the fragment shader. Assigning a node will replace the built-in material logic used in the fragment stage. + +Default is `null`. + +### .geometryNode : function + +This node property is intended for logic which modifies geometry data once or per animation step. Apps usually place such logic randomly in initialization routines or in the animation loop. `geometryNode` is intended as a dedicated API so there is an intended spot where geometry modifications can be implemented. + +The idea is to assign a `Fn` definition that holds the geometry modification logic. A typical example would be a GPU based particle system that provides a node material for usage on app level. The particle simulation would be implemented as compute shaders and managed inside a `Fn` function. This function is eventually assigned to `geometryNode`. + +Default is `null`. + +### .hardwareClipping : boolean + +Whether this material uses hardware clipping or not. This property is managed by the engine and should not be modified by apps. + +Default is `false`. + +### .isNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lights : boolean + +Whether this material is affected by lights or not. + +Default is `false`. + +### .lightsNode : LightsNode + +Node materials which set their `lights` property to `true` are affected by all lights of the scene. Sometimes selective lighting is wanted which means only _some_ lights in the scene affect a material. This can be achieved by creating an instance of [LightsNode](LightsNode.html) with a list of selective lights and assign the node to this property. + +```js +const customLightsNode = lights( [ light1, light2 ] ); +material.lightsNode = customLightsNode; +``` + +Default is `null`. + +### .maskNode : Node. + +Discards the fragment if the mask value is `false`. + +Default is `null`. + +### .maskShadowNode : Node. + +This node can be used to implement a shadow mask for the material. + +Default is `null`. + +### .mrtNode : MRTNode + +MRT configuration is done on renderer or pass level. This node allows to overwrite what values are written into MRT targets on material level. This can be useful for implementing selective FX features that should only affect specific objects. + +Default is `null`. + +### .normalNode : Node. + +The normals of node materials are by default inferred from the `normalMap`/`normalScale` or `bumpMap`/`bumpScale` properties. This node property allows to overwrite the default and define the normals with a node instead. + +If you don't want to overwrite the normals but modify the existing values instead, use [materialNormal](TSL.html#materialNormal). + +Default is `null`. + +### .opacityNode : Node. + +The opacity of node materials is by default inferred from the `opacity` and `alphaMap` properties. This node property allows to overwrite the default and define the opacity with a node instead. + +If you don't want to overwrite the opacity but modify the existing value instead, use [materialOpacity](TSL.html#materialOpacity). + +Default is `null`. + +### .outputNode : Node. + +This node can be used to define the final output of the material. + +TODO: Explain the differences to `fragmentNode`. + +Default is `null`. + +### .positionNode : Node. + +The local vertex positions are computed based on multiple factors like the attribute data, morphing or skinning. This node property allows to overwrite the default and define local vertex positions with nodes instead. + +If you don't want to overwrite the vertex positions but modify the existing values instead, use [positionLocal](TSL.html#positionLocal). + +```js +material.positionNode = positionLocal.add( displace ); +``` + +Default is `null`. + +### .receivedShadowNode : function | FunctionNode. + +This node can be used to influence how an object using this node material receive shadows. + +```js +const totalShadows = float( 1 ).toVar(); +material.receivedShadowNode = Fn( ( [ shadow ] ) => { + totalShadows.mulAssign( shadow ); + //return float( 1 ); // bypass received shadows + return shadow.mix( color( 0xff0000 ), 1 ); // modify shadow color +} ); +``` + +Default is `null`. + +### .receivedShadowPositionNode : Node. + +Allows to overwrite the position used for shadow map rendering which is by default [positionWorld](TSL.html#positionWorld), the vertex position in world space. + +Default is `null`. + +### .type : string + +Represents the type of the node material. + +**Overrides:** [Material#type](Material.html#type) + +### .vertexNode : Node. + +This node property can be used if you need complete freedom in implementing the vertex shader. Assigning a node will replace the built-in material logic used in the vertex stage. + +Default is `null`. + +## Methods + +### .build( builder : NodeBuilder ) + +Builds this material with the given node builder. + +**builder** + +The current node builder. + +### .copy( source : NodeMaterial ) : NodeMaterial + +Copies the properties of the given node material to this instance. + +**source** + +The material to copy. + +**Overrides:** [Material#copy](Material.html#copy) + +**Returns:** A reference to this node material. + +### .customProgramCacheKey() : string + +Allows to define a custom cache key that influence the material key computation for render objects. + +**Overrides:** [Material#customProgramCacheKey](Material.html#customProgramCacheKey) + +**Returns:** The custom cache key. + +### .setDefaultValues( material : Material ) + +Most classic material types have a node pendant e.g. for `MeshBasicMaterial` there is `MeshBasicNodeMaterial`. This utility method is intended for defining all material properties of the classic type in the node type. + +**material** + +The material to copy properties with their values to this node material. + +### .setup( builder : NodeBuilder ) + +Setups the vertex and fragment stage of this node material. + +**builder** + +The current node builder. + +### .setupClipping( builder : NodeBuilder ) : ClippingNode + +Setups the clipping node. + +**builder** + +The current node builder. + +**Returns:** The clipping node. + +### .setupDepth( builder : NodeBuilder ) + +Setups the depth of this material. + +**builder** + +The current node builder. + +### .setupDiffuseColor( builder : NodeBuilder, geometry : BufferGeometry ) + +Setups the computation of the material's diffuse color. + +**builder** + +The current node builder. + +**geometry** + +The geometry. + +### .setupEnvironment( builder : NodeBuilder ) : Node. + +Setups the environment node from the material. + +**builder** + +The current node builder. + +**Returns:** The environment node. + +### .setupFog( builder : NodeBuilder, outputNode : Node. ) : Node. + +Setup the fog. + +**builder** + +The current node builder. + +**outputNode** + +The existing output node. + +**Returns:** The output node. + +### .setupHardwareClipping( builder : NodeBuilder ) + +Setups the hardware clipping if available on the current device. + +**builder** + +The current node builder. + +### .setupLightMap( builder : NodeBuilder ) : Node. + +Setups the light map node from the material. + +**builder** + +The current node builder. + +**Returns:** The light map node. + +### .setupLighting( builder : NodeBuilder ) : Node. + +Setups the outgoing light node. + +**builder** + +The current node builder. + +**Returns:** The outgoing light node. + +### .setupLightingModel( builder : NodeBuilder ) : LightingModel (abstract) + +This method should be implemented by most derived materials since it defines the material's lighting model. + +**builder** + +The current node builder. + +**Returns:** The lighting model. + +### .setupLights( builder : NodeBuilder ) : LightsNode + +Setups the lights node based on the scene, environment and material. + +**builder** + +The current node builder. + +**Returns:** The lights node. + +### .setupModelViewProjection( builder : NodeBuilder ) : Node. + +Setups the position in clip space. + +**builder** + +The current node builder. + +**Returns:** The position in view space. + +### .setupNormal() : Node. + +Setups the normal node from the material. + +**Returns:** The normal node. + +### .setupObserver( builder : NodeBuilder ) : NodeMaterialObserver + +Setups a node material observer with the given builder. + +**builder** + +The current node builder. + +**Returns:** The node material observer. + +### .setupOutgoingLight() : Node. + +Setups the outgoing light node variable + +**Returns:** The outgoing light node. + +### .setupOutput( builder : NodeBuilder, outputNode : Node. ) : Node. + +Setups the output node. + +**builder** + +The current node builder. + +**outputNode** + +The existing output node. + +**Returns:** The output node. + +### .setupPosition( builder : NodeBuilder ) : Node. + +Setups the computation of the position in local space. + +**builder** + +The current node builder. + +**Returns:** The position in local space. + +### .setupPositionView( builder : NodeBuilder ) : Node. + +Setups the position node in view space. This method exists so derived node materials can modify the implementation e.g. sprite materials. + +**builder** + +The current node builder. + +**Returns:** The position in view space. + +### .setupPremultipliedAlpha( builder : NodeBuilder, outputNode : Node. ) : Node. + +Setups premultiplied alpha. + +**builder** + +The current node builder. + +**outputNode** + +The existing output node. + +**Returns:** The output node. + +### .setupVariants( builder : NodeBuilder ) (abstract) + +Abstract interface method that can be implemented by derived materials to setup material-specific node variables. + +**builder** + +The current node builder. + +### .setupVertex( builder : NodeBuilder ) : Node. + +Setups the logic for the vertex stage. + +**builder** + +The current node builder. + +**Returns:** The position in clip space. + +### .toJSON( meta : Object | string ) : Object + +Serializes this material to JSON. + +**meta** + +The meta information for serialization. + +**Overrides:** [Material#toJSON](Material.html#toJSON) + +**Returns:** The serialized node. + +## Source + +[src/materials/nodes/NodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/NodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/NodeMaterialLoader.html.md b/docs/pages/NodeMaterialLoader.html.md new file mode 100644 index 00000000000000..aa6db0741abeb4 --- /dev/null +++ b/docs/pages/NodeMaterialLoader.html.md @@ -0,0 +1,75 @@ +*Inheritance: Loader → MaterialLoader →* + +# NodeMaterialLoader + +A special type of material loader for loading node materials. + +## Constructor + +### new NodeMaterialLoader( manager : LoadingManager ) + +Constructs a new node material loader. + +**manager** + +A reference to a loading manager. + +## Properties + +### .nodeMaterials : Object. + +Represents a dictionary of node material types. + +### .nodes : Object. + +Represents a dictionary of node types. + +## Methods + +### .createMaterialFromType( type : string ) : Node + +Creates a node material from the given type. + +**type** + +The node material type. + +**Overrides:** [MaterialLoader#createMaterialFromType](MaterialLoader.html#createMaterialFromType) + +**Returns:** The created node material instance. + +### .parse( json : Object ) : NodeMaterial + +Parses the node material from the given JSON. + +**json** + +The JSON definition + +**Overrides:** [MaterialLoader#parse](MaterialLoader.html#parse) + +**Returns:** . The parsed material. + +### .setNodeMaterials( value : Object. ) : NodeLoader + +Defines the dictionary of node material types. + +**value** + +The node material library defined as ``. + +**Returns:** A reference to this loader. + +### .setNodes( value : Object. ) : NodeLoader + +Defines the dictionary of node types. + +**value** + +The node library defined as ``. + +**Returns:** A reference to this loader. + +## Source + +[src/loaders/nodes/NodeMaterialLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/nodes/NodeMaterialLoader.js) \ No newline at end of file diff --git a/docs/pages/NodeMaterialObserver.html.md b/docs/pages/NodeMaterialObserver.html.md new file mode 100644 index 00000000000000..696d5491504d12 --- /dev/null +++ b/docs/pages/NodeMaterialObserver.html.md @@ -0,0 +1,155 @@ +# NodeMaterialObserver + +This class is used by [WebGPURenderer](WebGPURenderer.html) as management component. It's primary purpose is to determine whether render objects require a refresh right before they are going to be rendered or not. + +## Constructor + +### new NodeMaterialObserver( builder : NodeBuilder ) + +Constructs a new node material observer. + +**builder** + +The node builder. + +## Properties + +### .hasAnimation : boolean + +Whether the node builder's 3D object is animated or not. + +### .hasNode : boolean + +Whether the material uses node objects or not. + +### .refreshUniforms : Array. + +A list of all possible material uniforms + +### .renderId : number + +Holds the current render ID from the node frame. + +Default is `0`. + +### .renderObjects : WeakMap. + +A node material can be used by more than one render object so the monitor must maintain a list of render objects. + +## Methods + +### .containsNode( builder : NodeBuilder ) : boolean + +Returns `true` if the node builder's material uses node properties. + +**builder** + +The current node builder. + +**Returns:** Whether the node builder's material uses node properties or not. + +### .equals( renderObject : RenderObject, lightsData : Array. ) : boolean + +Returns `true` if the given render object has not changed its state. + +**renderObject** + +The render object. + +**lightsData** + +The current material lights. + +**Returns:** Whether the given render object has changed its state or not. + +### .firstInitialization( renderObject : RenderObject ) : boolean + +Returns `true` if the given render object is verified for the first time of this observer. + +**renderObject** + +The render object. + +**Returns:** Whether the given render object is verified for the first time of this observer. + +### .getAttributesData( attributes : Object ) : Object + +Returns an attribute data structure holding the attributes versions for monitoring. + +**attributes** + +The geometry attributes. + +**Returns:** An object for monitoring the versions of attributes. + +### .getLights( lightsNode : LightsNode, renderId : number ) : Array. + +Returns the lights for the given lights node and render ID. + +**lightsNode** + +The lights node. + +**renderId** + +The render ID. + +**Returns:** The lights for the given lights node and render ID. + +### .getLightsData( materialLights : Array. ) : Array. + +Returns the lights data for the given material lights. + +**materialLights** + +The material lights. + +**Returns:** The lights data for the given material lights. + +### .getMaterialData( material : Material ) : Object + +Returns a material data structure holding the material property values for monitoring. + +**material** + +The material. + +**Returns:** An object for monitoring material properties. + +### .getRenderObjectData( renderObject : RenderObject ) : Object + +Returns monitoring data for the given render object. + +**renderObject** + +The render object. + +**Returns:** The monitoring data. + +### .needsRefresh( renderObject : RenderObject, nodeFrame : NodeFrame ) : boolean + +Checks if the given render object requires a refresh. + +**renderObject** + +The render object. + +**nodeFrame** + +The current node frame. + +**Returns:** Whether the given render object requires a refresh or not. + +### .needsVelocity( renderer : Renderer ) : boolean + +Returns `true` if the current rendering produces motion vectors. + +**renderer** + +The renderer. + +**Returns:** Whether the current rendering produces motion vectors or not. + +## Source + +[src/materials/nodes/manager/NodeMaterialObserver.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/manager/NodeMaterialObserver.js) \ No newline at end of file diff --git a/docs/pages/NodeObjectLoader.html.md b/docs/pages/NodeObjectLoader.html.md new file mode 100644 index 00000000000000..a3274638a439c3 --- /dev/null +++ b/docs/pages/NodeObjectLoader.html.md @@ -0,0 +1,95 @@ +*Inheritance: Loader → ObjectLoader →* + +# NodeObjectLoader + +A special type of object loader for loading 3D objects using node materials. + +## Constructor + +### new NodeObjectLoader( manager : LoadingManager ) + +Constructs a new node object loader. + +**manager** + +A reference to a loading manager. + +## Properties + +### .nodeMaterials : Object. + +Represents a dictionary of node material types. + +### .nodes : Object. + +Represents a dictionary of node types. + +## Methods + +### .parse( json : Object, onLoad : function ) : Object3D + +Parses the node objects from the given JSON. + +**json** + +The JSON definition + +**onLoad** + +The onLoad callback function. + +**Overrides:** [ObjectLoader#parse](ObjectLoader.html#parse) + +**Returns:** . The parsed 3D object. + +### .parseMaterials( json : Object, textures : Object. ) : Object. + +Parses the node objects from the given JSON and textures. + +**json** + +The JSON definition + +**textures** + +The texture library. + +**Returns:** . The parsed materials. + +### .parseNodes( json : Array., textures : Object. ) : Object. + +Parses the node objects from the given JSON and textures. + +**json** + +The JSON definition + +**textures** + +The texture library. + +**Returns:** . The parsed nodes. + +### .setNodeMaterials( value : Object. ) : NodeObjectLoader + +Defines the dictionary of node material types. + +**value** + +The node material library defined as ``. + +**Returns:** A reference to this loader. + +### .setNodes( value : Object. ) : NodeObjectLoader + +Defines the dictionary of node types. + +**value** + +The node library defined as ``. + +**Returns:** A reference to this loader. + +## Source + +[src/loaders/nodes/NodeObjectLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/nodes/NodeObjectLoader.js) \ No newline at end of file diff --git a/docs/pages/NodeParser.html.md b/docs/pages/NodeParser.html.md new file mode 100644 index 00000000000000..459cb5a3957809 --- /dev/null +++ b/docs/pages/NodeParser.html.md @@ -0,0 +1,23 @@ +# NodeParser + +Base class for node parsers. A derived parser must be implemented for each supported native shader language. + +## Constructor + +### new NodeParser() + +## Methods + +### .parseFunction( source : string ) : NodeFunction (abstract) + +The method parses the given native code an returns a node function. + +**source** + +The native shader code. + +**Returns:** A node function. + +## Source + +[src/nodes/core/NodeParser.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeParser.js) \ No newline at end of file diff --git a/docs/pages/NodeUniform.html.md b/docs/pages/NodeUniform.html.md new file mode 100644 index 00000000000000..d3272daca94f74 --- /dev/null +++ b/docs/pages/NodeUniform.html.md @@ -0,0 +1,57 @@ +# NodeUniform + +[NodeBuilder](NodeBuilder.html) is going to create instances of this class during the build process of nodes. They represent the final shader uniforms that are going to be generated by the builder. A dictionary of node uniforms is maintained in [NodeBuilder#uniforms](NodeBuilder.html#uniforms) for this purpose. + +## Constructor + +### new NodeUniform( name : string, type : string, node : UniformNode ) + +Constructs a new node uniform. + +**name** + +The name of the uniform. + +**type** + +The type of the uniform. + +**node** + +An reference to the node. + +## Properties + +### .groupNode : UniformGroupNode + +The uniform node's group. + +### .id : number + +The id of the uniform node. + +### .isNodeUniform : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the uniform. + +### .node : UniformNode + +An reference to the node. + +### .type : string + +The type of the uniform. + +### .value : any + +The value of the uniform node. + +## Source + +[src/nodes/core/NodeUniform.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeUniform.js) \ No newline at end of file diff --git a/docs/pages/NodeVar.html.md b/docs/pages/NodeVar.html.md new file mode 100644 index 00000000000000..5fe9169dccc0da --- /dev/null +++ b/docs/pages/NodeVar.html.md @@ -0,0 +1,57 @@ +# NodeVar + +[NodeBuilder](NodeBuilder.html) is going to create instances of this class during the build process of nodes. They represent the final shader variables that are going to be generated by the builder. A dictionary of node variables is maintained in [NodeBuilder#vars](NodeBuilder.html#vars) for this purpose. + +## Constructor + +### new NodeVar( name : string, type : string, readOnly : boolean, count : number ) + +Constructs a new node variable. + +**name** + +The name of the variable. + +**type** + +The type of the variable. + +**readOnly** + +The read-only flag. + +Default is `false`. + +**count** + +The size. + +Default is `null`. + +## Properties + +### .count : number + +The size. + +### .isNodeVar : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the variable. + +### .readOnly : boolean + +The read-only flag. + +### .type : string + +The type of the variable. + +## Source + +[src/nodes/core/NodeVar.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeVar.js) \ No newline at end of file diff --git a/docs/pages/NodeVarying.html.md b/docs/pages/NodeVarying.html.md new file mode 100644 index 00000000000000..7e3f9bf8c73b87 --- /dev/null +++ b/docs/pages/NodeVarying.html.md @@ -0,0 +1,61 @@ +*Inheritance: NodeVar →* + +# NodeVarying + +[NodeBuilder](NodeBuilder.html) is going to create instances of this class during the build process of nodes. They represent the final shader varyings that are going to be generated by the builder. An array of node varyings is maintained in [NodeBuilder#varyings](NodeBuilder.html#varyings) for this purpose. + +## Constructor + +### new NodeVarying( name : string, type : string, interpolationType : string, interpolationSampling : string ) + +Constructs a new node varying. + +**name** + +The name of the varying. + +**type** + +The type of the varying. + +**interpolationType** + +The interpolation type of the varying. + +Default is `null`. + +**interpolationSampling** + +The interpolation sampling type of the varying. + +Default is `null`. + +## Properties + +### .interpolationSampling : string + +The interpolation sampling type of varying data. + +Default is `null`. + +### .interpolationType : string + +The interpolation type of the varying data. + +Default is `null`. + +### .isNodeVarying : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .needsInterpolation : boolean + +Whether this varying requires interpolation or not. This property can be used to check if the varying can be optimized for a variable. + +Default is `false`. + +## Source + +[src/nodes/core/NodeVarying.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/NodeVarying.js) \ No newline at end of file diff --git a/docs/pages/NormalMapNode.html.md b/docs/pages/NormalMapNode.html.md new file mode 100644 index 00000000000000..2d218204e1c128 --- /dev/null +++ b/docs/pages/NormalMapNode.html.md @@ -0,0 +1,55 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# NormalMapNode + +This class can be used for applying normals maps to materials. + +## Code Example + +```js +material.normalNode = normalMap( texture( normalTex ) ); +``` + +## Constructor + +### new NormalMapNode( node : Node., scaleNode : Node. ) + +Constructs a new normal map node. + +**node** + +Represents the normal map data. + +**scaleNode** + +Controls the intensity of the effect. + +Default is `null`. + +## Properties + +### .node : Node. + +Represents the normal map data. + +### .normalMapType : TangentSpaceNormalMap | ObjectSpaceNormalMap + +The normal map type. + +Default is `TangentSpaceNormalMap`. + +### .scaleNode : Node. + +Controls the intensity of the effect. + +Default is `null`. + +### .unpackNormalMode : string + +Controls how to unpack the sampled normal map values. + +Default is `NoNormalPacking`. + +## Source + +[src/nodes/display/NormalMapNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/NormalMapNode.js) \ No newline at end of file diff --git a/docs/pages/NumberKeyframeTrack.html.md b/docs/pages/NumberKeyframeTrack.html.md new file mode 100644 index 00000000000000..6390868e73ecb9 --- /dev/null +++ b/docs/pages/NumberKeyframeTrack.html.md @@ -0,0 +1,41 @@ +*Inheritance: KeyframeTrack →* + +# NumberKeyframeTrack + +A track for numeric keyframe values. + +## Constructor + +### new NumberKeyframeTrack( name : string, times : Array., values : Array., interpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth ) + +Constructs a new number keyframe track. + +**name** + +The keyframe track's name. + +**times** + +A list of keyframe times. + +**values** + +A list of keyframe values. + +**interpolation** + +The interpolation type. + +## Properties + +### .ValueTypeName : string + +The value type name. + +Default is `'number'`. + +**Overrides:** [KeyframeTrack#ValueTypeName](KeyframeTrack.html#ValueTypeName) + +## Source + +[src/animation/tracks/NumberKeyframeTrack.js](https://github.com/mrdoob/three.js/blob/master/src/animation/tracks/NumberKeyframeTrack.js) \ No newline at end of file diff --git a/docs/pages/OBB.html.md b/docs/pages/OBB.html.md new file mode 100644 index 00000000000000..1a1738cb2645e2 --- /dev/null +++ b/docs/pages/OBB.html.md @@ -0,0 +1,227 @@ +# OBB + +Represents an oriented bounding box (OBB) in 3D space. + +## Import + +OBB is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OBB } from 'three/addons/math/OBB.js'; +``` + +## Constructor + +### new OBB( center : Vector3, halfSize : Vector3, rotation : Matrix3 ) + +Constructs a new OBB. + +**center** + +The center of the OBB. + +**halfSize** + +Positive halfwidth extents of the OBB along each axis. + +**rotation** + +The rotation of the OBB. + +## Properties + +### .center : Vector3 + +The center of the OBB. + +### .halfSize : Vector3 + +Positive halfwidth extents of the OBB along each axis. + +### .rotation : Matrix3 + +The rotation of the OBB. + +## Methods + +### .applyMatrix4( matrix : Matrix4 ) : OBB + +Applies the given transformation matrix to this OBB. This method can be used to transform the bounding volume with the world matrix of a 3D object in order to keep both entities in sync. + +**matrix** + +The matrix to apply. + +**Returns:** A reference of this OBB. + +### .clampPoint( point : Vector3, target : Vector3 ) : Vector3 + +Clamps the given point within the bounds of this OBB. + +**point** + +The point that should be clamped within the bounds of this OBB. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** + +* The clamped point. + +### .clone() : OBB + +Returns a new OBB with copied values from this instance. + +**Returns:** A clone of this instance. + +### .containsPoint( point : Vector3 ) : boolean + +Returns `true` if the given point lies within this OBB. + +**point** + +The point to test. + +**Returns:** + +* Whether the given point lies within this OBB or not. + +### .copy( obb : OBB ) : OBB + +Copies the values of the given OBB to this instance. + +**obb** + +The OBB to copy. + +**Returns:** A reference to this OBB. + +### .equals( obb : OBB ) : boolean + +Returns `true` if the given OBB is equal to this OBB. + +**obb** + +The OBB to test. + +**Returns:** Whether the given OBB is equal to this OBB or not. + +### .fromBox3( box3 : Box3 ) : OBB + +Defines an OBB based on the given AABB. + +**box3** + +The AABB to setup the OBB from. + +**Returns:** A reference of this OBB. + +### .getSize( target : Vector3 ) : Vector3 + +Returns the size of this OBB. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The size. + +### .intersectRay( ray : Ray, target : Vector3 ) : Vector3 + +Performs a ray/OBB intersection test and stores the intersection point in the given 3D vector. + +**ray** + +The ray to test. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The intersection point. If no intersection is detected, `null` is returned. + +### .intersectsBox3( box3 : Box3 ) : boolean + +Returns `true` if the given AABB intersects this OBB. + +**box3** + +The AABB to test. + +**Returns:** + +* Whether the given AABB intersects this OBB or not. + +### .intersectsOBB( obb : OBB, epsilon : number ) : boolean + +Returns `true` if the given OBB intersects this OBB. + +**obb** + +The OBB to test. + +**epsilon** + +A small value to prevent arithmetic errors. + +Default is `Number.EPSILON`. + +**Returns:** + +* Whether the given OBB intersects this OBB or not. + +### .intersectsPlane( plane : Plane ) : boolean + +Returns `true` if the given plane intersects this OBB. + +**plane** + +The plane to test. + +**Returns:** Whether the given plane intersects this OBB or not. + +### .intersectsRay( ray : Ray ) : boolean + +Returns `true` if the given ray intersects this OBB. + +**ray** + +The ray to test. + +**Returns:** Whether the given ray intersects this OBB or not. + +### .intersectsSphere( sphere : Sphere ) : boolean + +Returns `true` if the given bounding sphere intersects this OBB. + +**sphere** + +The bounding sphere to test. + +**Returns:** + +* Whether the given bounding sphere intersects this OBB or not. + +### .set( center : Vector3, halfSize : Vector3, rotation : Matrix3 ) : OBB + +Sets the OBBs components to the given values. + +**center** + +The center of the OBB. + +**halfSize** + +Positive halfwidth extents of the OBB along each axis. + +**rotation** + +The rotation of the OBB. + +**Returns:** A reference to this OBB. + +## Source + +[examples/jsm/math/OBB.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/OBB.js) \ No newline at end of file diff --git a/docs/pages/OBJExporter.html.md b/docs/pages/OBJExporter.html.md new file mode 100644 index 00000000000000..dd0779cdbe3d28 --- /dev/null +++ b/docs/pages/OBJExporter.html.md @@ -0,0 +1,42 @@ +# OBJExporter + +An exporter for OBJ. + +`OBJExporter` is not able to export material data into MTL files so only geometry data are supported. + +## Code Example + +```js +const exporter = new OBJExporter(); +const data = exporter.parse( scene ); +``` + +## Import + +OBJExporter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OBJExporter } from 'three/addons/exporters/OBJExporter.js'; +``` + +## Constructor + +### new OBJExporter() + +## Methods + +### .parse( object : Object3D ) : string + +Parses the given 3D object and generates the OBJ output. + +If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. + +**object** + +The 3D object to export. + +**Returns:** The exported OBJ. + +## Source + +[examples/jsm/exporters/OBJExporter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/OBJExporter.js) \ No newline at end of file diff --git a/docs/pages/OBJLoader.html.md b/docs/pages/OBJLoader.html.md new file mode 100644 index 00000000000000..d50bb210347fe3 --- /dev/null +++ b/docs/pages/OBJLoader.html.md @@ -0,0 +1,91 @@ +*Inheritance: Loader →* + +# OBJLoader + +A loader for the OBJ format. + +The [OBJ format](https://en.wikipedia.org/wiki/Wavefront_.obj_file) is a simple data-format that represents 3D geometry in a human readable format as the position of each vertex, the UV position of each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list of vertices, and texture vertices. + +## Code Example + +```js +const loader = new OBJLoader(); +const object = await loader.loadAsync( 'models/monster.obj' ); +scene.add( object ); +``` + +## Import + +OBJLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; +``` + +## Constructor + +### new OBJLoader( manager : LoadingManager ) + +Constructs a new OBJ loader. + +**manager** + +The loading manager. + +## Properties + +### .materials : MaterialCreator + +A reference to a material creator. + +Default is `null`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded OBJ asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string ) : Group + +Parses the given OBJ data and returns the resulting group. + +**text** + +The raw OBJ data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed OBJ. + +### .setMaterials( materials : MaterialCreator ) : OBJLoader + +Sets the material creator for this OBJ. This object is loaded via [MTLLoader](MTLLoader.html). + +**materials** + +An object that creates the materials for this OBJ. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/OBJLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/OBJLoader.js) \ No newline at end of file diff --git a/docs/pages/Object3D.html.md b/docs/pages/Object3D.html.md new file mode 100644 index 00000000000000..cf75c891294a0c --- /dev/null +++ b/docs/pages/Object3D.html.md @@ -0,0 +1,816 @@ +*Inheritance: EventDispatcher →* + +# Object3D + +This is the base class for most objects in three.js and provides a set of properties and methods for manipulating objects in 3D space. + +## Constructor + +### new Object3D() + +Constructs a new 3D object. + +## Properties + +### .animations : Array. + +An array holding the animation clips of the 3D object. + +### .castShadow : boolean + +When set to `true`, the 3D object gets rendered into shadow maps. + +Default is `false`. + +### .children : Array. + +An array holding the child 3D objects of this instance. + +### .customDepthMaterial : Material | undefined + +Custom depth material to be used when rendering to the depth map. Can only be used in context of meshes. When shadow-casting with a [DirectionalLight](DirectionalLight.html) or [SpotLight](SpotLight.html), if you are modifying vertex positions in the vertex shader you must specify a custom depth material for proper shadows. + +Only relevant in context of [WebGLRenderer](WebGLRenderer.html). + +Default is `undefined`. + +### .customDistanceMaterial : Material | undefined + +Same as [Object3D#customDepthMaterial](Object3D.html#customDepthMaterial), but used with [PointLight](PointLight.html). + +Only relevant in context of [WebGLRenderer](WebGLRenderer.html). + +Default is `undefined`. + +### .frustumCulled : boolean + +When set to `true`, the 3D object is honored by view frustum culling. + +Default is `true`. + +### .id : number (readonly) + +The ID of the 3D object. + +### .isObject3D : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .layers : Layers + +The layer membership of the 3D object. The 3D object is only visible if it has at least one layer in common with the camera in use. This property can also be used to filter out unwanted objects in ray-intersection tests when using [Raycaster](Raycaster.html). + +### .matrix : Matrix4 + +Represents the object's transformation matrix in local space. + +### .matrixAutoUpdate : boolean + +When set to `true`, the engine automatically computes the local matrix from position, rotation and scale every frame. + +The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_AUTO_UPDATE`. + +Default is `true`. + +### .matrixWorld : Matrix4 + +Represents the object's transformation matrix in world space. If the 3D object has no parent, then it's identical to the local transformation matrix + +### .matrixWorldAutoUpdate : boolean + +When set to `true`, the engine automatically computes the world matrix from the current local matrix and the object's transformation hierarchy. + +The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE`. + +Default is `true`. + +### .matrixWorldNeedsUpdate : boolean + +When set to `true`, it calculates the world matrix in that frame and resets this property to `false`. + +Default is `false`. + +### .modelViewMatrix : Matrix4 + +Represents the object's model-view matrix. + +### .name : string + +The name of the 3D object. + +### .normalMatrix : Matrix3 + +Represents the object's normal matrix. + +### .parent : Object3D + +A reference to the parent object. + +Default is `null`. + +### .position : Vector3 + +Represents the object's local position. + +Default is `(0,0,0)`. + +### .quaternion : Quaternion + +Represents the object's local rotation as Quaternions. + +### .receiveShadow : boolean + +When set to `true`, the 3D object is affected by shadows in the scene. + +Default is `false`. + +### .renderOrder : number + +This value allows the default rendering order of scene graph objects to be overridden although opaque and transparent objects remain sorted independently. When this property is set for an instance of [Group](Group.html),all descendants objects will be sorted and rendered together. Sorting is from lowest to highest render order. + +Default is `0`. + +### .rotation : Euler + +Represents the object's local rotation as Euler angles, in radians. + +Default is `(0,0,0)`. + +### .scale : Vector3 + +Represents the object's local scale. + +Default is `(1,1,1)`. + +### .type : string (readonly) + +The type property is used for detecting the object type in context of serialization/deserialization. + +### .up : Vector3 + +Defines the `up` direction of the 3D object which influences the orientation via methods like [Object3D#lookAt](Object3D.html#lookAt). + +The default values for all 3D objects is defined by `Object3D.DEFAULT_UP`. + +### .userData : Object + +An object that can be used to store custom data about the 3D object. It should not hold references to functions as these will not be cloned. + +### .uuid : string (readonly) + +The UUID of the 3D object. + +### .visible : boolean + +When set to `true`, the 3D object gets rendered. + +Default is `true`. + +### .DEFAULT_MATRIX_AUTO_UPDATE : boolean + +The default setting for [Object3D#matrixAutoUpdate](Object3D.html#matrixAutoUpdate) for newly created 3D objects. + +Default is `true`. + +### .DEFAULT_MATRIX_WORLD_AUTO_UPDATE : boolean + +The default setting for [Object3D#matrixWorldAutoUpdate](Object3D.html#matrixWorldAutoUpdate) for newly created 3D objects. + +Default is `true`. + +### .DEFAULT_UP : Vector3 + +The default up direction for objects, also used as the default position for [DirectionalLight](DirectionalLight.html) and [HemisphereLight](HemisphereLight.html). + +Default is `(0,1,0)`. + +## Methods + +### .add( object : Object3D ) : Object3D + +Adds the given 3D object as a child to this 3D object. An arbitrary number of objects may be added. Any current parent on an object passed in here will be removed, since an object can have at most one parent. + +**object** + +The 3D object to add. + +##### Fires: + +* [Object3D#event:added](Object3D.html#event:added) +* [Object3D#event:childadded](Object3D.html#event:childadded) + +**Returns:** A reference to this instance. + +### .applyMatrix4( matrix : Matrix4 ) + +Applies the given transformation matrix to the object and updates the object's position, rotation and scale. + +**matrix** + +The transformation matrix. + +### .applyQuaternion( q : Quaternion ) : Object3D + +Applies a rotation represented by given the quaternion to the 3D object. + +**q** + +The quaternion. + +**Returns:** A reference to this instance. + +### .attach( object : Object3D ) : Object3D + +Adds the given 3D object as a child of this 3D object, while maintaining the object's world transform. This method does not support scene graphs having non-uniformly-scaled nodes(s). + +**object** + +The 3D object to attach. + +##### Fires: + +* [Object3D#event:added](Object3D.html#event:added) +* [Object3D#event:childadded](Object3D.html#event:childadded) + +**Returns:** A reference to this instance. + +### .clear() : Object3D + +Removes all child objects. + +##### Fires: + +* [Object3D#event:removed](Object3D.html#event:removed) +* [Object3D#event:childremoved](Object3D.html#event:childremoved) + +**Returns:** A reference to this instance. + +### .clone( recursive : boolean ) : Object3D + +Returns a new 3D object with copied values from this instance. + +**recursive** + +When set to `true`, descendants of the 3D object are also cloned. + +Default is `true`. + +**Returns:** A clone of this instance. + +### .copy( source : Object3D, recursive : boolean ) : Object3D + +Copies the values of the given 3D object to this instance. + +**source** + +The 3D object to copy. + +**recursive** + +When set to `true`, descendants of the 3D object are cloned. + +Default is `true`. + +**Returns:** A reference to this instance. + +### .getObjectById( id : number ) : Object3D | undefined + +Searches through the 3D object and its children, starting with the 3D object itself, and returns the first with a matching ID. + +**id** + +The id. + +**Returns:** The found 3D object. Returns `undefined` if no 3D object has been found. + +### .getObjectByName( name : string ) : Object3D | undefined + +Searches through the 3D object and its children, starting with the 3D object itself, and returns the first with a matching name. + +**name** + +The name. + +**Returns:** The found 3D object. Returns `undefined` if no 3D object has been found. + +### .getObjectByProperty( name : string, value : any ) : Object3D | undefined + +Searches through the 3D object and its children, starting with the 3D object itself, and returns the first with a matching property value. + +**name** + +The name of the property. + +**value** + +The value. + +**Returns:** The found 3D object. Returns `undefined` if no 3D object has been found. + +### .getObjectsByProperty( name : string, value : any, result : Array. ) : Array. + +Searches through the 3D object and its children, starting with the 3D object itself, and returns all 3D objects with a matching property value. + +**name** + +The name of the property. + +**value** + +The value. + +**result** + +The method stores the result in this array. + +**Returns:** The found 3D objects. + +### .getWorldDirection( target : Vector3 ) : Vector3 + +Returns a vector representing the ("look") direction of the 3D object in world space. + +**target** + +The target vector the result is stored to. + +**Returns:** The 3D object's direction in world space. + +### .getWorldPosition( target : Vector3 ) : Vector3 + +Returns a vector representing the position of the 3D object in world space. + +**target** + +The target vector the result is stored to. + +**Returns:** The 3D object's position in world space. + +### .getWorldQuaternion( target : Quaternion ) : Quaternion + +Returns a Quaternion representing the position of the 3D object in world space. + +**target** + +The target Quaternion the result is stored to. + +**Returns:** The 3D object's rotation in world space. + +### .getWorldScale( target : Vector3 ) : Vector3 + +Returns a vector representing the scale of the 3D object in world space. + +**target** + +The target vector the result is stored to. + +**Returns:** The 3D object's scale in world space. + +### .localToWorld( vector : Vector3 ) : Vector3 + +Converts the given vector from this 3D object's local space to world space. + +**vector** + +The vector to convert. + +**Returns:** The converted vector. + +### .lookAt( x : number | Vector3, y : number, z : number ) + +Rotates the object to face a point in world space. + +This method does not support objects having non-uniformly-scaled parent(s). + +**x** + +The x coordinate in world space. Alternatively, a vector representing a position in world space + +**y** + +The y coordinate in world space. + +**z** + +The z coordinate in world space. + +### .onAfterRender( renderer : Renderer | WebGLRenderer, object : Object3D, camera : Camera, geometry : BufferGeometry, material : Material, group : Object ) + +A callback that is executed immediately after a 3D object is rendered. + +**renderer** + +The renderer. + +**object** + +The 3D object. + +**camera** + +The camera that is used to render the scene. + +**geometry** + +The 3D object's geometry. + +**material** + +The 3D object's material. + +**group** + +The geometry group data. + +### .onAfterShadow( renderer : Renderer | WebGLRenderer, object : Object3D, camera : Camera, shadowCamera : Camera, geometry : BufferGeometry, depthMaterial : Material, group : Object ) + +A callback that is executed immediately after a 3D object is rendered to a shadow map. + +**renderer** + +The renderer. + +**object** + +The 3D object. + +**camera** + +The camera that is used to render the scene. + +**shadowCamera** + +The shadow camera. + +**geometry** + +The 3D object's geometry. + +**depthMaterial** + +The depth material. + +**group** + +The geometry group data. + +### .onBeforeRender( renderer : Renderer | WebGLRenderer, object : Object3D, camera : Camera, geometry : BufferGeometry, material : Material, group : Object ) + +A callback that is executed immediately before a 3D object is rendered. + +**renderer** + +The renderer. + +**object** + +The 3D object. + +**camera** + +The camera that is used to render the scene. + +**geometry** + +The 3D object's geometry. + +**material** + +The 3D object's material. + +**group** + +The geometry group data. + +### .onBeforeShadow( renderer : Renderer | WebGLRenderer, object : Object3D, camera : Camera, shadowCamera : Camera, geometry : BufferGeometry, depthMaterial : Material, group : Object ) + +A callback that is executed immediately before a 3D object is rendered to a shadow map. + +**renderer** + +The renderer. + +**object** + +The 3D object. + +**camera** + +The camera that is used to render the scene. + +**shadowCamera** + +The shadow camera. + +**geometry** + +The 3D object's geometry. + +**depthMaterial** + +The depth material. + +**group** + +The geometry group data. + +### .raycast( raycaster : Raycaster, intersects : Array. ) (abstract) + +Abstract method to get intersections between a casted ray and this 3D object. Renderable 3D objects such as [Mesh](Mesh.html), [Line](Line.html) or [Points](Points.html) implement this method in order to use raycasting. + +**raycaster** + +The raycaster. + +**intersects** + +An array holding the result of the method. + +### .remove( object : Object3D ) : Object3D + +Removes the given 3D object as child from this 3D object. An arbitrary number of objects may be removed. + +**object** + +The 3D object to remove. + +##### Fires: + +* [Object3D#event:removed](Object3D.html#event:removed) +* [Object3D#event:childremoved](Object3D.html#event:childremoved) + +**Returns:** A reference to this instance. + +### .removeFromParent() : Object3D + +Removes this 3D object from its current parent. + +##### Fires: + +* [Object3D#event:removed](Object3D.html#event:removed) +* [Object3D#event:childremoved](Object3D.html#event:childremoved) + +**Returns:** A reference to this instance. + +### .rotateOnAxis( axis : Vector3, angle : number ) : Object3D + +Rotates the 3D object along an axis in local space. + +**axis** + +The (normalized) axis vector. + +**angle** + +The angle in radians. + +**Returns:** A reference to this instance. + +### .rotateOnWorldAxis( axis : Vector3, angle : number ) : Object3D + +Rotates the 3D object along an axis in world space. + +**axis** + +The (normalized) axis vector. + +**angle** + +The angle in radians. + +**Returns:** A reference to this instance. + +### .rotateX( angle : number ) : Object3D + +Rotates the 3D object around its X axis in local space. + +**angle** + +The angle in radians. + +**Returns:** A reference to this instance. + +### .rotateY( angle : number ) : Object3D + +Rotates the 3D object around its Y axis in local space. + +**angle** + +The angle in radians. + +**Returns:** A reference to this instance. + +### .rotateZ( angle : number ) : Object3D + +Rotates the 3D object around its Z axis in local space. + +**angle** + +The angle in radians. + +**Returns:** A reference to this instance. + +### .setRotationFromAxisAngle( axis : Vector3, angle : number ) + +Sets the given rotation represented as an axis/angle couple to the 3D object. + +**axis** + +The (normalized) axis vector. + +**angle** + +The angle in radians. + +### .setRotationFromEuler( euler : Euler ) + +Sets the given rotation represented as Euler angles to the 3D object. + +**euler** + +The Euler angles. + +### .setRotationFromMatrix( m : Matrix4 ) + +Sets the given rotation represented as rotation matrix to the 3D object. + +**m** + +Although a 4x4 matrix is expected, the upper 3x3 portion must be a pure rotation matrix (i.e, unscaled). + +### .setRotationFromQuaternion( q : Quaternion ) + +Sets the given rotation represented as a Quaternion to the 3D object. + +**q** + +The Quaternion + +### .toJSON( meta : Object | string ) : Object + +Serializes the 3D object into JSON. + +**meta** + +An optional value holding meta information about the serialization. + +See: + +* [ObjectLoader#parse](ObjectLoader.html#parse) + +**Returns:** A JSON object representing the serialized 3D object. + +### .translateOnAxis( axis : Vector3, distance : number ) : Object3D + +Translate the 3D object by a distance along the given axis in local space. + +**axis** + +The (normalized) axis vector. + +**distance** + +The distance in world units. + +**Returns:** A reference to this instance. + +### .translateX( distance : number ) : Object3D + +Translate the 3D object by a distance along its X-axis in local space. + +**distance** + +The distance in world units. + +**Returns:** A reference to this instance. + +### .translateY( distance : number ) : Object3D + +Translate the 3D object by a distance along its Y-axis in local space. + +**distance** + +The distance in world units. + +**Returns:** A reference to this instance. + +### .translateZ( distance : number ) : Object3D + +Translate the 3D object by a distance along its Z-axis in local space. + +**distance** + +The distance in world units. + +**Returns:** A reference to this instance. + +### .traverse( callback : function ) + +Executes the callback on this 3D object and all descendants. + +Note: Modifying the scene graph inside the callback is discouraged. + +**callback** + +A callback function that allows to process the current 3D object. + +### .traverseAncestors( callback : function ) + +Like [Object3D#traverse](Object3D.html#traverse), but the callback will only be executed for all ancestors. + +Note: Modifying the scene graph inside the callback is discouraged. + +**callback** + +A callback function that allows to process the current 3D object. + +### .traverseVisible( callback : function ) + +Like [Object3D#traverse](Object3D.html#traverse), but the callback will only be executed for visible 3D objects. Descendants of invisible 3D objects are not traversed. + +Note: Modifying the scene graph inside the callback is discouraged. + +**callback** + +A callback function that allows to process the current 3D object. + +### .updateMatrix() + +Updates the transformation matrix in local space by computing it from the current position, rotation and scale values. + +### .updateMatrixWorld( force : boolean ) + +Updates the transformation matrix in world space of this 3D objects and its descendants. + +To ensure correct results, this method also recomputes the 3D object's transformation matrix in local space. The computation of the local and world matrix can be controlled with the [Object3D#matrixAutoUpdate](Object3D.html#matrixAutoUpdate) and [Object3D#matrixWorldAutoUpdate](Object3D.html#matrixWorldAutoUpdate) flags which are both `true` by default. Set these flags to `false` if you need more control over the update matrix process. + +**force** + +When set to `true`, a recomputation of world matrices is forced even when [Object3D#matrixWorldAutoUpdate](Object3D.html#matrixWorldAutoUpdate) is set to `false`. + +Default is `false`. + +### .updateWorldMatrix( updateParents : boolean, updateChildren : boolean ) + +An alternative version of [Object3D#updateMatrixWorld](Object3D.html#updateMatrixWorld) with more control over the update of ancestor and descendant nodes. + +**updateParents** + +Whether ancestor nodes should be updated or not. + +Default is `false`. + +**updateChildren** + +Whether descendant nodes should be updated or not. + +Default is `false`. + +### .worldToLocal( vector : Vector3 ) : Vector3 + +Converts the given vector from this 3D object's word space to local space. + +**vector** + +The vector to convert. + +**Returns:** The converted vector. + +## Events + +### .added + +Fires when the object has been added to its parent object. + +##### Type: + +* Object + +### .childadded + +Fires when a new child object has been added. + +##### Type: + +* Object + +### .childremoved + +Fires when a child object has been removed. + +##### Type: + +* Object + +### .removed + +Fires when the object has been removed from its parent object. + +##### Type: + +* Object + +## Source + +[src/core/Object3D.js](https://github.com/mrdoob/three.js/blob/master/src/core/Object3D.js) \ No newline at end of file diff --git a/docs/pages/Object3DNode.html.md b/docs/pages/Object3DNode.html.md new file mode 100644 index 00000000000000..8851e7a8fa73c7 --- /dev/null +++ b/docs/pages/Object3DNode.html.md @@ -0,0 +1,87 @@ +*Inheritance: EventDispatcher → Node →* + +# Object3DNode + +This node can be used to access transformation related metrics of 3D objects. Depending on the selected scope, a different metric is represented as a uniform in the shader. The following scopes are supported: + +* `POSITION`: The object's position in world space. +* `VIEW_POSITION`: The object's position in view/camera space. +* `DIRECTION`: The object's direction in world space. +* `SCALE`: The object's scale in world space. +* `WORLD_MATRIX`: The object's matrix in world space. + +## Constructor + +### new Object3DNode( scope : 'position' | 'viewPosition' | 'direction' | 'scale' | 'worldMatrix', object3d : Object3D ) + +Constructs a new object 3D node. + +**scope** + +The node represents a different type of transformation depending on the scope. + +**object3d** + +The 3D object. + +Default is `null`. + +## Properties + +### .object3d : Object3D + +The 3D object. + +Default is `null`. + +### .scope : 'position' | 'viewPosition' | 'direction' | 'scale' | 'worldMatrix' + +The node reports a different type of transformation depending on the scope. + +### .uniformNode : UniformNode + +Holds the value of the node as a uniform. + +### .updateType : string + +Overwritten since this type of node is updated per object. + +Default is `'object'`. + +**Overrides:** [Node#updateType](Node.html#updateType) + +## Methods + +### .generate( builder : NodeBuilder ) : string + +Generates the code snippet of the uniform node. The node type of the uniform node also depends on the selected scope. + +**builder** + +The current node builder. + +**Overrides:** [Node#generate](Node.html#generate) + +**Returns:** The generated code snippet. + +### .getNodeType() : 'mat4' | 'vec3' | 'float' + +Overwritten since the node type is inferred from the scope. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .update( frame : NodeFrame ) + +Updates the uniform value depending on the scope. + +**frame** + +The current node frame. + +**Overrides:** [Node#update](Node.html#update) + +## Source + +[src/nodes/accessors/Object3DNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/Object3DNode.js) \ No newline at end of file diff --git a/docs/pages/ObjectLoader.html.md b/docs/pages/ObjectLoader.html.md new file mode 100644 index 00000000000000..decff2bccd09c2 --- /dev/null +++ b/docs/pages/ObjectLoader.html.md @@ -0,0 +1,96 @@ +*Inheritance: Loader →* + +# ObjectLoader + +A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4). The files are internally loaded via [FileLoader](FileLoader.html). + +## Code Example + +```js +const loader = new THREE.ObjectLoader(); +const obj = await loader.loadAsync( 'models/json/example.json' ); +scene.add( obj ); +// Alternatively, to parse a previously loaded JSON structure +const object = await loader.parseAsync( a_json_object ); +scene.add( object ); +``` + +## Constructor + +### new ObjectLoader( manager : LoadingManager ) + +Constructs a new object loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and pass the loaded 3D object to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .loadAsync( url : string, onProgress : onProgressCallback ) : Promise. (async) + +Async version of [ObjectLoader#load](ObjectLoader.html#load). + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onProgress** + +Executed while the loading is in progress. + +**Overrides:** [Loader#loadAsync](Loader.html#loadAsync) + +**Returns:** A Promise that resolves with the loaded 3D object. + +### .parse( json : Object, onLoad : onLoad ) : Object3D + +Parses the given JSON. This is used internally by [ObjectLoader#load](ObjectLoader.html#load) but can also be used directly to parse a previously loaded JSON structure. + +**json** + +The serialized 3D object. + +**onLoad** + +Executed when all resources (e.g. textures) have been fully loaded. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed 3D object. + +### .parseAsync( json : Object ) : Promise. (async) + +Async version of [ObjectLoader#parse](ObjectLoader.html#parse). + +**json** + +The serialized 3D object. + +**Returns:** A Promise that resolves with the parsed 3D object. + +## Source + +[src/loaders/ObjectLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/ObjectLoader.js) \ No newline at end of file diff --git a/docs/pages/OctahedronGeometry.html.md b/docs/pages/OctahedronGeometry.html.md new file mode 100644 index 00000000000000..df8533e7fffd23 --- /dev/null +++ b/docs/pages/OctahedronGeometry.html.md @@ -0,0 +1,56 @@ +*Inheritance: EventDispatcher → BufferGeometry → PolyhedronGeometry →* + +# OctahedronGeometry + +A geometry class for representing an octahedron. + +## Code Example + +```js +const geometry = new THREE.OctahedronGeometry(); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const octahedron = new THREE.Mesh( geometry, material ); +scene.add( octahedron ); +``` + +## Constructor + +### new OctahedronGeometry( radius : number, detail : number ) + +Constructs a new octahedron geometry. + +**radius** + +Radius of the octahedron. + +Default is `1`. + +**detail** + +Setting this to a value greater than `0` adds vertices making it no longer a octahedron. + +Default is `0`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +**Overrides:** [PolyhedronGeometry#parameters](PolyhedronGeometry.html#parameters) + +## Static Methods + +### .fromJSON( data : Object ) : OctahedronGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/OctahedronGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/OctahedronGeometry.js) \ No newline at end of file diff --git a/docs/pages/Octree.html.md b/docs/pages/Octree.html.md new file mode 100644 index 00000000000000..cbfea0c817ddde --- /dev/null +++ b/docs/pages/Octree.html.md @@ -0,0 +1,242 @@ +# Octree + +An octree is a hierarchical tree data structure used to partition a three-dimensional space by recursively subdividing it into eight octants. + +This particular implementation can have up to sixteen levels and stores up to eight triangles in leaf nodes. + +`Octree` can be used in games to compute collision between the game world and colliders from the player or other dynamic 3D objects. + +## Code Example + +```js +const octree = new Octree().fromGraphNode( scene ); +const result = octree.capsuleIntersect( playerCollider ); // collision detection +``` + +## Import + +Octree is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Octree } from 'three/addons/math/Octree.js'; +``` + +## Constructor + +### new Octree( box : Box3 ) + +Constructs a new Octree. + +**box** + +The base box with enclose the entire Octree. + +## Properties + +### .bounds : Box3 + +The bounds of the Octree. Compared to [Octree#box](Octree.html#box), no margin is applied. + +### .box : Box3 + +The base box with enclose the entire Octree. + +### .layers : Layers + +Can by used for layers configuration for refine testing. + +### .maxLevel : number + +The maximum level of the Octree. It defines the maximum hierarchical depth of the data structure. + +Default is `16`. + +### .trianglesPerLeaf : number + +The number of triangles a leaf can store before it is split. + +Default is `8`. + +## Methods + +### .addTriangle( triangle : Triangle ) : Octree + +Adds the given triangle to the Octree. The triangle vertices are clamped if they exceed the bounds of the Octree. + +**triangle** + +The triangle to add. + +**Returns:** A reference to this Octree. + +### .boxIntersect( box : Box3 ) : Object | boolean + +Performs a bounding box intersection test with this Octree. + +**box** + +The bounding box to test. + +**Returns:** The intersection object. If no intersection is detected, the method returns `false`. + +### .build() : Octree + +Builds the Octree. + +**Returns:** A reference to this Octree. + +### .calcBox() : Octree + +Prepares [Octree#box](Octree.html#box) for the build. + +**Returns:** A reference to this Octree. + +### .capsuleIntersect( capsule : Capsule ) : Object | boolean + +Performs a capsule intersection test with this Octree. + +**capsule** + +The capsule to test. + +**Returns:** The intersection object. If no intersection is detected, the method returns `false`. + +### .clear() : Octree + +Clears the Octree by making it empty. + +**Returns:** A reference to this Octree. + +### .fromGraphNode( group : Object3D ) : Octree + +Constructs the Octree from the given 3D object. + +**group** + +The scene graph node. + +**Returns:** A reference to this Octree. + +### .getBoxTriangles( box : Box3, triangles : Array. ) + +Computes the triangles that potentially intersect with the given bounding box. + +**box** + +The bounding box. + +**triangles** + +The target array that holds the triangles. + +### .getCapsuleTriangles( capsule : Capsule, triangles : Array. ) + +Computes the triangles that potentially intersect with the given capsule. + +**capsule** + +The capsule to test. + +**triangles** + +The target array that holds the triangles. + +### .getRayTriangles( ray : Ray, triangles : Array. ) + +Computes the triangles that potentially intersect with the given ray. + +**ray** + +The ray to test. + +**triangles** + +The target array that holds the triangles. + +### .getSphereTriangles( sphere : Sphere, triangles : Array. ) + +Computes the triangles that potentially intersect with the given bounding sphere. + +**sphere** + +The sphere to test. + +**triangles** + +The target array that holds the triangles. + +### .rayIntersect( ray : Ray ) : Object | boolean + +Performs a ray intersection test with this Octree. + +**ray** + +The ray to test. + +**Returns:** The nearest intersection object. If no intersection is detected, the method returns `false`. + +### .sphereIntersect( sphere : Sphere ) : Object | boolean + +Performs a bounding sphere intersection test with this Octree. + +**sphere** + +The bounding sphere to test. + +**Returns:** The intersection object. If no intersection is detected, the method returns `false`. + +### .split( level : number ) : Octree + +Splits the Octree. This method is used recursively when building the Octree. + +**level** + +The current level. + +**Returns:** A reference to this Octree. + +### .triangleBoxIntersect( box : Box3, triangle : Triangle ) : Object | false + +Computes the intersection between the given bounding box and triangle. + +**box** + +The bounding box to test. + +**triangle** + +The triangle to test. + +**Returns:** The intersection object. If no intersection is detected, the method returns `false`. + +### .triangleCapsuleIntersect( capsule : Capsule, triangle : Triangle ) : Object | false + +Computes the intersection between the given capsule and triangle. + +**capsule** + +The capsule to test. + +**triangle** + +The triangle to test. + +**Returns:** The intersection object. If no intersection is detected, the method returns `false`. + +### .triangleSphereIntersect( sphere : Sphere, triangle : Triangle ) : Object | false + +Computes the intersection between the given sphere and triangle. + +**sphere** + +The sphere to test. + +**triangle** + +The triangle to test. + +**Returns:** The intersection object. If no intersection is detected, the method returns `false`. + +## Source + +[examples/jsm/math/Octree.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Octree.js) \ No newline at end of file diff --git a/docs/pages/OctreeHelper.html.md b/docs/pages/OctreeHelper.html.md new file mode 100644 index 00000000000000..6aedfc0ee798cf --- /dev/null +++ b/docs/pages/OctreeHelper.html.md @@ -0,0 +1,60 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# OctreeHelper + +A helper for visualizing an Octree. + +## Code Example + +```js +const helper = new OctreeHelper( octree ); +scene.add( helper ); +``` + +## Import + +OctreeHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OctreeHelper } from 'three/addons/helpers/OctreeHelper.js'; +``` + +## Constructor + +### new OctreeHelper( octree : Octree, color : number | Color | string ) + +Constructs a new Octree helper. + +**octree** + +The octree to visualize. + +**color** + +The helper's color. + +Default is `0xffff00`. + +## Properties + +### .color : number | Color | string + +The helper's color. + +### .octree : Octree + +The octree to visualize. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the helper. This method must be called whenever the Octree's structure is changed. + +## Source + +[examples/jsm/helpers/OctreeHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/OctreeHelper.js) \ No newline at end of file diff --git a/docs/pages/OculusHandModel.html.md b/docs/pages/OculusHandModel.html.md new file mode 100644 index 00000000000000..a9215e4347ecc4 --- /dev/null +++ b/docs/pages/OculusHandModel.html.md @@ -0,0 +1,119 @@ +*Inheritance: EventDispatcher → Object3D →* + +# OculusHandModel + +Represents an Oculus hand model. + +## Import + +OculusHandModel is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OculusHandModel } from 'three/addons/webxr/OculusHandModel.js'; +``` + +## Constructor + +### new OculusHandModel( controller : Group, loader : Loader, onLoad : function ) + +Constructs a new Oculus hand model. + +**controller** + +The hand controller. + +**loader** + +A loader that is used to load hand models. + +Default is `null`. + +**onLoad** + +A callback that is executed when a hand model has been loaded. + +Default is `null`. + +## Properties + +### .controller : Group + +The hand controller. + +### .envMap : Texture + +The model's environment map. + +Default is `null`. + +### .loader : Loader + +A loader that is used to load hand models. + +Default is `null`. + +### .mesh : Mesh + +The model mesh. + +Default is `null`. + +### .motionController : MotionController + +The motion controller. + +Default is `null`. + +### .onLoad : function + +A callback that is executed when a hand model has been loaded. + +Default is `null`. + +### .path : string + +The path to the model repository. + +Default is `null`. + +## Methods + +### .checkButton( button : Object ) + +Executed actions depending on the interaction state with the given button. + +**button** + +The button. + +### .getPointerPosition() : Vector3 + +Returns the pointer position which is the position of the index finger tip. + +**Returns:** The pointer position. Returns `null` if not index finger tip joint was found. + +### .intersectBoxObject( boxObject : Mesh ) : boolean + +Returns `true` if the current pointer position (the index finger tip) intersections with the given box object. + +**boxObject** + +The box object. + +**Returns:** Whether an intersection was found or not. + +### .updateMatrixWorld( force : boolean ) + +Overwritten with a custom implementation. Makes sure the motion controller updates the mesh. + +**force** + +When set to `true`, a recomputation of world matrices is forced even when [Object3D#matrixWorldAutoUpdate](Object3D.html#matrixWorldAutoUpdate) is set to `false`. + +Default is `false`. + +**Overrides:** [Object3D#updateMatrixWorld](Object3D.html#updateMatrixWorld) + +## Source + +[examples/jsm/webxr/OculusHandModel.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/OculusHandModel.js) \ No newline at end of file diff --git a/docs/pages/OculusHandPointerModel.html.md b/docs/pages/OculusHandPointerModel.html.md new file mode 100644 index 00000000000000..cab53cfdd2e8b2 --- /dev/null +++ b/docs/pages/OculusHandPointerModel.html.md @@ -0,0 +1,179 @@ +*Inheritance: EventDispatcher → Object3D →* + +# OculusHandPointerModel + +Represents an Oculus hand pointer model. + +## Import + +OculusHandPointerModel is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OculusHandPointerModel } from 'three/addons/webxr/OculusHandPointerModel.js'; +``` + +## Constructor + +### new OculusHandPointerModel( hand : Group, controller : Group ) + +Constructs a new Oculus hand model. + +**hand** + +The hand controller. + +**controller** + +The WebXR controller in target ray space. + +## Properties + +### .attached : boolean + +Whether the model is attached or not. + +Default is `false`. + +### .controller : Group + +The WebXR controller in target ray space. + +### .cursorObject : Mesh + +The cursor object. + +Default is `null`. + +### .hand : Group + +The hand controller. + +### .pinched : boolean + +Whether the model is pinched or not. + +Default is `false`. + +### .pointerGeometry : BufferGeometry + +The pointer geometry. + +Default is `null`. + +### .pointerMesh : Mesh + +The pointer mesh. + +Default is `null`. + +### .pointerObject : Object3D + +The pointer object that holds the pointer mesh. + +Default is `null`. + +### .raycaster : Raycaster + +The internal raycaster used for detecting intersections. + +Default is `null`. + +## Methods + +### .checkIntersections( objects : Array., recursive : boolean ) + +Checks for intersections between the model's raycaster and the given objects. The method updates the cursor object to the intersection point. + +**objects** + +The 3D objects to check for intersection with the ray. + +**recursive** + +If set to `true`, it also checks all descendants. Otherwise it only checks intersection with the object. + +Default is `false`. + +### .createPointer() + +Creates a pointer mesh and adds it to this model. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .intersectObject( object : Object3D, recursive : boolean ) : Array. + +Performs an intersection test with the model's raycaster and the given object. + +**object** + +The 3D object to check for intersection with the ray. + +**recursive** + +If set to `true`, it also checks all descendants. Otherwise it only checks intersection with the object. + +Default is `true`. + +**Returns:** An array holding the intersection points. + +### .intersectObjects( objects : Array., recursive : boolean ) : Array. + +Performs an intersection test with the model's raycaster and the given objects. + +**objects** + +The 3D objects to check for intersection with the ray. + +**recursive** + +If set to `true`, it also checks all descendants. Otherwise it only checks intersection with the object. + +Default is `true`. + +**Returns:** An array holding the intersection points. + +### .isAttached() : boolean + +Returns `true` is the model is attached. + +**Returns:** Whether the model is attached or not. + +### .isPinched() : boolean + +Returns `true` is the model is pinched. + +**Returns:** Whether the model is pinched or not. + +### .setAttached( attached : boolean ) + +Sets the attached state. + +**attached** + +Whether the model is attached or not. + +### .setCursor( distance : number ) + +Sets the cursor to the given distance. + +**distance** + +The distance to set the cursor to. + +### .updateMatrixWorld( force : boolean ) + +Overwritten with a custom implementation. Makes sure the internal pointer and raycaster are updated. + +**force** + +When set to `true`, a recomputation of world matrices is forced even when [Object3D#matrixWorldAutoUpdate](Object3D.html#matrixWorldAutoUpdate) is set to `false`. + +Default is `false`. + +**Overrides:** [Object3D#updateMatrixWorld](Object3D.html#updateMatrixWorld) + +## Source + +[examples/jsm/webxr/OculusHandPointerModel.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/OculusHandPointerModel.js) \ No newline at end of file diff --git a/docs/pages/OperatorNode.html.md b/docs/pages/OperatorNode.html.md new file mode 100644 index 00000000000000..6b0c21f868b7ea --- /dev/null +++ b/docs/pages/OperatorNode.html.md @@ -0,0 +1,85 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# OperatorNode + +This node represents basic mathematical and logical operations like addition, subtraction or comparisons (e.g. `equal()`). + +## Constructor + +### new OperatorNode( op : string, aNode : Node, bNode : Node, …params : Node ) + +Constructs a new operator node. + +**op** + +The operator. + +**aNode** + +The first input. + +**bNode** + +The second input. + +**params** + +Additional input parameters. + +## Properties + +### .aNode : Node + +The first input. + +### .bNode : Node + +The second input. + +### .isOperatorNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .op : string + +The operator. + +## Methods + +### .getNodeType( builder : NodeBuilder, output : string ) : string + +This method is overwritten since the node type is inferred from the operator and the input node types. + +**builder** + +The current node builder. + +**output** + +The output type. + +Default is `null`. + +**Overrides:** [TempNode#getNodeType](TempNode.html#getNodeType) + +**Returns:** The node type. + +### .getOperatorMethod( builder : NodeBuilder, output : string ) : string + +Returns the operator method name. + +**builder** + +The current node builder. + +**output** + +The output type. + +**Returns:** The operator method name. + +## Source + +[src/nodes/math/OperatorNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/math/OperatorNode.js) \ No newline at end of file diff --git a/docs/pages/OrbitControls.html.md b/docs/pages/OrbitControls.html.md new file mode 100644 index 00000000000000..519b02ef55cc02 --- /dev/null +++ b/docs/pages/OrbitControls.html.md @@ -0,0 +1,335 @@ +*Inheritance: EventDispatcher → Controls →* + +# OrbitControls + +Orbit controls allow the camera to orbit around a target. + +OrbitControls performs orbiting, dollying (zooming), and panning. Unlike [TrackballControls](TrackballControls.html), it maintains the "up" direction `object.up` (+Y by default). + +* Orbit: Left mouse / touch: one-finger move. +* Zoom: Middle mouse, or mousewheel / touch: two-finger spread or squish. +* Pan: Right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move. + +## Code Example + +```js +const controls = new OrbitControls( camera, renderer.domElement ); +// controls.update() must be called after any manual changes to the camera's transform +camera.position.set( 0, 20, 100 ); +controls.update(); +function animate() { + // required if controls.enableDamping or controls.autoRotate are set to true + controls.update(); + renderer.render( scene, camera ); +} +``` + +## Import + +OrbitControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +``` + +## Constructor + +### new OrbitControls( object : Object3D, domElement : HTMLElement ) + +Constructs a new controls instance. + +**object** + +The object that is managed by the controls. + +**domElement** + +The HTML element used for event listeners. + +Default is `null`. + +## Properties + +### .autoRotate : boolean + +Set to true to automatically rotate around the target + +Note that if this is enabled, you must call `update()` in your animation loop. If you want the auto-rotate speed to be independent of the frame rate (the refresh rate of the display), you must pass the time `deltaTime`, in seconds, to `update()`. + +Default is `false`. + +### .autoRotateSpeed : number + +How fast to rotate around the target if `autoRotate` is `true`. The default equates to 30 seconds per orbit at 60fps. + +Note that if `autoRotate` is enabled, you must call `update()` in your animation loop. + +Default is `2`. + +### .cursor : Vector3 + +The focus point of the `minTargetRadius` and `maxTargetRadius` limits. It can be updated manually at any point to change the center of interest for the `target`. + +### .dampingFactor : number + +The damping inertia used if `enableDamping` is set to `true`. + +Note that for this to work, you must call `update()` in your animation loop. + +Default is `0.05`. + +### .enableDamping : boolean + +Set to `true` to enable damping (inertia), which can be used to give a sense of weight to the controls. Note that if this is enabled, you must call `update()` in your animation loop. + +Default is `false`. + +### .enablePan : boolean + +Enable or disable camera panning. + +Default is `true`. + +### .enableRotate : boolean + +Enable or disable horizontal and vertical rotation of the camera. + +Note that it is possible to disable a single axis by setting the min and max of the `minPolarAngle` or `minAzimuthAngle` to the same value, which will cause the vertical or horizontal rotation to be fixed at that value. + +Default is `true`. + +### .enableZoom : boolean + +Enable or disable zooming (dollying) of the camera. + +Default is `true`. + +### .keyPanSpeed : number + +How fast to pan the camera when the keyboard is used in pixels per keypress. + +Default is `7`. + +### .keyRotateSpeed : number + +How fast to rotate the camera when the keyboard is used. + +Default is `1`. + +### .keys : Object + +This object contains references to the keycodes for controlling camera panning. + +```js +controls.keys = { + LEFT: 'ArrowLeft', //left arrow + UP: 'ArrowUp', // up arrow + RIGHT: 'ArrowRight', // right arrow + BOTTOM: 'ArrowDown' // down arrow +} +``` + +**Overrides:** [Controls#keys](Controls.html#keys) + +### .maxAzimuthAngle : number + +How far you can orbit horizontally, upper limit. If set, the interval `[ min, max ]` must be a sub-interval of `[ - 2 PI, 2 PI ]`, with `( max - min < 2 PI )`. + +Default is `-Infinity`. + +### .maxDistance : number + +How far you can dolly out (perspective camera only). + +Default is `Infinity`. + +### .maxPolarAngle : number + +How far you can orbit vertically, upper limit. Range is `[0, Math.PI]` radians. + +Default is `Math.PI`. + +### .maxTargetRadius : number + +How far you can move the target from the 3D `cursor`. + +Default is `Infinity`. + +### .maxZoom : number + +How far you can zoom out (orthographic camera only). + +Default is `Infinity`. + +### .minAzimuthAngle : number + +How far you can orbit horizontally, lower limit. If set, the interval `[ min, max ]` must be a sub-interval of `[ - 2 PI, 2 PI ]`, with `( max - min < 2 PI )`. + +Default is `-Infinity`. + +### .minDistance : number + +How far you can dolly in (perspective camera only). + +Default is `0`. + +### .minPolarAngle : number + +How far you can orbit vertically, lower limit. Range is `[0, Math.PI]` radians. + +Default is `0`. + +### .minTargetRadius : number + +How close you can get the target to the 3D `cursor`. + +Default is `0`. + +### .minZoom : number + +How far you can zoom in (orthographic camera only). + +Default is `0`. + +### .mouseButtons : Object + +This object contains references to the mouse actions used by the controls. + +```js +controls.mouseButtons = { + LEFT: THREE.MOUSE.ROTATE, + MIDDLE: THREE.MOUSE.DOLLY, + RIGHT: THREE.MOUSE.PAN +} +``` + +**Overrides:** [Controls#mouseButtons](Controls.html#mouseButtons) + +### .panSpeed : number + +Speed of panning. + +Default is `1`. + +### .position0 : Vector3 + +Used internally by `saveState()` and `reset()`. + +### .rotateSpeed : number + +Speed of rotation. + +Default is `1`. + +### .screenSpacePanning : boolean + +Defines how the camera's position is translated when panning. If `true`, the camera pans in screen space. Otherwise, the camera pans in the plane orthogonal to the camera's up direction. + +Default is `true`. + +### .target : Vector3 + +The focus point of the controls, the `object` orbits around this. It can be updated manually at any point to change the focus of the controls. + +### .target0 : Vector3 + +Used internally by `saveState()` and `reset()`. + +### .touches : Object + +This object contains references to the touch actions used by the controls. + +```js +controls.mouseButtons = { + ONE: THREE.TOUCH.ROTATE, + TWO: THREE.TOUCH.DOLLY_PAN +} +``` + +**Overrides:** [Controls#touches](Controls.html#touches) + +### .zoom0 : number + +Used internally by `saveState()` and `reset()`. + +### .zoomSpeed : number + +Speed of zooming / dollying. + +Default is `1`. + +### .zoomToCursor : boolean + +Setting this property to `true` allows to zoom to the cursor's position. + +Default is `false`. + +## Methods + +### .getAzimuthalAngle() : number + +Get the current horizontal rotation, in radians. + +**Returns:** The current horizontal rotation, in radians. + +### .getDistance() : number + +Returns the distance from the camera to the target. + +**Returns:** The distance from the camera to the target. + +### .getPolarAngle() : number + +Get the current vertical rotation, in radians. + +**Returns:** The current vertical rotation, in radians. + +### .listenToKeyEvents( domElement : HTMLElement ) + +Adds key event listeners to the given DOM element. `window` is a recommended argument for using this method. + +**domElement** + +The DOM element + +### .reset() + +Reset the controls to their state from either the last time the `saveState()` was called, or the initial state. + +### .saveState() + +Save the current state of the controls. This can later be recovered with `reset()`. + +### .stopListenToKeyEvents() + +Removes the key event listener previously defined with `listenToKeyEvents()`. + +## Events + +### .change + +Fires when the camera has been transformed by the controls. + +##### Type: + +* Object + +### .end + +Fires when an interaction has finished. + +##### Type: + +* Object + +### .start + +Fires when an interaction was initiated. + +##### Type: + +* Object + +## Source + +[examples/jsm/controls/OrbitControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/OrbitControls.js) \ No newline at end of file diff --git a/docs/pages/OrthographicCamera.html.md b/docs/pages/OrthographicCamera.html.md new file mode 100644 index 00000000000000..12bc4c00e7317c --- /dev/null +++ b/docs/pages/OrthographicCamera.html.md @@ -0,0 +1,160 @@ +*Inheritance: EventDispatcher → Object3D → Camera →* + +# OrthographicCamera + +Camera that uses [orthographic projection](https://en.wikipedia.org/wiki/Orthographic_projection). + +In this projection mode, an object's size in the rendered image stays constant regardless of its distance from the camera. This can be useful for rendering 2D scenes and UI elements, amongst other things. + +## Code Example + +```js +const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 ); +scene.add( camera ); +``` + +## Constructor + +### new OrthographicCamera( left : number, right : number, top : number, bottom : number, near : number, far : number ) + +Constructs a new orthographic camera. + +**left** + +The left plane of the camera's frustum. + +Default is `-1`. + +**right** + +The right plane of the camera's frustum. + +Default is `1`. + +**top** + +The top plane of the camera's frustum. + +Default is `1`. + +**bottom** + +The bottom plane of the camera's frustum. + +Default is `-1`. + +**near** + +The camera's near plane. + +Default is `0.1`. + +**far** + +The camera's far plane. + +Default is `2000`. + +## Properties + +### .bottom : number + +The bottom plane of the camera's frustum. + +Default is `-1`. + +### .far : number + +The camera's far plane. Must be greater than the current value of [OrthographicCamera#near](OrthographicCamera.html#near). + +Default is `2000`. + +### .isOrthographicCamera : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .left : number + +The left plane of the camera's frustum. + +Default is `-1`. + +### .near : number + +The camera's near plane. The valid range is greater than `0` and less than the current value of [OrthographicCamera#far](OrthographicCamera.html#far). + +Note that, unlike for the [PerspectiveCamera](PerspectiveCamera.html), `0` is a valid value for an orthographic camera's near plane. + +Default is `0.1`. + +### .right : number + +The right plane of the camera's frustum. + +Default is `1`. + +### .top : number + +The top plane of the camera's frustum. + +Default is `1`. + +### .view : Object + +Represents the frustum window specification. This property should not be edited directly but via [PerspectiveCamera#setViewOffset](PerspectiveCamera.html#setViewOffset) and [PerspectiveCamera#clearViewOffset](PerspectiveCamera.html#clearViewOffset). + +Default is `null`. + +### .zoom : number + +The zoom factor of the camera. + +Default is `1`. + +## Methods + +### .clearViewOffset() + +Removes the view offset from the projection matrix. + +### .setViewOffset( fullWidth : number, fullHeight : number, x : number, y : number, width : number, height : number ) + +Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups. + +**fullWidth** + +The full width of multiview setup. + +**fullHeight** + +The full height of multiview setup. + +**x** + +The horizontal offset of the subcamera. + +**y** + +The vertical offset of the subcamera. + +**width** + +The width of subcamera. + +**height** + +The height of subcamera. + +See: + +* [PerspectiveCamera#setViewOffset](PerspectiveCamera.html#setViewOffset) + +### .updateProjectionMatrix() + +Updates the camera's projection matrix. Must be called after any change of camera properties. + +## Source + +[src/cameras/OrthographicCamera.js](https://github.com/mrdoob/three.js/blob/master/src/cameras/OrthographicCamera.js) \ No newline at end of file diff --git a/docs/pages/OutlineEffect.html.md b/docs/pages/OutlineEffect.html.md new file mode 100644 index 00000000000000..cd9e4ff499d64f --- /dev/null +++ b/docs/pages/OutlineEffect.html.md @@ -0,0 +1,126 @@ +# OutlineEffect + +An outline effect for toon shaders. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [ToonOutlinePassNode](ToonOutlinePassNode.html). + +## Code Example + +```js +const effect = new OutlineEffect( renderer ); +function render() { + effect.render( scene, camera ); +} +``` + +## Import + +OutlineEffect is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OutlineEffect } from 'three/addons/effects/OutlineEffect.js'; +``` + +## Constructor + +### new OutlineEffect( renderer : WebGLRenderer, parameters : OutlineEffect~Options ) + +Constructs a new outline effect. + +**renderer** + +The renderer. + +**parameters** + +The configuration parameter. + +## Methods + +### .render( scene : Object3D, camera : Camera ) + +When using this effect, this method should be called instead of the default [WebGLRenderer#render](WebGLRenderer.html#render). + +**scene** + +The scene to render. + +**camera** + +The camera. + +### .renderOutline( scene : Object3D, camera : Camera ) + +This method can be used to render outlines in VR. + +```js +const effect = new OutlineEffect( renderer ); +let renderingOutline = false; +scene.onAfterRender = function () { + if ( renderingOutline ) return; + renderingOutline = true; + effect.renderOutline( scene, camera ); + renderingOutline = false; +}; +function render() { + renderer.render( scene, camera ); +} +``` + +**scene** + +The scene to render. + +**camera** + +The camera. + +### .setSize( width : number, height : number ) + +Resizes the effect. + +**width** + +The width of the effect in logical pixels. + +**height** + +The height of the effect in logical pixels. + +## Type Definitions + +### .Options + +This type represents configuration settings of `OutlineEffect`. + +**defaultThickness** +number + +The outline thickness. + +Default is `0.003`. + +**defaultColor** +Array. + +The outline color. + +Default is `[0,0,0]`. + +**defaultAlpha** +number + +The outline alpha value. + +Default is `1`. + +**defaultKeepAlive** +boolean + +Whether to keep alive cached internal materials or not. + +Default is `false`. + +## Source + +[examples/jsm/effects/OutlineEffect.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/effects/OutlineEffect.js) \ No newline at end of file diff --git a/docs/pages/OutlineNode.html.md b/docs/pages/OutlineNode.html.md new file mode 100644 index 00000000000000..cb404e800a6ea9 --- /dev/null +++ b/docs/pages/OutlineNode.html.md @@ -0,0 +1,169 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# OutlineNode + +Post processing node for rendering outlines around selected objects. The node gives you great flexibility in composing the final outline look depending on your requirements. + +## Code Example + +```js +const postProcessing = new THREE.PostProcessing( renderer ); +const scenePass = pass( scene, camera ); +// outline parameter +const edgeStrength = uniform( 3.0 ); +const edgeGlow = uniform( 0.0 ); +const edgeThickness = uniform( 1.0 ); +const visibleEdgeColor = uniform( new THREE.Color( 0xffffff ) ); +const hiddenEdgeColor = uniform( new THREE.Color( 0x4e3636 ) ); +outlinePass = outline( scene, camera, { + selectedObjects, + edgeGlow, + edgeThickness +} ); +// compose custom outline +const { visibleEdge, hiddenEdge } = outlinePass; +const outlineColor = visibleEdge.mul( visibleEdgeColor ).add( hiddenEdge.mul( hiddenEdgeColor ) ).mul( edgeStrength ); +postProcessing.outputNode = outlineColor.add( scenePass ); +``` + +## Import + +OutlineNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { outline } from 'three/addons/tsl/display/OutlineNode.js'; +``` + +## Constructor + +### new OutlineNode( scene : Scene, camera : Camera, params : Object ) + +Constructs a new outline node. + +**scene** + +A reference to the scene. + +**camera** + +The camera the scene is rendered with. + +**params** + +The configuration parameters. + +**selectedObjects** + +An array of selected objects. + +**edgeThickness** + +The thickness of the edges. + +Default is `float(1)`. + +**edgeGlow** + +Can be used for an animated glow/pulse effects. + +Default is `float(0)`. + +**downSampleRatio** + +The downsample ratio. + +Default is `2`. + +## Properties + +### .camera : Camera + +The camera the scene is rendered with. + +### .downSampleRatio : number + +The downsample ratio. + +Default is `2`. + +### .edgeGlowNode : Node. + +Can be used for an animated glow/pulse effect. + +### .edgeThicknessNode : Node. + +The thickness of the edges. + +### .hiddenEdge + +A mask value that represents the hidden edge. + +### .scene : Scene + +A reference to the scene. + +### .selectedObjects : Array. + +An array of selected objects. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +### .visibleEdge + +A mask value that represents the visible edge. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/OutlineNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/OutlineNode.js) \ No newline at end of file diff --git a/docs/pages/OutlinePass.html.md b/docs/pages/OutlinePass.html.md new file mode 100644 index 00000000000000..6924297c13fe7f --- /dev/null +++ b/docs/pages/OutlinePass.html.md @@ -0,0 +1,169 @@ +*Inheritance: Pass →* + +# OutlinePass + +A pass for rendering outlines around selected objects. + +## Code Example + +```js +const resolution = new THREE.Vector2( window.innerWidth, window.innerHeight ); +const outlinePass = new OutlinePass( resolution, scene, camera ); +composer.addPass( outlinePass ); +``` + +## Import + +OutlinePass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js'; +``` + +## Constructor + +### new OutlinePass( resolution : Vector2, scene : Scene, camera : Camera, selectedObjects : Array. ) + +Constructs a new outline pass. + +**resolution** + +The effect's resolution. + +**scene** + +The scene to render. + +**camera** + +The camera. + +**selectedObjects** + +The selected 3D objects that should receive an outline. + +## Properties + +### .downSampleRatio : number + +The downsample ratio. The effect can be rendered in a much lower resolution than the beauty pass. + +Default is `2`. + +### .edgeGlow : number + +Can be used for an animated glow/pulse effect. + +Default is `0`. + +### .edgeStrength : number + +The edge strength. + +Default is `3`. + +### .edgeThickness : number + +The edge thickness. + +Default is `1`. + +### .hiddenEdgeColor : Color + +The hidden edge color. + +Default is `(0.1,0.04,0.02)`. + +### .patternTexture : Texture + +Can be used to highlight selected 3D objects. Requires to set [OutlinePass#usePatternTexture](OutlinePass.html#usePatternTexture) to `true`. + +Default is `null`. + +### .pulsePeriod : number + +The pulse period. + +Default is `0`. + +### .renderCamera : Object + +The camera. + +### .renderScene : Object + +The scene to render. + +### .resolution : Vector2 + +The effect's resolution. + +Default is `(256,256)`. + +### .selectedObjects : Array. + +The selected 3D objects that should receive an outline. + +### .usePatternTexture : boolean + +Whether to use a pattern texture for to highlight selected 3D objects or not. + +Default is `false`. + +### .visibleEdgeColor : Color + +The visible edge color. + +Default is `(1,1,1)`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the Outline pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/OutlinePass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/OutlinePass.js) \ No newline at end of file diff --git a/docs/pages/OutputPass.html.md b/docs/pages/OutputPass.html.md new file mode 100644 index 00000000000000..74bbbeabf35208 --- /dev/null +++ b/docs/pages/OutputPass.html.md @@ -0,0 +1,82 @@ +*Inheritance: Pass →* + +# OutputPass + +This pass is responsible for including tone mapping and color space conversion into your pass chain. In most cases, this pass should be included at the end of each pass chain. If a pass requires sRGB input (e.g. like FXAA), the pass must follow `OutputPass` in the pass chain. + +The tone mapping and color space settings are extracted from the renderer. + +## Code Example + +```js +const outputPass = new OutputPass(); +composer.addPass( outputPass ); +``` + +## Import + +OutputPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; +``` + +## Constructor + +### new OutputPass() + +Constructs a new output pass. + +## Properties + +### .isOutputPass : boolean (readonly) + +This flag indicates that this is an output pass. + +Default is `true`. + +### .material : RawShaderMaterial + +The pass material. + +### .uniforms : Object + +The pass uniforms. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the output pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/OutputPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/OutputPass.js) \ No newline at end of file diff --git a/docs/pages/OutputStructNode.html.md b/docs/pages/OutputStructNode.html.md new file mode 100644 index 00000000000000..c6530bdcd3172e --- /dev/null +++ b/docs/pages/OutputStructNode.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → Node →* + +# OutputStructNode + +This node can be used to define multiple outputs in a shader programs. + +## Constructor + +### new OutputStructNode( …members : Node ) + +Constructs a new output struct node. The constructor can be invoked with an arbitrary number of nodes representing the members. + +**members** + +A parameter list of nodes. + +## Properties + +### .isOutputStructNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .members : Array. + +An array of nodes which defines the output. + +## Source + +[src/nodes/core/OutputStructNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/OutputStructNode.js) \ No newline at end of file diff --git a/docs/pages/PCDLoader.html.md b/docs/pages/PCDLoader.html.md new file mode 100644 index 00000000000000..67f4a724291aa5 --- /dev/null +++ b/docs/pages/PCDLoader.html.md @@ -0,0 +1,89 @@ +*Inheritance: Loader →* + +# PCDLoader + +A loader for the Point Cloud Data (PCD) format. + +PCDLoader supports ASCII and (compressed) binary files as well as the following PCD fields: + +* x y z +* rgb +* normal\_x normal\_y normal\_z +* intensity +* label + +## Code Example + +```js +const loader = new PCDLoader(); +const points = await loader.loadAsync( './models/pcd/binary/Zaghetto.pcd' ); +points.geometry.center(); // optional +points.geometry.rotateX( Math.PI ); // optional +scene.add( points ); +``` + +## Import + +PCDLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { PCDLoader } from 'three/addons/loaders/PCDLoader.js'; +``` + +## Constructor + +### new PCDLoader( manager : LoadingManager ) + +Constructs a new PCD loader. + +**manager** + +The loading manager. + +## Properties + +### .littleEndian : boolean + +Whether to use little Endian or not. + +Default is `true`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded PCD asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : Points + +Parses the given PCD data and returns a point cloud. + +**data** + +The raw PCD data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed point cloud. + +## Source + +[examples/jsm/loaders/PCDLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js) \ No newline at end of file diff --git a/docs/pages/PDBLoader.html.md b/docs/pages/PDBLoader.html.md new file mode 100644 index 00000000000000..c1d1823c359d89 --- /dev/null +++ b/docs/pages/PDBLoader.html.md @@ -0,0 +1,75 @@ +*Inheritance: Loader →* + +# PDBLoader + +A loader for the PDB format. + +The [Protein Data Bank](https://en.wikipedia.org/wiki/Protein_Data_Bank_\(file_format\)) file format is a textual file describing the three-dimensional structures of molecules. + +## Code Example + +```js +const loader = new PDBLoader(); +const pdb = await loader.loadAsync( 'models/pdb/ethanol.pdb' ); +const geometryAtoms = pdb.geometryAtoms; +const geometryBonds = pdb.geometryBonds; +const json = pdb.json; +``` + +## Import + +PDBLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { PDBLoader } from 'three/addons/loaders/PDBLoader.js'; +``` + +## Constructor + +### new PDBLoader( manager : LoadingManager ) + +Constructs a new PDB loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded PDB asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string ) : Object + +Parses the given PDB data and returns an object holding the atoms and bond geometries as well as the raw atom data as JSON. + +**text** + +The raw PDB data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The result object. + +## Source + +[examples/jsm/loaders/PDBLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PDBLoader.js) \ No newline at end of file diff --git a/docs/pages/PLYExporter.html.md b/docs/pages/PLYExporter.html.md new file mode 100644 index 00000000000000..a8ea7379a088cd --- /dev/null +++ b/docs/pages/PLYExporter.html.md @@ -0,0 +1,83 @@ +# PLYExporter + +An exporter for PLY. + +PLY (Polygon or Stanford Triangle Format) is a file format for efficient delivery and loading of simple, static 3D content in a dense format. Both binary and ascii formats are supported. PLY can store vertex positions, colors, normals and uv coordinates. No textures or texture references are saved. + +## Code Example + +```js +const exporter = new PLYExporter(); +const data = exporter.parse( scene, options ); +``` + +## Import + +PLYExporter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { PLYExporter } from 'three/addons/exporters/PLYExporter.js'; +``` + +## Constructor + +### new PLYExporter() + +## Methods + +### .parse( object : Object3D, onDone : PLYExporter~OnDone, options : PLYExporter~Options ) : string | ArrayBuffer + +Parses the given 3D object and generates the PLY output. + +If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. + +**object** + +The 3D object to export. + +**onDone** + +A callback function that is executed when the export has finished. + +**options** + +The export options. + +**Returns:** The exported PLY. + +## Type Definitions + +### .OnDone( result : string | ArrayBuffer ) + +onDone callback of `PLYExporter`. + +**result** + +The generated PLY ascii or binary. + +### .Options + +Export options of `PLYExporter`. + +**binary** +boolean + +Whether to export in binary format or ASCII. + +Default is `false`. + +**excludeAttributes** +Array. + +Which properties to explicitly exclude from the exported PLY file. Valid values are `'color'`, `'normal'`, `'uv'`, and `'index'`. If triangle indices are excluded, then a point cloud is exported. + +**littleEndian** +boolean + +Whether the binary export uses little or big endian. + +Default is `false`. + +## Source + +[examples/jsm/exporters/PLYExporter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/PLYExporter.js) \ No newline at end of file diff --git a/docs/pages/PLYLoader.html.md b/docs/pages/PLYLoader.html.md new file mode 100644 index 00000000000000..d22947cd34c213 --- /dev/null +++ b/docs/pages/PLYLoader.html.md @@ -0,0 +1,105 @@ +*Inheritance: Loader →* + +# PLYLoader + +A loader for PLY the PLY format (known as the Polygon File Format or the Stanford Triangle Format). + +Limitations: + +* ASCII decoding assumes file is UTF-8. + +## Code Example + +```js +const loader = new PLYLoader(); +const geometry = await loader.loadAsync( './models/ply/ascii/dolphins.ply' ); +scene.add( new THREE.Mesh( geometry ) ); +``` + +## Import + +PLYLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; +``` + +## Constructor + +### new PLYLoader( manager : LoadingManager ) + +Constructs a new PLY loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded PLY asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : BufferGeometry + +Parses the given PLY data and returns the resulting geometry. + +**data** + +The raw PLY data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed geometry. + +### .setCustomPropertyNameMapping( mapping : Object ) + +Custom properties outside of the defaults for position, uv, normal and color attributes can be added using the setCustomPropertyNameMapping method. For example, the following maps the element properties “custom\_property\_a” and “custom\_property\_b” to an attribute “customAttribute” with an item size of 2. Attribute item sizes are set from the number of element properties in the property array. + +```js +loader.setCustomPropertyNameMapping( { + customAttribute: ['custom_property_a', 'custom_property_b'], +} ); +``` + +**mapping** + +The mapping dictionary. + +### .setPropertyNameMapping( mapping : Object ) + +Sets a property name mapping that maps default property names to custom ones. For example, the following maps the properties “diffuse\_(red|green|blue)” in the file to standard color names. + +```js +loader.setPropertyNameMapping( { + diffuse_red: 'red', + diffuse_green: 'green', + diffuse_blue: 'blue' +} ); +``` + +**mapping** + +The mapping dictionary. + +## Source + +[examples/jsm/loaders/PLYLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PLYLoader.js) \ No newline at end of file diff --git a/docs/pages/PMREMGenerator.html.md b/docs/pages/PMREMGenerator.html.md new file mode 100644 index 00000000000000..c19021c3a8a5f8 --- /dev/null +++ b/docs/pages/PMREMGenerator.html.md @@ -0,0 +1,111 @@ +# PMREMGenerator + +This class generates a Prefiltered, Mipmapped Radiance Environment Map (PMREM) from a cubeMap environment texture. This allows different levels of blur to be quickly accessed based on material roughness. It is packed into a special CubeUV format that allows us to perform custom interpolation so that we can support nonlinear formats such as RGBE. Unlike a traditional mipmap chain, it only goes down to the LOD\_MIN level (above), and then creates extra even more filtered 'mips' at the same LOD\_MIN resolution, associated with higher roughness levels. In this way we maintain resolution to smoothly interpolate diffuse lighting while limiting sampling computation. + +The prefiltering uses GGX VNDF (Visible Normal Distribution Function) importance sampling based on "Sampling the GGX Distribution of Visible Normals" (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF used in material rendering for physically-based image-based lighting. + +## Constructor + +### new PMREMGenerator( renderer : WebGLRenderer ) + +Constructs a new PMREM generator. + +**renderer** + +The renderer. + +## Methods + +### .compileCubemapShader() + +Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during your texture's network fetch for increased concurrency. + +### .compileEquirectangularShader() + +Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during your texture's network fetch for increased concurrency. + +### .dispose() + +Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, so you should not need more than one PMREMGenerator object. If you do, calling dispose() on one of them will cause any others to also become unusable. + +### .fromCubemap( cubemap : Texture, renderTarget : WebGLRenderTarget ) : WebGLRenderTarget + +Generates a PMREM from an cubemap texture, which can be either LDR or HDR. The ideal input cube size is 256 x 256, as this matches best with the 256 x 256 cubemap output. + +**cubemap** + +The cubemap texture to be converted. + +**renderTarget** + +The render target to use. + +Default is `null`. + +**Returns:** The resulting PMREM. + +### .fromEquirectangular( equirectangular : Texture, renderTarget : WebGLRenderTarget ) : WebGLRenderTarget + +Generates a PMREM from an equirectangular texture, which can be either LDR or HDR. The ideal input image size is 1k (1024 x 512), as this matches best with the 256 x 256 cubemap output. + +**equirectangular** + +The equirectangular texture to be converted. + +**renderTarget** + +The render target to use. + +Default is `null`. + +**Returns:** The resulting PMREM. + +### .fromScene( scene : Scene, sigma : number, near : number, far : number, options : Object ) : WebGLRenderTarget + +Generates a PMREM from a supplied Scene, which can be faster than using an image if networking bandwidth is low. Optional sigma specifies a blur radius in radians to be applied to the scene before PMREM generation. Optional near and far planes ensure the scene is rendered in its entirety. + +**scene** + +The scene to be captured. + +**sigma** + +The blur radius in radians. + +Default is `0`. + +**near** + +The near plane distance. + +Default is `0.1`. + +**far** + +The far plane distance. + +Default is `100`. + +**options** + +The configuration options. + +Default is `{}`. + +**size** + +The texture size of the PMREM. + +Default is `256`. + +**position** + +The position of the internal cube camera that renders the scene. + +Default is `origin`. + +**Returns:** The resulting PMREM. + +## Source + +[src/extras/PMREMGenerator.js](https://github.com/mrdoob/three.js/blob/master/src/extras/PMREMGenerator.js) \ No newline at end of file diff --git a/docs/pages/PMREMNode.html.md b/docs/pages/PMREMNode.html.md new file mode 100644 index 00000000000000..2ec64be8d19fd1 --- /dev/null +++ b/docs/pages/PMREMNode.html.md @@ -0,0 +1,70 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# PMREMNode + +This node represents a PMREM which is a special type of preprocessed environment map intended for PBR materials. + +## Code Example + +```js +const material = new MeshStandardNodeMaterial(); +material.envNode = pmremTexture( envMap ); +``` + +## Constructor + +### new PMREMNode( value : Texture, uvNode : Node., levelNode : Node. ) + +Constructs a new function overloading node. + +**value** + +The input texture. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +## Properties + +### .levelNode : Node. + +The level node. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.RENDER`. + +Default is `'render'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +### .uvNode : Node. + +The uv node. + +### .value : Texture + +The node's texture value. + +## Methods + +### .updateFromTexture( texture : Texture ) + +Uses the given PMREM texture to update internal values. + +**texture** + +The PMREM texture. + +## Source + +[src/nodes/pmrem/PMREMNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/pmrem/PMREMNode.js) \ No newline at end of file diff --git a/docs/pages/PVRLoader.html.md b/docs/pages/PVRLoader.html.md new file mode 100644 index 00000000000000..30aa4b8e7277ec --- /dev/null +++ b/docs/pages/PVRLoader.html.md @@ -0,0 +1,53 @@ +*Inheritance: Loader → CompressedTextureLoader →* + +# PVRLoader + +A loader for the PVRTC texture compression format. + +## Code Example + +```js +const loader = new PVRLoader(); +const map = loader.load( 'textures/compressed/disturb_4bpp_rgb.pvr' ); +map.colorSpace = THREE.SRGBColorSpace; // only for color textures +``` + +## Import + +PVRLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { PVRLoader } from 'three/addons/loaders/PVRLoader.js'; +``` + +## Constructor + +### new PVRLoader( manager : LoadingManager ) + +Constructs a new PVR loader. + +**manager** + +The loading manager. + +## Methods + +### .parse( buffer : ArrayBuffer, loadMipmaps : boolean ) : CompressedTextureLoader~TexData + +Parses the given PVRTC texture data. + +**buffer** + +The raw texture data. + +**loadMipmaps** + +Whether to load mipmaps or not. This option is not yet supported by the loader. + +**Overrides:** [CompressedTextureLoader#parse](CompressedTextureLoader.html#parse) + +**Returns:** An object representing the parsed texture data. + +## Source + +[examples/jsm/loaders/PVRLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PVRLoader.js) \ No newline at end of file diff --git a/docs/pages/PackFloatNode.html.md b/docs/pages/PackFloatNode.html.md new file mode 100644 index 00000000000000..c1c2ef35fa4a49 --- /dev/null +++ b/docs/pages/PackFloatNode.html.md @@ -0,0 +1,37 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# PackFloatNode + +This node represents an operation that packs floating-point values of a vector into an unsigned 32-bit integer + +## Constructor + +### new PackFloatNode( encoding : 'snorm' | 'unorm' | 'float16', vectorNode : Node ) + +**encoding** + +The numeric encoding that describes how the float values are mapped to the integer range. + +**vectorNode** + +The vector node to be packed + +## Properties + +### .encoding : string + +The numeric encoding. + +### .isPackFloatNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .vectorNode : Node + +The vector to be packed. + +## Source + +[src/nodes/math/PackFloatNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/math/PackFloatNode.js) \ No newline at end of file diff --git a/docs/pages/ParallaxBarrierEffect.html.md b/docs/pages/ParallaxBarrierEffect.html.md new file mode 100644 index 00000000000000..1853a43f51419f --- /dev/null +++ b/docs/pages/ParallaxBarrierEffect.html.md @@ -0,0 +1,57 @@ +# ParallaxBarrierEffect + +A class that creates an parallax barrier effect. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [ParallaxBarrierPassNode](ParallaxBarrierPassNode.html). + +## Import + +ParallaxBarrierEffect is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ParallaxBarrierEffect } from 'three/addons/effects/ParallaxBarrierEffect.js'; +``` + +## Constructor + +### new ParallaxBarrierEffect( renderer : WebGLRenderer ) + +Constructs a new parallax barrier effect. + +**renderer** + +The renderer. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +### .render( scene : Object3D, camera : Camera ) + +When using this effect, this method should be called instead of the default [WebGLRenderer#render](WebGLRenderer.html#render). + +**scene** + +The scene to render. + +**camera** + +The camera. + +### .setSize( width : number, height : number ) + +Resizes the effect. + +**width** + +The width of the effect in logical pixels. + +**height** + +The height of the effect in logical pixels. + +## Source + +[examples/jsm/effects/ParallaxBarrierEffect.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/effects/ParallaxBarrierEffect.js) \ No newline at end of file diff --git a/docs/pages/ParallaxBarrierPassNode.html.md b/docs/pages/ParallaxBarrierPassNode.html.md new file mode 100644 index 00000000000000..2baeabab85ef01 --- /dev/null +++ b/docs/pages/ParallaxBarrierPassNode.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → Node → TempNode → PassNode → StereoCompositePassNode →* + +# ParallaxBarrierPassNode + +A render pass node that creates a parallax barrier effect. + +## Import + +ParallaxBarrierPassNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { parallaxBarrierPass } from 'three/addons/tsl/display/ParallaxBarrierPassNode.js'; +``` + +## Constructor + +### new ParallaxBarrierPassNode( scene : Scene, camera : Camera ) + +Constructs a new parallax barrier pass node. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +## Properties + +### .isParallaxBarrierPassNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [StereoCompositePassNode#setup](StereoCompositePassNode.html#setup) + +## Source + +[examples/jsm/tsl/display/ParallaxBarrierPassNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/ParallaxBarrierPassNode.js) \ No newline at end of file diff --git a/docs/pages/ParameterNode.html.md b/docs/pages/ParameterNode.html.md new file mode 100644 index 00000000000000..46f98bdc643be2 --- /dev/null +++ b/docs/pages/ParameterNode.html.md @@ -0,0 +1,49 @@ +*Inheritance: EventDispatcher → Node → PropertyNode →* + +# ParameterNode + +Special version of [PropertyNode](PropertyNode.html) which is used for parameters. + +## Constructor + +### new ParameterNode( nodeType : string, name : string ) + +Constructs a new parameter node. + +**nodeType** + +The type of the node. + +**name** + +The name of the parameter in the shader. + +Default is `null`. + +## Properties + +### .isParameterNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .getMemberType( builder : NodeBuilder, name : string ) : string + +Gets the type of a member variable in the parameter node. + +**builder** + +The node builder. + +**name** + +The name of the member variable. + +**Overrides:** [PropertyNode#getMemberType](PropertyNode.html#getMemberType) + +## Source + +[src/nodes/core/ParameterNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/ParameterNode.js) \ No newline at end of file diff --git a/docs/pages/ParametricGeometry.html.md b/docs/pages/ParametricGeometry.html.md new file mode 100644 index 00000000000000..10967f14c8e5a8 --- /dev/null +++ b/docs/pages/ParametricGeometry.html.md @@ -0,0 +1,74 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# ParametricGeometry + +This class can be used to generate a geometry based on a parametric surface. + +Reference: [Mesh Generation with Python](https://prideout.net/blog/old/blog/index.html@p=44.html) + +## Code Example + +```js +const geometry = new THREE.ParametricGeometry( klein, 25, 25 ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +const klein = new THREE.Mesh( geometry, material ); +scene.add( klein ); +``` + +## Import + +ParametricGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js'; +``` + +## Constructor + +### new ParametricGeometry( func : ParametricGeometry~Func, slices : number, stacks : number ) + +Constructs a new parametric geometry. + +**func** + +The parametric function. Default is a function that generates a curved plane surface. + +**slices** + +The number of slices to use for the parametric function. + +Default is `8`. + +**stacks** + +The stacks of slices to use for the parametric function. + +Default is `8`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Type Definitions + +### .Func( u : number, v : number, target : Vector3 ) + +Parametric function definition of `ParametricGeometry`. + +**u** + +The `u` coordinate on the surface in the range `[0,1]`. + +**v** + +The `v` coordinate on the surface in the range `[0,1]`. + +**target** + +The target vector that is used to store the method's result. + +## Source + +[examples/jsm/geometries/ParametricGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/ParametricGeometry.js) \ No newline at end of file diff --git a/docs/pages/Pass.html.md b/docs/pages/Pass.html.md new file mode 100644 index 00000000000000..459b1604819573 --- /dev/null +++ b/docs/pages/Pass.html.md @@ -0,0 +1,97 @@ +# Pass + +Abstract base class for all post processing passes. + +This module is only relevant for post processing with [WebGLRenderer](WebGLRenderer.html). + +## Import + +Pass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Pass } from 'three/addons/postprocessing/Pass.js'; +``` + +## Constructor + +### new Pass() (abstract) + +Constructs a new pass. + +## Properties + +### .clear : boolean + +If set to `true`, the pass clears its buffer before rendering + +Default is `false`. + +### .enabled : boolean + +If set to `true`, the pass is processed by the composer. + +Default is `true`. + +### .isPass : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .needsSwap : boolean + +If set to `true`, the pass indicates to swap read and write buffer after rendering. + +Default is `true`. + +### .renderToScreen : boolean + +If set to `true`, the result of the pass is rendered to screen. The last pass in the composers pass chain gets automatically rendered to screen, no matter how this property is configured. + +Default is `false`. + +## Methods + +### .dispose() (abstract) + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) (abstract) + +This method holds the render logic of a pass. It must be implemented in all derived classes. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +### .setSize( width : number, height : number ) (abstract) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +## Source + +[examples/jsm/postprocessing/Pass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/Pass.js) \ No newline at end of file diff --git a/docs/pages/PassMultipleTextureNode.html.md b/docs/pages/PassMultipleTextureNode.html.md new file mode 100644 index 00000000000000..5066d00a718b50 --- /dev/null +++ b/docs/pages/PassMultipleTextureNode.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode → PassTextureNode →* + +# PassMultipleTextureNode + +An extension of `PassTextureNode` which allows to manage more than one internal texture. Relevant for the `getPreviousTexture()` related API. + +## Constructor + +### new PassMultipleTextureNode( passNode : PassNode, textureName : string, previousTexture : boolean ) + +Constructs a new pass texture node. + +**passNode** + +The pass node. + +**textureName** + +The output texture name. + +**previousTexture** + +Whether previous frame data should be used or not. + +Default is `false`. + +## Properties + +### .previousTexture : boolean + +Whether previous frame data should be used or not. + +### .textureName : string + +The output texture name. + +## Methods + +### .updateTexture() + +Updates the texture reference of this node. + +## Source + +[src/nodes/display/PassNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/PassNode.js) \ No newline at end of file diff --git a/docs/pages/PassNode.html.md b/docs/pages/PassNode.html.md new file mode 100644 index 00000000000000..f8a7a34724ce0b --- /dev/null +++ b/docs/pages/PassNode.html.md @@ -0,0 +1,335 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# PassNode + +Represents a render pass (sometimes called beauty pass) in context of post processing. This pass produces a render for the given scene and camera and can provide multiple outputs via MRT for further processing. + +## Code Example + +```js +const postProcessing = new PostProcessing( renderer ); +const scenePass = pass( scene, camera ); +postProcessing.outputNode = scenePass; +``` + +## Constructor + +### new PassNode( scope : 'color' | 'depth', scene : Scene, camera : Camera, options : Object ) + +Constructs a new pass node. + +**scope** + +The scope of the pass. The scope determines whether the node outputs color or depth. + +**scene** + +A reference to the scene. + +**camera** + +A reference to the camera. + +**options** + +Options for the internal render target. + +## Properties + +### .camera : Camera + +A reference to the camera. + +### .contextNode : ContextNode | null + +An optional global context for the pass. + +### .global : boolean + +This flag is used for global cache. + +Default is `true`. + +**Overrides:** [TempNode#global](TempNode.html#global) + +### .isPassNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .opaque : boolean + +Whether the pass is opaque. + +Default is `true`. + +### .options : Object + +Options for the internal render target. + +### .overrideMaterial : Material | null + +An optional override material for the pass. + +### .renderTarget : RenderTarget + +The pass's render target. + +### .scene : Scene + +A reference to the scene. + +### .scope : 'color' | 'depth' + +The scope of the pass. The scope determines whether the node outputs color or depth. + +### .transparent : boolean + +Whether the pass is transparent. + +Default is `false`. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders the scene once per frame in its [PassNode#updateBefore](PassNode.html#updateBefore) method. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +### .COLOR : 'color' + +### .DEPTH : 'depth' + +## Methods + +### .compileAsync( renderer : Renderer ) : Promise (async) + +Precompiles the pass. + +Note that this method must be called after the pass configuration is complete. So calls like `setMRT()` and `getTextureNode()` must proceed the precompilation. + +**renderer** + +The renderer. + +See: + +* [Renderer#compileAsync](Renderer.html#compileAsync) + +**Returns:** A Promise that resolves when the compile has been finished. + +### .dispose() + +Frees internal resources. Should be called when the node is no longer in use. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getLayers() : Layers + +Gets the current layer configuration of the pass. + +**Returns:** . + +### .getLinearDepthNode( name : string ) : Node + +Returns a linear depth node of this pass. + +**name** + +The output name to get the linear depth node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. + +Default is `'depth'`. + +**Returns:** The linear depth node. + +### .getMRT() : MRTNode + +Returns the current MRT node. + +**Returns:** The current MRT node. + +### .getPreviousTexture( name : string ) : Texture + +Returns the texture holding the data of the previous frame for the given output name. + +**name** + +The output name to get the texture for. + +**Returns:** The texture holding the data of the previous frame. + +### .getPreviousTextureNode( name : string ) : TextureNode + +Returns the previous texture node for the given output name. + +**name** + +The output name to get the previous texture node for. + +Default is `'output'`. + +**Returns:** The previous texture node. + +### .getResolution() : number + +Gets the current resolution of the pass. + +**Deprecated:** since r181. Use [\`getResolutionScale()\`](PassNode.html#getResolutionScale) instead. + +**Returns:** The current resolution. A value of `1` means full resolution. + +### .getResolutionScale() : number + +Gets the current resolution scale of the pass. + +**Returns:** The current resolution scale. A value of `1` means full resolution. + +### .getTexture( name : string ) : Texture + +Returns the texture for the given output name. + +**name** + +The output name to get the texture for. + +**Returns:** The texture. + +### .getTextureNode( name : string ) : TextureNode + +Returns the texture node for the given output name. + +**name** + +The output name to get the texture node for. + +Default is `'output'`. + +**Returns:** The texture node. + +### .getViewZNode( name : string ) : Node + +Returns a viewZ node of this pass. + +**name** + +The output name to get the viewZ node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. + +Default is `'depth'`. + +**Returns:** The viewZ node. + +### .setLayers( layers : Layers ) : PassNode + +Sets the layer configuration that should be used when rendering the pass. + +**layers** + +The layers object to set. + +**Returns:** A reference to this pass. + +### .setMRT( mrt : MRTNode ) : PassNode + +Sets the given MRT node to setup MRT for this pass. + +**mrt** + +The MRT object. + +**Returns:** A reference to this pass. + +### .setPixelRatio( pixelRatio : number ) + +Sets the pixel ratio the pass's render target and updates the size. + +**pixelRatio** + +The pixel ratio to set. + +### .setResolution( resolution : number ) : PassNode + +Sets the resolution for the pass. The resolution is a factor that is multiplied with the renderer's width and height. + +**resolution** + +The resolution to set. A value of `1` means full resolution. + +**Deprecated:** since r181. Use [\`setResolutionScale()\`](PassNode.html#setResolutionScale) instead. + +**Returns:** A reference to this pass. + +### .setResolutionScale( resolutionScale : number ) : PassNode + +Sets the resolution scale for the pass. The resolution scale is a factor that is multiplied with the renderer's width and height. + +**resolutionScale** + +The resolution scale to set. A value of `1` means full resolution. + +**Returns:** A reference to this pass. + +### .setScissor( x : number | Vector4, y : number, width : number, height : number ) + +This method allows to define the pass's scissor rectangle. By default, the scissor rectangle is kept in sync with the pass's dimensions. To reverse the process and use auto-sizing again, call the method with `null` as the single argument. + +**x** + +The horizontal coordinate for the lower left corner of the box in logical pixel unit. Instead of passing four arguments, the method also works with a single four-dimensional vector. + +**y** + +The vertical coordinate for the lower left corner of the box in logical pixel unit. + +**width** + +The width of the scissor box in logical pixel unit. + +**height** + +The height of the scissor box in logical pixel unit. + +### .setSize( width : number, height : number ) + +Sets the size of the pass's render target. Honors the pixel ratio. + +**width** + +The width to set. + +**height** + +The height to set. + +### .setViewport( x : number | Vector4, y : number, width : number, height : number ) + +This method allows to define the pass's viewport. By default, the viewport is kept in sync with the pass's dimensions. To reverse the process and use auto-sizing again, call the method with `null` as the single argument. + +**x** + +The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + +**y** + +The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + +**width** + +The width of the viewport in logical pixel unit. + +**height** + +The height of the viewport in logical pixel unit. + +### .toggleTexture( name : string ) + +Switches current and previous textures for the given output name. + +**name** + +The output name. + +## Source + +[src/nodes/display/PassNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/PassNode.js) \ No newline at end of file diff --git a/docs/pages/PassTextureNode.html.md b/docs/pages/PassTextureNode.html.md new file mode 100644 index 00000000000000..a8cea56eb3afb5 --- /dev/null +++ b/docs/pages/PassTextureNode.html.md @@ -0,0 +1,29 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode →* + +# PassTextureNode + +Represents the texture of a pass node. + +## Constructor + +### new PassTextureNode( passNode : PassNode, texture : Texture ) + +Constructs a new pass texture node. + +**passNode** + +The pass node. + +**texture** + +The output texture. + +## Properties + +### .passNode : PassNode + +A reference to the pass node. + +## Source + +[src/nodes/display/PassNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/PassNode.js) \ No newline at end of file diff --git a/docs/pages/Path.html.md b/docs/pages/Path.html.md new file mode 100644 index 00000000000000..b9b68c2d6b7941 --- /dev/null +++ b/docs/pages/Path.html.md @@ -0,0 +1,333 @@ +*Inheritance: Curve → CurvePath →* + +# Path + +A 2D path representation. The class provides methods for creating paths and contours of 2D shapes similar to the 2D Canvas API. + +## Code Example + +```js +const path = new THREE.Path(); +path.lineTo( 0, 0.8 ); +path.quadraticCurveTo( 0, 1, 0.2, 1 ); +path.lineTo( 1, 1 ); +const points = path.getPoints(); +const geometry = new THREE.BufferGeometry().setFromPoints( points ); +const material = new THREE.LineBasicMaterial( { color: 0xffffff } ); +const line = new THREE.Line( geometry, material ); +scene.add( line ); +``` + +## Constructor + +### new Path( points : Array. ) + +Constructs a new path. + +**points** + +An array of 2D points defining the path. + +## Properties + +### .currentPoint : Vector2 + +The current offset of the path. Any new curve added will start here. + +## Methods + +### .absarc( aX : number, aY : number, aRadius : number, aStartAngle : number, aEndAngle : number, aClockwise : boolean ) : Path + +Adds an absolutely positioned arc as an instance of [EllipseCurve](EllipseCurve.html) to the path. + +**aX** + +The x coordinate of the center of the arc. + +Default is `0`. + +**aY** + +The y coordinate of the center of the arc. + +Default is `0`. + +**aRadius** + +The radius of the arc. + +Default is `1`. + +**aStartAngle** + +The start angle in radians. + +Default is `0`. + +**aEndAngle** + +The end angle in radians. + +Default is `Math.PI*2`. + +**aClockwise** + +Whether to sweep the arc clockwise or not. + +Default is `false`. + +**Returns:** A reference to this path. + +### .absellipse( aX : number, aY : number, xRadius : number, yRadius : number, aStartAngle : number, aEndAngle : number, aClockwise : boolean, aRotation : number ) : Path + +Adds an absolutely positioned ellipse as an instance of [EllipseCurve](EllipseCurve.html) to the path. + +**aX** + +The x coordinate of the absolute center of the ellipse. + +Default is `0`. + +**aY** + +The y coordinate of the absolute center of the ellipse. + +Default is `0`. + +**xRadius** + +The radius of the ellipse in the x axis. + +Default is `1`. + +**yRadius** + +The radius of the ellipse in the y axis. + +Default is `1`. + +**aStartAngle** + +The start angle in radians. + +Default is `0`. + +**aEndAngle** + +The end angle in radians. + +Default is `Math.PI*2`. + +**aClockwise** + +Whether to sweep the ellipse clockwise or not. + +Default is `false`. + +**aRotation** + +The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. + +Default is `0`. + +**Returns:** A reference to this path. + +### .arc( aX : number, aY : number, aRadius : number, aStartAngle : number, aEndAngle : number, aClockwise : boolean ) : Path + +Adds an arc as an instance of [EllipseCurve](EllipseCurve.html) to the path, positioned relative to the current point. + +**aX** + +The x coordinate of the center of the arc offsetted from the previous curve. + +Default is `0`. + +**aY** + +The y coordinate of the center of the arc offsetted from the previous curve. + +Default is `0`. + +**aRadius** + +The radius of the arc. + +Default is `1`. + +**aStartAngle** + +The start angle in radians. + +Default is `0`. + +**aEndAngle** + +The end angle in radians. + +Default is `Math.PI*2`. + +**aClockwise** + +Whether to sweep the arc clockwise or not. + +Default is `false`. + +**Returns:** A reference to this path. + +### .bezierCurveTo( aCP1x : number, aCP1y : number, aCP2x : number, aCP2y : number, aX : number, aY : number ) : Path + +Adds an instance of [CubicBezierCurve](CubicBezierCurve.html) to the path by connecting the current point with the given one. + +**aCP1x** + +The x coordinate of the first control point. + +**aCP1y** + +The y coordinate of the first control point. + +**aCP2x** + +The x coordinate of the second control point. + +**aCP2y** + +The y coordinate of the second control point. + +**aX** + +The x coordinate of the end point. + +**aY** + +The y coordinate of the end point. + +**Returns:** A reference to this path. + +### .ellipse( aX : number, aY : number, xRadius : number, yRadius : number, aStartAngle : number, aEndAngle : number, aClockwise : boolean, aRotation : number ) : Path + +Adds an ellipse as an instance of [EllipseCurve](EllipseCurve.html) to the path, positioned relative to the current point + +**aX** + +The x coordinate of the center of the ellipse offsetted from the previous curve. + +Default is `0`. + +**aY** + +The y coordinate of the center of the ellipse offsetted from the previous curve. + +Default is `0`. + +**xRadius** + +The radius of the ellipse in the x axis. + +Default is `1`. + +**yRadius** + +The radius of the ellipse in the y axis. + +Default is `1`. + +**aStartAngle** + +The start angle in radians. + +Default is `0`. + +**aEndAngle** + +The end angle in radians. + +Default is `Math.PI*2`. + +**aClockwise** + +Whether to sweep the ellipse clockwise or not. + +Default is `false`. + +**aRotation** + +The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. + +Default is `0`. + +**Returns:** A reference to this path. + +### .lineTo( x : number, y : number ) : Path + +Adds an instance of [LineCurve](LineCurve.html) to the path by connecting the current point with the given one. + +**x** + +The x coordinate of the end point. + +**y** + +The y coordinate of the end point. + +**Returns:** A reference to this path. + +### .moveTo( x : number, y : number ) : Path + +Moves [Path#currentPoint](Path.html#currentPoint) to the given point. + +**x** + +The x coordinate. + +**y** + +The y coordinate. + +**Returns:** A reference to this path. + +### .quadraticCurveTo( aCPx : number, aCPy : number, aX : number, aY : number ) : Path + +Adds an instance of [QuadraticBezierCurve](QuadraticBezierCurve.html) to the path by connecting the current point with the given one. + +**aCPx** + +The x coordinate of the control point. + +**aCPy** + +The y coordinate of the control point. + +**aX** + +The x coordinate of the end point. + +**aY** + +The y coordinate of the end point. + +**Returns:** A reference to this path. + +### .setFromPoints( points : Array. ) : Path + +Creates a path from the given list of points. The points are added to the path as instances of [LineCurve](LineCurve.html). + +**points** + +An array of 2D points. + +**Returns:** A reference to this path. + +### .splineThru( pts : Array. ) : Path + +Adds an instance of [SplineCurve](SplineCurve.html) to the path by connecting the current point with the given list of points. + +**pts** + +An array of points in 2D space. + +**Returns:** A reference to this path. + +## Source + +[src/extras/core/Path.js](https://github.com/mrdoob/three.js/blob/master/src/extras/core/Path.js) \ No newline at end of file diff --git a/docs/pages/PerspectiveCamera.html.md b/docs/pages/PerspectiveCamera.html.md new file mode 100644 index 00000000000000..daabe1d6a226f6 --- /dev/null +++ b/docs/pages/PerspectiveCamera.html.md @@ -0,0 +1,247 @@ +*Inheritance: EventDispatcher → Object3D → Camera →* + +# PerspectiveCamera + +Camera that uses [perspective projection](https://en.wikipedia.org/wiki/Perspective_\(graphical\)). + +This projection mode is designed to mimic the way the human eye sees. It is the most common projection mode used for rendering a 3D scene. + +## Code Example + +```js +const camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 ); +scene.add( camera ); +``` + +## Constructor + +### new PerspectiveCamera( fov : number, aspect : number, near : number, far : number ) + +Constructs a new perspective camera. + +**fov** + +The vertical field of view. + +Default is `50`. + +**aspect** + +The aspect ratio. + +Default is `1`. + +**near** + +The camera's near plane. + +Default is `0.1`. + +**far** + +The camera's far plane. + +Default is `2000`. + +## Properties + +### .aspect : number + +The aspect ratio, usually the canvas width / canvas height. + +Default is `1`. + +### .far : number + +The camera's far plane. Must be greater than the current value of [PerspectiveCamera#near](PerspectiveCamera.html#near). + +Default is `2000`. + +### .filmGauge : number + +Film size used for the larger axis. Default is `35` (millimeters). This parameter does not influence the projection matrix unless [PerspectiveCamera#filmOffset](PerspectiveCamera.html#filmOffset) is set to a nonzero value. + +Default is `35`. + +### .filmOffset : number + +Horizontal off-center offset in the same unit as [PerspectiveCamera#filmGauge](PerspectiveCamera.html#filmGauge). + +Default is `0`. + +### .focus : number + +Object distance used for stereoscopy and depth-of-field effects. This parameter does not influence the projection matrix unless a [StereoCamera](StereoCamera.html) is being used. + +Default is `10`. + +### .fov : number + +The vertical field of view, from bottom to top of view, in degrees. + +Default is `50`. + +### .isPerspectiveCamera : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .near : number + +The camera's near plane. The valid range is greater than `0` and less than the current value of [PerspectiveCamera#far](PerspectiveCamera.html#far). + +Note that, unlike for the [OrthographicCamera](OrthographicCamera.html), `0` is _not_ a valid value for a perspective camera's near plane. + +Default is `0.1`. + +### .view : Object + +Represents the frustum window specification. This property should not be edited directly but via [PerspectiveCamera#setViewOffset](PerspectiveCamera.html#setViewOffset) and [PerspectiveCamera#clearViewOffset](PerspectiveCamera.html#clearViewOffset). + +Default is `null`. + +### .zoom : number + +The zoom factor of the camera. + +Default is `1`. + +## Methods + +### .clearViewOffset() + +Removes the view offset from the projection matrix. + +### .getEffectiveFOV() : number + +Returns the current vertical field of view angle in degrees considering [PerspectiveCamera#zoom](PerspectiveCamera.html#zoom). + +**Returns:** The effective FOV. + +### .getFilmHeight() : number + +Returns the height of the image on the film. If [PerspectiveCamera#aspect](PerspectiveCamera.html#aspect) is greater than or equal to one (landscape format), the result equals [PerspectiveCamera#filmGauge](PerspectiveCamera.html#filmGauge). + +**Returns:** The film width. + +### .getFilmWidth() : number + +Returns the width of the image on the film. If [PerspectiveCamera#aspect](PerspectiveCamera.html#aspect) is greater than or equal to one (landscape format), the result equals [PerspectiveCamera#filmGauge](PerspectiveCamera.html#filmGauge). + +**Returns:** The film width. + +### .getFocalLength() : number + +Returns the focal length from the current [PerspectiveCamera#fov](PerspectiveCamera.html#fov) and [PerspectiveCamera#filmGauge](PerspectiveCamera.html#filmGauge). + +**Returns:** The computed focal length. + +### .getViewBounds( distance : number, minTarget : Vector2, maxTarget : Vector2 ) + +Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction. Sets `minTarget` and `maxTarget` to the coordinates of the lower-left and upper-right corners of the view rectangle. + +**distance** + +The viewing distance. + +**minTarget** + +The lower-left corner of the view rectangle is written into this vector. + +**maxTarget** + +The upper-right corner of the view rectangle is written into this vector. + +### .getViewSize( distance : number, target : Vector2 ) : Vector2 + +Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction. + +**distance** + +The viewing distance. + +**target** + +The target vector that is used to store result where x is width and y is height. + +**Returns:** The view size. + +### .setFocalLength( focalLength : number ) + +Sets the FOV by focal length in respect to the current [PerspectiveCamera#filmGauge](PerspectiveCamera.html#filmGauge). + +The default film gauge is 35, so that the focal length can be specified for a 35mm (full frame) camera. + +**focalLength** + +Values for focal length and film gauge must have the same unit. + +### .setViewOffset( fullWidth : number, fullHeight : number, x : number, y : number, width : number, height : number ) + +Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups. + +For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this + +```js ++---+---+---+ + | A | B | C | + +---+---+---+ + | D | E | F | + +---+---+---+ +``` + +then for each monitor you would call it like this: + +```js +const w = 1920; +const h = 1080; +const fullWidth = w * 3; +const fullHeight = h * 2; +// --A-- +camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); +// --B-- +camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); +// --C-- +camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); +// --D-- +camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); +// --E-- +camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); +// --F-- +camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); +``` + +Note there is no reason monitors have to be the same size or in a grid. + +**fullWidth** + +The full width of multiview setup. + +**fullHeight** + +The full height of multiview setup. + +**x** + +The horizontal offset of the subcamera. + +**y** + +The vertical offset of the subcamera. + +**width** + +The width of subcamera. + +**height** + +The height of subcamera. + +### .updateProjectionMatrix() + +Updates the camera's projection matrix. Must be called after any change of camera properties. + +## Source + +[src/cameras/PerspectiveCamera.js](https://github.com/mrdoob/three.js/blob/master/src/cameras/PerspectiveCamera.js) \ No newline at end of file diff --git a/docs/pages/PhongLightingModel.html.md b/docs/pages/PhongLightingModel.html.md new file mode 100644 index 00000000000000..f06901c2676b29 --- /dev/null +++ b/docs/pages/PhongLightingModel.html.md @@ -0,0 +1,51 @@ +*Inheritance: LightingModel → BasicLightingModel →* + +# PhongLightingModel + +Represents the lighting model for a phong material. Used in [MeshPhongNodeMaterial](MeshPhongNodeMaterial.html). + +## Constructor + +### new PhongLightingModel( specular : boolean ) + +Constructs a new phong lighting model. + +**specular** + +Whether specular is supported or not. + +Default is `true`. + +## Properties + +### .specular : boolean + +Whether specular is supported or not. Set this to `false` if you are looking for a Lambert-like material meaning a material for non-shiny surfaces, without specular highlights. + +Default is `true`. + +## Methods + +### .direct( lightData : Object ) + +Implements the direct lighting. The specular portion is optional an can be controlled with the [PhongLightingModel#specular](PhongLightingModel.html#specular) flag. + +**lightData** + +The light data. + +**Overrides:** [BasicLightingModel#direct](BasicLightingModel.html#direct) + +### .indirect( builder : NodeBuilder ) + +Implements the indirect lighting. + +**builder** + +The current node builder. + +**Overrides:** [BasicLightingModel#indirect](BasicLightingModel.html#indirect) + +## Source + +[src/nodes/functions/PhongLightingModel.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/functions/PhongLightingModel.js) \ No newline at end of file diff --git a/docs/pages/PhysicalLightingModel.html.md b/docs/pages/PhysicalLightingModel.html.md new file mode 100644 index 00000000000000..c317178d8fd7b2 --- /dev/null +++ b/docs/pages/PhysicalLightingModel.html.md @@ -0,0 +1,229 @@ +*Inheritance: LightingModel →* + +# PhysicalLightingModel + +Represents the lighting model for a PBR material. + +## Constructor + +### new PhysicalLightingModel( clearcoat : boolean, sheen : boolean, iridescence : boolean, anisotropy : boolean, transmission : boolean, dispersion : boolean ) + +Constructs a new physical lighting model. + +**clearcoat** + +Whether clearcoat is supported or not. + +Default is `false`. + +**sheen** + +Whether sheen is supported or not. + +Default is `false`. + +**iridescence** + +Whether iridescence is supported or not. + +Default is `false`. + +**anisotropy** + +Whether anisotropy is supported or not. + +Default is `false`. + +**transmission** + +Whether transmission is supported or not. + +Default is `false`. + +**dispersion** + +Whether dispersion is supported or not. + +Default is `false`. + +## Properties + +### .anisotropy : boolean + +Whether anisotropy is supported or not. + +Default is `false`. + +### .clearcoat : boolean + +Whether clearcoat is supported or not. + +Default is `false`. + +### .clearcoatRadiance : Node + +The clear coat radiance. + +Default is `null`. + +### .clearcoatSpecularDirect : Node + +The clear coat specular direct. + +Default is `null`. + +### .clearcoatSpecularIndirect : Node + +The clear coat specular indirect. + +Default is `null`. + +### .dispersion : boolean + +Whether dispersion is supported or not. + +Default is `false`. + +### .iridescence : boolean + +Whether iridescence is supported or not. + +Default is `false`. + +### .iridescenceF0 : Node + +The iridescence F0. + +Default is `null`. + +### .iridescenceF0Dielectric : Node + +The iridescence F0 dielectric. + +Default is `null`. + +### .iridescenceF0Metallic : Node + +The iridescence F0 metallic. + +Default is `null`. + +### .iridescenceFresnel : Node + +The iridescence Fresnel. + +Default is `null`. + +### .sheen : boolean + +Whether sheen is supported or not. + +Default is `false`. + +### .sheenSpecularDirect : Node + +The sheen specular direct. + +Default is `null`. + +### .sheenSpecularIndirect : Node + +The sheen specular indirect. + +Default is `null`. + +### .transmission : boolean + +Whether transmission is supported or not. + +Default is `false`. + +## Methods + +### .ambientOcclusion( builder : NodeBuilder ) + +Implements the ambient occlusion term. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#ambientOcclusion](LightingModel.html#ambientOcclusion) + +### .direct( lightData : Object, builder : NodeBuilder ) + +Implements the direct light. + +**lightData** + +The light data. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#direct](LightingModel.html#direct) + +### .directRectArea( input : Object, builder : NodeBuilder ) + +This method is intended for implementing the direct light term for rect area light nodes. + +**input** + +The input data. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#directRectArea](LightingModel.html#directRectArea) + +### .finish( builder : NodeBuilder ) + +Used for final lighting accumulations depending on the requested features. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#finish](LightingModel.html#finish) + +### .indirect( builder : NodeBuilder ) + +Implements the indirect lighting. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#indirect](LightingModel.html#indirect) + +### .indirectDiffuse( builder : NodeBuilder ) + +Implements the indirect diffuse term. + +**builder** + +The current node builder. + +### .indirectSpecular( builder : NodeBuilder ) + +Implements the indirect specular term. + +**builder** + +The current node builder. + +### .start( builder : NodeBuilder ) + +Depending on what features are requested, the method prepares certain node variables which are later used for lighting computations. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#start](LightingModel.html#start) + +## Source + +[src/nodes/functions/PhysicalLightingModel.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/functions/PhysicalLightingModel.js) \ No newline at end of file diff --git a/docs/pages/PixelationNode.html.md b/docs/pages/PixelationNode.html.md new file mode 100644 index 00000000000000..6fae502a8b927c --- /dev/null +++ b/docs/pages/PixelationNode.html.md @@ -0,0 +1,95 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# PixelationNode + +A inner node definition that implements the actual pixelation TSL code. + +## Constructor + +### new PixelationNode( textureNode : TextureNode, depthNode : TextureNode, normalNode : TextureNode, pixelSize : Node., normalEdgeStrength : Node., depthEdgeStrength : Node. ) + +Constructs a new pixelation node. + +**textureNode** + +The texture node that represents the beauty pass. + +**depthNode** + +The texture that represents the beauty's depth. + +**normalNode** + +The texture that represents the beauty's normals. + +**pixelSize** + +The pixel size. + +**normalEdgeStrength** + +The normal edge strength. + +**depthEdgeStrength** + +The depth edge strength. + +## Properties + +### .depthEdgeStrength : Node. + +The depth edge strength. + +### .depthNode : TextureNode + +The texture that represents the beauty's depth. + +### .normalEdgeStrength : Node. + +The pixel size. + +### .normalNode : TextureNode + +The texture that represents the beauty's normals. + +### .pixelSize : Node. + +The pixel size. + +### .textureNode : TextureNode + +The texture node that represents the beauty pass. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node updates its internal uniforms once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to update uniforms once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/PixelationPassNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/PixelationPassNode.js) \ No newline at end of file diff --git a/docs/pages/PixelationPassNode.html.md b/docs/pages/PixelationPassNode.html.md new file mode 100644 index 00000000000000..5b386e3f5b1366 --- /dev/null +++ b/docs/pages/PixelationPassNode.html.md @@ -0,0 +1,101 @@ +*Inheritance: EventDispatcher → Node → TempNode → PassNode →* + +# PixelationPassNode + +A special render pass node that renders the scene with a pixelation effect. + +## Import + +PixelationPassNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { pixelationPass } from 'three/addons/tsl/display/PixelationPassNode.js'; +``` + +## Constructor + +### new PixelationPassNode( scene : Scene, camera : Camera, pixelSize : Node. | number, normalEdgeStrength : Node. | number, depthEdgeStrength : Node. | number ) + +Constructs a new pixelation pass node. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +**pixelSize** + +The pixel size. + +Default is `6`. + +**normalEdgeStrength** + +The normal edge strength. + +Default is `0.3`. + +**depthEdgeStrength** + +The depth edge strength. + +Default is `0.4`. + +## Properties + +### .depthEdgeStrength : number + +The depth edge strength. + +Default is `0.4`. + +### .isPixelationPassNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .normalEdgeStrength : number + +The normal edge strength. + +Default is `0.3`. + +### .pixelSize : number + +The pixel size. + +Default is `6`. + +## Methods + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width of the pass. + +**height** + +The height of the pass. + +**Overrides:** [PassNode#setSize](PassNode.html#setSize) + +### .setup( builder : NodeBuilder ) : PixelationNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [PassNode#setup](PassNode.html#setup) + +## Source + +[examples/jsm/tsl/display/PixelationPassNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/PixelationPassNode.js) \ No newline at end of file diff --git a/docs/pages/Plane.html.md b/docs/pages/Plane.html.md new file mode 100644 index 00000000000000..59ff290378bc9c --- /dev/null +++ b/docs/pages/Plane.html.md @@ -0,0 +1,269 @@ +# Plane + +A two dimensional surface that extends infinitely in 3D space, represented in [Hessian normal form](http://mathworld.wolfram.com/HessianNormalForm.html) by a unit length normal vector and a constant. + +## Constructor + +### new Plane( normal : Vector3, constant : number ) + +Constructs a new plane. + +**normal** + +A unit length vector defining the normal of the plane. + +Default is `(1,0,0)`. + +**constant** + +The signed distance from the origin to the plane. + +Default is `0`. + +## Properties + +### .constant : number + +The signed distance from the origin to the plane. + +Default is `0`. + +### .isPlane : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .normal : Vector3 + +A unit length vector defining the normal of the plane. + +## Methods + +### .applyMatrix4( matrix : Matrix4, optionalNormalMatrix : Matrix4 ) : Plane + +Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform. + +The optional normal matrix can be pre-computed like so: + +```js +const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); +``` + +**matrix** + +The transformation matrix. + +**optionalNormalMatrix** + +A pre-computed normal matrix. + +**Returns:** A reference to this plane. + +### .clone() : Plane + +Returns a new plane with copied values from this instance. + +**Returns:** A clone of this instance. + +### .coplanarPoint( target : Vector3 ) : Vector3 + +Returns a coplanar vector to the plane, by calculating the projection of the normal at the origin onto the plane. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The coplanar point. + +### .copy( plane : Plane ) : Plane + +Copies the values of the given plane to this instance. + +**plane** + +The plane to copy. + +**Returns:** A reference to this plane. + +### .distanceToPoint( point : Vector3 ) : number + +Returns the signed distance from the given point to this plane. + +**point** + +The point to compute the distance for. + +**Returns:** The signed distance. + +### .distanceToSphere( sphere : Sphere ) : number + +Returns the signed distance from the given sphere to this plane. + +**sphere** + +The sphere to compute the distance for. + +**Returns:** The signed distance. + +### .equals( plane : Plane ) : boolean + +Returns `true` if this plane is equal with the given one. + +**plane** + +The plane to test for equality. + +**Returns:** Whether this plane is equal with the given one. + +### .intersectLine( line : Line3, target : Vector3 ) : Vector3 + +Returns the intersection point of the passed line and the plane. Returns `null` if the line does not intersect. Returns the line's starting point if the line is coplanar with the plane. + +**line** + +The line to compute the intersection for. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The intersection point. + +### .intersectsBox( box : Box3 ) : boolean + +Returns `true` if the given bounding box intersects with the plane. + +**box** + +The bounding box to test. + +**Returns:** Whether the given bounding box intersects with the plane or not. + +### .intersectsLine( line : Line3 ) : boolean + +Returns `true` if the given line segment intersects with (passes through) the plane. + +**line** + +The line to test. + +**Returns:** Whether the given line segment intersects with the plane or not. + +### .intersectsSphere( sphere : Sphere ) : boolean + +Returns `true` if the given bounding sphere intersects with the plane. + +**sphere** + +The bounding sphere to test. + +**Returns:** Whether the given bounding sphere intersects with the plane or not. + +### .negate() : Plane + +Negates both the plane normal and the constant. + +**Returns:** A reference to this plane. + +### .normalize() : Plane + +Normalizes the plane normal and adjusts the constant accordingly. + +**Returns:** A reference to this plane. + +### .projectPoint( point : Vector3, target : Vector3 ) : Vector3 + +Projects a the given point onto the plane. + +**point** + +The point to project. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The projected point on the plane. + +### .set( normal : Vector3, constant : number ) : Plane + +Sets the plane components by copying the given values. + +**normal** + +The normal. + +**constant** + +The constant. + +**Returns:** A reference to this plane. + +### .setComponents( x : number, y : number, z : number, w : number ) : Plane + +Sets the plane components by defining `x`, `y`, `z` as the plane normal and `w` as the constant. + +**x** + +The value for the normal's x component. + +**y** + +The value for the normal's y component. + +**z** + +The value for the normal's z component. + +**w** + +The constant value. + +**Returns:** A reference to this plane. + +### .setFromCoplanarPoints( a : Vector3, b : Vector3, c : Vector3 ) : Plane + +Sets the plane from three coplanar points. The winding order is assumed to be counter-clockwise, and determines the direction of the plane normal. + +**a** + +The first coplanar point. + +**b** + +The second coplanar point. + +**c** + +The third coplanar point. + +**Returns:** A reference to this plane. + +### .setFromNormalAndCoplanarPoint( normal : Vector3, point : Vector3 ) : Plane + +Sets the plane from the given normal and coplanar point (that is a point that lies onto the plane). + +**normal** + +The normal. + +**point** + +A coplanar point. + +**Returns:** A reference to this plane. + +### .translate( offset : Vector3 ) : Plane + +Translates the plane by the distance defined by the given offset vector. Note that this only affects the plane constant and will not affect the normal vector. + +**offset** + +The offset vector. + +**Returns:** A reference to this plane. + +## Source + +[src/math/Plane.js](https://github.com/mrdoob/three.js/blob/master/src/math/Plane.js) \ No newline at end of file diff --git a/docs/pages/PlaneGeometry.html.md b/docs/pages/PlaneGeometry.html.md new file mode 100644 index 00000000000000..2482dcf0ca62fd --- /dev/null +++ b/docs/pages/PlaneGeometry.html.md @@ -0,0 +1,66 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# PlaneGeometry + +A geometry class for representing a plane. + +## Code Example + +```js +const geometry = new THREE.PlaneGeometry( 1, 1 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } ); +const plane = new THREE.Mesh( geometry, material ); +scene.add( plane ); +``` + +## Constructor + +### new PlaneGeometry( width : number, height : number, widthSegments : number, heightSegments : number ) + +Constructs a new plane geometry. + +**width** + +The width along the X axis. + +Default is `1`. + +**height** + +The height along the Y axis + +Default is `1`. + +**widthSegments** + +The number of segments along the X axis. + +Default is `1`. + +**heightSegments** + +The number of segments along the Y axis. + +Default is `1`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : PlaneGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/PlaneGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/PlaneGeometry.js) \ No newline at end of file diff --git a/docs/pages/PlaneHelper.html.md b/docs/pages/PlaneHelper.html.md new file mode 100644 index 00000000000000..d097ad39f07504 --- /dev/null +++ b/docs/pages/PlaneHelper.html.md @@ -0,0 +1,57 @@ +*Inheritance: EventDispatcher → Object3D → Line →* + +# PlaneHelper + +A helper object to visualize an instance of [Plane](Plane.html). + +## Code Example + +```js +const plane = new THREE.Plane( new THREE.Vector3( 1, 1, 0.2 ), 3 ); +const helper = new THREE.PlaneHelper( plane, 1, 0xffff00 ); +scene.add( helper ); +``` + +## Constructor + +### new PlaneHelper( plane : Plane, size : number, hex : number | Color | string ) + +Constructs a new plane helper. + +**plane** + +The plane to be visualized. + +**size** + +The side length of plane helper. + +Default is `1`. + +**hex** + +The helper's color. + +Default is `0xffff00`. + +## Properties + +### .plane : Plane + +The plane being visualized. + +### .size : number + +The side length of plane helper. + +Default is `1`. + +## Methods + +### .dispose() + +Updates the helper to match the position and direction of the light being visualized. + +## Source + +[src/helpers/PlaneHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/PlaneHelper.js) \ No newline at end of file diff --git a/docs/pages/PointLight.html.md b/docs/pages/PointLight.html.md new file mode 100644 index 00000000000000..0cd4a7a8d95867 --- /dev/null +++ b/docs/pages/PointLight.html.md @@ -0,0 +1,77 @@ +*Inheritance: EventDispatcher → Object3D → Light →* + +# PointLight + +A light that gets emitted from a single point in all directions. A common use case for this is to replicate the light emitted from a bare lightbulb. + +This light can cast shadows - see the [PointLightShadow](PointLightShadow.html) for details. + +## Code Example + +```js +const light = new THREE.PointLight( 0xff0000, 1, 100 ); +light.position.set( 50, 50, 50 ); +scene.add( light ); +``` + +## Constructor + +### new PointLight( color : number | Color | string, intensity : number, distance : number, decay : number ) + +Constructs a new point light. + +**color** + +The light's color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity measured in candela (cd). + +Default is `1`. + +**distance** + +Maximum range of the light. `0` means no limit. + +Default is `0`. + +**decay** + +The amount the light dims along the distance of the light. + +Default is `2`. + +## Properties + +### .decay : number + +The amount the light dims along the distance of the light. In context of physically-correct rendering the default value should not be changed. + +Default is `2`. + +### .distance : number + +When distance is zero, light will attenuate according to inverse-square law to infinite distance. When distance is non-zero, light will attenuate according to inverse-square law until near the distance cutoff, where it will then attenuate quickly and smoothly to 0. Inherently, cutoffs are not physically correct. + +Default is `0`. + +### .isPointLight : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .power : number + +The light's power. Power is the luminous power of the light measured in lumens (lm). Changing the power will also change the light's intensity. + +### .shadow : PointLightShadow + +This property holds the light's shadow configuration. + +## Source + +[src/lights/PointLight.js](https://github.com/mrdoob/three.js/blob/master/src/lights/PointLight.js) \ No newline at end of file diff --git a/docs/pages/PointLightHelper.html.md b/docs/pages/PointLightHelper.html.md new file mode 100644 index 00000000000000..bc86bc29278677 --- /dev/null +++ b/docs/pages/PointLightHelper.html.md @@ -0,0 +1,60 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# PointLightHelper + +This displays a helper object consisting of a spherical mesh for visualizing an instance of [PointLight](PointLight.html). + +## Code Example + +```js +const pointLight = new THREE.PointLight( 0xff0000, 1, 100 ); +pointLight.position.set( 10, 10, 10 ); +scene.add( pointLight ); +const sphereSize = 1; +const pointLightHelper = new THREE.PointLightHelper( pointLight, sphereSize ); +scene.add( pointLightHelper ); +``` + +## Constructor + +### new PointLightHelper( light : PointLight, sphereSize : number, color : number | Color | string ) + +Constructs a new point light helper. + +**light** + +The light to be visualized. + +**sphereSize** + +The size of the sphere helper. + +Default is `1`. + +**color** + +The helper's color. If not set, the helper will take the color of the light. + +## Properties + +### .color : number | Color | string + +The color parameter passed in the constructor. If not set, the helper will take the color of the light. + +### .light : PointLight + +The light being visualized. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the helper to match the position of the light being visualized. + +## Source + +[src/helpers/PointLightHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/PointLightHelper.js) \ No newline at end of file diff --git a/docs/pages/PointLightNode.html.md b/docs/pages/PointLightNode.html.md new file mode 100644 index 00000000000000..fc4ab7ef6409ea --- /dev/null +++ b/docs/pages/PointLightNode.html.md @@ -0,0 +1,49 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode →* + +# PointLightNode + +Module for representing point lights as nodes. + +## Constructor + +### new PointLightNode( light : PointLight ) + +Constructs a new point light node. + +**light** + +The point light source. + +Default is `null`. + +## Properties + +### .cutoffDistanceNode : UniformNode. + +Uniform node representing the cutoff distance. + +### .decayExponentNode : UniformNode. + +Uniform node representing the decay exponent. + +## Methods + +### .setupShadowNode() : PointShadowNode + +Overwritten to setup point light specific shadow. + +**Overrides:** [AnalyticLightNode#setupShadowNode](AnalyticLightNode.html#setupShadowNode) + +### .update( frame : NodeFrame ) + +Overwritten to updated point light specific uniforms. + +**frame** + +A reference to the current node frame. + +**Overrides:** [AnalyticLightNode#update](AnalyticLightNode.html#update) + +## Source + +[src/nodes/lighting/PointLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/PointLightNode.js) \ No newline at end of file diff --git a/docs/pages/PointLightShadow.html.md b/docs/pages/PointLightShadow.html.md new file mode 100644 index 00000000000000..24d75bd1a1e88b --- /dev/null +++ b/docs/pages/PointLightShadow.html.md @@ -0,0 +1,23 @@ +*Inheritance: LightShadow →* + +# PointLightShadow + +Represents the shadow configuration of point lights. + +## Constructor + +### new PointLightShadow() + +Constructs a new point light shadow. + +## Properties + +### .isPointLightShadow : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/lights/PointLightShadow.js](https://github.com/mrdoob/three.js/blob/master/src/lights/PointLightShadow.js) \ No newline at end of file diff --git a/docs/pages/PointShadowNode.html.md b/docs/pages/PointShadowNode.html.md new file mode 100644 index 00000000000000..ced245811b748f --- /dev/null +++ b/docs/pages/PointShadowNode.html.md @@ -0,0 +1,111 @@ +*Inheritance: EventDispatcher → Node → ShadowBaseNode → ShadowNode →* + +# PointShadowNode + +Represents the shadow implementation for point light nodes. + +## Constructor + +### new PointShadowNode( light : PointLight, shadow : PointLightShadow ) + +Constructs a new point shadow node. + +**light** + +The shadow casting point light. + +**shadow** + +An optional point light shadow. + +Default is `null`. + +## Methods + +### .getShadowFilterFn( type : number ) : function + +Overwrites the default implementation to return point light shadow specific filtering functions. + +**type** + +The shadow type. + +**Overrides:** [ShadowNode#getShadowFilterFn](ShadowNode.html#getShadowFilterFn) + +**Returns:** The filtering function. + +### .renderShadow( frame : NodeFrame ) + +Overwrites the default implementation with point light specific rendering code. + +**frame** + +A reference to the current node frame. + +**Overrides:** [ShadowNode#renderShadow](ShadowNode.html#renderShadow) + +### .setupRenderTarget( shadow : LightShadow, builder : NodeBuilder ) : Object + +Overwrites the default implementation to create a CubeRenderTarget with CubeDepthTexture. + +**shadow** + +The light shadow object. + +**builder** + +A reference to the current node builder. + +**Returns:** An object containing the shadow map and depth texture. + +### .setupShadowCoord( builder : NodeBuilder, shadowPosition : Node. ) : Node. + +Overwrites the default implementation so the unaltered shadow position is used. + +**builder** + +A reference to the current node builder. + +**shadowPosition** + +A node representing the shadow position. + +**Overrides:** [ShadowNode#setupShadowCoord](ShadowNode.html#setupShadowCoord) + +**Returns:** The shadow coordinates. + +### .setupShadowFilter( builder : NodeBuilder, inputs : Object ) : Node. + +Overwrites the default implementation to only use point light specific shadow filter functions. + +**builder** + +A reference to the current node builder. + +**inputs** + +A configuration object that defines the shadow filtering. + +**filterFn** + +This function defines the filtering type of the shadow map e.g. PCF. + +**depthTexture** + +A reference to the shadow map's depth texture. + +**shadowCoord** + +Shadow coordinates which are used to sample from the shadow map. + +**shadow** + +The light shadow. + +**Overrides:** [ShadowNode#setupShadowFilter](ShadowNode.html#setupShadowFilter) + +**Returns:** The result node of the shadow filtering. + +## Source + +[src/nodes/lighting/PointShadowNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/PointShadowNode.js) \ No newline at end of file diff --git a/docs/pages/PointUVNode.html.md b/docs/pages/PointUVNode.html.md new file mode 100644 index 00000000000000..a0367e0d8b6b29 --- /dev/null +++ b/docs/pages/PointUVNode.html.md @@ -0,0 +1,25 @@ +*Inheritance: EventDispatcher → Node →* + +# PointUVNode + +A node for representing the uv coordinates of points. + +Can only be used with a WebGL backend. In WebGPU, point primitives always have the size of one pixel and can thus can't be used as sprite-like objects that display textures. + +## Constructor + +### new PointUVNode() + +Constructs a new point uv node. + +## Properties + +### .isPointUVNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/nodes/accessors/PointUVNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/PointUVNode.js) \ No newline at end of file diff --git a/docs/pages/PointerLockControls.html.md b/docs/pages/PointerLockControls.html.md new file mode 100644 index 00000000000000..23b14048a64d7f --- /dev/null +++ b/docs/pages/PointerLockControls.html.md @@ -0,0 +1,140 @@ +*Inheritance: EventDispatcher → Controls →* + +# PointerLockControls + +The implementation of this class is based on the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API). `PointerLockControls` is a perfect choice for first person 3D games. + +## Code Example + +```js +const controls = new PointerLockControls( camera, document.body ); +// add event listener to show/hide a UI (e.g. the game's menu) +controls.addEventListener( 'lock', function () { + menu.style.display = 'none'; +} ); +controls.addEventListener( 'unlock', function () { + menu.style.display = 'block'; +} ); +``` + +## Import + +PointerLockControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js'; +``` + +## Constructor + +### new PointerLockControls( camera : Camera, domElement : HTMLElement ) + +Constructs a new controls instance. + +**camera** + +The camera that is managed by the controls. + +**domElement** + +The HTML element used for event listeners. + +Default is `null`. + +## Properties + +### .isLocked : boolean (readonly) + +Whether the controls are locked or not. + +Default is `false`. + +### .maxPolarAngle : number + +Camera pitch, upper limit. Range is '\[0, Math.PI\]' in radians. + +Default is `Math.PI`. + +### .minPolarAngle : number + +Camera pitch, lower limit. Range is '\[0, Math.PI\]' in radians. + +Default is `0`. + +### .pointerSpeed : number + +Multiplier for how much the pointer movement influences the camera rotation. + +Default is `1`. + +## Methods + +### .getDirection( v : Vector3 ) : Vector3 + +Returns the look direction of the camera. + +**v** + +The target vector that is used to store the method's result. + +**Returns:** The normalized direction vector. + +### .lock( unadjustedMovement : boolean ) + +Activates the pointer lock. + +**unadjustedMovement** + +Disables OS-level adjustment for mouse acceleration, and accesses raw mouse input instead. Setting it to true will disable mouse acceleration. + +Default is `false`. + +### .moveForward( distance : number ) + +Moves the camera forward parallel to the xz-plane. Assumes camera.up is y-up. + +**distance** + +The signed distance. + +### .moveRight( distance : number ) + +Moves the camera sidewards parallel to the xz-plane. + +**distance** + +The signed distance. + +### .unlock() + +Exits the pointer lock. + +## Events + +### .change + +Fires when the user moves the mouse. + +##### Type: + +* Object + +### .lock + +Fires when the pointer lock status is "locked" (in other words: the mouse is captured). + +##### Type: + +* Object + +### .unlock + +Fires when the pointer lock status is "unlocked" (in other words: the mouse is not captured anymore). + +##### Type: + +* Object + +## Source + +[examples/jsm/controls/PointerLockControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/PointerLockControls.js) \ No newline at end of file diff --git a/docs/pages/Points.html.md b/docs/pages/Points.html.md new file mode 100644 index 00000000000000..eaccf4eba8cdb0 --- /dev/null +++ b/docs/pages/Points.html.md @@ -0,0 +1,73 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Points + +A class for displaying points or point clouds. + +## Constructor + +### new Points( geometry : BufferGeometry, material : Material | Array. ) + +Constructs a new point cloud. + +**geometry** + +The points geometry. + +**material** + +The points material. + +## Properties + +### .geometry : BufferGeometry + +The points geometry. + +### .isPoints : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .material : Material | Array. + +The line material. + +Default is `PointsMaterial`. + +### .morphTargetDictionary : Object. | undefined + +A dictionary representing the morph targets in the geometry. The key is the morph targets name, the value its attribute index. This member is `undefined` by default and only set when morph targets are detected in the geometry. + +Default is `undefined`. + +### .morphTargetInfluences : Array. | undefined + +An array of weights typically in the range `[0,1]` that specify how much of the morph is applied. This member is `undefined` by default and only set when morph targets are detected in the geometry. + +Default is `undefined`. + +## Methods + +### .raycast( raycaster : Raycaster, intersects : Array. ) + +Computes intersection points between a casted ray and this point cloud. + +**raycaster** + +The raycaster. + +**intersects** + +The target array that holds the intersection points. + +**Overrides:** [Object3D#raycast](Object3D.html#raycast) + +### .updateMorphTargets() + +Sets the values of [Points#morphTargetDictionary](Points.html#morphTargetDictionary) and [Points#morphTargetInfluences](Points.html#morphTargetInfluences) to make sure existing morph targets can influence this 3D object. + +## Source + +[src/objects/Points.js](https://github.com/mrdoob/three.js/blob/master/src/objects/Points.js) \ No newline at end of file diff --git a/docs/pages/PointsMaterial.html.md b/docs/pages/PointsMaterial.html.md new file mode 100644 index 00000000000000..55106792ba300b --- /dev/null +++ b/docs/pages/PointsMaterial.html.md @@ -0,0 +1,86 @@ +*Inheritance: EventDispatcher → Material →* + +# PointsMaterial + +A material for rendering point primitives. + +Materials define the appearance of renderable 3D objects. + +## Code Example + +```js +const vertices = []; +for ( let i = 0; i < 10000; i ++ ) { + const x = THREE.MathUtils.randFloatSpread( 2000 ); + const y = THREE.MathUtils.randFloatSpread( 2000 ); + const z = THREE.MathUtils.randFloatSpread( 2000 ); + vertices.push( x, y, z ); +} +const geometry = new THREE.BufferGeometry(); +geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); +const material = new THREE.PointsMaterial( { color: 0x888888 } ); +const points = new THREE.Points( geometry, material ); +scene.add( points ); +``` + +## Constructor + +### new PointsMaterial( parameters : Object ) + +Constructs a new points material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isPointsMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +### .size : number + +Defines the size of the points in pixels. + +Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED\_POINT\_SIZE\_RANGE](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete). + +Default is `1`. + +### .sizeAttenuation : boolean + +Specifies whether size of individual points is attenuated by the camera depth (perspective camera only). + +Default is `true`. + +## Source + +[src/materials/PointsMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/PointsMaterial.js) \ No newline at end of file diff --git a/docs/pages/PointsNodeMaterial.html.md b/docs/pages/PointsNodeMaterial.html.md new file mode 100644 index 00000000000000..7d6ef9e13ae5e7 --- /dev/null +++ b/docs/pages/PointsNodeMaterial.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial → SpriteNodeMaterial →* + +# PointsNodeMaterial + +Node material version of [PointsMaterial](PointsMaterial.html). + +This material can be used in two ways: + +* By rendering point primitives with [Points](Points.html). Since WebGPU only supports point primitives with a pixel size of `1`, it's not possible to define a size. + +* By rendering point primitives with Sprites. In this case, size is honored, see [PointsNodeMaterial#sizeNode](PointsNodeMaterial.html#sizeNode). + +```js +const instancedPoints = new THREE.Sprite( new THREE.PointsNodeMaterial( { positionNode: instancedBufferAttribute( positionAttribute ) } ) ); +``` + +## Code Example + +```js +const pointCloud = new THREE.Points( geometry, new THREE.PointsNodeMaterial() ); +``` + +## Constructor + +### new PointsNodeMaterial( parameters : Object ) + +Constructs a new points node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .alphaToCoverage : boolean + +Whether alpha to coverage should be used or not. + +Default is `true`. + +**Overrides:** [SpriteNodeMaterial#alphaToCoverage](SpriteNodeMaterial.html#alphaToCoverage) + +### .isPointsNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .sizeNode : Node. + +This node property provides an additional way to set the point size. + +Note that WebGPU only supports point primitives with 1 pixel size. Consequently, this node has no effect when the material is used with [Points](Points.html) and a WebGPU backend. If an application wants to render points with a size larger than 1 pixel, the material should be used with [Sprite](Sprite.html) and instancing. + +Default is `null`. + +## Source + +[src/materials/nodes/PointsNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/PointsNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/PolarGridHelper.html.md b/docs/pages/PolarGridHelper.html.md new file mode 100644 index 00000000000000..7166360956bd00 --- /dev/null +++ b/docs/pages/PolarGridHelper.html.md @@ -0,0 +1,68 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# PolarGridHelper + +This helper is an object to define polar grids. Grids are two-dimensional arrays of lines. + +## Code Example + +```js +const radius = 10; +const sectors = 16; +const rings = 8; +const divisions = 64; +const helper = new THREE.PolarGridHelper( radius, sectors, rings, divisions ); +scene.add( helper ); +``` + +## Constructor + +### new PolarGridHelper( radius : number, sectors : number, rings : number, divisions : number, color1 : number | Color | string, color2 : number | Color | string ) + +Constructs a new polar grid helper. + +**radius** + +The radius of the polar grid. This can be any positive number. + +Default is `10`. + +**sectors** + +The number of sectors the grid will be divided into. This can be any positive integer. + +Default is `16`. + +**rings** + +The number of rings. This can be any positive integer. + +Default is `16`. + +**divisions** + +The number of line segments used for each circle. This can be any positive integer. + +Default is `64`. + +**color1** + +The first color used for grid elements. + +Default is `0x444444`. + +**color2** + +The second color used for grid elements. + +Default is `0x888888`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[src/helpers/PolarGridHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/PolarGridHelper.js) \ No newline at end of file diff --git a/docs/pages/PolyhedronGeometry.html.md b/docs/pages/PolyhedronGeometry.html.md new file mode 100644 index 00000000000000..9d365231c27698 --- /dev/null +++ b/docs/pages/PolyhedronGeometry.html.md @@ -0,0 +1,53 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# PolyhedronGeometry + +A polyhedron is a solid in three dimensions with flat faces. This class will take an array of vertices, project them onto a sphere, and then divide them up to the desired level of detail. + +## Constructor + +### new PolyhedronGeometry( vertices : Array., indices : Array., radius : number, detail : number ) + +Constructs a new polyhedron geometry. + +**vertices** + +A flat array of vertices describing the base shape. + +**indices** + +A flat array of indices describing the base shape. + +**radius** + +The radius of the shape. + +Default is `1`. + +**detail** + +How many levels to subdivide the geometry. The more detail, the smoother the shape. + +Default is `0`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : PolyhedronGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/PolyhedronGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/PolyhedronGeometry.js) \ No newline at end of file diff --git a/docs/pages/PositionalAudio.html.md b/docs/pages/PositionalAudio.html.md new file mode 100644 index 00000000000000..4bc42e4be48ae6 --- /dev/null +++ b/docs/pages/PositionalAudio.html.md @@ -0,0 +1,137 @@ +*Inheritance: EventDispatcher → Object3D → Audio →* + +# PositionalAudio + +Represents a positional audio object. + +## Code Example + +```js +// create an AudioListener and add it to the camera +const listener = new THREE.AudioListener(); +camera.add( listener ); +// create the PositionalAudio object (passing in the listener) +const sound = new THREE.PositionalAudio( listener ); +// load a sound and set it as the PositionalAudio object's buffer +const audioLoader = new THREE.AudioLoader(); +audioLoader.load( 'sounds/song.ogg', function( buffer ) { + sound.setBuffer( buffer ); + sound.setRefDistance( 20 ); + sound.play(); +}); +// create an object for the sound to play from +const sphere = new THREE.SphereGeometry( 20, 32, 16 ); +const material = new THREE.MeshPhongMaterial( { color: 0xff2200 } ); +const mesh = new THREE.Mesh( sphere, material ); +scene.add( mesh ); +// finally add the sound to the mesh +mesh.add( sound ); +``` + +## Constructor + +### new PositionalAudio( listener : AudioListener ) + +Constructs a positional audio. + +**listener** + +The global audio listener. + +## Properties + +### .panner : PannerNode (readonly) + +The panner node represents the location, direction, and behavior of an audio source in 3D space. + +## Methods + +### .getDistanceModel() : 'linear' | 'inverse' | 'exponential' + +Returns the current distance model. + +**Returns:** The distance model. + +### .getMaxDistance() : number + +Returns the current max distance. + +**Returns:** The max distance. + +### .getRefDistance() : number + +Returns the current reference distance. + +**Returns:** The reference distance. + +### .getRolloffFactor() : number + +Returns the current rolloff factor. + +**Returns:** The rolloff factor. + +### .setDirectionalCone( coneInnerAngle : number, coneOuterAngle : number, coneOuterGain : number ) : PositionalAudio + +Sets the directional cone in which the audio can be listened. + +**coneInnerAngle** + +An angle, in degrees, of a cone inside of which there will be no volume reduction. + +**coneOuterAngle** + +An angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the `coneOuterGain` parameter. + +**coneOuterGain** + +The amount of volume reduction outside the cone defined by the `coneOuterAngle`. When set to `0`, no sound can be heard. + +**Returns:** A reference to this instance. + +### .setDistanceModel( value : 'linear' | 'inverse' | 'exponential' ) : PositionalAudio + +Defines which algorithm to use to reduce the volume of the audio source as it moves away from the listener. + +Read [the spec](https://www.w3.org/TR/webaudio-1.1/#enumdef-distancemodeltype) for more details. + +**value** + +The distance model to set. + +**Returns:** A reference to this instance. + +### .setMaxDistance( value : number ) : PositionalAudio + +Defines the maximum distance between the audio source and the listener, after which the volume is not reduced any further. + +This value is used only by the `linear` distance model. + +**value** + +The max distance. + +**Returns:** A reference to this instance. + +### .setRefDistance( value : number ) : PositionalAudio + +Defines the reference distance for reducing volume as the audio source moves further from the listener – i.e. the distance at which the volume reduction starts taking effect. + +**value** + +The reference distance to set. + +**Returns:** A reference to this instance. + +### .setRolloffFactor( value : number ) : PositionalAudio + +Defines how quickly the volume is reduced as the source moves away from the listener. + +**value** + +The rolloff factor. + +**Returns:** A reference to this instance. + +## Source + +[src/audio/PositionalAudio.js](https://github.com/mrdoob/three.js/blob/master/src/audio/PositionalAudio.js) \ No newline at end of file diff --git a/docs/pages/PositionalAudioHelper.html.md b/docs/pages/PositionalAudioHelper.html.md new file mode 100644 index 00000000000000..639561f4dd5a85 --- /dev/null +++ b/docs/pages/PositionalAudioHelper.html.md @@ -0,0 +1,91 @@ +*Inheritance: EventDispatcher → Object3D → Line →* + +# PositionalAudioHelper + +This helper displays the directional cone of a positional audio. + +`PositionalAudioHelper` must be added as a child of the positional audio. + +## Code Example + +```js +const positionalAudio = new THREE.PositionalAudio( listener ); +positionalAudio.setDirectionalCone( 180, 230, 0.1 ); +scene.add( positionalAudio ); +const helper = new PositionalAudioHelper( positionalAudio ); +positionalAudio.add( helper ); +``` + +## Import + +PositionalAudioHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { PositionalAudioHelper } from 'three/addons/helpers/PositionalAudioHelper.js'; +``` + +## Constructor + +### new PositionalAudioHelper( audio : PositionalAudio, range : number, divisionsInnerAngle : number, divisionsOuterAngle : number ) + +Constructs a new positional audio helper. + +**audio** + +The audio to visualize. + +**range** + +The range of the directional cone. + +Default is `1`. + +**divisionsInnerAngle** + +The number of divisions of the inner part of the directional cone. + +Default is `16`. + +**divisionsOuterAngle** + +The number of divisions of the outer part of the directional cone. + +Default is `2`. + +## Properties + +### .audio : PositionalAudio + +The audio to visualize. + +### .divisionsInnerAngle : number + +The number of divisions of the inner part of the directional cone. + +Default is `16`. + +### .divisionsOuterAngle : number + +The number of divisions of the outer part of the directional cone. + +Default is `2`. + +### .range : number + +The range of the directional cone. + +Default is `1`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the helper. This method must be called whenever the directional cone of the positional audio is changed. + +## Source + +[examples/jsm/helpers/PositionalAudioHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/PositionalAudioHelper.js) \ No newline at end of file diff --git a/docs/pages/PostProcessing.html.md b/docs/pages/PostProcessing.html.md new file mode 100644 index 00000000000000..a5974416132469 --- /dev/null +++ b/docs/pages/PostProcessing.html.md @@ -0,0 +1,79 @@ +# PostProcessing + +This module is responsible to manage the post processing setups in apps. You usually create a single instance of this class and use it to define the output of your post processing effect chain. + +Note: This module can only be used with `WebGPURenderer`. + +## Code Example + +```js +const postProcessing = new PostProcessing( renderer ); +const scenePass = pass( scene, camera ); +postProcessing.outputNode = scenePass; +``` + +## Constructor + +### new PostProcessing( renderer : Renderer, outputNode : Node. ) + +Constructs a new post processing management module. + +**renderer** + +A reference to the renderer. + +**outputNode** + +An optional output node. + +## Properties + +### .context : Object (readonly) + +Returns the current context of the post processing stack. + +### .needsUpdate : Node. + +Must be set to `true` when the output node changes. + +### .outputColorTransform : boolean + +Whether the default output tone mapping and color space transformation should be enabled or not. + +It is enabled by default by it must be disabled when effects must be executed after tone mapping and color space conversion. A typical example is FXAA which requires sRGB input. + +When set to `false`, the app must control the output transformation with `RenderOutputNode`. + +```js +const outputPass = renderOutput( scenePass ); +``` + +### .outputNode : Node. + +A node which defines the final output of the post processing. This is usually the last node in a chain of effect nodes. + +### .renderer : Renderer + +A reference to the renderer. + +## Methods + +### .dispose() + +Frees internal resources. + +### .render() + +When `PostProcessing` is used to apply post processing effects, the application must use this version of `render()` inside its animation loop (not the one from the renderer). + +### .renderAsync() : Promise (async) + +When `PostProcessing` is used to apply post processing effects, the application must use this version of `renderAsync()` inside its animation loop (not the one from the renderer). + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the render has been finished. + +## Source + +[src/renderers/common/PostProcessing.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/PostProcessing.js) \ No newline at end of file diff --git a/docs/pages/PosterizeNode.html.md b/docs/pages/PosterizeNode.html.md new file mode 100644 index 00000000000000..a08d4367307fdb --- /dev/null +++ b/docs/pages/PosterizeNode.html.md @@ -0,0 +1,33 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# PosterizeNode + +Represents a posterize effect which reduces the number of colors in an image, resulting in a more blocky and stylized appearance. + +## Constructor + +### new PosterizeNode( sourceNode : Node, stepsNode : Node ) + +Constructs a new posterize node. + +**sourceNode** + +The input color. + +**stepsNode** + +Controls the intensity of the posterization effect. A lower number results in a more blocky appearance. + +## Properties + +### .sourceNode : Node + +The input color. + +### .stepsNode : Node + +Controls the intensity of the posterization effect. A lower number results in a more blocky appearance. + +## Source + +[src/nodes/display/PosterizeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/PosterizeNode.js) \ No newline at end of file diff --git a/docs/pages/ProgressiveLightMap.html.md b/docs/pages/ProgressiveLightMap.html.md new file mode 100644 index 00000000000000..cc08662f3a9174 --- /dev/null +++ b/docs/pages/ProgressiveLightMap.html.md @@ -0,0 +1,95 @@ +# ProgressiveLightMap + +Progressive Light Map Accumulator, by [zalo](https://github.com/zalo/). + +To use, simply construct a `ProgressiveLightMap` object, `plmap.addObjectsToLightMap(object)` an array of semi-static objects and lights to the class once, and then call `plmap.update(camera)` every frame to begin accumulating lighting samples. + +This should begin accumulating lightmaps which apply to your objects, so you can start jittering lighting to achieve the texture-space effect you're looking for. + +This class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import from `ProgressiveLightMapGPU.js`. + +## Import + +ProgressiveLightMap is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMap.js'; +``` + +## Constructor + +### new ProgressiveLightMap( renderer : WebGLRenderer, res : number ) + +Constructs a new progressive light map. + +**renderer** + +The renderer. + +**res** + +The side-long dimension of the total lightmap. + +Default is `1024`. + +## Properties + +### .renderer : WebGLRenderer + +The renderer. + +### .res : number + +The side-long dimension of the total lightmap. + +Default is `1024`. + +## Methods + +### .addObjectsToLightMap( objects : Array. ) + +Sets these objects' materials' lightmaps and modifies their uv1's. + +**objects** + +An array of objects and lights to set up your lightmap. + +### .dispose() + +Frees all internal resources. + +### .showDebugLightmap( visible : boolean, position : Vector3 ) + +Draws the lightmap in the main scene. Call this after adding the objects to it. + +**visible** + +Whether the debug plane should be visible + +**position** + +Where the debug plane should be drawn + +### .update( camera : Camera, blendWindow : number, blurEdges : boolean ) + +This function renders each mesh one at a time into their respective surface maps. + +**camera** + +The camera the scene is rendered with. + +**blendWindow** + +When >1, samples will accumulate over time. + +Default is `100`. + +**blurEdges** + +Whether to fix UV Edges via blurring. + +Default is `true`. + +## Source + +[examples/jsm/misc/ProgressiveLightMap.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/ProgressiveLightMap.js) \ No newline at end of file diff --git a/docs/pages/Projector.html.md b/docs/pages/Projector.html.md new file mode 100644 index 00000000000000..fbec1ae9bf1aa8 --- /dev/null +++ b/docs/pages/Projector.html.md @@ -0,0 +1,45 @@ +# Projector + +This class can project a given scene in 3D space into a 2D representation used for rendering with a 2D API. `Projector` is currently used by [SVGRenderer](SVGRenderer.html) and was previously used by the legacy `CanvasRenderer`. + +## Import + +Projector is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Projector } from 'three/addons/renderers/Projector.js'; +``` + +## Constructor + +### new Projector() + +Constructs a new projector. + +## Methods + +### .projectScene( scene : Object3D, camera : Camera, sortObjects : boolean, sortElements : boolean ) : Object + +Projects the given scene in 3D space into a 2D representation. The result is an object with renderable items. + +**scene** + +A scene or any other type of 3D object. + +**camera** + +The camera. + +**sortObjects** + +Whether to sort objects or not. + +**sortElements** + +Whether to sort elements (faces, lines and sprites) or not. + +**Returns:** The projected scene as renderable objects. + +## Source + +[examples/jsm/renderers/Projector.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/Projector.js) \ No newline at end of file diff --git a/docs/pages/ProjectorLight.html.md b/docs/pages/ProjectorLight.html.md new file mode 100644 index 00000000000000..ef2636d8d9aa87 --- /dev/null +++ b/docs/pages/ProjectorLight.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Object3D → Light → SpotLight →* + +# ProjectorLight + +A projector light version of [SpotLight](SpotLight.html). Can only be used with [WebGPURenderer](WebGPURenderer.html). + +## Constructor + +### new ProjectorLight( color : number | Color | string, intensity : number, distance : number, angle : number, penumbra : number, decay : number ) + +Constructs a new projector light. + +**color** + +The light's color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity measured in candela (cd). + +Default is `1`. + +**distance** + +Maximum range of the light. `0` means no limit. + +Default is `0`. + +**angle** + +Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`. + +Default is `Math.PI/3`. + +**penumbra** + +Percent of the spotlight cone that is attenuated due to penumbra. Value range is `[0,1]`. + +Default is `0`. + +**decay** + +The amount the light dims along the distance of the light. + +Default is `2`. + +## Properties + +### .aspect : number + +Aspect ratio of the light. Set to `null` to use the texture aspect ratio. + +Default is `null`. + +## Source + +[src/lights/webgpu/ProjectorLight.js](https://github.com/mrdoob/three.js/blob/master/src/lights/webgpu/ProjectorLight.js) \ No newline at end of file diff --git a/docs/pages/ProjectorLightNode.html.md b/docs/pages/ProjectorLightNode.html.md new file mode 100644 index 00000000000000..6124af310fbb28 --- /dev/null +++ b/docs/pages/ProjectorLightNode.html.md @@ -0,0 +1,27 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode → SpotLightNode →* + +# ProjectorLightNode + +An implementation of a projector light node. + +## Constructor + +### new ProjectorLightNode() + +## Methods + +### .getSpotAttenuation( builder : NodeBuilder ) : Node. + +Overwrites the default implementation to compute projection attenuation. + +**builder** + +The node builder. + +**Overrides:** [SpotLightNode#getSpotAttenuation](SpotLightNode.html#getSpotAttenuation) + +**Returns:** The spot attenuation. + +## Source + +[src/nodes/lighting/ProjectorLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/ProjectorLightNode.js) \ No newline at end of file diff --git a/docs/pages/PropertyBinding.html.md b/docs/pages/PropertyBinding.html.md new file mode 100644 index 00000000000000..cbc708fcc37857 --- /dev/null +++ b/docs/pages/PropertyBinding.html.md @@ -0,0 +1,117 @@ +# PropertyBinding + +This holds a reference to a real property in the scene graph; used internally. + +## Constructor + +### new PropertyBinding( rootNode : Object, path : string, parsedPath : Object ) + +Constructs a new property binding. + +**rootNode** + +The root node. + +**path** + +The path. + +**parsedPath** + +The parsed path. + +## Properties + +### .node : Object + +The object owns the animated property. + +### .parsedPath : Object + +An object holding information about the path. + +### .path : string + +The object path to the animated property. + +### .rootNode : Object3D | Skeleton + +The root node. + +## Methods + +### .bind() + +Creates a getter / setter pair for the property tracked by this binding. + +### .unbind() + +Unbinds the property. + +## Static Methods + +### .create( root : Object, path : string, parsedPath : Object ) : PropertyBinding | Composite + +Factory method for creating a property binding from the given parameters. + +**root** + +The root node. + +**path** + +The path. + +**parsedPath** + +The parsed path. + +**Returns:** The created property binding or composite. + +### .findNode( root : Object, nodeName : string | number ) : Object + +Searches for a node in the hierarchy of the given root object by the given node name. + +**root** + +The root object. + +**nodeName** + +The name of the node. + +**Returns:** The found node. Returns `null` if no object was found. + +### .parseTrackName( trackName : string ) : Object + +Parses the given track name (an object path to an animated property) and returns an object with information about the path. Matches strings in the following forms: + +* nodeName.property +* nodeName.property\[accessor\] +* nodeName.material.property\[accessor\] +* uuid.property\[accessor\] +* uuid.objectName\[objectIndex\].propertyName\[propertyIndex\] +* parentName/nodeName.property +* parentName/parentName/nodeName.property\[index\] +* .bone\[Armature.DEF\_cog\].position +* scene:helium\_balloon\_model:helium\_balloon\_model.position + +**trackName** + +The track name to parse. + +**Returns:** The parsed track name as an object. + +### .sanitizeNodeName( name : string ) : string + +Replaces spaces with underscores and removes unsupported characters from node names, to ensure compatibility with parseTrackName(). + +**name** + +Node name to be sanitized. + +**Returns:** The sanitized node name. + +## Source + +[src/animation/PropertyBinding.js](https://github.com/mrdoob/three.js/blob/master/src/animation/PropertyBinding.js) \ No newline at end of file diff --git a/docs/pages/PropertyMixer.html.md b/docs/pages/PropertyMixer.html.md new file mode 100644 index 00000000000000..39e4ba6d673190 --- /dev/null +++ b/docs/pages/PropertyMixer.html.md @@ -0,0 +1,97 @@ +# PropertyMixer + +Buffered scene graph property that allows weighted accumulation; used internally. + +## Constructor + +### new PropertyMixer( binding : PropertyBinding, typeName : string, valueSize : number ) + +Constructs a new property mixer. + +**binding** + +The property binding. + +**typeName** + +The keyframe track type name. + +**valueSize** + +The keyframe track value size. + +## Properties + +### .binding : PropertyBinding + +The property binding. + +### .cumulativeWeight : number + +TODO + +Default is `0`. + +### .cumulativeWeightAdditive : number + +TODO + +Default is `0`. + +### .referenceCount : number + +TODO + +Default is `0`. + +### .useCount : number + +TODO + +Default is `0`. + +### .valueSize : number + +The keyframe track value size. + +## Methods + +### .accumulate( accuIndex : number, weight : number ) + +Accumulates data in the `incoming` region into `accu`. + +**accuIndex** + +The accumulation index. + +**weight** + +The weight. + +### .accumulateAdditive( weight : number ) + +Accumulates data in the `incoming` region into `add`. + +**weight** + +The weight. + +### .apply( accuIndex : number ) + +Applies the state of `accu` to the binding when accus differ. + +**accuIndex** + +The accumulation index. + +### .restoreOriginalState() + +Applies the state previously taken via [PropertyMixer#saveOriginalState](PropertyMixer.html#saveOriginalState) to the binding. + +### .saveOriginalState() + +Remembers the state of the bound property and copy it to both accus. + +## Source + +[src/animation/PropertyMixer.js](https://github.com/mrdoob/three.js/blob/master/src/animation/PropertyMixer.js) \ No newline at end of file diff --git a/docs/pages/PropertyNode.html.md b/docs/pages/PropertyNode.html.md new file mode 100644 index 00000000000000..86e5257de9a8db --- /dev/null +++ b/docs/pages/PropertyNode.html.md @@ -0,0 +1,69 @@ +*Inheritance: EventDispatcher → Node →* + +# PropertyNode + +This class represents a shader property. It can be used to explicitly define a property and assign a value to it. + +`PropertyNode` is used by the engine to predefined common material properties for TSL code. + +## Code Example + +```js +const threshold = property( 'float', 'threshold' ).assign( THRESHOLD ); +``` + +## Constructor + +### new PropertyNode( nodeType : string, name : string, varying : boolean ) + +Constructs a new property node. + +**nodeType** + +The type of the node. + +**name** + +The name of the property in the shader. + +Default is `null`. + +**varying** + +Whether this property is a varying or not. + +Default is `false`. + +## Properties + +### .global : boolean + +This flag is used for global cache. + +Default is `true`. + +**Overrides:** [Node#global](Node.html#global) + +### .isPropertyNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the property in the shader. If no name is defined, the node system auto-generates one. + +Default is `null`. + +**Overrides:** [Node#name](Node.html#name) + +### .varying : boolean + +Whether this property is a varying or not. + +Default is `false`. + +## Source + +[src/nodes/core/PropertyNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/PropertyNode.js) \ No newline at end of file diff --git a/docs/pages/QuadMesh.html.md b/docs/pages/QuadMesh.html.md new file mode 100644 index 00000000000000..50a8f550c48e5e --- /dev/null +++ b/docs/pages/QuadMesh.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# QuadMesh + +This module is a helper for passes which need to render a full screen effect which is quite common in context of post processing. + +The intended usage is to reuse a single quad mesh for rendering subsequent passes by just reassigning the `material` reference. + +Note: This module can only be used with `WebGPURenderer`. + +## Constructor + +### new QuadMesh( material : Material ) + +Constructs a new quad mesh. + +**material** + +The material to render the quad mesh with. + +Default is `null`. + +## Properties + +### .camera : OrthographicCamera (readonly) + +The camera to render the quad mesh with. + +### .isQuadMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .render( renderer : Renderer ) + +Renders the quad mesh + +**renderer** + +The renderer. + +### .renderAsync( renderer : Renderer ) : Promise (async) + +Async version of `render()`. + +**renderer** + +The renderer. + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the render has been finished. + +## Source + +[src/renderers/common/QuadMesh.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/QuadMesh.js) \ No newline at end of file diff --git a/docs/pages/QuadraticBezierCurve.html.md b/docs/pages/QuadraticBezierCurve.html.md new file mode 100644 index 00000000000000..b32e895a289269 --- /dev/null +++ b/docs/pages/QuadraticBezierCurve.html.md @@ -0,0 +1,80 @@ +*Inheritance: Curve →* + +# QuadraticBezierCurve + +A curve representing a 2D Quadratic Bezier curve. + +## Code Example + +```js +const curve = new THREE.QuadraticBezierCurve( + new THREE.Vector2( - 10, 0 ), + new THREE.Vector2( 20, 15 ), + new THREE.Vector2( 10, 0 ) +) +const points = curve.getPoints( 50 ); +const geometry = new THREE.BufferGeometry().setFromPoints( points ); +const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); +// Create the final object to add to the scene +const curveObject = new THREE.Line( geometry, material ); +``` + +## Constructor + +### new QuadraticBezierCurve( v0 : Vector2, v1 : Vector2, v2 : Vector2 ) + +Constructs a new Quadratic Bezier curve. + +**v0** + +The start point. + +**v1** + +The control point. + +**v2** + +The end point. + +## Properties + +### .isQuadraticBezierCurve : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .v0 : Vector2 + +The start point. + +### .v1 : Vector2 + +The control point. + +### .v2 : Vector2 + +The end point. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector2 ) : Vector2 + +Returns a point on the curve. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[src/extras/curves/QuadraticBezierCurve.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/QuadraticBezierCurve.js) \ No newline at end of file diff --git a/docs/pages/QuadraticBezierCurve3.html.md b/docs/pages/QuadraticBezierCurve3.html.md new file mode 100644 index 00000000000000..797b6ef8a50ed6 --- /dev/null +++ b/docs/pages/QuadraticBezierCurve3.html.md @@ -0,0 +1,65 @@ +*Inheritance: Curve →* + +# QuadraticBezierCurve3 + +A curve representing a 3D Quadratic Bezier curve. + +## Constructor + +### new QuadraticBezierCurve3( v0 : Vector3, v1 : Vector3, v2 : Vector3 ) + +Constructs a new Quadratic Bezier curve. + +**v0** + +The start point. + +**v1** + +The control point. + +**v2** + +The end point. + +## Properties + +### .isQuadraticBezierCurve3 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .v0 : Vector3 + +The start point. + +### .v1 : Vector3 + +The control point. + +### .v2 : Vector3 + +The end point. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +Returns a point on the curve. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[src/extras/curves/QuadraticBezierCurve3.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/QuadraticBezierCurve3.js) \ No newline at end of file diff --git a/docs/pages/Quaternion.html.md b/docs/pages/Quaternion.html.md new file mode 100644 index 00000000000000..7cc07e7cf69752 --- /dev/null +++ b/docs/pages/Quaternion.html.md @@ -0,0 +1,454 @@ +# Quaternion + +Class for representing a Quaternion. Quaternions are used in three.js to represent rotations. + +Iterating through a vector instance will yield its components `(x, y, z, w)` in the corresponding order. + +Note that three.js expects Quaternions to be normalized. + +## Code Example + +```js +const quaternion = new THREE.Quaternion(); +quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 ); +const vector = new THREE.Vector3( 1, 0, 0 ); +vector.applyQuaternion( quaternion ); +``` + +## Constructor + +### new Quaternion( x : number, y : number, z : number, w : number ) + +Constructs a new quaternion. + +**x** + +The x value of this quaternion. + +Default is `0`. + +**y** + +The y value of this quaternion. + +Default is `0`. + +**z** + +The z value of this quaternion. + +Default is `0`. + +**w** + +The w value of this quaternion. + +Default is `1`. + +## Properties + +### .isQuaternion : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .w : number + +The w value of this quaternion. + +Default is `1`. + +### .x : number + +The x value of this quaternion. + +Default is `0`. + +### .y : number + +The y value of this quaternion. + +Default is `0`. + +### .z : number + +The z value of this quaternion. + +Default is `0`. + +## Methods + +### .angleTo( q : Quaternion ) : number + +Returns the angle between this quaternion and the given one in radians. + +**q** + +The quaternion to compute the angle with. + +**Returns:** The angle in radians. + +### .clone() : Quaternion + +Returns a new quaternion with copied values from this instance. + +**Returns:** A clone of this instance. + +### .conjugate() : Quaternion + +Returns the rotational conjugate of this quaternion. The conjugate of a quaternion represents the same rotation in the opposite direction about the rotational axis. + +**Returns:** A reference to this quaternion. + +### .copy( quaternion : Quaternion ) : Quaternion + +Copies the values of the given quaternion to this instance. + +**quaternion** + +The quaternion to copy. + +**Returns:** A reference to this quaternion. + +### .dot( v : Quaternion ) : number + +Calculates the dot product of this quaternion and the given one. + +**v** + +The quaternion to compute the dot product with. + +**Returns:** The result of the dot product. + +### .equals( quaternion : Quaternion ) : boolean + +Returns `true` if this quaternion is equal with the given one. + +**quaternion** + +The quaternion to test for equality. + +**Returns:** Whether this quaternion is equal with the given one. + +### .fromArray( array : Array., offset : number ) : Quaternion + +Sets this quaternion's components from the given array. + +**array** + +An array holding the quaternion component values. + +**offset** + +The offset into the array. + +Default is `0`. + +**Returns:** A reference to this quaternion. + +### .fromBufferAttribute( attribute : BufferAttribute, index : number ) : Quaternion + +Sets the components of this quaternion from the given buffer attribute. + +**attribute** + +The buffer attribute holding quaternion data. + +**index** + +The index into the attribute. + +**Returns:** A reference to this quaternion. + +### .identity() : Quaternion + +Sets this quaternion to the identity quaternion; that is, to the quaternion that represents "no rotation". + +**Returns:** A reference to this quaternion. + +### .invert() : Quaternion + +Inverts this quaternion via [Quaternion#conjugate](Quaternion.html#conjugate). The quaternion is assumed to have unit length. + +**Returns:** A reference to this quaternion. + +### .length() : number + +Computes the Euclidean length (straight-line length) of this quaternion, considered as a 4 dimensional vector. + +**Returns:** The Euclidean length. + +### .lengthSq() : number + +Computes the squared Euclidean length (straight-line length) of this quaternion, considered as a 4 dimensional vector. This can be useful if you are comparing the lengths of two quaternions, as this is a slightly more efficient calculation than [Quaternion#length](Quaternion.html#length). + +**Returns:** The squared Euclidean length. + +### .multiply( q : Quaternion ) : Quaternion + +Multiplies this quaternion by the given one. + +**q** + +The quaternion. + +**Returns:** A reference to this quaternion. + +### .multiplyQuaternions( a : Quaternion, b : Quaternion ) : Quaternion + +Multiplies the given quaternions and stores the result in this instance. + +**a** + +The first quaternion. + +**b** + +The second quaternion. + +**Returns:** A reference to this quaternion. + +### .normalize() : Quaternion + +Normalizes this quaternion - that is, calculated the quaternion that performs the same rotation as this one, but has a length equal to `1`. + +**Returns:** A reference to this quaternion. + +### .premultiply( q : Quaternion ) : Quaternion + +Pre-multiplies this quaternion by the given one. + +**q** + +The quaternion. + +**Returns:** A reference to this quaternion. + +### .random() : Quaternion + +Sets this quaternion to a uniformly random, normalized quaternion. + +**Returns:** A reference to this quaternion. + +### .rotateTowards( q : Quaternion, step : number ) : Quaternion + +Rotates this quaternion by a given angular step to the given quaternion. The method ensures that the final quaternion will not overshoot `q`. + +**q** + +The target quaternion. + +**step** + +The angular step in radians. + +**Returns:** A reference to this quaternion. + +### .set( x : number, y : number, z : number, w : number ) : Quaternion + +Sets the quaternion components. + +**x** + +The x value of this quaternion. + +**y** + +The y value of this quaternion. + +**z** + +The z value of this quaternion. + +**w** + +The w value of this quaternion. + +**Returns:** A reference to this quaternion. + +### .setFromAxisAngle( axis : Vector3, angle : number ) : Quaternion + +Sets this quaternion from the given axis and angle. + +**axis** + +The normalized axis. + +**angle** + +The angle in radians. + +**Returns:** A reference to this quaternion. + +### .setFromEuler( euler : Euler, update : boolean ) : Quaternion + +Sets this quaternion from the rotation specified by the given Euler angles. + +**euler** + +The Euler angles. + +**update** + +Whether the internal `onChange` callback should be executed or not. + +Default is `true`. + +**Returns:** A reference to this quaternion. + +### .setFromRotationMatrix( m : Matrix4 ) : Quaternion + +Sets this quaternion from the given rotation matrix. + +**m** + +A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled). + +**Returns:** A reference to this quaternion. + +### .setFromUnitVectors( vFrom : Vector3, vTo : Vector3 ) : Quaternion + +Sets this quaternion to the rotation required to rotate the direction vector `vFrom` to the direction vector `vTo`. + +**vFrom** + +The first (normalized) direction vector. + +**vTo** + +The second (normalized) direction vector. + +**Returns:** A reference to this quaternion. + +### .slerp( qb : Quaternion, t : number ) : Quaternion + +Performs a spherical linear interpolation between this quaternion and the target quaternion. + +**qb** + +The target quaternion. + +**t** + +The interpolation factor. A value in the range `[0,1]` will interpolate. A value outside the range `[0,1]` will extrapolate. + +**Returns:** A reference to this quaternion. + +### .slerpQuaternions( qa : Quaternion, qb : Quaternion, t : number ) : Quaternion + +Performs a spherical linear interpolation between the given quaternions and stores the result in this quaternion. + +**qa** + +The source quaternion. + +**qb** + +The target quaternion. + +**t** + +The interpolation factor in the closed interval `[0, 1]`. + +**Returns:** A reference to this quaternion. + +### .toArray( array : Array., offset : number ) : Array. + +Writes the components of this quaternion to the given array. If no array is provided, the method returns a new instance. + +**array** + +The target array holding the quaternion components. + +Default is `[]`. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** The quaternion components. + +### .toJSON() : Array. + +This methods defines the serialization result of this class. Returns the numerical elements of this quaternion in an array of format `[x, y, z, w]`. + +**Returns:** The serialized quaternion. + +## Static Methods + +### .multiplyQuaternionsFlat( dst : Array., dstOffset : number, src0 : Array., srcOffset0 : number, src1 : Array., srcOffset1 : number ) : Array. + +Multiplies two quaternions. This implementation assumes the quaternion data are managed in flat arrays. + +**dst** + +The destination array. + +**dstOffset** + +An offset into the destination array. + +**src0** + +The source array of the first quaternion. + +**srcOffset0** + +An offset into the first source array. + +**src1** + +The source array of the second quaternion. + +**srcOffset1** + +An offset into the second source array. + +See: + +* [Quaternion#multiplyQuaternions](Quaternion.html#multiplyQuaternions). + +**Returns:** The destination array. + +### .slerpFlat( dst : Array., dstOffset : number, src0 : Array., srcOffset0 : number, src1 : Array., srcOffset1 : number, t : number ) + +Interpolates between two quaternions via SLERP. This implementation assumes the quaternion data are managed in flat arrays. + +**dst** + +The destination array. + +**dstOffset** + +An offset into the destination array. + +**src0** + +The source array of the first quaternion. + +**srcOffset0** + +An offset into the first source array. + +**src1** + +The source array of the second quaternion. + +**srcOffset1** + +An offset into the second source array. + +**t** + +The interpolation factor. A value in the range `[0,1]` will interpolate. A value outside the range `[0,1]` will extrapolate. + +See: + +* [Quaternion#slerp](Quaternion.html#slerp) + +## Source + +[src/math/Quaternion.js](https://github.com/mrdoob/three.js/blob/master/src/math/Quaternion.js) \ No newline at end of file diff --git a/docs/pages/QuaternionKeyframeTrack.html.md b/docs/pages/QuaternionKeyframeTrack.html.md new file mode 100644 index 00000000000000..1af340cbe10b93 --- /dev/null +++ b/docs/pages/QuaternionKeyframeTrack.html.md @@ -0,0 +1,55 @@ +*Inheritance: KeyframeTrack →* + +# QuaternionKeyframeTrack + +A track for Quaternion keyframe values. + +## Constructor + +### new QuaternionKeyframeTrack( name : string, times : Array., values : Array., interpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth ) + +Constructs a new Quaternion keyframe track. + +**name** + +The keyframe track's name. + +**times** + +A list of keyframe times. + +**values** + +A list of keyframe values. + +**interpolation** + +The interpolation type. + +## Properties + +### .ValueTypeName : string + +The value type name. + +Default is `'quaternion'`. + +**Overrides:** [KeyframeTrack#ValueTypeName](KeyframeTrack.html#ValueTypeName) + +## Methods + +### .InterpolantFactoryMethodLinear( result : TypedArray ) : QuaternionLinearInterpolant + +Overwritten so the method returns Quaternion based interpolant. + +**result** + +The result buffer. + +**Overrides:** [KeyframeTrack#InterpolantFactoryMethodLinear](KeyframeTrack.html#InterpolantFactoryMethodLinear) + +**Returns:** The new interpolant. + +## Source + +[src/animation/tracks/QuaternionKeyframeTrack.js](https://github.com/mrdoob/three.js/blob/master/src/animation/tracks/QuaternionKeyframeTrack.js) \ No newline at end of file diff --git a/docs/pages/QuaternionLinearInterpolant.html.md b/docs/pages/QuaternionLinearInterpolant.html.md new file mode 100644 index 00000000000000..680204957b1a3f --- /dev/null +++ b/docs/pages/QuaternionLinearInterpolant.html.md @@ -0,0 +1,31 @@ +*Inheritance: Interpolant →* + +# QuaternionLinearInterpolant + +Spherical linear unit quaternion interpolant. + +## Constructor + +### new QuaternionLinearInterpolant( parameterPositions : TypedArray, sampleValues : TypedArray, sampleSize : number, resultBuffer : TypedArray ) + +Constructs a new SLERP interpolant. + +**parameterPositions** + +The parameter positions hold the interpolation factors. + +**sampleValues** + +The sample values. + +**sampleSize** + +The sample size + +**resultBuffer** + +The result buffer. + +## Source + +[src/math/interpolants/QuaternionLinearInterpolant.js](https://github.com/mrdoob/three.js/blob/master/src/math/interpolants/QuaternionLinearInterpolant.js) \ No newline at end of file diff --git a/docs/pages/RGBShiftNode.html.md b/docs/pages/RGBShiftNode.html.md new file mode 100644 index 00000000000000..6ef0a879c7bfcc --- /dev/null +++ b/docs/pages/RGBShiftNode.html.md @@ -0,0 +1,65 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# RGBShiftNode + +Post processing node for shifting/splitting RGB color channels. The effect separates color channels and offsets them from each other. + +## Import + +RGBShiftNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { rgbShift } from 'three/addons/tsl/display/RGBShiftNode.js'; +``` + +## Constructor + +### new RGBShiftNode( textureNode : TextureNode, amount : number, angle : number ) + +Constructs a new RGB shift node. + +**textureNode** + +The texture node that represents the input of the effect. + +**amount** + +The amount of the RGB shift. + +Default is `0.005`. + +**angle** + +Defines the orientation in which colors are shifted. + +Default is `0`. + +## Properties + +### .amount : UniformNode. + +The amount of the RGB shift. + +### .angle : UniformNode. + +Defines in which direction colors are shifted. + +### .textureNode : TextureNode + +The texture node that represents the input of the effect. + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +## Source + +[examples/jsm/tsl/display/RGBShiftNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/RGBShiftNode.js) \ No newline at end of file diff --git a/docs/pages/RTTNode.html.md b/docs/pages/RTTNode.html.md new file mode 100644 index 00000000000000..f7a21451625b95 --- /dev/null +++ b/docs/pages/RTTNode.html.md @@ -0,0 +1,119 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode →* + +# RTTNode + +`RTTNode` takes another node and uses it with a `QuadMesh` to render into a texture (RTT). This module is especially relevant in context of post processing where certain nodes require texture input for their effects. With the helper function `convertToTexture()` which is based on this module, the node system can automatically ensure texture input if required. + +## Constructor + +### new RTTNode( node : Node, width : number, height : number, options : Object ) + +Constructs a new RTT node. + +**node** + +The node to render a texture with. + +**width** + +The width of the internal render target. If not width is applied, the render target is automatically resized. + +Default is `null`. + +**height** + +The height of the internal render target. + +Default is `null`. + +**options** + +The options for the internal render target. + +Default is `{type:HalfFloatType}`. + +## Properties + +### .autoResize : boolean (readonly) + +Whether the internal render target should automatically be resized or not. + +Default is `true`. + +### .autoUpdate : boolean + +Whether the texture should automatically be updated or not. + +Default is `true`. + +### .height : number + +The height of the internal render target. + +Default is `null`. + +### .isRTTNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .node : Node + +The node to render a texture with. + +### .pixelRatio : number + +The pixel ratio + +Default is `1`. + +### .renderTarget : RenderTarget + +The render target + +### .textureNeedsUpdate : boolean + +Whether the texture requires an update or not. + +Default is `true`. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.RENDER` since the node updates the texture once per render in its [RTTNode#updateBefore](RTTNode.html#updateBefore) method. + +Default is `'render'`. + +**Overrides:** [TextureNode#updateBeforeType](TextureNode.html#updateBeforeType) + +### .width : number + +The width of the internal render target. If not width is applied, the render target is automatically resized. + +Default is `null`. + +## Methods + +### .setPixelRatio( pixelRatio : number ) + +Sets the pixel ratio. This will also resize the render target. + +**pixelRatio** + +The pixel ratio to set. + +### .setSize( width : number, height : number ) + +Sets the size of the internal render target + +**width** + +The width to set. + +**height** + +The width to set. + +## Source + +[src/nodes/utils/RTTNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/RTTNode.js) \ No newline at end of file diff --git a/docs/pages/RangeNode.html.md b/docs/pages/RangeNode.html.md new file mode 100644 index 00000000000000..b46d97dd571fe7 --- /dev/null +++ b/docs/pages/RangeNode.html.md @@ -0,0 +1,83 @@ +*Inheritance: EventDispatcher → Node →* + +# RangeNode + +`RangeNode` generates random instanced attribute data in a defined range. An exemplary use case for this utility node is to generate random per-instance colors: + +## Code Example + +```js +const material = new MeshBasicNodeMaterial(); +material.colorNode = range( new Color( 0x000000 ), new Color( 0xFFFFFF ) ); +const mesh = new InstancedMesh( geometry, material, count ); +``` + +## Constructor + +### new RangeNode( minNode : Node., maxNode : Node. ) + +Constructs a new range node. + +**minNode** + +A node defining the lower bound of the range. + +Default is `float()`. + +**maxNode** + +A node defining the upper bound of the range. + +Default is `float()`. + +## Properties + +### .maxNode : Node. + +A node defining the upper bound of the range. + +Default is `float()`. + +### .minNode : Node. + +A node defining the lower bound of the range. + +Default is `float()`. + +## Methods + +### .getConstNode( node : Node ) : Node + +Returns a constant node from the given node by traversing it. + +**node** + +The node to traverse. + +**Returns:** The constant node, if found. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from range definition. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .getVectorLength( builder : NodeBuilder ) : number + +Returns the vector length which is computed based on the range definition. + +**builder** + +The current node builder. + +**Returns:** The vector length. + +## Source + +[src/nodes/geometry/RangeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/geometry/RangeNode.js) \ No newline at end of file diff --git a/docs/pages/RapierHelper.html.md b/docs/pages/RapierHelper.html.md new file mode 100644 index 00000000000000..ac155199c33c99 --- /dev/null +++ b/docs/pages/RapierHelper.html.md @@ -0,0 +1,43 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# RapierHelper + +This class displays all Rapier Colliders in outline. + +## Import + +RapierHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; +``` + +## Constructor + +### new RapierHelper( world : RAPIER.world ) + +Constructs a new Rapier debug helper. + +**world** + +The Rapier world to visualize. + +## Properties + +### .world : RAPIER.world + +The Rapier world to visualize. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Call this in the render loop to update the outlines. + +## Source + +[examples/jsm/helpers/RapierHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/RapierHelper.js) \ No newline at end of file diff --git a/docs/pages/RapierPhysics.html.md b/docs/pages/RapierPhysics.html.md new file mode 100644 index 00000000000000..f27e659e3fecea --- /dev/null +++ b/docs/pages/RapierPhysics.html.md @@ -0,0 +1,139 @@ +# RapierPhysics + +Can be used to include Rapier as a Physics engine into `three.js` apps. The API can be initialized via: + +The component automatically imports Rapier from a CDN so make sure to use the component with an active Internet connection. + +## Code Example + +```js +const physics = await RapierPhysics(); +``` + +## Import + +RapierPhysics is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; +``` + +## Methods + +### .addHeightfield( mesh : Mesh, width : number, depth : number, heights : Float32Array, scale : Object ) : RigidBody + +Adds a heightfield terrain to the physics simulation. + +**mesh** + +The Three.js mesh representing the terrain. + +**width** + +The number of vertices along the width (x-axis) of the heightfield. + +**depth** + +The number of vertices along the depth (z-axis) of the heightfield. + +**heights** + +Array of height values for each vertex in the heightfield. + +**scale** + +Scale factors for the heightfield dimensions. + +**x** + +Scale factor for width. + +**y** + +Scale factor for height. + +**z** + +Scale factor for depth. + +**Returns:** The created Rapier rigid body for the heightfield. + +### .addMesh( mesh : Mesh, mass : number, restitution : number ) + +Adds the given mesh to this physics simulation. + +**mesh** + +The mesh to add. + +**mass** + +The mass in kg of the mesh. + +Default is `0`. + +**restitution** + +The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. + +Default is `0`. + +### .addScene( scene : Object3D ) + +Adds the given scene to this physics simulation. Only meshes with a `physics` object in their [Object3D#userData](Object3D.html#userData) field will be honored. The object can be used to store the mass and restitution of the mesh. E.g.: + +```js +box.userData.physics = { mass: 1, restitution: 0 }; +``` + +**scene** + +The scene or any type of 3D object to add. + +### .removeMesh( mesh : Mesh ) + +Removes the given mesh from this physics simulation. + +**mesh** + +The mesh to remove. + +### .setMeshPosition( mesh : Mesh, position : Vector3, index : number ) + +Set the position of the given mesh which is part of the physics simulation. Calling this method will reset the current simulated velocity of the mesh. + +**mesh** + +The mesh to update the position for. + +**position** + +The new position. + +**index** + +If the mesh is instanced, the index represents the instanced ID. + +Default is `0`. + +### .setMeshVelocity( mesh : Mesh, velocity : Vector3, index : number ) + +Set the velocity of the given mesh which is part of the physics simulation. + +**mesh** + +The mesh to update the velocity for. + +**velocity** + +The new velocity. + +**index** + +If the mesh is instanced, the index represents the instanced ID. + +Default is `0`. + +## Source + +[examples/jsm/physics/RapierPhysics.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/physics/RapierPhysics.js) \ No newline at end of file diff --git a/docs/pages/RawShaderMaterial.html.md b/docs/pages/RawShaderMaterial.html.md new file mode 100644 index 00000000000000..22d083bc8a8f5f --- /dev/null +++ b/docs/pages/RawShaderMaterial.html.md @@ -0,0 +1,29 @@ +*Inheritance: EventDispatcher → Material → ShaderMaterial →* + +# RawShaderMaterial + +This class works just like [ShaderMaterial](ShaderMaterial.html), except that definitions of built-in uniforms and attributes are not automatically prepended to the GLSL shader code. + +`RawShaderMaterial` can only be used with [WebGLRenderer](WebGLRenderer.html). + +## Constructor + +### new RawShaderMaterial( parameters : Object ) + +Constructs a new raw shader material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .isRawShaderMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/materials/RawShaderMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/RawShaderMaterial.js) \ No newline at end of file diff --git a/docs/pages/Ray.html.md b/docs/pages/Ray.html.md new file mode 100644 index 00000000000000..f0a2b54f4b94f8 --- /dev/null +++ b/docs/pages/Ray.html.md @@ -0,0 +1,285 @@ +# Ray + +A ray that emits from an origin in a certain direction. The class is used by [Raycaster](Raycaster.html) to assist with raycasting. Raycasting is used for mouse picking (working out what objects in the 3D space the mouse is over) amongst other things. + +## Constructor + +### new Ray( origin : Vector3, direction : Vector3 ) + +Constructs a new ray. + +**origin** + +The origin of the ray. + +Default is `(0,0,0)`. + +**direction** + +The (normalized) direction of the ray. + +Default is `(0,0,-1)`. + +## Properties + +### .direction : Vector3 + +The (normalized) direction of the ray. + +### .origin : Vector3 + +The origin of the ray. + +## Methods + +### .applyMatrix4( matrix4 : Matrix4 ) : Ray + +Transforms this ray with the given 4x4 transformation matrix. + +**matrix4** + +The transformation matrix. + +**Returns:** A reference to this ray. + +### .at( t : number, target : Vector3 ) : Vector3 + +Returns a vector that is located at a given distance along this ray. + +**t** + +The distance along the ray to retrieve a position for. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** A position on the ray. + +### .clone() : Ray + +Returns a new ray with copied values from this instance. + +**Returns:** A clone of this instance. + +### .closestPointToPoint( point : Vector3, target : Vector3 ) : Vector3 + +Returns the point along this ray that is closest to the given point. + +**point** + +A point in 3D space to get the closet location on the ray for. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The closest point on this ray. + +### .copy( ray : Ray ) : Ray + +Copies the values of the given ray to this instance. + +**ray** + +The ray to copy. + +**Returns:** A reference to this ray. + +### .distanceSqToPoint( point : Vector3 ) : number + +Returns the squared distance of the closest approach between this ray and the given point. + +**point** + +A point in 3D space to compute the distance to. + +**Returns:** The squared distance. + +### .distanceSqToSegment( v0 : Vector3, v1 : Vector3, optionalPointOnRay : Vector3, optionalPointOnSegment : Vector3 ) : number + +Returns the squared distance between this ray and the given line segment. + +**v0** + +The start point of the line segment. + +**v1** + +The end point of the line segment. + +**optionalPointOnRay** + +When provided, it receives the point on this ray that is closest to the segment. + +**optionalPointOnSegment** + +When provided, it receives the point on the line segment that is closest to this ray. + +**Returns:** The squared distance. + +### .distanceToPlane( plane : Plane ) : number + +Computes the distance from the ray's origin to the given plane. Returns `null` if the ray does not intersect with the plane. + +**plane** + +The plane to compute the distance to. + +**Returns:** Whether this ray intersects with the given sphere or not. + +### .distanceToPoint( point : Vector3 ) : number + +Returns the distance of the closest approach between this ray and the given point. + +**point** + +A point in 3D space to compute the distance to. + +**Returns:** The distance. + +### .equals( ray : Ray ) : boolean + +Returns `true` if this ray is equal with the given one. + +**ray** + +The ray to test for equality. + +**Returns:** Whether this ray is equal with the given one. + +### .intersectBox( box : Box3, target : Vector3 ) : Vector3 + +Intersects this ray with the given bounding box, returning the intersection point or `null` if there is no intersection. + +**box** + +The box to intersect. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The intersection point. + +### .intersectPlane( plane : Plane, target : Vector3 ) : Vector3 + +Intersects this ray with the given plane, returning the intersection point or `null` if there is no intersection. + +**plane** + +The plane to intersect. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The intersection point. + +### .intersectSphere( sphere : Sphere, target : Vector3 ) : Vector3 + +Intersects this ray with the given sphere, returning the intersection point or `null` if there is no intersection. + +**sphere** + +The sphere to intersect. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The intersection point. + +### .intersectTriangle( a : Vector3, b : Vector3, c : Vector3, backfaceCulling : boolean, target : Vector3 ) : Vector3 + +Intersects this ray with the given triangle, returning the intersection point or `null` if there is no intersection. + +**a** + +The first vertex of the triangle. + +**b** + +The second vertex of the triangle. + +**c** + +The third vertex of the triangle. + +**backfaceCulling** + +Whether to use backface culling or not. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The intersection point. + +### .intersectsBox( box : Box3 ) : boolean + +Returns `true` if this ray intersects with the given box. + +**box** + +The box to intersect. + +**Returns:** Whether this ray intersects with the given box or not. + +### .intersectsPlane( plane : Plane ) : boolean + +Returns `true` if this ray intersects with the given plane. + +**plane** + +The plane to intersect. + +**Returns:** Whether this ray intersects with the given plane or not. + +### .intersectsSphere( sphere : Sphere ) : boolean + +Returns `true` if this ray intersects with the given sphere. + +**sphere** + +The sphere to intersect. + +**Returns:** Whether this ray intersects with the given sphere or not. + +### .lookAt( v : Vector3 ) : Ray + +Adjusts the direction of the ray to point at the given vector in world space. + +**v** + +The target position. + +**Returns:** A reference to this ray. + +### .recast( t : number ) : Ray + +Shift the origin of this ray along its direction by the given distance. + +**t** + +The distance along the ray to interpolate. + +**Returns:** A reference to this ray. + +### .set( origin : Vector3, direction : Vector3 ) : Ray + +Sets the ray's components by copying the given values. + +**origin** + +The origin. + +**direction** + +The direction. + +**Returns:** A reference to this ray. + +## Source + +[src/math/Ray.js](https://github.com/mrdoob/three.js/blob/master/src/math/Ray.js) \ No newline at end of file diff --git a/docs/pages/Raycaster.html.md b/docs/pages/Raycaster.html.md new file mode 100644 index 00000000000000..679741a3afe7fc --- /dev/null +++ b/docs/pages/Raycaster.html.md @@ -0,0 +1,222 @@ +# Raycaster + +This class is designed to assist with raycasting. Raycasting is used for mouse picking (working out what objects in the 3d space the mouse is over) amongst other things. + +## Constructor + +### new Raycaster( origin : Vector3, direction : Vector3, near : number, far : number ) + +Constructs a new raycaster. + +**origin** + +The origin vector where the ray casts from. + +**direction** + +The (normalized) direction vector that gives direction to the ray. + +**near** + +All results returned are further away than near. Near can't be negative. + +Default is `0`. + +**far** + +All results returned are closer than far. Far can't be lower than near. + +Default is `Infinity`. + +## Properties + +### .camera : Camera + +The camera to use when raycasting against view-dependent objects such as billboarded objects like sprites. This field can be set manually or is set when calling `setFromCamera()`. + +Default is `null`. + +### .far : number + +All results returned are closer than far. Far can't be lower than near. + +Default is `Infinity`. + +### .layers : Layers + +Allows to selectively ignore 3D objects when performing intersection tests. The following code example ensures that only 3D objects on layer `1` will be honored by raycaster. + +```js +raycaster.layers.set( 1 ); +object.layers.enable( 1 ); +``` + +### .near : number + +All results returned are further away than near. Near can't be negative. + +Default is `0`. + +### .params : Object + +A parameter object that configures the raycasting. It has the structure: + +```js +{ + Mesh: {}, + Line: { threshold: 1 }, + LOD: {}, + Points: { threshold: 1 }, + Sprite: {} +} +``` + +Where `threshold` is the precision of the raycaster when intersecting objects, in world units. + +### .ray : Ray + +The ray used for raycasting. + +## Methods + +### .intersectObject( object : Object3D, recursive : boolean, intersects : Array. ) : Array. + +Checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first. + +`Raycaster` delegates to the `raycast()` method of the passed 3D object, when evaluating whether the ray intersects the object or not. This allows meshes to respond differently to ray casting than lines or points. + +Note that for meshes, faces must be pointed towards the origin of the ray in order to be detected; intersections of the ray passing through the back of a face will not be detected. To raycast against both faces of an object, you'll want to set [Material#side](Material.html#side) to `THREE.DoubleSide`. + +**object** + +The 3D object to check for intersection with the ray. + +**recursive** + +If set to `true`, it also checks all descendants. Otherwise it only checks intersection with the object. + +Default is `true`. + +**intersects** + +The target array that holds the result of the method. + +Default is `[]`. + +**Returns:** An array holding the intersection points. + +### .intersectObjects( objects : Array., recursive : boolean, intersects : Array. ) : Array. + +Checks all intersection between the ray and the objects with or without the descendants. Intersections are returned sorted by distance, closest first. + +**objects** + +The 3D objects to check for intersection with the ray. + +**recursive** + +If set to `true`, it also checks all descendants. Otherwise it only checks intersection with the object. + +Default is `true`. + +**intersects** + +The target array that holds the result of the method. + +Default is `[]`. + +**Returns:** An array holding the intersection points. + +### .set( origin : Vector3, direction : Vector3 ) + +Updates the ray with a new origin and direction by copying the values from the arguments. + +**origin** + +The origin vector where the ray casts from. + +**direction** + +The (normalized) direction vector that gives direction to the ray. + +### .setFromCamera( coords : Vector2, camera : Camera ) + +Uses the given coordinates and camera to compute a new origin and direction for the internal ray. + +**coords** + +2D coordinates of the mouse, in normalized device coordinates (NDC). X and Y components should be between `-1` and `1`. + +**camera** + +The camera from which the ray should originate. + +### .setFromXRController( controller : WebXRController ) : Raycaster + +Uses the given WebXR controller to compute a new origin and direction for the internal ray. + +**controller** + +The controller to copy the position and direction from. + +**Returns:** A reference to this raycaster. + +## Type Definitions + +### .Intersection + +The intersection point of a raycaster intersection test. + +**distance** +number + +The distance from the ray's origin to the intersection point. + +**distanceToRay** +number + +Some 3D objects e.g. [Points](Points.html) provide the distance of the intersection to the nearest point on the ray. For other objects it will be `undefined`. + +**point** +[Vector3](Vector3.html) + +The intersection point, in world coordinates. + +**face** +Object + +The face that has been intersected. + +**faceIndex** +number + +The face index. + +**object** +[Object3D](Object3D.html) + +The 3D object that has been intersected. + +**uv** +[Vector2](Vector2.html) + +U,V coordinates at point of intersection. + +**uv1** +[Vector2](Vector2.html) + +Second set of U,V coordinates at point of intersection. + +**normal** +[Vector3](Vector3.html) + +Interpolated normal vector at point of intersection. + +**instanceId** +number + +The index number of the instance where the ray intersects the [InstancedMesh](InstancedMesh.html). + +## Source + +[src/core/Raycaster.js](https://github.com/mrdoob/three.js/blob/master/src/core/Raycaster.js) \ No newline at end of file diff --git a/docs/pages/RectAreaLight.html.md b/docs/pages/RectAreaLight.html.md new file mode 100644 index 00000000000000..60cbe9d5d9366e --- /dev/null +++ b/docs/pages/RectAreaLight.html.md @@ -0,0 +1,81 @@ +*Inheritance: EventDispatcher → Object3D → Light →* + +# RectAreaLight + +This class emits light uniformly across the face a rectangular plane. This light type can be used to simulate light sources such as bright windows or strip lighting. + +Important Notes: + +* There is no shadow support. +* Only PBR materials are supported. +* You have to include `RectAreaLightUniformsLib` (`WebGLRenderer`) or `RectAreaLightTexturesLib` (`WebGPURenderer`) into your app and init the uniforms/textures. + +## Code Example + +```js +RectAreaLightUniformsLib.init(); // only relevant for WebGLRenderer +THREE.RectAreaLightNode.setLTC( RectAreaLightTexturesLib.init() ); // only relevant for WebGPURenderer +const intensity = 1; const width = 10; const height = 10; +const rectLight = new THREE.RectAreaLight( 0xffffff, intensity, width, height ); +rectLight.position.set( 5, 5, 0 ); +rectLight.lookAt( 0, 0, 0 ); +scene.add( rectLight ) +``` + +## Constructor + +### new RectAreaLight( color : number | Color | string, intensity : number, width : number, height : number ) + +Constructs a new area light. + +**color** + +The light's color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity. + +Default is `1`. + +**width** + +The width of the light. + +Default is `10`. + +**height** + +The height of the light. + +Default is `10`. + +## Properties + +### .height : number + +The height of the light. + +Default is `10`. + +### .isRectAreaLight : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .power : number + +The light's power. Power is the luminous power of the light measured in lumens (lm). Changing the power will also change the light's intensity. + +### .width : number + +The width of the light. + +Default is `10`. + +## Source + +[src/lights/RectAreaLight.js](https://github.com/mrdoob/three.js/blob/master/src/lights/RectAreaLight.js) \ No newline at end of file diff --git a/docs/pages/RectAreaLightHelper.html.md b/docs/pages/RectAreaLightHelper.html.md new file mode 100644 index 00000000000000..eb8bc011a978e3 --- /dev/null +++ b/docs/pages/RectAreaLightHelper.html.md @@ -0,0 +1,57 @@ +*Inheritance: EventDispatcher → Object3D → Line →* + +# RectAreaLightHelper + +Creates a visual aid for rect area lights. + +`RectAreaLightHelper` must be added as a child of the light. + +## Code Example + +```js +const light = new THREE.RectAreaLight( 0xffffbb, 1.0, 5, 5 ); +const helper = new RectAreaLightHelper( light ); +light.add( helper ); +``` + +## Import + +RectAreaLightHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; +``` + +## Constructor + +### new RectAreaLightHelper( light : RectAreaLight, color : number | Color | string ) + +Constructs a new rect area light helper. + +**light** + +The light to visualize. + +**color** + +The helper's color. If this is not the set, the helper will take the color of the light. + +## Properties + +### .color : number | Color | string | undefined + +The helper's color. If `undefined`, the helper will take the color of the light. + +### .light : RectAreaLight + +The light to visualize. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[examples/jsm/helpers/RectAreaLightHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/RectAreaLightHelper.js) \ No newline at end of file diff --git a/docs/pages/RectAreaLightNode.html.md b/docs/pages/RectAreaLightNode.html.md new file mode 100644 index 00000000000000..a9f614a33903a2 --- /dev/null +++ b/docs/pages/RectAreaLightNode.html.md @@ -0,0 +1,61 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode →* + +# RectAreaLightNode + +Module for representing rect area lights as nodes. + +## Constructor + +### new RectAreaLightNode( light : RectAreaLight ) + +Constructs a new rect area light node. + +**light** + +The rect area light source. + +Default is `null`. + +## Properties + +### .halfHeight : UniformNode. + +Uniform node representing the half height of the are light. + +### .halfWidth : UniformNode. + +Uniform node representing the half width of the are light. + +### .updateType : string + +The `updateType` is set to `NodeUpdateType.RENDER` since the light relies on `viewMatrix` which might vary per render call. + +Default is `'render'`. + +**Overrides:** [AnalyticLightNode#updateType](AnalyticLightNode.html#updateType) + +## Methods + +### .update( frame : NodeFrame ) + +Overwritten to updated rect area light specific uniforms. + +**frame** + +A reference to the current node frame. + +**Overrides:** [AnalyticLightNode#update](AnalyticLightNode.html#update) + +## Static Methods + +### .setLTC( ltc : RectAreaLightTexturesLib ) + +Used to configure the internal BRDF approximation texture data. + +**ltc** + +The BRDF approximation texture data. + +## Source + +[src/nodes/lighting/RectAreaLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/RectAreaLightNode.js) \ No newline at end of file diff --git a/docs/pages/RectAreaLightTexturesLib.html.md b/docs/pages/RectAreaLightTexturesLib.html.md new file mode 100644 index 00000000000000..f15933eb9ff994 --- /dev/null +++ b/docs/pages/RectAreaLightTexturesLib.html.md @@ -0,0 +1,51 @@ +# RectAreaLightTexturesLib + +Texture library for [RectAreaLight](RectAreaLight.html). This class holds the LTC BRDF data in data textures for further use in the renderer. + +Reference: Real-Time Polygonal-Light Shading with Linearly Transformed Cosines by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. [Code](https://github.com/selfshadow/ltc_code/). + +NOTE: This is a temporary location for the BRDF approximation texture data based off of Eric Heitz's work (see citation). BRDF data for `RectAreaLight` is currently approximated using a precomputed texture of roughly 80kb in size. The hope is to find a better way to include the large texture data before including the full RectAreaLight implementation in the main build files. + +## Import + +RectAreaLightTexturesLib is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; +``` + +## Properties + +### .LTC_FLOAT_1 : DataTexture + +The first LTC FP32 data texture. + +Default is `null`. + +### .LTC_FLOAT_2 : DataTexture + +The second LTC FP32 data texture. + +Default is `null`. + +### .LTC_HALF_1 : DataTexture + +The first LTC FP16 data texture. + +Default is `null`. + +### .LTC_HALF_2 : DataTexture + +The second LTC FP16 data texture. + +Default is `null`. + +## Static Methods + +### .init() : RectAreaLightTexturesLib + +Inits the texture library. + +## Source + +[examples/jsm/lights/RectAreaLightTexturesLib.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lights/RectAreaLightTexturesLib.js) \ No newline at end of file diff --git a/docs/pages/RectAreaLightUniformsLib.html.md b/docs/pages/RectAreaLightUniformsLib.html.md new file mode 100644 index 00000000000000..a55ccd087401d2 --- /dev/null +++ b/docs/pages/RectAreaLightUniformsLib.html.md @@ -0,0 +1,29 @@ +# RectAreaLightUniformsLib + +This class is only relevant when using [RectAreaLight](RectAreaLight.html) with [WebGLRenderer](WebGLRenderer.html). + +Before rect area lights can be used, the internal uniform library of the renderer must be enhanced with the following code. + +## Code Example + +```js +RectAreaLightUniformsLib.init(); +``` + +## Import + +RectAreaLightUniformsLib is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js'; +``` + +## Static Methods + +### .init() + +Inits the uniform library required when using rect area lights. + +## Source + +[examples/jsm/lights/RectAreaLightUniformsLib.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lights/RectAreaLightUniformsLib.js) \ No newline at end of file diff --git a/docs/pages/ReferenceBaseNode.html.md b/docs/pages/ReferenceBaseNode.html.md new file mode 100644 index 00000000000000..cfb2dd54f812ce --- /dev/null +++ b/docs/pages/ReferenceBaseNode.html.md @@ -0,0 +1,175 @@ +*Inheritance: EventDispatcher → Node →* + +# ReferenceBaseNode + +Base class for nodes which establishes a reference to a property of another object. In this way, the value of the node is automatically linked to the value of referenced object. Reference nodes internally represent the linked value as a uniform. + +## Constructor + +### new ReferenceBaseNode( property : string, uniformType : string, object : Object, count : number ) + +Constructs a new reference base node. + +**property** + +The name of the property the node refers to. + +**uniformType** + +The uniform type that should be used to represent the property value. + +**object** + +The object the property belongs to. + +Default is `null`. + +**count** + +When the linked property is an array-like, this parameter defines its length. + +Default is `null`. + +## Properties + +### .count : number + +When the linked property is an array, this parameter defines its length. + +Default is `null`. + +### .group : UniformGroupNode + +The uniform group of the internal uniform. + +Default is `null`. + +### .node : UniformNode + +The uniform node that holds the value of the reference node. + +Default is `null`. + +### .object : Object + +The object the property belongs to. + +Default is `null`. + +### .properties : Array. + +The property name might have dots so nested properties can be referred. The hierarchy of the names is stored inside this array. + +### .property : string + +The name of the property the node refers to. + +### .reference : Object + +Points to the current referred object. This property exists next to [ReferenceNode#object](ReferenceNode.html#object) since the final reference might be updated from calling code. + +Default is `null`. + +### .uniformType : string + +The uniform type that should be used to represent the property value. + +### .updateType : string + +Overwritten since reference nodes are updated per object. + +Default is `'object'`. + +**Overrides:** [Node#updateType](Node.html#updateType) + +## Methods + +### .element( indexNode : IndexNode ) : ReferenceElementNode + +When the referred property is array-like, this method can be used to access elements via an index node. + +**indexNode** + +indexNode. + +**Returns:** A reference to an element. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from the type of the reference node. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .getValueFromReference( object : Object ) : any + +Returns the property value from the given referred object. + +**object** + +The object to retrieve the property value from. + +Default is `this.reference`. + +**Returns:** The value. + +### .setGroup( group : UniformGroupNode ) : ReferenceBaseNode + +Sets the uniform group for this reference node. + +**group** + +The uniform group to set. + +**Returns:** A reference to this node. + +### .setNodeType( uniformType : string ) + +Sets the node type which automatically defines the internal uniform type. + +**uniformType** + +The type to set. + +### .setup() : UniformNode + +The output of the reference node is the internal uniform node. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The output node. + +### .update( frame : NodeFrame ) + +Overwritten to update the internal uniform value. + +**frame** + +A reference to the current node frame. + +**Overrides:** [Node#update](Node.html#update) + +### .updateReference( state : NodeFrame | NodeBuilder ) : Object + +Allows to update the reference based on the given state. The state is only evaluated [ReferenceBaseNode#object](ReferenceBaseNode.html#object) is not set. + +**state** + +The current state. + +**Overrides:** [Node#updateReference](Node.html#updateReference) + +**Returns:** The updated reference. + +### .updateValue() + +Retrieves the value from the referred object property and uses it to updated the internal uniform. + +## Source + +[src/nodes/accessors/ReferenceBaseNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/ReferenceBaseNode.js) \ No newline at end of file diff --git a/docs/pages/ReferenceElementNode.html.md b/docs/pages/ReferenceElementNode.html.md new file mode 100644 index 00000000000000..1fd1d094eafba6 --- /dev/null +++ b/docs/pages/ReferenceElementNode.html.md @@ -0,0 +1,131 @@ +*Inheritance: EventDispatcher → Node → ArrayElementNode →* + +# ReferenceElementNode + +This class is only relevant if the referenced property is array-like. In this case, `ReferenceElementNode` allows to refer to a specific element inside the data structure via an index. + +## Constructor + +### new ReferenceElementNode( referenceNode : ReferenceBaseNode, indexNode : Node ) + +Constructs a new reference element node. + +**referenceNode** + +The reference node. + +**indexNode** + +The index node that defines the element access. + +## Properties + +### .isReferenceElementNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .isReferenceElementNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .referenceNode : ReferenceBaseNode + +Similar to [ReferenceBaseNode#reference](ReferenceBaseNode.html#reference), an additional property references to the current node. + +Default is `null`. + +### .referenceNode : ReferenceNode + +Similar to [ReferenceNode#reference](ReferenceNode.html#reference), an additional property references to the current node. + +Default is `null`. + +## Methods + +### .getNodeType() : string + +This method is overwritten since the node type is inferred from the uniform type of the reference node. + +**Overrides:** [ArrayElementNode#getNodeType](ArrayElementNode.html#getNodeType) + +**Returns:** The node type. + +### .getNodeType() : string + +This method is overwritten since the node type is inferred from the uniform type of the reference node. + +**Overrides:** [ArrayElementNode#getNodeType](ArrayElementNode.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/accessors/ReferenceBaseNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/ReferenceBaseNode.js) + +This class is only relevant if the referenced property is array-like. In this case, `ReferenceElementNode` allows to refer to a specific element inside the data structure via an index. + +## Constructor + +### new ReferenceElementNode( referenceNode : ReferenceNode, indexNode : Node ) + +Constructs a new reference element node. + +**referenceNode** + +The reference node. + +**indexNode** + +The index node that defines the element access. + +## Properties + +### .isReferenceElementNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .isReferenceElementNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .referenceNode : ReferenceBaseNode + +Similar to [ReferenceBaseNode#reference](ReferenceBaseNode.html#reference), an additional property references to the current node. + +Default is `null`. + +### .referenceNode : ReferenceNode + +Similar to [ReferenceNode#reference](ReferenceNode.html#reference), an additional property references to the current node. + +Default is `null`. + +## Methods + +### .getNodeType() : string + +This method is overwritten since the node type is inferred from the uniform type of the reference node. + +**Overrides:** [ArrayElementNode#getNodeType](ArrayElementNode.html#getNodeType) + +**Returns:** The node type. + +### .getNodeType() : string + +This method is overwritten since the node type is inferred from the uniform type of the reference node. + +**Overrides:** [ArrayElementNode#getNodeType](ArrayElementNode.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/accessors/ReferenceNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/ReferenceNode.js) \ No newline at end of file diff --git a/docs/pages/ReferenceNode.html.md b/docs/pages/ReferenceNode.html.md new file mode 100644 index 00000000000000..5e5365b210c518 --- /dev/null +++ b/docs/pages/ReferenceNode.html.md @@ -0,0 +1,209 @@ +*Inheritance: EventDispatcher → Node →* + +# ReferenceNode + +This type of node establishes a reference to a property of another object. In this way, the value of the node is automatically linked to the value of referenced object. Reference nodes internally represent the linked value as a uniform. + +## Constructor + +### new ReferenceNode( property : string, uniformType : string, object : Object, count : number ) + +Constructs a new reference node. + +**property** + +The name of the property the node refers to. + +**uniformType** + +The uniform type that should be used to represent the property value. + +**object** + +The object the property belongs to. + +Default is `null`. + +**count** + +When the linked property is an array-like, this parameter defines its length. + +Default is `null`. + +## Properties + +### .count : number + +When the linked property is an array, this parameter defines its length. + +Default is `null`. + +### .group : UniformGroupNode + +The uniform group of the internal uniform. + +Default is `null`. + +### .name : string + +An optional label of the internal uniform node. + +Default is `null`. + +**Overrides:** [Node#name](Node.html#name) + +### .node : UniformNode + +The uniform node that holds the value of the reference node. + +Default is `null`. + +### .object : Object + +The object the property belongs to. + +Default is `null`. + +### .properties : Array. + +The property name might have dots so nested properties can be referred. The hierarchy of the names is stored inside this array. + +### .property : string + +The name of the property the node refers to. + +### .reference : Object + +Points to the current referred object. This property exists next to [ReferenceNode#object](ReferenceNode.html#object) since the final reference might be updated from calling code. + +Default is `null`. + +### .uniformType : string + +The uniform type that should be used to represent the property value. + +### .updateType : string + +Overwritten since reference nodes are updated per object. + +Default is `'object'`. + +**Overrides:** [Node#updateType](Node.html#updateType) + +## Methods + +### .element( indexNode : IndexNode ) : ReferenceElementNode + +When the referred property is array-like, this method can be used to access elements via an index node. + +**indexNode** + +indexNode. + +**Returns:** A reference to an element. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from the type of the reference node. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .getValueFromReference( object : Object ) : any + +Returns the property value from the given referred object. + +**object** + +The object to retrieve the property value from. + +Default is `this.reference`. + +**Returns:** The value. + +### .label( name : string ) : ReferenceNode + +Sets the label for the internal uniform. + +**name** + +The label to set. + +**Deprecated:** Yes + +**Returns:** A reference to this node. + +### .setGroup( group : UniformGroupNode ) : ReferenceNode + +Sets the uniform group for this reference node. + +**group** + +The uniform group to set. + +**Returns:** A reference to this node. + +### .setName( name : string ) : ReferenceNode + +Sets the name for the internal uniform. + +**name** + +The label to set. + +**Returns:** A reference to this node. + +### .setNodeType( uniformType : string ) + +Sets the node type which automatically defines the internal uniform type. + +**uniformType** + +The type to set. + +### .setup( builder : NodeBuilder ) : UniformNode + +The output of the reference node is the internal uniform node. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The output node. + +### .update( frame : NodeFrame ) + +Overwritten to update the internal uniform value. + +**frame** + +A reference to the current node frame. + +**Overrides:** [Node#update](Node.html#update) + +### .updateReference( state : NodeFrame | NodeBuilder ) : Object + +Allows to update the reference based on the given state. The state is only evaluated [ReferenceNode#object](ReferenceNode.html#object) is not set. + +**state** + +The current state. + +**Overrides:** [Node#updateReference](Node.html#updateReference) + +**Returns:** The updated reference. + +### .updateValue() + +Retrieves the value from the referred object property and uses it to updated the internal uniform. + +## Source + +[src/nodes/accessors/ReferenceNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/ReferenceNode.js) \ No newline at end of file diff --git a/docs/pages/Reflector.html.md b/docs/pages/Reflector.html.md new file mode 100644 index 00000000000000..e741cea412a405 --- /dev/null +++ b/docs/pages/Reflector.html.md @@ -0,0 +1,122 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# Reflector + +Can be used to create a flat, reflective surface like a mirror. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [ReflectorNode](ReflectorNode.html). + +## Code Example + +```js +const geometry = new THREE.PlaneGeometry( 100, 100 ); +const reflector = new Reflector( geometry, { + clipBias: 0.003, + textureWidth: window.innerWidth * window.devicePixelRatio, + textureHeight: window.innerHeight * window.devicePixelRatio, + color: 0xc1cbcb +} ); +scene.add( reflector ); +``` + +## Import + +Reflector is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Reflector } from 'three/addons/objects/Reflector.js'; +``` + +## Constructor + +### new Reflector( geometry : BufferGeometry, options : Reflector~Options ) + +Constructs a new reflector. + +**geometry** + +The reflector's geometry. + +**options** + +The configuration options. + +## Properties + +### .camera : PerspectiveCamera + +The reflector's virtual camera. This is used to render the scene from the mirror's point of view. + +### .forceUpdate : boolean + +Whether to force an update, no matter if the reflector is in view or not. + +Default is `false`. + +### .isReflector : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .getRenderTarget() : WebGLRenderTarget + +Returns the reflector's internal render target. + +**Returns:** The internal render target + +## Type Definitions + +### .Options + +Constructor options of `Reflector`. + +**color** +number | [Color](Color.html) | string + +The reflector's color. + +Default is `0x7F7F7F`. + +**textureWidth** +number + +The texture width. A higher value results in more clear reflections but is also more expensive. + +Default is `512`. + +**textureHeight** +number + +The texture height. A higher value results in more clear reflections but is also more expensive. + +Default is `512`. + +**clipBias** +number + +The clip bias. + +Default is `0`. + +**shader** +Object + +Can be used to pass in a custom shader that defines how the reflective view is projected onto the reflector's geometry. + +**multisample** +number + +How many samples to use for MSAA. `0` disables MSAA. + +Default is `4`. + +## Source + +[examples/jsm/objects/Reflector.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Reflector.js) \ No newline at end of file diff --git a/docs/pages/ReflectorForSSRPass.html.md b/docs/pages/ReflectorForSSRPass.html.md new file mode 100644 index 00000000000000..49f95e4e7330ec --- /dev/null +++ b/docs/pages/ReflectorForSSRPass.html.md @@ -0,0 +1,94 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# ReflectorForSSRPass + +A special version of [Reflector](Reflector.html) for usage with [SSRPass](SSRPass.html). + +## Import + +ReflectorForSSRPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js'; +``` + +## Constructor + +### new ReflectorForSSRPass( geometry : BufferGeometry, options : ReflectorForSSRPass~Options ) + +Constructs a new reflector. + +**geometry** + +The reflector's geometry. + +**options** + +The configuration options. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .getRenderTarget() : WebGLRenderTarget + +Returns the reflector's internal render target. + +**Returns:** The internal render target + +## Type Definitions + +### .Options + +Constructor options of `ReflectorForSSRPass`. + +**color** +number | [Color](Color.html) | string + +The reflector's color. + +Default is `0x7F7F7F`. + +**textureWidth** +number + +The texture width. A higher value results in more clear reflections but is also more expensive. + +Default is `512`. + +**textureHeight** +number + +The texture height. A higher value results in more clear reflections but is also more expensive. + +Default is `512`. + +**clipBias** +number + +The clip bias. + +Default is `0`. + +**shader** +Object + +Can be used to pass in a custom shader that defines how the reflective view is projected onto the reflector's geometry. + +**useDepthTexture** +boolean + +Whether to store depth values in a texture or not. + +Default is `true`. + +**resolution** +[Vector2](Vector2.html) + +Resolution for the Reflector Pass. + +## Source + +[examples/jsm/objects/ReflectorForSSRPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/ReflectorForSSRPass.js) \ No newline at end of file diff --git a/docs/pages/ReflectorNode.html.md b/docs/pages/ReflectorNode.html.md new file mode 100644 index 00000000000000..5aa85a96caf4ad --- /dev/null +++ b/docs/pages/ReflectorNode.html.md @@ -0,0 +1,96 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode →* + +# ReflectorNode + +This node can be used to implement mirror-like flat reflective surfaces. + +## Code Example + +```js +const groundReflector = reflector(); +material.colorNode = groundReflector; +const plane = new Mesh( geometry, material ); +plane.add( groundReflector.target ); +``` + +## Constructor + +### new ReflectorNode( parameters : Object ) + +Constructs a new reflector node. + +**parameters** + +An object holding configuration parameters. + +Default is `{}`. + +**target** + +The 3D object the reflector is linked to. + +Default is `new Object3D()`. + +**resolutionScale** + +The resolution scale. + +Default is `1`. + +**generateMipmaps** + +Whether mipmaps should be generated or not. + +Default is `false`. + +**bounces** + +Whether reflectors can render other reflector nodes or not. + +Default is `true`. + +**depth** + +Whether depth data should be generated or not. + +Default is `false`. + +**samples** + +Anti-Aliasing samples of the internal render-target. + +**defaultTexture** + +The default texture node. + +**reflector** + +The reflector base node. + +## Properties + +### .reflector : ReflectorBaseNode + +A reference to the internal reflector node. + +### .target : Object3D + +A reference to 3D object the reflector is linked to. + +## Methods + +### .dispose() + +Frees internal resources. Should be called when the node is no longer in use. + +**Overrides:** [TextureNode#dispose](TextureNode.html#dispose) + +### .getDepthNode() : Node + +Returns a node representing the mirror's depth. That can be used to implement more advanced reflection effects like distance attenuation. + +**Returns:** The depth node. + +## Source + +[src/nodes/utils/ReflectorNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/ReflectorNode.js) \ No newline at end of file diff --git a/docs/pages/Refractor.html.md b/docs/pages/Refractor.html.md new file mode 100644 index 00000000000000..6e87e9a25cc1df --- /dev/null +++ b/docs/pages/Refractor.html.md @@ -0,0 +1,115 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# Refractor + +Can be used to create a flat, refractive surface like for special windows or water effects. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [viewportSharedTexture](TSL.html#viewportSharedTexture). + +## Code Example + +```js +const geometry = new THREE.PlaneGeometry( 100, 100 ); +const refractor = new Refractor( refractorGeometry, { + color: 0xcbcbcb, + textureWidth: 1024, + textureHeight: 1024 +} ); +scene.add( refractor ); +``` + +## Import + +Refractor is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Refractor } from 'three/addons/objects/Refractor.js'; +``` + +## Constructor + +### new Refractor( geometry : BufferGeometry, options : Refractor~Options ) + +Constructs a new refractor. + +**geometry** + +The refractor's geometry. + +**options** + +The configuration options. + +## Properties + +### .camera : PerspectiveCamera + +The reflector's virtual camera. + +### .isRefractor : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .getRenderTarget() : WebGLRenderTarget + +Returns the reflector's internal render target. + +**Returns:** The internal render target + +## Type Definitions + +### .Options + +Constructor options of `Refractor`. + +**color** +number | [Color](Color.html) | string + +The refractor's color. + +Default is `0x7F7F7F`. + +**textureWidth** +number + +The texture width. A higher value results in more clear refractions but is also more expensive. + +Default is `512`. + +**textureHeight** +number + +The texture height. A higher value results in more clear refractions but is also more expensive. + +Default is `512`. + +**clipBias** +number + +The clip bias. + +Default is `0`. + +**shader** +Object + +Can be used to pass in a custom shader that defines how the refractive view is projected onto the reflector's geometry. + +**multisample** +number + +How many samples to use for MSAA. `0` disables MSAA. + +Default is `4`. + +## Source + +[examples/jsm/objects/Refractor.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Refractor.js) \ No newline at end of file diff --git a/docs/pages/RemapNode.html.md b/docs/pages/RemapNode.html.md new file mode 100644 index 00000000000000..9571d85745c599 --- /dev/null +++ b/docs/pages/RemapNode.html.md @@ -0,0 +1,71 @@ +*Inheritance: EventDispatcher → Node →* + +# RemapNode + +This node allows to remap a node value from one range into another. E.g a value of `0.4` in the range `[ 0.3, 0.5 ]` should be remapped into the normalized range `[ 0, 1 ]`. `RemapNode` takes care of that and converts the original value of `0.4` to `0.5`. + +## Constructor + +### new RemapNode( node : Node, inLowNode : Node, inHighNode : Node, outLowNode : Node, outHighNode : Node ) + +Constructs a new remap node. + +**node** + +The node that should be remapped. + +**inLowNode** + +The source or current lower bound of the range. + +**inHighNode** + +The source or current upper bound of the range. + +**outLowNode** + +The target lower bound of the range. + +Default is `float(0)`. + +**outHighNode** + +The target upper bound of the range. + +Default is `float(1)`. + +## Properties + +### .doClamp : boolean + +Whether the node value should be clamped before remapping it to the target range. + +Default is `true`. + +### .inHighNode : Node + +The source or current upper bound of the range. + +### .inLowNode : Node + +The source or current lower bound of the range. + +### .node : Node + +The node that should be remapped. + +### .outHighNode : Node + +The target upper bound of the range. + +Default is `float(1)`. + +### .outLowNode : Node + +The target lower bound of the range. + +Default is `float(0)`. + +## Source + +[src/nodes/utils/RemapNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/RemapNode.js) \ No newline at end of file diff --git a/docs/pages/RenderOutputNode.html.md b/docs/pages/RenderOutputNode.html.md new file mode 100644 index 00000000000000..9512ab22ce0980 --- /dev/null +++ b/docs/pages/RenderOutputNode.html.md @@ -0,0 +1,73 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# RenderOutputNode + +Normally, tone mapping and color conversion happens automatically before outputting pixel too the default (screen) framebuffer. In certain post processing setups this happens to late because certain effects require e.g. sRGB input. For such scenarios, `RenderOutputNode` can be used to apply tone mapping and color space conversion at an arbitrary point in the effect chain. + +When applying tone mapping and color space conversion manually with this node, you have to set [PostProcessing#outputColorTransform](PostProcessing.html#outputColorTransform) to `false`. + +## Code Example + +```js +const postProcessing = new PostProcessing( renderer ); +postProcessing.outputColorTransform = false; +const scenePass = pass( scene, camera ); +const outputPass = renderOutput( scenePass ); +postProcessing.outputNode = outputPass; +``` + +## Constructor + +### new RenderOutputNode( colorNode : Node, toneMapping : number, outputColorSpace : string ) + +Constructs a new render output node. + +**colorNode** + +The color node to process. + +**toneMapping** + +The tone mapping type. + +**outputColorSpace** + +The output color space. + +## Properties + +### .colorNode : Node + +The color node to process. + +### .isRenderOutputNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .outputColorSpace : string + +The output color space. + +## Methods + +### .getToneMapping() : number + +Gets the tone mapping type. + +**Returns:** The tone mapping type. + +### .setToneMapping( value : number ) : ToneMappingNode + +Sets the tone mapping type. + +**value** + +The tone mapping type. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/display/RenderOutputNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/RenderOutputNode.js) \ No newline at end of file diff --git a/docs/pages/RenderPass.html.md b/docs/pages/RenderPass.html.md new file mode 100644 index 00000000000000..b2ac5ddd0bbbf4 --- /dev/null +++ b/docs/pages/RenderPass.html.md @@ -0,0 +1,140 @@ +*Inheritance: Pass →* + +# RenderPass + +This class represents a render pass. It takes a camera and a scene and produces a beauty pass for subsequent post processing effects. + +## Code Example + +```js +const renderPass = new RenderPass( scene, camera ); +composer.addPass( renderPass ); +``` + +## Import + +RenderPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +``` + +## Constructor + +### new RenderPass( scene : Scene, camera : Camera, overrideMaterial : Material, clearColor : number | Color | string, clearAlpha : number ) + +Constructs a new render pass. + +**scene** + +The scene to render. + +**camera** + +The camera. + +**overrideMaterial** + +The override material. If set, this material is used for all objects in the scene. + +Default is `null`. + +**clearColor** + +The clear color of the render pass. + +Default is `null`. + +**clearAlpha** + +The clear alpha of the render pass. + +Default is `null`. + +## Properties + +### .camera : Camera + +The camera. + +### .clear : boolean + +Overwritten to perform a clear operation by default. + +Default is `true`. + +**Overrides:** [Pass#clear](Pass.html#clear) + +### .clearAlpha : number + +The clear alpha of the render pass. + +Default is `null`. + +### .clearColor : number | Color | string + +The clear color of the render pass. + +Default is `null`. + +### .clearDepth : boolean + +If set to `true`, only the depth can be cleared when `clear` is to `false`. + +Default is `false`. + +### .isRenderPass : boolean (readonly) + +This flag indicates that this pass renders the scene itself. + +Default is `true`. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +### .overrideMaterial : Material + +The override material. If set, this material is used for all objects in the scene. + +Default is `null`. + +### .scene : Scene + +The scene to render. + +## Methods + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs a beauty pass with the configured scene and camera. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/RenderPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/RenderPass.js) \ No newline at end of file diff --git a/docs/pages/RenderPixelatedPass.html.md b/docs/pages/RenderPixelatedPass.html.md new file mode 100644 index 00000000000000..bba822ef0641af --- /dev/null +++ b/docs/pages/RenderPixelatedPass.html.md @@ -0,0 +1,132 @@ +*Inheritance: Pass →* + +# RenderPixelatedPass + +A special type of render pass that produces a pixelated beauty pass. + +## Code Example + +```js +const renderPixelatedPass = new RenderPixelatedPass( 6, scene, camera ); +composer.addPass( renderPixelatedPass ); +``` + +## Import + +RenderPixelatedPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js'; +``` + +## Constructor + +### new RenderPixelatedPass( pixelSize : number, scene : Scene, camera : Camera, options : Object ) + +Constructs a new render pixelated pass. + +**pixelSize** + +The effect's pixel size. + +**scene** + +The scene to render. + +**camera** + +The camera. + +**options** + +The pass options. + +## Properties + +### .camera : Camera + +The camera. + +### .depthEdgeStrength : number + +The normal edge strength. + +Default is `0.4`. + +### .normalEdgeStrength : number + +The normal edge strength. + +Default is `0.3`. + +### .pixelSize : number + +The effect's pixel size. + +### .pixelatedMaterial : ShaderMaterial + +The pixelated material. + +### .scene : Scene + +The scene to render. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the pixelation pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setPixelSize( pixelSize : number ) + +Sets the effect's pixel size. + +**pixelSize** + +The pixel size to set. + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/RenderPixelatedPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/RenderPixelatedPass.js) \ No newline at end of file diff --git a/docs/pages/RenderTarget.html.md b/docs/pages/RenderTarget.html.md new file mode 100644 index 00000000000000..b6e962f3913860 --- /dev/null +++ b/docs/pages/RenderTarget.html.md @@ -0,0 +1,310 @@ +*Inheritance: EventDispatcher →* + +# RenderTarget + +A render target is a buffer where the video card draws pixels for a scene that is being rendered in the background. It is used in different effects, such as applying postprocessing to a rendered image before displaying it on the screen. + +## Constructor + +### new RenderTarget( width : number, height : number, options : RenderTarget~Options ) + +Constructs a new render target. + +**width** + +The width of the render target. + +Default is `1`. + +**height** + +The height of the render target. + +Default is `1`. + +**options** + +The configuration object. + +## Properties + +### .depth : number + +The depth of the render target. + +Default is `1`. + +### .depthBuffer : boolean + +Whether to allocate a depth buffer or not. + +Default is `true`. + +### .depthTexture : DepthTexture + +Instead of saving the depth in a renderbuffer, a texture can be used instead which is useful for further processing e.g. in context of post-processing. + +Default is `null`. + +### .height : number + +The height of the render target. + +Default is `1`. + +### .isRenderTarget : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .multiview : boolean + +Whether to this target is used in multiview rendering. + +Default is `false`. + +### .resolveDepthBuffer : boolean + +Whether to resolve the depth buffer or not. + +Default is `true`. + +### .resolveStencilBuffer : boolean + +Whether to resolve the stencil buffer or not. + +Default is `true`. + +### .samples : number + +The number of MSAA samples. + +A value of `0` disables MSAA. + +Default is `0`. + +### .scissor : Vector4 + +A rectangular area inside the render target's viewport. Fragments that are outside the area will be discarded. + +Default is `(0,0,width,height)`. + +### .scissorTest : boolean + +Indicates whether the scissor test should be enabled when rendering into this render target or not. + +Default is `false`. + +### .stencilBuffer : boolean + +Whether to allocate a stencil buffer or not. + +Default is `false`. + +### .texture : Texture + +The texture representing the default color attachment. + +### .textures : Array. + +An array of textures. Each color attachment is represented as a separate texture. Has at least a single entry for the default color attachment. + +### .viewport : Vector4 + +A rectangular area representing the render target's viewport. + +Default is `(0,0,width,height)`. + +### .width : number + +The width of the render target. + +Default is `1`. + +## Methods + +### .clone() : RenderTarget + +Returns a new render target with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( source : RenderTarget ) : RenderTarget + +Copies the settings of the given render target. This is a structural copy so no resources are shared between render targets after the copy. That includes all MRT textures and the depth texture. + +**source** + +The render target to copy. + +**Returns:** A reference to this instance. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +##### Fires: + +* RenderTarget#event:dispose + +### .setSize( width : number, height : number, depth : number ) + +Sets the size of this render target. + +**width** + +The width. + +**height** + +The height. + +**depth** + +The depth. + +Default is `1`. + +## Type Definitions + +### .Options + +Render target options. + +**generateMipmaps** +boolean + +Whether to generate mipmaps or not. + +Default is `false`. + +**magFilter** +number + +The mag filter. + +Default is `LinearFilter`. + +**minFilter** +number + +The min filter. + +Default is `LinearFilter`. + +**format** +number + +The texture format. + +Default is `RGBAFormat`. + +**type** +number + +The texture type. + +Default is `UnsignedByteType`. + +**internalFormat** +string + +The texture's internal format. + +Default is `null`. + +**wrapS** +number + +The texture's uv wrapping mode. + +Default is `ClampToEdgeWrapping`. + +**wrapT** +number + +The texture's uv wrapping mode. + +Default is `ClampToEdgeWrapping`. + +**anisotropy** +number + +The texture's anisotropy value. + +Default is `1`. + +**colorSpace** +string + +The texture's color space. + +Default is `NoColorSpace`. + +**depthBuffer** +boolean + +Whether to allocate a depth buffer or not. + +Default is `true`. + +**stencilBuffer** +boolean + +Whether to allocate a stencil buffer or not. + +Default is `false`. + +**resolveDepthBuffer** +boolean + +Whether to resolve the depth buffer or not. + +Default is `true`. + +**resolveStencilBuffer** +boolean + +Whether to resolve the stencil buffer or not. + +Default is `true`. + +**depthTexture** +[Texture](Texture.html) + +Reference to a depth texture. + +Default is `null`. + +**samples** +number + +The MSAA samples count. + +Default is `0`. + +**count** +number + +Defines the number of color attachments . Must be at least `1`. + +Default is `1`. + +**depth** +number + +The texture depth. + +Default is `1`. + +**multiview** +boolean + +Whether this target is used for multiview rendering. + +Default is `false`. + +## Source + +[src/core/RenderTarget.js](https://github.com/mrdoob/three.js/blob/master/src/core/RenderTarget.js) \ No newline at end of file diff --git a/docs/pages/RenderTarget3D.html.md b/docs/pages/RenderTarget3D.html.md new file mode 100644 index 00000000000000..934c3da7fa4df5 --- /dev/null +++ b/docs/pages/RenderTarget3D.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → RenderTarget →* + +# RenderTarget3D + +Represents a 3D render target. + +## Constructor + +### new RenderTarget3D( width : number, height : number, depth : number, options : RenderTarget~Options ) + +Constructs a new 3D render target. + +**width** + +The width of the render target. + +Default is `1`. + +**height** + +The height of the render target. + +Default is `1`. + +**depth** + +The height of the render target. + +Default is `1`. + +**options** + +The configuration object. + +## Properties + +### .isRenderTarget3D : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .texture : Data3DTexture + +Overwritten with a different texture type. + +**Overrides:** [RenderTarget#texture](RenderTarget.html#texture) + +## Source + +[src/core/RenderTarget3D.js](https://github.com/mrdoob/three.js/blob/master/src/core/RenderTarget3D.js) \ No newline at end of file diff --git a/docs/pages/RenderTransitionPass.html.md b/docs/pages/RenderTransitionPass.html.md new file mode 100644 index 00000000000000..ae76eb7736d33f --- /dev/null +++ b/docs/pages/RenderTransitionPass.html.md @@ -0,0 +1,149 @@ +*Inheritance: Pass →* + +# RenderTransitionPass + +A special type of render pass for implementing transition effects. When active, the pass will transition from scene A to scene B. + +## Code Example + +```js +const renderTransitionPass = new RenderTransitionPass( fxSceneA.scene, fxSceneA.camera, fxSceneB.scene, fxSceneB.camera ); +renderTransitionPass.setTexture( textures[ 0 ] ); +composer.addPass( renderTransitionPass ); +``` + +## Import + +RenderTransitionPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RenderTransitionPass } from 'three/addons/postprocessing/RenderTransitionPass.js'; +``` + +## Constructor + +### new RenderTransitionPass( sceneA : Scene, cameraA : Camera, sceneB : Scene, cameraB : Camera ) + +Constructs a render transition pass. + +**sceneA** + +The first scene. + +**cameraA** + +The camera of the first scene. + +**sceneB** + +The second scene. + +**cameraB** + +The camera of the second scene. + +## Properties + +### .cameraA : Camera + +The camera of the first scene. + +### .cameraB : Camera + +The camera of the second scene. + +### .material : ShaderMaterial + +The pass material. + +### .sceneA : Scene + +The first scene. + +### .sceneB : Scene + +The second scene. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the transition pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +### .setTexture( value : Texture ) + +Sets the effect texture. + +**value** + +The effect texture. + +### .setTextureThreshold( value : boolean | number ) + +Sets the texture threshold. This value defined how strong the texture effects the transition. Must be in the range `[0,1]` (0 means full effect, 1 means no effect). + +**value** + +The threshold value. + +### .setTransition( value : boolean | number ) + +Sets the transition factor. Must be in the range `[0,1]`. This value determines to what degree both scenes are mixed. + +**value** + +The transition factor. + +### .useTexture( value : boolean ) + +Toggles the usage of a texture for the effect. + +**value** + +Whether to use a texture for the transition effect or not. + +## Source + +[examples/jsm/postprocessing/RenderTransitionPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/RenderTransitionPass.js) \ No newline at end of file diff --git a/docs/pages/Renderer.html.md b/docs/pages/Renderer.html.md new file mode 100644 index 00000000000000..b5578f2def7c65 --- /dev/null +++ b/docs/pages/Renderer.html.md @@ -0,0 +1,1086 @@ +# Renderer + +Base class for renderers. + +## Constructor + +### new Renderer( backend : Backend, parameters : Renderer~Options ) + +Constructs a new renderer. + +**backend** + +The backend the renderer is targeting (e.g. WebGPU or WebGL 2). + +**parameters** + +The configuration parameter. + +## Properties + +### .alpha : boolean + +Whether the default framebuffer should be transparent or opaque. + +Default is `true`. + +### .autoClear : boolean + +Whether the renderer should automatically clear the current rendering target before execute a `render()` call. The target can be the canvas (default framebuffer) or the current bound render target (custom framebuffer). + +Default is `true`. + +### .autoClearColor : boolean + +When `autoClear` is set to `true`, this property defines whether the renderer should clear the color buffer. + +Default is `true`. + +### .autoClearDepth : boolean + +When `autoClear` is set to `true`, this property defines whether the renderer should clear the depth buffer. + +Default is `true`. + +### .autoClearStencil : boolean + +When `autoClear` is set to `true`, this property defines whether the renderer should clear the stencil buffer. + +Default is `true`. + +### .backend : Backend + +A reference to the current backend. + +### .contextNode : ContextNode + +A global context node that stores override nodes for specific transformations or calculations. These nodes can be used to replace default behavior in the rendering pipeline. + +**value** +Object + +The context value object. + +### .coordinateSystem : number (readonly) + +The coordinate system of the renderer. The value of this property depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or `THREE.WebGPUCoordinateSystem`. + +### .currentColorSpace : string + +The current color space of the renderer. When not producing screen output, the color space is always the working color space. + +### .currentSamples : number + +The current number of samples used for multi-sample anti-aliasing (MSAA). + +When rendering to a custom render target, the number of samples of that render target is used. If the renderer needs an internal framebuffer target for tone mapping or color space conversion, the number of samples is set to 0. + +### .currentToneMapping : number + +The current tone mapping of the renderer. When not producing screen output, the tone mapping is always `NoToneMapping`. + +### .debug : DebugConfig + +The renderer's debug configuration. + +### .depth : boolean + +Whether the default framebuffer should have a depth buffer or not. + +Default is `true`. + +### .domElement : HTMLCanvasElement | OffscreenCanvas + +A reference to the canvas element the renderer is drawing to. This value of this property will automatically be created by the renderer. + +### .highPrecision : boolean + +Enables or disables high precision for model-view and normal-view matrices. When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance. + +NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`. + +### .highPrecision : boolean + +Returns whether high precision is enabled or not. + +### .info : Info + +Holds a series of statistical information about the GPU memory and the rendering process. Useful for debugging and monitoring. + +### .initialized (readonly) + +Returns whether the renderer has been initialized or not. + +### .inspector : InspectorBase + +The inspector instance. The inspector can be any class that extends from `InspectorBase`. + +### .isOutputTarget + +Returns `true` if the rendering settings are set to screen output. + +### .isRenderer : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .library : NodeLibrary + +The node library defines how certain library objects like materials, lights or tone mapping functions are mapped to node types. This is required since although instances of classes like `MeshBasicMaterial` or `PointLight` can be part of the scene graph, they are internally represented as nodes for further processing. + +### .lighting : Lighting + +A map-like data structure for managing lights. + +### .logarithmicDepthBuffer : boolean + +Whether logarithmic depth buffer is enabled or not. + +Default is `false`. + +### .needsFrameBufferTarget + +Returns `true` if a framebuffer target is needed to perform tone mapping or color space conversion. If this is the case, the renderer allocates an internal render target for that purpose. + +### .onDeviceLost : function + +A callback function that defines what should happen when a device/context lost occurs. + +### .opaque : boolean + +Whether the renderer should render opaque render objects or not. + +Default is `true`. + +### .outputColorSpace : string + +Defines the output color space of the renderer. + +Default is `SRGBColorSpace`. + +### .samples : number + +The number of samples used for multi-sample anti-aliasing (MSAA). + +Default is `0`. + +### .shadowMap : ShadowMapConfig + +The renderer's shadow configuration. + +### .sortObjects : boolean + +Whether the renderer should sort its render lists or not. + +Note: Sorting is used to attempt to properly render objects that have some degree of transparency. By definition, sorting objects may not work in all cases. Depending on the needs of application, it may be necessary to turn off sorting and use other methods to deal with transparency rendering e.g. manually determining each object's rendering order. + +Default is `true`. + +### .stencil : boolean + +Whether the default framebuffer should have a stencil buffer or not. + +Default is `false`. + +### .toneMapping : number + +Defines the tone mapping of the renderer. + +Default is `NoToneMapping`. + +### .toneMappingExposure : number + +Defines the tone mapping exposure. + +Default is `1`. + +### .transparent : boolean + +Whether the renderer should render transparent render objects or not. + +Default is `true`. + +### .xr : XRManager + +The renderer's XR manager. + +## Methods + +### .clear( color : boolean, depth : boolean, stencil : boolean ) + +Performs a manual clear operation. This method ignores `autoClear` properties. + +**color** + +Whether the color buffer should be cleared or not. + +Default is `true`. + +**depth** + +Whether the depth buffer should be cleared or not. + +Default is `true`. + +**stencil** + +Whether the stencil buffer should be cleared or not. + +Default is `true`. + +### .clearAsync( color : boolean, depth : boolean, stencil : boolean ) : Promise (async) + +Async version of [Renderer#clear](Renderer.html#clear). + +**color** + +Whether the color buffer should be cleared or not. + +Default is `true`. + +**depth** + +Whether the depth buffer should be cleared or not. + +Default is `true`. + +**stencil** + +Whether the stencil buffer should be cleared or not. + +Default is `true`. + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the clear operation has been executed. + +### .clearColor() + +Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties. + +### .clearColorAsync() : Promise (async) + +Async version of [Renderer#clearColor](Renderer.html#clearColor). + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the clear operation has been executed. + +### .clearDepth() + +Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties. + +### .clearDepthAsync() : Promise (async) + +Async version of [Renderer#clearDepth](Renderer.html#clearDepth). + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the clear operation has been executed. + +### .clearStencil() + +Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties. + +### .clearStencilAsync() : Promise (async) + +Async version of [Renderer#clearStencil](Renderer.html#clearStencil). + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the clear operation has been executed. + +### .compile( scene : Object3D, camera : Camera, targetScene : Scene ) : function + +Alias for `compileAsync()`. + +**scene** + +The scene or 3D object to precompile. + +**camera** + +The camera that is used to render the scene. + +**targetScene** + +If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. + +**Returns:** A Promise that resolves when the compile has been finished. + +### .compileAsync( scene : Object3D, camera : Camera, targetScene : Scene ) : Promise (async) + +Compiles all materials in the given scene. This can be useful to avoid a phenomenon which is called "shader compilation stutter", which occurs when rendering an object with a new shader for the first time. + +If you want to add a 3D object to an existing scene, use the third optional parameter for applying the target scene. Note that the (target) scene's lighting and environment must be configured before calling this method. + +**scene** + +The scene or 3D object to precompile. + +**camera** + +The camera that is used to render the scene. + +**targetScene** + +If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. + +Default is `null`. + +**Returns:** A Promise that resolves when the compile has been finished. + +### .compute( computeNodes : Node | Array., dispatchSize : number | Array. | IndirectStorageBufferAttribute ) : Promise | undefined + +Execute a single or an array of compute nodes. This method can only be called if the renderer has been initialized. + +**computeNodes** + +The compute node(s). + +**dispatchSize** + +* A single number representing count, or +* An array \[x, y, z\] representing dispatch size, or +* A IndirectStorageBufferAttribute for indirect dispatch size. + +Default is `null`. + +**Returns:** A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized. + +### .computeAsync( computeNodes : Node | Array., dispatchSize : number | Array. | IndirectStorageBufferAttribute ) : Promise (async) + +Execute a single or an array of compute nodes. + +**computeNodes** + +The compute node(s). + +**dispatchSize** + +* A single number representing count, or +* An array \[x, y, z\] representing dispatch size, or +* A IndirectStorageBufferAttribute for indirect dispatch size. + +Default is `null`. + +**Returns:** A Promise that resolve when the compute has finished. + +### .copyFramebufferToTexture( framebufferTexture : FramebufferTexture, rectangle : Vector2 | Vector4 ) + +Copies the current bound framebuffer into the given texture. + +**framebufferTexture** + +The texture. + +**rectangle** + +A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied. + +Default is `null`. + +### .copyTextureToTexture( srcTexture : Texture, dstTexture : Texture, srcRegion : Box2 | Box3, dstPosition : Vector2 | Vector3, srcLevel : number, dstLevel : number ) + +Copies data of the given source texture into a destination texture. + +**srcTexture** + +The source texture. + +**dstTexture** + +The destination texture. + +**srcRegion** + +A bounding box which describes the source region. Can be two or three-dimensional. + +Default is `null`. + +**dstPosition** + +A vector that represents the origin of the destination region. Can be two or three-dimensional. + +Default is `null`. + +**srcLevel** + +The source mip level to copy from. + +Default is `0`. + +**dstLevel** + +The destination mip level to copy to. + +Default is `0`. + +### .dispose() + +Frees all internal resources of the renderer. Call this method if the renderer is no longer in use by your app. + +### .getActiveCubeFace() : number + +Returns the active cube face. + +**Returns:** The active cube face. + +### .getActiveMipmapLevel() : number + +Returns the active mipmap level. + +**Returns:** The active mipmap level. + +### .getAnimationLoop() : function + +Returns the current animation loop callback. + +**Returns:** The current animation loop callback. + +### .getArrayBufferAsync( attribute : StorageBufferAttribute ) : Promise. (async) + +Can be used to transfer buffer data from a storage buffer attribute from the GPU to the CPU in context of compute shaders. + +**attribute** + +The storage buffer attribute. + +**Returns:** A promise that resolves with the buffer data when the data are ready. + +### .getCanvasTarget() : CanvasTarget + +Returns the current canvas target. + +**Returns:** The current canvas target. + +### .getClearAlpha() : number + +Returns the clear alpha. + +**Returns:** The clear alpha. + +### .getClearColor( target : Color ) : Color + +Returns the clear color. + +**target** + +The method writes the result in this target object. + +**Returns:** The clear color. + +### .getClearDepth() : number + +Returns the clear depth. + +**Returns:** The clear depth. + +### .getClearStencil() : number + +Returns the clear stencil. + +**Returns:** The clear stencil. + +### .getColorBufferType() : number + +Returns the output buffer type. + +**Deprecated:** since r182. Use \`.getOutputBufferType()\` instead. + +**Returns:** The output buffer type. + +### .getContext() : GPUCanvasContext | WebGL2RenderingContext + +Returns the rendering context. + +**Returns:** The rendering context. + +### .getDrawingBufferSize( target : Vector2 ) : Vector2 + +Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + +**target** + +The method writes the result in this target object. + +**Returns:** The drawing buffer size. + +### .getMRT() : MRTNode + +Returns the MRT configuration. + +**Returns:** The MRT configuration. + +### .getMaxAnisotropy() : number + +Returns the maximum available anisotropy for texture filtering. + +**Returns:** The maximum available anisotropy. + +### .getOutputBufferType() : number + +Returns the output buffer type. + +**Returns:** The output buffer type. + +### .getOutputRenderTarget() : RenderTarget + +Returns the current output target. + +**Returns:** The current output render target. Returns `null` if no output target is set. + +### .getPixelRatio() : number + +Returns the pixel ratio. + +**Returns:** The pixel ratio. + +### .getRenderObjectFunction() : function + +Returns the current render object function. + +**Returns:** The current render object function. Returns `null` if no function is set. + +### .getRenderTarget() : RenderTarget + +Returns the current render target. + +**Returns:** The render target. Returns `null` if no render target is set. + +### .getScissor( target : Vector4 ) : Vector4 + +Returns the scissor rectangle. + +**target** + +The method writes the result in this target object. + +**Returns:** The scissor rectangle. + +### .getScissorTest() : boolean + +Returns the scissor test value. + +**Returns:** Whether the scissor test should be enabled or not. + +### .getSize( target : Vector2 ) : Vector2 + +Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + +**target** + +The method writes the result in this target object. + +**Returns:** The renderer's size in logical pixels. + +### .getViewport( target : Vector4 ) : Vector4 + +Returns the viewport definition. + +**target** + +The method writes the result in this target object. + +**Returns:** The viewport definition. + +### .hasCompatibility( name : string ) : boolean + +Checks if the given compatibility is supported by the selected backend. If the renderer has not been initialized, this method always returns `false`. + +**name** + +The compatibility's name. + +**Returns:** Whether the compatibility is supported or not. + +### .hasFeature( name : string ) : boolean + +Checks if the given feature is supported by the selected backend. If the renderer has not been initialized, this method always returns `false`. + +**name** + +The feature's name. + +**Returns:** Whether the feature is supported or not. + +### .hasFeatureAsync( name : string ) : Promise. (async) + +Checks if the given feature is supported by the selected backend. + +**name** + +The feature's name. + +**Deprecated:** Yes + +**Returns:** A Promise that resolves with a bool that indicates whether the feature is supported or not. + +### .hasInitialized() : boolean + +Returns `true` when the renderer has been initialized. + +**Returns:** Whether the renderer has been initialized or not. + +### .init() : Promise. (async) + +Initializes the renderer so it is ready for usage. + +**Returns:** A Promise that resolves when the renderer has been initialized. + +### .initTexture( texture : Texture ) + +Initializes the given texture. Useful for preloading a texture rather than waiting until first render (which can cause noticeable lags due to decode and GPU upload overhead). + +This method can only be used if the renderer has been initialized. + +**texture** + +The texture. + +### .initTextureAsync( texture : Texture ) : Promise (async) + +Initializes the given textures. Useful for preloading a texture rather than waiting until first render (which can cause noticeable lags due to decode and GPU upload overhead). + +**texture** + +The texture. + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the texture has been initialized. + +### .isOccluded( object : Object3D ) : boolean + +This method performs an occlusion query for the given 3D object. It returns `true` if the given 3D object is fully occluded by other 3D objects in the scene. + +**object** + +The 3D object to test. + +**Returns:** Whether the 3D object is fully occluded or not. + +### .readRenderTargetPixelsAsync( renderTarget : RenderTarget, x : number, y : number, width : number, height : number, textureIndex : number, faceIndex : number ) : Promise. (async) + +Reads pixel data from the given render target. + +**renderTarget** + +The render target to read from. + +**x** + +The `x` coordinate of the copy region's origin. + +**y** + +The `y` coordinate of the copy region's origin. + +**width** + +The width of the copy region. + +**height** + +The height of the copy region. + +**textureIndex** + +The texture index of a MRT render target. + +Default is `0`. + +**faceIndex** + +The active cube face index. + +Default is `0`. + +**Returns:** A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. + +### .render( scene : Object3D, camera : Camera ) + +Renders the scene or 3D object with the given camera. This method can only be called if the renderer has been initialized. When using `render()` inside an animation loop, it's guaranteed the renderer will be initialized. The animation loop must be defined with [Renderer#setAnimationLoop](Renderer.html#setAnimationLoop) though. + +For all other use cases (like when using on-demand rendering), you must call [Renderer#init](Renderer.html#init) before rendering. + +The target of the method is the default framebuffer (meaning the canvas) or alternatively a render target when specified via `setRenderTarget()`. + +**scene** + +The scene or 3D object to render. + +**camera** + +The camera to render the scene with. + +### .renderAsync( scene : Object3D, camera : Camera ) : Promise (async) + +Renders the scene in an async fashion. + +**scene** + +The scene or 3D object to render. + +**camera** + +The camera. + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when the render has been finished. + +### .renderObject( object : Object3D, scene : Scene, camera : Camera, geometry : BufferGeometry, material : Material, group : Object, lightsNode : LightsNode, clippingContext : ClippingContext, passId : string ) + +This method represents the default render object function that manages the render lifecycle of the object. + +**object** + +The 3D object. + +**scene** + +The scene the 3D object belongs to. + +**camera** + +The camera the object should be rendered with. + +**geometry** + +The object's geometry. + +**material** + +The object's material. + +**group** + +Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + +**lightsNode** + +The current lights node. + +**clippingContext** + +The clipping context. + +Default is `null`. + +**passId** + +An optional ID for identifying the pass. + +Default is `null`. + +### .setAnimationLoop( callback : onAnimationCallback ) : Promise (async) + +Applications are advised to always define the animation loop with this method and not manually with `requestAnimationFrame()` for best compatibility. + +**callback** + +The application's animation loop. + +**Returns:** A Promise that resolves when the set has been executed. + +### .setCanvasTarget( canvasTarget : CanvasTarget ) + +Sets the canvas target. The canvas target manages the HTML canvas or the offscreen canvas the renderer draws into. + +**canvasTarget** + +The canvas target. + +### .setClearAlpha( alpha : number ) + +Defines the clear alpha. + +**alpha** + +The clear alpha. + +### .setClearColor( color : Color, alpha : number ) + +Defines the clear color and optionally the clear alpha. + +**color** + +The clear color. + +**alpha** + +The clear alpha. + +Default is `1`. + +### .setClearDepth( depth : number ) + +Defines the clear depth. + +**depth** + +The clear depth. + +### .setClearStencil( stencil : number ) + +Defines the clear stencil. + +**stencil** + +The clear stencil. + +### .setDrawingBufferSize( width : number, height : number, pixelRatio : number ) + +This method allows to define the drawing buffer size by specifying width, height and pixel ratio all at once. The size of the drawing buffer is computed with this formula: + +```js +size.x = width * pixelRatio; +size.y = height * pixelRatio; +``` + +**width** + +The width in logical pixels. + +**height** + +The height in logical pixels. + +**pixelRatio** + +The pixel ratio. + +### .setMRT( mrt : MRTNode ) : Renderer + +Sets the given MRT configuration. + +**mrt** + +The MRT node to set. + +**Returns:** A reference to this renderer. + +### .setOpaqueSort( method : function ) + +Defines a manual sort function for the opaque render list. Pass `null` to use the default sort. + +**method** + +The sort function. + +### .setOutputRenderTarget( renderTarget : Object ) + +Sets the output render target for the renderer. + +**renderTarget** + +The render target to set as the output target. + +### .setPixelRatio( value : number ) + +Sets the given pixel ratio and resizes the canvas if necessary. + +**value** + +The pixel ratio. + +Default is `1`. + +### .setRenderObjectFunction( renderObjectFunction : renderObjectFunction ) + +Sets the given render object function. Calling this method overwrites the default implementation which is [Renderer#renderObject](Renderer.html#renderObject). Defining a custom function can be useful if you want to modify the way objects are rendered. For example you can define things like "every object that has material of a certain type should perform a pre-pass with a special overwrite material". The custom function must always call `renderObject()` in its implementation. + +Use `null` as the first argument to reset the state. + +**renderObjectFunction** + +The render object function. + +### .setRenderTarget( renderTarget : RenderTarget, activeCubeFace : number, activeMipmapLevel : number ) + +Sets the given render target. Calling this method means the renderer does not target the default framebuffer (meaning the canvas) anymore but a custom framebuffer. Use `null` as the first argument to reset the state. + +**renderTarget** + +The render target to set. + +**activeCubeFace** + +The active cube face. + +Default is `0`. + +**activeMipmapLevel** + +The active mipmap level. + +Default is `0`. + +### .setScissor( x : number | Vector4, y : number, width : number, height : number ) + +Defines the scissor rectangle. + +**x** + +The horizontal coordinate for the upper left corner of the box in logical pixel unit. Instead of passing four arguments, the method also works with a single four-dimensional vector. + +**y** + +The vertical coordinate for the upper left corner of the box in logical pixel unit. + +**width** + +The width of the scissor box in logical pixel unit. + +**height** + +The height of the scissor box in logical pixel unit. + +### .setScissorTest( boolean : boolean ) + +Defines the scissor test. + +**boolean** + +Whether the scissor test should be enabled or not. + +### .setSize( width : number, height : number, updateStyle : boolean ) + +Sets the size of the renderer. + +**width** + +The width in logical pixels. + +**height** + +The height in logical pixels. + +**updateStyle** + +Whether to update the `style` attribute of the canvas or not. + +Default is `true`. + +### .setTransparentSort( method : function ) + +Defines a manual sort function for the transparent render list. Pass `null` to use the default sort. + +**method** + +The sort function. + +### .setViewport( x : number | Vector4, y : number, width : number, height : number, minDepth : number, maxDepth : number ) + +Defines the viewport. + +**x** + +The horizontal coordinate for the upper left corner of the viewport origin in logical pixel unit. + +**y** + +The vertical coordinate for the upper left corner of the viewport origin in logical pixel unit. + +**width** + +The width of the viewport in logical pixel unit. + +**height** + +The height of the viewport in logical pixel unit. + +**minDepth** + +The minimum depth value of the viewport. WebGPU only. + +Default is `0`. + +**maxDepth** + +The maximum depth value of the viewport. WebGPU only. + +Default is `1`. + +### .waitForGPU() : Promise (async) + +Can be used to synchronize CPU operations with GPU tasks. So when this method is called, the CPU waits for the GPU to complete its operation (e.g. a compute task). + +**Deprecated:** Yes + +**Returns:** A Promise that resolves when synchronization has been finished. + +## Type Definitions + +### .Options + +Renderer options. + +**logarithmicDepthBuffer** +boolean + +Whether logarithmic depth buffer is enabled or not. + +Default is `false`. + +**alpha** +boolean + +Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + +Default is `true`. + +**depth** +boolean + +Whether the default framebuffer should have a depth buffer or not. + +Default is `true`. + +**stencil** +boolean + +Whether the default framebuffer should have a stencil buffer or not. + +Default is `false`. + +**antialias** +boolean + +Whether MSAA as the default anti-aliasing should be enabled or not. + +Default is `false`. + +**samples** +number + +When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0 to overwrite the default. + +Default is `0`. + +**getFallback** +function + +This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. + +Default is `null`. + +**outputBufferType** +number + +Defines the type of output buffers. The default `HalfFloatType` is recommend for best quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. + +Default is `HalfFloatType`. + +**multiview** +boolean + +If set to `true`, the renderer will use multiview during WebXR rendering if supported. + +Default is `false`. + +## Source + +[src/renderers/common/Renderer.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/Renderer.js) \ No newline at end of file diff --git a/docs/pages/RendererReferenceNode.html.md b/docs/pages/RendererReferenceNode.html.md new file mode 100644 index 00000000000000..608380f6af299a --- /dev/null +++ b/docs/pages/RendererReferenceNode.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Node → ReferenceBaseNode →* + +# RendererReferenceNode + +This node is a special type of reference node which is intended for linking renderer properties with node values. + +When changing `renderer.toneMappingExposure`, the node value of `exposureNode` will automatically be updated. + +## Code Example + +```js +const exposureNode = rendererReference( 'toneMappingExposure', 'float', renderer ); +``` + +## Constructor + +### new RendererReferenceNode( property : string, inputType : string, renderer : Renderer ) + +Constructs a new renderer reference node. + +**property** + +The name of the property the node refers to. + +**inputType** + +The uniform type that should be used to represent the property value. + +**renderer** + +The renderer the property belongs to. When no renderer is set, the node refers to the renderer of the current state. + +Default is `null`. + +## Properties + +### .renderer : Renderer + +The renderer the property belongs to. When no renderer is set, the node refers to the renderer of the current state. + +Default is `null`. + +## Methods + +### .updateReference( state : NodeFrame | NodeBuilder ) : Object + +Updates the reference based on the given state. The state is only evaluated [RendererReferenceNode#renderer](RendererReferenceNode.html#renderer) is not set. + +**state** + +The current state. + +**Overrides:** [ReferenceBaseNode#updateReference](ReferenceBaseNode.html#updateReference) + +**Returns:** The updated reference. + +## Source + +[src/nodes/accessors/RendererReferenceNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/RendererReferenceNode.js) \ No newline at end of file diff --git a/docs/pages/Resources.html.md b/docs/pages/Resources.html.md new file mode 100644 index 00000000000000..679c8485a4062a --- /dev/null +++ b/docs/pages/Resources.html.md @@ -0,0 +1,13 @@ +*Inheritance: Map →* + +# Resources + +A Map-like data structure for managing resources of scriptable nodes. + +## Constructor + +### new Resources() + +## Source + +[src/nodes/code/ScriptableNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/code/ScriptableNode.js) \ No newline at end of file diff --git a/docs/pages/Rhino3dmLoader.html.md b/docs/pages/Rhino3dmLoader.html.md new file mode 100644 index 00000000000000..15b2ced30dbc64 --- /dev/null +++ b/docs/pages/Rhino3dmLoader.html.md @@ -0,0 +1,122 @@ +*Inheritance: Loader →* + +# Rhino3dmLoader + +A loader for Rhinoceros 3D files and objects. + +Rhinoceros is a 3D modeler used to create, edit, analyze, document, render, animate, and translate NURBS curves, surfaces, breps, extrusions, point clouds, as well as polygon meshes and SubD objects. `rhino3dm.js` is compiled to WebAssembly from the open source geometry library `openNURBS`. The loader currently uses `rhino3dm.js 8.4.0`. + +## Code Example + +```js +const loader = new Rhino3dmLoader(); +loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.0.1' ); +const object = await loader.loadAsync( 'models/3dm/Rhino_Logo.3dm' ); +scene.add( object ); +``` + +## Import + +Rhino3dmLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Rhino3dmLoader } from 'three/addons/loaders/3DMLoader.js'; +``` + +## Constructor + +### new Rhino3dmLoader( manager : LoadingManager ) + +Constructs a new Rhino 3DM loader. + +**manager** + +The loading manager. + +## Methods + +### .debug() + +Prints debug messages to the browser console. + +### .decodeObjects( buffer : ArrayBuffer, url : string ) : Promise. + +Decodes the 3DM asset data with a Web Worker. + +**buffer** + +The raw 3DM asset data as an array buffer. + +**url** + +The asset URL. + +**Returns:** A Promise that resolved with the decoded 3D object. + +### .dispose() + +Frees internal resources. This method should be called when the loader is no longer required. + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded 3DM asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer, onLoad : function, onError : onErrorCallback ) + +Parses the given 3DM data and passes the loaded 3DM asset to the `onLoad()` callback. + +**data** + +The raw 3DM asset data as an array buffer. + +**onLoad** + +Executed when the loading process has been finished. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#parse](Loader.html#parse) + +### .setLibraryPath( path : string ) : Rhino3dmLoader + +Path to a folder containing the JS and WASM libraries. + +**path** + +The library path to set. + +**Returns:** A reference to this loader. + +### .setWorkerLimit( workerLimit : number ) : Rhino3dmLoader + +Sets the maximum number of Web Workers to be used during decoding. A lower limit may be preferable if workers are also for other tasks in the application. + +**workerLimit** + +The worker limit. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/3DMLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/3DMLoader.js) \ No newline at end of file diff --git a/docs/pages/RingGeometry.html.md b/docs/pages/RingGeometry.html.md new file mode 100644 index 00000000000000..fd14a37a1f654f --- /dev/null +++ b/docs/pages/RingGeometry.html.md @@ -0,0 +1,78 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# RingGeometry + +A class for generating a two-dimensional ring geometry. + +## Code Example + +```js +const geometry = new THREE.RingGeometry( 1, 5, 32 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } ); +const mesh = new THREE.Mesh( geometry, material ); +scene.add( mesh ); +``` + +## Constructor + +### new RingGeometry( innerRadius : number, outerRadius : number, thetaSegments : number, phiSegments : number, thetaStart : number, thetaLength : number ) + +Constructs a new ring geometry. + +**innerRadius** + +The inner radius of the ring. + +Default is `0.5`. + +**outerRadius** + +The outer radius of the ring. + +Default is `1`. + +**thetaSegments** + +Number of segments. A higher number means the ring will be more round. Minimum is `3`. + +Default is `32`. + +**phiSegments** + +Number of segments per ring segment. Minimum is `1`. + +Default is `1`. + +**thetaStart** + +Starting angle in radians. + +Default is `0`. + +**thetaLength** + +Central angle in radians. + +Default is `Math.PI*2`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : RingGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/RingGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/RingGeometry.js) \ No newline at end of file diff --git a/docs/pages/RollerCoasterGeometry.html.md b/docs/pages/RollerCoasterGeometry.html.md new file mode 100644 index 00000000000000..5aef74278bdc59 --- /dev/null +++ b/docs/pages/RollerCoasterGeometry.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# RollerCoasterGeometry + +A procedural roller coaster geometry. + +## Import + +RollerCoasterGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RollerCoasterGeometry } from 'three/addons/misc/RollerCoaster.js'; +``` + +## Constructor + +### new RollerCoasterGeometry( curve : Curve, divisions : number ) + +Constructs a new geometry. + +**curve** + +The curve to generate the geometry along. + +**divisions** + +The number of divisions which defines the detail of the geometry. + +## Source + +[examples/jsm/misc/RollerCoaster.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/RollerCoaster.js) \ No newline at end of file diff --git a/docs/pages/RollerCoasterLiftersGeometry.html.md b/docs/pages/RollerCoasterLiftersGeometry.html.md new file mode 100644 index 00000000000000..300c54e5727d79 --- /dev/null +++ b/docs/pages/RollerCoasterLiftersGeometry.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# RollerCoasterLiftersGeometry + +A procedural roller coaster lifters geometry. + +## Import + +RollerCoasterLiftersGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RollerCoasterLiftersGeometry } from 'three/addons/misc/RollerCoaster.js'; +``` + +## Constructor + +### new RollerCoasterLiftersGeometry( curve : Curve, divisions : number ) + +Constructs a new geometry. + +**curve** + +The curve to generate the geometry along. + +**divisions** + +The number of divisions which defines the detail of the geometry. + +## Source + +[examples/jsm/misc/RollerCoaster.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/RollerCoaster.js) \ No newline at end of file diff --git a/docs/pages/RollerCoasterShadowGeometry.html.md b/docs/pages/RollerCoasterShadowGeometry.html.md new file mode 100644 index 00000000000000..14a9957dc986b9 --- /dev/null +++ b/docs/pages/RollerCoasterShadowGeometry.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# RollerCoasterShadowGeometry + +A procedural roller coaster shadow geometry. + +## Import + +RollerCoasterShadowGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RollerCoasterShadowGeometry } from 'three/addons/misc/RollerCoaster.js'; +``` + +## Constructor + +### new RollerCoasterShadowGeometry( curve : Curve, divisions : number ) + +Constructs a new geometry. + +**curve** + +The curve to generate the geometry along. + +**divisions** + +The number of divisions which defines the detail of the geometry. + +## Source + +[examples/jsm/misc/RollerCoaster.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/RollerCoaster.js) \ No newline at end of file diff --git a/docs/pages/RoomEnvironment.html.md b/docs/pages/RoomEnvironment.html.md new file mode 100644 index 00000000000000..3d11e6d5157ac3 --- /dev/null +++ b/docs/pages/RoomEnvironment.html.md @@ -0,0 +1,38 @@ +*Inheritance: EventDispatcher → Object3D → Scene →* + +# RoomEnvironment + +This class represents a scene with a basic room setup that can be used as input for [PMREMGenerator#fromScene](PMREMGenerator.html#fromScene). The resulting PMREM represents the room's lighting and can be used for Image Based Lighting by assigning it to [Scene#environment](Scene.html#environment) or directly as an environment map to PBR materials. + +The implementation is based on the [EnvironmentScene](https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts) component from the `model-viewer` project. + +## Code Example + +```js +const environment = new RoomEnvironment(); +const pmremGenerator = new THREE.PMREMGenerator( renderer ); +const envMap = pmremGenerator.fromScene( environment ).texture; +scene.environment = envMap; +``` + +## Import + +RoomEnvironment is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +``` + +## Constructor + +### new RoomEnvironment() + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the environment is no longer required. + +## Source + +[examples/jsm/environments/RoomEnvironment.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/environments/RoomEnvironment.js) \ No newline at end of file diff --git a/docs/pages/RotateNode.html.md b/docs/pages/RotateNode.html.md new file mode 100644 index 00000000000000..7fa706c8f99709 --- /dev/null +++ b/docs/pages/RotateNode.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# RotateNode + +Applies a rotation to the given position node. + +## Constructor + +### new RotateNode( positionNode : Node, rotationNode : Node ) + +Constructs a new rotate node. + +**positionNode** + +The position node. + +**rotationNode** + +Represents the rotation that is applied to the position node. Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. + +## Properties + +### .positionNode : Node + +The position node. + +### .rotationNode : Node + +Represents the rotation that is applied to the position node. Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. + +## Methods + +### .getNodeType( builder : NodeBuilder ) : string + +The type of the [RotateNode#positionNode](RotateNode.html#positionNode) defines the node's type. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getNodeType](TempNode.html#getNodeType) + +**Returns:** The node's type. + +## Source + +[src/nodes/utils/RotateNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/RotateNode.js) \ No newline at end of file diff --git a/docs/pages/RoundedBoxGeometry.html.md b/docs/pages/RoundedBoxGeometry.html.md new file mode 100644 index 00000000000000..6530d1c923acea --- /dev/null +++ b/docs/pages/RoundedBoxGeometry.html.md @@ -0,0 +1,82 @@ +*Inheritance: EventDispatcher → BufferGeometry → BoxGeometry →* + +# RoundedBoxGeometry + +A special type of box geometry with rounded corners and edges. + +## Code Example + +```js +const geometry = new THREE.RoundedBoxGeometry(); +const material = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ); +const cube = new THREE.Mesh( geometry, material ); +scene.add( cube ); +``` + +## Import + +RoundedBoxGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; +``` + +## Constructor + +### new RoundedBoxGeometry( width : number, height : number, depth : number, segments : number, radius : number ) + +Constructs a new rounded box geometry. + +**width** + +The width. That is, the length of the edges parallel to the X axis. + +Default is `1`. + +**height** + +The height. That is, the length of the edges parallel to the Y axis. + +Default is `1`. + +**depth** + +The depth. That is, the length of the edges parallel to the Z axis. + +Default is `1`. + +**segments** + +Number of segments that form the rounded corners. + +Default is `2`. + +**radius** + +The radius of the rounded corners. + +Default is `0.1`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +**Overrides:** [BoxGeometry#parameters](BoxGeometry.html#parameters) + +## Static Methods + +### .fromJSON( data : Object ) : RoundedBoxGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[examples/jsm/geometries/RoundedBoxGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/RoundedBoxGeometry.js) \ No newline at end of file diff --git a/docs/pages/SAOPass.html.md b/docs/pages/SAOPass.html.md new file mode 100644 index 00000000000000..c9e777c86bb80a --- /dev/null +++ b/docs/pages/SAOPass.html.md @@ -0,0 +1,128 @@ +*Inheritance: Pass →* + +# SAOPass + +A SAO implementation inspired from @bhouston previous SAO work. + +`SAOPass` provides better quality than [SSAOPass](SSAOPass.html) but is also more expensive. + +## Code Example + +```js +const saoPass = new SAOPass( scene, camera ); +composer.addPass( saoPass ); +``` + +## Import + +SAOPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SAOPass } from 'three/addons/postprocessing/SAOPass.js'; +``` + +## Constructor + +### new SAOPass( scene : Scene, camera : Camera, resolution : Vector2 ) + +Constructs a new SAO pass. + +**scene** + +The scene to compute the AO for. + +**camera** + +The camera. + +**resolution** + +The effect's resolution. + +## Properties + +### .camera : Camera + +The camera. + +### .clear : boolean + +Overwritten to perform a clear operation by default. + +Default is `true`. + +**Overrides:** [Pass#clear](Pass.html#clear) + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +### .params : Object + +The SAO parameter. + +### .resolution : Vector2 + +The effect's resolution. + +Default is `(256,256)`. + +### .scene : Scene + +The scene to render the AO for. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the SAO pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/SAOPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SAOPass.js) \ No newline at end of file diff --git a/docs/pages/SMAANode.html.md b/docs/pages/SMAANode.html.md new file mode 100644 index 00000000000000..7fa18aec1eaed4 --- /dev/null +++ b/docs/pages/SMAANode.html.md @@ -0,0 +1,89 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# SMAANode + +Post processing node for applying SMAA. Unlike FXAA, this node should be applied before converting colors to sRGB. SMAA should produce better results than FXAA but is also more expensive to execute. + +Used Preset: SMAA 1x Medium (with color edge detection) Reference: [https://github.com/iryoku/smaa/releases/tag/v2.8](https://github.com/iryoku/smaa/releases/tag/v2.8). + +## Import + +SMAANode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { smaa } from 'three/addons/tsl/display/SMAANode.js'; +``` + +## Constructor + +### new SMAANode( textureNode : TextureNode ) + +Constructs a new SMAA node. + +**textureNode** + +The texture node that represents the input of the effect. + +## Properties + +### .textureNode : TextureNode + +The texture node that represents the input of the effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/SMAANode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/SMAANode.js) \ No newline at end of file diff --git a/docs/pages/SMAAPass.html.md b/docs/pages/SMAAPass.html.md new file mode 100644 index 00000000000000..f8c783802f2fb3 --- /dev/null +++ b/docs/pages/SMAAPass.html.md @@ -0,0 +1,78 @@ +*Inheritance: Pass →* + +# SMAAPass + +A pass for applying SMAA. Unlike [FXAAPass](FXAAPass.html), `SMAAPass` operates in `linear-srgb` so this pass must be executed before [OutputPass](OutputPass.html). + +## Code Example + +```js +const smaaPass = new SMAAPass(); +composer.addPass( smaaPass ); +``` + +## Import + +SMAAPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SMAAPass } from 'three/addons/postprocessing/SMAAPass.js'; +``` + +## Constructor + +### new SMAAPass() + +Constructs a new SMAA pass. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the SMAA pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/SMAAPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SMAAPass.js) \ No newline at end of file diff --git a/docs/pages/SSAAPassNode.html.md b/docs/pages/SSAAPassNode.html.md new file mode 100644 index 00000000000000..19c2f5206a97c9 --- /dev/null +++ b/docs/pages/SSAAPassNode.html.md @@ -0,0 +1,101 @@ +*Inheritance: EventDispatcher → Node → TempNode → PassNode →* + +# SSAAPassNode + +A special render pass node that renders the scene with SSAA (Supersampling Anti-Aliasing). This manual SSAA approach re-renders the scene ones for each sample with camera jitter and accumulates the results. + +This node produces a high-quality anti-aliased output but is also extremely expensive because of its brute-force approach of re-rendering the entire scene multiple times. + +Reference: [https://en.wikipedia.org/wiki/Supersampling](https://en.wikipedia.org/wiki/Supersampling) + +## Import + +SSAAPassNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ssaaPass } from 'three/addons/tsl/display/SSAAPassNode.js'; +``` + +## Constructor + +### new SSAAPassNode( scene : Scene, camera : Camera ) + +Constructs a new SSAA pass node. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +## Properties + +### .clearAlpha : number + +The clear alpha of the pass. + +Default is `0`. + +### .clearColor : Color + +The clear color of the pass. + +Default is `0x000000`. + +### .isSSAAPassNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .sampleLevel : number + +The sample level specified as n, where the number of samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16. + +Default is `4`. + +### .sampleWeight : UniformNode. + +A uniform node representing the sample weight. + +Default is `1`. + +### .unbiased : boolean + +Whether rounding errors should be mitigated or not. + +Default is `true`. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the pass is no longer required. + +**Overrides:** [PassNode#dispose](PassNode.html#dispose) + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's MRT configuration and quad mesh. + +**builder** + +The current node builder. + +**Overrides:** [PassNode#setup](PassNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the SSAA effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [PassNode#updateBefore](PassNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/SSAAPassNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/SSAAPassNode.js) \ No newline at end of file diff --git a/docs/pages/SSAARenderPass.html.md b/docs/pages/SSAARenderPass.html.md new file mode 100644 index 00000000000000..3b48a61bc51f65 --- /dev/null +++ b/docs/pages/SSAARenderPass.html.md @@ -0,0 +1,141 @@ +*Inheritance: Pass →* + +# SSAARenderPass + +Supersample Anti-Aliasing Render Pass. + +This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results. + +## Code Example + +```js +const ssaaRenderPass = new SSAARenderPass( scene, camera ); +ssaaRenderPass.sampleLevel = 3; +composer.addPass( ssaaRenderPass ); +``` + +## Import + +SSAARenderPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SSAARenderPass } from 'three/addons/postprocessing/SSAARenderPass.js'; +``` + +## Constructor + +### new SSAARenderPass( scene : Scene, camera : Camera, clearColor : number | Color | string, clearAlpha : number ) + +Constructs a new SSAA render pass. + +**scene** + +The scene to render. + +**camera** + +The camera. + +**clearColor** + +The clear color of the render pass. + +Default is `0x000000`. + +**clearAlpha** + +The clear alpha of the render pass. + +Default is `0`. + +## Properties + +### .camera : Camera + +The camera. + +### .clearAlpha : number + +The clear alpha of the render pass. + +Default is `0`. + +### .clearColor : number | Color | string + +The clear color of the render pass. + +Default is `0x000000`. + +### .sampleLevel : number + +The sample level. Specified as n, where the number of samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16. + +Default is `4`. + +### .scene : Scene + +The scene to render. + +### .stencilBuffer : boolean + +Whether to use a stencil buffer or not. This property can't be changed after the first render. + +Default is `false`. + +### .unbiased : boolean + +Whether the pass should be unbiased or not. This property has the most visible effect when rendering to a RGBA8 buffer because it mitigates rounding errors. By default RGBA16F is used. + +Default is `true`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the SSAA render pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/SSAARenderPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SSAARenderPass.js) \ No newline at end of file diff --git a/docs/pages/SSAOPass.html.md b/docs/pages/SSAOPass.html.md new file mode 100644 index 00000000000000..52eaa0680cf260 --- /dev/null +++ b/docs/pages/SSAOPass.html.md @@ -0,0 +1,168 @@ +*Inheritance: Pass →* + +# SSAOPass + +A pass for a basic SSAO effect. + +[SAOPass](SAOPass.html) and GTAPass produce a more advanced AO but are also more expensive. + +## Code Example + +```js +const ssaoPass = new SSAOPass( scene, camera, width, height ); +composer.addPass( ssaoPass ); +``` + +## Import + +SSAOPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SSAOPass } from 'three/addons/postprocessing/SSAOPass.js'; +``` + +## Constructor + +### new SSAOPass( scene : Scene, camera : Camera, width : number, height : number, kernelSize : number ) + +Constructs a new SSAO pass. + +**scene** + +The scene to compute the AO for. + +**camera** + +The camera. + +**width** + +The width of the effect. + +Default is `512`. + +**height** + +The height of the effect. + +Default is `512`. + +**kernelSize** + +The kernel size. + +Default is `32`. + +## Properties + +### .camera : Camera + +The camera. + +### .clear : boolean + +Overwritten to perform a clear operation by default. + +Default is `true`. + +**Overrides:** [Pass#clear](Pass.html#clear) + +### .height : number + +The height of the effect. + +Default is `512`. + +### .kernelRadius : number + +The kernel radius controls how wide the AO spreads. + +Default is `8`. + +### .maxDistance : number + +Defines the maximum distance that should be affected by the AO. + +Default is `0.1`. + +### .minDistance : number + +Defines the minimum distance that should be affected by the AO. + +Default is `0.005`. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +### .output : number + +The output configuration. + +Default is `0`. + +### .scene : Scene + +The scene to render the AO for. + +### .width : number + +The width of the effect. + +Default is `512`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the SSAO pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/SSAOPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SSAOPass.js) \ No newline at end of file diff --git a/docs/pages/SSGINode.html.md b/docs/pages/SSGINode.html.md new file mode 100644 index 00000000000000..f1aa6d4d43c440 --- /dev/null +++ b/docs/pages/SSGINode.html.md @@ -0,0 +1,197 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# SSGINode + +Post processing node for applying Screen Space Global Illumination (SSGI) to a scene. + +References: + +* [https://github.com/cdrinmatane/SSRT3](https://github.com/cdrinmatane/SSRT3). +* [https://cdrinmatane.github.io/posts/ssaovb-code/](https://cdrinmatane.github.io/posts/ssaovb-code/). +* [https://cdrinmatane.github.io/cgspotlight-slides/ssilvb\_slides.pdf](https://cdrinmatane.github.io/cgspotlight-slides/ssilvb_slides.pdf). + +The quality and performance of the effect mainly depend on `sliceCount` and `stepCount`. The total number of samples taken per pixel is `sliceCount` \* `stepCount` \* `2`. Here are some recommended presets depending on whether temporal filtering is used or not. + +With temporal filtering (recommended): + +* Low: `sliceCount` of `1`, `stepCount` of `12`. +* Medium: `sliceCount` of `2`, `stepCount` of `8`. +* High: `sliceCount` of `3`, `stepCount` of `16`. + +Use for a higher slice count if you notice temporal instabilities like flickering. Reduce the sample count then to mitigate the performance lost. + +Without temporal filtering: + +* Low: `sliceCount` of `2`, `stepCount` of `6`. +* Medium: `sliceCount` of `3`, `stepCount` of `8`. +* High: `sliceCount` of `4`, `stepCount` of `12`. + +## Import + +SSGINode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ssgi } from 'three/addons/tsl/display/SSGINode.js'; +``` + +## Constructor + +### new SSGINode( beautyNode : TextureNode, depthNode : TextureNode, normalNode : TextureNode, camera : PerspectiveCamera ) + +Constructs a new SSGI node. + +**beautyNode** + +A texture node that represents the beauty or scene pass. + +**depthNode** + +A texture node that represents the scene's depth. + +**normalNode** + +A texture node that represents the scene's normals. + +**camera** + +The camera the scene is rendered with. + +## Properties + +### .aoIntensity : UniformNode. + +Power function applied to AO to make it appear darker/lighter. Should be in the range `[0, 4]`. + +Default is `1`. + +### .backfaceLighting : UniformNode. + +How much light backface surfaces emit. Should be in the range `[0, 1]`. + +Default is `0`. + +### .beautyNode : TextureNode + +A texture node that represents the beauty or scene pass. + +### .depthNode : TextureNode + +A node that represents the scene's depth. + +### .expFactor : UniformNode. + +Controls samples distribution. It's an exponent applied at each step get increasing step size over the distance. Should be in the range `[1, 3]`. + +Default is `2`. + +### .giIntensity : UniformNode. + +Intensity of the indirect diffuse light. Should be in the range `[0, 100]`. + +Default is `10`. + +### .normalNode : TextureNode + +A node that represents the scene's normals. If no normals are passed to the constructor (because MRT is not available), normals can be automatically reconstructed from depth values in the shader. + +### .radius : UniformNode. + +Effective sampling radius in world space. AO and GI can only have influence within that radius. Should be in the range `[1, 25]`. + +Default is `12`. + +### .sliceCount : UniformNode. + +Number of per-pixel hemisphere slices. This has a big performance cost and should be kept as low as possible. Should be in the range `[1, 4]`. + +Default is `1`. + +### .stepCount : UniformNode. + +Number of samples taken along one side of a given hemisphere slice. This has a big performance cost and should be kept as low as possible. Should be in the range `[1, 32]`. + +Default is `12`. + +### .thickness : UniformNode. + +Constant thickness value of objects on the screen in world units. Allows light to pass behind surfaces past that thickness value. Should be in the range `[0.01, 10]`. + +Default is `1`. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +### .useLinearThickness : UniformNode. + +Whether to increase thickness linearly over distance or not (avoid losing detail over the distance). + +Default is `false`. + +### .useScreenSpaceSampling : UniformNode. + +Makes the sample distance in screen space instead of world-space (helps having more detail up close). + +Default is `false`. + +### .useTemporalFiltering : boolean + +Whether to use temporal filtering or not. Setting this property to `true` requires the usage of `TRAANode`. This will help to reduce noise although it introduces typical TAA artifacts like ghosting and temporal instabilities. + +If setting this property to `false`, a manual denoise via `DenoiseNode` is required. + +Default is `true`. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/SSGINode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/SSGINode.js) \ No newline at end of file diff --git a/docs/pages/SSRNode.html.md b/docs/pages/SSRNode.html.md new file mode 100644 index 00000000000000..80d08b0da9a93a --- /dev/null +++ b/docs/pages/SSRNode.html.md @@ -0,0 +1,157 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# SSRNode + +Post processing node for computing screen space reflections (SSR). + +Reference: [https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html](https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html) + +## Import + +SSRNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ssr } from 'three/addons/tsl/display/SSRNode.js'; +``` + +## Constructor + +### new SSRNode( colorNode : Node., depthNode : Node., normalNode : Node., metalnessNode : Node., roughnessNode : Node., camera : Camera ) + +Constructs a new SSR node. + +**colorNode** + +The node that represents the beauty pass. + +**depthNode** + +A node that represents the beauty pass's depth. + +**normalNode** + +A node that represents the beauty pass's normals. + +**metalnessNode** + +A node that represents the beauty pass's metalness. + +**roughnessNode** + +A node that represents the beauty pass's roughness. + +Default is `null`. + +**camera** + +The camera the scene is rendered with. + +Default is `null`. + +## Properties + +### .blurQuality : UniformNode. + +The quality of the blur. Must be an integer in the range `[1,3]`. + +### .camera : Camera + +The camera the scene is rendered with. + +### .colorNode : Node. + +The node that represents the beauty pass. + +### .depthNode : Node. + +A node that represents the beauty pass's depth. + +### .maxDistance : UniformNode. + +Controls how far a fragment can reflect. Increasing this value result in more computational overhead but also increases the reflection distance. + +### .metalnessNode : Node. + +A node that represents the beauty pass's metalness. + +### .normalNode : Node. + +A node that represents the beauty pass's normals. + +### .opacity : UniformNode. + +Controls how the SSR reflections are blended with the beauty pass. + +### .quality : UniformNode. + +This parameter controls how detailed the raymarching process works. The value ranges is `[0,1]` where `1` means best quality (the maximum number of raymarching iterations/samples) and `0` means no samples at all. + +A quality of `0.5` is usually sufficient for most use cases. Try to keep this parameter as low as possible. Larger values result in noticeable more overhead. + +### .resolutionScale : number + +The resolution scale. Valid values are in the range `[0,1]`. `1` means best quality but also results in more computational overhead. Setting to `0.5` means the effect is computed in half-resolution. + +Default is `1`. + +### .thickness : UniformNode. + +Controls the cutoff between what counts as a possible reflection hit and what does not. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/SSRNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/SSRNode.js) \ No newline at end of file diff --git a/docs/pages/SSRPass.html.md b/docs/pages/SSRPass.html.md new file mode 100644 index 00000000000000..d4ef5f0ea9c334 --- /dev/null +++ b/docs/pages/SSRPass.html.md @@ -0,0 +1,256 @@ +*Inheritance: Pass →* + +# SSRPass + +A pass for a basic SSR effect. + +## Code Example + +```js +const ssrPass = new SSRPass( { + renderer, + scene, + camera, + width: innerWidth, + height: innerHeight +} ); +composer.addPass( ssrPass ); +``` + +## Import + +SSRPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SSRPass } from 'three/addons/postprocessing/SSRPass.js'; +``` + +## Constructor + +### new SSRPass( options : SSRPass~Options ) + +Constructs a new SSR pass. + +**options** + +The pass options. + +## Properties + +### .blur : boolean + +Whether to blur reflections or not. + +Default is `true`. + +### .bouncing : boolean + +Whether bouncing is enabled or not. + +Default is `false`. + +### .camera : Camera + +The camera. + +### .clear : boolean + +Overwritten to perform a clear operation by default. + +Default is `true`. + +**Overrides:** [Pass#clear](Pass.html#clear) + +### .distanceAttenuation : boolean + +Whether to use distance attenuation or not. + +Default is `true`. + +### .fresnel : boolean + +Whether to use fresnel or not. + +Default is `true`. + +### .groundReflector : ReflectorForSSRPass + +The ground reflector. + +Default is `0`. + +### .height : number + +The height of the effect. + +Default is `512`. + +### .infiniteThick : boolean + +Whether to use infinite thickness or not. + +Default is `false`. + +### .maxDistance : number + +Controls how far a fragment can reflect. + +Default is `180`. + +### .opacity : number + +The opacity. + +Default is `0.5`. + +### .output : number + +The output configuration. + +Default is `0`. + +### .renderer : WebGLRenderer + +The renderer. + +### .resolutionScale : number + +The resolution scale. Valid values are in the range `[0,1]`. `1` means best quality but also results in more computational overhead. Setting to `0.5` means the effect is computed in half-resolution. + +Default is `1`. + +### .scene : Scene + +The scene to render. + +### .selective : boolean + +Whether the pass is selective or not. + +Default is `false`. + +### .selects : Array. + +Which 3D objects should be affected by SSR. If not set, the entire scene is affected. + +Default is `null`. + +### .thickness : number + +Controls the cutoff between what counts as a possible reflection hit and what does not. + +Default is `.018`. + +### .width : number + +The width of the effect. + +Default is `512`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the SSR pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Type Definitions + +### .Options + +Constructor options of `SSRPass`. + +**renderer** +[WebGLRenderer](WebGLRenderer.html) + +The renderer. + +**scene** +[Scene](Scene.html) + +The scene to render. + +**camera** +[Camera](Camera.html) + +The camera. + +**width** +number + +The width of the effect. + +Default is `512`. + +**height** +number + +The width of the effect. + +Default is `512`. + +**selects** +Array.<[Object3D](Object3D.html)\> + +Which 3D objects should be affected by SSR. If not set, the entire scene is affected. + +Default is `null`. + +**bouncing** +boolean + +Whether bouncing is enabled or not. + +Default is `false`. + +**groundReflector** +[ReflectorForSSRPass](ReflectorForSSRPass.html) + +A ground reflector. + +Default is `null`. + +## Source + +[examples/jsm/postprocessing/SSRPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SSRPass.js) \ No newline at end of file diff --git a/docs/pages/SSSLightingModel.html.md b/docs/pages/SSSLightingModel.html.md new file mode 100644 index 00000000000000..8da56d27496822 --- /dev/null +++ b/docs/pages/SSSLightingModel.html.md @@ -0,0 +1,83 @@ +*Inheritance: LightingModel → PhysicalLightingModel →* + +# SSSLightingModel + +Represents the lighting model for [MeshSSSNodeMaterial](MeshSSSNodeMaterial.html). + +## Constructor + +### new SSSLightingModel( clearcoat : boolean, sheen : boolean, iridescence : boolean, anisotropy : boolean, transmission : boolean, dispersion : boolean, sss : boolean ) + +Constructs a new physical lighting model. + +**clearcoat** + +Whether clearcoat is supported or not. + +Default is `false`. + +**sheen** + +Whether sheen is supported or not. + +Default is `false`. + +**iridescence** + +Whether iridescence is supported or not. + +Default is `false`. + +**anisotropy** + +Whether anisotropy is supported or not. + +Default is `false`. + +**transmission** + +Whether transmission is supported or not. + +Default is `false`. + +**dispersion** + +Whether dispersion is supported or not. + +Default is `false`. + +**sss** + +Whether SSS is supported or not. + +Default is `false`. + +## Properties + +### .useSSS : boolean + +Whether the lighting model should use SSS or not. + +Default is `false`. + +## Methods + +### .direct( input : Object, builder : NodeBuilder ) + +Extends the default implementation with a SSS term. + +Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) + +**input** + +The input data. + +**builder** + +The current node builder. + +**Overrides:** [PhysicalLightingModel#direct](PhysicalLightingModel.html#direct) + +## Source + +[src/materials/nodes/MeshSSSNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/MeshSSSNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/SSSNode.html.md b/docs/pages/SSSNode.html.md new file mode 100644 index 00000000000000..243b22f78fb804 --- /dev/null +++ b/docs/pages/SSSNode.html.md @@ -0,0 +1,155 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# SSSNode + +Post processing node for applying Screen-Space Shadows (SSS) to a scene. + +Screen-Space Shadows (also known as Contact Shadows) should ideally be used to complement traditional shadow maps. They are best suited for rendering detailed shadows of smaller objects at a closer scale like intricate shadowing on highly detailed models. In other words: Use Shadow Maps for the foundation and Screen-Space Shadows for the details. + +The shadows produced by this implementation might have too hard edges for certain use cases. Use a box, gaussian or hash blur to soften the edges before doing the composite with the beauty pass. Code example: + +Limitations: + +* Ideally the maximum shadow length should not exceed `1` meter. Otherwise the effect gets computationally very expensive since more samples during the ray marching process are evaluated. You can mitigate this issue by reducing the `quality` paramter. +* The effect can only be used with a single directional light, the main light of your scene. This main light usually represents the sun or daylight. +* Like other Screen-Space techniques SSS can only honor objects in the shadowing computation that are currently visible within the camera's view. + +References: + +* [https://panoskarabelas.com/posts/screen\_space\_shadows/](https://panoskarabelas.com/posts/screen_space_shadows/). +* [https://www.bendstudio.com/blog/inside-bend-screen-space-shadows/](https://www.bendstudio.com/blog/inside-bend-screen-space-shadows/). + +## Code Example + +```js +const sssPass = sss( scenePassDepth, camera, mainLight ); +const sssBlur = boxBlur( sssPass.r, { size: 2, separation: 1 } ); // optional blur +``` + +## Import + +SSSNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { sss } from 'three/addons/tsl/display/SSSNode.js'; +``` + +## Constructor + +### new SSSNode( depthNode : TextureNode, camera : Camera, mainLight : DirectionalLight ) + +Constructs a new SSS node. + +**depthNode** + +A texture node that represents the scene's depth. + +**camera** + +The camera the scene is rendered with. + +**mainLight** + +The main directional light of the scene. + +## Properties + +### .depthNode : TextureNode + +A node that represents the beauty pass's depth. + +### .maxDistance : UniformNode. + +Maximum shadow length in world units. Longer shadows result in more computational overhead. + +Default is `0.1`. + +### .quality : UniformNode. + +This parameter controls how detailed the raymarching process works. The value ranges is `[0,1]` where `1` means best quality (the maximum number of raymarching iterations/samples) and `0` means no samples at all. + +A quality of `0.5` is usually sufficient for most use cases. Try to keep this parameter as low as possible. Larger values result in noticeable more overhead. + +Default is `0.5`. + +### .resolutionScale : number + +The resolution scale. Valid values are in the range `[0,1]`. `1` means best quality but also results in more computational overhead. Setting to `0.5` means the effect is computed in half-resolution. + +Default is `1`. + +### .shadowIntensity : UniformNode. + +Shadow intensity. Must be in the range `[0, 1]`. + +Default is `1.0`. + +### .thickness : UniformNode. + +Depth testing thickness. + +Default is `0.01`. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +### .useTemporalFiltering : boolean + +Whether to use temporal filtering or not. Setting this property to `true` requires the usage of `TRAANode`. This will help to reduce noice although it introduces typical TAA artifacts like ghosting and temporal instabilities. + +Default is `false`. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/SSSNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/SSSNode.js) \ No newline at end of file diff --git a/docs/pages/STLExporter.html.md b/docs/pages/STLExporter.html.md new file mode 100644 index 00000000000000..ad5adc57198ba7 --- /dev/null +++ b/docs/pages/STLExporter.html.md @@ -0,0 +1,59 @@ +# STLExporter + +An exporter for STL. + +STL files describe only the surface geometry of a three-dimensional object without any representation of color, texture or other common model attributes. The STL format specifies both ASCII and binary representations, with binary being more compact. STL files contain no scale information or indexes, and the units are arbitrary. + +## Code Example + +```js +const exporter = new STLExporter(); +const data = exporter.parse( mesh, { binary: true } ); +``` + +## Import + +STLExporter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { STLExporter } from 'three/addons/exporters/STLExporter.js'; +``` + +## Constructor + +### new STLExporter() + +## Methods + +### .parse( scene : Object3D, options : STLExporter~Options ) : string | ArrayBuffer + +Parses the given 3D object and generates the STL output. + +If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. + +**scene** + +A scene, mesh or any other 3D object containing meshes to encode. + +**options** + +The export options. + +**Returns:** The exported STL. + +## Type Definitions + +### .Options + +Export options of `STLExporter`. + +**binary** +boolean + +Whether to export in binary format or ASCII. + +Default is `false`. + +## Source + +[examples/jsm/exporters/STLExporter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/STLExporter.js) \ No newline at end of file diff --git a/docs/pages/STLLoader.html.md b/docs/pages/STLLoader.html.md new file mode 100644 index 00000000000000..a6820fa74902ed --- /dev/null +++ b/docs/pages/STLLoader.html.md @@ -0,0 +1,101 @@ +*Inheritance: Loader →* + +# STLLoader + +A loader for the STL format, as created by Solidworks and other CAD programs. + +Supports both binary and ASCII encoded files. The loader returns a non-indexed buffer geometry. + +Limitations: + +* Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL\_(file\_format)#Color\_in\_binary\_STL). +* There is perhaps some question as to how valid it is to always assume little-endian-ness. +* ASCII decoding assumes file is UTF-8. + +For binary STLs geometry might contain colors for vertices. To use it: + +```js +// use the same code to load STL as above +if ( geometry.hasColors ) { + material = new THREE.MeshPhongMaterial( { opacity: geometry.alpha, vertexColors: true } ); +} +const mesh = new THREE.Mesh( geometry, material ); +``` + +For ASCII STLs containing multiple solids, each solid is assigned to a different group. Groups can be used to assign a different color by defining an array of materials with the same length of geometry.groups and passing it to the Mesh constructor: + +```js +const materials = []; +const nGeometryGroups = geometry.groups.length; +for ( let i = 0; i < nGeometryGroups; i ++ ) { + const material = new THREE.MeshPhongMaterial( { color: colorMap[ i ], wireframe: false } ); + materials.push( material ); +} +const mesh = new THREE.Mesh(geometry, materials); +``` + +## Code Example + +```js +const loader = new STLLoader(); +const geometry = await loader.loadAsync( './models/stl/slotted_disk.stl' ) +scene.add( new THREE.Mesh( geometry ) ); +``` + +## Import + +STLLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { STLLoader } from 'three/addons/loaders/STLLoader.js'; +``` + +## Constructor + +### new STLLoader( manager : LoadingManager ) + +Constructs a new STL loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded STL asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : BufferGeometry + +Parses the given STL data and returns the resulting geometry. + +**data** + +The raw STL data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed geometry. + +## Source + +[examples/jsm/loaders/STLLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/STLLoader.js) \ No newline at end of file diff --git a/docs/pages/SVGLoader.html.md b/docs/pages/SVGLoader.html.md new file mode 100644 index 00000000000000..3177d9d115582a --- /dev/null +++ b/docs/pages/SVGLoader.html.md @@ -0,0 +1,222 @@ +*Inheritance: Loader →* + +# SVGLoader + +A loader for the SVG format. + +Scalable Vector Graphics is an XML-based vector image format for two-dimensional graphics with support for interactivity and animation. + +## Code Example + +```js +const loader = new SVGLoader(); +const data = await loader.loadAsync( 'data/svgSample.svg' ); +const paths = data.paths; +const group = new THREE.Group(); +for ( let i = 0; i < paths.length; i ++ ) { + const path = paths[ i ]; + const material = new THREE.MeshBasicMaterial( { + color: path.color, + side: THREE.DoubleSide, + depthWrite: false + } ); + const shapes = SVGLoader.createShapes( path ); + for ( let j = 0; j < shapes.length; j ++ ) { + const shape = shapes[ j ]; + const geometry = new THREE.ShapeGeometry( shape ); + const mesh = new THREE.Mesh( geometry, material ); + group.add( mesh ); + } +} +scene.add( group ); +``` + +## Import + +SVGLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SVGLoader } from 'three/addons/loaders/SVGLoader.js'; +``` + +## Constructor + +### new SVGLoader( manager : LoadingManager ) + +Constructs a new SVG loader. + +**manager** + +The loading manager. + +## Properties + +### .defaultDPI : number + +Default dots per inch. + +Default is `90`. + +### .defaultUnit : 'mm' | 'cm' | 'in' | 'pt' | 'pc' | 'px' + +Default unit. + +Default is `'px'`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded SVG asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string ) : Object + +Parses the given SVG data and returns the resulting data. + +**text** + +The raw SVG data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** An object holding an array of shape paths and the SVG XML document. + +## Static Methods + +### .createShapes( shapePath : ShapePath ) : Array. + +Creates from the given shape path and array of shapes. + +**shapePath** + +The shape path. + +**Returns:** An array of shapes. + +### .getStrokeStyle( width : number, color : string, lineJoin : 'round' | 'bevel' | 'miter' | 'miter-limit', lineCap : 'round' | 'square' | 'butt', miterLimit : number ) : Object + +Returns a stroke style object from the given parameters. + +**width** + +The stroke width. + +Default is `1`. + +**color** + +The stroke color, as returned by [Color#getStyle](Color.html#getStyle). + +Default is `'#000'`. + +**lineJoin** + +The line join style. + +Default is `'miter'`. + +**lineCap** + +The line cap style. + +Default is `'butt'`. + +**miterLimit** + +Maximum join length, in multiples of the `width` parameter (join is truncated if it exceeds that distance). + +Default is `4`. + +**Returns:** The style object. + +### .pointsToStroke( points : Array., style : Object, arcDivisions : number, minDistance : number ) : BufferGeometry + +Creates a stroke from an array of points. + +**points** + +The points in 2D space. Minimum 2 points. The path can be open or closed (last point equals to first point). + +**style** + +Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object. + +**arcDivisions** + +Arc divisions for round joins and endcaps. + +Default is `12`. + +**minDistance** + +Points closer to this distance will be merged. + +Default is `0.001`. + +**Returns:** The stroke geometry. UV coordinates are generated ('u' along path. 'v' across it, from left to right). Returns `null` if not geometry was generated. + +### .pointsToStrokeWithBuffers( points : Array., style : Object, arcDivisions : number, minDistance : number, vertices : Array., normals : Array., uvs : Array., vertexOffset : number ) : number + +Creates a stroke from an array of points. + +**points** + +The points in 2D space. Minimum 2 points. + +**style** + +Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object. + +**arcDivisions** + +Arc divisions for round joins and endcaps. + +Default is `12`. + +**minDistance** + +Points closer to this distance will be merged. + +Default is `0.001`. + +**vertices** + +An array holding vertices. + +**normals** + +An array holding normals. + +**uvs** + +An array holding uvs. + +**vertexOffset** + +The vertex offset. + +Default is `0`. + +**Returns:** The number of vertices. + +## Source + +[examples/jsm/loaders/SVGLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/SVGLoader.js) \ No newline at end of file diff --git a/docs/pages/SVGObject.html.md b/docs/pages/SVGObject.html.md new file mode 100644 index 00000000000000..aa43bbb51fadd4 --- /dev/null +++ b/docs/pages/SVGObject.html.md @@ -0,0 +1,39 @@ +*Inheritance: EventDispatcher → Object3D →* + +# SVGObject + +Can be used to wrap SVG elements into a 3D object. + +## Import + +SVGObject is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SVGObject } from 'three/addons/renderers/SVGRenderer.js'; +``` + +## Constructor + +### new SVGObject( node : SVGElement ) + +Constructs a new SVG object. + +**node** + +The SVG element. + +## Properties + +### .isSVGObject : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .node : SVGElement + +This SVG element. + +## Source + +[examples/jsm/renderers/SVGRenderer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/SVGRenderer.js) \ No newline at end of file diff --git a/docs/pages/SVGRenderer.html.md b/docs/pages/SVGRenderer.html.md new file mode 100644 index 00000000000000..443730a1d5bc86 --- /dev/null +++ b/docs/pages/SVGRenderer.html.md @@ -0,0 +1,134 @@ +# SVGRenderer + +This renderer an be used to render geometric data using SVG. The produced vector graphics are particular useful in the following use cases: + +* Animated logos or icons. +* Interactive 2D/3D diagrams or graphs. +* Interactive maps. +* Complex or animated user interfaces. + +`SVGRenderer` has various advantages. It produces crystal-clear and sharp output which is independent of the actual viewport resolution.SVG elements can be styled via CSS. And they have good accessibility since it's possible to add metadata like title or description (useful for search engines or screen readers). + +There are, however, some important limitations: + +* No advanced shading. +* No texture support. +* No shadow support. + +## Import + +SVGRenderer is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SVGRenderer } from 'three/addons/renderers/SVGRenderer.js'; +``` + +## Constructor + +### new SVGRenderer() + +Constructs a new SVG renderer. + +## Properties + +### .autoClear : boolean + +Whether to automatically perform a clear before a render call or not. + +Default is `true`. + +### .domElement : SVGSVGElement + +The DOM where the renderer appends its child-elements. + +### .info : Object + +Provides information about the number of rendered vertices and faces. + +### .outputColorSpace : SRGBColorSpace | LinearSRGBColorSpace + +The output color space. + +Default is `SRGBColorSpace`. + +### .overdraw : number + +Number of fractional pixels to enlarge polygons in order to prevent anti-aliasing gaps. Range is `[0,1]`. + +Default is `0.5`. + +### .sortElements : boolean + +Whether to sort elements or not. + +Default is `true`. + +### .sortObjects : boolean + +Whether to sort 3D objects or not. + +Default is `true`. + +## Methods + +### .clear() + +Performs a manual clear with the defined clear color. + +### .getSize() : Object + +Returns an object containing the width and height of the renderer. + +**Returns:** The size of the renderer. + +### .render( scene : Object3D, camera : Camera ) + +Renders the given scene using the given camera. + +**scene** + +A scene or any other type of 3D object. + +**camera** + +The camera. + +### .setClearColor( color : number | Color | string ) + +Sets the clear color. + +**color** + +The clear color to set. + +### .setPrecision( precision : number ) + +Sets the precision of the data used to create a paths. + +**precision** + +The precision to set. + +### .setQuality( quality : 'low' | 'high' ) + +Sets the render quality. Setting to `high` means This value indicates that the browser tries to improve the SVG quality over rendering speed and geometric precision. + +**quality** + +The quality. + +### .setSize( width : number, height : number ) + +Resizes the renderer to the given width and height. + +**width** + +The width of the renderer. + +**height** + +The height of the renderer. + +## Source + +[examples/jsm/renderers/SVGRenderer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/SVGRenderer.js) \ No newline at end of file diff --git a/docs/pages/SampleNode.html.md b/docs/pages/SampleNode.html.md new file mode 100644 index 00000000000000..395f6857479340 --- /dev/null +++ b/docs/pages/SampleNode.html.md @@ -0,0 +1,63 @@ +*Inheritance: EventDispatcher → Node →* + +# SampleNode + +Class representing a node that samples a value using a provided callback function. + +## Constructor + +### new SampleNode( callback : function, uvNode : Node. ) + +Creates an instance of SampleNode. + +**callback** + +The function to be called when sampling. Should accept a UV node and return a value. + +**uvNode** + +The UV node to be used in the texture sampling. + +Default is `null`. + +## Properties + +### .isSampleNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .uvNode : Node.<(vec2|vec3)> + +Represents the texture coordinates. + +Default is `null`. + +### .type : string (readonly) + +Returns the type of the node. + +## Methods + +### .sample( uv : Node. ) : Node + +Calls the callback function with the provided UV node. + +**uv** + +The UV node or value to be passed to the callback. + +**Returns:** The result of the callback function. + +### .setup() : Node + +Sets up the node by sampling with the default UV accessor. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The result of the callback function when called with the UV node. + +## Source + +[src/nodes/utils/SampleNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/SampleNode.js) \ No newline at end of file diff --git a/docs/pages/SavePass.html.md b/docs/pages/SavePass.html.md new file mode 100644 index 00000000000000..0f70e9f92e1850 --- /dev/null +++ b/docs/pages/SavePass.html.md @@ -0,0 +1,104 @@ +*Inheritance: Pass →* + +# SavePass + +A pass that saves the contents of the current read buffer in a render target. + +## Code Example + +```js +const savePass = new SavePass( customRenderTarget ); +composer.addPass( savePass ); +``` + +## Import + +SavePass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SavePass } from 'three/addons/postprocessing/SavePass.js'; +``` + +## Constructor + +### new SavePass( renderTarget : WebGLRenderTarget ) + +Constructs a new save pass. + +**renderTarget** + +The render target for saving the read buffer. If not provided, the pass automatically creates a render target. + +## Properties + +### .material : ShaderMaterial + +The pass material. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +### .renderTarget : WebGLRenderTarget + +The render target which is used to save the read buffer. + +### .uniforms : Object + +The pass uniforms. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the save pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/SavePass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/SavePass.js) \ No newline at end of file diff --git a/docs/pages/Scene.html.md b/docs/pages/Scene.html.md new file mode 100644 index 00000000000000..ff167509950cc5 --- /dev/null +++ b/docs/pages/Scene.html.md @@ -0,0 +1,81 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Scene + +Scenes allow you to set up what is to be rendered and where by three.js. This is where you place 3D objects like meshes, lines or lights. + +## Constructor + +### new Scene() + +Constructs a new scene. + +## Properties + +### .background : Color | Texture + +Defines the background of the scene. Valid inputs are: + +* A color for defining a uniform colored background. +* A texture for defining a (flat) textured background. +* Cube textures or equirectangular textures for defining a skybox. + +Default is `null`. + +### .backgroundBlurriness : number + +Sets the blurriness of the background. Only influences environment maps assigned to [Scene#background](Scene.html#background). Valid input is a float between `0` and `1`. + +Default is `0`. + +### .backgroundIntensity : number + +Attenuates the color of the background. Only applies to background textures. + +Default is `1`. + +### .backgroundRotation : Euler + +The rotation of the background in radians. Only influences environment maps assigned to [Scene#background](Scene.html#background). + +Default is `(0,0,0)`. + +### .environment : Texture + +Sets the environment map for all physical materials in the scene. However, it's not possible to overwrite an existing texture assigned to the `envMap` material property. + +Default is `null`. + +### .environmentIntensity : number + +Attenuates the color of the environment. Only influences environment maps assigned to [Scene#environment](Scene.html#environment). + +Default is `1`. + +### .environmentRotation : Euler + +The rotation of the environment map in radians. Only influences physical materials in the scene when [Scene#environment](Scene.html#environment) is used. + +Default is `(0,0,0)`. + +### .fog : Fog | FogExp2 + +A fog instance defining the type of fog that affects everything rendered in the scene. + +Default is `null`. + +### .isScene : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .overrideMaterial : Material + +Forces everything in the scene to be rendered with the defined material. It is possible to exclude materials from override by setting [Material#allowOverride](Material.html#allowOverride) to `false`. + +Default is `null`. + +## Source + +[src/scenes/Scene.js](https://github.com/mrdoob/three.js/blob/master/src/scenes/Scene.js) \ No newline at end of file diff --git a/docs/pages/SceneNode.html.md b/docs/pages/SceneNode.html.md new file mode 100644 index 00000000000000..f63609a69ed04b --- /dev/null +++ b/docs/pages/SceneNode.html.md @@ -0,0 +1,55 @@ +*Inheritance: EventDispatcher → Node →* + +# SceneNode + +This module allows access to a collection of scene properties. The following predefined TSL objects are available for easier use: + +* `backgroundBlurriness`: A node that represents the scene's background blurriness. +* `backgroundIntensity`: A node that represents the scene's background intensity. +* `backgroundRotation`: A node that represents the scene's background rotation. + +## Constructor + +### new SceneNode( scope : 'backgroundBlurriness' | 'backgroundIntensity' | 'backgroundRotation', scene : Scene ) + +Constructs a new scene node. + +**scope** + +The scope defines the type of scene property that is accessed. + +**scene** + +A reference to the scene. + +Default is `null`. + +## Properties + +### .scene : Scene + +A reference to the scene that is going to be accessed. + +Default is `null`. + +### .scope : 'backgroundBlurriness' | 'backgroundIntensity' | 'backgroundRotation' + +The scope defines the type of scene property that is accessed. + +## Methods + +### .setup( builder : NodeBuilder ) : Node + +Depending on the scope, the method returns a different type of node that represents the respective scene property. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The output node. + +## Source + +[src/nodes/accessors/SceneNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/SceneNode.js) \ No newline at end of file diff --git a/docs/pages/SceneOptimizer.html.md b/docs/pages/SceneOptimizer.html.md new file mode 100644 index 00000000000000..bcc9fb391c4ab1 --- /dev/null +++ b/docs/pages/SceneOptimizer.html.md @@ -0,0 +1,74 @@ +# SceneOptimizer + +This class can be used to optimized scenes by converting individual meshes into [BatchedMesh](BatchedMesh.html). This component is an experimental attempt to implement auto-batching in three.js. + +## Import + +SceneOptimizer is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SceneOptimizer } from 'three/addons/utils/SceneOptimizer.js'; +``` + +## Constructor + +### new SceneOptimizer( scene : Scene, options : SceneOptimizer~Options ) + +Constructs a new scene optimizer. + +**scene** + +The scene to optimize. + +**options** + +The configuration options. + +## Methods + +### .disposeMeshes( meshesToRemove : Set. ) + +Removes the given array of meshes from the scene. + +**meshesToRemove** + +The meshes to remove. + +### .removeEmptyNodes( object : Object3D ) + +Removes empty nodes from all descendants of the given 3D object. + +**object** + +The 3D object to process. + +### .toBatchedMesh() : Scene + +Performs the auto-baching by identifying groups of meshes in the scene that can be represented as a single [BatchedMesh](BatchedMesh.html). The method modifies the scene by adding instances of `BatchedMesh` and removing the now redundant individual meshes. + +**Returns:** The optimized scene. + +### .toInstancingMesh() : Scene (abstract) + +Performs the auto-instancing by identifying groups of meshes in the scene that can be represented as a single [InstancedMesh](InstancedMesh.html). The method modifies the scene by adding instances of `InstancedMesh` and removing the now redundant individual meshes. + +This method is not yet implemented. + +**Returns:** The optimized scene. + +## Type Definitions + +### .Options + +Constructor options of `SceneOptimizer`. + +**debug** +boolean + +Whether to enable debug mode or not. + +Default is `false`. + +## Source + +[examples/jsm/utils/SceneOptimizer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SceneOptimizer.js) \ No newline at end of file diff --git a/docs/pages/ScreenNode.html.md b/docs/pages/ScreenNode.html.md new file mode 100644 index 00000000000000..a00df6d445d621 --- /dev/null +++ b/docs/pages/ScreenNode.html.md @@ -0,0 +1,65 @@ +*Inheritance: EventDispatcher → Node →* + +# ScreenNode + +This node provides a collection of screen related metrics. Depending on [ScreenNode#scope](ScreenNode.html#scope), the nodes can represent resolution or viewport data as well as fragment or uv coordinates. + +## Constructor + +### new ScreenNode( scope : 'coordinate' | 'viewport' | 'size' | 'uv' | 'dpr' ) + +Constructs a new screen node. + +**scope** + +The node's scope. + +## Properties + +### .isViewportNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .scope : 'coordinate' | 'viewport' | 'size' | 'uv' | 'dpr' + +The node represents different metric depending on which scope is selected. + +* `ScreenNode.COORDINATE`: Window-relative coordinates of the current fragment according to WebGPU standards. +* `ScreenNode.VIEWPORT`: The current viewport defined as a four-dimensional vector. +* `ScreenNode.SIZE`: The dimensions of the current bound framebuffer. +* `ScreenNode.UV`: Normalized coordinates. +* `ScreenNode.DPR`: Device pixel ratio. + +## Methods + +### .getNodeType() : 'float' | 'vec2' | 'vec4' + +This method is overwritten since the node type depends on the selected scope. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .getUpdateType() : NodeUpdateType + +This method is overwritten since the node's update type depends on the selected scope. + +**Overrides:** [Node#getUpdateType](Node.html#getUpdateType) + +**Returns:** The update type. + +### .update( frame : NodeFrame ) + +`ScreenNode` implements [Node#update](Node.html#update) to retrieve viewport and size information from the current renderer. + +**frame** + +A reference to the current node frame. + +**Overrides:** [Node#update](Node.html#update) + +## Source + +[src/nodes/display/ScreenNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/ScreenNode.js) \ No newline at end of file diff --git a/docs/pages/ScriptableNode.html.md b/docs/pages/ScriptableNode.html.md new file mode 100644 index 00000000000000..57e0e89bd2cec4 --- /dev/null +++ b/docs/pages/ScriptableNode.html.md @@ -0,0 +1,282 @@ +*Inheritance: EventDispatcher → Node →* + +# ScriptableNode + +This type of node allows to implement nodes with custom scripts. The script section is represented as an instance of `CodeNode` written with JavaScript. The script itself must adhere to a specific structure. + +* main(): Executed once by default and every time `node.needsUpdate` is set. +* layout: The layout object defines the script's interface (inputs and outputs). + +## Code Example + +```js +ScriptableNodeResources.set( 'TSL', TSL ); +const scriptableNode = scriptable( js( ` + layout = { + outputType: 'node', + elements: [ + { name: 'source', inputType: 'node' }, + ] + }; + const { mul, oscSine } = TSL; + function main() { + const source = parameters.get( 'source' ) || float(); + return mul( source, oscSine() ) ); + } +` ) ); +scriptableNode.setParameter( 'source', color( 1, 0, 0 ) ); +const material = new THREE.MeshBasicNodeMaterial(); +material.colorNode = scriptableNode; +``` + +## Constructor + +### new ScriptableNode( codeNode : CodeNode, parameters : Object ) + +Constructs a new scriptable node. + +**codeNode** + +The code node. + +Default is `null`. + +**parameters** + +The parameters definition. + +Default is `{}`. + +## Properties + +### .codeNode : CodeNode + +The code node. + +Default is `null`. + +### .isScriptableNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .parameters : Object + +The parameters definition. + +Default is `{}`. + +### .source : string + +The source code of the scriptable node. + +## Methods + +### .call( name : string, …params : any ) : any + +Calls a function from the script. + +**name** + +The function name. + +**params** + +A list of parameters. + +**Returns:** The result of the function call. + +### .callAsync( name : string, …params : any ) : Promise. (async) + +Asynchronously calls a function from the script. + +**name** + +The function name. + +**params** + +A list of parameters. + +**Returns:** The result of the function call. + +### .clearParameters() : ScriptableNode + +Deletes all parameters from the script. + +**Returns:** A reference to this node. + +### .deleteParameter( name : string ) : ScriptableNode + +Deletes a parameter from the script. + +**name** + +The parameter to remove. + +**Returns:** A reference to this node. + +### .dispose() + +Frees all internal resources. + +**Overrides:** [Node#dispose](Node.html#dispose) + +### .getDefaultOutput() : ScriptableValueNode + +Returns default output of the script. + +**Returns:** The default output. + +### .getDefaultOutputNode() : Node + +Returns default node output of the script. + +**Returns:** The default node output. + +### .getInputLayout( id : string ) : Object + +Returns an input from the layout with the given id/name. + +**id** + +The id/name of the input. + +**Returns:** The element entry. + +### .getLayout() : Object + +Returns the layout of the script. + +**Returns:** The script's layout. + +### .getLocal( name : string ) : Object + +Gets the value of a local script variable. + +**name** + +The variable name. + +**Returns:** The value. + +### .getMethod() : function + +Returns a function created from the node's script. + +**Returns:** The function representing the node's code. + +### .getNodeType( builder : NodeBuilder ) : string + +Overwritten since the node types is inferred from the script's output. + +**builder** + +The current node builder + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .getObject() : Object + +Returns an object representation of the script. + +**Returns:** The result object. + +### .getOutput( name : string ) : ScriptableValueNode + +Returns a script output for the given name. + +**name** + +The name of the output. + +**Returns:** The node value. + +### .getOutputLayout( id : string ) : Object + +Returns an output from the layout with the given id/name. + +**id** + +The id/name of the output. + +**Returns:** The element entry. + +### .getParameter( name : string ) : ScriptableValueNode + +Returns a parameter for the given name + +**name** + +The name of the parameter. + +**Returns:** The node value. + +### .getValue() : Node + +Returns the value of this node which is the value of the default output. + +**Returns:** The value. + +### .onRefresh() + +Event listener for the `refresh` event. + +### .refresh( output : string ) + +Refreshes the script node. + +**output** + +An optional output. + +Default is `null`. + +### .setLocal( name : string, value : Object ) : Resources + +Sets the reference of a local script variable. + +**name** + +The variable name. + +**value** + +The reference to set. + +**Returns:** The resource map + +### .setOutput( name : string, value : Node ) : ScriptableNode + +Defines a script output for the given name and value. + +**name** + +The name of the output. + +**value** + +The node value. + +**Returns:** A reference to this node. + +### .setParameter( name : string, value : any ) : ScriptableNode + +Sets a value for the given parameter name. + +**name** + +The parameter name. + +**value** + +The parameter value. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/code/ScriptableNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/code/ScriptableNode.js) \ No newline at end of file diff --git a/docs/pages/ScriptableValueNode.html.md b/docs/pages/ScriptableValueNode.html.md new file mode 100644 index 00000000000000..4d000dda1094e7 --- /dev/null +++ b/docs/pages/ScriptableValueNode.html.md @@ -0,0 +1,79 @@ +*Inheritance: EventDispatcher → Node →* + +# ScriptableValueNode + +`ScriptableNode` uses this class to manage script inputs and outputs. + +## Constructor + +### new ScriptableValueNode( value : any ) + +Constructs a new scriptable node. + +**value** + +The value. + +Default is `null`. + +## Properties + +### .events : EventDispatcher + +An event dispatcher for managing events. + +### .inputType : string + +If this node represents an input, this property represents the input type. + +Default is `null`. + +### .isScriptableOutputNode : boolean (readonly) + +Whether this node represents an output or not. + +Default is `true`. + +### .isScriptableValueNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .outputType : string + +If this node represents an output, this property represents the output type. + +Default is `null`. + +### .value : any + +The node's value. + +## Methods + +### .getNodeType( builder : NodeBuilder ) : string + +Overwritten since the node type is inferred from the value. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .getValue() : any + +The `value` property usually represents a node or even binary data in form of array buffers. In this case, this method tries to return the actual value behind the complex type. + +**Returns:** The value. + +### .refresh() + +Dispatches the `refresh` event. + +## Source + +[src/nodes/code/ScriptableValueNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/code/ScriptableValueNode.js) \ No newline at end of file diff --git a/docs/pages/SelectionBox.html.md b/docs/pages/SelectionBox.html.md new file mode 100644 index 00000000000000..5dd38467555f3f --- /dev/null +++ b/docs/pages/SelectionBox.html.md @@ -0,0 +1,94 @@ +# SelectionBox + +This class can be used to select 3D objects in a scene with a selection box. It is recommended to visualize the selected area with the help of [SelectionHelper](SelectionHelper.html). + +## Code Example + +```js +const selectionBox = new SelectionBox( camera, scene ); +const selectedObjects = selectionBox.select( startPoint, endPoint ); +``` + +## Import + +SelectionBox is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SelectionBox } from 'three/addons/interactive/SelectionBox.js'; +``` + +## Constructor + +### new SelectionBox( camera : Camera, scene : Scene, deep : number ) + +Constructs a new selection box. + +**camera** + +The camera the scene is rendered with. + +**scene** + +The scene. + +**deep** + +How deep the selection frustum of perspective cameras should extend. + +Default is `Number.MAX_VALUE`. + +## Properties + +### .batches : Object + +The selected batches of batched meshes. + +### .camera : Camera + +The camera the scene is rendered with. + +### .collection : Array. + +The selected 3D objects. + +### .deep : number + +How deep the selection frustum of perspective cameras should extend. + +Default is `Number.MAX_VALUE`. + +### .endPoint : Vector3 + +The end point of the selection. + +### .instances : Object + +The selected instance IDs of instanced meshes. + +### .scene : Scene + +The camera the scene is rendered with. + +### .startPoint : Vector3 + +The start point of the selection. + +## Methods + +### .select( startPoint : Vector3, endPoint : Vector3 ) : Array. + +This method selects 3D objects in the scene based on the given start and end point. If no parameters are provided, the method uses the start and end values of the respective members. + +**startPoint** + +The start point. + +**endPoint** + +The end point. + +**Returns:** The selected 3D objects. + +## Source + +[examples/jsm/interactive/SelectionBox.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/interactive/SelectionBox.js) \ No newline at end of file diff --git a/docs/pages/SelectionHelper.html.md b/docs/pages/SelectionHelper.html.md new file mode 100644 index 00000000000000..e4ee65d3ab64b1 --- /dev/null +++ b/docs/pages/SelectionHelper.html.md @@ -0,0 +1,59 @@ +# SelectionHelper + +A helper for [SelectionBox](SelectionBox.html). + +It visualizes the current selection box with a `div` container element. + +## Import + +SelectionHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SelectionHelper } from 'three/addons/interactive/SelectionHelper.js'; +``` + +## Constructor + +### new SelectionHelper( renderer : WebGPURenderer | WebGLRenderer, cssClassName : string ) + +Constructs a new selection helper. + +**renderer** + +The renderer. + +**cssClassName** + +The CSS class name of the `div`. + +## Properties + +### .element : HTMLDivElement + +The visualization of the selection box. + +### .enabled : boolean + +Whether helper is enabled or not. + +Default is `true`. + +### .isDown : boolean + +Whether the mouse or pointer is pressed down. + +Default is `false`. + +### .renderer : WebGPURenderer | WebGLRenderer + +A reference to the renderer. + +## Methods + +### .dispose() + +Call this method if you no longer want use to the controls. It frees all internal resources and removes all event listeners. + +## Source + +[examples/jsm/interactive/SelectionHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/interactive/SelectionHelper.js) \ No newline at end of file diff --git a/docs/pages/SetNode.html.md b/docs/pages/SetNode.html.md new file mode 100644 index 00000000000000..9471c57ba430ca --- /dev/null +++ b/docs/pages/SetNode.html.md @@ -0,0 +1,61 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# SetNode + +This module is part of the TSL core and usually not used in app level code. `SetNode` represents a set operation which means it is used to implement any `setXYZW()`, `setRGBA()` and `setSTPQ()` method invocations on node objects. For example: + +## Code Example + +```js +materialLine.colorNode = color( 0, 0, 0 ).setR( float( 1 ) ); +``` + +## Constructor + +### new SetNode( sourceNode : Node, components : string, targetNode : Node ) + +Constructs a new set node. + +**sourceNode** + +The node that should be updated. + +**components** + +The components that should be updated. + +**targetNode** + +The value node. + +## Properties + +### .components : string + +The components that should be updated. + +### .sourceNode : Node + +The node that should be updated. + +### .targetNode : Node + +The value node. + +## Methods + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from [SetNode#sourceNode](SetNode.html#sourceNode). + +**builder** + +The current node builder. + +**Overrides:** [TempNode#getNodeType](TempNode.html#getNodeType) + +**Returns:** The node type. + +## Source + +[src/nodes/utils/SetNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/SetNode.js) \ No newline at end of file diff --git a/docs/pages/ShaderMaterial.html.md b/docs/pages/ShaderMaterial.html.md new file mode 100644 index 00000000000000..24efb18d49aa3c --- /dev/null +++ b/docs/pages/ShaderMaterial.html.md @@ -0,0 +1,223 @@ +*Inheritance: EventDispatcher → Material →* + +# ShaderMaterial + +A material rendered with custom shaders. A shader is a small program written in GLSL. that runs on the GPU. You may want to use a custom shader if you need to implement an effect not included with any of the built-in materials. + +There are the following notes to bear in mind when using a `ShaderMaterial`: + +* `ShaderMaterial` can only be used with [WebGLRenderer](WebGLRenderer.html). +* Built in attributes and uniforms are passed to the shaders along with your code. If you don't want that, use [RawShaderMaterial](RawShaderMaterial.html) instead. +* You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end` in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has to be placed right above the loop. The loop formatting has to correspond to a defined standard. + * The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop). + * The loop variable has to be _i_. + * The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly value of _i_ for the given iteration and can be used in preprocessor statements. + +## Code Example + +```js +const material = new THREE.ShaderMaterial( { + uniforms: { + time: { value: 1.0 }, + resolution: { value: new THREE.Vector2() } + }, + vertexShader: document.getElementById( 'vertexShader' ).textContent, + fragmentShader: document.getElementById( 'fragmentShader' ).textContent +} ); +``` + +## Constructor + +### new ShaderMaterial( parameters : Object ) + +Constructs a new shader material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .clipping : boolean + +Defines whether this material supports clipping; `true` to let the renderer pass the clippingPlanes uniform. + +Default is `false`. + +### .defaultAttributeValues : Object + +When the rendered geometry doesn't include these attributes but the material does, these default values will be passed to the shaders. This avoids errors when buffer data is missing. + +* color: \[ 1, 1, 1 \] +* uv: \[ 0, 0 \] +* uv1: \[ 0, 0 \] + +### .defines : Object + +Defines custom constants using `#define` directives within the GLSL code for both the vertex shader and the fragment shader; each key/value pair yields another directive. + +```js +defines: { + FOO: 15, + BAR: true +} +``` + +Yields the lines: + +```js +#define FOO 15 +#define BAR true +``` + +### .extensions : Object + +This object allows to enable certain WebGL 2 extensions. + +* clipCullDistance: set to `true` to use vertex shader clipping +* multiDraw: set to `true` to use vertex shader multi\_draw / enable gl\_DrawID + +### .fog : boolean + +Defines whether the material color is affected by global fog settings; `true` to pass fog uniforms to the shader. + +Setting this property to `true` requires the definition of fog uniforms. It is recommended to use `UniformsUtils.merge()` to combine the custom shader uniforms with predefined fog uniforms. + +```js +const material = new ShaderMaterial( { + uniforms: UniformsUtils.merge( [ UniformsLib[ 'fog' ], shaderUniforms ] ); + vertexShader: vertexShader, + fragmentShader: fragmentShader, + fog: true +} ); +``` + +Default is `false`. + +### .forceSinglePass : boolean + +Overwritten and set to `true` by default. + +Default is `true`. + +**Overrides:** [Material#forceSinglePass](Material.html#forceSinglePass) + +### .fragmentShader : string + +Fragment shader GLSL code. This is the actual code for the shader. + +### .glslVersion : GLSL1 | GLSL3 + +Defines the GLSL version of custom shader code. + +Default is `null`. + +### .index0AttributeName : string | undefined + +If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation) to bind a generic vertex index to an attribute variable. + +Default is `undefined`. + +### .isShaderMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lights : boolean + +Defines whether this material uses lighting; `true` to pass uniform data related to lighting to this shader. + +Default is `false`. + +### .linewidth : number + +Controls line thickness or lines. + +WebGL and WebGPU ignore this setting and always render line primitives with a width of one pixel. + +Default is `1`. + +### .uniforms : Object + +An object of the form: + +```js +{ + "uniform1": { value: 1.0 }, + "uniform2": { value: 2 } +} +``` + +specifying the uniforms to be passed to the shader code; keys are uniform names, values are definitions of the form + +```js +{ + value: 1.0 +} +``` + +where `value` is the value of the uniform. Names must match the name of the uniform, as defined in the GLSL code. Note that uniforms are refreshed on every frame, so updating the value of the uniform will immediately update the value available to the GLSL code. + +### .uniformsGroups : Array. + +An array holding uniforms groups for configuring UBOs. + +### .uniformsNeedUpdate : boolean + +Can be used to force a uniform update while changing uniforms in [Object3D#onBeforeRender](Object3D.html#onBeforeRender). + +Default is `false`. + +### .vertexShader : string + +Vertex shader GLSL code. This is the actual code for the shader. + +### .wireframe : boolean + +Renders the geometry as a wireframe. + +Default is `false`. + +### .wireframeLinewidth : number + +Controls the thickness of the wireframe. + +WebGL and WebGPU ignore this property and always render 1 pixel wide lines. + +Default is `1`. + +## Type Definitions + +### .Shader + +This type represents the fields required to store and run the shader code. + +**name** +string + +The name of the shader. + +**uniforms** +Object. + +The uniforms of the shader. + +**defines** +Object. + +The defines of the shader. + +**vertexShader** +string + +The vertex shader code. + +**fragmentShader** +string + +The fragment shader code. + +## Source + +[src/materials/ShaderMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/ShaderMaterial.js) \ No newline at end of file diff --git a/docs/pages/ShaderPass.html.md b/docs/pages/ShaderPass.html.md new file mode 100644 index 00000000000000..2cd13d8171340d --- /dev/null +++ b/docs/pages/ShaderPass.html.md @@ -0,0 +1,90 @@ +*Inheritance: Pass →* + +# ShaderPass + +This pass can be used to create a post processing effect with a raw GLSL shader object. Useful for implementing custom effects. + +## Code Example + +```js +const fxaaPass = new ShaderPass( FXAAShader ); +composer.addPass( fxaaPass ); +``` + +## Import + +ShaderPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; +``` + +## Constructor + +### new ShaderPass( shader : Object | ShaderMaterial, textureID : string ) + +Constructs a new shader pass. + +**shader** + +A shader object holding vertex and fragment shader as well as defines and uniforms. It's also valid to pass a custom shader material. + +**textureID** + +The name of the texture uniform that should sample the read buffer. + +Default is `'tDiffuse'`. + +## Properties + +### .material : ShaderMaterial + +The pass material. + +### .textureID : string + +The name of the texture uniform that should sample the read buffer. + +Default is `'tDiffuse'`. + +### .uniforms : Object + +The pass uniforms. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the shader pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/ShaderPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/ShaderPass.js) \ No newline at end of file diff --git a/docs/pages/ShadowBaseNode.html.md b/docs/pages/ShadowBaseNode.html.md new file mode 100644 index 00000000000000..75b7423f4f4c22 --- /dev/null +++ b/docs/pages/ShadowBaseNode.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → Node →* + +# ShadowBaseNode + +Base class for all shadow nodes. + +Shadow nodes encapsulate shadow related logic and are always coupled to lighting nodes. Lighting nodes might share the same shadow node type or use specific ones depending on their requirements. + +## Constructor + +### new ShadowBaseNode( light : Light ) + +Constructs a new shadow base node. + +**light** + +The shadow casting light. + +## Properties + +### .isShadowBaseNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .light : Light + +The shadow casting light. + +### .updateBeforeType : string + +Overwritten since shadows are updated by default per render. + +Default is `'render'`. + +**Overrides:** [Node#updateBeforeType](Node.html#updateBeforeType) + +## Methods + +### .setupShadowPosition( object : NodeBuilder ) + +Setups the shadow position node which is by default the predefined TSL node object `shadowPositionWorld`. + +**object** + +A configuration object that must at least hold a material reference. + +## Source + +[src/nodes/lighting/ShadowBaseNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/ShadowBaseNode.js) \ No newline at end of file diff --git a/docs/pages/ShadowMapViewer.html.md b/docs/pages/ShadowMapViewer.html.md new file mode 100644 index 00000000000000..56dd2cdd0f613b --- /dev/null +++ b/docs/pages/ShadowMapViewer.html.md @@ -0,0 +1,76 @@ +# ShadowMapViewer + +This is a helper for visualising a given light's shadow map. It works for shadow casting lights: DirectionalLight and SpotLight. It renders out the shadow map and displays it on a HUD. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import the class from `ShadowMapViewerGPU.js`. + +## Code Example + +```js +const lightShadowMapViewer = new ShadowMapViewer( light ); +lightShadowMapViewer.position.x = 10; +lightShadowMapViewer.position.y = SCREEN_HEIGHT - ( SHADOW_MAP_HEIGHT / 4 ) - 10; +lightShadowMapViewer.size.width = SHADOW_MAP_WIDTH / 4; +lightShadowMapViewer.size.height = SHADOW_MAP_HEIGHT / 4; +lightShadowMapViewer.update(); +``` + +## Import + +ShadowMapViewer is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewer.js'; +``` + +## Constructor + +### new ShadowMapViewer( light : Light ) + +Constructs a new shadow map viewer. + +**light** + +The shadow casting light. + +## Properties + +### .enabled : boolean + +Whether to display the shadow map viewer or not. + +Default is `true`. + +### .position : Object + +The position of the viewer. When changing this property, make sure to call [ShadowMapViewer#update](ShadowMapViewer.html#update). + +Default is `true`. + +### .size : Object + +The size of the viewer. When changing this property, make sure to call [ShadowMapViewer#update](ShadowMapViewer.html#update). + +Default is `true`. + +## Methods + +### .render( renderer : WebGLRenderer ) + +Renders the viewer. This method must be called in the app's animation loop. + +**renderer** + +The renderer. + +### .update() + +Updates the viewer. + +### .updateForWindowResize() + +Resizes the viewer. This method should be called whenever the app's window is resized. + +## Source + +[examples/jsm/utils/ShadowMapViewer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/ShadowMapViewer.js) \ No newline at end of file diff --git a/docs/pages/ShadowMaskModel.html.md b/docs/pages/ShadowMaskModel.html.md new file mode 100644 index 00000000000000..66ce2f4db2f776 --- /dev/null +++ b/docs/pages/ShadowMaskModel.html.md @@ -0,0 +1,43 @@ +*Inheritance: LightingModel →* + +# ShadowMaskModel + +Represents lighting model for a shadow material. Used in [ShadowNodeMaterial](ShadowNodeMaterial.html). + +## Constructor + +### new ShadowMaskModel() + +Constructs a new shadow mask model. + +## Properties + +### .shadowNode : Node + +The shadow mask node. + +## Methods + +### .direct( input : Object ) + +Only used to save the shadow mask. + +**input** + +The input data. + +**Overrides:** [LightingModel#direct](LightingModel.html#direct) + +### .finish( builder : NodeBuilder ) + +Uses the shadow mask to produce the final color. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#finish](LightingModel.html#finish) + +## Source + +[src/nodes/functions/ShadowMaskModel.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/functions/ShadowMaskModel.js) \ No newline at end of file diff --git a/docs/pages/ShadowMaterial.html.md b/docs/pages/ShadowMaterial.html.md new file mode 100644 index 00000000000000..f2d1c60284296d --- /dev/null +++ b/docs/pages/ShadowMaterial.html.md @@ -0,0 +1,60 @@ +*Inheritance: EventDispatcher → Material →* + +# ShadowMaterial + +This material can receive shadows, but otherwise is completely transparent. + +## Code Example + +```js +const geometry = new THREE.PlaneGeometry( 2000, 2000 ); +geometry.rotateX( - Math.PI / 2 ); +const material = new THREE.ShadowMaterial(); +material.opacity = 0.2; +const plane = new THREE.Mesh( geometry, material ); +plane.position.y = -200; +plane.receiveShadow = true; +scene.add( plane ); +``` + +## Constructor + +### new ShadowMaterial( parameters : Object ) + +Constructs a new shadow material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .color : Color + +Color of the material. + +Default is `(0,0,0)`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isShadowMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .transparent : boolean + +Overwritten since shadow materials are transparent by default. + +Default is `true`. + +**Overrides:** [Material#transparent](Material.html#transparent) + +## Source + +[src/materials/ShadowMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/ShadowMaterial.js) \ No newline at end of file diff --git a/docs/pages/ShadowMesh.html.md b/docs/pages/ShadowMesh.html.md new file mode 100644 index 00000000000000..4866c527da2603 --- /dev/null +++ b/docs/pages/ShadowMesh.html.md @@ -0,0 +1,79 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# ShadowMesh + +A Shadow Mesh that follows a shadow-casting mesh in the scene, but is confined to a single plane. This technique can be used as a very performant alternative to classic shadow mapping. However, it has serious limitations like: + +* Shadows can only be casted on flat planes. +* No soft shadows support. + +## Code Example + +```js +const cubeShadow = new ShadowMesh( cube ); +scene.add( cubeShadow ); +``` + +## Import + +ShadowMesh is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ShadowMesh } from 'three/addons/objects/ShadowMesh.js'; +``` + +## Constructor + +### new ShadowMesh( mesh : Mesh ) + +Constructs a new shadow mesh. + +**mesh** + +The shadow-casting reference mesh. + +## Properties + +### .frustumCulled : boolean + +Overwritten to disable view-frustum culling by default. + +Default is `false`. + +**Overrides:** [Mesh#frustumCulled](Mesh.html#frustumCulled) + +### .isShadowMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .matrixAutoUpdate : boolean + +Overwritten to disable automatic matrix update. The local matrix is computed manually in [ShadowMesh#update](ShadowMesh.html#update). + +Default is `false`. + +**Overrides:** [Mesh#matrixAutoUpdate](Mesh.html#matrixAutoUpdate) + +### .meshMatrix : Matrix4 + +Represent the world matrix of the reference mesh. + +## Methods + +### .update( plane : Plane, lightPosition4D : Vector4 ) + +Updates the shadow mesh so it follows its shadow-casting reference mesh. + +**plane** + +The plane onto the shadow mesh is projected. + +**lightPosition4D** + +The light position. + +## Source + +[examples/jsm/objects/ShadowMesh.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/ShadowMesh.js) \ No newline at end of file diff --git a/docs/pages/ShadowNode.html.md b/docs/pages/ShadowNode.html.md new file mode 100644 index 00000000000000..a2bec47902e195 --- /dev/null +++ b/docs/pages/ShadowNode.html.md @@ -0,0 +1,193 @@ +*Inheritance: EventDispatcher → Node → ShadowBaseNode →* + +# ShadowNode + +Represents the default shadow implementation for lighting nodes. + +## Constructor + +### new ShadowNode( light : Light, shadow : LightShadow ) + +Constructs a new shadow node. + +**light** + +The shadow casting light. + +**shadow** + +An optional light shadow. + +Default is `null`. + +## Properties + +### .depthLayer : number (readonly) + +This index can be used when overriding setupRenderTarget with a RenderTarget Array to specify the depth layer. + +Default is `true`. + +### .isShadowNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .shadow : LightShadow + +The light shadow which defines the properties light's shadow. + +Default is `null`. + +### .shadowMap : RenderTarget + +A reference to the shadow map which is a render target. + +Default is `null`. + +### .vsmMaterialHorizontal : NodeMaterial + +Only relevant for VSM shadows. Node material which is used to render the second VSM pass. + +Default is `null`. + +### .vsmMaterialVertical : NodeMaterial + +Only relevant for VSM shadows. Node material which is used to render the first VSM pass. + +Default is `null`. + +### .vsmShadowMapHorizontal : RenderTarget + +Only relevant for VSM shadows. Render target for the second VSM render pass. + +Default is `null`. + +### .vsmShadowMapVertical : RenderTarget + +Only relevant for VSM shadows. Render target for the first VSM render pass. + +Default is `null`. + +## Methods + +### .dispose() + +Frees the internal resources of this shadow node. + +**Overrides:** [ShadowBaseNode#dispose](ShadowBaseNode.html#dispose) + +### .getShadowFilterFn( type : number ) : function + +Returns the shadow filtering function for the given shadow type. + +**type** + +The shadow type. + +**Returns:** The filtering function. + +### .renderShadow( frame : NodeFrame ) + +Renders the shadow. The logic of this function could be included into [ShadowNode#updateShadow](ShadowNode.html#updateShadow) however more specialized shadow nodes might require a custom shadow map rendering. By having a dedicated method, it's easier to overwrite the default behavior. + +**frame** + +A reference to the current node frame. + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +The implementation performs the setup of the output node. An output is only produces if shadow mapping is globally enabled in the renderer. + +**builder** + +A reference to the current node builder. + +**Overrides:** [ShadowBaseNode#setup](ShadowBaseNode.html#setup) + +**Returns:** The output node. + +### .setupShadow( builder : NodeBuilder ) : Node. + +Setups the shadow output node. + +**builder** + +A reference to the current node builder. + +**Returns:** The shadow output node. + +### .setupShadowCoord( builder : NodeBuilder, shadowPosition : Node. ) : Node. + +Setups the shadow coordinates. + +**builder** + +A reference to the current node builder. + +**shadowPosition** + +A node representing the shadow position. + +**Returns:** The shadow coordinates. + +### .setupShadowFilter( builder : NodeBuilder, inputs : Object ) : Node. + +Setups the shadow filtering. + +**builder** + +A reference to the current node builder. + +**inputs** + +A configuration object that defines the shadow filtering. + +**filterFn** + +This function defines the filtering type of the shadow map e.g. PCF. + +**depthTexture** + +A reference to the shadow map's texture data. + +**shadowCoord** + +Shadow coordinates which are used to sample from the shadow map. + +**shadow** + +The light shadow. + +**Returns:** The result node of the shadow filtering. + +### .updateBefore( frame : NodeFrame ) + +The implementation performs the update of the shadow map if necessary. + +**frame** + +A reference to the current node frame. + +**Overrides:** [ShadowBaseNode#updateBefore](ShadowBaseNode.html#updateBefore) + +### .updateShadow( frame : NodeFrame ) + +Updates the shadow. + +**frame** + +A reference to the current node frame. + +### .vsmPass( renderer : Renderer ) + +For VSM additional render passes are required. + +**renderer** + +A reference to the current renderer. + +## Source + +[src/nodes/lighting/ShadowNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/ShadowNode.js) \ No newline at end of file diff --git a/docs/pages/ShadowNodeMaterial.html.md b/docs/pages/ShadowNodeMaterial.html.md new file mode 100644 index 00000000000000..6280873595823d --- /dev/null +++ b/docs/pages/ShadowNodeMaterial.html.md @@ -0,0 +1,53 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# ShadowNodeMaterial + +Node material version of [ShadowMaterial](ShadowMaterial.html). + +## Constructor + +### new ShadowNodeMaterial( parameters : Object ) + +Constructs a new shadow node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isShadowNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .lights : boolean + +Set to `true` because so it's possible to implement the shadow mask effect. + +Default is `true`. + +**Overrides:** [NodeMaterial#lights](NodeMaterial.html#lights) + +### .transparent : boolean + +Overwritten since shadow materials are transparent by default. + +Default is `true`. + +**Overrides:** [NodeMaterial#transparent](NodeMaterial.html#transparent) + +## Methods + +### .setupLightingModel() : ShadowMaskModel + +Setups the lighting model. + +**Overrides:** [NodeMaterial#setupLightingModel](NodeMaterial.html#setupLightingModel) + +**Returns:** The lighting model. + +## Source + +[src/materials/nodes/ShadowNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/ShadowNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/Shape.html.md b/docs/pages/Shape.html.md new file mode 100644 index 00000000000000..3154d5bb66fb00 --- /dev/null +++ b/docs/pages/Shape.html.md @@ -0,0 +1,74 @@ +*Inheritance: Curve → CurvePath → Path →* + +# Shape + +Defines an arbitrary 2d shape plane using paths with optional holes. It can be used with [ExtrudeGeometry](ExtrudeGeometry.html), [ShapeGeometry](ShapeGeometry.html), to get points, or to get triangulated faces. + +## Code Example + +```js +const heartShape = new THREE.Shape(); +heartShape.moveTo( 25, 25 ); +heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 ); +heartShape.bezierCurveTo( - 30, 0, - 30, 35, - 30, 35 ); +heartShape.bezierCurveTo( - 30, 55, - 10, 77, 25, 95 ); +heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 ); +heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 ); +heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 ); +const extrudeSettings = { + depth: 8, + bevelEnabled: true, + bevelSegments: 2, + steps: 2, + bevelSize: 1, + bevelThickness: 1 +}; +const geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings ); +const mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial() ); +``` + +## Constructor + +### new Shape( points : Array. ) + +Constructs a new shape. + +**points** + +An array of 2D points defining the shape. + +## Properties + +### .holes : Array. (readonly) + +Defines the holes in the shape. Hole definitions must use the opposite winding order (CW/CCW) than the outer shape. + +### .uuid : string (readonly) + +The UUID of the shape. + +## Methods + +### .extractPoints( divisions : number ) : Object + +Returns an object that holds contour data for the shape and its holes as arrays of 2D points. + +**divisions** + +The fineness of the result. + +**Returns:** An object with contour data. + +### .getPointsHoles( divisions : number ) : Array.> + +Returns an array representing each contour of the holes as a list of 2D points. + +**divisions** + +The fineness of the result. + +**Returns:** The holes as a series of 2D points. + +## Source + +[src/extras/core/Shape.js](https://github.com/mrdoob/three.js/blob/master/src/extras/core/Shape.js) \ No newline at end of file diff --git a/docs/pages/ShapeGeometry.html.md b/docs/pages/ShapeGeometry.html.md new file mode 100644 index 00000000000000..26ddcf0cd36c4c --- /dev/null +++ b/docs/pages/ShapeGeometry.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# ShapeGeometry + +Creates an one-sided polygonal geometry from one or more path shapes. + +## Code Example + +```js +const arcShape = new THREE.Shape() + .moveTo( 5, 1 ) + .absarc( 1, 1, 4, 0, Math.PI * 2, false ); +const geometry = new THREE.ShapeGeometry( arcShape ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00, side: THREE.DoubleSide } ); +const mesh = new THREE.Mesh( geometry, material ) ; +scene.add( mesh ); +``` + +## Constructor + +### new ShapeGeometry( shapes : Shape | Array., curveSegments : number ) + +Constructs a new shape geometry. + +**shapes** + +A shape or an array of shapes. + +**curveSegments** + +Number of segments per shape. + +Default is `12`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object, shapes : Array. ) : ShapeGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**shapes** + +An array of shapes. + +**Returns:** A new instance. + +## Source + +[src/geometries/ShapeGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/ShapeGeometry.js) \ No newline at end of file diff --git a/docs/pages/ShapePath.html.md b/docs/pages/ShapePath.html.md new file mode 100644 index 00000000000000..27f0fca9cf6b1a --- /dev/null +++ b/docs/pages/ShapePath.html.md @@ -0,0 +1,133 @@ +# ShapePath + +This class is used to convert a series of paths to an array of shapes. It is specifically used in context of fonts and SVG. + +## Constructor + +### new ShapePath() + +Constructs a new shape path. + +## Properties + +### .color : Color + +The color of the shape. + +### .currentPath : Path + +The current path that is being generated. + +Default is `null`. + +### .subPaths : Array. + +The paths that have been generated for this shape. + +Default is `null`. + +## Methods + +### .bezierCurveTo( aCP1x : number, aCP1y : number, aCP2x : number, aCP2y : number, aX : number, aY : number ) : ShapePath + +Adds an instance of [CubicBezierCurve](CubicBezierCurve.html) to the path by connecting the current point with the given one. + +**aCP1x** + +The x coordinate of the first control point. + +**aCP1y** + +The y coordinate of the first control point. + +**aCP2x** + +The x coordinate of the second control point. + +**aCP2y** + +The y coordinate of the second control point. + +**aX** + +The x coordinate of the end point. + +**aY** + +The y coordinate of the end point. + +**Returns:** A reference to this shape path. + +### .lineTo( x : number, y : number ) : ShapePath + +Adds an instance of [LineCurve](LineCurve.html) to the path by connecting the current point with the given one. + +**x** + +The x coordinate of the end point. + +**y** + +The y coordinate of the end point. + +**Returns:** A reference to this shape path. + +### .moveTo( x : number, y : number ) : ShapePath + +Creates a new path and moves it current point to the given one. + +**x** + +The x coordinate. + +**y** + +The y coordinate. + +**Returns:** A reference to this shape path. + +### .quadraticCurveTo( aCPx : number, aCPy : number, aX : number, aY : number ) : ShapePath + +Adds an instance of [QuadraticBezierCurve](QuadraticBezierCurve.html) to the path by connecting the current point with the given one. + +**aCPx** + +The x coordinate of the control point. + +**aCPy** + +The y coordinate of the control point. + +**aX** + +The x coordinate of the end point. + +**aY** + +The y coordinate of the end point. + +**Returns:** A reference to this shape path. + +### .splineThru( pts : Array. ) : ShapePath + +Adds an instance of [SplineCurve](SplineCurve.html) to the path by connecting the current point with the given list of points. + +**pts** + +An array of points in 2D space. + +**Returns:** A reference to this shape path. + +### .toShapes( isCCW : boolean ) : Array. + +Converts the paths into an array of shapes. + +**isCCW** + +By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW). If this flag is set to `true`, then those are flipped. + +**Returns:** An array of shapes. + +## Source + +[src/extras/core/ShapePath.js](https://github.com/mrdoob/three.js/blob/master/src/extras/core/ShapePath.js) \ No newline at end of file diff --git a/docs/pages/ShapeUtils.html.md b/docs/pages/ShapeUtils.html.md new file mode 100644 index 00000000000000..3b0b67d84f0881 --- /dev/null +++ b/docs/pages/ShapeUtils.html.md @@ -0,0 +1,43 @@ +# ShapeUtils + +A class containing utility functions for shapes. + +## Static Methods + +### .area( contour : Array. ) : number + +Calculate area of a ( 2D ) contour polygon. + +**contour** + +An array of 2D points. + +**Returns:** The area. + +### .isClockWise( pts : Array. ) : boolean + +Returns `true` if the given contour uses a clockwise winding order. + +**pts** + +An array of 2D points defining a polygon. + +**Returns:** Whether the given contour uses a clockwise winding order or not. + +### .triangulateShape( contour : Array., holes : Array.> ) : Array.> + +Triangulates the given shape definition. + +**contour** + +An array of 2D points defining the contour. + +**holes** + +An array that holds arrays of 2D points defining the holes. + +**Returns:** An array that holds for each face definition an array with three indices. + +## Source + +[src/extras/ShapeUtils.js](https://github.com/mrdoob/three.js/blob/master/src/extras/ShapeUtils.js) \ No newline at end of file diff --git a/docs/pages/SimplexNoise.html.md b/docs/pages/SimplexNoise.html.md new file mode 100644 index 00000000000000..812737683d073e --- /dev/null +++ b/docs/pages/SimplexNoise.html.md @@ -0,0 +1,85 @@ +# SimplexNoise + +A utility class providing noise functions. + +The code is based on [Simplex noise demystified](https://web.archive.org/web/20210210162332/http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf) by Stefan Gustavson, 2005. + +## Import + +SimplexNoise is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SimplexNoise } from 'three/addons/math/SimplexNoise.js'; +``` + +## Constructor + +### new SimplexNoise( r : Object ) + +Constructs a new simplex noise object. + +**r** + +A math utility class that holds a `random()` method. This makes it possible to pass in custom random number generator. + +Default is `Math`. + +## Methods + +### .noise( xin : number, yin : number ) : number + +A 2D simplex noise method. + +**xin** + +The x coordinate. + +**yin** + +The y coordinate. + +**Returns:** The noise value. + +### .noise3d( xin : number, yin : number, zin : number ) : number + +A 3D simplex noise method. + +**xin** + +The x coordinate. + +**yin** + +The y coordinate. + +**zin** + +The z coordinate. + +**Returns:** The noise value. + +### .noise4d( x : number, y : number, z : number, w : number ) : number + +A 4D simplex noise method. + +**x** + +The x coordinate. + +**y** + +The y coordinate. + +**z** + +The z coordinate. + +**w** + +The w coordinate. + +**Returns:** The noise value. + +## Source + +[examples/jsm/math/SimplexNoise.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/SimplexNoise.js) \ No newline at end of file diff --git a/docs/pages/SimplifyModifier.html.md b/docs/pages/SimplifyModifier.html.md new file mode 100644 index 00000000000000..8e4780342a5973 --- /dev/null +++ b/docs/pages/SimplifyModifier.html.md @@ -0,0 +1,44 @@ +# SimplifyModifier + +This class can be used to modify a geometry by simplifying it. A typical use case for such a modifier is automatic LOD generation. + +The implementation is based on [Progressive Mesh type Polygon Reduction Algorithm](https://web.archive.org/web/20230610044040/http://www.melax.com/polychop/) by Stan Melax in 1998. + +## Code Example + +```js +const modifier = new SimplifyModifier(); +geometry = modifier.modify( geometry ); +``` + +## Import + +SimplifyModifier is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SimplifyModifier } from 'three/addons/modifiers/SimplifyModifier.js'; +``` + +## Constructor + +### new SimplifyModifier() + +## Methods + +### .modify( geometry : BufferGeometry, count : number ) : BufferGeometry + +Returns a new, modified version of the given geometry by applying a simplification. Please note that the resulting geometry is always non-indexed. + +**geometry** + +The geometry to modify. + +**count** + +The number of vertices to remove. + +**Returns:** A new, modified geometry. + +## Source + +[examples/jsm/modifiers/SimplifyModifier.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/modifiers/SimplifyModifier.js) \ No newline at end of file diff --git a/docs/pages/Skeleton.html.md b/docs/pages/Skeleton.html.md new file mode 100644 index 00000000000000..e973b2ee7a431b --- /dev/null +++ b/docs/pages/Skeleton.html.md @@ -0,0 +1,133 @@ +# Skeleton + +Class for representing the armatures in `three.js`. The skeleton is defined by a hierarchy of bones. + +## Code Example + +```js +const bones = []; +const shoulder = new THREE.Bone(); +const elbow = new THREE.Bone(); +const hand = new THREE.Bone(); +shoulder.add( elbow ); +elbow.add( hand ); +bones.push( shoulder , elbow, hand); +shoulder.position.y = -5; +elbow.position.y = 0; +hand.position.y = 5; +const armSkeleton = new THREE.Skeleton( bones ); +``` + +## Constructor + +### new Skeleton( bones : Array., boneInverses : Array. ) + +Constructs a new skeleton. + +**bones** + +An array of bones. + +**boneInverses** + +An array of bone inverse matrices. If not provided, these matrices will be computed automatically via [Skeleton#calculateInverses](Skeleton.html#calculateInverses). + +## Properties + +### .boneInverses : Array. + +An array of bone inverse matrices. + +### .boneMatrices : Float32Array + +An array buffer holding the bone data. Input data for [Skeleton#boneTexture](Skeleton.html#boneTexture). + +Default is `null`. + +### .boneTexture : DataTexture + +A texture holding the bone data for use in the vertex shader. + +Default is `null`. + +### .bones : Array. + +An array of bones defining the skeleton. + +### .previousBoneMatrices : Float32Array + +An array buffer holding the bone data of the previous frame. Required for computing velocity. Maintained in [SkinningNode](SkinningNode.html). + +Default is `null`. + +## Methods + +### .calculateInverses() + +Computes the bone inverse matrices. This method resets [Skeleton#boneInverses](Skeleton.html#boneInverses) and fills it with new matrices. + +### .clone() : Skeleton + +Returns a new skeleton with copied values from this instance. + +**Returns:** A clone of this instance. + +### .computeBoneTexture() : Skeleton + +Computes a data texture for passing bone data to the vertex shader. + +**Returns:** A reference of this instance. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .fromJSON( json : Object, bones : Object. ) : Skeleton + +Setups the skeleton by the given JSON and bones. + +**json** + +The skeleton as serialized JSON. + +**bones** + +An array of bones. + +**Returns:** A reference of this instance. + +### .getBoneByName( name : string ) : Bone | undefined + +Searches through the skeleton's bone array and returns the first with a matching name. + +**name** + +The name of the bone. + +**Returns:** The found bone. `undefined` if no bone has been found. + +### .init() + +Initializes the skeleton. This method gets automatically called by the constructor but depending on how the skeleton is created it might be necessary to call this method manually. + +### .pose() + +Resets the skeleton to the base pose. + +### .toJSON() : Object + +Serializes the skeleton into JSON. + +See: + +* [ObjectLoader#parse](ObjectLoader.html#parse) + +**Returns:** A JSON object representing the serialized skeleton. + +### .update() + +Resets the skeleton to the base pose. + +## Source + +[src/objects/Skeleton.js](https://github.com/mrdoob/three.js/blob/master/src/objects/Skeleton.js) \ No newline at end of file diff --git a/docs/pages/SkeletonHelper.html.md b/docs/pages/SkeletonHelper.html.md new file mode 100644 index 00000000000000..08651247d7066f --- /dev/null +++ b/docs/pages/SkeletonHelper.html.md @@ -0,0 +1,62 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# SkeletonHelper + +A helper object to assist with visualizing a [Skeleton](Skeleton.html). + +## Code Example + +```js +const helper = new THREE.SkeletonHelper( skinnedMesh ); +scene.add( helper ); +``` + +## Constructor + +### new SkeletonHelper( object : Object3D ) + +Constructs a new skeleton helper. + +**object** + +Usually an instance of [SkinnedMesh](SkinnedMesh.html). However, any 3D object can be used if it represents a hierarchy of bones (see [Bone](Bone.html)). + +## Properties + +### .bones : Array. + +The list of bones that the helper visualizes. + +### .isSkeletonHelper : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .root : Object3D + +The object being visualized. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .setColors( color1 : Color, color2 : Color ) : SkeletonHelper + +Defines the colors of the helper. + +**color1** + +The first line color for each bone. + +**color2** + +The second line color for each bone. + +**Returns:** A reference to this helper. + +## Source + +[src/helpers/SkeletonHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/SkeletonHelper.js) \ No newline at end of file diff --git a/docs/pages/SkinnedMesh.html.md b/docs/pages/SkinnedMesh.html.md new file mode 100644 index 00000000000000..56c09163e6965e --- /dev/null +++ b/docs/pages/SkinnedMesh.html.md @@ -0,0 +1,105 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# SkinnedMesh + +A mesh that has a [Skeleton](Skeleton.html) that can then be used to animate the vertices of the geometry with skinning/skeleton animation. + +Next to a valid skeleton, the skinned mesh requires skin indices and weights as buffer attributes in its geometry. These attribute define which bones affect a single vertex to a certain extend. + +Typically skinned meshes are not created manually but loaders like [GLTFLoader](GLTFLoader.html) or [FBXLoader](FBXLoader.html) import respective models. + +## Constructor + +### new SkinnedMesh( geometry : BufferGeometry, material : Material | Array. ) + +Constructs a new skinned mesh. + +**geometry** + +The mesh geometry. + +**material** + +The mesh material. + +## Properties + +### .bindMatrix : Matrix4 + +The base matrix that is used for the bound bone transforms. + +### .bindMatrixInverse : Matrix4 + +The base matrix that is used for resetting the bound bone transforms. + +### .bindMode : AttachedBindMode | DetachedBindMode + +`AttachedBindMode` means the skinned mesh shares the same world space as the skeleton. This is not true when using `DetachedBindMode` which is useful when sharing a skeleton across multiple skinned meshes. + +Default is `AttachedBindMode`. + +### .boundingBox : Box3 + +The bounding box of the skinned mesh. Can be computed via [SkinnedMesh#computeBoundingBox](SkinnedMesh.html#computeBoundingBox). + +Default is `null`. + +### .boundingSphere : Sphere + +The bounding sphere of the skinned mesh. Can be computed via [SkinnedMesh#computeBoundingSphere](SkinnedMesh.html#computeBoundingSphere). + +Default is `null`. + +### .isSkinnedMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .applyBoneTransform( index : number, target : Vector3 ) : Vector3 + +Applies the bone transform associated with the given index to the given vertex position. Returns the updated vector. + +**index** + +The vertex index. + +**target** + +The target object that is used to store the method's result. the skinned mesh's world matrix will be used instead. + +**Returns:** The updated vertex position. + +### .bind( skeleton : Skeleton, bindMatrix : Matrix4 ) + +Binds the given skeleton to the skinned mesh. + +**skeleton** + +The skeleton to bind. + +**bindMatrix** + +The bind matrix. If no bind matrix is provided, the skinned mesh's world matrix will be used instead. + +### .computeBoundingBox() + +Computes the bounding box of the skinned mesh, and updates [SkinnedMesh#boundingBox](SkinnedMesh.html#boundingBox). The bounding box is not automatically computed by the engine; this method must be called by your app. If the skinned mesh is animated, the bounding box should be recomputed per frame in order to reflect the current animation state. + +### .computeBoundingSphere() + +Computes the bounding sphere of the skinned mesh, and updates [SkinnedMesh#boundingSphere](SkinnedMesh.html#boundingSphere). The bounding sphere is automatically computed by the engine once when it is needed, e.g., for ray casting and view frustum culling. If the skinned mesh is animated, the bounding sphere should be recomputed per frame in order to reflect the current animation state. + +### .normalizeSkinWeights() + +Normalizes the skin weights which are defined as a buffer attribute in the skinned mesh's geometry. + +### .pose() + +This method sets the skinned mesh in the rest pose). + +## Source + +[src/objects/SkinnedMesh.js](https://github.com/mrdoob/three.js/blob/master/src/objects/SkinnedMesh.js) \ No newline at end of file diff --git a/docs/pages/SkinningNode.html.md b/docs/pages/SkinningNode.html.md new file mode 100644 index 00000000000000..5e726ce5b03cee --- /dev/null +++ b/docs/pages/SkinningNode.html.md @@ -0,0 +1,151 @@ +*Inheritance: EventDispatcher → Node →* + +# SkinningNode + +This node implements the vertex transformation shader logic which is required for skinning/skeletal animation. + +## Constructor + +### new SkinningNode( skinnedMesh : SkinnedMesh ) + +Constructs a new skinning node. + +**skinnedMesh** + +The skinned mesh. + +## Properties + +### .bindMatrixInverseNode : Node. + +The bind matrix inverse node. + +### .bindMatrixNode : Node. + +The bind matrix node. + +### .boneMatricesNode : Node + +The bind matrices as a uniform buffer node. + +### .positionNode : Node. + +The current vertex position in local space. + +### .previousBoneMatricesNode : Node + +The previous bind matrices as a uniform buffer node. Required for computing motion vectors. + +Default is `null`. + +### .skinIndexNode : AttributeNode + +The skin index attribute. + +### .skinWeightNode : AttributeNode + +The skin weight attribute. + +### .skinnedMesh : SkinnedMesh + +The skinned mesh. + +### .toPositionNode : Node. + +The result of vertex position in local space. + +### .updateType : string + +The update type overwritten since skinning nodes are updated per object. + +**Overrides:** [Node#updateType](Node.html#updateType) + +## Methods + +### .generate( builder : NodeBuilder, output : string ) : string + +Generates the code snippet of the skinning node. + +**builder** + +The current node builder. + +**output** + +The current output. + +**Overrides:** [Node#generate](Node.html#generate) + +**Returns:** The generated code snippet. + +### .getPreviousSkinnedPosition( builder : NodeBuilder ) : Node. + +Computes the transformed/skinned vertex position of the previous frame. + +**builder** + +The current node builder. + +**Returns:** The skinned position from the previous frame. + +### .getSkinnedNormal( boneMatrices : Node, normal : Node. ) : Node. + +Transforms the given vertex normal via skinning. + +**boneMatrices** + +The bone matrices + +Default is `this.boneMatricesNode`. + +**normal** + +The vertex normal in local space. + +Default is `normalLocal`. + +**Returns:** The transformed vertex normal. + +### .getSkinnedPosition( boneMatrices : Node, position : Node. ) : Node. + +Transforms the given vertex position via skinning. + +**boneMatrices** + +The bone matrices + +Default is `this.boneMatricesNode`. + +**position** + +The vertex position in local space. + +Default is `this.positionNode`. + +**Returns:** The transformed vertex position. + +### .setup( builder : NodeBuilder ) : Node. + +Setups the skinning node by assigning the transformed vertex data to predefined node variables. + +**builder** + +The current node builder. + +**Overrides:** [Node#setup](Node.html#setup) + +**Returns:** The transformed vertex position. + +### .update( frame : NodeFrame ) + +Updates the state of the skinned mesh by updating the skeleton once per frame. + +**frame** + +The current node frame. + +**Overrides:** [Node#update](Node.html#update) + +## Source + +[src/nodes/accessors/SkinningNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/SkinningNode.js) \ No newline at end of file diff --git a/docs/pages/Sky.html.md b/docs/pages/Sky.html.md new file mode 100644 index 00000000000000..0c6aca59b63707 --- /dev/null +++ b/docs/pages/Sky.html.md @@ -0,0 +1,46 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# Sky + +Represents a skydome for scene backgrounds. Based on [A Practical Analytic Model for Daylight](https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight) aka The Preetham Model, the de facto standard for analytical skydomes. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [SkyMesh](SkyMesh.html). + +More references: + +* [http://simonwallner.at/project/atmospheric-scattering/](http://simonwallner.at/project/atmospheric-scattering/) +* [http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR](http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR) + +## Code Example + +```js +const sky = new Sky(); +sky.scale.setScalar( 10000 ); +scene.add( sky ); +``` + +## Import + +Sky is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Sky } from 'three/addons/objects/Sky.js'; +``` + +## Constructor + +### new Sky() + +Constructs a new skydome. + +## Properties + +### .isSky : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[examples/jsm/objects/Sky.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Sky.js) \ No newline at end of file diff --git a/docs/pages/SkyGeometry.html.md b/docs/pages/SkyGeometry.html.md new file mode 100644 index 00000000000000..75f4207d70db39 --- /dev/null +++ b/docs/pages/SkyGeometry.html.md @@ -0,0 +1,23 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# SkyGeometry + +A procedural sky geometry. + +## Import + +SkyGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SkyGeometry } from 'three/addons/misc/RollerCoaster.js'; +``` + +## Constructor + +### new SkyGeometry() + +Constructs a new geometry. + +## Source + +[examples/jsm/misc/RollerCoaster.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/RollerCoaster.js) \ No newline at end of file diff --git a/docs/pages/SkyMesh.html.md b/docs/pages/SkyMesh.html.md new file mode 100644 index 00000000000000..c87c25f7be7cad --- /dev/null +++ b/docs/pages/SkyMesh.html.md @@ -0,0 +1,78 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# SkyMesh + +Represents a skydome for scene backgrounds. Based on [A Practical Analytic Model for Daylight](https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight) aka The Preetham Model, the de facto standard for analytical skydomes. + +Note that this class can only be used with [WebGPURenderer](WebGPURenderer.html). When using [WebGLRenderer](WebGLRenderer.html), use [Sky](Sky.html). + +More references: + +* [http://simonwallner.at/project/atmospheric-scattering/](http://simonwallner.at/project/atmospheric-scattering/) +* [http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR](http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR) + +## Code Example + +```js +const sky = new SkyMesh(); +sky.scale.setScalar( 10000 ); +scene.add( sky ); +``` + +## Import + +SkyMesh is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; +``` + +## Constructor + +### new SkyMesh() + +Constructs a new skydome. + +## Properties + +### .isSky : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +**Deprecated:** Use isSkyMesh instead. + +### .isSkyMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .mieCoefficient : UniformNode. + +The mieCoefficient uniform. + +### .mieDirectionalG : UniformNode. + +The mieDirectionalG uniform. + +### .rayleigh : UniformNode. + +The rayleigh uniform. + +### .sunPosition : UniformNode. + +The sun position uniform. + +### .turbidity : UniformNode. + +The turbidity uniform. + +### .upUniform : UniformNode. + +The up position. + +## Source + +[examples/jsm/objects/SkyMesh.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/SkyMesh.js) \ No newline at end of file diff --git a/docs/pages/SobelOperatorNode.html.md b/docs/pages/SobelOperatorNode.html.md new file mode 100644 index 00000000000000..cdf50179d66a25 --- /dev/null +++ b/docs/pages/SobelOperatorNode.html.md @@ -0,0 +1,63 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# SobelOperatorNode + +Post processing node for detecting edges with a sobel filter. A sobel filter should be applied after tone mapping and output color space conversion. + +## Import + +SobelOperatorNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { sobel } from 'three/addons/tsl/display/SobelOperatorNode.js'; +``` + +## Constructor + +### new SobelOperatorNode( textureNode : TextureNode ) + +Constructs a new sobel operator node. + +**textureNode** + +The texture node that represents the input of the effect. + +## Properties + +### .textureNode : TextureNode + +The texture node that represents the input of the effect. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node updates its internal uniforms once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to update the effect's uniforms once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/SobelOperatorNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/SobelOperatorNode.js) \ No newline at end of file diff --git a/docs/pages/Source.html.md b/docs/pages/Source.html.md new file mode 100644 index 00000000000000..841a41dc985fae --- /dev/null +++ b/docs/pages/Source.html.md @@ -0,0 +1,85 @@ +# Source + +Represents the data source of a texture. + +The main purpose of this class is to decouple the data definition from the texture definition so the same data can be used with multiple texture instances. + +## Constructor + +### new Source( data : any ) + +Constructs a new video texture. + +**data** + +The data definition of a texture. + +Default is `null`. + +## Properties + +### .data : any + +The data definition of a texture. + +### .dataReady : boolean + +This property is only relevant when [Source#needsUpdate](Source.html#needsUpdate) is set to `true` and provides more control on how texture data should be processed. When `dataReady` is set to `false`, the engine performs the memory allocation (if necessary) but does not transfer the data into the GPU memory. + +Default is `true`. + +### .id : number (readonly) + +The ID of the source. + +### .isSource : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .needsUpdate : boolean + +When the property is set to `true`, the engine allocates the memory for the texture (if necessary) and triggers the actual texture upload to the GPU next time the source is used. + +Default is `false`. + +### .uuid : string (readonly) + +The UUID of the source. + +### .version : number (readonly) + +This starts at `0` and counts how many times [Source#needsUpdate](Source.html#needsUpdate) is set to `true`. + +Default is `0`. + +## Methods + +### .getSize( target : Vector2 | Vector3 ) : Vector2 | Vector3 + +Returns the dimensions of the source into the given target vector. + +**target** + +The target object the result is written into. + +**Returns:** The dimensions of the source. + +### .toJSON( meta : Object | string ) : Object + +Serializes the source into JSON. + +**meta** + +An optional value holding meta information about the serialization. + +See: + +* [ObjectLoader#parse](ObjectLoader.html#parse) + +**Returns:** A JSON object representing the serialized source. + +## Source + +[src/textures/Source.js](https://github.com/mrdoob/three.js/blob/master/src/textures/Source.js) \ No newline at end of file diff --git a/docs/pages/Sphere.html.md b/docs/pages/Sphere.html.md new file mode 100644 index 00000000000000..e409fb355c652e --- /dev/null +++ b/docs/pages/Sphere.html.md @@ -0,0 +1,241 @@ +# Sphere + +An analytical 3D sphere defined by a center and radius. This class is mainly used as a Bounding Sphere for 3D objects. + +## Constructor + +### new Sphere( center : Vector3, radius : number ) + +Constructs a new sphere. + +**center** + +The center of the sphere + +Default is `(0,0,0)`. + +**radius** + +The radius of the sphere. + +Default is `-1`. + +## Properties + +### .center : Vector3 + +The center of the sphere + +### .isSphere : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .radius : number + +The radius of the sphere. + +## Methods + +### .applyMatrix4( matrix : Matrix4 ) : Sphere + +Transforms this sphere with the given 4x4 transformation matrix. + +**matrix** + +The transformation matrix. + +**Returns:** A reference to this sphere. + +### .clampPoint( point : Vector3, target : Vector3 ) : Vector3 + +Clamps a point within the sphere. If the point is outside the sphere, it will clamp it to the closest point on the edge of the sphere. Points already inside the sphere will not be affected. + +**point** + +The plane to clamp. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The clamped point. + +### .clone() : Sphere + +Returns a new sphere with copied values from this instance. + +**Returns:** A clone of this instance. + +### .containsPoint( point : Vector3 ) : boolean + +Returns `true` if this sphere contains the given point inclusive of the surface of the sphere. + +**point** + +The point to check. + +**Returns:** Whether this sphere contains the given point or not. + +### .copy( sphere : Sphere ) : Sphere + +Copies the values of the given sphere to this instance. + +**sphere** + +The sphere to copy. + +**Returns:** A reference to this sphere. + +### .distanceToPoint( point : Vector3 ) : number + +Returns the closest distance from the boundary of the sphere to the given point. If the sphere contains the point, the distance will be negative. + +**point** + +The point to compute the distance to. + +**Returns:** The distance to the point. + +### .equals( sphere : Sphere ) : boolean + +Returns `true` if this sphere is equal with the given one. + +**sphere** + +The sphere to test for equality. + +**Returns:** Whether this bounding sphere is equal with the given one. + +### .expandByPoint( point : Vector3 ) : Sphere + +Expands the boundaries of this sphere to include the given point. + +**point** + +The point to include. + +**Returns:** A reference to this sphere. + +### .fromJSON( json : Object ) : Sphere + +Returns a serialized structure of the bounding sphere. + +**json** + +The serialized json to set the sphere from. + +**Returns:** A reference to this bounding sphere. + +### .getBoundingBox( target : Box3 ) : Box3 + +Returns a bounding box that encloses this sphere. + +**target** + +The target box that is used to store the method's result. + +**Returns:** The bounding box that encloses this sphere. + +### .intersectsBox( box : Box3 ) : boolean + +Returns `true` if this sphere intersects with the given box. + +**box** + +The box to test. + +**Returns:** Whether this sphere intersects with the given box or not. + +### .intersectsPlane( plane : Plane ) : boolean + +Returns `true` if this sphere intersects with the given plane. + +**plane** + +The plane to test. + +**Returns:** Whether this sphere intersects with the given plane or not. + +### .intersectsSphere( sphere : Sphere ) : boolean + +Returns `true` if this sphere intersects with the given one. + +**sphere** + +The sphere to test. + +**Returns:** Whether this sphere intersects with the given one or not. + +### .isEmpty() : boolean + +Returns `true` if the sphere is empty (the radius set to a negative number). + +Spheres with a radius of `0` contain only their center point and are not considered to be empty. + +**Returns:** Whether this sphere is empty or not. + +### .makeEmpty() : Sphere + +Makes this sphere empty which means in encloses a zero space in 3D. + +**Returns:** A reference to this sphere. + +### .set( center : Vector3, radius : number ) : Sphere + +Sets the sphere's components by copying the given values. + +**center** + +The center. + +**radius** + +The radius. + +**Returns:** A reference to this sphere. + +### .setFromPoints( points : Array., optionalCenter : Vector3 ) : Sphere + +Computes the minimum bounding sphere for list of points. If the optional center point is given, it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing the points is calculated. + +**points** + +A list of points in 3D space. + +**optionalCenter** + +The center of the sphere. + +**Returns:** A reference to this sphere. + +### .toJSON() : Object + +Returns a serialized structure of the bounding sphere. + +**Returns:** Serialized structure with fields representing the object state. + +### .translate( offset : Vector3 ) : Sphere + +Translates the sphere's center by the given offset. + +**offset** + +The offset. + +**Returns:** A reference to this sphere. + +### .union( sphere : Sphere ) : Sphere + +Expands this sphere to enclose both the original sphere and the given sphere. + +**sphere** + +The sphere to include. + +**Returns:** A reference to this sphere. + +## Source + +[src/math/Sphere.js](https://github.com/mrdoob/three.js/blob/master/src/math/Sphere.js) \ No newline at end of file diff --git a/docs/pages/SphereGeometry.html.md b/docs/pages/SphereGeometry.html.md new file mode 100644 index 00000000000000..283a2fd47b54f3 --- /dev/null +++ b/docs/pages/SphereGeometry.html.md @@ -0,0 +1,84 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# SphereGeometry + +A class for generating a sphere geometry. + +## Code Example + +```js +const geometry = new THREE.SphereGeometry( 15, 32, 16 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const sphere = new THREE.Mesh( geometry, material ); +scene.add( sphere ); +``` + +## Constructor + +### new SphereGeometry( radius : number, widthSegments : number, heightSegments : number, phiStart : number, phiLength : number, thetaStart : number, thetaLength : number ) + +Constructs a new sphere geometry. + +**radius** + +The sphere radius. + +Default is `1`. + +**widthSegments** + +The number of horizontal segments. Minimum value is `3`. + +Default is `32`. + +**heightSegments** + +The number of vertical segments. Minimum value is `2`. + +Default is `16`. + +**phiStart** + +The horizontal starting angle in radians. + +Default is `0`. + +**phiLength** + +The horizontal sweep angle size. + +Default is `Math.PI*2`. + +**thetaStart** + +The vertical starting angle in radians. + +Default is `0`. + +**thetaLength** + +The vertical sweep angle size. + +Default is `Math.PI`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : SphereGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/SphereGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/SphereGeometry.js) \ No newline at end of file diff --git a/docs/pages/Spherical.html.md b/docs/pages/Spherical.html.md new file mode 100644 index 00000000000000..f004e80cac2bc7 --- /dev/null +++ b/docs/pages/Spherical.html.md @@ -0,0 +1,121 @@ +# Spherical + +This class can be used to represent points in 3D space as [Spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system). + +## Constructor + +### new Spherical( radius : number, phi : number, theta : number ) + +Constructs a new spherical. + +**radius** + +The radius, or the Euclidean distance (straight-line distance) from the point to the origin. + +Default is `1`. + +**phi** + +The polar angle in radians from the y (up) axis. + +Default is `0`. + +**theta** + +The equator/azimuthal angle in radians around the y (up) axis. + +Default is `0`. + +## Properties + +### .phi : number + +The polar angle in radians from the y (up) axis. + +Default is `0`. + +### .radius : number + +The radius, or the Euclidean distance (straight-line distance) from the point to the origin. + +Default is `1`. + +### .theta : number + +The equator/azimuthal angle in radians around the y (up) axis. + +Default is `0`. + +## Methods + +### .clone() : Spherical + +Returns a new spherical with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( other : Spherical ) : Spherical + +Copies the values of the given spherical to this instance. + +**other** + +The spherical to copy. + +**Returns:** A reference to this spherical. + +### .makeSafe() : Spherical + +Restricts the polar angle \[page:.phi phi\] to be between `0.000001` and pi - `0.000001`. + +**Returns:** A reference to this spherical. + +### .set( radius : number, phi : number, theta : number ) : Spherical + +Sets the spherical components by copying the given values. + +**radius** + +The radius. + +**phi** + +The polar angle. + +**theta** + +The azimuthal angle. + +**Returns:** A reference to this spherical. + +### .setFromCartesianCoords( x : number, y : number, z : number ) : Spherical + +Sets the spherical components from the given Cartesian coordinates. + +**x** + +The x value. + +**y** + +The y value. + +**z** + +The z value. + +**Returns:** A reference to this spherical. + +### .setFromVector3( v : Vector3 ) : Spherical + +Sets the spherical components from the given vector which is assumed to hold Cartesian coordinates. + +**v** + +The vector to set. + +**Returns:** A reference to this spherical. + +## Source + +[src/math/Spherical.js](https://github.com/mrdoob/three.js/blob/master/src/math/Spherical.js) \ No newline at end of file diff --git a/docs/pages/SphericalHarmonics3.html.md b/docs/pages/SphericalHarmonics3.html.md new file mode 100644 index 00000000000000..aaaa406cc558dc --- /dev/null +++ b/docs/pages/SphericalHarmonics3.html.md @@ -0,0 +1,196 @@ +# SphericalHarmonics3 + +Represents a third-order spherical harmonics (SH). Light probes use this class to encode lighting information. + +* Primary reference: [https://graphics.stanford.edu/papers/envmap/envmap.pdf](https://graphics.stanford.edu/papers/envmap/envmap.pdf) +* Secondary reference: [https://www.ppsloan.org/publications/StupidSH36.pdf](https://www.ppsloan.org/publications/StupidSH36.pdf) + +## Constructor + +### new SphericalHarmonics3() + +Constructs a new spherical harmonics. + +## Properties + +### .coefficients : Array. + +An array holding the (9) SH coefficients. + +### .isSphericalHarmonics3 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .add( sh : SphericalHarmonics3 ) : SphericalHarmonics3 + +Adds the given SH to this instance. + +**sh** + +The SH to add. + +**Returns:** A reference to this spherical harmonics. + +### .addScaledSH( sh : SphericalHarmonics3, s : number ) : SphericalHarmonics3 + +A convenience method for performing [SphericalHarmonics3#add](SphericalHarmonics3.html#add) and [SphericalHarmonics3#scale](SphericalHarmonics3.html#scale) at once. + +**sh** + +The SH to add. + +**s** + +The scale factor. + +**Returns:** A reference to this spherical harmonics. + +### .clone() : SphericalHarmonics3 + +Returns a new spherical harmonics with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( sh : SphericalHarmonics3 ) : SphericalHarmonics3 + +Copies the values of the given spherical harmonics to this instance. + +**sh** + +The spherical harmonics to copy. + +**Returns:** A reference to this spherical harmonics. + +### .equals( sh : SphericalHarmonics3 ) : boolean + +Returns `true` if this spherical harmonics is equal with the given one. + +**sh** + +The spherical harmonics to test for equality. + +**Returns:** Whether this spherical harmonics is equal with the given one. + +### .fromArray( array : Array., offset : number ) : SphericalHarmonics3 + +Sets the SH coefficients of this instance from the given array. + +**array** + +An array holding the SH coefficients. + +**offset** + +The array offset where to start copying. + +Default is `0`. + +**Returns:** A clone of this instance. + +### .getAt( normal : Vector3, target : Vector3 ) : Vector3 + +Returns the radiance in the direction of the given normal. + +**normal** + +The normal vector (assumed to be unit length) + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The radiance. + +### .getIrradianceAt( normal : Vector3, target : Vector3 ) : Vector3 + +Returns the irradiance (radiance convolved with cosine lobe) in the direction of the given normal. + +**normal** + +The normal vector (assumed to be unit length) + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The irradiance. + +### .lerp( sh : SphericalHarmonics3, alpha : number ) : SphericalHarmonics3 + +Linear interpolates between the given SH and this instance by the given alpha factor. + +**sh** + +The SH to interpolate with. + +**alpha** + +The alpha factor. + +**Returns:** A reference to this spherical harmonics. + +### .scale( s : number ) : SphericalHarmonics3 + +Scales this SH by the given scale factor. + +**s** + +The scale factor. + +**Returns:** A reference to this spherical harmonics. + +### .set( coefficients : Array. ) : SphericalHarmonics3 + +Sets the given SH coefficients to this instance by copying the values. + +**coefficients** + +The SH coefficients. + +**Returns:** A reference to this spherical harmonics. + +### .toArray( array : Array., offset : number ) : Array. + +Returns an array with the SH coefficients, or copies them into the provided array. The coefficients are represented as numbers. + +**array** + +The target array. + +Default is `[]`. + +**offset** + +The array offset where to start copying. + +Default is `0`. + +**Returns:** An array with flat SH coefficients. + +### .zero() : SphericalHarmonics3 + +Sets all SH coefficients to `0`. + +**Returns:** A reference to this spherical harmonics. + +## Static Methods + +### .getBasisAt( normal : Vector3, shBasis : Array. ) + +Computes the SH basis for the given normal vector. + +**normal** + +The normal. + +**shBasis** + +The target array holding the SH basis. + +## Source + +[src/math/SphericalHarmonics3.js](https://github.com/mrdoob/three.js/blob/master/src/math/SphericalHarmonics3.js) \ No newline at end of file diff --git a/docs/pages/SplineCurve.html.md b/docs/pages/SplineCurve.html.md new file mode 100644 index 00000000000000..df14fbaa57196c --- /dev/null +++ b/docs/pages/SplineCurve.html.md @@ -0,0 +1,67 @@ +*Inheritance: Curve →* + +# SplineCurve + +A curve representing a 2D spline curve. + +## Code Example + +```js +// Create a sine-like wave +const curve = new THREE.SplineCurve( [ + new THREE.Vector2( -10, 0 ), + new THREE.Vector2( -5, 5 ), + new THREE.Vector2( 0, 0 ), + new THREE.Vector2( 5, -5 ), + new THREE.Vector2( 10, 0 ) +] ); +const points = curve.getPoints( 50 ); +const geometry = new THREE.BufferGeometry().setFromPoints( points ); +const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); +// Create the final object to add to the scene +const splineObject = new THREE.Line( geometry, material ); +``` + +## Constructor + +### new SplineCurve( points : Array. ) + +Constructs a new 2D spline curve. + +**points** + +An array of 2D points defining the curve. + +## Properties + +### .isSplineCurve : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .points : Array. + +An array of 2D points defining the curve. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector2 ) : Vector2 + +Returns a point on the curve. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[src/extras/curves/SplineCurve.js](https://github.com/mrdoob/three.js/blob/master/src/extras/curves/SplineCurve.js) \ No newline at end of file diff --git a/docs/pages/SplitNode.html.md b/docs/pages/SplitNode.html.md new file mode 100644 index 00000000000000..230cd94d0c5381 --- /dev/null +++ b/docs/pages/SplitNode.html.md @@ -0,0 +1,85 @@ +*Inheritance: EventDispatcher → Node →* + +# SplitNode + +This module is part of the TSL core and usually not used in app level code. `SplitNode` represents a property access operation which means it is used to implement any `.xyzw`, `.rgba` and `stpq` usage on node objects. For example: + +## Code Example + +```js +const redValue = color.r; +``` + +## Constructor + +### new SplitNode( node : Node, components : string ) + +Constructs a new split node. + +**node** + +The node that should be accessed. + +**components** + +The components that should be accessed. + +Default is `'x'`. + +## Properties + +### .components : string + +The components that should be accessed. + +### .isSplitNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .node : Node + +The node that should be accessed. + +## Methods + +### .getComponentType( builder : NodeBuilder ) : string + +Returns the component type of the node's type. + +**builder** + +The current node builder. + +**Returns:** The component type. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from requested components. + +**builder** + +The current node builder. + +**Overrides:** [Node#getNodeType](Node.html#getNodeType) + +**Returns:** The node type. + +### .getScope() : Node + +Returns the scope of the node. + +**Overrides:** [Node#getScope](Node.html#getScope) + +**Returns:** The scope of the node. + +### .getVectorLength() : number + +Returns the vector length which is computed based on the requested components. + +**Returns:** The vector length. + +## Source + +[src/nodes/utils/SplitNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/SplitNode.js) \ No newline at end of file diff --git a/docs/pages/SpotLight.html.md b/docs/pages/SpotLight.html.md new file mode 100644 index 00000000000000..b2189a5a650930 --- /dev/null +++ b/docs/pages/SpotLight.html.md @@ -0,0 +1,124 @@ +*Inheritance: EventDispatcher → Object3D → Light →* + +# SpotLight + +This light gets emitted from a single point in one direction, along a cone that increases in size the further from the light it gets. + +This light can cast shadows - see the [SpotLightShadow](SpotLightShadow.html) for details. + +## Code Example + +```js +// white spotlight shining from the side, modulated by a texture +const spotLight = new THREE.SpotLight( 0xffffff ); +spotLight.position.set( 100, 1000, 100 ); +spotLight.map = new THREE.TextureLoader().load( url ); +spotLight.castShadow = true; +spotLight.shadow.mapSize.width = 1024; +spotLight.shadow.mapSize.height = 1024; +spotLight.shadow.camera.near = 500; +spotLight.shadow.camera.far = 4000; +spotLight.shadow.camera.fov = 30;s +``` + +## Constructor + +### new SpotLight( color : number | Color | string, intensity : number, distance : number, angle : number, penumbra : number, decay : number ) + +Constructs a new spot light. + +**color** + +The light's color. + +Default is `0xffffff`. + +**intensity** + +The light's strength/intensity measured in candela (cd). + +Default is `1`. + +**distance** + +Maximum range of the light. `0` means no limit. + +Default is `0`. + +**angle** + +Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`. + +Default is `Math.PI/3`. + +**penumbra** + +Percent of the spotlight cone that is attenuated due to penumbra. Value range is `[0,1]`. + +Default is `0`. + +**decay** + +The amount the light dims along the distance of the light. + +Default is `2`. + +## Properties + +### .angle : number + +Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`. + +Default is `Math.PI/3`. + +### .decay : number + +The amount the light dims along the distance of the light. In context of physically-correct rendering the default value should not be changed. + +Default is `2`. + +### .distance : number + +Maximum range of the light. `0` means no limit. + +Default is `0`. + +### .isSpotLight : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .map : Texture + +A texture used to modulate the color of the light. The spot light color is mixed with the RGB value of this texture, with a ratio corresponding to its alpha value. The cookie-like masking effect is reproduced using pixel values (0, 0, 0, 1-cookie\_value). + +_Warning_: This property is disabled if [Object3D#castShadow](Object3D.html#castShadow) is set to `false`. + +Default is `null`. + +### .penumbra : number + +Percent of the spotlight cone that is attenuated due to penumbra. Value range is `[0,1]`. + +Default is `0`. + +### .power : number + +The light's power. Power is the luminous power of the light measured in lumens (lm). Changing the power will also change the light's intensity. + +### .shadow : SpotLightShadow + +This property holds the light's shadow configuration. + +### .target : Object3D + +The spot light points from its position to the target's position. + +For the target's position to be changed to anything other than the default, it must be added to the scene. + +It is also possible to set the target to be another 3D object in the scene. The light will now track the target object. + +## Source + +[src/lights/SpotLight.js](https://github.com/mrdoob/three.js/blob/master/src/lights/SpotLight.js) \ No newline at end of file diff --git a/docs/pages/SpotLightHelper.html.md b/docs/pages/SpotLightHelper.html.md new file mode 100644 index 00000000000000..08cd111c6d32d1 --- /dev/null +++ b/docs/pages/SpotLightHelper.html.md @@ -0,0 +1,53 @@ +*Inheritance: EventDispatcher → Object3D →* + +# SpotLightHelper + +This displays a cone shaped helper object for a [SpotLight](SpotLight.html). + +## Code Example + +```js +const spotLight = new THREE.SpotLight( 0xffffff ); +spotLight.position.set( 10, 10, 10 ); +scene.add( spotLight ); +const spotLightHelper = new THREE.SpotLightHelper( spotLight ); +scene.add( spotLightHelper ); +``` + +## Constructor + +### new SpotLightHelper( light : HemisphereLight, color : number | Color | string ) + +Constructs a new spot light helper. + +**light** + +The light to be visualized. + +**color** + +The helper's color. If not set, the helper will take the color of the light. + +## Properties + +### .color : number | Color | string + +The color parameter passed in the constructor. If not set, the helper will take the color of the light. + +### .light : SpotLight + +The light being visualized. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the helper to match the position and direction of the light being visualized. + +## Source + +[src/helpers/SpotLightHelper.js](https://github.com/mrdoob/three.js/blob/master/src/helpers/SpotLightHelper.js) \ No newline at end of file diff --git a/docs/pages/SpotLightNode.html.md b/docs/pages/SpotLightNode.html.md new file mode 100644 index 00000000000000..604f7da3270299 --- /dev/null +++ b/docs/pages/SpotLightNode.html.md @@ -0,0 +1,71 @@ +*Inheritance: EventDispatcher → Node → LightingNode → AnalyticLightNode →* + +# SpotLightNode + +Module for representing spot lights as nodes. + +## Constructor + +### new SpotLightNode( light : SpotLight ) + +Constructs a new spot light node. + +**light** + +The spot light source. + +Default is `null`. + +## Properties + +### .colorNode : UniformNode. + +Uniform node representing the light color. + +**Overrides:** [AnalyticLightNode#colorNode](AnalyticLightNode.html#colorNode) + +### .coneCosNode : UniformNode. + +Uniform node representing the cone cosine. + +### .cutoffDistanceNode : UniformNode. + +Uniform node representing the cutoff distance. + +### .decayExponentNode : UniformNode. + +Uniform node representing the decay exponent. + +### .penumbraCosNode : UniformNode. + +Uniform node representing the penumbra cosine. + +## Methods + +### .getSpotAttenuation( builder : NodeBuilder, angleCosine : Node. ) : Node. + +Computes the spot attenuation for the given angle. + +**builder** + +The node builder. + +**angleCosine** + +The angle to compute the spot attenuation for. + +**Returns:** The spot attenuation. + +### .update( frame : NodeFrame ) + +Overwritten to updated spot light specific uniforms. + +**frame** + +A reference to the current node frame. + +**Overrides:** [AnalyticLightNode#update](AnalyticLightNode.html#update) + +## Source + +[src/nodes/lighting/SpotLightNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/SpotLightNode.js) \ No newline at end of file diff --git a/docs/pages/SpotLightShadow.html.md b/docs/pages/SpotLightShadow.html.md new file mode 100644 index 00000000000000..1f1c89fd7e5dfe --- /dev/null +++ b/docs/pages/SpotLightShadow.html.md @@ -0,0 +1,35 @@ +*Inheritance: LightShadow →* + +# SpotLightShadow + +Represents the shadow configuration of directional lights. + +## Constructor + +### new SpotLightShadow() + +Constructs a new spot light shadow. + +## Properties + +### .aspect : number + +Texture aspect ratio. + +Default is `1`. + +### .focus : number + +Used to focus the shadow camera. The camera's field of view is set as a percentage of the spotlight's field-of-view. Range is `[0, 1]`. + +Default is `1`. + +### .isSpotLightShadow : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/lights/SpotLightShadow.js](https://github.com/mrdoob/three.js/blob/master/src/lights/SpotLightShadow.js) \ No newline at end of file diff --git a/docs/pages/Sprite.html.md b/docs/pages/Sprite.html.md new file mode 100644 index 00000000000000..5869b0fecada89 --- /dev/null +++ b/docs/pages/Sprite.html.md @@ -0,0 +1,74 @@ +*Inheritance: EventDispatcher → Object3D →* + +# Sprite + +A sprite is a plane that always faces towards the camera, generally with a partially transparent texture applied. + +Sprites do not cast shadows, setting [Object3D#castShadow](Object3D.html#castShadow) to `true` will have no effect. + +## Code Example + +```js +const map = new THREE.TextureLoader().load( 'sprite.png' ); +const material = new THREE.SpriteMaterial( { map: map } ); +const sprite = new THREE.Sprite( material ); +scene.add( sprite ); +``` + +## Constructor + +### new Sprite( material : SpriteMaterial | SpriteNodeMaterial ) + +Constructs a new sprite. + +**material** + +The sprite material. + +## Properties + +### .center : Vector2 + +The sprite's anchor point, and the point around which the sprite rotates. A value of `(0.5, 0.5)` corresponds to the midpoint of the sprite. A value of `(0, 0)` corresponds to the lower left corner of the sprite. + +Default is `(0.5,0.5)`. + +### .count : number + +The number of instances of this sprite. Can only be used with [WebGPURenderer](WebGPURenderer.html). + +Default is `1`. + +### .geometry : BufferGeometry + +The sprite geometry. + +### .isSprite : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .material : SpriteMaterial | SpriteNodeMaterial + +The sprite material. + +## Methods + +### .raycast( raycaster : Raycaster, intersects : Array. ) + +Computes intersection points between a casted ray and this sprite. + +**raycaster** + +The raycaster. + +**intersects** + +The target array that holds the intersection points. + +**Overrides:** [Object3D#raycast](Object3D.html#raycast) + +## Source + +[src/objects/Sprite.js](https://github.com/mrdoob/three.js/blob/master/src/objects/Sprite.js) \ No newline at end of file diff --git a/docs/pages/SpriteMaterial.html.md b/docs/pages/SpriteMaterial.html.md new file mode 100644 index 00000000000000..3f8cbae842014c --- /dev/null +++ b/docs/pages/SpriteMaterial.html.md @@ -0,0 +1,83 @@ +*Inheritance: EventDispatcher → Material →* + +# SpriteMaterial + +A material for rendering instances of [Sprite](Sprite.html). + +## Code Example + +```js +const map = new THREE.TextureLoader().load( 'textures/sprite.png' ); +const material = new THREE.SpriteMaterial( { map: map, color: 0xffffff } ); +const sprite = new THREE.Sprite( material ); +sprite.scale.set(200, 200, 1) +scene.add( sprite ); +``` + +## Constructor + +### new SpriteMaterial( parameters : Object ) + +Constructs a new sprite material. + +**parameters** + +An object with one or more properties defining the material's appearance. Any property of the material (including any property from inherited materials) can be passed in here. Color values can be passed any type of value accepted by [Color#set](Color.html#set). + +## Properties + +### .alphaMap : Texture + +The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). + +Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected. + +Default is `null`. + +### .color : Color + +Color of the material. + +Default is `(1,1,1)`. + +### .fog : boolean + +Whether the material is affected by fog or not. + +Default is `true`. + +### .isSpriteMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .map : Texture + +The color map. May optionally include an alpha channel, typically combined with [Material#transparent](Material.html#transparent) or [Material#alphaTest](Material.html#alphaTest). The texture map color is modulated by the diffuse `color`. + +Default is `null`. + +### .rotation : number + +The rotation of the sprite in radians. + +Default is `0`. + +### .sizeAttenuation : boolean + +Specifies whether size of the sprite is attenuated by the camera depth (perspective camera only). + +Default is `true`. + +### .transparent : boolean + +Overwritten since sprite materials are transparent by default. + +Default is `true`. + +**Overrides:** [Material#transparent](Material.html#transparent) + +## Source + +[src/materials/SpriteMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/SpriteMaterial.js) \ No newline at end of file diff --git a/docs/pages/SpriteNodeMaterial.html.md b/docs/pages/SpriteNodeMaterial.html.md new file mode 100644 index 00000000000000..371e0347b7e438 --- /dev/null +++ b/docs/pages/SpriteNodeMaterial.html.md @@ -0,0 +1,89 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# SpriteNodeMaterial + +Node material version of [SpriteMaterial](SpriteMaterial.html). + +## Constructor + +### new SpriteNodeMaterial( parameters : Object ) + +Constructs a new sprite node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isSpriteNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .positionNode : Node. + +This property makes it possible to define the position of the sprite with a node. That can be useful when the material is used with instanced rendering and node data are defined with an instanced attribute node: + +```js +const positionAttribute = new InstancedBufferAttribute( new Float32Array( positions ), 3 ); +material.positionNode = instancedBufferAttribute( positionAttribute ); +``` + +Another possibility is to compute the instanced data with a compute shader: + +```js +const positionBuffer = instancedArray( particleCount, 'vec3' ); +particleMaterial.positionNode = positionBuffer.toAttribute(); +``` + +Default is `null`. + +**Overrides:** [NodeMaterial#positionNode](NodeMaterial.html#positionNode) + +### .rotationNode : Node. + +The rotation of sprite materials is by default inferred from the `rotation`, property. This node property allows to overwrite the default and define the rotation with a node instead. + +If you don't want to overwrite the rotation but modify the existing value instead, use [materialRotation](TSL.html#materialRotation). + +Default is `null`. + +### .scaleNode : Node. + +This node property provides an additional way to scale sprites next to `Object3D.scale`. The scale transformation based in `Object3D.scale` is multiplied with the scale value of this node in the vertex shader. + +Default is `null`. + +### .sizeAttenuation : boolean + +Whether to use size attenuation or not. + +Default is `true`. + +### .transparent : boolean + +In Sprites, the transparent property is enabled by default. + +Default is `true`. + +**Overrides:** [NodeMaterial#transparent](NodeMaterial.html#transparent) + +## Methods + +### .setupPositionView( builder : NodeBuilder ) : Node. + +Setups the position node in view space. This method implements the sprite specific vertex shader. + +**builder** + +The current node builder. + +**Overrides:** [NodeMaterial#setupPositionView](NodeMaterial.html#setupPositionView) + +**Returns:** The position in view space. + +## Source + +[src/materials/nodes/SpriteNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/SpriteNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/SpriteSheetUVNode.html.md b/docs/pages/SpriteSheetUVNode.html.md new file mode 100644 index 00000000000000..9833a4a22431e8 --- /dev/null +++ b/docs/pages/SpriteSheetUVNode.html.md @@ -0,0 +1,52 @@ +*Inheritance: EventDispatcher → Node →* + +# SpriteSheetUVNode + +Can be used to compute texture coordinates for animated sprite sheets. + +## Code Example + +```js +const uvNode = spritesheetUV( vec2( 6, 6 ), uv(), time.mul( animationSpeed ) ); +material.colorNode = texture( spriteSheet, uvNode ); +``` + +## Constructor + +### new SpriteSheetUVNode( countNode : Node., uvNode : Node., frameNode : Node. ) + +Constructs a new sprite sheet uv node. + +**countNode** + +The node that defines the number of sprites in the x and y direction (e.g 6x6). + +**uvNode** + +The uv node. + +Default is `uv()`. + +**frameNode** + +The node that defines the current frame/sprite. + +Default is `float()`. + +## Properties + +### .countNode : Node. + +The node that defines the number of sprites in the x and y direction (e.g 6x6). + +### .frameNode : Node. + +The node that defines the current frame/sprite. + +### .uvNode : Node. + +The uv node. + +## Source + +[src/nodes/utils/SpriteSheetUVNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/SpriteSheetUVNode.js) \ No newline at end of file diff --git a/docs/pages/StackNode.html.md b/docs/pages/StackNode.html.md new file mode 100644 index 00000000000000..29e80d13e5c8b0 --- /dev/null +++ b/docs/pages/StackNode.html.md @@ -0,0 +1,145 @@ +*Inheritance: EventDispatcher → Node →* + +# StackNode + +Stack is a helper for Nodes that need to produce stack-based code instead of continuous flow. They are usually needed in cases like `If`, `Else`. + +## Constructor + +### new StackNode( parent : StackNode ) + +Constructs a new stack node. + +**parent** + +The parent stack node. + +Default is `null`. + +## Properties + +### .isStackNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .nodes : Array. + +List of nodes. + +### .outputNode : Node + +The output node. + +Default is `null`. + +### .parent : StackNode + +The parent stack node. + +Default is `null`. + +## Methods + +### .Case( …params : any ) : StackNode + +Represents a `case` statement in TSL. The TSL version accepts an arbitrary numbers of values. The last parameter must be the callback method that should be executed in the `true` case. + +**params** + +The values of the `Case()` statement as well as the callback method. + +**Returns:** A reference to this stack node. + +### .Default( method : function ) : StackNode + +Represents the default code block of a Switch/Case statement. + +**method** + +TSL code which is executed in the `else` case. + +**Returns:** A reference to this stack node. + +### .Else( method : function ) : StackNode + +Represent an `else` statement in TSL. + +**method** + +TSL code which is executed in the `else` case. + +**Returns:** A reference to this stack node. + +### .ElseIf( boolNode : Node, method : function ) : StackNode + +Represent an `elseif` statement in TSL. + +**boolNode** + +Represents the condition. + +**method** + +TSL code which is executed if the condition evaluates to `true`. + +**Returns:** A reference to this stack node. + +### .If( boolNode : Node, method : function ) : StackNode + +Represent an `if` statement in TSL. + +**boolNode** + +Represents the condition. + +**method** + +TSL code which is executed if the condition evaluates to `true`. + +**Returns:** A reference to this stack node. + +### .Switch( expression : any, method : function ) : StackNode + +Represents a `switch` statement in TSL. + +**expression** + +Represents the expression. + +**method** + +TSL code which is executed if the condition evaluates to `true`. + +**Returns:** A reference to this stack node. + +### .addToStack( node : Node, index : number ) : StackNode + +Adds a node to this stack. + +**node** + +The node to add. + +**index** + +The index where the node should be added. + +Default is `this.nodes.length`. + +**Returns:** A reference to this stack node. + +### .addToStackBefore( node : Node ) : StackNode + +Adds a node to the stack before the current node. + +**node** + +The node to add. + +**Returns:** A reference to this stack node. + +## Source + +[src/nodes/core/StackNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/StackNode.js) \ No newline at end of file diff --git a/docs/pages/StereoCamera.html.md b/docs/pages/StereoCamera.html.md new file mode 100644 index 00000000000000..b0043f76e6133f --- /dev/null +++ b/docs/pages/StereoCamera.html.md @@ -0,0 +1,49 @@ +# StereoCamera + +A special type of camera that uses two perspective cameras with stereoscopic projection. Can be used for rendering stereo effects like [3D Anaglyph](https://en.wikipedia.org/wiki/Anaglyph_3D) or [Parallax Barrier](https://en.wikipedia.org/wiki/parallax_barrier). + +## Constructor + +### new StereoCamera() + +Constructs a new stereo camera. + +## Properties + +### .aspect : number + +The aspect. + +Default is `1`. + +### .cameraL : PerspectiveCamera + +The camera representing the left eye. This is added to layer `1` so objects to be rendered by the left camera must also be added to this layer. + +### .cameraR : PerspectiveCamera + +The camera representing the right eye. This is added to layer `2` so objects to be rendered by the right camera must also be added to this layer. + +### .eyeSep : number + +The eye separation which represents the distance between the left and right camera. + +Default is `0.064`. + +### .type : string (readonly) + +The type property is used for detecting the object type in context of serialization/deserialization. + +## Methods + +### .update( camera : PerspectiveCamera ) + +Updates the stereo camera based on the given perspective camera. + +**camera** + +The perspective camera. + +## Source + +[src/cameras/StereoCamera.js](https://github.com/mrdoob/three.js/blob/master/src/cameras/StereoCamera.js) \ No newline at end of file diff --git a/docs/pages/StereoCompositePassNode.html.md b/docs/pages/StereoCompositePassNode.html.md new file mode 100644 index 00000000000000..8baaa0ae40bf72 --- /dev/null +++ b/docs/pages/StereoCompositePassNode.html.md @@ -0,0 +1,83 @@ +*Inheritance: EventDispatcher → Node → TempNode → PassNode →* + +# StereoCompositePassNode + +A special (abstract) render pass node that renders the scene as a stereoscopic image. Unlike [StereoPassNode](StereoPassNode.html), this node merges the image for the left and right eye into a single one. That is required for effects like anaglyph or parallax barrier. + +## Import + +StereoCompositePassNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { StereoCompositePassNode } from 'three/addons/tsl/display/StereoCompositePassNode.js'; +``` + +## Constructor + +### new StereoCompositePassNode( scene : Scene, camera : Camera ) (abstract) + +Constructs a new stereo composite pass node. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +## Properties + +### .isStereoCompositePassNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .stereo : StereoCamera + +The internal stereo camera that is used to render the scene. + +## Methods + +### .dispose() + +Frees internal resources. This method should be called when the pass is no longer required. + +**Overrides:** [PassNode#dispose](PassNode.html#dispose) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width of the pass. + +**height** + +The height of the pass. + +**Overrides:** [PassNode#setSize](PassNode.html#setSize) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [PassNode#updateBefore](PassNode.html#updateBefore) + +### .updateStereoCamera( coordinateSystem : number ) + +Updates the internal stereo camera. + +**coordinateSystem** + +The current coordinate system. + +## Source + +[examples/jsm/tsl/display/StereoCompositePassNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/StereoCompositePassNode.js) \ No newline at end of file diff --git a/docs/pages/StereoEffect.html.md b/docs/pages/StereoEffect.html.md new file mode 100644 index 00000000000000..3f0432e758339a --- /dev/null +++ b/docs/pages/StereoEffect.html.md @@ -0,0 +1,61 @@ +# StereoEffect + +A class that creates an stereo effect. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [StereoPassNode](StereoPassNode.html). + +## Import + +StereoEffect is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { StereoEffect } from 'three/addons/effects/StereoEffect.js'; +``` + +## Constructor + +### new StereoEffect( renderer : WebGLRenderer ) + +Constructs a new stereo effect. + +**renderer** + +The renderer. + +## Methods + +### .render( scene : Object3D, camera : Camera ) + +When using this effect, this method should be called instead of the default [WebGLRenderer#render](WebGLRenderer.html#render). + +**scene** + +The scene to render. + +**camera** + +The camera. + +### .setEyeSeparation( eyeSep : number ) + +Sets the given eye separation. + +**eyeSep** + +The eye separation to set. + +### .setSize( width : number, height : number ) + +Resizes the effect. + +**width** + +The width of the effect in logical pixels. + +**height** + +The height of the effect in logical pixels. + +## Source + +[examples/jsm/effects/StereoEffect.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/effects/StereoEffect.js) \ No newline at end of file diff --git a/docs/pages/StereoPassNode.html.md b/docs/pages/StereoPassNode.html.md new file mode 100644 index 00000000000000..9d5c69b9322e8c --- /dev/null +++ b/docs/pages/StereoPassNode.html.md @@ -0,0 +1,55 @@ +*Inheritance: EventDispatcher → Node → TempNode → PassNode →* + +# StereoPassNode + +A special render pass node that renders the scene as a stereoscopic image. + +## Import + +StereoPassNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { stereoPass } from 'three/addons/tsl/display/StereoPassNode.js'; +``` + +## Constructor + +### new StereoPassNode( scene : Scene, camera : Camera ) + +Constructs a new stereo pass node. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +## Properties + +### .isStereoPassNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .stereo : StereoCamera + +The internal stereo camera that is used to render the scene. + +## Methods + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the stereo effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [PassNode#updateBefore](PassNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/StereoPassNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/StereoPassNode.js) \ No newline at end of file diff --git a/docs/pages/Storage3DTexture.html.md b/docs/pages/Storage3DTexture.html.md new file mode 100644 index 00000000000000..acf0faad260c01 --- /dev/null +++ b/docs/pages/Storage3DTexture.html.md @@ -0,0 +1,87 @@ +*Inheritance: EventDispatcher → Texture →* + +# Storage3DTexture + +This special type of texture is intended for compute shaders. It can be used to compute the data of a texture with a compute shader. + +Note: This type of texture can only be used with `WebGPURenderer` and a WebGPU backend. + +## Constructor + +### new Storage3DTexture( width : number, height : number, depth : number ) + +Constructs a new storage texture. + +**width** + +The storage texture's width. + +Default is `1`. + +**height** + +The storage texture's height. + +Default is `1`. + +**depth** + +The storage texture's depth. + +Default is `1`. + +## Properties + +### .image : Object + +The image object which just represents the texture's dimension. + +**Overrides:** [Texture#image](Texture.html#image) + +### .is3DTexture : boolean + +Indicates whether this texture is a 3D texture. + +### .isStorageTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .magFilter : number + +The default `magFilter` for storage textures is `THREE.LinearFilter`. + +**Overrides:** [Texture#magFilter](Texture.html#magFilter) + +### .minFilter : number + +The default `minFilter` for storage textures is `THREE.LinearFilter`. + +**Overrides:** [Texture#minFilter](Texture.html#minFilter) + +### .wrapR : number + +This defines how the texture is wrapped in the depth direction and corresponds to _W_ in UVW mapping. + +## Methods + +### .setSize( width : number, height : number, depth : number ) + +Sets the size of the storage 3d texture. + +**width** + +The new width of the storage texture. + +**height** + +The new height of the storage texture. + +**depth** + +The new depth of the storage texture. + +## Source + +[src/renderers/common/Storage3DTexture.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/Storage3DTexture.js) \ No newline at end of file diff --git a/docs/pages/StorageArrayElementNode.html.md b/docs/pages/StorageArrayElementNode.html.md new file mode 100644 index 00000000000000..a1918a9a25a12d --- /dev/null +++ b/docs/pages/StorageArrayElementNode.html.md @@ -0,0 +1,41 @@ +*Inheritance: EventDispatcher → Node → ArrayElementNode →* + +# StorageArrayElementNode + +This class enables element access on instances of [StorageBufferNode](StorageBufferNode.html). In most cases, it is indirectly used when accessing elements with the [StorageBufferNode#element](StorageBufferNode.html#element) method. + +## Code Example + +```js +const position = positionStorage.element( instanceIndex ); +``` + +## Constructor + +### new StorageArrayElementNode( storageBufferNode : StorageBufferNode, indexNode : Node ) + +Constructs storage buffer element node. + +**storageBufferNode** + +The storage buffer node. + +**indexNode** + +The index node that defines the element access. + +## Properties + +### .isStorageArrayElementNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .storageBufferNode : StorageBufferNode + +The storage buffer node. + +## Source + +[src/nodes/utils/StorageArrayElementNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/utils/StorageArrayElementNode.js) \ No newline at end of file diff --git a/docs/pages/StorageArrayTexture.html.md b/docs/pages/StorageArrayTexture.html.md new file mode 100644 index 00000000000000..a83d7ac1341d5b --- /dev/null +++ b/docs/pages/StorageArrayTexture.html.md @@ -0,0 +1,79 @@ +*Inheritance: EventDispatcher → Texture →* + +# StorageArrayTexture + +This special type of texture is intended for compute shaders. It can be used to compute the data of a texture with a compute shader. + +Note: This type of texture can only be used with `WebGPURenderer` and a WebGPU backend. + +## Constructor + +### new StorageArrayTexture( width : number, height : number, depth : number ) + +Constructs a new storage texture. + +**width** + +The storage texture's width. + +Default is `1`. + +**height** + +The storage texture's height. + +Default is `1`. + +**depth** + +The storage texture's depth. + +Default is `1`. + +## Properties + +### .image : Object + +The image object which just represents the texture's dimension. + +**Overrides:** [Texture#image](Texture.html#image) + +### .isStorageTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .magFilter : number + +The default `magFilter` for storage textures is `THREE.LinearFilter`. + +**Overrides:** [Texture#magFilter](Texture.html#magFilter) + +### .minFilter : number + +The default `minFilter` for storage textures is `THREE.LinearFilter`. + +**Overrides:** [Texture#minFilter](Texture.html#minFilter) + +## Methods + +### .setSize( width : number, height : number, depth : number ) + +Sets the size of the storage array texture. + +**width** + +The new width of the storage texture. + +**height** + +The new height of the storage texture. + +**depth** + +The new depth of the storage texture. + +## Source + +[src/renderers/common/StorageArrayTexture.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/StorageArrayTexture.js) \ No newline at end of file diff --git a/docs/pages/StorageBufferAttribute.html.md b/docs/pages/StorageBufferAttribute.html.md new file mode 100644 index 00000000000000..811dd38b6575a9 --- /dev/null +++ b/docs/pages/StorageBufferAttribute.html.md @@ -0,0 +1,41 @@ +*Inheritance: BufferAttribute →* + +# StorageBufferAttribute + +This special type of buffer attribute is intended for compute shaders. In earlier three.js versions it was only possible to update attribute data on the CPU via JavaScript and then upload the data to the GPU. With the new material system and renderer it is now possible to use compute shaders to compute the data for an attribute more efficiently on the GPU. + +The idea is to create an instance of this class and provide it as an input to [StorageBufferNode](StorageBufferNode.html). + +Note: This type of buffer attribute can only be used with `WebGPURenderer`. + +## Constructor + +### new StorageBufferAttribute( count : number | TypedArray, itemSize : number, typeClass : TypedArray.constructor ) + +Constructs a new storage buffer attribute. + +**count** + +The item count. It is also valid to pass a typed array as an argument. The subsequent parameters are then obsolete. + +**itemSize** + +The item size. + +**typeClass** + +A typed array constructor. + +Default is `Float32Array`. + +## Properties + +### .isStorageBufferAttribute : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/renderers/common/StorageBufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/StorageBufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/StorageBufferNode.html.md b/docs/pages/StorageBufferNode.html.md new file mode 100644 index 00000000000000..005eb29f148c87 --- /dev/null +++ b/docs/pages/StorageBufferNode.html.md @@ -0,0 +1,217 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → BufferNode →* + +# StorageBufferNode + +This node is used in context of compute shaders and allows to define a storage buffer for data. A typical workflow is to create instances of this node with the convenience functions `attributeArray()` or `instancedArray()`, setup up a compute shader that writes into the buffers and then convert the storage buffers to attribute nodes for rendering. + +## Code Example + +```js +const positionBuffer = instancedArray( particleCount, 'vec3' ); // the storage buffer node +const computeInit = Fn( () => { // the compute shader + const position = positionBuffer.element( instanceIndex ); + // compute position data + position.x = 1; + position.y = 1; + position.z = 1; +} )().compute( particleCount ); +const particleMaterial = new THREE.SpriteNodeMaterial(); +particleMaterial.positionNode = positionBuffer.toAttribute(); +renderer.computeAsync( computeInit ); +``` + +## Constructor + +### new StorageBufferNode( value : StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, bufferType : string | Struct, bufferCount : number ) + +Constructs a new storage buffer node. + +**value** + +The buffer data. + +**bufferType** + +The buffer type (e.g. `'vec3'`). + +Default is `null`. + +**bufferCount** + +The buffer count. + +Default is `0`. + +## Properties + +### .access : string + +The access type of the texture node. + +Default is `'readWrite'`. + +### .global : boolean + +`StorageBufferNode` sets this property to `true` by default. + +Default is `true`. + +**Overrides:** [BufferNode#global](BufferNode.html#global) + +### .isAtomic : boolean + +Whether the node is atomic or not. + +Default is `false`. + +### .isPBO : boolean + +Whether the node represents a PBO or not. Only relevant for WebGL. + +Default is `false`. + +### .isStorageBufferNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .structTypeNode : StructTypeNode + +The buffer struct type. + +Default is `null`. + +## Methods + +### .element( indexNode : IndexNode ) : StorageArrayElementNode + +Enables element access with the given index node. + +**indexNode** + +The index node. + +**Returns:** A node representing the element access. + +### .generate( builder : NodeBuilder ) : string + +Generates the code snippet of the storage buffer node. + +**builder** + +The current node builder. + +**Overrides:** [BufferNode#generate](BufferNode.html#generate) + +**Returns:** The generated code snippet. + +### .getAttributeData() : Object + +Returns attribute data for this storage buffer node. + +**Returns:** The attribute data. + +### .getHash( builder : NodeBuilder ) : string + +This method is overwritten since the buffer data might be shared and thus the hash should be shared as well. + +**builder** + +The current node builder. + +**Overrides:** [BufferNode#getHash](BufferNode.html#getHash) + +**Returns:** The hash. + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation to return a fixed value `'indirectStorageBuffer'` or `'storageBuffer'`. + +**builder** + +The current node builder. + +**Overrides:** [BufferNode#getInputType](BufferNode.html#getInputType) + +**Returns:** The input type. + +### .getMemberType( builder : NodeBuilder, name : string ) : string + +Returns the type of a member of the struct. + +**builder** + +The current node builder. + +**name** + +The name of the member. + +**Overrides:** [BufferNode#getMemberType](BufferNode.html#getMemberType) + +**Returns:** The type of the member. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type from the availability of storage buffers and the attribute data. + +**builder** + +The current node builder. + +**Overrides:** [BufferNode#getNodeType](BufferNode.html#getNodeType) + +**Returns:** The node type. + +### .getPBO() : boolean + +Returns the `isPBO` value. + +**Returns:** Whether the node represents a PBO or not. + +### .setAccess( value : string ) : StorageBufferNode + +Defines the node access. + +**value** + +The node access. + +**Returns:** A reference to this node. + +### .setAtomic( value : boolean ) : StorageBufferNode + +Defines whether the node is atomic or not. + +**value** + +The atomic flag. + +**Returns:** A reference to this node. + +### .setPBO( value : boolean ) : StorageBufferNode + +Defines whether this node is a PBO or not. Only relevant for WebGL. + +**value** + +The value so set. + +**Returns:** A reference to this node. + +### .toAtomic() : StorageBufferNode + +Convenience method for making this node atomic. + +**Returns:** A reference to this node. + +### .toReadOnly() : StorageBufferNode + +Convenience method for configuring a read-only node access. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/accessors/StorageBufferNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/StorageBufferNode.js) \ No newline at end of file diff --git a/docs/pages/StorageInstancedBufferAttribute.html.md b/docs/pages/StorageInstancedBufferAttribute.html.md new file mode 100644 index 00000000000000..d0f538f79c1fc4 --- /dev/null +++ b/docs/pages/StorageInstancedBufferAttribute.html.md @@ -0,0 +1,41 @@ +*Inheritance: BufferAttribute → InstancedBufferAttribute →* + +# StorageInstancedBufferAttribute + +This special type of instanced buffer attribute is intended for compute shaders. In earlier three.js versions it was only possible to update attribute data on the CPU via JavaScript and then upload the data to the GPU. With the new material system and renderer it is now possible to use compute shaders to compute the data for an attribute more efficiently on the GPU. + +The idea is to create an instance of this class and provide it as an input to [StorageBufferNode](StorageBufferNode.html). + +Note: This type of buffer attribute can only be used with `WebGPURenderer`. + +## Constructor + +### new StorageInstancedBufferAttribute( count : number | TypedArray, itemSize : number, typeClass : TypedArray.constructor ) + +Constructs a new storage instanced buffer attribute. + +**count** + +The item count. It is also valid to pass a typed array as an argument. The subsequent parameters are then obsolete. + +**itemSize** + +The item size. + +**typeClass** + +A typed array constructor. + +Default is `Float32Array`. + +## Properties + +### .isStorageInstancedBufferAttribute : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/renderers/common/StorageInstancedBufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/StorageInstancedBufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/StorageTexture.html.md b/docs/pages/StorageTexture.html.md new file mode 100644 index 00000000000000..9f78899d44c601 --- /dev/null +++ b/docs/pages/StorageTexture.html.md @@ -0,0 +1,75 @@ +*Inheritance: EventDispatcher → Texture →* + +# StorageTexture + +This special type of texture is intended for compute shaders. It can be used to compute the data of a texture with a compute shader. + +Note: This type of texture can only be used with `WebGPURenderer` and a WebGPU backend. + +## Constructor + +### new StorageTexture( width : number, height : number ) + +Constructs a new storage texture. + +**width** + +The storage texture's width. + +Default is `1`. + +**height** + +The storage texture's height. + +Default is `1`. + +## Properties + +### .image : Object + +The image object which just represents the texture's dimension. + +**Overrides:** [Texture#image](Texture.html#image) + +### .isStorageTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .magFilter : number + +The default `magFilter` for storage textures is `THREE.LinearFilter`. + +**Overrides:** [Texture#magFilter](Texture.html#magFilter) + +### .minFilter : number + +The default `minFilter` for storage textures is `THREE.LinearFilter`. + +**Overrides:** [Texture#minFilter](Texture.html#minFilter) + +### .mipmapsAutoUpdate : boolean + +When `true`, mipmaps will be auto-generated after compute writes. When `false`, mipmaps must be written manually via compute shaders. + +Default is `true`. + +## Methods + +### .setSize( width : number, height : number ) + +Sets the size of the storage texture. + +**width** + +The new width of the storage texture. + +**height** + +The new height of the storage texture. + +## Source + +[src/renderers/common/StorageTexture.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/StorageTexture.js) \ No newline at end of file diff --git a/docs/pages/StorageTextureNode.html.md b/docs/pages/StorageTextureNode.html.md new file mode 100644 index 00000000000000..909188288e1876 --- /dev/null +++ b/docs/pages/StorageTextureNode.html.md @@ -0,0 +1,151 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode →* + +# StorageTextureNode + +This special version of a texture node can be used to write data into a storage texture with a compute shader. + +This node can only be used with a WebGPU backend. + +## Code Example + +```js +const storageTexture = new THREE.StorageTexture( width, height ); +const computeTexture = Fn( ( { storageTexture } ) => { + const posX = instanceIndex.mod( width ); + const posY = instanceIndex.div( width ); + const indexUV = uvec2( posX, posY ); + // generate RGB values + const r = 1; + const g = 1; + const b = 1; + textureStore( storageTexture, indexUV, vec4( r, g, b, 1 ) ).toWriteOnly(); +} ); +const computeNode = computeTexture( { storageTexture } ).compute( width * height ); +renderer.computeAsync( computeNode ); +``` + +## Constructor + +### new StorageTextureNode( value : StorageTexture, uvNode : Node.<(vec2|vec3)>, storeNode : Node ) + +Constructs a new storage texture node. + +**value** + +The storage texture. + +**uvNode** + +The uv node. + +**storeNode** + +The value node that should be stored in the texture. + +Default is `null`. + +## Properties + +### .access : string + +The access type of the texture node. + +Default is `'writeOnly'`. + +### .isStorageTextureNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .mipLevel : number + +The mip level to write to for storage textures. + +Default is `0`. + +### .storeNode : Node + +The value node that should be stored in the texture. + +Default is `null`. + +## Methods + +### .generate( builder : NodeBuilder, output : string ) : string + +Generates the code snippet of the storage node. If no `storeNode` is defined, the texture node is generated as normal texture. + +**builder** + +The current node builder. + +**output** + +The current output. + +**Overrides:** [TextureNode#generate](TextureNode.html#generate) + +**Returns:** The generated code snippet. + +### .generateStore( builder : NodeBuilder ) + +Generates the code snippet of the storage texture node. + +**builder** + +The current node builder. + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation to return a fixed value `'storageTexture'`. + +**builder** + +The current node builder. + +**Overrides:** [TextureNode#getInputType](TextureNode.html#getInputType) + +**Returns:** The input type. + +### .setAccess( value : string ) : StorageTextureNode + +Defines the node access. + +**value** + +The node access. + +**Returns:** A reference to this node. + +### .setMipLevel( level : number ) : StorageTextureNode + +Sets the mip level to write to. + +**level** + +The mip level. + +**Returns:** A reference to this node. + +### .toReadOnly() : StorageTextureNode + +Convenience method for configuring a read-only node access. + +**Returns:** A reference to this node. + +### .toReadWrite() : StorageTextureNode + +Convenience method for configuring a read/write node access. + +**Returns:** A reference to this node. + +### .toWriteOnly() : StorageTextureNode + +Convenience method for configuring a write-only node access. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/accessors/StorageTextureNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/StorageTextureNode.js) \ No newline at end of file diff --git a/docs/pages/StringKeyframeTrack.html.md b/docs/pages/StringKeyframeTrack.html.md new file mode 100644 index 00000000000000..ffeab17bf89491 --- /dev/null +++ b/docs/pages/StringKeyframeTrack.html.md @@ -0,0 +1,55 @@ +*Inheritance: KeyframeTrack →* + +# StringKeyframeTrack + +A track for string keyframe values. + +## Constructor + +### new StringKeyframeTrack( name : string, times : Array., values : Array. ) + +Constructs a new string keyframe track. + +This keyframe track type has no `interpolation` parameter because the interpolation is always discrete. + +**name** + +The keyframe track's name. + +**times** + +A list of keyframe times. + +**values** + +A list of keyframe values. + +## Properties + +### .DefaultInterpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth + +The default interpolation type of this keyframe track. + +Default is `InterpolateDiscrete`. + +**Overrides:** [KeyframeTrack#DefaultInterpolation](KeyframeTrack.html#DefaultInterpolation) + +### .ValueBufferType : TypedArray | Array + +The value buffer type of this keyframe track. + +Default is `Array.constructor`. + +**Overrides:** [KeyframeTrack#ValueBufferType](KeyframeTrack.html#ValueBufferType) + +### .ValueTypeName : string + +The value type name. + +Default is `'string'`. + +**Overrides:** [KeyframeTrack#ValueTypeName](KeyframeTrack.html#ValueTypeName) + +## Source + +[src/animation/tracks/StringKeyframeTrack.js](https://github.com/mrdoob/three.js/blob/master/src/animation/tracks/StringKeyframeTrack.js) \ No newline at end of file diff --git a/docs/pages/StructNode.html.md b/docs/pages/StructNode.html.md new file mode 100644 index 00000000000000..95695371c4f821 --- /dev/null +++ b/docs/pages/StructNode.html.md @@ -0,0 +1,27 @@ +*Inheritance: EventDispatcher → Node →* + +# StructNode + +StructNode allows to create custom structures with multiple members. This can also be used to define structures in attribute and uniform data. + +## Code Example + +```js +// Define a custom struct +const BoundingBox = struct( { min: 'vec3', max: 'vec3' } ); +// Create a new instance of the struct +const bb = BoundingBox( vec3( 0 ), vec3( 1 ) ); // style 1 +const bb = BoundingBox( { min: vec3( 0 ), max: vec3( 1 ) } ); // style 2 +// Access the struct members +const min = bb.get( 'min' ); +// Assign a new value to a member +min.assign( vec3() ); +``` + +## Constructor + +### new StructNode() + +## Source + +[src/nodes/core/StructNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/StructNode.js) \ No newline at end of file diff --git a/docs/pages/StructTypeNode.html.md b/docs/pages/StructTypeNode.html.md new file mode 100644 index 00000000000000..47452934eb3f23 --- /dev/null +++ b/docs/pages/StructTypeNode.html.md @@ -0,0 +1,53 @@ +*Inheritance: EventDispatcher → Node →* + +# StructTypeNode + +Represents a struct type node in the node-based system. This class is used to define and manage the layout and types of struct members. It extends the base Node class and provides methods to get the length of the struct, retrieve member types, and generate the struct type for a builder. + +## Constructor + +### new StructTypeNode( membersLayout : Object, name : string ) + +Creates an instance of StructTypeNode. + +**membersLayout** + +The layout of the members for the struct. + +**name** + +The optional name of the struct. + +Default is `null`. + +## Properties + +### .isStructLayoutNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .membersLayout : Array.<{name: string, type: string, atomic: boolean}> + +The layout of the members for the struct + +### .name : string + +The name of the struct. + +Default is `null`. + +**Overrides:** [Node#name](Node.html#name) + +## Methods + +### .getLength() : number + +Returns the length of the struct. The length is calculated by summing the lengths of the struct's members. + +**Returns:** The length of the struct. + +## Source + +[src/nodes/core/StructTypeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/StructTypeNode.js) \ No newline at end of file diff --git a/docs/pages/SubBuildNode.html.md b/docs/pages/SubBuildNode.html.md new file mode 100644 index 00000000000000..fd72732b1b3eb6 --- /dev/null +++ b/docs/pages/SubBuildNode.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Node →* + +# SubBuildNode + +This node is used to build a sub-build in the node system. + +## Constructor + +### new SubBuildNode( node : Node, name : string, nodeType : string ) + +**node** + +The node to be built in the sub-build. + +**name** + +The name of the sub-build. + +**nodeType** + +The type of the node, if known. + +Default is `null`. + +## Properties + +### .isSubBuildNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the sub-build. + +**Overrides:** [Node#name](Node.html#name) + +### .node : Node + +The node to be built in the sub-build. + +## Source + +[src/nodes/core/SubBuildNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/SubBuildNode.js) \ No newline at end of file diff --git a/docs/pages/SubgroupFunctionNode.html.md b/docs/pages/SubgroupFunctionNode.html.md new file mode 100644 index 00000000000000..51d6d4aaea03ef --- /dev/null +++ b/docs/pages/SubgroupFunctionNode.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# SubgroupFunctionNode + +This class represents a set of built in WGSL shader functions that sync synchronously execute an operation across a subgroup, or 'warp', of compute or fragment shader invocations within a workgroup. Typically, these functions will synchronously execute an operation using data from all active invocations within the subgroup, then broadcast that result to all active invocations. In other graphics APIs, subgroup functions are also referred to as wave intrinsics (DirectX/HLSL) or warp intrinsics (CUDA). + +## Constructor + +### new SubgroupFunctionNode( method : string, aNode : Node, bNode : Node ) + +Constructs a new function node. + +**method** + +The subgroup/wave intrinsic method to construct. + +**aNode** + +The method's first argument. + +Default is `null`. + +**bNode** + +The method's second argument. + +Default is `null`. + +## Properties + +### .aNode : Node + +The method's first argument. + +### .bNode : Node + +The method's second argument. + +### .method : string + +The subgroup/wave intrinsic method to construct. + +## Source + +[src/nodes/gpgpu/SubgroupFunctionNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/gpgpu/SubgroupFunctionNode.js) \ No newline at end of file diff --git a/docs/pages/TAARenderPass.html.md b/docs/pages/TAARenderPass.html.md new file mode 100644 index 00000000000000..33ce5b1fa5cb86 --- /dev/null +++ b/docs/pages/TAARenderPass.html.md @@ -0,0 +1,111 @@ +*Inheritance: Pass → SSAARenderPass →* + +# TAARenderPass + +Temporal Anti-Aliasing Render Pass. + +When there is no motion in the scene, the TAA render pass accumulates jittered camera samples across frames to create a high quality anti-aliased result. + +Note: This effect uses no reprojection so it is no TRAA implementation. + +## Code Example + +```js +const taaRenderPass = new TAARenderPass( scene, camera ); +taaRenderPass.unbiased = false; +composer.addPass( taaRenderPass ); +``` + +## Import + +TAARenderPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; +``` + +## Constructor + +### new TAARenderPass( scene : Scene, camera : Camera, clearColor : number | Color | string, clearAlpha : number ) + +Constructs a new TAA render pass. + +**scene** + +The scene to render. + +**camera** + +The camera. + +**clearColor** + +The clear color of the render pass. + +Default is `0x000000`. + +**clearAlpha** + +The clear alpha of the render pass. + +Default is `0`. + +## Properties + +### .accumulate : boolean + +Whether to accumulate frames or not. This enables the TAA. + +Default is `false`. + +### .accumulateIndex : number + +The accumulation index. + +Default is `-1`. + +### .sampleLevel : number + +Overwritten and set to 0 by default. + +Default is `0`. + +**Overrides:** [SSAARenderPass#sampleLevel](SSAARenderPass.html#sampleLevel) + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [SSAARenderPass#dispose](SSAARenderPass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the TAA render pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [SSAARenderPass#render](SSAARenderPass.html#render) + +## Source + +[examples/jsm/postprocessing/TAARenderPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/TAARenderPass.js) \ No newline at end of file diff --git a/docs/pages/TDSLoader.html.md b/docs/pages/TDSLoader.html.md new file mode 100644 index 00000000000000..eaf7da974d75e9 --- /dev/null +++ b/docs/pages/TDSLoader.html.md @@ -0,0 +1,86 @@ +*Inheritance: Loader →* + +# TDSLoader + +A loader for the 3DS format, based on lib3ds. + +Loads geometry with uv and materials basic properties with texture support. + +## Code Example + +```js +const loader = new TDSLoader(); +loader.setResourcePath( 'models/3ds/portalgun/textures/' ); +const object = await loader.loadAsync( 'models/3ds/portalgun/portalgun.3ds' ); +scene.add( object ); +``` + +## Import + +TDSLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TDSLoader } from 'three/addons/loaders/TDSLoader.js'; +``` + +## Constructor + +### new TDSLoader( manager : LoadingManager ) + +Constructs a new 3DS loader. + +**manager** + +The loading manager. + +## Properties + +### .debug : boolean + +Whether debug mode should be enabled or not. + +Default is `false`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded 3DS asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( arraybuffer : ArrayBuffer, path : string ) : Group + +Parses the given 3DS data and returns the resulting data. + +**arraybuffer** + +The raw 3DS data as an array buffer. + +**path** + +The asset path. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed asset represented as a group. + +## Source + +[examples/jsm/loaders/TDSLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/TDSLoader.js) \ No newline at end of file diff --git a/docs/pages/TGALoader.html.md b/docs/pages/TGALoader.html.md new file mode 100644 index 00000000000000..4edce3a78d229e --- /dev/null +++ b/docs/pages/TGALoader.html.md @@ -0,0 +1,49 @@ +*Inheritance: Loader → DataTextureLoader →* + +# TGALoader + +A loader for the TGA texture format. + +## Code Example + +```js +const loader = new TGALoader(); +const texture = await loader.loadAsync( 'textures/crate_color8.tga' ); +texture.colorSpace = THREE.SRGBColorSpace; // only for color textures +``` + +## Import + +TGALoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TGALoader } from 'three/addons/loaders/TGALoader.js'; +``` + +## Constructor + +### new TGALoader( manager : LoadingManager ) + +Constructs a new TGA loader. + +**manager** + +The loading manager. + +## Methods + +### .parse( buffer : ArrayBuffer ) : DataTextureLoader~TexData + +Parses the given TGA texture data. + +**buffer** + +The raw texture data. + +**Overrides:** [DataTextureLoader#parse](DataTextureLoader.html#parse) + +**Returns:** An object representing the parsed texture data. + +## Source + +[examples/jsm/loaders/TGALoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/TGALoader.js) \ No newline at end of file diff --git a/docs/pages/TIFFLoader.html.md b/docs/pages/TIFFLoader.html.md new file mode 100644 index 00000000000000..3dded68f97ff03 --- /dev/null +++ b/docs/pages/TIFFLoader.html.md @@ -0,0 +1,49 @@ +*Inheritance: Loader → DataTextureLoader →* + +# TIFFLoader + +A loader for the TIFF texture format. + +## Code Example + +```js +const loader = new TIFFLoader(); +const texture = await loader.loadAsync( 'textures/tiff/crate_lzw.tif' ); +texture.colorSpace = THREE.SRGBColorSpace; +``` + +## Import + +TIFFLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TIFFLoader } from 'three/addons/loaders/TIFFLoader.js'; +``` + +## Constructor + +### new TIFFLoader( manager : LoadingManager ) + +Constructs a new TIFF loader. + +**manager** + +The loading manager. + +## Methods + +### .parse( buffer : ArrayBuffer ) : DataTextureLoader~TexData + +Parses the given TIFF texture data. + +**buffer** + +The raw texture data. + +**Overrides:** [DataTextureLoader#parse](DataTextureLoader.html#parse) + +**Returns:** An object representing the parsed texture data. + +## Source + +[examples/jsm/loaders/TIFFLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/TIFFLoader.js) \ No newline at end of file diff --git a/docs/pages/TRAANode.html.md b/docs/pages/TRAANode.html.md new file mode 100644 index 00000000000000..3e2743abbb7799 --- /dev/null +++ b/docs/pages/TRAANode.html.md @@ -0,0 +1,162 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# TRAANode + +A special node that applies TRAA (Temporal Reprojection Anti-Aliasing). + +References: + +* [https://alextardif.com/TAA.html](https://alextardif.com/TAA.html) +* [https://www.elopezr.com/temporal-aa-and-the-quest-for-the-holy-trail/](https://www.elopezr.com/temporal-aa-and-the-quest-for-the-holy-trail/) + +## Import + +TRAANode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { traa } from 'three/addons/tsl/display/TRAANode.js'; +``` + +## Constructor + +### new TRAANode( beautyNode : TextureNode, depthNode : TextureNode, velocityNode : TextureNode, camera : Camera ) + +Constructs a new TRAA node. + +**beautyNode** + +The texture node that represents the input of the effect. + +**depthNode** + +A node that represents the scene's depth. + +**velocityNode** + +A node that represents the scene's velocity. + +**camera** + +The camera the scene is rendered with. + +## Properties + +### .beautyNode : TextureNode + +The texture node that represents the input of the effect. + +### .camera : Camera + +The camera the scene is rendered with. + +### .depthNode : TextureNode + +A node that represents the scene's velocity. + +### .depthThreshold : number + +When the difference between the current and previous depth goes above this threshold, the history is considered invalid. + +Default is `0.0005`. + +### .edgeDepthDiff : number + +The depth difference within the 3×3 neighborhood to consider a pixel as an edge. + +Default is `0.001`. + +### .isTRAANode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .maxVelocityLength : number + +The history becomes invalid as the pixel length of the velocity approaches this value. + +Default is `128`. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders its effect once per frame in `updateBefore()`. + +Default is `'frame'`. + +**Overrides:** [TempNode#updateBeforeType](TempNode.html#updateBeforeType) + +### .useSubpixelCorrection : boolean + +Whether to decrease the weight on the current frame when the velocity is more subpixel. This reduces blurriness under motion, but can introduce a square pattern artifact. + +Default is `true`. + +### .velocityNode : TextureNode + +A node that represents the scene's velocity. + +## Methods + +### .clearViewOffset() + +Clears the view offset from the scene's camera. + +### .dispose() + +Frees internal resources. This method should be called when the effect is no longer required. + +**Overrides:** [TempNode#dispose](TempNode.html#dispose) + +### .getTextureNode() : PassTextureNode + +Returns the result of the effect as a texture node. + +**Returns:** A texture node that represents the result of the effect. + +### .setSize( width : number, height : number ) + +Sets the size of the effect. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setViewOffset( width : number, height : number ) + +Defines the TRAA's current jitter as a view offset to the scene's camera. + +**width** + +The width of the effect. + +**height** + +The height of the effect. + +### .setup( builder : NodeBuilder ) : PassTextureNode + +This method is used to setup the effect's render targets and TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +### .updateBefore( frame : NodeFrame ) + +This method is used to render the effect once per frame. + +**frame** + +The current node frame. + +**Overrides:** [TempNode#updateBefore](TempNode.html#updateBefore) + +## Source + +[examples/jsm/tsl/display/TRAANode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/TRAANode.js) \ No newline at end of file diff --git a/docs/pages/TSL.html.md b/docs/pages/TSL.html.md new file mode 100644 index 00000000000000..aa6e04bec9c87c --- /dev/null +++ b/docs/pages/TSL.html.md @@ -0,0 +1,6292 @@ +# TSL + +## Properties + +### .EPSILON : Node. (constant) + +A small value used to handle floating-point precision errors. + +### .HALF_PI : Node. (constant) + +Represents PI / 2. + +### .INFINITY : Node. (constant) + +Represents infinity. + +### .PI : Node. (constant) + +Represents PI. + +### .PI2 : Node. (constant) + +Represents PI \* 2. Please use the non-deprecated version `TWO_PI`. + +**Deprecated:** Yes + +### .TBNViewMatrix : Node. (constant) + +TSL object that represents the TBN matrix in view space. + +### .TWO_PI : Node. (constant) + +Represents PI \* 2. + +### .alphaT : PropertyNode. (constant) + +TSL object that represents the shader variable `AlphaT`. + +### .anisotropy : PropertyNode. (constant) + +TSL object that represents the shader variable `Anisotropy`. + +### .anisotropyB : PropertyNode. (constant) + +TSL object that represents the shader variable `AnisotropyB`. + +### .anisotropyT : PropertyNode. (constant) + +TSL object that represents the shader variable `AnisotropyT`. + +### .attenuationColor : PropertyNode. (constant) + +TSL object that represents the shader variable `AttenuationColor`. + +### .attenuationDistance : PropertyNode. (constant) + +TSL object that represents the shader variable `AttenuationDistance`. + +### .backgroundBlurriness : SceneNode (constant) + +TSL object that represents the scene's background blurriness. + +### .backgroundIntensity : SceneNode (constant) + +TSL object that represents the scene's background intensity. + +### .backgroundRotation : SceneNode (constant) + +TSL object that represents the scene's background rotation. + +### .bitangentGeometry : Node. (constant) + +TSL object that represents the bitangent attribute of the current rendered object. + +### .bitangentLocal : Node. (constant) + +TSL object that represents the vertex bitangent in local space of the current rendered object. + +### .bitangentView : Node. (constant) + +TSL object that represents the vertex bitangent in view space of the current rendered object. + +### .bitangentViewFrame : Node. (constant) + +Bitangent vector in view space, computed dynamically from geometry and UV derivatives. Complements the tangentViewFrame for constructing the tangent space basis. + +Reference: http://www.thetenthplanet.de/archives/1180 + +### .bitangentWorld : Node. (constant) + +TSL object that represents the vertex bitangent in world space of the current rendered object. + +### .cameraFar : UniformNode. (constant) + +TSL object that represents the `far` value of the camera used for the current render. + +### .cameraIndex : UniformNode. (constant) + +TSL object that represents the current `index` value of the camera if used ArrayCamera. + +### .cameraNear : UniformNode. (constant) + +TSL object that represents the `near` value of the camera used for the current render. + +### .cameraNormalMatrix : UniformNode. (constant) + +TSL object that represents the normal matrix of the camera used for the current render. + +### .cameraPosition : UniformNode. (constant) + +TSL object that represents the position in world space of the camera used for the current render. + +### .cameraProjectionMatrix : UniformNode. (constant) + +TSL object that represents the projection matrix of the camera used for the current render. + +### .cameraProjectionMatrixInverse : UniformNode. (constant) + +TSL object that represents the inverse projection matrix of the camera used for the current render. + +### .cameraViewMatrix : UniformNode. (constant) + +TSL object that represents the view matrix of the camera used for the current render. + +### .cameraViewport : UniformNode. (constant) + +TSL object that represents the viewport of the camera used for the current render. + +### .cameraWorldMatrix : UniformNode. (constant) + +TSL object that represents the world matrix of the camera used for the current render. + +### .clearcoat : PropertyNode. (constant) + +TSL object that represents the shader variable `Clearcoat`. + +### .clearcoatNormalView : Node. (constant) + +TSL object that represents the clearcoat vertex normal of the current rendered object in view space. + +### .clearcoatRoughness : PropertyNode. (constant) + +TSL object that represents the shader variable `ClearcoatRoughness`. + +### .clipSpace : VaryingNode. (constant) + +TSL object that represents the clip space position of the current rendered object. + +### .dashSize : PropertyNode. (constant) + +TSL object that represents the shader variable `dashSize`. + +### .deltaTime : UniformNode. (constant) + +Represents the delta time in seconds. + +### .depth : ViewportDepthNode (constant) + +TSL object that represents the depth value for the current fragment. + +### .diffuseColor : PropertyNode. (constant) + +TSL object that represents the shader variable `DiffuseColor`. + +### .diffuseContribution : PropertyNode. (constant) + +TSL object that represents the shader variable `DiffuseContribution`. + +### .directionToFaceDirection (constant) + +Converts a direction vector to a face direction vector based on the material's side. + +If the material is set to `BackSide`, the direction is inverted. If the material is set to `DoubleSide`, the direction is multiplied by `faceDirection`. + +### .dispersion : PropertyNode. (constant) + +TSL object that represents the shader variable `Dispersion`. + +### .drawIndex : IndexNode (constant) + +TSL object that represents the index of a draw call. + +### .emissive : PropertyNode. (constant) + +TSL object that represents the shader variable `EmissiveColor`. + +### .faceDirection : Node. (constant) + +TSL object that represents the front facing status as a number instead of a bool. `1` means front facing, `-1` means back facing. + +### .frameGroup : UniformGroupNode (constant) + +TSL object that represents a shared uniform group node which is updated once per frame. + +### .frameId : UniformNode. (constant) + +Represents the current frame ID. + +### .frontFacing : FrontFacingNode. (constant) + +TSL object that represents whether a primitive is front or back facing + +### .gapSize : PropertyNode. (constant) + +TSL object that represents the shader variable `gapSize`. + +### .globalId : ComputeBuiltinNode. (constant) + +A non-linearized 3-dimensional representation of the current invocation's position within a 3D global grid. + +### .highpModelNormalViewMatrix : Node. (constant) + +TSL object that represents the object's model normal view in `highp` precision which is achieved by computing the matrix in JS and not in the shader. + +### .highpModelViewMatrix : Node. (constant) + +TSL object that represents the object's model view in `highp` precision which is achieved by computing the matrix in JS and not in the shader. + +### .instanceIndex : IndexNode (constant) + +TSL object that represents the index of either a mesh instance or an invocation of a compute shader. + +### .invocationLocalIndex : IndexNode (constant) + +TSL object that represents the index of a compute invocation within the scope of a workgroup load. + +### .invocationSubgroupIndex : IndexNode (constant) + +TSL object that represents the index of a compute invocation within the scope of a subgroup. + +### .ior : PropertyNode. (constant) + +TSL object that represents the shader variable `IOR`. + +### .iridescence : PropertyNode. (constant) + +TSL object that represents the shader variable `Iridescence`. + +### .iridescenceIOR : PropertyNode. (constant) + +TSL object that represents the shader variable `IridescenceIOR`. + +### .iridescenceThickness : PropertyNode. (constant) + +TSL object that represents the shader variable `IridescenceThickness`. + +### .localId : ComputeBuiltinNode. (constant) + +A non-linearized 3-dimensional representation of the current invocation's position within a 3D workgroup grid. + +### .materialAO : Node. (constant) + +TSL object that represents the ambient occlusion map of the current material. The value is composed via `aoMap.r` - 1 \* `aoMapIntensity` + 1. + +### .materialAlphaTest : Node. (constant) + +TSL object that represents alpha test of the current material. + +### .materialAnisotropy : Node. (constant) + +TSL object that represents the anisotropy of the current material. + +### .materialAnisotropyVector : Node. (constant) + +TSL object that represents the anisotropy vector of the current material. + +### .materialAttenuationColor : Node. (constant) + +TSL object that represents the attenuation color of the current material. + +### .materialAttenuationDistance : Node. (constant) + +TSL object that represents the attenuation distance of the current material. + +### .materialClearcoat : Node. (constant) + +TSL object that represents the clearcoat of the current material. The value is composed via `clearcoat` \* `clearcoatMap.r` + +### .materialClearcoatNormal : Node. (constant) + +TSL object that represents the clearcoat normal of the current material. The value will be either `clearcoatNormalMap` or `normalView`. + +### .materialClearcoatRoughness : Node. (constant) + +TSL object that represents the clearcoat roughness of the current material. The value is composed via `clearcoatRoughness` \* `clearcoatRoughnessMap.r`. + +### .materialColor : Node. (constant) + +TSL object that represents the diffuse color of the current material. The value is composed via `color` \* `map`. + +### .materialDispersion : Node. (constant) + +TSL object that represents the dispersion of the current material. + +### .materialEmissive : Node. (constant) + +TSL object that represents the emissive color of the current material. The value is composed via `emissive` \* `emissiveIntensity` \* `emissiveMap`. + +### .materialEnvIntensity : Node. (constant) + +TSL object that represents the intensity of environment maps of PBR materials. When `material.envMap` is set, the value is `material.envMapIntensity` otherwise `scene.environmentIntensity`. + +### .materialEnvRotation : Node. (constant) + +TSL object that represents the rotation of environment maps. When `material.envMap` is set, the value is `material.envMapRotation`. `scene.environmentRotation` controls the rotation of `scene.environment` instead. + +### .materialIOR : Node. (constant) + +TSL object that represents the IOR of the current material. + +### .materialIridescence : Node. (constant) + +TSL object that represents the iridescence of the current material. + +### .materialIridescenceIOR : Node. (constant) + +TSL object that represents the iridescence IOR of the current material. + +### .materialIridescenceThickness : Node. (constant) + +TSL object that represents the iridescence thickness of the current material. + +### .materialLightMap : Node. (constant) + +TSL object that represents the light map of the current material. The value is composed via `lightMapIntensity` \* `lightMap.rgb`. + +### .materialLineDashOffset : Node. (constant) + +TSL object that represents the dash offset of the current line material. + +### .materialLineDashSize : Node. (constant) + +TSL object that represents the dash size of the current dashed line material. + +### .materialLineGapSize : Node. (constant) + +TSL object that represents the gap size of the current dashed line material. + +### .materialLineScale : Node. (constant) + +TSL object that represents the scale of the current dashed line material. + +### .materialLineWidth : Node. (constant) + +TSL object that represents the line width of the current line material. + +### .materialMetalness : Node. (constant) + +TSL object that represents the metalness of the current material. The value is composed via `metalness` \* `metalnessMap.b`. + +### .materialNormal : Node. (constant) + +TSL object that represents the normal of the current material. The value will be either `normalMap` \* `normalScale`, `bumpMap` \* `bumpScale` or `normalView`. + +### .materialOpacity : Node. (constant) + +TSL object that represents the opacity of the current material. The value is composed via `opacity` \* `alphaMap`. + +### .materialPointSize : Node. (constant) + +TSL object that represents the point size of the current points material. + +### .materialReflectivity : Node. (constant) + +TSL object that represents the reflectivity of the current material. + +### .materialRefractionRatio : UniformNode. (constant) + +TSL object that represents the refraction ratio of the material used for rendering the current object. + +### .materialRotation : Node. (constant) + +TSL object that represents the rotation of the current sprite material. + +### .materialRoughness : Node. (constant) + +TSL object that represents the roughness of the current material. The value is composed via `roughness` \* `roughnessMap.g`. + +### .materialSheen : Node. (constant) + +TSL object that represents the sheen color of the current material. The value is composed via `sheen` \* `sheenColor` \* `sheenColorMap`. + +### .materialSheenRoughness : Node. (constant) + +TSL object that represents the sheen roughness of the current material. The value is composed via `sheenRoughness` \* `sheenRoughnessMap.a`. + +### .materialShininess : Node. (constant) + +TSL object that represents the shininess of the current material. + +### .materialSpecular : Node. (constant) + +TSL object that represents the specular of the current material. + +### .materialSpecularColor : Node. (constant) + +TSL object that represents the specular color of the current material. The value is composed via `specularColor` \* `specularMap.rgb`. + +### .materialSpecularIntensity : Node. (constant) + +TSL object that represents the specular intensity of the current material. The value is composed via `specularIntensity` \* `specularMap.a`. + +### .materialSpecularStrength : Node. (constant) + +TSL object that represents the specular strength of the current material. The value is composed via `specularMap.r`. + +### .materialThickness : Node. (constant) + +TSL object that represents the thickness of the current material. The value is composed via `thickness` \* `thicknessMap.g`. + +### .materialTransmission : Node. (constant) + +TSL object that represents the transmission of the current material. The value is composed via `transmission` \* `transmissionMap.r`. + +### .mediumpModelViewMatrix : Node. (constant) + +TSL object that represents the object's model view in `mediump` precision. + +### .metalness : PropertyNode. (constant) + +TSL object that represents the shader variable `Metalness`. + +### .modelDirection : ModelNode. (constant) + +TSL object that represents the object's direction in world space. + +### .modelNormalMatrix : UniformNode. (constant) + +TSL object that represents the object's normal matrix. + +### .modelPosition : ModelNode. (constant) + +TSL object that represents the object's position in world space. + +### .modelRadius : ModelNode. (constant) + +TSL object that represents the object's radius. + +### .modelScale : ModelNode. (constant) + +TSL object that represents the object's scale in world space. + +### .modelViewMatrix : Node. (constant) + +TSL object that represents the object's model view matrix. + +### .modelViewPosition : ModelNode. (constant) + +TSL object that represents the object's position in view/camera space. + +### .modelViewProjection : VaryingNode. (constant) + +TSL object that represents the position in clip space after the model-view-projection transform of the current rendered object. + +### .modelWorldMatrix : ModelNode. (constant) + +TSL object that represents the object's world matrix. + +### .modelWorldMatrixInverse : UniformNode. (constant) + +TSL object that represents the object's inverse world matrix. + +### .normalFlat : Node. (constant) + +TSL object that represents the flat vertex normal of the current rendered object in view space. + +### .normalGeometry : Node. (constant) + +TSL object that represents the normal attribute of the current rendered object in local space. + +### .normalLocal : Node. (constant) + +TSL object that represents the vertex normal of the current rendered object in local space. + +### .normalView : Node. (constant) + +TSL object that represents the vertex normal of the current rendered object in view space. + +### .normalViewGeometry : Node. (constant) + +TSL object that represents the vertex normal of the current rendered object in view space. + +### .normalWorld : Node. (constant) + +TSL object that represents the vertex normal of the current rendered object in world space. + +### .normalWorldGeometry : Node. (constant) + +TSL object that represents the vertex normal of the current rendered object in world space. + +### .numWorkgroups : ComputeBuiltinNode. (constant) + +Represents the number of workgroups dispatched by the compute shader. + +```js +// Run 512 invocations/threads with a workgroup size of 128. +const computeFn = Fn(() => { + // numWorkgroups.x = 4 + storageBuffer.element(0).assign(numWorkgroups.x) +})().compute(512, [128]); +// Run 512 invocations/threads with the default workgroup size of 64. +const computeFn = Fn(() => { + // numWorkgroups.x = 8 + storageBuffer.element(0).assign(numWorkgroups.x) +})().compute(512); +``` + +### .objectGroup : UniformGroupNode (constant) + +TSL object that represents a uniform group node which is updated once per object. + +### .output : PropertyNode. (constant) + +TSL object that represents the shader variable `Output`. + +### .parallaxDirection : Node. (constant) + +TSL object that represents the parallax direction. + +### .pointUV : PointUVNode (constant) + +TSL object that represents the uv coordinates of points. + +### .pointWidth : PropertyNode. (constant) + +TSL object that represents the shader variable `pointWidth`. + +### .positionGeometry : AttributeNode. (constant) + +TSL object that represents the position attribute of the current rendered object. + +### .positionLocal : AttributeNode. (constant) + +TSL object that represents the vertex position in local space of the current rendered object. + +### .positionPrevious : AttributeNode. (constant) + +TSL object that represents the previous vertex position in local space of the current rendered object. Used in context of [VelocityNode](VelocityNode.html) for rendering motion vectors. + +### .positionView : VaryingNode. (constant) + +TSL object that represents the vertex position in view space of the current rendered object. + +### .positionViewDirection : VaryingNode. (constant) + +TSL object that represents the position view direction of the current rendered object. + +### .positionWorld : VaryingNode. (constant) + +TSL object that represents the vertex position in world space of the current rendered object. + +### .positionWorldDirection : Node. (constant) + +TSL object that represents the position world direction of the current rendered object. + +### .reflectVector : Node. (constant) + +Used for sampling cube maps when using cube reflection mapping. + +### .reflectView : Node. (constant) + +The reflect vector in view space. + +### .refractVector : Node. (constant) + +Used for sampling cube maps when using cube refraction mapping. + +### .refractView : Node. (constant) + +The refract vector in view space. + +### .renderGroup : UniformGroupNode (constant) + +TSL object that represents a shared uniform group node which is updated once per render. + +### .roughness : PropertyNode. (constant) + +TSL object that represents the shader variable `Roughness`. + +### .screenCoordinate : ScreenNode. (constant) + +TSL object that represents the current `x`/`y` pixel position on the screen in physical pixel units. + +### .screenDPR : ScreenNode. (constant) + +TSL object that represents the current DPR. + +### .screenSize : ScreenNode. (constant) + +TSL object that represents the screen resolution in physical pixel units. + +### .screenUV : ScreenNode. (constant) + +TSL object that represents normalized screen coordinates, unitless in `[0, 1]`. + +### .shadowPositionWorld : Node. (constant) + +TSL object that represents the vertex position in world space during the shadow pass. + +### .sheen : PropertyNode. (constant) + +TSL object that represents the shader variable `Sheen`. + +### .sheenRoughness : PropertyNode. (constant) + +TSL object that represents the shader variable `SheenRoughness`. + +### .shininess : PropertyNode. (constant) + +TSL object that represents the shader variable `Shininess`. + +### .specularColor : PropertyNode. (constant) + +TSL object that represents the shader variable `SpecularColor`. + +### .specularColorBlended : PropertyNode. (constant) + +TSL object that represents the shader variable `SpecularColorBlended`. + +### .specularF90 : PropertyNode. (constant) + +TSL object that represents the shader variable `SpecularF90`. + +### .subgroupIndex : IndexNode (constant) + +TSL object that represents the index of the subgroup the current compute invocation belongs to. + +### .subgroupSize : ComputeBuiltinNode. (constant) + +A device dependent variable that exposes the size of the current invocation's subgroup. + +### .tangentGeometry : Node. (constant) + +TSL object that represents the tangent attribute of the current rendered object. + +### .tangentLocal : Node. (constant) + +TSL object that represents the vertex tangent in local space of the current rendered object. + +### .tangentView : Node. (constant) + +TSL object that represents the vertex tangent in view space of the current rendered object. + +### .tangentViewFrame : Node. (constant) + +Tangent vector in view space, computed dynamically from geometry and UV derivatives. Useful for normal mapping without precomputed tangents. + +Reference: http://www.thetenthplanet.de/archives/1180 + +### .tangentWorld : Node. (constant) + +TSL object that represents the vertex tangent in world space of the current rendered object. + +### .thickness : PropertyNode. (constant) + +TSL object that represents the shader variable `Thickness`. + +### .time : UniformNode. (constant) + +Represents the elapsed time in seconds. + +### .toneMappingExposure : RendererReferenceNode. (constant) + +TSL object that represents the global tone mapping exposure of the renderer. + +### .transformedClearcoatNormalView : Node. (constant) + +TSL object that represents the transformed clearcoat vertex normal of the current rendered object in view space. + +**Deprecated:** since r178. Use \`clearcoatNormalView\` instead. + +### .transformedNormalView : Node. (constant) + +TSL object that represents the transformed vertex normal of the current rendered object in view space. + +**Deprecated:** since r178. Use \`normalView\` instead. + +### .transformedNormalWorld : Node. (constant) + +TSL object that represents the transformed vertex normal of the current rendered object in world space. + +**Deprecated:** since r178. Use \`normalWorld\` instead. + +### .transmission : PropertyNode. (constant) + +TSL object that represents the shader variable `Transmission`. + +### .velocity : VelocityNode (constant) + +TSL object that represents the velocity of a render pass. + +### .vertexIndex : IndexNode (constant) + +TSL object that represents the index of a vertex within a mesh. + +### .viewport : ScreenNode. (constant) + +TSL object that represents the viewport rectangle as `x`, `y`, `width` and `height` in physical pixel units. + +### .viewportCoordinate : ScreenNode. (constant) + +TSL object that represents the current `x`/`y` pixel position on the viewport in physical pixel units. + +### .viewportLinearDepth : ViewportDepthNode (constant) + +TSL object that represents the linear (orthographic) depth value of the current fragment + +### .viewportSize : ScreenNode. (constant) + +TSL object that represents the viewport resolution in physical pixel units. + +### .viewportUV : ScreenNode. (constant) + +TSL object that represents normalized viewport coordinates, unitless in `[0, 1]`. + +### .workgroupId : ComputeBuiltinNode. (constant) + +Represents the 3-dimensional index of the workgroup the current compute invocation belongs to. + +```js +// Execute 12 compute threads with a workgroup size of 3. +const computeFn = Fn( () => { + If( workgroupId.x.mod( 2 ).equal( 0 ), () => { + storageBuffer.element( instanceIndex ).assign( instanceIndex ); + } ).Else( () => { + storageBuffer.element( instanceIndex ).assign( 0 ); + } ); +} )().compute( 12, [ 3 ] ); +// workgroupId.x = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3]; +// Buffer Output = [0, 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0]; +``` + +## Methods + +### .Break() : ExpressionNode + +TSL function for creating a `Break()` expression. + +### .Const( node : Node, name : string ) : VarNode + +TSL function for creating a const node. + +**node** + +The node for which a constant should be created. + +**name** + +The name of the constant in the shader. + +### .Continue() : ExpressionNode + +TSL function for creating a `Continue()` expression. + +### .Discard( conditional : ConditionalNode ) : Node + +Represents a `discard` shader operation in TSL. + +**conditional** + +An optional conditional node. It allows to decide whether the discard should be executed or not. + +**Returns:** The `discard` expression. + +### .If( …params : any ) : StackNode + +Represent a conditional node using if/else statements. + +```js +If( condition, function ) + .ElseIf( condition, function ) + .Else( function ) +``` + +**params** + +The parameters for the conditional node. + +**Returns:** The conditional node. + +### .Loop( …params : any ) : LoopNode + +TSL function for creating a loop node. + +**params** + +A list of parameters. + +### .Return() : ExpressionNode + +Represents a `return` shader operation in TSL. + +**Returns:** The `return` expression. + +### .Switch( …params : any ) : StackNode + +Represent a conditional node using switch/case statements. + +```js +Switch( value ) + .Case( 1, function ) + .Case( 2, 3, 4, function ) + .Default( function ) +``` + +**params** + +The parameters for the conditional node. + +**Returns:** The conditional node. + +### .Var( node : Node, name : string ) : VarNode + +TSL function for creating a var node. + +**node** + +The node for which a variable should be created. + +**name** + +The name of the variable in the shader. + +### .VarIntent( node : Node, name : string ) : VarNode + +TSL function for creating a var intent node. + +**node** + +The node for which a variable should be created. + +**name** + +The name of the variable in the shader. + +### .abs( x : Node | number ) : Node + +Returns the absolute value of the parameter. + +**x** + +The parameter. + +### .acesFilmicToneMapping( color : Node., exposure : Node. ) : Node. + +ACESFilmic tone mapping. + +Reference: [https://github.com/selfshadow/ltc\_code/blob/master/webgl/shaders/ltc/ltc\_blit.fs](https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs) + +**color** + +The color that should be tone mapped. + +**exposure** + +The exposure. + +**Returns:** The tone mapped color. + +### .acos( x : Node | number ) : Node + +Returns the arccosine of the parameter. + +**x** + +The parameter. + +### .add( a : Node, b : Node, …params : Node ) : OperatorNode + +Returns the addition of two or more value. + +**a** + +The first input. + +**b** + +The second input. + +**params** + +Additional input parameters. + +### .afterImage( node : Node., damp : Node. | number ) : AfterImageNode + +TSL function for creating an after image node for post processing. + +**node** + +The node that represents the input of the effect. + +**damp** + +The damping intensity. A higher value means a stronger after image effect. + +Default is `0.96`. + +### .agxToneMapping( color : Node., exposure : Node. ) : Node. + +AgX tone mapping. + +**color** + +The color that should be tone mapped. + +**exposure** + +The exposure. + +**Returns:** The tone mapped color. + +### .all( x : Node | number ) : Node. + +Returns `true` if all components of `x` are `true`. + +**x** + +The parameter. + +### .anaglyphPass( scene : Scene, camera : Camera ) : AnaglyphPassNode + +TSL function for creating an anaglyph pass node. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +### .anamorphic( node : TextureNode, threshold : Node. | number, scale : Node. | number, samples : number ) : AnamorphicNode + +TSL function for creating an anamorphic flare effect. + +**node** + +The node that represents the input of the effect. + +**threshold** + +The threshold is one option to control the intensity and size of the effect. + +Default is `0.9`. + +**scale** + +Defines the vertical scale of the flares. + +Default is `3`. + +**samples** + +More samples result in larger flares and a more expensive runtime behavior. + +Default is `32`. + +### .and( …nodes : Node ) : OperatorNode + +Performs a logical AND operation on multiple nodes. + +**nodes** + +The input nodes to be combined using AND. + +### .any( x : Node | number ) : Node. + +Returns `true` if any components of `x` are `true`. + +**x** + +The parameter. + +### .ao( depthNode : Node., normalNode : Node., camera : Camera ) : GTAONode + +TSL function for creating a Ground Truth Ambient Occlusion (GTAO) effect. + +**depthNode** + +A node that represents the scene's depth. + +**normalNode** + +A node that represents the scene's normals. + +**camera** + +The camera the scene is rendered with. + +### .append( node : Node ) : function + +**node** + +The node to add. + +**Deprecated:** since r176. Use [Stack](global.html#Stack) instead. + +### .array( nodeTypeOrValues : string | Array., count : number ) : ArrayNode + +TSL function for creating an array node. + +**nodeTypeOrValues** + +A string representing the element type (e.g., 'vec3') or an array containing the default values (e.g., \[ vec3() \]). + +**count** + +Size of the array. + +### .asin( x : Node | number ) : Node + +Returns the arcsine of the parameter. + +**x** + +The parameter. + +### .assign( targetNode : Node, sourceNode : Node ) : AssignNode + +TSL function for creating an assign node. + +**targetNode** + +The target node. + +**sourceNode** + +The source type. + +### .atan( y : Node | number, x : Node | number ) : Node + +Returns the arc-tangent of the parameter. If two parameters are provided, the result is `atan2(y/x)`. + +**y** + +The y parameter. + +**x** + +The x parameter. + +### .atomicAdd( pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +Increments the value stored in the atomic variable. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicAnd( pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +Stores in an atomic variable the bitwise AND of its value with a parameter. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicFunc( method : string, pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +TSL function for appending an atomic function call into the programmatic flow of a compute shader. + +**method** + +The signature of the atomic function to construct. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicLoad( pointerNode : Node ) : AtomicFunctionNode + +Loads the value stored in the atomic variable. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +### .atomicMax( pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +Stores in an atomic variable the maximum between its current value and a parameter. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicMin( pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +Stores in an atomic variable the minimum between its current value and a parameter. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicNode( method : string, pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +TSL function for creating an atomic function node. + +**method** + +The signature of the atomic function to construct. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicOr( pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +Stores in an atomic variable the bitwise OR of its value with a parameter. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicStore( pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +Stores a value in the atomic variable. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicSub( pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +Decrements the value stored in the atomic variable. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .atomicXor( pointerNode : Node, valueNode : Node ) : AtomicFunctionNode + +Stores in an atomic variable the bitwise XOR of its value with a parameter. + +**pointerNode** + +An atomic variable or element of an atomic buffer. + +**valueNode** + +The value that mutates the atomic variable. + +### .attribute( name : string, nodeType : string ) : AttributeNode + +TSL function for creating an attribute node. + +**name** + +The name of the attribute. + +**nodeType** + +The node type. + +Default is `null`. + +### .attributeArray( count : number | TypedArray, type : string | Struct ) : StorageBufferNode + +TSL function for creating a storage buffer node with a configured `StorageBufferAttribute`. + +**count** + +The data count. It is also valid to pass a typed array as an argument. + +**type** + +The data type. + +Default is `'float'`. + +### .barrier( scope : string ) : BarrierNode + +TSL function for creating a barrier node. + +**scope** + +The scope defines the behavior of the node.. + +### .batch( batchMesh : BatchedMesh ) : BatchNode + +TSL function for creating a batch node. + +**batchMesh** + +A reference to batched mesh. + +### .bentNormalView() : Node. + +TSL function for computing bent normals. + +**Returns:** Bent normals. + +### .billboarding( config : Object ) : Node. + +This can be used to achieve a billboarding behavior for flat meshes. That means they are oriented always towards the camera. + +```js +material.vertexNode = billboarding(); +``` + +**config** + +The configuration object. + +**position** + +Can be used to define the vertex positions in world space. + +Default is `null`. + +**horizontal** + +Whether to follow the camera rotation horizontally or not. + +Default is `true`. + +**vertical** + +Whether to follow the camera rotation vertically or not. + +Default is `false`. + +**Returns:** The updated vertex position in clip space. + +### .bitAnd( a : Node, b : Node ) : OperatorNode + +Performs bitwise AND on two nodes. + +**a** + +The first input. + +**b** + +The second input. + +### .bitNot( a : Node, b : Node ) : OperatorNode + +Performs bitwise NOT on a node. + +**a** + +The first input. + +**b** + +The second input. + +### .bitOr( a : Node, b : Node ) : OperatorNode + +Performs bitwise OR on two nodes. + +**a** + +The first input. + +**b** + +The second input. + +### .bitXor( a : Node, b : Node ) : OperatorNode + +Performs bitwise XOR on two nodes. + +**a** + +The first input. + +**b** + +The second input. + +### .bitcast( x : Node | number, y : string ) : Node + +Reinterpret the bit representation of a value in one type as a value in another type. + +**x** + +The parameter. + +**y** + +The new type. + +### .bleach( color : Node., opacity : Node. ) : Node. + +Applies a bleach bypass effect to the given color node. + +**color** + +The color node to apply the sepia for. + +**opacity** + +Influences how strong the effect is blended with the original color. + +Default is `1`. + +**Returns:** The updated color node. + +### .blendBurn( base : Node., blend : Node. ) : Node. + +Represents a "Color Burn" blend mode. + +It's designed to darken the base layer's colors based on the color of the blend layer. It significantly increases the contrast of the base layer, making the colors more vibrant and saturated. The darker the color in the blend layer, the stronger the darkening and contrast effect on the base layer. + +**base** + +The base color. + +**blend** + +The blend color. A white (#ffffff) blend color does not alter the base color. + +**Returns:** The result. + +### .blendColor( base : Node., blend : Node. ) : Node. + +This function blends two color based on their alpha values by replicating the behavior of `THREE.NormalBlending`. It assumes both input colors have non-premultiplied alpha. + +**base** + +The base color. + +**blend** + +The blend color + +**Returns:** The result. + +### .blendDodge( base : Node., blend : Node. ) : Node. + +Represents a "Color Dodge" blend mode. + +It's designed to lighten the base layer's colors based on the color of the blend layer. It significantly increases the brightness of the base layer, making the colors lighter and more vibrant. The brighter the color in the blend layer, the stronger the lightening and contrast effect on the base layer. + +**base** + +The base color. + +**blend** + +The blend color. A black (#000000) blend color does not alter the base color. + +**Returns:** The result. + +### .blendOverlay( base : Node., blend : Node. ) : Node. + +Represents a "Overlay" blend mode. + +It's designed to increase the contrast of the base layer based on the color of the blend layer. It amplifies the existing colors and contrast in the base layer, making lighter areas lighter and darker areas darker. The color of the blend layer significantly influences the resulting contrast and color shift in the base layer. + +**base** + +The base color. + +**blend** + +The blend color + +**Returns:** The result. + +### .blendScreen( base : Node., blend : Node. ) : Node. + +Represents a "Screen" blend mode. + +Similar to `blendDodge()`, this mode also lightens the base layer's colors based on the color of the blend layer. The "Screen" blend mode is better for general brightening whereas the "Dodge" results in more subtle and nuanced effects. + +**base** + +The base color. + +**blend** + +The blend color. A black (#000000) blend color does not alter the base color. + +**Returns:** The result. + +### .bloom( node : Node., strength : number, radius : number, threshold : number ) : BloomNode + +TSL function for creating a bloom effect. + +**node** + +The node that represents the input of the effect. + +**strength** + +The strength of the bloom. + +Default is `1`. + +**radius** + +The radius of the bloom. + +Default is `0`. + +**threshold** + +The luminance threshold limits which bright areas contribute to the bloom effect. + +Default is `0`. + +### .boxBlur( textureNode : Node., options : Object ) : Node. + +Applies a box blur effect to the given texture node. + +Compared to Gaussian blur, box blur produces a more blocky result but with better performance when correctly configured. It is intended for mobile devices or performance restricted use cases where Gaussian is too heavy. + +The (kernel) `size` parameter should be small (1, 2 or 3) since it determines the number of samples based on (size \* 2 + 1)^2. This implementation uses a single pass approach so the kernel is not applied as a separable filter. That means larger kernels won't perform well. Use Gaussian instead if you need a more high-quality blur. + +To produce wider blurs, increase the `separation` parameter instead which has no influence on the performance. + +Reference: [https://github.com/lettier/3d-game-shaders-for-beginners/blob/master/demonstration/shaders/fragment/box-blur.frag](https://github.com/lettier/3d-game-shaders-for-beginners/blob/master/demonstration/shaders/fragment/box-blur.frag). + +**textureNode** + +The texture node that should be blurred. + +**options** + +Additional options for the hash blur effect. + +Default is `{}`. + +**size** + +Controls the blur's kernel. For performant results, the range should within \[1, 3\]. + +Default is `int(1)`. + +**separation** + +Spreads out the blur without having to sample additional fragments. Ranges from \[1, Infinity\]. + +Default is `int(1)`. + +**premultipliedAlpha** + +Whether to use premultiplied alpha for the blur effect. + +Default is `false`. + +**Returns:** The blurred texture node. + +### .buffer( value : Array., type : string, count : number ) : BufferNode + +TSL function for creating a buffer node. + +**value** + +Array-like buffer data. + +**type** + +The data type of a buffer element. + +**count** + +The count of buffer elements. + +### .bufferAttribute( array : BufferAttribute | InterleavedBuffer | TypedArray, type : string, stride : number, offset : number ) : BufferAttributeNode | Node + +TSL function for creating a buffer attribute node. + +**array** + +The attribute data. + +**type** + +The buffer type (e.g. `'vec3'`). + +Default is `null`. + +**stride** + +The buffer stride. + +Default is `0`. + +**offset** + +The buffer offset. + +Default is `0`. + +### .builtin( name : string ) : BuiltinNode + +TSL function for creating a builtin node. + +**name** + +The name of the built-in shader variable. + +### .builtinAOContext( aoNode : Node, node : Node ) : ContextNode + +TSL function for defining a built-in ambient occlusion context for a given node. + +**aoNode** + +The ambient occlusion value node to apply. + +**node** + +The node whose context should be modified. + +Default is `null`. + +### .builtinShadowContext( shadowNode : ShadowNode, light : Light, node : Node ) : ContextNode + +TSL function for defining a built-in shadow context for a given node. + +**shadowNode** + +The shadow node representing the light's shadow. + +**light** + +The light associated with the shadow. + +**node** + +The node whose context should be modified. + +Default is `null`. + +### .bumpMap( textureNode : Node., scaleNode : Node. ) : BumpMapNode + +TSL function for creating a bump map node. + +**textureNode** + +Represents the bump map data. + +**scaleNode** + +Controls the intensity of the bump effect. + +Default is `null`. + +### .bypass( outputNode : Node, callNode : Node ) : BypassNode + +TSL function for creating a bypass node. + +**outputNode** + +The output node. + +**callNode** + +The call node. + +### .cache( node : Node, parent : boolean ) : IsolateNode + +TSL function for creating a cache node. + +**node** + +The node that should be cached. + +**parent** + +Whether this node refers to a shared parent cache or not. + +Default is `true`. + +**Deprecated:** Yes + +### .cbrt( a : Node | number ) : Node + +Returns the cube root of a number. + +**a** + +The first parameter. + +### .cdl( color : Node., slope : Node., offset : Node., power : Node., saturation : Node., luminanceCoefficients : Node. ) : Node. + +Color Decision List (CDL) v1.2 + +Compact representation of color grading information, defined by slope, offset, power, and saturation. The CDL should be typically be given input in a log space (such as LogC, ACEScc, or AgX Log), and will return output in the same space. Output may require clamping >=0. + +**color** + +Input (-Infinity < input < +Infinity) + +**slope** + +Slope (0 ≤ slope < +Infinity) + +**offset** + +Offset (-Infinity < offset < +Infinity; typically -1 < offset < 1) + +**power** + +Power (0 < power < +Infinity) + +**saturation** + +Saturation (0 ≤ saturation < +Infinity; typically 0 ≤ saturation < 4) + +**luminanceCoefficients** + +Luminance coefficients for saturation term, typically Rec. 709 + +**Returns:** + +Output, -Infinity < output < +Infinity + +References: + +* ASC CDL v1.2 +* [https://blender.stackexchange.com/a/55239/43930](https://blender.stackexchange.com/a/55239/43930) +* [https://docs.acescentral.com/specifications/acescc/](https://docs.acescentral.com/specifications/acescc/) + +### .ceil( x : Node | number ) : Node + +Finds the nearest integer that is greater than or equal to the parameter. + +**x** + +The parameter. + +### .checker( coord : Node. ) : Node. + +Creates a 2x2 checkerboard pattern that can be used as procedural texture data. + +**coord** + +The uv coordinates. + +**Returns:** The result data. + +### .chromaticAberration( node : Node., strength : Node | number, center : Node | Vector2, scale : Node | number ) : ChromaticAberrationNode + +TSL function for creating a chromatic aberration node for post processing. + +**node** + +The node that represents the input of the effect. + +**strength** + +The strength of the chromatic aberration effect as a node or value. + +Default is `1.0`. + +**center** + +The center point of the effect as a node or value. If null, uses screen center (0.5, 0.5). + +Default is `null`. + +**scale** + +The scale factor for stepped scaling from center as a node or value. + +Default is `1.1`. + +### .cineonToneMapping( color : Node., exposure : Node. ) : Node. + +Cineon tone mapping. + +Reference: [http://filmicworlds.com/blog/filmic-tonemapping-operators/](http://filmicworlds.com/blog/filmic-tonemapping-operators/) + +**color** + +The color that should be tone mapped. + +**exposure** + +The exposure. + +**Returns:** The tone mapped color. + +### .circleIntersectsAABB( circleCenter : Node., radius : Node., minBounds : Node., maxBounds : Node. ) : Node. + +TSL function that checks if a circle intersects with an axis-aligned bounding box (AABB). + +**circleCenter** + +The center of the circle. + +**radius** + +The radius of the circle. + +**minBounds** + +The minimum bounds of the AABB. + +**maxBounds** + +The maximum bounds of the AABB. + +**Returns:** True if the circle intersects the AABB. + +### .clamp( value : Node | number, low : Node | number, high : Node | number ) : Node + +Constrains a value to lie between two further values. + +**value** + +The value to constrain. + +**low** + +The lower bound. + +Default is `0`. + +**high** + +The upper bound. + +Default is `1`. + +### .clipping() : ClippingNode + +TSL function for setting up the default clipping logic. + +### .clippingAlpha() : ClippingNode + +TSL function for setting up alpha to coverage. + +### .code( code : string, includes : Array., language : 'js' | 'wgsl' | 'glsl' ) : CodeNode + +TSL function for creating a code node. + +**code** + +The native code. + +**includes** + +An array of includes. + +Default is `[]`. + +**language** + +The used language. + +Default is `''`. + +### .colorSpaceToWorking( node : Node, sourceColorSpace : string ) : ColorSpaceNode + +TSL function for converting a given color node from the given color space to the current working color space. + +**node** + +Represents the node to convert. + +**sourceColorSpace** + +The source color space. + +### .colorToDirection( node : Node. ) : Node. + +Unpacks a color value into a direction vector. + +**node** + +The color to unpack. + +**Returns:** The direction. + +### .compute( node : Node, count : number | Array., workgroupSize : Array. ) : AtomicFunctionNode + +TSL function for creating a compute node. + +**node** + +TODO + +**count** + +TODO. + +**workgroupSize** + +TODO. + +Default is `[64]`. + +### .computeBuiltin( name : string, nodeType : string ) : ComputeBuiltinNode + +TSL function for creating a compute builtin node. + +**name** + +The built-in name. + +**nodeType** + +The node type. + +### .computeKernel( node : Node, workgroupSize : Array. ) : AtomicFunctionNode + +TSL function for creating a compute kernel node. + +**node** + +TODO + +**workgroupSize** + +TODO. + +Default is `[64]`. + +### .computeSkinning( skinnedMesh : SkinnedMesh, toPosition : Node. ) : SkinningNode + +TSL function for computing skinning. + +**skinnedMesh** + +The skinned mesh. + +**toPosition** + +The target position. + +Default is `null`. + +### .context( nodeOrValue : Node | Object, value : Object ) : ContextNode + +TSL function for creating a context node. + +**nodeOrValue** + +The node whose context should be modified or the modified context data. + +Default is `{}`. + +**value** + +The modified context data. + +Default is `{}`. + +### .convertColorSpace( node : Node, sourceColorSpace : string, targetColorSpace : string ) : ColorSpaceNode + +TSL function for converting a given color node from one color space to another one. + +**node** + +Represents the node to convert. + +**sourceColorSpace** + +The source color space. + +**targetColorSpace** + +The target color space. + +### .convertToTexture( node : Node, width : number, height : number, options : Object ) : RTTNode + +TSL function for converting nodes to textures nodes. + +**node** + +The node to render a texture with. + +**width** + +The width of the internal render target. If not width is applied, the render target is automatically resized. + +Default is `null`. + +**height** + +The height of the internal render target. + +Default is `null`. + +**options** + +The options for the internal render target. + +Default is `{type:HalfFloatType}`. + +### .cos( x : Node | number ) : Node + +Returns the cosine of the parameter. + +**x** + +The parameter. + +### .countLeadingZeros( x : Node | number ) : Node + +Finds the number of consecutive 0 bits starting from the most significant bit of the input value. + +Can only be used with [WebGPURenderer](WebGPURenderer.html) and a WebGPU backend. + +**x** + +The input value. + +### .countOneBits() : Node + +Finds the number of '1' bits set in the input value + +Can only be used with [WebGPURenderer](WebGPURenderer.html) and a WebGPU backend. + +### .countTrailingZeros( x : Node | number ) : Node + +Finds the number of consecutive 0 bits from the least significant bit of the input value, which is also the index of the least significant bit of the input value. + +Can only be used with [WebGPURenderer](WebGPURenderer.html) and a WebGPU backend. + +**x** + +The input value. + +### .createVar( node : Node, name : string ) : VarNode + +TSL function for creating a var node. + +**node** + +The node for which a variable should be created. + +**name** + +The name of the variable in the shader. + +### .cross( x : Node.<(vec2|vec3)>, y : Node.<(vec2|vec3)> ) : Node.<(float|vec3)> + +Calculates the cross product of two vectors. + +**x** + +The first vector. + +**y** + +The second vector. + +### .cubeMapNode( envNode : Node ) : CubeMapNode + +TSL function for creating a cube map node. + +**envNode** + +The node representing the environment map. + +### .cubeTexture( value : CubeTexture | CubeTextureNode, uvNode : Node., levelNode : Node., biasNode : Node. ) : CubeTextureNode + +TSL function for creating a cube texture uniform node. + +**value** + +The cube texture. + +Default is `EmptyTexture`. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +**biasNode** + +The bias node. + +Default is `null`. + +### .cubeTextureBase( value : CubeTexture, uvNode : Node., levelNode : Node., biasNode : Node. ) : CubeTextureNode + +TSL function for creating a cube texture node. + +**value** + +The cube texture. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +**biasNode** + +The bias node. + +Default is `null`. + +### .dFdx( x : Node | number ) : Node + +Returns the partial derivative of the parameter with respect to x. + +**x** + +The parameter. + +### .dFdy( x : Node | number ) : Node + +Returns the partial derivative of the parameter with respect to y. + +**x** + +The parameter. + +### .debug( node : Node, callback : function ) : DebugNode + +TSL function for creating a debug node. + +**node** + +The node to debug. + +**callback** + +Optional callback function to handle the debug output. + +Default is `null`. + +### .decrement( a : Node ) : OperatorNode + +Decrements a node by 1 and returns the previous value. + +**a** + +The node to decrement. + +### .decrementBefore( a : Node ) : OperatorNode + +Decrements a node by 1. + +**a** + +The node to decrement. + +### .degrees( x : Node | number ) : Node + +Convert a quantity in radians to degrees. + +**x** + +The input in radians. + +### .denoise( node : Node, depthNode : Node., normalNode : Node., camera : Camera ) : DenoiseNode + +TSL function for creating a denoise effect. + +**node** + +The node that represents the input of the effect (e.g. AO). + +**depthNode** + +A node that represents the scene's depth. + +**normalNode** + +A node that represents the scene's normals. + +**camera** + +The camera the scene is rendered with. + +### .densityFogFactor( density : Node ) + +Represents an exponential squared fog. This type of fog gives a clear view near the camera and a faster than exponentially densening fog farther from the camera. + +**density** + +Defines the fog density. + +### .depthBase( value : Node. ) : ViewportDepthNode. + +TSL function for defining a value for the current fragment's depth. + +**value** + +The depth value to set. + +### .depthPass( scene : Scene, camera : Camera, options : Object ) : PassNode + +TSL function for creating a depth pass node. + +**scene** + +A reference to the scene. + +**camera** + +A reference to the camera. + +**options** + +Options for the internal render target. + +### .determinant( x : Node.<(mat2|mat3|mat4)> ) : Node. + +Returns the determinant of a matrix. + +**x** + +The parameter. + +### .difference( x : Node | number, y : Node | number ) : Node + +Calculates the absolute difference between two values. + +**x** + +The first parameter. + +**y** + +The second parameter. + +### .directionToColor( node : Node. ) : Node. + +Packs a direction vector into a color value. + +**node** + +The direction to pack. + +**Returns:** The color. + +### .distance( x : Node.<(vec2|vec3|vec4)>, y : Node.<(vec2|vec3|vec4)> ) : Node. + +Calculates the distance between two points. + +**x** + +The first point. + +**y** + +The second point. + +### .div( a : Node, b : Node, …params : Node ) : OperatorNode + +Returns the division of two or more value. + +**a** + +The first input. + +**b** + +The second input. + +**params** + +Additional input parameters. + +### .dof( node : Node., viewZNode : Node., focusDistance : Node. | number, focalLength : Node. | number, bokehScale : Node. | number ) : DepthOfFieldNode + +TSL function for creating a depth-of-field effect (DOF) for post processing. + +**node** + +The node that represents the input of the effect. + +**viewZNode** + +Represents the viewZ depth values of the scene. + +**focusDistance** + +Defines the effect's focus which is the distance along the camera's look direction in world units. + +**focalLength** + +How far an object can be from the focal plane before it goes completely out-of-focus in world units. + +**bokehScale** + +A unitless value for artistic purposes to adjust the size of the bokeh. + +### .dot( x : Node.<(vec2|vec3|vec4)>, y : Node.<(vec2|vec3|vec4)> ) : Node. + +Calculates the dot product of two vectors. + +**x** + +The first vector. + +**y** + +The second vector. + +### .dotScreen( node : Node., angle : number, scale : number ) : DotScreenNode + +TSL function for creating a dot-screen node for post processing. + +**node** + +The node that represents the input of the effect. + +**angle** + +The rotation of the effect in radians. + +Default is `1.57`. + +**scale** + +The scale of the effect. A higher value means smaller dots. + +Default is `1`. + +### .dynamicBufferAttribute( array : BufferAttribute | InterleavedBuffer | TypedArray, type : string, stride : number, offset : number ) : BufferAttributeNode | Node + +TSL function for creating a buffer attribute node but with dynamic draw usage. Use this function if attribute data are updated per frame. + +**array** + +The attribute data. + +**type** + +The buffer type (e.g. `'vec3'`). + +Default is `null`. + +**stride** + +The buffer stride. + +Default is `0`. + +**offset** + +The buffer offset. + +Default is `0`. + +### .equal( a : Node, b : Node ) : OperatorNode + +Checks if two nodes are equal. + +**a** + +The first input. + +**b** + +The second input. + +### .equirectUV( dirNode : Node. ) : Node. + +TSL function for creating an equirect uv node. + +Can be used to compute texture coordinates for projecting an equirectangular texture onto a mesh for using it as the scene's background. + +```js +scene.backgroundNode = texture( equirectTexture, equirectUV() ); +``` + +**dirNode** + +A direction vector for sampling which is by default `positionWorldDirection`. + +Default is `positionWorldDirection`. + +### .exp( x : Node | number ) : Node + +Returns the natural exponentiation of the parameter. + +**x** + +The parameter. + +### .exp2( x : Node | number ) : Node + +Returns 2 raised to the power of the parameter. + +**x** + +The parameter. + +### .expression( snippet : string, nodeType : string ) : ExpressionNode + +TSL function for creating an expression node. + +**snippet** + +The native code snippet. + +**nodeType** + +The node type. + +Default is `'void'`. + +### .faceForward( N : Node.<(vec2|vec3|vec4)>, I : Node.<(vec2|vec3|vec4)>, Nref : Node.<(vec2|vec3|vec4)> ) : Node.<(vec2|vec3|vec4)> + +Returns a vector pointing in the same direction as another. + +**N** + +The vector to orient. + +**I** + +The incident vector. + +**Nref** + +The reference vector. + +### .film( inputNode : Node., intensityNode : Node., uvNode : Node. ) : FilmNode + +TSL function for creating a film node for post processing. + +**inputNode** + +The node that represents the input of the effect. + +**intensityNode** + +A node that represents the effect's intensity. + +Default is `null`. + +**uvNode** + +A node that allows to pass custom (e.g. animated) uv data. + +Default is `null`. + +### .floatBitsToInt( value : Node. ) : BitcastNode + +Bitcasts a float or a vector of floats to a corresponding integer type with the same element size. + +**value** + +The float or vector of floats to bitcast. + +### .floatBitsToUint( value : Node. ) : BitcastNode + +Bitcasts a float or a vector of floats to a corresponding unsigned integer type with the same element size. + +**value** + +The float or vector of floats to bitcast. + +### .floor( x : Node | number ) : Node + +Finds the nearest integer less than or equal to the parameter. + +**x** + +The parameter. + +### .fog( color : Node, factor : Node ) + +This class can be used to configure a fog for the scene. Nodes of this type are assigned to `Scene.fogNode`. + +**color** + +Defines the color of the fog. + +**factor** + +Defines how the fog is factored in the scene. + +### .fract( x : Node | number ) : Node + +Computes the fractional part of the parameter. + +**x** + +The parameter. + +### .fwidth( x : Node | number ) : Node + +Returns the sum of the absolute derivatives in x and y. + +**x** + +The parameter. + +### .fxaa( node : Node. ) : FXAANode + +TSL function for creating a FXAA node for anti-aliasing via post processing. + +**node** + +The node that represents the input of the effect. + +### .gain( x : Node., k : Node. ) : Node. + +A function that remaps the `[0,1]` interval into the `[0,1]` interval. Expands the sides and compresses the center, and keeps `0.5` mapped to `0.5`. Reference: [https://iquilezles.org/articles/functions/](https://iquilezles.org/articles/functions/). + +**x** + +The value to remap. + +**k** + +`k=1` is the identity curve,`k<1` produces the classic `gain()` shape, and `k>1` produces "s" shaped curves. + +**Returns:** The remapped value. + +### .gaussianBlur( node : Node., directionNode : Node.<(vec2|float)>, sigma : number, options : Object ) : GaussianBlurNode + +TSL function for creating a gaussian blur node for post processing. + +**node** + +The node that represents the input of the effect. + +**directionNode** + +Defines the direction and radius of the blur. + +**sigma** + +Controls the kernel of the blur filter. Higher values mean a wider blur radius. + +**options** + +Additional options for the gaussian blur effect. + +Default is `{}`. + +**premultipliedAlpha** + +Whether to use premultiplied alpha for the blur effect. + +Default is `false`. + +**resolutionScale** + +The resolution of the effect. 0.5 means half the resolution of the texture node. + +Default is `1`. + +### .getNormalFromDepth( uv : Node., depthTexture : DepthTexture, projectionMatrixInverse : Node. ) : Node. + +Computes a normal vector based on depth data. Can be used as a fallback when no normal render target is available or if flat surface normals are required. + +**uv** + +The texture coordinate. + +**depthTexture** + +The depth texture. + +**projectionMatrixInverse** + +The camera's inverse projection matrix. + +**Returns:** The computed normal vector. + +### .getParallaxCorrectNormal( normal : Node., cubeSize : Node., cubePos : Node. ) : Node. + +This computes a parallax corrected normal which is used for box-projected cube mapping (BPCEM). + +Reference: [https://devlog-martinsh.blogspot.com/2011/09/box-projected-cube-environment-mapping.html](https://devlog-martinsh.blogspot.com/2011/09/box-projected-cube-environment-mapping.html) + +```js +const uvNode = getParallaxCorrectNormal( reflectVector, vec3( 200, 100, 100 ), vec3( 0, - 50, 0 ) ); +material.envNode = pmremTexture( renderTarget.texture, uvNode ); +``` + +**normal** + +The normal to correct. + +**cubeSize** + +The cube size should reflect the size of the environment (BPCEM is usually applied in closed environments like rooms). + +**cubePos** + +The cube position. + +**Returns:** The parallax corrected normal. + +### .getScreenPosition( viewPosition : Node., projectionMatrix : Node. ) : Node. + +Computes a screen position expressed as uv coordinates based on a fragment's position in view space and the camera's projection matrix + +**viewPosition** + +The fragments position in view space. + +**projectionMatrix** + +The camera's projection matrix. + +**Returns:** The fragment's screen position expressed as uv coordinates. + +### .getShadowMaterial( light : Light ) : NodeMaterial + +Retrieves or creates a shadow material for the given light source. + +This function checks if a shadow material already exists for the provided light. If not, it creates a new `NodeMaterial` configured for shadow rendering and stores it in the `shadowMaterialLib` for future use. + +**light** + +The light source for which the shadow material is needed. If the light is a point light, a depth node is calculated using the linear shadow distance. + +**Returns:** The shadow material associated with the given light. + +### .getShadowRenderObjectFunction( renderer : Renderer, shadow : LightShadow, shadowType : number, useVelocity : boolean ) : shadowRenderObjectFunction + +Creates a function to render shadow objects in a scene. + +**renderer** + +The renderer. + +**shadow** + +The light shadow object containing shadow properties. + +**shadowType** + +The type of shadow map (e.g., BasicShadowMap). + +**useVelocity** + +Whether to use velocity data for rendering. + +**Returns:** A function that renders shadow objects. + +### .getViewPosition( screenPosition : Node., depth : Node., projectionMatrixInverse : Node. ) : Node. + +Computes a position in view space based on a fragment's screen position expressed as uv coordinates, the fragments depth value and the camera's inverse projection matrix. + +**screenPosition** + +The fragment's screen position expressed as uv coordinates. + +**depth** + +The fragment's depth value. + +**projectionMatrixInverse** + +The camera's inverse projection matrix. + +**Returns:** The fragments position in view space. + +### .glsl( src : string, includes : Array. ) : CodeNode + +TSL function for creating a GLSL code node. + +**src** + +The native code. + +**includes** + +An array of includes. + +### .grayscale( color : Node. ) : Node. + +Computes a grayscale value for the given RGB color value. + +**color** + +The color value to compute the grayscale for. + +**Returns:** The grayscale color. + +### .greaterThan( a : Node, b : Node ) : OperatorNode + +Checks if the first node is greater than the second. + +**a** + +The first input. + +**b** + +The second input. + +### .greaterThanEqual( a : Node, b : Node ) : OperatorNode + +Checks if the first node is greater than or equal to the second. + +**a** + +The first input. + +**b** + +The second input. + +### .hardwareClipping() : ClippingNode + +TSL function for setting up hardware-based clipping. + +### .hash( seed : Node. ) : Node. + +Generates a hash value in the range `[0, 1]` from the given seed. + +**seed** + +The seed. + +**Returns:** The hash value. + +### .hashBlur( textureNode : Node., bluramount : Node., options : Object ) : Node. + +Applies a hash blur effect to the given texture node. + +The approach of this blur is different compared to Gaussian and box blur since it does not rely on a kernel to apply a convolution. Instead, it reads the base texture multiple times in a random pattern and then averages the samples. A typical artifact of this technique is a slightly noisy appearance of the blur which can be mitigated by increasing the number of iterations (see `repeats` parameter). Compared to Gaussian blur, hash blur requires just a single pass. + +Reference: [https://www.shadertoy.com/view/4lXXWn](https://www.shadertoy.com/view/4lXXWn). + +**textureNode** + +The texture node that should be blurred. + +**bluramount** + +This node determines the amount of blur. + +Default is `float(0.1)`. + +**options** + +Additional options for the hash blur effect. + +Default is `{}`. + +**repeats** + +The number of iterations for the blur effect. + +Default is `float(45)`. + +**premultipliedAlpha** + +Whether to use premultiplied alpha for the blur effect. + +Default is `false`. + +**Returns:** The blurred texture node. + +### .hue( color : Node., adjustment : Node. ) : Node. + +Updates the hue component of the given RGB color while preserving its luminance and saturation. + +**color** + +The input color. + +**adjustment** + +Defines the degree of hue rotation in radians. A positive value rotates the hue clockwise, while a negative value rotates it counterclockwise. + +Default is `1`. + +**Returns:** The updated color. + +### .increment( a : Node ) : OperatorNode + +Increments a node by 1 and returns the previous value. + +**a** + +The node to increment. + +### .incrementBefore( a : Node ) : OperatorNode + +Increments a node by 1. + +**a** + +The node to increment. + +### .inspector( node : Node, name : string, callback : function | null ) : Node + +Creates an inspector node to wrap around a given node for inspection purposes. + +**node** + +The node to inspect. + +**name** + +Optional name for the inspector node. + +Default is `''`. + +**callback** + +Optional callback to modify the node during setup. + +Default is `null`. + +**Returns:** The inspector node. + +### .instance( count : number, instanceMatrix : InstancedBufferAttribute | StorageInstancedBufferAttribute, instanceColor : InstancedBufferAttribute | StorageInstancedBufferAttribute ) : InstanceNode + +TSL function for creating an instance node. + +**count** + +The number of instances. + +**instanceMatrix** + +Instanced buffer attribute representing the instance transformations. + +**instanceColor** + +Instanced buffer attribute representing the instance colors. + +### .instancedArray( count : number | TypedArray, type : string | Struct ) : StorageBufferNode + +TSL function for creating a storage buffer node with a configured `StorageInstancedBufferAttribute`. + +**count** + +The data count. It is also valid to pass a typed array as an argument. + +**type** + +The data type. + +Default is `'float'`. + +### .instancedBufferAttribute( array : BufferAttribute | InterleavedBuffer | TypedArray, type : string, stride : number, offset : number ) : BufferAttributeNode | Node + +TSL function for creating a buffer attribute node but with enabled instancing + +**array** + +The attribute data. + +**type** + +The buffer type (e.g. `'vec3'`). + +Default is `null`. + +**stride** + +The buffer stride. + +Default is `0`. + +**offset** + +The buffer offset. + +Default is `0`. + +### .instancedDynamicBufferAttribute( array : BufferAttribute | InterleavedBuffer | TypedArray, type : string, stride : number, offset : number ) : BufferAttributeNode | Node + +TSL function for creating a buffer attribute node but with dynamic draw usage and enabled instancing + +**array** + +The attribute data. + +**type** + +The buffer type (e.g. `'vec3'`). + +Default is `null`. + +**stride** + +The buffer stride. + +Default is `0`. + +**offset** + +The buffer offset. + +Default is `0`. + +### .instancedMesh( instancedMesh : InstancedMesh ) : InstancedMeshNode + +TSL function for creating an instanced mesh node. + +**instancedMesh** + +The instancedMesh. + +### .intBitsToFloat( value : Node. ) : BitcastNode + +Bitcasts an integer or a vector of integers to a corresponding float type with the same element size. + +**value** + +The integer or vector of integers to bitcast. + +### .interleavedGradientNoise( position : Node. ) : Node. + +Interleaved Gradient Noise (IGN) from Jimenez 2014. + +IGN has "low discrepancy" resulting in evenly distributed samples. It's superior compared to default white noise, blue noise or Bayer. + +References: + +* [https://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare/](https://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare/) +* [https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/](https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/) + +**position** + +The input position, usually screen coordinates. + +**Returns:** The noise value. + +### .inverse( x : Node.<(mat2|mat3|mat4)> ) : Node.<(mat2|mat3|mat4)> + +Returns the inverse of a matrix. + +**x** + +The parameter. + +### .inverseSqrt( x : Node | number ) : Node + +Returns the inverse of the square root of the parameter. + +**x** + +The parameter. + +### .isolate( node : Node ) : IsolateNode + +TSL function for creating a cache node. + +**node** + +The node that should be cached. + +### .js( src : string, includes : Array. ) : CodeNode + +TSL function for creating a JS code node. + +**src** + +The native code. + +**includes** + +An array of includes. + +### .label( node : Node, name : string ) : ContextNode + +TSL function for defining a label context value for a given node. + +**node** + +The node whose context should be modified. + +**name** + +The name/label to set. + +**Deprecated:** Yes + +### .length( x : Node ) : Node. + +Calculates the length of a vector. + +**x** + +The parameter. + +### .lengthSq( a : Node.<(vec2|vec3|vec4)> ) : Node. + +Calculate the squared length of a vector. + +**a** + +The vector. + +### .lensflare( node : TextureNode, params : Object ) : LensflareNode + +TSL function for creating a bloom-based lens flare effect. + +**node** + +The node that represents the scene's bloom. + +**params** + +The parameter object for configuring the effect. + +**ghostTint** + +Defines the tint of the flare/ghosts. + +Default is `vec3(1, 1, 1)`. + +**threshold** + +Controls the size and strength of the effect. A higher threshold results in smaller flares. + +Default is `float(0.5)`. + +**ghostSamples** + +Represents the number of flares/ghosts per bright spot which pivot around the center. + +Default is `float(4)`. + +**ghostSpacing** + +Defines the spacing of the flares/ghosts. + +Default is `float(0.25)`. + +**ghostAttenuationFactor** + +Defines the attenuation factor of flares/ghosts. + +Default is `float(25)`. + +**downSampleRatio** + +Defines how downsampling since the effect is usually not rendered at full resolution. + +Default is `4`. + +### .lessThan( a : Node, b : Node ) : OperatorNode + +Checks if the first node is less than the second. + +**a** + +The first input. + +**b** + +The second input. + +### .lessThanEqual( a : Node, b : Node ) : OperatorNode + +Checks if the first node is less than or equal to the second. + +**a** + +The first input. + +**b** + +The second input. + +### .lightPosition( light : Light ) : UniformNode. + +TSL function for getting the position in world space for the given light. + +**light** + +The light source. + +**Returns:** The light's position in world space. + +### .lightProjectionUV( light : Light, position : Node. ) : Node. + +TSL function for getting projected uv coordinates for the given light. Relevant when using maps with spot lights. + +**light** + +The light source. + +**position** + +The position to project. + +Default is `positionWorld`. + +**Returns:** The projected uvs. + +### .lightShadowMatrix( light : Light ) : UniformNode. + +TSL function for getting a shadow matrix uniform node for the given light. + +**light** + +The light source. + +**Returns:** The shadow matrix uniform node. + +### .lightTargetDirection( light : Light ) : Node. + +TSL function for getting the light target direction for the given light. + +**light** + +The light source. + +**Returns:** The light's target direction. + +### .lightTargetPosition( light : Light ) : UniformNode. + +TSL function for getting the light target position in world space for the given light. + +**light** + +The light source. + +**Returns:** The light target position in world space. + +### .lightViewPosition( light : Light ) : UniformNode. + +TSL function for getting the position in view space for the given light. + +**light** + +The light source. + +**Returns:** The light's position in view space. + +### .lights( lights : Array. ) : LightsNode + +TSL function for creating an instance of `LightsNode` and configuring it with the given array of lights. + +**lights** + +An array of lights. + +**Returns:** The created lights node. + +### .linearDepth( value : Node. ) : ViewportDepthNode. + +TSL function for converting a perspective depth value to linear depth. + +**value** + +The perspective depth. If `null` is provided, the current fragment's depth is used. + +Default is `null`. + +### .linearToneMapping( color : Node., exposure : Node. ) : Node. + +Linear tone mapping, exposure only. + +**color** + +The color that should be tone mapped. + +**exposure** + +The exposure. + +**Returns:** The tone mapped color. + +### .log( x : Node | number ) : Node + +Returns the natural logarithm of the parameter. + +**x** + +The parameter. + +### .log2( x : Node | number ) : Node + +Returns the base 2 logarithm of the parameter. + +**x** + +The parameter. + +### .logarithmicDepthToViewZ( depth : Node., near : Node., far : Node. ) : Node. + +TSL function for converting a logarithmic depth value to a viewZ value. + +**depth** + +The logarithmic depth. + +**near** + +The camera's near value. + +**far** + +The camera's far value. + +### .luminance( color : Node., luminanceCoefficients : Node. ) : Node. + +Computes the luminance for the given RGB color value. + +**color** + +The color value to compute the luminance for. + +**luminanceCoefficients** + +The luminance coefficients. By default predefined values of the current working color space are used. + +**Returns:** The luminance. + +### .lut3D( node : Node, lut : TextureNode, size : number, intensity : Node. | number ) : Lut3DNode + +TSL function for creating a LUT node for color grading via post processing. + +**node** + +The node that represents the input of the effect. + +**lut** + +A texture node that represents the lookup table. + +**size** + +The size of the lookup table. + +**intensity** + +Controls the intensity of the effect. + +### .matcapUV() : Node. + +TSL function for creating a matcap uv node. + +Can be used to compute texture coordinates for projecting a matcap onto a mesh. Used by [MeshMatcapNodeMaterial](MeshMatcapNodeMaterial.html). + +**Returns:** The matcap UV coordinates. + +### .materialReference( name : string, type : string, material : Material ) : MaterialReferenceNode + +TSL function for creating a material reference node. + +**name** + +The name of the property the node refers to. + +**type** + +The uniform type that should be used to represent the property value. + +**material** + +The material the property belongs to. When no material is set, the node refers to the material of the current rendered object. + +Default is `null`. + +### .max( …values : Node | number ) : Node + +Returns the greatest of the given values. + +**values** + +The values to compare. + +### .maxMipLevel( textureNode : TextureNode ) : MaxMipLevelNode + +TSL function for creating a max mip level node. + +**textureNode** + +The texture node to compute the max mip level for. + +### .min( …values : Node | number ) : Node + +Returns the least of the given values. + +**values** + +The values to compare. + +### .mix( a : Node | number, b : Node | number, t : Node | number ) : Node + +Linearly interpolates between two values. + +**a** + +The first parameter. + +**b** + +The second parameter. + +**t** + +The interpolation value. + +### .mixElement( t : Node | number, e1 : Node | number, e2 : Node | number ) : Node + +Alias for `mix()` with a different parameter order. + +**t** + +The interpolation value. + +**e1** + +The first parameter. + +**e2** + +The second parameter. + +### .mod( a : Node, b : Node ) : OperatorNode + +Computes the remainder of dividing the first node by the second one. + +**a** + +The first input. + +**b** + +The second input. + +### .modInt( a : Node, b : Node ) : OperatorNode + +**a** + +The first input. + +**b** + +The second input. + +**Deprecated:** since r175. Use [mod](TSL.html#mod) instead. + +### .morphReference( mesh : Mesh ) : MorphNode + +TSL function for creating a morph node. + +**mesh** + +The mesh holding the morph targets. + +### .motionBlur( inputNode : Node., velocity : Node., numSamples : Node. ) : Node. + +Applies a motion blur effect to the given input node. + +**inputNode** + +The input node to apply the motion blur for. + +**velocity** + +The motion vectors of the beauty pass. + +**numSamples** + +How many samples the effect should use. A higher value results in better quality but is also more expensive. + +Default is `int(16)`. + +**Returns:** The input node with the motion blur effect applied. + +### .mrt( outputNodes : Object. ) : MRTNode + +TSL function for creating a MRT node. + +**outputNodes** + +The MRT outputs. + +### .mul( a : Node, b : Node, …params : Node ) : OperatorNode + +Returns the multiplication of two or more value. + +**a** + +The first input. + +**b** + +The second input. + +**params** + +Additional input parameters. + +### .negate( x : Node | number ) : Node + +Negates the value of the parameter (-x). + +**x** + +The parameter. + +### .neutralToneMapping( color : Node., exposure : Node. ) : Node. + +Neutral tone mapping. + +Reference: [https://modelviewer.dev/examples/tone-mapping](https://modelviewer.dev/examples/tone-mapping) + +**color** + +The color that should be tone mapped. + +**exposure** + +The exposure. + +**Returns:** The tone mapped color. + +### .normalMap( node : Node., scaleNode : Node. ) : NormalMapNode + +TSL function for creating a normal map node. + +**node** + +Represents the normal map data. + +**scaleNode** + +Controls the intensity of the effect. + +Default is `null`. + +### .normalize( x : Node ) : Node + +Calculates the unit vector in the same direction as the original vector. + +**x** + +The input vector. + +### .not( value : Node ) : OperatorNode + +Performs logical NOT on a node. + +**value** + +The value. + +### .notEqual( a : Node, b : Node ) : OperatorNode + +Checks if two nodes are not equal. + +**a** + +The first input. + +**b** + +The second input. + +### .objectDirection( object3d : Object3D ) : Object3DNode. + +TSL function for creating an object 3D node that represents the object's direction in world space. + +**object3d** + +The 3D object. + +### .objectPosition( object3d : Object3D ) : Object3DNode. + +TSL function for creating an object 3D node that represents the object's position in world space. + +**object3d** + +The 3D object. + +### .objectRadius( object3d : Object3D ) : Object3DNode. + +TSL function for creating an object 3D node that represents the object's radius. + +**object3d** + +The 3D object. + +### .objectScale( object3d : Object3D ) : Object3DNode. + +TSL function for creating an object 3D node that represents the object's scale in world space. + +**object3d** + +The 3D object. + +### .objectViewPosition( object3d : Object3D ) : Object3DNode. + +TSL function for creating an object 3D node that represents the object's position in view/camera space. + +**object3d** + +The 3D object. + +### .objectWorldMatrix( object3d : Object3D ) : Object3DNode. + +TSL function for creating an object 3D node that represents the object's world matrix. + +**object3d** + +The 3D object. + +### .oneMinus( x : Node | number ) : Node + +Return `1` minus the parameter. + +**x** + +The parameter. + +### .or( …nodes : Node ) : OperatorNode + +Performs a logical OR operation on multiple nodes. + +**nodes** + +The input nodes to be combined using OR. + +### .orthographicDepthToViewZ( depth : Node., near : Node., far : Node. ) : Node. + +TSL function for converting an orthographic depth value to a viewZ value. + +**depth** + +The orthographic depth. + +**near** + +The camera's near value. + +**far** + +The camera's far value. + +### .oscSawtooth( t : Node. ) : Node. + +Generates a sawtooth wave oscillation based on a timer. + +**t** + +The timer to generate the oscillation with. + +**Returns:** The oscillation node. + +### .oscSine( t : Node. ) : Node. + +Generates a sine wave oscillation based on a timer. + +**t** + +The timer to generate the oscillation with. + +**Returns:** The oscillation node. + +### .oscSquare( t : Node. ) : Node. + +Generates a square wave oscillation based on a timer. + +**t** + +The timer to generate the oscillation with. + +**Returns:** The oscillation node. + +### .oscTriangle( t : Node. ) : Node. + +Generates a triangle wave oscillation based on a timer. + +**t** + +The timer to generate the oscillation with. + +**Returns:** The oscillation node. + +### .outline( scene : Scene, camera : Camera, params : Object ) : OutlineNode + +TSL function for creating an outline effect around selected objects. + +**scene** + +A reference to the scene. + +**camera** + +The camera the scene is rendered with. + +**params** + +The configuration parameters. + +**selectedObjects** + +An array of selected objects. + +**edgeThickness** + +The thickness of the edges. + +Default is `float(1)`. + +**edgeGlow** + +Can be used for animated glow/pulse effects. + +Default is `float(0)`. + +**downSampleRatio** + +The downsample ratio. + +Default is `2`. + +### .outputStruct( …members : Node ) : OutputStructNode + +TSL function for creating an output struct node. + +**members** + +A parameter list of nodes. + +### .overloadingFn( functionNodes : Array. ) : FunctionOverloadingNode + +TSL function for creating a function overloading node. + +**functionNodes** + +Array of `Fn` function definitions. + +### .packHalf2x16( value : Node. ) : Node + +Converts each component of the vec2 to 16-bit floating-point values. The results are packed into a single unsigned integer. + +**value** + +The 2-component vector to be packed + +### .packSnorm2x16( value : Node. ) : Node + +Converts each component of the normalized float to 16-bit integer values. The results are packed into a single unsigned integer. round(clamp(c, -1, +1) \* 32767.0) + +**value** + +The 2-component vector to be packed + +### .packUnorm2x16( value : Node. ) : Node + +Converts each component of the normalized float to 16-bit integer values. The results are packed into a single unsigned integer. round(clamp(c, 0, +1) \* 65535.0) + +**value** + +The 2-component vector to be packed + +### .parabola( x : Node., k : Node. ) : Node. + +A function that remaps the `[0,1]` interval into the `[0,1]` interval. The corners are mapped to `0` and the center to `1`. Reference: [https://iquilezles.org/articles/functions/](https://iquilezles.org/articles/functions/). + +**x** + +The value to remap. + +**k** + +Allows to control the remapping functions shape by rising the parabola to a power `k`. + +**Returns:** The remapped value. + +### .parallaxBarrierPass( scene : Scene, camera : Camera ) : ParallaxBarrierPassNode + +TSL function for creating an parallax barrier pass node. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +### .parallaxUV( uv : Node., scale : Node. ) : Node. + +TSL function for computing parallax uv coordinates. + +**uv** + +A uv node. + +**scale** + +A scale node. + +**Returns:** Parallax uv coordinates. + +### .parameter( type : string, name : string ) : ParameterNode + +TSL function for creating a parameter node. + +**type** + +The type of the node. + +**name** + +The name of the parameter in the shader. + +### .pass( scene : Scene, camera : Camera, options : Object ) : PassNode + +TSL function for creating a pass node. + +**scene** + +A reference to the scene. + +**camera** + +A reference to the camera. + +**options** + +Options for the internal render target. + +### .passTexture( pass : PassNode, texture : Texture ) : PassTextureNode + +TSL function for creating a pass texture node. + +**pass** + +The pass node. + +**texture** + +The output texture. + +### .pcurve( x : Node., a : Node., b : Node. ) : Node. + +A function that remaps the `[0,1]` interval into the `[0,1]` interval. A generalization of the `parabola()`. Keeps the corners mapped to 0 but allows the control of the shape one either side of the curve. Reference: [https://iquilezles.org/articles/functions/](https://iquilezles.org/articles/functions/). + +**x** + +The value to remap. + +**a** + +First control parameter. + +**b** + +Second control parameter. + +**Returns:** The remapped value. + +### .perspectiveDepthToViewZ( depth : Node., near : Node., far : Node. ) : Node. + +TSL function for converting a perspective depth value to a viewZ value. + +**depth** + +The perspective depth. + +**near** + +The camera's near value. + +**far** + +The camera's far value. + +### .pixelationPass( scene : Scene, camera : Camera, pixelSize : Node. | number, normalEdgeStrength : Node. | number, depthEdgeStrength : Node. | number ) : PixelationPassNode + +TSL function for creating a pixelation render pass node for post processing. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +**pixelSize** + +The pixel size. + +Default is `6`. + +**normalEdgeStrength** + +The normal edge strength. + +Default is `0.3`. + +**depthEdgeStrength** + +The depth edge strength. + +Default is `0.4`. + +### .pmremTexture( value : Texture, uvNode : Node., levelNode : Node. ) : PMREMNode + +TSL function for creating a PMREM node. + +**value** + +The input texture. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +### .pointShadow( light : PointLight, shadow : PointLightShadow ) : PointShadowNode + +TSL function for creating an instance of `PointShadowNode`. + +**light** + +The shadow casting point light. + +**shadow** + +An optional point light shadow. + +Default is `null`. + +**Returns:** The created point shadow node. + +### .posterize( sourceNode : Node, stepsNode : Node ) : PosterizeNode + +TSL function for creating a posterize node. + +**sourceNode** + +The input color. + +**stepsNode** + +Controls the intensity of the posterization effect. A lower number results in a more blocky appearance. + +### .pow( x : Node | number, y : Node | number ) : Node + +Return the value of the first parameter raised to the power of the second one. + +**x** + +The first parameter. + +**y** + +The second parameter. + +### .pow2( x : Node | number ) : Node + +Returns the square of the parameter. + +**x** + +The first parameter. + +### .pow3( x : Node | number ) : Node + +Returns the cube of the parameter. + +**x** + +The first parameter. + +### .pow4( x : Node | number ) : Node + +Returns the fourth power of the parameter. + +**x** + +The first parameter. + +### .premultipliedGaussianBlur( node : Node., directionNode : Node.<(vec2|float)>, sigma : number ) : GaussianBlurNode + +TSL function for creating a gaussian blur node for post processing with enabled premultiplied alpha. + +**node** + +The node that represents the input of the effect. + +**directionNode** + +Defines the direction and radius of the blur. + +**sigma** + +Controls the kernel of the blur filter. Higher values mean a wider blur radius. + +**Deprecated:** since r180. Use \`gaussianBlur()\` with \`premultipliedAlpha: true\` option instead. + +### .premultiplyAlpha( color : Node. ) : Node. + +Premultiplies the RGB channels of a color by its alpha channel. + +This function is useful for converting a non-premultiplied alpha color into a premultiplied alpha format, where the RGB values are scaled by the alpha value. Premultiplied alpha is often used in graphics rendering for certain operations, such as compositing and image processing. + +**color** + +The input color with non-premultiplied alpha. + +**Returns:** The color with premultiplied alpha. + +### .property( type : string, name : string ) : PropertyNode + +TSL function for creating a property node. + +**type** + +The type of the node. + +**name** + +The name of the property in the shader. + +Default is `null`. + +### .quadBroadcast( e : number ) : number + +Broadcasts e from the quad invocation with id equal to id. + +**e** + +The value to broadcast. + +**Returns:** The broadcast value. + +### .quadSwapDiagonal( e : number ) : number + +Swaps e between invocations in the quad diagonally. + +**e** + +The value to swap from the current invocation. + +**Returns:** The value received from the swap operation. + +### .quadSwapX( e : number ) : number + +Swaps e between invocations in the quad in the X direction. + +**e** + +The value to swap from the current invocation. + +**Returns:** The value received from the swap operation. + +### .quadSwapY( e : number ) : number + +Swaps e between invocations in the quad in the Y direction. + +**e** + +The value to swap from the current invocation. + +**Returns:** The value received from the swap operation. + +### .radialBlur( textureNode : Node., options : Object ) : Node. + +This TSL function blurs an image in a circular pattern, radiating from a configurable center point in screen space. + +Radial blurs can be used for different kind of effects like producing simple faked lighting effects also known as "light shafts". The major limitation of this specific usage is the center point can only be defined in 2D so the effect does not honor the depth of 3D objects. Consequently, it is not intended for physically correct lit scenes. + +**textureNode** + +The texture node that should be blurred. + +**options** + +Additional options for the radial blur effect. + +Default is `{}`. + +**center** + +The center of the light in screen uvs. + +Default is `vec2(0.5, 0.5)`. + +**weight** + +Base weight factor for each sample in the range `[0,1]`. + +Default is `float(0.9)`. + +**decay** + +Decreases the weight factor so each iteration adds less to the sum. Must be in the range `[0,1]`. If you increase the sample count, you have to increase this option as well to avoid a darking effect. + +Default is `float(0.95)`. + +**count** + +The number if iterations. Should be in the range `[16,64]`. + +Default is `int(32)`. + +**exposure** + +Exposure control of the blur. + +Default is `float(5)`. + +**Returns:** The blurred texture node. + +### .radians( x : Node | number ) : Node + +Converts a quantity in degrees to radians. + +**x** + +The input in degrees. + +### .rand( uv : Node. ) : Node. + +Returns a random value for the given uv. + +**uv** + +The uv node. + +### .range( minNode : Node., maxNode : Node. ) : RangeNode + +TSL function for creating a range node. + +**minNode** + +A node defining the lower bound of the range. + +Default is `float()`. + +**maxNode** + +A node defining the upper bound of the range. + +Default is `float()`. + +### .rangeFogFactor( near : Node, far : Node ) + +Constructs a new range factor node. + +**near** + +Defines the near value. + +**far** + +Defines the far value. + +### .reciprocal( x : Node | number ) : Node + +Returns the reciprocal of the parameter `(1/x)`. + +**x** + +The parameter. + +### .reference( name : string, type : string, object : Object ) : ReferenceBaseNode + +TSL function for creating a reference base node. + +**name** + +The name of the property the node refers to. + +**type** + +The uniform type that should be used to represent the property value. + +**object** + +The object the property belongs to. + +### .reference( name : string, type : string, object : Object ) : ReferenceNode + +TSL function for creating a reference node. + +**name** + +The name of the property the node refers to. + +**type** + +The uniform type that should be used to represent the property value. + +**object** + +The object the property belongs to. + +### .referenceBuffer( name : string, type : string, count : number, object : Object ) : ReferenceBaseNode + +TSL function for creating a reference base node. Use this function if you want need a reference to an array-like property that should be represented as a uniform buffer. + +**name** + +The name of the property the node refers to. + +**type** + +The uniform type that should be used to represent the property value. + +**count** + +The number of value inside the array-like object. + +**object** + +An array-like object the property belongs to. + +### .referenceBuffer( name : string, type : string, count : number, object : Object ) : ReferenceNode + +TSL function for creating a reference node. Use this function if you want need a reference to an array-like property that should be represented as a uniform buffer. + +**name** + +The name of the property the node refers to. + +**type** + +The uniform type that should be used to represent the property value. + +**count** + +The number of value inside the array-like object. + +**object** + +An array-like object the property belongs to. + +### .reflect( I : Node.<(vec2|vec3|vec4)>, N : Node.<(vec2|vec3|vec4)> ) : Node.<(vec2|vec3|vec4)> + +Calculates the reflection direction for an incident vector. + +**I** + +The incident vector. + +**N** + +The normal vector. + +### .reflector( parameters : Object ) : ReflectorNode + +TSL function for creating a reflector node. + +**parameters** + +An object holding configuration parameters. + +Default is `{}`. + +**target** + +The 3D object the reflector is linked to. + +Default is `new Object3D()`. + +**resolution** + +The resolution scale. + +Default is `1`. + +**generateMipmaps** + +Whether mipmaps should be generated or not. + +Default is `false`. + +**bounces** + +Whether reflectors can render other reflector nodes or not. + +Default is `true`. + +**depth** + +Whether depth data should be generated or not. + +Default is `false`. + +**samples** + +Anti-Aliasing samples of the internal render-target. + +**defaultTexture** + +The default texture node. + +**reflector** + +The reflector base node. + +### .refract( I : Node.<(vec2|vec3|vec4)>, N : Node.<(vec2|vec3|vec4)>, eta : Node. ) : Node.<(vec2|vec3|vec4)> + +Calculates the refraction direction for an incident vector. + +**I** + +The incident vector. + +**N** + +The normal vector. + +**eta** + +The ratio of indices of refraction. + +### .reinhardToneMapping( color : Node., exposure : Node. ) : Node. + +Reinhard tone mapping. + +Reference: [https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf](https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf) + +**color** + +The color that should be tone mapped. + +**exposure** + +The exposure. + +**Returns:** The tone mapped color. + +### .remap( node : Node, inLowNode : Node, inHighNode : Node, outLowNode : Node, outHighNode : Node ) : RemapNode + +TSL function for creating a remap node. + +**node** + +The node that should be remapped. + +**inLowNode** + +The source or current lower bound of the range. + +**inHighNode** + +The source or current upper bound of the range. + +**outLowNode** + +The target lower bound of the range. + +Default is `float(0)`. + +**outHighNode** + +The target upper bound of the range. + +Default is `float(1)`. + +### .remapClamp( node : Node, inLowNode : Node, inHighNode : Node, outLowNode : Node, outHighNode : Node ) : RemapNode + +TSL function for creating a remap node, but with enabled clamping. + +**node** + +The node that should be remapped. + +**inLowNode** + +The source or current lower bound of the range. + +**inHighNode** + +The source or current upper bound of the range. + +**outLowNode** + +The target lower bound of the range. + +Default is `float(0)`. + +**outHighNode** + +The target upper bound of the range. + +Default is `float(1)`. + +### .renderOutput( color : Node, toneMapping : number, outputColorSpace : string ) : RenderOutputNode + +TSL function for creating a posterize node. + +**color** + +The color node to process. + +**toneMapping** + +The tone mapping type. + +Default is `null`. + +**outputColorSpace** + +The output color space. + +Default is `null`. + +### .rendererReference( name : string, type : string, renderer : Renderer ) : RendererReferenceNode + +TSL function for creating a renderer reference node. + +**name** + +The name of the property the node refers to. + +**type** + +The uniform type that should be used to represent the property value. + +**renderer** + +The renderer the property belongs to. When no renderer is set, the node refers to the renderer of the current state. + +Default is `null`. + +### .replaceDefaultUV( callback : function, node : Node ) : ContextNode + +Replaces the default UV coordinates used in texture lookups. + +```js +material.contextNode = replaceDefaultUV( ( textureNode ) => { + // ... + return customUVCoordinates; +} ); +``` + +**callback** + +A callback that receives the texture node and must return the new uv coordinates. + +**node** + +An optional node to which the context will be applied. + +Default is `null`. + +**Returns:** A context node that replaces the default UV coordinates. + +### .rgbShift( node : Node., amount : number, angle : number ) : RGBShiftNode + +TSL function for creating a RGB shift or split effect for post processing. + +**node** + +The node that represents the input of the effect. + +**amount** + +The amount of the RGB shift. + +Default is `0.005`. + +**angle** + +Defines in which direction colors are shifted. + +Default is `0`. + +### .rotate( positionNode : Node, rotationNode : Node ) : RotateNode + +TSL function for creating a rotate node. + +**positionNode** + +The position node. + +**rotationNode** + +Represents the rotation that is applied to the position node. Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. + +### .rotateUV( uv : Node., rotation : Node., center : Node. ) : Node. + +Rotates the given uv coordinates around a center point + +**uv** + +The uv coordinates. + +**rotation** + +The rotation defined in radians. + +**center** + +The center of rotation + +**Returns:** The rotated uv coordinates. + +### .round( x : Node | number ) : Node + +Rounds the parameter to the nearest integer. + +**x** + +The parameter. + +### .rtt( node : Node, width : number, height : number, options : Object ) : RTTNode + +TSL function for creating a RTT node. + +**node** + +The node to render a texture with. + +**width** + +The width of the internal render target. If not width is applied, the render target is automatically resized. + +Default is `null`. + +**height** + +The height of the internal render target. + +Default is `null`. + +**options** + +The options for the internal render target. + +Default is `{type:HalfFloatType}`. + +### .sRGBTransferEOTF( color : Node. ) : Node. + +Converts the given color value from sRGB to linear-sRGB color space. + +**color** + +The sRGB color. + +**Returns:** The linear-sRGB color. + +### .sRGBTransferOETF( color : Node. ) : Node. + +Converts the given color value from linear-sRGB to sRGB color space. + +**color** + +The linear-sRGB color. + +**Returns:** The sRGB color. + +### .sampler( value : TextureNode | Texture ) : Node + +Converts a texture or texture node to a sampler. + +**value** + +The texture or texture node to convert. + +### .samplerComparison( value : TextureNode | Texture ) : Node + +Converts a texture or texture node to a sampler comparison. + +**value** + +The texture or texture node to convert. + +### .saturate( value : Node | number ) : Node + +Constrains a value between `0` and `1`. + +**value** + +The value to constrain. + +### .saturation( color : Node., adjustment : Node. ) : Node. + +Super-saturates or desaturates the given RGB color. + +**color** + +The input color. + +**adjustment** + +Specifies the amount of the conversion. A value under `1` desaturates the color, a value over `1` super-saturates it. + +Default is `1`. + +**Returns:** The saturated color. + +### .scriptable( codeNode : CodeNode, parameters : Object ) : ScriptableNode + +TSL function for creating a scriptable node. + +**codeNode** + +The code node. + +**parameters** + +The parameters definition. + +Default is `{}`. + +### .scriptableValue( value : any ) : ScriptableValueNode + +TSL function for creating a scriptable value node. + +**value** + +The value. + +### .select( condNode : Node, ifNode : Node, elseNode : Node ) : ConditionalNode + +TSL function for creating a conditional node. + +**condNode** + +The node that defines the condition. + +**ifNode** + +The node that is evaluate when the condition ends up `true`. + +**elseNode** + +The node that is evaluate when the condition ends up `false`. + +Default is `null`. + +### .sepia( color : Node. ) : Node. + +Applies a sepia effect to the given color node. + +**color** + +The color node to apply the sepia for. + +**Returns:** The updated color node. + +### .setName( node : Node, name : string ) : ContextNode + +TSL function for defining a name for the context value for a given node. + +**node** + +The node whose context should be modified. + +**name** + +The name to set. + +### .shadow( light : Light, shadow : LightShadow ) : ShadowNode + +TSL function for creating an instance of `ShadowNode`. + +**light** + +The shadow casting light. + +**shadow** + +The light shadow. + +**Returns:** The created shadow node. + +### .shapeCircle( coord : Node. ) : Node. + +Generates a circle based on the uv coordinates. + +**coord** + +The uv to generate the circle. + +**Returns:** The circle shape. + +### .sharedUniformGroup( name : string, order : number ) : UniformGroupNode + +TSL function for creating a shared uniform group node with the given name and order. + +**name** + +The name of the uniform group node. + +**order** + +Influences the internal sorting. + +Default is `0`. + +### .shiftLeft( a : Node, b : Node ) : OperatorNode + +Shifts a node to the left. + +**a** + +The node to shift. + +**b** + +The value to shift. + +### .shiftRight( a : Node, b : Node ) : OperatorNode + +Shifts a node to the right. + +**a** + +The node to shift. + +**b** + +The value to shift. + +### .sign( x : Node | number ) : Node + +Extracts the sign of the parameter. + +**x** + +The parameter. + +### .sin( x : Node | number ) : Node + +Returns the sine of the parameter. + +**x** + +The parameter. + +### .sinc( x : Node., k : Node. ) : Node. + +A phase shifted sinus curve that starts at zero and ends at zero, with bouncing behavior. Reference: [https://iquilezles.org/articles/functions/](https://iquilezles.org/articles/functions/). + +**x** + +The value to compute the sin for. + +**k** + +Controls the amount of bounces. + +**Returns:** The result value. + +### .skinning( skinnedMesh : SkinnedMesh ) : SkinningNode + +TSL function for creating a skinning node. + +**skinnedMesh** + +The skinned mesh. + +### .smaa( node : Node. ) : SMAANode + +TSL function for creating a SMAA node for anti-aliasing via post processing. + +**node** + +The node that represents the input of the effect. + +### .smoothstep( low : Node | number, high : Node | number, x : Node | number ) : Node + +Performs a Hermite interpolation between two values. + +**low** + +The value of the lower edge of the Hermite function. + +**high** + +The value of the upper edge of the Hermite function. + +**x** + +The source value for interpolation. + +### .smoothstepElement( x : Node | number, low : Node | number, high : Node | number ) : Node + +Alias for `smoothstep()` with a different parameter order. + +**x** + +The source value for interpolation. + +**low** + +The value of the lower edge of the Hermite function. + +**high** + +The value of the upper edge of the Hermite function. + +### .sobel( node : Node. ) : SobelOperatorNode + +TSL function for creating a sobel operator node which performs edge detection with a sobel filter. + +**node** + +The node that represents the input of the effect. + +### .spherizeUV( uv : Node., strength : Node., center : Node. ) : Node. + +Applies a spherical warping effect to the given uv coordinates. + +**uv** + +The uv coordinates. + +**strength** + +The strength of the effect. + +**center** + +The center point + +**Returns:** The updated uv coordinates. + +### .spritesheetUV( countNode : Node., uvNode : Node., frameNode : Node. ) : SpriteSheetUVNode + +TSL function for creating a sprite sheet uv node. + +**countNode** + +The node that defines the number of sprites in the x and y direction (e.g 6x6). + +**uvNode** + +The uv node. + +Default is `uv()`. + +**frameNode** + +The node that defines the current frame/sprite. + +Default is `float()`. + +### .sqrt( x : Node | number ) : Node + +Returns the square root of the parameter. + +**x** + +The parameter. + +### .ssaaPass( scene : Scene, camera : Camera ) : SSAAPassNode + +TSL function for creating a SSAA pass node for Supersampling Anti-Aliasing. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +### .ssgi( beautyNode : TextureNode, depthNode : TextureNode, normalNode : TextureNode, camera : Camera ) : SSGINode + +TSL function for creating a SSGI effect. + +**beautyNode** + +The texture node that represents the input of the effect. + +**depthNode** + +A texture node that represents the scene's depth. + +**normalNode** + +A texture node that represents the scene's normals. + +**camera** + +The camera the scene is rendered with. + +### .ssr( colorNode : Node., depthNode : Node., normalNode : Node., metalnessNode : Node., roughnessNode : Node., camera : Camera ) : SSRNode + +TSL function for creating screen space reflections (SSR). + +**colorNode** + +The node that represents the beauty pass. + +**depthNode** + +A node that represents the beauty pass's depth. + +**normalNode** + +A node that represents the beauty pass's normals. + +**metalnessNode** + +A node that represents the beauty pass's metalness. + +**roughnessNode** + +A node that represents the beauty pass's roughness. + +Default is `null`. + +**camera** + +The camera the scene is rendered with. + +Default is `null`. + +### .sss( depthNode : TextureNode, camera : Camera, mainLight : DirectionalLight ) : SSSNode + +TSL function for creating a SSS effect. + +**depthNode** + +A texture node that represents the scene's depth. + +**camera** + +The camera the scene is rendered with. + +**mainLight** + +The main directional light of the scene. + +### .stack( parent : StackNode ) : StackNode + +TSL function for creating a stack node. + +**parent** + +The parent stack node. + +Default is `null`. + +### .step( x : Node | number, y : Node | number ) : Node + +Generate a step function by comparing two values. + +**x** + +The y parameter. + +**y** + +The x parameter. + +### .stepElement( x : Node | number, edge : Node | number ) : Node + +Alias for `step()` with a different parameter order. + +**x** + +The source value for interpolation. + +**edge** + +The edge value. + +### .stereoPass( scene : Scene, camera : Camera ) : StereoPassNode + +TSL function for creating a stereo pass node for stereoscopic rendering. + +**scene** + +The scene to render. + +**camera** + +The camera to render the scene with. + +### .storage( value : StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, type : string | Struct, count : number ) : StorageBufferNode + +TSL function for creating a storage buffer node. + +**value** + +The buffer data. + +**type** + +The buffer type (e.g. `'vec3'`). + +Default is `null`. + +**count** + +The buffer count. + +Default is `0`. + +### .storageBarrier() : BarrierNode + +TSL function for creating a storage barrier. All invocations must wait for each access to variables within the 'storage' address space to complete before the barrier can be passed. + +### .storageElement( storageBufferNode : StorageBufferNode, indexNode : Node ) : StorageArrayElementNode + +TSL function for creating a storage element node. + +**storageBufferNode** + +The storage buffer node. + +**indexNode** + +The index node that defines the element access. + +### .storageTexture( value : StorageTexture, uvNode : Node.<(vec2|vec3)>, storeNode : Node ) : StorageTextureNode + +TSL function for creating a storage texture node. + +**value** + +The storage texture. + +**uvNode** + +The uv node. + +**storeNode** + +The value node that should be stored in the texture. + +Default is `null`. + +### .struct( membersLayout : Object, name : string ) : function + +TSL function for creating a struct node. + +**membersLayout** + +The layout of the struct members. + +**name** + +The name of the struct. + +Default is `null`. + +**Returns:** The struct function. + +### .sub( a : Node, b : Node, …params : Node ) : OperatorNode + +Returns the subtraction of two or more value. + +**a** + +The first input. + +**b** + +The second input. + +**params** + +Additional input parameters. + +### .subBuild( node : Node, name : string, type : string ) : Node + +Creates a new sub-build node. + +**node** + +The node to be built in the sub-build. + +**name** + +The name of the sub-build. + +**type** + +The type of the node, if known. + +Default is `null`. + +**Returns:** A node object wrapping the SubBuildNode instance. + +### .subgroupAdd( e : number ) : number + +A reduction that adds e among all active invocations and returns that result. + +**e** + +The value provided to the reduction by the current invocation. + +**Returns:** The accumulated result of the reduction operation. + +### .subgroupAll() : bool + +Returns true if e is true for all active invocations in the subgroup. + +**Returns:** The result of the computation. + +### .subgroupAnd( e : number ) : number + +A reduction that performs a bitwise and of e among all active invocations and returns that result. + +**e** + +The value provided to the reduction by the current invocation. + +**Returns:** The result of the reduction operation. + +### .subgroupAny() : bool + +Returns true if e is true for any active invocation in the subgroup + +**Returns:** The result of the computation. + +### .subgroupBallot( pred : bool ) : vec4.. + +Returns a set of bitfields where the bit corresponding to subgroup\_invocation\_id is 1 if pred is true for that active invocation and 0 otherwise. + +**pred** + +A boolean that sets the bit corresponding to the invocations subgroup invocation id. + +**Returns:** + +* A bitfield corresponding to the pred value of each subgroup invocation. + +### .subgroupBroadcast( e : number, id : number ) : number + +Broadcasts e from the invocation whose subgroup\_invocation\_id matches id, to all active invocations. + +**e** + +The value to broadcast from subgroup invocation 'id'. + +**id** + +The subgroup invocation to broadcast from. + +**Returns:** The broadcast value. + +### .subgroupBroadcastFirst( e : number, id : number ) : number + +Broadcasts e from the active invocation with the lowest subgroup\_invocation\_id in the subgroup to all other active invocations. + +**e** + +The value to broadcast from the lowest subgroup invocation. + +**id** + +The subgroup invocation to broadcast from. + +**Returns:** The broadcast value. + +### .subgroupElect() : bool + +Returns true if this invocation has the lowest subgroup\_invocation\_id among active invocations in the subgroup. + +**Returns:** The result of the computation. + +### .subgroupExclusiveAdd( e : number ) : number + +An exclusive scan that returns the sum of e for all active invocations with subgroup\_invocation\_id less than this invocation. + +**e** + +The value provided to the exclusive scan by the current invocation. + +**Returns:** The accumulated result of the exclusive scan operation. + +### .subgroupExclusiveMul( e : number ) : number + +An exclusive scan that returns the product of e for all active invocations with subgroup\_invocation\_id less than this invocation. + +**e** + +The value provided to the exclusive scan by the current invocation. + +**Returns:** The accumulated result of the exclusive scan operation. + +### .subgroupInclusiveAdd( e : number ) : number + +An inclusive scan returning the sum of e for all active invocations with subgroup\_invocation\_id less than or equal to this invocation. + +**e** + +The value provided to the inclusive scan by the current invocation. + +**Returns:** The accumulated result of the inclusive scan operation. + +### .subgroupInclusiveMul( e : number ) : number + +An inclusive scan returning the product of e for all active invocations with subgroup\_invocation\_id less than or equal to this invocation. + +**e** + +The value provided to the inclusive scan by the current invocation. + +**Returns:** The accumulated result of the inclusive scan operation. + +### .subgroupMax( e : number ) : number + +A reduction that performs a max of e among all active invocations and returns that result. + +**e** + +The value provided to the reduction by the current invocation. + +**Returns:** The result of the reduction operation. + +### .subgroupMin( e : number ) : number + +A reduction that performs a min of e among all active invocations and returns that result. + +**e** + +The value provided to the reduction by the current invocation. + +**Returns:** The result of the reduction operation. + +### .subgroupMul( e : number ) : number + +A reduction that multiplies e among all active invocations and returns that result. + +**e** + +The value provided to the reduction by the current invocation. + +**Returns:** The accumulated result of the reduction operation. + +### .subgroupOr( e : number ) : number + +A reduction that performs a bitwise or of e among all active invocations and returns that result. + +**e** + +The value provided to the reduction by the current invocation. + +**Returns:** The result of the reduction operation. + +### .subgroupShuffle( v : number, id : number ) : number + +Returns v from the active invocation whose subgroup\_invocation\_id matches id + +**v** + +The value to return from subgroup invocation id^mask. + +**id** + +The subgroup invocation which returns the value v. + +**Returns:** The broadcast value. + +### .subgroupShuffleDown( v : number, delta : number ) : number + +Returns v from the active invocation whose subgroup\_invocation\_id matches subgroup\_invocation\_id + delta + +**v** + +The value to return from subgroup invocation id^mask. + +**delta** + +A value that offsets the current subgroup invocation. + +**Returns:** The broadcast value. + +### .subgroupShuffleUp( v : number, delta : number ) : number + +Returns v from the active invocation whose subgroup\_invocation\_id matches subgroup\_invocation\_id - delta + +**v** + +The value to return from subgroup invocation id^mask. + +**delta** + +A value that offsets the current in. + +**Returns:** The broadcast value. + +### .subgroupShuffleXor( v : number, mask : number ) : number + +Returns v from the active invocation whose subgroup\_invocation\_id matches subgroup\_invocation\_id ^ mask. + +**v** + +The value to return from subgroup invocation id^mask. + +**mask** + +A bitmask that determines the target invocation via a XOR operation. + +**Returns:** The broadcast value. + +### .subgroupXor( e : number ) : number + +A reduction that performs a bitwise xor of e among all active invocations and returns that result. + +**e** + +The value provided to the reduction by the current invocation. + +**Returns:** The result of the reduction operation. + +### .tan( x : Node | number ) : Node + +Returns the tangent of the parameter. + +**x** + +The parameter. + +### .texture( value : Texture | TextureNode, uvNode : Node.<(vec2|vec3)>, levelNode : Node., biasNode : Node. ) : TextureNode + +TSL function for creating a texture node or sample a texture node already existing. + +**value** + +The texture. + +Default is `EmptyTexture`. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +**biasNode** + +The bias node. + +Default is `null`. + +### .texture3D( value : Data3DTexture, uvNode : Node., levelNode : Node. ) : Texture3DNode + +TSL function for creating a 3D texture node. + +**value** + +The 3D texture. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +### .texture3DLevel( value : Texture | TextureNode, uvNode : Node., levelNode : Node. ) : TextureNode + +TSL function for creating a texture node that fetches/loads texels without interpolation. + +**value** + +The texture. + +Default is `EmptyTexture`. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +### .texture3DLoad( value : Texture | TextureNode, uvNode : Node., levelNode : Node., biasNode : Node. ) : TextureNode + +TSL function for creating a texture node that fetches/loads texels without interpolation. + +**value** + +The texture. + +Default is `EmptyTexture`. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +**biasNode** + +The bias node. + +Default is `null`. + +### .textureBarrier() : BarrierNode + +TSL function for creating a texture barrier. All invocations must wait for each access to variables within the 'texture' address space to complete before the barrier can be passed. + +### .textureBase( value : Texture, uvNode : Node.<(vec2|vec3)>, levelNode : Node., biasNode : Node. ) : TextureNode + +TSL function for creating a texture node. + +**value** + +The texture. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +**biasNode** + +The bias node. + +Default is `null`. + +### .textureBicubic( textureNode : TextureNode, strength : Node. ) : Node + +Applies mipped bicubic texture filtering to the given texture node. + +**textureNode** + +The texture node that should be filtered. + +**strength** + +Defines the strength of the bicubic filtering. + +**Returns:** The filtered texture sample. + +### .textureBicubicLevel( textureNode : TextureNode, lodNode : Node. ) : Node + +Applies mipped bicubic texture filtering to the given texture node. + +**textureNode** + +The texture node that should be filtered. + +**lodNode** + +Defines the LOD to sample from. + +**Returns:** The filtered texture sample. + +### .textureLoad( value : Texture | TextureNode, uvNode : Node.<(vec2|vec3)>, levelNode : Node., biasNode : Node. ) : TextureNode + +TSL function for creating a texture node that fetches/loads texels without interpolation. + +**value** + +The texture. + +Default is `EmptyTexture`. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +**biasNode** + +The bias node. + +Default is `null`. + +### .textureSize( textureNode : TextureNode, levelNode : Node. ) : TextureSizeNode + +TSL function for creating a texture size node. + +**textureNode** + +A texture node which size should be retrieved. + +**levelNode** + +A level node which defines the requested mip. + +Default is `null`. + +### .textureStore( value : StorageTexture, uvNode : Node.<(vec2|vec3)>, storeNode : Node ) : StorageTextureNode + +TODO: Explain difference to `storageTexture()`. + +**value** + +The storage texture. + +**uvNode** + +The uv node. + +**storeNode** + +The value node that should be stored in the texture. + +Default is `null`. + +### .tiledLights( maxLights : number, tileSize : number ) : TiledLightsNode + +TSL function that creates a tiled lights node. + +**maxLights** + +The maximum number of lights. + +Default is `1024`. + +**tileSize** + +The tile size. + +Default is `32`. + +**Returns:** The tiled lights node. + +### .toneMapping( mapping : number, exposure : Node. | number, color : Node. | Color ) : ToneMappingNode. + +TSL function for creating a tone mapping node. + +**mapping** + +The tone mapping type. + +**exposure** + +The tone mapping exposure. + +**color** + +The color node to process. + +### .toonOutlinePass( scene : Scene, camera : Camera, color : Color, thickness : number, alpha : number ) : ToonOutlinePassNode + +TSL function for creating a toon outline pass node. + +**scene** + +A reference to the scene. + +**camera** + +A reference to the camera. + +**color** + +Defines the outline's color. + +**thickness** + +Defines the outline's thickness. + +Default is `0.003`. + +**alpha** + +Defines the outline's alpha. + +Default is `1`. + +### .traa( beautyNode : TextureNode, depthNode : TextureNode, velocityNode : TextureNode, camera : Camera ) : TRAANode + +TSL function for creating a TRAA node for Temporal Reprojection Anti-Aliasing. + +**beautyNode** + +The texture node that represents the input of the effect. + +**depthNode** + +A node that represents the scene's depth. + +**velocityNode** + +A node that represents the scene's velocity. + +**camera** + +The camera the scene is rendered with. + +### .transformDirection( direction : Node.<(vec2|vec3|vec4)>, matrix : Node.<(mat2|mat3|mat4)> ) : Node + +Transforms the direction of a vector by a matrix and then normalizes the result. + +**direction** + +The direction vector. + +**matrix** + +The transformation matrix. + +### .transformNormal( normal : Node., matrix : Node. ) : Node. + +Transforms the normal with the given matrix. + +**normal** + +The normal. + +**matrix** + +The matrix. + +Default is `modelWorldMatrix`. + +**Returns:** The transformed normal. + +### .transformNormalToView( normal : Node., builder : NodeBuilder ) : Node. + +Transforms the given normal from local to view space. + +**normal** + +The normal. + +**builder** + +The current node builder. + +**Returns:** The transformed normal. + +### .transition( nodeA : Node., nodeB : Node., mixTextureNode : Node., mixRatio : Node. | number, threshold : Node. | number, useTexture : Node. | number ) : TransitionNode + +TSL function for creating a transition node for post processing. + +**nodeA** + +A texture node that represents the beauty pass of the first scene. + +**nodeB** + +A texture node that represents the beauty pass of the second scene. + +**mixTextureNode** + +A texture that defines how the transition effect should look like. + +**mixRatio** + +The interpolation factor that controls the mix. + +**threshold** + +Can be used to tweak the linear interpolation. + +**useTexture** + +Whether `mixTextureNode` should influence the transition or not. + +### .transpose( x : Node.<(mat2|mat3|mat4)> ) : Node + +Returns the transpose of a matrix. + +**x** + +The parameter. + +### .triNoise3D( position : Node., speed : Node., time : Node. ) : Node. + +Generates a noise value from the given position, speed and time parameters. + +**position** + +The position. + +**speed** + +The speed. + +**time** + +The time. + +**Returns:** The generated noise. + +### .triplanarTexture( textureXNode : Node, textureYNode : Node, textureZNode : Node, scaleNode : Node., positionNode : Node., normalNode : Node. ) : Node. + +TSL function for creating a triplanar textures node. + +**textureXNode** + +First texture node. + +**textureYNode** + +Second texture node. When not set, the shader will sample from `textureXNode` instead. + +Default is `null`. + +**textureZNode** + +Third texture node. When not set, the shader will sample from `textureXNode` instead. + +Default is `null`. + +**scaleNode** + +The scale node. + +Default is `float(1)`. + +**positionNode** + +Vertex positions in local space. + +Default is `positionLocal`. + +**normalNode** + +Normals in local space. + +Default is `normalLocal`. + +### .triplanarTextures( textureXNode : Node, textureYNode : Node, textureZNode : Node, scaleNode : Node., positionNode : Node., normalNode : Node. ) : Node. + +TSL function for creating a triplanar textures node. + +Can be used for triplanar texture mapping. + +```js +material.colorNode = triplanarTexture( texture( diffuseMap ) ); +``` + +**textureXNode** + +First texture node. + +**textureYNode** + +Second texture node. When not set, the shader will sample from `textureXNode` instead. + +Default is `null`. + +**textureZNode** + +Third texture node. When not set, the shader will sample from `textureXNode` instead. + +Default is `null`. + +**scaleNode** + +The scale node. + +Default is `float(1)`. + +**positionNode** + +Vertex positions in local space. + +Default is `positionLocal`. + +**normalNode** + +Normals in local space. + +Default is `normalLocal`. + +### .trunc( x : Node | number ) : Node + +Truncates the parameter, removing the fractional part. + +**x** + +The parameter. + +### .uintBitsToFloat( value : Node. ) : BitcastNode + +Bitcast an unsigned integer or a vector of unsigned integers to a corresponding float type with the same element size. + +**value** + +The unsigned integer or vector of unsigned integers to bitcast. + +### .uniform( value : any | string, type : string ) : UniformNode + +TSL function for creating a uniform node. + +**value** + +The value of this uniform or your type. Usually a JS primitive or three.js object (vector, matrix, color, texture). + +**type** + +The node type. If no explicit type is defined, the node tries to derive the type from its value. + +### .uniformArray( values : Array., nodeType : string ) : UniformArrayNode + +TSL function for creating an uniform array node. + +**values** + +Array-like data. + +**nodeType** + +The data type of the array elements. + +### .uniformCubeTexture( value : CubeTexture ) : CubeTextureNode + +TSL function for creating a uniform cube texture node. + +**value** + +The cube texture. + +Default is `EmptyTexture`. + +### .uniformFlow( node : Node ) : ContextNode + +TSL function for defining a uniformFlow context value for a given node. + +**node** + +The node whose dependencies should all execute within a uniform control-flow path. + +### .uniformGroup( name : string ) : UniformGroupNode + +TSL function for creating a uniform group node with the given name. + +**name** + +The name of the uniform group node. + +### .uniformTexture( value : Texture ) : TextureNode + +TSL function for creating a uniform texture node. + +**value** + +The texture. + +### .unpackHalf2x16( value : Node. ) : Node + +Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as 16-bit floating-point numbers. Returns a vec2 with both values. + +**value** + +The unsigned integer to be unpacked + +### .unpackNormal( xy : Node. ) : Node. + +Unpacks a tangent space normal, reconstructing the Z component by projecting the X,Y coordinates onto the hemisphere. The X,Y coordinates are expected to be in the \[-1, 1\] range. + +**xy** + +The X,Y coordinates of the normal. + +**Returns:** The resulting normal. + +### .unpackSnorm2x16( value : Node. ) : Node + +Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized signed integers. Returns a vec2 with both values. + +**value** + +The unsigned integer to be unpacked + +### .unpackUnorm2x16( value : Node. ) : Node + +Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized unsigned integers. Returns a vec2 with both values. + +**value** + +The unsigned integer to be unpacked + +### .unpremultiplyAlpha( color : Node. ) : Node. + +Unpremultiplies the RGB channels of a color by its alpha channel. + +This function is useful for converting a premultiplied alpha color back into a non-premultiplied alpha format, where the RGB values are divided by the alpha value. Unpremultiplied alpha is often used in graphics rendering for certain operations, such as compositing and image processing. + +**color** + +The input color with premultiplied alpha. + +**Returns:** The color with non-premultiplied alpha. + +### .userData( name : string, inputType : string, userData : Object ) : UserDataNode + +TSL function for creating a user data node. + +**name** + +The property name that should be referenced by the node. + +**inputType** + +The node data type of the reference. + +**userData** + +A reference to the `userData` object. If not provided, the `userData` property of the 3D object that uses the node material is evaluated. + +### .uv( index : number ) : AttributeNode. + +TSL function for creating an uv attribute node with the given index. + +**index** + +The uv index. + +Default is `0`. + +**Returns:** The uv attribute node. + +### .varying( node : Node, name : string ) : VaryingNode + +TSL function for creating a varying node. + +**node** + +The node for which a varying should be created. + +**name** + +The name of the varying in the shader. + +### .varyingProperty( type : string, name : string ) : PropertyNode + +TSL function for creating a varying property node. + +**type** + +The type of the node. + +**name** + +The name of the varying in the shader. + +Default is `null`. + +### .vertexColor( index : number ) : VertexColorNode + +TSL function for creating a reference node. + +**index** + +The attribute index. + +Default is `0`. + +### .vertexStage( node : Node ) : VaryingNode + +Computes a node in the vertex stage. + +**node** + +The node which should be executed in the vertex stage. + +### .vibrance( color : Node., adjustment : Node. ) : Node. + +Selectively enhance the intensity of less saturated RGB colors. Can result in a more natural and visually appealing image with enhanced color depth compared to ColorAdjustment#saturation. + +**color** + +The input color. + +**adjustment** + +Controls the intensity of the vibrance effect. + +Default is `1`. + +**Returns:** The updated color. + +### .viewZToLogarithmicDepth( viewZ : Node., near : Node., far : Node. ) : Node. + +TSL function for converting a viewZ value to a logarithmic depth value. + +**viewZ** + +The viewZ node. + +**near** + +The camera's near value. + +**far** + +The camera's far value. + +### .viewZToOrthographicDepth( viewZ : Node., near : Node., far : Node. ) : Node. + +TSL function for converting a viewZ value to an orthographic depth value. + +**viewZ** + +The viewZ node. + +**near** + +The camera's near value. + +**far** + +The camera's far value. + +### .viewZToPerspectiveDepth( viewZ : Node., near : Node., far : Node. ) : Node. + +TSL function for converting a viewZ value to a perspective depth value. + +Note: {link https://twitter.com/gonnavis/status/1377183786949959682}. + +**viewZ** + +The viewZ node. + +**near** + +The camera's near value. + +**far** + +The camera's far value. + +### .viewportDepthTexture( uvNode : Node, levelNode : Node ) : ViewportDepthTextureNode + +TSL function for a viewport depth texture node. + +**uvNode** + +The uv node. + +Default is `screenUV`. + +**levelNode** + +The level node. + +Default is `null`. + +### .viewportMipTexture( uvNode : Node, levelNode : Node, framebufferTexture : Texture ) : ViewportTextureNode + +TSL function for creating a viewport texture node with enabled mipmap generation. + +**uvNode** + +The uv node. + +Default is `screenUV`. + +**levelNode** + +The level node. + +Default is `null`. + +**framebufferTexture** + +A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. + +Default is `null`. + +### .viewportSafeUV( uv : Node. ) : Node. + +A special version of a screen uv function that involves a depth comparison when computing the final uvs. The function mitigates visual errors when using viewport texture nodes for refraction purposes. Without this function objects in front of a refractive surface might appear on the refractive surface which is incorrect. + +**uv** + +Optional uv coordinates. By default `screenUV` is used. + +**Returns:** The update uv coordinates. + +### .viewportSharedTexture( uvNode : Node, levelNode : Node ) : ViewportSharedTextureNode + +TSL function for creating a shared viewport texture node. + +**uvNode** + +The uv node. + +Default is `screenUV`. + +**levelNode** + +The level node. + +Default is `null`. + +### .viewportTexture( uvNode : Node, levelNode : Node, framebufferTexture : Texture ) : ViewportTextureNode + +TSL function for creating a viewport texture node. + +**uvNode** + +The uv node. + +Default is `screenUV`. + +**levelNode** + +The level node. + +Default is `null`. + +**framebufferTexture** + +A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. + +Default is `null`. + +### .vogelDiskSample( sampleIndex : Node., samplesCount : Node., phi : Node. ) : Node. + +Vogel disk sampling for uniform circular distribution. + +This function generates sample points distributed uniformly on a disk using the golden angle, resulting in an efficient low-discrepancy sequence for sampling. The rotation parameter (phi) allows randomizing the pattern per-pixel when combined with IGN. + +**sampleIndex** + +The index of the current sample (0-based). + +**samplesCount** + +The total number of samples. + +**phi** + +Rotation angle in radians (typically from IGN \* 2π). + +**Returns:** A 2D point on the unit disk. + +### .wgsl( src : string, includes : Array. ) : CodeNode + +TSL function for creating a WGSL code node. + +**src** + +The native code. + +**includes** + +An array of includes. + +### .workgroupArray( type : string, count : number ) : WorkgroupInfoNode + +TSL function for creating a workgroup info node. Creates a new 'workgroup' scoped array buffer. + +**type** + +The data type of a 'workgroup' scoped buffer element. + +**count** + +The number of elements in the buffer. + +Default is `0`. + +### .workgroupBarrier() : BarrierNode + +TSL function for creating a workgroup barrier. All compute shader invocations must wait for each invocation within a workgroup to complete before the barrier can be surpassed. + +### .workingToColorSpace( node : Node, targetColorSpace : string ) : ColorSpaceNode + +TSL function for converting a given color node from the current working color space to the given color space. + +**node** + +Represents the node to convert. + +**targetColorSpace** + +The target color space. + +### .xor( a : Node, b : Node ) : OperatorNode + +Performs logical XOR on two nodes. + +**a** + +The first input. + +**b** + +The second input. + +## Type Definitions + +### .ConstantsInterpolationSamplingMode + +Represents the different interpolation sampling modes. + +**NORMAL** +string + +Normal sampling mode. + +**CENTROID** +string + +Centroid sampling mode. + +**SAMPLE** +string + +Sample-specific sampling mode. + +**FIRST** +string + +Flat interpolation using the first vertex. + +**EITHER** +string + +Flat interpolation using either vertex. + +### .ConstantsInterpolationSamplingType + +Represents the different interpolation sampling types. + +**PERSPECTIVE** +string + +Perspective-correct interpolation. + +**LINEAR** +string + +Linear interpolation. + +**FLAT** +string + +Flat interpolation. + +### .ConstantsMouse + +This type represents mouse buttons and interaction types in context of controls. + +**MIDDLE** +number + +The left mouse button. + +**LEFT** +number + +The middle mouse button. + +**RIGHT** +number + +The right mouse button. + +**ROTATE** +number + +A rotate interaction. + +**DOLLY** +number + +A dolly interaction. + +**PAN** +number + +A pan interaction. + +### .ConstantsTimestampQuery + +This type represents the different timestamp query types. + +**COMPUTE** +string + +A `compute` timestamp query. + +**RENDER** +string + +A `render` timestamp query. + +### .ConstantsTouch + +This type represents touch interaction types in context of controls. + +**ROTATE** +number + +A rotate interaction. + +**PAN** +number + +A pan interaction. + +**DOLLY\_PAN** +number + +The dolly-pan interaction. + +**DOLLY\_ROTATE** +number + +A dolly-rotate interaction. + +### .DebugConfig + +Debug configuration. + +**checkShaderErrors** +boolean + +Whether shader errors should be checked or not. + +**onShaderError** +function + +A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. + +**getShaderAsync** +function + +Allows the get the raw shader code for the given scene, camera and 3D object. + +### .ShadowMapConfig + +Shadow map configuration + +**enabled** +boolean + +Whether to globally enable shadows or not. + +**transmitted** +boolean + +Whether to enable light transmission through non-opaque materials. + +**type** +number + +The shadow map type. + +### .XRConfig + +XR configuration. + +**enabled** +boolean + +Whether to globally enable XR or not. + +### .onAnimationCallback( time : DOMHighResTimeStamp, frame : XRFrame ) + +Animation loop parameter of `renderer.setAnimationLoop()`. + +**time** + +A timestamp indicating the end time of the previous frame's rendering. + +**frame** + +A reference to the current XR frame. Only relevant when using XR rendering. + +### .onErrorCallback( error : Error ) + +Callback for onError in loaders. + +**error** + +The error which occurred during the loading process. + +### .onProgressCallback( event : ProgressEvent ) + +Callback for onProgress in loaders. + +**event** + +An instance of `ProgressEvent` that represents the current loading status. + +### .renderObjectFunction( object : Object3D, scene : Scene, camera : Camera, geometry : BufferGeometry, material : Material, group : Object, lightsNode : LightsNode, clippingContext : ClippingContext, passId : string ) + +Callback for [Renderer#setRenderObjectFunction](Renderer.html#setRenderObjectFunction). + +**object** + +The 3D object. + +**scene** + +The scene the 3D object belongs to. + +**camera** + +The camera the object should be rendered with. + +**geometry** + +The object's geometry. + +**material** + +The object's material. + +**group** + +Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + +**lightsNode** + +The current lights node. + +**clippingContext** + +The clipping context. + +**passId** + +An optional ID for identifying the pass. + +Default is `null`. + +### .traverseCallback( node : Node ) + +Callback for [Node#traverse](Node.html#traverse). + +**node** + +The current node. \ No newline at end of file diff --git a/docs/pages/TTFLoader.html.md b/docs/pages/TTFLoader.html.md new file mode 100644 index 00000000000000..313005f7ab4341 --- /dev/null +++ b/docs/pages/TTFLoader.html.md @@ -0,0 +1,81 @@ +*Inheritance: Loader →* + +# TTFLoader + +A loader for the TTF format. + +Loads TTF files and converts them into typeface JSON that can be used directly to create THREE.Font objects. + +## Code Example + +```js +const loader = new TTFLoader(); +const json = await loader.loadAsync( 'fonts/ttf/kenpixel.ttf' ); +const font = new Font( json ); +``` + +## Import + +TTFLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TTFLoader } from 'three/addons/loaders/TTFLoader.js'; +``` + +## Constructor + +### new TTFLoader( manager : LoadingManager ) + +Constructs a new TTF loader. + +**manager** + +The loading manager. + +## Properties + +### .reversed : boolean + +Whether the TTF commands should be reversed or not. + +Default is `false`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded TTF asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( arraybuffer : ArrayBuffer ) : Object + +Parses the given TTF data and returns a JSON for creating a font. + +**arraybuffer** + +The raw TTF data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The result JSON. + +## Source + +[examples/jsm/loaders/TTFLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/TTFLoader.js) \ No newline at end of file diff --git a/docs/pages/Tab.html.md b/docs/pages/Tab.html.md new file mode 100644 index 00000000000000..e2a6ce428e3331 --- /dev/null +++ b/docs/pages/Tab.html.md @@ -0,0 +1,39 @@ +# Tab + +Tab class + +## Constructor + +### new Tab( title : string, options : Object ) + +**title** + +The title of the tab + +**options** + +Options for the tab + +**allowDetach** + +Whether the tab can be detached into a separate window + +Default is `true`. + +**builtin** + +Whether the tab should appear in the profiler-toggle button + +Default is `false`. + +**icon** + +SVG icon HTML for the builtin button + +## Classes + +[Tab](Tab.html) + +## Source + +[examples/jsm/inspector/ui/Tab.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/inspector/ui/Tab.js) \ No newline at end of file diff --git a/docs/pages/TeapotGeometry.html.md b/docs/pages/TeapotGeometry.html.md new file mode 100644 index 00000000000000..f12e9a46443823 --- /dev/null +++ b/docs/pages/TeapotGeometry.html.md @@ -0,0 +1,80 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# TeapotGeometry + +Tessellates the famous Utah teapot database by Martin Newell into triangles. + +The teapot should normally be rendered as a double sided object, since for some patches both sides can be seen, e.g., the gap around the lid and inside the spout. + +Segments 'n' determines the number of triangles output. Total triangles = 32_2_n_n - 8_n (degenerates at the top and bottom cusps are deleted). + +Code based on [SPD software](http://tog.acm.org/resources/SPD/) Created for the Udacity course [Interactive Rendering](http://bit.ly/ericity) + +## Code Example + +```js +const geometry = new TeapotGeometry( 50, 18 ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +const teapot = new THREE.Mesh( geometry, material ); +scene.add( teapot ); +``` + +## Import + +TeapotGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; +``` + +## Constructor + +### new TeapotGeometry( size : number, segments : number, bottom : boolean, lid : boolean, body : boolean, fitLid : boolean, blinn : boolean ) + +Constructs a new teapot geometry. + +**size** + +Relative scale of the teapot. + +Default is `50`. + +**segments** + +Number of line segments to subdivide each patch edge. + +Default is `10`. + +**bottom** + +Whether the bottom of the teapot is generated or not. + +Default is `true`. + +**lid** + +Whether the lid is generated or not. + +Default is `true`. + +**body** + +Whether the body is generated or not. + +Default is `true`. + +**fitLid** + +Whether the lid is slightly stretched to prevent gaps between the body and lid or not. + +Default is `true`. + +**blinn** + +Whether the teapot is scaled vertically for better aesthetics or not. + +Default is `true`. + +## Source + +[examples/jsm/geometries/TeapotGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/TeapotGeometry.js) \ No newline at end of file diff --git a/docs/pages/TempNode.html.md b/docs/pages/TempNode.html.md new file mode 100644 index 00000000000000..8463e7ecce3785 --- /dev/null +++ b/docs/pages/TempNode.html.md @@ -0,0 +1,43 @@ +*Inheritance: EventDispatcher → Node →* + +# TempNode + +This module uses cache management to create temporary variables if the node is used more than once to prevent duplicate calculations. + +The class acts as a base class for many other nodes types. + +## Constructor + +### new TempNode( nodeType : string ) + +Constructs a temp node. + +**nodeType** + +The node type. + +Default is `null`. + +## Properties + +### .isTempNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .hasDependencies( builder : NodeBuilder ) : boolean + +Whether this node is used more than once in context of other nodes. + +**builder** + +The node builder. + +**Returns:** A flag that indicates if there is more than one dependency to other nodes. + +## Source + +[src/nodes/core/TempNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/TempNode.js) \ No newline at end of file diff --git a/docs/pages/TessellateModifier.html.md b/docs/pages/TessellateModifier.html.md new file mode 100644 index 00000000000000..4f9c38f7951238 --- /dev/null +++ b/docs/pages/TessellateModifier.html.md @@ -0,0 +1,66 @@ +# TessellateModifier + +This class can be used to modify a geometry by breaking its edges if they are longer than maximum length. + +## Code Example + +```js +const modifier = new TessellateModifier( 8, 6 ); +geometry = modifier.modify( geometry ); +``` + +## Import + +TessellateModifier is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TessellateModifier } from 'three/addons/modifiers/TessellateModifier.js'; +``` + +## Constructor + +### new TessellateModifier( maxEdgeLength : number, maxIterations : number ) + +Constructs a new Tessellate modifier. + +**maxEdgeLength** + +The maximum edge length. + +Default is `0.1`. + +**maxIterations** + +The number of iterations. + +Default is `6`. + +## Properties + +### .maxEdgeLength : number + +The maximum edge length. + +Default is `0.1`. + +### .maxIterations : number + +The maximum edge length. + +Default is `0.1`. + +## Methods + +### .modify( geometry : BufferGeometry ) : BufferGeometry + +Returns a new, modified version of the given geometry by applying a tesselation. Please note that the resulting geometry is always non-indexed. + +**geometry** + +The geometry to modify. + +**Returns:** A new, modified geometry. + +## Source + +[examples/jsm/modifiers/TessellateModifier.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/modifiers/TessellateModifier.js) \ No newline at end of file diff --git a/docs/pages/TetrahedronGeometry.html.md b/docs/pages/TetrahedronGeometry.html.md new file mode 100644 index 00000000000000..ec5630ec854b20 --- /dev/null +++ b/docs/pages/TetrahedronGeometry.html.md @@ -0,0 +1,56 @@ +*Inheritance: EventDispatcher → BufferGeometry → PolyhedronGeometry →* + +# TetrahedronGeometry + +A geometry class for representing an tetrahedron. + +## Code Example + +```js +const geometry = new THREE.TetrahedronGeometry(); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const tetrahedron = new THREE.Mesh( geometry, material ); +scene.add( tetrahedron ); +``` + +## Constructor + +### new TetrahedronGeometry( radius : number, detail : number ) + +Constructs a new tetrahedron geometry. + +**radius** + +Radius of the tetrahedron. + +Default is `1`. + +**detail** + +Setting this to a value greater than `0` adds vertices making it no longer a tetrahedron. + +Default is `0`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +**Overrides:** [PolyhedronGeometry#parameters](PolyhedronGeometry.html#parameters) + +## Static Methods + +### .fromJSON( data : Object ) : TetrahedronGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/TetrahedronGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/TetrahedronGeometry.js) \ No newline at end of file diff --git a/docs/pages/TextGeometry.html.md b/docs/pages/TextGeometry.html.md new file mode 100644 index 00000000000000..3797c878f7c9ac --- /dev/null +++ b/docs/pages/TextGeometry.html.md @@ -0,0 +1,141 @@ +*Inheritance: EventDispatcher → BufferGeometry → ExtrudeGeometry →* + +# TextGeometry + +A class for generating text as a single geometry. It is constructed by providing a string of text, and a set of parameters consisting of a loaded font and extrude settings. + +See the [FontLoader](FontLoader.html) page for additional details. + +`TextGeometry` uses [typeface.json](http://gero3.github.io/facetype.js/) generated fonts. Some existing fonts can be found located in `/examples/fonts`. + +## Code Example + +```js +const loader = new FontLoader(); +const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' ); +const geometry = new TextGeometry( 'Hello three.js!', { + font: font, + size: 80, + depth: 5, + curveSegments: 12 +} ); +``` + +## Import + +TextGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; +``` + +## Constructor + +### new TextGeometry( text : string, parameters : TextGeometry~Options ) + +Constructs a new text geometry. + +**text** + +The text that should be transformed into a geometry. + +**parameters** + +The text settings. + +## Type Definitions + +### .Options + +Represents the `options` type of the geometry's constructor. + +**font** +[Font](Font.html) + +The font. + +**size** +number + +The text size. + +Default is `100`. + +**depth** +number + +Depth to extrude the shape. + +Default is `50`. + +**curveSegments** +number + +Number of points on the curves. + +Default is `12`. + +**steps** +number + +Number of points used for subdividing segments along the depth of the extruded spline. + +Default is `1`. + +**bevelEnabled** +boolean + +Whether to beveling to the shape or not. + +Default is `false`. + +**bevelThickness** +number + +How deep into the original shape the bevel goes. + +Default is `10`. + +**bevelSize** +number + +Distance from the shape outline that the bevel extends. + +Default is `8`. + +**bevelOffset** +number + +Distance from the shape outline that the bevel starts. + +Default is `0`. + +**bevelSegments** +number + +Number of bevel layers. + +Default is `3`. + +**direction** +string + +Char direction: ltr(left to right), rtl(right to left) & tb(top bottom). + +Default is `'ltr'`. + +**extrudePath** +[Curve](Curve.html) + +A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion. + +Default is `null`. + +**UVGenerator** +Object + +An object that provides UV generator functions for custom UV generation. + +## Source + +[examples/jsm/geometries/TextGeometry.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/TextGeometry.js) \ No newline at end of file diff --git a/docs/pages/Texture.html.md b/docs/pages/Texture.html.md new file mode 100644 index 00000000000000..442e29ca9d8921 --- /dev/null +++ b/docs/pages/Texture.html.md @@ -0,0 +1,417 @@ +*Inheritance: EventDispatcher →* + +# Texture + +Base class for all textures. + +Note: After the initial use of a texture, its dimensions, format, and type cannot be changed. Instead, call [Texture#dispose](Texture.html#dispose) on the texture and instantiate a new one. + +## Constructor + +### new Texture( image : Object, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, format : number, type : number, anisotropy : number, colorSpace : string ) + +Constructs a new texture. + +**image** + +The image holding the texture data. + +Default is `Texture.DEFAULT_IMAGE`. + +**mapping** + +The texture mapping. + +Default is `Texture.DEFAULT_MAPPING`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `LinearFilter`. + +**minFilter** + +The min filter value. + +Default is `LinearMipmapLinearFilter`. + +**format** + +The texture format. + +Default is `RGBAFormat`. + +**type** + +The texture type. + +Default is `UnsignedByteType`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +**colorSpace** + +The color space. + +Default is `NoColorSpace`. + +## Properties + +### .anisotropy : number + +The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is `1`. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +### .center : Vector2 + +The point around which rotation occurs. A value of `(0.5, 0.5)` corresponds to the center of the texture. Default is `(0, 0)`, the lower left. + +Default is `(0,0)`. + +### .channel : number + +Lets you select the uv attribute to map the texture to. `0` for `uv`, `1` for `uv1`, `2` for `uv2` and `3` for `uv3`. + +Default is `0`. + +### .colorSpace : string + +Textures containing color data should be annotated with `SRGBColorSpace` or `LinearSRGBColorSpace`. + +Default is `NoColorSpace`. + +### .depth + +The depth of the texture in pixels. + +### .flipY : boolean + +If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + +Note that this property has no effect when using `ImageBitmap`. You need to configure the flip on bitmap creation instead. + +Default is `true`. + +### .format : number + +The format of the texture. + +Default is `RGBAFormat`. + +### .generateMipmaps : boolean + +Whether to generate mipmaps (if possible) for a texture. + +Set this to `false` if you are creating mipmaps manually. + +Default is `true`. + +### .height + +The height of the texture in pixels. + +### .id : number (readonly) + +The ID of the texture. + +### .image : Object + +The image object holding the texture data. + +### .internalFormat : string + +The default internal format is derived from [Texture#format](Texture.html#format) and [Texture#type](Texture.html#type) and defines how the texture data is going to be stored on the GPU. + +This property allows to overwrite the default format. + +Default is `null`. + +### .isArrayTexture : boolean (readonly) + +Indicates if a texture should be handled like a texture array. + +Default is `false`. + +### .isRenderTargetTexture : boolean (readonly) + +Indicates whether a texture belongs to a render target or not. + +Default is `false`. + +### .isTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .magFilter : NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | LinearFilter | LinearMipmapNearestFilter | LinearMipmapLinearFilter + +How the texture is sampled when a texel covers more than one pixel. + +Default is `LinearFilter`. + +### .mapping : UVMapping | CubeReflectionMapping | CubeRefractionMapping | EquirectangularReflectionMapping | EquirectangularRefractionMapping | CubeUVReflectionMapping + +How the texture is applied to the object. The value `UVMapping` is the default, where texture or uv coordinates are used to apply the map. + +Default is `UVMapping`. + +### .matrix : Matrix3 + +The uv-transformation matrix of the texture. + +### .matrixAutoUpdate : boolean + +Whether to update the texture's uv-transformation [Texture#matrix](Texture.html#matrix) from the properties [Texture#offset](Texture.html#offset), [Texture#repeat](Texture.html#repeat), [Texture#rotation](Texture.html#rotation), and [Texture#center](Texture.html#center). + +Set this to `false` if you are specifying the uv-transform matrix directly. + +Default is `true`. + +### .minFilter : NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | LinearFilter | LinearMipmapNearestFilter | LinearMipmapLinearFilter + +How the texture is sampled when a texel covers less than one pixel. + +Default is `LinearMipmapLinearFilter`. + +### .mipmaps : Array. + +An array holding user-defined mipmaps. + +### .name : string + +The name of the material. + +### .needsPMREMUpdate : boolean + +Setting this property to `true` indicates the engine the PMREM must be regenerated. + +Default is `false`. + +### .needsUpdate : boolean + +Setting this property to `true` indicates the engine the texture must be updated in the next render. This triggers a texture upload to the GPU and ensures correct texture parameter configuration. + +Default is `false`. + +### .offset : Vector2 + +How much a single repetition of the texture is offset from the beginning, in each direction U and V. Typical range is `0.0` to `1.0`. + +Default is `(0,0)`. + +### .onUpdate : function + +A callback function, called when the texture is updated (e.g., when [Texture#needsUpdate](Texture.html#needsUpdate) has been set to true and then the texture is used). + +Default is `null`. + +### .pmremVersion : number (readonly) + +Indicates whether this texture should be processed by `PMREMGenerator` or not (only relevant for render target textures). + +Default is `0`. + +### .premultiplyAlpha : boolean + +If set to `true`, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU. + +Note that this property has no effect when using `ImageBitmap`. You need to configure premultiply alpha on bitmap creation instead. + +Default is `false`. + +### .renderTarget : RenderTarget | WebGLRenderTarget + +An optional back reference to the textures render target. + +Default is `null`. + +### .repeat : Vector2 + +How many times the texture is repeated across the surface, in each direction U and V. If repeat is set greater than `1` in either direction, the corresponding wrap parameter should also be set to `RepeatWrapping` or `MirroredRepeatWrapping` to achieve the desired tiling effect. + +Default is `(1,1)`. + +### .rotation : number + +How much the texture is rotated around the center point, in radians. Positive values are counter-clockwise. + +Default is `0`. + +### .source : Source + +The data definition of a texture. A reference to the data source can be shared across textures. This is often useful in context of spritesheets where multiple textures render the same data but with different texture transformations. + +### .type : number + +The data type of the texture. + +Default is `UnsignedByteType`. + +### .unpackAlignment : number + +Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are `1` (byte-alignment), `2` (rows aligned to even-numbered bytes), `4` (word-alignment), and `8` (rows start on double-word boundaries). + +Default is `4`. + +### .updateRanges : Array. + +This can be used to only update a subregion or specific rows of the texture (for example, just the first 3 rows). Use the `addUpdateRange()` function to add ranges to this array. + +### .userData : Object + +An object that can be used to store custom data about the texture. It should not hold references to functions as these will not be cloned. + +### .uuid : string (readonly) + +The UUID of the material. + +### .version : number (readonly) + +This starts at `0` and counts how many times [Texture#needsUpdate](Texture.html#needsUpdate) is set to `true`. + +Default is `0`. + +### .width + +The width of the texture in pixels. + +### .wrapS : RepeatWrapping | ClampToEdgeWrapping | MirroredRepeatWrapping + +This defines how the texture is wrapped horizontally and corresponds to _U_ in UV mapping. + +Default is `ClampToEdgeWrapping`. + +### .wrapT : RepeatWrapping | ClampToEdgeWrapping | MirroredRepeatWrapping + +This defines how the texture is wrapped horizontally and corresponds to _V_ in UV mapping. + +Default is `ClampToEdgeWrapping`. + +### .DEFAULT_ANISOTROPY : number + +The default anisotropy value for all textures. + +Default is `1`. + +### .DEFAULT_IMAGE : Image + +The default image for all textures. + +Default is `null`. + +### .DEFAULT_MAPPING : number + +The default mapping for all textures. + +Default is `UVMapping`. + +## Methods + +### .addUpdateRange( start : number, count : number ) + +Adds a range of data in the data texture to be updated on the GPU. + +**start** + +Position at which to start update. + +**count** + +The number of components to update. + +### .clearUpdateRanges() + +Clears the update ranges. + +### .clone() : Texture + +Returns a new texture with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( source : Texture ) : Texture + +Copies the values of the given texture to this instance. + +**source** + +The texture to copy. + +**Returns:** A reference to this instance. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +##### Fires: + +* [Texture#event:dispose](Texture.html#event:dispose) + +### .setValues( values : Object ) + +Sets this texture's properties based on `values`. + +**values** + +A container with texture parameters. + +### .toJSON( meta : Object | string ) : Object + +Serializes the texture into JSON. + +**meta** + +An optional value holding meta information about the serialization. + +See: + +* [ObjectLoader#parse](ObjectLoader.html#parse) + +**Returns:** A JSON object representing the serialized texture. + +### .transformUv( uv : Vector2 ) : Vector2 + +Transforms the given uv vector with the textures uv transformation matrix. + +**uv** + +The uv vector. + +**Returns:** The transformed uv vector. + +### .updateMatrix() + +Updates the texture transformation matrix from the from the properties [Texture#offset](Texture.html#offset), [Texture#repeat](Texture.html#repeat), [Texture#rotation](Texture.html#rotation), and [Texture#center](Texture.html#center). + +## Events + +### .dispose + +Fires when the texture has been disposed of. + +##### Type: + +* Object + +## Source + +[src/textures/Texture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/Texture.js) \ No newline at end of file diff --git a/docs/pages/Texture3DNode.html.md b/docs/pages/Texture3DNode.html.md new file mode 100644 index 00000000000000..ff37c304047959 --- /dev/null +++ b/docs/pages/Texture3DNode.html.md @@ -0,0 +1,129 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode →* + +# Texture3DNode + +This type of uniform node represents a 3D texture. + +## Constructor + +### new Texture3DNode( value : Data3DTexture, uvNode : Node.<(vec2|vec3)>, levelNode : Node. ) + +Constructs a new 3D texture node. + +**value** + +The 3D texture. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +## Properties + +### .isTexture3DNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .generateOffset( builder : NodeBuilder, offsetNode : Node ) : string + +Generates the offset code snippet. + +**builder** + +The current node builder. + +**offsetNode** + +The offset node to generate code for. + +**Overrides:** [TextureNode#generateOffset](TextureNode.html#generateOffset) + +**Returns:** The generated code snippet. + +### .generateUV( builder : NodeBuilder, uvNode : Node ) : string + +Generates the uv code snippet. + +**builder** + +The current node builder. + +**uvNode** + +The uv node to generate code for. + +**Overrides:** [TextureNode#generateUV](TextureNode.html#generateUV) + +**Returns:** The generated code snippet. + +### .getDefaultUV() : Node. + +Returns a default uv node which is in context of 3D textures a three-dimensional uv node. + +**Overrides:** [TextureNode#getDefaultUV](TextureNode.html#getDefaultUV) + +**Returns:** The default uv node. + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation to return a fixed value `'texture3D'`. + +**builder** + +The current node builder. + +**Overrides:** [TextureNode#getInputType](TextureNode.html#getInputType) + +**Returns:** The input type. + +### .normal( uvNode : Node. ) : Node. + +TODO. + +**uvNode** + +The uv node . + +**Returns:** TODO. + +### .setUpdateMatrix( value : boolean ) + +Overwritten with an empty implementation since the `updateMatrix` flag is ignored for 3D textures. The uv transformation matrix is not applied to 3D textures. + +**value** + +The update toggle. + +**Overrides:** [TextureNode#setUpdateMatrix](TextureNode.html#setUpdateMatrix) + +### .setupUV( builder : NodeBuilder, uvNode : Node ) : Node + +Overwrites the default implementation to return the unmodified uv node. + +**builder** + +The current node builder. + +**uvNode** + +The uv node to setup. + +**Overrides:** [TextureNode#setupUV](TextureNode.html#setupUV) + +**Returns:** The unmodified uv node. + +## Source + +[src/nodes/accessors/Texture3DNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/Texture3DNode.js) \ No newline at end of file diff --git a/docs/pages/TextureHelper.html.md b/docs/pages/TextureHelper.html.md new file mode 100644 index 00000000000000..d3c938b60dee9c --- /dev/null +++ b/docs/pages/TextureHelper.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# TextureHelper + +A helper that can be used to display any type of texture for debugging purposes. Depending on the type of texture (2D, 3D, Array), the helper becomes a plane or box mesh. + +This helper can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import from `TextureHelperGPU.js`. + +## Import + +TextureHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TextureHelper } from 'three/addons/helpers/TextureHelper.js'; +``` + +## Constructor + +### new TextureHelper( texture : Texture, width : number, height : number, depth : number ) + +Constructs a new texture helper. + +**texture** + +The texture to visualize. + +**width** + +The helper's width. + +Default is `1`. + +**height** + +The helper's height. + +Default is `1`. + +**depth** + +The helper's depth. + +Default is `1`. + +## Properties + +### .texture : Texture + +The texture to visualize. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[examples/jsm/helpers/TextureHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/TextureHelper.js) \ No newline at end of file diff --git a/docs/pages/TextureLoader.html.md b/docs/pages/TextureLoader.html.md new file mode 100644 index 00000000000000..b65fbcdc5a9291 --- /dev/null +++ b/docs/pages/TextureLoader.html.md @@ -0,0 +1,55 @@ +*Inheritance: Loader →* + +# TextureLoader + +Class for loading textures. Images are internally loaded via [ImageLoader](ImageLoader.html). + +Please note that `TextureLoader` has dropped support for progress events in `r84`. For a `TextureLoader` that supports progress events, see [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145). + +## Code Example + +```js +const loader = new THREE.TextureLoader(); +const texture = await loader.loadAsync( 'textures/land_ocean_ice_cloud_2048.jpg' ); +const material = new THREE.MeshBasicMaterial( { map:texture } ); +``` + +## Constructor + +### new TextureLoader( manager : LoadingManager ) + +Constructs a new texture loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : Texture + +Starts loading from the given URL and pass the fully loaded texture to the `onLoad()` callback. The method also returns a new texture object which can directly be used for material creation. If you do it this way, the texture may pop up in your scene once the respective loading process is finished. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Unsupported in this loader. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The texture. + +## Source + +[src/loaders/TextureLoader.js](https://github.com/mrdoob/three.js/blob/master/src/loaders/TextureLoader.js) \ No newline at end of file diff --git a/docs/pages/TextureNode.html.md b/docs/pages/TextureNode.html.md new file mode 100644 index 00000000000000..eff7b3f750de4c --- /dev/null +++ b/docs/pages/TextureNode.html.md @@ -0,0 +1,445 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode →* + +# TextureNode + +This type of uniform node represents a 2D texture. + +## Constructor + +### new TextureNode( value : Texture, uvNode : Node.<(vec2|vec3)>, levelNode : Node., biasNode : Node. ) + +Constructs a new texture node. + +**value** + +The texture. + +Default is `EmptyTexture`. + +**uvNode** + +The uv node. + +Default is `null`. + +**levelNode** + +The level node. + +Default is `null`. + +**biasNode** + +The bias node. + +Default is `null`. + +## Properties + +### .biasNode : Node. + +Represents the bias to be applied during level-of-detail computation. + +Default is `null`. + +### .compareNode : Node. + +Represents a reference value a texture sample is compared to. + +Default is `null`. + +### .depthNode : Node. + +When using texture arrays, the depth node defines the layer to select. + +Default is `null`. + +### .gradNode : Array.> + +When defined, a texture is sampled using explicit gradients. + +Default is `null`. + +### .isTextureNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .levelNode : Node. + +Represents the mip level that should be selected. + +Default is `null`. + +### .offsetNode : Node.<(ivec2|ivec3)> + +Represents the optional texel offset applied to the unnormalized texture coordinate before sampling the texture. + +Default is `null`. + +### .referenceNode : Node + +The reference node. + +Default is `null`. + +### .sampler : boolean + +Whether texture values should be sampled or fetched. + +Default is `true`. + +### .updateMatrix : boolean + +Whether the uv transformation matrix should be automatically updated or not. Use `setUpdateMatrix()` if you want to change the value of the property. + +Default is `false`. + +### .updateType : string + +By default the `update()` method is not executed. Depending on whether a uv transformation matrix and/or flipY is applied, `update()` is executed per object. + +Default is `'none'`. + +**Overrides:** [UniformNode#updateType](UniformNode.html#updateType) + +### .uvNode : Node.<(vec2|vec3)> + +Represents the texture coordinates. + +Default is `null`. + +### .value : Texture + +The texture value. + +**Overrides:** [UniformNode#value](UniformNode.html#value) + +## Methods + +### .bias( biasNode : Node. ) : TextureNode + +Samples the texture with the given bias. + +**biasNode** + +The bias node. + +**Returns:** A texture node representing the texture sample. + +### .blur( amountNode : Node. ) : TextureNode + +Samples a blurred version of the texture by defining an internal bias. + +**amountNode** + +How blurred the texture should be. + +**Returns:** A texture node representing the texture sample. + +### .clone() : TextureNode + +Clones the texture node. + +**Returns:** The cloned texture node. + +### .compare( compareNode : Node. ) : TextureNode + +Samples the texture by executing a compare operation. + +**compareNode** + +The node that defines the compare value. + +**Returns:** A texture node representing the texture sample. + +### .depth( depthNode : Node. ) : TextureNode + +Samples the texture by defining a depth node. + +**depthNode** + +The depth node. + +**Returns:** A texture node representing the texture sample. + +### .generate( builder : NodeBuilder, output : string ) : string + +Generates the code snippet of the texture node. + +**builder** + +The current node builder. + +**output** + +The current output. + +**Overrides:** [UniformNode#generate](UniformNode.html#generate) + +**Returns:** The generated code snippet. + +### .generateOffset( builder : NodeBuilder, offsetNode : Node ) : string + +Generates the offset code snippet. + +**builder** + +The current node builder. + +**offsetNode** + +The offset node to generate code for. + +**Returns:** The generated code snippet. + +### .generateSnippet( builder : NodeBuilder, textureProperty : string, uvSnippet : string, levelSnippet : string, biasSnippet : string, depthSnippet : string, compareSnippet : string, gradSnippet : Array., offsetSnippet : string ) : string + +Generates the snippet for the texture sampling. + +**builder** + +The current node builder. + +**textureProperty** + +The texture property. + +**uvSnippet** + +The uv snippet. + +**levelSnippet** + +The level snippet. + +**biasSnippet** + +The bias snippet. + +**depthSnippet** + +The depth snippet. + +**compareSnippet** + +The compare snippet. + +**gradSnippet** + +The grad snippet. + +**offsetSnippet** + +The offset snippet. + +**Returns:** The generated code snippet. + +### .generateUV( builder : NodeBuilder, uvNode : Node ) : string + +Generates the uv code snippet. + +**builder** + +The current node builder. + +**uvNode** + +The uv node to generate code for. + +**Returns:** The generated code snippet. + +### .getBase() : TextureNode + +Returns the base texture of this node. + +**Returns:** The base texture node. + +### .getDefaultUV() : AttributeNode. + +Returns a default uvs based on the current texture's channel. + +**Returns:** The default uvs. + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation to return a fixed value `'texture'`. + +**builder** + +The current node builder. + +**Overrides:** [UniformNode#getInputType](UniformNode.html#getInputType) + +**Returns:** The input type. + +### .getNodeType( builder : NodeBuilder ) : string + +Overwritten since the node type is inferred from the texture type. + +**builder** + +The current node builder. + +**Overrides:** [UniformNode#getNodeType](UniformNode.html#getNodeType) + +**Returns:** The node type. + +### .getSampler() : boolean + +Returns the sampler value. + +**Returns:** The sampler value. + +### .getTransformedUV( uvNode : Node ) : Node + +Transforms the given uv node with the texture transformation matrix. + +**uvNode** + +The uv node to transform. + +**Returns:** The transformed uv node. + +### .getUniformHash( builder : NodeBuilder ) : string + +Overwritten since the uniform hash is defined by the texture's UUID. + +**builder** + +The current node builder. + +**Overrides:** [UniformNode#getUniformHash](UniformNode.html#getUniformHash) + +**Returns:** The uniform hash. + +### .grad( gradNodeX : Node., gradNodeY : Node. ) : TextureNode + +Samples the texture using an explicit gradient. + +**gradNodeX** + +The gradX node. + +**gradNodeY** + +The gradY node. + +**Returns:** A texture node representing the texture sample. + +### .level( levelNode : Node. ) : TextureNode + +Samples a specific mip of the texture. + +**levelNode** + +The mip level to sample. + +**Returns:** A texture node representing the texture sample. + +### .load( uvNode : Node. ) : TextureNode + +TSL function for creating a texture node that fetches/loads texels without interpolation. + +**uvNode** + +The uv node. + +**Returns:** A texture node representing the texture load. + +### .offset( offsetNode : Node. ) : TextureNode + +Samples the texture by defining an offset node. + +**offsetNode** + +The offset node. + +**Returns:** A texture node representing the texture sample. + +### .sample( uvNode : Node ) : TextureNode + +Samples the texture with the given uv node. + +**uvNode** + +The uv node. + +**Returns:** A texture node representing the texture sample. + +### .setSampler( value : boolean ) : TextureNode + +Sets the sampler value. + +**value** + +The sampler value to set. + +**Returns:** A reference to this texture node. + +### .setUpdateMatrix( value : boolean ) : TextureNode + +Defines whether the uv transformation matrix should automatically be updated or not. + +**value** + +The update toggle. + +**Returns:** A reference to this node. + +### .setup( builder : NodeBuilder ) + +Setups texture node by preparing the internal nodes for code generation. + +**builder** + +The current node builder. + +**Overrides:** [UniformNode#setup](UniformNode.html#setup) + +### .setupUV( builder : NodeBuilder, uvNode : Node ) : Node + +Setups the uv node. Depending on the backend as well as texture's image and type, it might be necessary to modify the uv node for correct sampling. + +**builder** + +The current node builder. + +**uvNode** + +The uv node to setup. + +**Returns:** The updated uv node. + +### .size( levelNode : Node. ) : TextureSizeNode + +Returns the texture size of the requested level. + +**levelNode** + +The level to compute the size for. + +**Returns:** The texture size. + +### .update() + +The update is used to implement the update of the uv transformation matrix. + +**Overrides:** [UniformNode#update](UniformNode.html#update) + +### .updateReference( state : any ) : Texture + +Overwritten to always return the texture reference of the node. + +**state** + +This method can be invocated in different contexts so `state` can refer to any object type. + +**Overrides:** [UniformNode#updateReference](UniformNode.html#updateReference) + +**Returns:** The texture reference. + +## Source + +[src/nodes/accessors/TextureNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/TextureNode.js) \ No newline at end of file diff --git a/docs/pages/TexturePass.html.md b/docs/pages/TexturePass.html.md new file mode 100644 index 00000000000000..9cef98ad99e758 --- /dev/null +++ b/docs/pages/TexturePass.html.md @@ -0,0 +1,104 @@ +*Inheritance: Pass →* + +# TexturePass + +This pass can be used to render a texture over the entire screen. + +## Code Example + +```js +const texture = new THREE.TextureLoader().load( 'textures/2294472375_24a3b8ef46_o.jpg' ); +texture.colorSpace = THREE.SRGBColorSpace; +const texturePass = new TexturePass( texture ); +composer.addPass( texturePass ); +``` + +## Import + +TexturePass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; +``` + +## Constructor + +### new TexturePass( map : Texture, opacity : number ) + +Constructs a new texture pass. + +**map** + +The texture to render. + +**opacity** + +The opacity. + +Default is `1`. + +## Properties + +### .map : Texture + +The texture to render. + +### .material : ShaderMaterial + +The pass material. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +### .opacity : number + +The opacity. + +Default is `1`. + +### .uniforms : Object + +The pass uniforms. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the texture pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +## Source + +[examples/jsm/postprocessing/TexturePass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/TexturePass.js) \ No newline at end of file diff --git a/docs/pages/TextureSizeNode.html.md b/docs/pages/TextureSizeNode.html.md new file mode 100644 index 00000000000000..b902e2ad0b4946 --- /dev/null +++ b/docs/pages/TextureSizeNode.html.md @@ -0,0 +1,43 @@ +*Inheritance: EventDispatcher → Node →* + +# TextureSizeNode + +A node that represents the dimensions of a texture. The texture size is retrieved in the shader via built-in shader functions like `textureDimensions()` or `textureSize()`. + +## Constructor + +### new TextureSizeNode( textureNode : TextureNode, levelNode : Node. ) + +Constructs a new texture size node. + +**textureNode** + +A texture node which size should be retrieved. + +**levelNode** + +A level node which defines the requested mip. + +Default is `null`. + +## Properties + +### .isTextureSizeNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .levelNode : Node. + +A level node which defines the requested mip. + +Default is `null`. + +### .textureNode : TextureNode + +A texture node which size should be retrieved. + +## Source + +[src/nodes/accessors/TextureSizeNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/TextureSizeNode.js) \ No newline at end of file diff --git a/docs/pages/TextureUtils.html.md b/docs/pages/TextureUtils.html.md new file mode 100644 index 00000000000000..35b5627822929f --- /dev/null +++ b/docs/pages/TextureUtils.html.md @@ -0,0 +1,69 @@ +# TextureUtils + +A class containing utility functions for textures. + +## Static Methods + +### .contain( texture : Texture, aspect : number ) : Texture + +Scales the texture as large as possible within its surface without cropping or stretching the texture. The method preserves the original aspect ratio of the texture. Akin to CSS `object-fit: contain` + +**texture** + +The texture. + +**aspect** + +The texture's aspect ratio. + +**Returns:** The updated texture. + +### .cover( texture : Texture, aspect : number ) : Texture + +Scales the texture to the smallest possible size to fill the surface, leaving no empty space. The method preserves the original aspect ratio of the texture. Akin to CSS `object-fit: cover`. + +**texture** + +The texture. + +**aspect** + +The texture's aspect ratio. + +**Returns:** The updated texture. + +### .fill( texture : Texture ) : Texture + +Configures the texture to the default transformation. Akin to CSS `object-fit: fill`. + +**texture** + +The texture. + +**Returns:** The updated texture. + +### .getByteLength( width : number, height : number, format : number, type : number ) : number + +Determines how many bytes must be used to represent the texture. + +**width** + +The width of the texture. + +**height** + +The height of the texture. + +**format** + +The texture's format. + +**type** + +The texture's type. + +**Returns:** The byte length. + +## Source + +[src/extras/TextureUtils.js](https://github.com/mrdoob/three.js/blob/master/src/extras/TextureUtils.js) \ No newline at end of file diff --git a/docs/pages/ThreeMFLoader.html.md b/docs/pages/ThreeMFLoader.html.md new file mode 100644 index 00000000000000..b4459a6a36a818 --- /dev/null +++ b/docs/pages/ThreeMFLoader.html.md @@ -0,0 +1,99 @@ +*Inheritance: Loader →* + +# ThreeMFLoader + +A loader for the [3D Manufacturing Format (3MF)](https://3mf.io/specification/) format. + +The following features from the core specification are supported: + +* 3D Models +* Object Resources (Meshes and Components) +* Material Resources (Base Materials) + +3MF Materials and Properties Extension are only partially supported. + +* Texture 2D +* Texture 2D Groups +* Color Groups (Vertex Colors) +* Metallic Display Properties (PBR) + +## Code Example + +```js +const loader = new ThreeMFLoader(); +const object = await loader.loadAsync( './models/3mf/truck.3mf' ); +object.rotation.set( - Math.PI / 2, 0, 0 ); // z-up conversion +scene.add( object ); +``` + +## Import + +ThreeMFLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ThreeMFLoader } from 'three/addons/loaders/3MFLoader.js'; +``` + +## Constructor + +### new ThreeMFLoader( manager : LoadingManager ) + +Constructs a new 3MF loader. + +**manager** + +The loading manager. + +## Properties + +### .availableExtensions : Array. + +An array of available extensions. + +## Methods + +### .addExtension( extension : Object ) + +Adds a 3MF extension. + +**extension** + +The extension to add. + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded 3MF asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : Group + +Parses the given 3MF data and returns the resulting group. + +**data** + +The raw 3MF asset data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** A group representing the parsed asset. + +## Source + +[examples/jsm/loaders/3MFLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/3MFLoader.js) \ No newline at end of file diff --git a/docs/pages/TileShadowNode.html.md b/docs/pages/TileShadowNode.html.md new file mode 100644 index 00000000000000..509b718326e28c --- /dev/null +++ b/docs/pages/TileShadowNode.html.md @@ -0,0 +1,137 @@ +*Inheritance: EventDispatcher → Node → ShadowBaseNode →* + +# TileShadowNode + +A class that extends `ShadowBaseNode` to implement tiled shadow mapping. This allows splitting a shadow map into multiple tiles, each with its own light and camera, to improve shadow quality and performance for large scenes. + +**Note:** This class does not support `VSMShadowMap` at the moment. + +## Import + +TileShadowNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TileShadowNode } from 'three/addons/tsl/shadows/TileShadowNode.js'; +``` + +## Constructor + +### new TileShadowNode( light : Light, options : Object ) + +Creates an instance of `TileShadowNode`. + +**light** + +The original light source used for shadow mapping. + +**options** + +Configuration options for the tiled shadow node. + +Default is `{}`. + +**tilesX** + +The number of tiles along the X-axis. + +Default is `2`. + +**tilesY** + +The number of tiles along the Y-axis. + +Default is `2`. + +**resolution** + +The resolution of the shadow map. + +**debug** + +Whether to enable debug mode. + +Default is `false`. + +## Methods + +### .disposeLightsAndNodes() + +Helper method to remove lights and associated nodes/targets. Used internally during dispose and potential re-initialization. + +### .generateTiles( tilesX : number, tilesY : number ) : Array. + +Generates the tiles for the shadow map based on the specified number of tiles along the X and Y axes. + +**tilesX** + +The number of tiles along the X-axis. + +**tilesY** + +The number of tiles along the Y-axis. + +**Returns:** An array of tile objects, each containing the tile's bounds and index. + +### .init( builder : Builder ) + +Initializes the tiled shadow node by creating lights, cameras, and shadow maps for each tile. + +**builder** + +The builder used to create render targets and other resources. + +### .setup( builder : Builder ) : Node + +Sets up the shadow node for rendering. + +**builder** + +The builder used to set up the shadow node. + +**Overrides:** [ShadowBaseNode#setup](ShadowBaseNode.html#setup) + +**Returns:** A node representing the shadow value. + +### .syncLightTransformation( lwLight : LwLight, sourceLight : Light ) + +Synchronizes the transformation of a tile light with the source light. + +**lwLight** + +The tile light to synchronize. + +**sourceLight** + +The source light to copy transformations from. + +### .update() + +Updates the light transformations and shadow cameras for each tile. + +**Overrides:** [ShadowBaseNode#update](ShadowBaseNode.html#update) + +### .updateBefore( frame : NodeFrame ) + +The implementation performs the update of the shadow map if necessary. + +**frame** + +A reference to the current node frame. + +**Overrides:** [ShadowBaseNode#updateBefore](ShadowBaseNode.html#updateBefore) + +### .updateLightDirection() + +Updates the initial light direction based on the light's target position. + +### .updateShadow( frame : NodeFrame ) + +Updates the shadow map rendering. + +**frame** + +A reference to the current node frame. + +## Source + +[examples/jsm/tsl/shadows/TileShadowNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/shadows/TileShadowNode.js) \ No newline at end of file diff --git a/docs/pages/TileShadowNodeHelper.html.md b/docs/pages/TileShadowNodeHelper.html.md new file mode 100644 index 00000000000000..c11c30296eea0d --- /dev/null +++ b/docs/pages/TileShadowNodeHelper.html.md @@ -0,0 +1,39 @@ +*Inheritance: EventDispatcher → Object3D → Group →* + +# TileShadowNodeHelper + +Helper class to manage and display debug visuals for TileShadowNode. + +## Import + +TileShadowNodeHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TileShadowNodeHelper } from 'three/addons/tsl/shadows/TileShadowNodeHelper.js'; +``` + +## Constructor + +### new TileShadowNodeHelper( tileShadowNode : TileShadowNode ) + +**tileShadowNode** + +The TileShadowNode instance to debug. + +## Methods + +### .dispose() + +Removes all debug objects (planes and helpers) from the scene. + +### .init() + +Initializes the debug displays (planes and camera helpers). Should be called after TileShadowNode has initialized its lights and shadow nodes. + +### .update() + +Updates the debug visuals (specifically camera helpers). Should be called within TileShadowNode's update method. + +## Source + +[examples/jsm/tsl/shadows/TileShadowNodeHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/shadows/TileShadowNodeHelper.js) \ No newline at end of file diff --git a/docs/pages/TiledLighting.html.md b/docs/pages/TiledLighting.html.md new file mode 100644 index 00000000000000..eba8dd1f218625 --- /dev/null +++ b/docs/pages/TiledLighting.html.md @@ -0,0 +1,50 @@ +*Inheritance: Lighting →* + +# TiledLighting + +A custom lighting implementation based on Tiled-Lighting that overwrites the default implementation in [WebGPURenderer](WebGPURenderer.html). + +## Code Example + +```js +const lighting = new TiledLighting(); +renderer.lighting = lighting; // set lighting system +``` + +## Import + +TiledLighting is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TiledLighting } from 'three/addons/lighting/TiledLighting.js'; +``` + +## Constructor + +### new TiledLighting() + +Constructs a new lighting system. + +## Classes + +[TiledLighting](TiledLighting.html) + +## Methods + +### .createNode( lights : Array. ) : TiledLightsNode + +Creates a new tiled lights node for the given array of lights. + +This method is called internally by the renderer and must be overwritten by all custom lighting implementations. + +**lights** + +The render object. + +**Overrides:** [Lighting#createNode](Lighting.html#createNode) + +**Returns:** The tiled lights node. + +## Source + +[examples/jsm/lighting/TiledLighting.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lighting/TiledLighting.js) \ No newline at end of file diff --git a/docs/pages/TiledLightsNode.html.md b/docs/pages/TiledLightsNode.html.md new file mode 100644 index 00000000000000..67dcba61b34f12 --- /dev/null +++ b/docs/pages/TiledLightsNode.html.md @@ -0,0 +1,49 @@ +*Inheritance: EventDispatcher → Node → LightsNode →* + +# TiledLightsNode + +A custom version of `LightsNode` implementing tiled lighting. This node is used in [TiledLighting](TiledLighting.html) to overwrite the renderer's default lighting with a custom implementation. + +## Import + +TiledLightsNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { tiledLights } from 'three/addons/tsl/lighting/TiledLightsNode.js'; +``` + +## Constructor + +### new TiledLightsNode( maxLights : number, tileSize : number ) + +Constructs a new tiled lights node. + +**maxLights** + +The maximum number of lights. + +Default is `1024`. + +**tileSize** + +The tile size. + +Default is `32`. + +## Properties + +### .maxLights : number + +The maximum number of lights. + +Default is `1024`. + +### .tileSize : number + +The tile size. + +Default is `32`. + +## Source + +[examples/jsm/tsl/lighting/TiledLightsNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/lighting/TiledLightsNode.js) \ No newline at end of file diff --git a/docs/pages/Timer.html.md b/docs/pages/Timer.html.md new file mode 100644 index 00000000000000..024266650eaa09 --- /dev/null +++ b/docs/pages/Timer.html.md @@ -0,0 +1,85 @@ +# Timer + +This class is an alternative to [Clock](Clock.html) with a different API design and behavior. The goal is to avoid the conceptual flaws that became apparent in `Clock` over time. + +* `Timer` has an `update()` method that updates its internal state. That makes it possible to call `getDelta()` and `getElapsed()` multiple times per simulation step without getting different values. +* The class can make use of the Page Visibility API to avoid large time delta values when the app is inactive (e.g. tab switched or browser hidden). + +## Code Example + +```js +const timer = new Timer(); +timer.connect( document ); // use Page Visibility API +``` + +## Constructor + +### new Timer() + +Constructs a new timer. + +## Methods + +### .connect( document : Document ) + +Connect the timer to the given document.Calling this method is not mandatory to use the timer but enables the usage of the Page Visibility API to avoid large time delta values. + +**document** + +The document. + +### .disconnect() + +Disconnects the timer from the DOM and also disables the usage of the Page Visibility API. + +### .dispose() + +Can be used to free all internal resources. Usually called when the timer instance isn't required anymore. + +### .getDelta() : number + +Returns the time delta in seconds. + +**Returns:** The time delta in second. + +### .getElapsed() : number + +Returns the elapsed time in seconds. + +**Returns:** The elapsed time in second. + +### .getTimescale() : number + +Returns the timescale. + +**Returns:** The timescale. + +### .reset() : Timer + +Resets the time computation for the current simulation step. + +**Returns:** A reference to this timer. + +### .setTimescale( timescale : number ) : Timer + +Sets the given timescale which scale the time delta computation in `update()`. + +**timescale** + +The timescale to set. + +**Returns:** A reference to this timer. + +### .update( timestamp : number ) : Timer + +Updates the internal state of the timer. This method should be called once per simulation step and before you perform queries against the timer (e.g. via `getDelta()`). + +**timestamp** + +The current time in milliseconds. Can be obtained from the `requestAnimationFrame` callback argument. If not provided, the current time will be determined with `performance.now`. + +**Returns:** A reference to this timer. + +## Source + +[src/core/Timer.js](https://github.com/mrdoob/three.js/blob/master/src/core/Timer.js) \ No newline at end of file diff --git a/docs/pages/TimestampQueryPool.html.md b/docs/pages/TimestampQueryPool.html.md new file mode 100644 index 00000000000000..4e2b895ca0e24b --- /dev/null +++ b/docs/pages/TimestampQueryPool.html.md @@ -0,0 +1,119 @@ +# TimestampQueryPool + +Abstract base class of a timestamp query pool. + +## Constructor + +### new TimestampQueryPool( maxQueries : number ) (abstract) + +Creates a new timestamp query pool. + +**maxQueries** + +Maximum number of queries this pool can hold. + +Default is `256`. + +## Properties + +### .currentQueryIndex : number + +How many queries allocated so far. + +Default is `0`. + +### .frames : Array. + +Stores all timestamp frames. + +### .isDisposed : boolean + +Whether the pool has been disposed or not. + +Default is `false`. + +### .lastValue : number + +TODO + +Default is `0`. + +### .maxQueries : number + +Maximum number of queries this pool can hold. + +Default is `256`. + +### .pendingResolve : boolean + +TODO + +Default is `false`. + +### .queryOffsets : Map. + +Tracks offsets for different contexts. + +### .timestamps : Map. + +Stores the latest timestamp for each render context. + +### .trackTimestamp : boolean + +Whether to track timestamps or not. + +Default is `true`. + +## Methods + +### .allocateQueriesForContext( uid : string, frameId : number ) : number (abstract) + +Allocate queries for a specific uid. + +**uid** + +A unique identifier for the render context. + +**frameId** + +The current frame identifier. + +### .dispose() (abstract) + +Dispose of the query pool. + +### .getTimestamp( uid : string ) : number + +Returns the timestamp for a given render context. + +**uid** + +A unique identifier for the render context. + +**Returns:** The timestamp, or undefined if not available. + +### .getTimestampFrames() : Array. + +Returns all timestamp frames. + +**Returns:** The timestamp frames. + +### .hasTimestamp( uid : string ) : boolean + +Returns whether a timestamp is available for a given render context. + +**uid** + +A unique identifier for the render context. + +**Returns:** True if a timestamp is available, false otherwise. + +### .resolveQueriesAsync() : Promise. | number (async, abstract) + +Resolve all timestamps and return data (or process them). + +**Returns:** The resolved timestamp value. + +## Source + +[src/renderers/common/TimestampQueryPool.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/TimestampQueryPool.js) \ No newline at end of file diff --git a/docs/pages/ToneMappingNode.html.md b/docs/pages/ToneMappingNode.html.md new file mode 100644 index 00000000000000..4638571f018423 --- /dev/null +++ b/docs/pages/ToneMappingNode.html.md @@ -0,0 +1,69 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# ToneMappingNode + +This node represents a tone mapping operation. + +## Constructor + +### new ToneMappingNode( toneMapping : number, exposureNode : Node, colorNode : Node ) + +Constructs a new tone mapping node. + +**toneMapping** + +The tone mapping type. + +**exposureNode** + +The tone mapping exposure. + +**colorNode** + +The color node to process. + +Default is `null`. + +## Properties + +### .colorNode : Node + +Represents the color to process. + +Default is `null`. + +### .exposureNode : Node + +The tone mapping exposure. + +Default is `null`. + +## Methods + +### .customCacheKey() : number + +Overwrites the default `customCacheKey()` implementation by including the tone mapping type into the cache key. + +**Overrides:** [TempNode#customCacheKey](TempNode.html#customCacheKey) + +**Returns:** The hash. + +### .getToneMapping() : number + +Gets the tone mapping type. + +**Returns:** The tone mapping type. + +### .setToneMapping( value : number ) : ToneMappingNode + +Sets the tone mapping type. + +**value** + +The tone mapping type. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/display/ToneMappingNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/ToneMappingNode.js) \ No newline at end of file diff --git a/docs/pages/ToonLightingModel.html.md b/docs/pages/ToonLightingModel.html.md new file mode 100644 index 00000000000000..06f413eec2a880 --- /dev/null +++ b/docs/pages/ToonLightingModel.html.md @@ -0,0 +1,39 @@ +*Inheritance: LightingModel →* + +# ToonLightingModel + +Represents the lighting model for a toon material. Used in [MeshToonNodeMaterial](MeshToonNodeMaterial.html). + +## Constructor + +### new ToonLightingModel() + +## Methods + +### .direct( lightData : Object, builder : NodeBuilder ) + +Implements the direct lighting. Instead of using a conventional smooth irradiance, the irradiance is reduced to a small number of discrete shades to create a comic-like, flat look. + +**lightData** + +The light data. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#direct](LightingModel.html#direct) + +### .indirect( builder : NodeBuilder ) + +Implements the indirect lighting. + +**builder** + +The current node builder. + +**Overrides:** [LightingModel#indirect](LightingModel.html#indirect) + +## Source + +[src/nodes/functions/ToonLightingModel.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/functions/ToonLightingModel.js) \ No newline at end of file diff --git a/docs/pages/ToonOutlinePassNode.html.md b/docs/pages/ToonOutlinePassNode.html.md new file mode 100644 index 00000000000000..a6433ec125c731 --- /dev/null +++ b/docs/pages/ToonOutlinePassNode.html.md @@ -0,0 +1,65 @@ +*Inheritance: EventDispatcher → Node → TempNode → PassNode →* + +# ToonOutlinePassNode + +Represents a render pass for producing a toon outline effect on compatible objects. Only 3D objects with materials of type `MeshToonMaterial` and `MeshToonNodeMaterial` will receive the outline. + +## Code Example + +```js +const postProcessing = new PostProcessing( renderer ); +const scenePass = toonOutlinePass( scene, camera ); +postProcessing.outputNode = scenePass; +``` + +## Constructor + +### new ToonOutlinePassNode( scene : Scene, camera : Camera, colorNode : Node, thicknessNode : Node, alphaNode : Node ) + +Constructs a new outline pass node. + +**scene** + +A reference to the scene. + +**camera** + +A reference to the camera. + +**colorNode** + +Defines the outline's color. + +**thicknessNode** + +Defines the outline's thickness. + +**alphaNode** + +Defines the outline's alpha. + +## Properties + +### .alphaNode : Node + +Defines the outline's alpha. + +### .colorNode : Node + +Defines the outline's color. + +### .name : string + +The name of this pass. + +Default is `'Outline Pass'`. + +**Overrides:** [PassNode#name](PassNode.html#name) + +### .thicknessNode : Node + +Defines the outline's thickness. + +## Source + +[src/nodes/display/ToonOutlinePassNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/ToonOutlinePassNode.js) \ No newline at end of file diff --git a/docs/pages/TorusGeometry.html.md b/docs/pages/TorusGeometry.html.md new file mode 100644 index 00000000000000..f8242beae28891 --- /dev/null +++ b/docs/pages/TorusGeometry.html.md @@ -0,0 +1,72 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# TorusGeometry + +A geometry class for representing an torus. + +## Code Example + +```js +const geometry = new THREE.TorusGeometry( 10, 3, 16, 100 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const torus = new THREE.Mesh( geometry, material ); +scene.add( torus ); +``` + +## Constructor + +### new TorusGeometry( radius : number, tube : number, radialSegments : number, tubularSegments : number, arc : number ) + +Constructs a new torus geometry. + +**radius** + +Radius of the torus, from the center of the torus to the center of the tube. + +Default is `1`. + +**tube** + +Radius of the tube. Must be smaller than `radius`. + +Default is `0.4`. + +**radialSegments** + +The number of radial segments. + +Default is `12`. + +**tubularSegments** + +The number of tubular segments. + +Default is `48`. + +**arc** + +Central angle in radians. + +Default is `Math.PI*2`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : TorusGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/TorusGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusGeometry.js) \ No newline at end of file diff --git a/docs/pages/TorusKnot.html.md b/docs/pages/TorusKnot.html.md new file mode 100644 index 00000000000000..cc0787e8dab462 --- /dev/null +++ b/docs/pages/TorusKnot.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# TorusKnot + +A torus knot. + +## Import + +TorusKnot is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TorusKnot } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new TorusKnot( scale : number ) + +Constructs a new torus knot. + +**scale** + +The curve's scale. + +Default is `10`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `10`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/TorusKnotGeometry.html.md b/docs/pages/TorusKnotGeometry.html.md new file mode 100644 index 00000000000000..c0177f9f292d8a --- /dev/null +++ b/docs/pages/TorusKnotGeometry.html.md @@ -0,0 +1,78 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# TorusKnotGeometry + +Creates a torus knot, the particular shape of which is defined by a pair of coprime integers, p and q. If p and q are not coprime, the result will be a torus link. + +## Code Example + +```js +const geometry = new THREE.TorusKnotGeometry( 10, 3, 100, 16 ); +const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); +const torusKnot = new THREE.Mesh( geometry, material ); +scene.add( torusKnot ); +``` + +## Constructor + +### new TorusKnotGeometry( radius : number, tube : number, tubularSegments : number, radialSegments : number, p : number, q : number ) + +Constructs a new torus knot geometry. + +**radius** + +Radius of the torus knot. + +Default is `1`. + +**tube** + +Radius of the tube. + +Default is `0.4`. + +**tubularSegments** + +The number of tubular segments. + +Default is `64`. + +**radialSegments** + +The number of radial segments. + +Default is `8`. + +**p** + +This value determines, how many times the geometry winds around its axis of rotational symmetry. + +Default is `2`. + +**q** + +This value determines, how many times the geometry winds around a circle in the interior of the torus. + +Default is `3`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : TorusKnotGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/TorusKnotGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusKnotGeometry.js) \ No newline at end of file diff --git a/docs/pages/TrackballControls.html.md b/docs/pages/TrackballControls.html.md new file mode 100644 index 00000000000000..26607043a7bacc --- /dev/null +++ b/docs/pages/TrackballControls.html.md @@ -0,0 +1,177 @@ +*Inheritance: EventDispatcher → Controls →* + +# TrackballControls + +This class is similar to [OrbitControls](OrbitControls.html). However, it does not maintain a constant camera `up` vector. That means if the camera orbits over the “north” and “south” poles, it does not flip to stay "right side up". + +## Import + +TrackballControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +``` + +## Constructor + +### new TrackballControls( object : Object3D, domElement : HTMLElement ) + +Constructs a new controls instance. + +**object** + +The object that is managed by the controls. + +**domElement** + +The HTML element used for event listeners. + +Default is `null`. + +## Properties + +### .dynamicDampingFactor : number + +Defines the intensity of damping. Only considered if `staticMoving` is set to `false`. + +Default is `0.2`. + +### .keys : Array. + +This array holds keycodes for controlling interactions. + +* When the first defined key is pressed, all mouse interactions (left, middle, right) performs orbiting. +* When the second defined key is pressed, all mouse interactions (left, middle, right) performs zooming. +* When the third defined key is pressed, all mouse interactions (left, middle, right) performs panning. + +Default is _KeyA, KeyS, KeyD_ which represents A, S, D. + +**Overrides:** [Controls#keys](Controls.html#keys) + +### .maxDistance : number + +How far you can dolly out (perspective camera only). + +Default is `Infinity`. + +### .maxZoom : number + +How far you can zoom out (orthographic camera only). + +Default is `Infinity`. + +### .minDistance : number + +How far you can dolly in (perspective camera only). + +Default is `0`. + +### .minZoom : number + +How far you can zoom in (orthographic camera only). + +Default is `0`. + +### .mouseButtons : Object + +This object contains references to the mouse actions used by the controls. + +```js +controls.mouseButtons = { + LEFT: THREE.MOUSE.ROTATE, + MIDDLE: THREE.MOUSE.DOLLY, + RIGHT: THREE.MOUSE.PAN +} +``` + +**Overrides:** [Controls#mouseButtons](Controls.html#mouseButtons) + +### .noPan : boolean + +Whether panning is disabled or not. + +Default is `false`. + +### .noRotate : boolean + +Whether rotation is disabled or not. + +Default is `false`. + +### .noZoom : boolean + +Whether zooming is disabled or not. + +Default is `false`. + +### .panSpeed : number + +The pan speed. + +Default is `0.3`. + +### .rotateSpeed : number + +The rotation speed. + +Default is `1`. + +### .screen : Object (readonly) + +Represents the properties of the screen. Automatically set when `handleResize()` is called. + +### .staticMoving : boolean + +Whether damping is disabled or not. + +Default is `false`. + +### .target : Vector3 + +The focus point of the controls. + +### .zoomSpeed : number + +The zoom speed. + +Default is `1.2`. + +## Methods + +### .handleResize() + +Must be called if the application window is resized. + +### .reset() + +Resets the controls to its initial state. + +## Events + +### .change + +Fires when the camera has been transformed by the controls. + +##### Type: + +* Object + +### .end + +Fires when an interaction has finished. + +##### Type: + +* Object + +### .start + +Fires when an interaction was initiated. + +##### Type: + +* Object + +## Source + +[examples/jsm/controls/TrackballControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/TrackballControls.js) \ No newline at end of file diff --git a/docs/pages/TransformControls.html.md b/docs/pages/TransformControls.html.md new file mode 100644 index 00000000000000..bb6897be4ca610 --- /dev/null +++ b/docs/pages/TransformControls.html.md @@ -0,0 +1,283 @@ +*Inheritance: EventDispatcher → Controls →* + +# TransformControls + +This class can be used to transform objects in 3D space by adapting a similar interaction model of DCC tools like Blender. Unlike other controls, it is not intended to transform the scene's camera. + +`TransformControls` expects that its attached 3D object is part of the scene graph. + +## Import + +TransformControls is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TransformControls } from 'three/addons/controls/TransformControls.js'; +``` + +## Constructor + +### new TransformControls( camera : Camera, domElement : HTMLElement ) + +Constructs a new controls instance. + +**camera** + +The camera of the rendered scene. + +**domElement** + +The HTML element used for event listeners. + +Default is `null`. + +## Properties + +### .axis : string + +The current transformation axis. + +### .camera : Camera + +The camera of the rendered scene. + +### .dragging : boolean (readonly) + +Whether dragging is currently performed or not. + +Default is `false`. + +### .maxX : number + +The maximum allowed X position during translation. + +Default is `Infinity`. + +### .maxY : number + +The maximum allowed Y position during translation. + +Default is `Infinity`. + +### .maxZ : number + +The maximum allowed Z position during translation. + +Default is `Infinity`. + +### .minX : number + +The minimum allowed X position during translation. + +Default is `-Infinity`. + +### .minY : number + +The minimum allowed y position during translation. + +Default is `-Infinity`. + +### .minZ : number + +The minimum allowed z position during translation. + +Default is `-Infinity`. + +### .mode : 'translate' | 'rotate' | 'scale' + +The current transformation axis. + +Default is `'translate'`. + +### .rotationSnap : number + +By default, 3D objects are continuously rotated. If you set this property to a numeric value (radians), you can define in which steps the 3D object should be rotated. + +Default is `null`. + +### .scaleSnap : number + +By default, 3D objects are continuously scaled. If you set this property to a numeric value, you can define in which steps the 3D object should be scaled. + +Default is `null`. + +### .showX : boolean + +Whether the x-axis helper should be visible or not. + +Default is `true`. + +### .showY : boolean + +Whether the y-axis helper should be visible or not. + +Default is `true`. + +### .showZ : boolean + +Whether the z-axis helper should be visible or not. + +Default is `true`. + +### .size : number + +The size of the helper UI (axes/planes). + +Default is `1`. + +### .space : 'world' | 'local' + +Defines in which coordinate space transformations should be performed. + +Default is `'world'`. + +### .translationSnap : number + +By default, 3D objects are continuously translated. If you set this property to a numeric value (world units), you can define in which steps the 3D object should be translated. + +Default is `null`. + +## Methods + +### .attach( object : Object3D ) : TransformControls + +Sets the 3D object that should be transformed and ensures the controls UI is visible. + +**object** + +The 3D object that should be transformed. + +**Returns:** A reference to this controls. + +### .detach() : TransformControls + +Removes the current 3D object from the controls and makes the helper UI invisible. + +**Returns:** A reference to this controls. + +### .getHelper() : TransformControlsRoot + +Returns the visual representation of the controls. Add the helper to your scene to visually transform the attached 3D object. + +**Returns:** The helper. + +### .getMode() : 'translate' | 'rotate' | 'scale' + +Returns the transformation mode. + +**Returns:** The transformation mode. + +### .getRaycaster() : Raycaster + +Returns the raycaster that is used for user interaction. This object is shared between all instances of `TransformControls`. + +**Returns:** The internal raycaster. + +### .reset() + +Resets the object's position, rotation and scale to when the current transform began. + +### .setColors( xAxis : number | Color | string, yAxis : number | Color | string, zAxis : number | Color | string, active : number | Color | string ) + +Sets the colors of the control's gizmo. + +**xAxis** + +The x-axis color. + +**yAxis** + +The y-axis color. + +**zAxis** + +The z-axis color. + +**active** + +The color for active elements. + +### .setMode( mode : 'translate' | 'rotate' | 'scale' ) + +Sets the given transformation mode. + +**mode** + +The transformation mode to set. + +### .setRotationSnap( rotationSnap : number ) + +Sets the rotation snap. + +**rotationSnap** + +The rotation snap to set. + +### .setScaleSnap( scaleSnap : number ) + +Sets the scale snap. + +**scaleSnap** + +The scale snap to set. + +### .setSize( size : number ) + +Sets the size of the helper UI. + +**size** + +The size to set. + +### .setSpace( space : 'world' | 'local' ) + +Sets the coordinate space in which transformations are applied. + +**space** + +The space to set. + +### .setTranslationSnap( translationSnap : number ) + +Sets the translation snap. + +**translationSnap** + +The translation snap to set. + +## Events + +### .change + +Fires if any type of change (object or property change) is performed. Property changes are separate events you can add event listeners to. The event type is "propertyname-changed". + +##### Type: + +* Object + +### .mouseDown + +Fires if a pointer (mouse/touch) becomes active. + +##### Type: + +* Object + +### .mouseUp + +Fires if a pointer (mouse/touch) is no longer active. + +##### Type: + +* Object + +### .objectChange + +Fires if the controlled 3D object is changed. + +##### Type: + +* Object + +## Source + +[examples/jsm/controls/TransformControls.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/TransformControls.js) \ No newline at end of file diff --git a/docs/pages/TransitionNode.html.md b/docs/pages/TransitionNode.html.md new file mode 100644 index 00000000000000..4e2849d9ef2a1e --- /dev/null +++ b/docs/pages/TransitionNode.html.md @@ -0,0 +1,85 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# TransitionNode + +Post processing node for creating a transition effect between scenes. + +## Import + +TransitionNode is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { transition } from 'three/addons/tsl/display/TransitionNode.js'; +``` + +## Constructor + +### new TransitionNode( textureNodeA : TextureNode, textureNodeB : TextureNode, mixTextureNode : TextureNode, mixRatioNode : Node., thresholdNode : Node., useTextureNode : Node. ) + +Constructs a new transition node. + +**textureNodeA** + +A texture node that represents the beauty pass of the first scene. + +**textureNodeB** + +A texture node that represents the beauty pass of the second scene. + +**mixTextureNode** + +A texture node that defines how the transition effect should look like. + +**mixRatioNode** + +The interpolation factor that controls the mix. + +**thresholdNode** + +Can be used to tweak the linear interpolation. + +**useTextureNode** + +Whether `mixTextureNode` should influence the transition or not. + +## Properties + +### .mixRatioNode : Node. + +The interpolation factor that controls the mix. + +### .mixTextureNode : TextureNode + +A texture that defines how the transition effect should look like. + +### .textureNodeA : TextureNode + +A texture node that represents the beauty pass of the first scene. + +### .textureNodeB : TextureNode + +A texture node that represents the beauty pass of the second scene. + +### .thresholdNode : Node. + +Can be used to tweak the linear interpolation. + +### .useTextureNode : Node. + +Whether `mixTextureNode` should influence the transition or not. + +## Methods + +### .setup( builder : NodeBuilder ) : ShaderCallNodeInternal + +This method is used to setup the effect's TSL code. + +**builder** + +The current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +## Source + +[examples/jsm/tsl/display/TransitionNode.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/display/TransitionNode.js) \ No newline at end of file diff --git a/docs/pages/Transpiler.html.md b/docs/pages/Transpiler.html.md new file mode 100644 index 00000000000000..7968eb57debbbe --- /dev/null +++ b/docs/pages/Transpiler.html.md @@ -0,0 +1,57 @@ +# Transpiler + +A class that transpiles shader code from one language into another. + +`Transpiler` can only be used to convert GLSL into TSL right now. It is intended to support developers when they want to migrate their custom materials from the current to the new node-based material system. + +## Import + +Transpiler is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import Transpiler from 'three/addons/transpiler/Transpiler.js'; +``` + +## Constructor + +### new Transpiler( decoder : GLSLDecoder, encoder : TSLEncoder ) + +Constructs a new transpiler. + +**decoder** + +The GLSL decoder. + +**encoder** + +The TSL encoder. + +## Properties + +### .decoder : GLSLDecoder + +The GLSL decoder. This component parse GLSL and produces a language-independent AST for further processing. + +### .encoder : TSLEncoder + +The TSL encoder. It takes the AST and emits TSL code. + +### .linker : Linker + +The linker. It processes the AST and resolves variable and function references, ensuring that all dependencies are properly linked. + +## Methods + +### .parse( source : string ) : string + +Parses the given GLSL source and returns TSL syntax. + +**source** + +The GLSL source. + +**Returns:** The TSL code. + +## Source + +[examples/jsm/transpiler/Transpiler.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/transpiler/Transpiler.js) \ No newline at end of file diff --git a/docs/pages/TreesGeometry.html.md b/docs/pages/TreesGeometry.html.md new file mode 100644 index 00000000000000..837e160cb339c6 --- /dev/null +++ b/docs/pages/TreesGeometry.html.md @@ -0,0 +1,27 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# TreesGeometry + +A procedural trees geometry. + +## Import + +TreesGeometry is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TreesGeometry } from 'three/addons/misc/RollerCoaster.js'; +``` + +## Constructor + +### new TreesGeometry( landscape : Mesh ) + +Constructs a new geometry. + +**landscape** + +A mesh representing the landscape. Trees will be positioned randomly on the landscape's surface. + +## Source + +[examples/jsm/misc/RollerCoaster.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/RollerCoaster.js) \ No newline at end of file diff --git a/docs/pages/TrefoilKnot.html.md b/docs/pages/TrefoilKnot.html.md new file mode 100644 index 00000000000000..40c85e10b3ef88 --- /dev/null +++ b/docs/pages/TrefoilKnot.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# TrefoilKnot + +A Trefoil Knot. + +## Import + +TrefoilKnot is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TrefoilKnot } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new TrefoilKnot( scale : number ) + +Constructs a new Trefoil Knot. + +**scale** + +The curve's scale. + +Default is `10`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `10`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/TrefoilPolynomialKnot.html.md b/docs/pages/TrefoilPolynomialKnot.html.md new file mode 100644 index 00000000000000..2569649cd7fe08 --- /dev/null +++ b/docs/pages/TrefoilPolynomialKnot.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# TrefoilPolynomialKnot + +A Trefoil Polynomial Knot. + +## Import + +TrefoilPolynomialKnot is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TrefoilPolynomialKnot } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new TrefoilPolynomialKnot( scale : number ) + +Constructs a new Trefoil Polynomial Knot. + +**scale** + +The curve's scale. + +Default is `10`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `10`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/Triangle.html.md b/docs/pages/Triangle.html.md new file mode 100644 index 00000000000000..bbb304550d29d8 --- /dev/null +++ b/docs/pages/Triangle.html.md @@ -0,0 +1,417 @@ +# Triangle + +A geometric triangle as defined by three vectors representing its three corners. + +## Constructor + +### new Triangle( a : Vector3, b : Vector3, c : Vector3 ) + +Constructs a new triangle. + +**a** + +The first corner of the triangle. + +Default is `(0,0,0)`. + +**b** + +The second corner of the triangle. + +Default is `(0,0,0)`. + +**c** + +The third corner of the triangle. + +Default is `(0,0,0)`. + +## Properties + +### .a : Vector3 + +The first corner of the triangle. + +### .b : Vector3 + +The second corner of the triangle. + +### .c : Vector3 + +The third corner of the triangle. + +## Methods + +### .clone() : Triangle + +Returns a new triangle with copied values from this instance. + +**Returns:** A clone of this instance. + +### .closestPointToPoint( p : Vector3, target : Vector3 ) : Vector3 + +Returns the closest point on the triangle to the given point. + +**p** + +The point to compute the closest point for. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The closest point on the triangle. + +### .containsPoint( point : Vector3 ) : boolean + +Returns `true` if the given point, when projected onto the plane of the triangle, lies within the triangle. + +**point** + +The point in 3D space to test. + +**Returns:** Whether the given point, when projected onto the plane of the triangle, lies within the triangle or not. + +### .copy( triangle : Triangle ) : Triangle + +Copies the values of the given triangle to this instance. + +**triangle** + +The triangle to copy. + +**Returns:** A reference to this triangle. + +### .equals( triangle : Triangle ) : boolean + +Returns `true` if this triangle is equal with the given one. + +**triangle** + +The triangle to test for equality. + +**Returns:** Whether this triangle is equal with the given one. + +### .getArea() : number + +Computes the area of the triangle. + +**Returns:** The triangle's area. + +### .getBarycoord( point : Vector3, target : Vector3 ) : Vector3 + +Computes a barycentric coordinates from the given vector. Returns `null` if the triangle is degenerate. + +**point** + +A point in 3D space. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The barycentric coordinates for the given point + +### .getInterpolation( point : Vector3, v1 : Vector3, v2 : Vector3, v3 : Vector3, target : Vector3 ) : Vector3 + +Computes the value barycentrically interpolated for the given point on the triangle. Returns `null` if the triangle is degenerate. + +**point** + +Position of interpolated point. + +**v1** + +Value to interpolate of first vertex. + +**v2** + +Value to interpolate of second vertex. + +**v3** + +Value to interpolate of third vertex. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The interpolated value. + +### .getMidpoint( target : Vector3 ) : Vector3 + +Computes the midpoint of the triangle. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The triangle's midpoint. + +### .getNormal( target : Vector3 ) : Vector3 + +Computes the normal of the triangle. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The triangle's normal. + +### .getPlane( target : Plane ) : Plane + +Computes a plane the triangle lies within. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The plane the triangle lies within. + +### .intersectsBox( box : Box3 ) : boolean + +Returns `true` if this triangle intersects with the given box. + +**box** + +The box to intersect. + +**Returns:** Whether this triangle intersects with the given box or not. + +### .isFrontFacing( direction : Vector3 ) : boolean + +Returns `true` if the triangle is oriented towards the given direction. + +**direction** + +The (normalized) direction vector. + +**Returns:** Whether the triangle is oriented towards the given direction or not. + +### .set( a : Vector3, b : Vector3, c : Vector3 ) : Triangle + +Sets the triangle's vertices by copying the given values. + +**a** + +The first corner of the triangle. + +**b** + +The second corner of the triangle. + +**c** + +The third corner of the triangle. + +**Returns:** A reference to this triangle. + +### .setFromAttributeAndIndices( attribute : BufferAttribute, i0 : number, i1 : number, i2 : number ) : Triangle + +Sets the triangle's vertices by copying the given attribute values. + +**attribute** + +A buffer attribute with 3D points data. + +**i0** + +The attribute index representing the first corner of the triangle. + +**i1** + +The attribute index representing the second corner of the triangle. + +**i2** + +The attribute index representing the third corner of the triangle. + +**Returns:** A reference to this triangle. + +### .setFromPointsAndIndices( points : Array., i0 : number, i1 : number, i2 : number ) : Triangle + +Sets the triangle's vertices by copying the given array values. + +**points** + +An array with 3D points. + +**i0** + +The array index representing the first corner of the triangle. + +**i1** + +The array index representing the second corner of the triangle. + +**i2** + +The array index representing the third corner of the triangle. + +**Returns:** A reference to this triangle. + +## Static Methods + +### .containsPoint( point : Vector3, a : Vector3, b : Vector3, c : Vector3 ) : boolean + +Returns `true` if the given point, when projected onto the plane of the triangle, lies within the triangle. + +**point** + +The point in 3D space to test. + +**a** + +The first corner of the triangle. + +**b** + +The second corner of the triangle. + +**c** + +The third corner of the triangle. + +**Returns:** Whether the given point, when projected onto the plane of the triangle, lies within the triangle or not. + +### .getBarycoord( point : Vector3, a : Vector3, b : Vector3, c : Vector3, target : Vector3 ) : Vector3 + +Computes a barycentric coordinates from the given vector. Returns `null` if the triangle is degenerate. + +**point** + +A point in 3D space. + +**a** + +The first corner of the triangle. + +**b** + +The second corner of the triangle. + +**c** + +The third corner of the triangle. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The barycentric coordinates for the given point + +### .getInterpolatedAttribute( attr : BufferAttribute, i1 : number, i2 : number, i3 : number, barycoord : Vector3, target : Vector3 ) : Vector3 + +Computes the value barycentrically interpolated for the given attribute and indices. + +**attr** + +The attribute to interpolate. + +**i1** + +Index of first vertex. + +**i2** + +Index of second vertex. + +**i3** + +Index of third vertex. + +**barycoord** + +The barycoordinate value to use to interpolate. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The interpolated attribute value. + +### .getInterpolation( point : Vector3, p1 : Vector3, p2 : Vector3, p3 : Vector3, v1 : Vector3, v2 : Vector3, v3 : Vector3, target : Vector3 ) : Vector3 + +Computes the value barycentrically interpolated for the given point on the triangle. Returns `null` if the triangle is degenerate. + +**point** + +Position of interpolated point. + +**p1** + +The first corner of the triangle. + +**p2** + +The second corner of the triangle. + +**p3** + +The third corner of the triangle. + +**v1** + +Value to interpolate of first vertex. + +**v2** + +Value to interpolate of second vertex. + +**v3** + +Value to interpolate of third vertex. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The interpolated value. + +### .getNormal( a : Vector3, b : Vector3, c : Vector3, target : Vector3 ) : Vector3 + +Computes the normal vector of a triangle. + +**a** + +The first corner of the triangle. + +**b** + +The second corner of the triangle. + +**c** + +The third corner of the triangle. + +**target** + +The target vector that is used to store the method's result. + +**Returns:** The triangle's normal. + +### .isFrontFacing( a : Vector3, b : Vector3, c : Vector3, direction : Vector3 ) : boolean + +Returns `true` if the triangle is oriented towards the given direction. + +**a** + +The first corner of the triangle. + +**b** + +The second corner of the triangle. + +**c** + +The third corner of the triangle. + +**direction** + +The (normalized) direction vector. + +**Returns:** Whether the triangle is oriented towards the given direction or not. + +## Source + +[src/math/Triangle.js](https://github.com/mrdoob/three.js/blob/master/src/math/Triangle.js) \ No newline at end of file diff --git a/docs/pages/TubeGeometry.html.md b/docs/pages/TubeGeometry.html.md new file mode 100644 index 00000000000000..deb7d254265966 --- /dev/null +++ b/docs/pages/TubeGeometry.html.md @@ -0,0 +1,81 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# TubeGeometry + +Creates a tube that extrudes along a 3D curve. + +## Code Example + +```js +class CustomSinCurve extends THREE.Curve { + getPoint( t, optionalTarget = new THREE.Vector3() ) { + const tx = t * 3 - 1.5; + const ty = Math.sin( 2 * Math.PI * t ); + const tz = 0; + return optionalTarget.set( tx, ty, tz ); + } +} +const path = new CustomSinCurve( 10 ); +const geometry = new THREE.TubeGeometry( path, 20, 2, 8, false ); +const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); +const mesh = new THREE.Mesh( geometry, material ); +scene.add( mesh ); +``` + +## Constructor + +### new TubeGeometry( path : Curve, tubularSegments : number, radius : number, radialSegments : number, closed : boolean ) + +Constructs a new tube geometry. + +**path** + +A 3D curve defining the path of the tube. + +Default is `QuadraticBezierCurve3`. + +**tubularSegments** + +The number of segments that make up the tube. + +Default is `64`. + +**radius** + +The radius of the tube. + +Default is `1`. + +**radialSegments** + +The number of segments that make up the cross-section. + +Default is `8`. + +**closed** + +Whether the tube is closed or not. + +Default is `false`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Static Methods + +### .fromJSON( data : Object ) : TubeGeometry + +Factory method for creating an instance of this class from the given JSON object. + +**data** + +A JSON object representing the serialized geometry. + +**Returns:** A new instance. + +## Source + +[src/geometries/TubeGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/TubeGeometry.js) \ No newline at end of file diff --git a/docs/pages/TubePainter.html.md b/docs/pages/TubePainter.html.md new file mode 100644 index 00000000000000..58f44bfbae27d5 --- /dev/null +++ b/docs/pages/TubePainter.html.md @@ -0,0 +1,70 @@ +# TubePainter + +This module can be used to paint tube-like meshes along a sequence of points. This module is used in a XR painter demo. + +## Code Example + +```js +const painter = new TubePainter(); +scene.add( painter.mesh ); +``` + +## Import + +TubePainter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TubePainter } from 'three/addons/misc/TubePainter.js'; +``` + +## Constructor + +### new TubePainter() + +## Properties + +### .mesh : Mesh + +The "painted" tube mesh. Must be added to the scene. + +## Methods + +### .lineTo( position : Vector3 ) + +Draw a stroke from the current position to the given one. This method extends the tube while drawing with the XR controllers. + +**position** + +The destination position. + +### .moveTo( position : Vector3 ) + +Moves the current painting position to the given value. + +**position** + +The new painting position. + +### .setColor( color : Color ) + +Sets the color of newly rendered tube segments. + +**color** + +The color. + +### .setSize( size : number ) + +Sets the size of newly rendered tube segments. + +**size** + +The size. + +### .update() + +Updates the internal geometry buffers so the new painted segments are rendered. + +## Source + +[examples/jsm/misc/TubePainter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/TubePainter.js) \ No newline at end of file diff --git a/docs/pages/USDLoader.html.md b/docs/pages/USDLoader.html.md new file mode 100644 index 00000000000000..e0427b8582e56a --- /dev/null +++ b/docs/pages/USDLoader.html.md @@ -0,0 +1,73 @@ +*Inheritance: Loader →* + +# USDLoader + +A loader for the USDZ format. + +USDZ files that use USDC internally are not yet supported, only USDA. + +## Code Example + +```js +const loader = new USDZLoader(); +const model = await loader.loadAsync( 'saeukkang.usdz' ); +scene.add( model ); +``` + +## Import + +USDLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { USDLoader } from 'three/addons/loaders/USDLoader.js'; +``` + +## Constructor + +### new USDLoader( manager : LoadingManager ) + +Constructs a new USDZ loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded USDZ asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( buffer : ArrayBuffer | string ) : Group + +Parses the given USDZ data and returns the resulting group. + +**buffer** + +The raw USDZ data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed asset as a group. + +## Source + +[examples/jsm/loaders/USDLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/USDLoader.js) \ No newline at end of file diff --git a/docs/pages/USDZExporter.html.md b/docs/pages/USDZExporter.html.md new file mode 100644 index 00000000000000..b958036c89eb23 --- /dev/null +++ b/docs/pages/USDZExporter.html.md @@ -0,0 +1,137 @@ +# USDZExporter + +An exporter for USDZ. + +## Code Example + +```js +const exporter = new USDZExporter(); +const arraybuffer = await exporter.parseAsync( scene ); +``` + +## Import + +USDZExporter is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { USDZExporter } from 'three/addons/exporters/USDZExporter.js'; +``` + +## Constructor + +### new USDZExporter() + +Constructs a new USDZ exporter. + +## Properties + +### .textureUtils : WebGLTextureUtils | WebGPUTextureUtils + +A reference to a texture utils module. + +Default is `null`. + +## Methods + +### .parse( scene : Object3D, onDone : USDZExporter~OnDone, onError : USDZExporter~OnError, options : USDZExporter~Options ) + +Parse the given 3D object and generates the USDZ output. + +**scene** + +The 3D object to export. + +**onDone** + +A callback function that is executed when the export has finished. + +**onError** + +A callback function that is executed when an error happens. + +**options** + +The export options. + +### .parseAsync( scene : Object3D, options : USDZExporter~Options ) : Promise. (async) + +Async version of [USDZExporter#parse](USDZExporter.html#parse). + +**scene** + +The 3D object to export. + +**options** + +The export options. + +**Returns:** A Promise that resolved with the exported USDZ data. + +### .setTextureUtils( utils : WebGLTextureUtils | WebGPUTextureUtils ) + +Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported. + +Depending on whether you use [WebGLRenderer](WebGLRenderer.html) or [WebGPURenderer](WebGPURenderer.html), you must inject the corresponding texture utils [WebGLTextureUtils](WebGLTextureUtils.html) or [WebGPUTextureUtils](WebGPUTextureUtils.html). + +**utils** + +The texture utils. + +## Type Definitions + +### .OnDone( result : ArrayBuffer ) + +onDone callback of `USDZExporter`. + +**result** + +The generated USDZ. + +### .OnError( error : Error ) + +onError callback of `USDZExporter`. + +**error** + +The error object. + +### .Options + +Export options of `USDZExporter`. + +**maxTextureSize** +number + +The maximum texture size that is going to be exported. + +Default is `1024`. + +**includeAnchoringProperties** +boolean + +Whether to include anchoring properties or not. + +Default is `true`. + +**onlyVisible** +boolean + +Export only visible 3D objects. + +Default is `true`. + +**ar** +Object + +If `includeAnchoringProperties` is set to `true`, the anchoring type and alignment can be configured via `ar.anchoring.type` and `ar.planeAnchoring.alignment`. + +**quickLookCompatible** +boolean + +Whether to make the exported USDZ compatible to QuickLook which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback). + +Default is `false`. + +## Source + +[examples/jsm/exporters/USDZExporter.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/USDZExporter.js) \ No newline at end of file diff --git a/docs/pages/Uint16BufferAttribute.html.md b/docs/pages/Uint16BufferAttribute.html.md new file mode 100644 index 00000000000000..39347d4323a999 --- /dev/null +++ b/docs/pages/Uint16BufferAttribute.html.md @@ -0,0 +1,29 @@ +*Inheritance: BufferAttribute →* + +# Uint16BufferAttribute + +Convenient class that can be used when creating a `UInt16` buffer attribute with a plain `Array` instance. + +## Constructor + +### new Uint16BufferAttribute( array : Array. | Uint16Array, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Uint32BufferAttribute.html.md b/docs/pages/Uint32BufferAttribute.html.md new file mode 100644 index 00000000000000..391d3d10de20b4 --- /dev/null +++ b/docs/pages/Uint32BufferAttribute.html.md @@ -0,0 +1,29 @@ +*Inheritance: BufferAttribute →* + +# Uint32BufferAttribute + +Convenient class that can be used when creating a `UInt32` buffer attribute with a plain `Array` instance. + +## Constructor + +### new Uint32BufferAttribute( array : Array. | Uint32Array, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Uint8BufferAttribute.html.md b/docs/pages/Uint8BufferAttribute.html.md new file mode 100644 index 00000000000000..2e3b832e58b190 --- /dev/null +++ b/docs/pages/Uint8BufferAttribute.html.md @@ -0,0 +1,29 @@ +*Inheritance: BufferAttribute →* + +# Uint8BufferAttribute + +Convenient class that can be used when creating a `UInt8` buffer attribute with a plain `Array` instance. + +## Constructor + +### new Uint8BufferAttribute( array : Array. | Uint8Array, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/Uint8ClampedBufferAttribute.html.md b/docs/pages/Uint8ClampedBufferAttribute.html.md new file mode 100644 index 00000000000000..52ca60443ecddd --- /dev/null +++ b/docs/pages/Uint8ClampedBufferAttribute.html.md @@ -0,0 +1,29 @@ +*Inheritance: BufferAttribute →* + +# Uint8ClampedBufferAttribute + +Convenient class that can be used when creating a `UInt8Clamped` buffer attribute with a plain `Array` instance. + +## Constructor + +### new Uint8ClampedBufferAttribute( array : Array. | Uint8ClampedArray, itemSize : number, normalized : boolean ) + +Constructs a new buffer attribute. + +**array** + +The array holding the attribute data. + +**itemSize** + +The item size. + +**normalized** + +Whether the data are normalized or not. + +Default is `false`. + +## Source + +[src/core/BufferAttribute.js](https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js) \ No newline at end of file diff --git a/docs/pages/UltraHDRLoader.html.md b/docs/pages/UltraHDRLoader.html.md new file mode 100644 index 00000000000000..af3ee88865cbe9 --- /dev/null +++ b/docs/pages/UltraHDRLoader.html.md @@ -0,0 +1,109 @@ +*Inheritance: Loader →* + +# UltraHDRLoader + +A loader for the Ultra HDR Image Format. + +Existing HDR or EXR textures can be converted to Ultra HDR with this [tool](https://gainmap-creator.monogrid.com/). + +Current feature set: + +* JPEG headers (required) +* XMP metadata (required) +* XMP validation (not implemented) +* EXIF profile (not implemented) +* ICC profile (not implemented) +* Binary storage for SDR & HDR images (required) +* Gainmap metadata (required) +* Non-JPEG image formats (not implemented) +* Primary image as an HDR image (not implemented) + +## Code Example + +```js +const loader = new UltraHDRLoader(); +const texture = await loader.loadAsync( 'textures/equirectangular/ice_planet_close.jpg' ); +texture.mapping = THREE.EquirectangularReflectionMapping; +scene.background = texture; +scene.environment = texture; +``` + +## Import + +UltraHDRLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; +``` + +## Constructor + +### new UltraHDRLoader( manager : LoadingManager ) + +Constructs a new Ultra HDR loader. + +**manager** + +The loading manager. + +## Properties + +### .type : HalfFloatType | FloatType + +The texture type. + +Default is `HalfFloatType`. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) : DataTexture + +Starts loading from the given URL and passes the loaded Ultra HDR texture to the `onLoad()` callback. + +**url** + +The path/URL of the files to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +**Returns:** The Ultra HDR texture. + +### .parse( buffer : ArrayBuffer, onLoad : function ) + +Parses the given Ultra HDR texture data. + +**buffer** + +The raw texture data. + +**onLoad** + +The `onLoad` callback. + +**Overrides:** [Loader#parse](Loader.html#parse) + +### .setDataType( value : HalfFloatType | FloatType ) : UltraHDRLoader + +Sets the texture type. + +**value** + +The texture type to set. + +**Returns:** A reference to this loader. + +## Source + +[examples/jsm/loaders/UltraHDRLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/UltraHDRLoader.js) \ No newline at end of file diff --git a/docs/pages/Uniform.html.md b/docs/pages/Uniform.html.md new file mode 100644 index 00000000000000..e88736cd80ff28 --- /dev/null +++ b/docs/pages/Uniform.html.md @@ -0,0 +1,82 @@ +# Uniform + +Represents a uniform which is a global shader variable. They are passed to shader programs. + +When declaring a uniform of a [ShaderMaterial](ShaderMaterial.html), it is declared by value or by object. + +Since this class can only be used in context of [ShaderMaterial](ShaderMaterial.html), it is only supported in [WebGLRenderer](WebGLRenderer.html). + +## Code Example + +```js +uniforms: { + time: { value: 1.0 }, + resolution: new Uniform( new Vector2() ) +}; +``` + +## Constructor + +### new Uniform( value : any ) + +Constructs a new uniform. + +**value** + +The uniform value. + +## Properties + +### .boundary : number + +Used to build the uniform buffer according to the STD140 layout. Derived uniforms will set this property to a data type specific value. + +### .index : number + +This property is set by [UniformsGroup](UniformsGroup.html) and marks the index position in the uniform array. + +### .itemSize : number + +The item size. Derived uniforms will set this property to a data type specific value. + +### .name : string + +The uniform's name. + +### .offset : number + +This property is set by [UniformsGroup](UniformsGroup.html) and marks the start position in the uniform buffer. + +### .value : any + +The uniform value. + +### .value : any + +The uniform's value. + +## Methods + +### .clone() : Uniform + +Returns a new uniform with copied values from this instance. If the value has a `clone()` method, the value is cloned as well. + +**Returns:** A clone of this instance. + +### .getValue() : any + +Returns the uniform's value. + +**Returns:** The value. + +### .setValue( value : any ) + +Sets the uniform's value. + +**value** + +The value to set. + +## Source + +[src/core/Uniform.js](https://github.com/mrdoob/three.js/blob/master/src/core/Uniform.js) \ No newline at end of file diff --git a/docs/pages/UniformArrayElementNode.html.md b/docs/pages/UniformArrayElementNode.html.md new file mode 100644 index 00000000000000..c5801b01cb8eb3 --- /dev/null +++ b/docs/pages/UniformArrayElementNode.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → Node → ArrayElementNode →* + +# UniformArrayElementNode + +Represents the element access on uniform array nodes. + +## Constructor + +### new UniformArrayElementNode( uniformArrayNode : UniformArrayNode, indexNode : IndexNode ) + +Constructs a new buffer node. + +**uniformArrayNode** + +The uniform array node to access. + +**indexNode** + +The index data that define the position of the accessed element in the array. + +## Properties + +### .isArrayBufferElementNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/nodes/accessors/UniformArrayNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/UniformArrayNode.js) \ No newline at end of file diff --git a/docs/pages/UniformArrayNode.html.md b/docs/pages/UniformArrayNode.html.md new file mode 100644 index 00000000000000..6c4f06414e1691 --- /dev/null +++ b/docs/pages/UniformArrayNode.html.md @@ -0,0 +1,124 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → BufferNode →* + +# UniformArrayNode + +Similar to [BufferNode](BufferNode.html) this module represents array-like data as uniform buffers. Unlike [BufferNode](BufferNode.html), it can handle more common data types in the array (e.g `three.js` primitives) and automatically manage buffer padding. It should be the first choice when working with uniforms buffers. + +## Code Example + +```js +const tintColors = uniformArray( [ + new Color( 1, 0, 0 ), + new Color( 0, 1, 0 ), + new Color( 0, 0, 1 ) +], 'color' ); +const redColor = tintColors.element( 0 ); +``` + +## Constructor + +### new UniformArrayNode( value : Array., elementType : string ) + +Constructs a new uniform array node. + +**value** + +Array holding the buffer data. + +**elementType** + +The data type of a buffer element. + +Default is `null`. + +## Properties + +### .array : Array. + +Array holding the buffer data. Unlike [BufferNode](BufferNode.html), the array can hold number primitives as well as three.js objects like vectors, matrices or colors. + +### .elementType : string + +The data type of an array element. + +### .isArrayBufferNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .paddedType : string + +The padded type. Uniform buffers must conform to a certain buffer layout so a separate type is computed to ensure correct buffer size. + +### .updateType : string + +Overwritten since uniform array nodes are updated per render. + +Default is `'render'`. + +**Overrides:** [BufferNode#updateType](BufferNode.html#updateType) + +## Methods + +### .element( indexNode : IndexNode ) : UniformArrayElementNode + +Overwrites the default `element()` method to provide element access based on [UniformArrayNode](UniformArrayNode.html). + +**indexNode** + +The index node. + +### .getElementType( builder : NodeBuilder ) : string + +The data type of the array elements. + +**builder** + +The current node builder. + +**Overrides:** [BufferNode#getElementType](BufferNode.html#getElementType) + +**Returns:** The element type. + +### .getNodeType( builder : NodeBuilder ) : string + +This method is overwritten since the node type is inferred from the [UniformArrayNode#paddedType](UniformArrayNode.html#paddedType). + +**builder** + +The current node builder. + +**Overrides:** [BufferNode#getNodeType](BufferNode.html#getNodeType) + +**Returns:** The node type. + +### .getPaddedType() : string + +Returns the padded type based on the element type. + +**Returns:** The padded type. + +### .setup( builder : NodeBuilder ) : null + +Implement the value buffer creation based on the array data. + +**builder** + +A reference to the current node builder. + +**Overrides:** [BufferNode#setup](BufferNode.html#setup) + +### .update( frame : NodeFrame ) + +The update makes sure to correctly transfer the data from the (complex) objects in the array to the internal, correctly padded value buffer. + +**frame** + +A reference to the current node frame. + +**Overrides:** [BufferNode#update](BufferNode.html#update) + +## Source + +[src/nodes/accessors/UniformArrayNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/UniformArrayNode.js) \ No newline at end of file diff --git a/docs/pages/UniformGroupNode.html.md b/docs/pages/UniformGroupNode.html.md new file mode 100644 index 00000000000000..7f3316d2118e46 --- /dev/null +++ b/docs/pages/UniformGroupNode.html.md @@ -0,0 +1,63 @@ +*Inheritance: EventDispatcher → Node →* + +# UniformGroupNode + +This node can be used to group single instances of [UniformNode](UniformNode.html) and manage them as a uniform buffer. + +In most cases, the predefined nodes `objectGroup`, `renderGroup` and `frameGroup` will be used when defining the [UniformNode#groupNode](UniformNode.html#groupNode) property. + +* `objectGroup`: Uniform buffer per object. +* `renderGroup`: Shared uniform buffer, updated once per render call. +* `frameGroup`: Shared uniform buffer, updated once per frame. + +## Constructor + +### new UniformGroupNode( name : string, shared : boolean, order : number ) + +Constructs a new uniform group node. + +**name** + +The name of the uniform group node. + +**shared** + +Whether this uniform group node is shared or not. + +Default is `false`. + +**order** + +Influences the internal sorting. + +Default is `1`. + +## Properties + +### .isUniformGroup : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the uniform group node. + +**Overrides:** [Node#name](Node.html#name) + +### .order : number + +Influences the internal sorting. TODO: Add details when this property should be changed. + +Default is `1`. + +### .shared : boolean + +Whether this uniform group node is shared or not. + +Default is `false`. + +## Source + +[src/nodes/core/UniformGroupNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/UniformGroupNode.js) \ No newline at end of file diff --git a/docs/pages/UniformNode.html.md b/docs/pages/UniformNode.html.md new file mode 100644 index 00000000000000..753e1a406dbce3 --- /dev/null +++ b/docs/pages/UniformNode.html.md @@ -0,0 +1,95 @@ +*Inheritance: EventDispatcher → Node → InputNode →* + +# UniformNode + +Class for representing a uniform. + +## Constructor + +### new UniformNode( value : any, nodeType : string ) + +Constructs a new uniform node. + +**value** + +The value of this node. Usually a JS primitive or three.js object (vector, matrix, color, texture). + +**nodeType** + +The node type. If no explicit type is defined, the node tries to derive the type from its value. + +Default is `null`. + +## Properties + +### .groupNode : UniformGroupNode + +The uniform group of this uniform. By default, uniforms are managed per object but they might belong to a shared group which is updated per frame or render call. + +### .isUniformNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name or label of the uniform. + +Default is `''`. + +**Overrides:** [InputNode#name](InputNode.html#name) + +## Methods + +### .getGroup() : UniformGroupNode + +Returns the [UniformNode#groupNode](UniformNode.html#groupNode). + +**Returns:** The uniform group. + +### .getUniformHash( builder : NodeBuilder ) : string + +By default, this method returns the result of [Node#getHash](Node.html#getHash) but derived classes might overwrite this method with a different implementation. + +**builder** + +The current node builder. + +**Returns:** The uniform hash. + +### .label( name : string ) : UniformNode + +Sets the [UniformNode#name](UniformNode.html#name) property. + +**name** + +The name of the uniform. + +**Deprecated:** Yes + +**Returns:** A reference to this node. + +### .setGroup( group : UniformGroupNode ) : UniformNode + +Sets the [UniformNode#groupNode](UniformNode.html#groupNode) property. + +**group** + +The uniform group. + +**Returns:** A reference to this node. + +### .setName( name : string ) : UniformNode + +Sets the [UniformNode#name](UniformNode.html#name) property. + +**name** + +The name of the uniform. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/core/UniformNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/UniformNode.js) \ No newline at end of file diff --git a/docs/pages/UniformsGroup.html.md b/docs/pages/UniformsGroup.html.md new file mode 100644 index 00000000000000..58bda4197fa839 --- /dev/null +++ b/docs/pages/UniformsGroup.html.md @@ -0,0 +1,263 @@ +*Inheritance: EventDispatcher →* + +# UniformsGroup + +A class for managing multiple uniforms in a single group. The renderer will process such a definition as a single UBO. + +Since this class can only be used in context of [ShaderMaterial](ShaderMaterial.html), it is only supported in [WebGLRenderer](WebGLRenderer.html). + +## Constructor + +### new UniformsGroup() + +Constructs a new uniforms group. + +## Properties + +### .buffer : Float32Array + +A Float32 array buffer with the uniform values. + +**Overrides:** [UniformBuffer#buffer](UniformBuffer.html#buffer) + +### .byteLength : number + +The byte length of the buffer with correct buffer alignment. + +**Overrides:** [UniformBuffer#byteLength](UniformBuffer.html#byteLength) + +### .id : number (readonly) + +The ID of the 3D object. + +### .isUniformsGroup : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .isUniformsGroup : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the uniforms group. + +**Overrides:** [UniformBuffer#name](UniformBuffer.html#name) + +### .uniforms : Array. + +An array holding the uniforms. + +### .uniforms : Array. + +An array of uniform objects. + +The order of uniforms in this array must match the order of uniforms in the shader. + +### .usage : StaticDrawUsage | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage + +The buffer usage. + +Default is `StaticDrawUsage`. + +### .values : Array. + +An array with the raw uniform values. + +## Methods + +### .add( uniform : Uniform ) : UniformsGroup + +Adds the given uniform to this uniforms group. + +**uniform** + +The uniform to add. + +**Returns:** A reference to this uniforms group. + +### .addUniform( uniform : Uniform ) : UniformsGroup + +Adds a uniform to this group. + +**uniform** + +The uniform to add. + +**Returns:** A reference to this group. + +### .addUniformUpdateRange( uniform : Uniform ) + +Adds a uniform's update range to this buffer. + +**uniform** + +The uniform. + +### .clearUpdateRanges() + +Clears all update ranges of this buffer. + +**Overrides:** [UniformBuffer#clearUpdateRanges](UniformBuffer.html#clearUpdateRanges) + +### .clone() : UniformsGroup + +Returns a new uniforms group with copied values from this instance. + +**Overrides:** [UniformBuffer#clone](UniformBuffer.html#clone) + +**Returns:** A clone of this instance. + +### .copy( source : UniformsGroup ) : UniformsGroup + +Copies the values of the given uniforms group to this instance. + +**source** + +The uniforms group to copy. + +**Returns:** A reference to this uniforms group. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +##### Fires: + +* [Texture#event:dispose](Texture.html#event:dispose) + +### .remove( uniform : Uniform ) : UniformsGroup + +Removes the given uniform from this uniforms group. + +**uniform** + +The uniform to remove. + +**Returns:** A reference to this uniforms group. + +### .removeUniform( uniform : Uniform ) : UniformsGroup + +Removes a uniform from this group. + +**uniform** + +The uniform to remove. + +**Returns:** A reference to this group. + +### .setName( name : string ) : UniformsGroup + +Sets the name of this uniforms group. + +**name** + +The name to set. + +**Returns:** A reference to this uniforms group. + +### .setUsage( value : StaticDrawUsage | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage ) : UniformsGroup + +Sets the usage of this uniforms group. + +**value** + +The usage to set. + +**Returns:** A reference to this uniforms group. + +### .update() : boolean + +Updates this group by updating each uniform object of the internal uniform list. The uniform objects check if their values has actually changed so this method only returns `true` if there is a real value change. + +**Overrides:** [UniformBuffer#update](UniformBuffer.html#update) + +**Returns:** Whether the uniforms have been updated and must be uploaded to the GPU. + +### .updateByType( uniform : Uniform ) : boolean + +Updates a given uniform by calling an update method matching the uniforms type. + +**uniform** + +The uniform to update. + +**Returns:** Whether the uniform has been updated or not. + +### .updateColor( uniform : ColorUniform ) : boolean + +Updates a given Color uniform. + +**uniform** + +The Color uniform. + +**Returns:** Whether the uniform has been updated or not. + +### .updateMatrix3( uniform : Matrix3Uniform ) : boolean + +Updates a given Matrix3 uniform. + +**uniform** + +The Matrix3 uniform. + +**Returns:** Whether the uniform has been updated or not. + +### .updateMatrix4( uniform : Matrix4Uniform ) : boolean + +Updates a given Matrix4 uniform. + +**uniform** + +The Matrix4 uniform. + +**Returns:** Whether the uniform has been updated or not. + +### .updateNumber( uniform : NumberUniform ) : boolean + +Updates a given Number uniform. + +**uniform** + +The Number uniform. + +**Returns:** Whether the uniform has been updated or not. + +### .updateVector2( uniform : Vector2Uniform ) : boolean + +Updates a given Vector2 uniform. + +**uniform** + +The Vector2 uniform. + +**Returns:** Whether the uniform has been updated or not. + +### .updateVector3( uniform : Vector3Uniform ) : boolean + +Updates a given Vector3 uniform. + +**uniform** + +The Vector3 uniform. + +**Returns:** Whether the uniform has been updated or not. + +### .updateVector4( uniform : Vector4Uniform ) : boolean + +Updates a given Vector4 uniform. + +**uniform** + +The Vector4 uniform. + +**Returns:** Whether the uniform has been updated or not. + +## Source + +[src/core/UniformsGroup.js](https://github.com/mrdoob/three.js/blob/master/src/core/UniformsGroup.js) \ No newline at end of file diff --git a/docs/pages/UnpackFloatNode.html.md b/docs/pages/UnpackFloatNode.html.md new file mode 100644 index 00000000000000..878fa6bd47675f --- /dev/null +++ b/docs/pages/UnpackFloatNode.html.md @@ -0,0 +1,37 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# UnpackFloatNode + +This node represents an operation that unpacks values from a 32-bit unsigned integer, reinterpreting the results as a floating-point vector + +## Constructor + +### new UnpackFloatNode( encoding : 'snorm' | 'unorm' | 'float16', uintNode : Node ) + +**encoding** + +The numeric encoding that describes how the integer values are mapped to the float range + +**uintNode** + +The uint node to be unpacked + +## Properties + +### .encoding : string + +The numeric encoding. + +### .isUnpackFloatNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .uintNode : Node + +The unsigned integer to be unpacked. + +## Source + +[src/nodes/math/UnpackFloatNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/math/UnpackFloatNode.js) \ No newline at end of file diff --git a/docs/pages/UnrealBloomPass.html.md b/docs/pages/UnrealBloomPass.html.md new file mode 100644 index 00000000000000..99bace3d2d047e --- /dev/null +++ b/docs/pages/UnrealBloomPass.html.md @@ -0,0 +1,139 @@ +*Inheritance: Pass →* + +# UnrealBloomPass + +This pass is inspired by the bloom pass of Unreal Engine. It creates a mip map chain of bloom textures and blurs them with different radii. Because of the weighted combination of mips, and because larger blurs are done on higher mips, this effect provides good quality and performance. + +When using this pass, tone mapping must be enabled in the renderer settings. + +Reference: + +* [Bloom in Unreal Engine](https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/) + +## Code Example + +```js +const resolution = new THREE.Vector2( window.innerWidth, window.innerHeight ); +const bloomPass = new UnrealBloomPass( resolution, 1.5, 0.4, 0.85 ); +composer.addPass( bloomPass ); +``` + +## Import + +UnrealBloomPass is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; +``` + +## Constructor + +### new UnrealBloomPass( resolution : Vector2, strength : number, radius : number, threshold : number ) + +Constructs a new Unreal Bloom pass. + +**resolution** + +The effect's resolution. + +**strength** + +The Bloom strength. + +Default is `1`. + +**radius** + +The Bloom radius. + +**threshold** + +The luminance threshold limits which bright areas contribute to the Bloom effect. + +## Properties + +### .clearColor : Color + +The effect's clear color + +Default is `(0,0,0)`. + +### .needsSwap : boolean + +Overwritten to disable the swap. + +Default is `false`. + +**Overrides:** [Pass#needsSwap](Pass.html#needsSwap) + +### .radius : number + +The Bloom radius. Must be in the range `[0,1]`. + +### .resolution : Vector2 + +The effect's resolution. + +Default is `(256,256)`. + +### .strength : number + +The Bloom strength. + +Default is `1`. + +### .threshold : number + +The luminance threshold limits which bright areas contribute to the Bloom effect. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app. + +**Overrides:** [Pass#dispose](Pass.html#dispose) + +### .render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean ) + +Performs the Bloom pass. + +**renderer** + +The renderer. + +**writeBuffer** + +The write buffer. This buffer is intended as the rendering destination for the pass. + +**readBuffer** + +The read buffer. The pass can access the result from the previous pass from this buffer. + +**deltaTime** + +The delta time in seconds. + +**maskActive** + +Whether masking is active or not. + +**Overrides:** [Pass#render](Pass.html#render) + +### .setSize( width : number, height : number ) + +Sets the size of the pass. + +**width** + +The width to set. + +**height** + +The height to set. + +**Overrides:** [Pass#setSize](Pass.html#setSize) + +## Source + +[examples/jsm/postprocessing/UnrealBloomPass.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/postprocessing/UnrealBloomPass.js) \ No newline at end of file diff --git a/docs/pages/UserDataNode.html.md b/docs/pages/UserDataNode.html.md new file mode 100644 index 00000000000000..6f8070808d4873 --- /dev/null +++ b/docs/pages/UserDataNode.html.md @@ -0,0 +1,61 @@ +*Inheritance: EventDispatcher → Node → ReferenceNode →* + +# UserDataNode + +A special type of reference node that allows to link values in `userData` fields to node objects. + +Since `UserDataNode` is extended from [ReferenceNode](ReferenceNode.html), the node value will automatically be updated when the `rotation` user data field changes. + +## Code Example + +```js +sprite.userData.rotation = 1; // stores individual rotation per sprite +const material = new THREE.SpriteNodeMaterial(); +material.rotationNode = userData( 'rotation', 'float' ); +``` + +## Constructor + +### new UserDataNode( property : string, inputType : string, userData : Object ) + +Constructs a new user data node. + +**property** + +The property name that should be referenced by the node. + +**inputType** + +The node data type of the reference. + +**userData** + +A reference to the `userData` object. If not provided, the `userData` property of the 3D object that uses the node material is evaluated. + +Default is `null`. + +## Properties + +### .userData : Object + +A reference to the `userData` object. If not provided, the `userData` property of the 3D object that uses the node material is evaluated. + +Default is `null`. + +## Methods + +### .updateReference( state : NodeFrame | NodeBuilder ) : Object + +Overwritten to make sure [ReferenceNode#reference](ReferenceNode.html#reference) points to the correct `userData` field. + +**state** + +The current state to evaluate. + +**Overrides:** [ReferenceNode#updateReference](ReferenceNode.html#updateReference) + +**Returns:** A reference to the `userData` field. + +## Source + +[src/nodes/accessors/UserDataNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/UserDataNode.js) \ No newline at end of file diff --git a/docs/pages/VOXData3DTexture.html.md b/docs/pages/VOXData3DTexture.html.md new file mode 100644 index 00000000000000..e6328adaecd70a --- /dev/null +++ b/docs/pages/VOXData3DTexture.html.md @@ -0,0 +1,21 @@ +*Inheritance: EventDispatcher → Texture → Data3DTexture →* + +# VOXData3DTexture + +A VOX 3D texture. + +Instances of this class are created from the loaded chunks of [VOXLoader](VOXLoader.html). + +## Constructor + +### new VOXData3DTexture( chunk : Object ) + +Constructs a new VOX 3D texture. + +**chunk** + +A VOX chunk loaded via [VOXLoader](VOXLoader.html). + +## Source + +[examples/jsm/loaders/VOXLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/VOXLoader.js) \ No newline at end of file diff --git a/docs/pages/VOXLoader.html.md b/docs/pages/VOXLoader.html.md new file mode 100644 index 00000000000000..11d4c559f23b4b --- /dev/null +++ b/docs/pages/VOXLoader.html.md @@ -0,0 +1,65 @@ +*Inheritance: Loader →* + +# VOXLoader + +A loader for the VOX format. + +## Code Example + +```js +const loader = new VOXLoader(); +const result = await loader.loadAsync( 'models/vox/monu10.vox' ); +scene.add( result.scene.children[ 0 ] ); +``` + +## Import + +VOXLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VOXLoader } from 'three/addons/loaders/VOXLoader.js'; +``` + +## Constructor + +### new VOXLoader() + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded VOX asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( buffer : ArrayBuffer ) : Object + +Parses the given VOX data and returns the result object. + +**buffer** + +The raw VOX data as an array buffer. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed VOX data with properties: chunks, scene. + +## Source + +[examples/jsm/loaders/VOXLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/VOXLoader.js) \ No newline at end of file diff --git a/docs/pages/VOXMesh.html.md b/docs/pages/VOXMesh.html.md new file mode 100644 index 00000000000000..7b4c6732d2504c --- /dev/null +++ b/docs/pages/VOXMesh.html.md @@ -0,0 +1,21 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# VOXMesh + +A VOX mesh. + +Instances of this class are created from the loaded chunks of [VOXLoader](VOXLoader.html). + +## Constructor + +### new VOXMesh( chunk : Object ) + +Constructs a new VOX mesh. + +**chunk** + +A VOX chunk loaded via [VOXLoader](VOXLoader.html). + +## Source + +[examples/jsm/loaders/VOXLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/VOXLoader.js) \ No newline at end of file diff --git a/docs/pages/VRButton.html.md b/docs/pages/VRButton.html.md new file mode 100644 index 00000000000000..2a143403dda834 --- /dev/null +++ b/docs/pages/VRButton.html.md @@ -0,0 +1,49 @@ +# VRButton + +A utility class for creating a button that allows to initiate immersive VR sessions based on WebXR. The button can be created with a factory method and then appended ot the website's DOM. + +## Code Example + +```js +document.body.appendChild( VRButton.createButton( renderer ) ); +``` + +## Import + +VRButton is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VRButton } from 'three/addons/webxr/VRButton.js'; +``` + +## Properties + +### .xrSessionIsGranted : boolean + +Whether a XR session has been granted or not. + +Default is `false`. + +## Static Methods + +### .createButton( renderer : WebGLRenderer | WebGPURenderer, sessionInit : XRSessionInit ) : HTMLElement + +Constructs a new VR button. + +**renderer** + +The renderer. + +**sessionInit** + +The a configuration object for the AR session. + +**Returns:** The button or an error message if `immersive-ar` isn't supported. + +### .registerSessionGrantedListener() + +Registers a `sessiongranted` event listener. When a session is granted, the VRButton#xrSessionIsGranted flag will evaluate to `true`. This method is automatically called by the module itself so there should be no need to use it on app level. + +## Source + +[examples/jsm/webxr/VRButton.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/VRButton.js) \ No newline at end of file diff --git a/docs/pages/VRMLLoader.html.md b/docs/pages/VRMLLoader.html.md new file mode 100644 index 00000000000000..9c073de972875d --- /dev/null +++ b/docs/pages/VRMLLoader.html.md @@ -0,0 +1,75 @@ +*Inheritance: Loader →* + +# VRMLLoader + +A loader for the VRML format. + +## Code Example + +```js +const loader = new VRMLLoader(); +const object = await loader.loadAsync( 'models/vrml/house.wrl' ); +scene.add( object ); +``` + +## Import + +VRMLLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VRMLLoader } from 'three/addons/loaders/VRMLLoader.js'; +``` + +## Constructor + +### new VRMLLoader( manager : LoadingManager ) + +Constructs a new VRML loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded VRML asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : string, path : string ) : Scene + +Parses the given VRML data and returns the resulting scene. + +**data** + +The raw VRML data as a string. + +**path** + +The URL base path. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed scene. + +## Source + +[examples/jsm/loaders/VRMLLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/VRMLLoader.js) \ No newline at end of file diff --git a/docs/pages/VTKLoader.html.md b/docs/pages/VTKLoader.html.md new file mode 100644 index 00000000000000..f3865d096c7c72 --- /dev/null +++ b/docs/pages/VTKLoader.html.md @@ -0,0 +1,75 @@ +*Inheritance: Loader →* + +# VTKLoader + +A loader for the VTK format. + +This loader only supports the `POLYDATA` dataset format so far. Other formats (structured points, structured grid, rectilinear grid, unstructured grid, appended) are not supported. + +## Code Example + +```js +const loader = new VTKLoader(); +const geometry = await loader.loadAsync( 'models/vtk/liver.vtk' ); +geometry.computeVertexNormals(); +const mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial() ); +scene.add( mesh ); +``` + +## Import + +VTKLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VTKLoader } from 'three/addons/loaders/VTKLoader.js'; +``` + +## Constructor + +### new VTKLoader( manager : LoadingManager ) + +Constructs a new VTK loader. + +**manager** + +The loading manager. + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded VRML asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( data : ArrayBuffer ) : BufferGeometry + +Parses the given VTK data and returns the resulting geometry. + +**data** + +The raw VTK data as an array buffer + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The parsed geometry. + +## Source + +[examples/jsm/loaders/VTKLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/VTKLoader.js) \ No newline at end of file diff --git a/docs/pages/VarNode.html.md b/docs/pages/VarNode.html.md new file mode 100644 index 00000000000000..830406762650a2 --- /dev/null +++ b/docs/pages/VarNode.html.md @@ -0,0 +1,117 @@ +*Inheritance: EventDispatcher → Node →* + +# VarNode + +Class for representing shader variables as nodes. Variables are created from existing nodes like the following: + +## Code Example + +```js +const depth = sampleDepth( uvNode ).toVar( 'depth' ); +``` + +## Constructor + +### new VarNode( node : Node, name : string, readOnly : boolean ) + +Constructs a new variable node. + +**node** + +The node for which a variable should be created. + +**name** + +The name of the variable in the shader. + +Default is `null`. + +**readOnly** + +The read-only flag. + +Default is `false`. + +## Properties + +### .global : boolean + +`VarNode` sets this property to `true` by default. + +Default is `true`. + +**Overrides:** [Node#global](Node.html#global) + +### .intent : boolean + +This flag is used to indicate that this node is used for intent. + +Default is `false`. + +### .isVarNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the variable in the shader. If no name is defined, the node system auto-generates one. + +Default is `null`. + +**Overrides:** [Node#name](Node.html#name) + +### .node : Node + +The node for which a variable should be created. + +### .parents : boolean + +Add this flag to the node system to indicate that this node require parents. + +Default is `true`. + +**Overrides:** [Node#parents](Node.html#parents) + +### .readOnly : boolean + +The read-only flag. + +Default is `false`. + +## Methods + +### .getIntent() : boolean + +Returns the intent flag of this node. + +**Returns:** The intent flag. + +### .isIntent( builder : NodeBuilder ) : boolean + +Checks if this node is used for intent. + +**builder** + +The node builder. + +**Returns:** Whether this node is used for intent. + +### .setIntent( value : boolean ) : VarNode + +Sets the intent flag for this node. + +This flag is used to indicate that this node is used for intent and should not be built directly. Instead, it is used to indicate that the node should be treated as a variable intent. + +It's useful for assigning variables without needing creating a new variable node. + +**value** + +The value to set for the intent flag. + +**Returns:** This node. + +## Source + +[src/nodes/core/VarNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/VarNode.js) \ No newline at end of file diff --git a/docs/pages/VaryingNode.html.md b/docs/pages/VaryingNode.html.md new file mode 100644 index 00000000000000..2722a51c95c549 --- /dev/null +++ b/docs/pages/VaryingNode.html.md @@ -0,0 +1,99 @@ +*Inheritance: EventDispatcher → Node →* + +# VaryingNode + +Class for representing shader varyings as nodes. Varyings are create from existing nodes like the following: + +## Code Example + +```js +const positionLocal = positionGeometry.toVarying( 'vPositionLocal' ); +``` + +## Constructor + +### new VaryingNode( node : Node, name : string ) + +Constructs a new varying node. + +**node** + +The node for which a varying should be created. + +**name** + +The name of the varying in the shader. + +Default is `null`. + +## Properties + +### .global : boolean + +This flag is used for global cache. + +Default is `true`. + +**Overrides:** [Node#global](Node.html#global) + +### .interpolationSampling : string + +The interpolation sampling type of varying data. + +Default is `null`. + +### .interpolationType : string + +The interpolation type of the varying data. + +Default is `null`. + +### .isVaryingNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the varying in the shader. If no name is defined, the node system auto-generates one. + +Default is `null`. + +**Overrides:** [Node#name](Node.html#name) + +### .node : Node + +The node for which a varying should be created. + +## Methods + +### .setInterpolation( type : string, sampling : string ) : VaryingNode + +Defines the interpolation type of the varying. + +**type** + +The interpolation type. + +**sampling** + +The interpolation sampling type + +Default is `null`. + +**Returns:** A reference to this node. + +### .setupVarying( builder : NodeBuilder ) : NodeVarying + +This method performs the setup of a varying node with the current node builder. + +**builder** + +The current node builder. + +**Returns:** The node varying from the node builder. + +## Source + +[src/nodes/core/VaryingNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/core/VaryingNode.js) \ No newline at end of file diff --git a/docs/pages/Vector2.html.md b/docs/pages/Vector2.html.md new file mode 100644 index 00000000000000..527271cf0e8ddb --- /dev/null +++ b/docs/pages/Vector2.html.md @@ -0,0 +1,586 @@ +# Vector2 + +Class representing a 2D vector. A 2D vector is an ordered pair of numbers (labeled x and y), which can be used to represent a number of things, such as: + +* A point in 2D space (i.e. a position on a plane). +* A direction and length across a plane. In three.js the length will always be the Euclidean distance(straight-line distance) from `(0, 0)` to `(x, y)` and the direction is also measured from `(0, 0)` towards `(x, y)`. +* Any arbitrary ordered pair of numbers. + +There are other things a 2D vector can be used to represent, such as momentum vectors, complex numbers and so on, however these are the most common uses in three.js. + +Iterating through a vector instance will yield its components `(x, y)` in the corresponding order. + +## Code Example + +```js +const a = new THREE.Vector2( 0, 1 ); +//no arguments; will be initialised to (0, 0) +const b = new THREE.Vector2( ); +const d = a.distanceTo( b ); +``` + +## Constructor + +### new Vector2( x : number, y : number ) + +Constructs a new 2D vector. + +**x** + +The x value of this vector. + +Default is `0`. + +**y** + +The y value of this vector. + +Default is `0`. + +## Properties + +### .height : number + +Alias for [Vector2#y](Vector2.html#y). + +### .isVector2 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .width : number + +Alias for [Vector2#x](Vector2.html#x). + +### .x : number + +The x value of this vector. + +### .y : number + +The y value of this vector. + +## Methods + +### .add( v : Vector2 ) : Vector2 + +Adds the given vector to this instance. + +**v** + +The vector to add. + +**Returns:** A reference to this vector. + +### .addScalar( s : number ) : Vector2 + +Adds the given scalar value to all components of this instance. + +**s** + +The scalar to add. + +**Returns:** A reference to this vector. + +### .addScaledVector( v : Vector2, s : number ) : Vector2 + +Adds the given vector scaled by the given factor to this instance. + +**v** + +The vector. + +**s** + +The factor that scales `v`. + +**Returns:** A reference to this vector. + +### .addVectors( a : Vector2, b : Vector2 ) : Vector2 + +Adds the given vectors and stores the result in this instance. + +**a** + +The first vector. + +**b** + +The second vector. + +**Returns:** A reference to this vector. + +### .angle() : number + +Computes the angle in radians of this vector with respect to the positive x-axis. + +**Returns:** The angle in radians. + +### .angleTo( v : Vector2 ) : number + +Returns the angle between the given vector and this instance in radians. + +**v** + +The vector to compute the angle with. + +**Returns:** The angle in radians. + +### .applyMatrix3( m : Matrix3 ) : Vector2 + +Multiplies this vector (with an implicit 1 as the 3rd component) by the given 3x3 matrix. + +**m** + +The matrix to apply. + +**Returns:** A reference to this vector. + +### .ceil() : Vector2 + +The components of this vector are rounded up to the nearest integer value. + +**Returns:** A reference to this vector. + +### .clamp( min : Vector2, max : Vector2 ) : Vector2 + +If this vector's x or y value is greater than the max vector's x or y value, it is replaced by the corresponding value. If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value. + +**min** + +The minimum x and y values. + +**max** + +The maximum x and y values in the desired range. + +**Returns:** A reference to this vector. + +### .clampLength( min : number, max : number ) : Vector2 + +If this vector's length is greater than the max value, it is replaced by the max value. If this vector's length is less than the min value, it is replaced by the min value. + +**min** + +The minimum value the vector length will be clamped to. + +**max** + +The maximum value the vector length will be clamped to. + +**Returns:** A reference to this vector. + +### .clampScalar( minVal : number, maxVal : number ) : Vector2 + +If this vector's x or y values are greater than the max value, they are replaced by the max value. If this vector's x or y values are less than the min value, they are replaced by the min value. + +**minVal** + +The minimum value the components will be clamped to. + +**maxVal** + +The maximum value the components will be clamped to. + +**Returns:** A reference to this vector. + +### .clone() : Vector2 + +Returns a new vector with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( v : Vector2 ) : Vector2 + +Copies the values of the given vector to this instance. + +**v** + +The vector to copy. + +**Returns:** A reference to this vector. + +### .cross( v : Vector2 ) : number + +Calculates the cross product of the given vector with this instance. + +**v** + +The vector to compute the cross product with. + +**Returns:** The result of the cross product. + +### .distanceTo( v : Vector2 ) : number + +Computes the distance from the given vector to this instance. + +**v** + +The vector to compute the distance to. + +**Returns:** The distance. + +### .distanceToSquared( v : Vector2 ) : number + +Computes the squared distance from the given vector to this instance. If you are just comparing the distance with another distance, you should compare the distance squared instead as it is slightly more efficient to calculate. + +**v** + +The vector to compute the squared distance to. + +**Returns:** The squared distance. + +### .divide( v : Vector2 ) : Vector2 + +Divides this instance by the given vector. + +**v** + +The vector to divide. + +**Returns:** A reference to this vector. + +### .divideScalar( scalar : number ) : Vector2 + +Divides this vector by the given scalar. + +**scalar** + +The scalar to divide. + +**Returns:** A reference to this vector. + +### .dot( v : Vector2 ) : number + +Calculates the dot product of the given vector with this instance. + +**v** + +The vector to compute the dot product with. + +**Returns:** The result of the dot product. + +### .equals( v : Vector2 ) : boolean + +Returns `true` if this vector is equal with the given one. + +**v** + +The vector to test for equality. + +**Returns:** Whether this vector is equal with the given one. + +### .floor() : Vector2 + +The components of this vector are rounded down to the nearest integer value. + +**Returns:** A reference to this vector. + +### .fromArray( array : Array., offset : number ) : Vector2 + +Sets this vector's x value to be `array[ offset ]` and y value to be `array[ offset + 1 ]`. + +**array** + +An array holding the vector component values. + +**offset** + +The offset into the array. + +Default is `0`. + +**Returns:** A reference to this vector. + +### .fromBufferAttribute( attribute : BufferAttribute, index : number ) : Vector2 + +Sets the components of this vector from the given buffer attribute. + +**attribute** + +The buffer attribute holding vector data. + +**index** + +The index into the attribute. + +**Returns:** A reference to this vector. + +### .getComponent( index : number ) : number + +Returns the value of the vector component which matches the given index. + +**index** + +The component index. `0` equals to x, `1` equals to y. + +**Returns:** A vector component value. + +### .length() : number + +Computes the Euclidean length (straight-line length) from (0, 0) to (x, y). + +**Returns:** The length of this vector. + +### .lengthSq() : number + +Computes the square of the Euclidean length (straight-line length) from (0, 0) to (x, y). If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate. + +**Returns:** The square length of this vector. + +### .lerp( v : Vector2, alpha : number ) : Vector2 + +Linearly interpolates between the given vector and this instance, where alpha is the percent distance along the line - alpha = 0 will be this vector, and alpha = 1 will be the given one. + +**v** + +The vector to interpolate towards. + +**alpha** + +The interpolation factor, typically in the closed interval `[0, 1]`. + +**Returns:** A reference to this vector. + +### .lerpVectors( v1 : Vector2, v2 : Vector2, alpha : number ) : Vector2 + +Linearly interpolates between the given vectors, where alpha is the percent distance along the line - alpha = 0 will be first vector, and alpha = 1 will be the second one. The result is stored in this instance. + +**v1** + +The first vector. + +**v2** + +The second vector. + +**alpha** + +The interpolation factor, typically in the closed interval `[0, 1]`. + +**Returns:** A reference to this vector. + +### .manhattanDistanceTo( v : Vector2 ) : number + +Computes the Manhattan distance from the given vector to this instance. + +**v** + +The vector to compute the Manhattan distance to. + +**Returns:** The Manhattan distance. + +### .manhattanLength() : number + +Computes the Manhattan length of this vector. + +**Returns:** The length of this vector. + +### .max( v : Vector2 ) : Vector2 + +If this vector's x or y value is less than the given vector's x or y value, replace that value with the corresponding max value. + +**v** + +The vector. + +**Returns:** A reference to this vector. + +### .min( v : Vector2 ) : Vector2 + +If this vector's x or y value is greater than the given vector's x or y value, replace that value with the corresponding min value. + +**v** + +The vector. + +**Returns:** A reference to this vector. + +### .multiply( v : Vector2 ) : Vector2 + +Multiplies the given vector with this instance. + +**v** + +The vector to multiply. + +**Returns:** A reference to this vector. + +### .multiplyScalar( scalar : number ) : Vector2 + +Multiplies the given scalar value with all components of this instance. + +**scalar** + +The scalar to multiply. + +**Returns:** A reference to this vector. + +### .negate() : Vector2 + +Inverts this vector - i.e. sets x = -x and y = -y. + +**Returns:** A reference to this vector. + +### .normalize() : Vector2 + +Converts this vector to a unit vector - that is, sets it equal to a vector with the same direction as this one, but with a vector length of `1`. + +**Returns:** A reference to this vector. + +### .random() : Vector2 + +Sets each component of this vector to a pseudo-random value between `0` and `1`, excluding `1`. + +**Returns:** A reference to this vector. + +### .rotateAround( center : Vector2, angle : number ) : Vector2 + +Rotates this vector around the given center by the given angle. + +**center** + +The point around which to rotate. + +**angle** + +The angle to rotate, in radians. + +**Returns:** A reference to this vector. + +### .round() : Vector2 + +The components of this vector are rounded to the nearest integer value + +**Returns:** A reference to this vector. + +### .roundToZero() : Vector2 + +The components of this vector are rounded towards zero (up if negative, down if positive) to an integer value. + +**Returns:** A reference to this vector. + +### .set( x : number, y : number ) : Vector2 + +Sets the vector components. + +**x** + +The value of the x component. + +**y** + +The value of the y component. + +**Returns:** A reference to this vector. + +### .setComponent( index : number, value : number ) : Vector2 + +Allows to set a vector component with an index. + +**index** + +The component index. `0` equals to x, `1` equals to y. + +**value** + +The value to set. + +**Returns:** A reference to this vector. + +### .setLength( length : number ) : Vector2 + +Sets this vector to a vector with the same direction as this one, but with the specified length. + +**length** + +The new length of this vector. + +**Returns:** A reference to this vector. + +### .setScalar( scalar : number ) : Vector2 + +Sets the vector components to the same value. + +**scalar** + +The value to set for all vector components. + +**Returns:** A reference to this vector. + +### .setX( x : number ) : Vector2 + +Sets the vector's x component to the given value + +**x** + +The value to set. + +**Returns:** A reference to this vector. + +### .setY( y : number ) : Vector2 + +Sets the vector's y component to the given value + +**y** + +The value to set. + +**Returns:** A reference to this vector. + +### .sub( v : Vector2 ) : Vector2 + +Subtracts the given vector from this instance. + +**v** + +The vector to subtract. + +**Returns:** A reference to this vector. + +### .subScalar( s : number ) : Vector2 + +Subtracts the given scalar value from all components of this instance. + +**s** + +The scalar to subtract. + +**Returns:** A reference to this vector. + +### .subVectors( a : Vector2, b : Vector2 ) : Vector2 + +Subtracts the given vectors and stores the result in this instance. + +**a** + +The first vector. + +**b** + +The second vector. + +**Returns:** A reference to this vector. + +### .toArray( array : Array., offset : number ) : Array. + +Writes the components of this vector to the given array. If no array is provided, the method returns a new instance. + +**array** + +The target array holding the vector components. + +Default is `[]`. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** The vector components. + +## Source + +[src/math/Vector2.js](https://github.com/mrdoob/three.js/blob/master/src/math/Vector2.js) \ No newline at end of file diff --git a/docs/pages/Vector3.html.md b/docs/pages/Vector3.html.md new file mode 100644 index 00000000000000..4733b7da99c4b3 --- /dev/null +++ b/docs/pages/Vector3.html.md @@ -0,0 +1,854 @@ +# Vector3 + +Class representing a 3D vector. A 3D vector is an ordered triplet of numbers (labeled x, y and z), which can be used to represent a number of things, such as: + +* A point in 3D space. +* A direction and length in 3D space. In three.js the length will always be the Euclidean distance(straight-line distance) from `(0, 0, 0)` to `(x, y, z)` and the direction is also measured from `(0, 0, 0)` towards `(x, y, z)`. +* Any arbitrary ordered triplet of numbers. + +There are other things a 3D vector can be used to represent, such as momentum vectors and so on, however these are the most common uses in three.js. + +Iterating through a vector instance will yield its components `(x, y, z)` in the corresponding order. + +## Code Example + +```js +const a = new THREE.Vector3( 0, 1, 0 ); +//no arguments; will be initialised to (0, 0, 0) +const b = new THREE.Vector3( ); +const d = a.distanceTo( b ); +``` + +## Constructor + +### new Vector3( x : number, y : number, z : number ) + +Constructs a new 3D vector. + +**x** + +The x value of this vector. + +Default is `0`. + +**y** + +The y value of this vector. + +Default is `0`. + +**z** + +The z value of this vector. + +Default is `0`. + +## Properties + +### .isVector3 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .x : number + +The x value of this vector. + +### .y : number + +The y value of this vector. + +### .z : number + +The z value of this vector. + +## Methods + +### .add( v : Vector3 ) : Vector3 + +Adds the given vector to this instance. + +**v** + +The vector to add. + +**Returns:** A reference to this vector. + +### .addScalar( s : number ) : Vector3 + +Adds the given scalar value to all components of this instance. + +**s** + +The scalar to add. + +**Returns:** A reference to this vector. + +### .addScaledVector( v : Vector3 | Vector4, s : number ) : Vector3 + +Adds the given vector scaled by the given factor to this instance. + +**v** + +The vector. + +**s** + +The factor that scales `v`. + +**Returns:** A reference to this vector. + +### .addVectors( a : Vector3, b : Vector3 ) : Vector3 + +Adds the given vectors and stores the result in this instance. + +**a** + +The first vector. + +**b** + +The second vector. + +**Returns:** A reference to this vector. + +### .angleTo( v : Vector3 ) : number + +Returns the angle between the given vector and this instance in radians. + +**v** + +The vector to compute the angle with. + +**Returns:** The angle in radians. + +### .applyAxisAngle( axis : Vector3, angle : number ) : Vector3 + +Applies a rotation specified by an axis and an angle to this vector. + +**axis** + +A normalized vector representing the rotation axis. + +**angle** + +The angle in radians. + +**Returns:** A reference to this vector. + +### .applyEuler( euler : Euler ) : Vector3 + +Applies the given Euler rotation to this vector. + +**euler** + +The Euler angles. + +**Returns:** A reference to this vector. + +### .applyMatrix3( m : Matrix3 ) : Vector3 + +Multiplies this vector with the given 3x3 matrix. + +**m** + +The 3x3 matrix. + +**Returns:** A reference to this vector. + +### .applyMatrix4( m : Matrix4 ) : Vector3 + +Multiplies this vector (with an implicit 1 in the 4th dimension) by m, and divides by perspective. + +**m** + +The matrix to apply. + +**Returns:** A reference to this vector. + +### .applyNormalMatrix( m : Matrix3 ) : Vector3 + +Multiplies this vector by the given normal matrix and normalizes the result. + +**m** + +The normal matrix. + +**Returns:** A reference to this vector. + +### .applyQuaternion( q : Quaternion ) : Vector3 + +Applies the given Quaternion to this vector. + +**q** + +The Quaternion. + +**Returns:** A reference to this vector. + +### .ceil() : Vector3 + +The components of this vector are rounded up to the nearest integer value. + +**Returns:** A reference to this vector. + +### .clamp( min : Vector3, max : Vector3 ) : Vector3 + +If this vector's x, y or z value is greater than the max vector's x, y or z value, it is replaced by the corresponding value. If this vector's x, y or z value is less than the min vector's x, y or z value, it is replaced by the corresponding value. + +**min** + +The minimum x, y and z values. + +**max** + +The maximum x, y and z values in the desired range. + +**Returns:** A reference to this vector. + +### .clampLength( min : number, max : number ) : Vector3 + +If this vector's length is greater than the max value, it is replaced by the max value. If this vector's length is less than the min value, it is replaced by the min value. + +**min** + +The minimum value the vector length will be clamped to. + +**max** + +The maximum value the vector length will be clamped to. + +**Returns:** A reference to this vector. + +### .clampScalar( minVal : number, maxVal : number ) : Vector3 + +If this vector's x, y or z values are greater than the max value, they are replaced by the max value. If this vector's x, y or z values are less than the min value, they are replaced by the min value. + +**minVal** + +The minimum value the components will be clamped to. + +**maxVal** + +The maximum value the components will be clamped to. + +**Returns:** A reference to this vector. + +### .clone() : Vector3 + +Returns a new vector with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( v : Vector3 ) : Vector3 + +Copies the values of the given vector to this instance. + +**v** + +The vector to copy. + +**Returns:** A reference to this vector. + +### .cross( v : Vector3 ) : Vector3 + +Calculates the cross product of the given vector with this instance. + +**v** + +The vector to compute the cross product with. + +**Returns:** The result of the cross product. + +### .crossVectors( a : Vector3, b : Vector3 ) : Vector3 + +Calculates the cross product of the given vectors and stores the result in this instance. + +**a** + +The first vector. + +**b** + +The second vector. + +**Returns:** A reference to this vector. + +### .distanceTo( v : Vector3 ) : number + +Computes the distance from the given vector to this instance. + +**v** + +The vector to compute the distance to. + +**Returns:** The distance. + +### .distanceToSquared( v : Vector3 ) : number + +Computes the squared distance from the given vector to this instance. If you are just comparing the distance with another distance, you should compare the distance squared instead as it is slightly more efficient to calculate. + +**v** + +The vector to compute the squared distance to. + +**Returns:** The squared distance. + +### .divide( v : Vector3 ) : Vector3 + +Divides this instance by the given vector. + +**v** + +The vector to divide. + +**Returns:** A reference to this vector. + +### .divideScalar( scalar : number ) : Vector3 + +Divides this vector by the given scalar. + +**scalar** + +The scalar to divide. + +**Returns:** A reference to this vector. + +### .dot( v : Vector3 ) : number + +Calculates the dot product of the given vector with this instance. + +**v** + +The vector to compute the dot product with. + +**Returns:** The result of the dot product. + +### .equals( v : Vector3 ) : boolean + +Returns `true` if this vector is equal with the given one. + +**v** + +The vector to test for equality. + +**Returns:** Whether this vector is equal with the given one. + +### .floor() : Vector3 + +The components of this vector are rounded down to the nearest integer value. + +**Returns:** A reference to this vector. + +### .fromArray( array : Array., offset : number ) : Vector3 + +Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]` and z value to be `array[ offset + 2 ]`. + +**array** + +An array holding the vector component values. + +**offset** + +The offset into the array. + +Default is `0`. + +**Returns:** A reference to this vector. + +### .fromBufferAttribute( attribute : BufferAttribute, index : number ) : Vector3 + +Sets the components of this vector from the given buffer attribute. + +**attribute** + +The buffer attribute holding vector data. + +**index** + +The index into the attribute. + +**Returns:** A reference to this vector. + +### .getComponent( index : number ) : number + +Returns the value of the vector component which matches the given index. + +**index** + +The component index. `0` equals to x, `1` equals to y, `2` equals to z. + +**Returns:** A vector component value. + +### .length() : number + +Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z). + +**Returns:** The length of this vector. + +### .lengthSq() : number + +Computes the square of the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate. + +**Returns:** The square length of this vector. + +### .lerp( v : Vector3, alpha : number ) : Vector3 + +Linearly interpolates between the given vector and this instance, where alpha is the percent distance along the line - alpha = 0 will be this vector, and alpha = 1 will be the given one. + +**v** + +The vector to interpolate towards. + +**alpha** + +The interpolation factor, typically in the closed interval `[0, 1]`. + +**Returns:** A reference to this vector. + +### .lerpVectors( v1 : Vector3, v2 : Vector3, alpha : number ) : Vector3 + +Linearly interpolates between the given vectors, where alpha is the percent distance along the line - alpha = 0 will be first vector, and alpha = 1 will be the second one. The result is stored in this instance. + +**v1** + +The first vector. + +**v2** + +The second vector. + +**alpha** + +The interpolation factor, typically in the closed interval `[0, 1]`. + +**Returns:** A reference to this vector. + +### .manhattanDistanceTo( v : Vector3 ) : number + +Computes the Manhattan distance from the given vector to this instance. + +**v** + +The vector to compute the Manhattan distance to. + +**Returns:** The Manhattan distance. + +### .manhattanLength() : number + +Computes the Manhattan length of this vector. + +**Returns:** The length of this vector. + +### .max( v : Vector3 ) : Vector3 + +If this vector's x, y or z value is less than the given vector's x, y or z value, replace that value with the corresponding max value. + +**v** + +The vector. + +**Returns:** A reference to this vector. + +### .min( v : Vector3 ) : Vector3 + +If this vector's x, y or z value is greater than the given vector's x, y or z value, replace that value with the corresponding min value. + +**v** + +The vector. + +**Returns:** A reference to this vector. + +### .multiply( v : Vector3 ) : Vector3 + +Multiplies the given vector with this instance. + +**v** + +The vector to multiply. + +**Returns:** A reference to this vector. + +### .multiplyScalar( scalar : number ) : Vector3 + +Multiplies the given scalar value with all components of this instance. + +**scalar** + +The scalar to multiply. + +**Returns:** A reference to this vector. + +### .multiplyVectors( a : Vector3, b : Vector3 ) : Vector3 + +Multiplies the given vectors and stores the result in this instance. + +**a** + +The first vector. + +**b** + +The second vector. + +**Returns:** A reference to this vector. + +### .negate() : Vector3 + +Inverts this vector - i.e. sets x = -x, y = -y and z = -z. + +**Returns:** A reference to this vector. + +### .normalize() : Vector3 + +Converts this vector to a unit vector - that is, sets it equal to a vector with the same direction as this one, but with a vector length of `1`. + +**Returns:** A reference to this vector. + +### .project( camera : Camera ) : Vector3 + +Projects this vector from world space into the camera's normalized device coordinate (NDC) space. + +**camera** + +The camera. + +**Returns:** A reference to this vector. + +### .projectOnPlane( planeNormal : Vector3 ) : Vector3 + +Projects this vector onto a plane by subtracting this vector projected onto the plane's normal from this vector. + +**planeNormal** + +The plane normal. + +**Returns:** A reference to this vector. + +### .projectOnVector( v : Vector3 ) : Vector3 + +Projects this vector onto the given one. + +**v** + +The vector to project to. + +**Returns:** A reference to this vector. + +### .random() : Vector3 + +Sets each component of this vector to a pseudo-random value between `0` and `1`, excluding `1`. + +**Returns:** A reference to this vector. + +### .randomDirection() : Vector3 + +Sets this vector to a uniformly random point on a unit sphere. + +**Returns:** A reference to this vector. + +### .reflect( normal : Vector3 ) : Vector3 + +Reflects this vector off a plane orthogonal to the given normal vector. + +**normal** + +The (normalized) normal vector. + +**Returns:** A reference to this vector. + +### .round() : Vector3 + +The components of this vector are rounded to the nearest integer value + +**Returns:** A reference to this vector. + +### .roundToZero() : Vector3 + +The components of this vector are rounded towards zero (up if negative, down if positive) to an integer value. + +**Returns:** A reference to this vector. + +### .set( x : number, y : number, z : number ) : Vector3 + +Sets the vector components. + +**x** + +The value of the x component. + +**y** + +The value of the y component. + +**z** + +The value of the z component. + +**Returns:** A reference to this vector. + +### .setComponent( index : number, value : number ) : Vector3 + +Allows to set a vector component with an index. + +**index** + +The component index. `0` equals to x, `1` equals to y, `2` equals to z. + +**value** + +The value to set. + +**Returns:** A reference to this vector. + +### .setFromColor( c : Color ) : Vector3 + +Sets the vector components from the RGB components of the given color. + +**c** + +The color to set. + +**Returns:** A reference to this vector. + +### .setFromCylindrical( c : Cylindrical ) : Vector3 + +Sets the vector components from the given cylindrical coordinates. + +**c** + +The cylindrical coordinates. + +**Returns:** A reference to this vector. + +### .setFromCylindricalCoords( radius : number, theta : number, y : number ) : Vector3 + +Sets the vector components from the given cylindrical coordinates. + +**radius** + +The radius. + +**theta** + +The theta angle in radians. + +**y** + +The y value. + +**Returns:** A reference to this vector. + +### .setFromEuler( e : Euler ) : Vector3 + +Sets the vector components from the given Euler angles. + +**e** + +The Euler angles to set. + +**Returns:** A reference to this vector. + +### .setFromMatrix3Column( m : Matrix3, index : number ) : Vector3 + +Sets the vector components from the specified matrix column. + +**m** + +The 3x3 matrix. + +**index** + +The column index. + +**Returns:** A reference to this vector. + +### .setFromMatrixColumn( m : Matrix4, index : number ) : Vector3 + +Sets the vector components from the specified matrix column. + +**m** + +The 4x4 matrix. + +**index** + +The column index. + +**Returns:** A reference to this vector. + +### .setFromMatrixPosition( m : Matrix4 ) : Vector3 + +Sets the vector components to the position elements of the given transformation matrix. + +**m** + +The 4x4 matrix. + +**Returns:** A reference to this vector. + +### .setFromMatrixScale( m : Matrix4 ) : Vector3 + +Sets the vector components to the scale elements of the given transformation matrix. + +**m** + +The 4x4 matrix. + +**Returns:** A reference to this vector. + +### .setFromSpherical( s : Spherical ) : Vector3 + +Sets the vector components from the given spherical coordinates. + +**s** + +The spherical coordinates. + +**Returns:** A reference to this vector. + +### .setFromSphericalCoords( radius : number, phi : number, theta : number ) : Vector3 + +Sets the vector components from the given spherical coordinates. + +**radius** + +The radius. + +**phi** + +The phi angle in radians. + +**theta** + +The theta angle in radians. + +**Returns:** A reference to this vector. + +### .setLength( length : number ) : Vector3 + +Sets this vector to a vector with the same direction as this one, but with the specified length. + +**length** + +The new length of this vector. + +**Returns:** A reference to this vector. + +### .setScalar( scalar : number ) : Vector3 + +Sets the vector components to the same value. + +**scalar** + +The value to set for all vector components. + +**Returns:** A reference to this vector. + +### .setX( x : number ) : Vector3 + +Sets the vector's x component to the given value + +**x** + +The value to set. + +**Returns:** A reference to this vector. + +### .setY( y : number ) : Vector3 + +Sets the vector's y component to the given value + +**y** + +The value to set. + +**Returns:** A reference to this vector. + +### .setZ( z : number ) : Vector3 + +Sets the vector's z component to the given value + +**z** + +The value to set. + +**Returns:** A reference to this vector. + +### .sub( v : Vector3 ) : Vector3 + +Subtracts the given vector from this instance. + +**v** + +The vector to subtract. + +**Returns:** A reference to this vector. + +### .subScalar( s : number ) : Vector3 + +Subtracts the given scalar value from all components of this instance. + +**s** + +The scalar to subtract. + +**Returns:** A reference to this vector. + +### .subVectors( a : Vector3, b : Vector3 ) : Vector3 + +Subtracts the given vectors and stores the result in this instance. + +**a** + +The first vector. + +**b** + +The second vector. + +**Returns:** A reference to this vector. + +### .toArray( array : Array., offset : number ) : Array. + +Writes the components of this vector to the given array. If no array is provided, the method returns a new instance. + +**array** + +The target array holding the vector components. + +Default is `[]`. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** The vector components. + +### .transformDirection( m : Matrix4 ) : Vector3 + +Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of the given 4x4 matrix and then normalizes the result. + +**m** + +The matrix. + +**Returns:** A reference to this vector. + +### .unproject( camera : Camera ) : Vector3 + +Unprojects this vector from the camera's normalized device coordinate (NDC) space into world space. + +**camera** + +The camera. + +**Returns:** A reference to this vector. + +## Source + +[src/math/Vector3.js](https://github.com/mrdoob/three.js/blob/master/src/math/Vector3.js) \ No newline at end of file diff --git a/docs/pages/Vector4.html.md b/docs/pages/Vector4.html.md new file mode 100644 index 00000000000000..6aa85841664e26 --- /dev/null +++ b/docs/pages/Vector4.html.md @@ -0,0 +1,594 @@ +# Vector4 + +Class representing a 4D vector. A 4D vector is an ordered quadruplet of numbers (labeled x, y, z and w), which can be used to represent a number of things, such as: + +* A point in 4D space. +* A direction and length in 4D space. In three.js the length will always be the Euclidean distance(straight-line distance) from `(0, 0, 0, 0)` to `(x, y, z, w)` and the direction is also measured from `(0, 0, 0, 0)` towards `(x, y, z, w)`. +* Any arbitrary ordered quadruplet of numbers. + +There are other things a 4D vector can be used to represent, however these are the most common uses in _three.js_. + +Iterating through a vector instance will yield its components `(x, y, z, w)` in the corresponding order. + +## Code Example + +```js +const a = new THREE.Vector4( 0, 1, 0, 0 ); +//no arguments; will be initialised to (0, 0, 0, 1) +const b = new THREE.Vector4( ); +const d = a.dot( b ); +``` + +## Constructor + +### new Vector4( x : number, y : number, z : number, w : number ) + +Constructs a new 4D vector. + +**x** + +The x value of this vector. + +Default is `0`. + +**y** + +The y value of this vector. + +Default is `0`. + +**z** + +The z value of this vector. + +Default is `0`. + +**w** + +The w value of this vector. + +Default is `1`. + +## Properties + +### .height : number + +Alias for [Vector4#w](Vector4.html#w). + +### .isVector4 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .w : number + +The w value of this vector. + +### .width : number + +Alias for [Vector4#z](Vector4.html#z). + +### .x : number + +The x value of this vector. + +### .y : number + +The y value of this vector. + +### .z : number + +The z value of this vector. + +## Methods + +### .add( v : Vector4 ) : Vector4 + +Adds the given vector to this instance. + +**v** + +The vector to add. + +**Returns:** A reference to this vector. + +### .addScalar( s : number ) : Vector4 + +Adds the given scalar value to all components of this instance. + +**s** + +The scalar to add. + +**Returns:** A reference to this vector. + +### .addScaledVector( v : Vector4, s : number ) : Vector4 + +Adds the given vector scaled by the given factor to this instance. + +**v** + +The vector. + +**s** + +The factor that scales `v`. + +**Returns:** A reference to this vector. + +### .addVectors( a : Vector4, b : Vector4 ) : Vector4 + +Adds the given vectors and stores the result in this instance. + +**a** + +The first vector. + +**b** + +The second vector. + +**Returns:** A reference to this vector. + +### .applyMatrix4( m : Matrix4 ) : Vector4 + +Multiplies this vector with the given 4x4 matrix. + +**m** + +The 4x4 matrix. + +**Returns:** A reference to this vector. + +### .ceil() : Vector4 + +The components of this vector are rounded up to the nearest integer value. + +**Returns:** A reference to this vector. + +### .clamp( min : Vector4, max : Vector4 ) : Vector4 + +If this vector's x, y, z or w value is greater than the max vector's x, y, z or w value, it is replaced by the corresponding value. If this vector's x, y, z or w value is less than the min vector's x, y, z or w value, it is replaced by the corresponding value. + +**min** + +The minimum x, y and z values. + +**max** + +The maximum x, y and z values in the desired range. + +**Returns:** A reference to this vector. + +### .clampLength( min : number, max : number ) : Vector4 + +If this vector's length is greater than the max value, it is replaced by the max value. If this vector's length is less than the min value, it is replaced by the min value. + +**min** + +The minimum value the vector length will be clamped to. + +**max** + +The maximum value the vector length will be clamped to. + +**Returns:** A reference to this vector. + +### .clampScalar( minVal : number, maxVal : number ) : Vector4 + +If this vector's x, y, z or w values are greater than the max value, they are replaced by the max value. If this vector's x, y, z or w values are less than the min value, they are replaced by the min value. + +**minVal** + +The minimum value the components will be clamped to. + +**maxVal** + +The maximum value the components will be clamped to. + +**Returns:** A reference to this vector. + +### .clone() : Vector4 + +Returns a new vector with copied values from this instance. + +**Returns:** A clone of this instance. + +### .copy( v : Vector3 | Vector4 ) : Vector4 + +Copies the values of the given vector to this instance. + +**v** + +The vector to copy. + +**Returns:** A reference to this vector. + +### .divide( v : Vector4 ) : Vector4 + +Divides this instance by the given vector. + +**v** + +The vector to divide. + +**Returns:** A reference to this vector. + +### .divideScalar( scalar : number ) : Vector4 + +Divides this vector by the given scalar. + +**scalar** + +The scalar to divide. + +**Returns:** A reference to this vector. + +### .dot( v : Vector4 ) : number + +Calculates the dot product of the given vector with this instance. + +**v** + +The vector to compute the dot product with. + +**Returns:** The result of the dot product. + +### .equals( v : Vector4 ) : boolean + +Returns `true` if this vector is equal with the given one. + +**v** + +The vector to test for equality. + +**Returns:** Whether this vector is equal with the given one. + +### .floor() : Vector4 + +The components of this vector are rounded down to the nearest integer value. + +**Returns:** A reference to this vector. + +### .fromArray( array : Array., offset : number ) : Vector4 + +Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`, z value to be `array[ offset + 2 ]`, w value to be `array[ offset + 3 ]`. + +**array** + +An array holding the vector component values. + +**offset** + +The offset into the array. + +Default is `0`. + +**Returns:** A reference to this vector. + +### .fromBufferAttribute( attribute : BufferAttribute, index : number ) : Vector4 + +Sets the components of this vector from the given buffer attribute. + +**attribute** + +The buffer attribute holding vector data. + +**index** + +The index into the attribute. + +**Returns:** A reference to this vector. + +### .getComponent( index : number ) : number + +Returns the value of the vector component which matches the given index. + +**index** + +The component index. `0` equals to x, `1` equals to y, `2` equals to z, `3` equals to w. + +**Returns:** A vector component value. + +### .length() : number + +Computes the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w). + +**Returns:** The length of this vector. + +### .lengthSq() : number + +Computes the square of the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate. + +**Returns:** The square length of this vector. + +### .lerp( v : Vector4, alpha : number ) : Vector4 + +Linearly interpolates between the given vector and this instance, where alpha is the percent distance along the line - alpha = 0 will be this vector, and alpha = 1 will be the given one. + +**v** + +The vector to interpolate towards. + +**alpha** + +The interpolation factor, typically in the closed interval `[0, 1]`. + +**Returns:** A reference to this vector. + +### .lerpVectors( v1 : Vector4, v2 : Vector4, alpha : number ) : Vector4 + +Linearly interpolates between the given vectors, where alpha is the percent distance along the line - alpha = 0 will be first vector, and alpha = 1 will be the second one. The result is stored in this instance. + +**v1** + +The first vector. + +**v2** + +The second vector. + +**alpha** + +The interpolation factor, typically in the closed interval `[0, 1]`. + +**Returns:** A reference to this vector. + +### .manhattanLength() : number + +Computes the Manhattan length of this vector. + +**Returns:** The length of this vector. + +### .max( v : Vector4 ) : Vector4 + +If this vector's x, y, z or w value is less than the given vector's x, y, z or w value, replace that value with the corresponding max value. + +**v** + +The vector. + +**Returns:** A reference to this vector. + +### .min( v : Vector4 ) : Vector4 + +If this vector's x, y, z or w value is greater than the given vector's x, y, z or w value, replace that value with the corresponding min value. + +**v** + +The vector. + +**Returns:** A reference to this vector. + +### .multiply( v : Vector4 ) : Vector4 + +Multiplies the given vector with this instance. + +**v** + +The vector to multiply. + +**Returns:** A reference to this vector. + +### .multiplyScalar( scalar : number ) : Vector4 + +Multiplies the given scalar value with all components of this instance. + +**scalar** + +The scalar to multiply. + +**Returns:** A reference to this vector. + +### .negate() : Vector4 + +Inverts this vector - i.e. sets x = -x, y = -y, z = -z, w = -w. + +**Returns:** A reference to this vector. + +### .normalize() : Vector4 + +Converts this vector to a unit vector - that is, sets it equal to a vector with the same direction as this one, but with a vector length of `1`. + +**Returns:** A reference to this vector. + +### .random() : Vector4 + +Sets each component of this vector to a pseudo-random value between `0` and `1`, excluding `1`. + +**Returns:** A reference to this vector. + +### .round() : Vector4 + +The components of this vector are rounded to the nearest integer value + +**Returns:** A reference to this vector. + +### .roundToZero() : Vector4 + +The components of this vector are rounded towards zero (up if negative, down if positive) to an integer value. + +**Returns:** A reference to this vector. + +### .set( x : number, y : number, z : number, w : number ) : Vector4 + +Sets the vector components. + +**x** + +The value of the x component. + +**y** + +The value of the y component. + +**z** + +The value of the z component. + +**w** + +The value of the w component. + +**Returns:** A reference to this vector. + +### .setAxisAngleFromQuaternion( q : Quaternion ) : Vector4 + +Sets the x, y and z components of this vector to the quaternion's axis and w to the angle. + +**q** + +The Quaternion to set. + +**Returns:** A reference to this vector. + +### .setAxisAngleFromRotationMatrix( m : Matrix4 ) : Vector4 + +Sets the x, y and z components of this vector to the axis of rotation and w to the angle. + +**m** + +A 4x4 matrix of which the upper left 3x3 matrix is a pure rotation matrix. + +**Returns:** A reference to this vector. + +### .setComponent( index : number, value : number ) : Vector4 + +Allows to set a vector component with an index. + +**index** + +The component index. `0` equals to x, `1` equals to y, `2` equals to z, `3` equals to w. + +**value** + +The value to set. + +**Returns:** A reference to this vector. + +### .setFromMatrixPosition( m : Matrix4 ) : Vector4 + +Sets the vector components to the position elements of the given transformation matrix. + +**m** + +The 4x4 matrix. + +**Returns:** A reference to this vector. + +### .setLength( length : number ) : Vector4 + +Sets this vector to a vector with the same direction as this one, but with the specified length. + +**length** + +The new length of this vector. + +**Returns:** A reference to this vector. + +### .setScalar( scalar : number ) : Vector4 + +Sets the vector components to the same value. + +**scalar** + +The value to set for all vector components. + +**Returns:** A reference to this vector. + +### .setW( w : number ) : Vector4 + +Sets the vector's w component to the given value + +**w** + +The value to set. + +**Returns:** A reference to this vector. + +### .setX( x : number ) : Vector4 + +Sets the vector's x component to the given value + +**x** + +The value to set. + +**Returns:** A reference to this vector. + +### .setY( y : number ) : Vector4 + +Sets the vector's y component to the given value + +**y** + +The value to set. + +**Returns:** A reference to this vector. + +### .setZ( z : number ) : Vector4 + +Sets the vector's z component to the given value + +**z** + +The value to set. + +**Returns:** A reference to this vector. + +### .sub( v : Vector4 ) : Vector4 + +Subtracts the given vector from this instance. + +**v** + +The vector to subtract. + +**Returns:** A reference to this vector. + +### .subScalar( s : number ) : Vector4 + +Subtracts the given scalar value from all components of this instance. + +**s** + +The scalar to subtract. + +**Returns:** A reference to this vector. + +### .subVectors( a : Vector4, b : Vector4 ) : Vector4 + +Subtracts the given vectors and stores the result in this instance. + +**a** + +The first vector. + +**b** + +The second vector. + +**Returns:** A reference to this vector. + +### .toArray( array : Array., offset : number ) : Array. + +Writes the components of this vector to the given array. If no array is provided, the method returns a new instance. + +**array** + +The target array holding the vector components. + +Default is `[]`. + +**offset** + +Index of the first element in the array. + +Default is `0`. + +**Returns:** The vector components. + +## Source + +[src/math/Vector4.js](https://github.com/mrdoob/three.js/blob/master/src/math/Vector4.js) \ No newline at end of file diff --git a/docs/pages/VectorKeyframeTrack.html.md b/docs/pages/VectorKeyframeTrack.html.md new file mode 100644 index 00000000000000..31c0917bae53f3 --- /dev/null +++ b/docs/pages/VectorKeyframeTrack.html.md @@ -0,0 +1,41 @@ +*Inheritance: KeyframeTrack →* + +# VectorKeyframeTrack + +A track for vector keyframe values. + +## Constructor + +### new VectorKeyframeTrack( name : string, times : Array., values : Array., interpolation : InterpolateLinear | InterpolateDiscrete | InterpolateSmooth ) + +Constructs a new vector keyframe track. + +**name** + +The keyframe track's name. + +**times** + +A list of keyframe times. + +**values** + +A list of keyframe values. + +**interpolation** + +The interpolation type. + +## Properties + +### .ValueTypeName : string + +The value type name. + +Default is `'vector'`. + +**Overrides:** [KeyframeTrack#ValueTypeName](KeyframeTrack.html#ValueTypeName) + +## Source + +[src/animation/tracks/VectorKeyframeTrack.js](https://github.com/mrdoob/three.js/blob/master/src/animation/tracks/VectorKeyframeTrack.js) \ No newline at end of file diff --git a/docs/pages/VelocityNode.html.md b/docs/pages/VelocityNode.html.md new file mode 100644 index 00000000000000..fb57a27ae63034 --- /dev/null +++ b/docs/pages/VelocityNode.html.md @@ -0,0 +1,101 @@ +*Inheritance: EventDispatcher → Node → TempNode →* + +# VelocityNode + +A node for representing motion or velocity vectors. Foundation for advanced post processing effects like motion blur or TRAA. + +The node keeps track of the model, view and projection matrices of the previous frame and uses them to compute offsets in NDC space. These offsets represent the final velocity. + +## Constructor + +### new VelocityNode() + +Constructs a new vertex color node. + +## Properties + +### .previousCameraViewMatrix : UniformNode. + +Uniform node representing the previous view matrix. + +Default is `null`. + +### .previousModelWorldMatrix : UniformNode. + +Uniform node representing the previous model matrix in world space. + +Default is `null`. + +### .previousProjectionMatrix : UniformNode. + +Uniform node representing the previous projection matrix. + +Default is `null`. + +### .projectionMatrix : Matrix4 + +The current projection matrix. + +Default is `null`. + +### .updateAfterType : string + +Overwritten since velocity nodes save data after the update. + +Default is `'object'`. + +**Overrides:** [TempNode#updateAfterType](TempNode.html#updateAfterType) + +### .updateType : string + +Overwritten since velocity nodes are updated per object. + +Default is `'object'`. + +**Overrides:** [TempNode#updateType](TempNode.html#updateType) + +## Methods + +### .setProjectionMatrix( projectionMatrix : Matrix4 ) + +Sets the given projection matrix. + +**projectionMatrix** + +The projection matrix to set. + +### .setup( builder : NodeBuilder ) : Node. + +Implements the velocity computation based on the previous and current vertex data. + +**builder** + +A reference to the current node builder. + +**Overrides:** [TempNode#setup](TempNode.html#setup) + +**Returns:** The motion vector. + +### .update( frame : NodeFrame ) + +Updates velocity specific uniforms. + +**frame** + +A reference to the current node frame. + +**Overrides:** [TempNode#update](TempNode.html#update) + +### .updateAfter( frame : NodeFrame ) + +Overwritten to updated velocity specific uniforms. + +**frame** + +A reference to the current node frame. + +**Overrides:** [TempNode#updateAfter](TempNode.html#updateAfter) + +## Source + +[src/nodes/accessors/VelocityNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/VelocityNode.js) \ No newline at end of file diff --git a/docs/pages/VertexColorNode.html.md b/docs/pages/VertexColorNode.html.md new file mode 100644 index 00000000000000..c3bd09ce230299 --- /dev/null +++ b/docs/pages/VertexColorNode.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Node → AttributeNode →* + +# VertexColorNode + +An attribute node for representing vertex colors. + +## Constructor + +### new VertexColorNode( index : number ) + +Constructs a new vertex color node. + +**index** + +The attribute index. + +## Properties + +### .index : number + +The attribute index to enable more than one sets of vertex colors. + +Default is `0`. + +### .isVertexColorNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .getAttributeName( builder : NodeBuilder ) : string + +Overwrites the default implementation by honoring the attribute index. + +**builder** + +The current node builder. + +**Overrides:** [AttributeNode#getAttributeName](AttributeNode.html#getAttributeName) + +**Returns:** The attribute name. + +## Source + +[src/nodes/accessors/VertexColorNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/accessors/VertexColorNode.js) \ No newline at end of file diff --git a/docs/pages/VertexNormalsHelper.html.md b/docs/pages/VertexNormalsHelper.html.md new file mode 100644 index 00000000000000..4ee16cc6d005f0 --- /dev/null +++ b/docs/pages/VertexNormalsHelper.html.md @@ -0,0 +1,88 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# VertexNormalsHelper + +Visualizes an object's vertex normals. + +Requires that normals have been specified in the geometry as a buffer attribute or have been calculated using [BufferGeometry#computeVertexNormals](BufferGeometry.html#computeVertexNormals). + +## Code Example + +```js +const geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 ); +const material = new THREE.MeshStandardMaterial(); +const mesh = new THREE.Mesh( geometry, material ); +scene.add( mesh ); +const helper = new VertexNormalsHelper( mesh, 1, 0xff0000 ); +scene.add( helper ); +``` + +## Import + +VertexNormalsHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VertexNormalsHelper } from 'three/addons/helpers/VertexNormalsHelper.js'; +``` + +## Constructor + +### new VertexNormalsHelper( object : Object3D, size : number, color : number | Color | string ) + +Constructs a new vertex normals helper. + +**object** + +The object for which to visualize vertex normals. + +**size** + +The helper's size. + +Default is `1`. + +**color** + +The helper's color. + +Default is `0xff0000`. + +## Properties + +### .isVertexNormalsHelper : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .matrixAutoUpdate : boolean + +Overwritten and set to `false` since the object's world transformation is encoded in the helper's geometry data. + +Default is `false`. + +**Overrides:** [LineSegments#matrixAutoUpdate](LineSegments.html#matrixAutoUpdate) + +### .object : Object3D + +The object for which to visualize vertex normals. + +### .size : number + +The helper's size. + +Default is `1`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the vertex normals preview based on the object's world transform. + +## Source + +[examples/jsm/helpers/VertexNormalsHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/VertexNormalsHelper.js) \ No newline at end of file diff --git a/docs/pages/VertexTangentsHelper.html.md b/docs/pages/VertexTangentsHelper.html.md new file mode 100644 index 00000000000000..100a56e3c30e17 --- /dev/null +++ b/docs/pages/VertexTangentsHelper.html.md @@ -0,0 +1,78 @@ +*Inheritance: EventDispatcher → Object3D → Line → LineSegments →* + +# VertexTangentsHelper + +Visualizes an object's vertex tangents. + +Requires that tangents have been specified in the geometry as a buffer attribute or have been calculated using [BufferGeometry#computeTangents](BufferGeometry.html#computeTangents). + +## Code Example + +```js +const helper = new VertexTangentsHelper( mesh, 1, 0xff0000 ); +scene.add( helper ); +``` + +## Import + +VertexTangentsHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VertexTangentsHelper } from 'three/addons/helpers/VertexTangentsHelper.js'; +``` + +## Constructor + +### new VertexTangentsHelper( object : Object3D, size : number, color : number | Color | string ) + +Constructs a new vertex tangents helper. + +**object** + +The object for which to visualize vertex tangents. + +**size** + +The helper's size. + +Default is `1`. + +**color** + +The helper's color. + +Default is `0xff0000`. + +## Properties + +### .matrixAutoUpdate : boolean + +Overwritten and set to `false` since the object's world transformation is encoded in the helper's geometry data. + +Default is `false`. + +**Overrides:** [LineSegments#matrixAutoUpdate](LineSegments.html#matrixAutoUpdate) + +### .object : Object3D + +The object for which to visualize vertex tangents. + +### .size : number + +The helper's size. + +Default is `1`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .update() + +Updates the vertex normals preview based on the object's world transform. + +## Source + +[examples/jsm/helpers/VertexTangentsHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/VertexTangentsHelper.js) \ No newline at end of file diff --git a/docs/pages/VideoFrameTexture.html.md b/docs/pages/VideoFrameTexture.html.md new file mode 100644 index 00000000000000..21e8e15b0f125d --- /dev/null +++ b/docs/pages/VideoFrameTexture.html.md @@ -0,0 +1,94 @@ +*Inheritance: EventDispatcher → Texture → VideoTexture →* + +# VideoFrameTexture + +This class can be used as an alternative way to define video data. Instead of using an instance of `HTMLVideoElement` like with `VideoTexture`, `VideoFrameTexture` expects each frame is defined manually via [VideoFrameTexture#setFrame](VideoFrameTexture.html#setFrame). A typical use case for this module is when video frames are decoded with the WebCodecs API. + +## Code Example + +```js +const texture = new THREE.VideoFrameTexture(); +texture.setFrame( frame ); +``` + +## Constructor + +### new VideoFrameTexture( mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, format : number, type : number, anisotropy : number ) + +Constructs a new video frame texture. + +**mapping** + +The texture mapping. + +Default is `Texture.DEFAULT_MAPPING`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `LinearFilter`. + +**minFilter** + +The min filter value. + +Default is `LinearFilter`. + +**format** + +The texture format. + +Default is `RGBAFormat`. + +**type** + +The texture type. + +Default is `UnsignedByteType`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +## Properties + +### .isVideoFrameTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .setFrame( frame : VideoFrame ) + +Sets the current frame of the video. This will automatically update the texture so the data can be used for rendering. + +**frame** + +The video frame. + +### .update() + +This method overwritten with an empty implementation since this type of texture is updated via `setFrame()`. + +**Overrides:** [VideoTexture#update](VideoTexture.html#update) + +## Source + +[src/textures/VideoFrameTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/VideoFrameTexture.js) \ No newline at end of file diff --git a/docs/pages/VideoTexture.html.md b/docs/pages/VideoTexture.html.md new file mode 100644 index 00000000000000..56423aabba8c9a --- /dev/null +++ b/docs/pages/VideoTexture.html.md @@ -0,0 +1,105 @@ +*Inheritance: EventDispatcher → Texture →* + +# VideoTexture + +A texture for use with a video. + +Note: When using video textures with [WebGPURenderer](WebGPURenderer.html), [Texture#colorSpace](Texture.html#colorSpace) must be set to THREE.SRGBColorSpace. + +Note: After the initial use of a texture, its dimensions, format, and type cannot be changed. Instead, call [Texture#dispose](Texture.html#dispose) on the texture and instantiate a new one. + +## Code Example + +```js +// assuming you have created a HTML video element with id="video" +const video = document.getElementById( 'video' ); +const texture = new THREE.VideoTexture( video ); +``` + +## Constructor + +### new VideoTexture( video : HTMLVideoElement, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, format : number, type : number, anisotropy : number ) + +Constructs a new video texture. + +**video** + +The video element to use as a data source for the texture. + +**mapping** + +The texture mapping. + +Default is `Texture.DEFAULT_MAPPING`. + +**wrapS** + +The wrapS value. + +Default is `ClampToEdgeWrapping`. + +**wrapT** + +The wrapT value. + +Default is `ClampToEdgeWrapping`. + +**magFilter** + +The mag filter value. + +Default is `LinearFilter`. + +**minFilter** + +The min filter value. + +Default is `LinearFilter`. + +**format** + +The texture format. + +Default is `RGBAFormat`. + +**type** + +The texture type. + +Default is `UnsignedByteType`. + +**anisotropy** + +The anisotropy value. + +Default is `Texture.DEFAULT_ANISOTROPY`. + +## Properties + +### .generateMipmaps : boolean + +Whether to generate mipmaps (if possible) for a texture. + +Overwritten and set to `false` by default. + +Default is `false`. + +**Overrides:** [Texture#generateMipmaps](Texture.html#generateMipmaps) + +### .isVideoTexture : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .update() + +This method is called automatically by the renderer and sets [Texture#needsUpdate](Texture.html#needsUpdate) to `true` every time a new frame is available. + +Only relevant if `requestVideoFrameCallback` is not supported in the browser. + +## Source + +[src/textures/VideoTexture.js](https://github.com/mrdoob/three.js/blob/master/src/textures/VideoTexture.js) \ No newline at end of file diff --git a/docs/pages/ViewHelper.html.md b/docs/pages/ViewHelper.html.md new file mode 100644 index 00000000000000..92ba0b1e0579f6 --- /dev/null +++ b/docs/pages/ViewHelper.html.md @@ -0,0 +1,121 @@ +*Inheritance: EventDispatcher → Object3D →* + +# ViewHelper + +A special type of helper that visualizes the camera's transformation in a small viewport area as an axes helper. Such a helper is often wanted in 3D modeling tools or scene editors like the [three.js editor](https://threejs.org/editor). + +The helper allows to click on the X, Y and Z axes which animates the camera so it looks along the selected axis. + +## Import + +ViewHelper is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ViewHelper } from 'three/addons/helpers/ViewHelper.js'; +``` + +## Constructor + +### new ViewHelper( camera : Camera, domElement : HTMLElement ) + +Constructs a new view helper. + +**camera** + +The camera whose transformation should be visualized. + +**domElement** + +The DOM element that is used to render the view. + +## Properties + +### .animating : boolean (readonly) + +Whether the helper is currently animating or not. + +Default is `false`. + +### .center : Vector3 + +The helper's center point. + +### .isViewHelper : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .handleClick( event : PointerEvent ) : boolean + +This method should be called when a click or pointer event has happened in the app. + +**event** + +The event to process. + +**Returns:** Whether an intersection with the helper has been detected or not. + +### .render( renderer : WebGLRenderer | WebGPURenderer ) + +Renders the helper in a separate view in the bottom-right corner of the viewport. + +**renderer** + +The renderer. + +### .setLabelStyle( font : string, color : string, radius : number ) + +Sets the label style. Has no effect when the axes are unlabeled. + +**font** + +The label font. + +Default is `'24px Arial'`. + +**color** + +The label color. + +Default is `'#000000'`. + +**radius** + +The label radius. + +Default is `14`. + +### .setLabels( labelX : string | undefined, labelY : string | undefined, labelZ : string | undefined ) + +Sets labels for each axis. By default, they are unlabeled. + +**labelX** + +The label for the x-axis. + +**labelY** + +The label for the y-axis. + +**labelZ** + +The label for the z-axis. + +### .update( delta : number ) + +Updates the helper. This method should be called in the app's animation loop. + +**delta** + +The delta time in seconds. + +## Source + +[examples/jsm/helpers/ViewHelper.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/ViewHelper.js) \ No newline at end of file diff --git a/docs/pages/ViewportDepthNode.html.md b/docs/pages/ViewportDepthNode.html.md new file mode 100644 index 00000000000000..fd8a08ff628cc5 --- /dev/null +++ b/docs/pages/ViewportDepthNode.html.md @@ -0,0 +1,47 @@ +*Inheritance: EventDispatcher → Node →* + +# ViewportDepthNode + +This node offers a collection of features in context of the depth logic in the fragment shader. Depending on [ViewportDepthNode#scope](ViewportDepthNode.html#scope), it can be used to define a depth value for the current fragment or for depth evaluation purposes. + +## Constructor + +### new ViewportDepthNode( scope : 'depth' | 'depthBase' | 'linearDepth', valueNode : Node ) + +Constructs a new viewport depth node. + +**scope** + +The node's scope. + +**valueNode** + +The value node. + +Default is `null`. + +## Properties + +### .isViewportDepthNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .scope : 'depth' | 'depthBase' | 'linearDepth' + +The node behaves differently depending on which scope is selected. + +* `ViewportDepthNode.DEPTH_BASE`: Allows to define a value for the current fragment's depth. +* `ViewportDepthNode.DEPTH`: Represents the depth value for the current fragment (`valueNode` is ignored). +* `ViewportDepthNode.LINEAR_DEPTH`: Represents the linear (orthographic) depth value of the current fragment. If a `valueNode` is set, the scope can be used to convert perspective depth data to linear data. + +### .valueNode : Node + +Can be used to define a custom depth value. The property is ignored in the `ViewportDepthNode.DEPTH` scope. + +Default is `null`. + +## Source + +[src/nodes/display/ViewportDepthNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/ViewportDepthNode.js) \ No newline at end of file diff --git a/docs/pages/ViewportDepthTextureNode.html.md b/docs/pages/ViewportDepthTextureNode.html.md new file mode 100644 index 00000000000000..e53cf9a10de377 --- /dev/null +++ b/docs/pages/ViewportDepthTextureNode.html.md @@ -0,0 +1,37 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode → ViewportTextureNode →* + +# ViewportDepthTextureNode + +Represents the depth of the current viewport as a texture. This module can be used in combination with viewport texture to achieve effects that require depth evaluation. + +## Constructor + +### new ViewportDepthTextureNode( uvNode : Node, levelNode : Node ) + +Constructs a new viewport depth texture node. + +**uvNode** + +The uv node. + +Default is `screenUV`. + +**levelNode** + +The level node. + +Default is `null`. + +## Methods + +### .getTextureForReference() : DepthTexture + +Overwritten so the method always returns the unique shared depth texture. + +**Overrides:** [ViewportTextureNode#getTextureForReference](ViewportTextureNode.html#getTextureForReference) + +**Returns:** The shared depth texture. + +## Source + +[src/nodes/display/ViewportDepthTextureNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/ViewportDepthTextureNode.js) \ No newline at end of file diff --git a/docs/pages/ViewportSharedTextureNode.html.md b/docs/pages/ViewportSharedTextureNode.html.md new file mode 100644 index 00000000000000..afa42af0121769 --- /dev/null +++ b/docs/pages/ViewportSharedTextureNode.html.md @@ -0,0 +1,37 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode → ViewportTextureNode →* + +# ViewportSharedTextureNode + +`ViewportTextureNode` creates an internal texture for each node instance. This module shares a texture across all instances of `ViewportSharedTextureNode`. It should be the first choice when using data of the default/screen framebuffer for performance reasons. + +## Constructor + +### new ViewportSharedTextureNode( uvNode : Node, levelNode : Node ) + +Constructs a new viewport shared texture node. + +**uvNode** + +The uv node. + +Default is `screenUV`. + +**levelNode** + +The level node. + +Default is `null`. + +## Methods + +### .getTextureForReference() : FramebufferTexture + +Overwritten so the method always returns the unique shared framebuffer texture. + +**Overrides:** [ViewportTextureNode#getTextureForReference](ViewportTextureNode.html#getTextureForReference) + +**Returns:** The shared framebuffer texture. + +## Source + +[src/nodes/display/ViewportSharedTextureNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/ViewportSharedTextureNode.js) \ No newline at end of file diff --git a/docs/pages/ViewportTextureNode.html.md b/docs/pages/ViewportTextureNode.html.md new file mode 100644 index 00000000000000..5035a846587191 --- /dev/null +++ b/docs/pages/ViewportTextureNode.html.md @@ -0,0 +1,77 @@ +*Inheritance: EventDispatcher → Node → InputNode → UniformNode → TextureNode →* + +# ViewportTextureNode + +A special type of texture node which represents the data of the current viewport as a texture. The module extracts data from the current bound framebuffer with a copy operation so no extra render pass is required to produce the texture data (which is good for performance). `ViewportTextureNode` can be used as an input for a variety of effects like refractive or transmissive materials. + +## Constructor + +### new ViewportTextureNode( uvNode : Node, levelNode : Node, framebufferTexture : Texture ) + +Constructs a new viewport texture node. + +**uvNode** + +The uv node. + +Default is `screenUV`. + +**levelNode** + +The level node. + +Default is `null`. + +**framebufferTexture** + +A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. + +Default is `null`. + +## Properties + +### .defaultFramebuffer : FramebufferTexture + +The reference framebuffer texture. This is used to store the framebuffer texture for the current render target. If the render target changes, a new framebuffer texture is created automatically. + +Default is `null`. + +### .generateMipmaps : boolean + +Whether to generate mipmaps or not. + +Default is `false`. + +### .isOutputTextureNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .updateBeforeType : string + +The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders the scene once per frame in its [ViewportTextureNode#updateBefore](ViewportTextureNode.html#updateBefore) method. + +Default is `'frame'`. + +**Overrides:** [TextureNode#updateBeforeType](TextureNode.html#updateBeforeType) + +## Methods + +### .getTextureForReference( reference : RenderTarget ) : Texture + +This methods returns a texture for the given render target reference. + +To avoid rendering errors, `ViewportTextureNode` must use unique framebuffer textures for different render contexts. + +**reference** + +The render target reference. + +Default is `null`. + +**Returns:** The framebuffer texture. + +## Source + +[src/nodes/display/ViewportTextureNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/display/ViewportTextureNode.js) \ No newline at end of file diff --git a/docs/pages/VivianiCurve.html.md b/docs/pages/VivianiCurve.html.md new file mode 100644 index 00000000000000..3b72b1d543c012 --- /dev/null +++ b/docs/pages/VivianiCurve.html.md @@ -0,0 +1,55 @@ +*Inheritance: Curve →* + +# VivianiCurve + +A Viviani curve. + +## Import + +VivianiCurve is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VivianiCurve } from 'three/addons/curves/CurveExtras.js'; +``` + +## Constructor + +### new VivianiCurve( scale : number ) + +Constructs a new Viviani curve. + +**scale** + +The curve's scale. + +Default is `70`. + +## Properties + +### .scale : number + +The curve's scale. + +Default is `70`. + +## Methods + +### .getPoint( t : number, optionalTarget : Vector3 ) : Vector3 + +This method returns a vector in 3D space for the given interpolation factor. + +**t** + +A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + +**optionalTarget** + +The optional target vector the result is written to. + +**Overrides:** [Curve#getPoint](Curve.html#getPoint) + +**Returns:** The position on the curve. + +## Source + +[examples/jsm/curves/CurveExtras.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/CurveExtras.js) \ No newline at end of file diff --git a/docs/pages/Volume.html.md b/docs/pages/Volume.html.md new file mode 100644 index 00000000000000..98cffdecc2cf8b --- /dev/null +++ b/docs/pages/Volume.html.md @@ -0,0 +1,213 @@ +# Volume + +This class had been written to handle the output of the [NRRDLoader](NRRDLoader.html). It contains a volume of data and information about it. For now it only handles 3 dimensional data. + +## Import + +Volume is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Volume } from 'three/addons/misc/Volume.js'; +``` + +## Constructor + +### new Volume( xLength : number, yLength : number, zLength : number, type : string, arrayBuffer : ArrayBuffer ) + +Constructs a new volume. + +**xLength** + +Width of the volume. + +**yLength** + +Length of the volume. + +**zLength** + +Depth of the volume. + +**type** + +The type of data (uint8, uint16, ...). + +**arrayBuffer** + +The buffer with volume data. + +## Properties + +### .RASDimensions : Array. + +This array holds the dimensions of the volume in the RAS space + +### .axisOrder : Array. + +The order of the Axis dictated by the NRRD header + +### .data : TypedArray + +The data of the volume. + +### .inverseMatrix : Martrix3 + +The RAS to IJK matrix. + +### .lowerThreshold : number + +The voxels with values under this threshold won't appear in the slices. If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume. + +### .matrix : Martrix3 + +The IJK to RAS matrix. + +### .offset : Array. + +Offset of the volume in the RAS coordinate system + +### .segmentation : boolean + +Whether to use segmentation mode or not. It can load 16-bits nrrds correctly. + +Default is `false`. + +### .sliceList : Array. + +The list of all the slices associated to this volume + +### .spacing : Array. + +Spacing to apply to the volume from IJK to RAS coordinate system + +### .upperThreshold : number + +The voxels with values over this threshold won't appear in the slices. If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume + +### .xLength : number + +Width of the volume in the IJK coordinate system. + +Default is `1`. + +### .yLength : number + +Height of the volume in the IJK coordinate system. + +Default is `1`. + +### .zLength : number + +Depth of the volume in the IJK coordinate system. + +Default is `1`. + +## Methods + +### .access( i : number, j : number, k : number ) : number + +Compute the index in the data array corresponding to the given coordinates in IJK system. + +**i** + +First coordinate. + +**j** + +Second coordinate. + +**k** + +Third coordinate. + +**Returns:** The index. + +### .computeMinMax() : Array. + +Compute the minimum and the maximum of the data in the volume. + +**Returns:** The min/max data as `[min,max]`. + +### .extractPerpendicularPlane( axis : 'x' | 'y' | 'z', RASIndex : number ) : Object + +Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system. + +**axis** + +The normal axis to the slice. + +**RASIndex** + +The index of the slice. + +**Returns:** An object containing all the useful information on the geometry of the slice. + +### .extractSlice( axis : 'x' | 'y' | 'z', index : number ) : VolumeSlice + +Returns a slice corresponding to the given axis and index. The coordinate are given in the Right Anterior Superior coordinate format. + +**axis** + +The normal axis to the slice. + +**index** + +The index of the slice. + +**Returns:** The extracted slice. + +### .getData( i : number, j : number, k : number ) : number + +Shortcut for data\[access(i,j,k)\]. + +**i** + +First coordinate. + +**j** + +Second coordinate. + +**k** + +Third coordinate. + +**Returns:** The value in the data array. + +### .map( functionToMap : function, context : Object ) : Volume + +Apply a function to all the voxels, be careful, the value will be replaced. + +**functionToMap** + +A function to apply to every voxel, will be called with the following parameters: value of the voxel, index of the voxel, the data (TypedArray). + +**context** + +You can specify a context in which call the function, default if this Volume. + +**Returns:** A reference to this instance. + +### .repaintAllSlices() : Volume + +Call repaint on all the slices extracted from this volume. + +See: + +* [VolumeSlice#repaint](VolumeSlice.html#repaint) + +**Returns:** A reference to this volume. + +### .reverseAccess( index : number ) : Array. + +Retrieve the IJK coordinates of the voxel corresponding of the given index in the data. + +**index** + +Index of the voxel. + +**Returns:** The IJK coordinates as `[x,y,z]`. + +## Source + +[examples/jsm/misc/Volume.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/Volume.js) \ No newline at end of file diff --git a/docs/pages/VolumeNodeMaterial.html.md b/docs/pages/VolumeNodeMaterial.html.md new file mode 100644 index 00000000000000..ad296f6c78aa56 --- /dev/null +++ b/docs/pages/VolumeNodeMaterial.html.md @@ -0,0 +1,45 @@ +*Inheritance: EventDispatcher → Material → NodeMaterial →* + +# VolumeNodeMaterial + +Volume node material. + +## Constructor + +### new VolumeNodeMaterial( parameters : Object ) + +Constructs a new volume node material. + +**parameters** + +The configuration parameter. + +## Properties + +### .isVolumeNodeMaterial : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .offsetNode : Node. + +Offsets the distance a ray has been traveled through a volume. Can be used to implement dithering to reduce banding. + +Default is `null`. + +### .scatteringNode : function | FunctionNode. + +Node used for scattering calculations. + +Default is `null`. + +### .steps : number + +Number of steps used for raymarching. + +Default is `25`. + +## Source + +[src/materials/nodes/VolumeNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/VolumeNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/VolumeSlice.html.md b/docs/pages/VolumeSlice.html.md new file mode 100644 index 00000000000000..a74394ed096786 --- /dev/null +++ b/docs/pages/VolumeSlice.html.md @@ -0,0 +1,117 @@ +# VolumeSlice + +This class has been made to hold a slice of a volume data. + +## Import + +VolumeSlice is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VolumeSlice } from 'three/addons/misc/VolumeSlice.js'; +``` + +## Constructor + +### new VolumeSlice( volume : Volume, index : number, axis : 'x' | 'y' | 'z' ) + +Constructs a new volume slice. + +**volume** + +The associated volume. + +**index** + +The index of the slice. + +Default is `0`. + +**axis** + +For now only 'x', 'y' or 'z' but later it will change to a normal vector. + +Default is `'z'`. + +See: + +* [Volume](Volume.html) + +## Properties + +### .axis : 'x' | 'y' | 'z' + +The normal axis. + +### .canvas : HTMLCanvasElement + +The final canvas used for the texture. + +### .canvasBuffer : HTMLCanvasElement + +The intermediary canvas used to paint the data. + +### .ctx : CanvasRenderingContext2D + +The rendering context of the canvas. + +### .ctxBuffer : CanvasRenderingContext2D + +The rendering context of the canvas buffer, + +### .geometryNeedsUpdate : boolean + +If set to `true`, `updateGeometry()` will be triggered at the next repaint. + +Default is `true`. + +### .iLength : number + +Width of slice in the original coordinate system, corresponds to the width of the buffer canvas. + +Default is `0`. + +### .index : number + +The index of the slice, if changed, will automatically call updateGeometry at the next repaint. + +Default is `0`. + +### .jLength : number + +Height of slice in the original coordinate system, corresponds to the height of the buffer canvas. + +Default is `0`. + +### .mesh : Mesh + +The mesh ready to get used in the scene. + +### .sliceAccess : function + +Function that allow the slice to access right data. + +See: + +* [Volume#extractPerpendicularPlane](Volume.html#extractPerpendicularPlane) + +### .volume : Volume + +The associated volume. + +## Methods + +### .repaint() + +Refresh the texture and the geometry if geometryNeedsUpdate is set to `true`. + +### .updateGeometry() + +Refresh the geometry according to axis and index. + +See: + +* [Volume#extractPerpendicularPlane](Volume.html#extractPerpendicularPlane) + +## Source + +[examples/jsm/misc/VolumeSlice.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/misc/VolumeSlice.js) \ No newline at end of file diff --git a/docs/pages/VolumetricLightingModel.html.md b/docs/pages/VolumetricLightingModel.html.md new file mode 100644 index 00000000000000..a7761c16ee22a3 --- /dev/null +++ b/docs/pages/VolumetricLightingModel.html.md @@ -0,0 +1,13 @@ +*Inheritance: LightingModel →* + +# VolumetricLightingModel + +VolumetricLightingModel class extends the LightingModel to implement volumetric lighting effects. This model calculates the scattering and transmittance of light through a volumetric medium. It dynamically adjusts the direction of the ray based on the camera and object positions. The model supports custom scattering and depth nodes to enhance the lighting effects. + +## Constructor + +### new VolumetricLightingModel() + +## Source + +[src/nodes/functions/VolumetricLightingModel.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/functions/VolumetricLightingModel.js) \ No newline at end of file diff --git a/docs/pages/WGSLNodeBuilder.html.md b/docs/pages/WGSLNodeBuilder.html.md new file mode 100644 index 00000000000000..a8703be2848025 --- /dev/null +++ b/docs/pages/WGSLNodeBuilder.html.md @@ -0,0 +1,921 @@ +*Inheritance: NodeBuilder →* + +# WGSLNodeBuilder + +A node builder targeting WGSL. + +This module generates WGSL shader code from node materials and also generates the respective bindings and vertex buffer definitions. These data are later used by the renderer to create render and compute pipelines for render objects. + +## Constructor + +### new WGSLNodeBuilder( object : Object3D, renderer : Renderer ) + +Constructs a new WGSL node builder renderer. + +**object** + +The 3D object. + +**renderer** + +The renderer. + +## Properties + +### .builtins : Object.> + +A dictionary that holds for each shader stage a Map of builtins. + +### .directives : Object.> + +A dictionary that holds for each shader stage a Set of directives. + +### .scopedArrays : Map. + +A map for managing scope arrays. Only relevant for when using [WorkgroupInfoNode](WorkgroupInfoNode.html) in context of compute shaders. + +### .uniformGroups : Object.> + +A dictionary that holds for each shader stage ('vertex', 'fragment', 'compute') another dictionary which manages UBOs per group ('render','frame','object'). + +### .uniformGroupsBindings : Object. + +A dictionary that holds the assigned binding indices for each uniform group. This ensures the same binding index is used across all shader stages. + +## Methods + +### .buildCode() + +Controls the code build of the shader stages. + +**Overrides:** [NodeBuilder#buildCode](NodeBuilder.html#buildCode) + +### .buildFunctionCode( shaderNode : ShaderNodeInternal ) : string + +Builds the given shader node. + +**shaderNode** + +The shader node. + +**Overrides:** [NodeBuilder#buildFunctionCode](NodeBuilder.html#buildFunctionCode) + +**Returns:** The WGSL function code. + +### .enableClipDistances() + +Enables the 'clip\_distances' directive. + +### .enableDirective( name : string, shaderStage : string ) + +Enables the given directive for the given shader stage. + +**name** + +The directive name. + +**shaderStage** + +The shader stage to enable the directive for. + +Default is `this.shaderStage`. + +### .enableDualSourceBlending() + +Enables the 'dual\_source\_blending' directive. + +### .enableHardwareClipping( planeCount : string ) + +Enables hardware clipping. + +**planeCount** + +The clipping plane count. + +### .enableShaderF16() + +Enables the 'f16' directive. + +### .enableSubGroups() + +Enables the 'subgroups' directive. + +### .enableSubgroupsF16() + +Enables the 'subgroups-f16' directive. + +### .generateArrayDeclaration( type : string, count : number ) : string + +Generates the array declaration string. + +**type** + +The type. + +**count** + +The count. + +**Overrides:** [NodeBuilder#generateArrayDeclaration](NodeBuilder.html#generateArrayDeclaration) + +**Returns:** The generated value as a shader string. + +### .generateFilteredTexture( texture : Texture, textureProperty : string, uvSnippet : string, offsetSnippet : string, levelSnippet : string ) : string + +Generates the WGSL snippet for a manual filtered texture. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**offsetSnippet** + +A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**levelSnippet** + +A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + +Default is `'0u'`. + +**Returns:** The WGSL snippet. + +### .generateTexture( texture : Texture, textureProperty : string, uvSnippet : string, depthSnippet : string, offsetSnippet : string, shaderStage : string ) : string + +Generates the WGSL snippet for sampling/loading the given texture. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**depthSnippet** + +A WGSL snippet that represents 0-based texture array index to sample. + +**offsetSnippet** + +A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Overrides:** [NodeBuilder#generateTexture](NodeBuilder.html#generateTexture) + +**Returns:** The WGSL snippet. + +### .generateTextureBias( texture : Texture, textureProperty : string, uvSnippet : string, biasSnippet : string, depthSnippet : string, offsetSnippet : string, shaderStage : string ) : string + +Generates the WGSL snippet when sampling textures with a bias to the mip level. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**biasSnippet** + +A WGSL snippet that represents the bias to apply to the mip level before sampling. + +**depthSnippet** + +A WGSL snippet that represents 0-based texture array index to sample. + +**offsetSnippet** + +A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Returns:** The WGSL snippet. + +### .generateTextureCompare( texture : Texture, textureProperty : string, uvSnippet : string, compareSnippet : string, depthSnippet : string, offsetSnippet : string, shaderStage : string ) : string + +Generates the WGSL snippet for sampling a depth texture and comparing the sampled depth values against a reference value. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**compareSnippet** + +A WGSL snippet that represents the reference value. + +**depthSnippet** + +A WGSL snippet that represents 0-based texture array index to sample. + +**offsetSnippet** + +A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Returns:** The WGSL snippet. + +### .generateTextureDimension( texture : Texture, textureProperty : string, levelSnippet : string ) : string + +Generates a WGSL variable that holds the texture dimension of the given texture. It also returns information about the number of layers (elements) of an arrayed texture as well as the cube face count of cube textures. + +**texture** + +The texture to generate the function for. + +**textureProperty** + +The name of the video texture uniform in the shader. + +**levelSnippet** + +A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + +**Returns:** The name of the dimension variable. + +### .generateTextureGrad( texture : Texture, textureProperty : string, uvSnippet : string, gradSnippet : Array., depthSnippet : string, offsetSnippet : string, shaderStage : string ) : string + +Generates the WGSL snippet for sampling/loading the given texture using explicit gradients. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**gradSnippet** + +An array holding both gradient WGSL snippets. + +**depthSnippet** + +A WGSL snippet that represents 0-based texture array index to sample. + +**offsetSnippet** + +A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Returns:** The WGSL snippet. + +### .generateTextureLevel( texture : Texture, textureProperty : string, uvSnippet : string, levelSnippet : string, depthSnippet : string, offsetSnippet : string, shaderStage : string ) : string + +Generates the WGSL snippet when sampling textures with explicit mip level. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**levelSnippet** + +A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + +**depthSnippet** + +A WGSL snippet that represents 0-based texture array index to sample. + +**offsetSnippet** + +A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Returns:** The WGSL snippet. + +### .generateTextureLoad( texture : Texture, textureProperty : string, uvIndexSnippet : string, levelSnippet : string, depthSnippet : string, offsetSnippet : string ) : string + +Generates the WGSL snippet that reads a single texel from a texture without sampling or filtering. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvIndexSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**levelSnippet** + +A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + +**depthSnippet** + +A WGSL snippet that represents 0-based texture array index to sample. + +**offsetSnippet** + +A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**Returns:** The WGSL snippet. + +### .generateTextureLod( texture : Texture, textureProperty : string, uvSnippet : string, depthSnippet : string, offsetSnippet : string, levelSnippet : string ) : string + +Generates the WGSL snippet for a texture lookup with explicit level-of-detail. Since it's a lookup, no sampling or filtering is applied. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**depthSnippet** + +A WGSL snippet that represents 0-based texture array index to sample. + +**offsetSnippet** + +A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + +**levelSnippet** + +A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + +Default is `'0u'`. + +**Overrides:** [NodeBuilder#generateTextureLod](NodeBuilder.html#generateTextureLod) + +**Returns:** The WGSL snippet. + +### .generateTextureStore( texture : Texture, textureProperty : string, uvIndexSnippet : string, depthSnippet : string, valueSnippet : string ) : string + +Generates the WGSL snippet that writes a single texel to a texture. + +**texture** + +The texture. + +**textureProperty** + +The name of the texture uniform in the shader. + +**uvIndexSnippet** + +A WGSL snippet that represents texture coordinates used for sampling. + +**depthSnippet** + +A WGSL snippet that represents 0-based texture array index to sample. + +**valueSnippet** + +A WGSL snippet that represent the new texel value. + +**Returns:** The WGSL snippet. + +### .generateWrapFunction( texture : Texture ) : string + +Generates a wrap function used in context of textures. + +**texture** + +The texture to generate the function for. + +**Returns:** The name of the generated function. + +### .getAttributes( shaderStage : string ) : string + +Returns the shader attributes of the given shader stage as a WGSL string. + +**shaderStage** + +The shader stage. + +**Overrides:** [NodeBuilder#getAttributes](NodeBuilder.html#getAttributes) + +**Returns:** The WGSL snippet that defines the shader attributes. + +### .getBitcastMethod( type : string ) : string + +Returns the bitcast method name for a given input and outputType. + +**type** + +The output type to bitcast to. + +**Returns:** The resolved WGSL bitcast invocation. + +### .getBuiltin( name : string, property : string, type : string, shaderStage : string ) : string + +This method should be used whenever builtins are required in nodes. The internal builtins data structure will make sure builtins are defined in the WGSL source. + +**name** + +The builtin name. + +**property** + +The property name. + +**type** + +The node data type. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Returns:** The property name. + +### .getBuiltins( shaderStage : string ) : string + +Returns the builtins of the given shader stage as a WGSL string. + +**shaderStage** + +The shader stage. + +**Returns:** A WGSL snippet that represents the builtins of the given stage. + +### .getClipDistance() : string + +Returns the clip distances builtin. + +**Returns:** The clip distances builtin. + +### .getDirectives( shaderStage : string ) : string + +Returns the directives of the given shader stage as a WGSL string. + +**shaderStage** + +The shader stage. + +**Returns:** A WGSL snippet that enables the directives of the given stage. + +### .getDrawIndex() : null + +Overwritten as a NOP since this method is intended for the WebGL 2 backend. + +**Overrides:** [NodeBuilder#getDrawIndex](NodeBuilder.html#getDrawIndex) + +**Returns:** Null. + +### .getFloatPackingMethod( encoding : string ) : string + +Returns the float packing method name for a given numeric encoding. + +**encoding** + +The numeric encoding that describes how the float values are mapped to the integer range. + +**Returns:** The resolve WGSL float packing method name. + +### .getFloatUnpackingMethod( encoding : string ) : string + +Returns the float unpacking method name for a given numeric encoding. + +**encoding** + +The numeric encoding that describes how the integer values are mapped to the float range. + +**Returns:** The resolve WGSL float unpacking method name. + +### .getFragCoord() : string + +Returns the frag coord builtin. + +**Overrides:** [NodeBuilder#getFragCoord](NodeBuilder.html#getFragCoord) + +**Returns:** The frag coord builtin. + +### .getFragDepth() : string + +Returns the frag depth builtin. + +**Returns:** The frag depth builtin. + +### .getFrontFacing() : string + +Returns the front facing builtin. + +**Overrides:** [NodeBuilder#getFrontFacing](NodeBuilder.html#getFrontFacing) + +**Returns:** The front facing builtin. + +### .getFunctionOperator( op : string ) : string + +Returns the native shader operator name for a given generic name. + +**op** + +The operator name to resolve. + +**Overrides:** [NodeBuilder#getFunctionOperator](NodeBuilder.html#getFunctionOperator) + +**Returns:** The resolved operator name. + +### .getInstanceIndex() : string + +Contextually returns either the vertex stage instance index builtin or the linearized index of an compute invocation within a grid of workgroups. + +**Overrides:** [NodeBuilder#getInstanceIndex](NodeBuilder.html#getInstanceIndex) + +**Returns:** The instance index. + +### .getInvocationLocalIndex() : string + +Returns a builtin representing the index of a compute invocation within the scope of a workgroup load. + +**Returns:** The invocation local index. + +### .getInvocationSubgroupIndex() : string + +Returns a builtin representing the index of a compute invocation within the scope of a subgroup. + +**Returns:** The invocation subgroup index. + +### .getMethod( method : string, output : string ) : string + +Returns the native shader method name for a given generic name. + +**method** + +The method name to resolve. + +**output** + +An optional output. + +Default is `null`. + +**Overrides:** [NodeBuilder#getMethod](NodeBuilder.html#getMethod) + +**Returns:** The resolved WGSL method name. + +### .getNodeAccess( node : StorageTextureNode | StorageBufferNode, shaderStage : string ) : string + +Returns the node access for the given node and shader stage. + +**node** + +The storage node. + +**shaderStage** + +The shader stage. + +**Returns:** The node access. + +### .getOutputStructName() : string + +Returns the output struct name. + +**Overrides:** [NodeBuilder#getOutputStructName](NodeBuilder.html#getOutputStructName) + +**Returns:** The name of the output struct. + +### .getPropertyName( node : Node, shaderStage : string ) : string + +Returns a WGSL snippet that represents the property name of the given node. + +**node** + +The node. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Overrides:** [NodeBuilder#getPropertyName](NodeBuilder.html#getPropertyName) + +**Returns:** The property name. + +### .getScopedArray( name : string, scope : string, bufferType : string, bufferCount : string ) : string + +This method should be used when a new scoped buffer is used in context of compute shaders. It adds the array to the internal data structure which is later used to generate the respective WGSL. + +**name** + +The array name. + +**scope** + +The scope. + +**bufferType** + +The buffer type. + +**bufferCount** + +The buffer count. + +**Returns:** The array name. + +### .getScopedArrays( shaderStage : string ) : string | undefined + +Returns the scoped arrays of the given shader stage as a WGSL string. + +**shaderStage** + +The shader stage. + +**Returns:** The WGSL snippet that defines the scoped arrays. Returns `undefined` when used in the vertex or fragment stage. + +### .getStorageAccess( node : StorageTextureNode | StorageBufferNode, shaderStage : string ) : string + +Returns A WGSL snippet representing the storage access. + +**node** + +The storage node. + +**shaderStage** + +The shader stage. + +**Returns:** The WGSL snippet representing the storage access. + +### .getStructMembers( struct : StructTypeNode ) : string + +Returns the members of the given struct type node as a WGSL string. + +**struct** + +The struct type node. + +**Returns:** The WGSL snippet that defines the struct members. + +### .getStructs( shaderStage : string ) : string + +Returns the structs of the given shader stage as a WGSL string. + +**shaderStage** + +The shader stage. + +**Returns:** The WGSL snippet that defines the structs. + +### .getSubgroupIndex() : string + +Returns a builtin representing the index of a compute invocation's subgroup within its workgroup. + +**Returns:** The subgroup index. + +### .getSubgroupSize() : string + +Returns a builtin representing the size of a subgroup within the current shader. + +**Returns:** The subgroup size. + +### .getTernary( condSnippet : string, ifSnippet : string, elseSnippet : string ) : string + +Returns the native snippet for a ternary operation. + +**condSnippet** + +The condition determining which expression gets resolved. + +**ifSnippet** + +The expression to resolve to if the condition is true. + +**elseSnippet** + +The expression to resolve to if the condition is false. + +**Overrides:** [NodeBuilder#getTernary](NodeBuilder.html#getTernary) + +**Returns:** The resolved method name. + +### .getType( type : string ) : string + +Returns the WGSL type of the given node data type. + +**type** + +The node data type. + +**Overrides:** [NodeBuilder#getType](NodeBuilder.html#getType) + +**Returns:** The WGSL type. + +### .getUniformFromNode( node : UniformNode, type : string, shaderStage : string, name : string ) : NodeUniform + +This method is one of the more important ones since it's responsible for generating a matching binding instance for the given uniform node. + +These bindings are later used in the renderer to create bind groups and layouts. + +**node** + +The uniform node. + +**type** + +The node data type. + +**shaderStage** + +The shader stage. + +**name** + +An optional uniform name. + +Default is `null`. + +**Overrides:** [NodeBuilder#getUniformFromNode](NodeBuilder.html#getUniformFromNode) + +**Returns:** The node uniform object. + +### .getUniforms( shaderStage : string ) : string + +Returns the uniforms of the given shader stage as a WGSL string. + +**shaderStage** + +The shader stage. + +**Overrides:** [NodeBuilder#getUniforms](NodeBuilder.html#getUniforms) + +**Returns:** The WGSL snippet that defines the uniforms. + +### .getVar( type : string, name : string, count : number ) : string + +Returns a WGSL string representing a variable. + +**type** + +The variable's type. + +**name** + +The variable's name. + +**count** + +The array length. + +Default is `null`. + +**Overrides:** [NodeBuilder#getVar](NodeBuilder.html#getVar) + +**Returns:** The WGSL snippet that defines a variable. + +### .getVars( shaderStage : string ) : string + +Returns the variables of the given shader stage as a WGSL string. + +**shaderStage** + +The shader stage. + +**Overrides:** [NodeBuilder#getVars](NodeBuilder.html#getVars) + +**Returns:** The WGSL snippet that defines the variables. + +### .getVaryings( shaderStage : string ) : string + +Returns the varyings of the given shader stage as a WGSL string. + +**shaderStage** + +The shader stage. + +**Overrides:** [NodeBuilder#getVaryings](NodeBuilder.html#getVaryings) + +**Returns:** The WGSL snippet that defines the varyings. + +### .getVertexIndex() : string + +Returns the vertex index builtin. + +**Overrides:** [NodeBuilder#getVertexIndex](NodeBuilder.html#getVertexIndex) + +**Returns:** The vertex index. + +### .hasBuiltin( name : string, shaderStage : string ) : boolean + +Returns `true` if the given builtin is defined in the given shader stage. + +**name** + +The builtin name. + +**shaderStage** + +The shader stage this code snippet is generated for. + +Default is `this.shaderStage`. + +**Returns:** Whether the given builtin is defined in the given shader stage or not. + +### .isAvailable( name : string ) : boolean + +Whether the requested feature is available or not. + +**name** + +The requested feature. + +**Overrides:** [NodeBuilder#isAvailable](NodeBuilder.html#isAvailable) + +**Returns:** Whether the requested feature is supported or not. + +### .isFlipY() : boolean + +Whether to flip texture data along its vertical axis or not. + +**Overrides:** [NodeBuilder#isFlipY](NodeBuilder.html#isFlipY) + +**Returns:** Returns always `false` in context of WGSL. + +### .isSampleCompare( texture : Texture ) : boolean + +Returns `true` if the sampled values of the given texture should be compared against a reference value. + +**texture** + +The texture. + +**Returns:** Whether the sampled values of the given texture should be compared against a reference value or not. + +### .isUnfilterable( texture : Texture ) : boolean + +Returns `true` if the given texture is unfilterable. + +**texture** + +The texture. + +**Returns:** Whether the given texture is unfilterable or not. + +## Source + +[src/renderers/webgpu/nodes/WGSLNodeBuilder.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webgpu/nodes/WGSLNodeBuilder.js) \ No newline at end of file diff --git a/docs/pages/WGSLNodeFunction.html.md b/docs/pages/WGSLNodeFunction.html.md new file mode 100644 index 00000000000000..215a868bc31fed --- /dev/null +++ b/docs/pages/WGSLNodeFunction.html.md @@ -0,0 +1,35 @@ +*Inheritance: NodeFunction →* + +# WGSLNodeFunction + +This class represents a WSL node function. + +## Constructor + +### new WGSLNodeFunction( source : string ) + +Constructs a new WGSL node function. + +**source** + +The WGSL source. + +## Methods + +### .getCode( name : string ) : string + +This method returns the WGSL code of the node function. + +**name** + +The function's name. + +Default is `this.name`. + +**Overrides:** [NodeFunction#getCode](NodeFunction.html#getCode) + +**Returns:** The shader code. + +## Source + +[src/renderers/webgpu/nodes/WGSLNodeFunction.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webgpu/nodes/WGSLNodeFunction.js) \ No newline at end of file diff --git a/docs/pages/WGSLNodeParser.html.md b/docs/pages/WGSLNodeParser.html.md new file mode 100644 index 00000000000000..f6e38f7fbbb982 --- /dev/null +++ b/docs/pages/WGSLNodeParser.html.md @@ -0,0 +1,27 @@ +*Inheritance: NodeParser →* + +# WGSLNodeParser + +A WGSL node parser. + +## Constructor + +### new WGSLNodeParser() + +## Methods + +### .parseFunction( source : string ) : WGSLNodeFunction + +The method parses the given WGSL code an returns a node function. + +**source** + +The WGSL code. + +**Overrides:** [NodeParser#parseFunction](NodeParser.html#parseFunction) + +**Returns:** A node function. + +## Source + +[src/renderers/webgpu/nodes/WGSLNodeParser.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webgpu/nodes/WGSLNodeParser.js) \ No newline at end of file diff --git a/docs/pages/Water.html.md b/docs/pages/Water.html.md new file mode 100644 index 00000000000000..b3e1f1e7a3dbd5 --- /dev/null +++ b/docs/pages/Water.html.md @@ -0,0 +1,142 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# Water + +A basic flat, reflective water effect. + +Note that this class can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), use [WaterMesh](WaterMesh.html). + +References: + +* [Flat mirror for three.js](https://github.com/Slayvin) +* [An implementation of water shader based on the flat mirror](https://home.adelphi.edu/~stemkoski/) +* [Water shader explanations in WebGL](http://29a.ch/slides/2012/webglwater/) + +## Import + +Water is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Water } from 'three/addons/objects/Water.js'; +``` + +## Constructor + +### new Water( geometry : BufferGeometry, options : Water~Options ) + +Constructs a new water instance. + +**geometry** + +The water's geometry. + +**options** + +The configuration options. + +## Properties + +### .isWater : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Type Definitions + +### .Options + +Constructor options of `Water`. + +**textureWidth** +number + +The texture width. A higher value results in more clear reflections but is also more expensive. + +Default is `512`. + +**textureHeight** +number + +The texture height. A higher value results in more clear reflections but is also more expensive. + +Default is `512`. + +**clipBias** +number + +The clip bias. + +Default is `0`. + +**alpha** +number + +The alpha value. + +Default is `1`. + +**time** +number + +The time value. + +Default is `0`. + +**waterNormals** +[Texture](Texture.html) + +The water's normal map. + +Default is `null`. + +**sunDirection** +[Vector3](Vector3.html) + +The sun direction. + +Default is `(0.70707,0.70707,0.0)`. + +**sunColor** +number | [Color](Color.html) | string + +The sun color. + +Default is `0xffffff`. + +**waterColor** +number | [Color](Color.html) | string + +The water color. + +Default is `0x7F7F7F`. + +**eye** +[Vector3](Vector3.html) + +The eye vector. + +**distortionScale** +number + +The distortion scale. + +Default is `20`. + +**side** +[FrontSide](global.html#FrontSide) | [BackSide](global.html#BackSide) | [DoubleSide](global.html#DoubleSide) + +The water material's `side` property. + +Default is `FrontSide`. + +**fog** +boolean + +Whether the water should be affected by fog or not. + +Default is `false`. + +## Source + +[examples/jsm/objects/Water.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Water.js) \ No newline at end of file diff --git a/docs/pages/WaterMesh.html.md b/docs/pages/WaterMesh.html.md new file mode 100644 index 00000000000000..31045474bc8061 --- /dev/null +++ b/docs/pages/WaterMesh.html.md @@ -0,0 +1,155 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# WaterMesh + +A basic flat, reflective water effect. + +Note that this class can only be used with [WebGPURenderer](WebGPURenderer.html). When using [WebGLRenderer](WebGLRenderer.html), use [Water](Water.html). + +References: + +* [Flat mirror for three.js](https://github.com/Slayvin) +* [An implementation of water shader based on the flat mirror](https://home.adelphi.edu/~stemkoski/) +* [Water shader explanations in WebGL](http://29a.ch/slides/2012/webglwater/) + +## Import + +WaterMesh is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { WaterMesh } from 'three/addons/objects/WaterMesh.js'; +``` + +## Constructor + +### new WaterMesh( geometry : BufferGeometry, options : WaterMesh~Options ) + +Constructs a new water mesh. + +**geometry** + +The water mesh's geometry. + +**options** + +The configuration options. + +## Properties + +### .alpha : UniformNode. + +The alpha value. + +Default is `1`. + +### .distortionScale : UniformNode. + +The distortion scale. + +Default is `20`. + +### .isWaterMesh : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .resolutionScale : number + +The effect's resolution scale. + +Default is `0.5`. + +### .size : UniformNode. + +The size value. + +Default is `1`. + +### .sunColor : UniformNode. + +The sun color. + +Default is `0xffffff`. + +### .sunDirection : UniformNode. + +The sun direction. + +Default is `(0.70707,0.70707,0.0)`. + +### .waterColor : UniformNode. + +The water color. + +Default is `0x7f7f7f`. + +### .waterNormals : TextureNode + +The water's normal map. + +## Type Definitions + +### .Options + +Constructor options of `WaterMesh`. + +**resolutionScale** +number + +The resolution scale. + +Default is `0.5`. + +**waterNormals** +[Texture](Texture.html) + +The water's normal map. + +Default is `null`. + +**alpha** +number + +The alpha value. + +Default is `1`. + +**size** +number + +The size value. + +Default is `1`. + +**sunColor** +number | [Color](Color.html) | string + +The sun color. + +Default is `0xffffff`. + +**sunDirection** +[Vector3](Vector3.html) + +The sun direction. + +Default is `(0.70707,0.70707,0.0)`. + +**waterColor** +number | [Color](Color.html) | string + +The water color. + +Default is `0x7F7F7F`. + +**distortionScale** +number + +The distortion scale. + +Default is `20`. + +## Source + +[examples/jsm/objects/WaterMesh.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/WaterMesh.js) \ No newline at end of file diff --git a/docs/pages/WebGL.html.md b/docs/pages/WebGL.html.md new file mode 100644 index 00000000000000..d01b8be70ceb59 --- /dev/null +++ b/docs/pages/WebGL.html.md @@ -0,0 +1,39 @@ +# WebGL + +A utility module with basic WebGL 2 capability testing. + +## Import + +WebGL is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import WebGL from 'three/addons/capabilities/WebGL.js'; +``` + +## Static Methods + +### .getWebGL2ErrorMessage() : HTMLDivElement + +Returns a `div` element representing a formatted error message that can be appended in web sites if WebGL 2 isn't supported. + +**Returns:** A `div` element representing a formatted error message that WebGL 2 isn't supported. + +### .isColorSpaceAvailable( colorSpace : string ) : boolean + +Returns `true` if the given color space is available. This method can only be used if WebGL 2 is supported. + +**colorSpace** + +The color space to test. + +**Returns:** Whether the given color space is available or not. + +### .isWebGL2Available() : boolean + +Returns `true` if WebGL 2 is available. + +**Returns:** Whether WebGL 2 is available or not. + +## Source + +[examples/jsm/capabilities/WebGL.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/capabilities/WebGL.js) \ No newline at end of file diff --git a/docs/pages/WebGL3DRenderTarget.html.md b/docs/pages/WebGL3DRenderTarget.html.md new file mode 100644 index 00000000000000..b4881812528f46 --- /dev/null +++ b/docs/pages/WebGL3DRenderTarget.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → RenderTarget → WebGLRenderTarget →* + +# WebGL3DRenderTarget + +A 3D render target used in context of [WebGLRenderer](WebGLRenderer.html). + +## Constructor + +### new WebGL3DRenderTarget( width : number, height : number, depth : number, options : RenderTarget~Options ) + +Constructs a new 3D render target. + +**width** + +The width of the render target. + +Default is `1`. + +**height** + +The height of the render target. + +Default is `1`. + +**depth** + +The height of the render target. + +Default is `1`. + +**options** + +The configuration object. + +## Properties + +### .isWebGL3DRenderTarget : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .texture : Data3DTexture + +Overwritten with a different texture type. + +**Overrides:** [WebGLRenderTarget#texture](WebGLRenderTarget.html#texture) + +## Source + +[src/renderers/WebGL3DRenderTarget.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGL3DRenderTarget.js) \ No newline at end of file diff --git a/docs/pages/WebGLArrayRenderTarget.html.md b/docs/pages/WebGLArrayRenderTarget.html.md new file mode 100644 index 00000000000000..4da0a76fb97b07 --- /dev/null +++ b/docs/pages/WebGLArrayRenderTarget.html.md @@ -0,0 +1,51 @@ +*Inheritance: EventDispatcher → RenderTarget → WebGLRenderTarget →* + +# WebGLArrayRenderTarget + +An array render target used in context of [WebGLRenderer](WebGLRenderer.html). + +## Constructor + +### new WebGLArrayRenderTarget( width : number, height : number, depth : number, options : RenderTarget~Options ) + +Constructs a new array render target. + +**width** + +The width of the render target. + +Default is `1`. + +**height** + +The height of the render target. + +Default is `1`. + +**depth** + +The height of the render target. + +Default is `1`. + +**options** + +The configuration object. + +## Properties + +### .isWebGLArrayRenderTarget : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .texture : DataArrayTexture + +Overwritten with a different texture type. + +**Overrides:** [WebGLRenderTarget#texture](WebGLRenderTarget.html#texture) + +## Source + +[src/renderers/WebGLArrayRenderTarget.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLArrayRenderTarget.js) \ No newline at end of file diff --git a/docs/pages/WebGLCubeRenderTarget.html.md b/docs/pages/WebGLCubeRenderTarget.html.md new file mode 100644 index 00000000000000..e1e96256fd19ca --- /dev/null +++ b/docs/pages/WebGLCubeRenderTarget.html.md @@ -0,0 +1,81 @@ +*Inheritance: EventDispatcher → RenderTarget → WebGLRenderTarget →* + +# WebGLCubeRenderTarget + +A cube render target used in context of [WebGLRenderer](WebGLRenderer.html). + +## Constructor + +### new WebGLCubeRenderTarget( size : number, options : RenderTarget~Options ) + +Constructs a new cube render target. + +**size** + +The size of the render target. + +Default is `1`. + +**options** + +The configuration object. + +## Properties + +### .isWebGLCubeRenderTarget : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .texture : DataArrayTexture + +Overwritten with a different texture type. + +**Overrides:** [WebGLRenderTarget#texture](WebGLRenderTarget.html#texture) + +## Methods + +### .clear( renderer : WebGLRenderer, color : boolean, depth : boolean, stencil : boolean ) + +Clears this cube render target. + +**renderer** + +The renderer. + +**color** + +Whether the color buffer should be cleared or not. + +Default is `true`. + +**depth** + +Whether the depth buffer should be cleared or not. + +Default is `true`. + +**stencil** + +Whether the stencil buffer should be cleared or not. + +Default is `true`. + +### .fromEquirectangularTexture( renderer : WebGLRenderer, texture : Texture ) : WebGLCubeRenderTarget + +Converts the given equirectangular texture to a cube map. + +**renderer** + +The renderer. + +**texture** + +The equirectangular texture. + +**Returns:** A reference to this cube render target. + +## Source + +[src/renderers/WebGLCubeRenderTarget.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLCubeRenderTarget.js) \ No newline at end of file diff --git a/docs/pages/WebGLRenderTarget.html.md b/docs/pages/WebGLRenderTarget.html.md new file mode 100644 index 00000000000000..03835d6ad554e6 --- /dev/null +++ b/docs/pages/WebGLRenderTarget.html.md @@ -0,0 +1,39 @@ +*Inheritance: EventDispatcher → RenderTarget →* + +# WebGLRenderTarget + +A render target used in context of [WebGLRenderer](WebGLRenderer.html). + +## Constructor + +### new WebGLRenderTarget( width : number, height : number, options : RenderTarget~Options ) + +Constructs a new 3D render target. + +**width** + +The width of the render target. + +Default is `1`. + +**height** + +The height of the render target. + +Default is `1`. + +**options** + +The configuration object. + +## Properties + +### .isWebGLRenderTarget : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/renderers/WebGLRenderTarget.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLRenderTarget.js) \ No newline at end of file diff --git a/docs/pages/WebGLRenderer.html.md b/docs/pages/WebGLRenderer.html.md new file mode 100644 index 00000000000000..eb8fa80ec80358 --- /dev/null +++ b/docs/pages/WebGLRenderer.html.md @@ -0,0 +1,990 @@ +# WebGLRenderer + +This renderer uses WebGL 2 to display scenes. + +WebGL 1 is not supported since `r163`. + +## Constructor + +### new WebGLRenderer( parameters : WebGLRenderer~Options ) + +Constructs a new WebGL renderer. + +**parameters** + +The configuration parameter. + +## Properties + +### .autoClear : boolean + +Whether the renderer should automatically clear its output before rendering a frame or not. + +Default is `true`. + +### .autoClearColor : boolean + +If [WebGLRenderer#autoClear](WebGLRenderer.html#autoClear) set to `true`, whether the renderer should clear the color buffer or not. + +Default is `true`. + +### .autoClearDepth : boolean + +If [WebGLRenderer#autoClear](WebGLRenderer.html#autoClear) set to `true`, whether the renderer should clear the depth buffer or not. + +Default is `true`. + +### .autoClearStencil : boolean + +If [WebGLRenderer#autoClear](WebGLRenderer.html#autoClear) set to `true`, whether the renderer should clear the stencil buffer or not. + +Default is `true`. + +### .capabilities : WebGLRenderer~Capabilities + +Holds details about the capabilities of the current rendering context. + +### .clippingPlanes : Array. + +User-defined clipping planes specified in world space. These planes apply globally. Points in space whose dot product with the plane is negative are cut away. + +### .coordinateSystem : WebGLCoordinateSystem | WebGPUCoordinateSystem (readonly) + +Defines the coordinate system of the renderer. + +In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`. + +Default is `WebGLCoordinateSystem`. + +### .debug : Object + +A object with debug configuration settings. + +* `checkShaderErrors`: If it is `true`, defines whether material shader programs are checked for errors during compilation and linkage process. It may be useful to disable this check in production for performance gain. It is strongly recommended to keep these checks enabled during development. If the shader does not compile and link - it will not work and associated material will not render. +* `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that can be used for custom error reporting. The callback receives the WebGL context, an instance of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader. Assigning a custom function disables the default error reporting. + +### .domElement : HTMLCanvasElement | OffscreenCanvas + +A canvas where the renderer draws its output.This is automatically created by the renderer in the constructor (if not provided already); you just need to add it to your page like so: + +```js +document.body.appendChild( renderer.domElement ); +``` + +### .extensions : Object + +Provides methods for retrieving and testing WebGL extensions. + +* `get(extensionName:string)`: Used to check whether a WebGL extension is supported and return the extension object if available. +* `has(extensionName:string)`: returns `true` if the extension is supported. + +### .info : WebGLRenderer~Info + +Holds a series of statistical information about the GPU memory and the rendering process. Useful for debugging and monitoring. + +By default these data are reset at each render call but when having multiple render passes per frame (e.g. when using post processing) it can be preferred to reset with a custom pattern. First, set `autoReset` to `false`. + +```js +renderer.info.autoReset = false; +``` + +Call `reset()` whenever you have finished to render a single frame. + +```js +renderer.info.reset(); +``` + +### .isWebGLRenderer : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .localClippingEnabled : boolean + +Whether the renderer respects object-level clipping planes or not. + +Default is `false`. + +### .outputColorSpace : SRGBColorSpace | LinearSRGBColorSpace + +Defines the output color space of the renderer. + +Default is `SRGBColorSpace`. + +### .properties : Object + +Used to track properties of other objects like native WebGL objects. + +### .renderLists : Object + +Manages the render lists of the renderer. + +### .shadowMap : WebGLRenderer~ShadowMap + +Interface for managing shadows. + +### .sortObjects : boolean + +Whether the renderer should sort objects or not. + +Note: Sorting is used to attempt to properly render objects that have some degree of transparency. By definition, sorting objects may not work in all cases. Depending on the needs of application, it may be necessary to turn off sorting and use other methods to deal with transparency rendering e.g. manually determining each object's rendering order. + +Default is `true`. + +### .state : Object + +Interface for managing the WebGL state. + +### .toneMapping : NoToneMapping | LinearToneMapping | ReinhardToneMapping | CineonToneMapping | ACESFilmicToneMapping | CustomToneMapping | AgXToneMapping | NeutralToneMapping + +The tone mapping technique of the renderer. + +Default is `NoToneMapping`. + +### .toneMappingExposure : number + +Exposure level of tone mapping. + +Default is `1`. + +### .transmissionResolutionScale : number + +The normalized resolution scale for the transmission render target, measured in percentage of viewport dimensions. Lowering this value can result in significant performance improvements when using [MeshPhysicalMaterial#transmission](MeshPhysicalMaterial.html#transmission). + +Default is `1`. + +### .xr : WebXRManager + +A reference to the XR manager. + +## Methods + +### .clear( color : boolean, depth : boolean, stencil : boolean ) + +Tells the renderer to clear its color, depth or stencil drawing buffer(s). This method initializes the buffers to the current clear color values. + +**color** + +Whether the color buffer should be cleared or not. + +Default is `true`. + +**depth** + +Whether the depth buffer should be cleared or not. + +Default is `true`. + +**stencil** + +Whether the stencil buffer should be cleared or not. + +Default is `true`. + +### .clearColor() + +Clears the color buffer. Equivalent to calling `renderer.clear( true, false, false )`. + +### .clearDepth() + +Clears the depth buffer. Equivalent to calling `renderer.clear( false, true, false )`. + +### .clearStencil() + +Clears the stencil buffer. Equivalent to calling `renderer.clear( false, false, true )`. + +### .compile( scene : Object3D, camera : Camera, targetScene : Scene ) : Set. + +Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first rendering. If you want to add a 3D object to an existing scene, use the third optional parameter for applying the target scene. + +Note that the (target) scene's lighting and environment must be configured before calling this method. + +**scene** + +The scene or another type of 3D object to precompile. + +**camera** + +The camera. + +**targetScene** + +The target scene. + +Default is `null`. + +**Returns:** The precompiled materials. + +### .compileAsync( scene : Object3D, camera : Camera, targetScene : Scene ) : Promise (async) + +Asynchronous version of [WebGLRenderer#compile](WebGLRenderer.html#compile). + +This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence, it is recommended to use this version of `compile()` whenever possible. + +**scene** + +The scene or another type of 3D object to precompile. + +**camera** + +The camera. + +**targetScene** + +The target scene. + +Default is `null`. + +**Returns:** A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation. + +### .copyFramebufferToTexture( texture : FramebufferTexture, position : Vector2, level : number ) + +Copies pixels from the current bound framebuffer into the given texture. + +**texture** + +The texture. + +**position** + +The start position of the copy operation. + +Default is `null`. + +**level** + +The mip level. The default represents the base mip. + +Default is `0`. + +### .copyTextureToTexture( srcTexture : Texture, dstTexture : Texture, srcRegion : Box2 | Box3, dstPosition : Vector2 | Vector3, srcLevel : number, dstLevel : number ) + +Copies data of the given source texture into a destination texture. + +When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized [WebGLRenderer#initRenderTarget](WebGLRenderer.html#initRenderTarget). + +**srcTexture** + +The source texture. + +**dstTexture** + +The destination texture. + +**srcRegion** + +A bounding box which describes the source region. Can be two or three-dimensional. + +Default is `null`. + +**dstPosition** + +A vector that represents the origin of the destination region. Can be two or three-dimensional. + +Default is `null`. + +**srcLevel** + +The source mipmap level to copy. + +Default is `0`. + +**dstLevel** + +The destination mipmap level. + +Default is `0`. + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +### .forceContextLoss() + +Simulates a loss of the WebGL context. This requires support for the `WEBGL_lose_context` extension. + +### .forceContextRestore() + +Simulates a restore of the WebGL context. This requires support for the `WEBGL_lose_context` extension. + +### .getActiveCubeFace() : number + +Returns the active cube face. + +**Returns:** The active cube face. + +### .getActiveMipmapLevel() : number + +Returns the active mipmap level. + +**Returns:** The active mipmap level. + +### .getClearAlpha() : number + +Returns the clear alpha. Ranges within `[0,1]`. + +**Returns:** The clear alpha. + +### .getClearColor( target : Color ) : Color + +Returns the clear color. + +**target** + +The method writes the result in this target object. + +**Returns:** The clear color. + +### .getContext() : WebGL2RenderingContext + +Returns the rendering context. + +**Returns:** The rendering context. + +### .getContextAttributes() : WebGLContextAttributes + +Returns the rendering context attributes. + +**Returns:** The rendering context attributes. + +### .getCurrentViewport( target : Vector2 ) : Vector2 + +Returns the current viewport definition. + +**target** + +The method writes the result in this target object. + +**Returns:** The current viewport definition. + +### .getDrawingBufferSize( target : Vector2 ) : Vector2 + +Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + +**target** + +The method writes the result in this target object. + +**Returns:** The drawing buffer size. + +### .getPixelRatio() : number + +Returns the pixel ratio. + +**Returns:** The pixel ratio. + +### .getRenderTarget() : WebGLRenderTarget + +Returns the active render target. + +**Returns:** The active render target. Returns `null` if no render target is currently set. + +### .getScissor( target : Vector4 ) : Vector4 + +Returns the scissor region. + +**target** + +The method writes the result in this target object. + +**Returns:** The scissor region. + +### .getScissorTest() : boolean + +Returns `true` if the scissor test is enabled. + +**Returns:** Whether the scissor test is enabled or not. + +### .getSize( target : Vector2 ) : Vector2 + +Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + +**target** + +The method writes the result in this target object. + +**Returns:** The renderer's size in logical pixels. + +### .getViewport( target : Vector4 ) : Vector4 + +Returns the viewport definition. + +**target** + +The method writes the result in this target object. + +**Returns:** The viewport definition. + +### .initRenderTarget( target : WebGLRenderTarget ) + +Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data can be copied into it using [WebGLRenderer#copyTextureToTexture](WebGLRenderer.html#copyTextureToTexture) before it has been rendered to. + +**target** + +The render target. + +### .initTexture( texture : Texture ) + +Initializes the given texture. Useful for preloading a texture rather than waiting until first render (which can cause noticeable lags due to decode and GPU upload overhead). + +**texture** + +The texture. + +### .readRenderTargetPixels( renderTarget : WebGLRenderTarget, x : number, y : number, width : number, height : number, buffer : TypedArray, activeCubeFaceIndex : number, textureIndex : number ) + +Reads the pixel data from the given render target into the given buffer. + +**renderTarget** + +The render target to read from. + +**x** + +The `x` coordinate of the copy region's origin. + +**y** + +The `y` coordinate of the copy region's origin. + +**width** + +The width of the copy region. + +**height** + +The height of the copy region. + +**buffer** + +The result buffer. + +**activeCubeFaceIndex** + +The active cube face index. + +**textureIndex** + +The texture index of an MRT render target. + +Default is `0`. + +### .readRenderTargetPixelsAsync( renderTarget : WebGLRenderTarget, x : number, y : number, width : number, height : number, buffer : TypedArray, activeCubeFaceIndex : number, textureIndex : number ) : Promise. (async) + +Asynchronous, non-blocking version of [WebGLRenderer#readRenderTargetPixels](WebGLRenderer.html#readRenderTargetPixels). + +It is recommended to use this version of `readRenderTargetPixels()` whenever possible. + +**renderTarget** + +The render target to read from. + +**x** + +The `x` coordinate of the copy region's origin. + +**y** + +The `y` coordinate of the copy region's origin. + +**width** + +The width of the copy region. + +**height** + +The height of the copy region. + +**buffer** + +The result buffer. + +**activeCubeFaceIndex** + +The active cube face index. + +**textureIndex** + +The texture index of an MRT render target. + +Default is `0`. + +**Returns:** A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. + +### .render( scene : Object3D, camera : Camera ) + +Renders the given scene (or other type of 3D object) using the given camera. + +The render is done to a previously specified render target set by calling [WebGLRenderer#setRenderTarget](WebGLRenderer.html#setRenderTarget) or to the canvas as usual. + +By default render buffers are cleared before rendering but you can prevent this by setting the property `autoClear` to `false`. If you want to prevent only certain buffers being cleared you can `autoClearColor`, `autoClearDepth` or `autoClearStencil` to `false`. To force a clear, use [WebGLRenderer#clear](WebGLRenderer.html#clear). + +**scene** + +The scene to render. + +**camera** + +The camera. + +### .resetState() + +Can be used to reset the internal WebGL state. This method is mostly relevant for applications which share a single WebGL context across multiple WebGL libraries. + +### .setAnimationLoop( callback : onAnimationCallback ) + +Applications are advised to always define the animation loop with this method and not manually with `requestAnimationFrame()` for best compatibility. + +**callback** + +The application's animation loop. + +### .setClearAlpha( alpha : number ) + +Sets the clear alpha. + +**alpha** + +The clear alpha. + +### .setClearColor( color : Color, alpha : number ) + +Sets the clear color and alpha. + +**color** + +The clear color. + +**alpha** + +The clear alpha. + +Default is `1`. + +### .setDrawingBufferSize( width : number, height : number, pixelRatio : number ) + +This method allows to define the drawing buffer size by specifying width, height and pixel ratio all at once. The size of the drawing buffer is computed with this formula: + +```js +size.x = width * pixelRatio; +size.y = height * pixelRatio; +``` + +**width** + +The width in logical pixels. + +**height** + +The height in logical pixels. + +**pixelRatio** + +The pixel ratio. + +### .setEffects( effects : Array ) + +Sets the post-processing effects to be applied after rendering. + +**effects** + +An array of post-processing effects. + +### .setOpaqueSort( method : function ) + +Sets a custom opaque sort function for the render lists. Pass `null` to use the default `painterSortStable` function. + +**method** + +The opaque sort function. + +### .setPixelRatio( value : number ) + +Sets the given pixel ratio and resizes the canvas if necessary. + +**value** + +The pixel ratio. + +### .setRenderTarget( renderTarget : WebGLRenderTarget, activeCubeFace : number, activeMipmapLevel : number ) + +Sets the active rendertarget. + +**renderTarget** + +The render target to set. When `null` is given, the canvas is set as the active render target instead. + +**activeCubeFace** + +The active cube face when using a cube render target. Indicates the z layer to render in to when using 3D or array render targets. + +Default is `0`. + +**activeMipmapLevel** + +The active mipmap level. + +Default is `0`. + +### .setScissor( x : number | Vector4, y : number, width : number, height : number ) + +Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`. + +**x** + +The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit. Or alternatively a four-component vector specifying all the parameters of the scissor region. + +**y** + +The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit. + +**width** + +The width of the scissor region in logical pixel unit. + +**height** + +The height of the scissor region in logical pixel unit. + +### .setScissorTest( boolean : boolean ) + +Enable or disable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions. + +**boolean** + +Whether the scissor test is enabled or not. + +### .setSize( width : number, height : number, updateStyle : boolean ) + +Resizes the output canvas to (width, height) with device pixel ratio taken into account, and also sets the viewport to fit that size, starting in (0, 0). Setting `updateStyle` to false prevents any style changes to the output canvas. + +**width** + +The width in logical pixels. + +**height** + +The height in logical pixels. + +**updateStyle** + +Whether to update the `style` attribute of the canvas or not. + +Default is `true`. + +### .setTransparentSort( method : function ) + +Sets a custom transparent sort function for the render lists. Pass `null` to use the default `reversePainterSortStable` function. + +**method** + +The opaque sort function. + +### .setViewport( x : number | Vector4, y : number, width : number, height : number ) + +Sets the viewport to render from `(x, y)` to `(x + width, y + height)`. + +**x** + +The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. Or alternatively a four-component vector specifying all the parameters of the viewport. + +**y** + +The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + +**width** + +The width of the viewport in logical pixel unit. + +**height** + +The height of the viewport in logical pixel unit. + +## Type Definitions + +### .Capabilities + +WebGLRenderer Capabilities. + +**getMaxAnisotropy** +function + +Returns the maximum available anisotropy. + +**getMaxPrecision** +function + +Returns the maximum available precision for vertex and fragment shaders. + +**logarithmicDepthBuffer** +boolean + +`true` if `logarithmicDepthBuffer` was set to `true` in the constructor. + +**maxAttributes** +number + +The number of shader attributes that can be used by the vertex shader. + +**maxCubemapSize** +number + +Maximum height \* width of cube map textures that a shader can use. + +**maxFragmentUniforms** +number + +The number of uniforms that can be used by a fragment shader. + +**maxSamples** +number + +Maximum number of samples in context of Multisample anti-aliasing (MSAA). + +**maxTextures** +number + +The maximum number of textures that can be used by a shader. + +**maxTextureSize** +number + +Maximum height \* width of a texture that a shader use. + +**maxVaryings** +number + +The number of varying vectors that can used by shaders. + +**maxVertexTextures** +number + +The number of textures that can be used in a vertex shader. + +**maxVertexUniforms** +number + +The maximum number of uniforms that can be used in a vertex shader. + +**precision** +string + +The shader precision currently being used by the renderer. + +**reversedDepthBuffer** +boolean + +`true` if `reversedDepthBuffer` was set to `true` in the constructor and the rendering context supports `EXT_clip_control`. + +### .Info + +WebGLRenderer Info + +**autoReset** +boolean + +Whether to automatically reset the info by the renderer or not. + +Default is `true`. + +**memory** +[WebGLRenderer~InfoMemory](WebGLRenderer.html#~InfoMemory) + +Information about allocated objects. + +**render** +[WebGLRenderer~InfoRender](WebGLRenderer.html#~InfoRender) + +Information about rendered objects. + +**programs** +Array. + +An array `WebGLProgram`s used for rendering. + +**reset** +function + +Resets the info object for the next frame. + +### .InfoMemory + +WebGLRenderer Info Memory + +**geometries** +number + +The number of active geometries. + +**textures** +number + +The number of active textures. + +### .InfoRender + +WebGLRenderer Info Render + +**frame** +number + +The frame ID. + +**calls** +number + +The number of draw calls per frame. + +**triangles** +number + +The number of rendered triangles primitives per frame. + +**points** +number + +The number of rendered points primitives per frame. + +**lines** +number + +The number of rendered lines primitives per frame. + +### .Options + +WebGLRenderer options. + +**canvas** +HTMLCanvasElement | OffscreenCanvas + +A canvas element where the renderer draws its output. If not passed in here, a new canvas element will be created by the renderer. + +Default is `null`. + +**context** +WebGL2RenderingContext + +Can be used to attach an existing rendering context to this renderer. + +Default is `null`. + +**precision** +'highp' | 'mediump' | 'lowp' + +The default shader precision. Uses `highp` if supported by the device. + +Default is `'highp'`. + +**alpha** +boolean + +Controls the default clear alpha value. When set to`true`, the value is `0`. Otherwise it's `1`. + +Default is `false`. + +**premultipliedAlpha** +boolean + +Whether the renderer will assume colors have premultiplied alpha or not. + +Default is `true`. + +**antialias** +boolean + +Whether to use the default MSAA or not. + +Default is `false`. + +**stencil** +boolean + +Whether the drawing buffer has a stencil buffer of at least 8 bits or not. + +Default is `false`. + +**preserveDrawingBuffer** +boolean + +Whether to preserve the buffer until manually cleared or overwritten. + +Default is `false`. + +**powerPreference** +'default' | 'low-power' | 'high-performance' + +Provides a hint to the user agent indicating what configuration of GPU is suitable for this WebGL context. + +Default is `'default'`. + +**failIfMajorPerformanceCaveat** +boolean + +Whether the renderer creation will fail upon low performance is detected. + +Default is `false`. + +**depth** +boolean + +Whether the drawing buffer has a depth buffer of at least 16 bits. + +Default is `true`. + +**logarithmicDepthBuffer** +boolean + +Whether to use a logarithmic depth buffer. It may be necessary to use this if dealing with huge differences in scale in a single scene. Note that this setting uses `gl_FragDepth` if available which disables the Early Fragment Test optimization and can cause a decrease in performance. + +Default is `false`. + +**reversedDepthBuffer** +boolean + +Whether to use a reverse depth buffer. Requires the `EXT_clip_control` extension. This is a more faster and accurate version than logarithmic depth buffer. + +Default is `false`. + +**outputBufferType** +number + +Defines the type of the output buffer. Use `HalfFloatType` for HDR rendering with tone mapping and post-processing support. + +Default is `UnsignedByteType`. + +### .ShadowMap + +WebGLRenderer Shadow Map. + +**enabled** +boolean + +If set to `true`, use shadow maps in the scene. + +Default is `false`. + +**autoUpdate** +boolean + +Enables automatic updates to the shadows in the scene. If you do not require dynamic lighting / shadows, you may set this to `false`. + +Default is `true`. + +**needsUpdate** +boolean + +When set to `true`, shadow maps in the scene will be updated in the next `render` call. + +Default is `false`. + +**type** +[BasicShadowMap](global.html#BasicShadowMap) | [PCFShadowMap](global.html#PCFShadowMap) | [VSMShadowMap](global.html#VSMShadowMap) + +Defines the shadow map type. + +Default is `PCFShadowMap`. + +## Source + +[src/renderers/WebGLRenderer.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLRenderer.js) \ No newline at end of file diff --git a/docs/pages/WebGLTimestampQueryPool.html.md b/docs/pages/WebGLTimestampQueryPool.html.md new file mode 100644 index 00000000000000..97a48bc0caba12 --- /dev/null +++ b/docs/pages/WebGLTimestampQueryPool.html.md @@ -0,0 +1,83 @@ +*Inheritance: TimestampQueryPool →* + +# WebGLTimestampQueryPool + +Manages a pool of WebGL timestamp queries for performance measurement. Handles creation, execution, and resolution of timer queries using WebGL extensions. + +## Constructor + +### new WebGLTimestampQueryPool( gl : WebGLRenderingContext | WebGL2RenderingContext, type : string, maxQueries : number ) + +Creates a new WebGL timestamp query pool. + +**gl** + +The WebGL context. + +**type** + +The type identifier for this query pool. + +**maxQueries** + +Maximum number of queries this pool can hold. + +Default is `2048`. + +## Methods + +### .allocateQueriesForContext( uid : string ) : number + +Allocates a pair of queries for a given render context. + +**uid** + +A unique identifier for the render context. + +**Overrides:** [TimestampQueryPool#allocateQueriesForContext](TimestampQueryPool.html#allocateQueriesForContext) + +**Returns:** The base offset for the allocated queries, or null if allocation failed. + +### .beginQuery( uid : string ) + +Begins a timestamp query for the specified render context. + +**uid** + +A unique identifier for the render context. + +### .dispose() + +Releases all resources held by this query pool. This includes deleting all query objects and clearing internal state. + +**Overrides:** [TimestampQueryPool#dispose](TimestampQueryPool.html#dispose) + +### .endQuery( uid : string ) + +Ends the active timestamp query for the specified render context. + +**uid** + +A unique identifier for the render context. + +### .resolveQueriesAsync() : Promise. (async) + +Asynchronously resolves all completed queries and returns the total duration. + +**Overrides:** [TimestampQueryPool#resolveQueriesAsync](TimestampQueryPool.html#resolveQueriesAsync) + +**Returns:** The total duration in milliseconds, or the last valid value if resolution fails. + +### .resolveQuery( query : WebGLQuery ) : Promise. (async) + +Resolves a single query, checking for completion and disjoint operation. + +**query** + +The query object to resolve. + +**Returns:** The elapsed time in milliseconds. + +## Source + +[src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js) \ No newline at end of file diff --git a/docs/pages/WebGPU.html.md b/docs/pages/WebGPU.html.md new file mode 100644 index 00000000000000..d1f772809396df --- /dev/null +++ b/docs/pages/WebGPU.html.md @@ -0,0 +1,29 @@ +# WebGPU + +A utility module with basic WebGPU capability testing. + +## Import + +WebGPU is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import WebGPU from 'three/addons/capabilities/WebGPU.js'; +``` + +## Static Methods + +### .getErrorMessage() : HTMLDivElement + +Returns a `div` element representing a formatted error message that can be appended in web sites if WebGPU isn't supported. + +**Returns:** A `div` element representing a formatted error message that WebGPU isn't supported. + +### .isAvailable() : boolean + +Returns `true` if WebGPU is available. + +**Returns:** Whether WebGPU is available or not. + +## Source + +[examples/jsm/capabilities/WebGPU.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/capabilities/WebGPU.js) \ No newline at end of file diff --git a/docs/pages/WebGPURenderer.html.md b/docs/pages/WebGPURenderer.html.md new file mode 100644 index 00000000000000..4f22f3dd9ba1ba --- /dev/null +++ b/docs/pages/WebGPURenderer.html.md @@ -0,0 +1,107 @@ +*Inheritance: Renderer →* + +# WebGPURenderer + +This renderer is the new alternative of `WebGLRenderer`. `WebGPURenderer` has the ability to target different backends. By default, the renderer tries to use a WebGPU backend if the browser supports WebGPU. If not, `WebGPURenderer` falls backs to a WebGL 2 backend. + +## Constructor + +### new WebGPURenderer( parameters : WebGPURenderer~Options ) + +Constructs a new WebGPU renderer. + +**parameters** + +The configuration parameter. + +## Properties + +### .isWebGPURenderer : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .library : StandardNodeLibrary + +The generic default value is overwritten with the standard node library for type mapping. + +**Overrides:** [Renderer#library](Renderer.html#library) + +## Type Definitions + +### .Options + +WebGPURenderer options. + +**logarithmicDepthBuffer** +boolean + +Whether logarithmic depth buffer is enabled or not. + +Default is `false`. + +**alpha** +boolean + +Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + +Default is `true`. + +**depth** +boolean + +Whether the default framebuffer should have a depth buffer or not. + +Default is `true`. + +**stencil** +boolean + +Whether the default framebuffer should have a stencil buffer or not. + +Default is `false`. + +**antialias** +boolean + +Whether MSAA as the default anti-aliasing should be enabled or not. + +Default is `false`. + +**samples** +number + +When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. + +Default is `0`. + +**forceWebGL** +boolean + +If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. + +Default is `false`. + +**multiview** +boolean + +If set to `true`, the renderer will use multiview during WebXR rendering if supported. + +Default is `false`. + +**outputType** +number + +Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. + +**outputBufferType** +number + +Defines the type of output buffers. The default `HalfFloatType` is recommend for best quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. + +Default is `HalfFloatType`. + +## Source + +[src/renderers/webgpu/WebGPURenderer.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webgpu/WebGPURenderer.js) \ No newline at end of file diff --git a/docs/pages/WebGPUTimestampQueryPool.html.md b/docs/pages/WebGPUTimestampQueryPool.html.md new file mode 100644 index 00000000000000..e3b7c0fe482735 --- /dev/null +++ b/docs/pages/WebGPUTimestampQueryPool.html.md @@ -0,0 +1,59 @@ +*Inheritance: TimestampQueryPool →* + +# WebGPUTimestampQueryPool + +Manages a pool of WebGPU timestamp queries for performance measurement. Extends the base TimestampQueryPool to provide WebGPU-specific implementation. + +## Constructor + +### new WebGPUTimestampQueryPool( device : GPUDevice, type : string, maxQueries : number ) + +Creates a new WebGPU timestamp query pool. + +**device** + +The WebGPU device to create queries on. + +**type** + +The type identifier for this query pool. + +**maxQueries** + +Maximum number of queries this pool can hold. + +Default is `2048`. + +## Methods + +### .allocateQueriesForContext( uid : string ) : number + +Allocates a pair of queries for a given render context. + +**uid** + +A unique identifier for the render context. + +**Overrides:** [TimestampQueryPool#allocateQueriesForContext](TimestampQueryPool.html#allocateQueriesForContext) + +**Returns:** The base offset for the allocated queries, or null if allocation failed. + +### .dispose() : Promise (async) + +Dispose of the query pool. + +**Overrides:** [TimestampQueryPool#dispose](TimestampQueryPool.html#dispose) + +**Returns:** A Promise that resolves when the dispose has been executed. + +### .resolveQueriesAsync() : Promise. (async) + +Asynchronously resolves all pending queries and returns the total duration. If there's already a pending resolve operation, returns that promise instead. + +**Overrides:** [TimestampQueryPool#resolveQueriesAsync](TimestampQueryPool.html#resolveQueriesAsync) + +**Returns:** The total duration in milliseconds, or the last valid value if resolution fails. + +## Source + +[src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js) \ No newline at end of file diff --git a/docs/pages/WebXRDepthSensing.html.md b/docs/pages/WebXRDepthSensing.html.md new file mode 100644 index 00000000000000..4ee78660250d65 --- /dev/null +++ b/docs/pages/WebXRDepthSensing.html.md @@ -0,0 +1,65 @@ +# WebXRDepthSensing + +A XR module that manages the access to the Depth Sensing API. + +## Constructor + +### new WebXRDepthSensing() + +Constructs a new depth sensing module. + +## Properties + +### .depthFar : number + +The depth near far. + +### .depthNear : number + +The depth near value. + +### .mesh : Mesh + +A plane mesh for visualizing the depth texture. + +### .texture : ExternalTexture + +An opaque texture representing the depth of the user's environment. + +## Methods + +### .getDepthTexture() : ExternalTexture + +Returns a texture representing the depth of the user's environment. + +**Returns:** The depth texture. + +### .getMesh( cameraXR : ArrayCamera ) : Mesh + +Returns a plane mesh that visualizes the depth texture. + +**cameraXR** + +The XR camera. + +**Returns:** The plane mesh. + +### .init( depthData : XRWebGLDepthInformation, renderState : XRRenderState ) + +Inits the depth sensing module + +**depthData** + +The XR depth data. + +**renderState** + +The XR render state. + +### .reset() + +Resets the module + +## Source + +[src/renderers/webxr/WebXRDepthSensing.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webxr/WebXRDepthSensing.js) \ No newline at end of file diff --git a/docs/pages/WebXRManager.html.md b/docs/pages/WebXRManager.html.md new file mode 100644 index 00000000000000..5f622f76e1ccf6 --- /dev/null +++ b/docs/pages/WebXRManager.html.md @@ -0,0 +1,203 @@ +*Inheritance: EventDispatcher →* + +# WebXRManager + +This class represents an abstraction of the WebXR Device API and is internally used by [WebGLRenderer](WebGLRenderer.html). `WebXRManager` also provides a public interface that allows users to enable/disable XR and perform XR related tasks like for instance retrieving controllers. + +## Properties + +### .cameraAutoUpdate : boolean + +Whether the manager's XR camera should be automatically updated or not. + +Default is `true`. + +### .enabled : boolean + +This flag notifies the renderer to be ready for XR rendering. Set it to `true` if you are going to use XR in your app. + +Default is `false`. + +### .isPresenting : boolean (readonly) + +Whether XR presentation is active or not. + +Default is `false`. + +## Methods + +### .getBaseLayer() : XRWebGLLayer | XRProjectionLayer + +Returns the current base layer. + +This is an `XRProjectionLayer` when the targeted XR device supports the WebXR Layers API, or an `XRWebGLLayer` otherwise. + +**Returns:** The XR base layer. + +### .getBinding() : XRWebGLBinding + +Returns the current XR binding. + +Creates a new binding if needed and the browser is capable of doing so. + +**Returns:** The XR binding. Returns `null` if one cannot be created. + +### .getCamera() : ArrayCamera + +Returns an instance of [ArrayCamera](ArrayCamera.html) which represents the XR camera of the active XR session. For each view it holds a separate camera object. + +The camera's `fov` is currently not used and does not reflect the fov of the XR camera. If you need the fov on app level, you have to compute in manually from the XR camera's projection matrices. + +**Returns:** The XR camera. + +### .getCameraTexture( xrCamera : XRCamera ) : Texture + +Retrieves an opaque texture from the view-aligned XRCamera. Only available during the current animation loop. + +**xrCamera** + +The camera to query. + +**Returns:** An opaque texture representing the current raw camera frame. + +### .getController( index : number ) : Group + +Returns a group representing the `target ray` space of the XR controller. Use this space for visualizing 3D objects that support the user in pointing tasks like UI interaction. + +**index** + +The index of the controller. + +**Returns:** A group representing the `target ray` space. + +### .getControllerGrip( index : number ) : Group + +Returns a group representing the `grip` space of the XR controller. Use this space for visualizing 3D objects that support the user in pointing tasks like UI interaction. + +Note: If you want to show something in the user's hand AND offer a pointing ray at the same time, you'll want to attached the handheld object to the group returned by `getControllerGrip()` and the ray to the group returned by `getController()`. The idea is to have two different groups in two different coordinate spaces for the same WebXR controller. + +**index** + +The index of the controller. + +**Returns:** A group representing the `grip` space. + +### .getDepthSensingMesh() : Mesh + +Returns the depth sensing mesh. + +See [WebXRDepthSensing#getMesh](WebXRDepthSensing.html#getMesh). + +**Returns:** The depth sensing mesh. + +### .getDepthTexture() : Texture + +Returns the current depth texture computed via depth sensing. + +See [WebXRDepthSensing#getDepthTexture](WebXRDepthSensing.html#getDepthTexture). + +**Returns:** The depth texture. + +### .getEnvironmentBlendMode() : 'opaque' | 'additive' | 'alpha-blend' | undefined + +Returns the environment blend mode from the current XR session. + +**Returns:** The environment blend mode. Returns `undefined` when used outside of a XR session. + +### .getFoveation() : number | undefined + +Returns the amount of foveation used by the XR compositor for the projection layer. + +**Returns:** The amount of foveation. + +### .getFrame() : XRFrame + +Returns the current XR frame. + +**Returns:** The XR frame. Returns `null` when used outside a XR session. + +### .getHand( index : number ) : Group + +Returns a group representing the `hand` space of the XR controller. Use this space for visualizing 3D objects that support the user in pointing tasks like UI interaction. + +**index** + +The index of the controller. + +**Returns:** A group representing the `hand` space. + +### .getReferenceSpace() : XRReferenceSpace + +Returns the XR reference space. + +**Returns:** The XR reference space. + +### .getSession() : XRSession + +Returns the current XR session. + +**Returns:** The XR session. Returns `null` when used outside a XR session. + +### .hasDepthSensing() : boolean + +Returns `true` if depth sensing is supported. + +**Returns:** Whether depth sensing is supported or not. + +### .setFoveation( value : number ) + +Sets the foveation value. + +**value** + +A number in the range `[0,1]` where `0` means no foveation (full resolution) and `1` means maximum foveation (the edges render at lower resolution). + +### .setFramebufferScaleFactor( value : number ) + +Sets the framebuffer scale factor. + +This method can not be used during a XR session. + +**value** + +The framebuffer scale factor. + +### .setReferenceSpace( space : XRReferenceSpace ) + +Sets a custom XR reference space. + +**space** + +The XR reference space. + +### .setReferenceSpaceType( value : string ) + +Sets the reference space type. Can be used to configure a spatial relationship with the user's physical environment. Depending on how the user moves in 3D space, setting an appropriate reference space can improve tracking. Default is `local-floor`. Valid values can be found here https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference\_space\_types. + +This method can not be used during a XR session. + +**value** + +The reference space type. + +### .setSession( value : XRSession ) : Promise (async) + +After a XR session has been requested usually with one of the `*Button` modules, it is injected into the renderer with this method. This method triggers the start of the actual XR rendering. + +**value** + +The XR session to set. + +**Returns:** A Promise that resolves when the session has been set. + +### .updateCamera( camera : Camera ) + +Updates the state of the XR camera. Use this method on app level if you set `cameraAutoUpdate` to `false`. The method requires the non-XR camera of the scene as a parameter. The passed in camera's transformation is automatically adjusted to the position of the XR camera when calling this method. + +**camera** + +The camera. + +## Source + +[src/renderers/webxr/WebXRManager.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/webxr/WebXRManager.js) \ No newline at end of file diff --git a/docs/pages/Wireframe.html.md b/docs/pages/Wireframe.html.md new file mode 100644 index 00000000000000..a5a5a077706592 --- /dev/null +++ b/docs/pages/Wireframe.html.md @@ -0,0 +1,58 @@ +*Inheritance: EventDispatcher → Object3D → Mesh →* + +# Wireframe + +A class for creating wireframes based on wide lines. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import the class from `lines/webgpu/Wireframe.js`. + +## Code Example + +```js +const geometry = new THREE.IcosahedronGeometry(); +const wireframeGeometry = new WireframeGeometry2( geo ); +const wireframe = new Wireframe( wireframeGeometry, material ); +scene.add( wireframe ); +``` + +## Import + +Wireframe is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { Wireframe } from 'three/addons/lines/Wireframe.js'; +``` + +## Constructor + +### new Wireframe( geometry : LineSegmentsGeometry, material : LineMaterial ) + +Constructs a new wireframe. + +**geometry** + +The line geometry. + +**material** + +The line material. + +## Properties + +### .isWireframe : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Methods + +### .computeLineDistances() : Wireframe + +Computes an array of distance values which are necessary for rendering dashed lines. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line. + +**Returns:** A reference to this instance. + +## Source + +[examples/jsm/lines/Wireframe.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/Wireframe.js) \ No newline at end of file diff --git a/docs/pages/WireframeGeometry.html.md b/docs/pages/WireframeGeometry.html.md new file mode 100644 index 00000000000000..311b617884928a --- /dev/null +++ b/docs/pages/WireframeGeometry.html.md @@ -0,0 +1,41 @@ +*Inheritance: EventDispatcher → BufferGeometry →* + +# WireframeGeometry + +Can be used as a helper object to visualize a geometry as a wireframe. + +Note: It is not yet possible to serialize/deserialize instances of this class. + +## Code Example + +```js +const geometry = new THREE.SphereGeometry(); +const wireframe = new THREE.WireframeGeometry( geometry ); +const line = new THREE.LineSegments( wireframe ); +line.material.depthWrite = false; +line.material.opacity = 0.25; +line.material.transparent = true; +scene.add( line ); +``` + +## Constructor + +### new WireframeGeometry( geometry : BufferGeometry ) + +Constructs a new wireframe geometry. + +**geometry** + +The geometry. + +Default is `null`. + +## Properties + +### .parameters : Object + +Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. + +## Source + +[src/geometries/WireframeGeometry.js](https://github.com/mrdoob/three.js/blob/master/src/geometries/WireframeGeometry.js) \ No newline at end of file diff --git a/docs/pages/WireframeGeometry2.html.md b/docs/pages/WireframeGeometry2.html.md new file mode 100644 index 00000000000000..a7697b184d3efa --- /dev/null +++ b/docs/pages/WireframeGeometry2.html.md @@ -0,0 +1,44 @@ +*Inheritance: InstancedBufferGeometry → LineSegmentsGeometry →* + +# WireframeGeometry2 + +A special type of line segments geometry intended for wireframe rendering. + +This is used in [Wireframe](Wireframe.html) to describe the shape. + +## Code Example + +```js +const geometry = new THREE.IcosahedronGeometry(); +const wireframeGeometry = new WireframeGeometry2( geo ); +``` + +## Import + +WireframeGeometry2 is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { WireframeGeometry2 } from 'three/addons/lines/WireframeGeometry2.js'; +``` + +## Constructor + +### new WireframeGeometry2( geometry : BufferGeometry ) + +Constructs a new wireframe geometry. + +**geometry** + +The geometry to render the wireframe for. + +## Properties + +### .isWireframeGeometry2 : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[examples/jsm/lines/WireframeGeometry2.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/WireframeGeometry2.js) \ No newline at end of file diff --git a/docs/pages/WoodNodeMaterial.html.md b/docs/pages/WoodNodeMaterial.html.md new file mode 100644 index 00000000000000..7d92cec257f196 --- /dev/null +++ b/docs/pages/WoodNodeMaterial.html.md @@ -0,0 +1,23 @@ +# WoodNodeMaterial + +Procedural wood material using TSL (Three.js Shading Language). + +Usage examples: + +// Using presets (recommended for common wood types) const material = WoodNodeMaterial.fromPreset('walnut', 'gloss'); + +// Using custom parameters (for advanced customization) const material = new WoodNodeMaterial({ centerSize: 1.2, ringThickness: 1/40, darkGrainColor: new THREE.Color('#2a1a0a'), lightGrainColor: new THREE.Color('#8b4513'), clearcoat: 1, clearcoatRoughness: 0.3 }); + +// Mixing presets with custom overrides const walnutParams = GetWoodPreset('walnut', 'raw'); const material = new WoodNodeMaterial({ ...walnutParams, ringThickness: 1/50, // Override specific parameter clearcoat: 1 // Add finish }); + +## Constructor + +### new WoodNodeMaterial() + +## Classes + +[WoodNodeMaterial](WoodNodeMaterial.html) + +## Source + +[examples/jsm/materials/WoodNodeMaterial.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/materials/WoodNodeMaterial.js) \ No newline at end of file diff --git a/docs/pages/WorkerPool.html.md b/docs/pages/WorkerPool.html.md new file mode 100644 index 00000000000000..c465d38b535b64 --- /dev/null +++ b/docs/pages/WorkerPool.html.md @@ -0,0 +1,95 @@ +# WorkerPool + +A simple pool for managing Web Workers. + +## Import + +WorkerPool is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { WorkerPool } from 'three/addons/utils/WorkerPool.js'; +``` + +## Constructor + +### new WorkerPool( pool : number ) + +Constructs a new Worker pool. + +**pool** + +The size of the pool. + +Default is `4`. + +## Classes + +[WorkerPool](WorkerPool.html) + +## Properties + +### .pool : number + +The size of the pool. + +Default is `4`. + +### .queue : Array. + +A message queue. + +### .workerCreator : function + +A factory function for creating workers. + +### .workerStatus : number + +The current worker status. + +### .workers : Array. + +An array of Workers. + +### .workersResolve : Array. + +An array with resolve functions for messages. + +## Methods + +### .dispose() + +Terminates all Workers of this pool. Call this method whenever this Worker pool is no longer used in your app. + +### .postMessage( msg : Object, transfer : Array. ) : Promise + +Post a message to an idle Worker. If no Worker is available, the message is pushed into a message queue for later processing. + +**msg** + +The message. + +**transfer** + +An array with array buffers for data transfer. + +**Returns:** A Promise that resolves when the message has been processed. + +### .setWorkerCreator( workerCreator : function ) + +Sets a function that is responsible for creating Workers. + +**workerCreator** + +The worker creator function. + +### .setWorkerLimit( pool : number ) + +Sets the Worker limit + +**pool** + +The size of the pool. + +## Source + +[examples/jsm/utils/WorkerPool.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/WorkerPool.js) \ No newline at end of file diff --git a/docs/pages/WorkgroupInfoElementNode.html.md b/docs/pages/WorkgroupInfoElementNode.html.md new file mode 100644 index 00000000000000..2fff2713b1c8b0 --- /dev/null +++ b/docs/pages/WorkgroupInfoElementNode.html.md @@ -0,0 +1,31 @@ +*Inheritance: EventDispatcher → Node → ArrayElementNode →* + +# WorkgroupInfoElementNode + +Represents an element of a 'workgroup' scoped buffer. + +## Constructor + +### new WorkgroupInfoElementNode( workgroupInfoNode : Node, indexNode : Node ) + +Constructs a new workgroup info element node. + +**workgroupInfoNode** + +The workgroup info node. + +**indexNode** + +The index node that defines the element access. + +## Properties + +### .isWorkgroupInfoElementNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +## Source + +[src/nodes/gpgpu/WorkgroupInfoNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/gpgpu/WorkgroupInfoNode.js) \ No newline at end of file diff --git a/docs/pages/WorkgroupInfoNode.html.md b/docs/pages/WorkgroupInfoNode.html.md new file mode 100644 index 00000000000000..9d08f295bcbc73 --- /dev/null +++ b/docs/pages/WorkgroupInfoNode.html.md @@ -0,0 +1,127 @@ +*Inheritance: EventDispatcher → Node →* + +# WorkgroupInfoNode + +A node allowing the user to create a 'workgroup' scoped buffer within the context of a compute shader. Typically, workgroup scoped buffers are created to hold data that is transferred from a global storage scope into a local workgroup scope. For invocations within a workgroup, data access speeds on 'workgroup' scoped buffers can be significantly faster than similar access operations on globally accessible storage buffers. + +This node can only be used with a WebGPU backend. + +## Constructor + +### new WorkgroupInfoNode( scope : string, bufferType : string, bufferCount : number ) + +Constructs a new buffer scoped to type scope. + +**scope** + +TODO. + +**bufferType** + +The data type of a 'workgroup' scoped buffer element. + +**bufferCount** + +The number of elements in the buffer. + +Default is `0`. + +## Properties + +### .bufferCount : number + +The buffer count. + +Default is `0`. + +### .bufferType : string + +The buffer type. + +### .elementType : string + +The data type of the array buffer. + +### .isWorkgroupInfoNode : boolean (readonly) + +This flag can be used for type testing. + +Default is `true`. + +### .name : string + +The name of the workgroup scoped buffer. + +Default is `''`. + +**Overrides:** [Node#name](Node.html#name) + +### .scope : string + +TODO. + +## Methods + +### .element( indexNode : IndexNode ) : WorkgroupInfoElementNode + +This method can be used to access elements via an index node. + +**indexNode** + +indexNode. + +**Returns:** A reference to an element. + +### .getElementType() : string + +The data type of the array buffer. + +**Overrides:** [Node#getElementType](Node.html#getElementType) + +**Returns:** The element type. + +### .getInputType( builder : NodeBuilder ) : string + +Overwrites the default implementation since the input type is inferred from the scope. + +**builder** + +The current node builder. + +**Returns:** The input type. + +### .label( name : string ) : WorkgroupInfoNode + +Sets the name/label of this node. + +**name** + +The name to set. + +**Deprecated:** Yes + +**Returns:** A reference to this node. + +### .setName( name : string ) : WorkgroupInfoNode + +Sets the name of this node. + +**name** + +The name to set. + +**Returns:** A reference to this node. + +### .setScope( scope : string ) : WorkgroupInfoNode + +Sets the scope of this node. + +**scope** + +The scope to set. + +**Returns:** A reference to this node. + +## Source + +[src/nodes/gpgpu/WorkgroupInfoNode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/gpgpu/WorkgroupInfoNode.js) \ No newline at end of file diff --git a/docs/pages/XRButton.html.md b/docs/pages/XRButton.html.md new file mode 100644 index 00000000000000..2ff41724fe0608 --- /dev/null +++ b/docs/pages/XRButton.html.md @@ -0,0 +1,39 @@ +# XRButton + +A utility class for creating a button that allows to initiate immersive XR sessions based on WebXR. The button can be created with a factory method and then appended ot the website's DOM. + +Compared to [ARButton](ARButton.html) and [VRButton](VRButton.html), this class will try to offer an immersive AR session first. If the device does not support this type of session, it uses an immersive VR session. + +## Code Example + +```js +document.body.appendChild( XRButton.createButton( renderer ) ); +``` + +## Import + +XRButton is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { XRButton } from 'three/addons/webxr/XRButton.js'; +``` + +## Static Methods + +### .createButton( renderer : WebGLRenderer | WebGPURenderer, sessionInit : XRSessionInit ) : HTMLElement + +Constructs a new XR button. + +**renderer** + +The renderer. + +**sessionInit** + +The a configuration object for the AR session. + +**Returns:** The button or an error message if WebXR isn't supported. + +## Source + +[examples/jsm/webxr/XRButton.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRButton.js) \ No newline at end of file diff --git a/docs/pages/XRControllerModel.html.md b/docs/pages/XRControllerModel.html.md new file mode 100644 index 00000000000000..3d109803c9c0a8 --- /dev/null +++ b/docs/pages/XRControllerModel.html.md @@ -0,0 +1,53 @@ +*Inheritance: EventDispatcher → Object3D →* + +# XRControllerModel + +Represents a XR controller model. + +## Constructor + +### new XRControllerModel() + +Constructs a new XR controller model. + +## Properties + +### .envMap : Texture + +The controller's environment map. + +Default is `null`. + +### .motionController : MotionController + +The motion controller. + +Default is `null`. + +## Methods + +### .setEnvironmentMap( envMap : Texture ) : XRControllerModel + +Sets an environment map that is applied to the controller model. + +**envMap** + +The environment map to apply. + +**Returns:** A reference to this instance. + +### .updateMatrixWorld( force : boolean ) + +Overwritten with a custom implementation. Polls data from the XRInputSource and updates the model's components to match the real world data. + +**force** + +When set to `true`, a recomputation of world matrices is forced even when [Object3D#matrixWorldAutoUpdate](Object3D.html#matrixWorldAutoUpdate) is set to `false`. + +Default is `false`. + +**Overrides:** [Object3D#updateMatrixWorld](Object3D.html#updateMatrixWorld) + +## Source + +[examples/jsm/webxr/XRControllerModelFactory.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRControllerModelFactory.js) \ No newline at end of file diff --git a/docs/pages/XRControllerModelFactory.html.md b/docs/pages/XRControllerModelFactory.html.md new file mode 100644 index 00000000000000..2c540ce639009b --- /dev/null +++ b/docs/pages/XRControllerModelFactory.html.md @@ -0,0 +1,84 @@ +# XRControllerModelFactory + +Allows to create controller models for WebXR controllers that can be added as a visual representation to your scene. `XRControllerModelFactory` will automatically fetch controller models that match what the user is holding as closely as possible. The models should be attached to the object returned from getControllerGrip in order to match the orientation of the held device. + +This module depends on the [motion-controllers](https://github.com/immersive-web/webxr-input-profiles/blob/main/packages/motion-controllers/README.md) third-part library. + +## Code Example + +```js +const controllerModelFactory = new XRControllerModelFactory(); +const controllerGrip = renderer.xr.getControllerGrip( 0 ); +controllerGrip.add( controllerModelFactory.createControllerModel( controllerGrip ) ); +scene.add( controllerGrip ); +``` + +## Import + +XRControllerModelFactory is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; +``` + +## Constructor + +### new XRControllerModelFactory( gltfLoader : GLTFLoader, onLoad : function ) + +Constructs a new XR controller model factory. + +**gltfLoader** + +A glTF loader that is used to load controller models. + +Default is `null`. + +**onLoad** + +A callback that is executed when a controller model has been loaded. + +Default is `null`. + +## Properties + +### .gltfLoader : GLTFLoader + +A glTF loader that is used to load controller models. + +Default is `null`. + +### .onLoad : function + +A callback that is executed when a controller model has been loaded. + +Default is `null`. + +### .path : string + +The path to the model repository. + +## Methods + +### .createControllerModel( controller : Group ) : XRControllerModel + +Creates a controller model for the given WebXR controller. + +**controller** + +The controller. + +**Returns:** The XR controller model. + +### .setPath( path : string ) : XRControllerModelFactory + +Sets the path to the model repository. + +**path** + +The path to set. + +**Returns:** A reference to this instance. + +## Source + +[examples/jsm/webxr/XRControllerModelFactory.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRControllerModelFactory.js) \ No newline at end of file diff --git a/docs/pages/XREstimatedLight.html.md b/docs/pages/XREstimatedLight.html.md new file mode 100644 index 00000000000000..b87c4470e33f09 --- /dev/null +++ b/docs/pages/XREstimatedLight.html.md @@ -0,0 +1,59 @@ +*Inheritance: EventDispatcher → Object3D → Group →* + +# XREstimatedLight + +This class can be used to represent the environmental light of a XR session. It relies on the WebXR Lighting Estimation API. + +## Import + +XREstimatedLight is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { XREstimatedLight } from 'three/addons/webxr/XREstimatedLight.js'; +``` + +## Constructor + +### new XREstimatedLight( renderer : WebGLRenderer, environmentEstimation : boolean ) + +Constructs a new light. + +**renderer** + +The renderer. + +**environmentEstimation** + +Whether to use environment estimation or not. + +Default is `true`. + +## Classes + +[XREstimatedLight](XREstimatedLight.html) + +## Properties + +### .directionalLight : DirectionalLight + +Represents the primary light from the XR environment. + +### .environment : Texture + +Will be set to a cube map in the SessionLightProbe if environment estimation is available and requested. + +Default is `null`. + +### .lightProbe : LightProbe + +The light probe that represents the estimated light. + +## Methods + +### .dispose() + +Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. + +## Source + +[examples/jsm/webxr/XREstimatedLight.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XREstimatedLight.js) \ No newline at end of file diff --git a/docs/pages/XRHandMeshModel.html.md b/docs/pages/XRHandMeshModel.html.md new file mode 100644 index 00000000000000..b15546fe51aa08 --- /dev/null +++ b/docs/pages/XRHandMeshModel.html.md @@ -0,0 +1,69 @@ +# XRHandMeshModel + +Represents one of the hand model types [XRHandModelFactory](XRHandModelFactory.html) might produce depending on the selected profile. `XRHandMeshModel` represents a hand with a custom asset. + +## Import + +XRHandMeshModel is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { XRHandMeshModel } from 'three/addons/webxr/XRHandMeshModel.js'; +``` + +## Constructor + +### new XRHandMeshModel( handModel : XRHandModel, controller : Group, path : string, handedness : XRHandedness, loader : Loader, onLoad : function ) + +Constructs a new XR hand mesh model. + +**handModel** + +The hand model. + +**controller** + +The WebXR controller. + +**path** + +The model path. + +**handedness** + +The handedness of the XR input source. + +**loader** + +The loader. If not provided, an instance of `GLTFLoader` will be used to load models. + +Default is `null`. + +**onLoad** + +A callback that is executed when a controller model has been loaded. + +Default is `null`. + +## Properties + +### .bones : Array. + +An array of bones representing the bones of the hand skeleton. + +### .controller : Group + +The WebXR controller. + +### .handModel : XRHandModel + +The hand model. + +## Methods + +### .updateMesh() + +Updates the mesh based on the tracked XR joints data. + +## Source + +[examples/jsm/webxr/XRHandMeshModel.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRHandMeshModel.js) \ No newline at end of file diff --git a/docs/pages/XRHandModel.html.md b/docs/pages/XRHandModel.html.md new file mode 100644 index 00000000000000..35573e82b8a256 --- /dev/null +++ b/docs/pages/XRHandModel.html.md @@ -0,0 +1,57 @@ +*Inheritance: EventDispatcher → Object3D →* + +# XRHandModel + +Represents a XR hand model. + +## Constructor + +### new XRHandModel( controller : Group ) + +Constructs a new XR hand model. + +**controller** + +The hand controller. + +## Properties + +### .controller : Group + +The hand controller. + +### .envMap : Texture + +The controller's environment map. + +Default is `null`. + +### .mesh : Mesh + +The model mesh. + +Default is `null`. + +### .motionController : MotionController + +The motion controller. + +Default is `null`. + +## Methods + +### .updateMatrixWorld( force : boolean ) + +Overwritten with a custom implementation. Makes sure the motion controller updates the mesh. + +**force** + +When set to `true`, a recomputation of world matrices is forced even when [Object3D#matrixWorldAutoUpdate](Object3D.html#matrixWorldAutoUpdate) is set to `false`. + +Default is `false`. + +**Overrides:** [Object3D#updateMatrixWorld](Object3D.html#updateMatrixWorld) + +## Source + +[examples/jsm/webxr/XRHandModelFactory.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRHandModelFactory.js) \ No newline at end of file diff --git a/docs/pages/XRHandModelFactory.html.md b/docs/pages/XRHandModelFactory.html.md new file mode 100644 index 00000000000000..4ed5780c976030 --- /dev/null +++ b/docs/pages/XRHandModelFactory.html.md @@ -0,0 +1,88 @@ +# XRHandModelFactory + +Similar to [XRControllerModelFactory](XRControllerModelFactory.html), this class allows to create hand models for WebXR controllers that can be added as a visual representation to your scene. + +## Code Example + +```js +const handModelFactory = new XRHandModelFactory(); +const hand = renderer.xr.getHand( 0 ); +hand.add( handModelFactory.createHandModel( hand ) ); +scene.add( hand ); +``` + +## Import + +XRHandModelFactory is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { XRHandModelFactory } from 'three/addons/webxr/XRHandModelFactory.js'; +``` + +## Constructor + +### new XRHandModelFactory( gltfLoader : GLTFLoader, onLoad : function ) + +Constructs a new XR hand model factory. + +**gltfLoader** + +A glTF loader that is used to load hand models. + +Default is `null`. + +**onLoad** + +A callback that is executed when a hand model has been loaded. + +Default is `null`. + +## Properties + +### .gltfLoader : GLTFLoader + +A glTF loader that is used to load hand models. + +Default is `null`. + +### .onLoad : function + +A callback that is executed when a hand model has been loaded. + +Default is `null`. + +### .path : string + +The path to the model repository. + +Default is `null`. + +## Methods + +### .createHandModel( controller : Group, profile : 'spheres' | 'boxes' | 'mesh' ) : XRHandModel + +Creates a controller model for the given WebXR hand controller. + +**controller** + +The hand controller. + +**profile** + +The model profile that defines the model type. + +**Returns:** The XR hand model. + +### .setPath( path : string ) : XRHandModelFactory + +Sets the path to the hand model repository. + +**path** + +The path to set. + +**Returns:** A reference to this instance. + +## Source + +[examples/jsm/webxr/XRHandModelFactory.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRHandModelFactory.js) \ No newline at end of file diff --git a/docs/pages/XRHandPrimitiveModel.html.md b/docs/pages/XRHandPrimitiveModel.html.md new file mode 100644 index 00000000000000..39b7f03d3c4d3b --- /dev/null +++ b/docs/pages/XRHandPrimitiveModel.html.md @@ -0,0 +1,74 @@ +# XRHandPrimitiveModel + +Represents one of the hand model types [XRHandModelFactory](XRHandModelFactory.html) might produce depending on the selected profile. `XRHandPrimitiveModel` represents a hand with sphere or box primitives according to the selected `primitive` option. + +## Import + +XRHandPrimitiveModel is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { XRHandPrimitiveModel } from 'three/addons/webxr/XRHandPrimitiveModel.js'; +``` + +## Constructor + +### new XRHandPrimitiveModel( handModel : XRHandModel, controller : Group, path : string, handedness : XRHandedness, options : XRHandPrimitiveModel~Options ) + +Constructs a new XR hand primitive model. + +**handModel** + +The hand model. + +**controller** + +The WebXR controller. + +**path** + +The model path. + +**handedness** + +The handedness of the XR input source. + +**options** + +The model options. + +## Properties + +### .controller : Group + +The WebXR controller. + +### .envMap : Texture + +The model's environment map. + +Default is `null`. + +### .handModel : XRHandModel + +The hand model. + +## Methods + +### .updateMesh() + +Updates the mesh based on the tracked XR joints data. + +## Type Definitions + +### .Options + +Constructor options of `XRHandPrimitiveModel`. + +**primitive** +'box' | 'sphere' + +The primitive type. + +## Source + +[examples/jsm/webxr/XRHandPrimitiveModel.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRHandPrimitiveModel.js) \ No newline at end of file diff --git a/docs/pages/XRManager.html.md b/docs/pages/XRManager.html.md new file mode 100644 index 00000000000000..f9aab0373d2cd6 --- /dev/null +++ b/docs/pages/XRManager.html.md @@ -0,0 +1,285 @@ +*Inheritance: EventDispatcher →* + +# XRManager + +The XR manager is built on top of the WebXR Device API to manage XR sessions with `WebGPURenderer`. + +XR is currently only supported with a WebGL 2 backend. + +## Constructor + +### new XRManager( renderer : Renderer, multiview : boolean ) + +Constructs a new XR manager. + +**renderer** + +The renderer. + +**multiview** + +Enables multiview if the device supports it. + +Default is `false`. + +## Properties + +### .cameraAutoUpdate : boolean + +Whether the XR camera should automatically be updated or not. + +Default is `true`. + +### .enabled : boolean + +This flag globally enables XR rendering. + +Default is `false`. + +### .isPresenting : boolean (readonly) + +Whether the XR device is currently presenting or not. + +Default is `false`. + +## Methods + +### .createCylinderLayer( radius : number, centralAngle : number, aspectratio : number, translation : Vector3, quaternion : Quaternion, pixelwidth : number, pixelheight : number, rendercall : function, attributes : Object ) : Mesh + +This method can be used in XR applications to create a cylindrical layer that presents a separate rendered scene. + +**radius** + +The radius of the cylinder in world units. + +**centralAngle** + +The central angle of the cylinder in radians. + +**aspectratio** + +The aspect ratio. + +**translation** + +The position/translation of the layer plane in world units. + +**quaternion** + +The orientation of the layer plane expressed as a quaternion. + +**pixelwidth** + +The width of the layer's render target in pixels. + +**pixelheight** + +The height of the layer's render target in pixels. + +**rendercall** + +A callback function that renders the layer. Similar to code in the default animation loop, this method can be used to update/transform 3D object in the layer's scene. + +**attributes** + +Allows to configure the layer's render target. + +Default is `{}`. + +**Returns:** A mesh representing the cylindrical XR layer. This mesh should be added to the XR scene. + +### .createQuadLayer( width : number, height : number, translation : Vector3, quaternion : Quaternion, pixelwidth : number, pixelheight : number, rendercall : function, attributes : Object ) : Mesh + +This method can be used in XR applications to create a quadratic layer that presents a separate rendered scene. + +**width** + +The width of the layer plane in world units. + +**height** + +The height of the layer plane in world units. + +**translation** + +The position/translation of the layer plane in world units. + +**quaternion** + +The orientation of the layer plane expressed as a quaternion. + +**pixelwidth** + +The width of the layer's render target in pixels. + +**pixelheight** + +The height of the layer's render target in pixels. + +**rendercall** + +A callback function that renders the layer. Similar to code in the default animation loop, this method can be used to update/transform 3D object in the layer's scene. + +**attributes** + +Allows to configure the layer's render target. + +Default is `{}`. + +**Returns:** A mesh representing the quadratic XR layer. This mesh should be added to the XR scene. + +### .getBinding() : XRWebGLBinding + +Returns the current XR binding. + +Creates a new binding if needed and the browser is capable of doing so. + +**Returns:** The XR binding. Returns `null` if one cannot be created. + +### .getCamera() : ArrayCamera + +Returns the XR camera. + +**Returns:** The XR camera. + +### .getController( index : number ) : Group + +Returns an instance of `THREE.Group` that represents the transformation of a XR controller in target ray space. The requested controller is defined by the given index. + +**index** + +The index of the XR controller. + +**Returns:** A group that represents the controller's transformation. + +### .getControllerGrip( index : number ) : Group + +Returns an instance of `THREE.Group` that represents the transformation of a XR controller in grip space. The requested controller is defined by the given index. + +**index** + +The index of the XR controller. + +**Returns:** A group that represents the controller's transformation. + +### .getEnvironmentBlendMode() : 'opaque' | 'additive' | 'alpha-blend' | undefined + +Returns the environment blend mode from the current XR session. + +**Returns:** The environment blend mode. Returns `undefined` when used outside of a XR session. + +### .getFoveation() : number | undefined + +Returns the foveation value. + +**Returns:** The foveation value. Returns `undefined` if no base or projection layer is defined. + +### .getFrame() : XRFrame + +Returns the current XR frame. + +**Returns:** The XR frame. Returns `null` when used outside a XR session. + +### .getFramebufferScaleFactor() : number + +Returns the framebuffer scale factor. + +**Returns:** The framebuffer scale factor. + +### .getHand( index : number ) : Group + +Returns an instance of `THREE.Group` that represents the transformation of a XR controller in hand space. The requested controller is defined by the given index. + +**index** + +The index of the XR controller. + +**Returns:** A group that represents the controller's transformation. + +### .getReferenceSpace() : XRReferenceSpace + +Returns the XR reference space. + +**Returns:** The XR reference space. + +### .getReferenceSpaceType() : XRReferenceSpaceType + +Returns the reference space type. + +**Returns:** The reference space type. + +### .getSession() : XRSession + +Returns the current XR session. + +**Returns:** The XR session. Returns `null` when used outside a XR session. + +### .renderLayers() + +Renders the XR layers that have been previously added to the scene. + +This method is usually called in your animation loop before rendering the actual scene via `renderer.render( scene, camera );`. + +### .setFoveation( foveation : number ) + +Sets the foveation value. + +**foveation** + +A number in the range `[0,1]` where `0` means no foveation (full resolution) and `1` means maximum foveation (the edges render at lower resolution). + +### .setFramebufferScaleFactor( factor : number ) + +Sets the framebuffer scale factor. + +This method can not be used during a XR session. + +**factor** + +The framebuffer scale factor. + +### .setReferenceSpace( space : XRReferenceSpace ) + +Sets a custom XR reference space. + +**space** + +The XR reference space. + +### .setReferenceSpaceType( type : XRReferenceSpaceType ) + +Sets the reference space type. + +This method can not be used during a XR session. + +**type** + +The reference space type. + +### .setSession( session : XRSession ) : Promise (async) + +After a XR session has been requested usually with one of the `*Button` modules, it is injected into the renderer with this method. This method triggers the start of the actual XR rendering. + +**session** + +The XR session to set. + +**Returns:** A Promise that resolves when the session has been set. + +### .updateCamera( camera : PerspectiveCamera ) + +This method is called by the renderer per frame and updates the XR camera and it sub cameras based on the given camera. The given camera is the "user" camera created on application level and used for non-XR rendering. + +**camera** + +The camera. + +### .useMultiview() : boolean + +Returns `true` if the engine renders to a multiview target. + +**Returns:** Whether the engine renders to a multiview render target or not. + +## Source + +[src/renderers/common/XRManager.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/common/XRManager.js) \ No newline at end of file diff --git a/docs/pages/XRPlanes.html.md b/docs/pages/XRPlanes.html.md new file mode 100644 index 00000000000000..73e7302d6e57f7 --- /dev/null +++ b/docs/pages/XRPlanes.html.md @@ -0,0 +1,34 @@ +*Inheritance: EventDispatcher → Object3D →* + +# XRPlanes + +A utility class for the WebXR Plane Detection Module. If planes are detected by WebXR, this class will automatically add them as thin box meshes to the scene when below code snippet is used. + +## Code Example + +```js +const planes = new XRPlanes( renderer ); +scene.add( planes ); +``` + +## Import + +XRPlanes is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { XRPlanes } from 'three/addons/webxr/XRPlanes.js'; +``` + +## Constructor + +### new XRPlanes( renderer : WebGLRenderer | WebGPURenderer ) + +Constructs a new XR plane container. + +**renderer** + +The renderer. + +## Source + +[examples/jsm/webxr/XRPlanes.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRPlanes.js) \ No newline at end of file diff --git a/docs/pages/XYZLoader.html.md b/docs/pages/XYZLoader.html.md new file mode 100644 index 00000000000000..1a4ff91a0b0893 --- /dev/null +++ b/docs/pages/XYZLoader.html.md @@ -0,0 +1,71 @@ +*Inheritance: Loader →* + +# XYZLoader + +A loader for the XYZ format. + +XYZ is a very simple format for storing point clouds. The layouts `XYZ` (points) and `XYZRGB` (points + colors) are supported. + +## Code Example + +```js +const loader = new XYZLoader(); +const geometry = await loader.loadAsync( 'models/xyz/helix_201.xyz' ); +geometry.center(); +const vertexColors = ( geometry.hasAttribute( 'color' ) === true ); +const material = new THREE.PointsMaterial( { size: 0.1, vertexColors: vertexColors } ); +const points = new THREE.Points( geometry, material ); +scene.add( points ); +``` + +## Import + +XYZLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { XYZLoader } from 'three/addons/loaders/XYZLoader.js'; +``` + +## Constructor + +### new XYZLoader() + +## Methods + +### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback ) + +Starts loading from the given URL and passes the loaded XYZ asset to the `onLoad()` callback. + +**url** + +The path/URL of the file to be loaded. This can also be a data URI. + +**onLoad** + +Executed when the loading process has been finished. + +**onProgress** + +Executed while the loading is in progress. + +**onError** + +Executed when errors occur. + +**Overrides:** [Loader#load](Loader.html#load) + +### .parse( text : string ) : BufferGeometry + +Parses the given XYZ data and returns the resulting geometry. + +**text** + +The raw XYZ data as a string. + +**Overrides:** [Loader#parse](Loader.html#parse) + +**Returns:** The geometry representing the point cloud. + +## Source + +[examples/jsm/loaders/XYZLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/XYZLoader.js) \ No newline at end of file diff --git a/docs/pages/global.html.md b/docs/pages/global.html.md new file mode 100644 index 00000000000000..5eaa0b04ffb748 --- /dev/null +++ b/docs/pages/global.html.md @@ -0,0 +1,2180 @@ +# Global + +## Properties + +### .ACESFilmicToneMapping : number (constant) + +ACES Filmic tone mapping. + +### .AddEquation : number (constant) + +A `source + destination` blending equation. + +### .AddOperation : number (constant) + +Adds the two colors. + +### .AdditiveAnimationBlendMode : number (constant) + +Additive animation blend mode. Can be used to layer motions on top of each other to build complex performances from smaller re-usable assets. + +### .AdditiveBlending : number (constant) + +Represents additive blending. + +### .AgXToneMapping : number (constant) + +AgX tone mapping. + +### .AlphaFormat : number (constant) + +Discards the red, green and blue components and reads just the alpha component. + +### .AlwaysCompare : number (constant) + +Always pass. + +### .AlwaysDepth : number (constant) + +Always pass. + +### .AlwaysStencilFunc : number (constant) + +Will always return true. + +### .AttachedBindMode : string (constant) + +The skinned mesh shares the same world space as the skeleton. + +### .BackSide : number (constant) + +Only back faces are rendered. + +### .BasicDepthPacking : number (constant) + +The depth value is inverted (1.0 - z) for visualization purposes. + +### .BasicShadowMap : number (constant) + +Gives unfiltered shadow maps - fastest, but lowest quality. + +### .ByteType : number (constant) + +A byte data type for textures. + +### .CineonToneMapping : number (constant) + +Cineon tone mapping. + +### .ClampToEdgeWrapping : number (constant) + +The last pixel of the texture stretches to the edge of the mesh. + +### .Compatibility : Object (constant) + +Compatibility flags for features that may not be supported across all platforms. + +### .ConstantAlphaFactor : number (constant) + +Multiplies all colors by a constant alpha value. + +### .ConstantColorFactor : number (constant) + +Multiplies all colors by a constant color. + +### .CubeReflectionMapping : number (constant) + +Reflection mapping for cube textures. + +### .CubeRefractionMapping : number (constant) + +Refraction mapping for cube textures. + +### .CubeUVReflectionMapping : number (constant) + +Reflection mapping for PMREM textures. + +### .CullFaceBack : number (constant) + +Culls back faces. + +### .CullFaceFront : number (constant) + +Culls front faces. + +### .CullFaceFrontBack : number (constant) + +Culls both front and back faces. + +### .CullFaceNone : number (constant) + +Disables face culling. + +### .CustomBlending : number (constant) + +Represents custom blending. + +### .CustomToneMapping : number (constant) + +Custom tone mapping. + +Expects a custom implementation by modifying shader code of the material's fragment shader. + +### .DATA (constant) + +Precomputed DFG LUT for Image-Based Lighting Resolution: 16x16 Samples: 4096 per texel Format: RG16F (2 half floats per texel: scale, bias) + +### .DecrementStencilOp : number (constant) + +Decrements the current stencil buffer value. Clamps to `0`. + +### .DecrementWrapStencilOp : number (constant) + +Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of `0`. + +### .DefaultLoadingManager : LoadingManager (constant) + +The global default loading manager. + +### .DepthFormat : number (constant) + +Reads each element as a single depth value, converts it to floating point, and clamps to the range `[0,1]`. + +### .DepthStencilFormat : number (constant) + +Reads each element is a pair of depth and stencil values. The depth component of the pair is interpreted as in `DepthFormat`. The stencil component is interpreted based on the depth + stencil internal format. + +### .DetachedBindMode : string (constant) + +The skinned mesh does not share the same world space as the skeleton. This is useful when a skeleton is shared across multiple skinned meshes. + +### .DoubleSide : number (constant) + +Both front and back faces are rendered. + +### .DstAlphaFactor : number (constant) + +Multiplies all colors by the destination alpha value. + +### .DstColorFactor : number (constant) + +Multiplies all colors by the destination color. + +### .DynamicCopyUsage : number (constant) + +The contents are intended to be respecified repeatedly by reading data from the 3D API, and used many times as the source for WebGL drawing and image specification commands. + +### .DynamicDrawUsage : number (constant) + +The contents are intended to be respecified repeatedly by the application, and used many times as the source for drawing and image specification commands. + +### .DynamicReadUsage : number (constant) + +The contents are intended to be respecified repeatedly by reading data from the 3D API, and queried many times by the application. + +### .EqualCompare : number (constant) + +Pass if the incoming value equals the texture value. + +### .EqualDepth : number (constant) + +Pass if the incoming value equals the depth buffer value. + +### .EqualStencilFunc : number (constant) + +Will return true if the stencil reference value is equal to the current stencil value. + +### .EquirectangularReflectionMapping : number (constant) + +Reflection mapping for equirectangular textures. + +### .EquirectangularRefractionMapping : number (constant) + +Refraction mapping for equirectangular textures. + +### .FloatType : number (constant) + +A float data type for textures. + +### .FrontSide : number (constant) + +Only front faces are rendered. + +### .GLSL1 : string (constant) + +GLSL 1 shader code. + +### .GLSL3 : string (constant) + +GLSL 3 shader code. + +### .GreaterCompare : number (constant) + +Pass if the incoming value is greater than the texture value. + +### .GreaterDepth : number (constant) + +Pass if the incoming value is greater than the depth buffer value. + +### .GreaterEqualCompare : number (constant) + +Pass if the incoming value is greater than or equal to the texture value. + +### .GreaterEqualDepth : number (constant) + +Pass if the incoming value is greater than or equal to the depth buffer value. + +### .GreaterEqualStencilFunc : number (constant) + +Will return true if the stencil reference value is greater than or equal to the current stencil value. + +### .GreaterStencilFunc : number (constant) + +Will return true if the stencil reference value is greater than the current stencil value. + +### .HalfFloatType : number (constant) + +A half float data type for textures. + +### .IncrementStencilOp : number (constant) + +Increments the current stencil buffer value. Clamps to the maximum representable unsigned value. + +### .IncrementWrapStencilOp : number (constant) + +Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing the maximum representable unsigned value. + +### .IntType : number (constant) + +An int data type for textures. + +### .InterpolateDiscrete : number (constant) + +Discrete interpolation mode for keyframe tracks. + +### .InterpolateLinear : number (constant) + +Linear interpolation mode for keyframe tracks. + +### .InterpolateSmooth : number (constant) + +Smooth interpolation mode for keyframe tracks. + +### .InterpolationSamplingMode : ConstantsInterpolationSamplingMode (constant) + +Represents the different interpolation sampling modes. + +### .InterpolationSamplingType : ConstantsInterpolationSamplingType (constant) + +Represents mouse buttons and interaction types in context of controls. + +### .InvertStencilOp : number (constant) + +Inverts the current stencil buffer value bitwise. + +### .KHR_mesh_quantization_ExtraAttrTypes (constant) + +The KHR\_mesh\_quantization extension allows these extra attribute component types + +See: + +* [https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR\_mesh\_quantization/README.md#extending-mesh-attributes](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md#extending-mesh-attributes) + +### .KeepStencilOp : number (constant) + +Keeps the current value. + +### .LessCompare : number (constant) + +Pass if the incoming value is less than the texture value. + +### .LessDepth : number (constant) + +Pass if the incoming value is less than the depth buffer value. + +### .LessEqualCompare : number (constant) + +Pass if the incoming value is less than or equal to the texture value. + +### .LessEqualDepth : number (constant) + +Pass if the incoming value is less than or equal to the depth buffer value. + +### .LessEqualStencilFunc : number (constant) + +Will return true if the stencil reference value is less than or equal to the current stencil value. + +### .LessStencilFunc : number (constant) + +Will return true if the stencil reference value is less than the current stencil value. + +### .LinearFilter : number (constant) + +Returns the weighted average of the four texture elements that are closest to the specified texture coordinates, and can include items wrapped or repeated from other parts of a texture, depending on the values of `wrapS` and `wrapT`, and on the exact mapping. + +### .LinearMipmapLinearFilter : number (constant) + +Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the `LinearFilter` criterion to produce a texture value from each mipmap. The final texture value is a weighted average of those two values. + +### .LinearMipmapNearestFilter : number (constant) + +Chooses the mipmap that most closely matches the size of the pixel being textured and uses the `LinearFilter` criterion (a weighted average of the four texels that are closest to the center of the pixel) to produce a texture value. + +### .LinearSRGBColorSpace : string (constant) + +sRGB-linear color space. + +### .LinearToneMapping : number (constant) + +Linear tone mapping. + +### .LinearTransfer : string (constant) + +Linear transfer function. + +### .LoopOnce : number (constant) + +Animations are played once. + +### .LoopPingPong : number (constant) + +Animations are played with a chosen number of repetitions, alternately playing forward and backward. + +### .LoopRepeat : number (constant) + +Animations are played with a chosen number of repetitions, each time jumping from the end of the clip directly to its beginning. + +### .MOUSE : ConstantsMouse (constant) + +Represents mouse buttons and interaction types in context of controls. + +### .MaxEquation : number (constant) + +A blend equation that uses the maximum of source and destination. + +### .MinEquation : number (constant) + +A blend equation that uses the minimum of source and destination. + +### .MirroredRepeatWrapping : number (constant) + +The texture will repeats to infinity, mirroring on each repeat. + +### .MixOperation : number (constant) + +Uses reflectivity to blend between the two colors. + +### .MultiplyBlending : number (constant) + +Represents multiply blending. + +### .MultiplyOperation : number (constant) + +Multiplies the environment map color with the surface color. + +### .NearestFilter : number (constant) + +Returns the value of the texture element that is nearest (in Manhattan distance) to the specified texture coordinates. + +### .NearestMipmapLinearFilter : number (constant) + +Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the `NearestFilter` criterion to produce a texture value from each mipmap. The final texture value is a weighted average of those two values. + +### .NearestMipmapNearestFilter : number (constant) + +Chooses the mipmap that most closely matches the size of the pixel being textured and uses the `NearestFilter` criterion (the texel nearest to the center of the pixel) to produce a texture value. + +### .NeutralToneMapping : number (constant) + +Neutral tone mapping. + +Implementation based on the Khronos 3D Commerce Group standard tone mapping. + +### .NeverCompare : number (constant) + +Never pass. + +### .NeverDepth : number (constant) + +Never pass. + +### .NeverStencilFunc : number (constant) + +Will never return true. + +### .NoBlending : number (constant) + +No blending is performed which effectively disables alpha transparency. + +### .NoColorSpace : string (constant) + +No color space. + +### .NoNormalPacking : string (constant) + +No normal map packing. + +### .NoToneMapping : number (constant) + +No tone mapping is applied. + +### .NodeAccess (constant) + +Access types of a node. These are relevant for compute and storage usage. + +**READ\_ONLY** +string + +Read-only access + +**WRITE\_ONLY** +string + +Write-only access. + +**READ\_WRITE** +string + +Read and write access. + +### .NodeShaderStage (constant) + +Possible shader stages. + +**VERTEX** +string + +The vertex shader stage. + +**FRAGMENT** +string + +The fragment shader stage. + +### .NodeType (constant) + +Data types of a node. + +**BOOLEAN** +string + +Boolean type. + +**INTEGER** +string + +Integer type. + +**FLOAT** +string + +Float type. + +**VECTOR2** +string + +Two-dimensional vector type. + +**VECTOR3** +string + +Three-dimensional vector type. + +**VECTOR4** +string + +Four-dimensional vector type. + +**MATRIX2** +string + +2x2 matrix type. + +**MATRIX3** +string + +3x3 matrix type. + +**MATRIX4** +string + +4x4 matrix type. + +### .NodeUpdateType (constant) + +Update types of a node. + +**NONE** +string + +The update method is not executed. + +**FRAME** +string + +The update method is executed per frame. + +**RENDER** +string + +The update method is executed per render. A frame might be produced by multiple render calls so this value allows more detailed updates than FRAME. + +**OBJECT** +string + +The update method is executed per [Object3D](Object3D.html) that uses the node for rendering. + +### .NormalAnimationBlendMode : number (constant) + +Default animation blend mode. + +### .NormalBlending : number (constant) + +The default blending. + +### .NormalGAPacking : string (constant) + +Normal GA packing. + +### .NormalRGPacking : string (constant) + +Normal RG packing. + +### .NotEqualCompare : number (constant) + +Pass if the incoming value is not equal to the texture value. + +### .NotEqualDepth : number (constant) + +Pass if the incoming value is not equal to the depth buffer value. + +### .NotEqualStencilFunc : number (constant) + +Will return true if the stencil reference value is not equal to the current stencil value. + +### .ObjectSpaceNormalMap : number (constant) + +Normal information is relative to the object orientation. + +### .OnBeforeMaterialUpdate (constant) + +Creates an event that triggers a function before the material is updated. + +The event will be bound to the declared TSL function `Fn()`; it must be declared within a `Fn()` or the JS function call must be inherited from one. + +### .OnBeforeObjectUpdate (constant) + +Creates an event that triggers a function before an object (Mesh|Sprite) is updated. + +The event will be bound to the declared TSL function `Fn()`; it must be declared within a `Fn()` or the JS function call must be inherited from one. + +### .OnMaterialUpdate (constant) + +Creates an event that triggers a function when the first object that uses the material is rendered. + +The event will be bound to the declared TSL function `Fn()`; it must be declared within a `Fn()` or the JS function call must be inherited from one. + +### .OnObjectUpdate (constant) + +Creates an event that triggers a function every time an object (Mesh|Sprite) is rendered. + +The event will be bound to the declared TSL function `Fn()`; it must be declared within a `Fn()` or the JS function call must be inherited from one. + +### .OneFactor : number (constant) + +Multiplies all colors by `1`. + +### .OneMinusConstantAlphaFactor : number (constant) + +Multiplies all colors by 1 minus a constant alpha value. + +### .OneMinusConstantColorFactor : number (constant) + +Multiplies all colors by `1` minus a constant color. + +### .OneMinusDstAlphaFactor : number (constant) + +Multiplies all colors by `1` minus the destination alpha value. + +### .OneMinusDstColorFactor : number (constant) + +Multiplies all colors by `1` minus each destination color. + +### .OneMinusSrcAlphaFactor : number (constant) + +Multiplies all colors by 1 minus the source alpha value. + +### .OneMinusSrcColorFactor : number (constant) + +Multiplies all colors by `1` minus each source color. + +### .PCFShadowMap : number (constant) + +Filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm. + +### .PCFSoftShadowMap : number (constant) + +Filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm with better soft shadows especially when using low-resolution shadow maps. + +### .R11_EAC_Format : number (constant) + +EAC R11 UNORM format. + +### .RED_GREEN_RGTC2_Format : number (constant) + +RGTC2 Red Green format. + +### .RED_RGTC1_Format : number (constant) + +RGTC1 Red format. + +### .RG11_EAC_Format : number (constant) + +EAC RG11 UNORM format. + +### .RGBADepthPacking : number (constant) + +The depth value is packed into 32 bit RGBA. + +### .RGBAFormat : number (constant) + +Reads the red, green, blue and alpha components. + +### .RGBAIntegerFormat : number (constant) + +Reads the red, green, blue and alpha components. The texels are read as integers instead of floating point. + +### .RGBA_ASTC_10x10_Format : number (constant) + +ASTC RGBA 10x10 format. + +### .RGBA_ASTC_10x5_Format : number (constant) + +ASTC RGBA 10x5 format. + +### .RGBA_ASTC_10x6_Format : number (constant) + +ASTC RGBA 10x6 format. + +### .RGBA_ASTC_10x8_Format : number (constant) + +ASTC RGBA 10x8 format. + +### .RGBA_ASTC_12x10_Format : number (constant) + +ASTC RGBA 12x10 format. + +### .RGBA_ASTC_12x12_Format : number (constant) + +ASTC RGBA 12x12 format. + +### .RGBA_ASTC_4x4_Format : number (constant) + +ASTC RGBA 4x4 format. + +### .RGBA_ASTC_5x4_Format : number (constant) + +ASTC RGBA 5x4 format. + +### .RGBA_ASTC_5x5_Format : number (constant) + +ASTC RGBA 5x5 format. + +### .RGBA_ASTC_6x5_Format : number (constant) + +ASTC RGBA 6x5 format. + +### .RGBA_ASTC_6x6_Format : number (constant) + +ASTC RGBA 6x6 format. + +### .RGBA_ASTC_8x5_Format : number (constant) + +ASTC RGBA 8x5 format. + +### .RGBA_ASTC_8x6_Format : number (constant) + +ASTC RGBA 8x6 format. + +### .RGBA_ASTC_8x8_Format : number (constant) + +ASTC RGBA 8x8 format. + +### .RGBA_BPTC_Format : number (constant) + +BPTC RGBA format. + +### .RGBA_ETC2_EAC_Format : number (constant) + +ETC2 RGBA format. + +### .RGBA_PVRTC_2BPPV1_Format : number (constant) + +PVRTC RGBA compression in 2-bit mode. One block for each 8×4 pixels. + +### .RGBA_PVRTC_4BPPV1_Format : number (constant) + +PVRTC RGBA compression in 4-bit mode. One block for each 4×4 pixels. + +### .RGBA_S3TC_DXT1_Format : number (constant) + +A DXT1-compressed image in an RGB image format with a simple on/off alpha value. + +### .RGBA_S3TC_DXT3_Format : number (constant) + +A DXT3-compressed image in an RGBA image format. Compared to a 32-bit RGBA texture, it offers 4:1 compression. + +### .RGBA_S3TC_DXT5_Format : number (constant) + +A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs to the DXT3 compression in how the alpha compression is done. + +### .RGBDepthPacking : number (constant) + +The depth value is packed into 24 bit RGB. + +### .RGBFormat : number (constant) + +Discards the alpha component and reads the red, green and blue component. + +### .RGBIntegerFormat : number (constant) + +Discards the alpha component and reads the red, green and blue component. The texels are read as integers instead of floating point. + +### .RGB_BPTC_SIGNED_Format : number (constant) + +BPTC Signed RGB format. + +### .RGB_BPTC_UNSIGNED_Format : number (constant) + +BPTC Unsigned RGB format. + +### .RGB_ETC1_Format : number (constant) + +ETC1 RGB format. + +### .RGB_ETC2_Format : number (constant) + +ETC2 RGB format. + +### .RGB_PVRTC_2BPPV1_Format : number (constant) + +PVRTC RGB compression in 2-bit mode. One block for each 8×4 pixels. + +### .RGB_PVRTC_4BPPV1_Format : number (constant) + +PVRTC RGB compression in 4-bit mode. One block for each 4×4 pixels. + +### .RGB_S3TC_DXT1_Format : number (constant) + +A DXT1-compressed image in an RGB image format. + +### .RGDepthPacking : number (constant) + +The depth value is packed into 16 bit RG. + +### .RGFormat : number (constant) + +Discards the alpha, and blue components and reads the red, and green components. + +### .RGIntegerFormat : number (constant) + +Discards the alpha, and blue components and reads the red, and green components. The texels are read as integers instead of floating point. + +### .RedFormat : number (constant) + +Discards the green, blue and alpha components and reads just the red component. + +### .RedIntegerFormat : number (constant) + +Discards the green, blue and alpha components and reads just the red component. The texels are read as integers instead of floating point. + +### .ReinhardToneMapping : number (constant) + +Reinhard tone mapping. + +### .RepeatWrapping : number (constant) + +The texture will simply repeat to infinity. + +### .ReplaceStencilOp : number (constant) + +Sets the stencil buffer value to the specified reference value. + +### .ReverseSubtractEquation : number (constant) + +A `destination - source` blending equation. + +### .SIGNED_R11_EAC_Format : number (constant) + +EAC R11 SNORM format. + +### .SIGNED_RED_GREEN_RGTC2_Format : number (constant) + +RGTC2 Signed Red Green format. + +### .SIGNED_RED_RGTC1_Format : number (constant) + +RGTC1 Signed Red format. + +### .SIGNED_RG11_EAC_Format : number (constant) + +EAC RG11 SNORM format. + +### .SRGBColorSpace : string (constant) + +sRGB color space. + +### .SRGBTransfer : string (constant) + +sRGB transfer function. + +### .SRGB_TO_LINEAR (constant) + +UltraHDR Image Format - https://developer.android.com/media/platform/hdr-image-format + +Short format brief: + +\[JPEG headers\] \[XMP metadata describing the MPF container and _both_ SDR and gainmap images\] \[Optional metadata\] \[EXIF\] \[ICC Profile\] \[SDR image\] \[XMP metadata describing only the gainmap image\] \[Gainmap image\] + +Each section is separated by a 0xFFXX byte followed by a descriptor byte (0xFFE0, 0xFFE1, 0xFFE2.) Binary image storages are prefixed with a unique 0xFFD8 16-bit descriptor. + +### .ScriptableNodeResources : Resources (constant) + +Defines the resources (e.g. namespaces) of scriptable nodes. + +### .ShortType : number (constant) + +A short data type for textures. + +### .SrcAlphaFactor : number (constant) + +Multiplies all colors by the source alpha value. + +### .SrcAlphaSaturateFactor : number (constant) + +Multiplies the RGB colors by the smaller of either the source alpha value or the value of `1` minus the destination alpha value. The alpha value is multiplied by `1`. + +### .SrcColorFactor : number (constant) + +Multiplies all colors by the source colors. + +### .StaticCopyUsage : number (constant) + +The contents are intended to be specified once by reading data from the 3D API, and used many times as the source for WebGL drawing and image specification commands. + +### .StaticDrawUsage : number (constant) + +The contents are intended to be specified once by the application, and used many times as the source for drawing and image specification commands. + +### .StaticReadUsage : number (constant) + +The contents are intended to be specified once by reading data from the 3D API, and queried many times by the application. + +### .StreamCopyUsage : number (constant) + +The contents are intended to be specified once by reading data from the 3D API, and used at most a few times as the source for WebGL drawing and image specification commands. + +### .StreamDrawUsage : number (constant) + +The contents are intended to be specified once by the application, and used at most a few times as the source for drawing and image specification commands. + +### .StreamReadUsage : number (constant) + +The contents are intended to be specified once by reading data from the 3D API, and queried at most a few times by the application + +### .SubtractEquation : number (constant) + +A `source - destination` blending equation. + +### .SubtractiveBlending : number (constant) + +Represents subtractive blending. + +### .TOUCH : ConstantsTouch (constant) + +Represents touch interaction types in context of controls. + +### .TangentSpaceNormalMap : number (constant) + +Normal information is relative to the underlying surface. + +### .TimestampQuery : ConstantsTimestampQuery (constant) + +Represents the different timestamp query types. + +### .TriangleFanDrawMode : number (constant) + +For each vertex draw a triangle from the first vertex and the last two vertices. + +### .TriangleStripDrawMode : number (constant) + +For each vertex draw a triangle from the last three vertices. + +### .TrianglesDrawMode : number (constant) + +For every three vertices draw a single triangle. + +### .UVMapping : number (constant) + +Maps textures using the geometry's UV coordinates. + +### .UnsignedByteType : number (constant) + +An unsigned byte data type for textures. + +### .UnsignedInt101111Type : number (constant) + +An unsigned int 10\_11\_11 (packed) data type for textures. + +### .UnsignedInt248Type : number (constant) + +An unsigned int 24\_8 data type for textures. + +### .UnsignedInt5999Type : number (constant) + +An unsigned int 5\_9\_9\_9 (packed) data type for textures. + +### .UnsignedIntType : number (constant) + +An unsigned int data type for textures. + +### .UnsignedShort4444Type : number (constant) + +An unsigned short 4\_4\_4\_4 (packed) data type for textures. + +### .UnsignedShort5551Type : number (constant) + +An unsigned short 5\_5\_5\_1 (packed) data type for textures. + +### .UnsignedShortType : number (constant) + +An unsigned short data type for textures. + +### .VK_FORMAT_MAP (constant) + +References: + +* https://github.khronos.org/KTX-Specification/ktxspec.v2.html +* https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html +* https://github.com/donmccurdy/KTX-Parse + +### .VSMShadowMap : number (constant) + +Filters shadow maps using the Variance Shadow Map (VSM) algorithm. When using VSMShadowMap all shadow receivers will also cast shadows. + +### .WebGLCoordinateSystem : number (constant) + +WebGL coordinate system. + +### .WebGPUCoordinateSystem : number (constant) + +WebGPU coordinate system. + +### .WrapAroundEnding : number (constant) + +Wrap around ending for animations. + +### .ZeroCurvatureEnding : number (constant) + +Zero curvature ending for animations. + +### .ZeroFactor : number (constant) + +Multiplies all colors by `0`. + +### .ZeroSlopeEnding : number (constant) + +Zero slope ending for animations. + +### .ZeroStencilOp : number (constant) + +Sets the stencil buffer value to `0`. + +### .disposeShadowMaterial (constant) + +Disposes the shadow material for the given light source. + +### .viewportResolution (constant) + +**Deprecated:** since r169. Use [screenSize](TSL.html#screenSize) instead. + +## Methods + +### .BasicShadowFilter( inputs : Object ) : Node. + +A shadow filtering function performing basic filtering. This is in fact an unfiltered version of the shadow map with a binary `[0,1]` result. + +**inputs** + +The input parameter object. + +**depthTexture** + +A reference to the shadow map's texture data. + +**shadowCoord** + +The shadow coordinates. + +**Returns:** The filtering result. + +### .PCFShadowFilter( inputs : Object ) : Node. + +A shadow filtering function performing PCF filtering with Vogel disk sampling and IGN. + +Uses 5 samples distributed via Vogel disk pattern, rotated per-pixel using Interleaved Gradient Noise (IGN) to break up banding artifacts. Combined with hardware PCF (4-tap filtering per sample), this effectively provides 20 filtered taps with better distribution. + +**inputs** + +The input parameter object. + +**depthTexture** + +A reference to the shadow map's texture data. + +**shadowCoord** + +The shadow coordinates. + +**shadow** + +The light shadow. + +**Returns:** The filtering result. + +### .PCFSoftShadowFilter( inputs : Object ) : Node. + +A shadow filtering function performing PCF soft filtering. + +**inputs** + +The input parameter object. + +**depthTexture** + +A reference to the shadow map's texture data. + +**shadowCoord** + +The shadow coordinates. + +**shadow** + +The light shadow. + +**Returns:** The filtering result. + +### .PointShadowFilter( inputs : Object ) : Node. + +A shadow filtering function for point lights using Vogel disk sampling and IGN. + +Uses 5 samples distributed via Vogel disk pattern in tangent space around the sample direction, rotated per-pixel using Interleaved Gradient Noise (IGN). + +**inputs** + +The input parameter object. + +**depthTexture** + +A reference to the shadow cube map. + +**bd3D** + +The normalized direction from light to fragment. + +**dp** + +The depth value to compare against. + +**shadow** + +The light shadow. + +**Returns:** The filtering result. + +### .Stack( node : Node ) : Node + +Add the given node to the current stack. + +**node** + +The node to add. + +**Returns:** The node that was added to the stack. + +### .VSMShadowFilter( inputs : Object ) : Node. + +A shadow filtering function performing VSM filtering. + +**inputs** + +The input parameter object. + +**depthTexture** + +A reference to the shadow map's texture data. + +**shadowCoord** + +The shadow coordinates. + +**Returns:** The filtering result. + +### .buildData3DTexture( chunk : Object ) : Data3DTexture + +Builds a 3D texture from a VOX chunk. + +**chunk** + +A VOX chunk loaded via [VOXLoader](VOXLoader.html). + +**Returns:** The generated 3D texture. + +### .buildMesh( chunk : Object ) : Mesh + +Builds a mesh from a VOX chunk. + +**chunk** + +A VOX chunk loaded via [VOXLoader](VOXLoader.html). + +**Returns:** The generated mesh. + +### .ceilPowerOfTwo( value : number ) : number + +Returns the smallest power of two that is greater than or equal to the given number. + +**value** + +The value to find a POT for. + +**Returns:** The smallest power of two that is greater than or equal to the given number. + +### .clamp( value : number, min : number, max : number ) : number + +Clamps the given value between min and max. + +**value** + +The value to clamp. + +**min** + +The min value. + +**max** + +The max value. + +**Returns:** The clamped value. + +### .contain( texture : Texture, aspect : number ) : Texture + +Scales the texture as large as possible within its surface without cropping or stretching the texture. The method preserves the original aspect ratio of the texture. Akin to CSS `object-fit: contain` + +**texture** + +The texture. + +**aspect** + +The texture's aspect ratio. + +**Returns:** The updated texture. + +### .convertArray( array : TypedArray | Array, type : TypedArray.constructor ) : TypedArray + +Converts an array to a specific type. + +**array** + +The array to convert. + +**type** + +The constructor of a typed array that defines the new type. + +**Returns:** The converted array. + +### .cover( texture : Texture, aspect : number ) : Texture + +Scales the texture to the smallest possible size to fill the surface, leaving no empty space. The method preserves the original aspect ratio of the texture. Akin to CSS `object-fit: cover`. + +**texture** + +The texture. + +**aspect** + +The texture's aspect ratio. + +**Returns:** The updated texture. + +### .createEvent( type : string, callback : function ) : EventNode + +Helper to create an EventNode and add it to the stack. + +**type** + +The event type. + +**callback** + +The callback function. + +### .damp( x : number, y : number, lambda : number, dt : number ) : number + +Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta time to maintain frame rate independent movement. For details, see [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/). + +**x** + +The current point. + +**y** + +The target point. + +**lambda** + +A higher lambda value will make the movement more sudden, and a lower value will make the movement more gradual. + +**dt** + +Delta time in seconds. + +**Returns:** The interpolated value. + +### .degToRad( degrees : number ) : number + +Converts degrees to radians. + +**degrees** + +A value in degrees. + +**Returns:** The converted value in radians. + +### .denormalize( value : number, array : TypedArray ) : number + +Denormalizes the given value according to the given typed array. + +**value** + +The value to denormalize. + +**array** + +The typed array that defines the data type of the value. + +**Returns:** The denormalize (float) value in the range `[0,1]`. + +### .euclideanModulo( n : number, m : number ) : number + +Computes the Euclidean modulo of the given parameters that is `( ( n % m ) + m ) % m`. + +**n** + +The first parameter. + +**m** + +The second parameter. + +**Returns:** The Euclidean modulo. + +### .fill( texture : Texture ) : Texture + +Configures the texture to the default transformation. Akin to CSS `object-fit: fill`. + +**texture** + +The texture. + +**Returns:** The updated texture. + +### .flattenJSON( jsonKeys : Array., times : Array., values : Array., valuePropertyName : string ) + +Used for parsing AOS keyframe formats. + +**jsonKeys** + +A list of JSON keyframes. + +**times** + +This array will be filled with keyframe times by this function. + +**values** + +This array will be filled with keyframe values by this function. + +**valuePropertyName** + +The name of the property to use. + +### .floorPowerOfTwo( value : number ) : number + +Returns the largest power of two that is less than or equal to the given number. + +**value** + +The value to find a POT for. + +**Returns:** The largest power of two that is less than or equal to the given number. + +### .fromHalfFloat( val : number ) : number + +Returns a single precision floating point value (FP32) from the given half precision floating point value (FP16). + +**val** + +A half precision floating point value. + +**Returns:** The FP32 value. + +### .generateMagicSquare( size : number ) : Array. + +Computes an array of magic square values required to generate the noise texture. + +**size** + +The noise size. + +**Returns:** The magic square values. + +### .generateMagicSquareNoise( size : number ) : DataTexture + +Generates the AO's noise texture for the given size. + +**size** + +The noise size. + +Default is `5`. + +**Returns:** The generated noise texture. + +### .generateUUID() : string + +Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) (universally unique identifier). + +**Returns:** The UUID. + +### .getByteLength( width : number, height : number, format : number, type : number ) : number + +Determines how many bytes must be used to represent the texture. + +**width** + +The width of the texture. + +**height** + +The height of the texture. + +**format** + +The texture's format. + +**type** + +The texture's type. + +**Returns:** The byte length. + +### .getCacheKey( renderContext : RenderContext ) : number + +Computes a cache key for the given render context. This key should identify the render target state so it is possible to configure the correct attachments in the respective backend. + +**renderContext** + +The render context. + +**Returns:** The cache key. + +### .getDistanceAttenuation( inputs : Object ) : Node. + +Represents a `discard` shader operation in TSL. + +**inputs** + +The input parameter object. + +**lightDistance** + +The distance of the light's position to the current fragment position. + +**cutoffDistance** + +The light's cutoff distance. + +**decayExponent** + +The light's decay exponent. + +**Returns:** The distance falloff. + +### .getFloatLength( floatLength : number ) : number + +This function is usually called with the length in bytes of an array buffer. It returns an padded value which ensure chunk size alignment according to STD140 layout. + +**floatLength** + +The buffer length. + +**Returns:** The padded length. + +### .getFormat( texture : Texture, device : GPUDevice ) : string + +Returns the GPU format for the given texture. + +**texture** + +The texture. + +**device** + +The GPU device which is used for feature detection. It is not necessary to apply the device for most formats. + +Default is `null`. + +**Returns:** The GPU format. + +### .getKeyframeOrder( times : Array. ) : Array. + +Returns an array by which times and values can be sorted. + +**times** + +The keyframe time values. + +**Returns:** The array. + +### .getMembersLayout( members : Object. ) : Array.<{name: string, type: string, atomic: boolean}> + +Generates a layout for struct members. This function takes an object representing struct members and returns an array of member layouts. Each member layout includes the member's name, type, and whether it is atomic. + +**members** + +An object where keys are member names and values are either types (as strings) or objects with type and atomic properties. + +**Returns:** An array of member layouts. + +### .getStrideLength( vectorLength : number ) : number + +This function is called with a vector length and ensure the computed length matches a predefined stride (in this case `4`). + +**vectorLength** + +The vector length. + +**Returns:** The padded length. + +### .getTextureIndex( textures : Array., name : string ) : number + +Returns the MRT texture index for the given name. + +**textures** + +The textures of a MRT-configured render target. + +**name** + +The name of the MRT texture which index is requested. + +**Returns:** The texture index. + +### .getUniforms( splineTexture : DataTexture ) : Object + +Create a new set of uniforms for describing the curve modifier. + +**splineTexture** + +Which holds the curve description. + +**Returns:** The uniforms object to be used in the shader. + +### .getVectorLength( count : number, vectorLength : number ) : number + +Given the count of vectors and their vector length, this function computes a total length in bytes with buffer alignment according to STD140 layout. + +**count** + +The number of vectors. + +**vectorLength** + +The vector length. + +Default is `4`. + +**Returns:** The padded length. + +### .getViewZNode( builder : NodeBuilder ) : Node + +Returns a node that represents the `z` coordinate in view space for the current fragment. It's a different representation of the default depth value. + +This value can be part of a computation that defines how the fog density increases when moving away from the camera. + +**builder** + +The current node builder. + +**Returns:** The viewZ node. + +### .inverseLerp( x : number, y : number, value : number ) : number + +Returns the percentage in the closed interval `[0, 1]` of the given value between the start and end point. + +**x** + +The start point + +**y** + +The end point. + +**value** + +A value between start and end. + +**Returns:** The interpolation factor. + +### .isPowerOfTwo( value : number ) : boolean + +Returns `true` if the given number is a power of two. + +**value** + +The value to check. + +**Returns:** Whether the given number is a power of two or not. + +### .isTypedArray( array : any ) : boolean + +Returns `true` if the given object is a typed array. + +**array** + +The object to check. + +**Returns:** Whether the given object is a typed array. + +### .lerp( x : number, y : number, t : number ) : number + +Returns a value linearly interpolated from two known points based on the given interval - `t = 0` will return `x` and `t = 1` will return `y`. + +**x** + +The start point + +**y** + +The end point. + +**t** + +The interpolation factor in the closed interval `[0, 1]`. + +**Returns:** The interpolated value. + +### .makeClipAdditive( targetClip : AnimationClip, referenceFrame : number, referenceClip : AnimationClip, fps : number ) : AnimationClip + +Converts the keyframes of the given animation clip to an additive format. + +**targetClip** + +The clip to make additive. + +**referenceFrame** + +The reference frame. + +Default is `0`. + +**referenceClip** + +The reference clip. + +Default is `targetClip`. + +**fps** + +The FPS. + +Default is `30`. + +**Returns:** The updated clip which is now additive. + +### .mapLinear( x : number, a1 : number, a2 : number, b1 : number, b2 : number ) : number + +Performs a linear mapping from range `` to range `` for the given value. + +**x** + +The value to be mapped. + +**a1** + +Minimum value for range A. + +**a2** + +Maximum value for range A. + +**b1** + +Minimum value for range B. + +**b2** + +Maximum value for range B. + +**Returns:** The mapped value. + +### .normalize( value : number, array : TypedArray ) : number + +Normalizes the given value according to the given typed array. + +**value** + +The float value in the range `[0,1]` to normalize. + +**array** + +The typed array that defines the data type of the value. + +**Returns:** The normalize value. + +### .pingpong( x : number, length : number ) : number + +Returns a value that alternates between `0` and the given `length` parameter. + +**x** + +The value to pingpong. + +**length** + +The positive value the function will pingpong to. + +Default is `1`. + +**Returns:** The alternated value. + +### .radToDeg( radians : number ) : number + +Converts radians to degrees. + +**radians** + +A value in radians. + +**Returns:** The converted value in degrees. + +### .randFloat( low : number, high : number ) : number + +Returns a random float from `` interval. + +**low** + +The lower value boundary. + +**high** + +The upper value boundary + +**Returns:** A random float. + +### .randFloatSpread( range : number ) : number + +Returns a random integer from `<-range/2, range/2>` interval. + +**range** + +Defines the value range. + +**Returns:** A random float. + +### .randInt( low : number, high : number ) : number + +Returns a random integer from `` interval. + +**low** + +The lower value boundary. + +**high** + +The upper value boundary + +**Returns:** A random integer. + +### .sample( callback : function, uv : Node. ) : SampleNode + +Helper function to create a SampleNode wrapped as a node object. + +**callback** + +The function to be called when sampling. Should accept a UV node and return a value. + +**uv** + +The UV node to be used in the texture sampling. + +Default is `null`. + +**Returns:** The created SampleNode instance wrapped as a node object. + +### .seededRandom( s : number ) : number + +Returns a deterministic pseudo-random float in the interval `[0, 1]`. + +**s** + +The integer seed. + +**Returns:** A random float. + +### .setProjectionFromUnion( camera : ArrayCamera, cameraL : PerspectiveCamera, cameraR : PerspectiveCamera ) + +Assumes 2 cameras that are parallel and share an X-axis, and that the cameras' projection and world matrices have already been set. And that near and far planes are identical for both cameras. Visualization of this technique: https://computergraphics.stackexchange.com/a/4765 + +**camera** + +The camera to update. + +**cameraL** + +The left camera. + +**cameraR** + +The right camera. + +### .setQuaternionFromProperEuler( q : Quaternion, a : number, b : number, c : number, order : 'XYX' | 'XZX' | 'YXY' | 'YZY' | 'ZXZ' | 'ZYZ' ) + +Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles) defined by the given angles and order. + +Rotations are applied to the axes in the order specified by order: rotation by angle `a` is applied first, then by angle `b`, then by angle `c`. + +**q** + +The quaternion to set. + +**a** + +The rotation applied to the first axis, in radians. + +**b** + +The rotation applied to the second axis, in radians. + +**c** + +The rotation applied to the third axis, in radians. + +**order** + +A string specifying the axes order. + +### .shadowRenderObjectFunction( object : Object3D, scene : Scene, _camera : Camera, geometry : BufferGeometry, material : Material, group : Group, …params : any ) + +Shadow Render Object Function. + +**object** + +The 3D object to render. + +**scene** + +The scene containing the object. + +**\_camera** + +The camera used for rendering. + +**geometry** + +The geometry of the object. + +**material** + +The material of the object. + +**group** + +The group the object belongs to. + +**params** + +Additional parameters for rendering. + +### .smootherstep( x : number, min : number, max : number ) : number + +A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations) that has zero 1st and 2nd order derivatives at x=0 and x=1. + +**x** + +The value to evaluate based on its position between min and max. + +**min** + +The min value. Any x value below min will be `0`. + +**max** + +The max value. Any x value above max will be `1`. + +**Returns:** The alternated value. + +### .smoothstep( x : number, min : number, max : number ) : number + +Returns a value in the range `[0,1]` that represents the percentage that `x` has moved between `min` and `max`, but smoothed or slowed down the closer `x` is to the `min` and `max`. + +See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details. + +**x** + +The value to evaluate based on its position between min and max. + +**min** + +The min value. Any x value below min will be `0`. + +**max** + +The max value. Any x value above max will be `1`. + +**Returns:** The alternated value. + +### .sortedArray( values : Array., stride : number, order : Array. ) : Array. + +Sorts the given array by the previously computed order via `getKeyframeOrder()`. + +**values** + +The values to sort. + +**stride** + +The stride. + +**order** + +The sort order. + +**Returns:** The sorted values. + +### .subclip( sourceClip : AnimationClip, name : string, startFrame : number, endFrame : number, fps : number ) : AnimationClip + +Creates a new clip, containing only the segment of the original clip between the given frames. + +**sourceClip** + +The values to sort. + +**name** + +The name of the clip. + +**startFrame** + +The start frame. + +**endFrame** + +The end frame. + +**fps** + +The FPS. + +Default is `30`. + +**Returns:** The new sub clip. + +### .toHalfFloat( val : number ) : number + +Returns a half precision floating point value (FP16) from the given single precision floating point value (FP32). + +**val** + +A single precision floating point value. + +**Returns:** The FP16 value. + +### .updateCamera( camera : Camera, parent : Object3D ) + +Updates the world matrices for the given camera based on the parent 3D object. + +**camera** + +The camera to update. + +**parent** + +The parent 3D object. + +### .updateUserCamera( camera : Camera, cameraXR : ArrayCamera, parent : Object3D ) + +Updates the given camera with the transformation of the XR camera and parent object. + +**camera** + +The camera to update. + +**cameraXR** + +The XR camera. + +**parent** + +The parent 3D object. + +## Type Definitions + +### .ConstantsInterpolationSamplingMode + +Represents the different interpolation sampling modes. + +**NORMAL** +string + +Normal sampling mode. + +**CENTROID** +string + +Centroid sampling mode. + +**SAMPLE** +string + +Sample-specific sampling mode. + +**FIRST** +string + +Flat interpolation using the first vertex. + +**EITHER** +string + +Flat interpolation using either vertex. + +### .ConstantsInterpolationSamplingType + +Represents the different interpolation sampling types. + +**PERSPECTIVE** +string + +Perspective-correct interpolation. + +**LINEAR** +string + +Linear interpolation. + +**FLAT** +string + +Flat interpolation. + +### .ConstantsMouse + +This type represents mouse buttons and interaction types in context of controls. + +**MIDDLE** +number + +The left mouse button. + +**LEFT** +number + +The middle mouse button. + +**RIGHT** +number + +The right mouse button. + +**ROTATE** +number + +A rotate interaction. + +**DOLLY** +number + +A dolly interaction. + +**PAN** +number + +A pan interaction. + +### .ConstantsTimestampQuery + +This type represents the different timestamp query types. + +**COMPUTE** +string + +A `compute` timestamp query. + +**RENDER** +string + +A `render` timestamp query. + +### .ConstantsTouch + +This type represents touch interaction types in context of controls. + +**ROTATE** +number + +A rotate interaction. + +**PAN** +number + +A pan interaction. + +**DOLLY\_PAN** +number + +The dolly-pan interaction. + +**DOLLY\_ROTATE** +number + +A dolly-rotate interaction. + +### .DebugConfig + +Debug configuration. + +**checkShaderErrors** +boolean + +Whether shader errors should be checked or not. + +**onShaderError** +function + +A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. + +**getShaderAsync** +function + +Allows the get the raw shader code for the given scene, camera and 3D object. + +### .ShadowMapConfig + +Shadow map configuration + +**enabled** +boolean + +Whether to globally enable shadows or not. + +**transmitted** +boolean + +Whether to enable light transmission through non-opaque materials. + +**type** +number + +The shadow map type. + +### .XRConfig + +XR configuration. + +**enabled** +boolean + +Whether to globally enable XR or not. + +### .onAnimationCallback( time : DOMHighResTimeStamp, frame : XRFrame ) + +Animation loop parameter of `renderer.setAnimationLoop()`. + +**time** + +A timestamp indicating the end time of the previous frame's rendering. + +**frame** + +A reference to the current XR frame. Only relevant when using XR rendering. + +### .onErrorCallback( error : Error ) + +Callback for onError in loaders. + +**error** + +The error which occurred during the loading process. + +### .onProgressCallback( event : ProgressEvent ) + +Callback for onProgress in loaders. + +**event** + +An instance of `ProgressEvent` that represents the current loading status. + +### .renderObjectFunction( object : Object3D, scene : Scene, camera : Camera, geometry : BufferGeometry, material : Material, group : Object, lightsNode : LightsNode, clippingContext : ClippingContext, passId : string ) + +Callback for [Renderer#setRenderObjectFunction](Renderer.html#setRenderObjectFunction). + +**object** + +The 3D object. + +**scene** + +The scene the 3D object belongs to. + +**camera** + +The camera the object should be rendered with. + +**geometry** + +The object's geometry. + +**material** + +The object's material. + +**group** + +Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + +**lightsNode** + +The current lights node. + +**clippingContext** + +The clipping context. + +**passId** + +An optional ID for identifying the pass. + +Default is `null`. + +### .traverseCallback( node : Node ) + +Callback for [Node#traverse](Node.html#traverse). + +**node** + +The current node. \ No newline at end of file diff --git a/docs/pages/index.html.md b/docs/pages/index.html.md new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/docs/pages/module-ACESFilmicToneMappingShader.html.md b/docs/pages/module-ACESFilmicToneMappingShader.html.md new file mode 100644 index 00000000000000..fb784f52447f1f --- /dev/null +++ b/docs/pages/module-ACESFilmicToneMappingShader.html.md @@ -0,0 +1,21 @@ +# ACESFilmicToneMappingShader + +## Import + +ACESFilmicToneMappingShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ACESFilmicToneMappingShader } from 'three/addons/shaders/ACESFilmicToneMappingShader.js'; +``` + +## Properties + +### .ACESFilmicToneMappingShader : ShaderMaterial~Shader (inner, constant) + +ACES Filmic Tone Mapping Shader by Stephen Hill. Reference: [ltc\_blit.fs](https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs) + +This implementation of ACES is modified to accommodate a brighter viewing environment. The scale factor of 1/0.6 is subjective. See discussion in #19621. + +## Source + +[examples/jsm/shaders/ACESFilmicToneMappingShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/ACESFilmicToneMappingShader.js) \ No newline at end of file diff --git a/docs/pages/module-AfterimageShader.html.md b/docs/pages/module-AfterimageShader.html.md new file mode 100644 index 00000000000000..a938ab0c28a3a1 --- /dev/null +++ b/docs/pages/module-AfterimageShader.html.md @@ -0,0 +1,19 @@ +# AfterimageShader + +## Import + +AfterimageShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { AfterimageShader } from 'three/addons/shaders/AfterimageShader.js'; +``` + +## Properties + +### .AfterimageShader : ShaderMaterial~Shader (inner, constant) + +Inspired by [Three.js FBO motion trails](https://codepen.io/brunoimbrizi/pen/MoRJaN?page=1&). + +## Source + +[examples/jsm/shaders/AfterimageShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/AfterimageShader.js) \ No newline at end of file diff --git a/docs/pages/module-BasicShader.html.md b/docs/pages/module-BasicShader.html.md new file mode 100644 index 00000000000000..d8a64b7c461132 --- /dev/null +++ b/docs/pages/module-BasicShader.html.md @@ -0,0 +1,19 @@ +# BasicShader + +## Import + +BasicShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BasicShader } from 'three/addons/shaders/BasicShader.js'; +``` + +## Properties + +### .BasicShader : ShaderMaterial~Shader (inner, constant) + +Simple shader for testing. + +## Source + +[examples/jsm/shaders/BasicShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/BasicShader.js) \ No newline at end of file diff --git a/docs/pages/module-Bayer.html.md b/docs/pages/module-Bayer.html.md new file mode 100644 index 00000000000000..83d0e39bc50ffa --- /dev/null +++ b/docs/pages/module-Bayer.html.md @@ -0,0 +1,25 @@ +# Bayer + +## Import + +Bayer is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { bayer16 } from 'three/addons/tsl/math/Bayer.js'; +``` + +## Static Methods + +### .bayer16( uv : Node. ) : Node. + +This TSL function can be used to sample a Bayer16 texture which is a 16x16 texture with a Bayer Matrix pattern. It can be used for dithering effects but also as an alternative to blue-noise. When used with Ray Marching specifically in [VolumeNodeMaterial#offsetNode](VolumeNodeMaterial.html#offsetNode), it reduces banding problem, thus being able to use fewer steps without affecting the visuals as much. + +**uv** + +The uv to sample the bayer16 texture. + +**Returns:** The sampled bayer value. + +## Source + +[examples/jsm/tsl/math/Bayer.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/math/Bayer.js) \ No newline at end of file diff --git a/docs/pages/module-BleachBypassShader.html.md b/docs/pages/module-BleachBypassShader.html.md new file mode 100644 index 00000000000000..a790cfe4ccca8f --- /dev/null +++ b/docs/pages/module-BleachBypassShader.html.md @@ -0,0 +1,19 @@ +# BleachBypassShader + +## Import + +BleachBypassShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BleachBypassShader } from 'three/addons/shaders/BleachBypassShader.js'; +``` + +## Properties + +### .BleachBypassShader : ShaderMaterial~Shader (inner, constant) + +Bleach bypass shader \[http://en.wikipedia.org/wiki/Bleach\_bypass\] based on [Nvidia Shader library](http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass). + +## Source + +[examples/jsm/shaders/BleachBypassShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/BleachBypassShader.js) \ No newline at end of file diff --git a/docs/pages/module-BlendShader.html.md b/docs/pages/module-BlendShader.html.md new file mode 100644 index 00000000000000..7cf7805bceae9e --- /dev/null +++ b/docs/pages/module-BlendShader.html.md @@ -0,0 +1,19 @@ +# BlendShader + +## Import + +BlendShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BlendShader } from 'three/addons/shaders/BlendShader.js'; +``` + +## Properties + +### .BlendShader : ShaderMaterial~Shader (inner, constant) + +Blends two textures. + +## Source + +[examples/jsm/shaders/BlendShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/BlendShader.js) \ No newline at end of file diff --git a/docs/pages/module-BokehShader.html.md b/docs/pages/module-BokehShader.html.md new file mode 100644 index 00000000000000..211c86362804d8 --- /dev/null +++ b/docs/pages/module-BokehShader.html.md @@ -0,0 +1,19 @@ +# BokehShader + +## Import + +BokehShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BokehShader } from 'three/addons/shaders/BokehShader.js'; +``` + +## Properties + +### .BokehShader : ShaderMaterial~Shader (inner, constant) + +Depth-of-field shader with bokeh ported from [GLSL shader by Martins Upitis](http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html). + +## Source + +[examples/jsm/shaders/BokehShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/BokehShader.js) \ No newline at end of file diff --git a/docs/pages/module-BokehShader2.html.md b/docs/pages/module-BokehShader2.html.md new file mode 100644 index 00000000000000..ebcdd97c79486f --- /dev/null +++ b/docs/pages/module-BokehShader2.html.md @@ -0,0 +1,21 @@ +# BokehShader2 + +## Import + +BokehShader2 is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BokehShader, BokehDepthShader } from 'three/addons/shaders/BokehShader2.js'; +``` + +## Properties + +### .BokehShader : ShaderMaterial~Shader (inner, constant) + +Depth-of-field shader with bokeh ported from [GLSL shader by Martins Upitis](http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-\(update\)). + +Requires #define RINGS and SAMPLES integers + +## Source + +[examples/jsm/shaders/BokehShader2.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/BokehShader2.js) \ No newline at end of file diff --git a/docs/pages/module-BrightnessContrastShader.html.md b/docs/pages/module-BrightnessContrastShader.html.md new file mode 100644 index 00000000000000..404b62622ef2d5 --- /dev/null +++ b/docs/pages/module-BrightnessContrastShader.html.md @@ -0,0 +1,19 @@ +# BrightnessContrastShader + +## Import + +BrightnessContrastShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { BrightnessContrastShader } from 'three/addons/shaders/BrightnessContrastShader.js'; +``` + +## Properties + +### .BrightnessContrastShader : ShaderMaterial~Shader (inner, constant) + +Brightness and contrast adjustment [https://github.com/evanw/glfx.js](https://github.com/evanw/glfx.js). Brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white) Contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) + +## Source + +[examples/jsm/shaders/BrightnessContrastShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/BrightnessContrastShader.js) \ No newline at end of file diff --git a/docs/pages/module-BufferGeometryUtils.html.md b/docs/pages/module-BufferGeometryUtils.html.md new file mode 100644 index 00000000000000..e49bd4fcf01511 --- /dev/null +++ b/docs/pages/module-BufferGeometryUtils.html.md @@ -0,0 +1,187 @@ +# BufferGeometryUtils + +## Import + +BufferGeometryUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; +``` + +## Methods + +### .computeMikkTSpaceTangents( geometry : BufferGeometry, MikkTSpace : Object, negateSign : boolean ) : BufferGeometry (inner) + +Computes vertex tangents using the MikkTSpace algorithm. MikkTSpace generates the same tangents consistently, and is used in most modelling tools and normal map bakers. Use MikkTSpace for materials with normal maps, because inconsistent tangents may lead to subtle visual issues in the normal map, particularly around mirrored UV seams. + +In comparison to this method, [BufferGeometry#computeTangents](BufferGeometry.html#computeTangents) (a custom algorithm) generates tangents that probably will not match the tangents in other software. The custom algorithm is sufficient for general use with a custom material, and may be faster than MikkTSpace. + +Returns the original BufferGeometry. Indexed geometries will be de-indexed. Requires position, normal, and uv attributes. + +**geometry** + +The geometry to compute tangents for. + +**MikkTSpace** + +Instance of `examples/jsm/libs/mikktspace.module.js`, or `mikktspace` npm package. Await `MikkTSpace.ready` before use. + +**negateSign** + +Whether to negate the sign component (.w) of each tangent. Required for normal map conventions in some formats, including glTF. + +Default is `true`. + +**Returns:** The updated geometry. + +### .computeMorphedAttributes( object : Mesh | Line | Points ) : Object (inner) + +Calculates the morphed attributes of a morphed/skinned BufferGeometry. + +Helpful for Raytracing or Decals (i.e. a `DecalGeometry` applied to a morphed Object with a `BufferGeometry` will use the original `BufferGeometry`, not the morphed/skinned one, generating an incorrect result. Using this function to create a shadow `Object3`D the `DecalGeometry` can be correctly generated). + +**object** + +The 3D object to compute morph attributes for. + +**Returns:** An object with original position/normal attributes and morphed ones. + +### .deepCloneAttribute( attribute : BufferAttribute ) : BufferAttribute (inner) + +Performs a deep clone of the given buffer attribute. + +**attribute** + +The attribute to clone. + +**Returns:** The cloned attribute. + +### .deinterleaveAttribute( attribute : InterleavedBufferAttribute ) : BufferAttribute (inner) + +Returns a new, non-interleaved version of the given attribute. + +**attribute** + +The interleaved attribute. + +**Returns:** The non-interleaved attribute. + +### .deinterleaveGeometry( geometry : BufferGeometry ) (inner) + +Deinterleaves all attributes on the given geometry. + +**geometry** + +The geometry to deinterleave. + +### .estimateBytesUsed( geometry : BufferGeometry ) : number (inner) + +Returns the amount of bytes used by all attributes to represent the geometry. + +**geometry** + +The geometry. + +**Returns:** The estimate bytes used. + +### .interleaveAttributes( attributes : Array. ) : Array. (inner) + +Interleaves a set of attributes and returns a new array of corresponding attributes that share a single [InterleavedBuffer](InterleavedBuffer.html) instance. All attributes must have compatible types. + +**attributes** + +The attributes to interleave. + +**Returns:** An array of interleaved attributes. If interleave does not succeed, the method returns `null`. + +### .mergeAttributes( attributes : Array. ) : BufferAttribute (inner) + +Merges a set of attributes into a single instance. All attributes must have compatible properties and types. Instances of [InterleavedBufferAttribute](InterleavedBufferAttribute.html) are not supported. + +**attributes** + +The attributes to merge. + +**Returns:** The merged attribute. Returns `null` if the merge does not succeed. + +### .mergeGeometries( geometries : Array., useGroups : boolean ) : BufferGeometry (inner) + +Merges a set of geometries into a single instance. All geometries must have compatible attributes. + +**geometries** + +The geometries to merge. + +**useGroups** + +Whether to use groups or not. + +Default is `false`. + +**Returns:** The merged geometry. Returns `null` if the merge does not succeed. + +### .mergeGroups( geometry : BufferGeometry ) : BufferGeometry (inner) + +Merges the [BufferGeometry#groups](BufferGeometry.html#groups) for the given geometry. + +**geometry** + +The geometry to modify. + +**Returns:** + +* The updated geometry + +### .mergeVertices( geometry : BufferGeometry, tolerance : number ) : BufferGeometry (inner) + +Returns a new geometry with vertices for which all similar vertex attributes (within tolerance) are merged. + +**geometry** + +The geometry to merge vertices for. + +**tolerance** + +The tolerance value. + +Default is `1e-4`. + +**Returns:** + +* The new geometry with merged vertices. + +### .toCreasedNormals( geometry : BufferGeometry, creaseAngle : number ) : BufferGeometry (inner) + +Modifies the supplied geometry if it is non-indexed, otherwise creates a new, non-indexed geometry. Returns the geometry with smooth normals everywhere except faces that meet at an angle greater than the crease angle. + +**geometry** + +The geometry to modify. + +**creaseAngle** + +The crease angle in radians. + +Default is `Math.PI/3`. + +**Returns:** + +* The updated geometry + +### .toTrianglesDrawMode( geometry : BufferGeometry, drawMode : number ) : BufferGeometry (inner) + +Returns a new indexed geometry based on `TrianglesDrawMode` draw mode. This mode corresponds to the `gl.TRIANGLES` primitive in WebGL. + +**geometry** + +The geometry to convert. + +**drawMode** + +The current draw mode. + +**Returns:** The new geometry using `TrianglesDrawMode`. + +## Source + +[examples/jsm/utils/BufferGeometryUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/BufferGeometryUtils.js) \ No newline at end of file diff --git a/docs/pages/module-CSMShader.html.md b/docs/pages/module-CSMShader.html.md new file mode 100644 index 00000000000000..5c3858e864bc04 --- /dev/null +++ b/docs/pages/module-CSMShader.html.md @@ -0,0 +1,19 @@ +# CSMShader + +## Import + +CSMShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CSMShader } from 'three/addons/csm/CSMShader.js'; +``` + +## Properties + +### .CSMShader : Object (inner, constant) + +The object that holds the GLSL enhancements to enable CSM. This code is injected into the built-in material shaders by [CSM](CSM.html). + +## Source + +[examples/jsm/csm/CSMShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/csm/CSMShader.js) \ No newline at end of file diff --git a/docs/pages/module-CameraUtils.html.md b/docs/pages/module-CameraUtils.html.md new file mode 100644 index 00000000000000..7a59fe40742319 --- /dev/null +++ b/docs/pages/module-CameraUtils.html.md @@ -0,0 +1,41 @@ +# CameraUtils + +## Import + +CameraUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as CameraUtils from 'three/addons/utils/CameraUtils.js'; +``` + +## Methods + +### .frameCorners( camera : PerspectiveCamera, bottomLeftCorner : Vector3, bottomRightCorner : Vector3, topLeftCorner : Vector3, estimateViewFrustum : boolean ) (inner) + +Set projection matrix and the orientation of a perspective camera to exactly frame the corners of an arbitrary rectangle. NOTE: This function ignores the standard parameters; do not call `updateProjectionMatrix()` after this. + +**camera** + +The camera. + +**bottomLeftCorner** + +The bottom-left corner point. + +**bottomRightCorner** + +The bottom-right corner point. + +**topLeftCorner** + +The top-left corner point. + +**estimateViewFrustum** + +If set to `true`, the function tries to estimate the camera's FOV. + +Default is `false`. + +## Source + +[examples/jsm/utils/CameraUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/CameraUtils.js) \ No newline at end of file diff --git a/docs/pages/module-ColorCorrectionShader.html.md b/docs/pages/module-ColorCorrectionShader.html.md new file mode 100644 index 00000000000000..62c9047da57b5a --- /dev/null +++ b/docs/pages/module-ColorCorrectionShader.html.md @@ -0,0 +1,19 @@ +# ColorCorrectionShader + +## Import + +ColorCorrectionShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ColorCorrectionShader } from 'three/addons/shaders/ColorCorrectionShader.js'; +``` + +## Properties + +### .ColorCorrectionShader : ShaderMaterial~Shader (inner, constant) + +Color correction shader. + +## Source + +[examples/jsm/shaders/ColorCorrectionShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/ColorCorrectionShader.js) \ No newline at end of file diff --git a/docs/pages/module-ColorSpaces.html.md b/docs/pages/module-ColorSpaces.html.md new file mode 100644 index 00000000000000..5e9e9970a66082 --- /dev/null +++ b/docs/pages/module-ColorSpaces.html.md @@ -0,0 +1,80 @@ +# ColorSpaces + +## Properties + +### .DisplayP3ColorSpace : string (constant) + +Display-P3 color space. + +### .DisplayP3ColorSpaceImpl : module:ColorSpaces~ColorSpaceImpl (constant) + +Implementation object for the Display-P3 color space. + +### .ExtendedSRGBColorSpace : string (constant) + +Extended-sRGB color space. + +### .ExtendedSRGBColorSpaceImpl : module:ColorSpaces~ColorSpaceImpl (constant) + +Implementation object for the Extended-sRGB color space. + +### .LinearDisplayP3ColorSpace : string (constant) + +Display-P3-Linear color space. + +### .LinearDisplayP3ColorSpaceImpl : module:ColorSpaces~ColorSpaceImpl (constant) + +Implementation object for the Display-P3-Linear color space. + +### .LinearRec2020ColorSpace : string (constant) + +Rec2020-Linear color space. + +### .LinearRec2020ColorSpaceImpl : module:ColorSpaces~ColorSpaceImpl (constant) + +Implementation object for the Rec2020-Linear color space. + +## Type Definitions + +### .ColorSpaceImpl + +An object holding the color space implementation. + +**primaries** +Array. + +The primaries. + +**whitePoint** +Array. + +The white point. + +**toXYZ** +[Matrix3](Matrix3.html) + +A color space conversion matrix, converting to CIE XYZ. + +**fromXYZ** +[Matrix3](Matrix3.html) + +A color space conversion matrix, converting from CIE XYZ. + +**luminanceCoefficients** +Array. + +The luminance coefficients. + +**workingColorSpaceConfig** +Object + +The working color space config. + +**outputColorSpaceConfig** +Object + +The drawing buffer color space config. + +## Source + +[examples/jsm/math/ColorSpaces.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/ColorSpaces.js) \ No newline at end of file diff --git a/docs/pages/module-ColorifyShader.html.md b/docs/pages/module-ColorifyShader.html.md new file mode 100644 index 00000000000000..006ef13cbc42de --- /dev/null +++ b/docs/pages/module-ColorifyShader.html.md @@ -0,0 +1,19 @@ +# ColorifyShader + +## Import + +ColorifyShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ColorifyShader } from 'three/addons/shaders/ColorifyShader.js'; +``` + +## Properties + +### .ColorifyShader : ShaderMaterial~Shader (inner, constant) + +Colorify shader. + +## Source + +[examples/jsm/shaders/ColorifyShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/ColorifyShader.js) \ No newline at end of file diff --git a/docs/pages/module-ConvolutionShader.html.md b/docs/pages/module-ConvolutionShader.html.md new file mode 100644 index 00000000000000..05a633c2c7f182 --- /dev/null +++ b/docs/pages/module-ConvolutionShader.html.md @@ -0,0 +1,19 @@ +# ConvolutionShader + +## Import + +ConvolutionShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ConvolutionShader } from 'three/addons/shaders/ConvolutionShader.js'; +``` + +## Properties + +### .ConvolutionShader : ShaderMaterial~Shader (inner, constant) + +Convolution shader ported from o3d sample to WebGL / GLSL. + +## Source + +[examples/jsm/shaders/ConvolutionShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/ConvolutionShader.js) \ No newline at end of file diff --git a/docs/pages/module-CopyShader.html.md b/docs/pages/module-CopyShader.html.md new file mode 100644 index 00000000000000..76cad2c16c2d7a --- /dev/null +++ b/docs/pages/module-CopyShader.html.md @@ -0,0 +1,19 @@ +# CopyShader + +## Import + +CopyShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { CopyShader } from 'three/addons/shaders/CopyShader.js'; +``` + +## Properties + +### .CopyShader : ShaderMaterial~Shader (inner, constant) + +Full-screen copy shader pass. + +## Source + +[examples/jsm/shaders/CopyShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/CopyShader.js) \ No newline at end of file diff --git a/docs/pages/module-DOFMipMapShader.html.md b/docs/pages/module-DOFMipMapShader.html.md new file mode 100644 index 00000000000000..335a7dcf95139d --- /dev/null +++ b/docs/pages/module-DOFMipMapShader.html.md @@ -0,0 +1,21 @@ +# DOFMipMapShader + +## Import + +DOFMipMapShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DOFMipMapShader } from 'three/addons/shaders/DOFMipMapShader.js'; +``` + +## Properties + +### .DOFMipMapShader : ShaderMaterial~Shader (inner, constant) + +Depth-of-field shader using mipmaps from Matt Handley @applmak. + +Requires power-of-2 sized render target with enabled mipmaps. + +## Source + +[examples/jsm/shaders/DOFMipMapShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/DOFMipMapShader.js) \ No newline at end of file diff --git a/docs/pages/module-DepthLimitedBlurShader.html.md b/docs/pages/module-DepthLimitedBlurShader.html.md new file mode 100644 index 00000000000000..dc8f154aba65a0 --- /dev/null +++ b/docs/pages/module-DepthLimitedBlurShader.html.md @@ -0,0 +1,21 @@ +# DepthLimitedBlurShader + +## Import + +DepthLimitedBlurShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DepthLimitedBlurShader, BlurShaderUtils } from 'three/addons/shaders/DepthLimitedBlurShader.js'; +``` + +## Properties + +### .DepthLimitedBlurShader : ShaderMaterial~Shader (inner, constant) + +TODO + +Used by [SAOPass](SAOPass.html). + +## Source + +[examples/jsm/shaders/DepthLimitedBlurShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/DepthLimitedBlurShader.js) \ No newline at end of file diff --git a/docs/pages/module-DigitalGlitch.html.md b/docs/pages/module-DigitalGlitch.html.md new file mode 100644 index 00000000000000..e23695317a2208 --- /dev/null +++ b/docs/pages/module-DigitalGlitch.html.md @@ -0,0 +1,19 @@ +# DigitalGlitch + +## Import + +DigitalGlitch is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DigitalGlitch } from 'three/addons/shaders/DigitalGlitch.js'; +``` + +## Properties + +### .DigitalGlitch : ShaderMaterial~Shader (inner, constant) + +Digital glitch shader. + +## Source + +[examples/jsm/shaders/DigitalGlitch.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/DigitalGlitch.js) \ No newline at end of file diff --git a/docs/pages/module-DotScreenShader.html.md b/docs/pages/module-DotScreenShader.html.md new file mode 100644 index 00000000000000..f42366e6ac2051 --- /dev/null +++ b/docs/pages/module-DotScreenShader.html.md @@ -0,0 +1,19 @@ +# DotScreenShader + +## Import + +DotScreenShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { DotScreenShader } from 'three/addons/shaders/DotScreenShader.js'; +``` + +## Properties + +### .DotScreenShader : ShaderMaterial~Shader (inner, constant) + +Dot screen shader based on [glfx.js sepia shader](https://github.com/evanw/glfx.js). + +## Source + +[examples/jsm/shaders/DotScreenShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/DotScreenShader.js) \ No newline at end of file diff --git a/docs/pages/module-ExposureShader.html.md b/docs/pages/module-ExposureShader.html.md new file mode 100644 index 00000000000000..7c1cca83fc185a --- /dev/null +++ b/docs/pages/module-ExposureShader.html.md @@ -0,0 +1,19 @@ +# ExposureShader + +## Import + +ExposureShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { ExposureShader } from 'three/addons/shaders/ExposureShader.js'; +``` + +## Properties + +### .ExposureShader : ShaderMaterial~Shader (inner, constant) + +TODO + +## Source + +[examples/jsm/shaders/ExposureShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/ExposureShader.js) \ No newline at end of file diff --git a/docs/pages/module-FXAAShader.html.md b/docs/pages/module-FXAAShader.html.md new file mode 100644 index 00000000000000..e7e81f3c64c0e3 --- /dev/null +++ b/docs/pages/module-FXAAShader.html.md @@ -0,0 +1,24 @@ +# FXAAShader + +## Import + +FXAAShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FXAAShader } from 'three/addons/shaders/FXAAShader.js'; +``` + +## Properties + +### .FXAAShader : ShaderMaterial~Shader (inner, constant) + +FXAA algorithm from NVIDIA, C# implementation by Jasper Flick, GLSL port by Dave Hoskins. + +References: + +* [http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA\_WhitePaper.pdf](http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf). +* [https://catlikecoding.com/unity/tutorials/advanced-rendering/fxaa/](https://catlikecoding.com/unity/tutorials/advanced-rendering/fxaa/). + +## Source + +[examples/jsm/shaders/FXAAShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/FXAAShader.js) \ No newline at end of file diff --git a/docs/pages/module-FilmShader.html.md b/docs/pages/module-FilmShader.html.md new file mode 100644 index 00000000000000..df736107f4670c --- /dev/null +++ b/docs/pages/module-FilmShader.html.md @@ -0,0 +1,21 @@ +# FilmShader + +## Import + +FilmShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FilmShader } from 'three/addons/shaders/FilmShader.js'; +``` + +## Properties + +### .FilmShader : ShaderMaterial~Shader (inner, constant) + +TODO + +Used by [FilmPass](FilmPass.html). + +## Source + +[examples/jsm/shaders/FilmShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/FilmShader.js) \ No newline at end of file diff --git a/docs/pages/module-FocusShader.html.md b/docs/pages/module-FocusShader.html.md new file mode 100644 index 00000000000000..9979f01a4280c7 --- /dev/null +++ b/docs/pages/module-FocusShader.html.md @@ -0,0 +1,19 @@ +# FocusShader + +## Import + +FocusShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FocusShader } from 'three/addons/shaders/FocusShader.js'; +``` + +## Properties + +### .FocusShader : ShaderMaterial~Shader (inner, constant) + +Focus shader based on [PaintEffect postprocess from ro.me](http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js). + +## Source + +[examples/jsm/shaders/FocusShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/FocusShader.js) \ No newline at end of file diff --git a/docs/pages/module-FreiChenShader.html.md b/docs/pages/module-FreiChenShader.html.md new file mode 100644 index 00000000000000..ddbd51e123cf15 --- /dev/null +++ b/docs/pages/module-FreiChenShader.html.md @@ -0,0 +1,21 @@ +# FreiChenShader + +## Import + +FreiChenShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { FreiChenShader } from 'three/addons/shaders/FreiChenShader.js'; +``` + +## Properties + +### .FreiChenShader : ShaderMaterial~Shader (inner, constant) + +Edge Detection Shader using Frei-Chen filter. Based on [http://rastergrid.com/blog/2011/01/frei-chen-edge-detector](http://rastergrid.com/blog/2011/01/frei-chen-edge-detector). + +aspect: vec2 of (1/width, 1/height) + +## Source + +[examples/jsm/shaders/FreiChenShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/FreiChenShader.js) \ No newline at end of file diff --git a/docs/pages/module-GTAOShader.html.md b/docs/pages/module-GTAOShader.html.md new file mode 100644 index 00000000000000..0d935046d17239 --- /dev/null +++ b/docs/pages/module-GTAOShader.html.md @@ -0,0 +1,32 @@ +# GTAOShader + +## Import + +GTAOShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GTAOShader } from 'three/addons/shaders/GTAOShader.js'; +``` + +## Properties + +### .GTAOBlendShader : Object (inner, constant) + +GTAO blend shader. Use by [GTAOPass](GTAOPass.html). + +### .GTAODepthShader : Object (inner, constant) + +GTAO depth shader. Use by [GTAOPass](GTAOPass.html). + +### .GTAOShader : ShaderMaterial~Shader (inner, constant) + +GTAO shader. Use by [GTAOPass](GTAOPass.html). + +References: + +* [Practical Realtime Strategies for Accurate Indirect Occlusion](https://iryoku.com/downloads/Practical-Realtime-Strategies-for-Accurate-Indirect-Occlusion.pdf). +* [Horizon-Based Indirect Lighting (HBIL)](https://github.com/Patapom/GodComplex/blob/master/Tests/TestHBIL/2018%20Mayaux%20-%20Horizon-Based%20Indirect%20Lighting%20\(HBIL\).pdf) + +## Source + +[examples/jsm/shaders/GTAOShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/GTAOShader.js) \ No newline at end of file diff --git a/docs/pages/module-GammaCorrectionShader.html.md b/docs/pages/module-GammaCorrectionShader.html.md new file mode 100644 index 00000000000000..bd7065d43158b7 --- /dev/null +++ b/docs/pages/module-GammaCorrectionShader.html.md @@ -0,0 +1,23 @@ +# GammaCorrectionShader + +## Import + +GammaCorrectionShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js'; +``` + +## Properties + +### .GammaCorrectionShader : ShaderMaterial~Shader (inner, constant) + +Gamma Correction Shader + +References: + +* [http://en.wikipedia.org/wiki/gamma\_correction](http://en.wikipedia.org/wiki/gamma_correction). + +## Source + +[examples/jsm/shaders/GammaCorrectionShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/GammaCorrectionShader.js) \ No newline at end of file diff --git a/docs/pages/module-GeometryCompressionUtils.html.md b/docs/pages/module-GeometryCompressionUtils.html.md new file mode 100644 index 00000000000000..70f2739c67054c --- /dev/null +++ b/docs/pages/module-GeometryCompressionUtils.html.md @@ -0,0 +1,43 @@ +# GeometryCompressionUtils + +## Import + +GeometryCompressionUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as GeometryCompressionUtils from 'three/addons/utils/GeometryCompressionUtils.js'; +``` + +## Methods + +### .compressNormals( geometry : BufferGeometry, encodeMethod : 'DEFAULT' | 'OCT1Byte' | 'OCT2Byte' | 'ANGLES' ) (inner) + +Compressed the given geometry's `normal` attribute by the selected encode method. + +**geometry** + +The geometry whose normals should be compressed. + +**encodeMethod** + +The compression method. + +### .compressPositions( geometry : BufferGeometry ) (inner) + +Compressed the given geometry's `position` attribute. + +**geometry** + +The geometry whose position values should be compressed. + +### .compressUvs( geometry : BufferGeometry ) (inner) + +Compressed the given geometry's `uv` attribute. + +**geometry** + +The geometry whose texture coordinates should be compressed. + +## Source + +[examples/jsm/utils/GeometryCompressionUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/GeometryCompressionUtils.js) \ No newline at end of file diff --git a/docs/pages/module-GeometryUtils.html.md b/docs/pages/module-GeometryUtils.html.md new file mode 100644 index 00000000000000..d3559d2b329643 --- /dev/null +++ b/docs/pages/module-GeometryUtils.html.md @@ -0,0 +1,151 @@ +# GeometryUtils + +## Import + +GeometryUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; +``` + +## Methods + +### .gosper( size : number ) : Array. (inner) + +Generates a Gosper curve (lying in the XY plane). + +Reference: [https://gist.github.com/nitaku/6521802](https://gist.github.com/nitaku/6521802) + +**size** + +The size of a single gosper island. + +Default is `1`. + +**Returns:** The gosper island points. + +### .hilbert2D( center : Vector3, size : number, iterations : number, v0 : number, v1 : number, v2 : number, v3 : number ) : Array. (inner) + +Generates 2D-Coordinates along a Hilbert curve. + +Based on work by: [http://www.openprocessing.org/sketch/15493](http://www.openprocessing.org/sketch/15493) + +**center** + +Center of Hilbert curve. + +**size** + +Total width of Hilbert curve. + +Default is `10`. + +**iterations** + +Number of subdivisions. + +Default is `10`. + +**v0** + +Corner index -X, -Z. + +Default is `0`. + +**v1** + +Corner index -X, +Z. + +Default is `1`. + +**v2** + +Corner index +X, +Z. + +Default is `2`. + +**v3** + +Corner index +X, -Z. + +Default is `3`. + +**Returns:** The Hilbert curve points. + +### .hilbert3D( center : Vector3, size : number, iterations : number, v0 : number, v1 : number, v2 : number, v3 : number, v4 : number, v5 : number, v6 : number, v7 : number ) : Array. (inner) + +Generates 3D-Coordinates along a Hilbert curve. + +Based on work by: [https://openprocessing.org/user/5654](https://openprocessing.org/user/5654) + +**center** + +Center of Hilbert curve. + +**size** + +Total width of Hilbert curve. + +Default is `10`. + +**iterations** + +Number of subdivisions. + +Default is `1`. + +**v0** + +Corner index -X, +Y, -Z. + +Default is `0`. + +**v1** + +Corner index -X, +Y, +Z. + +Default is `1`. + +**v2** + +Corner index -X, -Y, +Z. + +Default is `2`. + +**v3** + +Corner index -X, -Y, -Z. + +Default is `3`. + +**v4** + +Corner index +X, -Y, -Z. + +Default is `4`. + +**v5** + +Corner index +X, -Y, +Z. + +Default is `5`. + +**v6** + +Corner index +X, +Y, +Z. + +Default is `6`. + +**v7** + +Corner index +X, +Y, -Z. + +Default is `7`. + +**Returns:** + +* The Hilbert curve points. + +## Source + +[examples/jsm/utils/GeometryUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/GeometryUtils.js) \ No newline at end of file diff --git a/docs/pages/module-GodRaysShader.html.md b/docs/pages/module-GodRaysShader.html.md new file mode 100644 index 00000000000000..a9d9cebe14d9bd --- /dev/null +++ b/docs/pages/module-GodRaysShader.html.md @@ -0,0 +1,47 @@ +# GodRaysShader + +## Import + +GodRaysShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as GodRaysShader from 'three/addons/shaders/GodRaysShader.js'; +``` + +## Properties + +### .GodRaysCombineShader : ShaderMaterial~Shader (inner, constant) + +Additively applies god rays from texture tGodRays to a background (tColors). fGodRayIntensity attenuates the god rays. + +### .GodRaysDepthMaskShader : ShaderMaterial~Shader (inner, constant) + +God-rays (crepuscular rays) + +Similar implementation to the one used by Crytek for CryEngine 2 \[Sousa2008\]. Blurs a mask generated from the depth map along radial lines emanating from the light source. The blur repeatedly applies a blur filter of increasing support but constant sample count to produce a blur filter with large support. + +My implementation performs 3 passes, similar to the implementation from Sousa. I found just 6 samples per pass produced acceptable results. The blur is applied three times, with decreasing filter support. The result is equivalent to a single pass with 6_6_6 = 216 samples. + +References: + +* [Sousa2008, Crysis Next Gen Effects, GDC2008](http://www.crytek.com/sites/default/files/GDC08_SousaT_CrysisEffects.ppt). + +### .GodRaysFakeSunShader : Object (inner, constant) + +A dodgy sun/sky shader. Makes a bright spot at the sun location. Would be cheaper/faster/simpler to implement this as a simple sun sprite. + +### .GodRaysGenerateShader : ShaderMaterial~Shader (inner, constant) + +The god-ray generation shader. + +First pass: + +The depth map is blurred along radial lines towards the "sun". The output is written to a temporary render target (I used a 1/4 sized target). + +Pass two & three: + +The results of the previous pass are re-blurred, each time with a decreased distance between samples. + +## Source + +[examples/jsm/shaders/GodRaysShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/GodRaysShader.js) \ No newline at end of file diff --git a/docs/pages/module-HalftoneShader.html.md b/docs/pages/module-HalftoneShader.html.md new file mode 100644 index 00000000000000..38c0624b11133d --- /dev/null +++ b/docs/pages/module-HalftoneShader.html.md @@ -0,0 +1,23 @@ +# HalftoneShader + +## Import + +HalftoneShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HalftoneShader } from 'three/addons/shaders/HalftoneShader.js'; +``` + +## Properties + +### .HalftoneShader : ShaderMaterial~Shader (inner, constant) + +RGB Halftone shader. + +Used by [HalftonePass](HalftonePass.html). + +Shape (1 = Dot, 2 = Ellipse, 3 = Line, 4 = Square) Blending Mode (1 = Linear, 2 = Multiply, 3 = Add, 4 = Lighter, 5 = Darker) + +## Source + +[examples/jsm/shaders/HalftoneShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/HalftoneShader.js) \ No newline at end of file diff --git a/docs/pages/module-HorizontalBlurShader.html.md b/docs/pages/module-HorizontalBlurShader.html.md new file mode 100644 index 00000000000000..02f2e74f28e0bb --- /dev/null +++ b/docs/pages/module-HorizontalBlurShader.html.md @@ -0,0 +1,30 @@ +# HorizontalBlurShader + +## Import + +HorizontalBlurShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HorizontalBlurShader } from 'three/addons/shaders/HorizontalBlurShader.js'; +``` + +## Properties + +### .HorizontalBlurShader : ShaderMaterial~Shader (inner, constant) + +Two pass Gaussian blur filter (horizontal and vertical blur shaders). + +References: + +* [http://www.cake23.de/traveling-wavefronts-lit-up.html](http://www.cake23.de/traveling-wavefronts-lit-up.html). + +* 9 samples per pass + +* standard deviation 2.7 + +* "h" and "v" parameters should be set to "1 / width" and "1 / height" + + +## Source + +[examples/jsm/shaders/HorizontalBlurShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/HorizontalBlurShader.js) \ No newline at end of file diff --git a/docs/pages/module-HorizontalTiltShiftShader.html.md b/docs/pages/module-HorizontalTiltShiftShader.html.md new file mode 100644 index 00000000000000..ddec2a64359180 --- /dev/null +++ b/docs/pages/module-HorizontalTiltShiftShader.html.md @@ -0,0 +1,24 @@ +# HorizontalTiltShiftShader + +## Import + +HorizontalTiltShiftShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HorizontalTiltShiftShader } from 'three/addons/shaders/HorizontalTiltShiftShader.js'; +``` + +## Properties + +### .HorizontalTiltShiftShader : ShaderMaterial~Shader (inner, constant) + +Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position. + +* 9 samples per pass +* standard deviation 2.7 +* "h" and "v" parameters should be set to "1 / width" and "1 / height" +* "r" parameter control where "focused" horizontal line lies + +## Source + +[examples/jsm/shaders/HorizontalTiltShiftShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/HorizontalTiltShiftShader.js) \ No newline at end of file diff --git a/docs/pages/module-HueSaturationShader.html.md b/docs/pages/module-HueSaturationShader.html.md new file mode 100644 index 00000000000000..2d3a0d0aad387f --- /dev/null +++ b/docs/pages/module-HueSaturationShader.html.md @@ -0,0 +1,21 @@ +# HueSaturationShader + +## Import + +HueSaturationShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { HueSaturationShader } from 'three/addons/shaders/HueSaturationShader.js'; +``` + +## Properties + +### .HueSaturationShader : ShaderMaterial~Shader (inner, constant) + +Hue and saturation adjustment, [https://github.com/evanw/glfx.js](https://github.com/evanw/glfx.js). + +hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc. saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) + +## Source + +[examples/jsm/shaders/HueSaturationShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/HueSaturationShader.js) \ No newline at end of file diff --git a/docs/pages/module-Interpolations.html.md b/docs/pages/module-Interpolations.html.md new file mode 100644 index 00000000000000..b2d2509952bb99 --- /dev/null +++ b/docs/pages/module-Interpolations.html.md @@ -0,0 +1,85 @@ +# Interpolations + +Interpolations contains spline and Bézier functions internally used by concrete curve classes. + +Bezier Curves formulas obtained from: https://en.wikipedia.org/wiki/B%C3%A9zier\_curve + +## Methods + +### .CatmullRom( t : number, p0 : number, p1 : number, p2 : number, p3 : number ) : number (inner) + +Computes a point on a Catmull-Rom spline. + +**t** + +The interpolation factor. + +**p0** + +The first control point. + +**p1** + +The second control point. + +**p2** + +The third control point. + +**p3** + +The fourth control point. + +**Returns:** The calculated point on a Catmull-Rom spline. + +### .CubicBezier( t : number, p0 : number, p1 : number, p2 : number, p3 : number ) : number (inner) + +Computes a point on a Cubic Bezier curve. + +**t** + +The interpolation factor. + +**p0** + +The first control point. + +**p1** + +The second control point. + +**p2** + +The third control point. + +**p3** + +The fourth control point. + +**Returns:** The calculated point on a Cubic Bezier curve. + +### .QuadraticBezier( t : number, p0 : number, p1 : number, p2 : number ) : number (inner) + +Computes a point on a Quadratic Bezier curve. + +**t** + +The interpolation factor. + +**p0** + +The first control point. + +**p1** + +The second control point. + +**p2** + +The third control point. + +**Returns:** The calculated point on a Quadratic Bezier curve. + +## Source + +[src/extras/core/Interpolations.js](https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js) \ No newline at end of file diff --git a/docs/pages/module-KaleidoShader.html.md b/docs/pages/module-KaleidoShader.html.md new file mode 100644 index 00000000000000..d691f7444e09ac --- /dev/null +++ b/docs/pages/module-KaleidoShader.html.md @@ -0,0 +1,21 @@ +# KaleidoShader + +## Import + +KaleidoShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { KaleidoShader } from 'three/addons/shaders/KaleidoShader.js'; +``` + +## Properties + +### .KaleidoShader : ShaderMaterial~Shader (inner, constant) + +Kaleidoscope Shader. Radial reflection around center point Ported from: [http://pixelshaders.com/editor/](http://pixelshaders.com/editor/) by [Toby Schachman](http://tobyschachman.com/) + +sides: number of reflections angle: initial angle in radians + +## Source + +[examples/jsm/shaders/KaleidoShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/KaleidoShader.js) \ No newline at end of file diff --git a/docs/pages/module-LuminosityHighPassShader.html.md b/docs/pages/module-LuminosityHighPassShader.html.md new file mode 100644 index 00000000000000..0da5365296b991 --- /dev/null +++ b/docs/pages/module-LuminosityHighPassShader.html.md @@ -0,0 +1,19 @@ +# LuminosityHighPassShader + +## Import + +LuminosityHighPassShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LuminosityHighPassShader } from 'three/addons/shaders/LuminosityHighPassShader.js'; +``` + +## Properties + +### .LuminosityHighPassShader : ShaderMaterial~Shader (inner, constant) + +Luminosity high pass shader. + +## Source + +[examples/jsm/shaders/LuminosityHighPassShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/LuminosityHighPassShader.js) \ No newline at end of file diff --git a/docs/pages/module-LuminosityShader.html.md b/docs/pages/module-LuminosityShader.html.md new file mode 100644 index 00000000000000..c716e932677b84 --- /dev/null +++ b/docs/pages/module-LuminosityShader.html.md @@ -0,0 +1,19 @@ +# LuminosityShader + +## Import + +LuminosityShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { LuminosityShader } from 'three/addons/shaders/LuminosityShader.js'; +``` + +## Properties + +### .LuminosityShader : ShaderMaterial~Shader (inner, constant) + +Luminosity shader. + +## Source + +[examples/jsm/shaders/LuminosityShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/LuminosityShader.js) \ No newline at end of file diff --git a/docs/pages/module-MirrorShader.html.md b/docs/pages/module-MirrorShader.html.md new file mode 100644 index 00000000000000..35d084d06bd65a --- /dev/null +++ b/docs/pages/module-MirrorShader.html.md @@ -0,0 +1,21 @@ +# MirrorShader + +## Import + +MirrorShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { MirrorShader } from 'three/addons/shaders/MirrorShader.js'; +``` + +## Properties + +### .MirrorShader : ShaderMaterial~Shader (inner, constant) + +Copies half the input to the other half. + +side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom). + +## Source + +[examples/jsm/shaders/MirrorShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/MirrorShader.js) \ No newline at end of file diff --git a/docs/pages/module-NURBSUtils.html.md b/docs/pages/module-NURBSUtils.html.md new file mode 100644 index 00000000000000..f180416d453a0d --- /dev/null +++ b/docs/pages/module-NURBSUtils.html.md @@ -0,0 +1,263 @@ +# NURBSUtils + +## Import + +NURBSUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as NURBSUtils from 'three/addons/curves/NURBSUtils.js'; +``` + +## Methods + +### .calcBSplineDerivatives( p : number, U : Array., P : Array., u : number, nd : number ) : Array. (inner) + +Calculates derivatives of a B-Spline. See The NURBS Book, page 93, algorithm A3.2. + +**p** + +The degree. + +**U** + +The knot vector. + +**P** + +The control points + +**u** + +The parametric point. + +**nd** + +The number of derivatives. + +**Returns:** An array\[d+1\] with derivatives. + +### .calcBSplinePoint( p : number, U : Array., P : Array., u : number ) : Vector4 (inner) + +Calculates B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1. + +**p** + +The degree of the B-Spline. + +**U** + +The knot vector. + +**P** + +The control points + +**u** + +The parametric point. + +**Returns:** The point for given `u`. + +### .calcBasisFunctionDerivatives( span : number, u : number, p : number, n : number, U : Array. ) : Array.> (inner) + +Calculates basis functions derivatives. See The NURBS Book, page 72, algorithm A2.3. + +**span** + +The span in which `u` lies. + +**u** + +The parametric point. + +**p** + +The degree. + +**n** + +number of derivatives to calculate + +**U** + +The knot vector. + +**Returns:** An array\[n+1\]\[p+1\] with basis functions derivatives. + +### .calcBasisFunctions( span : number, u : number, p : number, U : Array. ) : Array. (inner) + +Calculates basis functions. See The NURBS Book, page 70, algorithm A2.2. + +**span** + +The span in which `u` lies. + +**u** + +The parametric value. + +**p** + +The degree. + +**U** + +The knot vector. + +**Returns:** Array\[p+1\] with basis functions values. + +### .calcKoverI( k : number, i : number ) : number (inner) + +Calculates "K over I". + +**k** + +The K value. + +**i** + +The I value. + +**Returns:** k!/(i!(k-i)!) + +### .calcNURBSDerivatives( p : number, U : Array., P : Array., u : number, nd : number ) : Array. (inner) + +Calculates NURBS curve derivatives. See The NURBS Book, page 127, algorithm A4.2. + +**p** + +The degree. + +**U** + +The knot vector. + +**P** + +The control points in homogeneous space. + +**u** + +The parametric point. + +**nd** + +The number of derivatives. + +**Returns:** array with derivatives for rational curve. + +### .calcRationalCurveDerivatives( Pders : Array. ) : Array. (inner) + +Calculates derivatives (0-nd) of rational curve. See The NURBS Book, page 127, algorithm A4.2. + +**Pders** + +Array with derivatives. + +**Returns:** An array with derivatives for rational curve. + +### .calcSurfacePoint( p : number, q : number, U : Array., V : Array., P : Array.>, u : number, v : number, target : Vector3 ) (inner) + +Calculates a rational B-Spline surface point. See The NURBS Book, page 134, algorithm A4.3. + +**p** + +The first degree of B-Spline surface. + +**q** + +The second degree of B-Spline surface. + +**U** + +The first knot vector. + +**V** + +The second knot vector. + +**P** + +The control points in homogeneous space. + +**u** + +The first parametric point. + +**v** + +The second parametric point. + +**target** + +The target vector. + +### .calcVolumePoint( p : number, q : number, r : number, U : Array., V : Array., W : Array., P : Array.>>, u : number, v : number, w : number, target : Vector3 ) (inner) + +Calculates a rational B-Spline volume point. See The NURBS Book, page 134, algorithm A4.3. + +**p** + +The first degree of B-Spline surface. + +**q** + +The second degree of B-Spline surface. + +**r** + +The third degree of B-Spline surface. + +**U** + +The first knot vector. + +**V** + +The second knot vector. + +**W** + +The third knot vector. + +**P** + +The control points in homogeneous space. + +**u** + +The first parametric point. + +**v** + +The second parametric point. + +**w** + +The third parametric point. + +**target** + +The target vector. + +### .findSpan( p : number, u : number, U : Array. ) : number (inner) + +Finds knot vector span. + +**p** + +The degree. + +**u** + +The parametric value. + +**U** + +The knot vector. + +**Returns:** The span. + +## Source + +[examples/jsm/curves/NURBSUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/curves/NURBSUtils.js) \ No newline at end of file diff --git a/docs/pages/module-NormalMapShader.html.md b/docs/pages/module-NormalMapShader.html.md new file mode 100644 index 00000000000000..21585c74eb8f01 --- /dev/null +++ b/docs/pages/module-NormalMapShader.html.md @@ -0,0 +1,19 @@ +# NormalMapShader + +## Import + +NormalMapShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { NormalMapShader } from 'three/addons/shaders/NormalMapShader.js'; +``` + +## Properties + +### .NormalMapShader : ShaderMaterial~Shader (inner, constant) + +Normal map shader, compute normals from heightmap. + +## Source + +[examples/jsm/shaders/NormalMapShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/NormalMapShader.js) \ No newline at end of file diff --git a/docs/pages/module-OutputShader.html.md b/docs/pages/module-OutputShader.html.md new file mode 100644 index 00000000000000..0cb2b50013b949 --- /dev/null +++ b/docs/pages/module-OutputShader.html.md @@ -0,0 +1,21 @@ +# OutputShader + +## Import + +OutputShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { OutputShader } from 'three/addons/shaders/OutputShader.js'; +``` + +## Properties + +### .OutputShader : ShaderMaterial~Shader (inner, constant) + +Performs tone mapping and color space conversion for FX workflows. + +Used by [OutputPass](OutputPass.html). + +## Source + +[examples/jsm/shaders/OutputShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/OutputShader.js) \ No newline at end of file diff --git a/docs/pages/module-ParametricFunctions.html.md b/docs/pages/module-ParametricFunctions.html.md new file mode 100644 index 00000000000000..8abc4e876d1f2e --- /dev/null +++ b/docs/pages/module-ParametricFunctions.html.md @@ -0,0 +1,79 @@ +# ParametricFunctions + +## Import + +ParametricFunctions is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as ParametricFunctions from 'three/addons/geometries/ParametricFunctions.js'; +``` + +## Methods + +### .klein( v : number, u : number, target : Vector3 ) (inner) + +A parametric function representing the Klein bottle. + +**v** + +The `v` coordinate on the surface in the range `[0,1]`. + +**u** + +The `u` coordinate on the surface in the range `[0,1]`. + +**target** + +The target vector that is used to store the method's result. + +### .mobius( u : number, t : number, target : Vector3 ) (inner) + +A parametric function representing a flat mobius strip. + +**u** + +The `u` coordinate on the surface in the range `[0,1]`. + +**t** + +The `v` coordinate on the surface in the range `[0,1]`. + +**target** + +The target vector that is used to store the method's result. + +### .mobius3d( u : number, t : number, target : Vector3 ) (inner) + +A parametric function representing a volumetric mobius strip. + +**u** + +The `u` coordinate on the surface in the range `[0,1]`. + +**t** + +The `v` coordinate on the surface in the range `[0,1]`. + +**target** + +The target vector that is used to store the method's result. + +### .plane( u : number, v : number, target : Vector3 ) (inner) + +A parametric function representing a flat plane. + +**u** + +The `u` coordinate on the surface in the range `[0,1]`. + +**v** + +The `v` coordinate on the surface in the range `[0,1]`. + +**target** + +The target vector that is used to store the method's result. + +## Source + +[examples/jsm/geometries/ParametricFunctions.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/ParametricFunctions.js) \ No newline at end of file diff --git a/docs/pages/module-PoissonDenoiseShader.html.md b/docs/pages/module-PoissonDenoiseShader.html.md new file mode 100644 index 00000000000000..6e3fdca164939c --- /dev/null +++ b/docs/pages/module-PoissonDenoiseShader.html.md @@ -0,0 +1,24 @@ +# PoissonDenoiseShader + +## Import + +PoissonDenoiseShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { PoissonDenoiseShader } from 'three/addons/shaders/PoissonDenoiseShader.js'; +``` + +## Properties + +### .PoissonDenoiseShader : ShaderMaterial~Shader (inner, constant) + +Poisson Denoise Shader. + +References: + +* [Self-Supervised Poisson-Gaussian Denoising](https://openaccess.thecvf.com/content/WACV2021/papers/Khademi_Self-Supervised_Poisson-Gaussian_Denoising_WACV_2021_paper.pdf). +* [Poisson2Sparse: Self-Supervised Poisson Denoising From a Single Image](https://arxiv.org/pdf/2206.01856.pdf) + +## Source + +[examples/jsm/shaders/PoissonDenoiseShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/PoissonDenoiseShader.js) \ No newline at end of file diff --git a/docs/pages/module-RGBShiftShader.html.md b/docs/pages/module-RGBShiftShader.html.md new file mode 100644 index 00000000000000..426ce2df49f66c --- /dev/null +++ b/docs/pages/module-RGBShiftShader.html.md @@ -0,0 +1,21 @@ +# RGBShiftShader + +## Import + +RGBShiftShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RGBShiftShader } from 'three/addons/shaders/RGBShiftShader.js'; +``` + +## Properties + +### .RGBShiftShader : ShaderMaterial~Shader (inner, constant) + +RGB Shift Shader Shifts red and blue channels from center in opposite directions Ported from https://web.archive.org/web/20090820185047/http://kriss.cx/tom/2009/05/rgb-shift/ by Tom Butterworth / https://web.archive.org/web/20090810054752/http://kriss.cx/tom/ + +amount: shift distance (1 is width of input) angle: shift angle in radians + +## Source + +[examples/jsm/shaders/RGBShiftShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/RGBShiftShader.js) \ No newline at end of file diff --git a/docs/pages/module-Raymarching.html.md b/docs/pages/module-Raymarching.html.md new file mode 100644 index 00000000000000..e8c48349898ed9 --- /dev/null +++ b/docs/pages/module-Raymarching.html.md @@ -0,0 +1,32 @@ +# Raymarching + +## Import + +Raymarching is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { RaymarchingBox } from 'three/addons/tsl/utils/Raymarching.js'; +``` + +## Static Methods + +### .RaymarchingBox( steps : number | Node, callback : function | FunctionNode ) + +TSL function for performing raymarching in a box-area using the specified number of steps and a callback function. + +```js +RaymarchingBox( count, ( { positionRay } ) => { +} ); +``` + +**steps** + +The number of steps for raymarching. + +**callback** + +The callback function to execute at each step. + +## Source + +[examples/jsm/tsl/utils/Raymarching.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/tsl/utils/Raymarching.js) \ No newline at end of file diff --git a/docs/pages/module-SAOShader.html.md b/docs/pages/module-SAOShader.html.md new file mode 100644 index 00000000000000..0f7883e000a24d --- /dev/null +++ b/docs/pages/module-SAOShader.html.md @@ -0,0 +1,21 @@ +# SAOShader + +## Import + +SAOShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SAOShader } from 'three/addons/shaders/SAOShader.js'; +``` + +## Properties + +### .SAOShader : ShaderMaterial~Shader (inner, constant) + +SAO shader. + +Used by [SAOPass](SAOPass.html). + +## Source + +[examples/jsm/shaders/SAOShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/SAOShader.js) \ No newline at end of file diff --git a/docs/pages/module-SMAAShader.html.md b/docs/pages/module-SMAAShader.html.md new file mode 100644 index 00000000000000..454fc8cc0f1c12 --- /dev/null +++ b/docs/pages/module-SMAAShader.html.md @@ -0,0 +1,33 @@ +# SMAAShader + +## Import + +SMAAShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SMAAShader } from 'three/addons/shaders/SMAAShader.js'; +``` + +WebGL port of Subpixel Morphological Antialiasing (SMAA) v2.8 Preset: SMAA 1x Medium (with color edge detection) + +References: + +* [https://github.com/iryoku/smaa/releases/tag/v2.8](https://github.com/iryoku/smaa/releases/tag/v2.8) + +## Properties + +### .SMAABlendShader : ShaderMaterial~Shader (inner, constant) + +SMAA Blend shader. + +### .SMAAEdgesShader : ShaderMaterial~Shader (inner, constant) + +SMAA Edges shader. + +### .SMAAWeightsShader : ShaderMaterial~Shader (inner, constant) + +SMAA Weights shader. + +## Source + +[examples/jsm/shaders/SMAAShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/SMAAShader.js) \ No newline at end of file diff --git a/docs/pages/module-SSAOShader.html.md b/docs/pages/module-SSAOShader.html.md new file mode 100644 index 00000000000000..bf62fc7a498aec --- /dev/null +++ b/docs/pages/module-SSAOShader.html.md @@ -0,0 +1,33 @@ +# SSAOShader + +## Import + +SSAOShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SSAOShader } from 'three/addons/shaders/SSAOShader.js'; +``` + +## Properties + +### .SSAOBlurShader : Object (inner, constant) + +SSAO blur shader. + +### .SSAODepthShader : ShaderMaterial~Shader (inner, constant) + +SSAO depth shader. + +### .SSAOShader : ShaderMaterial~Shader (inner, constant) + +SSAO shader. + +References: + +* [http://john-chapman-graphics.blogspot.com/2013/01/ssao-tutorial.html](http://john-chapman-graphics.blogspot.com/2013/01/ssao-tutorial.html) +* [https://learnopengl.com/Advanced-Lighting/SSAO](https://learnopengl.com/Advanced-Lighting/SSAO) +* [https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl](https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl) + +## Source + +[examples/jsm/shaders/SSAOShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/SSAOShader.js) \ No newline at end of file diff --git a/docs/pages/module-SSRShader.html.md b/docs/pages/module-SSRShader.html.md new file mode 100644 index 00000000000000..3c473d33e61b27 --- /dev/null +++ b/docs/pages/module-SSRShader.html.md @@ -0,0 +1,33 @@ +# SSRShader + +## Import + +SSRShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as SSRShader from 'three/addons/shaders/SSRShader.js'; +``` + +A collection of shaders used for SSR. + +References: + +* [3D Game Shaders For Beginners, Screen Space Reflection (SSR)](https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html). + +## Properties + +### .SSRBlurShader : ShaderMaterial~Shader (inner, constant) + +SSR Blur shader. + +### .SSRDepthShader : ShaderMaterial~Shader (inner, constant) + +SSR Depth shader. + +### .SSRShader : ShaderMaterial~Shader (inner, constant) + +SSR shader. + +## Source + +[examples/jsm/shaders/SSRShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/SSRShader.js) \ No newline at end of file diff --git a/docs/pages/module-SceneUtils.html.md b/docs/pages/module-SceneUtils.html.md new file mode 100644 index 00000000000000..ad8394ee108ced --- /dev/null +++ b/docs/pages/module-SceneUtils.html.md @@ -0,0 +1,115 @@ +# SceneUtils + +## Import + +SceneUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as SceneUtils from 'three/addons/utils/SceneUtils.js'; +``` + +## Methods + +### .createMeshesFromInstancedMesh( instancedMesh : InstancedMesh ) : Group (inner) + +This function creates a mesh for each instance of the given instanced mesh and adds it to a group. Each mesh will honor the current 3D transformation of its corresponding instance. + +**instancedMesh** + +The instanced mesh. + +**Returns:** A group of meshes. + +### .createMeshesFromMultiMaterialMesh( mesh : Mesh ) : Group (inner) + +This function creates a mesh for each geometry-group of the given multi-material mesh and adds it to a group. + +**mesh** + +The multi-material mesh. + +**Returns:** A group of meshes. + +### .createMultiMaterialObject( geometry : BufferGeometry, materials : Array. ) : Group (inner) + +This function represents an alternative way to create 3D objects with multiple materials. Normally, [BufferGeometry#groups](BufferGeometry.html#groups) are used which might introduce issues e.g. when exporting the object to a 3D format. This function accepts a geometry and an array of materials and creates for each material a mesh that is added to a group. + +**geometry** + +The geometry. + +**materials** + +An array of materials. + +**Returns:** A group representing a multi-material object. + +### .reduceVertices( object : Object3D, func : function, initialValue : any ) : any (inner) + +Executes a reducer function for each vertex of the given 3D object. `reduceVertices()` returns a single value: the function's accumulated result. + +**object** + +The 3D object that should be processed. It must have a geometry with a `position` attribute. + +**func** + +The reducer function. First argument is the current value, second argument the current vertex. + +**initialValue** + +The initial value. + +**Returns:** The result. + +### .sortInstancedMesh( mesh : InstancedMesh, compareFn : function ) (inner) + +Sorts the instances of the given instanced mesh. + +**mesh** + +The instanced mesh to sort. + +**compareFn** + +A custom compare function for the sort. + +### .traverseAncestorsGenerator( object : Object3D ) : Object3D (generator, inner) + +Generator based alternative to [Object3D#traverseAncestors](Object3D.html#traverseAncestors). + +**object** + +Object to traverse. + +##### Yields: + +Objects that passed the filter condition. + +### .traverseGenerator( object : Object3D ) : Object3D (generator, inner) + +Generator based alternative to [Object3D#traverse](Object3D.html#traverse). + +**object** + +Object to traverse. + +##### Yields: + +Objects that passed the filter condition. + +### .traverseVisibleGenerator( object : Object3D ) : Object3D (generator, inner) + +Generator based alternative to [Object3D#traverseVisible](Object3D.html#traverseVisible). + +**object** + +Object to traverse. + +##### Yields: + +Objects that passed the filter condition. + +## Source + +[examples/jsm/utils/SceneUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SceneUtils.js) \ No newline at end of file diff --git a/docs/pages/module-SepiaShader.html.md b/docs/pages/module-SepiaShader.html.md new file mode 100644 index 00000000000000..96a7e8e9b9ed70 --- /dev/null +++ b/docs/pages/module-SepiaShader.html.md @@ -0,0 +1,19 @@ +# SepiaShader + +## Import + +SepiaShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SepiaShader } from 'three/addons/shaders/SepiaShader.js'; +``` + +## Properties + +### .SepiaShader : ShaderMaterial~Shader (inner, constant) + +Sepia tone shader based on [glfx.js sepia shader](https://github.com/evanw/glfx.js). + +## Source + +[examples/jsm/shaders/SepiaShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/SepiaShader.js) \ No newline at end of file diff --git a/docs/pages/module-SkeletonUtils.html.md b/docs/pages/module-SkeletonUtils.html.md new file mode 100644 index 00000000000000..3c0c6abd765e64 --- /dev/null +++ b/docs/pages/module-SkeletonUtils.html.md @@ -0,0 +1,138 @@ +# SkeletonUtils + +## Import + +SkeletonUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js'; +``` + +## Methods + +### .clone( source : Object3D ) : Object3D (inner) + +Clones the given 3D object and its descendants, ensuring that any `SkinnedMesh` instances are correctly associated with their bones. Bones are also cloned, and must be descendants of the object passed to this method. Other data, like geometries and materials, are reused by reference. + +**source** + +The 3D object to clone. + +**Returns:** The cloned 3D object. + +### .retarget( target : Object3D, source : Object3D, options : module:SkeletonUtils~RetargetOptions ) (inner) + +Retargets the skeleton from the given source 3D object to the target 3D object. + +**target** + +The target 3D object. + +**source** + +The source 3D object. + +**options** + +The options. + +### .retargetClip( target : Object3D, source : Object3D, clip : AnimationClip, options : module:SkeletonUtils~RetargetOptions ) : AnimationClip (inner) + +Retargets the animation clip of the source object to the target 3D object. + +**target** + +The target 3D object. + +**source** + +The source 3D object. + +**clip** + +The animation clip. + +**options** + +The options. + +**Returns:** The retargeted animation clip. + +## Type Definitions + +### .RetargetOptions + +Retarget options of `SkeletonUtils`. + +**useFirstFramePosition** +boolean + +Whether to use the position of the first frame or not. + +Default is `false`. + +**fps** +number + +The FPS of the clip. + +**names** +Object. + +A dictionary for mapping target to source bone names. + +**getBoneName** +function + +A function for mapping bone names. Alternative to `names`. + +**trim** +Array. + +Whether to trim the clip or not. If set the array should hold two values for the start and end. + +**preserveBoneMatrix** +boolean + +Whether to preserve bone matrices or not. + +Default is `true`. + +**preserveBonePositions** +boolean + +Whether to preserve bone positions or not. + +Default is `true`. + +**useTargetMatrix** +boolean + +Whether to use the target matrix or not. + +Default is `false`. + +**hip** +string + +The name of the source's hip bone. + +Default is `'hip'`. + +**hipInfluence** +[Vector3](Vector3.html) + +The hip influence. + +Default is `(1,1,1)`. + +**scale** +number + +The scale. + +Default is `1`. + +## Source + +[examples/jsm/utils/SkeletonUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SkeletonUtils.js) \ No newline at end of file diff --git a/docs/pages/module-SobelOperatorShader.html.md b/docs/pages/module-SobelOperatorShader.html.md new file mode 100644 index 00000000000000..4d8dc0e9ee3a04 --- /dev/null +++ b/docs/pages/module-SobelOperatorShader.html.md @@ -0,0 +1,21 @@ +# SobelOperatorShader + +## Import + +SobelOperatorShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SobelOperatorShader } from 'three/addons/shaders/SobelOperatorShader.js'; +``` + +## Properties + +### .SobelOperatorShader : ShaderMaterial~Shader (inner, constant) + +Sobel Edge Detection (see [https://youtu.be/uihBwtPIBxM](https://youtu.be/uihBwtPIBxM)). + +As mentioned in the video the Sobel operator expects a grayscale image as input. + +## Source + +[examples/jsm/shaders/SobelOperatorShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/SobelOperatorShader.js) \ No newline at end of file diff --git a/docs/pages/module-SortUtils.html.md b/docs/pages/module-SortUtils.html.md new file mode 100644 index 00000000000000..6e5145b5013d53 --- /dev/null +++ b/docs/pages/module-SortUtils.html.md @@ -0,0 +1,32 @@ +# SortUtils + +## Import + +SortUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as SortUtils from 'three/addons/utils/SortUtils.js'; +``` + +## Static Methods + +### .radixSort( arr : Array., opt : Object ) + +Hybrid radix sort from. + +* [https://gist.github.com/sciecode/93ed864dd77c5c8803c6a86698d68dab](https://gist.github.com/sciecode/93ed864dd77c5c8803c6a86698d68dab) +* [https://github.com/mrdoob/three.js/pull/27202#issuecomment-1817640271](https://github.com/mrdoob/three.js/pull/27202#issuecomment-1817640271) + +Expects unsigned 32b integer values. + +**arr** + +The array to sort. + +**opt** + +The options + +## Source + +[examples/jsm/utils/SortUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/SortUtils.js) \ No newline at end of file diff --git a/docs/pages/module-SubsurfaceScatteringShader.html.md b/docs/pages/module-SubsurfaceScatteringShader.html.md new file mode 100644 index 00000000000000..77fb95d9082c1c --- /dev/null +++ b/docs/pages/module-SubsurfaceScatteringShader.html.md @@ -0,0 +1,21 @@ +# SubsurfaceScatteringShader + +## Import + +SubsurfaceScatteringShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { SubsurfaceScatteringShader } from 'three/addons/shaders/SubsurfaceScatteringShader.js'; +``` + +## Properties + +### .SubsurfaceScatteringShader : ShaderMaterial~Shader (inner, constant) + +Subsurface Scattering shader. + +Based on GDC 2011 – [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) + +## Source + +[examples/jsm/shaders/SubsurfaceScatteringShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/SubsurfaceScatteringShader.js) \ No newline at end of file diff --git a/docs/pages/module-Text2D.html.md b/docs/pages/module-Text2D.html.md new file mode 100644 index 00000000000000..361ad44da7eae9 --- /dev/null +++ b/docs/pages/module-Text2D.html.md @@ -0,0 +1,29 @@ +# Text2D + +## Import + +Text2D is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as Text2D from 'three/addons/webxr/Text2D.js'; +``` + +## Methods + +### .createText( message : string, height : number ) : Mesh (inner) + +A helper function for creating a simple plane mesh that can be used as a text label. The mesh's material holds a canvas texture that displays the given message. + +**message** + +The message to display. + +**height** + +The labels height. + +**Returns:** The plane mesh representing a text label. + +## Source + +[examples/jsm/webxr/Text2D.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/Text2D.js) \ No newline at end of file diff --git a/docs/pages/module-TriangleBlurShader.html.md b/docs/pages/module-TriangleBlurShader.html.md new file mode 100644 index 00000000000000..228c40e5a1e3e8 --- /dev/null +++ b/docs/pages/module-TriangleBlurShader.html.md @@ -0,0 +1,123 @@ +# TriangleBlurShader + +## Import + +TriangleBlurShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TriangleBlurShader } from 'three/addons/shaders/TriangleBlurShader.js'; +``` + +## Properties + +### .TechnicolorShader : ShaderMaterial~Shader (inner, constant) + +Simulates the look of the two-strip technicolor process popular in early 20th century films. More historical info here: [http://www.widescreenmuseum.com/oldcolor/technicolor1.htm](http://www.widescreenmuseum.com/oldcolor/technicolor1.htm) Demo here: [http://charliehoey.com/technicolor\_shader/shader\_test.html](http://charliehoey.com/technicolor_shader/shader_test.html) + +### .ToonShader1 : ShaderMaterial~Shader (inner, constant) + +Toon1 shader. + +### .ToonShader2 : Object (inner, constant) + +Toon2 shader. + +### .ToonShaderDotted : Object (inner, constant) + +Toon Dotted shader. + +### .ToonShaderHatching : Object (inner, constant) + +Toon Hatching shader. + +### .TriangleBlurShader : ShaderMaterial~Shader (inner, constant) + +Triangle blur shader based on [glfx.js triangle blur shader](https://github.com/evanw/glfx.js). + +A basic blur filter, which convolves the image with a pyramid filter. The pyramid filter is separable and is applied as two perpendicular triangle filters. + +## Source + +[examples/jsm/shaders/TechnicolorShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/TechnicolorShader.js) + +## Import + +TriangleBlurShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as ToonShader from 'three/addons/shaders/ToonShader.js'; +``` + +Collection of toon shaders. + +## Properties + +### .TechnicolorShader : ShaderMaterial~Shader (inner, constant) + +Simulates the look of the two-strip technicolor process popular in early 20th century films. More historical info here: [http://www.widescreenmuseum.com/oldcolor/technicolor1.htm](http://www.widescreenmuseum.com/oldcolor/technicolor1.htm) Demo here: [http://charliehoey.com/technicolor\_shader/shader\_test.html](http://charliehoey.com/technicolor_shader/shader_test.html) + +### .ToonShader1 : ShaderMaterial~Shader (inner, constant) + +Toon1 shader. + +### .ToonShader2 : Object (inner, constant) + +Toon2 shader. + +### .ToonShaderDotted : Object (inner, constant) + +Toon Dotted shader. + +### .ToonShaderHatching : Object (inner, constant) + +Toon Hatching shader. + +### .TriangleBlurShader : ShaderMaterial~Shader (inner, constant) + +Triangle blur shader based on [glfx.js triangle blur shader](https://github.com/evanw/glfx.js). + +A basic blur filter, which convolves the image with a pyramid filter. The pyramid filter is separable and is applied as two perpendicular triangle filters. + +## Source + +[examples/jsm/shaders/ToonShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/ToonShader.js) + +## Import + +TriangleBlurShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { TriangleBlurShader } from 'three/addons/shaders/TriangleBlurShader.js'; +``` + +## Properties + +### .TechnicolorShader : ShaderMaterial~Shader (inner, constant) + +Simulates the look of the two-strip technicolor process popular in early 20th century films. More historical info here: [http://www.widescreenmuseum.com/oldcolor/technicolor1.htm](http://www.widescreenmuseum.com/oldcolor/technicolor1.htm) Demo here: [http://charliehoey.com/technicolor\_shader/shader\_test.html](http://charliehoey.com/technicolor_shader/shader_test.html) + +### .ToonShader1 : ShaderMaterial~Shader (inner, constant) + +Toon1 shader. + +### .ToonShader2 : Object (inner, constant) + +Toon2 shader. + +### .ToonShaderDotted : Object (inner, constant) + +Toon Dotted shader. + +### .ToonShaderHatching : Object (inner, constant) + +Toon Hatching shader. + +### .TriangleBlurShader : ShaderMaterial~Shader (inner, constant) + +Triangle blur shader based on [glfx.js triangle blur shader](https://github.com/evanw/glfx.js). + +A basic blur filter, which convolves the image with a pyramid filter. The pyramid filter is separable and is applied as two perpendicular triangle filters. + +## Source + +[examples/jsm/shaders/TriangleBlurShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/TriangleBlurShader.js) \ No newline at end of file diff --git a/docs/pages/module-UVsDebug.html.md b/docs/pages/module-UVsDebug.html.md new file mode 100644 index 00000000000000..d80e7c4624f962 --- /dev/null +++ b/docs/pages/module-UVsDebug.html.md @@ -0,0 +1,35 @@ +# UVsDebug + +## Import + +UVsDebug is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { UVsDebug } from 'three/addons/utils/UVsDebug.js'; +``` + +## Methods + +### .UVsDebug( geometry : BufferGeometry, size : number ) : HTMLCanvasElement (inner) + +Function for "unwrapping" and debugging three.js geometries UV mapping. + +```js +document.body.appendChild( UVsDebug( new THREE.SphereGeometry() ) ); +``` + +**geometry** + +The geometry whose uv coordinates should be inspected. + +**size** + +The size of the debug canvas. + +Default is `1024`. + +**Returns:** A canvas element with visualized uv coordinates. + +## Source + +[examples/jsm/utils/UVsDebug.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/UVsDebug.js) \ No newline at end of file diff --git a/docs/pages/module-UniformsUtils.html.md b/docs/pages/module-UniformsUtils.html.md new file mode 100644 index 00000000000000..a75ada7092b979 --- /dev/null +++ b/docs/pages/module-UniformsUtils.html.md @@ -0,0 +1,29 @@ +# UniformsUtils + +Provides utility functions for managing uniforms. + +## Static Methods + +### .cloneUniforms( src : Object ) : Object + +Clones the given uniform definitions by performing a deep-copy. That means if the value of a uniform refers to an object like a Vector3 or Texture, the cloned uniform will refer to a new object reference. + +**src** + +An object representing uniform definitions. + +**Returns:** The cloned uniforms. + +### .mergeUniforms( uniforms : Array ) : Object + +Merges the given uniform definitions into a single object. Since the method internally uses cloneUniforms(), it performs a deep-copy when producing the merged uniform definitions. + +**uniforms** + +An array of objects containing uniform definitions. + +**Returns:** The merged uniforms. + +## Source + +[src/renderers/shaders/UniformsUtils.js](https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/UniformsUtils.js) \ No newline at end of file diff --git a/docs/pages/module-UnpackDepthRGBAShader.html.md b/docs/pages/module-UnpackDepthRGBAShader.html.md new file mode 100644 index 00000000000000..7436643ed3449a --- /dev/null +++ b/docs/pages/module-UnpackDepthRGBAShader.html.md @@ -0,0 +1,19 @@ +# UnpackDepthRGBAShader + +## Import + +UnpackDepthRGBAShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { UnpackDepthRGBAShader } from 'three/addons/shaders/UnpackDepthRGBAShader.js'; +``` + +## Properties + +### .UnpackDepthRGBAShader : ShaderMaterial~Shader (inner, constant) + +Depth visualization shader that shows depth values as monochrome color. + +## Source + +[examples/jsm/shaders/UnpackDepthRGBAShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/UnpackDepthRGBAShader.js) \ No newline at end of file diff --git a/docs/pages/module-VelocityShader.html.md b/docs/pages/module-VelocityShader.html.md new file mode 100644 index 00000000000000..10c8710480a693 --- /dev/null +++ b/docs/pages/module-VelocityShader.html.md @@ -0,0 +1,19 @@ +# VelocityShader + +## Import + +VelocityShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VelocityShader } from 'three/addons/shaders/VelocityShader.js'; +``` + +## Properties + +### .VelocityShader : ShaderMaterial~Shader (inner, constant) + +Mesh velocity shader by @bhouston. + +## Source + +[examples/jsm/shaders/VelocityShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/VelocityShader.js) \ No newline at end of file diff --git a/docs/pages/module-VerticalBlurShader.html.md b/docs/pages/module-VerticalBlurShader.html.md new file mode 100644 index 00000000000000..8cd1fd4822d8d1 --- /dev/null +++ b/docs/pages/module-VerticalBlurShader.html.md @@ -0,0 +1,28 @@ +# VerticalBlurShader + +## Import + +VerticalBlurShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VerticalBlurShader } from 'three/addons/shaders/VerticalBlurShader.js'; +``` + +## Properties + +### .VerticalBlurShader : ShaderMaterial~Shader (inner, constant) + +Two pass Gaussian blur filter (horizontal and vertical blur shaders) + +* see [http://www.cake23.de/traveling-wavefronts-lit-up.html](http://www.cake23.de/traveling-wavefronts-lit-up.html) + +* 9 samples per pass + +* standard deviation 2.7 + +* "h" and "v" parameters should be set to "1 / width" and "1 / height" + + +## Source + +[examples/jsm/shaders/VerticalBlurShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/VerticalBlurShader.js) \ No newline at end of file diff --git a/docs/pages/module-VerticalTiltShiftShader.html.md b/docs/pages/module-VerticalTiltShiftShader.html.md new file mode 100644 index 00000000000000..7890580ca7cd4a --- /dev/null +++ b/docs/pages/module-VerticalTiltShiftShader.html.md @@ -0,0 +1,24 @@ +# VerticalTiltShiftShader + +## Import + +VerticalTiltShiftShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VerticalTiltShiftShader } from 'three/addons/shaders/VerticalTiltShiftShader.js'; +``` + +## Properties + +### .VerticalTiltShiftShader : ShaderMaterial~Shader (inner, constant) + +Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position + +* 9 samples per pass +* standard deviation 2.7 +* "h" and "v" parameters should be set to "1 / width" and "1 / height" +* "r" parameter control where "focused" horizontal line lies + +## Source + +[examples/jsm/shaders/VerticalTiltShiftShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/VerticalTiltShiftShader.js) \ No newline at end of file diff --git a/docs/pages/module-VignetteShader.html.md b/docs/pages/module-VignetteShader.html.md new file mode 100644 index 00000000000000..fd4f0e19e65189 --- /dev/null +++ b/docs/pages/module-VignetteShader.html.md @@ -0,0 +1,19 @@ +# VignetteShader + +## Import + +VignetteShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VignetteShader } from 'three/addons/shaders/VignetteShader.js'; +``` + +## Properties + +### .VignetteShader : ShaderMaterial~Shader (inner, constant) + +Based on [PaintEffect postprocess from ro.me](https://github.com/dataarts/3-dreams-of-black/blob/master/deploy/js/effects/PaintEffect.js). + +## Source + +[examples/jsm/shaders/VignetteShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/VignetteShader.js) \ No newline at end of file diff --git a/docs/pages/module-VolumeShader.html.md b/docs/pages/module-VolumeShader.html.md new file mode 100644 index 00000000000000..ae308079317d11 --- /dev/null +++ b/docs/pages/module-VolumeShader.html.md @@ -0,0 +1,19 @@ +# VolumeShader + +## Import + +VolumeShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { VolumeRenderShader1 } from 'three/addons/shaders/VolumeShader.js'; +``` + +## Properties + +### .VolumeRenderShader1 : ShaderMaterial~Shader (inner, constant) + +Shaders to render 3D volumes using raycasting. The applied techniques are based on similar implementations in the Visvis and Vispy projects. This is not the only approach, therefore it's marked 1. + +## Source + +[examples/jsm/shaders/VolumeShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/VolumeShader.js) \ No newline at end of file diff --git a/docs/pages/module-WaterRefractionShader.html.md b/docs/pages/module-WaterRefractionShader.html.md new file mode 100644 index 00000000000000..77756a0725a242 --- /dev/null +++ b/docs/pages/module-WaterRefractionShader.html.md @@ -0,0 +1,19 @@ +# WaterRefractionShader + +## Import + +WaterRefractionShader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import { WaterRefractionShader } from 'three/addons/shaders/WaterRefractionShader.js'; +``` + +## Properties + +### .WaterRefractionShader : ShaderMaterial~Shader (inner, constant) + +Basic water refraction shader. + +## Source + +[examples/jsm/shaders/WaterRefractionShader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/shaders/WaterRefractionShader.js) \ No newline at end of file diff --git a/docs/pages/module-WebGLTextureUtils.html.md b/docs/pages/module-WebGLTextureUtils.html.md new file mode 100644 index 00000000000000..a54d7cae16a73f --- /dev/null +++ b/docs/pages/module-WebGLTextureUtils.html.md @@ -0,0 +1,39 @@ +# WebGLTextureUtils + +## Import + +WebGLTextureUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as WebGLTextureUtils from 'three/addons/utils/WebGLTextureUtils.js'; +``` + +## Static Methods + +### .decompress( texture : CompressedTexture, maxTextureSize : number, renderer : WebGLRenderer ) : CanvasTexture + +Returns an uncompressed version of the given compressed texture. + +This module can only be used with [WebGLRenderer](WebGLRenderer.html). When using [WebGPURenderer](WebGPURenderer.html), import the function from [WebGPUTextureUtils](WebGPUTextureUtils.html). + +**texture** + +The compressed texture. + +**maxTextureSize** + +The maximum size of the uncompressed texture. + +Default is `Infinity`. + +**renderer** + +A reference to a renderer. + +Default is `null`. + +**Returns:** The uncompressed texture. + +## Source + +[examples/jsm/utils/WebGLTextureUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/WebGLTextureUtils.js) \ No newline at end of file diff --git a/docs/pages/module-WebGPUTextureUtils.html.md b/docs/pages/module-WebGPUTextureUtils.html.md new file mode 100644 index 00000000000000..04d1d5377e1de4 --- /dev/null +++ b/docs/pages/module-WebGPUTextureUtils.html.md @@ -0,0 +1,39 @@ +# WebGPUTextureUtils + +## Import + +WebGPUTextureUtils is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation). + +```js +import * as WebGPUTextureUtils from 'three/addons/utils/WebGPUTextureUtils.js'; +``` + +## Static Methods + +### .decompress( blitTexture : CompressedTexture, maxTextureSize : number, renderer : WebGPURenderer ) : Promise. (async) + +Returns an uncompressed version of the given compressed texture. + +This module can only be used with [WebGPURenderer](WebGPURenderer.html). When using [WebGLRenderer](WebGLRenderer.html), import the function from [WebGLTextureUtils](WebGLTextureUtils.html). + +**blitTexture** + +The compressed texture. + +**maxTextureSize** + +The maximum size of the uncompressed texture. + +Default is `Infinity`. + +**renderer** + +A reference to a renderer. + +Default is `null`. + +**Returns:** A Promise that resolved with the uncompressed texture. + +## Source + +[examples/jsm/utils/WebGPUTextureUtils.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/WebGPUTextureUtils.js) \ No newline at end of file diff --git a/llms.txt b/llms.txt new file mode 100644 index 00000000000000..a25276a1c39a9d --- /dev/null +++ b/llms.txt @@ -0,0 +1,7 @@ +# Three.js + +> Three.js is a cross-browser JavaScript library for creating 3D graphics using WebGL and WebGPU. + +See the full documentation for LLMs at: https://threejs.org/docs/llms.txt + +For complete inline documentation including TSL: https://threejs.org/docs/llms-full.txt diff --git a/package-lock.json b/package-lock.json index 191f0c33bf4e84..fad75c3be527ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,8 @@ "pngjs": "^7.0.0", "puppeteer": "^24.25.0", "qunit": "^2.19.4", - "rollup": "^4.6.0" + "rollup": "^4.6.0", + "turndown": "^7.2.2" } }, "node_modules/@babel/code-frame": { @@ -398,6 +399,13 @@ "dev": true, "license": "CC0-1.0" }, + "node_modules/@mixmark-io/domino": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@mixmark-io/domino/-/domino-2.2.0.tgz", + "integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==", + "dev": true, + "license": "BSD-2-Clause" + }, "node_modules/@puppeteer/browsers": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.11.0.tgz", @@ -3552,6 +3560,16 @@ "dev": true, "license": "0BSD" }, + "node_modules/turndown": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/turndown/-/turndown-7.2.2.tgz", + "integrity": "sha512-1F7db8BiExOKxjSMU2b7if62D/XOyQyZbPKq/nUwopfgnHlqXHqQ0lvfUTeUIr1lZJzOPFn43dODyMSIfvWRKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@mixmark-io/domino": "^2.2.0" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index e3d41a85f8b704..b349e606da9b73 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,9 @@ "start": "npm run dev", "test": "npm run lint && npm run test-unit && npm run test-unit-addons", "build": "rollup -c utils/build/rollup.config.js", + "build-docs": "jsdoc -c utils/docs/jsdoc.config.json && npm run build-llms", + "build-llms": "node utils/llms/build.js", "build-module": "rollup -c utils/build/rollup.config.js --configOnlyModule", - "build-docs": "jsdoc -c utils/docs/jsdoc.config.json", "dev": "node utils/build/dev.js && node utils/server.js -p 8080", "preview": "node utils/build/preview.js", "lint-core": "eslint src", @@ -106,7 +107,8 @@ "magic-string": "^0.30.0", "puppeteer": "^24.25.0", "qunit": "^2.19.4", - "rollup": "^4.6.0" + "rollup": "^4.6.0", + "turndown": "^7.2.2" }, "jspm": { "files": [ diff --git a/utils/llms/build.js b/utils/llms/build.js new file mode 100644 index 00000000000000..26f52de88078c8 --- /dev/null +++ b/utils/llms/build.js @@ -0,0 +1,634 @@ +import fs from 'fs'; +import path from 'path'; +import TurndownService from 'turndown'; + +// Read package.json to get current version +const packageJson = JSON.parse( fs.readFileSync( 'package.json', 'utf8' ) ); +const version = packageJson.version; + +// Read TSL specification +const tslSpec = fs.readFileSync( 'docs/TSL.md', 'utf8' ); + +// Setup Turndown for HTML to Markdown conversion +const turndown = new TurndownService( { + headingStyle: 'atx', + codeBlockStyle: 'fenced' +} ); + +// Code blocks - assume JavaScript +turndown.addRule( 'codeBlocks', { + filter: [ 'pre' ], + replacement: function ( content ) { + + return '\n```js\n' + content.trim() + '\n```\n'; + + } +} ); + +// Simplify member/method headings: ".[name](#name)" -> ".name" +turndown.addRule( 'memberHeadings', { + filter: function ( node ) { + + return node.tagName === 'H3' && node.classList.contains( 'name' ); + + }, + replacement: function ( content, node ) { + + // Extract the clean signature without anchor links + let text = node.textContent.trim(); + // Clean up extra whitespace + text = text.replace( /\s+/g, ' ' ); + return '\n### ' + text + '\n'; + + } +} ); + +// Simplify type signatures in spans +turndown.addRule( 'typeSignatures', { + filter: function ( node ) { + + return node.tagName === 'SPAN' && node.classList.contains( 'type-signature' ); + + }, + replacement: function ( content, node ) { + + // Just return the text content without links + return ' : ' + node.textContent.trim(); + + } +} ); + +// Clean up inheritance chain (p.inheritance) +turndown.addRule( 'inheritance', { + filter: function ( node ) { + + return node.tagName === 'P' && node.classList.contains( 'inheritance' ); + + }, + replacement: function ( content, node ) { + + // Convert to simple text chain + const text = node.textContent.trim(); + if ( ! text ) return ''; + return '*Inheritance: ' + text + '*\n\n'; + + } +} ); + +// Root llms.txt - simple pointer file +const rootLlms = `# Three.js + +> Three.js is a cross-browser JavaScript library for creating 3D graphics using WebGL and WebGPU. + +See the full documentation for LLMs at: https://threejs.org/docs/llms.txt + +For complete inline documentation including TSL: https://threejs.org/docs/llms-full.txt +`; + +// Docs llms.txt - main documentation index with instructions +const docsLlms = `# Three.js + +> Three.js is a cross-browser JavaScript library for creating 3D graphics using WebGL and WebGPU. + +## Instructions for Large Language Models + +When generating Three.js code, follow these guidelines: + +### 1. Use Import Maps (Not Old CDN Patterns) + +WRONG - outdated pattern: +\`\`\`html + +\`\`\` + +CORRECT - modern pattern (always use latest version): +\`\`\`html + + +\`\`\` + +### 2. Choosing Between WebGLRenderer and WebGPURenderer + +Three.js maintains both renderers: + +**Use WebGLRenderer** (default, mature): +- Maximum browser compatibility +- Well-established, many years of development +- Most examples and tutorials use this + +\`\`\`js +import * as THREE from 'three'; +const renderer = new THREE.WebGLRenderer(); +\`\`\` + +**Use WebGPURenderer** when you need: +- Custom shaders/materials using TSL (Three.js Shading Language) +- Compute shaders +- Advanced node-based materials + +\`\`\`js +import * as THREE from 'three/webgpu'; +const renderer = new THREE.WebGPURenderer(); +await renderer.init(); +\`\`\` + +### 3. TSL (Three.js Shading Language) + +When using WebGPURenderer, use TSL instead of raw GLSL for custom materials: + +\`\`\`js +import { texture, uv, color } from 'three/tsl'; + +const material = new THREE.MeshStandardNodeMaterial(); +material.colorNode = texture( myTexture ).mul( color( 0xff0000 ) ); +\`\`\` + +TSL benefits: +- Works with both WebGL and WebGPU backends +- No string manipulation or onBeforeCompile hacks +- Type-safe, composable shader nodes +- Automatic optimization + +### 4. NodeMaterial Classes (for WebGPU/TSL) + +When using TSL, use node-based materials: +- MeshBasicNodeMaterial +- MeshStandardNodeMaterial +- MeshPhysicalNodeMaterial +- LineBasicNodeMaterial +- SpriteNodeMaterial + +## Getting Started + +- [Installation](https://threejs.org/manual/#en/installation) +- [Creating a Scene](https://threejs.org/manual/#en/creating-a-scene) +- [Fundamentals](https://threejs.org/manual/#en/fundamentals) +- [Responsive Design](https://threejs.org/manual/#en/responsive) + +## Renderer Guides + +- [WebGPURenderer](https://threejs.org/manual/#en/webgpurenderer) + +## Core Concepts + +- [TSL Specification](https://threejs.org/docs/#api/en/nodes/TSL): Complete shader language reference +- [Animation System](https://threejs.org/manual/#en/animation-system) +- [Loading 3D Models](https://threejs.org/manual/#en/loading-3d-models) +- [Scene Graph](https://threejs.org/manual/#en/scenegraph) +- [Materials](https://threejs.org/manual/#en/materials) +- [Textures](https://threejs.org/manual/#en/textures) +- [Lights](https://threejs.org/manual/#en/lights) +- [Cameras](https://threejs.org/manual/#en/cameras) +- [Shadows](https://threejs.org/manual/#en/shadows) + +## Essential API + +### Core +- [Object3D](https://threejs.org/docs/#api/en/core/Object3D) +- [BufferGeometry](https://threejs.org/docs/#api/en/core/BufferGeometry) +- [BufferAttribute](https://threejs.org/docs/#api/en/core/BufferAttribute) + +### Scenes +- [Scene](https://threejs.org/docs/#api/en/scenes/Scene) + +### Cameras +- [PerspectiveCamera](https://threejs.org/docs/#api/en/cameras/PerspectiveCamera) +- [OrthographicCamera](https://threejs.org/docs/#api/en/cameras/OrthographicCamera) + +### Renderers +- [WebGLRenderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) +- [WebGPURenderer](https://threejs.org/docs/#api/en/renderers/webgpu/WebGPURenderer) + +### Objects +- [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) +- [InstancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh) +- [Group](https://threejs.org/docs/#api/en/objects/Group) + +### Materials +- [MeshBasicMaterial](https://threejs.org/docs/#api/en/materials/MeshBasicMaterial) +- [MeshStandardMaterial](https://threejs.org/docs/#api/en/materials/MeshStandardMaterial) +- [MeshPhysicalMaterial](https://threejs.org/docs/#api/en/materials/MeshPhysicalMaterial) + +### Geometries +- [BoxGeometry](https://threejs.org/docs/#api/en/geometries/BoxGeometry) +- [SphereGeometry](https://threejs.org/docs/#api/en/geometries/SphereGeometry) +- [PlaneGeometry](https://threejs.org/docs/#api/en/geometries/PlaneGeometry) + +### Lights +- [AmbientLight](https://threejs.org/docs/#api/en/lights/AmbientLight) +- [DirectionalLight](https://threejs.org/docs/#api/en/lights/DirectionalLight) +- [PointLight](https://threejs.org/docs/#api/en/lights/PointLight) +- [SpotLight](https://threejs.org/docs/#api/en/lights/SpotLight) + +### Loaders +- [TextureLoader](https://threejs.org/docs/#api/en/loaders/TextureLoader) +- [GLTFLoader](https://threejs.org/docs/#examples/en/loaders/GLTFLoader) + +### Controls +- [OrbitControls](https://threejs.org/docs/#examples/en/controls/OrbitControls) +- [TransformControls](https://threejs.org/docs/#examples/en/controls/TransformControls) + +### Math +- [Vector2](https://threejs.org/docs/#api/en/math/Vector2) +- [Vector3](https://threejs.org/docs/#api/en/math/Vector3) +- [Matrix4](https://threejs.org/docs/#api/en/math/Matrix4) +- [Quaternion](https://threejs.org/docs/#api/en/math/Quaternion) +- [Color](https://threejs.org/docs/#api/en/math/Color) +`; + +// Docs llms-full.txt - complete inline documentation +const docsLlmsFull = `# Three.js + +> Three.js is a cross-browser JavaScript library for creating 3D graphics using WebGL and WebGPU. + +## Instructions for Large Language Models + +When generating Three.js code, follow these guidelines: + +### 1. Use Import Maps (Not Old CDN Patterns) + +WRONG - outdated pattern: +\`\`\`html + +\`\`\` + +CORRECT - modern pattern (always use latest version): +\`\`\`html + + +\`\`\` + +### 2. Choosing Between WebGLRenderer and WebGPURenderer + +Three.js maintains both renderers: + +**Use WebGLRenderer** (default, mature): +- Maximum browser compatibility +- Well-established, many years of development +- Most examples and tutorials use this + +\`\`\`js +import * as THREE from 'three'; +const renderer = new THREE.WebGLRenderer(); +\`\`\` + +**Use WebGPURenderer** when you need: +- Custom shaders/materials using TSL (Three.js Shading Language) +- Compute shaders +- Advanced node-based materials + +\`\`\`js +import * as THREE from 'three/webgpu'; +const renderer = new THREE.WebGPURenderer(); +await renderer.init(); +\`\`\` + +### 3. TSL (Three.js Shading Language) + +When using WebGPURenderer, use TSL instead of raw GLSL for custom materials: + +\`\`\`js +import { texture, uv, color } from 'three/tsl'; + +const material = new THREE.MeshStandardNodeMaterial(); +material.colorNode = texture( myTexture ).mul( color( 0xff0000 ) ); +\`\`\` + +TSL benefits: +- Works with both WebGL and WebGPU backends +- No string manipulation or onBeforeCompile hacks +- Type-safe, composable shader nodes +- Automatic optimization + +### 4. NodeMaterial Classes (for WebGPU/TSL) + +When using TSL, use node-based materials: +- MeshBasicNodeMaterial +- MeshStandardNodeMaterial +- MeshPhysicalNodeMaterial +- LineBasicNodeMaterial +- SpriteNodeMaterial + +--- + +## Complete Code Examples + +### Basic Scene with WebGLRenderer + +\`\`\`html + + + + + Three.js Basic Scene + + + + + + + +\`\`\` + +### Basic Scene with WebGPURenderer and TSL + +\`\`\`html + + + + + Three.js WebGPU Scene + + + + + + + +\`\`\` + +### Loading a GLTF Model + +\`\`\`js +import * as THREE from 'three'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +const loader = new GLTFLoader(); + +loader.load( + 'model.glb', + ( gltf ) => { + scene.add( gltf.scene ); + }, + ( progress ) => { + console.log( ( progress.loaded / progress.total * 100 ) + '% loaded' ); + }, + ( error ) => { + console.error( 'Error loading model:', error ); + } +); +\`\`\` + +--- + +# TSL (Three.js Shading Language) - Complete Reference + +${tslSpec} +`; + +// Generate .md versions of all HTML doc pages +const docsDir = 'docs/pages'; +const htmlFiles = fs.readdirSync( docsDir ).filter( f => f.endsWith( '.html' ) ); + +const mdFiles = []; + +for ( const file of htmlFiles ) { + + const htmlPath = path.join( docsDir, file ); + const html = fs.readFileSync( htmlPath, 'utf8' ); + + // Extract just the body content + const bodyMatch = html.match( /]*>([\s\S]*)<\/body>/i ); + if ( ! bodyMatch ) continue; + + const bodyHtml = bodyMatch[ 1 ]; + const markdown = turndown.turndown( bodyHtml ); + + // Write .md file alongside HTML + const mdPath = htmlPath + '.md'; + fs.writeFileSync( mdPath, markdown ); + + // Track for listing + const name = file.replace( '.html', '' ); + mdFiles.push( name ); + +} + +// Categorize files by naming patterns +function categorize( name ) { + + // Skip internal/index files + if ( name === 'index' || name === 'global' ) return null; + + // Specific patterns (order matters - more specific first) + if ( /Loader$/.test( name ) ) return 'Loaders'; + if ( /Geometry$/.test( name ) ) return 'Geometries'; + if ( /Material$/.test( name ) ) return 'Materials'; + if ( /NodeMaterial$/.test( name ) ) return 'Materials'; + if ( /Light$/.test( name ) ) return 'Lights'; + if ( /Camera$/.test( name ) ) return 'Cameras'; + if ( /Controls$/.test( name ) ) return 'Controls'; + if ( /Helper$/.test( name ) ) return 'Helpers'; + if ( /Curve/.test( name ) ) return 'Curves'; + if ( /Pass$/.test( name ) || /PassNode$/.test( name ) ) return 'Post-Processing'; + if ( /Node$/.test( name ) ) return 'Nodes (TSL)'; + if ( /Texture$/.test( name ) ) return 'Textures'; + if ( /Animation/.test( name ) ) return 'Animation'; + if ( /Audio/.test( name ) ) return 'Audio'; + if ( /XR/.test( name ) ) return 'WebXR'; + if ( /Effect$/.test( name ) ) return 'Effects'; + if ( /^Vector|^Matrix|^Quaternion|^Euler|^Color$|^Box|^Sphere|^Ray|^Plane|^Frustum|^Triangle/.test( name ) ) return 'Math'; + if ( /^module-/.test( name ) ) return 'Shader Modules'; + + return 'Core'; + +} + +const categories = {}; + +for ( const name of mdFiles ) { + + const category = categorize( name ); + if ( ! category ) continue; + + if ( ! categories[ category ] ) categories[ category ] = []; + categories[ category ].push( name ); + +} + +// Sort categories and items within each +const categoryOrder = [ + 'Core', 'Cameras', 'Lights', 'Materials', 'Geometries', 'Textures', + 'Loaders', 'Controls', 'Helpers', 'Animation', 'Audio', 'Math', + 'Curves', 'Effects', 'Post-Processing', 'Nodes (TSL)', 'WebXR', 'Shader Modules' +]; + +let categorizedList = ''; + +for ( const category of categoryOrder ) { + + if ( ! categories[ category ] ) continue; + + categories[ category ].sort(); + categorizedList += `\n### ${category}\n\n`; + categorizedList += categories[ category ] + .map( name => `- [${name}](https://threejs.org/docs/pages/${name}.html.md)` ) + .join( '\n' ); + categorizedList += '\n'; + +} + +// Build documentation list for llms-full.txt +const docsList = ` + +--- + +## Available Documentation + +The following documentation pages are available in markdown format at \`https://threejs.org/docs/pages/{Name}.html.md\`: +${categorizedList}`; + +// Write files +fs.writeFileSync( 'llms.txt', rootLlms ); +fs.writeFileSync( 'docs/llms.txt', docsLlms ); +fs.writeFileSync( 'docs/llms-full.txt', docsLlmsFull + docsList ); + +console.log( `Generated llms.txt files for Three.js v${version}` ); +console.log( ' - llms.txt (root)' ); +console.log( ' - docs/llms.txt' ); +console.log( ' - docs/llms-full.txt' ); +console.log( ` - ${mdFiles.length} doc pages converted to .md` );