import { WebGLRenderer } from "https://deno.land/x/threejs_4_deno@v121/src/Three.d.ts";
The WebGL renderer displays your beautifully crafted scenes using WebGL, if your device supports it. This renderer has way better performance than CanvasRenderer.
Constructors
parameters is an optional object with properties defining the renderer's behaviour. The constructor also accepts no parameters at all. In all cases, it will assume sane defaults when parameters are missing.
Properties
Defines whether the renderer should automatically clear its output before rendering.
If autoClear is true, defines whether the renderer should clear the color buffer. Default is true.
If autoClear is true, defines whether the renderer should clear the depth buffer. Default is true.
If autoClear is true, defines whether the renderer should clear the stencil buffer. Default is true.
The HTML5 Canvas's 'webgl' context obtained from the canvas where the renderer will draw.
Debug configurations.
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.
Default is LinearEncoding.
Methods
Tells the renderer to clear its color, depth or stencil drawing buffer(s). Arguments default to true
Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first rendering.
Copies a region of the currently bound framebuffer into the selected mipmap level of the selected texture. This region is defined by the size of the destination texture's mip level, offset by the input position.
Copies srcTexture to the specified level of dstTexture, offset by the input position.
Returns the current active cube face.
Returns the current active mipmap level.
Returns a float with the current clear alpha. Ranges from 0 to 1.
Returns a THREE.Color instance with the current clear color.
Return the WebGL context.
Returns the current render target. If no render target is set, null is returned.
Copies the scissor area into target.
Returns true if scissor test is enabled; returns false otherwise.
Copies the viewport into target.
Initializes the given texture. Can be used to preload a texture rather than waiting until first render (which can cause noticeable lags due to decode and GPU upload overhead).
Render a scene or an object using a camera. The render is done to a previously specified WebGLRenderTarget#renderTarget | .renderTarget set by calling WebGLRenderer#setRenderTarget | .setRenderTarget or to the canvas as usual.
By default render buffers are cleared before rendering but you can prevent this by setting the property WebGLRenderer#autoClear | autoClear to false. If you want to prevent only certain buffers being cleared you can set either the WebGLRenderer#autoClearColor | autoClearColor, WebGLRenderer#autoClearStencil | autoClearStencil or WebGLRenderer#autoClearDepth | autoClearDepth properties to false. To forcibly clear one ore more buffers call WebGLRenderer#clear | .clear.
A build in function that can be used instead of requestAnimationFrame. For WebXR projects this function must be used.
Sets the clear color, using color for the color and alpha for the opacity.
Sets the given WebGLFramebuffer. This method can only be used if no render target is set via WebGLRenderer#setRenderTarget | .setRenderTarget.
Sets the custom opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
Sets the active render target.
Sets the scissor area from (x, y) to (x + width, y + height).
Enable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions.
Resizes the output canvas to (width, height), and also sets the viewport to fit that size, starting in (0, 0).
Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function.
Sets the viewport to render from (x, y) to (x + width, y + height). (x, y) is the lower-left corner of the region.