123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../../" />
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- <h1>[name]</h1>
- <p class="desc">
- The WebGL renderer displays your beautifully crafted scenes using
- [link:https://en.wikipedia.org/wiki/WebGL WebGL].
- </p>
- <h2>Constructor</h2>
- <h3>[name]( [param:Object parameters] )</h3>
- <p>
- [page:Object parameters] - (optional) object with properties defining the
- renderer's behavior. The constructor also accepts no parameters at all.
- In all cases, it will assume sane defaults when parameters are missing.
- The following are valid parameters:<br /><br />
- [page:DOMElement canvas] - A
- [link:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas canvas]
- where the renderer draws its output. This corresponds to the
- [page:WebGLRenderer.domElement domElement] property below. If not passed
- in here, a new canvas element will be created.<br />
- [page:WebGLRenderingContext context] - This can be used to attach the
- renderer to an existing
- [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext RenderingContext]. Default is null.<br />
- [page:String precision] - Shader precision. Can be `"highp"`, `"mediump"`
- or `"lowp"`. Defaults to `"highp"` if supported by the device.<br />
- [page:Boolean alpha] - controls the default clear alpha value. When set to
- `true`, the value is `0`. Otherwise it's `1`. Default is `false`.<br />
- [page:Boolean premultipliedAlpha] - whether the renderer will assume that
- colors have
- [link:https://en.wikipedia.org/wiki/Glossary_of_computer_graphics#Premultiplied_alpha premultiplied alpha].
- Default is `true`.<br />
- [page:Boolean antialias] - whether to perform antialiasing. Default is
- `false`.<br />
- [page:Boolean stencil] - whether the drawing buffer has a
- [link:https://en.wikipedia.org/wiki/Stencil_buffer stencil buffer] of at
- least 8 bits. Default is `false`.<br />
- [page:Boolean preserveDrawingBuffer] - whether to preserve the buffers
- until manually cleared or overwritten. Default is `false`.<br />
- [page:String powerPreference] - Provides a hint to the user agent
- indicating what configuration of GPU is suitable for this WebGL context.
- Can be `"high-performance"`, `"low-power"` or `"default"`. Default is
- `"default"`. See
- [link:https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2 WebGL spec] for details.<br />
- [page:Boolean failIfMajorPerformanceCaveat] - whether the renderer
- creation will fail upon low performance is detected. Default is `false`.
- See [link:https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2 WebGL spec] for details.<br />
- [page:Boolean depth] - whether the drawing buffer has a
- [link:https://en.wikipedia.org/wiki/Z-buffering depth buffer] of at least
- 16 bits. Default is `true`.<br />
- [page:Boolean logarithmicDepthBuffer] - 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
- [link:https://www.khronos.org/opengl/wiki/Early_Fragment_Test Early Fragment Test]
- optimization and can cause a decrease in performance.
- Default is `false`. See the [example:webgl_camera_logarithmicdepthbuffer camera / logarithmicdepthbuffer] example.
- [page:Boolean reverseDepthBuffer] - 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`.
- </p>
- <h2>Properties</h2>
- <h3>[property:Boolean autoClear]</h3>
- <p>
- Defines whether the renderer should automatically clear its output before
- rendering a frame. Default is `true`.
- </p>
- <h3>[property:Boolean autoClearColor]</h3>
- <p>
- If [page:.autoClear autoClear] is true, defines whether the renderer
- should clear the color buffer. Default is `true`.
- </p>
- <h3>[property:Boolean autoClearDepth]</h3>
- <p>
- If [page:.autoClear autoClear] is true, defines whether the renderer
- should clear the depth buffer. Default is `true`.
- </p>
- <h3>[property:Boolean autoClearStencil]</h3>
- <p>
- If [page:.autoClear autoClear] is true, defines whether the renderer
- should clear the stencil buffer. Default is `true`.
- </p>
- <h3>[property:Object capabilities]</h3>
- <p>
- An object containing details about the capabilities of the current
- [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext RenderingContext].<br />
- - [page:Boolean floatFragmentTextures]: whether the context supports the
- [link:https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_float OES_texture_float] extension.<br />
- - [page:Boolean floatVertexTextures]: `true` if [page:Boolean floatFragmentTextures]
- and [page:Boolean vertexTextures] are both true.<br />
- - [page:Method getMaxAnisotropy](): Returns the maximum available
- anisotropy.<br />
- - [page:Method getMaxPrecision](): Returns the maximum available precision
- for vertex and fragment shaders. <br />
- - [page:Boolean isWebGL2]: `true` if the context in use is a
- WebGL2RenderingContext object.<br />
- - [page:Boolean logarithmicDepthBuffer]: `true` if the [page:parameter logarithmicDepthBuffer]
- was set to true in the constructor.<br />
- - [page:Integer maxAttributes]: The value of `gl.MAX_VERTEX_ATTRIBS`.<br />
- - [page:Integer maxCubemapSize]: The value of
- `gl.MAX_CUBE_MAP_TEXTURE_SIZE`. Maximum height * width of cube map
- textures that a shader can use.<br />
- - [page:Integer maxFragmentUniforms]: The value of
- `gl.MAX_FRAGMENT_UNIFORM_VECTORS`. The number of uniforms that can be used
- by a fragment shader.<br />
- - [page:Integer maxSamples]: The value of `gl.MAX_SAMPLES`. Maximum number
- of samples in context of Multisample anti-aliasing (MSAA).<br />
- - [page:Integer maxTextureSize]: The value of `gl.MAX_TEXTURE_SIZE`.
- Maximum height * width of a texture that a shader use.<br />
- - [page:Integer maxTextures]: The value of `gl.MAX_TEXTURE_IMAGE_UNITS`.
- The maximum number of textures that can be used by a shader.<br />
- - [page:Integer maxVaryings]: The value of `gl.MAX_VARYING_VECTORS`. The
- number of varying vectors that can used by shaders.<br />
- - [page:Integer maxVertexTextures]: The value of
- `gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS`. The number of textures that can be
- used in a vertex shader.<br />
- - [page:Integer maxVertexUniforms]: The value of
- `gl.MAX_VERTEX_UNIFORM_VECTORS`. The maximum number of uniforms that can
- be used in a vertex shader.<br />
- - [page:String precision]: The shader precision currently being used by
- the renderer.<br />
- - [page:Boolean reverseDepthBuffer]: `true` if the [page:parameter reverseDepthBuffer]
- was set to `true` in the constructor and the context
- supports the [link:https://registry.khronos.org/webgl/extensions/EXT_clip_control/ EXT_clip_control] extension.<br />
- - [page:Boolean vertexTextures]: `true` if [property:Integer maxVertexTextures]
- is greater than 0 (i.e. vertex textures can be used).<br />
- </p>
- <h3>[property:Array clippingPlanes]</h3>
- <p>
- User-defined clipping planes specified as THREE.Plane objects in world
- space. These planes apply globally. Points in space whose dot product with
- the plane is negative are cut away. Default is [].
- </p>
- <h3>[property:Object debug]</h3>
- <p>
- - [page:Boolean 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. Default is `true`.<br />
- - [page:Function 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. Default is `null`.
- </p>
-
- <h3>[property:DOMElement domElement]</h3>
- <p>
- A [link:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas canvas]
- where the renderer draws its output.<br />
- 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:<br />
- <code>
- document.body.appendChild( renderer.domElement );
- </code>
- </p>
- <h3>[property:Object extensions]</h3>
- <p>
- - [page:Object get]( [param:String extensionName] ): Used to check whether
- various extensions are supported and returns an object with details of the
- extension if available. This method can check for the following
- extensions:<br />
- </p>
- <ul>
- <li>`WEBGL_depth_texture`</li>
- <li>`EXT_texture_filter_anisotropic`</li>
- <li>`WEBGL_compressed_texture_s3tc`</li>
- <li>`WEBGL_compressed_texture_pvrtc`</li>
- <li>`WEBGL_compressed_texture_etc1`</li>
- </ul>
- <h3>[property:string outputColorSpace]</h3>
- <p>
- Defines the output color space of the renderer. Default is [page:Textures THREE.SRGBColorSpace].
- </p>
- <p>
- If a render target has been set using [page:WebGLRenderer.setRenderTarget .setRenderTarget]
- then renderTarget.texture.colorSpace will be used instead.
- </p>
- <p>
- See the [page:Textures texture constants] page for details of other
- formats.
- </p>
- <h3>[property:Object info]</h3>
- <p>
- An object with a series of statistical information about the graphics
- board memory and the rendering process. Useful for debugging or just for
- the sake of curiosity. The object contains the following fields:
- </p>
- <ul>
- <li>
- memory:
- <ul>
- <li>geometries</li>
- <li>textures</li>
- </ul>
- </li>
- <li>
- render:
- <ul>
- <li>calls</li>
- <li>triangles</li>
- <li>points</li>
- <li>lines</li>
- <li>frame</li>
- </ul>
- </li>
- <li>programs</li>
- </ul>
- <p>
- 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`.
- <code> renderer.info.autoReset = false; </code>
- Call `reset()` whenever you have finished to render a single frame.
- <code> renderer.info.reset(); </code>
- </p>
- <h3>[property:Boolean localClippingEnabled]</h3>
- <p>
- Defines whether the renderer respects object-level clipping planes.
- Default is `false`.
- </p>
- <h3>[property:Object properties]</h3>
- <p>
- Used internally by the renderer to keep track of various sub object
- properties.
- </p>
- <h3>[property:WebGLRenderLists renderLists]</h3>
- <p>Used internally to handle ordering of scene object rendering.</p>
- <h3>[property:WebGLShadowMap shadowMap]</h3>
- <p>
- This contains the reference to the shadow map, if used.<br />
- - [page:Boolean enabled]: If set, use shadow maps in the scene. Default is
- `false`.<br />
- - [page:Boolean autoUpdate]: Enables automatic updates to the shadows in
- the scene. Default is `true`.<br />
- If you do not require dynamic lighting / shadows, you may set this to
- `false` when the renderer is instantiated.<br />
- - [page:Boolean needsUpdate]: When set to `true`, shadow maps in the scene
- will be updated in the next `render` call. Default is `false`.<br />
- If you have disabled automatic updates to shadow maps
- (`shadowMap.autoUpdate = false`), you will need to set this to `true` and
- then make a render call to update the shadows in your scene.<br />
- - [page:Integer type]: Defines shadow map type (unfiltered, percentage
- close filtering, percentage close filtering with bilinear filtering in
- shader). Options are:
- </p>
- <ul>
- <li>THREE.BasicShadowMap</li>
- <li>THREE.PCFShadowMap (default)</li>
- <li>THREE.PCFSoftShadowMap</li>
- <li>THREE.VSMShadowMap</li>
- </ul>
- See [page:Renderer Renderer constants] for details.<br />
- <h3>[property:Boolean sortObjects]</h3>
- <p>
- Defines whether the renderer should sort objects. Default is `true`.<br /><br />
- 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.
- </p>
- <h3>[property:Object state]</h3>
- <p>
- Contains functions for setting various properties of the
- [page:WebGLRenderer.context] state.
- </p>
- <h3>[property:Constant toneMapping]</h3>
- <p>
- Default is [page:Renderer NoToneMapping]. See the [page:Renderer Renderer constants] for other choices.
- </p>
- <h3>[property:Number toneMappingExposure]</h3>
- <p>Exposure level of tone mapping. Default is `1`.</p>
- <h3>[property:WebXRManager xr]</h3>
- <p>
- Provides access to the WebXR related [page:WebXRManager interface] of the
- renderer.
- </p>
- <h2>Methods</h2>
- <h3>
- [method:undefined clear]( [param:Boolean color], [param:Boolean depth], [param:Boolean stencil] )
- </h3>
- <p>
- Tells the renderer to clear its color, depth or stencil drawing buffer(s).
- This method initializes the color buffer to the current clear color
- value.<br />
- Arguments default to `true`.
- </p>
- <h3>[method:undefined clearColor]( )</h3>
- <p>
- Clear the color buffer. Equivalent to calling [page:WebGLRenderer.clear .clear]( true, false, false ).
- </p>
- <h3>[method:undefined clearDepth]( )</h3>
- <p>
- Clear the depth buffer. Equivalent to calling [page:WebGLRenderer.clear .clear]( false, true, false ).
- </p>
- <h3>[method:undefined clearStencil]( )</h3>
- <p>
- Clear the stencil buffers. Equivalent to calling [page:WebGLRenderer.clear .clear]( false, false, true ).
- </p>
- <h3>
- [method:Set compile]( [param:Object3D scene], [param:Camera camera], [param:Scene targetScene] )
- </h3>
- <p>
- 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.<br />
- Note that the (target) scene's lighting and environment should be configured before calling this method.
- </p>
- <h3>
- [method:Promise compileAsync]( [param:Object3D scene], [param:Camera camera], [param:Scene targetScene] )
- </h3>
- <p>
- Asynchronous version of [page:WebGLRenderer.compile .compile](). The method returns a Promise that resolves when the
- given scene can be rendered without unnecessary stalling due to shader compilation.<br /><br />
-
- This method makes use of the *KHR_parallel_shader_compile* WebGL extension.
- </p>
- <h3>
- [method:undefined copyFramebufferToTexture]( [param:FramebufferTexture texture], [param:Vector2 position], [param:Number level] )
- </h3>
- <p>
- Copies pixels from the current WebGLFramebuffer into a 2D texture. Enables
- access to
- [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/copyTexImage2D WebGLRenderingContext.copyTexImage2D].
- </p>
- <h3>
- [method:undefined copyTextureToTexture]( [param:Texture srcTexture], [param:Texture dstTexture], [param:Box2 srcRegion], [param:Vector2 dstPosition], [param:Number level] )
- </h3>
- <p>
- Copies the pixels of a texture in the bounds '[page:Box2 srcRegion]' in
- the destination texture starting from the given position. Enables access
- to
- [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texSubImage2D WebGLRenderingContext.texSubImage2D].
- </p>
- <h3>
- [method:undefined copyTextureToTexture3D]( [param:Texture srcTexture], [param:Texture dstTexture], [param:Box3 srcRegion], [param:Vector3 dstPosition], [param:Number level] )
- </h3>
- <p>
- Copies the pixels of a texture in the bounds '[page:Box3 srcRegion]' in
- the destination texture starting from the given position. Enables access
- to
- [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texSubImage3D WebGL2RenderingContext.texSubImage3D].
- </p>
- <h3>[method:undefined dispose]( )</h3>
- <p>
- Frees the GPU-related resources allocated by this instance. Call this
- method whenever this instance is no longer used in your app.
- </p>
- <h3>[method:undefined forceContextLoss]()</h3>
- <p>
- Simulate loss of the WebGL context. This requires support for the
- [link:https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context WEBGL_lose_context] extensions.
- </p>
- <h3>[method:undefined forceContextRestore]( )</h3>
- <p>
- Simulate restore of the WebGL context. This requires support for the
- [link:https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context WEBGL_lose_context] extensions.
- </p>
- <h3>[method:Float getClearAlpha]()</h3>
- <p>
- Returns a [page:Float float] with the current clear alpha. Ranges from `0`
- to `1`.
- </p>
- <h3>[method:Color getClearColor]( [param:Color target] )</h3>
- <p>
- Returns a [page:Color THREE.Color] instance with the current clear color.
- </p>
- <h3>[method:WebGL2RenderingContext getContext]()</h3>
- <p>Return the current WebGL context.</p>
- <h3>[method:WebGLContextAttributes getContextAttributes]()</h3>
- <p>
- Returns an object that describes the attributes set on the WebGL context
- when it was created.
- </p>
- <h3>[method:Integer getActiveCubeFace]()</h3>
- <p>Returns the current active cube face.</p>
- <h3>[method:Integer getActiveMipmapLevel]()</h3>
- <p>Returns the current active mipmap level.</p>
- <h3>[method:RenderTarget getRenderTarget]()</h3>
- <p>
- Returns the current [page:RenderTarget RenderTarget] if there are; returns
- `null` otherwise.
- </p>
- <h3>[method:Vector4 getCurrentViewport]( [param:Vector4 target] )</h3>
- <p>
- [page:Vector4 target] — the result will be copied into this Vector4.<br /><br />
- Returns the current viewport.
- </p>
- <h3>[method:Vector2 getDrawingBufferSize]( [param:Vector2 target] )</h3>
- <p>
- [page:Vector2 target] — the result will be copied into this Vector2.<br /><br />
- Returns the width and height of the renderer's drawing buffer, in pixels.
- </p>
- <h3>[method:number getPixelRatio]()</h3>
- <p>Returns current device pixel ratio used.</p>
- <h3>[method:Vector4 getScissor]( [param:Vector4 target] )</h3>
- <p>
- [page:Vector4 target] — the result will be copied into this Vector4.<br /><br />
- Returns the scissor region.
- </p>
- <h3>[method:Boolean getScissorTest]()</h3>
- <p>Returns `true` if scissor test is enabled; returns `false` otherwise.</p>
- <h3>[method:Vector2 getSize]( [param:Vector2 target] )</h3>
- <p>
- [page:Vector2 target] — the result will be copied into this Vector2.<br /><br />
- Returns the width and height of the renderer's output canvas, in pixels.
- </p>
- <h3>[method:Vector4 getViewport]( [param:Vector4 target] )</h3>
- <p>
- [page:Vector4 target] — the result will be copied into this Vector4.<br /><br />
- Returns the viewport.
- </p>
- <h3>[method:undefined initTexture]( [param:Texture texture] )</h3>
- <p>
- 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).
- </p>
- <h3>[method:undefined initRenderTarget]( [param:WebGLRenderTarget target] )</h3>
- <p>
- Initializes the given WebGLRenderTarget memory. Useful for initializing a render
- target so data can be copied into it using [page:WebGLRenderer.copyTextureToTexture .copyTextureToTexture]
- before it has been rendered to.
- </p>
- <h3>[method:undefined resetGLState]( )</h3>
- <p>
- Reset the GL state to default. Called internally if the WebGL context is
- lost.
- </p>
- <h3>
- [method:undefined readRenderTargetPixels]( [param:WebGLRenderTarget renderTarget], [param:Float x], [param:Float y], [param:Float width], [param:Float height], [param:TypedArray buffer], [param:Integer activeCubeFaceIndex] )
- </h3>
- <p>
- buffer - Uint8Array is the only destination type supported in all cases,
- other types are renderTarget and platform dependent. See
- [link:https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.12 WebGL spec] for details.
- </p>
- <p>
- Reads the pixel data from the renderTarget into the buffer you pass in.
- This is a wrapper around
- [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels WebGLRenderingContext.readPixels]().
- </p>
- <p>
- For reading out a [page:WebGLCubeRenderTarget WebGLCubeRenderTarget] use
- the optional parameter activeCubeFaceIndex to determine which face should
- be read.
- </p>
- <h3>
- [method:Promise readRenderTargetPixelsAsync]( [param:WebGLRenderTarget renderTarget], [param:Float x], [param:Float y], [param:Float width], [param:Float height], [param:TypedArray buffer], [param:Integer activeCubeFaceIndex] )
- </h3>
- <p>
- Asynchronous, non-blocking version of [page:WebGLRenderer.readRenderTargetPixels .readRenderTargetPixels]. The
- returned promise resolves once the buffer data is ready to be used.
- </p>
- <p>
- See the [example:webgl_interactive_cubes_gpu interactive / cubes / gpu] example.
- </p>
- <h3>
- [method:undefined render]( [param:Object3D scene], [param:Camera camera] )
- </h3>
- <p>
- Render a [page:Scene scene] or another type of [page:Object3D object]
- using a [page:Camera camera].<br />
- The render is done to a previously specified [page:WebGLRenderTarget renderTarget]
- set by calling [page:WebGLRenderer.setRenderTarget .setRenderTarget] or to the canvas as usual.<br />
- By default render buffers are cleared before rendering but you can prevent
- this by setting the property [page:WebGLRenderer.autoClear autoClear] to
- false. If you want to prevent only certain buffers being cleared you can
- set either the [page:WebGLRenderer.autoClearColor autoClearColor],
- [page:WebGLRenderer.autoClearStencil autoClearStencil] or
- [page:WebGLRenderer.autoClearDepth autoClearDepth] properties to false. To
- forcibly clear one or more buffers call [page:WebGLRenderer.clear .clear].
- </p>
- <h3>[method:undefined resetState]()</h3>
- <p>
- 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.
- </p>
- <h3>[method:undefined setAnimationLoop]( [param:Function callback] )</h3>
- <p>
- [page:Function callback] — The function will be called every available
- frame. If `null` is passed it will stop any already ongoing animation.
- </p>
- <p>
- A built in function that can be used instead of
- [link:https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame requestAnimationFrame].
- For WebXR projects this function must be used.
- </p>
- <h3>[method:undefined setClearAlpha]( [param:Float alpha] )</h3>
- <p>Sets the clear alpha. Valid input is a float between `0.0` and `1.0`.</p>
- <h3>
- [method:undefined setClearColor]( [param:Color color], [param:Float alpha] )
- </h3>
- <p>Sets the clear color and opacity.</p>
- <h3>[method:undefined setPixelRatio]( [param:number value] )</h3>
- <p>
- Sets device pixel ratio. This is usually used for HiDPI device to prevent
- blurring output canvas.
- </p>
- <h3>
- [method:undefined setRenderTarget]( [param:WebGLRenderTarget renderTarget],
- [param:Integer activeCubeFace], [param:Integer activeMipmapLevel] )
- </h3>
- <p>
- renderTarget -- The [page:WebGLRenderTarget renderTarget] that needs to be
- activated. When `null` is given, the canvas is set as the active render
- target instead.<br />
- activeCubeFace -- Specifies the active cube side (PX 0, NX 1, PY 2, NY 3,
- PZ 4, NZ 5) of [page:WebGLCubeRenderTarget]. When passing a
- [page:WebGLArrayRenderTarget] or [page:WebGL3DRenderTarget] this indicates
- the z layer to render in to (optional).<br />
- activeMipmapLevel -- Specifies the active mipmap level (optional).<br /><br />
- This method sets the active rendertarget.
- </p>
- <h3>
- [method:undefined setScissor]( [param:Integer x], [param:Integer y], [param:Integer width], [param:Integer height] )<br />
- [method:undefined setScissor]( [param:Vector4 vector] )
- </h3>
- <p>
- The x, y, width, and height parameters of the scissor region.<br />
- Optionally, a 4-component vector specifying the parameters of the
- region.<br /><br />
- Sets the scissor region from (x, y) to (x + width, y + height).<br />
- (x, y) is the lower-left corner of the scissor region.
- </p>
- <h3>[method:undefined setScissorTest]( [param:Boolean boolean] )</h3>
- <p>
- 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.
- </p>
- <h3>[method:undefined setOpaqueSort]( [param:Function method] )</h3>
- <p>
- Sets the custom opaque sort function for the WebGLRenderLists. Pass null
- to use the default painterSortStable function.
- </p>
- <h3>[method:undefined setTransparentSort]( [param:Function method] )</h3>
- <p>
- Sets the custom transparent sort function for the WebGLRenderLists. Pass
- null to use the default reversePainterSortStable function.
- </p>
- <h3>
- [method:undefined setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )
- </h3>
- <p>
- 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 [page:Boolean updateStyle] to false prevents any style changes
- to the output canvas.
- </p>
- <h3>
- [method:undefined setViewport]( [param:Integer x], [param:Integer y], [param:Integer width], [param:Integer height] )<br />
- [method:undefined setViewport]( [param:Vector4 vector] )
- </h3>
- <p>
- The x, y, width, and height parameters of the viewport.<br />
- Optionally, a 4-component vector specifying the parameters of a
- viewport.<br /><br />
- Sets the viewport to render from (x, y) to (x + width, y + height).<br />
- (x, y) is the lower-left corner of the region.
- </p>
- <h2>Source</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </p>
- </body>
- </html>
|